|
|
| version 1.8, 2004/02/18 20:11:37 | version 1.11, 2005/05/13 05:47:25 |
|---|---|
| Line 5 | Line 5 |
| #include "rhythm.h" | #include "rhythm.h" |
| static const char file_2608bd[] = "2608_bd.wav"; | static const OEMCHAR file_2608bd[] = OEMTEXT("2608_bd.wav"); |
| static const char file_2608sd[] = "2608_sd.wav"; | static const OEMCHAR file_2608sd[] = OEMTEXT("2608_sd.wav"); |
| static const char file_2608top[] = "2608_top.wav"; | static const OEMCHAR file_2608top[] = OEMTEXT("2608_top.wav"); |
| static const char file_2608hh[] = "2608_hh.wav"; | static const OEMCHAR file_2608hh[] = OEMTEXT("2608_hh.wav"); |
| static const char file_2608tom[] = "2608_tom.wav"; | static const OEMCHAR file_2608tom[] = OEMTEXT("2608_tom.wav"); |
| static const char file_2608rim[] = "2608_rim.wav"; | static const OEMCHAR file_2608rim[] = OEMTEXT("2608_rim.wav"); |
| static const char *rhythmfile[6] = { | static const OEMCHAR *rhythmfile[6] = { |
| file_2608bd, file_2608sd, file_2608top, | file_2608bd, file_2608sd, file_2608top, |
| file_2608hh, file_2608tom, file_2608rim}; | file_2608hh, file_2608tom, file_2608rim}; |
| typedef struct { | typedef struct { |
| UINT rate; | |
| UINT pcmexist; | |
| PMIXDAT pcm[6]; | PMIXDAT pcm[6]; |
| UINT vol; | UINT vol; |
| UINT voltbl[96]; | UINT voltbl[96]; |
| Line 28 static RHYTHMCFG rhythmcfg; | Line 30 static RHYTHMCFG rhythmcfg; |
| void rhythm_initialize(UINT rate) { | void rhythm_initialize(UINT rate) { |
| UINT i; | UINT i; |
| char path[MAX_PATH]; | |
| ZeroMemory(&rhythmcfg, sizeof(rhythmcfg)); | ZeroMemory(&rhythmcfg, sizeof(rhythmcfg)); |
| for (i=0; i<6; i++) { | rhythmcfg.rate = rate; |
| getbiospath(path, rhythmfile[i], sizeof(path)); | |
| pcmmix_regfile(rhythmcfg.pcm + i, path, rate); | |
| } | |
| for (i=0; i<96; i++) { | for (i=0; i<96; i++) { |
| rhythmcfg.voltbl[i] = (UINT)(32768.0 * | rhythmcfg.voltbl[i] = (UINT)(32768.0 * |
| pow(2.0, (double)i * (-3.0) / 40.0)); | pow(2.0, (double)i * (-3.0) / 40.0)); |
| Line 55 void rhythm_deinitialize(void) { | Line 54 void rhythm_deinitialize(void) { |
| } | } |
| } | } |
| static void rhythm_load(void) { | |
| int i; | |
| OEMCHAR path[MAX_PATH]; | |
| for (i=0; i<6; i++) { | |
| if (rhythmcfg.pcm[i].sample == NULL) { | |
| getbiospath(path, rhythmfile[i], NELEMENTS(path)); | |
| pcmmix_regfile(rhythmcfg.pcm + i, path, rhythmcfg.rate); | |
| } | |
| } | |
| } | |
| UINT rhythm_getcaps(void) { | UINT rhythm_getcaps(void) { |
| UINT ret; | UINT ret; |
| Line 83 void rhythm_bind(RHYTHM rhy) { | Line 95 void rhythm_bind(RHYTHM rhy) { |
| UINT i; | UINT i; |
| rhythm_load(); | |
| rhy->hdr.enable = 0x3f; | rhy->hdr.enable = 0x3f; |
| for (i=0; i<6; i++) { | for (i=0; i<6; i++) { |
| rhy->trk[i].data = rhythmcfg.pcm[i]; | rhy->trk[i].data = rhythmcfg.pcm[i]; |
| Line 101 void rhythm_update(RHYTHM rhy) { | Line 114 void rhythm_update(RHYTHM rhy) { |
| } | } |
| } | } |
| void rhythm_setreg(RHYTHM rhy, REG8 reg, REG8 value) { | void rhythm_setreg(RHYTHM rhy, UINT reg, REG8 value) { |
| PMIXTRK *trk; | PMIXTRK *trk; |
| REG8 bit; | REG8 bit; |