Beispiel #1
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);
 }
Beispiel #2
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));
        }
Beispiel #3
0
 private void Menu_Replace_VH()
 {
     byte[] data = FileUtil.OpenFile(FileFilters.VH,FileFilters.Any);
     if (data != null)
     {
         vh = VH.Load(data);
         oldmusicentrycontroller.OldMusicEntry.VH = vh;
     }
 }
Beispiel #4
0
 public OldVHController(OldMusicEntryController oldmusicentrycontroller,VH vh)
 {
     this.oldmusicentrycontroller = oldmusicentrycontroller;
     this.vh = vh;
     Node.Text = "VH";
     Node.ImageKey = "vh";
     Node.SelectedImageKey = "vh";
     AddMenu("Replace VH",Menu_Replace_VH);
     AddMenuSeparator();
     AddMenu("Export VH",Menu_Export_VH);
 }
Beispiel #5
0
 public void Split(out VH vh,out SampleLine[] vb)
 {
     List<SampleLine> samples = new List<SampleLine>();
     List<int> wavelengths = new List<int>();
     foreach (SampleSet wave in waves)
     {
         samples.AddRange(wave.SampleLines);
         wavelengths.Add(wave.SampleLines.Count);
     }
     vh = new VH(isoldversion,samples.Count,volume,panning,attribute1,attribute2,programs,wavelengths);
     vb = samples.ToArray();
 }
Beispiel #6
0
        public void Split(out VH vh, out SampleLine[] vb)
        {
            List <SampleLine> samples     = new List <SampleLine>();
            List <int>        wavelengths = new List <int>();

            foreach (SampleSet wave in waves)
            {
                samples.AddRange(wave.SampleLines);
                wavelengths.Add(wave.SampleLines.Count);
            }
            vh = new VH(isoldversion, samples.Count, volume, panning, attribute1, attribute2, programs, wavelengths);
            vb = samples.ToArray();
        }
Beispiel #7
0
 public OldMusicEntry(int vb0eid,int vb1eid,int vb2eid,int vb3eid,VH vh,SEP sep,int eid)
     : base(eid)
 {
     if (vh == null)
         throw new ArgumentNullException("vh");
     if (sep == null)
         throw new ArgumentNullException("sep");
     this.vb0eid = vb0eid;
     this.vb1eid = vb1eid;
     this.vb2eid = vb2eid;
     this.vb3eid = vb3eid;
     this.vh = vh;
     this.sep = sep;
 }
Beispiel #8
0
 public OldMusicEntry(int vb0eid, int vb1eid, int vb2eid, int vb3eid, VH vh, SEP sep, int eid) : base(eid)
 {
     if (vh == null)
     {
         throw new ArgumentNullException("vh");
     }
     if (sep == null)
     {
         throw new ArgumentNullException("sep");
     }
     this.vb0eid = vb0eid;
     this.vb1eid = vb1eid;
     this.vb2eid = vb2eid;
     this.vb3eid = vb3eid;
     this.vh     = vh;
     this.sep    = sep;
 }
Beispiel #9
0
        public override Entry Load(byte[][] items, int eid)
        {
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }
            if (items.Length != 3)
            {
                ErrorManager.SignalError("MusicEntry: Wrong number of items");
            }
            if (items[0].Length != 36)
            {
                ErrorManager.SignalError("MusicEntry: First item length is wrong");
            }
            int seqcount = BitConv.FromInt32(items[0], 0);
            int vheid    = BitConv.FromInt32(items[0], 4);
            int vb0eid   = BitConv.FromInt32(items[0], 8);
            int vb1eid   = BitConv.FromInt32(items[0], 12);
            int vb2eid   = BitConv.FromInt32(items[0], 16);
            int vb3eid   = BitConv.FromInt32(items[0], 20);
            int vb4eid   = BitConv.FromInt32(items[0], 24);
            int vb5eid   = BitConv.FromInt32(items[0], 28);
            int vb6eid   = BitConv.FromInt32(items[0], 32);
            VH  vh;

            if (items[1].Length != 0)
            {
                vh = VH.Load(items[1]);
            }
            else
            {
                vh = null;
            }
            SEP sep = SEP.Load(items[2], seqcount);

            return(new MusicEntry(vheid, vb0eid, vb1eid, vb2eid, vb3eid, vb4eid, vb5eid, vb6eid, vh, sep, eid));
        }