The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Mix_OpenAudio makes crash Windows Kernel
DjPoke


Joined: 05 Feb 2011
Posts: 4
Location: france
Hello peoples Very Happy

I've a problem with Mix_OpenAudio in SDL 2.0, that makes crash Windows kernel.

If i compile with GCC, no problems.
If i compile with GDB, the game i'm developping crashes.

I'm under Codeblocks 16.0.1.
I've tried both MinGW that comes with it, and TGM_GCC, it's the same thing.

This is my source code.
I've tried to enable, disable command lines, it's really Mix_OpenAudio that makes GDB crashes.

Code:

// load support for the OGG sample/music formats
    int flags = MIX_INIT_OGG;
    int initted = Mix_Init(flags);
    if((initted & flags) != flags) {
        printf("Mix_Init: Impossible d'initialiser le support ogg !\n");
        printf("Mix_Init: %s\n", Mix_GetError());
        return 1;
    }
 
    // TODO: rĂ©soudre le bug qui empĂȘche GDB de fonctionner (ici !!!)
    if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 2048) < 0) {
        fprintf(stdout,"Impossible d'ouvrir Mix_OpenAudio: %s", SDL_GetError());
        return 1;
    }
 
    // Allouer 16 canneaux de mixage
    Mix_AllocateChannels(16);


And the error :
Quote:

In RaiseException () (C:\WINDOWS\System32\KernelBase.dll
GameCodingNinja


Joined: 29 Aug 2014
Posts: 32
Are you calling Mix_OpenAudio "after" you've called SDL_Init? Does your SDL_Init include SDL_INIT_AUDIO | SDL_INIT_EVENTS? What are you passing to the SDL_Init?

Are you compiling the SDL Mixer or are you using the DLL's?

I have not encountered any problem using the mixer and I compiling for Windows, Linux and Android. For Windows I use all the provided SDL DLL's. Life is simpler that way.

The sound settings I use are...
frequency="44100" sound_channels="2" mix_channels="8" chunksize="1024"

Just an FYI. A lower chunk size and a higher frequency provides lower sound latency. I've noticed this mostly in Windows.

Do you really need "16" mix channels? I'd try 8 to see if that is related to your problem.
DjPoke


Joined: 05 Feb 2011
Posts: 4
Location: france
I've tried what you said, but nothing changes.

I'm under Windows 10 (x64), using Codeblocks, so i must compile with Mingw32 and i have the 32 bits dll's in my project directory.
I've added the include & lib directories from the i686 directory, and when i compile in normal mode, it works perfectly.

Only GDB dislike my program.

I've seen this bug on google, but nobody seems to know where it comes from.
GameCodingNinja


Joined: 29 Aug 2014
Posts: 32
What is GDB?
DjPoke


Joined: 05 Feb 2011
Posts: 4
Location: france
GDB is the GNU Debugger.

You can compile with GCC for a normal compilation, or GDB to debug your game.
Mix_OpenAudio makes crash Windows Kernel
Mason Wheeler
Guest

The worst excuse for an interactive debugger ever to be foisted upon a population of developers that somehow ended up taking it seriously.
From: GameCodingNinja;
To: ;
Subject: Re: [SDL] Mix_OpenAudio makes crash Windows Kernel
Sent: Sat, Oct 29, 2016 11:31:16 PM


What is GDB?
GameCodingNinja


Joined: 29 Aug 2014
Posts: 32
Oh, that GDB. I'm bad with acronyms.

When I build and run in Linux, I use Netbeans as the IDE and it uses GDB. Everything works fine.

For Windows, why not just use the free community version of Visual Studio? It has all the features you'll ever need. That's what I do. Chances are there's a problem with the debugger since it was ported to Windows.

The debugger in Visual Studio is really great!
DjPoke


Joined: 05 Feb 2011
Posts: 4
Location: france
Sure, but i need my project to be compiled both on Windows & Linux.
Russell


Joined: 29 Oct 2016
Posts: 2
Hello

You'll need to add SDL_SetHint(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, "1"); BEFORE calling any SDL initialization functions, including Mix_Init(...) (even SDL_INIT(SDL_INIT_TIMER); will trigger it)

I believe this is because SDL calls RaiseException when the GNU debugger is attached under windows, it appears versions of GDB greater than 7.11 (?) will trigger on this exception, maybe because it doesn't support exceptions that can continue?

Check https://bugzilla.libsdl.org/show_bug.cgi?id=2089 for more info