Comments (8)
It's still alive, but not actively maintained since I'm not programming that much in D anymore as I've used to be. I've fixed the conversion bug and fixed the error of the assertion error ;). I suppose the error was caused due to a large stacktrace. It looks like the real error happened here: https://github.com/Dgame/Dgame/blob/master/source/Dgame/Window/Internal/Init.d#L111
It seems that your SDL is missing the required ogg and mp3 support.
from dgame.
They are install. An I still receive error. It looks like a derelict bug.
SDL version: 2.0.8
core.exception.AssertError@/home/drake/.dub/packages/dgame-0.6.6/dgame/source/Dgame/Internal/Error.d(36): Error: Failed to init the required ogg and mp3 support: OGG support not available
My c program runs fine.
#include <stdio.h>
#include "SDL.h"
#include "SDL_mixer.h"
// gcc -o sdl_window sdl_window.c -I/usr/include/SDL2 -lSDL2 -lSDL2_mixer
int main() {
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) != 0) {
SDL_Log("Unable to initialize SDL: %s", SDL_GetError());
return 1;
}
int mixFlags = MIX_INIT_OGG | MIX_INIT_MP3;
int mixInit = Mix_Init(mixFlags);
if(mixInit & mixFlags != mixFlags) {
SDL_Log("Unable to initialize Mixer ogg or mp3: %s", Mix_GetError());
SDL_Quit();
return 1;
}
printf("Everything is good");
SDL_Quit();
return 0;
}
my derelict sdl2 program get same error.
import std.stdio : writeln;
import derelict.sdl2.sdl;
import derelict.sdl2.mixer;
void main() {
DerelictSDL2.load();
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) != 0) {
writeln("Unable to initialize SDL: ", SDL_GetError());
return;
}
DerelictSDL2Mixer.load();
int mixFlags = MIX_INIT_OGG | MIX_INIT_MP3;
int mixInit = Mix_Init(mixFlags);
if ((mixInit & mixFlags) != mixFlags) {
writeln("Unable to initialize Mixer ogg or mp3: ", Mix_GetError());
SDL_Quit();
return;
}
Mix_Quit();
SDL_Quit();
}
from dgame.
Strange. But aldacron is quick in fixing such stuff, just open an issue.
from dgame.
Never mine.
if(mixInit & mixFlags != mixFlags)
forgot () around mixInit & mixFlags
my c program get the same error.
from dgame.
Omg, I got caught in the same trap. Silly me. Well, I could change that requirement since sound support is not your concern as long as you don't use the Sound package. But that would have to wait until next week.
from dgame.
Found the bug. Fix is open audio before Mix_Init.
No more error.
import std.stdio : writeln;
import derelict.sdl2.sdl;
import derelict.sdl2.mixer;
void main() {
DerelictSDL2.load();
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) != 0) {
writeln("Unable to initialize SDL: ", SDL_GetError());
return;
}
DerelictSDL2Mixer.load();
if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024)==-1) {
writeln("Audio Error");
SDL_Quit();
return;
}
int mixFlags = MIX_INIT_OGG | MIX_INIT_MP3;
int mixInit = Mix_Init(mixFlags);
if ((mixInit & mixFlags) != mixFlags) {
if ((mixInit & MIX_INIT_OGG) != MIX_INIT_OGG)
writeln("Unable to find ogg");
if ((mixInit & MIX_INIT_MP3) != MIX_INIT_MP3)
writeln("Unable to find mp3");
writeln(Mix_GetError());
SDL_Quit();
return;
}
Mix_Quit();
SDL_Quit();
}
from dgame.
I change the order of open audio in dgame/window/internal/init.d. My program runs now. Thanks for your time.
// Initialize SDL_mixer
result = Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096);
assert_fmt(result == 0, "Warning: Could not open Mix_OpenAudio: %s\n", Mix_GetError());
result = Mix_Init(MIX_INIT_OGG | MIX_INIT_MP3);
assert_fmt(result != 0, "Error: Failed to init the required ogg and mp3 support: %s\n", Mix_GetError());
if ((result & MIX_INIT_OGG) == 0)
print_fmt("Warning: No ogg support: %s\n", Mix_GetError());
else if ((result & MIX_INIT_MP3) == 0)
print_fmt("Warning: No mp3 support: %s\n", Mix_GetError());
from dgame.
Seems to work with SDL 2.0.3 & 2.0.4 as well, thanks for your work!
from dgame.
Related Issues (20)
- Iterating over SpriteSheet starts at index 1 and ends at index 0 HOT 13
- small issue on page HOT 2
- [Feature Request] A Window.draw overload with an offset HOT 4
- Dgame Does not render on multiple windows HOT 3
- Make Rect a template to allow for floating point HOT 1
- Necessary code doesn't execute when compiling in release mode HOT 3
- Shape color is being changed by unrelated objects HOT 5
- TTF_Init is not being called, formatting Text always errors "Font Invalid" HOT 5
- StopWatch Divide by 0 when trying to fill frame_ms HOT 1
- DerelictGL3 not able to find symbol ( glGetnTexImage ) HOT 3
- Window.wait Timeout is milliseconds, not seconds. HOT 1
- Collision detection HOT 4
- Wrong links in README.md? HOT 1
- Dgame crashing HOT 6
- What about adding more built in colors? Like 400 plus . Color Enhancement idea . HOT 8
- Rect methods questions ? Add new method clamp ? HOT 1
- `object.Error@(0): Access Violation` on `DMD32` HOT 7
- D program quits unexpectedly when using Text HOT 11
- Text colors are wrong HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgame.