Reputation: 3796
I put the music(mp3) file in the music folder and created a Song song;
object in the game class.
Then I did song = Content.Load<Song>("music file name here")
in the ContentLoad
method and did MediaPlayer.Play(song)
.
But it gives me an error saying:
Could not load music asset
I tried making the "Copy to Output Directory" to "Copy always". But this also didn't solve the problem.
I heared about monogame not having a content pipe line, but I don't understand what it is. Can anyone explain what I should do to make my music file playable?
Upvotes: 0
Views: 813
Reputation: 3185
You can find a tutorial (written by me) explaining exactly how to use sounds in Monogame here.
But basically, all you need to do is:
The image has a spritefont selected, but the same applies to sound effects.
Then you can use it as you would in a typical XNA game.
As of today, I have not been able to find another way to load them without needing XNA. Same goes for sprite fonts. You need to generate the xnb files by using the Content project provided by XNA.
Remember that you can install XNA on VS 2012+ and Windows 8 without a problem thanks to XNA Refresh.
One more thing to add, the last time I used Monogame (September, 2014); there was a bug in the templates downloaded from the Monogame site that would not allow for any sound effect (song, effect, instance, etc) to be played; and this would happen with no errors being thrown. The solution at that time was to download the Monogame templates by using Nuget.
Upvotes: 1