Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (602)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  OpenAL position data type  (Read 1855 times)
0 Members and 1 Guest are viewing this topic.
Offline aNt

Senior Devvie




AFK


« Posted 2003-04-24 11:15:20 »

hello all...

i is just playing around with the OpenAL cool stuff. I have got it playing audio and stuff. Just wondering how i set the position of the sound?

i take it the call should take 3 floats but i cant see a call that will let me do that. can anyone help me out?

rock and roll....
Offline princec

« JGO Spiffy Duke »


Medals: 434
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2003-04-24 14:15:02 »

al.source3f(source, property, x, y, z);

where property is AL.POSITION

Cas Smiley

Offline aNt

Senior Devvie




AFK


« Reply #2 - Posted 2003-04-24 19:51:27 »

yep i got it working Smiley.

just wondered how i send stuff to:

al.sourcefv(int, int, int);

shouldnt it be:

al.sourcefv(int, int, float[]);

? if not how to i send an array of floats to 'sourcefv' ?

top tops anyways. - just wondered.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #3 - Posted 2003-04-24 20:29:37 »

Quote

shouldnt it be:
al.sourcefv(int, int, float[]);


Not if you want LWJGL to be FAST!

We use ByteBuffers to transfer between Java and the Native side. Pack you floats into a ByteBuffer, and pass the position of those floats long.

Check
http://java-game-lib.sourceforge.net/documents/openal_c-to-java.html
for more info

Offline cfmdobbie

Senior Devvie


Medals: 1


Who, me?


« Reply #4 - Posted 2003-04-24 20:30:43 »

That last parameter would be the address of a FloatBuffer.  Do something like:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
// Do this bit once - it's computationally expensive
FloatBuffer fb = ByteBuffer.allocateDirect(3 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer() ;
int address = Sys.getDirectBufferAddress(fb) ;

// Fill the buffer whenever
fb.rewind() ;
fb.put(1.0f).put(0.5f).put(0.3f) ;

// Call the method with the address of the buffer
al.sourcefv(source, property, address) ;


Hellomynameis Charlie Dobbie.
Offline aNt

Senior Devvie




AFK


« Reply #5 - Posted 2003-04-25 07:15:50 »

what the numbers in:

allocateDirect(3 * 4) ?

faster is it? ok but i update the positions every time so i guess there wont be much of a speed leep.

will do anyways looks cooler Smiley
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #6 - Posted 2003-04-25 08:26:21 »

Quote
allocateDirect(3 * 4) ?


allocateDirect needs to be told how many bytes it should allocate = 3 floats of each 4 bytes.

Offline aNt

Senior Devvie




AFK


« Reply #7 - Posted 2003-04-25 08:45:40 »

cool Smiley i was looking at the wrong docs. part of java.nio - i just started playing with at. cool - it seems very fast at io.. well i guess thats what everyone is on about Smiley
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (51 views)
2014-12-03 16:27:13

CopyableCougar4 (49 views)
2014-11-29 21:32:03

toopeicgaming1999 (115 views)
2014-11-26 15:22:04

toopeicgaming1999 (103 views)
2014-11-26 15:20:36

toopeicgaming1999 (31 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!