Initializes the BASS digital output system.
BOOL WINAPI BASS_Init( |
Parameters
device | The device to use... 0 = first, -1 = default, -2 = no sound. BASS_GetDeviceDescription can be used to get the total number of devices. | ||||||||||
freq | Output sample rate. | ||||||||||
flags | Any combination of these flags.
| ||||||||||
win | The application's main window. If you're using the console, then you should use the handle returned by the GetForegroundWindow function. |
Return value
If BASS was successfully initialized then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_ALREADY | BASS has already been initialized. You must call BASS_Free before calling BASS_Init again. |
BASS_ERROR_DEVICE | The device number specified is invalid. |
BASS_ERROR_DRIVER | There is no available device driver. |
BASS_ERROR_FORMAT | The specified format is not supported by the device. Try changing the freq and flags parameters. |
BASS_ERROR_MEM | There is insufficent memory. |
BASS_ERROR_NO3D | The device has no 3D support. |
BASS_ERROR_NOA3D | The device has no A3D support. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
Remarks
This function must be successfully called before calling any other BASS functions, except BASS_ErrorGetCode, BASS_GetDeviceDescription, BASS_GetGlobalVolumes, BASS_GetVersion, BASS_SetBufferLength, BASS_SetLogCurves, BASS_SetGlobalVolumes, and the CD functions.
The no sound device allows loading and "playing" of MOD musics only, all sample/stream functions and most other functions fail. This is so that you can still use the MOD musics as synchronizers when there is no soundcard present. When using the no sound device, you should still set the other parameters as you would do normally.
It is advisable to have a "lower quality" option (eg. 22050hz instead of 44100hz) in your software, for users with slower computers.
When requesting the default device with the BASS_DEVICE_A3D flag, the device used is not necessarily the same as would be used without the BASS_DEVICE_A3D flag. The A3D driver automatically searches for the best (most hardware channels) A3D device. So if your program supports both A3D and EAX, then you should let the user choose, otherwise users that have both an A3D device and an EAX device will be stuck with the A3D.
Example
To initialize BASS, falling back to no sound if no device is available.
// try initializing the default device, at 44100hz stereo 16 bits |
See also
BASS_CDInit, BASS_Free, BASS_GetDSoundObject, BASS_GetInfo, BASS_MusicLoad, BASS_Start, BASS_SampleLoad, BASS_SampleCreate, BASS_StreamCreate, BASS_StreamCreateFile