since my first post as a very green newbee on Bass, I have come some way. I managed to play files from disk, files from an SQL database (mp3 as blobs) and CD tracks, and I thought to be ready for the next step, just combining my current 'victories'.
What I want now is get a CD track, read it and encode it using Lame into a byte array or memorystream to be played (much) later. Without any file creation.
so I get myself a stream:
_stream = BassCd.BASS_CD_StreamCreate(ct.driveNo, ct.trackNr - 1, BASSFlag.BASS_DEFAULT);
stick this into an encoder:
BassEnc.BASS_Encode_Start(_stream, "lame", BASSEncode.BASS_ENCODE_AUTOFREE, null, IntPtr.Zero)
and now all one needs to do is create the bytes:
MemoryStream m = new MemoryStream();
while (BassEnc.BASS_Encode_IsActive(_stream) != BASSActive.BASS_ACTIVE_STOPPED)
byte buf = new byte; // processing buffer
BassEnc.BASS_Encode_Write(_stream, buf, buf.Length); // send the buffered data to the encoder
m.Write(buf, 0, buf.Length); // append the stream
BassEnc.BASS_Encode_Stop(_stream); // close the encoder
and lo: I have a memorystream for later consumption.
I am afraid this was too easy, since the the loop to fill my memorystream never is entered.
Now I suspect it is 'just' setting the right switches, but for the life of me I cannot figure out which to use.
Does anyone have suggestion?