Esempio n. 1
0
 public void LoadSf2(Sf2.Sf2Region[] regions, AssetManager assets)
 {
     intervalList = new PatchInterval[regions.Length];
     for (int x = 0; x < intervalList.Length; x++)
     {
         byte loKey;
         byte hiKey;
         byte loVel;
         byte hiVel;
         if (BitConverter.IsLittleEndian)
         {
             loKey = (byte)(regions[x].Generators[(int)GeneratorEnum.KeyRange] & 0xFF);
             hiKey = (byte)((regions[x].Generators[(int)GeneratorEnum.KeyRange] >> 8) & 0xFF);
             loVel = (byte)(regions[x].Generators[(int)GeneratorEnum.VelocityRange] & 0xFF);
             hiVel = (byte)((regions[x].Generators[(int)GeneratorEnum.VelocityRange] >> 8) & 0xFF);
         }
         else
         {
             hiKey = (byte)(regions[x].Generators[(int)GeneratorEnum.KeyRange] & 0xFF);
             loKey = (byte)((regions[x].Generators[(int)GeneratorEnum.KeyRange] >> 8) & 0xFF);
             hiVel = (byte)(regions[x].Generators[(int)GeneratorEnum.VelocityRange] & 0xFF);
             loVel = (byte)((regions[x].Generators[(int)GeneratorEnum.VelocityRange] >> 8) & 0xFF);
         }
         Sf2Patch sf2 = new Sf2Patch(patchName + "_" + x);
         sf2.Load(regions[x], assets);
         intervalList[x] = new PatchInterval(sf2, 0, 15, loKey, hiKey, loVel, hiVel);
     }
     DetermineIntervalType();
 }
 //public void LoadSfz(SfzRegion[] regions, AssetManager assets, string directory)
 //{
 //    //Load sub instruments first
 //    intervalList = new PatchInterval[regions.Length];
 //    for (int x = 0; x < intervalList.Length; x++)
 //    {
 //        SfzRegion r = regions[x];
 //        DescriptorList descList = new DescriptorList(r);
 //        assets.LoadSampleAsset(descList.GenDescriptions[0].AssetName, patchName, directory);
 //        SfzPatch sfzPatch = new SfzPatch(patchName + "_" + x);
 //        sfzPatch.Load(descList, assets);
 //        intervalList[x] = new PatchInterval(sfzPatch, r.loChan, r.hiChan, r.loKey, r.hiKey, r.loVel, r.hiVel);
 //    }
 //    DetermineIntervalType();
 //}
 public void LoadSf2(Sf2.Sf2Region[] regions, AssetManager assets)
 {
     intervalList = new PatchInterval[regions.Length];
     for (int x = 0; x < intervalList.Length; x++)
     {
         byte loKey;
         byte hiKey;
         byte loVel;
         byte hiVel;
         if(BitConverter.IsLittleEndian)
         {
             loKey = (byte)(regions[x].Generators[(int)GeneratorEnum.KeyRange] & 0xFF);
             hiKey = (byte)((regions[x].Generators[(int)GeneratorEnum.KeyRange] >> 8) & 0xFF);
             loVel = (byte)(regions[x].Generators[(int)GeneratorEnum.VelocityRange] & 0xFF);
             hiVel = (byte)((regions[x].Generators[(int)GeneratorEnum.VelocityRange] >> 8) & 0xFF);
         }
         else
         {
             hiKey = (byte)(regions[x].Generators[(int)GeneratorEnum.KeyRange] & 0xFF);
             loKey = (byte)((regions[x].Generators[(int)GeneratorEnum.KeyRange] >> 8) & 0xFF);
             hiVel = (byte)(regions[x].Generators[(int)GeneratorEnum.VelocityRange] & 0xFF);
             loVel = (byte)((regions[x].Generators[(int)GeneratorEnum.VelocityRange] >> 8) & 0xFF);
         }
         Sf2Patch sf2 = new Sf2Patch(patchName + "_" + x);
         sf2.Load(regions[x], assets);
         intervalList[x] = new PatchInterval(sf2, 0, 15, loKey, hiKey, loVel, hiVel);
     }
     DetermineIntervalType();
 }