/[svn]/linuxsampler/trunk/src/audiothread.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/audiothread.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 13 by schoenebeck, Fri Nov 21 15:07:23 2003 UTC revision 15 by schoenebeck, Sun Nov 23 21:16:49 2003 UTC
# Line 35  Line 35 
35  #include "voice.h"  #include "voice.h"
36  #include "audioio.h"  #include "audioio.h"
37  #include "gig.h"  #include "gig.h"
   
38  #include "rtelmemorypool.h"  #include "rtelmemorypool.h"
39    
40  #define PITCHBEND_SEMITONES     12  #define PITCHBEND_SEMITONES     12
# Line 46  Line 45 
45    
46  class AudioThread : public Thread {  class AudioThread : public Thread {
47      public:      public:
48          int ActiveVoiceCount;  ///< number of currently active voices          int ActiveVoiceCount;     ///< number of currently active voices
49          int ActiveVoiceCountMax;          int ActiveVoiceCountMax;  ///< the maximum voice usage since application start
50    
51          AudioThread(AudioIO* pAudioIO, DiskThread* pDiskThread, gig::Instrument* pInstrument);          AudioThread(AudioIO* pAudioIO, DiskThread* pDiskThread, gig::Instrument* pInstrument);
52         ~AudioThread();         ~AudioThread();
# Line 70  class AudioThread : public Thread { Line 69  class AudioThread : public Thread {
69              uint8_t        number;              uint8_t        number;
70              uint8_t        value;              uint8_t        value;
71          } command;          } command;
72          struct sustained_key_t {          struct midi_key_info_t {
73              int midikey;              RTEList<Voice*>*             pActiveVoices; ///< Contains the active voices associated with the MIDI key.
74              int velocity;              RTEList<Voice*>::NodeHandle  hSustainPtr;   ///< Points to the voice element in the active voice list which has not received a note-off yet (this pointer is needed for sustain pedal handling)
75                bool                         Sustained;     ///< Is true if the MIDI key is currently sustained, thus if Note-off arrived while sustain pedal pressed.
76          };          };
77    
78          RingBuffer<command_t>*           pCommandQueue;          RingBuffer<command_t>*           pCommandQueue;
79          float*                           pAudioSumBuffer;    ///< Audio sum of all voices (32 bit)          float*                           pAudioSumBuffer;    ///< Audio sum of all voices (32 bit)
80          Voice**                          pVoices;            ///< The voice pool, containing all Voices (active and inactice voices) in unsorted order          Voice**                          pVoices;            ///< The voice pool, containing all Voices (active and inactice voices) in unsorted order
81          RTEList<Voice *>*                pActiveVoices[128]; ///< Contains all active voices sorted by MIDI key number          midi_key_info_t                  pMIDIKeyInfo[128];  ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key
82          /* ActiveVoicePool is a memory pool of limited size (size=MAX VOICES) of active voices.          /* ActiveVoicePool is a memory pool of limited size (size=MAX VOICES) of active voices.
83             it can be allocated dynamically in real time and the allocated elements can be added to             it can be allocated dynamically in real time and the allocated elements can be added to
84             the linked lists represented by ActiveVoices[MIDIKey]. This means we can have unlimited             the linked lists represented by ActiveVoices[MIDIKey]. This means we can have unlimited
85             active voices per key. This if for example useful to manage the sustain pedal messages             active voices per key. This if for example useful to manage the sustain pedal messages
86           */           */
87          RTELMemoryPool<Voice *>*         ActiveVoicePool;          RTELMemoryPool<Voice*>*          ActiveVoicePool;
88          /* SustainedVoicePool is a dynamically allocated pool (size=MAX VOICES) and list of notes          RTELMemoryPool<uint>*            SustainedKeyPool;   ///< Contains the MIDI key numbers of all currently sustained keys.
            notes that were sustained and where the corresponding MIDI note-off arrived  
            but cannot processed yet. Basically when the sustain pedal is pressed and the  
            note-off on a certain midi key arrives. notes are not deleted from the  
            ActiveVoices[MIDIKey] list but an element is added in the SustainedVoicePool,  
            which is a dynamically allocated pool with a builtin list.  
            Then the pedal is finally released, this list is traversed and all elements  
            in the lists ActiveVoices[MIDIKey] ( where MIDIKey is contained in the list of  
            sustained voices) are processed (voices are released)  
         */  
         RTELMemoryPool<sustained_key_t>* SustainedKeyPool;  
89          AudioIO*                         pAudioIO;          AudioIO*                         pAudioIO;
90          DiskThread*                      pDiskThread;          DiskThread*                      pDiskThread;
91          gig::Instrument*                 pInstrument;          gig::Instrument*                 pInstrument;
92          bool                             SustainPedal;  ///< true if sustain pedal is down          bool                             SustainPedal;       ///< true if sustain pedal is down
93          uint8_t                          PrevHoldCCValue;          uint8_t                          PrevHoldCCValue;
94    
95          void ActivateVoice(uint8_t MIDIKey, uint8_t Velocity);          void ActivateVoice(uint8_t MIDIKey, uint8_t Velocity);

Legend:
Removed from v.13  
changed lines
  Added in v.15

  ViewVC Help
Powered by ViewVC