X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=c%2Fsampler%2Fc%2Fsdl-sampler_backup.c;fp=c%2Fsampler%2Fc%2Fsdl-sampler_backup.c;h=0000000000000000000000000000000000000000;hb=51baeaf524489d11b6455a97b2d26b8309b79607;hp=5bb0240ca6330c458260780e39bbc52262154d25;hpb=2e9749f0922e4c0337845b1d2de733d1ceab3195;p=mirrors%2FPrograms.git diff --git a/c/sampler/c/sdl-sampler_backup.c b/c/sampler/c/sdl-sampler_backup.c deleted file mode 100644 index 5bb0240..0000000 --- a/c/sampler/c/sdl-sampler_backup.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include "SDL.h" -#include "SDL_mixer.h" //Docs: http://www.libsdl.org/projects/SDL_mixer/docs/ -//example http://www.kekkai.org/roger/sdl/mixer/ - -static struct termios stored_settings; -void tc_reset() { tcsetattr(0,TCSANOW,&stored_settings); } -void icanon_off() { - struct termios new_settings; - tcgetattr(0,&stored_settings); - new_settings = stored_settings; - new_settings.c_lflag &= (~ICANON); - new_settings.c_lflag &= (~ECHO); - new_settings.c_cc[VTIME] = 0; - new_settings.c_cc[VMIN] = 1; - tcsetattr(0,TCSANOW,&new_settings); - atexit(tc_reset); -} - -char gethit() { - icanon_off(); - char c = getchar(); - tc_reset(); - return c; -} - -Mix_Music *play_sound = NULL; -Mix_Chunk *play_sound2 = NULL; -Mix_Chunk *play_sound3 = NULL; - -void cleanUp() { - Mix_FreeMusic(play_sound); - Mix_FreeChunk(play_sound2); - Mix_CloseAudio(); - SDL_Quit(); -} - -char map[] = "hgjfkdlsa" "nbmvcxz" "yturieowpq"; - -int main(int argc, char* args[]) -{ - SDL_Init(SDL_INIT_AUDIO); atexit(cleanUp); - //Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096); - Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 256); - - //play_sound = Mix_LoadMUS("/home/harvie/Downloads/Shared/Shaggy-Mr._Bombastic.mp3"); - play_sound2 = Mix_LoadWAV("bd.wav"); - play_sound3 = Mix_LoadWAV("s.wav"); - - //Mix_PlayMusic(play_sound, 0); //(Mix_Music, loops) -1 = infinite loop, 0 = play 1time - //Mix_PlayChannel(-1, play_sound2, 9); //(channel, sample, loop) - - //while(Mix_PlayingMusic() || Mix_Playing(-1)) sleep(1); - - puts("Press Q to exit!"); - char c; - //for(c=0;c<20;c++) Mix_PlayChannel(1, play_sound2, 0); - icanon_off(); - while(c = getchar()) { - switch(c) { - case 'Q': exit(0); break; - case 'a': case 'A': Mix_PlayChannel(-1, play_sound3, 0); break; - default: Mix_PlayChannel(-1, play_sound2, 0); - } - } - - exit(0); -} -