LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: vrm on October 12, 2003, 20:58:05

Title: playing mono wav files on different channels (left/right)
Post by: vrm on October 12, 2003, 20:58:05
Hi there,

I try to play a mono wav file on the left channel and a second one on the right channel with OpenAL, any ideas ?

vrm  :D
Title: playing mono wav files on different channels (left/right)
Post by: princec on October 12, 2003, 22:53:03
Simply position it to the left or right as appropriate...

Cas :)
Title: playing mono wav files on different channels (left/right)
Post by: vrm on October 13, 2003, 08:25:01
what kind of position is equal to full volume on left and no volume on right ?
Title: playing mono wav files on different channels (left/right)
Post by: princec on October 13, 2003, 12:07:31
Hm, I see what you mean. I'm not sure that sound simulation actually allows that - you're always going to hear something in your other ear (OpenAL really treats your speakers like ears rather than speakers).

Why not just turn off distance attenuation on that source and move it a long way off to the left?

Cas :)
Title: Re: playing mono wav files on different channels (left/right
Post by: durandal on October 13, 2003, 20:40:16
Quote from: "vrm"Hi there,

I try to play a mono wav file on the left channel and a second one on the right channel with OpenAL, any ideas ?

vrm  :D

The SoundAPI for JOSRTS has some concept if "left and right", and even though the balance is not 100% faded in one direction it has a very noticeable direction


       switch(pp.getDirection()) {
           case PlaybackProperties.CENTER:
               x = 0.0f;
               break;
           case PlaybackProperties.LEFT:
               x = -1.0f * balanceDistanceFactor;
               break;
           case PlaybackProperties.RIGHT:
               x = 1.0f * balanceDistanceFactor;
               break;
           default:
               x = 0.0f;
       }
       
       c.setProperty(AL.POSITION, x, 0.0f, 0.0f);


(balanceDistanceFactor is a constant set to 1.0f)

And setProperty comes down to this:


     
   public void setProperty(int type, float v1, float v2, float v3) {
       
       source.getContext().source3f(getName(), type, v1, v2, v3);

   }


I'm rather tired so I guess I'm not very structured but I hope it helps.

Kalle :)