Author Topic: Streaming Question  (Read 3353 times)

Laughy

  • Posts: 2
Streaming Question
« on: 31 Jul '03 - 11:36 »
Hey, I have two questions about streaming using BASS.

I noticed that when one writes to the buffer in your callback, it takes a while for the actual data written to become audible. In the frequency example that comes with BASS, for instance, it takes almost one full second when moving the slider around before you hear the change you made.

This is true also when one sets the bufferlength to a lower number (I set it to 0.01).

In addition, BASS also seems to poll the callback every 100ms. Is there anyway to change how fast it polls, and thus how much data it requests (for 50ms poll it would require half the data) ?

I ask this because I'm writing the audio section for a game emulator, and the emulator will write out approximately 44.1 bytes a millisecond (since it is a 44100 khz wave) over time, and the delay for when the data is written and actually hearing the data written should rather small.

My second question is your opinion on the best way to buffer this data. Since the emulator can sometimes write 40 bytes in one millisecond, and maybe 50 in the next, I know I need to buffer the written values first before sending to BASS, but I haven't come up good scheme for doing so.

What I was thinking was setting up BASS so that it would write around 1000 bytes or so whenever it polls, and my emu would be always a couple hundred bytes ahead of that.

Thanks guys, and if you have any suggestions, I would greatly appreciate them.

-Jordan

Ian @ un4seen

  • Administrator
  • Posts: 20845
Re: Streaming Question
« Reply #1 on: 31 Jul '03 - 12:11 »
Quote
In addition, BASS also seems to poll the callback every 100ms. Is there anyway to change how fast it polls, and thus how much data it requests (for 50ms poll it would require half the data) ?

You can specify the update period in the BASS_Init call (HIWORD of the "flags" parameter).

You can see an example of using a small update period and buffer length in the SYNTH.C example.

Laughy

  • Posts: 2
Re: Streaming Question
« Reply #2 on: 31 Jul '03 - 23:14 »
Thanks! However why does the output still delay so much using delphi? Is it due to a delphi problem? The delay seems almost one full second between changing frequencies, which rather a long time, even with a small buffer and update time

Ian @ un4seen

  • Administrator
  • Posts: 20845
Re: Streaming Question
« Reply #3 on: 1 Aug '03 - 13:46 »
I don't think the fact you're using Delphi would cause any greater delay. Does the precompiled SYNTH example (in the C directory) have a large delay? If not, compare what it does with what you're doing - particularly the BASS_Init and BASS_SetBufferLength calls :)