From 70b29f846076a0eea22c5a1227cdb08706004221 Mon Sep 17 00:00:00 2001 From: angel Date: Thu, 23 Jun 2005 15:31:33 +0000 Subject: [PATCH] Minor cleanings to ss_song_render(). git-svn-id: file:///home/angel/tmp/svn-triptico/ahxm/trunk@709 c87de0a0-a11c-0410-a1e5-866214bc28b2 --- ss_song.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/ss_song.c b/ss_song.c index e92ba55..e0775c2 100644 --- a/ss_song.c +++ b/ss_song.c @@ -442,6 +442,8 @@ int ss_song_render(int skip_secs) struct ss_ins * i; double tempo=120.0; int skip_frames; + struct ss_wave * w; + double freq; /* convert the song to ss events */ n_tracks=ss_song_convert_events(); @@ -506,24 +508,31 @@ int ss_song_render(int skip_secs) case SONG_EV_SS_WAV: - { - struct ss_wave * w; - - w=ss_load_wav_file(e->ss_wav.file, - ss_note_frequency(e->ss_wav.base), - ss_note_frequency(e->ss_wav.min), - ss_note_frequency(e->ss_wav.max), - e->ss_wav.loop_start, - e->ss_wav.loop_end); + w=ss_load_wav_file(e->ss_wav.file, + ss_note_frequency(e->ss_wav.base), + ss_note_frequency(e->ss_wav.min), + ss_note_frequency(e->ss_wav.max), + e->ss_wav.loop_start, e->ss_wav.loop_end); - ss_ins_add_layer(i, w); + /* fail if can't open wav */ + if(w == NULL) + { + printf("Can't load wav '%s'\n", e->ss_wav.file); + go=0; } + else + ss_ins_add_layer(i, w); break; case SONG_EV_SS_PAT: - ss_load_pat_file(i, e->ss_pat.file); + if(ss_load_pat_file(i, e->ss_pat.file) < 0) + { + printf("Can't load pat '%s'\n", e->ss_pat.file); + go=0; + } + break; case SONG_EV_SS_EFF_DELAY: @@ -597,10 +606,6 @@ int ss_song_render(int skip_secs) case SONG_EV_SS_PITCH_STRETCH: - { - struct ss_wave * w; - double freq; - /* find the wave */ freq=ss_note_frequency(e->ss_pitch_stretch.note); w=ss_ins_find_layer(i, freq, NULL); @@ -612,16 +617,11 @@ int ss_song_render(int skip_secs) /* play the note */ ss_ins_play(i, freq, e->ss_pitch_stretch.vol, e->ss_pitch_stretch.note_id, w); - } break; case SONG_EV_SS_PRINT_WAVE_TEMPO: - { - struct ss_wave * w; - double freq; - /* find the wave */ freq=ss_note_frequency(e->ss_print_wave_tempo.note); w=ss_ins_find_layer(i, freq, NULL); @@ -631,7 +631,6 @@ int ss_song_render(int skip_secs) ss_tempo_from_wave(w, e->ss_print_wave_tempo.note, e->ss_print_wave_tempo.len)); - } break; -- 2.11.4.GIT