예제 #1
0
        public MidiChord(int channel, MidiChordDef midiChordDef, OutputDevice midiOutputDevice)
            : base(channel, 0, midiChordDef.MsDuration)
        {
            _midiOutputDevice = midiOutputDevice;

            List <BasicMidiChordDef> basicMidiChordDefs = midiChordDef.BasicMidiChordDefs;

            Debug.Assert(basicMidiChordDefs.Count > 0);
            List <int> realBasicMidiChordDurations = MidiChordDef.GetIntDurations(MsDuration, midiChordDef.BasicChordDurations, basicMidiChordDefs.Count);

            var notesToStop = new SortedSet <byte>();
            int i           = 0;

            foreach (BasicMidiChordDef basicMidiChordDef in midiChordDef.BasicMidiChordDefs)
            {
                this._basicMidiChords.Add(new BasicMidiChord(channel, this, basicMidiChordDef, realBasicMidiChordDurations[i++]));
                if (basicMidiChordDef.HasChordOff)
                {
                    foreach (byte note in basicMidiChordDef.Pitches)
                    {
                        if (!notesToStop.Contains(note))
                        {
                            notesToStop.Add(note);
                        }
                    }
                }
            }

            if (midiChordDef.Bank != null)
            {
                _bank = new BankControl(channel, (byte)midiChordDef.Bank);
            }
            if (midiChordDef.Patch != null)
            {
                _patch = new PatchControl(channel, (byte)midiChordDef.Patch);
            }

            // Moritz currently never repeats MidiChords, so the _repeat field is unnecessary.
            // However: the value of midiChordDef.Repeat is saved in SVG-MIDI files,
            // and may be used by the web AssistantPerformer.
            //_repeat = midiChordDef.Repeat;

            if (midiChordDef.PitchWheelDeviation != null)
            {
                _pitchWheelDeviation = new PitchWheelDeviation(channel, (byte)midiChordDef.PitchWheelDeviation);
            }
            if (midiChordDef.MidiChordSliderDefs != null)
            {
                CreateSliders(channel, midiChordDef.MidiChordSliderDefs, MsDuration);
            }

            SetMessagesDict();
        }
예제 #2
0
        public MidiChord(int channel, MidiChordDef midiChordDef, OutputDevice midiOutputDevice)
            : base(channel, 0, midiChordDef.MsDuration)
        {
            _midiOutputDevice = midiOutputDevice;

            List<BasicMidiChordDef> basicMidiChordDefs = midiChordDef.BasicMidiChordDefs;
            Debug.Assert(basicMidiChordDefs.Count > 0);
            List<int> realBasicMidiChordDurations = MidiChordDef.GetIntDurations(MsDuration, midiChordDef.BasicChordDurations, basicMidiChordDefs.Count);

            var notesToStop = new SortedSet<byte>();
            int i = 0;
            foreach(BasicMidiChordDef basicMidiChordDef in midiChordDef.BasicMidiChordDefs)
            {
                this._basicMidiChords.Add(new BasicMidiChord(channel, this, basicMidiChordDef, realBasicMidiChordDurations[i++]));
                if(basicMidiChordDef.HasChordOff)
                {
                    foreach(byte note in basicMidiChordDef.Pitches)
                    {
                        if(!notesToStop.Contains(note))
                            notesToStop.Add(note);
                    }
                }
            }

            if(midiChordDef.Bank != null)
            {
                _bank = new BankControl(channel, (byte)midiChordDef.Bank);
            }
            if(midiChordDef.Patch != null)
            {
                _patch = new PatchControl(channel, (byte)midiChordDef.Patch);
            }

            // Moritz currently never repeats MidiChords, so the _repeat field is unnecessary.
            // However: the value of midiChordDef.Repeat is saved in SVG-MIDI files,
            // and may be used by the web AssistantPerformer.
            //_repeat = midiChordDef.Repeat;

            if(midiChordDef.PitchWheelDeviation != null)
            {
                _pitchWheelDeviation = new PitchWheelDeviation(channel, (byte)midiChordDef.PitchWheelDeviation);
            }
            if(midiChordDef.MidiChordSliderDefs != null)
                CreateSliders(channel, midiChordDef.MidiChordSliderDefs, MsDuration);

            SetMessagesDict();
        }
예제 #3
0
        public BasicMidiChord(int channel, MidiChord midiChord, BasicMidiChordDef bmcd, int realMsDuration)
        {
            MidiChord = midiChord;
            //MsPosition = bmcd.MsPosition;
            MsDuration = realMsDuration;

            if(bmcd.BankIndex != null)
            {
                BankControl = new BankControl(channel, (byte)bmcd.BankIndex);
            }
            if(bmcd.PatchIndex != null)
            {
                PatchControl = new PatchControl(channel, (byte)bmcd.PatchIndex);
            }

            ChordOn = new ChordOn(this);
            SetChordOn(channel, bmcd.Pitches, bmcd.Velocities);
            if(bmcd.HasChordOff)
            {
                ChordOff = new ChordOff(this);
                SetChordOff(channel, bmcd.Pitches);
            }
        }
예제 #4
0
        public BasicMidiChord(int channel, MidiChord midiChord, BasicMidiChordDef bmcd, int realMsDuration)
        {
            MidiChord = midiChord;
            //MsPosition = bmcd.MsPosition;
            MsDuration = realMsDuration;

            if (bmcd.BankIndex != null)
            {
                BankControl = new BankControl(channel, (byte)bmcd.BankIndex);
            }
            if (bmcd.PatchIndex != null)
            {
                PatchControl = new PatchControl(channel, (byte)bmcd.PatchIndex);
            }

            ChordOn = new ChordOn(this);
            SetChordOn(channel, bmcd.Pitches, bmcd.Velocities);
            if (bmcd.HasChordOff)
            {
                ChordOff = new ChordOff(this);
                SetChordOff(channel, bmcd.Pitches);
            }
        }