BindBC / bindbc-sdl

Static & dynamic D bindings to SDL and the SDL_* libraries, compatible with BetterC, @nogc, and nothrow.
Boost Software License 1.0
88 stars 23 forks source link

Wav Sound files not load #18

Closed joelcnz closed 5 years ago

joelcnz commented 5 years ago

Using Mix_LoadWAV, files are found, but won't load!?

[Edit]

I've tried different versions. I have it initialized.

mdparker commented 5 years ago

This is not an SDL support forum, but a bug tracker for reporting issues with BindBC. Before reporting anything here, you should first determine as best you can if it is a program error, a problem with the binding, or a problem with the library so that you can go to the correct place for help.

"won't load" isn't enough information to help anyone help you. When you get an error return code from most SDL functions, you can use SDL_GetError to fetch an error string describing the problem. It returns a pointer to a static string, so you can get a D string from it with std.string.fromStringz (as long as you don't want to store it anywhere, it which case you'll want to use std.conv.to to make a copy).

import std.string : fromStringz;
throw new Exception("Error trying to load wav file: " ~ SDL_GetError().fromStringz);

I would assume that this has nothing to do with the binding, though it's not impossible that there's a function signature mismatch causing wonky behavior.

joelcnz commented 5 years ago

Oh, thanks, the error message thing helped. I've never used 'fromStringz' before.