Hi,
I'm trying to record a radio streaming but my code only record for 5 seconds...
Following is my code:
class Program
{
private static FileStream _fs = null;
private static DOWNLOADPROC _myDownloadProc;
private static byte[] _data; // local data buffer
static void Main(string[] args)
{
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
_myDownloadProc = new DOWNLOADPROC(MyDownload);
int stream = Bass.BASS_StreamCreateURL("
http://m2.fabricahost.com.br:8704/;stream.mp3", 0,
BASSFlag.BASS_SAMPLE_MONO, _myDownloadProc, IntPtr.Zero);
Bass.BASS_ChannelPlay(stream, false);
}
private static void MyDownload(IntPtr buffer, int length, IntPtr user)
{
if (_fs == null)
{
// create the file
_fs = File.OpenWrite("output.mp3");
}
if (buffer == IntPtr.Zero)
{
// finished downloading
_fs.Flush();
_fs.Close();
}
else
{
// increase the data buffer as needed
if (_data == null || _data.Length < length)
_data = new byte[length];
// copy from managed to unmanaged memory
Marshal.Copy(buffer, _data, 0, length);
// write to file
_fs.Write(_data, 0, length);
}
}
}
I need to record at least 3h, how can i do that?
Thanks