- procedure PlayWAV (file_name:string; loops: integer);
- var wave: PMix_Chunk; audio_rate, audio_channels, audio_buffers: Integer; audio_format:word;
- begin
- audio_rate := MIX_DEFAULT_FREQUENCY;
- audio_format := MIX_DEFAULT_FORMAT;
- audio_channels := MIX_DEFAULT_CHANNELS;
- audio_buffers := 4096;
- if Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0 then SDL_ERROR;
- wave := Mix_LoadWAV(PAnsiChar(file_name));
- if wave = nil then SDL_ERROR;
- Mix_PlayChannel(0, wave, loops);
- if Mix_Playing(0) < 0 then SDL_ERROR;
- end;