示例#1
0
        void OpenFile(string filePath)
        {
            Player?.Stop();
            Player?.Dispose();
            PreviewStream?.Dispose();

            MainView.Wave        = null;
            MainView.AudioScale  = null;
            MainView.MessageText = LangResources.ProgressMessage_LoadWave;
            MainView.Progress    = 0.0;
            Lock = true;
            LoadWave(filePath);
        }
示例#2
0
        void ApplyScale(double[] newScale)
        {
            var newF0 = new double[AnalyzedAudio.AnalyzedAudio.FrameLength];

            Buffer.BlockCopy(AnalyzedAudio.AnalyzedAudio.F0, 0, newF0, 0, newF0.Length * sizeof(double));

            for (var i = Math.Min(newScale.Length, newF0.Length) - 1; i > -1; i--)
            {
                if (newF0[i] <= 0.0 || newScale[i] <= 0.0)
                {
                    continue;
                }
                newF0[i] = newScale[i];
            }
            MainView.EditableAudioScale = new AudioScaleModel(newF0, AnalyzedAudio.AnalyzedAudio.FramePeriod, AnalyzedAudio.SampleCount, AnalyzedAudio.SampleRate);

            PreviewStream.Dispose();
            var edited = AnalyzedAudio.AnalyzedAudio.ReplaceF0(newF0);

            PreviewStream = new WaveCacheStream(AudioOperatorPlugins.Find(p => p.GetType() == AnalyzedAudio.OperatorType).Synthesize(edited));
            Player.SetStream(PreviewStream);
        }