6 Mix_Chunk
*sounds
[max_sounds
];
27 int main(int argc
,char *argv
[])
29 if ( SDL_Init(SDL_INIT_AUDIO
) < 0 ) {
30 fprintf(stderr
, "Problem: %s\n", SDL_GetError());
36 //MIX_DEFAULT_FORMAT - Signed 16-bit zvuky, v systemovem bytovem poradi (little,big endian)
37 //mono-stereo: pro mono vlozte 1, pro stereo 2
39 if (Mix_OpenAudio(22050/*frekvence [Hz]*/, MIX_DEFAULT_FORMAT
, 2/*mono-stereo*/,1024/*velikost bloku*/)==-1)
41 fprintf(stderr
,"Mix_OpenAudio: %s\n", Mix_GetError());
45 sounds
[SND_ZVUK
] = Mix_LoadWAV("zvuk.wav");
46 if (sounds
[SND_ZVUK
]==NULL
)
48 fprintf(stderr
,"zvuk [zvuk.wav] nebyl nahran\n");exit(2);}
50 //kanal: -1 pro prvni volny kanal
51 //pocet opakovani x: zvuk se bude opakovat x+1 krat,x=-1 pro stale opakovani.
52 Mix_PlayChannel(-1/*kanal*/,sounds
[SND_ZVUK
]/*Mix_Chunk*/,0/*pocet opakovani*/);
54 music
=Mix_LoadMUS("music.mp3");
56 printf("Mix_LoadMUS(\"music.mp3\"): %s\n", Mix_GetError());
60 //pocet opakovani x: hudba se bude opakovat x krat,x=-1 pro stale opakovani.
61 //postupne zvysuje hlasitost hudby od 0 do 100% za 2000 ms po spusteni
63 Mix_FadeInMusic(music
, -1/*pocet opakovani*/,2000 /*cas[ms]*/);
65 //lze i jen provest pouhe spusteni hudby
66 //Mix_PlayMusic(music, -1/*pocet opakovani*/);
70 //ztlumi hudbu az do ticha a vypne
71 Mix_FadeOutMusic(2000);
This page took 1.392405 seconds and 4 git commands to generate.