00001 00002 /****************** <SYN heading BEGIN do not edit this line> ***************** 00003 * 00004 * subsynth - modular audio synthesizer 00005 * subsynth is (C) Copyright 2001-2002 by Kevin Meinert 00006 * 00007 * Original Author: Kevin Meinert 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Library General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Library General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Library General Public 00020 * License along with this library; if not, write to the 00021 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00022 * Boston, MA 02111-1307, USA. 00023 * 00024 * ----------------------------------------------------------------- 00025 * File: $RCSfile: SampleBufferQueue.h,v $ 00026 * Date modified: $Date: 2002/04/15 01:55:54 $ 00027 * Version: $Revision: 1.6 $ 00028 * ----------------------------------------------------------------- 00029 * 00030 ****************** <SYN heading END do not edit this line> ******************/ 00031 #ifndef SUBSYNTH_AUDIO_BUFFER_QUEUE 00032 #define SUBSYNTH_AUDIO_BUFFER_QUEUE 00033 00034 #include <list> 00035 #include <syn/Util/WatermarkedQueue.h> 00036 #include <syn/Core/SampleBufferRepos.h> 00037 #include <syn/Core/SampleBuffer.h> 00038 00039 namespace syn 00040 { 00051 class SampleBufferQueue : public WatermarkedQueue<SampleBuffer1f*> 00052 { 00053 public: 00054 SampleBufferQueue() : mDone( true ) 00055 { 00056 } 00057 00058 virtual ~SampleBufferQueue() 00059 { 00060 // pop everything off the queue 00061 int s = this->size(); 00062 for (int x = 0; x < s; ++x) 00063 { 00064 SampleBuffer1f* p = this->front(); 00065 this->pop(); 00066 SampleBufferRepos::instance()->putback( p ); 00067 } 00068 00069 assert( this->size() == 0 && "queue didn't auto empty properly" ); 00070 } 00071 00078 bool done() 00079 { 00080 // we're not done if there is more to read. 00081 if (this->size() > 0) 00082 return false; 00083 else 00084 return mDone; 00085 } 00086 00090 void setDone( bool d ) 00091 { 00092 mDone = d; 00093 } 00094 00095 private: 00096 bool mDone; 00097 }; 00098 } 00099 00100 #endif