Esempio n. 1
0
        public void AddLR(WavData wd, int sampleNum, double start, double end)
        {
            double startTime = wd.RatioToTime(start);
            double endTime   = wd.RatioToTime(end);
            double dt        = (endTime - startTime) / sampleNum;

            short[] left  = wd.GetLeft(sampleNum, start, end);
            short[] right = wd.GetRight(sampleNum, start, end);
            chart.Series.Clear();
            chart.Series.Add("L");
            chart.Series["L"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            for (int i = 0; i < left.Length; i++)
            {
                double x = startTime + dt * i;
                chart.Series["L"].Points.AddXY(x, left[i]);
            }
            chart.Series.Add("R");
            chart.Series["R"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            for (int i = 0; i < right.Length; i++)
            {
                double x = startTime + dt * i;
                chart.Series["R"].Points.AddXY(x, right[i]);
            }
            setXlim(startTime, endTime);
            setYlim(Int16.MinValue + 1, Int16.MaxValue - 1);
        }
Esempio n. 2
0
        short[] ComputeMean(int idx)
        {
            int       left        = 0;
            int       right       = 0;
            ArrayList listUnmuted = GetUnmutedItems();
            int       num         = listUnmuted.Count;
            double    factorL     = 0;
            double    factorR     = 0;

            for (int i = 0; i < num; i++)
            {
                try
                {
                    WavData item = ((ItemSet)listUnmuted[i]).GetData();
                    left    += item.GetLeft(idx);
                    right   += item.GetRight(idx);
                    factorL += Math.Abs(item.GetFactor(idx, WavData.LEFT));
                    factorR += Math.Abs(item.GetFactor(idx, WavData.RIGHT));
                }
                catch (ArgumentOutOfRangeException)
                {
                    // sometimes thrown when item removed while playing
                    // can be ignored
                }
                catch (NullReferenceException)
                {
                    continue;
                }
            }
            if (factorL == 0 && factorR == 0 && avoidAllMute)
            {
                WavData item = GetLastItem().GetData();
                item.IsDefault = true;
                left           = item.GetLeft(idx);
                right          = item.GetRight(idx);
                item.IsDefault = false;
                factorL        = 1;
                factorR        = 1;
            }
            short newLeft, newRight;

            if (factorL > 1 || normalize)
            {
                newLeft = ToShortDevidedBy(left, factorL);
            }
            else
            {
                newLeft = Convert.ToInt16(left);
            }
            if (factorR > 1 || normalize)
            {
                newRight = ToShortDevidedBy(right, factorR);;
            }
            else
            {
                newRight = Convert.ToInt16(right);
            }
            return(new short[] { newLeft, newRight });
        }
Esempio n. 3
0
        public ItemSet(WavData wd) : base(wd.GetName())
        {
            this.wd = wd;
            //if (wd.isMP3()) this.PlotEnable = true;
            SetInit();

            wd.Parent = this;
        }
Esempio n. 4
0
 protected override void Dispose(bool disposing)
 {
     wd.Dispose();
     wd = null;
     if (LRThread != null)
     {
         LRThread.Abort();
         LRThread = null;
     }
     if (TFThread != null)
     {
         TFThread.Abort();
         TFThread = null;
     }
     form.KeyPushed -= HandleKey;
     base.Dispose(disposing);
 }
Esempio n. 5
0
 public DSPSelectWindow(WavData parent)
 {
     myWd = parent;
     Initialize();
 }
Esempio n. 6
0
 public void Play(WavData wd, int PlayPosition)
 {
     position = PlayPosition;
     Play(wd);
 }