-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include "libspu_i.h" | ||
|
||
extern s32 _spu_keystat; | ||
#define NUM_SPU_CHANNELS 24 | ||
|
||
long SpuRGetAllKeysStatus(long min, long max, char* status) { | ||
s32 last_voice; | ||
s32 var_a1; | ||
s32 voice; | ||
s32 var_v0; | ||
s8* var_a2; | ||
u16 volume; | ||
if (min < 0) { | ||
min = 0; | ||
} | ||
if (min < NUM_SPU_CHANNELS) { | ||
if (max >= NUM_SPU_CHANNELS) { | ||
max = NUM_SPU_CHANNELS - 1; | ||
} | ||
} else { | ||
return -3; | ||
} | ||
if ((max < 0) || (max < min)) { | ||
return -3; | ||
} | ||
voice = min; | ||
last_voice = max + 1; | ||
|
||
for (voice = min; voice < last_voice; voice++) { | ||
volume = _spu_RXX->raw[(8 * voice) + 6]; | ||
if ((1 << voice) & _spu_keystat) { | ||
if (volume != 0) { | ||
status[voice] = 1; | ||
} else { | ||
status[voice] = 3; | ||
} | ||
} else if (volume != 0) { | ||
status[voice] = 2; | ||
} else { | ||
status[voice] = 0; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
void SpuGetAllKeysStatus(char* status) { | ||
s32 voice; | ||
u16* new_var; | ||
u16 volumex; | ||
s32 max; | ||
max = NUM_SPU_CHANNELS; | ||
for (voice = 0; voice < max; voice++) { | ||
new_var = &_spu_RXX->rxx.voice[voice].volumex; | ||
volumex = *new_var; | ||
if ((1 << voice) & _spu_keystat) { | ||
if (volumex != 0) { | ||
status[voice] = 1; | ||
} else { | ||
status[voice] = 3; | ||
} | ||
} else if (volumex != 0) { | ||
status[voice] = 2; | ||
} else { | ||
status[voice] = 0; | ||
} | ||
} | ||
} |