Exemplo n.º 1
0
 public override AGeneratorEnvelope GetNextOscillator(ref GeneratorEnvelope aGeneratorEnvelope)
 {
     if (aGeneratorEnvelope.timeElapsedHold >= aGeneratorEnvelope.soundfont.ampeg.ampegHold)
     {
         return(GeneratorEnvelopeSet.generatorEnvelopeDecay.GetNextOscillator(ref aGeneratorEnvelope));
     }
     else
     {
         return(this);
     }
 }
Exemplo n.º 2
0
 public override AGeneratorEnvelope GetNextOscillator(ref GeneratorEnvelope aGeneratorEnvelope)
 {
     if (aGeneratorEnvelope.timeElapsedDelay >= aGeneratorEnvelope.soundfont.ampeg.ampegDelay)
     {
         return(GeneratorEnvelopeSet.generatorEnvelopeAttack.GetNextOscillator(ref aGeneratorEnvelope));
     }
     else
     {
         return(this);
     }
 }
Exemplo n.º 3
0
        private void AddSamplePoint(double aAddSamples, ref GeneratorEnvelope aGeneratorEnvelope)
        {
            aGeneratorEnvelope.samplePosition += aAddSamples * aGeneratorEnvelope.sampleSpeed;

            if (aGeneratorEnvelope.soundfont.soundinfo.loopMode == true && aGeneratorEnvelope.samplePosition > aGeneratorEnvelope.soundfont.soundinfo.loopEnd)
            {
                // To Be Commented.
                // 計算式の意味を説明する.
                aGeneratorEnvelope.samplePosition = aGeneratorEnvelope.soundfont.soundinfo.loopStart + (aGeneratorEnvelope.samplePosition - aGeneratorEnvelope.soundfont.soundinfo.loopEnd);
            }
        }
 public override AGeneratorEnvelope GetNextOscillator(ref GeneratorEnvelope aGeneratorEnvelope)
 {
     if (aGeneratorEnvelope.timeElapsedRelease >= aGeneratorEnvelope.soundfont.ampeg.ampegRelease)
     {
         return(GeneratorEnvelopeSet.generatorEnvelopeEnd.GetNextOscillator(ref aGeneratorEnvelope));
     }
     else
     {
         return(this);
     }
 }
Exemplo n.º 5
0
 public override AGeneratorEnvelope GetNextOscillator(ref GeneratorEnvelope aGeneratorEnvelope)
 {
     // リリース時間に適当に重みを掛け引く.
     if (aGeneratorEnvelope.secondsSustain != 0 && aGeneratorEnvelope.timeElapsedSustain >= aGeneratorEnvelope.secondsSustain - aGeneratorEnvelope.soundfont.ampeg.ampegRelease / 3.0d)
     //if( aGeneratorEnvelope.secondsSustain != 0 && timeElapsed >= aGeneratorEnvelope.secondsSustain )
     {
         return(GeneratorEnvelopeSet.generatorEnvelopeRelease.GetNextOscillator(ref aGeneratorEnvelope));
     }
     else
     {
         return(this);
     }
 }
Exemplo n.º 6
0
        public void GetEnvelope(double[] aBufer, double aAddSamples, ref GeneratorEnvelope aGeneratorEnvelope)
        {
            if (( int )aGeneratorEnvelope.samplePosition + 1 < aGeneratorEnvelope.waveform.format.samples)
            {
                aBufer[0] = MeanInterpolation.Calculate(aGeneratorEnvelope.waveform, 0, aGeneratorEnvelope.samplePosition);
                aBufer[1] = MeanInterpolation.Calculate(aGeneratorEnvelope.waveform, 1, aGeneratorEnvelope.samplePosition);
            }
            // To Be Commented.
            // ループエンドまでは再生する。
            else if (( int )aGeneratorEnvelope.samplePosition >= aGeneratorEnvelope.soundfont.soundinfo.loopEnd && aGeneratorEnvelope.soundfont.soundinfo.loopMode == true)
            {
                // To Be Commented.
                // なぜ"loopStart + 1"になるのか確認する.
                aBufer[0] = MeanInterpolation.Calculate(aGeneratorEnvelope.waveform, 0, aGeneratorEnvelope.samplePosition, aGeneratorEnvelope.soundfont.soundinfo.loopStart + 1);
                aBufer[1] = MeanInterpolation.Calculate(aGeneratorEnvelope.waveform, 1, aGeneratorEnvelope.samplePosition, aGeneratorEnvelope.soundfont.soundinfo.loopStart + 1);
            }

            AddSamplePoint(aAddSamples, ref aGeneratorEnvelope);
        }
Exemplo n.º 7
0
        public override void Generate(double[] aWaveform, double aAddSamples, double aSampleSpeed, ref GeneratorEnvelope aGeneratorEnvelope)
        {
            GetEnvelope(aWaveform, aAddSamples, ref aGeneratorEnvelope);
            double lEnvelope = aGeneratorEnvelope.soundfont.ampeg.ampegSustain;

            aWaveform[0] *= lEnvelope;
            aWaveform[1] *= lEnvelope;

            aGeneratorEnvelope.timeElapsedSustain += aSampleSpeed;
            aGeneratorEnvelope.timeElapsedSum     += aSampleSpeed;

            //elapsed += 1.0d;
            //elapsedSum += 1.0d;
        }
Exemplo n.º 8
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());
 }
Exemplo n.º 9
0
        public override void Generate(double[] aWaveform, double aAddSamples, double aSampleSpeed, ref GeneratorEnvelope aGeneratorEnvelope)
        {
            GetEnvelope(aWaveform, aAddSamples, ref aGeneratorEnvelope);
            double lEnvelope = 1.0f;

            aWaveform[0] *= lEnvelope;
            aWaveform[1] *= lEnvelope;

            aGeneratorEnvelope.timeElapsedHold += aSampleSpeed;
            aGeneratorEnvelope.timeElapsedSum  += aSampleSpeed;
        }
Exemplo n.º 10
0
        public override void Generate(double[] aBuffer, double aAddSamples, double aSampleSpeed, ref GeneratorEnvelope aGeneratorEnvelope)
        {
            aBuffer[0] = 0;
            aBuffer[1] = 0;

            aGeneratorEnvelope.timeElapsedDelay += aSampleSpeed;
            aGeneratorEnvelope.timeElapsedSum   += aSampleSpeed;
        }
Exemplo n.º 11
0
 public abstract AGeneratorEnvelope GetNextOscillator(ref GeneratorEnvelope aGeneratorEnvelope);
Exemplo n.º 12
0
 public abstract void Generate(double[] aBuffer, double aAddSamples, double aSampleSpeed, ref GeneratorEnvelope aGeneratorEnvelope);
        public override void Generate(double[] aBuffer, double aAddSamples, double aSampleSpeed, ref GeneratorEnvelope aGeneratorEnvelope)
        {
            GetEnvelope(aBuffer, aAddSamples, ref aGeneratorEnvelope);
            double lEnvelope = aGeneratorEnvelope.soundfont.ampeg.ampegStart + (1.0f - aGeneratorEnvelope.soundfont.ampeg.ampegStart) * aGeneratorEnvelope.timeElapsedAttack / aGeneratorEnvelope.soundfont.ampeg.ampegAttack;

            aBuffer[0] *= lEnvelope;
            aBuffer[1] *= lEnvelope;

            aGeneratorEnvelope.timeElapsedAttack += aSampleSpeed;
            aGeneratorEnvelope.timeElapsedSum    += aSampleSpeed;
        }
Exemplo n.º 14
0
 public override AGeneratorEnvelope GetNextOscillator(ref GeneratorEnvelope aGeneratorEnvelope)
 {
     return(this);
 }
Exemplo n.º 15
0
 public override void Generate(double[] aBuffer, double aAddSamples, double aSampleSpeed, ref GeneratorEnvelope aGeneratorEnvelope)
 {
     aBuffer[0] = 0;
     aBuffer[1] = 0;
 }