annotate trunk/src/Modules/Output/FileOutputAIMC.h @ 706:f8e90b5d85fd tip

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