Пример #1
0
        public override void Load(DescriptorList description, AssetManager assets)
        {
            //read in sfz params
            CustomDescriptor sfzConfig = description.FindCustomDescriptor("sfzi");

            exTarget    = (int)sfzConfig.Objects[0];
            exGroup     = (int)sfzConfig.Objects[1];
            sfzVolume   = (float)sfzConfig.Objects[2];
            sfzPan      = new PanComponent((float)sfzConfig.Objects[3], PanFormulaEnum.Neg3dBCenter);
            ampKeyTrack = (float)sfzConfig.Objects[4];
            ampRootKey  = (byte)sfzConfig.Objects[5];
            ampVelTrack = (float)sfzConfig.Objects[6];
            //read in the generator info
            GeneratorDescriptor gdes = description.GenDescriptions[0];

            if (gdes.SamplerType != WaveformEnum.SampleData)
            {
                throw new Exception("Sfz can only support sample data generators.");
            }
            this.genList[0] = gdes.ToGenerator(assets);
            //read in the envelope info
            this.envList[0] = description.EnvelopeDescriptions[0];
            this.envList[1] = description.EnvelopeDescriptions[1];
            this.envList[2] = description.EnvelopeDescriptions[2];
            //read in the lfo info
            this.lfoList[0] = description.LfoDescriptions[0];
            this.lfoList[1] = description.LfoDescriptions[1];
            this.lfoList[2] = description.LfoDescriptions[2];
            //read in the filter info
            this.fltrList[0] = description.FilterDescriptions[0];
        }
Пример #2
0
        public override void Load(DescriptorList description, AssetManager assets)
        {
            CustomDescriptor fmConfig = description.FindCustomDescriptor("fm2c");

            cIndex   = (double)fmConfig.Objects[0];
            mIndex   = (double)fmConfig.Objects[1];
            feedBack = (double)fmConfig.Objects[2];
            sync     = GetSyncModeFromString((string)fmConfig.Objects[3]);
            if (description.GenDescriptions[0].LoopMethod != LoopModeEnum.Continuous || description.GenDescriptions[1].LoopMethod != LoopModeEnum.Continuous)
            {
                throw new Exception("Fm2 patches must have continuous generators with wrapping bounds.");
            }
            genList[0] = description.GenDescriptions[0].ToGenerator(assets);
            genList[1] = description.GenDescriptions[1].ToGenerator(assets);
            envList[0] = description.EnvelopeDescriptions[0];
            envList[1] = description.EnvelopeDescriptions[1];
            lfoList[0] = description.LfoDescriptions[0];
        }
 public override void Load(DescriptorList description, AssetManager assets)
 {
     //read in sfz params
     CustomDescriptor sfzConfig = description.FindCustomDescriptor("sfzi");
     exTarget = (int)sfzConfig.Objects[0];
     exGroup = (int)sfzConfig.Objects[1];
     sfzVolume = (float)sfzConfig.Objects[2];
     sfzPan = new PanComponent((float)sfzConfig.Objects[3], PanFormulaEnum.Neg3dBCenter);
     ampKeyTrack = (float)sfzConfig.Objects[4];
     ampRootKey = (byte)sfzConfig.Objects[5];
     ampVelTrack = (float)sfzConfig.Objects[6];
     //read in the generator info
     GeneratorDescriptor gdes = description.GenDescriptions[0];
     if (gdes.SamplerType != WaveformEnum.SampleData)
         throw new Exception("Sfz can only support sample data generators.");
     gen = gdes.ToGenerator(assets);
     //read in the envelope info
     ptch_env = description.EnvelopeDescriptions[0];
     fltr_env = description.EnvelopeDescriptions[1];
     amp_env = description.EnvelopeDescriptions[2];
     //read in the lfo info
     ptch_lfo = description.LfoDescriptions[0];
     fltr_lfo = description.LfoDescriptions[1];
     amp_lfo = description.LfoDescriptions[2];
     //read in the filter info
     fltr = description.FilterDescriptions[0];
 }
 public override void Load(DescriptorList description, AssetManager assets)
 {
     CustomDescriptor fmConfig = description.FindCustomDescriptor("fm2c");
     cIndex = (double)fmConfig.Objects[0];
     mIndex = (double)fmConfig.Objects[1];
     feedBack = (double)fmConfig.Objects[2];
     sync = GetSyncModeFromString((string)fmConfig.Objects[3]);
     if (description.GenDescriptions[0].LoopMethod != LoopModeEnum.Continuous || description.GenDescriptions[1].LoopMethod != LoopModeEnum.Continuous)
         throw new Exception("Fm2 patches must have continuous generators with wrapping bounds.");
     cGen = description.GenDescriptions[0].ToGenerator(assets);
     mGen = description.GenDescriptions[1].ToGenerator(assets);
     cEnv = description.EnvelopeDescriptions[0];
     mEnv = description.EnvelopeDescriptions[1];
     lfo = description.LfoDescriptions[0];
 }