I’m experimenting with the secretive undocumented openAL libraries .
At its simplest implementation I’d like to try and get sound effects corresponding to where a user taps on the screen.
Although I have some understanding of the various APIs, I’m a little baffled by the corresponding values; i.e these commands:
al.Source( mySource, al.ROLLOFF_FACTOR, 1.0 )
al.Source( mySource, al.REFERENCE_DISTANCE, 240.0 )
al.Source( mySource, al.POSITION, y, x, z)
What impact does 1.0, 240, x,y,z have ? Are the x,y,z values corresponding to screen co-ordinates? My guessing is that they relate to the listener (default 0,0,0?), but using somebody else’s code I’m generating x,y and z with the following code:
local x = event.x - display.viewableContentWidth \* 0.5
local y = event.y - display.viewableContentHeight \* 0.5
local z = 0
Which creates values int eh range of -240 to 240 and -160 to 160?!?!
No matter what I tinker with I can’t quite create the effect I’m looking for, essentially a smashed plate on the far right of the screen should only really be heard on the right earphone and vice-versa - that’s just not happening for me.
I should note that I’ve ensured all tracks are mono and my game is played in a landscape orientation, which may be screwing around with the positioning.
Any clarification on these values, or general assistance would be extremely appreciated. [import]uid: 33275 topic_id: 24042 reply_id: 324042[/import]