示例#1
0
        // methods


        private bool ErrorTrap(
            ArrayHandleByte messageUtf8,
            bool resumable)
        {
            if (!resumable)
            {
                throw new EvalErrorException(EvalErrors.eEvalErrorTrapEncountered);
            }
            if (!mainWindow.InvokeRequired)
            {
                bool resume = mainWindow.PromptResumableError(messageUtf8.strings);
                if (!resume)
                {
                    throw new EvalErrorException(EvalErrors.eEvalErrorTrapEncountered);
                }
            }
            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;
                MainWindow.PromptResumableErrorDelegate d
                    = new MainWindow.PromptResumableErrorDelegate(mainWindow.PromptResumableError);
                object o      = mainWindow.Invoke(d, new object[] { messageUtf8.strings });
                bool   resume = (bool)o;
                if (!resume)
                {
                    throw new EvalErrorException(EvalErrors.eEvalErrorTrapEncountered);
                }
            }
            return(true);
        }
示例#2
0
        private int GetWaveTableFrames(
            ArrayHandleByte waveTableName)
        {
            string name = waveTableName.strings;
            WaveTableObjectRec waveTable = mainWindow.Document.WaveTableList.Find(
                delegate(WaveTableObjectRec candidate) { return(String.Equals(name, candidate.Name)); });

            if (waveTable == null)
            {
                throw new EvalErrorException(EvalErrors.eEvalGetSampleNotDefined);
            }
            return(waveTable.NumFrames);
        }
示例#3
0
        private ArrayHandleFloat GetSampleMonoArray(
            ArrayHandleByte sampleName)
        {
            string name = sampleName.strings;
            SampleObjectRec sample = mainWindow.Document.SampleList.Find(
                delegate(SampleObjectRec candidate) { return(String.Equals(name, candidate.Name)); });

            if (sample == null)
            {
                throw new EvalErrorException(EvalErrors.eEvalGetSampleNotDefined);
            }
            if (sample.NumChannels != NumChannelsType.eSampleMono)
            {
                throw new EvalErrorException(EvalErrors.eEvalGetSampleWrongChannelType);
            }
            return(new ArrayHandleFloat(sample.SampleData.CopyRawData(ChannelType.eMonoChannel)));
        }
示例#4
0
 private ArrayHandleFloat LoadSampleMonoArray(
     ArrayHandleByte type,
     ArrayHandleByte name)
 {
     return(LoadSampleHelper(ChannelType.eMonoChannel, type.strings, name.strings));
 }
示例#5
0
 private bool PrintString(
     ArrayHandleByte text)
 {
     PrintStringHelper(text.strings);
     return(true);
 }
示例#6
0
 /* the ACTUAL array is added, so you no longer own it after this! */
 public void AddArrayToStack(ArrayHandleByte value)
 {
     EnsureStackSize1();
     ElementArray[NumElements].reference.arrayHandleByte = value;
     NumElements++;
 }