BASS_MIDI_FontUnpack
Produces a decompressed version of a packed soundfont.
BOOL BASS_MIDI_FontUnpack( HSOUNDFONT handle, void *outfile, DWORD flags );
Parameters
handle | The soundfont to unpack. | ||
outfile | Filename for the unpacked soundfont. | ||
flags | Any combination of these flags.
|
Return value
If successful, the TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.Error codes
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_NOTAVAIL | The soundfont is not packed. |
BASS_ERROR_INIT | BASS_Init has not been successfully called - it needs to be to decode the samples. |
BASS_ERROR_CODEC | The appropriate add-on to decode the samples is not loaded. |
BASS_ERROR_CREATE | Could not create the output file, outfile. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
Remarks
To unpack a soundfont, the appropriate BASS add-on needs to be loaded (via BASS_PluginLoad) to decode the samples. For example, if the samples are FLAC encoded, BASSFLAC would need to be loaded. BASS also needs to have been initialized, using BASS_Init. For just unpacking a soundfont, the "no sound" device could be used.A soundfont should not be unpacked while it is being used to render any MIDI streams, as that could delay the rendering.
BASS_MIDI_FontGetInfo can be used to check if a soundfont is packed.
Example
Unpack a FLAC encoded soundfont.BASS_PluginLoad("bassflac.dll", 0); // load FLAC plugin HSOUNDFONT handle=BASS_MIDI_FontInit("afile.sf2pack", 0); // open soundfont BASS_MIDI_FontUnpack(handle, "afile.sf2", 0); // produce unpacked version