annotate trunk/src/Modules/Input/ModuleFileInput.h @ 279:f469d936337f

- Replacing tabs with spaces for indentation
author tomwalters
date Thu, 18 Feb 2010 20:04:04 +0000
parents ce2bab04f155
children e55d0c225a57
rev   line source
tomwalters@275 1 // Copyright 2006-2010, Willem van Engen, Thomas Walters
tomwalters@275 2 //
tomwalters@275 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@275 4 // http://www.acousticscale.org/AIMC
tomwalters@275 5 //
tomwalters@275 6 // This program is free software: you can redistribute it and/or modify
tomwalters@275 7 // it under the terms of the GNU General Public License as published by
tomwalters@275 8 // the Free Software Foundation, either version 3 of the License, or
tomwalters@275 9 // (at your option) any later version.
tomwalters@275 10 //
tomwalters@275 11 // This program is distributed in the hope that it will be useful,
tomwalters@275 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@275 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@275 14 // GNU General Public License for more details.
tomwalters@275 15 //
tomwalters@275 16 // You should have received a copy of the GNU General Public License
tomwalters@275 17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
tomwalters@275 18
tomwalters@275 19 /*! \file
tomwalters@275 20 * \brief Audio file input
tomwalters@275 21 *
tomwalters@275 22 * \author Willem van Engen <cnbh@willem.engen.nl>
tomwalters@275 23 * \author Thomas Walters <tom@acousticscale.org>
tomwalters@275 24 * \date created 2006/09/21
tomwalters@275 25 * \version \$Id$
tomwalters@275 26 */
tomwalters@275 27
tomwalters@275 28 #ifndef _AIMC_MODULES_INPUT_FILE_H_
tomwalters@275 29 #define _AIMC_MODULES_INPUT_FILE_H_
tomwalters@275 30
tomwalters@275 31 #include <sndfile.h>
tomwalters@275 32
tomwalters@275 33 #include "Support/Module.h"
tomwalters@275 34 #include "Support/Parameters.h"
tomwalters@275 35 #include "Support/SignalBank.h"
tomwalters@275 36
tomwalters@275 37 namespace aimc {
tomwalters@275 38 class ModuleFileInput : public Module {
tomwalters@275 39 public:
tomwalters@279 40 ModuleFileInput(Parameters *pParam);
tomwalters@279 41 virtual ~ModuleFileInput();
tomwalters@275 42
tomwalters@279 43 /*! \brief Initializes this input device using an audio file
tomwalters@279 44 * \param sFilename Path of the file to load
tomwalters@279 45 * \return true on success, false on error
tomwalters@279 46 */
tomwalters@279 47 bool LoadFile(const char *sFilename);
tomwalters@275 48
tomwalters@275 49 //! \brief Process the loaded file.
tomwalters@275 50 void Process();
tomwalters@275 51
tomwalters@275 52 //! \brief Dummy Initialize function. Call LoadFile instead.
tomwalters@275 53 virtual bool Initialize(const SignalBank &input);
tomwalters@275 54
tomwalters@279 55 //! \brief Dummy funciton to comply with the Module specification. Gives an
tomwalters@275 56 // error message when called.
tomwalters@275 57 virtual void Process(const SignalBank &input);
tomwalters@275 58
tomwalters@275 59 private:
tomwalters@275 60 //! \brief Prepare the module
tomwalters@275 61 //! \param input Input SignalBank
tomwalters@275 62 //! \param output true on success false on failure
tomwalters@275 63 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@275 64
tomwalters@275 65 //! \brief Rewind to the start of the file
tomwalters@275 66 virtual void ResetInternal();
tomwalters@275 67
tomwalters@279 68 //! \brief File descriptor
tomwalters@279 69 SNDFILE *file_handle_;
tomwalters@275 70
tomwalters@279 71 //! \brief Current position in time of the file
tomwalters@275 72 int file_position_samples_;
tomwalters@275 73 bool file_loaded_;
tomwalters@275 74 int audio_channels_;
tomwalters@275 75 int buffer_length_;
tomwalters@275 76 float sample_rate_;
tomwalters@275 77 };
tomwalters@275 78 } // namespace aimc
tomwalters@275 79
tomwalters@275 80 #endif // _AIMC_MODULES_INPUT_FILE_H_