Example #1
0
        internal override SVoice GetVoiceFromNote(byte voice, sbyte note, out bool fromDrum)
        {
            fromDrum = false;

            SVoice sv = voices[voice];

Read:
            M4AVoice v = (M4AVoice)sv.Voice;

            switch (v.Type)
            {
            case 0x40:
                var  multi = (M4ASMulti)sv;
                byte inst  = ROM.Instance.ReadByte((uint)(v.Keys + note));
                sv       = multi.Table[inst];
                fromDrum = false;     // In case there is a multi within a drum
                goto Read;

            case 0x80:
                var drum = (M4ASDrum)sv;
                sv       = drum.Table[note];
                fromDrum = true;
                goto Read;

            default:
                return(sv);
            }
        }
Example #2
0
 public string SendVoice(SVoice model)
 {
     return(string.Format(@"<xml>
                             <ToUserName><![CDATA[{0}]]></ToUserName>
                             <FromUserName><![CDATA[{1}]]></FromUserName>
                             <CreateTime>{2}</CreateTime>
                             <MsgType><![CDATA[{3}]]></MsgType>
                             <Voice>
                             <MediaId><![CDATA[{4}]]></MediaId>
                             </Voice>
                             </xml>", model.ToUserName, model.FromUserName, model.CreateTime, model.MsgType, model.MediaId));
 }
Example #3
0
        protected override void Load(uint table)
        {
            uint sampleCount = ROM.Instance.Game.SampleTableSize;

            Samples = new MLSSSSample[sampleCount];
            Offset  = ROM.Instance.Game.VoiceTable;

            for (int i = 0; i < 256; i++)
            {
                var  off        = ROM.Instance.ReadInt16((uint)(Offset + (i * 2)));
                var  nextOff    = ROM.Instance.ReadInt16((uint)(Offset + ((i + 1) * 2)));
                uint numEntries = (uint)(nextOff - off) / 8; // Each entry is 8 bytes
                voices[i] = new SVoice(new MLSSVoice((uint)(Offset + off), numEntries));
            }

            uint sOffset = ROM.Instance.Game.SampleTable;

            for (uint i = 0; i < sampleCount; i++)
            {
                int off = ROM.Instance.ReadInt32(sOffset + (i * 4));
                Samples[i] = (off == 0) ? null : new MLSSSSample((uint)(sOffset + off));
            }
        }
Example #4
0
        protected override void Load(uint table)
        {
            Offset = table;
            for (uint i = 0; i < 256; i++)
            {
                uint off = table + (i * 0xC);
                if (!ROM.IsValidRomOffset(off))
                {
                    break;
                }
                var voice = ROM.Instance.ReadStruct <M4AVoice>(off);
                switch (voice.Type) // Check type
                {
                case 0x0:
                case 0x8:
                    voices[i] = new M4ASDirect(voice);
                    break;

                case 0x3:
                case 0xB:
                    voices[i] = new M4ASWave(voice);
                    break;

                case 0x40:
                    voices[i] = new M4ASMulti(voice);
                    break;

                case 0x80:
                    voices[i] = new M4ASDrum(voice);
                    break;

                default:
                    voices[i] = new SVoice(voice);
                    break;
                }
            }
        }