How can I add a handle so it will wait will it stopped playing the sound?
The BASS_StreamFree call will stop playback of the stream. If you would like to delay that until playback has finished, you could use a BASS_SYNC_END sync, which will notify you when playback has reached the end, something like this...
BASS_ChannelSetSync(stream, BASS_SYNC_END, 0, EndSyncProc, 0); // set an END sync on the stream
BASS_ChannelPlay(stream, FALSE); // start playing it
...
void CALLBACK EndSyncProc(HSYNC handle, DWORD channel, DWORD data, void *user)
{
BASS_StreamFree(channel); // free the stream
}
Alternatively, you could add the BASS_STREAM_AUTOFREE flag to the BASS_StreamCreateFile call to have the stream automatically freed when it reaches the end. Please see the documentation for details on that stuff (also see BASS_ChannelIsActive).
Is there a way to load some files into memory?
Do you mean pre-decode the files to memory, so that no file reading or decoding is required during playback? If so, that is possible via the "sample" functions (see BASS_SampleLoad).