BASS.NET API for the Un4seen BASS Audio LibraryBassMidiBASS_MIDI_FontUnpack Method BASS.NET API for the Un4seen BASS Audio Library
Produces a decompressed version of a packed soundfont.

Unicode version only here (BASS_UNICODE will be used automatically).

Namespace: Un4seen.Bass.AddOn.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

public static bool BASS_MIDI_FontUnpack(
	int handle,
	string outfile
)

Parameters

handle
Type: SystemInt32
The soundfont to unpack.
outfile
Type: SystemString
Filename for the unpacked soundfont.

Return Value

Type: Boolean
If successful, the is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

To unpack a soundfont, the appropriate BASS add-on needs to be loaded (via BASS_PluginLoad(String)) 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(Int32, Int32, BASSInit, IntPtr). 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(Int32, BASS_MIDI_FONTINFO) can be used to check if a soundfont is packed.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThe soundfont is not packed.
BASS_ERROR_INITBASS_Init(Int32, Int32, BASSInit, IntPtr) has not been successfully called - it needs to be to decode the samples.
BASS_ERROR_CODECThe appropriate add-on to decode the samples is not loaded.
BASS_ERROR_CREATECouldn't create the output file, outfile.
BASS_ERROR_UNKNOWNSome other mystery problem!

Examples

Unpack a FLAC encoded soundfont:
VB
' load FLAC plugin
Bass.BASS_PluginLoad("bassflac.dll")
' open soundfont
Dim handle As Integer = BassMidi.BASS_MIDI_FontInit("afile.sf2pack")
' produce unpacked version
BassMidi.BASS_MIDI_FontUnpack(handle, "afile.sf2")
// load FLAC plugin
Bass.BASS_PluginLoad("bassflac.dll");
// open soundfont
int handle = BassMidi.BASS_MIDI_FontInit("afile.sf2pack");
// produce unpacked version
BassMidi.BASS_MIDI_FontUnpack(handle, "afile.sf2");
See Also

Reference