/[svn]/linuxsampler/trunk/src/engines/common/VoiceBase.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/VoiceBase.h

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

revision 2027 by iliev, Tue Nov 3 19:27:42 2009 UTC revision 2375 by schoenebeck, Thu Oct 4 17:45:22 2012 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck    *   *   Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck    *
6   *   Copyright (C) 2005-2009 Christian Schoenebeck                         *   *   Copyright (C) 2005-2008 Christian Schoenebeck                         *
7   *   Copyright (C) 2009 Grigor Iliev                                       *   *   Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev        *
8   *                                                                         *   *                                                                         *
9   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
10   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 35  namespace LinuxSampler { Line 35  namespace LinuxSampler {
35              D*   pDiskThread;  ///< Pointer to the disk thread, to be able to order a disk stream and later to delete the stream again              D*   pDiskThread;  ///< Pointer to the disk thread, to be able to order a disk stream and later to delete the stream again
36              int  RealSampleWordsLeftToRead; ///< Number of samples left to read, not including the silence added for the interpolator              int  RealSampleWordsLeftToRead; ///< Number of samples left to read, not including the silence added for the interpolator
37    
38              VoiceBase() {              VoiceBase(SignalUnitRack* pRack = NULL): AbstractVoice(pRack) {
39                  pRegion      = NULL;                  pRegion      = NULL;
40                  pDiskThread  = NULL;                  pDiskThread  = NULL;
41              }              }
# Line 79  namespace LinuxSampler { Line 79  namespace LinuxSampler {
79    
80              virtual int OrderNewStream() {              virtual int OrderNewStream() {
81                  int res = pDiskThread->OrderNewStream (                  int res = pDiskThread->OrderNewStream (
82                      &DiskStreamRef, pRegion, MaxRAMPos, !RAMLoop                      &DiskStreamRef, pRegion, MaxRAMPos + GetRAMCacheOffset(), !RAMLoop
83                  );                  );
84    
85                  if (res < 0) {                  if (res < 0) {
# Line 90  namespace LinuxSampler { Line 90  namespace LinuxSampler {
90    
91                  return 0;                  return 0;
92              }              }
93                
94                /** The offset of the RAM cache from the sample start (in sample units). */
95                virtual int GetRAMCacheOffset() { return 0; }
96    
97              /**              /**
98               *  Renders the audio data for this voice for the current audio fragment.               *  Renders the audio data for this voice for the current audio fragment.
# Line 135  namespace LinuxSampler { Line 138  namespace LinuxSampler {
138                                  // check if the disk thread created our ordered disk stream in the meantime                                  // check if the disk thread created our ordered disk stream in the meantime
139                                  DiskStreamRef.pStream = pDiskThread->AskForCreatedStream(DiskStreamRef.OrderID);                                  DiskStreamRef.pStream = pDiskThread->AskForCreatedStream(DiskStreamRef.OrderID);
140                                  if (!DiskStreamRef.pStream) {                                  if (!DiskStreamRef.pStream) {
141                                      std::cout << stderr << "Disk stream not available in time!" << std::endl << std::flush;                                      std::cerr << "Disk stream not available in time!\n" << std::flush;
142                                      KillImmediately();                                      KillImmediately();
143                                      return;                                      return;
144                                  }                                  }
# Line 185  namespace LinuxSampler { Line 188  namespace LinuxSampler {
188                  itTriggerEvent = Pool<Event>::Iterator();                  itTriggerEvent = Pool<Event>::Iterator();
189    
190                  // If sample stream or release stage finished, kill the voice                  // If sample stream or release stage finished, kill the voice
191                  if (                  if (PlaybackState == Voice::playback_state_end || EG1Finished()) {
192                      PlaybackState == Voice::playback_state_end ||                      KillImmediately();
193                      EG1.getSegmentType() == gig::EGADSR::segment_end                  }
                 ) KillImmediately();  
194              }              }
195    
196              /**              /**
# Line 227  namespace LinuxSampler { Line 229  namespace LinuxSampler {
229              S*  pSample;   ///< Pointer to the sample to be played back              S*  pSample;   ///< Pointer to the sample to be played back
230              R*  pRegion;   ///< Pointer to the articulation information of current region of this voice              R*  pRegion;   ///< Pointer to the articulation information of current region of this voice
231    
232                virtual MidiKeyBase* GetMidiKeyInfo(int MIDIKey) {
233                    EC* pChannel = static_cast<EC*>(pEngineChannel);
234                    return &pChannel->pMIDIKeyInfo[MIDIKey];
235                }
236    
237              virtual unsigned long GetNoteOnTime(int MIDIKey) {              virtual unsigned long GetNoteOnTime(int MIDIKey) {
238                  EC* pChannel = static_cast<EC*>(pEngineChannel);                  EC* pChannel = static_cast<EC*>(pEngineChannel);
239                  return pChannel->pMIDIKeyInfo[MIDIKey].NoteOnTime;                  return pChannel->pMIDIKeyInfo[MIDIKey].NoteOnTime;

Legend:
Removed from v.2027  
changed lines
  Added in v.2375

  ViewVC Help
Powered by ViewVC