--- linuxsampler/trunk/src/engines/common/AbstractVoice.h 2010/09/14 17:09:08 2121 +++ linuxsampler/trunk/src/engines/common/AbstractVoice.h 2011/07/11 17:52:01 2205 @@ -4,7 +4,7 @@ * * * Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * * Copyright (C) 2005-2008 Christian Schoenebeck * - * Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev * + * Copyright (C) 2009-2011 Christian Schoenebeck and Grigor Iliev * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -37,6 +37,7 @@ #include "../gig/SmoothVolume.h" #include "../gig/Synthesizer.h" #include "../gig/Profiler.h" +#include "SignalUnitRack.h" // include the appropriate (unsigned) triangle LFO implementation #if CONFIG_UNSIGNED_TRIANG_ALGO == INT_MATH_SOLUTION @@ -100,6 +101,10 @@ ); virtual void Synthesize(uint Samples, sample_t* pSrc, uint Skip); + + uint GetSampleRate() { return GetEngine()->SampleRate; } + + virtual SignalUnitRack* GetSignalUnitRack() { return NULL; } void processCCEvents(RTList::Iterator& itEvent, uint End); void processPitchEvent(RTList::Iterator& itEvent); @@ -135,7 +140,7 @@ unsigned long MaxRAMPos; ///< The upper allowed limit (not actually the end) in the RAM sample cache, after that point it's not safe to chase the interpolator another time over over the current cache position, instead we switch to disk then. uint Delay; ///< Number of sample points the rendering process of this voice should be delayed (jitter correction), will be set to 0 after the first audio fragment cycle EG* pEG1; ///< Envelope Generator 1 (Amplification) - gig::EGADSR EG2; ///< Envelope Generator 2 (Filter cutoff frequency) TODO: use common EG instead of gig + EG* pEG2; ///< Envelope Generator 2 (Filter cutoff frequency) gig::EGDecay EG3; ///< Envelope Generator 3 (Pitch) TODO: use common EG instead? midi_ctrl VCFCutoffCtrl; midi_ctrl VCFResonanceCtrl; @@ -160,6 +165,19 @@ virtual InstrumentInfo GetInstrumentInfo() = 0; /** + * Most of the important members of the voice are set when the voice + * is triggered (like pEngineChannel, pRegion, pSample, etc). + * This method is called after these members are set and before + * the voice is actually triggered. + * Override this method if you need to do some additional + * initialization which depends on these members before the voice + * is triggered. + */ + virtual void AboutToTrigger() { } + + virtual bool EG1Finished(); + + /** * Gets the sample cache size in bytes. */ virtual unsigned long GetSampleCacheSize() = 0; @@ -226,6 +244,8 @@ */ virtual EGInfo CalculateEG2ControllerInfluence(double eg2ControllerValue) = 0; + virtual void TriggerEG2(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) = 0; + virtual float CalculateCutoffBase(uint8_t MIDIKeyVelocity) = 0; virtual float CalculateFinalCutoff(float cutoffBase) = 0;