Пример #1
0
        public override void update(NoteStyle noteStyle)
        {
            base.update(noteStyle);
            NoteStyle_Line noteStyle_Line = (NoteStyle_Line)noteStyle;

            if (noteStyle_Line.LineType == null)
            {
                lineTypeList.SelectedIndex = -1;
            }
            else
            {
                lineTypeList.SelectedIndex = (int)noteStyle_Line.LineType;
            }

            Form1.setNumericUdValue(lineWidthUd, noteStyle_Line.LineWidth);
            Form1.setNumericUdValue(qnGapFillUd, noteStyle_Line.Qn_gapThreshold);
            continuousCb.CheckState = Form1.toCheckState(noteStyle_Line.Continuous);
            if (noteStyle_Line.HlType == null)
            {
                lineHlTypeList.SelectedIndex = -1;
            }
            else
            {
                lineHlTypeList.SelectedIndex = (int)noteStyle_Line.HlType;
            }

            Form1.setNumericUdValue(hlSizeUpDown, noteStyle_Line.HlSize);
            Form1.setNumericUdValue(hlMovementPowUd, noteStyle_Line.HlMovementPow);
            movingHlCb.CheckState    = Form1.toCheckState(noteStyle_Line.MovingHl);
            shrinkingHlCb.CheckState = Form1.toCheckState(noteStyle_Line.ShrinkingHl);
            hlBorderCb.CheckState    = Form1.toCheckState(noteStyle_Line.HlBorder);
        }
Пример #2
0
        public virtual void update(NoteStyle noteStyle)
        {
            //modEntryBs.DataSource = noteStyle.ModEntries;
            modEntryCombo.DisplayMember = "Name";
            modEntryCombo.SelectedIndex = -1;
            modEntryCombo.Items.Clear();
            //modEntryCombo.Text = "";
            if (noteStyle.ModEntries == null)
            {
                modEntryCombo.Enabled       = false;
                modEntryCombo.SelectedIndex = -1;
            }
            else
            {
                if (noteStyle.ModEntries.Count > 0)
                {
                    modEntryCombo.Items.AddRange(noteStyle.ModEntries.ToArray());
                }
                if (noteStyle.SelectedModEntryIndex == null)
                {
                    modEntryCombo.SelectedIndex = -1;
                }
                else
                {
                    modEntryCombo.SelectedIndex = (int)noteStyle.SelectedModEntryIndex;
                }
                modEntryCombo.Enabled = true;
            }

            NoteStyleMod modEntry = noteStyle.SelectedModEntry;

            if (modEntry != null)
            {
                Form1.setNumericUdValue(xOriginUd, modEntry.Origin.X);
                Form1.setNumericUdValue(yOriginUd, modEntry.Origin.Y);
                xOriginCb.CheckState = Form1.toCheckState(modEntry.XOriginEnable);
                yOriginCb.CheckState = Form1.toCheckState(modEntry.YOriginEnable);
                if (modEntry.CombineXY == null)
                {
                    combineXYCombo.SelectedIndex = -1;
                }
                else
                {
                    combineXYCombo.SelectedIndex = (int)modEntry.CombineXY;
                }
                updateXYOriginEnabled();
                squareAspectCb.CheckState = Form1.toCheckState(modEntry.SquareAspect);
                colorDestCb.CheckState    = Form1.toCheckState(modEntry.ColorDestEnable);
                angleDestCb.CheckState    = Form1.toCheckState(modEntry.AngleDestEnable);
                colorDestBtn.BackColor    = Form1.xnaToGdiCol(modEntry.ColorDest);
                Form1.setNumericUdValue(angleDestUd, modEntry.AngleDest);
                Form1.setNumericUdValue(startUd, modEntry.Start);
                Form1.setNumericUdValue(stopUd, modEntry.Stop);
                Form1.setNumericUdValue(fadeInUd, modEntry.FadeIn);
                Form1.setNumericUdValue(fadeOutUd, modEntry.FadeOut);
                Form1.setNumericUdValue(powerUd, modEntry.Power);
                discardStopCb.CheckState = Form1.toCheckState(modEntry.DiscardAfterStop);
                invertCb.CheckState      = Form1.toCheckState(modEntry.Invert);
            }
        }
Пример #3
0
 /// <summary>
 /// Resets the default values for the MML being played.
 /// </summary>
 /// <param name="channelOpen">If the channel is currently open, then do </param>
 public void ResetChannelDefaults()
 {
     velocity       = Config.Velocity.Default;
     octave         = Config.Octave.Default;
     noteTimeValue  = 4;
     nextUpdateTime = 0;
     lastNotePlayed = 0;
     noteStyle      = NoteStyle.Regular;
     mStack.Refresh();
     ChangeNoteStyle(channelID, noteStyle);
 }
Пример #4
0
 public void ChangeMode(int channel, NoteStyle mode)
 {
     if (channel >= 0 && channel < Config.Channel.Count)
     {
         noteMode[channel] = mode;
         if (mode == NoteStyle.Noise)
         {
             mixer.SetGeneratorType(channel, WaveType.WhiteNoise);
         }
         else
         {
             mixer.SetGeneratorType(channel, WaveType.Square);
         }
     }
 }
Пример #5
0
        /// <summary>
        /// Base for rendering the end of a class.
        /// </summary>
        internal static void NoteBaseEnd(this StringBuilder stringBuilder, NoteStyle style = NoteStyle.Normal)
        {
            stringBuilder.Append(Constant.End);
            stringBuilder.Append(Constant.Space);

            switch (style)
            {
            case NoteStyle.Hexagonal:
                stringBuilder.Append(Constant.NoteHexagon);
                break;

            case NoteStyle.Box:
                stringBuilder.Append(Constant.NoteBox);
                break;
            }

            stringBuilder.Append(Constant.Note);
            stringBuilder.AppendNewLine();
        }
Пример #6
0
 /// <summary>
 /// Changes the instrument on the specified channel.
 /// </summary>
 /// <param name="newInstrument">The instrument to change to.</param>
 private void ChangeInstrument(int newInstrument)
 {
     // Note: These instrument ranges map to the same thing:
     // 144-151 (7 square waves plus one noise)
     // 152-159
     // 160-167
     // 168-175
     instrument = newInstrument;
     if (instrument < 128)
     {
         ChangeNoteStyle(channelID, NoteStyle.Regular);
         noteStyle = NoteStyle.Regular;
         MIDIMessage mst = new MIDIMessage();
         mst.Channel = channelID;
         mst.Status  = MessageType.ProgramChange;
         mst.Data1   = instrument;
         SendEvent(mst);
     }
     else if (instrument > 143 & instrument < 176)
     {
         while (instrument > 151)
         {
             instrument -= 8;
         }
         if (instrument == 151)
         {
             ChangeNoteStyle(channelID, NoteStyle.Noise);
             noteStyle = NoteStyle.Noise;
         }
         else
         {
             ChangeNoteStyle(channelID, NoteStyle.PSG);
             noteStyle = NoteStyle.PSG;
             ChangeDuty(channelID, .125f * (instrument - 143));
         }
     }
     else
     {
         ChangeNoteStyle(channelID, NoteStyle.Drums);
         noteStyle = NoteStyle.Drums;
     }
 }
Пример #7
0
 public void ChangeMode(int channel, NoteStyle mode)
 {
     if (channel >= 0 && channel < 8)
     {
         noteMode[channel] = mode;
         if (mode == NoteStyle.Noise)
         {
             this.mixer.SetGeneratorType(channel, WaveType.WhiteNoise);
         }
         else
         {
             this.mixer.SetGeneratorType(channel, WaveType.Square);
         }
     }
 }
Пример #8
0
 /// <summary>
 /// Renders a note over multiple participants.
 /// </summary>
 /// <param name="participantA">The first participant.</param>
 /// <param name="participantB">The second participant.</param>
 /// <param name="note">The text of the note.</param>
 /// <param name="style">Optional styleof note. Default <see cref="NoteStyle.Normal"/>.</param>
 /// <param name="color">Optional backgrond color.</param>
 /// <param name="alignWithPrevious">Optional alignment with the previous note. Default <c>false</c>.</param>
 /// <exception cref="ArgumentNullException"><paramref name="stringBuilder"/> is <c>null</c>.</exception>
 public static void Note(this StringBuilder stringBuilder, string participantA, string participantB, string note, NoteStyle style = NoteStyle.Normal, Color color = null, bool alignWithPrevious = false)
 {
     stringBuilder.Note(NotePosition.Over, participantA + Constant.Comma + participantB, note, style, color, alignWithPrevious);
 }
Пример #9
0
 /// <summary>
 /// Renders a note.
 /// </summary>
 /// <param name="position">The position of the note.</param>
 /// <param name="participant">Optional participant. The position is relative to this participant.</param>
 /// <param name="note">The text of the note.</param>
 /// <param name="style">Optional of note. Default <see cref="NoteStyle.Normal"/>.</param>
 /// <param name="color">Optional backgrond color.</param>
 /// <param name="alignWithPrevious">Optional alignment with the previous note. Default <c>false</c>.</param>
 /// <exception cref="ArgumentNullException"><paramref name="stringBuilder"/> is <c>null</c>.</exception>
 public static void Note(this StringBuilder stringBuilder, NotePosition position, string participant, string note, NoteStyle style = NoteStyle.Normal, Color color = null, bool alignWithPrevious = false)
 {
     stringBuilder.NoteBase(position, participant, style, color, alignWithPrevious);
     stringBuilder.Append(Constant.Space);
     stringBuilder.Append(Constant.Colon);
     stringBuilder.Append(Constant.Space);
     stringBuilder.Append(note.Replace("\n", "\\n"));
     stringBuilder.AppendNewLine();
 }
Пример #10
0
 /// <summary>
 /// Renders the start of multiline note over a participant.
 /// </summary>
 /// <param name="participant">The participant the note is positioned over.</param>
 /// <param name="style">Optional styleof note. Default <see cref="NoteStyle.Normal"/>.</param>
 /// <param name="color">Optional backgrond color.</param>
 /// <param name="alignWithPrevious">Optional alignment with the previous note. Default <c>false</c>.</param>
 /// <exception cref="ArgumentNullException"><paramref name="stringBuilder"/> is <c>null</c>.</exception>
 public static void StartNote(this StringBuilder stringBuilder, string participant, NoteStyle style = NoteStyle.Normal, Color color = null, bool alignWithPrevious = false)
 {
     stringBuilder.StartNote(NotePosition.Over, participant, style, color, alignWithPrevious);
 }
Пример #11
0
        /// <summary>
        /// Renders the start of a multiline note.
        /// </summary>
        /// <param name="position">The position of the note.</param>
        /// <param name="participant">Optional participant. The position is relative to this participant.</param>
        /// <param name="style">Optional styleof note. Default <see cref="NoteStyle.Normal"/>.</param>
        /// <param name="color">Optional backgrond color.</param>
        /// <param name="alignWithPrevious">Optional alignment with the previous note. Default <c>false</c>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="stringBuilder"/> is <c>null</c>.</exception>
        public static void StartNote(this StringBuilder stringBuilder, NotePosition position, string participant = null, NoteStyle style = NoteStyle.Normal, Color color = null, bool alignWithPrevious = false)
        {
            if (stringBuilder is null)
            {
                throw new ArgumentNullException(nameof(stringBuilder));
            }

            stringBuilder.NoteBase(position, participant, style, color, alignWithPrevious);
            stringBuilder.AppendNewLine();
        }
Пример #12
0
 /// <summary>
 /// Changes the instrument on the specified channel.
 /// </summary>
 /// <param name="newInstrument">The instrument to change to.</param>
 private void ChangeInstrument(int newInstrument)
 {
     // Note: These instrument ranges map to the same thing:
     // 144-151 (7 square waves plus one noise)
     // 152-159
     // 160-167
     // 168-175
     this.instrument = newInstrument;
     if (this.instrument < 128)
     {
         ChangeNoteStyle(this.channelID, NoteStyle.Regular);
         noteStyle = NoteStyle.Regular;
         MIDIMessage mst = new MIDIMessage();
         mst.Channel = channelID;
         mst.Status = MessageType.ProgramChange;
         mst.Data1 = this.instrument;
         SendEvent(mst);
     }
     else if (this.instrument > 143 & this.instrument < 176)
     {
         while (this.instrument > 151)
         {
             this.instrument -= 8;
         }
         if (this.instrument == 151)
         {
             ChangeNoteStyle(this.channelID, NoteStyle.Noise);
             noteStyle = NoteStyle.Noise;
         }
         else
         {
             ChangeNoteStyle(this.channelID, NoteStyle.PSG);
             noteStyle = NoteStyle.PSG;
             ChangeDuty(this.channelID, .125f * (this.instrument - 143));
         }
     }
     else
     {
         ChangeNoteStyle(this.channelID, NoteStyle.Drums);
         noteStyle = NoteStyle.Drums;
     }
 }
Пример #13
0
 /// <summary>
 /// Resets the default values for the MML being played.
 /// </summary>
 /// <param name="channelOpen">If the channel is currently open, then do this.</param>
 public void ResetChannelDefaults()
 {
     this.velocity = 127;
     this.octave = 5;
     this.noteTimeValue = 4;
     this.nextUpdateTime = 0;
     this.lastNotePlayed = 0;
     this.noteStyle = NoteStyle.Regular;
     this.mStack.Refresh();
     ChangeNoteStyle(this.channelID, this.noteStyle);
 }
Пример #14
0
        /// <summary>
        /// Base for rendering a note.
        /// </summary>
        /// <param name="position">The position of the note.</param>
        /// <param name="participant">Optional participant. The position is relative to this participant.</param>
        /// <param name="style">Optional style of note. Default <see cref="NoteStyle.Normal"/>.</param>
        /// <param name="color">Optional backgrond color.</param>
        /// <param name="alignWithPrevious">Optional alignment with the previous note. Default <c>false</c>.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="stringBuilder"/> is <c>null</c>.</exception>
        internal static void NoteBase(this StringBuilder stringBuilder, NotePosition position, string participant = null, NoteStyle style = NoteStyle.Normal, Color color = null, bool alignWithPrevious = false)
        {
            if (stringBuilder is null)
            {
                throw new ArgumentNullException(nameof(stringBuilder));
            }

            if (alignWithPrevious)
            {
                stringBuilder.Append(Constant.AlignNote);
                stringBuilder.Append(Constant.Space);
            }

            switch (style)
            {
            case NoteStyle.Hexagonal:
                stringBuilder.Append(Constant.NoteHexagon);
                break;

            case NoteStyle.Box:
                stringBuilder.Append(Constant.NoteBox);
                break;
            }

            stringBuilder.Append(Constant.Note);
            stringBuilder.Append(Constant.Space);
            stringBuilder.Append(position.ToString().ToLowerInvariant());

            if (!string.IsNullOrWhiteSpace(participant))
            {
                if (position != NotePosition.Over)
                {
                    stringBuilder.Append(Constant.Space);
                    stringBuilder.Append(Constant.Of);
                }

                stringBuilder.Append(Constant.Space);
                stringBuilder.Append(participant);
            }

            if (color is not null && color.ToString() != string.Empty)
            {
                stringBuilder.Append(Constant.Space);
                stringBuilder.Append(color);
            }
        }