tomwalters@275: // Copyright 2006-2010, Willem van Engen, Thomas Walters tomwalters@275: // tomwalters@275: // AIM-C: A C++ implementation of the Auditory Image Model tomwalters@275: // http://www.acousticscale.org/AIMC tomwalters@275: // tomwalters@318: // Licensed under the Apache License, Version 2.0 (the "License"); tomwalters@318: // you may not use this file except in compliance with the License. tomwalters@318: // You may obtain a copy of the License at tomwalters@275: // tomwalters@318: // http://www.apache.org/licenses/LICENSE-2.0 tomwalters@275: // tomwalters@318: // Unless required by applicable law or agreed to in writing, software tomwalters@318: // distributed under the License is distributed on an "AS IS" BASIS, tomwalters@318: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. tomwalters@318: // See the License for the specific language governing permissions and tomwalters@318: // limitations under the License. tomwalters@275: tomwalters@275: /*! \file tomwalters@275: * \brief Audio file input tomwalters@275: * tomwalters@275: * \author Willem van Engen tomwalters@275: * \author Thomas Walters tomwalters@275: * \date created 2006/09/21 tomwalters@275: * \version \$Id$ tomwalters@275: */ tomwalters@275: tomwalters@283: #ifndef AIMC_MODULES_INPUT_FILEINPUT_H_ tomwalters@283: #define AIMC_MODULES_INPUT_FILEINPUT_H_ tomwalters@275: tomwalters@275: #include tomwalters@275: tomwalters@275: #include "Support/Module.h" tomwalters@275: #include "Support/Parameters.h" tomwalters@275: #include "Support/SignalBank.h" tomwalters@275: tomwalters@275: namespace aimc { tomwalters@275: class ModuleFileInput : public Module { tomwalters@275: public: tomwalters@280: explicit ModuleFileInput(Parameters *pParam); tomwalters@279: virtual ~ModuleFileInput(); tomwalters@275: tomwalters@275: virtual void Process(const SignalBank &input); tomwalters@275: tomwalters@275: private: tomwalters@280: /*! \brief Prepare the module tomwalters@280: * \param input Input SignalBank tomwalters@280: * \param output true on success false on failure tomwalters@280: */ tomwalters@275: virtual bool InitializeInternal(const SignalBank &input); tomwalters@275: tomwalters@280: /*! \brief Rewind to the start of the file tomwalters@280: */ tomwalters@275: virtual void ResetInternal(); tomwalters@275: tomwalters@280: /*! \brief File descriptor tomwalters@280: */ tomwalters@279: SNDFILE *file_handle_; tomwalters@275: tomwalters@280: /*! \brief Current position in time of the file tomwalters@280: */ tomwalters@275: int file_position_samples_; tomwalters@275: bool file_loaded_; tomwalters@275: int audio_channels_; tomwalters@275: int buffer_length_; tomwalters@275: float sample_rate_; tomwalters@275: }; tomwalters@275: } // namespace aimc tomwalters@275: tomwalters@283: #endif // AIMC_MODULES_INPUT_FILEINPUT_H_