0

For my project i'm implementing mp3 soundtracks using WindowsMediaPlayer library, to particular areas of the game. I've successfully implemented one already for the "launchscreen" and navigational menus.

I've copied the exact code and added it to my new "GameScreen" form but haven't had any success with finding the Soundtrack itself. When i put in the other Soundtrack into the other URL property it works perfectly fine which makes me believe it doesn't find it in the directory. What makes me believe this further is when i put the Mercury Soundtrack into the "Launchscreen" form it doesn't work also. I've also tried adding the whole path to the file from file explorer but it doesn't agree with the backslashes and so that is also not viable.

Here is the code that i have working at the moment. Its globally accessible because it's stops in a different form

static public WindowsMediaPlayer Introthemetune = new WindowsMediaPlayer();

public LaunchScreen()
{
    this.Opacity = 0;
    InitializeComponent();
    Introthemetune.URL = "Finalised Game Soundtrack.mp3";
}

private void Gamescreen_Load(object sender, EventArgs e)
{

    Introthemetune.controls.play(); //only plays once need on loop
}

Here's the exact same code but with the different soundtrack and yet it doesn't work.

WindowsMediaPlayer MercuryTheme = new WindowsMediaPlayer(); //instantiating new class containing the mercury themetune

public MercuryGameScreen()
{
    this.Opacity = 0;
    InitializeComponent();
    MercuryTheme.URL = "Mercury Soundtrack.mp3";
}

private void MercuryGameScreen_Load(object sender, EventArgs e)
{
    MercuryTheme.controls.play(); //only plays once need on loop
}

I want it to simply player the soundtrack. Any help is greatly appreciated as this has me severely perplexed.

JoshG
  • 6,472
  • 2
  • 38
  • 61

0 Answers0