How to add music in the code
It all lies in the FrmLvl Load
Where to put the music
songNames = new string[]
{
"JaredLeto_wav",
"BeQuietAndDrive_wav",
"ArmsWideOpen_wav",
"_3_Doors_Down_wav",
"HowYouRemindMe_wav",
"MySacrifice_wav",
"OneLatBreath_wav"
};
rm = new ResourceManager("Fall2020_CSC403_Project.Properties.Resources", Assembly.GetExecutingAssembly());
// Initialize NAudio objects
waveOut = new WaveOutEvent();
LoadSong();
In the FrmLevel_Load method you will see the playlist we have. This is where you can add new music, but you must be sure to use the exact name you gave the song which you can find in the properties of the song under Resources->Audio. Once that is in the music is almost set. Another big thing to remember is to set the Resource Manager to the correct location of the songs. As you can see we put all our songs in Resources and we have to put the location, i.e "[Namespace of Resources.resx].[Properties].[Resources]". Then the code Loads the songs and you're set.
To learn more about types of sounds you can play i.e mp3,mp4,wav,etc and how to incorporate them into your project checkout the NAudio library for documentation https://github.com/naudio/NAudio/blob/master/README.md
To learn more on adding songs to the resources checkout
How to add music to ResourcesLast updated