Hi!
ich habe es jetzt hinbekommen:
Delphi-Quellcode:
program project1;
{$mode delphi}{$H+}
uses
cthreads,
Classes,sdl,sdl_mixer;
var
audio_rate:integer;
audio_format:UInt16;
audio_channels:integer;
audio_buffers:integer;
sound:PMix_Chunk;
screen:PSDL_Surface;
channel:integer;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
begin
if (SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO) <>0) then
begin
writeln('[ERROR] Can''t init SDL: '+SDL_GetError());
exit;
end;
audio_rate:=22050;
audio_format:=AUDIO_S16SYS;
audio_channels:=2;
audio_buffers:=4096;
if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)<>0) then
begin
writeln('[ERROR] Can''t init SDL_Mixer: '+Mix_GetError());
exit;
end;
sound:=Mix_LoadWAV('/home/peter/LazProjekte/TsdlG/data/music/game-musik.wav');
if (sound=nil) then
begin
writeln('[ERROR] Can''t load Wav: '+Mix_GetError());
exit;
end;
screen:=SDL_SetVideoMode(320,240,0,SDL_ANYFORMAT);
if (screen=nil) then
begin
writeln('[ERROR] Can''t set video mode: '+SDL_GetError());
exit;
end;
channel:=Mix_PlayChannel(-1, sound, 0);
if (channel=-1) then
begin
writeln('[ERROR] Can''t play Wav file: '+Mix_GetError());
exit;
end;
while(Mix_Playing(channel) <> 0) do ;
Mix_FreeChunk(sound);
Mix_CloseAudio();
SDL_Quit();
end.
Mein Fehler was das mir smpeg fehlte -_-
Danach ging es auch mit sdl_mixer