Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (686)
Games in Android Showcase (197)
games submitted by our members
Games in WIP (758)
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 2353 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: 792
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.

 
roseslayer (385 views)
2016-08-06 11:43:29

roseslayer (354 views)
2016-08-06 09:43:11

xTheGamerCodes (429 views)
2016-08-04 15:40:59

xTheGamerCodes (421 views)
2016-08-04 15:40:24

orrenravid (773 views)
2016-07-16 03:57:23

theagentd (848 views)
2016-07-11 14:28:54

Hydroque (939 views)
2016-07-06 05:56:57

Hydroque (978 views)
2016-07-03 08:52:54

GrandCastle (790 views)
2016-07-01 09:13:47

GrandCastle (634 views)
2016-07-01 09:09:45
Rendering resources
by Roquen
2016-08-08 05:55:21

Rendering resources
by Roquen
2016-08-08 05:52:42

Rendering resources
by Roquen
2016-08-08 05:50:38

Rendering resources
by Roquen
2016-08-08 05:49:53

Rendering resources
by Roquen
2016-08-08 05:32:39

Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42
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!