Request Instructions for Using Audiere Within T2D
by practicing01 · in Torque 2D Professional · 05/12/2013 (3:17 am) · 8 replies
I've successfully compiled T2D with Audiere and was able to Play an ogg file. However, I don't know how to use the source so I called the Audiere functions from within WinMain() (line 1647 of winWindow.cc) and hardcoded the sound file path to C:/sound.ogg. Where is the real main loop located? How do I specify a file path that starts from the executables directory? Could someone post code of an Audiere function made accessable through torquescript, please? If binding all Audiere functions to torquescript is the same process then I could do them all based on that one example. Thanks. Edit: Link to fork: https://github.com/practicing01/Torque2D/tree/development
#2
05/15/2013 (7:57 am)
Thanks! I was able to copy/paste/mod a console function and got it working. I'll play around with it to try and figure out how to deal with handles and such.
#3
http://pastebin.com/qCWfRhjg
06/24/2013 (8:43 am)
I've gotten a bit deeper into the rabbit hole and made a custom script object. Playing a sound still works but stopping it crashes. Can anyone help please? I'm thinking it has to do with pointers to classes and such (I don't know c++ well). The stopping function starts at line 75.http://pastebin.com/qCWfRhjg
#4
06/24/2013 (1:53 pm)
Double check your types. Probably want to step through that with a debugger and check to see what exactly you have there because it's tough to tell.
#5
06/26/2013 (7:59 am)
Woot hoot! Got it to play/stop an ogg just fine now. However, every time I make it play there's a lag spike. There's a toy if anyone wants to check it out.
#6
06/26/2013 (11:17 am)
Excellent! Now just have to see if it's the resource system or the sound library causing the latency. Have you watched it using the performance monitor to see where the activity is? You should be able to tell whether or not it's the disk access itself using just that tool.
#7
06/27/2013 (6:40 am)
All done! It was OpenSound() (reads ogg file from disk). I made that into a seperate function.
#8
06/27/2013 (7:10 pm)
Great! Does Audiere have support for stream sources? That could be another approach instead of reading the whole file. Or an alternate approach - maybe a StreamSound() that locates and starts streaming the audio....
Torque Owner Richard Ranft
Roostertail Games