some useless comments and litte audio bug
This commit is contained in:
parent
c37d289fdf
commit
953377d4ec
2 changed files with 3 additions and 8 deletions
11
src/music.c
11
src/music.c
|
@ -34,7 +34,7 @@ music_load_beats(struct s_game *g, int music) { // {{{
|
|||
|
||||
free(beats_file);
|
||||
|
||||
while(fgets(buffer, sizeof(buffer), f) && i < MAX_MUSICS_NUM) {
|
||||
while(fgets(buffer, sizeof(buffer), f)) {
|
||||
//ugly, but it's a one time
|
||||
beats = realloc(beats, (i+1) * sizeof(*beats));
|
||||
beats[i] = (long)atof(strtrim(buffer));
|
||||
|
@ -42,6 +42,8 @@ music_load_beats(struct s_game *g, int music) { // {{{
|
|||
}
|
||||
|
||||
g->audio.beats[music] = beats;
|
||||
g->audio.num_beats[music] = i;
|
||||
|
||||
|
||||
fclose(f);
|
||||
} //}}}
|
||||
|
@ -109,8 +111,6 @@ int
|
|||
did_have_beat(struct s_game *g) {
|
||||
int music = g->audio.currently_playing;
|
||||
|
||||
printf(">> %d\n", g->audio.currently_playing);
|
||||
|
||||
if(music == -1)
|
||||
return 0;
|
||||
|
||||
|
@ -121,12 +121,7 @@ did_have_beat(struct s_game *g) {
|
|||
(actual_time.tv_nsec - g->start_time.tv_nsec) / 1e9;
|
||||
|
||||
|
||||
printf(">> %d, done: %d\n", g->audio.num_beats[music], g->audio.beat_already_done);
|
||||
|
||||
// printf("Secs passed: %lf, actual: %lf\n", secs_passed, mus_beats[already_done]);
|
||||
|
||||
if(g->audio.num_beats[music] > g->audio.beat_already_done) {
|
||||
puts("Hallo");
|
||||
if(g->audio.beats[music][g->audio.beat_already_done] < secs_passed) {
|
||||
g->audio.beat_already_done++;
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue