|
|
| version 1.1, 2003/10/16 17:58:05 | version 1.7, 2004/02/18 18:29:29 |
|---|---|
| Line 2 | Line 2 |
| #include <math.h> | #include <math.h> |
| #include "wavefile.h" | #include "wavefile.h" |
| #include "dosio.h" | #include "dosio.h" |
| #include "pccore.h" | |
| #include "sound.h" | #include "sound.h" |
| #include "rhythm.h" | #include "rhythm.h" |
| Line 22 static const char *rhythmfile[RHYTHM_MAX | Line 23 static const char *rhythmfile[RHYTHM_MAX |
| static BOOL pcmload(RHYTHMPCM *pcm, const char *fname, UINT rate) { | static BOOL pcmload(RHYTHMPCM *pcm, const char *fname, UINT rate) { |
| char path[MAX_PATH]; | |
| FILEH fh; | FILEH fh; |
| RIFF_HEADER riff; | RIFF_HEADER riff; |
| BOOL head; | BOOL head; |
| Line 35 static BOOL pcmload(RHYTHMPCM *pcm, cons | Line 37 static BOOL pcmload(RHYTHMPCM *pcm, cons |
| UINT pos; | UINT pos; |
| BYTE work[256]; | BYTE work[256]; |
| fh = file_open_c(fname); | getbiospath(path, fname, sizeof(path)); |
| fh = file_open_rb(path); | |
| if (fh == FILEH_INVALID) { | if (fh == FILEH_INVALID) { |
| goto pld_err1; | goto pld_err1; |
| } | } |
| Line 79 static BOOL pcmload(RHYTHMPCM *pcm, cons | Line 82 static BOOL pcmload(RHYTHMPCM *pcm, cons |
| goto pld_err2; | goto pld_err2; |
| } | } |
| step = 44100 / rate; | step = 44100 / rate; |
| if (step == 0) { | |
| goto pld_err2; | |
| } | |
| samples = size / 2 / step; | samples = size / 2 / step; |
| if (samples == 0) { | if (samples == 0) { |
| goto pld_err2; | goto pld_err2; |
| Line 166 void rhythm_update(RHYTHM rhy) { | Line 172 void rhythm_update(RHYTHM rhy) { |
| } while(++r < rterm); | } while(++r < rterm); |
| } | } |
| void rhythm_setreg(RHYTHM rhy, BYTE reg, BYTE value) { | void rhythm_setreg(RHYTHM rhy, REG8 reg, REG8 value) { |
| RHYTHMCH *r; | RHYTHMCH *r; |
| BYTE bit; | REG8 bit; |
| int i; | int i; |
| if (reg == 0x10) { | if (reg == 0x10) { |
| Line 191 void rhythm_setreg(RHYTHM rhy, BYTE reg, | Line 197 void rhythm_setreg(RHYTHM rhy, BYTE reg, |
| r++; | r++; |
| } | } |
| } | } |
| else if (reg == 0x11) { // ver0.28 | else if (reg == 0x11) { |
| sound_sync(); | sound_sync(); |
| rhy->vol = (~value) & 0x3f; | rhy->vol = (~value) & 0x3f; |
| rhythm_update(rhy); | rhythm_update(rhy); |