示例#1
0
 public void Program(byte program, bool mt32)
 {
     Clear();
     if (program > 127)
         return;
     _type = InstrumentType.Program;
     _instrument = new InstrumentProgram(program, mt32);
 }
 public void Adlib(byte[] instrument)
 {
     Clear();
     if (instrument == null)
     {
         return;
     }
     _type       = InstrumentType.AdLib;
     _instrument = new InstrumentAdLib(instrument);
 }
 public void Program(byte program, bool mt32)
 {
     Clear();
     if (program > 127)
     {
         return;
     }
     _type       = InstrumentType.Program;
     _instrument = new InstrumentProgram(program, mt32);
 }
 public void PcSpk(byte[] instrument)
 {
     Clear();
     if (instrument == null)
     {
         return;
     }
     _type       = InstrumentType.PcSpk;
     _instrument = new InstrumentPcSpk(instrument);
 }
        public void SaveOrLoad(Serializer s)
        {
            if (!s.IsLoading)
            {
                s.Writer.WriteByte((byte)_type);
                if (_instrument != null)
                {
                    _instrument.SaveOrLoad(s);
                }
            }
            else
            {
                Clear();
                _type = (InstrumentType)s.Reader.ReadByte();
                switch (_type)
                {
                case InstrumentType.None:
                    break;

                case InstrumentType.Program:
                    _instrument = new InstrumentProgram(s);
                    break;

                case InstrumentType.AdLib:
                    _instrument = new InstrumentAdLib(s.Reader.BaseStream);
                    break;

                // TODO: vs: Roland, MacSfx
//                    case InstrumentType.Roland:
//                        _instrument = new InstrumentRoland(s);
//                        break;
                case InstrumentType.PcSpk:
                    _instrument = new InstrumentPcSpk(s.Reader.BaseStream);
                    break;

//                    case InstrumentType.MacSfx:
//                        _instrument = new InstrumentMacSfx(s);
//                        break;
                default:
                    throw new NotSupportedException(string.Format("No known instrument classification #{0}", (int)_type));
                }
            }
        }
 public void Clear()
 {
     _instrument = null;
     _type       = InstrumentType.None;
 }
示例#7
0
 public void Adlib(byte[] instrument)
 {
     Clear();
     if (instrument == null)
         return;
     _type = InstrumentType.AdLib;
     _instrument = new InstrumentAdLib(instrument);
 }
示例#8
0
 public void Clear()
 {
     _instrument = null;
     _type = InstrumentType.None;
 }
示例#9
0
        public void SaveOrLoad(Serializer s)
        {
            if (!s.IsLoading)
            {
                s.Writer.WriteByte((byte)_type);
                if (_instrument != null)
                    _instrument.SaveOrLoad(s);
            }
            else
            {
                Clear();
                _type = (InstrumentType)s.Reader.ReadByte();
                switch (_type)
                {
                    case InstrumentType.None:
                        break;
                    case InstrumentType.Program:
                        _instrument = new InstrumentProgram(s);
                        break;
                    case InstrumentType.AdLib:
                        _instrument = new InstrumentAdLib(s.Reader.BaseStream);
                        break;
                // TODO: vs: Roland, MacSfx
//                    case InstrumentType.Roland:
//                        _instrument = new InstrumentRoland(s);
//                        break;
                    case InstrumentType.PcSpk:
                        _instrument = new InstrumentPcSpk(s.Reader.BaseStream);
                        break;
//                    case InstrumentType.MacSfx:
//                        _instrument = new InstrumentMacSfx(s);
//                        break;
                    default:
                        throw new NotSupportedException(string.Format("No known instrument classification #{0}", (int)_type));
                }
            }
        }
示例#10
0
 public void PcSpk(byte[] instrument)
 {
     Clear();
     if (instrument == null)
         return;
     _type = InstrumentType.PcSpk;
     _instrument = new InstrumentPcSpk(instrument);
 }