annotate src/Modules/Output/FileOutputAIMC.h @ 253:988c8b6f7946

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