[SDL] SDL application crash when using Mix_CloseAudio
Jacek Dylak
dylak at gazeta.pl
Thu Nov 16 07:02:59 PST 2006
Writing this e-mail made once again thinking about this problem. And,
unfortunately, after sending it I have found problem in my code. Sorry for
bothering you.
Best regards,
Jacek
Jacek Dylak napisał(a):
> Hi all,
>
> I'm using the SDL to produce some visual and audio stimulation in our
> experiments. For audio I am using SDL_Mixer. And I've got quite strange
> problem with it. When using the Mix_CloseAudio in my code to cleanup at the
> end of the SDL related part, the application crash when returning from the run
> method which actually perform the experiment. But when the Mix_CloseAudio is
> commented out the application works smoothly without any problems.
>
> I can't let it be as it because the SDL part is executed on the top of the
> normal setup window - the idea is to allow the user to run experiment several
> times without exiting the application. And without Mix_CloseAudio, when the
> experiment is executed for the second time there is no audio at all.
>
> The experiment executing method is provided below with all SDL related code.
> The SDL_Mixer has been added to the working correctly code, so I am quite sure
> that the problem is somehow related to the SDL_Mixer.
>
> Does anyone has any idea of how to solve it or maybe has similar problems?
>
> Best regards
> Jacek
>
> void run()
> {
> ::SetEnvironmentVariableA( "SDL_VIDEODRIVER" , "directx" );
> SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO|SDL_INIT_AUDIO);
> const SDL_VideoInfo* vi = SDL_GetVideoInfo();
> SDL_Surface* pScreen = SDL_SetVideoMode( pm.in_nScreenWidthPix ,
> pm.in_nScreenHeightPix , vi->vfmt->BitsPerPixel , SDL_FULLSCREEN |
> SDL_HWSURFACE | SDL_DOUBLEBUF );
> TTF_Init();
>
> Mix_OpenAudio( MIX_DEFAULT_FREQUENCY , MIX_DEFAULT_FORMAT , 2 , 512 );
> Mix_AllocateChannels( 16 );
>
> //running experiment here - the code here does not call any
> //SDL_Mixer related methods
>
> Mix_CloseAudio(); //commenting this line prevents app from crashing
> TTF_Quit();
> SDL_Quit();
>
> //actually the application crash occurs here, when returning from this method
> }
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>
>
>
More information about the SDL
mailing list