diff --git a/OpenDiablo2.SDL2/SDL2MusicPlayer.cs b/OpenDiablo2.SDL2/SDL2MusicPlayer.cs
index 20a55fee..ee9d547f 100644
--- a/OpenDiablo2.SDL2/SDL2MusicPlayer.cs
+++ b/OpenDiablo2.SDL2/SDL2MusicPlayer.cs
@@ -25,16 +25,17 @@ namespace OpenDiablo2.SDL2_
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private IntPtr music = IntPtr.Zero;
+ private int musicChannel;
public SDL2MusicPlayer()
{
- if (SDL_mixer.Mix_OpenAudio(22050, SDL_mixer.MIX_DEFAULT_FORMAT, 2, 2048) < 0)
+ if (SDL_mixer.Mix_OpenAudio(22050, SDL_mixer.MIX_DEFAULT_FORMAT, 2, 1024) < 0)
log.Error($"SDL_mixer could not initialize! SDL_mixer Error: {SDL.SDL_GetError()}");
}
public void PlaySong()
{
- SDL_mixer.Mix_PlayChannel(-1, music, 1);
+ musicChannel = SDL_mixer.Mix_PlayChannel(-1, music, 1);
}
public void LoadSong(Stream data)
@@ -51,6 +52,7 @@ namespace OpenDiablo2.SDL2_
{
if (music == IntPtr.Zero)
return;
+ SDL_mixer.Mix_HaltChannel(musicChannel);
SDL_mixer.Mix_FreeChunk(music);
}
@@ -60,21 +62,6 @@ namespace OpenDiablo2.SDL2_
SDL_mixer.Mix_CloseAudio();
}
- /*
-
- musicStream = data;
- SDL.SDL_AudioSpec want = new SDL.SDL_AudioSpec
- {
- freq = 22050,
- format = SDL.AUDIO_S16LSB,
- channels = 2,
- samples = 4096,
- callback = AudioCallback
- };
-
- SDL.SDL_OpenAudio(ref want, out audioSpec);
- SDL.SDL_PauseAudio(0);
- */
}
}
diff --git a/OpenDiablo2.Scenes/MainMenu.cs b/OpenDiablo2.Scenes/MainMenu.cs
index 96ca5de7..c943b575 100644
--- a/OpenDiablo2.Scenes/MainMenu.cs
+++ b/OpenDiablo2.Scenes/MainMenu.cs
@@ -1,4 +1,20 @@
-using System;
+/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+using System;
using System.Drawing;
using System.Linq;
using OpenDiablo2.Common;
@@ -24,6 +40,8 @@ namespace OpenDiablo2.Scenes
IRenderWindow renderWindow,
ISceneManager sceneManager,
IResourceManager resourceManager,
+ IMusicProvider musicProvider,
+ IMPQProvider mpqProvider,
Func createButton,
Func getScene // Temporary until SDL load functions are sped up
)
@@ -71,11 +89,8 @@ namespace OpenDiablo2.Scenes
getScene(scenesToLoad[i]);
}
-
- /*
musicProvider.LoadSong(mpqProvider.GetStream("data\\global\\music\\introedit.wav"));
musicProvider.PlaySong();
- */
}
private void OnVisitWebsiteClicked()