pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
plank_AudioFileWriter.h
00001 /*
00002  -------------------------------------------------------------------------------
00003  This file is part of the Plink, Plonk, Plank libraries
00004   by Martin Robinson
00005  
00006  http://code.google.com/p/pl-nk/
00007  
00008  Copyright University of the West of England, Bristol 2011-14
00009  All rights reserved.
00010  
00011  Redistribution and use in source and binary forms, with or without
00012  modification, are permitted provided that the following conditions are met:
00013  
00014  * Redistributions of source code must retain the above copyright
00015    notice, this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright
00017    notice, this list of conditions and the following disclaimer in the
00018    documentation and/or other materials provided with the distribution.
00019  * Neither the name of University of the West of England, Bristol nor 
00020    the names of its contributors may be used to endorse or promote products
00021    derived from this software without specific prior written permission.
00022  
00023  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00024  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00025  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00026  DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF THE WEST OF ENGLAND, BRISTOL BE 
00027  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00028  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
00029  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00030  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00031  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
00032  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00033  
00034  This software makes use of third party libraries. For more information see:
00035  doc/license.txt included in the distribution.
00036  -------------------------------------------------------------------------------
00037  */
00038 
00039 #ifndef PLANK_AUDIOFILEWRITER_H
00040 #define PLANK_AUDIOFILEWRITER_H
00041 
00042 #include "plank_AudioFileCommon.h"
00043 
00044 PLANK_BEGIN_C_LINKAGE
00045 
00054 typedef struct PlankAudioFileWriter* PlankAudioFileWriterRef; 
00055 
00058 PlankAudioFileWriterRef pl_AudioFileWriter_CreateAndInit();
00059 
00062 PlankAudioFileWriterRef pl_AudioFileWriter_Create();
00063 
00067 PlankResult pl_AudioFileWriter_Init (PlankAudioFileWriterRef p);
00068 
00072 PlankResult pl_AudioFileWriter_DeInit (PlankAudioFileWriterRef p);
00073 
00077 PlankResult pl_AudioFileWriter_Destroy (PlankAudioFileWriterRef p);
00078 
00083 PlankFileRef pl_AudioFileWriter_GetFile (PlankAudioFileWriterRef p);
00084 
00087 PlankAudioFileFormatInfo* pl_AudioFileWriter_GetFormatInfo (PlankAudioFileWriterRef p);
00088 
00089 const PlankAudioFileFormatInfo* pl_AudioFileWriter_GetFormatInfoReadOnly (PlankAudioFileWriterRef p);
00090 
00091 PlankAudioFileMetaDataIOFlags pl_AudioFileWriter_GetMetaDataIOFlags (PlankAudioFileWriterRef p);
00092 PlankResult pl_AudioFileWriter_SetMetaDataIOFlags (PlankAudioFileWriterRef p, PlankAudioFileMetaDataIOFlags metaDataIOFlags);
00093 PlankAudioFileMetaDataRef pl_AudioFileWriter_GetMetaData (PlankAudioFileWriterRef p);
00094 PlankResult pl_AudioFileWriter_SetMetaData (PlankAudioFileWriterRef p, PlankAudioFileMetaDataRef metaData);
00095 
00096 
00097 PlankResult pl_AudioFileWriter_SetFormatWAV (PlankAudioFileWriterRef p, const int bitsPerSample, const PlankChannelLayout channelLayout, const double sampleRate, const PlankB isFloat);
00098 PlankResult pl_AudioFileWriter_SetFormatAIFF (PlankAudioFileWriterRef p, const int bitsPerSample, const PlankChannelLayout channelLayout, const double sampleRate);
00099 PlankResult pl_AudioFileWriter_SetFormatAIFC (PlankAudioFileWriterRef p, const int bitsPerSample, const PlankChannelLayout channelLayout, const double sampleRate, const PlankB isFloat, const PlankB isLittleEndian);
00100 PlankResult pl_AudioFileWriter_SetFormatCAF (PlankAudioFileWriterRef p, const int bitsPerSample, const PlankChannelLayout channelLayout, const double sampleRate, const PlankB isFloat, const PlankB isLittleEndian);
00101 PlankResult pl_AudioFileWriter_SetFormatW64 (PlankAudioFileWriterRef p, const int bitsPerSample, const PlankChannelLayout channelLayout, const double sampleRate, const PlankB isFloat);
00102 PlankResult pl_AudioFileWriter_SetFormatOggVorbis (PlankAudioFileWriterRef p, const float quality, const PlankChannelLayout channelLayout, const double sampleRate);
00103 PlankResult pl_AudioFileWriter_SetFormatOggVorbisManaged (PlankAudioFileWriterRef p, const int minBitRate, const int nominalBitRate, const int maxBitRate, const PlankChannelLayout channelLayout, const double sampleRate);
00104 PlankResult pl_AudioFileWriter_SetFormatOpus (PlankAudioFileWriterRef p, const float quality, const PlankChannelLayout channelLayout, const double sampleRate, const double frameDuration);
00105 PlankResult pl_AudioFileWriter_SetFormatOpusManaged (PlankAudioFileWriterRef p, const int nominalBitRate, const PlankChannelLayout channelLayout, const double sampleRate, const double frameDuration);
00106 
00108 PlankResult pl_AudioFileWriter_Open (PlankAudioFileWriterRef p, const char* filepath);
00109 
00110 PlankResult pl_AudioFileWriter_OpenWithFile (PlankAudioFileWriterRef p, PlankFileRef file);
00111 
00113 PlankResult pl_AudioFileWriter_Close (PlankAudioFileWriterRef p);
00114 
00115 PlankResult pl_AudioFileWriter_WriteHeader (PlankAudioFileWriterRef p);
00116 
00117 PlankResult pl_AudioFileWriter_WriteFrames (PlankAudioFileWriterRef p, const PlankB convertByteOrder, const int numFrames, const void* data);
00118 
00119 PlankB pl_AudioFileWriter_IsEncodingNativeEndian (PlankAudioFileWriterRef p);
00120 
00121 PlankResult pl_AudioFileWriter_SetHeaderPad (PlankAudioFileWriterRef p, const PlankUI headerPad);
00122 
00123 PlankResult pl_AudioFileWriter_SetChannelItentifier (PlankAudioFileWriterRef p, const int channel, const PlankChannelIdentifier channelIdentifier);
00124 PlankResult pl_AudioFileWriter_GetChannelItentifier (PlankAudioFileWriterRef p, const int channel, PlankChannelIdentifier* identifier);
00125 PlankB pl_AudioFileWriter_SetChanneLayout (PlankAudioFileWriterRef p, const PlankChannelLayout layout);
00126 PlankResult pl_AudioFileWriter_GetChannelLayout (PlankAudioFileWriterRef p, PlankChannelLayout* layout);
00127 PlankResult pl_AudioFileWriter_GetNumChannels (PlankAudioFileWriterRef p, int* numChannels);
00128 
00129 
00132 PLANK_END_C_LINKAGE
00133 
00134 #if !DOXYGEN
00135 typedef struct PlankAudioFileWriter
00136 {    
00137     PlankP peer;
00138     PlankAudioFileFormatInfo formatInfo;
00139     
00140     PlankLL numFrames;
00141     PlankLL dataPosition;
00142     PlankLL metaDataChunkPosition;  // this is the position of the chunk header of the first optional metadata chunk after
00143     PlankUI headerPad;              // this is the number of bytes exlcuding the chunk header to pad the header with
00144     PlankUC dataOffset; // into data chunk
00145     PlankUC reserved1;
00146     PlankUC reserved2;
00147     PlankUC reserved3;
00148     
00149     PlankAudioFileMetaDataIOFlags metaDataIOFlags;
00150     PlankAudioFileMetaDataRef metaData;
00151     
00152     PlankM writeFramesFunction;
00153     PlankM writeHeaderFunction;
00154 
00155 } PlankAudioFileWriter;
00156 #endif
00157 
00158 #endif // PLANK_AUDIOFILEWRITER_H
 All Classes Functions Typedefs Enumerations Enumerator Properties