/[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 10 by senoner, Tue Nov 11 23:30:47 2003 UTC revision 12 by schoenebeck, Sun Nov 16 19:01:50 2003 UTC
# Line 47  Line 47 
47    
48  class AudioThread : public Thread {  class AudioThread : public Thread {
49      public:      public:
50            int ActiveVoiceCount;  ///< number of currently active voices
51    
52          AudioThread(AudioIO* pAudioIO, DiskThread* pDiskThread, gig::Instrument* pInstrument);          AudioThread(AudioIO* pAudioIO, DiskThread* pDiskThread, gig::Instrument* pInstrument);
53         ~AudioThread();         ~AudioThread();
54          void ProcessNoteOn(uint8_t Pitch, uint8_t Velocity);          void ProcessNoteOn(uint8_t Pitch, uint8_t Velocity);
55          void ProcessNoteOff(uint8_t Pitch, uint8_t Velocity);          void ProcessNoteOff(uint8_t Pitch, uint8_t Velocity);
56          void ProcessContinuousController(uint8_t Channel, uint8_t Number, uint8_t Value);          void ProcessContinuousController(uint8_t Channel, uint8_t Number, uint8_t Value);
   
         // the number of currently active streams  
         // printed on the console the main thread (along with the active streams count)  
         int ActiveVoiceCount;  
   
57      protected:      protected:
58          int Main(); ///< Implementation of virtual method from class Thread          int Main(); ///< Implementation of virtual method from class Thread
59      private:      private:
# Line 73  class AudioThread : public Thread { Line 70  class AudioThread : public Thread {
70              uint8_t        number;              uint8_t        number;
71              uint8_t        value;              uint8_t        value;
72          } command;          } command;
73          RingBuffer<command_t>* pCommandQueue;          struct sustained_key_t {
74          float*                 pAudioSumBuffer;    ///< Audio sum of all voices (32 bit)              int midikey;
75          Voice**                pVoices;            ///< The voice pool, containing all Voices (active and inactice voices) in unsorted order              int velocity;
76            };
77    
78          RTEList<Voice *> *pActiveVoices[128];  ///< Contains all active voices sorted by MIDI key number          RingBuffer<command_t>*           pCommandQueue;
79            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
81            RTEList<Voice *>*                pActiveVoices[128]; ///< Contains all active voices sorted by MIDI key number
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          /* SustainedVoicePool is a dynamically allocated pool (size=MAX VOICES) and list of notes
89             notes that were sustained and where the corresponding MIDI note-off arrived             notes that were sustained and where the corresponding MIDI note-off arrived
90             but cannot processed yet. Basically when the sustain pedal is pressed and the             but cannot processed yet. Basically when the sustain pedal is pressed and the
# Line 94  class AudioThread : public Thread { Line 95  class AudioThread : public Thread {
95             in the lists ActiveVoices[MIDIKey] ( where MIDIKey is contained in the list of             in the lists ActiveVoices[MIDIKey] ( where MIDIKey is contained in the list of
96             sustained voices) are processed (voices are released)             sustained voices) are processed (voices are released)
97          */          */
98            RTELMemoryPool<sustained_key_t>* SustainedKeyPool;
99          typedef struct {          AudioIO*                         pAudioIO;
100                           int midikey;          DiskThread*                      pDiskThread;
101                           int velocity;          gig::Instrument*                 pInstrument;
102                         } sustained_key_t;          bool                             SustainPedal;  ///< true if sustain pedal is down
103            uint8_t                          PrevHoldCCValue;
         RTELMemoryPool<sustained_key_t> *SustainedKeyPool;  
   
         uint8_t PrevHoldCCValue;  
         // SustainPedal = 1 if the sustain pedal is down, otherwise it is 0  
         uint8_t SustainPedal;  
   
   
   
         AudioIO*               pAudioIO;  
         DiskThread*            pDiskThread;  
         gig::Instrument*       pInstrument;  
104    
105          void ActivateVoice(uint8_t MIDIKey, uint8_t Velocity);          void ActivateVoice(uint8_t MIDIKey, uint8_t Velocity);
106          void ReleaseVoice(uint8_t MIDIKey, uint8_t Velocity);          void ReleaseVoice(uint8_t MIDIKey, uint8_t Velocity);
107            void ReleaseVoice(Voice* pVoice);
108          void ContinuousController(uint8_t Channel, uint8_t Number, uint8_t Value);          void ContinuousController(uint8_t Channel, uint8_t Number, uint8_t Value);
         
109          void CacheInitialSamples(gig::Sample* pSample);          void CacheInitialSamples(gig::Sample* pSample);
110  };  };
111    

Legend:
Removed from v.10  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC