static TrackViewModel CreateTrackViewModel(GeneratorModeType generatorModeType)
 {
     PrepareAppState();
     return(new TrackViewModel {
         Name = "Track1", GeneratorMode = generatorModeType
     });
 }
        static MainWindowViewModel CreateMainWindowViewModel(GeneratorModeType generatorModeType)
        {
            PrepareAppState();
            var mainWindowVM = new MainWindowViewModel(loadDefaultPlaylist: false);

            mainWindowVM.PlaylistViewModel.AddNewTrack();
            mainWindowVM.PlaylistViewModel.TrackVMs[0].GeneratorMode = generatorModeType;
            return(mainWindowVM);
        }
Exemple #3
0
        private static PlotSampleViewModel CreatePlotSampleViewModel(GeneratorModeType generatorModeType)
        {
            PrepareAppState();
            ISampleProvider signal = new BasicSignal();

            if (generatorModeType == GeneratorModeType.Stereo)
            {
                signal = signal.ToStereo(1, 0.5f);
            }
            var plotSignal = new PlotSampleProvider(signal);
            var plotVM     = new PlotSampleViewModel(plotSignal);

            plotVM.IsPlotEnable = true;

            var count = Constants.Wave.DefaultSampleRate / 8 * signal.WaveFormat.Channels;

            float[] buffer = Array.Empty <float>();
            buffer = BufferHelpers.Ensure(buffer, count);
            plotVM.SampleSignal.Read(buffer, 0, count);

            return(plotVM);
        }