--- libgig/trunk/src/gig.h 2005/03/09 22:02:40 437 +++ libgig/trunk/src/gig.h 2005/06/19 15:18:59 666 @@ -309,6 +309,27 @@ 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. An equivalent progress_t structure will be passed + * back as argument to the callback function on each progress change. + * The factor field of the supplied progress_t structure will then + * reflect the current progress as value between 0.0 and 1.0. You might + * want to use the custom field for data needed in your callback + * function. + */ + struct progress_t { + void (*callback)(progress_t*); ///< Callback function pointer which has to be assigned to a function for progress notification. + float factor; ///< Reflects current progress as value between 0.0 and 1.0. + void* custom; ///< This pointer can be used for arbitrary data. + float __range_min; ///< Only for internal usage, do not modify! + float __range_max; ///< Only for internal usage, do not modify! + progress_t(); + }; + // just symbol prototyping class File; class Instrument; @@ -422,6 +443,8 @@ // Methods double GetVelocityAttenuation(uint8_t MIDIKeyVelocity); + double GetVelocityRelease(uint8_t MIDIKeyVelocity); + protected: DimensionRegion(RIFF::List* _3ewl); ~DimensionRegion(); @@ -460,8 +483,10 @@ static uint Instances; ///< Number of DimensionRegion instances. static VelocityTableMap* pVelocityTables; ///< Contains the tables corresponding to the various velocity parameters (VelocityResponseCurve and VelocityResponseDepth). double* pVelocityAttenuationTable; ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion. + double* pVelocityReleaseTable; ///< Points to the velocity table corresponding to the release velocity parameters of this DimensionRegion leverage_ctrl_t DecodeLeverageController(_lev_ctrl_t EncodedController); + double* GetVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling); double* CreateVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling); }; @@ -513,8 +538,9 @@ unsigned long WorstCaseFrameSize; ///< For compressed samples only: size (in bytes) of the largest possible sample frame. unsigned long SamplesPerFrame; ///< For compressed samples only: number of samples in a full sample frame. buffer_t RAMCache; ///< Buffers samples (already uncompressed) in RAM. + unsigned long FileNo; ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig) - Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset); + Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0); ~Sample(); /** * Swaps the order of the data words in the given memory area @@ -622,7 +648,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 +687,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 +707,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,9 +722,11 @@ InstrumentList* pInstruments; InstrumentList::iterator InstrumentsIterator; - void LoadSamples(); - void LoadInstruments(); + void LoadSamples(progress_t* pProgress = NULL); + void LoadInstruments(progress_t* pProgress = NULL); friend class Region; + + std::list ExtensionFiles; }; /** Will be thrown whenever a gig specific error occurs while trying to access a Gigasampler File. */ @@ -708,6 +736,9 @@ void PrintMessage(); }; + String libraryName(); + String libraryVersion(); + } // namespace gig #endif // __GIG_H__