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

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

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

revision 9 by schoenebeck, Wed Nov 5 14:47:10 2003 UTC revision 12 by schoenebeck, Sun Nov 16 19:01:50 2003 UTC
# Line 36  Voice::~Voice() { Line 36  Voice::~Voice() {
36    
37  void Voice::Trigger(int MIDIKey, uint8_t Velocity, gig::Instrument* Instrument) {  void Voice::Trigger(int MIDIKey, uint8_t Velocity, gig::Instrument* Instrument) {
38      Active        = true;      Active        = true;
39        this->MIDIKey = MIDIKey;
40      pRegion       = Instrument->GetRegion(MIDIKey);      pRegion       = Instrument->GetRegion(MIDIKey);
41      PlaybackState = playback_state_ram; // we always start playback from RAM cache and switch then to disk if needed      PlaybackState = playback_state_ram; // we always start playback from RAM cache and switch then to disk if needed
42      Pos           = 0;      Pos           = 0;
# Line 69  void Voice::Trigger(int MIDIKey, uint8_t Line 70  void Voice::Trigger(int MIDIKey, uint8_t
70      if (DiskVoice) {      if (DiskVoice) {
71          MaxRAMPos = cachedsamples - (OutputBufferSize << MAX_PITCH) / pSample->Channels;          MaxRAMPos = cachedsamples - (OutputBufferSize << MAX_PITCH) / pSample->Channels;
72          pDiskThread->OrderNewStream(&DiskStreamRef, pSample, MaxRAMPos);          pDiskThread->OrderNewStream(&DiskStreamRef, pSample, MaxRAMPos);
73          dmsg(("Disk voice launched (cached samples: %d, total Samples: %d, MaxRAMPos: %d\n", cachedsamples, pSample->SamplesTotal, MaxRAMPos));          dmsg(5,("Disk voice launched (cached samples: %d, total Samples: %d, MaxRAMPos: %d\n", cachedsamples, pSample->SamplesTotal, MaxRAMPos));
74      }      }
75      else {      else {
76          MaxRAMPos = cachedsamples;          MaxRAMPos = cachedsamples;
77          dmsg(("RAM only voice launched\n"));          dmsg(5,("RAM only voice launched\n"));
78      }      }
79    
80      CurrentPitch = pow(2, (double) (MIDIKey - (int) pSample->MIDIUnityNote) / (double) 12);      CurrentPitch = pow(2, (double) (MIDIKey - (int) pSample->MIDIUnityNote) / (double) 12);
# Line 92  void Voice::RenderAudio() { Line 93  void Voice::RenderAudio() {
93                  if (DiskVoice) {                  if (DiskVoice) {
94                      // check if we reached the allowed limit of the sample RAM cache                      // check if we reached the allowed limit of the sample RAM cache
95                      if (Pos > MaxRAMPos) {                      if (Pos > MaxRAMPos) {
96                          dmsg(("Voice: switching to disk playback (Pos=%f)\n", Pos));                          dmsg(5,("Voice: switching to disk playback (Pos=%f)\n", Pos));
97                          this->PlaybackState = playback_state_disk;                          this->PlaybackState = playback_state_disk;
98                      }                      }
99                  }                  }

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

  ViewVC Help
Powered by ViewVC