I'm trying to play a stream from memory. The stream is an .ogg music file.
If I create a stream from file, all works well. However, if I load the .ogg file to memory and then try to play it I just get silence. There's no BASS errors, so it seems like it should be working.
Here's my code:
file.openFromFile(fullfile, "rb", false);
buffer = (char*)malloc(file.getSize());
file.read(buffer, file.getSize(), 1);
musicStreamID = BASS_StreamCreateFile(true, buffer, 0, file.getSize(), BASS_STREAM_AUTOFREE);
// Old code to play from file --- musicStreamID = BASS_StreamCreateFile(FALSE, filename, 0, 0, BASS_STREAM_AUTOFREE);
engine->debugMsg.printff(EdebugMsg_Error, "BASS AUDIO: Can't play file %s: %s", fullfile, getBassErrorString());
bool res = BASS_ChannelPlay(musicStreamID, FALSE);
engine->debugMsg.printff(EdebugMsg_Error, "%s", getBassErrorString());
The code returns a valid handle and the ChannelPlay function returns TRUE, but I don't hear any music.
I've tried this code on Windows and Android and get the same results.