ok I don’t have much time, but here we go, I hope it’s detailed enough.
In your MonoGame project you have the Content Pipeline tool.
You have probably used it before, but if you didn’t in your VS in the solution explorer you will find a folder called “Content” and in there the pipeline. Called content.mgcb.
Open the tool and in there you have to add an existing item. You can do that by right clicking on “Content” and selecting “Add -> Existing item” or on the corresponding icon above.
Select your .ogg file.
That’s it.
Now in your game code go to the class where you want to manage the music (or asset loading).
Make a new field for the SoundEffect
private SoundEffect mySoundEffect;
Now we need to initialize the sound effect.
Ideally we want to do this only once when the game is loaded.
In the main game file (yourprojectname.cs) you see a function which is called LoadContent.
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// TODO: use this.Content to load your game content here
}
This one is called at the start and you can call other functions from here.
In your soundmanager class you would ideally create another LoadContent function and somehow call if from the function mentioned above.
In there we add
`mySoundEffect = content.Load(“soundEffect”);
Note: If you created a folder in your content pipeline tool it would be “folder/soundEffect”. You don’t need to add the file ending here - don’t use “soundEffect.ogg”.
Ok great, so now we have loaded the SoundEffect into the game.
To play it we simply call
_mySoundEffect.Play();