pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
plank_AudioFileReader.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_AUDIOFILEREADER_H
00040 #define PLANK_AUDIOFILEREADER_H
00041 
00042 #include "plank_AudioFileCommon.h"
00043 
00044 PLANK_BEGIN_C_LINKAGE
00045 
00054 typedef struct PlankAudioFileReader* PlankAudioFileReaderRef; 
00055 
00058 PlankAudioFileReaderRef pl_AudioFileReader_CreateAndInit();
00059 
00062 PlankAudioFileReaderRef pl_AudioFileReader_Create();
00063 
00067 PlankResult pl_AudioFileReader_Init (PlankAudioFileReaderRef p);
00068 
00072 PlankResult pl_AudioFileReader_DeInit (PlankAudioFileReaderRef p);
00073 
00077 PlankResult pl_AudioFileReader_Destroy (PlankAudioFileReaderRef p);
00078 
00083 PlankFileRef pl_AudioFileReader_GetFile (PlankAudioFileReaderRef p);
00084 
00088 PlankResult pl_AudioFileReader_Open (PlankAudioFileReaderRef p, const char* filepath);
00089 
00090 PlankResult pl_AudioFileReader_OpenWithMetaData (PlankAudioFileReaderRef p, const char* filepath);
00091 
00092 PlankResult pl_AudioFileReader_OpenInternal (PlankAudioFileReaderRef p, const char* filepath, const PlankAudioFileMetaDataIOFlags metaDataIOFlags);
00093 
00096 PlankResult pl_AudioFileReader_OpenWithFile (PlankAudioFileReaderRef p, PlankFileRef file, const PlankAudioFileMetaDataIOFlags metaDataIOFlags);
00097 
00098 PlankResult pl_AudioFileReader_OpenWithAudioFileArray (PlankAudioFileReaderRef p, PlankDynamicArrayRef array, PlankB ownArray, const int multiMode, int* indexRef);
00099 
00100 typedef PlankResult (*PlankAudioFileReaderCustomNextFunction)(PlankP, PlankAudioFileReaderRef, PlankAudioFileReaderRef*);
00101 typedef PlankResult (*PlankAudioFileReaderCustomFreeFunction)(PlankP);
00102 typedef PlankResult (*PlankAudioFileReaderCustomSetFrameFunction)(PlankAudioFileReaderRef, const PlankLL frameIndex);
00103 typedef PlankResult (*PlankAudioFileReaderCustomGetFrameFunction)(PlankAudioFileReaderRef, PlankLL *);
00104 
00105 
00106 PlankResult pl_AudioFileReader_OpenWithCustomNextFunction (PlankAudioFileReaderRef p,
00107                                                            PlankAudioFileReaderCustomNextFunction nextFunction,
00108                                                            PlankAudioFileReaderCustomFreeFunction freeFunction,
00109                                                            PlankAudioFileReaderCustomSetFrameFunction setFrameFunction,
00110                                                            PlankAudioFileReaderCustomGetFrameFunction getFrameFunction,
00111                                                            PlankP ref);
00112 
00113 PlankResult pl_AudioFileReader_OpenWithRegion (PlankAudioFileReaderRef p, PlankAudioFileReaderRef original, PlankAudioFileRegionRef region);
00114 
00115 //PlankResult pl_AudioFileReader_OpenCopy (PlankAudioFileReaderRef p, PlankAudioFileReaderRef original);
00116 //PlankResult pl_AudioFileReader_OpenCopyWithoutMetaData (PlankAudioFileReaderRef p, PlankAudioFileReaderRef original);
00117 
00118 
00122 PlankResult pl_AudioFileReader_Close (PlankAudioFileReaderRef p);
00123 
00124 
00125 const PlankAudioFileFormatInfo* pl_AudioFileReader_GetFormatInfoReadOnly (PlankAudioFileReaderRef p);
00126 
00127 
00131 PlankResult pl_AudioFileReader_GetFormat (PlankAudioFileReaderRef p, int *format);
00132 
00136 PlankResult pl_AudioFileReader_GetEncoding (PlankAudioFileReaderRef p, int *encoding);
00137 
00142 PlankResult pl_AudioFileReader_GetBitsPerSample (PlankAudioFileReaderRef p, int *bitsPerSample);
00143 
00148 PlankResult pl_AudioFileReader_GetBytesPerFrame (PlankAudioFileReaderRef p, int *bytesPerFrame);
00149 
00153 PlankResult pl_AudioFileReader_GetNumChannels (PlankAudioFileReaderRef p, int *numChannels);
00154 
00158 PlankResult pl_AudioFileReader_GetSampleRate (PlankAudioFileReaderRef p, double *sampleRate);
00159 
00163 PlankResult pl_AudioFileReader_GetNumFrames (PlankAudioFileReaderRef p, PlankLL *numFrames);
00164 
00165 PlankB pl_AudioFileReader_IsPositionable (PlankAudioFileReaderRef p);
00166 
00170 PlankResult pl_AudioFileReader_SetFramePosition (PlankAudioFileReaderRef p, const PlankLL frameIndex);
00171 
00175 PlankResult pl_AudioFileReader_ResetFramePosition (PlankAudioFileReaderRef p);
00176 
00180 PlankResult pl_AudioFileReader_GetFramePosition (PlankAudioFileReaderRef p, PlankLL *frameIndex);
00181 
00185 PlankResult pl_AudioFileReader_ReadFrames (PlankAudioFileReaderRef p, const PlankB convertByteOrder, const int numFrames, void* data, int* framesRead);
00186 
00187 PlankAudioFileMetaDataRef pl_AudioFileReader_GetMetaData (PlankAudioFileReaderRef p);
00188 
00189 PlankResult pl_AudioFileReader_SetName (PlankAudioFileReaderRef p, const char* text);
00190 const char* pl_AudioFileReader_GetName (PlankAudioFileReaderRef p);
00191 
00192 PlankResult pl_AudioFileReader_GetChannelItentifier (PlankAudioFileReaderRef p, const int channel, PlankChannelIdentifier* identifier);
00193 PlankResult pl_AudioFileReader_GetChannelLayout (PlankAudioFileReaderRef p, PlankChannelLayout* layout);
00194 
00195 
00198 PLANK_END_C_LINKAGE
00199 
00200 typedef struct PlankAudioFileReaderCustom* PlankAudioFileReaderCustomRef;
00201 
00202 #if !DOXYGEN
00203 typedef struct PlankAudioFileReader
00204 {
00205     PlankP peer;
00206     PlankAudioFileFormatInfo formatInfo;
00207     PlankC format;
00208 
00209     PlankLL numFrames;
00210     PlankLL dataPosition;
00211     
00212     PlankAudioFileMetaDataIOFlags metaDataIOFlags;
00213     PlankAudioFileMetaDataRef metaData;
00214     PlankDynamicArray name;
00215     
00216     PlankM readFramesFunction;
00217     PlankM setFramePositionFunction;
00218     PlankM getFramePositionFunction;
00219 } PlankAudioFileReader;
00220 
00221 typedef struct PlankAudioFileReaderCustom
00222 {
00223     PlankAudioFileReaderCustomNextFunction nextFunction;
00224     PlankAudioFileReaderCustomFreeFunction freeFunction;
00225     PlankP ref;
00226     PlankAudioFileReaderRef currentAudioFile;
00227 } PlankAudioFileReaderCustom;
00228 #endif
00229 
00230 #endif // PLANK_AUDIOFILEREADER_H
 All Classes Functions Typedefs Enumerations Enumerator Properties