Jump to content
  • Advertisement
Sign in to follow this  
Slaru

Simple audio interface

This topic is 5410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am planning a simple audio interface, and came up with this plan. I will have a singleton class call IAudioManager that will keep a list of all sounds and music. When I want to play the sound or music, I call a function that references the sound or music, and get a pointer to an ISound or IMusic interface. ISound is for sound effects, or sounds with a position for 3d positional audio. IMusic is for music, such as a soundtrack in the background. Does this sound good? Or is there some much better way to approach this?

Share this post


Link to post
Share on other sites
Advertisement
Sounds like a plan. But don't forget to include length in the list of class-members, or you'll have a fun time with guess and check in your project.

Or not, I really don't know, I just pretend to be smart.

Share this post


Link to post
Share on other sites
I was thinking of how i will implement this, and decided to put these in a DLL. For the header file, I declare IAudioManager as an abstract base class. I provide a function to return a pointer to a derived implementation of IAudioManager. I declare ISound and IMusic as abstract base classes too, and give IAudioManager the member functions to return a pointer to a derived implementation of ISound and IMusic. In the DLL, i then derive from the three interfaces and create the implementation. This works right?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!