Is it possible to join two mp3 files in one channel using BASS_StreamPutData?
Yes, but you would need to create a "push" stream for it (using BASS_StreamCreate), and you could then feed the data from both files into that (using BASS_StreamPutData). Pre-decoding data from the files may not be the most effecient way to do it though. Another way to do it is to use a STREAMPROC callback function, which can decode data from the files as it's needed. Something like this...
#define sources 2
HSTREAM source[sources];
int currentsource;
...
source[0]=BASS_StreamCreateFile(FALSE, filename[0], 0, 0, BASS_STREAM_DECODE); // create "decoding channel" for 1st file
source[1]=BASS_StreamCreateFile(FALSE, filename[1], 0, 0, BASS_STREAM_DECODE); // and the 2nd file
BASS_CHANNELINO ci;
BASS_ChannelGetInfo(source[0], &ci); // get sample format info
output=BASS_StreamCreate(ci.freq, ci.chans, 0, StreamProc, 0); // create a custom stream with same format
currentsource=0;
BASS_ChannelPlay(output, 0); // start it
...
DWORD CALLBACK StreamProc(HSTREAM handle, void *buf, DWORD len, void *user)
{
retry:
DWORD r=BASS_ChannelGetData(source[currentsource], buf, len); // get data from the current sound
if (r==(DWORD)-1) { // failed
if (currentsource==sources-1) return BASS_STREAMPROC_END; // reached the end
currentsource++; // advance to next source
goto retry;
}
return r;
}
Note the source files need to have an identical sample format (sample rate and channel count) for this to work properly. If they don't, you could use the BASSmix add-on instead, which can resample them to a common format. Here's a thread on that...
www.un4seen.com/forum/?topic=6159