annotate trunk/src/Modules/Output/FileOutputAIMC.h @ 431:17bbf05d43a1

Edited wiki page AIMCopyExamples through web user interface.
author tom@acousticscale.org
date Thu, 04 Nov 2010 18:07:46 +0000
parents 3ee03a6b95a0
children 99f9bf0f7798
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
tomwalters@320 31 #include "Support/Module.h"
tomwalters@320 32 #include "Support/SignalBank.h"
tomwalters@320 33
tomwalters@320 34 namespace aimc {
tomwalters@320 35 class FileOutputAIMC : public Module {
tomwalters@320 36 public:
tomwalters@320 37 /*! \brief Create a new file output for an AIMC format file.
tomwalters@320 38 */
tomwalters@320 39 explicit FileOutputAIMC(Parameters *pParam);
tomwalters@320 40 ~FileOutputAIMC();
tomwalters@320 41
tomwalters@320 42 /*! \brief Initialize the output to AIMC.
tomwalters@320 43 * \param *filename Filename of the ouptut file to be created.
tomwalters@320 44 * If the file exists it will be overwritten
tomwalters@320 45 * \return Returns true on success of initialization.
tomwalters@320 46 */
tomwalters@320 47 bool OpenFile(const char *filename, float frame_period_ms);
tomwalters@320 48 bool CloseFile();
tomwalters@320 49 virtual void Process(const SignalBank &input);
tomwalters@320 50 private:
tomwalters@320 51 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@320 52 virtual void ResetInternal();
tomwalters@320 53
tomwalters@320 54 void WriteHeader();
tomwalters@320 55
tomwalters@320 56 /*! \brief Whether initialization is done or not
tomwalters@320 57 */
tomwalters@320 58 bool header_written_;
tomwalters@320 59
tomwalters@320 60 /*! \brief Internal pointer to the output file
tomwalters@320 61 */
tomwalters@320 62 FILE *file_handle_;
tomwalters@320 63
tomwalters@320 64 /*! \brief Count of the number of samples in the file, written on close
tomwalters@320 65 */
tomwalters@322 66 int frame_count_;
tomwalters@320 67
tomwalters@320 68 int channel_count_;
tomwalters@320 69 int buffer_length_;
tomwalters@398 70 float sample_rate_;
tomwalters@320 71 float frame_period_ms_;
tomwalters@320 72 };
tomwalters@320 73 } // namespace aimc
tomwalters@320 74
tomwalters@320 75 #endif // AIMC_MODULES_OUTPUT_AIMC_H_
tomwalters@320 76