annotate src/Modules/Input/ModuleFileInput.h @ 611:0fbaf443ec82

Carfac C++ revision 3, indluding more style improvements. The output structs are now classes again, and have separate storage methods for each output structure along with flags in the Run and RunSegment methods to allow for only storing NAPs if desired.
author alexbrandmeyer
date Fri, 17 May 2013 19:52:45 +0000
parents 3cdaa81c3aca
children
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@3 42 virtual void Process(const SignalBank &input);
tomwalters@3 43
tomwalters@3 44 private:
tomwalters@8 45 /*! \brief Prepare the module
tomwalters@8 46 * \param input Input SignalBank
tomwalters@8 47 * \param output true on success false on failure
tomwalters@8 48 */
tomwalters@3 49 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@3 50
tomwalters@8 51 /*! \brief Rewind to the start of the file
tomwalters@8 52 */
tomwalters@3 53 virtual void ResetInternal();
tomwalters@3 54
tomwalters@8 55 /*! \brief File descriptor
tomwalters@8 56 */
tomwalters@7 57 SNDFILE *file_handle_;
tomwalters@3 58
tomwalters@8 59 /*! \brief Current position in time of the file
tomwalters@8 60 */
tomwalters@3 61 int file_position_samples_;
tomwalters@3 62 bool file_loaded_;
tomwalters@3 63 int audio_channels_;
tomwalters@3 64 int buffer_length_;
tomwalters@3 65 float sample_rate_;
tomwalters@3 66 };
tomwalters@3 67 } // namespace aimc
tomwalters@3 68
tomwalters@11 69 #endif // AIMC_MODULES_INPUT_FILEINPUT_H_