Question about Audio in TGB
by Dennis Harrington · in Torque Game Builder · 04/17/2006 (2:48 pm) · 5 replies
One of the game concepts I'm working on is a rhythm game (think Frequency, DDR, Guitar Hero, etc.) but without the funky controller, obviously. ;) I'm thinking it would be most similar to Frequency and Amplitude or maybe even a puzzle hybrid like Lumines.
Anyway, my questions are about audio and OpenAL. Firstly, are there any good resources on using it within TGB? I searched on TDN and just found a couple of basic pages for using it in TGE but I assume it would be the same in TGB, right? Am I being dumb and have I just completely missed some documentation on it or is that all there is?
Secondly, is there any functionality that would allow me to set cue points within a track or at the very least, constantly update the current position within the track?
The problem is that if I want events to be triggered in time with the music or to play secondary samples in time, I'd need to have some way of keeping track of where the "play head" is in the current song. I've visited openal.org and I fear that I'd need to dive into the engine in order to add the functionality I need, unless I'm missing something.
Any input would be greatly appreciated!
Anyway, my questions are about audio and OpenAL. Firstly, are there any good resources on using it within TGB? I searched on TDN and just found a couple of basic pages for using it in TGE but I assume it would be the same in TGB, right? Am I being dumb and have I just completely missed some documentation on it or is that all there is?
Secondly, is there any functionality that would allow me to set cue points within a track or at the very least, constantly update the current position within the track?
The problem is that if I want events to be triggered in time with the music or to play secondary samples in time, I'd need to have some way of keeping track of where the "play head" is in the current song. I've visited openal.org and I fear that I'd need to dive into the engine in order to add the functionality I need, unless I'm missing something.
Any input would be greatly appreciated!
#2
04/17/2006 (3:44 pm)
I think all the OpenAL functions are prefixed with "alx" so you can search for that in TDN or other torquescript references. There is an OpenAL sdk you can download on the web, to get an idea of the internals. No idea whether OpenAL has all the features required for your game though.
#3
04/17/2006 (3:45 pm)
From an old post by Ben Garney Quote:If you're curious, try using dumpFunctions - it should have a section with all the AL/ALX commands.
#4
After looking more at the code for VMPlayer and searching for 'alx', it appears that all or most of the OpenAL function is in fact exposed since the entire player is written in Torquescript. Commands like 'alxSeekToStreamPosition' are the kind of things I'm looking for but I haven't found any documentation on them so I guess I'll just play around and see what works and what doesn't! Hopefully, all of the alx commands will work with TGB and not just TGE.
Here's the link to VMPlayer in case anyone is interested: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9560
04/17/2006 (4:28 pm)
Thanks, Alex. That's good to know. As a matter of fact, I was looking at the OpenAL docs and the functionality is in there, I just wasn't sure if all of the OpenAL functionality was exposed to Torquescript or if I had to go through specific functions.After looking more at the code for VMPlayer and searching for 'alx', it appears that all or most of the OpenAL function is in fact exposed since the entire player is written in Torquescript. Commands like 'alxSeekToStreamPosition' are the kind of things I'm looking for but I haven't found any documentation on them so I guess I'll just play around and see what works and what doesn't! Hopefully, all of the alx commands will work with TGB and not just TGE.
Here's the link to VMPlayer in case anyone is interested: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9560
#5
By default, stream seeking and pausing functionality doesn't exist in the engine (at least not as of the time of that resource, and I couldn't find any official GG word that it was added since), so you would have to take the resource he links to and integrate the change into the TGB source in order to get that functionality exposed to script.
04/17/2006 (4:35 pm)
Note the following in the resource you linked to:Quote:
2) While VMPlayer is written entirely in script it does require a small modification to TGE to fix a bug, as well that you have installed a previous resource I wrote to allow pausing and seeking of audio.
By default, stream seeking and pausing functionality doesn't exist in the engine (at least not as of the time of that resource, and I couldn't find any official GG word that it was added since), so you would have to take the resource he links to and integrate the change into the TGB source in order to get that functionality exposed to script.
Torque Owner Dennis Harrington