Creates a sample stream from an MP3 or WAV file.
HSTREAM WINAPI BASS_StreamCreateFile( |
Parameters
mem | TRUE = stream the file from memory. | ||||||||
file | Filename (mem = FALSE) or a memory location (mem = TRUE). | ||||||||
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 | Any combination of these flags.
|
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_FILEOPEN | The file could not be opened. |
BASS_ERROR_ILLPARAM | The length must be specified when streaming from memory. |
BASS_ERROR_FORMAT | The file's format is not recognised/supported. |
BASS_ERROR_MEM | There is insufficent memory. |
BASS_ERROR_NO3D | Couldn't initialize 3D support for the stream. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
Remarks
MPEG 1.0 and 2.0 layer 3 files are supported, layers 1 and 2 are not. But they have worse quality and compression ratios, so it's no big loss!
WAV files can be in standard Windows PCM format or they can be compressed with any CODEC, but the CODEC is required to be installed on the user's computer for the WAV to be decoded. So, you should either distribute the CODEC with your software, or use a CODEC that comes with Windows (eg. Microsoft ADPCM).
Use BASS_ChannelGetAttributes and BASS_ChannelGetFlags to retrieve information on the format (sample rate, resolution, channels) of the stream. The total length of the stream can be retrieved using BASS_StreamGetLength.
Example
To stream an MP3 file, using reduced quality.
BASS_StreamFileCreate(FALSE,"afile.mp3",0,0,BASS_MP3_HALFRATE); |
See also
BASS_ChannelGetAttributes, BASS_ChannelGetFlags, BASS_ChannelSet3DAttributes, BASS_ChannelSet3DPosition, BASS_ChannelSetAttributes, BASS_ChannelSetEAXMix, BASS_ChannelSetPosition, BASS_StreamCreate, BASS_StreamFree, BASS_StreamGetLength, BASS_StreamPlay