private void buttonTest_MouseDown(object sender, MouseEventArgs e) { const double BufferDuration = .25f; IPlayPrefsProvider playPrefsProvider = mainWindow.GetPlayPrefsProvider(); #if true // prevents "Add New Data Source..." from working state = WaveTableTestGeneratorParams<OutputDeviceDestination, OutputDeviceArguments>.Do( mainWindow.DisplayName, OutputDeviceEnumerator.OutputDeviceGetDestination, OutputDeviceEnumerator.CreateOutputDeviceDestinationHandler, new OutputDeviceArguments(BufferDuration), WaveTableTestGeneratorParams<OutputDeviceDestination, OutputDeviceArguments>.MainLoop, generatorParams = new WaveTableTestGeneratorParams<OutputDeviceDestination, OutputDeviceArguments>( waveTableObject.WaveTableData, waveTableObject.TestAttackDuration, waveTableObject.TestDecayDuration, waveTableObject.NumBits, playPrefsProvider.SamplingRate, waveTableObject.TestFrequency), WaveTableTestGeneratorParams<OutputDeviceDestination, OutputDeviceArguments>.Completion, mainWindow, NumChannelsType.eSampleMono, waveTableObject.NumBits, playPrefsProvider.SamplingRate, 1/*oversampling*/, false/*showProgressWindow*/, false/*modal*/); #endif }
bool IMenuStripManagerHandler.ExecuteMenuItem(MenuStripManager menuStrip, ToolStripMenuItem menuItem) { if (menuItem == menuStrip.editNotePropertiesToolStripMenuItem) { EditNoteProperties(); return(true); } else if (menuItem == menuStrip.editTrackPropertiesToolStripMenuItem) { EditTrackProperties(); return(true); } else if (menuItem == menuStrip.selectAllToolStripMenuItem) { trackViewControl.TrackViewSelectAll(); return(true); } else if (menuItem == menuStrip.pasteToolStripMenuItem) { trackViewControl.TrackViewAttemptPaste(); return(true); } else if (menuItem == menuStrip.clearToolStripMenuItem) { if (trackViewControl.TrackViewIsASingleNoteSelected() || trackViewControl.TrackViewIsASingleCommandSelected()) { trackViewControl.TrackViewDeleteSingleNoteOrCommand(); } else if (trackViewControl.TrackViewIsARangeSelected()) { trackViewControl.TrackViewDeleteRangeSelection(); } trackViewControl.TrackViewShowSelection(); return(true); } else if (menuItem == menuStrip.cutToolStripMenuItem) { trackViewControl.TrackViewCutRangeSelection(); trackViewControl.TrackViewShowSelection(); return(true); } else if (menuItem == menuStrip.copyToolStripMenuItem) { trackViewControl.TrackViewCopyRangeSelection(); return(true); } else if (menuItem == menuStrip.undoToolStripMenuItem) { trackViewControl.UndoHelper.Undo(); return(true); } else if (menuItem == menuStrip.redoToolStripMenuItem) { trackViewControl.UndoHelper.Redo(); return(true); } else if ((menuItem == menuStrip.playTrackFromHereToolStripMenuItem) || (menuItem == menuStrip.playTrackFromHereToDiskToolStripMenuItem)) { IPlayPrefsProvider playPrefsProvider = mainWindow.GetPlayPrefsProvider(); int StartIndex; if (trackViewControl.TrackViewIsARangeSelected()) { StartIndex = trackViewControl.TrackViewGetRangeStart(); } else if (trackViewControl.TrackViewIsThereInsertionPoint()) { StartIndex = trackViewControl.TrackViewGetInsertionPointIndex(); } else if (trackViewControl.TrackViewIsASingleNoteSelected() || trackViewControl.TrackViewIsASingleCommandSelected()) { StartIndex = trackViewControl.TrackViewGetSingleNoteSelectionFrameNumber(); } else { StartIndex = 0; /* default to the beginning for other selections */ } List <TrackObjectRec> TrackList = new List <TrackObjectRec>(); TrackList.Add(trackObject); if (menuItem == menuStrip.playTrackFromHereToolStripMenuItem) { #if true // prevents "Add New Data Source..." from working SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .Do( mainWindow.DisplayName, OutputDeviceEnumerator.OutputDeviceGetDestination, OutputDeviceEnumerator.CreateOutputDeviceDestinationHandler, new OutputDeviceArguments(playPrefsProvider.BufferDuration), SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .SynthesizerMainLoop, new SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments>( mainWindow, mainWindow.Document, TrackList, trackObject, StartIndex, playPrefsProvider.SamplingRate, playPrefsProvider.EnvelopeUpdateRate, playPrefsProvider.NumChannels, (LargeBCDType)playPrefsProvider.DefaultBeatsPerMinute, playPrefsProvider.OverallVolumeScalingFactor, (LargeBCDType)playPrefsProvider.ScanningGap, playPrefsProvider.OutputNumBits, false /*clipWarning*/, playPrefsProvider.Oversampling, playPrefsProvider.ShowSummary, playPrefsProvider.Deterministic, playPrefsProvider.Seed, null /*automationSettings*/), SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .SynthesizerCompletion, mainWindow, playPrefsProvider.NumChannels, playPrefsProvider.OutputNumBits, playPrefsProvider.SamplingRate, playPrefsProvider.Oversampling, true /*showProgressWindow*/, true /*modal*/); #endif } else { #if true // prevents "Add New Data Source..." from working SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .Do( mainWindow.DisplayName, OutputSelectableFileDestinationHandler.OutputSelectableFileGetDestination, OutputSelectableFileDestinationHandler.CreateOutputSelectableFileDestinationHandler, new OutputSelectableFileArguments(), SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .SynthesizerMainLoop, new SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments>( mainWindow, mainWindow.Document, TrackList, trackObject, StartIndex, playPrefsProvider.SamplingRate, playPrefsProvider.EnvelopeUpdateRate, playPrefsProvider.NumChannels, (LargeBCDType)playPrefsProvider.DefaultBeatsPerMinute, playPrefsProvider.OverallVolumeScalingFactor, (LargeBCDType)playPrefsProvider.ScanningGap, playPrefsProvider.OutputNumBits, false /*clipWarning*/, playPrefsProvider.Oversampling, playPrefsProvider.ShowSummary, playPrefsProvider.Deterministic, playPrefsProvider.Seed, null /*automationSettings*/), SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .SynthesizerCompletion, mainWindow, playPrefsProvider.NumChannels, playPrefsProvider.OutputNumBits, playPrefsProvider.SamplingRate, playPrefsProvider.Oversampling, true /*showProgressWindow*/, true /*modal*/); #endif } return(true); } else if ((menuItem == menuStrip.playAllFromHereToolStripMenuItem) || (menuItem == menuStrip.playAllFromHereToDiskToolStripMenuItem)) { IPlayPrefsProvider playPrefsProvider = mainWindow.GetPlayPrefsProvider(); int StartIndex; if (trackViewControl.TrackViewIsARangeSelected()) { StartIndex = trackViewControl.TrackViewGetRangeStart(); } else if (trackViewControl.TrackViewIsThereInsertionPoint()) { StartIndex = trackViewControl.TrackViewGetInsertionPointIndex(); } else if (trackViewControl.TrackViewIsASingleNoteSelected() || trackViewControl.TrackViewIsASingleCommandSelected()) { StartIndex = trackViewControl.TrackViewGetSingleNoteSelectionFrameNumber(); } else { StartIndex = 0; /* default to the beginning for other selections */ } List <TrackObjectRec> TrackList = new List <TrackObjectRec>(); TrackList.Add(trackObject); // we must include the current track foreach (TrackObjectRec track in playPrefsProvider.IncludedTracks) { if (track != trackObject) { TrackList.Add(track); } } if (menuItem == menuStrip.playAllFromHereToolStripMenuItem) { #if true // prevents "Add New Data Source..." from working SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .Do( mainWindow.DisplayName, OutputDeviceEnumerator.OutputDeviceGetDestination, OutputDeviceEnumerator.CreateOutputDeviceDestinationHandler, new OutputDeviceArguments(playPrefsProvider.BufferDuration), SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .SynthesizerMainLoop, new SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments>( mainWindow, mainWindow.Document, TrackList, trackObject, StartIndex, playPrefsProvider.SamplingRate, playPrefsProvider.EnvelopeUpdateRate, playPrefsProvider.NumChannels, (LargeBCDType)playPrefsProvider.DefaultBeatsPerMinute, playPrefsProvider.OverallVolumeScalingFactor, (LargeBCDType)playPrefsProvider.ScanningGap, playPrefsProvider.OutputNumBits, false /*clipWarning*/, playPrefsProvider.Oversampling, playPrefsProvider.ShowSummary, playPrefsProvider.Deterministic, playPrefsProvider.Seed, null /*automationSettings*/), SynthesizerGeneratorParams <OutputDeviceDestination, OutputDeviceArguments> .SynthesizerCompletion, mainWindow, playPrefsProvider.NumChannels, playPrefsProvider.OutputNumBits, playPrefsProvider.SamplingRate, playPrefsProvider.Oversampling, true /*showProgressWindow*/, true /*modal*/); #endif } else { #if true // prevents "Add New Data Source..." from working SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .Do( mainWindow.DisplayName, OutputSelectableFileDestinationHandler.OutputSelectableFileGetDestination, OutputSelectableFileDestinationHandler.CreateOutputSelectableFileDestinationHandler, new OutputSelectableFileArguments(), SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .SynthesizerMainLoop, new SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments>( mainWindow, mainWindow.Document, TrackList, trackObject, StartIndex, playPrefsProvider.SamplingRate, playPrefsProvider.EnvelopeUpdateRate, playPrefsProvider.NumChannels, (LargeBCDType)playPrefsProvider.DefaultBeatsPerMinute, playPrefsProvider.OverallVolumeScalingFactor, (LargeBCDType)playPrefsProvider.ScanningGap, playPrefsProvider.OutputNumBits, false /*clipWarning*/, playPrefsProvider.Oversampling, playPrefsProvider.ShowSummary, playPrefsProvider.Deterministic, playPrefsProvider.Seed, null /*automationSettings*/), SynthesizerGeneratorParams <OutputSelectableFileDestination, OutputSelectableFileArguments> .SynthesizerCompletion, mainWindow, playPrefsProvider.NumChannels, playPrefsProvider.OutputNumBits, playPrefsProvider.SamplingRate, playPrefsProvider.Oversampling, true /*showProgressWindow*/, true /*modal*/); #endif } return(true); } else if (menuItem == menuStrip.showSelectionToolStripMenuItem) { trackViewControl.TrackViewShowSelection(); return(true); } else if (menuItem == menuStrip.transposeToolStripMenuItem) { double Transpose = 0; CmdDlgOneParam.CommandDialogOneParam("Transpose half-steps:", null, ref Transpose); if (Transpose != 0) { trackViewControl.TrackViewTransposeSelection((int)Transpose); } return(true); } else if (menuItem == menuStrip.goToLineToolStripMenuItem) { double NewMeasure = 0; CmdDlgOneParam.CommandDialogOneParam("Go To Measure:", null, ref NewMeasure); if (NewMeasure != 0) { trackViewControl.TrackViewShowMeasure((int)NewMeasure); } return(true); } else if (menuItem == menuStrip.doubleDurationToolStripMenuItem) { trackViewControl.TrackViewAdjustDuration(2, 1); return(true); } else if (menuItem == menuStrip.halveDurationToolStripMenuItem) { trackViewControl.TrackViewAdjustDuration(1, 2); return(true); } return(false); }