some beats

This commit is contained in:
Frank Villaro-Dixon 2015-01-01 12:05:40 +01:00
parent 461b4f94dd
commit 561aedd930
3 changed files with 22 additions and 2 deletions

View file

@ -1,5 +1,5 @@
all:
clang *.c `sdl-config --cflags --libs` -lm -Wall -Wextra -o jeu
clang *.c `sdl-config --cflags --libs` -lSDL_mixer -lm -Wall -Wextra -o jeu
clean:
rm jeu

13
beat_detector.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
mplayer mus.mp3 > /dev/null &
START=$(date +%s.%N)
> mus.beats
while true; do
read n
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
echo $DIFF >> mus.beats
done

9
sdl.c
View file

@ -7,17 +7,24 @@
#include <stdio.h>
#include <stdlib.h>
#include "SDL/SDL.h"
#include "SDL_mixer.h"
#include "game.h"
void
init_SDL(struct s_game *g)
{
/* initialize SDL */
SDL_Init(SDL_INIT_VIDEO);
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
/* set the title bar */
SDL_WM_SetCaption("SDL Move", "SDL Move");
/* create window */
g->screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
Mix_OpenAudio(22050,AUDIO_S16SYS,2,640);
Mix_Music *mus;
mus = Mix_LoadMUS("./mus.mp3");
Mix_PlayMusic(mus,1);
}