annotate src/Modules/Input/ModuleFileInput.h @ 113:9d12efd43513

- Bash scripting is rubbish.
author tomwalters
date Tue, 14 Sep 2010 01:41:19 +0000
parents c5f5e9569863
children 3cdaa81c3aca
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@45 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@45 7 // you may not use this file except in compliance with the License.
tomwalters@45 8 // You may obtain a copy of the License at
tomwalters@3 9 //
tomwalters@45 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@3 11 //
tomwalters@45 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@45 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@45 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@45 15 // See the License for the specific language governing permissions and
tomwalters@45 16 // limitations under the License.
tomwalters@3 17
tomwalters@3 18 /*! \file
tomwalters@3 19 * \brief Audio file input
tomwalters@3 20 *
tomwalters@3 21 * \author Willem van Engen <cnbh@willem.engen.nl>
tomwalters@3 22 * \author Thomas Walters <tom@acousticscale.org>
tomwalters@3 23 * \date created 2006/09/21
tomwalters@3 24 * \version \$Id$
tomwalters@3 25 */
tomwalters@3 26
tomwalters@11 27 #ifndef AIMC_MODULES_INPUT_FILEINPUT_H_
tomwalters@11 28 #define AIMC_MODULES_INPUT_FILEINPUT_H_
tomwalters@3 29
tomwalters@3 30 #include <sndfile.h>
tomwalters@3 31
tomwalters@3 32 #include "Support/Module.h"
tomwalters@3 33 #include "Support/Parameters.h"
tomwalters@3 34 #include "Support/SignalBank.h"
tomwalters@3 35
tomwalters@3 36 namespace aimc {
tomwalters@3 37 class ModuleFileInput : public Module {
tomwalters@3 38 public:
tomwalters@8 39 explicit ModuleFileInput(Parameters *pParam);
tomwalters@7 40 virtual ~ModuleFileInput();
tomwalters@3 41
tomwalters@7 42 /*! \brief Initializes this input device using an audio file
tomwalters@7 43 * \param sFilename Path of the file to load
tomwalters@7 44 * \return true on success, false on error
tomwalters@7 45 */
tomwalters@7 46 bool LoadFile(const char *sFilename);
tomwalters@3 47
tomwalters@8 48 /*! \brief Process the loaded file.
tomwalters@8 49 */
tomwalters@3 50 void Process();
tomwalters@3 51
tomwalters@8 52 /*! \brief Dummy Initialize function. Call LoadFile instead.
tomwalters@8 53 */
tomwalters@3 54 virtual bool Initialize(const SignalBank &input);
tomwalters@3 55
tomwalters@8 56 /*! \brief Dummy funciton to comply with the Module specification. Gives an
tomwalters@8 57 * error message when called.
tomwalters@8 58 */
tomwalters@3 59 virtual void Process(const SignalBank &input);
tomwalters@3 60
tomwalters@3 61 private:
tomwalters@8 62 /*! \brief Prepare the module
tomwalters@8 63 * \param input Input SignalBank
tomwalters@8 64 * \param output true on success false on failure
tomwalters@8 65 */
tomwalters@3 66 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@3 67
tomwalters@8 68 /*! \brief Rewind to the start of the file
tomwalters@8 69 */
tomwalters@3 70 virtual void ResetInternal();
tomwalters@3 71
tomwalters@8 72 /*! \brief File descriptor
tomwalters@8 73 */
tomwalters@7 74 SNDFILE *file_handle_;
tomwalters@3 75
tomwalters@8 76 /*! \brief Current position in time of the file
tomwalters@8 77 */
tomwalters@3 78 int file_position_samples_;
tomwalters@3 79 bool file_loaded_;
tomwalters@3 80 int audio_channels_;
tomwalters@3 81 int buffer_length_;
tomwalters@3 82 float sample_rate_;
tomwalters@3 83 };
tomwalters@3 84 } // namespace aimc
tomwalters@3 85
tomwalters@11 86 #endif // AIMC_MODULES_INPUT_FILEINPUT_H_