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