--- libgig/trunk/src/gig.h 2005/03/09 22:02:40 437 +++ libgig/trunk/src/gig.h 2005/05/07 20:19:10 515 @@ -309,6 +309,21 @@ unsigned long loop_cycles_left; ///< How many times the loop has still to be passed, this value will be decremented with each loop cycle. }; + /** + * @brief Used for indicating the progress of a certain task. + * + * The function pointer argument has to be supplied with a valid + * function of the given signature which will then be called on + * progress changes. The float argument of the callback function will + * then reflect the current progress as a value between 0.0 and 1.0. + */ + struct progress_t { + void (*callback)(float); ///< Callback function pointer which has to be assigned to a function for progress notification. + float __range_min; + float __range_max; + progress_t(); + }; + // just symbol prototyping class File; class Instrument; @@ -622,7 +637,7 @@ Region(Instrument* pInstrument, RIFF::List* rgnList); void LoadDimensionRegions(RIFF::List* rgn); - Sample* GetSampleFromWavePool(unsigned int WavePoolTableIndex); + Sample* GetSampleFromWavePool(unsigned int WavePoolTableIndex, progress_t* pProgress = NULL); ~Region(); friend class Instrument; }; @@ -661,7 +676,7 @@ Region* RegionKeyTable[128]; ///< fast lookup for the corresponding Region of a MIDI key int RegionIndex; - Instrument(File* pFile, RIFF::List* insList); + Instrument(File* pFile, RIFF::List* insList, progress_t* pProgress = NULL); ~Instrument(); friend class File; }; @@ -681,11 +696,11 @@ DLS::Resource::GetParent; // overridden methods File(RIFF::File* pRIFF); - Sample* GetFirstSample(); ///< Returns a pointer to the first Sample object of the file, NULL otherwise. + Sample* GetFirstSample(progress_t* pProgress = NULL); ///< Returns a pointer to the first Sample object of the file, NULL otherwise. Sample* GetNextSample(); ///< Returns a pointer to the next Sample object of the file, NULL otherwise. Instrument* GetFirstInstrument(); ///< Returns a pointer to the first Instrument object of the file, NULL otherwise. Instrument* GetNextInstrument(); ///< Returns a pointer to the next Instrument object of the file, NULL otherwise. - Instrument* GetInstrument(uint index); + Instrument* GetInstrument(uint index, progress_t* pProgress = NULL); ~File(); protected: typedef std::list SampleList; @@ -696,8 +711,8 @@ InstrumentList* pInstruments; InstrumentList::iterator InstrumentsIterator; - void LoadSamples(); - void LoadInstruments(); + void LoadSamples(progress_t* pProgress = NULL); + void LoadInstruments(progress_t* pProgress = NULL); friend class Region; };