Page 1 of 1

Hey chili, Sound API question

Posted: July 28th, 2020, 10:26 am
by albinopapa
Hey, had a question about your XAudio implementation. How easy would it be to add functionality for panning and fading? Playing short sounds or looping is fine, but what if I want to fade a sound before stopping it or fade out one sound and fade in another like a transition? The panning would be more to simulate positional audio PlayLeft( value ) or PlayRight( value ) or even Play( left_percent, 1.f - left_precent ) something like that.

From what I can tell, the implementation just pushes back sound channels and when you stop a sound, it only stops the last added sound unless you Sound::StopAll. Would I need to search the vector of channels to find a sound to see if it's already started playing? That way I wouldn't be restarting the same sound each frame or should the sounds be part of an event that gets removed from a list once executed?

Re: Hey chili, Sound API question

Posted: July 30th, 2020, 7:15 am
by chili
It's been a few years since I designed that... I believe the basic idea is that specific instantiations of a sound on channels are not individually trackable at the point of interface with the library. I don't see why you can't add that stuff if you want to. Maybe play returns a smart handle object that can be used to manipulate specific instances of a sound.