One way to do this would be to simply list each file as a string constant. But it is disappointing to add new content, and if you ever want to add new sounds, you will have to recompile and redistribute the entire application.
Instead, consider listing your audio files in a single data file (XML, maybe?). Inside your program, import the data as a string key, a dictionary with string values, where your keys are the name of the sound, and the values โโare the names of the files. Create a wrapper class to hold the dictionary so you can handle errors gracefully, and voilร ! You have access to your sounds, and you can add and remove sounds outside of the code itself.
In addition, when you make your call in the database, all you have to do is add additional audio data to the dictionary.
source share