Creates a sample stream from a WMA file or URL.
HSTREAM BASS_WMA_StreamCreateFile( BOOL mem, void *file, QWORD offset, QWORD length, DWORD flags );
|mem||TRUE = stream the file from memory, 2 = stream from an IStream object.|
|file||Filename or URL (mem = FALSE) or a memory location (mem = TRUE), or a pointer to an IStream object (mem = 2).|
|offset||File offset to begin streaming from (only used if mem = FALSE).|
|length||Data length... 0 = use all data up to the end of the file (if mem = FALSE).|
|flags||A combination of these flags.
|BASS_ERROR_WMA||The Windows Media modules (v9 or above) are not installed.|
|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_ILLPARAM||One or more of the parameters are invalid.|
|BASS_ERROR_FILEOPEN||The file could not be opened.|
|BASS_ERROR_FILEFORM||The file's format is not recognised/supported.|
|BASS_ERROR_CODEC||There is no appropriate codec installed to decode the file. Try installing the latest Windows Media codecs.|
|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, they are attempting to assign a stereo stream to a mono speaker or 3D functionality is enabled.|
|BASS_ERROR_MEM||There is insufficient memory.|
|BASS_ERROR_NO3D||Could not initialize 3D support.|
|BASS_ERROR_WMA_LICENSE||The WMA file cannot be played because it is protected.|
|BASS_ERROR_UNKNOWN||Some other mystery problem!|
A description of the codec used by the file is also available from BASS_ChannelGetTags (BASS_TAG_WMA_CODEC). 2 null-terminated UTF-8 strings are returned, with the 1st string being the name of the codec, and the 2nd containing additional information like what VBR setting was used.
The playback length of the stream can be retrieved using BASS_ChannelGetLength. Until the whole file has been streamed, whatever length the file's header says is returned, which may or may not be exact.
Although the Windows Media modules uses its own internet streaming routines (not BASS's), the BASS_CONFIG_NET_PROXY and BASS_CONFIG_NET_TIMEOUT config options do have effect when opening WMA streams. When the BASS_CONFIG_NET_PLAYLIST config option is enabled, BASSWMA will process ASX and WPL files. None of the other NET config options apply.
Unless the BASS_CONFIG_WMA_BASSFILE config option is enabled, the Windows Media modules uses its own file reading routines, and the offset and length parameters are ignored, except that length is still the length when playing from memory. Also, BASS_StreamGetFilePosition is not fully supported. The file size (BASS_FILEPOS_END) can be retrieved, but the decode position (BASS_FILEPOS_CURRENT) is not available. The download progress of streamed files (BASS_FILEPOS_DOWNLOAD) can also be retrieved. The buffering progress (percentage) can be retrieved using the BASS_FILEPOS_WMA_BUFFER mode.
When streaming a file from the internet, it is not possible to seek with BASS_ChannelSetPosition until the whole file has been downloaded. A sync (BASS_SYNC_DOWNLOAD) can be set to be notified when the file has been downloaded. When streaming from the internet, the WMA decoding is performed in a separate thread, so the CPU used to decode the stream during playback will not be included in the BASS_GetCPU return value.
The playback rate of local files can be altered with BASS_ChannelSetAttribute. The playback rate of internet streams should not be changed, because they are delivered at a fixed rate: the rate required to sustain playback at normal speed. So increasing the rate will result in playback stalling.
BASS_ChannelGetInfo, BASS_ChannelGetLength, BASS_ChannelPlay, BASS_ChannelSetAttribute, BASS_ChannelSetDSP, BASS_ChannelSetFX, BASS_ChannelSetLink, BASS_StreamFree, BASS_ChannelGetTags