mirror of https://github.com/PrimeDecomp/prime.git
Cleaner sndGetPitch
This commit is contained in:
parent
a42f503dbf
commit
82e0878653
|
@ -919,10 +919,10 @@ LIBS = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lib": "musyx",
|
"lib": "musyx",
|
||||||
#"mw_version": "1.2.5",
|
"mw_version": "1.2.5",
|
||||||
#"cflags": "-proc gecko -fp hard -nodefaults -nosyspath -i include -i libc -g -sym on -D_DEBUG=1 -enum int ",
|
"cflags": "-proc gecko -fp hard -nodefaults -nosyspath -i include -i libc -g -sym on -D_DEBUG=1 -enum int ",
|
||||||
"mw_version": "1.3.2",
|
#"mw_version": "1.3.2",
|
||||||
"cflags": "$cflags_musyx",
|
#"cflags": "$cflags_musyx",
|
||||||
"host": False,
|
"host": False,
|
||||||
"objects": [
|
"objects": [
|
||||||
"musyx/runtime/seq",
|
"musyx/runtime/seq",
|
||||||
|
@ -956,6 +956,7 @@ LIBS = [
|
||||||
["musyx/runtime/StdReverb/reverb", False],
|
["musyx/runtime/StdReverb/reverb", False],
|
||||||
["musyx/runtime/Delay/delay_fx", True],
|
["musyx/runtime/Delay/delay_fx", True],
|
||||||
["musyx/runtime/Chorus/chorus_fx", True],
|
["musyx/runtime/Chorus/chorus_fx", True],
|
||||||
|
["musyx/runtime/profile", True],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -271,6 +271,7 @@ unsigned long sndPopGroup() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u32 seqPlaySong(u16 sgid, u16 sid, void* arrfile, SND_PLAYPARA* para, u8 irq_call, u8 studio) {
|
u32 seqPlaySong(u16 sgid, u16 sid, void* arrfile, SND_PLAYPARA* para, u8 irq_call, u8 studio) {
|
||||||
|
|
|
@ -52,19 +52,22 @@ float tonedown_tab[128] = {
|
||||||
|
|
||||||
s32 sndPitchUpOne(u16 note) { return note * 1.0594631f; }
|
s32 sndPitchUpOne(u16 note) { return note * 1.0594631f; }
|
||||||
|
|
||||||
u32 sndGetPitch(u8 arg0, u32 arg1) {
|
u32 sndGetPitch(u8 key, u32 sInfo) {
|
||||||
f32 pitch;
|
u8 okey; // r31
|
||||||
double tmp;
|
float frq; // r63
|
||||||
u32 temp_r6;
|
if (sInfo == 0xffffffff) {
|
||||||
|
sInfo = 0x40005622;
|
||||||
|
}
|
||||||
|
|
||||||
if (arg1 == 0xFFFFFFFF) {
|
okey = sInfo >> 24;
|
||||||
arg1 = 0x40005622;
|
|
||||||
|
if (key != okey) {
|
||||||
|
frq = (float)(sInfo & 0xFFFFFF) *
|
||||||
|
(okey < key ? toneup_tab[key - okey] : tonedown_tab[okey - key]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
frq = sInfo & 0xFFFFFF;
|
||||||
}
|
}
|
||||||
pitch = 4096.f;
|
|
||||||
temp_r6 = (arg1 >> 24);
|
return (4096.f * frq) / synthInfo.mixFrq;
|
||||||
pitch *= (f32)(arg0 != temp_r6
|
|
||||||
? (f32)((arg1 & 0xFFFFFF) * (temp_r6 < arg0 ? toneup_tab[(arg0 - temp_r6)]
|
|
||||||
: tonedown_tab[temp_r6 - arg0]))
|
|
||||||
: (f32)(arg1 & 0xFFFFFF));
|
|
||||||
return pitch / synthInfo.mixFrq;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue