Sdl mixer mod playing

Robert Clayton schrieb am 21 Jun 2000:

When I play a .it mod, the sound starts of jerkily. I assume this is a
buffer problem. If I increase audio_buffers though, either my program
crashes on exit or nothing improves as the sound plays.
What’s wrong? I thought playing mods was very low at the processor level of
things.

  • Make sure you call Mix_HaltMusic and Mix_CloseAudio before you shut down
  • Reduce the sample rate to 22050 Hz. That is enough for most applications

Mixing is something processor intensive.

  • Andreas–
    Check out my 3D lightcycle game: http://www.gltron.org
    More than 60’000 Downloads of the latest version (0.59)

When I play a .it mod, the sound starts of jerkily. I assume this is a
buffer problem. If I increase audio_buffers though, either my program
crashes on exit or nothing improves as the sound plays.
What’s wrong? I thought playing mods was very low at the processor level of
things.

All error checking is removed from this code, and the cleanUp function on
exiting isn’t included since I’d assume it doesn’t matter.

int audio_rate;
Uint16 audio_format;
int audio_channels;
int audio_buffers;
int looping;
int interactive;

SDL_Init(SDL_INIT_AUDIO)

atexit(cleanUp);
signal(SIGINT, exit);
signal(SIGTERM, exit);

// Setup the sound device
/* Initialize variables */
audio_rate = 44100;
audio_format = AUDIO_S16;
audio_channels = 2;
audio_buffers = 4096;

Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)
audio_open = 1;

char filename[] = “test_file.it”;

music = Mix_LoadMUS(filename);

Mix_PlayMusic(music,0);

/* do game loop stuff */________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com