Hey Ian!
Sort of....
It will be playing the stream in real time but we want to draw ahead of where it's playing and instead draw from the amount looked ahead and downloaded already via the DownloadProc
Is sent him your response and this is his.
Looks like his is still stuck
======FROM MY CODER======
Hi
I have a problem with WF drawing of cloud audio file
When create a stream with BASS_StreamCreateUrl() function, WF data taken from the stream is not correct sometimes.
So I am going to draw with the current downloaded buffer through some steps in DOWNLOADProc function to advance the performance of WF drawing
I have to extract audio data part from current downloaded buffer and draw WF with the audio data.
so I tried to create a stream with current downloaded buffer and get channel data from the stream.
My code is as follows.
private FileStream _fs = null;
int downStream = 0;
public void MyDownloadProc(IntPtr buffer, int length, IntPtr user)
{
if(_fs == null)
{
_fs = File.OpenWrite(cloudTempFullPath);
downStream = Bass.BASS_StreamCreate(sr, channels, BASSFlag.BASS_SAMPLE_FLOAT|BASSFlag.BASS_STREAM_DECODE, null, IntPtr.Zero);
if (buffer == IntPtr.Zero)
{
...
}
else
{
byte[] data = new byte[length];
Marshal.Copy(buffer, data, 0, length);
_fs.Write(data, 0, length); // write to file
float[] floatArray = new float[data.Length / 4]; // Assuming each float is 4 bytes
for (int i = 0; i < data.Length; i += 4)
{
floatArray[i / 4] = BitConverter.ToSingle(data, i);
}
Bass.BASS_StreamPutData(downStream, floatArray, floatArray.Length);
GenerateWaveFormWithStream(downStream);
}
}
public void GenerateWaveformWithStream(downStrream)
{
streamLength = (long)Bass.BASS_ChannelGetLength(downStream);
... // some codes for drawing
if(downStream !=0)
{
Bass.BASS_StreamFree(downStream);
downStream = 0;
}
}
but the streamLength =-1 here.
could you let me know what the resolution is? is it possible to do like this?
Thanks.