Game Development Community

Playing a wav from the middle

by Ian Omroth Hardingham · in Technical Issues · 08/18/2004 (1:20 am) · 8 replies

Hi everyone.

Does anyone know how to play a wav/ogg from a certain point (ie, not the beggining) in TGE/openAL?

Thanks,
Ian

#1
08/19/2004 (1:32 pm)
I dont know how, but why would you want to?
#2
08/19/2004 (4:00 pm)
I dont really think this is possible at all !
But i agree with Robert Why do you want that ?
Can you not only cut out the parts you want to play ?
And make a new wave file or ogg for all parts.
#3
08/19/2004 (4:54 pm)
I don't know how, but I can think of many uses. I also can think of a few games who do use it.
#4
08/19/2004 (6:20 pm)
*waits to hear some reasons* Not being a smart ass, I truely want to know
#5
08/20/2004 (2:30 am)
Hey guys.

The reason is this: I'm doing proper dynamic music. When things happen on screen, different channels need to activated/deactivated in the right places. I'm not just playing different tracks based on the situation, the actual track is changing.

But I'm in trouble if I can't do this...

Ian
#6
08/20/2004 (3:19 am)
I understand what you are after.
In the base engine code i havent seen a function for this.
but if you are a skilled coder then everything is possible !
#7
08/20/2004 (2:27 pm)
You could split the songs into tiny chunks. When one chunk ends, either play the next chunk in the song or move to a different song and play a chunk from it.

I'm not sure if you could time it right, but it's an idea.
#8
08/20/2004 (2:45 pm)
My AudioFilter code is able to do something along these lines :
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5557

Though notably, the method i used to seek time in the music suffered from a short second delay due to a sizeable portion of the audio being already buffered by openal - since it needs to continue playing the existing sound before it plays any more.

Other solutions for mood based music include having 2 or more music files (sound buffered from a specific offset in the file), making a class in torque that fades between playing them.
...Or of course, you could abruptly stop the music in script and play another bit.