Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/AbsSoundFileSource2.cpp
Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 1998-2010 George Tzanetakis <gtzan@cs.uvic.ca>
00003 **
00004 ** This program is free software; you can redistribute it and/or modify
00005 ** it under the terms of the GNU General Public License as published by
00006 ** the Free Software Foundation; either version 2 of the License, or
00007 ** (at your option) any later version.
00008 **
00009 ** This program is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 ** GNU General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU General Public License
00015 ** along with this program; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 */
00018 
00019 #include "AbsSoundFileSource2.h"
00020 
00021 using std::ostringstream;
00022 using namespace Marsyas;
00023 
00024 AbsSoundFileSource2::AbsSoundFileSource2(mrs_string type, mrs_string name):MarSystem(type, name)
00025 {
00026   size_ = 0;
00027 
00028   addControls();
00029 }
00030 
00031 AbsSoundFileSource2::~AbsSoundFileSource2()
00032 {
00033 }
00034 
00035 // AbsSoundFileSource2::AbsSoundFileSource2(const AbsSoundFileSource2& a):MarSystem(a) //[!][?]
00036 // {
00037 //  filename_ = a.filename_;
00038 //
00039 //  nChannels_ = a.nChannels_;
00040 //
00041 //  size_ = a.size_;
00042 //  pos_ = a.pos_;
00043 //
00044 //  loopSize_ = a.loopSize_;
00045 //  //loopDuration_ = a.loopDuration_;
00046 //  loopRepetitions_ = a.loopRepetitions_;
00047 //  loopStart_ = a.loopStart_;
00048 // }
00049 
00050 MarSystem*
00051 AbsSoundFileSource2::clone() const
00052 {
00053   return new AbsSoundFileSource2(*this);
00054 }
00055 
00056 void
00057 AbsSoundFileSource2::addControls()
00058 {
00059   //setctrl("mrs_string/onObsNames", "audio,");
00060   setctrl("mrs_string/inObsNames", "audio,");
00061 
00062   //common controls
00063   addctrl("mrs_natural/nChannels",(mrs_natural)1);
00064   //setctrlState("mrs_natural/nChannels", true); //[?] state or stateless? Let each derived class set it up its way...
00065 
00066   addctrl("mrs_natural/pos", (mrs_natural)0);
00067 
00068   addctrl("mrs_bool/hasData", false);
00069 
00070   addctrl("mrs_string/filename", "");
00071   setctrlState("mrs_string/filename", true);
00072 
00073   addctrl("mrs_string/filetype", "defaulttype");
00074 
00075   addctrl("mrs_natural/size", (mrs_natural)0);//size in number of samples per channel
00076 }
00077 
00078 bool
00079 AbsSoundFileSource2::getHeader()
00080 {
00081   //does nothing => used to create a "DummyFileSource"
00082   return true;
00083 }
00084 
00085 realvec&
00086 AbsSoundFileSource2::getAudioRegion(mrs_natural startSample, mrs_natural endSample)
00087 {
00088   (void) startSample; (void) endSample;
00089   //return empty realvec
00090   return audioRegion_;
00091 }
00092 
00093 void
00094 AbsSoundFileSource2::myProcess(realvec& in,realvec &out)
00095 {
00096   (void) in;
00097   //send silence to the output => used to create a "DummyFileSource"
00098   out.setval(0.0);
00099 }