コード例 #1
0
        /// <summary>
        /// Converts the form settings to the actual pitches and velocities
        /// </summary>
        /// <param name="bcfs"></param>
        public BasicChordMidiSettings(BasicChordFormSettings bcfs)
        {
            Durations = new List <int>(bcfs.Durations);
            ChordOffs = new List <bool>(bcfs.ChordOffs);
            for (int chordIndex = 0; chordIndex < bcfs.Durations.Count; ++chordIndex)
            {
                List <byte> midiPitches            = new List <byte>();
                List <byte> midiVelocities         = new List <byte>();
                float       verticalVelocityFactor = 1.0F;
                if (bcfs.VerticalVelocityFactors.Count > chordIndex)
                {
                    verticalVelocityFactor = bcfs.VerticalVelocityFactors[chordIndex];
                }

                if (bcfs.ChordDensities[chordIndex] > 0)
                {
                    if (bcfs.ChordDensities[chordIndex] == 1)
                    {
                        midiPitches.Add(bcfs.MidiPitches[chordIndex]);
                        midiVelocities.Add(bcfs.Velocities[chordIndex]);
                    }
                    else
                    {
                        midiPitches    = GetMidiPitches(chordIndex, bcfs.MidiPitches, bcfs.ChordDensities, bcfs.Inversions, bcfs.InversionIndices);
                        midiVelocities = GetVerticalVelocities(bcfs.Velocities[chordIndex], bcfs.ChordDensities[chordIndex], verticalVelocityFactor);
                    }
                }
                MidiPitches.Add(midiPitches);
                Velocities.Add(midiVelocities);
            }
        }
コード例 #2
0
ファイル: Palette.cs プロジェクト: notator/Moritz
        /// <summary>
        /// Converts the form settings to the actual pitches and velocities
        /// </summary>
        /// <param name="bcfs"></param>
        public BasicChordMidiSettings(BasicChordFormSettings bcfs)
        {
            Durations = new List<int>(bcfs.Durations);
            ChordOffs = new List<bool>(bcfs.ChordOffs);
            for(int chordIndex = 0; chordIndex < bcfs.Durations.Count; ++chordIndex)
            {
                List<byte> midiPitches = new List<byte>();
                List<byte> midiVelocities = new List<byte>();
                float verticalVelocityFactor = 1.0F;
                if(bcfs.VerticalVelocityFactors.Count > chordIndex)
                    verticalVelocityFactor = bcfs.VerticalVelocityFactors[chordIndex];

                if(bcfs.ChordDensities[chordIndex] > 0)
                {
                    if(bcfs.ChordDensities[chordIndex] == 1)
                    {
                        midiPitches.Add(bcfs.MidiPitches[chordIndex]);
                        midiVelocities.Add(bcfs.Velocities[chordIndex]);
                    }
                    else
                    {
                        midiPitches = GetMidiPitches(chordIndex, bcfs.MidiPitches, bcfs.ChordDensities, bcfs.Inversions, bcfs.InversionIndices);
                        midiVelocities = GetVerticalVelocities(bcfs.Velocities[chordIndex], bcfs.ChordDensities[chordIndex], verticalVelocityFactor);
                    }

                }
                MidiPitches.Add(midiPitches);
                Velocities.Add(midiVelocities);
            }
        }
コード例 #3
0
        public OrnamentSettings(PaletteForm paletteform)
        {
            OrnamentsForm osf = paletteform.OrnamentsForm;

            Debug.Assert(osf != null && osf.Ornaments != null);

            BasicChordFormSettings bcs = new BasicChordFormSettings();

            /// relative durations
            bcs.Durations = M.StringToIntList(osf.BasicChordControl.DurationsTextBox.Text, ',');
            /// velocity increments
            bcs.Velocities = M.StringToByteList(osf.BasicChordControl.VelocitiesTextBox.Text, ',');
            /// transposition intervals
            bcs.MidiPitches             = M.StringToByteList(osf.BasicChordControl.MidiPitchesTextBox.Text, ',');
            bcs.ChordOffs               = M.StringToBoolList(osf.BasicChordControl.ChordOffsTextBox.Text, ',');
            bcs.ChordDensities          = M.StringToByteList(osf.BasicChordControl.ChordDensitiesTextBox.Text, ',');
            bcs.Inversions              = paletteform.GetLinearInversions(osf.BasicChordControl.RootInversionTextBox.Text);
            bcs.InversionIndices        = M.StringToIntList(osf.BasicChordControl.InversionIndicesTextBox.Text, ',');
            bcs.VerticalVelocityFactors = M.StringToFloatList(osf.BasicChordControl.VerticalVelocityFactorsTextBox.Text, ',');

            BasicChordMidiSettings = new BasicChordMidiSettings(bcs);
            // if BankIndices or PatchIndices != null, their values override the values in the upper BasicMidiChord
            if (osf.BankIndicesTextBox.Text == "")
            {
                BankIndices = null;
            }
            else
            {
                BankIndices = M.StringToByteList(osf.BankIndicesTextBox.Text, ',');
            }
            if (osf.PatchIndicesTextBox.Text == "")
            {
                PatchIndices = null;
            }
            else
            {
                PatchIndices = M.StringToByteList(osf.PatchIndicesTextBox.Text, ',');
            }

            OrnamentValues = osf.Ornaments;
        }
コード例 #4
0
        public Palette(PaletteForm paletteForm)
        {
            BasicChordFormSettings bcfs = new BasicChordFormSettings();

            bcfs.Durations               = M.StringToIntList(paletteForm.BasicChordControl.DurationsTextBox.Text, ',');
            bcfs.Velocities              = M.StringToByteList(paletteForm.BasicChordControl.VelocitiesTextBox.Text, ',');
            bcfs.MidiPitches             = M.StringToByteList(paletteForm.BasicChordControl.MidiPitchesTextBox.Text, ',');
            bcfs.ChordOffs               = M.StringToBoolList(paletteForm.BasicChordControl.ChordOffsTextBox.Text, ',');
            bcfs.ChordDensities          = M.StringToByteList(paletteForm.BasicChordControl.ChordDensitiesTextBox.Text, ',');
            bcfs.Inversions              = paletteForm.GetLinearInversions(paletteForm.BasicChordControl.RootInversionTextBox.Text);
            bcfs.InversionIndices        = M.StringToIntList(paletteForm.BasicChordControl.InversionIndicesTextBox.Text, ',');
            bcfs.VerticalVelocityFactors = M.StringToFloatList(paletteForm.BasicChordControl.VerticalVelocityFactorsTextBox.Text, ',');

            _basicChordMidiSettings = new BasicChordMidiSettings(bcfs);

            _bankIndices              = M.StringToByteList(paletteForm.BankIndicesTextBox.Text, ',');
            _patchIndices             = M.StringToByteList(paletteForm.PatchIndicesTextBox.Text, ',');
            _pitchwheelDeviations     = M.StringToByteList(paletteForm.PitchwheelDeviationsTextBox.Text, ',');
            _pitchwheelEnvelopes      = M.StringToByteLists(paletteForm.PitchwheelEnvelopesTextBox.Text);
            _panEnvelopes             = M.StringToByteLists(paletteForm.PanEnvelopesTextBox.Text);
            _modulationWheelEnvelopes = M.StringToByteLists(paletteForm.ModulationWheelEnvelopesTextBox.Text);
            _expressionEnvelopes      = M.StringToByteLists(paletteForm.ExpressionEnvelopesTextBox.Text);

            _ornamentNumbers        = M.StringToIntList(paletteForm.OrnamentNumbersTextBox.Text, ',');
            _ornamentMinMsDurations = M.StringToIntList(paletteForm.MinMsDurationsTextBox.Text, ',');

            _ornamentSettings = null;
            if (paletteForm.OrnamentsForm != null)
            {
                _ornamentSettings = new OrnamentSettings(paletteForm);
            }

            for (int chordIndex = 0; chordIndex < _basicChordMidiSettings.Durations.Count; ++chordIndex)
            {
                DurationDef dd = GetDurationDef(chordIndex);
                _durationDefs.Add(dd);
            }

            _isPercussionPalette = paletteForm.IsPercussionPalette;
        }
コード例 #5
0
ファイル: Palette.cs プロジェクト: notator/Moritz
        /// <summary>
        /// A temporary palette containing a single DurationDef.
        /// Used just to construct the single DurationDef with the existing code.
        /// </summary>
        /// <param name="paletteChordForm"></param>
        public Palette(PaletteChordForm paletteChordForm)
        {
            BasicChordFormSettings bcfs = new BasicChordFormSettings();
            bcfs.Durations = M.StringToIntList(paletteChordForm.DurationTextBox.Text, ',');
            bcfs.Velocities = M.StringToByteList(paletteChordForm.VelocityTextBox.Text, ',');
            bcfs.MidiPitches = M.StringToByteList(paletteChordForm.BaseMidiPitchTextBox.Text,  ',');
            bcfs.ChordOffs = M.StringToBoolList(paletteChordForm.ChordOffTextBox.Text, ',');
            bcfs.ChordDensities = M.StringToByteList(paletteChordForm.ChordDensityTextBox.Text, ',');
            bcfs.Inversions = paletteChordForm.PaletteForm.GetLinearInversions(paletteChordForm.PaletteForm.BasicChordControl.RootInversionTextBox.Text);
            bcfs.InversionIndices = M.StringToIntList(paletteChordForm.InversionIndexTextBox.Text, ',');
            bcfs.VerticalVelocityFactors = M.StringToFloatList(paletteChordForm.VerticalVelocityFactorTextBox.Text, ',');

            _basicChordMidiSettings = new BasicChordMidiSettings(bcfs);

            _bankIndices = M.StringToByteList(paletteChordForm.BankIndexTextBox.Text, ',');
            _patchIndices = M.StringToByteList(paletteChordForm.PatchIndexTextBox.Text, ',');
            _pitchwheelDeviations = M.StringToByteList(paletteChordForm.PitchwheelDeviationTextBox.Text, ',');

            _pitchwheelEnvelopes = M.StringToByteLists(paletteChordForm.PitchwheelEnvelopeTextBox.Text);
            _panEnvelopes = M.StringToByteLists(paletteChordForm.PanEnvelopeTextBox.Text);
            _modulationWheelEnvelopes = M.StringToByteLists(paletteChordForm.ModulationWheelEnvelopeTextBox.Text);
            _expressionEnvelopes = M.StringToByteLists(paletteChordForm.ExpressionEnvelopeTextBox.Text);

            _ornamentNumbers = M.StringToIntList(paletteChordForm.OrnamentNumberTextBox.Text, ',');
            _ornamentMinMsDurations = M.StringToIntList(paletteChordForm.MinMsDurationTextBox.Text, ',');

            _ornamentSettings = null;
            if(paletteChordForm.PaletteForm.OrnamentsForm != null)
            {
                _ornamentSettings = new OrnamentSettings(paletteChordForm.PaletteForm);
            }

            DurationDef dd = GetDurationDef(0);
            _durationDefs.Add(dd);
        }
コード例 #6
0
ファイル: Palette.cs プロジェクト: notator/Moritz
        public Palette(PaletteForm paletteForm)
        {
            Name = paletteForm.PaletteName;

            BasicChordFormSettings bcfs = new BasicChordFormSettings();
            bcfs.Durations = M.StringToIntList(paletteForm.BasicChordControl.DurationsTextBox.Text, ',');
            bcfs.Velocities = M.StringToByteList(paletteForm.BasicChordControl.VelocitiesTextBox.Text, ',');
            bcfs.MidiPitches = M.StringToByteList(paletteForm.BasicChordControl.MidiPitchesTextBox.Text, ',');
            bcfs.ChordOffs = M.StringToBoolList(paletteForm.BasicChordControl.ChordOffsTextBox.Text, ',');
            bcfs.ChordDensities = M.StringToByteList(paletteForm.BasicChordControl.ChordDensitiesTextBox.Text, ',');
            bcfs.Inversions = paletteForm.GetLinearInversions(paletteForm.BasicChordControl.RootInversionTextBox.Text);
            bcfs.InversionIndices = M.StringToIntList(paletteForm.BasicChordControl.InversionIndicesTextBox.Text, ',');
            bcfs.VerticalVelocityFactors = M.StringToFloatList(paletteForm.BasicChordControl.VerticalVelocityFactorsTextBox.Text, ',');

            _basicChordMidiSettings = new BasicChordMidiSettings(bcfs);

            _bankIndices = M.StringToByteList(paletteForm.BankIndicesTextBox.Text, ',');
            _patchIndices = M.StringToByteList(paletteForm.PatchIndicesTextBox.Text, ',');
            _pitchwheelDeviations = M.StringToByteList(paletteForm.PitchwheelDeviationsTextBox.Text, ',');
            _pitchwheelEnvelopes = M.StringToByteLists(paletteForm.PitchwheelEnvelopesTextBox.Text);
            _panEnvelopes = M.StringToByteLists(paletteForm.PanEnvelopesTextBox.Text);
            _modulationWheelEnvelopes = M.StringToByteLists(paletteForm.ModulationWheelEnvelopesTextBox.Text);
            _expressionEnvelopes = M.StringToByteLists(paletteForm.ExpressionEnvelopesTextBox.Text);

            _ornamentNumbers = M.StringToIntList(paletteForm.OrnamentNumbersTextBox.Text, ',');
            _ornamentMinMsDurations = M.StringToIntList(paletteForm.MinMsDurationsTextBox.Text, ',');

            _ornamentSettings = null;
            if(paletteForm.OrnamentsForm != null)
            {
                _ornamentSettings = new OrnamentSettings(paletteForm);
            }

            for(int chordIndex = 0; chordIndex < _basicChordMidiSettings.Durations.Count; ++chordIndex)
            {
                DurationDef dd = GetDurationDef(chordIndex);
                _durationDefs.Add(dd);
            }

            _isPercussionPalette = paletteForm.IsPercussionPalette;
        }
コード例 #7
0
ファイル: Palette.cs プロジェクト: notator/Moritz
        public OrnamentSettings(PaletteForm paletteform)
        {
            OrnamentsForm osf = paletteform.OrnamentsForm;
            Debug.Assert(osf != null && osf.Ornaments != null);

            BasicChordFormSettings bcs = new BasicChordFormSettings();
            /// relative durations
            bcs.Durations = M.StringToIntList(osf.BasicChordControl.DurationsTextBox.Text, ',');
            /// velocity increments
            bcs.Velocities = M.StringToByteList(osf.BasicChordControl.VelocitiesTextBox.Text, ',');
            /// transposition intervals
            bcs.MidiPitches = M.StringToByteList(osf.BasicChordControl.MidiPitchesTextBox.Text, ',');
            bcs.ChordOffs = M.StringToBoolList(osf.BasicChordControl.ChordOffsTextBox.Text, ',');
            bcs.ChordDensities = M.StringToByteList(osf.BasicChordControl.ChordDensitiesTextBox.Text, ',');
            bcs.Inversions = paletteform.GetLinearInversions(osf.BasicChordControl.RootInversionTextBox.Text);
            bcs.InversionIndices = M.StringToIntList(osf.BasicChordControl.InversionIndicesTextBox.Text, ',');
            bcs.VerticalVelocityFactors = M.StringToFloatList(osf.BasicChordControl.VerticalVelocityFactorsTextBox.Text, ',');

            BasicChordMidiSettings = new BasicChordMidiSettings(bcs);
            // if BankIndices or PatchIndices != null, their values override the values in the upper BasicMidiChord
            if(osf.BankIndicesTextBox.Text == "")
            {
                BankIndices = null;
            }
            else
            {
                BankIndices = M.StringToByteList(osf.BankIndicesTextBox.Text, ',');
            }
            if(osf.PatchIndicesTextBox.Text == "")
            {
                PatchIndices = null;
            }
            else
            {
                PatchIndices = M.StringToByteList(osf.PatchIndicesTextBox.Text, ',');
            }

            OrnamentValues = osf.Ornaments;
        }