5 #include "SDL_mixer.h" //Docs: http://www.libsdl.org/projects/SDL_mixer/docs/
6 //example http://www.kekkai.org/roger/sdl/mixer/
8 static struct termios stored_settings
;
9 void tc_reset() { tcsetattr(0,TCSANOW
,&stored_settings
); }
11 struct termios new_settings
;
12 tcgetattr(0,&stored_settings
);
13 new_settings
= stored_settings
;
14 new_settings
.c_lflag
&= (~ICANON
);
15 new_settings
.c_lflag
&= (~ECHO
);
16 new_settings
.c_cc
[VTIME
] = 0;
17 new_settings
.c_cc
[VMIN
] = 1;
18 tcsetattr(0,TCSANOW
,&new_settings
);
29 Mix_Music
*play_sound
= NULL
;
30 Mix_Chunk
*play_sound2
= NULL
;
31 Mix_Chunk
*play_sound3
= NULL
;
34 Mix_FreeMusic(play_sound
);
35 Mix_FreeChunk(play_sound2
);
40 char map
[] = "hgjfkdlsa" "nbmvcxz" "yturieowpq";
42 int main(int argc
, char* args
[])
44 SDL_Init(SDL_INIT_AUDIO
); atexit(cleanUp
);
45 //Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096);
46 Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT
, 2, 256);
48 //play_sound = Mix_LoadMUS("/home/harvie/Downloads/Shared/Shaggy-Mr._Bombastic.mp3");
49 play_sound2
= Mix_LoadWAV("bd.wav");
50 play_sound3
= Mix_LoadWAV("s.wav");
52 //Mix_PlayMusic(play_sound, 0); //(Mix_Music, loops) -1 = infinite loop, 0 = play 1time
53 //Mix_PlayChannel(-1, play_sound2, 9); //(channel, sample, loop)
55 //while(Mix_PlayingMusic() || Mix_Playing(-1)) sleep(1);
57 puts("Press Q to exit!");
59 //for(c=0;c<20;c++) Mix_PlayChannel(1, play_sound2, 0);
61 while(c
= getchar()) {
63 case 'Q': exit(0); break;
64 case 'a': case 'A': Mix_PlayChannel(-1, play_sound3
, 0); break;
65 default: Mix_PlayChannel(-1, play_sound2
, 0);
This page took 1.121584 seconds and 5 git commands to generate.