Okay, I've tried what you suggested, I started a decoder channel
_decoder = BASS_StreamCreateFileUser(STREAMFILE_NOBUFFER, BASS_STREAM_DECODE, &decoderFileProcs, NULL)
and a playing channel
_channel = BASS_StreamCreate(ci.freq, ci.chans, ci.flags&(BASS_SAMPLE_FLOAT|BASS_SAMPLE_8BITS), STREAMPROC_PUSH, 0)
and then I am feeding the playing channel in a separate thread
while (1)
{
BYTE buf[10000];
DWORD c = BASS_ChannelGetData(_decoder, buf, sizeof(buf)); // request data from the decoder
if (c==-1) break; // error, eg. EOF or freed
c = BASS_StreamPutData(_channel, buf, c); // feed the data to the push stream
if (c) usleep(100000); // queued data means the playback buffer is full, so wait a bit (100ms)
}
but it still works just for mp3 files.
If I try mp4 aac files or even lpcm, it just returns BASS_ERROR_FILEFORM.
I thought at least LPCM should work but it doesn't :/
Do you have any other ideas?
I really don't want to ditch BASS for playing filetypes other than mp3...
Also, what I've tried and doesn't work with mp4 files
NSString *fullPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:fileName];
NSData *data = [[NSData alloc] initWithContentsOfFile:fullPath];
NSData *subData = [data subdataWithRange:NSMakeRange(0, data.length / 2)];
if(!(_channel=BASS_StreamCreateFile(TRUE,[subData bytes],0,subData.length,BASS_SAMPLE_LOOP|BASS_SAMPLE_FLOAT)))
but it works perfect when the data provided is whole,
if(!(_channel=BASS_StreamCreateFile(TRUE,[data bytes],0,data.length,BASS_SAMPLE_LOOP|BASS_SAMPLE_FLOAT)))
So basically, it comes to having to provide the whole file data in order to play the mp4 file,
which is not acceptable for my app. Imagine loading a 280 minute podcast here