Exemple #1
0
        private IDictionary <int, ICollection <ManagedFeature> > GenerateFeatures(ManagedPlugin plugin, float[] fSampleData, bool showProgress = true)
        {
            int i = 0;
            int j = 0;
            IDictionary <int, ICollection <ManagedFeature> > retVal =
                new ConcurrentDictionary <int, ICollection <ManagedFeature> >();

            BeatsAndBarsProgress progressDlg = new BeatsAndBarsProgress();

            if (showProgress)
            {
                progressDlg.Show();
            }

            int stepSize = plugin.GetPreferredStepSize();

            double progressVal = 0;
            uint   frequency   = (uint)m_audioModule.Frequency;

            if (frequency != 0)
            {
                float[] fSamples = new float[plugin.GetPreferredBlockSize()];
                for (j = 0;
                     ((fSampleData.Length - j) >= plugin.GetPreferredBlockSize());
                     j += stepSize)
                {
                    progressVal = (j / (double)fSampleData.Length) * 100.0;
                    progressDlg.UpdateProgress((int)progressVal);

                    Array.Copy(fSampleData, j, fSamples, 0, fSamples.Length);
                    plugin.Process(fSamples,
                                   ManagedRealtime.frame2RealTime(j, (uint)m_audioModule.Frequency));
                }

                Array.Clear(fSamples, 0, fSamples.Length);
                Array.Copy(fSampleData, j, fSamples, 0, fSampleData.Length - j);
                plugin.Process(fSamples,
                               ManagedRealtime.frame2RealTime(j, (uint)m_audioModule.Frequency));

                progressDlg.Close();

                retVal = plugin.GetRemainingFeatures();
            }

            return(retVal);
        }
Exemple #2
0
		private IDictionary<int, ICollection<ManagedFeature>> GenerateFeatures(ManagedPlugin plugin, float[] fSampleData, bool showProgress = true)
		{
			int i = 0;
			int j = 0;
			IDictionary<int, ICollection<ManagedFeature>> retVal = 
				new ConcurrentDictionary<int, ICollection<ManagedFeature>>();

			BeatsAndBarsProgress progressDlg = new BeatsAndBarsProgress();
			if (showProgress)
			{
				progressDlg.Show();	
			}
			
			int stepSize = plugin.GetPreferredStepSize();

			double progressVal = 0;
			uint frequency = (uint)m_audioModule.Frequency;
			if (frequency != 0)
			{
				float[] fSamples = new float[plugin.GetPreferredBlockSize()];
				for (j = 0;
					((fSampleData.Length - j) >= plugin.GetPreferredBlockSize());
					j += stepSize)
				{
					progressVal = ((double)j / (double)fSampleData.Length) * 100.0;
					progressDlg.UpdateProgress((int)progressVal);

					Array.Copy(fSampleData, j, fSamples, 0, fSamples.Length);
					plugin.Process(fSamples,
							ManagedRealtime.frame2RealTime(j, (uint)m_audioModule.Frequency));
				}

				Array.Clear(fSamples, 0, fSamples.Length);
				Array.Copy(fSampleData, j, fSamples, 0, fSampleData.Length - j);
				plugin.Process(fSamples,
						ManagedRealtime.frame2RealTime(j, (uint)m_audioModule.Frequency));

				progressDlg.Close();

				retVal = plugin.GetRemainingFeatures();	
			}

			return retVal;
		}