annotate src/Modules/Input/ModuleFileInput.h @ 7:1a1988ec40e7

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