claudio canepa wrote:
Problem: pygame.mixer.music crash while changing song pygame versions with problems:1.7.1 : got from pygame site maybe two years ago, the binary dependencies at same time , the binaries readme tells it is SDL - 1.2.7 , with SDL_mixer - 1.2.3, built with MSVC 6. Lots of pygame games run with no problems.1.8.1.rc3 : test 1 both with the telus build and the 'automated build', tests 2 and 3 only tested against telus buildOther info:winXP + sp2, python 2.4.3, integrated audio nvidia nforce2, audio drivers version 5.10.2917.0Tested on more than a single machine, but same hardware. Problem - bugdemos history:1. I am one of the magicor (http://magicor.sourceforge.net <http://magicor.sourceforge.net/>) developers, working in windows; with pygame 1.7.1 no real problems with the game, but trying the pygame 1.8.1.rc3 crashes begin. I tracked the problem to the moment pygame.mixer.music is instructed to change the current song. The crash is a GPF, not even a 'pygame parachute', and the OS tell the fault is at sdl_mixer.dll , vs 1.2.8.0 <http://1.2.8.0> ( provided with the windows installer for pygame 1.8.1.rc3 ) The specific fail moment is when in the levelselect menu the user gives an 'esc', wich normally will change to the main menu. I tryied with both the telus build and the 'automated build', same problem. 1.8.1.rc3 installed after unistall 1.7.1 and deleting the remaining site-packages\pygame dir2. Then I wrote mtest2.py (atached) to demo the problem in short code; it responds to keypresess changing or restarting the song played. ( to try it you must get two songs from the magicor repo, data\music\menu.xm and data\levels\egypt\egyptian-trance.xm ) All right, at first seemed to worked as expected: no fail in 1.7.1, fail in 1.8.1.rc3. With more runs, they start to appear crashes in 1.7.1, albeit mostly 'pygame parachute's. Failures not so consistent. Maybe sensitive to the timming of keypresses, sometimes closing a console and starting other seems to help to get failures. Restarting ( keypress 'r' ) seems more prone to crash than toggle song ( keypress 't' ) in pygame 1.7.1, the other way with 1.8.1.rc3 the song 'egyptian-trance.xm' seems to crash more than menu.xm ( in repeat mode ) Two or tree toggles in 1.8.1.rc3 usually suffice to crash, 1.7.1 seems les prone to crash.
[snip other confirming test: trunner2.py/mtest4.py] Pygame 1.8.1 release for Pythons 2.4 and 2.5 on Windows:Okay, I can confirm that mtest2.py consistently crashes for me on the third toggle. Also the attached music.py test program crashes on the third iteration of the for loop. There is no crash for ogg-vorbis and midi (using timidity) files. Neither does music.c, the C version of music.py, crash. So I will compare the C test program with Pygame.mixer for differences. It can still be an SDL_mixer/mikmod bug though.
-- Lenard Lindstrom <len-l@xxxxxxxxx>
Attachment:
music.py
Description: application/python
#include <stdio.h> #include "SDL.h" #include "SDL_mixer.h" static Mix_Music* current_music = NULL; static int music_playing = 0; static void music_finished() { music_playing = 0; } static void play_music (char *path) { int volume; if (current_music) { Mix_FreeMusic (current_music); } Mix_HookMusicFinished (music_finished); current_music = Mix_LoadMUS (path); volume = Mix_VolumeMusic (-1); Mix_FadeInMusicPos (current_music, -1, 0, 0); Mix_VolumeMusic (volume); music_playing = 1; printf("Playing %s\n", path); } int main (int argc, char *argv[]) { char* files[] = {"menu.xm", "egyptian-trance.xm"}; int next_track = 0; int niters = 25; int i; if (SDL_Init (SDL_INIT_AUDIO) < 0) { printf ("*** Failed to initialize SDL audio.\n"); return 1; } if (Mix_OpenAudio (44100, AUDIO_S16SYS, 2, 4096) < 0) { printf("*** Failed to open Mixer audio.\n"); SDL_Quit (); return 2; } Mix_VolumeMusic (127); for (i = 0; i < niters; ++i) { next_track = (next_track + 1) % 2; play_music (files[next_track]); SDL_Delay (4000); } SDL_Delay (20000); Mix_FreeMusic (current_music); Mix_CloseAudio (); SDL_Quit (); return 0; }