BASS_MIDI_StreamCreateURL
Creates a sample stream from an MIDI file on the internet, optionally receiving the downloaded data in a callback.
HSTREAM BASS_StreamCreateURL(
char *url,
DWORD offset,
DWORD flags,
DOWNLOADPROC *proc,
void *user,
DWORD freq
);
Parameters
| url | URL of the file to stream. Should begin with "http://" or "ftp://". | ||||||||||||||||||||||||||||||||||||||
| offset | File position to start streaming from. This is ignored by some servers, specifically when the file length is unknown. | ||||||||||||||||||||||||||||||||||||||
| flags | Any combination of these flags.
| ||||||||||||||||||||||||||||||||||||||
| proc | Callback function to receive the downloaded file... NULL = no callback. | ||||||||||||||||||||||||||||||||||||||
| user | User instance data to pass to the callback function. | ||||||||||||||||||||||||||||||||||||||
| freq | Sample rate to render/play the MIDI stream at... 0 = the rate specified in the BASS_Init call, 1 = the device's current output rate (or the BASS_Init rate if that is not available). |
Return value
If successful, the new stream's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.Error codes
| BASS_ERROR_INIT | BASS_Init has not been successfully called. |
| BASS_ERROR_NOTAVAIL | Only decoding channels (BASS_STREAM_DECODE) are allowed when using the "no sound" device. The BASS_STREAM_AUTOFREE flag is also unavailable to decoding channels. |
| BASS_ERROR_NONET | No internet connection could be opened. |
| BASS_ERROR_ILLPARAM | url is not a valid URL. |
| BASS_ERROR_TIMEOUT | The server did not respond to the request within the timeout period, as set with the BASS_CONFIG_NET_TIMEOUT config option. |
| BASS_ERROR_FILEOPEN | The file could not be opened. |
| BASS_ERROR_FILEFORM | The file's format is not recognised/supported. |
| BASS_ERROR_FORMAT | The sample format is not supported by the device/drivers. If the stream is more than stereo or the BASS_SAMPLE_FLOAT flag is used, it could be that they are not supported. |
| BASS_ERROR_SPEAKER | The specified SPEAKER flags are invalid. The device/drivers do not support them or 3D functionality is enabled. |
| BASS_ERROR_MEM | There is insufficient memory. |
| BASS_ERROR_NO3D | Could not initialize 3D support. |
| BASS_ERROR_UNKNOWN | Some other mystery problem! |
Remarks
The entire MIDI file is preloaded, so the standard BASS_STREAM_BLOCK and BASS_STREAM_RESTRATE flags have no effect here.Regardless of the BASS_CONFIG_MIDI_AUTOFONT setting, a matching soundfont is not looked for when opening a MIDI file from a URL.
Platform-specific
Away from Windows, all mixing is done in software (by BASS), so the BASS_SAMPLE_SOFTWARE flag is unnecessary. The BASS_SAMPLE_FX flag is also ignored. On Android and iOS, sinc interpolation requires a NEON-supporting CPU; the BASS_MIDI_SINCINTER flag will otherwise be ignored. Sinc interpolation is not available on Windows CE.See also
BASS_MIDI_StreamCreateFile, BASS_MIDI_StreamCreateFileUser, BASS_MIDI_StreamGetChannel, BASS_MIDI_StreamGetMark, BASS_MIDI_StreamLoadSamples, BASS_MIDI_StreamSetFonts, BASS_ATTRIB_MIDI_CPU, BASS_ATTRIB_MIDI_SRC, BASS_CONFIG_MIDI_DEFFONT, BASS_CONFIG_MIDI_VOICESBASS_ChannelGetInfo, BASS_ChannelGetLength, BASS_ChannelGetTags, BASS_ChannelPlay, BASS_ChannelSetAttribute, BASS_ChannelSetDSP, BASS_ChannelSetFX, BASS_ChannelSetLink, BASS_StreamFree, DOWNLOADPROC callback, BASS_CONFIG_NET_AGENT, BASS_CONFIG_NET_PROXY, BASS_CONFIG_NET_TIMEOUT