00001 /* 00002 * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG) 00003 * UNIVERSITAT POMPEU FABRA 00004 * 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 #ifndef MultiChannelAudioFileReader_hxx 00023 #define MultiChannelAudioFileReader_hxx 00024 00025 #include "Processing.hxx" 00026 #include "MultiChannelAudioFileReaderConfig.hxx" 00027 #include "AudioFile.hxx" 00028 #include "Audio.hxx" 00029 #include "OutControl.hxx" 00030 #include <vector> 00031 00032 namespace CLAM 00033 { 00034 00035 class AudioOutPort; 00036 00037 class MultiChannelAudioFileReader : public Processing 00038 { 00039 public: 00040 MultiChannelAudioFileReader(); 00041 MultiChannelAudioFileReader( const ProcessingConfig& cfg ); 00042 00043 ~MultiChannelAudioFileReader(); 00044 00045 virtual const char* GetClassName() const; 00046 virtual const ProcessingConfig& GetConfig() const; 00047 virtual bool Do(); 00048 virtual bool Do( std::vector<Audio>& outputs ); 00049 bool ModifiesPortsAndControlsAtConfiguration(); 00050 const AudioFileHeader & GetHeader() const { return mAudioFile.GetHeader(); } 00051 const AudioTextDescriptors & GetTextDescriptors () const { return mAudioFile.GetTextDescriptors(); } 00052 const EAudioFileCodec GetCodec() const { return mAudioFile.GetCodec(); } 00053 const std::vector<TIndex> & GetSelectedChannels() const {return mSelectedChannels;} 00054 00055 void Pause() { mIsPaused = (mIsPaused)?false:true; }; //TODO change to Qt boolean interface (pau) 00056 00057 protected: // methods 00058 00059 virtual bool ConcreteConfigure( const ProcessingConfig& cfgObject ); 00060 virtual bool ConcreteStart(); 00061 virtual bool ConcreteStop(); 00062 00063 void ResizePorts(unsigned nPorts); 00064 00065 protected: // attributes 00066 00067 typedef std::vector< AudioOutPort* > OutputVector; 00068 typedef std::vector< Audio* > OutRefsVector; 00069 00070 MultiChannelAudioFileReaderConfig mConfig; 00071 OutputVector _outputs; 00072 FloatOutControl mTimeOutput; 00073 std::vector< TIndex > mSelectedChannels; 00074 std::vector< TData* > mSamplesMatrix; 00075 AudioCodecs::Stream* mNativeStream; 00076 TTime mCurrentBeginTime; 00077 TTime mDeltaTime; 00078 bool mEOFReached; 00079 bool mIsPaused; 00080 AudioFileSource mAudioFile; 00081 }; 00082 } 00083 00084 #endif // MultiChannelAudioFileReader.hxx 00085