Пример #1
0
 public void Portament(int aNoteDestination, double aPitch, ref MidiPitch aMidiPitch)
 {
     if (/*aMidiStatus.GetBank() != 0x7F00 &&*/ aMidiPitch.GetPortamentFlag() == true)
     {
         portamentTime            = aMidiPitch.GetPortamentTime();
         noteFrequencyDestination = 440.0d * Math.Pow(2.0d, (aNoteDestination - 69.0d) / 12.0f) * Math.Pow(2.0d, aPitch / 1200.0d);
         noteFrequencyDiff        = noteFrequencyDestination - noteFrequency;
     }
 }
Пример #2
0
        public FilterVibrato(ref MidiPitch aMidiPitch)
        {
            lowFrequency          = aMidiPitch.lowFrequency;
            lowFrequencyDirection = aMidiPitch.mulBase;

            /*
             * if( aMidiStatus.GetBank() == 0x7F00 )
             * {
             *      lowFrequencyDirection = 0.0d;
             * }*/
        }
Пример #3
0
        public void Filter(ref double lSampleSpeed, int aSampleRate, ref MidiPitch aMidiPitch)
        {
            if (lowFrequencyDirection != 0.0d)
            {
                lowFrequency += lowFrequencyDirection;

                if (lowFrequency >= aMidiPitch.modHigh * aSampleRate)
                {
                    lowFrequencyDirection = -aMidiPitch.mulBase * aSampleRate;
                }
                else if (lowFrequency < aMidiPitch.modLow * aSampleRate)
                {
                    lowFrequencyDirection = aMidiPitch.mulBase * aSampleRate;
                }

                lSampleSpeed *= lowFrequency;
            }
        }
Пример #4
0
        public void Oscillate(double[] aBuffer, int aSampleRate, ref MidiVolume aMidiVolume, ref MidiPitch aMidiPitch)
        {
            generatorPortament.Update(aSampleRate);

            double lSampleSpeed = 1.0d / ( double )aSampleRate;
            double lAddSamples  = generatorPortament.noteFrequency * aMidiPitch.GetFrequency() * lSampleSpeed;

            filterVibrato.Filter(ref lAddSamples, aSampleRate, ref aMidiPitch);

            generatorEnvelope.Generate(aBuffer, lAddSamples, lSampleSpeed);
        }
Пример #5
0
        public void Portament(byte aNote, byte aVelocity, SoundfontBase aSoundfont, ref MidiVolume aMidiVolume, ref MidiPitch aMidiPitch, double aSecondsSustain = 0.0d)
        {
            Logger.LogNormal("Portament");

            generatorEnvelope.Set(aSoundfont, aVelocity, aSecondsSustain);
            generatorPortament.Portament(aNote, aSoundfont.soundinfo.GetPitch(), ref aMidiPitch);
        }
Пример #6
0
 public MidiOscillator(byte aNote, byte aInstrument, byte aVelocity, SoundfontBase aSoundfont, ref MidiVolume aMidiVolume, ref MidiPitch aMidiPitch, double aSecondsSustain = 0.0d)
 {
     generatorEnvelope  = new GeneratorEnvelope(aSoundfont, aVelocity, aSecondsSustain);
     filterVibrato      = new FilterVibrato(ref aMidiPitch);
     generatorPortament = new GeneratorPortament(aNote, aSoundfont.soundinfo.GetPitch());
 }