示例#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
 private void PrintStringHelper(
     string text)
 {
     if (!mainWindow.InvokeRequired)
     {
         IInteractionWindowService interaction = mainWindow.GetInteractionWindow();
         interaction.Append(text);
     }
     else
     {
         // UI interaction must be marshaled to the main UI thread
         // (see https://msdn.microsoft.com/en-us/library/ms171728%28v=vs.80%29.aspx)
         interaction = true;
         MainWindowGetInteractionWindowDelegate d = new MainWindowGetInteractionWindowDelegate(mainWindow.GetInteractionWindow);
         object o = mainWindow.Invoke(d, new object[] { });
         IInteractionWindowService       interactionWindow = (IInteractionWindowService)o;
         InteractionWindowAppendDelegate e = new InteractionWindowAppendDelegate(interactionWindow.Append);
         interactionWindow.Invoke(e, new object[] { text });
     }
 }
        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);
            }
        }