[openbeosmediakit] Re: About BSoundPlayer

  • From: "Marcus Overhagen" <ml@xxxxxxxxxxxx>
  • To: openbeosmediakit@xxxxxxxxxxxxx
  • Date: Sat, 27 Sep 2003 00:35:42 GMT

> Hi,
> >> How must I fill the buffer for doing what I want?
> > The data above looks ok.
> > Can you post a small sample program source code that shows the problem?
> >
> source are here http://jerome.leveque.free.fr/SoftSynth.zip
> the soft create an SynthConsumer derived from BMidiLocalConsumer (Midi2) 
> connect to it with PatchBay a producer and play.
> The function that fill buffer are SynthConsumer::AddNoteToBuffer
I don't know what else is wrong, but you shouldn't use B_MEDIA_BIG_ENDIAN
as format. B_MEDIA_HOST_ENDIAN is better in your case.
Also try to memset the buffer to 0 before adding data into it,

I don't completely understand what you are doing, but i only
get silence here when running it, with R5 and open media kit. 

I was hoping for some simple example software that demonstrates
the problem, not for the full thing.

You can try to use this code to demonstrate the problem:

int16 *buf = (int16 *)buffer;
int count = size / 4;

for (int i = 0; i < count; i++) {
        *buf++ = (i & 0xf) << 12;
        *buf++ = 0;

This should generate some noise on one channel, and silence on the other.
by swapping the *buf++ lines, you should be able to change the channel.

It that works, BSoundPlayer is working correct

Other related posts: