Mercurial > hg > aimc
comparison trunk/src/Modules/Output/FileOutputAIMC.h @ 320:c74acd46121b
- Added support for a very basic AIM-C file format
author | tomwalters@google.com |
---|---|
date | Thu, 27 May 2010 07:25:03 +0000 |
parents | |
children | 1c0723041971 |
comparison
equal
deleted
inserted
replaced
319:566a8543a6f1 | 320:c74acd46121b |
---|---|
1 // Copyright 2006-2010, Thomas Walters, Willem van Engen | |
2 // | |
3 // AIM-C: A C++ implementation of the Auditory Image Model | |
4 // http://www.acousticscale.org/AIMC | |
5 // | |
6 // Licensed under the Apache License, Version 2.0 (the "License"); | |
7 // you may not use this file except in compliance with the License. | |
8 // You may obtain a copy of the License at | |
9 // | |
10 // http://www.apache.org/licenses/LICENSE-2.0 | |
11 // | |
12 // Unless required by applicable law or agreed to in writing, software | |
13 // distributed under the License is distributed on an "AS IS" BASIS, | |
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 // See the License for the specific language governing permissions and | |
16 // limitations under the License. | |
17 | |
18 /*! | |
19 * \file | |
20 * \brief File output to AIMC format | |
21 * | |
22 * \author Thomas Walters <tom@acousticscale.org> | |
23 * \author Willem van Engen <cnbh@willem.engen.nl> | |
24 * \date created 2006/10/30 | |
25 * \version \$Header$ | |
26 */ | |
27 | |
28 #ifndef AIMC_MODULES_OUTPUT_AIMC_H_ | |
29 #define AIMC_MODULES_OUTPUT_AIMC_H_ | |
30 | |
31 #include "Support/Module.h" | |
32 #include "Support/SignalBank.h" | |
33 | |
34 namespace aimc { | |
35 class FileOutputAIMC : public Module { | |
36 public: | |
37 /*! \brief Create a new file output for an AIMC format file. | |
38 */ | |
39 explicit FileOutputAIMC(Parameters *pParam); | |
40 ~FileOutputAIMC(); | |
41 | |
42 /*! \brief Initialize the output to AIMC. | |
43 * \param *filename Filename of the ouptut file to be created. | |
44 * If the file exists it will be overwritten | |
45 * \return Returns true on success of initialization. | |
46 */ | |
47 bool OpenFile(const char *filename, float frame_period_ms); | |
48 bool CloseFile(); | |
49 virtual void Process(const SignalBank &input); | |
50 private: | |
51 virtual bool InitializeInternal(const SignalBank &input); | |
52 virtual void ResetInternal(); | |
53 | |
54 void WriteHeader(); | |
55 | |
56 /*! \brief Whether initialization is done or not | |
57 */ | |
58 bool header_written_; | |
59 | |
60 /*! \brief Internal pointer to the output file | |
61 */ | |
62 FILE *file_handle_; | |
63 | |
64 /*! \brief Count of the number of samples in the file, written on close | |
65 */ | |
66 int sample_count_; | |
67 | |
68 int channel_count_; | |
69 int buffer_length_; | |
70 float sample_rate_; | |
71 float frame_period_ms_; | |
72 }; | |
73 } // namespace aimc | |
74 | |
75 #endif // AIMC_MODULES_OUTPUT_AIMC_H_ | |
76 |