コード例 #1
0
 /* sweep the tempo to a new value relative to the current value */
 public static void TempoControlSweepToAdjustedValue(
     TempoControlRec Tempo,
     LargeBCDType AdjustBPM,
     SmallExtBCDType NumBeatsToReach)
 {
     TempoControlSweepHelper(
         Tempo,
         Tempo.CurrentBeatsPerMinute + (double)AdjustBPM,
         NumBeatsToReach);
 }
コード例 #2
0
 /* sweep the tempo to a new value */
 public static void TempoControlSweepToNewValue(
     TempoControlRec Tempo,
     LargeBCDType NewBPM,
     SmallExtBCDType NumBeatsToReach)
 {
     TempoControlSweepHelper(
         Tempo,
         (double)NewBPM,
         NumBeatsToReach);
 }
コード例 #3
0
 /* set the tempo to the specified number of beats per minute */
 public static void TempoControlSetBeatsPerMinute(
     TempoControlRec Tempo,
     LargeBCDType NewBeatsPerMinute)
 {
     Tempo.CurrentBeatsPerMinute = (double)NewBeatsPerMinute;
     if (Tempo.CurrentBeatsPerMinute < MINBPM)
     {
         Tempo.CurrentBeatsPerMinute = MINBPM;
     }
     Tempo.BeatsPerMinuteChangeCountdown = 0;
 }
コード例 #4
0
 /* adjust the tempo by adding the specified value to it */
 public static void TempoControlAdjustBeatsPerMinute(
     TempoControlRec Tempo,
     LargeBCDType IncrementBeatsPerMinute)
 {
     Tempo.CurrentBeatsPerMinute += (double)IncrementBeatsPerMinute;
     if (Tempo.CurrentBeatsPerMinute < MINBPM)
     {
         Tempo.CurrentBeatsPerMinute = MINBPM;
     }
     Tempo.BeatsPerMinuteChangeCountdown = 0;
 }
コード例 #5
0
        /* create a new tempo control record */
        public static TempoControlRec NewTempoControl(LargeBCDType DefaultBeatsPerMinute)
        {
#if DEBUG
            Debug.Assert(DURATIONUPDATECLOCKRESOLUTION == Constants.Denominator);
#endif

            TempoControlRec Tempo = new TempoControlRec();

            Tempo.DefaultBeatsPerMinute = (double)DefaultBeatsPerMinute;
            Tempo.CurrentBeatsPerMinute = Tempo.DefaultBeatsPerMinute;
            ResetLinearTransition(ref Tempo.BeatsPerMinuteChange, 0, 0, 1);
            Tempo.BeatsPerMinuteChangeCountdown = 0;

            return(Tempo);
        }
コード例 #6
0
 public SynthesizerGeneratorParams(
     IMainWindowServices mainWindow,
     Document document,
     List <TrackObjectRec> listOfTracks,
     TrackObjectRec keyTrack,
     int frameToStartAt,
     int samplingRate,
     int envelopeRate,
     NumChannelsType channels,
     LargeBCDType defaultBeatsPerMinute,
     double overallVolumeScalingReciprocal,
     LargeBCDType scanningGap,
     NumBitsType bits,
     bool clipWarn,
     int oversamplingFactor,
     bool showSummary,
     bool deterministic,// now ignored - control by setting randomSeed to null or int
     int?randomSeed,
     Synthesizer.AutomationSettings automationSettings)
 {
     this.mainWindow                     = mainWindow;
     this.document                       = document;
     this.listOfTracks                   = listOfTracks;
     this.keyTrack                       = keyTrack;
     this.frameToStartAt                 = frameToStartAt;
     this.samplingRate                   = samplingRate;
     this.envelopeRate                   = envelopeRate;
     this.channels                       = channels;
     this.defaultBeatsPerMinute          = defaultBeatsPerMinute;
     this.overallVolumeScalingReciprocal = overallVolumeScalingReciprocal;
     this.scanningGap                    = scanningGap;
     this.bits               = bits;
     this.clipWarn           = clipWarn;
     this.oversamplingFactor = oversamplingFactor;
     this.showSummary        = showSummary;
     this.deterministic      = deterministic;
     this.randomSeed         = randomSeed;
     this.automationSettings = automationSettings;
 }
コード例 #7
0
            public Source(Document document)
            {
                _document = document;

                _SamplingRate               = document.SamplingRate;
                _EnvelopeUpdateRate         = document.EnvelopeUpdateRate;
                _Oversampling               = document.Oversampling;
                _DefaultBeatsPerMinute      = (LargeBCDType)document.DefaultBeatsPerMinute;
                _OverallVolumeScalingFactor = (LargeBCDType)document.OverallVolumeScalingFactor;
                _OutputNumBits              = document.OutputNumBits;
                _ScanningGap    = (LargeBCDType)document.ScanningGap;
                _BufferDuration = (LargeBCDType)document.BufferDuration;
                _ClipWarning    = document.ClipWarning;
                _NumChannels    = document.NumChannels;
                _ShowSummary    = document.ShowSummary;
                _Deterministic  = document.Deterministic;
                _Seed           = document.Seed;
                foreach (TrackObjectRec Track in document.TrackList)
                {
                    IncludedTracks.Add(new TrackInclusionRec(Track, this));
                }

                document.TrackList.ListChanged += TrackList_ListChanged;
            }
コード例 #8
0
 public void WriteLBCD(LargeBCDType lbcd)
 {
     WriteInt32(lbcd.rawInt32);
 }
コード例 #9
0
 public LargeBCDType ReadLBCD()
 {
     return(LargeBCDType.FromRawInt32(ReadInt32()));
 }
コード例 #10
0
        /* process commands in the queue that occur now.  this should be called after */
        /* queueing commands, but before incrementing the execution index, and before */
        /* processing the data, so that commands are handled at the beginning of a */
        /* transition. */
        public static void TrackEffectProcessQueuedCommands(
            TrackEffectGenRec Generator,
            SynthParamRec SynthParams)
        {
            if (Generator.List != null)
            {
                while ((Generator.ScanningGapListHead != null) &&
                       (Generator.ScanningGapListHead.StartTime <= Generator.ExecutionIndex))
                {
                    CommandConsCell Cell;

                    /* since the start time of commands can't be adjusted, there should */
                    /* never be a command that is strictly less than. */
#if DEBUG
                    if (Generator.ScanningGapListHead.StartTime < Generator.ExecutionIndex)
                    {
                        // early command
                        Debug.Assert(false);
                        throw new InvalidOperationException();
                    }
#endif
                    /* unlink the cons cell */
                    Cell = Generator.ScanningGapListHead;
                    Generator.ScanningGapListHead = Generator.ScanningGapListHead.Next;
                    if (Generator.ScanningGapListHead == null)
                    {
                        Generator.ScanningGapListTail = null;
                    }
                    /* see what we're supposed to do with the command */
                    switch ((NoteCommands)(Cell.Command.Flags & ~NoteFlags.eCommandFlag))
                    {
                    default:
                        Debug.Assert(false);
                        throw new ArgumentException();

                    case NoteCommands.eCmdSetEffectParam1:     /* specify the new default effect parameter in <1l> */
                    case NoteCommands.eCmdSetScoreEffectParam1:
                    case NoteCommands.eCmdSetSectionEffectParam1:
                        Generator.Accents0.Current
                            = (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents0.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdIncEffectParam1:     /* add <1l> to the default effect parameter */
                    case NoteCommands.eCmdIncScoreEffectParam1:
                    case NoteCommands.eCmdIncSectionEffectParam1:
                        Generator.Accents0.Current
                            += (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents0.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdSweepEffectParamAbs1:     /* <1l> = new effect parameter, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamAbs1:
                    case NoteCommands.eCmdSweepSectionEffectParamAbs1:
                        SweepToNewValue(
                            ref Generator.Accents0,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSweepEffectParamRel1:     /* <1l> = effect parameter adjust, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamRel1:
                    case NoteCommands.eCmdSweepSectionEffectParamRel1:
                        SweepToAdjustedValue(
                            ref Generator.Accents0,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSetEffectParam2:     /* specify the new default effect parameter in <1l> */
                    case NoteCommands.eCmdSetScoreEffectParam2:
                    case NoteCommands.eCmdSetSectionEffectParam2:
                        Generator.Accents1.Current
                            = (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents1.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdIncEffectParam2:     /* add <1l> to the default effect parameter */
                    case NoteCommands.eCmdIncScoreEffectParam2:
                    case NoteCommands.eCmdIncSectionEffectParam2:
                        Generator.Accents1.Current
                            += (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents1.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdSweepEffectParamAbs2:     /* <1l> = new effect parameter, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamAbs2:
                    case NoteCommands.eCmdSweepSectionEffectParamAbs2:
                        SweepToNewValue(
                            ref Generator.Accents1,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSweepEffectParamRel2:     /* <1l> = effect parameter adjust, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamRel2:
                    case NoteCommands.eCmdSweepSectionEffectParamRel2:
                        SweepToAdjustedValue(
                            ref Generator.Accents1,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSetEffectParam3:     /* specify the new default effect parameter in <1l> */
                    case NoteCommands.eCmdSetScoreEffectParam3:
                    case NoteCommands.eCmdSetSectionEffectParam3:
                        Generator.Accents2.Current
                            = (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents2.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdIncEffectParam3:     /* add <1l> to the default effect parameter */
                    case NoteCommands.eCmdIncScoreEffectParam3:
                    case NoteCommands.eCmdIncSectionEffectParam3:
                        Generator.Accents2.Current
                            += (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents2.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdSweepEffectParamAbs3:     /* <1l> = new effect parameter, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamAbs3:
                    case NoteCommands.eCmdSweepSectionEffectParamAbs3:
                        SweepToNewValue(
                            ref Generator.Accents2,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSweepEffectParamRel3:     /* <1l> = effect parameter adjust, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamRel3:
                    case NoteCommands.eCmdSweepSectionEffectParamRel3:
                        SweepToAdjustedValue(
                            ref Generator.Accents2,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSetEffectParam4:     /* specify the new default effect parameter in <1l> */
                    case NoteCommands.eCmdSetScoreEffectParam4:
                    case NoteCommands.eCmdSetSectionEffectParam4:
                        Generator.Accents3.Current
                            = (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents3.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdIncEffectParam4:     /* add <1l> to the default effect parameter */
                    case NoteCommands.eCmdIncScoreEffectParam4:
                    case NoteCommands.eCmdIncSectionEffectParam4:
                        Generator.Accents3.Current
                            += (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents3.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdSweepEffectParamAbs4:     /* <1l> = new effect parameter, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamAbs4:
                    case NoteCommands.eCmdSweepSectionEffectParamAbs4:
                        SweepToNewValue(
                            ref Generator.Accents3,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSweepEffectParamRel4:     /* <1l> = effect parameter adjust, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamRel4:
                    case NoteCommands.eCmdSweepSectionEffectParamRel4:
                        SweepToAdjustedValue(
                            ref Generator.Accents3,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSetEffectParam5:     /* specify the new default effect parameter in <1l> */
                    case NoteCommands.eCmdSetScoreEffectParam5:
                    case NoteCommands.eCmdSetSectionEffectParam5:
                        Generator.Accents4.Current
                            = (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents4.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdIncEffectParam5:     /* add <1l> to the default effect parameter */
                    case NoteCommands.eCmdIncScoreEffectParam5:
                    case NoteCommands.eCmdIncSectionEffectParam5:
                        Generator.Accents4.Current
                            += (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents4.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdSweepEffectParamAbs5:     /* <1l> = new effect parameter, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamAbs5:
                    case NoteCommands.eCmdSweepSectionEffectParamAbs5:
                        SweepToNewValue(
                            ref Generator.Accents4,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSweepEffectParamRel5:     /* <1l> = effect parameter adjust, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamRel5:
                    case NoteCommands.eCmdSweepSectionEffectParamRel5:
                        SweepToAdjustedValue(
                            ref Generator.Accents4,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSetEffectParam6:     /* specify the new default effect parameter in <1l> */
                    case NoteCommands.eCmdSetScoreEffectParam6:
                    case NoteCommands.eCmdSetSectionEffectParam6:
                        Generator.Accents5.Current
                            = (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents5.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdIncEffectParam6:     /* add <1l> to the default effect parameter */
                    case NoteCommands.eCmdIncScoreEffectParam6:
                    case NoteCommands.eCmdIncSectionEffectParam6:
                        Generator.Accents5.Current
                            += (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents5.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdSweepEffectParamAbs6:     /* <1l> = new effect parameter, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamAbs6:
                    case NoteCommands.eCmdSweepSectionEffectParamAbs6:
                        SweepToNewValue(
                            ref Generator.Accents5,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSweepEffectParamRel6:     /* <1l> = effect parameter adjust, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamRel6:
                    case NoteCommands.eCmdSweepSectionEffectParamRel6:
                        SweepToAdjustedValue(
                            ref Generator.Accents5,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSetEffectParam7:     /* specify the new default effect parameter in <1l> */
                    case NoteCommands.eCmdSetScoreEffectParam7:
                    case NoteCommands.eCmdSetSectionEffectParam7:
                        Generator.Accents6.Current
                            = (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents6.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdIncEffectParam7:     /* add <1l> to the default effect parameter */
                    case NoteCommands.eCmdIncScoreEffectParam7:
                    case NoteCommands.eCmdIncSectionEffectParam7:
                        Generator.Accents6.Current
                            += (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents6.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdSweepEffectParamAbs7:     /* <1l> = new effect parameter, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamAbs7:
                    case NoteCommands.eCmdSweepSectionEffectParamAbs7:
                        SweepToNewValue(
                            ref Generator.Accents6,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSweepEffectParamRel7:     /* <1l> = effect parameter adjust, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamRel7:
                    case NoteCommands.eCmdSweepSectionEffectParamRel7:
                        SweepToAdjustedValue(
                            ref Generator.Accents6,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSetEffectParam8:     /* specify the new default effect parameter in <1l> */
                    case NoteCommands.eCmdSetScoreEffectParam8:
                    case NoteCommands.eCmdSetSectionEffectParam8:
                        Generator.Accents7.Current
                            = (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents7.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdIncEffectParam8:     /* add <1l> to the default effect parameter */
                    case NoteCommands.eCmdIncScoreEffectParam8:
                    case NoteCommands.eCmdIncSectionEffectParam8:
                        Generator.Accents7.Current
                            += (double)LargeBCDType.FromRawInt32(Cell.Command._Argument1);
                        Generator.Accents7.ChangeCountdown = 0;
                        break;

                    case NoteCommands.eCmdSweepEffectParamAbs8:     /* <1l> = new effect parameter, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamAbs8:
                    case NoteCommands.eCmdSweepSectionEffectParamAbs8:
                        SweepToNewValue(
                            ref Generator.Accents7,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdSweepEffectParamRel8:     /* <1l> = effect parameter adjust, <2xs> = # of beats to get there */
                    case NoteCommands.eCmdSweepScoreEffectParamRel8:
                    case NoteCommands.eCmdSweepSectionEffectParamRel8:
                        SweepToAdjustedValue(
                            ref Generator.Accents7,
                            LargeBCDType.FromRawInt32(Cell.Command._Argument1),
                            SmallExtBCDType.FromRawInt32(Cell.Command._Argument2));
                        break;

                    case NoteCommands.eCmdTrackEffectEnable:
                    case NoteCommands.eCmdScoreEffectEnable:
                    case NoteCommands.eCmdSectionEffectEnable:
                        if (!Generator.AutoQuiescence)
                        {
                            /* if autoquiescence is enabled, ignore the commands */
                            Generator.Enable = (Cell.Command._Argument1 < 0);
                        }
                        break;
                    }
                }

                /* increment our scanning gap back edge clock, after scheduling commands */
                /* (this way, commands are scheduled on the beginning of the clock they */
                /* should occur on). */
                Generator.ExecutionIndex += 1;
                /* since this routine is only called when samples are being generated, */
                /* we don't have to worry about when to increment this counter */
            }
        }