c++ - Design choice for sound effects -


I'm trying to decide how I want to implement sound effects in my program. There is a debate.

1) Create an intuitive interface soundproofing and get every sound effect from it. Each sound effect is its own orbit. On creation, it opens the sound file and plays, and closes the file on destruction. The main drawback I see this approach is that I have many small things that will increase the number of files a lot. I could put many sound effects in a single header (which is related), but I'm not sure.

2) Since the sound of any sound effect says the same thing, this file opens with only the difference, I can generate a single sound effect, its creator is a calculator in which the sound effect names I class will use a switch to play the appropriate sound.

Obviously I am arguing over a "traditional" approach from an OP approach, and I am thinking that what is the best design option here. I am leaning towards the OOP approach, but I'm not sure how to structure the file. If you have any other recommendations, then I am happy to hear them.

If I believe that you are encoding sound effect for all possible sounds Are you

It seems wrong, you create different subclasses for different behavior, not for individual data.
If you have some sound effects types that require preprocessing, sub-squares of data mean- If the project is large, then you may want to separate the different effect codes and effect parameters, so that you can apply To change the effect without rebuilding (for example coding and sound design separately).

To run different sound files, only the class constructor should take the path or the resource ID for the sound file - there is no switch here

If you are using sound files many times, which are used frequently, the pool-based approach will be useful to avoid reloading files every time. An idiom for this is a flyweight pattern (see, for an implementation).


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -