Hey chili, Sound API question

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Hey chili, Sound API question

Post by albinopapa » July 28th, 2020, 10:26 am

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?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Hey chili, Sound API question

Post by chili » July 30th, 2020, 7:15 am

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.
Chili

Post Reply