Пример #1
0
        public static void Completion(
            PlayFileWithEffectsGeneratorParams <T, W> generatorParams,
            ref ClipInfo clipInfo)
        {
            if (generatorParams.synthState != null)
            {
                Synthesizer.SynthStateRec.FinalizeSynthesizer(
                    generatorParams.synthState,
                    (generatorParams.result == Synthesizer.SynthErrorCodes.eSynthDone) && (generatorParams.exception == null) /*writeOutputLogs*/);
                generatorParams.synthState = null;
            }

            if (generatorParams.reader != null)
            {
                generatorParams.reader.Close();
                generatorParams.reader = null;
            }
            if (generatorParams.stream != null)
            {
                generatorParams.stream.Close();
                generatorParams.stream = null;
            }

            string interactionLogFinal = generatorParams.interactionLog.ToString();

            if (interactionLogFinal.Length != 0)
            {
                IInteractionWindowService interaction = generatorParams.mainWindow.GetInteractionWindow();
                interaction.Append(interactionLogFinal);
            }

            string message = null;

            if (generatorParams.exception != null)
            {
                message = generatorParams.exception.ToString();
            }
            else if (generatorParams.result != Synthesizer.SynthErrorCodes.eSynthDone)
            {
                message = Synthesizer.GetErrorMessage(generatorParams.result, generatorParams.errorInfo);
            }
            if (message != null)
            {
                MessageBox.Show(message, "Synthesis Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Пример #2
0
        public static void SynthesizerCompletion(
            SynthesizerGeneratorParams <T, W> generatorParams,
            ref ClipInfo clipInfo)
        {
            string interactionLogFinal = generatorParams.interactionLog.ToString();

            if (interactionLogFinal.Length != 0)
            {
                IInteractionWindowService interaction = generatorParams.mainWindow.GetInteractionWindow();
                interaction.Append(interactionLogFinal);
            }

            string message = null;

            if (generatorParams.exception != null)
            {
                message = generatorParams.exception.ToString();
            }
            else if (generatorParams.result != Synthesizer.SynthErrorCodes.eSynthDone)
            {
                message = Synthesizer.GetErrorMessage(generatorParams.result, generatorParams.errorInfo);
            }
            if (message != null)
            {
                MessageBox.Show(message, "Synthesis Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }

            if ((message == null) && generatorParams.clipWarn && (clipInfo.clippedSampleCount != 0))
            {
                string clippingMessage = String.Format(
                    "{0} out of {1} samples were clipped, with a maximum overextent of {2:0.000000}. Set the inverse volume to be greater than {3:0.000000} to eliminate the clipping.",
                    clipInfo.clippedSampleCount,
                    clipInfo.totalSampleCount,
                    clipInfo.maxClipExtent,
                    clipInfo.maxClipExtent * generatorParams.overallVolumeScalingReciprocal);
                MessageBox.Show(clippingMessage, "Clipping Ocurred", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }