public static OutputGeneric<T, WaveTableTestGeneratorParams<T, W>, W> Do( string baseName, GetDestinationMethod<T> getDestination, CreateDestinationHandlerMethod<T, W> createDestinationHandler, W destinationHandlerArguments, GeneratorMainLoopMethod<T, WaveTableTestGeneratorParams<T, W>, W> generatorMainLoop, WaveTableTestGeneratorParams<T, W> generatorParams, GeneratorCompletionMethod<WaveTableTestGeneratorParams<T, W>> generatorCompletion, IMainWindowServices mainWindow, NumChannelsType channels, NumBitsType bits, int samplingRate, int oversamplingFactor, bool showProgressWindow, bool modal) { // prerequisites return OutputGeneric<T, WaveTableTestGeneratorParams<T, W>, W>.Do( baseName, getDestination, createDestinationHandler, destinationHandlerArguments, generatorMainLoop, generatorParams, generatorCompletion, channels, bits, samplingRate, oversamplingFactor, showProgressWindow, modal); }
public static OutputGeneric <T, SynthesizerGeneratorParams <T, W>, W> Do( string baseName, GetDestinationMethod <T> getDestination, CreateDestinationHandlerMethod <T, W> createDestinationHandler, W destinationHandlerArguments, GeneratorMainLoopMethod <T, SynthesizerGeneratorParams <T, W>, W> generatorMainLoop, SynthesizerGeneratorParams <T, W> generatorParams, GeneratorCompletionMethod <SynthesizerGeneratorParams <T, W> > generatorCompletion, IMainWindowServices mainWindow, NumChannelsType channels, NumBitsType bits, int samplingRate, int oversamplingFactor, bool showProgressWindow, bool modal) { // prerequisites /* force an auto-save since play may take a long time */ MainWindow.DoAutosaveGlobally(); /* make sure all objects are up to date */ if (!mainWindow.MakeUpToDate()) { /* couldn't compile score elements */ return(null); } return(OutputGeneric <T, SynthesizerGeneratorParams <T, W>, W> .Do( baseName, getDestination, createDestinationHandler, destinationHandlerArguments, generatorMainLoop, generatorParams, generatorCompletion, channels, bits, samplingRate, oversamplingFactor, showProgressWindow, modal)); }
public static OutputGeneric <T, U, W> Do( string baseName, GetDestinationMethod <T> getDestination, CreateDestinationHandlerMethod <T, W> createDestinationHandler, W destinationHandlerParams, GeneratorMainLoopMethod <T, U, W> generatorMainLoop, U generatorParams, GeneratorCompletionMethod <U> generatorCompletion, NumChannelsType channels, NumBitsType bits, int samplingRate, int oversamplingFactor, bool showProgressWindow, bool modal) // modal is only meaningful when showProgressWindow==true { // set up processing record OutputGeneric <T, U, W> state = new OutputGeneric <T, U, W>(); state.channels = channels; state.bits = bits; state.samplingRate = samplingRate; state.oversamplingFactor = oversamplingFactor; state.totalSampleCount = 0; state.clippedSampleCount = 0; state.maxClipExtent = 0; state.oversamplingSkipCarryover = 0; if ((state.bits == NumBitsType.eSample8bit) || (state.bits == NumBitsType.eSample16bit)) { if (OutputGeneric <T, U, W> .UseHPTRI) // TODO: add dither selector to global settings { state.ditherState = new Synthesizer.StereoDither_HPTRI(bits); } else { state.ditherState = new Synthesizer.StereoDither_TPDF(bits); } } if (!getDestination(out state.destination)) { return(null); } state.createDestinationHandler = createDestinationHandler; state.generatorMainLoop = generatorMainLoop; state.generatorParams = generatorParams; state.generatorCompletion = generatorCompletion; state.destinationHandlerParams = destinationHandlerParams; state.stopper = new Synthesizer.StopTask(); state.waitFinishedHelper = new WaitFinishedHelper(); // All synth parameter initialization must be done by this point to avoid race conditions!!! state.thread = new Thread(ThreadMain); state.thread.Start(state); if (showProgressWindow) { state.progressWindow = new OutputProgressWindow( baseName, true /*show clipping*/, state, state, state.stopper, state.waitFinishedHelper, state.waitFinishedHelper, delegate() { ClipInfo clipInfo = new ClipInfo( state.totalSampleCount, state.clippedSampleCount, state.maxClipExtent); state.generatorCompletion( generatorParams, ref clipInfo); }); if (modal) { state.progressWindow.ShowDialog(); state.Dispose(); // suppress finalize } else { state.progressWindow.Show(); // client required to dispose after completion } } // After this, the dialog prevents UI interaction with the application on the main thread // and the rendering thread does it's thing until finished. // The dialog and the rendering thread talk to each other about stopping and completion. return(state); }