pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
plank_MultiFileReader.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_IFFFILEWRITER_H
00040 #define PLANK_IFFFILEWRITER_H
00041 
00042 #include "plank_File.h"
00043 #include "../containers/plank_DynamicArray.h"
00044 #include "../containers/plank_LockFreeQueue.h"
00045 
00046 
00047 PLANK_BEGIN_C_LINKAGE
00048 
00056 #define PLANKMULITFILE_MODE_UNKNOWN                 0
00057 #define PLANKMULITFILE_MODE_ARRAYSEQUENCEONCE       1       // DynamicArray of File objects
00058 #define PLANKMULITFILE_MODE_ARRAYSEQUENCELOOP       2       // DynamicArray of File objects
00059 #define PLANKMULITFILE_MODE_ARRAYRANDOM             3       // DynamicArray of File objects randomly chosen
00060 #define PLANKMULITFILE_MODE_ARRAYRANDOMNOREPEAT     4       // DynamicArray of File objects randomly chosen, not repeating
00061 //#define PLANKMULITFILE_MODE_ARRAYCALLBACK           5       // DynamicArray of File objects chosen using a callback
00062 #define PLANKMULITFILE_MODE_ARRAYINDEXREF           5       // DynamicArray of File objects chosen using a reference to an index
00063 #define PLANKMULITFILE_MODE_QUEUE                   6       // LockFreeQueue of File objects
00064 #define PLANKMULITFILE_MODE_CUSTOM                  7       // Custom
00065 
00066 
00067 
00068 typedef PlankResult (*PlankMultiFileNextFunction)(PlankMulitFileReaderRef);
00069 typedef PlankResult (*PlankMultiFileNextIndexFunction)(PlankMulitFileReaderRef);
00070 typedef PlankResult (*PlankMultiFileDestroyCustomFunction)(PlankMulitFileReaderRef);
00071 
00072 
00073 PlankMulitFileReaderRef pl_MultiFileReader_Create();
00074 
00075 PlankResult pl_MultiFileReader_InitArraySequence (PlankMulitFileReaderRef p, const int fileMode,  PlankDynamicArrayRef array, const PlankB ownArray,  const PlankB loop);
00076 PlankResult pl_MultiFileReader_InitArrayRandom (PlankMulitFileReaderRef p, const int fileMode, PlankDynamicArrayRef array, const PlankB ownArray, const PlankB noRepeat);
00077 PlankResult pl_MultiFileReader_InitArrayIndexRef (PlankMulitFileReaderRef p, const int fileMode, PlankDynamicArrayRef array, const PlankB ownArray, int* indexRef);
00078 PlankResult pl_MultiFileReader_InitQueue (PlankMulitFileReaderRef p, const int fileMode, PlankLockFreeQueueRef queue, const PlankB ownQueue);
00079 PlankResult pl_MultiFileReader_InitCustom (PlankMulitFileReaderRef p, const int fileMode, PlankP custom, const PlankB ownCustom, PlankMultiFileNextFunction nextFuntion, PlankMultiFileDestroyCustomFunction destroyCustomFunction);
00080 
00081 PlankResult pl_MultiFileReader_DeInit (PlankMulitFileReaderRef p);
00082 PlankResult pl_MultiFileReader_Destroy (PlankMulitFileReaderRef p);
00083 
00084 PlankResult pl_MultiFileReader_GetMultiMode (PlankMulitFileReaderRef p, int* multiMode);
00085 PlankResult pl_MultiFileReader_GetArray (PlankMulitFileReaderRef p, PlankDynamicArrayRef* array);
00086 PlankResult pl_MultiFileReader_GetQueue (PlankMulitFileReaderRef p, PlankLockFreeQueueRef* queue);
00087 PlankResult pl_MultiFileReader_GetCurrentFile (PlankMulitFileReaderRef p, PlankFileRef* currentFile);
00088 PlankResult pl_MultiFileReader_GetIndex (PlankMulitFileReaderRef p, int* index);
00089 PlankResult pl_MultiFileReader_SetIndex (PlankMulitFileReaderRef p, const int index);
00090 PlankResult pl_MultiFileReader_GetNumFiles (PlankMulitFileReaderRef p, int* count);
00091 
00092 
00093 PlankResult pl_MultiFileReader_Open (PlankMulitFileReaderRef p);
00094 PlankResult pl_MultiFileReader_Read (PlankMulitFileReaderRef p, PlankP ptr, int maximumBytes, int* bytesRead);
00095 
00096 PlankResult pl_MultiFileReader_Queue_FreeCurrentFile (PlankMulitFileReaderRef p);
00097 
00100 PLANK_END_C_LINKAGE
00101 
00102 #if !DOXYGEN
00103 typedef struct PlankMulitFileReader
00104 {
00105     void* source;
00106     PlankFileRef currentFile;
00107     PlankMultiFileNextFunction nextFunction;
00108     PlankMultiFileNextIndexFunction nextIndexFunction;
00109     PlankP otherRef;
00110 
00111     int multiMode;
00112     PlankB ownSource;
00113     int index;
00114     int fileMode;
00115 } PlankMulitFileReader;
00116 #endif
00117 
00118 //------------------------------------------------------------------------------
00119 
00120 
00121 
00122 #endif // PLANK_IFFFILEWRITER_H
 All Classes Functions Typedefs Enumerations Enumerator Properties