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

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

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

revision 18 by schoenebeck, Sun Dec 7 05:03:43 2003 UTC revision 20 by schoenebeck, Thu Dec 25 00:02:45 2003 UTC
# Line 109  int AudioThread::Main() { Line 109  int AudioThread::Main() {
109          }          }
110    
111    
112          // zero out the sum buffer          // zero out the output sum buffer
113          for (uint u = 0; u < pAudioIO->FragmentSize * pAudioIO->Channels; u++) {          memset(pAudioSumBuffer, 0, pAudioIO->FragmentSize * pAudioIO->Channels * sizeof(float));
             pAudioSumBuffer[u] = 0.0;  
         }  
114    
115    
116          // render audio from all active voices          // render audio from all active voices
# Line 136  int AudioThread::Main() { Line 134  int AudioThread::Main() {
134          // (from 32bit to 16bit sample) and copy to output buffer          // (from 32bit to 16bit sample) and copy to output buffer
135          float sample_point;          float sample_point;
136          for (uint u = 0; u < pAudioIO->FragmentSize * pAudioIO->Channels; u++) {          for (uint u = 0; u < pAudioIO->FragmentSize * pAudioIO->Channels; u++) {
137              sample_point = this->pAudioSumBuffer[u] / 4; // FIXME division by 4 just for testing purposes (to give a bit of head room when mixing multiple voices together)              sample_point = this->pAudioSumBuffer[u] * this->Volume;
138              if (sample_point < -32768.0) sample_point = -32768.0;              if (sample_point < -32768.0) sample_point = -32768.0;
139              if (sample_point > 32767.0)  sample_point = 32767.0;              if (sample_point > 32767.0)  sample_point = 32767.0;
140              this->pAudioIO->pOutputBuffer[u] = (sample_t) sample_point;              this->pAudioIO->pOutputBuffer[u] = (sample_t) sample_point;

Legend:
Removed from v.18  
changed lines
  Added in v.20

  ViewVC Help
Powered by ViewVC