mirror of
https://github.com/zeldaret/tp
synced 2026-05-22 22:44:28 -04:00
Implement Z2AudioCS (#3103)
This commit is contained in:
+10
-10
@@ -2317,40 +2317,40 @@ Z2AudioLib/Z2AudioMgr.cpp:
|
||||
.sbss start:0x804FB240 end:0x804FB248
|
||||
.sdata2 start:0x804FFDC8 end:0x804FFDD0
|
||||
|
||||
Z2AudioLib/SpkSpeakerCtrl.cpp:
|
||||
Z2AudioCS/SpkSpeakerCtrl.cpp:
|
||||
.text start:0x802AA208 end:0x802AAB9C
|
||||
.ctors start:0x80396244 end:0x80396248
|
||||
.bss start:0x80482E78 end:0x80482F98
|
||||
.sbss start:0x804FB248 end:0x804FB250
|
||||
|
||||
Z2AudioLib/SpkSystem.cpp:
|
||||
Z2AudioCS/SpkSystem.cpp:
|
||||
.text start:0x802AAB9C end:0x802AAE6C
|
||||
.ctors start:0x80396248 end:0x8039624C
|
||||
.bss start:0x80482F98 end:0x80482FB8
|
||||
.sbss start:0x804FB250 end:0x804FB264
|
||||
.sbss start:0x804FB250 end:0x804FB260
|
||||
|
||||
Z2AudioLib/SpkMixingBuffer.cpp:
|
||||
Z2AudioCS/SpkMixingBuffer.cpp:
|
||||
.text start:0x802AAE6C end:0x802AAFB8
|
||||
.sdata2 start:0x804FFDD0 end:0x804FFDD8
|
||||
|
||||
Z2AudioLib/SpkWave.cpp:
|
||||
Z2AudioCS/SpkWave.cpp:
|
||||
.text start:0x802AAFB8 end:0x802AB0FC
|
||||
|
||||
Z2AudioLib/SpkTable.cpp:
|
||||
Z2AudioCS/SpkTable.cpp:
|
||||
.text start:0x802AB0FC end:0x802AB180
|
||||
|
||||
Z2AudioLib/SpkData.cpp:
|
||||
Z2AudioCS/SpkData.cpp:
|
||||
.text start:0x802AB180 end:0x802AB268
|
||||
|
||||
Z2AudioLib/SpkSound.cpp:
|
||||
Z2AudioCS/SpkSound.cpp:
|
||||
.text start:0x802AB268 end:0x802ABE74
|
||||
.ctors start:0x8039624C end:0x80396250
|
||||
.bss start:0x80482FB8 end:0x80482FC8
|
||||
.sdata2 start:0x804FFDD8 end:0x804FFE00
|
||||
|
||||
Z2AudioLib/Z2AudioCS.cpp:
|
||||
Z2AudioCS/Z2AudioCS.cpp:
|
||||
.text start:0x802ABE74 end:0x802AC134
|
||||
.sbss start:0x804FB264 end:0x804FB268
|
||||
.sbss start:0x804FB260 end:0x804FB268
|
||||
.sdata2 start:0x804FFE00 end:0x804FFE08
|
||||
|
||||
revolution/gf/GFGeometry.cpp:
|
||||
|
||||
@@ -27444,8 +27444,8 @@ mAudioMgrPtr__10Z2AudioMgr = .sbss:0x804FB240; // type:object size:0x4 scope:glo
|
||||
sMixingBuffer = .sbss:0x804FB248; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__29JASGlobalInstance<9SpkSystem> = .sbss:0x804FB250; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__35JASGlobalInstance<14SpkSoundHolder> = .sbss:0x804FB254; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
lbl_804FB258 = .sbss:0x804FB258; // type:object size:0x8 data:byte
|
||||
lbl_804FB260 = .sbss:0x804FB260; // type:object size:0x1 data:byte
|
||||
@GUARD@memPool___29JASPoolAllocObject<8SpkSound> = .sbss:0x804FB258; // type:object size:0x1 scope:local data:byte
|
||||
l_spkVolume = .sbss:0x804FB260; // type:object size:0x1 scope:local data:byte
|
||||
sSpkHandles = .sbss:0x804FB264; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sSystemHeap__7JKRHeap = .sbss:0x804FB268; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sCurrentHeap__7JKRHeap = .sbss:0x804FB26C; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
|
||||
+10
-10
@@ -2308,40 +2308,40 @@ Z2AudioLib/Z2AudioMgr.cpp:
|
||||
.sbss start:0x8053B068 end:0x8053B070
|
||||
.sdata2 start:0x8053FC60 end:0x8053FC68
|
||||
|
||||
Z2AudioLib/SpkSpeakerCtrl.cpp:
|
||||
Z2AudioCS/SpkSpeakerCtrl.cpp:
|
||||
.text start:0x802B0128 end:0x802B0858
|
||||
.ctors start:0x803CE378 end:0x803CE37C
|
||||
.bss start:0x804C22F8 end:0x804C2408
|
||||
.sbss start:0x8053B070 end:0x8053B078
|
||||
|
||||
Z2AudioLib/SpkSystem.cpp:
|
||||
Z2AudioCS/SpkSystem.cpp:
|
||||
.text start:0x802B0858 end:0x802B0AFC
|
||||
.ctors start:0x803CE37C end:0x803CE380
|
||||
.bss start:0x804C2408 end:0x804C2428
|
||||
.sbss start:0x8053B078 end:0x8053B08C
|
||||
.sbss start:0x8053B078 end:0x8053B088
|
||||
|
||||
Z2AudioLib/SpkMixingBuffer.cpp:
|
||||
Z2AudioCS/SpkMixingBuffer.cpp:
|
||||
.text start:0x802B0AFC end:0x802B0C48
|
||||
.sdata2 start:0x8053FC68 end:0x8053FC70
|
||||
|
||||
Z2AudioLib/SpkWave.cpp:
|
||||
Z2AudioCS/SpkWave.cpp:
|
||||
.text start:0x802B0C48 end:0x802B0D8C
|
||||
|
||||
Z2AudioLib/SpkTable.cpp:
|
||||
Z2AudioCS/SpkTable.cpp:
|
||||
.text start:0x802B0D8C end:0x802B0E10
|
||||
|
||||
Z2AudioLib/SpkData.cpp:
|
||||
Z2AudioCS/SpkData.cpp:
|
||||
.text start:0x802B0E10 end:0x802B0EF8
|
||||
|
||||
Z2AudioLib/SpkSound.cpp:
|
||||
Z2AudioCS/SpkSound.cpp:
|
||||
.text start:0x802B0EF8 end:0x802B1B04
|
||||
.ctors start:0x803CE380 end:0x803CE384
|
||||
.bss start:0x804C2428 end:0x804C2438
|
||||
.sdata2 start:0x8053FC70 end:0x8053FC98
|
||||
|
||||
Z2AudioLib/Z2AudioCS.cpp:
|
||||
Z2AudioCS/Z2AudioCS.cpp:
|
||||
.text start:0x802B1B04 end:0x802B1DC4
|
||||
.sbss start:0x8053B08C end:0x8053B090
|
||||
.sbss start:0x8053B088 end:0x8053B090
|
||||
.sdata2 start:0x8053FC98 end:0x8053FCA0
|
||||
|
||||
revolution/gf/GFGeometry.cpp:
|
||||
|
||||
@@ -28596,8 +28596,8 @@ mAudioMgrPtr__10Z2AudioMgr = .sbss:0x8053B068; // type:object size:0x4 scope:glo
|
||||
sMixingBuffer = .sbss:0x8053B070; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__29JASGlobalInstance<9SpkSystem> = .sbss:0x8053B078; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__35JASGlobalInstance<14SpkSoundHolder> = .sbss:0x8053B07C; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
lbl_8053B080 = .sbss:0x8053B080; // type:object size:0x8 data:byte
|
||||
lbl_8053B088 = .sbss:0x8053B088; // type:object size:0x1 data:byte
|
||||
@GUARD@memPool___29JASPoolAllocObject<8SpkSound> = .sbss:0x8053B080; // type:object size:0x1 scope:weak data:byte
|
||||
l_spkVolume = .sbss:0x8053B088; // type:object size:0x1 scope:local data:byte
|
||||
sSpkHandles = .sbss:0x8053B08C; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
spHomeButtonObj__Q210homebutton10HomeButton = .sbss:0x8053B090; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
suIDCounter__Q310homebutton3gui11PaneManager = .sbss:0x8053B098; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
|
||||
+10
-10
@@ -2310,40 +2310,40 @@ Z2AudioLib/Z2AudioMgr.cpp:
|
||||
.sbss start:0x80521088 end:0x80521090
|
||||
.sdata2 start:0x80525CE8 end:0x80525CF0
|
||||
|
||||
Z2AudioLib/SpkSpeakerCtrl.cpp:
|
||||
Z2AudioCS/SpkSpeakerCtrl.cpp:
|
||||
.text start:0x802AFB48 end:0x802B04DC
|
||||
.ctors start:0x803B8DBC end:0x803B8DC0
|
||||
.bss start:0x804A8A18 end:0x804A8B38
|
||||
.sbss start:0x80521090 end:0x80521098
|
||||
|
||||
Z2AudioLib/SpkSystem.cpp:
|
||||
Z2AudioCS/SpkSystem.cpp:
|
||||
.text start:0x802B04DC end:0x802B07AC
|
||||
.ctors start:0x803B8DC0 end:0x803B8DC4
|
||||
.bss start:0x804A8B38 end:0x804A8B58
|
||||
.sbss start:0x80521098 end:0x805210AC
|
||||
.sbss start:0x80521098 end:0x805210A8
|
||||
|
||||
Z2AudioLib/SpkMixingBuffer.cpp:
|
||||
Z2AudioCS/SpkMixingBuffer.cpp:
|
||||
.text start:0x802B07AC end:0x802B08F8
|
||||
.sdata2 start:0x80525CF0 end:0x80525CF8
|
||||
|
||||
Z2AudioLib/SpkWave.cpp:
|
||||
Z2AudioCS/SpkWave.cpp:
|
||||
.text start:0x802B08F8 end:0x802B0A3C
|
||||
|
||||
Z2AudioLib/SpkTable.cpp:
|
||||
Z2AudioCS/SpkTable.cpp:
|
||||
.text start:0x802B0A3C end:0x802B0AC0
|
||||
|
||||
Z2AudioLib/SpkData.cpp:
|
||||
Z2AudioCS/SpkData.cpp:
|
||||
.text start:0x802B0AC0 end:0x802B0BA8
|
||||
|
||||
Z2AudioLib/SpkSound.cpp:
|
||||
Z2AudioCS/SpkSound.cpp:
|
||||
.text start:0x802B0BA8 end:0x802B17B4
|
||||
.ctors start:0x803B8DC4 end:0x803B8DC8
|
||||
.bss start:0x804A8B58 end:0x804A8B68
|
||||
.sdata2 start:0x80525CF8 end:0x80525D20
|
||||
|
||||
Z2AudioLib/Z2AudioCS.cpp:
|
||||
Z2AudioCS/Z2AudioCS.cpp:
|
||||
.text start:0x802B17B4 end:0x802B1A74
|
||||
.sbss start:0x805210AC end:0x805210B0
|
||||
.sbss start:0x805210A8 end:0x805210B0
|
||||
.sdata2 start:0x80525D20 end:0x80525D28
|
||||
|
||||
revolution/gf/GFGeometry.cpp:
|
||||
|
||||
@@ -28124,8 +28124,8 @@ mAudioMgrPtr__10Z2AudioMgr = .sbss:0x80521088; // type:object size:0x4 scope:glo
|
||||
sMixingBuffer = .sbss:0x80521090; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__29JASGlobalInstance<9SpkSystem> = .sbss:0x80521098; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__35JASGlobalInstance<14SpkSoundHolder> = .sbss:0x8052109C; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
lbl_805210A0 = .sbss:0x805210A0; // type:object size:0x8 data:byte
|
||||
lbl_805210A8 = .sbss:0x805210A8; // type:object size:0x1 data:byte
|
||||
@GUARD@memPool___29JASPoolAllocObject<8SpkSound> = .sbss:0x805210A0; // type:object size:0x1 scope:weak data:byte
|
||||
l_spkVolume = .sbss:0x805210A8; // type:object size:0x1 scope:local data:byte
|
||||
sSpkHandles = .sbss:0x805210AC; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
spHomeButtonObj__Q210homebutton10HomeButton = .sbss:0x805210B0; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
suIDCounter__Q310homebutton3gui11PaneManager = .sbss:0x805210B8; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
|
||||
+10
-10
@@ -2310,40 +2310,40 @@ Z2AudioLib/Z2AudioMgr.cpp:
|
||||
.sbss start:0x8051EEF8 end:0x8051EF00
|
||||
.sdata2 start:0x80523B40 end:0x80523B48
|
||||
|
||||
Z2AudioLib/SpkSpeakerCtrl.cpp:
|
||||
Z2AudioCS/SpkSpeakerCtrl.cpp:
|
||||
.text start:0x802B1668 end:0x802B1FFC
|
||||
.ctors start:0x803BA87C end:0x803BA880
|
||||
.bss start:0x804A6898 end:0x804A69B8
|
||||
.sbss start:0x8051EF00 end:0x8051EF08
|
||||
|
||||
Z2AudioLib/SpkSystem.cpp:
|
||||
Z2AudioCS/SpkSystem.cpp:
|
||||
.text start:0x802B1FFC end:0x802B22CC
|
||||
.ctors start:0x803BA880 end:0x803BA884
|
||||
.bss start:0x804A69B8 end:0x804A69D8
|
||||
.sbss start:0x8051EF08 end:0x8051EF1C
|
||||
.sbss start:0x8051EF08 end:0x8051EF18
|
||||
|
||||
Z2AudioLib/SpkMixingBuffer.cpp:
|
||||
Z2AudioCS/SpkMixingBuffer.cpp:
|
||||
.text start:0x802B22CC end:0x802B2418
|
||||
.sdata2 start:0x80523B48 end:0x80523B50
|
||||
|
||||
Z2AudioLib/SpkWave.cpp:
|
||||
Z2AudioCS/SpkWave.cpp:
|
||||
.text start:0x802B2418 end:0x802B255C
|
||||
|
||||
Z2AudioLib/SpkTable.cpp:
|
||||
Z2AudioCS/SpkTable.cpp:
|
||||
.text start:0x802B255C end:0x802B25E0
|
||||
|
||||
Z2AudioLib/SpkData.cpp:
|
||||
Z2AudioCS/SpkData.cpp:
|
||||
.text start:0x802B25E0 end:0x802B26C8
|
||||
|
||||
Z2AudioLib/SpkSound.cpp:
|
||||
Z2AudioCS/SpkSound.cpp:
|
||||
.text start:0x802B26C8 end:0x802B32D4
|
||||
.ctors start:0x803BA884 end:0x803BA888
|
||||
.bss start:0x804A69D8 end:0x804A69E8
|
||||
.sdata2 start:0x80523B50 end:0x80523B78
|
||||
|
||||
Z2AudioLib/Z2AudioCS.cpp:
|
||||
Z2AudioCS/Z2AudioCS.cpp:
|
||||
.text start:0x802B32D4 end:0x802B3594
|
||||
.sbss start:0x8051EF1C end:0x8051EF20
|
||||
.sbss start:0x8051EF18 end:0x8051EF20
|
||||
.sdata2 start:0x80523B78 end:0x80523B80
|
||||
|
||||
revolution/gf/GFGeometry.cpp:
|
||||
|
||||
@@ -28128,8 +28128,8 @@ mAudioMgrPtr__10Z2AudioMgr = .sbss:0x8051EEF8; // type:object size:0x4 scope:glo
|
||||
sMixingBuffer = .sbss:0x8051EF00; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__29JASGlobalInstance<9SpkSystem> = .sbss:0x8051EF08; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__35JASGlobalInstance<14SpkSoundHolder> = .sbss:0x8051EF0C; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
lbl_8051EF10 = .sbss:0x8051EF10; // type:object size:0x8 data:byte
|
||||
lbl_8051EF18 = .sbss:0x8051EF18; // type:object size:0x1 data:byte
|
||||
@GUARD@memPool___29JASPoolAllocObject<8SpkSound> = .sbss:0x8051EF10; // type:object size:0x1 scope:weak data:byte
|
||||
l_spkVolume = .sbss:0x8051EF18; // type:object size:0x1 scope:local data:byte
|
||||
sSpkHandles = .sbss:0x8051EF1C; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
spHomeButtonObj__Q210homebutton10HomeButton = .sbss:0x8051EF20; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
suIDCounter__Q310homebutton3gui11PaneManager = .sbss:0x8051EF28; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
|
||||
+10
-10
@@ -2307,40 +2307,40 @@ Z2AudioLib/Z2AudioMgr.cpp:
|
||||
.sbss start:0x80521848 end:0x80521850
|
||||
.sdata2 start:0x805264B8 end:0x805264C0
|
||||
|
||||
Z2AudioLib/SpkSpeakerCtrl.cpp:
|
||||
Z2AudioCS/SpkSpeakerCtrl.cpp:
|
||||
.text start:0x802AFF78 end:0x802B090C
|
||||
.ctors start:0x803B923C end:0x803B9240
|
||||
.bss start:0x804A9338 end:0x804A9458
|
||||
.sbss start:0x80521850 end:0x80521858
|
||||
|
||||
Z2AudioLib/SpkSystem.cpp:
|
||||
Z2AudioCS/SpkSystem.cpp:
|
||||
.text start:0x802B090C end:0x802B0BDC
|
||||
.ctors start:0x803B9240 end:0x803B9244
|
||||
.bss start:0x804A9458 end:0x804A9478
|
||||
.sbss start:0x80521858 end:0x8052186C
|
||||
.sbss start:0x80521858 end:0x80521868
|
||||
|
||||
Z2AudioLib/SpkMixingBuffer.cpp:
|
||||
Z2AudioCS/SpkMixingBuffer.cpp:
|
||||
.text start:0x802B0BDC end:0x802B0D28
|
||||
.sdata2 start:0x805264C0 end:0x805264C8
|
||||
|
||||
Z2AudioLib/SpkWave.cpp:
|
||||
Z2AudioCS/SpkWave.cpp:
|
||||
.text start:0x802B0D28 end:0x802B0E6C
|
||||
|
||||
Z2AudioLib/SpkTable.cpp:
|
||||
Z2AudioCS/SpkTable.cpp:
|
||||
.text start:0x802B0E6C end:0x802B0EF0
|
||||
|
||||
Z2AudioLib/SpkData.cpp:
|
||||
Z2AudioCS/SpkData.cpp:
|
||||
.text start:0x802B0EF0 end:0x802B0FD8
|
||||
|
||||
Z2AudioLib/SpkSound.cpp:
|
||||
Z2AudioCS/SpkSound.cpp:
|
||||
.text start:0x802B0FD8 end:0x802B1BE4
|
||||
.ctors start:0x803B9244 end:0x803B9248
|
||||
.bss start:0x804A9478 end:0x804A9488
|
||||
.sdata2 start:0x805264C8 end:0x805264F0
|
||||
|
||||
Z2AudioLib/Z2AudioCS.cpp:
|
||||
Z2AudioCS/Z2AudioCS.cpp:
|
||||
.text start:0x802B1BE4 end:0x802B1EA4
|
||||
.sbss start:0x8052186C end:0x80521870
|
||||
.sbss start:0x80521868 end:0x80521870
|
||||
.sdata2 start:0x805264F0 end:0x805264F8
|
||||
|
||||
revolution/gf/GFGeometry.cpp:
|
||||
|
||||
@@ -28015,8 +28015,8 @@ mAudioMgrPtr__10Z2AudioMgr = .sbss:0x80521848; // type:object size:0x4 scope:glo
|
||||
sMixingBuffer = .sbss:0x80521850; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__29JASGlobalInstance<9SpkSystem> = .sbss:0x80521858; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sInstance__35JASGlobalInstance<14SpkSoundHolder> = .sbss:0x8052185C; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
lbl_80521860 = .sbss:0x80521860; // type:object size:0x8 data:byte
|
||||
lbl_80521868 = .sbss:0x80521868; // type:object size:0x1 data:byte
|
||||
@GUARD@memPool___29JASPoolAllocObject<8SpkSound> = .sbss:0x80521860; // type:object size:0x1 scope:weak data:byte
|
||||
l_spkVolume = .sbss:0x80521868; // type:object size:0x1 scope:local data:byte
|
||||
sSpkHandles = .sbss:0x8052186C; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
spHomeButtonObj__Q210homebutton10HomeButton = .sbss:0x80521870; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
suIDCounter__Q310homebutton3gui11PaneManager = .sbss:0x80521878; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
|
||||
@@ -2371,7 +2371,7 @@ Z2AudioCS/SpkSpeakerCtrl.cpp:
|
||||
Z2AudioCS/SpkSystem.cpp:
|
||||
.text start:0x8035F630 end:0x8035F960
|
||||
.ctors start:0x8048E680 end:0x8048E684
|
||||
.sbss start:0x805091A0 end:0x805091B4
|
||||
.sbss start:0x805091A0 end:0x805091B0
|
||||
.bss start:0x8057EE78 end:0x8057EE98
|
||||
|
||||
Z2AudioCS/SpkMixingBuffer.cpp:
|
||||
@@ -2395,7 +2395,7 @@ Z2AudioCS/SpkSound.cpp:
|
||||
|
||||
Z2AudioCS/Z2AudioCS.cpp:
|
||||
.text start:0x80360870 end:0x80360E90
|
||||
.sbss start:0x805091B4 end:0x805091B8
|
||||
.sbss start:0x805091B0 end:0x805091B8
|
||||
.sdata2 start:0x8050DF18 end:0x8050DF20
|
||||
|
||||
revolution/gf/GFGeometry.cpp:
|
||||
|
||||
@@ -25636,8 +25636,8 @@ mAudioMgrPtr__10Z2AudioMgr = .sbss:0x80509190; // type:object size:0x4 scope:glo
|
||||
sMixingBuffer = .sbss:0x80509198; // type:object size:0x4 scope:global data:4byte hash:0xFB6CB64A
|
||||
sInstance__29JASGlobalInstance<9SpkSystem> = .sbss:0x805091A0; // type:object size:0x4 scope:global data:4byte hash:0xA09FFFD8 dhash:0x0F2938EA
|
||||
sInstance__35JASGlobalInstance<14SpkSoundHolder> = .sbss:0x805091A4; // type:object size:0x4 scope:global data:4byte hash:0x36FDD217 dhash:0x47E37BB4
|
||||
lbl_805091A8 = .sbss:0x805091A8; // type:object size:0x1 data:byte hash:0x4CDC2040 dhash:0xE30C82D3
|
||||
lbl_805091B0 = .sbss:0x805091B0; // type:object size:0x1 data:byte hash:0x3DE7AC96
|
||||
@GUARD@memPool___29JASPoolAllocObject<8SpkSound> = .sbss:0x805091A8; // type:object size:0x1 scope:weak data:byte hash:0x4CDC2040 dhash:0xE30C82D3
|
||||
l_spkVolume = .sbss:0x805091B0; // type:object size:0x1 scope:local data:byte hash:0x3DE7AC96
|
||||
sSpkHandles = .sbss:0x805091B4; // type:object size:0x4 scope:global data:4byte hash:0x56939CC7
|
||||
spHomeButtonObj__Q210homebutton10HomeButton = .sbss:0x805091B8; // type:object size:0x4 scope:global data:4byte hash:0xAEFD08FB dhash:0xF1660658
|
||||
suIDCounter__Q310homebutton3gui11PaneManager = .sbss:0x805091C0; // type:object size:0x4 scope:global data:4byte hash:0x23AF02A1 dhash:0xB23D8ED1
|
||||
|
||||
+10
-10
@@ -3102,41 +3102,41 @@ Z2AudioLib/Z2TrackView.cpp:
|
||||
.sdata start:0x8074A770 end:0x8074A7A0
|
||||
.sdata2 start:0x80752600 end:0x80752610
|
||||
|
||||
Z2AudioCSD/SpkSpeakerCtrl.cpp:
|
||||
Z2AudioCS/SpkSpeakerCtrl.cpp:
|
||||
.text start:0x804F4030 end:0x804F4CC0
|
||||
.ctors start:0x8062F99C end:0x8062F9A0
|
||||
.sbss start:0x8074CE00 end:0x8074CE08
|
||||
.bss start:0x807E1D70 end:0x807E1E90
|
||||
|
||||
Z2AudioCSD/SpkSystem.cpp:
|
||||
Z2AudioCS/SpkSystem.cpp:
|
||||
.text start:0x804F4CC0 end:0x804F5860
|
||||
.ctors start:0x8062F9A0 end:0x8062F9A4
|
||||
.data start:0x8070CA20 end:0x8070CAE8
|
||||
.sdata start:0x8074A7A0 end:0x8074A7D0
|
||||
.sbss start:0x8074CE08 end:0x8074CE1C
|
||||
.sbss start:0x8074CE08 end:0x8074CE18
|
||||
.sdata2 start:0x80752610 end:0x80752618
|
||||
.bss start:0x807E1E90 end:0x807E1EB0
|
||||
|
||||
Z2AudioCSD/SpkMixingBuffer.cpp:
|
||||
Z2AudioCS/SpkMixingBuffer.cpp:
|
||||
.text start:0x804F5860 end:0x804F5DB0
|
||||
.data start:0x8070CAE8 end:0x8070CB60
|
||||
.sdata start:0x8074A7D0 end:0x8074A7E8
|
||||
.sdata2 start:0x80752618 end:0x80752620
|
||||
|
||||
Z2AudioCSD/SpkWave.cpp:
|
||||
Z2AudioCS/SpkWave.cpp:
|
||||
.text start:0x804F5DB0 end:0x804F6400
|
||||
.data start:0x8070CB60 end:0x8070CBA0
|
||||
.sdata start:0x8074A7E8 end:0x8074A800
|
||||
|
||||
Z2AudioCSD/SpkTable.cpp:
|
||||
Z2AudioCS/SpkTable.cpp:
|
||||
.text start:0x804F6400 end:0x804F6530
|
||||
|
||||
Z2AudioCSD/SpkData.cpp:
|
||||
Z2AudioCS/SpkData.cpp:
|
||||
.text start:0x804F6530 end:0x804F68D0
|
||||
.data start:0x8070CBA0 end:0x8070CC00
|
||||
.sdata start:0x8074A800 end:0x8074A830
|
||||
|
||||
Z2AudioCSD/SpkSound.cpp:
|
||||
Z2AudioCS/SpkSound.cpp:
|
||||
.text start:0x804F68D0 end:0x804F8240
|
||||
.ctors start:0x8062F9A4 end:0x8062F9A8
|
||||
.data start:0x8070CC00 end:0x8070CDF0
|
||||
@@ -3144,11 +3144,11 @@ Z2AudioCSD/SpkSound.cpp:
|
||||
.sdata2 start:0x80752620 end:0x80752648
|
||||
.bss start:0x807E1EB0 end:0x807E1EC0
|
||||
|
||||
Z2AudioCSD/Z2AudioCS.cpp:
|
||||
Z2AudioCS/Z2AudioCS.cpp:
|
||||
.text start:0x804F8240 end:0x804F8AE0
|
||||
.data start:0x8070CDF0 end:0x8070CEF8
|
||||
.sdata start:0x8074A878 end:0x8074A8B0
|
||||
.sbss start:0x8074CE1C end:0x8074CE20
|
||||
.sbss start:0x8074CE18 end:0x8074CE20
|
||||
.sdata2 start:0x80752648 end:0x80752650
|
||||
|
||||
revolution/gf/GFGeometry.cpp:
|
||||
|
||||
@@ -52644,14 +52644,21 @@ lbl_8070C9BA = .data:0x8070C9BA; // type:object size:0x66
|
||||
@STRING@__rf__14SpkSoundHandleCFv@1 = .data:0x8070CD78; // type:object size:0xB scope:local data:string hash:0x3EC1E462 dhash:0xCBF24059
|
||||
@STRING@__rf__14SpkSoundHandleCFv@0 = .data:0x8070CD84; // type:object size:0xC scope:local data:string hash:0x3EC1E463 dhash:0xCBF24059
|
||||
@STRING@__rf__14SpkSoundHandleCFv = .data:0x8070CD90; // type:object size:0xB scope:local data:string hash:0x0E65BB53 dhash:0x56BA35D5
|
||||
lbl_8070CD9B = .data:0x8070CD9B; // type:object size:0x55
|
||||
@STRING@getParams__8SpkTableFl@5 = .data:0x8070CD9C; // type:object size:0xB scope:local data:string
|
||||
@STRING@getParams__8SpkTableFl@4 = .data:0x8070CDA8; // type:object size:0x12 scope:local data:string
|
||||
@STRING@getParams__8SpkTableFl@3 = .data:0x8070CDBC; // type:object size:0xB scope:local data:string
|
||||
@STRING@getParams__8SpkTableFl@1 = .data:0x8070CDC8; // type:object size:0xB scope:local data:string
|
||||
@STRING@getParams__8SpkTableFl@0 = .data:0x8070CDD4; // type:object size:0x9 scope:local data:string
|
||||
@STRING@getParams__8SpkTableFl = .data:0x8070CDE0; // type:object size:0xB scope:local data:string
|
||||
@14612 = .data:0x8070CDF0; // type:object size:0xE scope:local data:string hash:0xA0600895
|
||||
...data.0 = .data:0x8070CDF0; // type:label scope:local
|
||||
@14617 = .data:0x8070CE00; // type:object size:0xC scope:local data:string hash:0xA0600890
|
||||
@14671 = .data:0x8070CE0C; // type:object size:0x2C scope:local data:string hash:0xA06007D0
|
||||
@14712 = .data:0x8070CE38; // type:object size:0x20 scope:local data:string hash:0xA06014D4
|
||||
@14731 = .data:0x8070CE58; // type:object size:0x25 scope:local data:string hash:0xA0601495
|
||||
lbl_8070CE7D = .data:0x8070CE7D; // type:object size:0x27
|
||||
@STRING@__rf__14SpkSoundHandleCFv@1 = .data:0x8070CE80; // type:object size:0xB scope:local data:string
|
||||
@STRING@__rf__14SpkSoundHandleCFv@0 = .data:0x8070CE8C; // type:object size:0xC scope:local data:string
|
||||
@STRING@__rf__14SpkSoundHandleCFv = .data:0x8070CE98; // type:object size:0xB scope:local data:string
|
||||
@STRING@getName__8SpkTableFl@5 = .data:0x8070CEA4; // type:object size:0xB scope:local data:string hash:0x137611D0 dhash:0x073DA070
|
||||
@STRING@getName__8SpkTableFl@4 = .data:0x8070CEB0; // type:object size:0x12 scope:local data:string hash:0x137611D1 dhash:0x073DA070
|
||||
@STRING@getName__8SpkTableFl@3 = .data:0x8070CEC4; // type:object size:0xB scope:local data:string hash:0x137611D6 dhash:0x073DA070
|
||||
@@ -64822,8 +64829,8 @@ sF1_Pan_Width = .sbss:0x8074CDF8; // type:object size:0x4 scope:global align:4 d
|
||||
sMixingBuffer = .sbss:0x8074CE00; // type:object size:0x4 scope:global data:4byte hash:0xFB6CB64A
|
||||
sInstance__29JASGlobalInstance<9SpkSystem> = .sbss:0x8074CE08; // type:object size:0x4 scope:global data:4byte hash:0xA09FFFD8 dhash:0x0F2938EA
|
||||
sInstance__35JASGlobalInstance<14SpkSoundHolder> = .sbss:0x8074CE0C; // type:object size:0x4 scope:global data:4byte hash:0x36FDD217 dhash:0x47E37BB4
|
||||
lbl_8074CE10 = .sbss:0x8074CE10; // type:object size:0x8 data:byte hash:0x4CDC2040 dhash:0xE30C82D3
|
||||
lbl_8074CE18 = .sbss:0x8074CE18; // type:object size:0x1 data:byte hash:0x3DE7AC96
|
||||
@GUARD@memPool___29JASPoolAllocObject<8SpkSound> = .sbss:0x8074CE10; // type:object size:0x1 scope:weak data:byte hash:0x4CDC2040 dhash:0xE30C82D3
|
||||
l_spkVolume = .sbss:0x8074CE18; // type:object size:0x1 scope:local data:byte hash:0x3DE7AC96
|
||||
sSpkHandles = .sbss:0x8074CE1C; // type:object size:0x4 scope:global data:4byte hash:0x56939CC7
|
||||
sSystemHeap__7JKRHeap = .sbss:0x8074CE20; // type:object size:0x4 scope:global data:4byte hash:0xDA667457 dhash:0x03758820
|
||||
sCurrentHeap__7JKRHeap = .sbss:0x8074CE24; // type:object size:0x4 scope:global data:4byte hash:0xB87EEE3B dhash:0x55BE7AAC
|
||||
|
||||
+9
-9
@@ -1253,20 +1253,20 @@ config.libs = [
|
||||
],
|
||||
},
|
||||
{
|
||||
"lib": "Z2AudioCSD",
|
||||
"lib": "Z2AudioCS",
|
||||
"mw_version": MWVersion(config.version),
|
||||
"cflags": cflags_framework,
|
||||
"progress_category": "core",
|
||||
"host": True,
|
||||
"objects": [
|
||||
Object(NonMatching, "Z2AudioCSD/SpkSpeakerCtrl.cpp"),
|
||||
Object(NonMatching, "Z2AudioCSD/SpkSystem.cpp"),
|
||||
Object(NonMatching, "Z2AudioCSD/SpkMixingBuffer.cpp"),
|
||||
Object(NonMatching, "Z2AudioCSD/SpkWave.cpp"),
|
||||
Object(NonMatching, "Z2AudioCSD/SpkTable.cpp"),
|
||||
Object(NonMatching, "Z2AudioCSD/SpkData.cpp"),
|
||||
Object(NonMatching, "Z2AudioCSD/SpkSound.cpp"),
|
||||
Object(NonMatching, "Z2AudioCSD/Z2AudioCS.cpp"),
|
||||
Object(Matching, "Z2AudioCS/SpkSpeakerCtrl.cpp"),
|
||||
Object(Equivalent, "Z2AudioCS/SpkSystem.cpp"),
|
||||
Object(MatchingFor(ALL_WII, ALL_DEMO, "Shield"), "Z2AudioCS/SpkMixingBuffer.cpp"),
|
||||
Object(Matching, "Z2AudioCS/SpkWave.cpp"),
|
||||
Object(Matching, "Z2AudioCS/SpkTable.cpp"),
|
||||
Object(MatchingFor(ALL_WII, ALL_DEMO, "Shield"), "Z2AudioCS/SpkData.cpp"),
|
||||
Object(Equivalent, "Z2AudioCS/SpkSound.cpp"), # weak func order (JSUList ctor)
|
||||
Object(Equivalent, "Z2AudioCS/Z2AudioCS.cpp"),
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
#define JASCALC_H
|
||||
|
||||
#include <dolphin/types.h>
|
||||
#include <limits>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct JASCalc {
|
||||
static void imixcopy(const s16*, const s16*, s16*, u32);
|
||||
@@ -15,15 +16,8 @@ struct JASCalc {
|
||||
static void bzero(void* dest, u32 size);
|
||||
static f32 pow2(f32);
|
||||
|
||||
// Could not make it work as inline - specialization is in JASCalc.cpp
|
||||
template <typename A, typename B>
|
||||
static A clamp(B x); /* {
|
||||
if (std::numeric_limits<A>::min() >= x)
|
||||
return std::numeric_limits<A>::min();
|
||||
if (x >= std::numeric_limits<A>::max())
|
||||
return std::numeric_limits<A>::max();
|
||||
return x;
|
||||
} */
|
||||
static A clamp(B x);
|
||||
|
||||
static f32 clamp01(f32 i_value) {
|
||||
if (i_value <= 0.0f) {
|
||||
@@ -42,4 +36,13 @@ struct JASCalc {
|
||||
static const s16 CUTOFF_TO_IIR_TABLE[128][4];
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
A JASCalc::clamp(B x) {
|
||||
if (x <= std::numeric_limits<A>::min())
|
||||
return std::numeric_limits<A>::min();
|
||||
if (x >= std::numeric_limits<A>::max())
|
||||
return std::numeric_limits<A>::max();
|
||||
return x;
|
||||
}
|
||||
|
||||
#endif /* JASCALC_H */
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef Z2AUDIOCS_SPKDATA_H
|
||||
#define Z2AUDIOCS_SPKDATA_H
|
||||
|
||||
#include "Z2AudioCS/SpkTable.h"
|
||||
#include "Z2AudioCS/SpkWave.h"
|
||||
#include "JSystem/JKernel/JKRArchive.h"
|
||||
|
||||
class SpkData {
|
||||
public:
|
||||
SpkData(JKRArchive*);
|
||||
void loadTable(u16 chan);
|
||||
void loadWave(u16 chan);
|
||||
BOOL isValid(void) const;
|
||||
|
||||
inline SpkTable& getTableMgr(void) { return mTableMgr; }
|
||||
inline SpkWave& getWaveMgr(void) { return mWaveMgr; }
|
||||
|
||||
/* 0x00 */ SpkTable mTableMgr;
|
||||
/* 0x10 */ SpkWave mWaveMgr;
|
||||
/* 0x14 */ JKRArchive* mResArc;
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_SPKDATA_H */
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef Z2AUDIOCS_SPKMIXINGBUFFER_H
|
||||
#define Z2AUDIOCS_SPKMIXINGBUFFER_H
|
||||
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
static const s32 cSamplesPerAudioPacket = 40;
|
||||
|
||||
class SpkMixingBuffer {
|
||||
public:
|
||||
SpkMixingBuffer(JKRHeap* heap);
|
||||
void mix(s32 chan, s16* src, s32 len, f32 weight, s32 offset);
|
||||
s16* getSamples(s32 chan) const;
|
||||
bool update(s32 chan);
|
||||
void bzeroBuffer(s32 chan);
|
||||
|
||||
private:
|
||||
/* 0x00 */ s16* mBuffer[4];
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_SPKMIXINGBUFFER_H */
|
||||
@@ -0,0 +1,119 @@
|
||||
#ifndef Z2AUDIOCS_SPKSOUND_H
|
||||
#define Z2AUDIOCS_SPKSOUND_H
|
||||
|
||||
#include "Z2AudioCS/SpkTable.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
#include <revolution/types.h>
|
||||
|
||||
class SpkSound;
|
||||
|
||||
class SpkSoundHandle {
|
||||
public:
|
||||
SpkSoundHandle(void) : mSound(NULL) {}
|
||||
~SpkSoundHandle(void) {
|
||||
releaseSound();
|
||||
}
|
||||
void releaseSound(void);
|
||||
|
||||
inline bool isSoundAttached() const {
|
||||
return mSound != NULL;
|
||||
}
|
||||
inline SpkSound* operator->(void) const {
|
||||
JUT_ASSERT(62, mSound != NULL);
|
||||
return mSound;
|
||||
}
|
||||
inline operator bool() const {
|
||||
return isSoundAttached();
|
||||
}
|
||||
|
||||
/* 0x00 */ SpkSound* mSound;
|
||||
};
|
||||
|
||||
class SpkSoundVolume {
|
||||
public:
|
||||
SpkSoundVolume(void);
|
||||
void setRelease(s32);
|
||||
void setFadeOut(s32);
|
||||
f32 calc(bool&);
|
||||
void setTableVolume(f32);
|
||||
|
||||
/* 0x00 */ f32 field_0x00;
|
||||
/* 0x04 */ f32 field_0x04;
|
||||
/* 0x08 */ f32 field_0x08;
|
||||
/* 0x0C */ f32 field_0x0c;
|
||||
/* 0x10 */ f32 field_0x10;
|
||||
/* 0x14 */ f32 field_0x14;
|
||||
/* 0x18 */ f32 field_0x18;
|
||||
/* 0x1C */ f32 mTableVolume;
|
||||
};
|
||||
|
||||
class SpkSound : public JASPoolAllocObject<SpkSound>, public JSULink<SpkSound> {
|
||||
public:
|
||||
SpkSound(void);
|
||||
~SpkSound(void);
|
||||
void update(f32 vol);
|
||||
void stop(s32 msec);
|
||||
void startRelease(void);
|
||||
bool isHandleAttached(void) const;
|
||||
void attachHandle(SpkSoundHandle* handle);
|
||||
void releaseHandle(void);
|
||||
bool start(s32 chan, s32 soundNum);
|
||||
void kill(void);
|
||||
bool isStopping(void) const;
|
||||
bool isDead(void) const;
|
||||
bool isLocked(void) const;
|
||||
void unlock(void);
|
||||
s32 getLifeTime(void);
|
||||
void setLifeTime(s32 lifeTime);
|
||||
void updateLifeTime(void);
|
||||
s32 convertMsecToFrames(s32 msec);
|
||||
bool isLoopWave(void);
|
||||
bool setWaveData(s32 soundNum);
|
||||
|
||||
inline s32 getPriority(void) const { return mPriority; }
|
||||
inline void setPriority(s32 priority) { mPriority = priority; }
|
||||
inline s32 getSoundNum(void) const { return mSoundNum; }
|
||||
inline void setSoundNum(s32 soundNum) { mSoundNum = soundNum; }
|
||||
|
||||
/* 0x10 */ SpkSoundHandle* mHandle;
|
||||
/* 0x14 */ s32 mSoundNum;
|
||||
/* 0x18 */ s16* mWaveData;
|
||||
/* 0x1C */ s32 mCurPos;
|
||||
/* 0x20 */ u32 field_0x20;
|
||||
/* 0x24 */ s32 mPriority;
|
||||
/* 0x28 */ u32 field_0x28;
|
||||
/* 0x2C */ s32 mWaveSize;
|
||||
/* 0x30 */ s32 mWaveLoopStart;
|
||||
/* 0x34 */ s32 mWaveLoopEnd;
|
||||
/* 0x38 */ s32 mState;
|
||||
/* 0x3C */ s32 mLifeTime;
|
||||
/* 0x40 */ SpkSoundVolume mVolume;
|
||||
};
|
||||
|
||||
class SpkSoundHolder : JASGlobalInstance<SpkSoundHolder> {
|
||||
public:
|
||||
SpkSoundHolder(void);
|
||||
bool startSound(s32 chan, s32 soundNum, SpkSoundHandle* handle);
|
||||
bool startLevelSound(s32 chan, s32 soundNum, SpkSoundHandle* handle);
|
||||
void stopAll(s32 chan, s32 msec);
|
||||
bool update(s32 chan);
|
||||
bool updateEachSound(s32 chan);
|
||||
void freeDeadSound(s32 chan);
|
||||
void appendSound(s32 chan, SpkSound* sound);
|
||||
void framework(void);
|
||||
|
||||
inline f32 getMasterVolume(void) const { return mMasterVolume; }
|
||||
inline void setMasterVolume(f32 vol) { mMasterVolume = vol; }
|
||||
inline s32 getConfigVolume(void) const { return mConfigVolume; }
|
||||
inline void setConfigVolume(s32 vol) { mConfigVolume = vol; }
|
||||
inline f32 getConfigVolumeF32(void) const { return (f32)mConfigVolume / 15.0f; }
|
||||
|
||||
/* 0x00 */ JSUList<SpkSound> mSoundList[WPAD_MAX_CONTROLLERS];
|
||||
/* 0x30 */ f32 mSoundVolumes[WPAD_MAX_CONTROLLERS];
|
||||
/* 0x40 */ f32 mMasterVolume;
|
||||
/* 0x44 */ s32 mConfigVolume;
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_SPKSOUND_H */
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef Z2AUDIOCS_SPKSPEAKERCTRL_H
|
||||
#define Z2AUDIOCS_SPKSPEAKERCTRL_H
|
||||
|
||||
#include "Z2AudioCS/SpkMixingBuffer.h"
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/types.h>
|
||||
#include <revolution/wenc.h>
|
||||
|
||||
struct SpeakerInfo {
|
||||
/* 0x00 */ bool mIsConnected;
|
||||
/* 0x01 */ bool mIsPlaying;
|
||||
/* 0x02 */ WENCInfo mEncInfo;
|
||||
/* 0x22 */ bool field_0x22;
|
||||
/* 0x23 */ bool mIsMuted;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
/* 0x24 */ s32 mState;
|
||||
#endif
|
||||
/* 0x28 */ s32 mRadioSensitivityTimer;
|
||||
/* 0x2C */ s32 mExtensionTimer;
|
||||
/* 0x30 */ u8 mVolume;
|
||||
};
|
||||
|
||||
class SpkSpeakerCtrl {
|
||||
public:
|
||||
static void setMixingBuffer(SpkMixingBuffer*);
|
||||
static void setup(void);
|
||||
static void connect(s32 chan);
|
||||
static void disconnect(s32 chan);
|
||||
static void setSpeakerOn(s32 chan);
|
||||
static void setSpeakerOnCallback(s32 chan, s32 param_1);
|
||||
static void setSpeakerPlay(s32 chan);
|
||||
static void startPlayCallback(s32 chan, s32 param_1);
|
||||
static void setSpeakerOff(s32 chan);
|
||||
static void retryConnection(s32 chan);
|
||||
static void framework(void);
|
||||
static void updateSpeaker(OSAlarm* alarm, OSContext* ctx);
|
||||
static bool isEnable(s32 chan);
|
||||
static void extensionProcess(s32 chan, s32 param_1);
|
||||
static bool updateExtensionProcess(s32 chan);
|
||||
static bool isSubmitPlayByExtensionConnect(s32 chan);
|
||||
static bool checkRadioSensitivity(s32 chan);
|
||||
static bool isSubmitPlayByRadioSensitivity(s32 chan);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_SPKSPEAKERCTRL_H */
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef Z2AUDIOCS_SPKSYSTEM_H
|
||||
#define Z2AUDIOCS_SPKSYSTEM_H
|
||||
|
||||
#include "Z2AudioCS/SpkData.h"
|
||||
#include "Z2AudioCS/SpkMixingBuffer.h"
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JKernel/JKRArchive.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <revolution/types.h>
|
||||
|
||||
class SpkSystem : protected JASGlobalInstance<SpkSystem> {
|
||||
public:
|
||||
SpkSystem(JKRHeap* heap);
|
||||
void setResource(JKRArchive* resArc, u16, u16);
|
||||
void framework(void);
|
||||
void startSound(s32 chan, s32 param_1, SpkSoundHandle* handle);
|
||||
void startLevelSound(s32 chan, s32 param_1, SpkSoundHandle* handle);
|
||||
void stopAll(s32 chan, s32 msec);
|
||||
void setMasterVolume(f32 vol);
|
||||
f32 getMasterVolume(void);
|
||||
void setConfigVolume(s32 vol);
|
||||
static void newSoundMemPool(s32 numOfSound);
|
||||
static void connect(s32 chan);
|
||||
static void disconnect(s32 chan);
|
||||
static void extensionProcess(s32, s32);
|
||||
|
||||
inline SpkData* getData(void) const { return mData; }
|
||||
inline SpkMixingBuffer* getMixingBuffer(void) const { return mMixingBuffer; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ JKRHeap* mHeap;
|
||||
/* 0x04 */ SpkData* mData;
|
||||
/* 0x08 */ SpkMixingBuffer* mMixingBuffer;
|
||||
/* 0x0C */ SpkSoundHolder* mSoundHolder;
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_SPKSYSTEM_H */
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef Z2AUDIOCS_SPKTABLE_H
|
||||
#define Z2AUDIOCS_SPKTABLE_H
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include <revolution/types.h>
|
||||
#include <revolution/wpad.h>
|
||||
|
||||
struct SpkTableParams {
|
||||
/* 0x00 */ u16 mWaveNum;
|
||||
/* 0x02 */ u8 field_0x02;
|
||||
/* 0x03 */ u8 mVolume;
|
||||
/* 0x04 */ u16 mMsec;
|
||||
/* 0x06 */ u8 pad_0x06[2];
|
||||
};
|
||||
|
||||
class SpkTable {
|
||||
public:
|
||||
SpkTable(void);
|
||||
void setResource(void* res);
|
||||
|
||||
inline s32 getName(s32 num) {
|
||||
JUT_ASSERT(0x35, num >= 0);
|
||||
JUT_ASSERT(0x36, num < mNumOfSound);
|
||||
return *(mDataOffsets + num);
|
||||
}
|
||||
inline s32 getNumOfSound() const { return mNumOfSound; }
|
||||
inline bool isValid(void) const { return mIsInitialized; }
|
||||
inline SpkTableParams* getParams(s32 num) {
|
||||
JUT_ASSERT(46, num >= 0);
|
||||
JUT_ASSERT(47, num < mNumOfSound);
|
||||
return (SpkTableParams*)mEntryOffset + num;
|
||||
}
|
||||
|
||||
// private:
|
||||
/* 0x00 */ bool mIsInitialized;
|
||||
/* 0x04 */ s32 mNumOfSound;
|
||||
/* 0x08 */ u32 mEntryOffset;
|
||||
/* 0x0C */ s32* mDataOffsets;
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_SPKTABLE_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef Z2AUDIOCS_SPKWAVE_H
|
||||
#define Z2AUDIOCS_SPKWAVE_H
|
||||
|
||||
#include <revolution/types.h>
|
||||
|
||||
struct WaveData {
|
||||
s32 size;
|
||||
u32 loopStartPos;
|
||||
u32 loopEndPos;
|
||||
s16 wave[0];
|
||||
};
|
||||
|
||||
class SpkWave {
|
||||
public:
|
||||
SpkWave(void);
|
||||
void setResource(void*);
|
||||
s32 getNumOfWaves(void) const;
|
||||
s32 getWaveSize(s32 num) const;
|
||||
u32 getLoopStartPos(s32 num) const;
|
||||
u32 getLoopEndPos(s32 num) const;
|
||||
s16* getWave(s32 num) const;
|
||||
WaveData* getWaveData(s32 num) const;
|
||||
|
||||
inline bool isValid(void) const { return mWaveData != NULL; }
|
||||
inline const void* getResource(void) const { return mWaveData; }
|
||||
inline void* getResource(void) { return mWaveData; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ void* mWaveData;
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_SPKWAVE_H */
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef Z2AUDIOCS_H
|
||||
#define Z2AUDIOCS_H
|
||||
|
||||
#include "Z2AudioCS/SpkTable.h"
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
#include <dolphin/types.h>
|
||||
|
||||
class JKRHeap;
|
||||
class JKRArchive;
|
||||
|
||||
class Z2AudioCS {
|
||||
public:
|
||||
static void newSpkSoundMemPool();
|
||||
static int init(JKRHeap* heap, JKRArchive* res, s32 param_2, s32 param_3);
|
||||
static void update();
|
||||
static void connect(s32 chan);
|
||||
static void disconnect(s32 chan);
|
||||
static void extensionProcess(s32 chan, s32 param_1);
|
||||
static SpkSoundHandle* getHandleSoundID(s32 soundNum);
|
||||
static SpkSoundHandle* start(s32 id, s32 chan);
|
||||
static SpkSoundHandle* startLevel(s32 id, s32 chan);
|
||||
static s32 getName(s32 num);
|
||||
static s32 getNumOfSound(void);
|
||||
static void stopAll(s32 chan, s32 msec);
|
||||
static void stop(s32 chan);
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_H */
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef Z2AUDIOCS_H
|
||||
#define Z2AUDIOCS_H
|
||||
|
||||
#include <dolphin/types.h>
|
||||
|
||||
class JKRHeap;
|
||||
class JKRArchive;
|
||||
|
||||
class Z2AudioCS {
|
||||
public:
|
||||
static void newSpkSoundMemPool();
|
||||
static int init(JKRHeap*, JKRArchive*, s32, s32);
|
||||
static void update();
|
||||
static void connect(s32);
|
||||
static void disconnect(s32);
|
||||
static void extensionProcess(s32, s32);
|
||||
u32 getHandleSoundID(s32);
|
||||
static void start(s32, s32);
|
||||
static int startLevel(s32, s32);
|
||||
};
|
||||
|
||||
#endif /* Z2AUDIOCS_H */
|
||||
@@ -263,9 +263,6 @@ s16 const JASCalc::CUTOFF_TO_IIR_TABLE[128][4] = {
|
||||
0x7FFF, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
template <>
|
||||
s16 JASCalc::clamp(s32);
|
||||
|
||||
// currently required because of missing functions
|
||||
// JASCalc::hannWindow(short *, u32)
|
||||
// JASCalc::hammWindow(short *, u32)
|
||||
@@ -319,12 +316,3 @@ f32 JASCalc::pow2(f32 x) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <>
|
||||
s16 JASCalc::clamp(s32 x) {
|
||||
if (x <= std::numeric_limits<s16>::min())
|
||||
return std::numeric_limits<s16>::min();
|
||||
if (x >= std::numeric_limits<s16>::max())
|
||||
return std::numeric_limits<s16>::max();
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,21 @@ namespace std {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define INT8_MAX (0x7F)
|
||||
# define INT16_MAX (0x7FFF)
|
||||
# define INT32_MAX (0x7FFFFFFF)
|
||||
# define INT64_MAX (0x7FFFFFFFFFFFFFFFLL)
|
||||
|
||||
# define INT8_MIN (-INT8_MAX-1)
|
||||
# define INT16_MIN (-INT16_MAX-1)
|
||||
# define INT32_MIN (-INT632_MAX-1)
|
||||
# define INT64_MIN (-INT64_MAX-1)
|
||||
|
||||
# define UINT8_MAX (0xFFU)
|
||||
# define UINT16_MAX (0xFFFFU)
|
||||
# define UINT32_MAX (0xFFFFFFFFU)
|
||||
# define UINT64_MAX (0xFFFFFFFFFFFFFFFFULL)
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "Z2AudioCS/SpkData.h"
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
SpkData::SpkData(JKRArchive* resArc) {
|
||||
mResArc = resArc;
|
||||
JUT_ASSERT(21, resArc);
|
||||
}
|
||||
|
||||
void SpkData::loadTable(u16 chan) {
|
||||
JUT_ASSERT(32, mResArc);
|
||||
|
||||
void* res = mResArc->getResource(chan);
|
||||
JUT_ASSERT(35, res);
|
||||
|
||||
mTableMgr.setResource(res);
|
||||
}
|
||||
|
||||
void SpkData::loadWave(u16 chan) {
|
||||
JUT_ASSERT(48, mResArc);
|
||||
|
||||
void* res = mResArc->getResource(chan);
|
||||
JUT_ASSERT(51, res);
|
||||
|
||||
mWaveMgr.setResource(res);
|
||||
}
|
||||
|
||||
BOOL SpkData::isValid(void) const {
|
||||
return mTableMgr.isValid() && mWaveMgr.isValid();
|
||||
}
|
||||
|
||||
static void dummy(SpkWave* wave, SpkTable* table) {
|
||||
if (wave->isValid() && table->isValid()) {
|
||||
table->getParams(0);
|
||||
table->getNumOfSound();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#include "Z2AudioCS/SpkMixingBuffer.h"
|
||||
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
#include "JSystem/JAudio2/JASCalc.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
|
||||
SpkMixingBuffer::SpkMixingBuffer(JKRHeap* heap) {
|
||||
JUT_ASSERT(25, heap);
|
||||
for (s32 chan = 0; chan < ARRAY_SIZE(mBuffer); chan++) {
|
||||
mBuffer[chan] = new (heap, 0) s16[cSamplesPerAudioPacket];
|
||||
JUT_ASSERT(29, mBuffer[chan]);
|
||||
bzeroBuffer(chan);
|
||||
}
|
||||
}
|
||||
|
||||
void SpkMixingBuffer::mix(s32 chan, s16* src, s32 len, f32 weight,
|
||||
s32 offset) {
|
||||
JUT_ASSERT(61, chan < 4);
|
||||
JUT_ASSERT(62, mBuffer[chan]);
|
||||
JUT_ASSERT(63, src);
|
||||
JUT_ASSERT(64, offset >= 0);
|
||||
JUT_ASSERT(65, (offset+len) <= cSamplesPerAudioPacket);
|
||||
|
||||
for (s32 i = 0; i < len; i++) {
|
||||
s32 sample = mBuffer[chan][i + offset];
|
||||
s16 srcSample = src[i];
|
||||
sample += (s32)(srcSample * weight);
|
||||
mBuffer[chan][i + offset] = JASCalc::clamp<s16, s32>(sample);
|
||||
}
|
||||
}
|
||||
|
||||
s16* SpkMixingBuffer::getSamples(s32 chan) const {
|
||||
JUT_ASSERT(97, chan < 4);
|
||||
JUT_ASSERT(98, mBuffer[chan]);
|
||||
return mBuffer[chan];
|
||||
}
|
||||
|
||||
bool SpkMixingBuffer::update(s32 chan) {
|
||||
bzeroBuffer(chan);
|
||||
SpkSoundHolder* sound_holder = JASGlobalInstance<SpkSoundHolder>::getInstance();
|
||||
JUT_ASSERT(121, sound_holder);
|
||||
bool result = sound_holder->update(chan);
|
||||
return result;
|
||||
}
|
||||
|
||||
void SpkMixingBuffer::bzeroBuffer(s32 chan) {
|
||||
JUT_ASSERT(143, chan < 4);
|
||||
JUT_ASSERT(144, mBuffer[chan]);
|
||||
JASCalc::bzero(mBuffer[chan], cSamplesPerAudioPacket * sizeof(s16));
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
|
||||
#include "Z2AudioCS/SpkSpeakerCtrl.h"
|
||||
#include "Z2AudioCS/SpkSystem.h"
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
|
||||
#define SPK_SOUND_MIX_STEP 40
|
||||
|
||||
enum SpkSoundState {
|
||||
SpkSoundState_STARTING_e,
|
||||
SpkSoundState_LOCKED_e,
|
||||
SpkSoundState_UNLOCKED_e,
|
||||
SpkSoundState_STOPPING_e,
|
||||
SpkSoundState_DEAD_e,
|
||||
};
|
||||
|
||||
void SpkSoundHandle::releaseSound() {
|
||||
if (!mSound) {
|
||||
return;
|
||||
}
|
||||
|
||||
mSound->mHandle = NULL;
|
||||
mSound = NULL;
|
||||
}
|
||||
|
||||
SpkSoundVolume::SpkSoundVolume() {
|
||||
field_0x00 = 1.0f;
|
||||
field_0x04 = 0.0f;
|
||||
field_0x08 = 1.0f;
|
||||
field_0x0c = 0.0f;
|
||||
field_0x10 = 1.0f;
|
||||
field_0x14 = 1.0f;
|
||||
field_0x18 = 0.0f;
|
||||
mTableVolume = 1.0f;
|
||||
}
|
||||
|
||||
void SpkSoundVolume::setRelease(s32 release) {
|
||||
if (release > 0) {
|
||||
field_0x04 = 1.0f / release;
|
||||
} else {
|
||||
field_0x04 = 1.0f;
|
||||
}
|
||||
|
||||
field_0x00 = 1.0f;
|
||||
}
|
||||
|
||||
void SpkSoundVolume::setFadeOut(s32 fadeOut) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
if (fadeOut > 0) {
|
||||
field_0x0c = 1.0f / fadeOut;
|
||||
} else {
|
||||
field_0x0c = 1.0f;
|
||||
}
|
||||
|
||||
field_0x08 = 1.0f;
|
||||
}
|
||||
|
||||
f32 SpkSoundVolume::calc(bool& param_0) {
|
||||
param_0 = false;
|
||||
|
||||
if (field_0x04 != 0.0f) {
|
||||
field_0x00 -= field_0x04;
|
||||
if (field_0x00 <= 0.0f) {
|
||||
field_0x00 = 0.0f;
|
||||
field_0x04 = 0.0f;
|
||||
param_0 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x0c != 0.0f) {
|
||||
field_0x08 -= field_0x0c;
|
||||
if (field_0x08 <= 0.0f) {
|
||||
field_0x08 = 0.0f;
|
||||
field_0x0c = 0.0f;
|
||||
param_0 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x18 != 0.0f) {
|
||||
field_0x10 += field_0x18;
|
||||
if (field_0x18 >= 0.0f) {
|
||||
if (field_0x10 >= field_0x14) {
|
||||
field_0x10 = field_0x14;
|
||||
field_0x18 = 0.0f;
|
||||
}
|
||||
} else if (field_0x10 <= field_0x14) {
|
||||
field_0x10 = field_0x14;
|
||||
field_0x18 = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
f32 result = mTableVolume * (field_0x10 * (field_0x08 * (field_0x00 * field_0x00)));
|
||||
return result;
|
||||
}
|
||||
|
||||
void SpkSoundVolume::setTableVolume(f32 vol) {
|
||||
mTableVolume = vol;
|
||||
}
|
||||
|
||||
SpkSound::SpkSound() : JSULink<SpkSound>(this),
|
||||
mHandle(NULL), mSoundNum(-1), mWaveData(0), mCurPos(0),
|
||||
field_0x20(0), mPriority(100), field_0x28(0), mWaveSize(0),
|
||||
mWaveLoopStart(-1), mWaveLoopEnd(-1), mState(SpkSoundState_STARTING_e),
|
||||
mLifeTime(-1) {
|
||||
}
|
||||
|
||||
SpkSound::~SpkSound() {
|
||||
releaseHandle();
|
||||
}
|
||||
|
||||
void SpkSound::update(f32 param_0) {
|
||||
if (!((SpkSoundState)mState != SpkSoundState_UNLOCKED_e &&
|
||||
(SpkSoundState)mState != SpkSoundState_STOPPING_e)) {
|
||||
SpkSystem* system = JASGlobalInstance<SpkSystem>::getInstance();
|
||||
JUT_ASSERT(227, system);
|
||||
|
||||
SpkMixingBuffer* mixing_buffer = system->getMixingBuffer();
|
||||
JUT_ASSERT(230, mixing_buffer);
|
||||
|
||||
bool calc_flag = false;
|
||||
f32 weight = mVolume.calc(calc_flag);
|
||||
if (calc_flag) {
|
||||
mState = SpkSoundState_DEAD_e;
|
||||
}
|
||||
weight *= param_0;
|
||||
|
||||
if (!isLoopWave()) {
|
||||
s32 len = SPK_SOUND_MIX_STEP;
|
||||
if (mCurPos + len >= mWaveSize) {
|
||||
len = mWaveSize - mCurPos;
|
||||
}
|
||||
|
||||
mixing_buffer->mix(field_0x20, mWaveData + mCurPos, len, weight, 0);
|
||||
|
||||
mCurPos += SPK_SOUND_MIX_STEP;
|
||||
|
||||
if (mCurPos >= mWaveSize) {
|
||||
mState = SpkSoundState_DEAD_e;
|
||||
}
|
||||
return;
|
||||
}
|
||||
s32 len = 0;
|
||||
s32 processedBytes = 0;
|
||||
s32 remainingBytes = SPK_SOUND_MIX_STEP;
|
||||
if (mWaveLoopEnd - mCurPos >= SPK_SOUND_MIX_STEP) {
|
||||
len = SPK_SOUND_MIX_STEP;
|
||||
mixing_buffer->mix(field_0x20, mWaveData + mCurPos, len, weight, 0);
|
||||
|
||||
mCurPos += SPK_SOUND_MIX_STEP;
|
||||
|
||||
if (mCurPos >= mWaveLoopEnd) {
|
||||
mCurPos = mWaveLoopStart;
|
||||
}
|
||||
} else {
|
||||
while (remainingBytes > 0) {
|
||||
len = mWaveLoopEnd - mCurPos;
|
||||
if (len >= remainingBytes) {
|
||||
len = remainingBytes;
|
||||
}
|
||||
remainingBytes -= len;
|
||||
|
||||
mixing_buffer->mix(field_0x20, mWaveData + mCurPos, len, weight,
|
||||
processedBytes);
|
||||
|
||||
processedBytes += len;
|
||||
mCurPos += len;
|
||||
|
||||
if (mCurPos >= mWaveLoopEnd) {
|
||||
mCurPos = mWaveLoopStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSound::stop(s32 msec) {
|
||||
mState = SpkSoundState_STOPPING_e;
|
||||
s32 fade = convertMsecToFrames(msec);
|
||||
|
||||
if (fade) {
|
||||
mVolume.setFadeOut(fade);
|
||||
} else {
|
||||
startRelease();
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSound::startRelease(void) {
|
||||
mVolume.setRelease(field_0x28);
|
||||
}
|
||||
|
||||
void SpkSound::attachHandle(SpkSoundHandle* handle) {
|
||||
JUT_ASSERT(338, handle);
|
||||
if (isHandleAttached()) {
|
||||
releaseHandle();
|
||||
}
|
||||
|
||||
mHandle = handle;
|
||||
mHandle->mSound = this;
|
||||
}
|
||||
|
||||
bool SpkSound::isHandleAttached(void) const {
|
||||
return mHandle != NULL;
|
||||
}
|
||||
|
||||
void SpkSound::releaseHandle() {
|
||||
if (!mHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHandle->mSound = NULL;
|
||||
mHandle = NULL;
|
||||
}
|
||||
|
||||
bool SpkSound::start(s32 param_0, s32 soundNum) {
|
||||
field_0x20 = param_0;
|
||||
|
||||
bool setResult = setWaveData(soundNum);
|
||||
if (!setResult) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mState = SpkSoundState_LOCKED_e;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SpkSound::kill(void) {
|
||||
mState = SpkSoundState_DEAD_e;
|
||||
}
|
||||
|
||||
bool SpkSound::isStopping(void) const {
|
||||
return mState == SpkSoundState_STOPPING_e;
|
||||
}
|
||||
|
||||
bool SpkSound::isDead(void) const {
|
||||
return mState == SpkSoundState_DEAD_e;
|
||||
}
|
||||
|
||||
bool SpkSound::isLocked(void) const {
|
||||
return mState == SpkSoundState_LOCKED_e;
|
||||
}
|
||||
|
||||
void SpkSound::unlock() {
|
||||
if (mState != SpkSoundState_LOCKED_e) {
|
||||
return;
|
||||
}
|
||||
|
||||
mState = SpkSoundState_UNLOCKED_e;
|
||||
}
|
||||
|
||||
s32 SpkSound::getLifeTime(void) {
|
||||
return mLifeTime;
|
||||
}
|
||||
|
||||
void SpkSound::setLifeTime(s32 lifeTime) {
|
||||
mLifeTime = lifeTime;
|
||||
}
|
||||
|
||||
void SpkSound::updateLifeTime() {
|
||||
mLifeTime--;
|
||||
}
|
||||
|
||||
s32 SpkSound::convertMsecToFrames(s32 msec) {
|
||||
return 6 * msec / 40;
|
||||
}
|
||||
|
||||
inline bool SpkSound::isLoopWave(void) {
|
||||
return mWaveLoopStart >= 0 && mWaveLoopEnd > mWaveLoopStart;
|
||||
}
|
||||
|
||||
bool SpkSound::setWaveData(s32 soundNum) {
|
||||
SpkSystem* system = JASGlobalInstance<SpkSystem>::getInstance();
|
||||
JUT_ASSERT(432, system);
|
||||
|
||||
SpkData* data = system->getData();
|
||||
JUT_ASSERT(435, data);
|
||||
|
||||
if (data->isValid() == 0) {
|
||||
JUT_WARN(438, "%s", "Speaker data is not valid\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
SpkTable& table = data->getTableMgr();
|
||||
JUT_ASSERT(444, soundNum < table.getNumOfSound());
|
||||
|
||||
mSoundNum = soundNum;
|
||||
s32 waveNum = table.getParams(soundNum)->mWaveNum;
|
||||
mPriority = table.getParams(soundNum)->field_0x02;
|
||||
mVolume.setTableVolume(table.getParams(soundNum)->mVolume / 127.0f);
|
||||
field_0x28 = convertMsecToFrames(table.getParams(soundNum)->mMsec);
|
||||
|
||||
SpkWave& wave = data->getWaveMgr();
|
||||
JUT_ASSERT(457, mSoundNum < wave.getNumOfWaves());
|
||||
mWaveData = wave.getWave(waveNum);
|
||||
mCurPos = 0;
|
||||
mWaveSize = wave.getWaveSize(waveNum) / 2;
|
||||
mWaveLoopStart = wave.getLoopStartPos(waveNum);
|
||||
mWaveLoopEnd = wave.getLoopEndPos(waveNum);
|
||||
|
||||
JUT_ASSERT(466, mWaveLoopEnd <= mWaveSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SpkSoundHolder::SpkSoundHolder() : JASGlobalInstance(true) {
|
||||
mMasterVolume = 1.0f;
|
||||
mConfigVolume = 10;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mSoundVolumes); i++) {
|
||||
mSoundVolumes[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
bool SpkSoundHolder::startSound(s32 chan, s32 soundNum, SpkSoundHandle* handle) {
|
||||
if (!SpkSpeakerCtrl::isEnable(chan)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (soundNum < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handle != NULL) {
|
||||
if (*handle) {
|
||||
if ((*handle)->isLocked()) {
|
||||
(*handle)->kill();
|
||||
} else {
|
||||
(*handle)->stop(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpkSound* new_sound_p = new SpkSound();
|
||||
if (new_sound_p == NULL) {
|
||||
JUT_WARN(520, "%s", "cannot new SpkSound\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handle != NULL) {
|
||||
new_sound_p->attachHandle(handle);
|
||||
}
|
||||
|
||||
bool startResult = new_sound_p->start(chan, soundNum);
|
||||
if (!startResult) {
|
||||
JUT_WARN(532, "%s", "cannot start SpkSound\n");
|
||||
delete new_sound_p;
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
JASCriticalSection cs;
|
||||
appendSound(chan, new_sound_p);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SpkSoundHolder::appendSound(s32 chan, SpkSound* sound) {
|
||||
mSoundList[chan].append(sound);
|
||||
}
|
||||
|
||||
bool SpkSoundHolder::startLevelSound(s32 chan, s32 soundNum, SpkSoundHandle* handle) {
|
||||
if (handle == NULL) {
|
||||
JUT_WARN(558, "%s", "Spk : No Handle for Level Sound");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*handle) {
|
||||
if (!(*handle)->isStopping() && !(*handle)->isDead()) {
|
||||
(*handle)->setLifeTime(2);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
bool startResult = startSound(chan, soundNum, handle);
|
||||
if (!startResult) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*handle) {
|
||||
(*handle)->setLifeTime(2);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSoundHolder::stopAll(s32 chan, s32 msec) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
for (JSULink<SpkSound>* it = mSoundList[chan].getFirst(); it != NULL; it = it->getNext()) {
|
||||
if (it->getObject() != NULL) {
|
||||
it->getObject()->stop(msec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SpkSoundHolder::update(s32 chan) {
|
||||
JASCriticalSection cs;
|
||||
bool ret = updateEachSound(chan);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool SpkSoundHolder::updateEachSound(s32 chan) {
|
||||
bool retval = false;
|
||||
|
||||
f32 volume = getMasterVolume() * getConfigVolumeF32();
|
||||
|
||||
for (JSULink<SpkSound>* it = mSoundList[chan].getFirst(); it != NULL; it = it->getNext()) {
|
||||
it->getObject()->update(volume * mSoundVolumes[chan]);
|
||||
retval = true;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void SpkSoundHolder::freeDeadSound(s32 chan) {
|
||||
JSULink<SpkSound>* it = mSoundList[chan].getFirst();
|
||||
while (it != NULL) {
|
||||
JSULink<SpkSound>* next = it->getNext();
|
||||
if (it->getObject()->isDead()) {
|
||||
mSoundList[chan].remove(it);
|
||||
delete it->getObject();
|
||||
}
|
||||
it = next;
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSoundHolder::framework(void) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mSoundList); i++) {
|
||||
for (JSULink<SpkSound>* it = mSoundList[i].getFirst(); it != NULL; it = it->getNext()) {
|
||||
if (it->getObject() != NULL) {
|
||||
if (it->getObject()->isLocked()) {
|
||||
it->getObject()->unlock();
|
||||
} else if (it->getObject()->getLifeTime() >= 0) {
|
||||
it->getObject()->updateLifeTime();
|
||||
if (it->getObject()->getLifeTime() <= 0) {
|
||||
it->getObject()->stop(0);
|
||||
it->getObject()->setLifeTime(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
freeDeadSound(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
#include "Z2AudioCS/SpkSpeakerCtrl.h"
|
||||
|
||||
#include "Z2AudioCS/SpkMixingBuffer.h"
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/wpad.h>
|
||||
|
||||
OSAlarm sSpeakerAlarm;
|
||||
SpeakerInfo sSpeakerInfo[WPAD_MAX_CONTROLLERS];
|
||||
SpkSoundHandle sAdjustSoundHandle[WPAD_MAX_CONTROLLERS];
|
||||
SpkMixingBuffer* sMixingBuffer;
|
||||
|
||||
#if VERSION == VERSION_WII_USA_R0
|
||||
#define SPKSPEAKERCTRL_SET_STATE(s) (void)0
|
||||
#else
|
||||
#define SPKSPEAKERCTRL_SET_STATE(s) mState = s
|
||||
#endif
|
||||
|
||||
void SpkSpeakerCtrl::setMixingBuffer(SpkMixingBuffer* pMixingBuffer) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
sMixingBuffer = pMixingBuffer;
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setup(void) {
|
||||
for (s32 i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||
sSpeakerInfo[i].mIsConnected = false;
|
||||
sSpeakerInfo[i].mIsPlaying = false;
|
||||
sSpeakerInfo[i].field_0x22 = true;
|
||||
sSpeakerInfo[i].mIsMuted = false;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[i].mState = 0;
|
||||
#endif
|
||||
sSpeakerInfo[i].mVolume = 64;
|
||||
sSpeakerInfo[i].mRadioSensitivityTimer = 0;
|
||||
sSpeakerInfo[i].mExtensionTimer = 0;
|
||||
memset(sSpeakerInfo[i].mEncInfo.data, 0, sizeof(sSpeakerInfo[i].mEncInfo));
|
||||
}
|
||||
|
||||
OSCreateAlarm(&sSpeakerAlarm);
|
||||
OSSetPeriodicAlarm(&sSpeakerAlarm, OSGetTime(), OSNanosecondsToTicks(6666667), updateSpeaker);
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::connect(s32 chan) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
sSpeakerInfo[chan].mIsConnected = true;
|
||||
sSpeakerInfo[chan].mIsPlaying = false;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
#endif
|
||||
setSpeakerOn(chan);
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::disconnect(s32 chan) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
sSpeakerInfo[chan].mIsConnected = false;
|
||||
sSpeakerInfo[chan].mIsPlaying = false;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
#endif
|
||||
setSpeakerOff(chan);
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setSpeakerOn(s32 chan) {
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
JASCriticalSection cs;
|
||||
#endif
|
||||
|
||||
s32 val = WPADControlSpeaker(chan, 1, setSpeakerOnCallback);
|
||||
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
if (val == -2) {
|
||||
sSpeakerInfo[chan].mState = 1;
|
||||
} else {
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setSpeakerOnCallback(s32 chan, s32 param_1) {
|
||||
#if VERSION == VERSION_WII_USA_R0
|
||||
if (param_1 == 0) {
|
||||
setSpeakerPlay(chan);
|
||||
}
|
||||
#else
|
||||
JASCriticalSection cs;
|
||||
|
||||
if (param_1 == 0) {
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
setSpeakerPlay(chan);
|
||||
} else {
|
||||
if (param_1 == -3) {
|
||||
sSpeakerInfo[chan].mState = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setSpeakerPlay(s32 chan) {
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
JASCriticalSection cs;
|
||||
#endif
|
||||
|
||||
s32 val = WPADControlSpeaker(chan, 4, startPlayCallback);
|
||||
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
if (val == -2) {
|
||||
sSpeakerInfo[chan].mState = 2;
|
||||
} else {
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::startPlayCallback(s32 chan, s32 param_1) {
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
JASCriticalSection cs;
|
||||
#endif
|
||||
|
||||
if (param_1 == 0) {
|
||||
sSpeakerInfo[chan].mIsPlaying = true;
|
||||
sSpeakerInfo[chan].field_0x22 = true;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
#endif
|
||||
memset(&sSpeakerInfo[chan].mEncInfo, 0, 0x20);
|
||||
} else if (param_1 == -3) {
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 2;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setSpeakerOff(s32 chan) {
|
||||
sSpeakerInfo[chan].mIsPlaying = false;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
#endif
|
||||
WPADControlSpeaker(chan, 0, 0);
|
||||
}
|
||||
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
void SpkSpeakerCtrl::retryConnection(s32 chan) {
|
||||
switch (sSpeakerInfo[chan].mState) {
|
||||
case 0:
|
||||
case 3:
|
||||
break;
|
||||
case 1:
|
||||
setSpeakerOn(chan);
|
||||
break;
|
||||
case 2:
|
||||
setSpeakerPlay(chan);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void SpkSpeakerCtrl::framework() {
|
||||
for (s32 i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||
retryConnection(i);
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::updateSpeaker(OSAlarm*, OSContext*) {
|
||||
for (s32 i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||
if (sMixingBuffer != NULL) {
|
||||
BOOL isBusy = FALSE;
|
||||
|
||||
if (!checkRadioSensitivity(i)) {
|
||||
isBusy = TRUE;
|
||||
}
|
||||
|
||||
if (!updateExtensionProcess(i)) {
|
||||
isBusy = TRUE;
|
||||
}
|
||||
|
||||
if (sSpeakerInfo[i].mIsMuted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool updateResult = sMixingBuffer->update(i);
|
||||
if (isBusy) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sSpeakerInfo[i].mIsPlaying) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (updateResult) {
|
||||
bool var_r28 = true;
|
||||
|
||||
if (sSpeakerInfo[i].mIsPlaying && sMixingBuffer != NULL) {
|
||||
if (sSpeakerInfo[i].field_0x22) {
|
||||
var_r28 = false;
|
||||
sSpeakerInfo[i].field_0x22 = false;
|
||||
}
|
||||
u8 data[24];
|
||||
WENCGetEncodeData(&sSpeakerInfo[i].mEncInfo, var_r28,
|
||||
sMixingBuffer->getSamples(i), 0x28, data);
|
||||
WPADSendStreamData(i, data, 0x14);
|
||||
}
|
||||
} else {
|
||||
sSpeakerInfo[i].field_0x22 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::isEnable(s32 chan) {
|
||||
return WPADIsSpeakerEnabled(chan) &&
|
||||
sSpeakerInfo[chan].mIsPlaying &&
|
||||
!isSubmitPlayByRadioSensitivity(chan) &&
|
||||
!isSubmitPlayByExtensionConnect(chan) &&
|
||||
sMixingBuffer != NULL;
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::extensionProcess(s32 chan, s32 param_1) {
|
||||
if (!sSpeakerInfo[chan].mIsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
sSpeakerInfo[chan].mExtensionTimer = 49;
|
||||
sSpeakerInfo[chan].field_0x22 = true;
|
||||
if (param_1 == 0xFF) {
|
||||
sSpeakerInfo[chan].mExtensionTimer = 50;
|
||||
}
|
||||
|
||||
if (sSpeakerInfo[chan].mIsPlaying == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSpeakerOff(chan);
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::updateExtensionProcess(s32 chan) {
|
||||
if (sSpeakerInfo[chan].mIsConnected == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sSpeakerInfo[chan].mExtensionTimer < 50) {
|
||||
if (sSpeakerInfo[chan].mExtensionTimer > 0) {
|
||||
if (sSpeakerInfo[chan].mExtensionTimer == 1 && !sSpeakerInfo[chan].mIsPlaying) {
|
||||
setSpeakerOn(chan);
|
||||
}
|
||||
|
||||
sSpeakerInfo[chan].mExtensionTimer--;
|
||||
} else {
|
||||
sSpeakerInfo[chan].mExtensionTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool retval;
|
||||
if (sSpeakerInfo[chan].mExtensionTimer == 0) {
|
||||
retval = true;
|
||||
} else {
|
||||
retval = false;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::isSubmitPlayByExtensionConnect(s32 chan) {
|
||||
if (sSpeakerInfo[chan].mExtensionTimer > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::checkRadioSensitivity(s32 chan) {
|
||||
if (sSpeakerInfo[chan].mIsConnected == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WPADGetRadioSensitivity(chan) < 60) {
|
||||
if (sSpeakerInfo[chan].mIsPlaying == 1) {
|
||||
setSpeakerOff(chan);
|
||||
}
|
||||
|
||||
sSpeakerInfo[chan].mRadioSensitivityTimer = 200;
|
||||
sSpeakerInfo[chan].field_0x22 = true;
|
||||
} else {
|
||||
if (sSpeakerInfo[chan].mRadioSensitivityTimer > 0) {
|
||||
if (sSpeakerInfo[chan].mRadioSensitivityTimer == 1) {
|
||||
if (!sSpeakerInfo[chan].mIsPlaying) {
|
||||
setSpeakerOn(chan);
|
||||
}
|
||||
}
|
||||
|
||||
sSpeakerInfo[chan].mRadioSensitivityTimer--;
|
||||
} else {
|
||||
sSpeakerInfo[chan].mRadioSensitivityTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool retval;
|
||||
if (sSpeakerInfo[chan].mRadioSensitivityTimer == 0) {
|
||||
retval = true;
|
||||
} else {
|
||||
retval = false;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::isSubmitPlayByRadioSensitivity(s32 chan) {
|
||||
if (sSpeakerInfo[chan].mRadioSensitivityTimer > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "Z2AudioCS/SpkSystem.h"
|
||||
|
||||
#include "Z2AudioCS/SpkMixingBuffer.h"
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
#include "Z2AudioCS/SpkSpeakerCtrl.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
template<> SpkSystem* JASGlobalInstance<SpkSystem>::sInstance;
|
||||
template<> SpkSoundHolder* JASGlobalInstance<SpkSoundHolder>::sInstance;
|
||||
|
||||
const static s32 cConfigVolumeMax = 15;
|
||||
|
||||
SpkSystem::SpkSystem(JKRHeap* heap) : JASGlobalInstance(true) {
|
||||
mData = NULL;
|
||||
|
||||
if (!heap) {
|
||||
heap = JKRGetCurrentHeap();
|
||||
}
|
||||
|
||||
mHeap = heap;
|
||||
mMixingBuffer = new (heap, 0) SpkMixingBuffer(heap);
|
||||
JUT_ASSERT(35, mMixingBuffer);
|
||||
mSoundHolder = new (heap, 0) SpkSoundHolder();
|
||||
JUT_ASSERT(38, mSoundHolder);
|
||||
SpkSpeakerCtrl::setup();
|
||||
SpkSpeakerCtrl::setMixingBuffer(mMixingBuffer);
|
||||
}
|
||||
|
||||
void SpkSystem::setResource(JKRArchive* resArc, u16 param_1, u16 param_2) {
|
||||
JUT_ASSERT(71, mHeap);
|
||||
JUT_ASSERT(72, resArc);
|
||||
mData = new (mHeap, 0) SpkData(resArc);
|
||||
JUT_ASSERT(75, mData);
|
||||
mData->loadTable(param_1);
|
||||
mData->loadWave(param_2);
|
||||
}
|
||||
|
||||
void SpkSystem::framework() {
|
||||
JUT_ASSERT(89, mSoundHolder);
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
SpkSpeakerCtrl::framework();
|
||||
#endif
|
||||
mSoundHolder->framework();
|
||||
}
|
||||
|
||||
void SpkSystem::startSound(s32 chan, s32 param_1, SpkSoundHandle* handle) {
|
||||
JUT_ASSERT(108, chan >= 0);
|
||||
JUT_ASSERT(109, chan < 4);
|
||||
JUT_ASSERT(110, mSoundHolder);
|
||||
mSoundHolder->startSound(chan, param_1, handle);
|
||||
}
|
||||
|
||||
void SpkSystem::startLevelSound(s32 chan, s32 param_1, SpkSoundHandle* handle) {
|
||||
JUT_ASSERT(128, chan >= 0);
|
||||
JUT_ASSERT(129, chan < 4);
|
||||
JUT_ASSERT(130, mSoundHolder);
|
||||
JUT_ASSERT(131, handle);
|
||||
mSoundHolder->startLevelSound(chan, param_1, handle);
|
||||
}
|
||||
|
||||
void SpkSystem::setMasterVolume(f32 vol) {
|
||||
JUT_ASSERT(146, mSoundHolder);
|
||||
JUT_ASSERT(147, vol >= 0.f);
|
||||
JUT_ASSERT(148, vol <= 1.f);
|
||||
mSoundHolder->setMasterVolume(vol);
|
||||
}
|
||||
|
||||
f32 SpkSystem::getMasterVolume(void) {
|
||||
return mSoundHolder->getMasterVolume();
|
||||
}
|
||||
|
||||
void SpkSystem::stopAll(s32 chan, s32 msec) {
|
||||
JUT_ASSERT(269, mSoundHolder);
|
||||
JUT_ASSERT(270, chan < 4);
|
||||
JUT_ASSERT(271, msec >= 0);
|
||||
|
||||
if (chan < 0) {
|
||||
for (s32 i = 0; i < 4; i++) {
|
||||
mSoundHolder->stopAll(i, msec);
|
||||
}
|
||||
} else {
|
||||
mSoundHolder->stopAll(chan, msec);
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSystem::setConfigVolume(s32 vol) {
|
||||
JUT_ASSERT(307, mSoundHolder);
|
||||
JUT_ASSERT(308, vol >= 0);
|
||||
JUT_ASSERT(309, vol <= cConfigVolumeMax);
|
||||
|
||||
mSoundHolder->setConfigVolume(vol);
|
||||
}
|
||||
|
||||
void SpkSystem::newSoundMemPool(s32 numOfSound) {
|
||||
JUT_ASSERT(351, numOfSound >= 0);
|
||||
JASPoolAllocObject<SpkSound>::newMemPool(numOfSound);
|
||||
}
|
||||
|
||||
void SpkSystem::connect(s32 chan) {
|
||||
SpkSpeakerCtrl::connect(chan);
|
||||
}
|
||||
|
||||
void SpkSystem::disconnect(s32 chan) {
|
||||
SpkSpeakerCtrl::disconnect(chan);
|
||||
}
|
||||
|
||||
void SpkSystem::extensionProcess(s32 chan, s32 param_1) {
|
||||
SpkSpeakerCtrl::extensionProcess(chan, param_1);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "Z2AudioCS/SpkTable.h"
|
||||
|
||||
SpkTable::SpkTable(void) {
|
||||
mIsInitialized = false;
|
||||
mNumOfSound = 0;
|
||||
mEntryOffset = 0;
|
||||
mDataOffsets = 0;
|
||||
}
|
||||
|
||||
struct SpkTableHeader {
|
||||
s32 resourceCount;
|
||||
s32 entryOff;
|
||||
s32 dataOffsetsStartOff;
|
||||
BOOL isDataOffsetsInitialized;
|
||||
};
|
||||
|
||||
void SpkTable::setResource(void* res) {
|
||||
mIsInitialized = false;
|
||||
|
||||
s32* cursor = (s32*)res;
|
||||
|
||||
s32 resourceCount = *cursor++;
|
||||
s32 entryOff = *cursor++;
|
||||
s32 dataOffsetsStartOff = *cursor++;
|
||||
s32* pIsDataOffsetsInitialized = cursor;
|
||||
BOOL isDataOffsetsInitialized = *cursor++;
|
||||
|
||||
mNumOfSound = resourceCount;
|
||||
|
||||
s32 entryOffset = (s32)res + entryOff;
|
||||
mEntryOffset = entryOffset;
|
||||
s32* dataOffsets = (s32*)((s32)res + dataOffsetsStartOff);
|
||||
if (!isDataOffsetsInitialized) {
|
||||
for (s32 i = 0; i < mNumOfSound; i++) {
|
||||
dataOffsets[i] += (s32)res;
|
||||
}
|
||||
}
|
||||
|
||||
s32* dataOffsetsCopy = dataOffsets;
|
||||
mDataOffsets = dataOffsetsCopy;
|
||||
*pIsDataOffsetsInitialized = TRUE;
|
||||
|
||||
mIsInitialized = true;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#include "Z2AudioCS/SpkWave.h"
|
||||
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/types.h>
|
||||
|
||||
SpkWave::SpkWave(void) {
|
||||
mWaveData = NULL;
|
||||
}
|
||||
|
||||
void SpkWave::setResource(void* res) {
|
||||
JUT_ASSERT(30, res);
|
||||
|
||||
JASCriticalSection cs;
|
||||
|
||||
mWaveData = res;
|
||||
}
|
||||
|
||||
s32 SpkWave::getNumOfWaves(void) const {
|
||||
if (mWaveData == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ((s32*)mWaveData)[1];
|
||||
}
|
||||
|
||||
s32 SpkWave::getWaveSize(s32 num) const {
|
||||
JUT_ASSERT(57, num >= 0);
|
||||
if (!mWaveData) {
|
||||
return 0;
|
||||
}
|
||||
JUT_ASSERT(60, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = getWaveData(num);
|
||||
JUT_ASSERT(63, data);
|
||||
return data->size;
|
||||
}
|
||||
|
||||
u32 SpkWave::getLoopStartPos(s32 num) const {
|
||||
JUT_ASSERT(76, num >= 0);
|
||||
if (!mWaveData) {
|
||||
return 0;
|
||||
}
|
||||
JUT_ASSERT(79, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = getWaveData(num);
|
||||
JUT_ASSERT(82, data);
|
||||
return data->loopStartPos;
|
||||
}
|
||||
|
||||
u32 SpkWave::getLoopEndPos(s32 num) const {
|
||||
JUT_ASSERT(95, num >= 0);
|
||||
if (!mWaveData) {
|
||||
return 0;
|
||||
}
|
||||
JUT_ASSERT(98, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = getWaveData(num);
|
||||
JUT_ASSERT(101, data);
|
||||
return data->loopEndPos;
|
||||
}
|
||||
|
||||
s16* SpkWave::getWave(s32 num) const {
|
||||
JUT_ASSERT(114, num >= 0);
|
||||
if (!mWaveData) {
|
||||
return 0;
|
||||
}
|
||||
JUT_ASSERT(117, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = getWaveData(num);
|
||||
JUT_ASSERT(120, data);
|
||||
return data->wave;
|
||||
}
|
||||
|
||||
WaveData* SpkWave::getWaveData(s32 num) const {
|
||||
JUT_ASSERT(138, num >= 0);
|
||||
JUT_ASSERT(139, mWaveData);
|
||||
JUT_ASSERT(140, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = (WaveData*)((u32)mWaveData + *(u32*)((u32)mWaveData + num * 4 + 8));
|
||||
return data;
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
|
||||
#include "Z2AudioCS/SpkSystem.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <revolution/types.h>
|
||||
#include <revolution/wpad.h>
|
||||
|
||||
#define HANDLES_MAX 0x30
|
||||
|
||||
static SpkSoundHandle* sSpkHandles;
|
||||
|
||||
static u8 l_spkVolume;
|
||||
|
||||
void Z2AudioCS::newSpkSoundMemPool() {
|
||||
SpkSystem::newSoundMemPool(HANDLES_MAX);
|
||||
}
|
||||
|
||||
int Z2AudioCS::init(JKRHeap* heap, JKRArchive* res, s32 param_2, s32 param_3) {
|
||||
JUT_ASSERT(59, heap);
|
||||
JUT_ASSERT(60, res);
|
||||
SpkSystem* spkSys = new(heap, 0) SpkSystem(heap);
|
||||
JUT_ASSERT(67, spkSys);
|
||||
|
||||
sSpkHandles = new (heap, 0) SpkSoundHandle[HANDLES_MAX];
|
||||
JUT_ASSERT(71, sSpkHandles);
|
||||
|
||||
spkSys->setResource(res, 2, 3);
|
||||
spkSys->setMasterVolume(1.0f);
|
||||
spkSys->setConfigVolume(15);
|
||||
}
|
||||
|
||||
void Z2AudioCS::update() {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() != NULL) {
|
||||
JASGlobalInstance<SpkSystem>::getInstance()->framework();
|
||||
}
|
||||
}
|
||||
|
||||
void Z2AudioCS::connect(s32 chan) {
|
||||
SpkSystem::connect(chan);
|
||||
l_spkVolume = WPADGetSpeakerVolume();
|
||||
}
|
||||
|
||||
void Z2AudioCS::disconnect(s32 chan) {
|
||||
SpkSystem::disconnect(chan);
|
||||
}
|
||||
|
||||
void Z2AudioCS::extensionProcess(s32 chan, s32 param_1) {
|
||||
SpkSystem::extensionProcess(chan, param_1);
|
||||
}
|
||||
|
||||
static SpkSoundHandle* getFreeSpkHandle(void) {
|
||||
JUT_ASSERT(125, JASGlobalInstance<SpkSystem>::getInstance());
|
||||
JUT_ASSERT(126, sSpkHandles);
|
||||
|
||||
SpkSoundHandle* highestPriorityHandle = NULL;
|
||||
s32 highestPriority = 255;
|
||||
for (s32 i = 0; i < HANDLES_MAX; i++) {
|
||||
if (!sSpkHandles[i].isSoundAttached()) {
|
||||
return &sSpkHandles[i];
|
||||
}
|
||||
|
||||
if (sSpkHandles[i]->getPriority() < highestPriority) {
|
||||
highestPriorityHandle = &sSpkHandles[i];
|
||||
highestPriority = sSpkHandles[i]->getPriority();
|
||||
}
|
||||
}
|
||||
|
||||
return highestPriorityHandle;
|
||||
}
|
||||
|
||||
SpkSoundHandle* Z2AudioCS::getHandleSoundID(s32 soundNum) {
|
||||
JUT_ASSERT(145, JASGlobalInstance<SpkSystem>::getInstance());
|
||||
JUT_ASSERT(146, sSpkHandles);
|
||||
|
||||
for (s32 i = 0; i < HANDLES_MAX; i++) {
|
||||
if (!sSpkHandles[i].isSoundAttached()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sSpkHandles[i]->getSoundNum() == soundNum) {
|
||||
return &sSpkHandles[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SpkSoundHandle* Z2AudioCS::start(s32 id, s32 chan) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (sSpkHandles == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (l_spkVolume == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OS_REPORT("[Z2AudioCS::start] id:%d ch:%d\n", id, chan);
|
||||
SpkSoundHandle* handle = getFreeSpkHandle();
|
||||
JUT_ASSERT(172, handle);
|
||||
|
||||
JASGlobalInstance<SpkSystem>::getInstance()->startSound(chan, id, handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
SpkSoundHandle* Z2AudioCS::startLevel(s32 id, s32 chan) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (sSpkHandles == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (l_spkVolume == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OS_REPORT("[Z2AudioCS::startLevel] id:%d ch:%d\n", id, chan);
|
||||
|
||||
SpkSoundHandle* handle = getHandleSoundID(id);
|
||||
if (handle == NULL) {
|
||||
handle = getFreeSpkHandle();
|
||||
}
|
||||
JUT_ASSERT(191, handle);
|
||||
|
||||
JASGlobalInstance<SpkSystem>::getInstance()->startLevelSound(chan, id, handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
s32 Z2AudioCS::getName(s32 num) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance()->getData() == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return JASGlobalInstance<SpkSystem>::getInstance()->getData()->getTableMgr().getName(num);
|
||||
}
|
||||
|
||||
s32 Z2AudioCS::getNumOfSound(void) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance()->getData() == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return JASGlobalInstance<SpkSystem>::getInstance()->getData()->getTableMgr().getNumOfSound();
|
||||
}
|
||||
|
||||
void Z2AudioCS::stopAll(s32 chan, s32 msec) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
JASGlobalInstance<SpkSystem>::getInstance()->stopAll(chan, msec);
|
||||
}
|
||||
|
||||
void Z2AudioCS::stop(s32 chan) {
|
||||
stopAll(chan, 0);
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "Z2AudioLib/Z2SoundHandles.h"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
Z2AudioMgr* Z2AudioMgr::mAudioMgrPtr;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
void Z2CreatureLink::setLinkGroupInfo(u8) {}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
static void dummy() {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
Z2SoundObjBase::Z2SoundObjBase()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "d/d_home_button.h"
|
||||
#include "JSystem/JFramework/JFWDisplay.h"
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#include "Z2AudioLib/Z2AudioMgr.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "m_Do/m_Do_Reset.h"
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#include "JSystem/JKernel/JKRMemArchive.h"
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_debug_viewer.h"
|
||||
#include "m_Do/m_Do_Reset.h"
|
||||
#include "m_Do/m_Do_dvd_thread.h"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#include <revolution/sc.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "SSystem/SComponent/c_lib.h"
|
||||
#include "SSystem/SComponent/c_m3d.h"
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#include "d/actor/d_a_player.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "m_Do/m_Do_Reset.h"
|
||||
|
||||
Reference in New Issue
Block a user