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@318
|
6 // Licensed under the Apache License, Version 2.0 (the "License");
|
tomwalters@318
|
7 // you may not use this file except in compliance with the License.
|
tomwalters@318
|
8 // You may obtain a copy of the License at
|
tomwalters@275
|
9 //
|
tomwalters@318
|
10 // http://www.apache.org/licenses/LICENSE-2.0
|
tomwalters@275
|
11 //
|
tomwalters@318
|
12 // Unless required by applicable law or agreed to in writing, software
|
tomwalters@318
|
13 // distributed under the License is distributed on an "AS IS" BASIS,
|
tomwalters@318
|
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
tomwalters@318
|
15 // See the License for the specific language governing permissions and
|
tomwalters@318
|
16 // limitations under the License.
|
tomwalters@275
|
17
|
tomwalters@275
|
18 /*! \file
|
tomwalters@275
|
19 * \brief Audio file input
|
tomwalters@275
|
20 *
|
tomwalters@275
|
21 * \author Willem van Engen <cnbh@willem.engen.nl>
|
tomwalters@275
|
22 * \author Thomas Walters <tom@acousticscale.org>
|
tomwalters@275
|
23 * \date created 2006/09/21
|
tomwalters@275
|
24 * \version \$Id$
|
tomwalters@275
|
25 */
|
tomwalters@275
|
26
|
tomwalters@283
|
27 #ifndef AIMC_MODULES_INPUT_FILEINPUT_H_
|
tomwalters@283
|
28 #define AIMC_MODULES_INPUT_FILEINPUT_H_
|
tomwalters@275
|
29
|
tomwalters@275
|
30 #include <sndfile.h>
|
tomwalters@275
|
31
|
tomwalters@275
|
32 #include "Support/Module.h"
|
tomwalters@275
|
33 #include "Support/Parameters.h"
|
tomwalters@275
|
34 #include "Support/SignalBank.h"
|
tomwalters@275
|
35
|
tomwalters@275
|
36 namespace aimc {
|
tomwalters@275
|
37 class ModuleFileInput : public Module {
|
tomwalters@275
|
38 public:
|
tomwalters@280
|
39 explicit ModuleFileInput(Parameters *pParam);
|
tomwalters@279
|
40 virtual ~ModuleFileInput();
|
tomwalters@275
|
41
|
tomwalters@275
|
42 virtual void Process(const SignalBank &input);
|
tomwalters@275
|
43
|
tomwalters@275
|
44 private:
|
tomwalters@280
|
45 /*! \brief Prepare the module
|
tomwalters@280
|
46 * \param input Input SignalBank
|
tomwalters@280
|
47 * \param output true on success false on failure
|
tomwalters@280
|
48 */
|
tomwalters@275
|
49 virtual bool InitializeInternal(const SignalBank &input);
|
tomwalters@275
|
50
|
tomwalters@280
|
51 /*! \brief Rewind to the start of the file
|
tomwalters@280
|
52 */
|
tomwalters@275
|
53 virtual void ResetInternal();
|
tomwalters@275
|
54
|
tomwalters@280
|
55 /*! \brief File descriptor
|
tomwalters@280
|
56 */
|
tomwalters@279
|
57 SNDFILE *file_handle_;
|
tomwalters@275
|
58
|
tomwalters@280
|
59 /*! \brief Current position in time of the file
|
tomwalters@280
|
60 */
|
tomwalters@275
|
61 int file_position_samples_;
|
tomwalters@275
|
62 bool file_loaded_;
|
tomwalters@275
|
63 int audio_channels_;
|
tomwalters@275
|
64 int buffer_length_;
|
tomwalters@275
|
65 float sample_rate_;
|
tomwalters@275
|
66 };
|
tomwalters@275
|
67 } // namespace aimc
|
tomwalters@275
|
68
|
tomwalters@283
|
69 #endif // AIMC_MODULES_INPUT_FILEINPUT_H_
|