annotate src/Modules/Output/FileOutputAIMC.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 087f3b3c36d3
children
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@603 43 virtual void Process(const SignalBank &input);
tomwalters@603 44 private:
tomwalters@603 45 /*! \brief Initialize the output to AIMC.
tomwalters@46 46 * \param *filename Filename of the ouptut file to be created.
tomwalters@46 47 * If the file exists it will be overwritten
tomwalters@46 48 * \return Returns true on success of initialization.
tomwalters@46 49 */
tom@253 50 bool OpenFile(string &filename);
tomwalters@46 51 bool CloseFile();
tomwalters@603 52 bool OpenStrobesFile(string &filename);
tomwalters@603 53 bool CloseStrobesFile();
tomwalters@603 54
tomwalters@46 55 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@46 56 virtual void ResetInternal();
tomwalters@46 57
tomwalters@46 58 void WriteHeader();
tomwalters@46 59
tomwalters@46 60 /*! \brief Whether initialization is done or not
tomwalters@46 61 */
tomwalters@46 62 bool header_written_;
tomwalters@46 63
tomwalters@46 64 /*! \brief Internal pointer to the output file
tomwalters@46 65 */
tomwalters@46 66 FILE *file_handle_;
tomwalters@603 67 FILE *strobes_file_handle_;
tomwalters@46 68
tomwalters@46 69 /*! \brief Count of the number of samples in the file, written on close
tomwalters@46 70 */
tomwalters@159 71 int frame_count_;
tomwalters@46 72
tomwalters@46 73 int channel_count_;
tomwalters@46 74 int buffer_length_;
tomwalters@228 75 float sample_rate_;
tomwalters@46 76 float frame_period_ms_;
tom@253 77 string file_suffix_;
tomwalters@603 78 bool dump_strobes_;
tomwalters@603 79 string strobes_file_suffix_;
tomwalters@46 80 };
tomwalters@46 81 } // namespace aimc
tomwalters@46 82
tomwalters@46 83 #endif // AIMC_MODULES_OUTPUT_AIMC_H_
tomwalters@46 84