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: DummyOutputModule.cpp,v $ 00026 * Date modified: $Date: 2002/02/16 19:24:16 $ 00027 * Version: $Revision: 1.6 $ 00028 * ----------------------------------------------------------------- 00029 * 00030 ****************** <SYN heading END do not edit this line> ******************/ 00031 #include "syn/Core/SampleBufferQueue.h" 00032 #include "syn/Module/DummyOutputModule.h" 00033 00034 00035 namespace syn 00036 { 00037 DummyOutputModule::DummyOutputModule() : Module(), flag(false) 00038 { 00039 // hook them up so they're publicly accessable... 00040 mMonoAudioInput = this->createInput( "mono audio" ); 00041 } 00042 00043 // TODO: this might be wrong, we may be to update fmt 00044 // when ever there is a new connection 00045 bool DummyOutputModule::open() 00046 { 00047 mIsOpen = true; 00048 return mIsOpen; 00049 } 00050 00051 void DummyOutputModule::close() 00052 { 00053 mIsOpen = false; 00054 } 00055 00056 void DummyOutputModule::update() 00057 { 00058 // if connected, then suck data from the queue and throw it away... 00059 if (mMonoAudioInput->isConnected()) 00060 { 00061 SampleBufferQueuePtr input_queue; 00062 unsigned int size = 0; 00063 00064 // do it every other time... just to seem realistic... 00065 if (flag && !mMonoAudioInput->empty()) 00066 { 00067 SampleBuffer1f* read_buf = mMonoAudioInput->front(); 00068 size = mMonoAudioInput->front()->size(); 00069 mMonoAudioInput->pop(); 00070 SampleBufferRepos::instance()->putback( read_buf ); 00071 } 00072 00073 flag = !flag; 00074 this->setPutCount( size ); // record how much was read... hahaha... 00075 } 00076 else 00077 { 00078 this->setPutCount( 0 ); 00079 } 00080 } 00081 00082 } 00083