Exemple #1
0
 public SoundEntry(SampleSet samples,int eid)
     : base(eid)
 {
     if (samples == null)
         throw new ArgumentNullException("samples");
     this.samples = samples;
 }
Exemple #2
0
        public override Entry Load(byte[][] items, int eid)
        {
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }
            if (items.Length != 2)
            {
                ErrorManager.SignalError("WavebankEntry: Wrong number of items");
            }
            if (items[0].Length != 8)
            {
                ErrorManager.SignalError("WavebankEntry: First item length is wrong");
            }
            int id     = BitConv.FromInt32(items[0], 0);
            int length = BitConv.FromInt32(items[0], 4);

            if (id < 0 || id > 6)
            {
                ErrorManager.SignalIgnorableError("WavebankEntry: ID is invalid");
            }
            if (length != items[1].Length)
            {
                ErrorManager.SignalIgnorableError("WavebankEntry: Length field mismatch");
            }
            return(new WavebankEntry(id, SampleSet.Load(items[1]), eid));
        }
Exemple #3
0
 public static VAB Join(VH vh,SampleLine[] vb)
 {
     if (vh == null)
         throw new ArgumentNullException("vh");
     if (vb == null)
         throw new ArgumentNullException("vb");
     if (vh.VBSize != vb.Length)
     {
         ErrorManager.SignalIgnorableError("VAB: VB size field mismatch");
     }
     SampleSet[] waves = new SampleSet [vh.Waves.Count];
     int offset = 0;
     for (int i = 0;i < vh.Waves.Count;i++)
     {
         int wavelength = vh.Waves[i];
         if (offset + wavelength > vb.Length)
         {
             ErrorManager.SignalError("VAB: Wave ends out of bounds");
         }
         SampleLine[] wavelines = new SampleLine[wavelength];
         for (int j = 0;j < wavelength;j++)
         {
             wavelines[j] = vb[offset + j];
         }
         offset += wavelength;
         waves[i] = new SampleSet(wavelines);
     }
     return new VAB(vh.IsOldVersion,vh.Volume,vh.Panning,vh.Attribute1,vh.Attribute2,vh.Programs,waves);
 }
Exemple #4
0
        public static VAB Join(VH vh, SampleLine[] vb)
        {
            if (vh == null)
            {
                throw new ArgumentNullException("vh");
            }
            if (vb == null)
            {
                throw new ArgumentNullException("vb");
            }
            if (vh.VBSize != vb.Length)
            {
                ErrorManager.SignalIgnorableError("VAB: VB size field mismatch");
            }
            SampleSet[] waves  = new SampleSet [vh.Waves.Count];
            int         offset = 0;

            for (int i = 0; i < vh.Waves.Count; i++)
            {
                int wavelength = vh.Waves[i];
                if (offset + wavelength > vb.Length)
                {
                    ErrorManager.SignalError("VAB: Wave ends out of bounds");
                }
                SampleLine[] wavelines = new SampleLine[wavelength];
                for (int j = 0; j < wavelength; j++)
                {
                    wavelines[j] = vb[offset + j];
                }
                offset  += wavelength;
                waves[i] = new SampleSet(wavelines);
            }
            return(new VAB(vh.IsOldVersion, vh.Volume, vh.Panning, vh.Attribute1, vh.Attribute2, vh.Programs, waves));
        }
Exemple #5
0
 public SoundEntry(SampleSet samples, int eid) : base(eid)
 {
     if (samples == null)
     {
         throw new ArgumentNullException("samples");
     }
     this.samples = samples;
 }
Exemple #6
0
 public WavebankEntry(int id,SampleSet samples,int eid)
     : base(eid)
 {
     if (samples == null)
         throw new ArgumentNullException("samples");
     this.id = id;
     this.samples = samples;
 }
Exemple #7
0
 public WavebankEntry(int id, SampleSet samples, int eid) : base(eid)
 {
     if (samples == null)
     {
         throw new ArgumentNullException("samples");
     }
     this.id      = id;
     this.samples = samples;
 }
Exemple #8
0
 public override Entry Load(byte[][] items, int eid)
 {
     if (items == null)
     {
         throw new ArgumentNullException("items");
     }
     if (items.Length != 1)
     {
         ErrorManager.SignalError("SoundEntry: Wrong number of items");
     }
     return(new SoundEntry(SampleSet.Load(items[0]), eid));
 }
Exemple #9
0
        public SoundBox(SampleSet samples)
        {
            this.samples = samples;

            spPlayer = new SoundPlayer();

            tbbExport = new ToolStripButton();
            tbbExport.Text = "Export";
            tbbExport.Click += new EventHandler(tbbExport_Click);

            tsToolbar = new ToolStrip();
            tsToolbar.Dock = DockStyle.Top;
            tsToolbar.Items.Add(tbbExport);

            cmdPlay11025 = new Button();
            cmdPlay11025.Dock = DockStyle.Fill;
            cmdPlay11025.Text = "Play (11025 Hz)";
            cmdPlay11025.Click += new EventHandler(cmdPlay11025_Click);

            cmdPlay22050 = new Button();
            cmdPlay22050.Dock = DockStyle.Fill;
            cmdPlay22050.Text = "Play (22050 Hz)";
            cmdPlay22050.Click += new EventHandler(cmdPlay22050_Click);

            cmdExport11025 = new Button();
            cmdExport11025.Dock = DockStyle.Fill;
            cmdExport11025.Text = "Export Wave (11025 Hz)";
            cmdExport11025.Click += new EventHandler(cmdExport11025_Click);

            cmdExport22050 = new Button();
            cmdExport22050.Dock = DockStyle.Fill;
            cmdExport22050.Text = "Export Wave (22050 Hz)";
            cmdExport22050.Click += new EventHandler(cmdExport22050_Click);

            pnOptions = new TableLayoutPanel();
            pnOptions.Dock = DockStyle.Fill;
            pnOptions.ColumnCount = 2;
            pnOptions.RowCount = 3;
            pnOptions.ColumnStyles.Add(new ColumnStyle(SizeType.Percent,50));
            pnOptions.ColumnStyles.Add(new ColumnStyle(SizeType.Percent,50));
            pnOptions.RowStyles.Add(new RowStyle(SizeType.Percent,50));
            pnOptions.RowStyles.Add(new RowStyle(SizeType.Percent,50));
            pnOptions.Controls.Add(cmdPlay11025,0,0);
            pnOptions.Controls.Add(cmdPlay22050,0,1);
            pnOptions.Controls.Add(cmdExport11025,1,0);
            pnOptions.Controls.Add(cmdExport22050,1,1);

            Controls.Add(pnOptions);
            Controls.Add(tsToolbar);
        }
 private void Menu_Export_Linked_VB()
 {
     SampleLine[] vb = FindLinkedVB();
     byte[] data = new SampleSet(vb).Save();
     FileUtil.SaveFile(data,FileFilters.VB,FileFilters.Any);
 }