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 override void Load(DescriptorList description, AssetManager assets) { intervalList = new PatchInterval[description.CustomDescriptions.Length]; for (int x = 0; x < intervalList.Length; x++) { if (!description.CustomDescriptions[x].ID.ToLower().Equals("mpat")) { throw new Exception(string.Format("The patch: {0} has an invalid descriptor with id {1}", this.patchName, description.CustomDescriptions[x].ID)); } string patchName = (string)description.CustomDescriptions[x].Objects[0]; PatchAsset pAsset = assets.FindPatch(patchName); if (pAsset == null) { throw new Exception(string.Format("The patch: {0} could not be found. For multi patches all sub patches must be loaded first.", patchName)); } byte sChan = (byte)description.CustomDescriptions[x].Objects[1]; byte eChan = (byte)description.CustomDescriptions[x].Objects[2]; byte sKey = (byte)description.CustomDescriptions[x].Objects[3]; byte eKey = (byte)description.CustomDescriptions[x].Objects[4]; byte sVel = (byte)description.CustomDescriptions[x].Objects[5]; byte eVel = (byte)description.CustomDescriptions[x].Objects[6]; intervalList[x] = new PatchInterval(pAsset.Patch, sChan, eChan, sKey, eKey, sVel, eVel); } 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 PatchInfo(string name, PatchInterval pInterval) { Name = name; Ranges.Add(pInterval); }
public bool WithinRange(PatchInterval pInfo) { return((pInfo.Bank == Bank) && ((pInfo.Start <= End && pInfo.Start >= Start) || (pInfo.End <= End && pInfo.End >= Start))); }
public bool WithinRange(PatchInterval pInfo) { return (pInfo.Bank == Bank) && ((pInfo.Start <= End && pInfo.Start >= Start) || (pInfo.End <= End && pInfo.End >= Start)); }
//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(); }
public override void Load(DescriptorList description, AssetManager assets) { intervalList = new PatchInterval[description.CustomDescriptions.Length]; for (int x = 0; x < intervalList.Length; x++) { if (!description.CustomDescriptions[x].ID.ToLower().Equals("mpat")) throw new Exception(string.Format("The patch: {0} has an invalid descriptor with id {1}", this.patchName, description.CustomDescriptions[x].ID)); string patchName = (string)description.CustomDescriptions[x].Objects[0]; PatchAsset pAsset = assets.FindPatch(patchName); if(pAsset == null) throw new Exception(string.Format("The patch: {0} could not be found. For multi patches all sub patches must be loaded first.", patchName)); byte sChan = (byte)description.CustomDescriptions[x].Objects[1]; byte eChan = (byte)description.CustomDescriptions[x].Objects[2]; byte sKey = (byte)description.CustomDescriptions[x].Objects[3]; byte eKey = (byte)description.CustomDescriptions[x].Objects[4]; byte sVel = (byte)description.CustomDescriptions[x].Objects[5]; byte eVel = (byte)description.CustomDescriptions[x].Objects[6]; intervalList[x] = new PatchInterval(pAsset.Patch, sChan, eChan, sKey, eKey, sVel, eVel); } DetermineIntervalType(); }