--- libgig/trunk/src/gig.h 2005/02/17 02:22:26 384 +++ libgig/trunk/src/gig.h 2005/07/26 11:13:53 728 @@ -225,6 +225,8 @@ dimension_channelaftertouch = 0x83, ///< Channel Key Pressure dimension_releasetrigger = 0x84, ///< Special dimension for triggering samples on releasing a key. dimension_keyboard = 0x85, ///< Dimension for keyswitching + dimension_roundrobin = 0x86, ///< Different samples triggered each time a note is played, dimension regions selected in sequence + dimension_random = 0x87, ///< Different samples triggered each time a note is played, random order dimension_modwheel = 0x01, ///< Modulation Wheel (MIDI Controller 1) dimension_breath = 0x02, ///< Breath Controller (Coarse, MIDI Controller 2) dimension_foot = 0x04, ///< Foot Pedal (Coarse, MIDI Controller 4) @@ -307,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; @@ -380,9 +403,10 @@ bool VCFEnabled; ///< If filter should be used. vcf_type_t VCFType; ///< Defines the general filter characteristic (lowpass, highpass, bandpass, etc.). vcf_cutoff_ctrl_t VCFCutoffController; ///< Specifies which external controller has influence on the filter cutoff frequency. + bool VCFCutoffControllerInvert; ///< Inverts values coming from the defined cutoff controller uint8_t VCFCutoff; ///< Max. cutoff frequency. curve_type_t VCFVelocityCurve; ///< Defines a transformation curve for the incoming velocity values, affecting the VCF. - uint8_t VCFVelocityScale; ///< (0-127) Amount velocity controls VCF cutoff frequency (only if no other VCF cutoff controller is defined). + uint8_t VCFVelocityScale; ///< (0-127) Amount velocity controls VCF cutoff frequency (only if no other VCF cutoff controller is defined, otherwise this is the minimum cutoff). uint8_t VCFVelocityDynamicRange; ///< 0x04 = lowest, 0x00 = highest uint8_t VCFResonance; ///< Firm internal filter resonance weight. bool VCFResonanceDynamic; ///< If true: Increases the resonance Q according to changes of controllers that actually control the VCF cutoff frequency (EG2, ext. VCF MIDI controller). @@ -409,6 +433,8 @@ bool SustainDefeat; ///< If true: Sustain pedal will not hold a note. bool MSDecode; ///< Gigastudio flag: defines if Mid Side Recordings should be decoded. uint16_t SampleStartOffset; ///< Number of samples the sample start should be moved (0 - 2000). + double SampleAttenuation; ///< Sample volume (calculated from DLS::Sampler::Gain) + // derived attributes from DLS::Sampler DLS::Sampler::UnityNote; DLS::Sampler::FineTune; @@ -418,6 +444,9 @@ // Methods double GetVelocityAttenuation(uint8_t MIDIKeyVelocity); + double GetVelocityRelease(uint8_t MIDIKeyVelocity); + double GetVelocityCutoff(uint8_t MIDIKeyVelocity); + protected: DimensionRegion(RIFF::List* _3ewl); ~DimensionRegion(); @@ -456,8 +485,11 @@ 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 + double* pVelocityCutoffTable; ///< Points to the velocity table corresponding to the filter 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); }; @@ -481,6 +513,8 @@ uint32_t LoopFraction; ///< The fractional value specifies a fraction of a sample at which to loop (only if Loops > 0). This allows a loop to be fine tuned at a resolution greater than one sample. A value of 0 means no fraction, a value of 0x80000000 means 1/2 of a sample length. 0xFFFFFFFF is the smallest fraction of a sample that can be represented. uint32_t LoopPlayCount; ///< Number of times the loop should be played (only if Loops > 0, a value of 0 = infinite). bool Compressed; ///< If the sample wave is compressed (probably just interesting for instrument and sample editors, as this library already handles the decompression in it's sample access methods anyway). + uint32_t TruncatedBits; ///< For 24-bit compressed samples only: number of bits truncated during compression (0, 4 or 6) + bool Dithered; ///< For 24-bit compressed samples only: if dithering was used during compression with bit reduction // own methods buffer_t LoadSampleData(); @@ -507,8 +541,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 @@ -616,7 +651,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; }; @@ -655,7 +690,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; }; @@ -675,11 +710,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; @@ -690,9 +725,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. */ @@ -702,6 +739,9 @@ void PrintMessage(); }; + String libraryName(); + String libraryVersion(); + } // namespace gig #endif // __GIG_H__