annotate src/Modules/Input/ModuleFileInput.h @ 8:fcbf85ce59fb

- Lots of changes to make cpplint happy. It still complains about header guards, but that's pretty much it now.
author tomwalters
date Thu, 18 Feb 2010 21:12:41 +0000
parents 1a1988ec40e7
children bd370910aa05
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@8 40 explicit 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@8 49 /*! \brief Process the loaded file.
tomwalters@8 50 */
tomwalters@3 51 void Process();
tomwalters@3 52
tomwalters@8 53 /*! \brief Dummy Initialize function. Call LoadFile instead.
tomwalters@8 54 */
tomwalters@3 55 virtual bool Initialize(const SignalBank &input);
tomwalters@3 56
tomwalters@8 57 /*! \brief Dummy funciton to comply with the Module specification. Gives an
tomwalters@8 58 * error message when called.
tomwalters@8 59 */
tomwalters@3 60 virtual void Process(const SignalBank &input);
tomwalters@3 61
tomwalters@3 62 private:
tomwalters@8 63 /*! \brief Prepare the module
tomwalters@8 64 * \param input Input SignalBank
tomwalters@8 65 * \param output true on success false on failure
tomwalters@8 66 */
tomwalters@3 67 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@3 68
tomwalters@8 69 /*! \brief Rewind to the start of the file
tomwalters@8 70 */
tomwalters@3 71 virtual void ResetInternal();
tomwalters@3 72
tomwalters@8 73 /*! \brief File descriptor
tomwalters@8 74 */
tomwalters@7 75 SNDFILE *file_handle_;
tomwalters@3 76
tomwalters@8 77 /*! \brief Current position in time of the file
tomwalters@8 78 */
tomwalters@3 79 int file_position_samples_;
tomwalters@3 80 bool file_loaded_;
tomwalters@3 81 int audio_channels_;
tomwalters@3 82 int buffer_length_;
tomwalters@3 83 float sample_rate_;
tomwalters@3 84 };
tomwalters@3 85 } // namespace aimc
tomwalters@3 86
tomwalters@8 87 #endif // _AIMC_MODULES_INPUT_FILE_H_