Example #1
0
 public void Load(Sf2Region region, AssetManager assets)
 {
     this.exGroup        = region.Generators[(int)GeneratorEnum.ExclusiveClass];
     this.exTarget       = exGroup;
     iniFilterFc         = region.Generators[(int)GeneratorEnum.InitialFilterCutoffFrequency];
     filterQ             = SynthHelper.DBtoLinear(region.Generators[(int)GeneratorEnum.InitialFilterQ] / 10.0);
     initialAttn         = -region.Generators[(int)GeneratorEnum.InitialAttenuation] / 10f;
     keyOverride         = region.Generators[(int)GeneratorEnum.KeyNumber];
     velOverride         = region.Generators[(int)GeneratorEnum.Velocity];
     keynumToModEnvHold  = region.Generators[(int)GeneratorEnum.KeyNumberToModulationEnvelopeHold];
     keynumToModEnvDecay = region.Generators[(int)GeneratorEnum.KeyNumberToModulationEnvelopeDecay];
     keynumToVolEnvHold  = region.Generators[(int)GeneratorEnum.KeyNumberToVolumeEnvelopeHold];
     keynumToVolEnvDecay = region.Generators[(int)GeneratorEnum.KeyNumberToVolumeEnvelopeDecay];
     pan              = new PanComponent(region.Generators[(int)GeneratorEnum.Pan] / 500f, PanFormulaEnum.Neg3dBCenter);
     modLfoToPitch    = region.Generators[(int)GeneratorEnum.ModulationLFOToPitch];
     vibLfoToPitch    = region.Generators[(int)GeneratorEnum.VibratoLFOToPitch];
     modEnvToPitch    = region.Generators[(int)GeneratorEnum.ModulationEnvelopeToPitch];
     modLfoToFilterFc = region.Generators[(int)GeneratorEnum.ModulationLFOToFilterCutoffFrequency];
     modEnvToFilterFc = region.Generators[(int)GeneratorEnum.ModulationEnvelopeToFilterCutoffFrequency];
     modLfoToVolume   = region.Generators[(int)GeneratorEnum.ModulationLFOToVolume] / 10f;
     LoadGen(region, assets);
     LoadEnvelopes(region);
     LoadLfos(region);
     LoadFilter(region);
 }
Example #2
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];
        }
Example #3
0
        public SynthParameters(Synthesizer synth)
        {
            Synth = synth;

            Pan            = new CCValue(0);
            Volume         = new CCValue(0);
            Expression     = new CCValue(0);
            ModRange       = new CCValue(0);
            PitchBend      = new CCValue(0);
            MasterFineTune = new CCValue(0);
            Rpn            = new CCValue(0);

            CurrentPan = new PanComponent();

            ResetControllers();
        }