Exemple #1
0
        public override bool Init()
        {
            mh        = new ITHEADER();
            poslookup = new byte[256];
            itpat     = new ITNOTE [200 * 64];
            for (int i = 0; i < itpat.Length; i++)
            {
                itpat[i] = new ITNOTE();
            }

            mask = new byte [64];

            last = new ITNOTE[64];
            for (int i = 0; i < last.Length; i++)
            {
                last[i] = new ITNOTE();
            }

            return(true);
        }
Exemple #2
0
        bool IT_ReadPattern(ushort patrows)
        {
            int row = 0, flag, ch, blah;

            //ITNOTE *itt=itpat,dummy,*n,*l;

            int    place = 0;
            ITNOTE dummy, n, l;

            dummy = new ITNOTE();

            for (int i = 0; i < 200 * 64; i++)
            {
                itpat[i].Clear();
            }

            do
            {
                flag = m_Reader.Read_byte();
                if (m_Reader.isEOF())
                {
                    m_LoadError = MMERR_LOADING_PATTERN;
                    return(false);
                }

                if (flag == 0)
                {
                    place += m_Module.numchn;
                    row++;
                }
                else
                {
                    ch = remap[(flag - 1) & 63];
                    if (ch != -1)
                    {
                        n = itpat[ch + place];
                        l = last[ch];
                    }
                    else
                    {
                        n = l = dummy;
                    }

                    if ((flag & 128) != 0)
                    {
                        mask[ch] = m_Reader.Read_byte();
                    }
                    if ((mask[ch] & 1) != 0)
                    {
                        /* convert IT note off to internal note off */
                        if ((l.note = n.note = m_Reader.Read_byte()) == 255)
                        {
                            l.note = n.note = 253;
                        }
                    }
                    if ((mask[ch] & 2) != 0)
                    {
                        l.ins = n.ins = m_Reader.Read_byte();
                    }
                    if ((mask[ch] & 4) != 0)
                    {
                        l.volpan = n.volpan = m_Reader.Read_byte();
                    }
                    if ((mask[ch] & 8) != 0)
                    {
                        l.cmd = n.cmd = m_Reader.Read_byte();
                        l.inf = n.inf = m_Reader.Read_byte();
                    }
                    if ((mask[ch] & 16) != 0)
                    {
                        n.note = l.note;
                    }
                    if ((mask[ch] & 32) != 0)
                    {
                        n.ins = l.ins;
                    }
                    if ((mask[ch] & 64) != 0)
                    {
                        n.volpan = l.volpan;
                    }
                    if ((mask[ch] & 128) != 0)
                    {
                        n.cmd = l.cmd;
                        n.inf = l.inf;
                    }
                }
            } while(row < patrows);


//          for (int i = 0; i < itpat.Length; i++)
//          {
//              Debug.WriteLine("{0} {1} {2} {3} {4}", itpat[i].cmd, itpat[i].inf, itpat[i].ins, itpat[i].note, itpat[i].volpan);
//
            for (blah = 0; blah < m_Module.numchn; blah++)
            {
                if ((m_Module.tracks[numtrk++] = IT_ConvertTrack(itpat, patrows, blah)) == null)
                {
                    return(false);
                }
            }

            return(true);
        }