Ejemplo n.º 1
0
        string GetDebugInfo(int nTrackIndex, int nTrackOffset, int delta)
        {
            ushort msg16 = FileHandle.Get16Bit(nTrackIndex, nTrackOffset);
            byte   msg8  = (byte)(msg16 & 0xFF);
            // we want to skip a two-byte header?
            byte msg8Plus1 = FileHandle.Get8Bit(nTrackIndex, nTrackOffset + 2);

            CurrentStatus = msg16;
            return($"{{ Track Index: {nTrackIndex}, Track Offset: {nTrackOffset}, delta: {delta} }}\n" +
                   $"{{ 16 Bit Message: {msg16:X4}, 8 Bit Message: {msg8:X2}, next 8 Bit Message: {msg8Plus1:X2};");
        }
Ejemplo n.º 2
0
        public string GetEventString(int nTrackIndex, int nTrackOffset)
        {
            int offset0 = nTrackOffset, offset1 = nTrackOffset + 1;

            if (!StatusQuery.IsMidiMessage(CurrentRunningStatus8))
            {
                Debug.Assert(false, string.Format("warning… {0:X2}", CurrentRunningStatus8));
                return(null);
            }
            // metadata
            if (StatusQuery.IsSequencerSpecific(CurrentRunningStatus8))
            {
                return(StatusQuery.SystemExclusiveRange.Name);
            }
            else if (StatusQuery.IsNoteOn(CurrentRunningStatus8))
            {
                return(GetNoteMsg(offset0, StringRes.format_note_on));
            }
            else if (StatusQuery.IsNoteOff(CurrentRunningStatus8))
            {
                return(GetNoteMsg(offset0, StringRes.fotmat_note_off));
            }
            // channel/voice
            else if (0x21 == CurrentRunningStatus8)
            {
                return(FileHandle.Get8Bit(nTrackIndex, offset1).ToString());
            }
            else if (StatusQuery.IsKeyAftertouch(CurrentRunningStatus8))
            {
                return(string.Format(StringRes.mA, FileHandle[nTrackIndex, offset0], FileHandle[nTrackIndex, offset1]));
            }
            else if (StatusQuery.IsControlChange(CurrentRunningStatus8))
            {
                var mapIndex   = FileHandle.Get8Bit(nTrackIndex, offset0);
                var mapString1 = mapIndex > 127 ? $"{mapIndex}?" : EnumFile.CMAP[mapIndex].Trim();
                var mapString2 = FileHandle.Get8Bit(nTrackIndex, offset1);
                return(string.Format(StringRes.mB, mapString1, mapString2));
            }
            else if (StatusQuery.IsProgramChange(CurrentRunningStatus8))
            {
                return(EnumFile.IMAP[FileHandle[nTrackIndex, offset0]].Replace((char)0xA, (char)0x20).Trim());
            }
            else if (StatusQuery.IsChannelAftertouch(CurrentRunningStatus8))
            {
                return(StatusQuery.ChannelAftertouchRange.Name);
            }
            else if (StatusQuery.IsPitchBend(CurrentRunningStatus8))
            {
                return(StatusQuery.PitchBendRange.Name);
            }
            // system
            else if (StatusQuery.IsSystemCommon(CurrentRunningStatus8))
            {
                return(StatusQuery.SystemCommonMessageRange.Name);
            }
            else if (StatusQuery.IsSystemRealtime(CurrentRunningStatus8))
            {
                return(StatusQuery.SystemRealtimeRange.Name);
            }
            return(null);
        }