minor tweaks to old code

This commit is contained in:
Adam D. Ruppe 2022-04-05 16:32:54 -04:00
parent a2d1e5df2d
commit d4ac2707c6
2 changed files with 14 additions and 11 deletions

View file

@ -4,8 +4,6 @@ module arsd.audio;
import sdl.SDL;
import sdl.SDL_mixer;
import std.string;
import arsd.engine;
bool audioIsLoaded; // potential hack material
@ -15,7 +13,7 @@ class Sound {
this(char[] filename){
if(!audioIsLoaded)
return;
sfx = Mix_LoadWAV(std.string.toStringz(filename));
sfx = Mix_LoadWAV((filename ~ "\0").ptr);
if(sfx is null)
throw new Exception(immutableString("Sound load " ~ filename));
}
@ -45,7 +43,7 @@ class Music {
this(char[] filename){
if(!audioIsLoaded)
return;
mus = Mix_LoadMUS(std.string.toStringz(filename));
mus = Mix_LoadMUS((filename~"\0").ptr);
if(mus is null)
throw new Exception(immutableString("Music load " ~ filename));
}