Okay thanks, I managed to write the data into the byte array.
I have three more questions:
(1) How do I playback the recording during recording with this setup?
(2) Is there a way to playback the byte array after recording without prior saving it to the hard drive?
(3) How do I record source or mixer channels in order to write the data to a byte array? So far I only got recording directly to hard drive?
Thanks in advance :-) looking forward to your answer.
Edit:
I tried to write the sample data into a file after recording and ran into this problem:
I get an mp3 file in the length that I recorded, but it doesnt contain what I recorded. Instead I get silence alternately with noise (take a look at the attachment, its a zipped mp3 file, hope thats okay).
Whats wrong with this?:
Dim DummyStream As Integer = Bass.BASS_StreamCreateDummy(44100, 2, Nothing, IntPtr.Zero) ' // create a dummy stream
Dim Encoder = BassEnc_Mp3.BASS_Encode_MP3_StartFile(DummyStream, Nothing, AddOn.Enc.BASSEncode.BASS_ENCODE_AUTOFREE Or AddOn.Enc.BASSEncode.BASS_ENCODE_QUEUE, OutputFolder & FileName & ".mp3") ' // start an MP3 encoder On it
Dim TrackLengthInBytes As Long = (EndPos - StartPos - 1)
Dim Track(CInt(TrackLengthInBytes)) As Byte
Array.Copy(RecordedDataComplete.ToArray, StartPos, Track, 0, TrackLengthInBytes)
Un4seen.Bass.AddOn.Enc.BassEnc.BASS_Encode_Write(Encoder, Track, Track.Length) '// send sample data To the encoder
Un4seen.Bass.AddOn.Enc.BassEnc.BASS_Encode_Stop(Encoder) '; // Stop the encoder
Also, when I call BASS_Encode_Stop right after, I will only get an mp3 file with 2 kiloBytes.