annotate src/Modules/Output/FileOutputAIMC.h @ 49:0cd20c748308

- AIMCopy v5 for just smooth NAP features - Reporting of all modules and versions
author tomwalters
date Sun, 11 Jul 2010 03:46:06 +0000
parents 6dc9bc6cc13b
children c5ac2f0c7fc5
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
tomwalters@46 31 #include "Support/Module.h"
tomwalters@46 32 #include "Support/SignalBank.h"
tomwalters@46 33
tomwalters@46 34 namespace aimc {
tomwalters@46 35 class FileOutputAIMC : public Module {
tomwalters@46 36 public:
tomwalters@46 37 /*! \brief Create a new file output for an AIMC format file.
tomwalters@46 38 */
tomwalters@46 39 explicit FileOutputAIMC(Parameters *pParam);
tomwalters@46 40 ~FileOutputAIMC();
tomwalters@46 41
tomwalters@46 42 /*! \brief Initialize the output to AIMC.
tomwalters@46 43 * \param *filename Filename of the ouptut file to be created.
tomwalters@46 44 * If the file exists it will be overwritten
tomwalters@46 45 * \return Returns true on success of initialization.
tomwalters@46 46 */
tomwalters@46 47 bool OpenFile(const char *filename, float frame_period_ms);
tomwalters@46 48 bool CloseFile();
tomwalters@46 49 virtual void Process(const SignalBank &input);
tomwalters@46 50 private:
tomwalters@46 51 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@46 52 virtual void ResetInternal();
tomwalters@46 53
tomwalters@46 54 void WriteHeader();
tomwalters@46 55
tomwalters@46 56 /*! \brief Whether initialization is done or not
tomwalters@46 57 */
tomwalters@46 58 bool header_written_;
tomwalters@46 59
tomwalters@46 60 /*! \brief Internal pointer to the output file
tomwalters@46 61 */
tomwalters@46 62 FILE *file_handle_;
tomwalters@46 63
tomwalters@46 64 /*! \brief Count of the number of samples in the file, written on close
tomwalters@46 65 */
tomwalters@48 66 int frame_count_;
tomwalters@46 67
tomwalters@46 68 int channel_count_;
tomwalters@46 69 int buffer_length_;
tomwalters@46 70 float sample_rate_;
tomwalters@46 71 float frame_period_ms_;
tomwalters@46 72 };
tomwalters@46 73 } // namespace aimc
tomwalters@46 74
tomwalters@46 75 #endif // AIMC_MODULES_OUTPUT_AIMC_H_
tomwalters@46 76