mirror of
https://github.com/zeldaret/ss
synced 2026-07-09 06:13:17 -04:00
Merge remote-tracking branch 'upstream/main' into blurpalette_mgr
This commit is contained in:
@@ -2,18 +2,18 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
|
||||
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
|
||||
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
|
||||
dAcOblade_c_classInit__Fv = .text:0x00000070; // type:function size:0x90
|
||||
fn_382_100 = .text:0x00000100; // type:function size:0x98
|
||||
fn_382_1A0 = .text:0x000001A0; // type:function size:0xC4
|
||||
fn_382_270 = .text:0x00000270; // type:function size:0x8
|
||||
fn_382_280 = .text:0x00000280; // type:function size:0x30
|
||||
fn_382_2B0 = .text:0x000002B0; // type:function size:0x28
|
||||
createHeap__11dAcOblade_cFv = .text:0x00000100; // type:function size:0x98
|
||||
create__11dAcOblade_cFv = .text:0x000001A0; // type:function size:0xC4
|
||||
doDelete__11dAcOblade_cFv = .text:0x00000270; // type:function size:0x8
|
||||
actorExecute__11dAcOblade_cFv = .text:0x00000280; // type:function size:0x30
|
||||
draw__11dAcOblade_cFv = .text:0x000002B0; // type:function size:0x28
|
||||
__dt__11dAcOblade_cFv = .text:0x000002E0; // type:function size:0x68
|
||||
_ctors = .ctors:0x00000000; // type:label scope:global
|
||||
_dtors = .dtors:0x00000000; // type:label scope:global
|
||||
lbl_382_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float
|
||||
lbl_382_rodata_4 = .rodata:0x00000004; // type:object size:0x4 align:4 data:float
|
||||
lbl_382_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float
|
||||
lbl_382_rodata_4 = .rodata:0x00000004; // type:object size:0x4 scope:local align:4 data:float
|
||||
g_profile_OBJ_BLADE = .data:0x00000000; // type:object size:0x10
|
||||
lbl_382_data_10 = .data:0x00000010; // type:object size:0x10 data:string
|
||||
lbl_382_data_20 = .data:0x00000020; // type:object size:0x10
|
||||
lbl_382_data_30 = .data:0x00000030; // type:object size:0x20
|
||||
lbl_382_data_50 = .data:0x00000050; // type:object size:0x80
|
||||
lbl_382_data_10 = .data:0x00000010; // type:object size:0x10 scope:local data:string
|
||||
lbl_382_data_20 = .data:0x00000020; // type:object size:0x10 scope:local
|
||||
lbl_382_data_30 = .data:0x00000030; // type:object size:0x20 scope:local
|
||||
__vt__11dAcOblade_c = .data:0x00000050; // type:object size:0x80
|
||||
|
||||
@@ -2,20 +2,20 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
|
||||
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
|
||||
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
|
||||
dAcOdistantShip_c_classInit__Fv = .text:0x00000070; // type:function size:0x5C
|
||||
AcOdistantShip__initModels = .text:0x000000D0; // type:function size:0x90
|
||||
AcOdistantShip__init = .text:0x00000160; // type:function size:0x100
|
||||
fn_616_260 = .text:0x00000260; // type:function size:0x8
|
||||
fn_616_270 = .text:0x00000270; // type:function size:0x8
|
||||
AcOdistantShip__draw = .text:0x00000280; // type:function size:0x34
|
||||
AcOdistantShip__getModelName = .text:0x000002C0; // type:function size:0x38
|
||||
createHeap__17dAcOdistantShip_cFv = .text:0x000000D0; // type:function size:0x90
|
||||
create__17dAcOdistantShip_cFv = .text:0x00000160; // type:function size:0x100
|
||||
doDelete__17dAcOdistantShip_cFv = .text:0x00000260; // type:function size:0x8
|
||||
actorExecute__17dAcOdistantShip_cFv = .text:0x00000270; // type:function size:0x8
|
||||
draw__17dAcOdistantShip_cFv = .text:0x00000280; // type:function size:0x34
|
||||
getModelName__17dAcOdistantShip_cFv = .text:0x000002C0; // type:function size:0x38
|
||||
__dt__17dAcOdistantShip_cFv = .text:0x00000300; // type:function size:0x68
|
||||
_ctors = .ctors:0x00000000; // type:label scope:global
|
||||
_dtors = .dtors:0x00000000; // type:label scope:global
|
||||
lbl_616_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float
|
||||
lbl_616_rodata_4 = .rodata:0x00000004; // type:object size:0x4 align:4 data:float
|
||||
lbl_616_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float
|
||||
lbl_616_rodata_4 = .rodata:0x00000004; // type:object size:0x4 scope:local align:4 data:float
|
||||
g_profile_OBJ_DIS_SHIP = .data:0x00000000; // type:object size:0x10
|
||||
lbl_616_data_10 = .data:0x00000010; // type:object size:0x10 data:string
|
||||
lbl_616_data_20 = .data:0x00000020; // type:object size:0x20
|
||||
lbl_616_data_40 = .data:0x00000040; // type:object size:0x10
|
||||
lbl_616_data_50 = .data:0x00000050; // type:object size:0x18
|
||||
AcOdistantShip__vtable = .data:0x00000068; // type:object size:0x80
|
||||
lbl_616_data_10 = .data:0x00000010; // type:object size:0x10 scope:local data:string
|
||||
lbl_616_data_20 = .data:0x00000020; // type:object size:0x20 scope:local
|
||||
lbl_616_data_40 = .data:0x00000040; // type:object size:0x10 scope:local
|
||||
lbl_616_data_50 = .data:0x00000050; // type:object size:0x18 scope:local
|
||||
__vt__17dAcOdistantShip_c = .data:0x00000068; // type:object size:0x80
|
||||
|
||||
@@ -8,13 +8,13 @@ __dt__27sFState_c<14dAcOimpaDoor_c>Fv = .text:0x000001B0; // type:function size:
|
||||
__dt__30sFStateFct_c<14dAcOimpaDoor_c>Fv = .text:0x00000210; // type:function size:0x6C
|
||||
__dt__83sStateMgr_c<14dAcOimpaDoor_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000280; // type:function size:0xA0
|
||||
__dt__53sFStateMgr_c<14dAcOimpaDoor_c,20sStateMethodUsr_FI_c>Fv = .text:0x00000320; // type:function size:0xA4
|
||||
fn_421_3D0 = .text:0x000003D0; // type:function size:0x88
|
||||
fn_421_460 = .text:0x00000460; // type:function size:0xE8
|
||||
createHeap__14dAcOimpaDoor_cFv = .text:0x000003D0; // type:function size:0x88
|
||||
create__14dAcOimpaDoor_cFv = .text:0x00000460; // type:function size:0xE8
|
||||
changeState__83sStateMgr_c<14dAcOimpaDoor_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x00000550; // type:function size:0x10
|
||||
fn_421_560 = .text:0x00000560; // type:function size:0x8
|
||||
fn_421_570 = .text:0x00000570; // type:function size:0x30
|
||||
doDelete__14dAcOimpaDoor_cFv = .text:0x00000560; // type:function size:0x8
|
||||
actorExecute__14dAcOimpaDoor_cFv = .text:0x00000570; // type:function size:0x30
|
||||
executeState__83sStateMgr_c<14dAcOimpaDoor_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000005A0; // type:function size:0x10
|
||||
fn_421_5B0 = .text:0x000005B0; // type:function size:0x28
|
||||
draw__14dAcOimpaDoor_cFv = .text:0x000005B0; // type:function size:0x28
|
||||
initializeState_Wait__14dAcOimpaDoor_cFv = .text:0x000005E0; // type:function size:0x4
|
||||
executeState_Wait__14dAcOimpaDoor_cFv = .text:0x000005F0; // type:function size:0x4
|
||||
finalizeState_Wait__14dAcOimpaDoor_cFv = .text:0x00000600; // type:function size:0x4
|
||||
@@ -40,11 +40,11 @@ isSameName__29sFStateID_c<14dAcOimpaDoor_c>CFPCc = .text:0x00000A20; // type:fun
|
||||
_ctors = .ctors:0x00000000; // type:label scope:global
|
||||
_dtors = .dtors:0x00000000; // type:label scope:global
|
||||
__destroy_global_chain_reference = .dtors:0x00000000; // type:object size:0x4 scope:global
|
||||
lbl_421_rodata_0 = .rodata:0x00000000; // type:object size:0x18 data:float
|
||||
lbl_421_rodata_0 = .rodata:0x00000000; // type:object size:0x18 scope:local data:float
|
||||
g_profile_OBJ_IMPA_DOOR = .data:0x00000000; // type:object size:0x10 data:4byte
|
||||
lbl_421_data_10 = .data:0x00000010; // type:object size:0x8
|
||||
lbl_421_data_18 = .data:0x00000018; // type:object size:0x10 data:string
|
||||
lbl_421_data_28 = .data:0x00000028; // type:object size:0x20
|
||||
lbl_421_data_10 = .data:0x00000010; // type:object size:0x8 scope:local
|
||||
lbl_421_data_18 = .data:0x00000018; // type:object size:0x10 scope:local data:string
|
||||
lbl_421_data_28 = .data:0x00000028; // type:object size:0x20 scope:local
|
||||
lbl_421_data_48 = .data:0x00000048; // type:object size:0x80
|
||||
lbl_421_data_C8 = .data:0x000000C8; // type:object size:0x30
|
||||
lbl_421_data_F8 = .data:0x000000F8; // type:object size:0x30
|
||||
@@ -52,5 +52,5 @@ lbl_421_data_128 = .data:0x00000128; // type:object size:0x18
|
||||
lbl_421_data_140 = .data:0x00000140; // type:object size:0x5C
|
||||
lbl_421_data_19C = .data:0x0000019C; // type:object size:0x34
|
||||
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
|
||||
lbl_421_bss_8 = .bss:0x00000008; // type:object size:0x10
|
||||
lbl_421_bss_18 = .bss:0x00000018; // type:object size:0x30 data:4byte
|
||||
lbl_421_bss_8 = .bss:0x00000008; // type:object size:0x10 scope:local
|
||||
lbl_421_bss_18 = .bss:0x00000018; // type:object size:0x30 scope:local data:4byte
|
||||
|
||||
@@ -2,15 +2,15 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
|
||||
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
|
||||
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
|
||||
dAcOmoleCover_c_classInit__Fv = .text:0x00000070; // type:function size:0x64
|
||||
AcOmoleCover__initModels = .text:0x000000E0; // type:function size:0x110
|
||||
AcOmoleCover__init = .text:0x000001F0; // type:function size:0xD0
|
||||
fn_424_2C0 = .text:0x000002C0; // type:function size:0x8
|
||||
fn_424_2D0 = .text:0x000002D0; // type:function size:0x8
|
||||
AcOmoleCover__draw = .text:0x000002E0; // type:function size:0x28
|
||||
createHeap__15dAcOmoleCover_cFv = .text:0x000000E0; // type:function size:0x110
|
||||
create__15dAcOmoleCover_cFv = .text:0x000001F0; // type:function size:0xD0
|
||||
doDelete__15dAcOmoleCover_cFv = .text:0x000002C0; // type:function size:0x8
|
||||
actorExecute__15dAcOmoleCover_cFv = .text:0x000002D0; // type:function size:0x8
|
||||
draw__15dAcOmoleCover_cFv = .text:0x000002E0; // type:function size:0x28
|
||||
__dt__15dAcOmoleCover_cFv = .text:0x00000310; // type:function size:0x74
|
||||
_ctors = .ctors:0x00000000; // type:label scope:global
|
||||
_dtors = .dtors:0x00000000; // type:label scope:global
|
||||
lbl_424_rodata_0 = .rodata:0x00000000; // type:object size:0x1C data:float
|
||||
lbl_424_rodata_0 = .rodata:0x00000000; // type:object size:0x1C scope:local data:float
|
||||
g_profile_OBJ_MOLE_COVER = .data:0x00000000; // type:object size:0x6C
|
||||
lbl_424_data_6C = .data:0x0000006C; // type:object size:0x24
|
||||
AcOmoleCover__vtable = .data:0x00000090; // type:object size:0x80
|
||||
lbl_424_data_6C = .data:0x0000006C; // type:object size:0x24 scope:local
|
||||
__vt__15dAcOmoleCover_c = .data:0x00000090; // type:object size:0x80
|
||||
|
||||
@@ -2,15 +2,15 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
|
||||
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
|
||||
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
|
||||
dAcOropeBase_c_classInit__Fv = .text:0x00000070; // type:function size:0x5C
|
||||
fn_431_D0 = .text:0x000000D0; // type:function size:0xD0
|
||||
fn_431_1A0 = .text:0x000001A0; // type:function size:0xBC
|
||||
fn_431_260 = .text:0x00000260; // type:function size:0x8
|
||||
fn_431_270 = .text:0x00000270; // type:function size:0x28
|
||||
fn_431_2A0 = .text:0x000002A0; // type:function size:0x28
|
||||
createHeap__14dAcOropeBase_cFv = .text:0x000000D0; // type:function size:0xD0
|
||||
create__14dAcOropeBase_cFv = .text:0x000001A0; // type:function size:0xBC
|
||||
doDelete__14dAcOropeBase_cFv = .text:0x00000260; // type:function size:0x8
|
||||
actorExecute__14dAcOropeBase_cFv = .text:0x00000270; // type:function size:0x28
|
||||
draw__14dAcOropeBase_cFv = .text:0x000002A0; // type:function size:0x28
|
||||
__dt__14dAcOropeBase_cFv = .text:0x000002D0; // type:function size:0x68
|
||||
_ctors = .ctors:0x00000000; // type:label scope:global
|
||||
_dtors = .dtors:0x00000000; // type:label scope:global
|
||||
lbl_431_rodata_0 = .rodata:0x00000000; // type:object size:0x18 data:float
|
||||
lbl_431_rodata_0 = .rodata:0x00000000; // type:object size:0x18 scope:local data:float
|
||||
g_profile_OBJ_ROPE_BASE = .data:0x00000000; // type:object size:0x38
|
||||
lbl_431_data_38 = .data:0x00000038; // type:object size:0x20
|
||||
lbl_431_data_58 = .data:0x00000058; // type:object size:0x80
|
||||
lbl_431_data_38 = .data:0x00000038; // type:object size:0x20 scope:local
|
||||
__vt__14dAcOropeBase_c = .data:0x00000058; // type:object size:0x80
|
||||
|
||||
+113
-5
@@ -361,8 +361,10 @@ toBeSorted/arc_managers/layout_arc_manager.cpp:
|
||||
toBeSorted/arc_managers/layout_arc_control.cpp:
|
||||
.text start:0x8006A2E0 end:0x8006A544 align:16
|
||||
|
||||
toBeSorted/base_tables.cpp:
|
||||
toBeSorted/actor_info.cpp:
|
||||
.text start:0x8006A550 end:0x8006A8C8 align:16
|
||||
.rodata start:0x804E0FA8 end:0x804E3418
|
||||
.sdata2 start:0x805779F8 end:0x80579210
|
||||
|
||||
toBeSorted/unk_vec_math.cpp:
|
||||
.text start:0x8006A8D0 end:0x8006B3A4 align:16
|
||||
@@ -2867,6 +2869,9 @@ nw4r/g3d/g3d_scnmdl.cpp:
|
||||
.rodata start:0x804F7B48 end:0x804F7B58
|
||||
.data start:0x8056DA70 end:0x8056DAB8
|
||||
|
||||
nw4r/g3d/g3d_scnmdl1mat1shp.cpp:
|
||||
.rodata start:0x804F7B58 end:0x804F7B70
|
||||
|
||||
nw4r/g3d/g3d_calcmaterial.cpp:
|
||||
.text start:0x8045FDB0 end:0x8045FFE4 align:16
|
||||
|
||||
@@ -2894,48 +2899,77 @@ nw4r/g3d/g3d_calcvtx.cpp:
|
||||
.sdata2 start:0x8057EEF0 end:0x8057EEF8
|
||||
|
||||
nw4r/snd/snd_AnimSound.cpp:
|
||||
.text start:0x80461700 end:0x804630D4 align:16
|
||||
.text start:0x80461700 end:0x80462F18 align:16
|
||||
.sdata2 start:0x8057EEF8 end:0x8057EF18
|
||||
|
||||
nw4r/snd/snd_AnimSoundReader.cpp:
|
||||
.text start:0x80462F20 end:0x804630D4 align:16
|
||||
|
||||
nw4r/snd/snd_AxManager.cpp:
|
||||
.text start:0x804630E0 end:0x80464880 align:16
|
||||
.ctors start:0x804DB958 end:0x804DB95C
|
||||
.sbss start:0x80576650 end:0x80576668
|
||||
.sdata2 start:0x8057EF18 end:0x8057EF30
|
||||
.bss start:0x80658F80 end:0x80659390
|
||||
|
||||
nw4r/snd/snd_AxVoice.cpp:
|
||||
.text start:0x80464880 end:0x80467634 align:16
|
||||
.sdata2 start:0x8057EF30 end:0x8057EF58
|
||||
|
||||
nw4r/snd/snd_AxVoiceManager.cpp:
|
||||
.text start:0x80467640 end:0x80467DC8 align:16
|
||||
.sbss start:0x80576668 end:0x80576670
|
||||
.bss start:0x80659390 end:0x806593C8
|
||||
|
||||
nw4r/snd/snd_AxfxImpl.cpp:
|
||||
.text start:0x80467DD0 end:0x80467FC8 align:16
|
||||
.sbss start:0x80576670 end:0x80576678
|
||||
|
||||
nw4r/snd/snd_Bank.cpp:
|
||||
.text start:0x80467FD0 end:0x80468248 align:16
|
||||
.sdata2 start:0x8057EF58 end:0x8057EF78
|
||||
|
||||
nw4r/snd/snd_BankFile.cpp:
|
||||
.text start:0x80468250 end:0x8046890C align:16
|
||||
.sdata2 start:0x8057EF78 end:0x8057EF80
|
||||
|
||||
nw4r/snd/snd_BasicPlayer.cpp:
|
||||
.text start:0x80468910 end:0x80468B50 align:16
|
||||
.data start:0x8056DB38 end:0x8056DB60
|
||||
.sdata2 start:0x8057EF80 end:0x8057EF88
|
||||
|
||||
nw4r/snd/snd_BasicSound.cpp:
|
||||
.text start:0x80468B50 end:0x8046A36C align:16
|
||||
.ctors start:0x804DB95C end:0x804DB960
|
||||
.data start:0x8056DB60 end:0x8056DB98
|
||||
.sbss start:0x80576678 end:0x80576680
|
||||
.sdata2 start:0x8057EF88 end:0x8057EF98
|
||||
|
||||
nw4r/snd/snd_BiquadFilterPreset.cpp:
|
||||
.text start:0x8046A370 end:0x8046A7B0 align:16
|
||||
.rodata start:0x804F7B80 end:0x804F8FB8
|
||||
.data start:0x8056DB98 end:0x8056DBE8
|
||||
.sdata2 start:0x8057EF98 end:0x8057EFA8
|
||||
|
||||
nw4r/snd/snd_Channel.cpp:
|
||||
.text start:0x8046A7B0 end:0x8046B7C8 align:16
|
||||
.sbss start:0x80576680 end:0x80576688
|
||||
.sdata2 start:0x8057EFA8 end:0x8057EFD0
|
||||
.bss start:0x806593C8 end:0x806593F8
|
||||
|
||||
nw4r/snd/snd_DisposeCallbackManager.cpp:
|
||||
.text start:0x8046B7D0 end:0x8046BB5C align:16
|
||||
.sbss start:0x80576688 end:0x80576690
|
||||
.bss start:0x806593F8 end:0x80659410
|
||||
|
||||
nw4r/snd/snd_DvdSoundArchive.cpp:
|
||||
.text start:0x8046BB60 end:0x8046C1C8 align:16
|
||||
.data start:0x8056DBE8 end:0x8056DC70
|
||||
|
||||
nw4r/snd/snd_EnvGenerator.cpp:
|
||||
.text start:0x8046C1D0 end:0x8046C5A0 align:16
|
||||
.rodata start:0x804F8FB8 end:0x804F92B8
|
||||
.sdata2 start:0x8057EFD0 end:0x8057F000
|
||||
|
||||
nw4r/snd/snd_ExternalSoundPlayer.cpp:
|
||||
.text start:0x8046C5A0 end:0x8046CB18 align:16
|
||||
@@ -2945,77 +2979,114 @@ nw4r/snd/snd_FrameHeap.cpp:
|
||||
|
||||
nw4r/snd/snd_FxReverbStdDpl2.cpp:
|
||||
.text start:0x8046D2E0 end:0x8046DA10 align:16
|
||||
.data start:0x8056DC70 end:0x8056DC98
|
||||
.sdata2 start:0x8057F000 end:0x8057F018
|
||||
|
||||
nw4r/snd/snd_InstancePool.cpp:
|
||||
.text start:0x8046DA10 end:0x8046DCF8 align:16
|
||||
|
||||
nw4r/snd/snd_Lfo.cpp:
|
||||
.text start:0x8046DD00 end:0x8046DF08 align:16
|
||||
.rodata start:0x804F92B8 end:0x804F92E0
|
||||
.sdata2 start:0x8057F018 end:0x8057F048
|
||||
|
||||
nw4r/snd/snd_MemorySoundArchive.cpp:
|
||||
.text start:0x8046DF10 end:0x8046E3B0 align:16
|
||||
.data start:0x8056DC98 end:0x8056DD18
|
||||
|
||||
nw4r/snd/snd_MidiSeqPlayer.cpp:
|
||||
.text start:0x8046E3B0 end:0x8046E458 align:16
|
||||
|
||||
nw4r/snd/snd_MmlParser.cpp:
|
||||
.text start:0x8046E460 end:0x8046F63C align:16
|
||||
.data start:0x8056DD18 end:0x8056DF48
|
||||
.sdata start:0x80574E90 end:0x80574EA0
|
||||
.sbss start:0x80576690 end:0x80576698
|
||||
.sdata2 start:0x8057F048 end:0x8057F068
|
||||
|
||||
nw4r/snd/snd_MmlSeqTrack.cpp:
|
||||
.text start:0x8046F640 end:0x8046F6F8 align:16
|
||||
.data start:0x8056DF48 end:0x8056DF58
|
||||
|
||||
nw4r/snd/snd_MmlSeqTrackAllocator.cpp:
|
||||
.text start:0x8046F700 end:0x8046F850 align:16
|
||||
.data start:0x8056DF58 end:0x8056DF70
|
||||
|
||||
nw4r/snd/snd_NandSoundArchive.cpp:
|
||||
.text start:0x8046F850 end:0x804700B8 align:16
|
||||
.data start:0x8056DF70 end:0x8056DFF0
|
||||
.sbss start:0x80576698 end:0x805766A0
|
||||
|
||||
nw4r/snd/snd_PlayerHeap.cpp:
|
||||
.text start:0x804700C0 end:0x804702DC align:16
|
||||
.data start:0x8056DFF0 end:0x8056E000
|
||||
|
||||
nw4r/snd/snd_RemoteSpeaker.cpp:
|
||||
.text start:0x804702E0 end:0x80470C90 align:16
|
||||
|
||||
nw4r/snd/snd_RemoteSpeakerManager.cpp:
|
||||
.text start:0x80470C90 end:0x80470ED8 align:16
|
||||
.sbss start:0x805766A0 end:0x805766A8
|
||||
.bss start:0x80659410 end:0x806596E8
|
||||
|
||||
nw4r/snd/snd_SeqFile.cpp:
|
||||
.text start:0x80470EE0 end:0x80471018 align:16
|
||||
|
||||
nw4r/snd/snd_SeqPlayer.cpp:
|
||||
.text start:0x80471020 end:0x804727F8 align:16
|
||||
.data start:0x8056E000 end:0x8056E088
|
||||
.sdata2 start:0x8057F068 end:0x8057F080
|
||||
.bss start:0x806596E8 end:0x80659708
|
||||
|
||||
nw4r/snd/snd_SeqSound.cpp:
|
||||
.text start:0x80472800 end:0x8047316C align:16
|
||||
.ctors start:0x804DB960 end:0x804DB964
|
||||
.data start:0x8056E088 end:0x8056E0D8
|
||||
.sbss start:0x805766A8 end:0x805766B0
|
||||
|
||||
nw4r/snd/snd_SeqSoundHandle.cpp:
|
||||
.text start:0x80473170 end:0x804732A8 align:16
|
||||
|
||||
nw4r/snd/snd_SeqTrack.cpp:
|
||||
.text start:0x804732B0 end:0x80474818 align:16
|
||||
.rodata start:0x804F92E0 end:0x804F9308
|
||||
.data start:0x8056E0D8 end:0x8056E0E8
|
||||
.sdata2 start:0x8057F080 end:0x8057F0B0
|
||||
|
||||
nw4r/snd/snd_Sound3DActor.cpp:
|
||||
.text start:0x80474820 end:0x80474BD8 align:16
|
||||
.rodata start:0x804F9308 end:0x804F9320
|
||||
.data start:0x8056E0E8 end:0x8056E118
|
||||
.sdata2 start:0x8057F0B0 end:0x8057F0B8
|
||||
|
||||
nw4r/snd/snd_Sound3DCalculator.cpp:
|
||||
.text start:0x80474BE0 end:0x804756B0 align:16
|
||||
.sdata2 start:0x8057F0B8 end:0x8057F100
|
||||
|
||||
nw4r/snd/snd_Sound3DEngine.cpp:
|
||||
.text start:0x804756B0 end:0x804759F8 align:16
|
||||
.data start:0x8056E118 end:0x8056E138
|
||||
.sdata2 start:0x8057F100 end:0x8057F118
|
||||
|
||||
nw4r/snd/snd_Sound3DListener.cpp:
|
||||
.text start:0x80475A00 end:0x80475C88 align:16
|
||||
.sdata2 start:0x8057F118 end:0x8057F128
|
||||
|
||||
nw4r/snd/snd_Sound3DManager.cpp:
|
||||
.text start:0x80475C90 end:0x80475F78 align:16
|
||||
.ctors start:0x804DB964 end:0x804DB968
|
||||
.data start:0x8056E138 end:0x8056E170
|
||||
.sdata2 start:0x8057F128 end:0x8057F130
|
||||
.bss start:0x80659708 end:0x80659720
|
||||
|
||||
nw4r/snd/snd_SoundActor.cpp:
|
||||
.text start:0x80475F80 end:0x80476264 align:16
|
||||
.text start:0x80475F80 end:0x80476278 align:16
|
||||
.data start:0x8056E170 end:0x8056E190
|
||||
.sdata2 start:0x8057F130 end:0x8057F138
|
||||
|
||||
nw4r/snd/snd_SoundArchive.cpp:
|
||||
.text start:0x80476270 end:0x8047697C align:16
|
||||
.text start:0x80476280 end:0x8047697C align:16
|
||||
.data start:0x8056E190 end:0x8056E1B0
|
||||
|
||||
nw4r/snd/snd_SoundArchiveFile.cpp:
|
||||
.text start:0x80476980 end:0x80477C90 align:16
|
||||
@@ -3025,15 +3096,21 @@ nw4r/snd/snd_SoundArchiveLoader.cpp:
|
||||
|
||||
nw4r/snd/snd_SoundArchivePlayer.cpp:
|
||||
.text start:0x80478560 end:0x8047B018 align:16
|
||||
.data start:0x8056E1B0 end:0x8056E200
|
||||
.sdata2 start:0x8057F138 end:0x8057F148
|
||||
|
||||
nw4r/snd/snd_SoundHandle.cpp:
|
||||
.text start:0x8047B020 end:0x8047B110 align:16
|
||||
|
||||
nw4r/snd/snd_SoundHeap.cpp:
|
||||
.text start:0x8047B110 end:0x8047B418 align:16
|
||||
.data start:0x8056E200 end:0x8056E210
|
||||
|
||||
nw4r/snd/snd_SoundPlayer.cpp:
|
||||
.text start:0x8047B420 end:0x8047C050 align:16
|
||||
.sbss start:0x805766B0 end:0x805766B8
|
||||
.sdata2 start:0x8057F148 end:0x8057F150
|
||||
.bss start:0x80659720 end:0x80659D40
|
||||
|
||||
nw4r/snd/snd_SoundStartable.cpp:
|
||||
.text start:0x8047C050 end:0x8047C3AC align:16
|
||||
@@ -3041,9 +3118,15 @@ nw4r/snd/snd_SoundStartable.cpp:
|
||||
nw4r/snd/snd_SoundSystem.cpp:
|
||||
.text start:0x8047C3B0 end:0x8047C708 align:16
|
||||
.ctors start:0x804DB968 end:0x804DB96C
|
||||
.data start:0x8056E210 end:0x8056E258
|
||||
.sdata start:0x80574EA0 end:0x80574EA8
|
||||
.sbss start:0x805766B8 end:0x805766C0
|
||||
.bss start:0x80659D40 end:0x8066F660
|
||||
|
||||
nw4r/snd/snd_SoundThread.cpp:
|
||||
.text start:0x8047C710 end:0x8047CD10 align:16
|
||||
.sbss start:0x805766C0 end:0x805766C8
|
||||
.bss start:0x8066F660 end:0x8066FA20
|
||||
|
||||
nw4r/snd/snd_StrmChannel.cpp:
|
||||
.text start:0x8047CD10 end:0x8047CF50 align:16
|
||||
@@ -3053,10 +3136,17 @@ nw4r/snd/snd_StrmFile.cpp:
|
||||
|
||||
nw4r/snd/snd_StrmPlayer.cpp:
|
||||
.text start:0x8047D8E0 end:0x80480588 align:16
|
||||
.data start:0x8056E258 end:0x8056E2D0
|
||||
.sbss start:0x805766C8 end:0x805766D0
|
||||
.sdata2 start:0x8057F150 end:0x8057F178
|
||||
.bss start:0x8066FA20 end:0x80673A38
|
||||
|
||||
nw4r/snd/snd_StrmSound.cpp:
|
||||
.text start:0x80480590 end:0x80480D8C align:16
|
||||
.ctors start:0x804DB96C end:0x804DB970
|
||||
.data start:0x8056E2D0 end:0x8056E308
|
||||
.sbss start:0x805766D0 end:0x805766D8
|
||||
.sdata2 start:0x8057F178 end:0x8057F188
|
||||
|
||||
nw4r/snd/snd_StrmSoundHandle.cpp:
|
||||
.text start:0x80480D90 end:0x80480EC8 align:16
|
||||
@@ -3066,34 +3156,52 @@ nw4r/snd/snd_Task.cpp:
|
||||
|
||||
nw4r/snd/snd_TaskManager.cpp:
|
||||
.text start:0x80480F10 end:0x804815D0 align:16
|
||||
.sbss start:0x805766D8 end:0x805766E0
|
||||
.bss start:0x80673A38 end:0x80673A80
|
||||
|
||||
nw4r/snd/snd_TaskThread.cpp:
|
||||
.text start:0x804815D0 end:0x80481798 align:16
|
||||
|
||||
nw4r/snd/snd_Voice.cpp:
|
||||
.text start:0x804817A0 end:0x80484034 align:16
|
||||
.data start:0x8056E308 end:0x8056E340
|
||||
.sdata2 start:0x8057F188 end:0x8057F1C0
|
||||
|
||||
nw4r/snd/snd_VoiceManager.cpp:
|
||||
.text start:0x80484040 end:0x804846F4 align:16
|
||||
.sbss start:0x805766E0 end:0x805766E8
|
||||
.bss start:0x80673A80 end:0x80673AA8
|
||||
|
||||
nw4r/snd/snd_Util.cpp:
|
||||
.text start:0x80484700 end:0x80484BD4 align:16
|
||||
.rodata start:0x804F9320 end:0x804FB7A0
|
||||
.data start:0x8056E340 end:0x8056E350
|
||||
.sdata start:0x80574EA8 end:0x80574EB0
|
||||
.sdata2 start:0x8057F1C0 end:0x8057F1F0
|
||||
|
||||
nw4r/snd/snd_WaveArchive.cpp:
|
||||
.text start:0x80484BE0 end:0x80484CE8 align:16
|
||||
|
||||
nw4r/snd/snd_WaveFile.cpp:
|
||||
.text start:0x80484BE0 end:0x80484F54 align:16
|
||||
.text start:0x80484CF0 end:0x80484F54 align:16
|
||||
|
||||
nw4r/snd/snd_WaveSound.cpp:
|
||||
.text start:0x80484F60 end:0x8048531C align:16
|
||||
.ctors start:0x804DB970 end:0x804DB974
|
||||
.data start:0x8056E350 end:0x8056E388
|
||||
.sbss start:0x805766E8 end:0x805766F0
|
||||
|
||||
nw4r/snd/snd_WaveSoundHandle.cpp:
|
||||
.text start:0x80485320 end:0x80485458 align:16
|
||||
|
||||
nw4r/snd/snd_WsdFile.cpp:
|
||||
.text start:0x80485460 end:0x80485824 align:16
|
||||
.sdata2 start:0x8057F1F0 end:0x8057F1F8
|
||||
|
||||
nw4r/snd/snd_WsdPlayer.cpp:
|
||||
.text start:0x80485830 end:0x804869D8 align:16
|
||||
.data start:0x8056E388 end:0x8056E3E8
|
||||
.sdata2 start:0x8057F1F8 end:0x8057F220
|
||||
|
||||
nw4r/snd/snd_adpcm.cpp:
|
||||
.text start:0x804869E0 end:0x80486A6C align:16
|
||||
|
||||
+1235
-1237
File diff suppressed because it is too large
Load Diff
+85
-83
@@ -313,10 +313,10 @@ def EGGLib(lib_name, objects):
|
||||
}
|
||||
|
||||
|
||||
def nw4rLib(lib_name, objects, extra_cflags=[]):
|
||||
def nw4rLib(lib_name, objects, extra_cflags=[], mw_version=None):
|
||||
return {
|
||||
"lib": lib_name,
|
||||
"mw_version": "Wii/1.3", # most seem to be around 1.2, snd is 1.6
|
||||
"mw_version": mw_version or "Wii/1.3", # most seem to be around 1.2, snd is 1.6
|
||||
"cflags": cflags_nw4r + extra_cflags,
|
||||
"progress_category": "nw4r",
|
||||
"host": False,
|
||||
@@ -435,7 +435,7 @@ config.libs = [
|
||||
Object(NonMatching, "toBeSorted/arc_managers/oarc_control.cpp"),
|
||||
Object(Matching, "toBeSorted/arc_managers/layout_arc_manager.cpp"),
|
||||
Object(NonMatching, "toBeSorted/arc_managers/layout_arc_control.cpp"),
|
||||
Object(NonMatching, "toBeSorted/base_tables.cpp"),
|
||||
Object(Matching, "toBeSorted/actor_info.cpp"),
|
||||
Object(NonMatching, "toBeSorted/unk_vec_math.cpp"),
|
||||
Object(NonMatching, "toBeSorted/unk_mdl_cc.cpp"),
|
||||
Object(NonMatching, "toBeSorted/d_camera.cpp"),
|
||||
@@ -999,7 +999,7 @@ config.libs = [
|
||||
Object(Matching, "nw4r/g3d/g3d_scnmdl.cpp"),
|
||||
# Object(NonMatching, "nw4r/g3d/g3d_scnchoice.cpp"),
|
||||
# Object(NonMatching, "nw4r/g3d/g3d_scngroupex.cpp"),
|
||||
# Object(NonMatching, "nw4r/g3d/g3d_scnmdl1mat1shp.cpp"),
|
||||
Object(Matching, "nw4r/g3d/g3d_scnmdl1mat1shp.cpp"),
|
||||
# Object(NonMatching, "nw4r/g3d/g3d_scnmdlexpand.cpp"),
|
||||
Object(Matching, "nw4r/g3d/g3d_calcmaterial.cpp"),
|
||||
Object(Matching, "nw4r/g3d/g3d_init.cpp"),
|
||||
@@ -1012,81 +1012,83 @@ config.libs = [
|
||||
nw4rLib(
|
||||
"snd",
|
||||
[
|
||||
Object(NonMatching, "nw4r/snd/snd_AnimSound.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_AxManager.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_AxVoice.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_AxVoiceManager.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_AxfxImpl.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Bank.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_BankFile.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_BasicPlayer.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_BasicSound.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_BiquadFilterPreset.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Channel.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_DisposeCallbackManager.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_debug.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_DvdSoundArchive.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_EnvGenerator.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_ExternalSoundPlayer.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_FrameHeap.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_FxBase.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_FxChorus.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_FxDelay.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_FxReverbHi.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_FxReverbHiDpl2.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_FxReverbStd.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_FxReverbStdDpl2.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_InstancePool.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Lfo.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_MemorySoundArchive.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_MidiSeqPlayer.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_MmlParser.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_MmlSeqTrack.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_MmlSeqTrackAllocator.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_NandSoundArchive.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_PlayerHeap.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_RemoteSpeaker.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_RemoteSpeakerManager.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SeqFile.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SeqPlayer.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SeqSound.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SeqSoundHandle.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SeqTrack.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Sound3DActor.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Sound3DCalculator.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Sound3DEngine.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Sound3DListener.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Sound3DManager.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundActor.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundArchive.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundArchiveFile.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundArchiveLoader.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundArchivePlayer.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundHandle.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundHeap.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundPlayer.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundStartable.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundSystem.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_SoundThread.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_StrmChannel.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_StrmFile.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_StrmPlayer.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_StrmSound.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_StrmSoundHandle.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Task.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_TaskManager.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_TaskThread.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Voice.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_VoiceManager.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_Util.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_WaveArchive.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_WaveFile.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_WaveSound.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_WaveSoundHandle.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_WsdFile.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_WsdPlayer.cpp"),
|
||||
Object(NonMatching, "nw4r/snd/snd_adpcm.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_AnimSound.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_AnimSoundReader.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_AxManager.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_AxVoice.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_AxVoiceManager.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_AxfxImpl.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Bank.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_BankFile.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_BasicPlayer.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_BasicSound.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_BiquadFilterPreset.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Channel.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_DisposeCallbackManager.cpp"),
|
||||
# Object(NonMatching, "nw4r/snd/snd_debug.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_DvdSoundArchive.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_EnvGenerator.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_ExternalSoundPlayer.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_FrameHeap.cpp"),
|
||||
# Object(NonMatching, "nw4r/snd/snd_FxBase.cpp"),
|
||||
# Object(NonMatching, "nw4r/snd/snd_FxChorus.cpp"),
|
||||
# Object(NonMatching, "nw4r/snd/snd_FxDelay.cpp"),
|
||||
# Object(NonMatching, "nw4r/snd/snd_FxReverbHi.cpp"),
|
||||
# Object(NonMatching, "nw4r/snd/snd_FxReverbHiDpl2.cpp"),
|
||||
# Object(NonMatching, "nw4r/snd/snd_FxReverbStd.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_FxReverbStdDpl2.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_InstancePool.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Lfo.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_MemorySoundArchive.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_MidiSeqPlayer.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_MmlParser.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_MmlSeqTrack.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_MmlSeqTrackAllocator.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_NandSoundArchive.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_PlayerHeap.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_RemoteSpeaker.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_RemoteSpeakerManager.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SeqFile.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SeqPlayer.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SeqSound.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SeqSoundHandle.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SeqTrack.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Sound3DActor.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Sound3DCalculator.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Sound3DEngine.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Sound3DListener.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Sound3DManager.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundActor.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundArchive.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundArchiveFile.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundArchiveLoader.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundArchivePlayer.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundHandle.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundHeap.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundPlayer.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundStartable.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundSystem.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_SoundThread.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_StrmChannel.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_StrmFile.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_StrmPlayer.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_StrmSound.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_StrmSoundHandle.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Task.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_TaskManager.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_TaskThread.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Voice.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_VoiceManager.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_Util.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_WaveArchive.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_WaveFile.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_WaveSound.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_WaveSoundHandle.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_WsdFile.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_WsdPlayer.cpp"),
|
||||
Object(Matching, "nw4r/snd/snd_adpcm.cpp"),
|
||||
],
|
||||
mw_version="Wii/1.6",
|
||||
),
|
||||
nw4rLib(
|
||||
"lyt",
|
||||
@@ -1959,7 +1961,7 @@ config.libs = [
|
||||
),
|
||||
Rel(Matching, "d_a_obj_bird_sp", "REL/d/a/obj/d_a_obj_bird_sp.cpp"),
|
||||
Rel(Matching, "d_a_obj_bird_statue", "REL/d/a/obj/d_a_obj_bird_statue.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_blade", "REL/d/a/obj/d_a_obj_blade.cpp"),
|
||||
Rel(Matching, "d_a_obj_blade", "REL/d/a/obj/d_a_obj_blade.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_blast_rock", "REL/d/a/obj/d_a_obj_blast_rock.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_block_rope", "REL/d/a/obj/d_a_obj_block_rope.cpp"),
|
||||
Rel(
|
||||
@@ -2017,7 +2019,7 @@ config.libs = [
|
||||
"d_a_obj_display_only_nbs",
|
||||
"REL/d/a/obj/d_a_obj_display_only_nbs.cpp",
|
||||
),
|
||||
Rel(NonMatching, "d_a_obj_distant_ship", "REL/d/a/obj/d_a_obj_distant_ship.cpp"),
|
||||
Rel(Matching, "d_a_obj_distant_ship", "REL/d/a/obj/d_a_obj_distant_ship.cpp"),
|
||||
Rel(
|
||||
NonMatching,
|
||||
"d_a_obj_diviner_crystal",
|
||||
@@ -2100,7 +2102,7 @@ config.libs = [
|
||||
Rel(NonMatching, "d_a_obj_hit_lever_sw", "REL/d/a/obj/d_a_obj_hit_lever_sw.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_hole", "REL/d/a/obj/d_a_obj_hole.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_hole_minigame", "REL/d/a/obj/d_a_obj_hole_minigame.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_impa_door", "REL/d/a/obj/d_a_obj_impa_door.cpp"),
|
||||
Rel(Matching, "d_a_obj_impa_door", "REL/d/a/obj/d_a_obj_impa_door.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_insect_island", "REL/d/a/obj/d_a_obj_insect_island.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_into_hole", "REL/d/a/obj/d_a_obj_into_hole.cpp"),
|
||||
Rel(Matching, "d_a_obj_iron_stage", "REL/d/a/obj/d_a_obj_iron_stage.cpp"),
|
||||
@@ -2146,7 +2148,7 @@ config.libs = [
|
||||
Rel(Matching, "d_a_obj_mapparts", "REL/d/a/obj/d_a_obj_mapparts.cpp"),
|
||||
Rel(Matching, "d_a_obj_megami_island", "REL/d/a/obj/d_a_obj_megami_island.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_mg_pumpkin", "REL/d/a/obj/d_a_obj_mg_pumpkin.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_mole_cover", "REL/d/a/obj/d_a_obj_mole_cover.cpp"),
|
||||
Rel(Matching, "d_a_obj_mole_cover", "REL/d/a/obj/d_a_obj_mole_cover.cpp"),
|
||||
Rel(Matching, "d_a_obj_mole_soil", "REL/d/a/obj/d_a_obj_mole_soil.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_move_elec", "REL/d/a/obj/d_a_obj_move_elec.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_move_lift_vol", "REL/d/a/obj/d_a_obj_move_lift_vol.cpp"),
|
||||
@@ -2186,7 +2188,7 @@ config.libs = [
|
||||
Rel(NonMatching, "d_a_obj_rock_sky", "REL/d/a/obj/d_a_obj_rock_sky.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_roll_pillar", "REL/d/a/obj/d_a_obj_roll_pillar.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_roll_rock", "REL/d/a/obj/d_a_obj_roll_rock.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_rope_base", "REL/d/a/obj/d_a_obj_rope_base.cpp"),
|
||||
Rel(Matching, "d_a_obj_rope_base", "REL/d/a/obj/d_a_obj_rope_base.cpp"),
|
||||
Rel(NonMatching, "d_a_obj_rope_igaiga", "REL/d/a/obj/d_a_obj_rope_igaiga.cpp"),
|
||||
Rel(
|
||||
NonMatching, "d_a_obj_rotation_light", "REL/d/a/obj/d_a_obj_rotation_light.cpp"
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef DECOMP_UNKNOWN_TYPES_H
|
||||
#define DECOMP_UNKNOWN_TYPES_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// MOST LIKELY mVEC
|
||||
struct Vec3f {
|
||||
f32 x, y, z;
|
||||
};
|
||||
|
||||
struct Vec2f {
|
||||
f32 x, y;
|
||||
};
|
||||
|
||||
struct Vec3s {
|
||||
s16 x, y, z;
|
||||
};
|
||||
|
||||
struct ObjInfo {
|
||||
/* 0x00 */ char *name;
|
||||
/* 0x04 */ u16 obj_id;
|
||||
/* 0x06 */ u16 obj_id2;
|
||||
/* 0x08 */ u16 fiTextEntryId;
|
||||
/* 0x0A */ s8 unk_0xA;
|
||||
/* 0x0B */ u8 subtype;
|
||||
};
|
||||
|
||||
// is now fLiNdBa_c
|
||||
// struct ActorReference {
|
||||
// ActorReference* prev;
|
||||
// ActorReference* next;
|
||||
// fBase_c* link;
|
||||
// };
|
||||
|
||||
class UnkCollider {};
|
||||
|
||||
#endif
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef D_A_BASE_H
|
||||
#define D_A_BASE_H
|
||||
|
||||
#include "UnknownTypeBelongings.h"
|
||||
#include "common.h"
|
||||
#include "d/d_base.h"
|
||||
#include "m/m_allocator.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/actor_info.h"
|
||||
#include "toBeSorted/raii_ptr.h"
|
||||
#include "toBeSorted/tlist.h"
|
||||
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
class dAcBase_c : public dBase_c {
|
||||
public:
|
||||
/* 0x68 */ mHeapAllocator_c heap_allocator;
|
||||
/* 0x84 */ ObjInfo *obj_info;
|
||||
/* 0x84 */ const ActorInfo *mpActorInfo;
|
||||
/* 0x88 */ TList<SoundInfo, 12> sound_list;
|
||||
/* 0x94 */ RaiiPtr<SoundSource> sound_source;
|
||||
/* 0x98 */ mVec3_c *obj_pos;
|
||||
@@ -249,10 +249,10 @@ public:
|
||||
// funcs found in TU
|
||||
/* 8002c650 */ static void setTempCreateParams(
|
||||
mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, s32 roomId, u32 params2, dAcBase_c *parent, u8 subtype, u16 unkFlag,
|
||||
s8 viewClipIdx, ObjInfo *objInfo
|
||||
s8 viewClipIdx, const ActorInfo *actorInfo
|
||||
);
|
||||
|
||||
/* 8002c690 */ SoundSource *FUN_8002c690();
|
||||
/* 8002c690 */ SoundSource *createSoundSource();
|
||||
/* 8002c710 */ int initAllocatorWork1Heap(int size, char *name, int align);
|
||||
/* 8002c720 */ int initAllocator(int size, char *name, EGG::Heap *heap, int align);
|
||||
/* 8002c7b0 */ bool addActorToRoom(s32 roomId);
|
||||
@@ -339,7 +339,7 @@ public:
|
||||
/* 80575084 */ static mAng3_c *s_Create_Rotation;
|
||||
/* 80575088 */ static mVec3_c *s_Create_Scale;
|
||||
/* 8057508C */ static dAcBase_c *s_Create_Parent;
|
||||
/* 80575090 */ static ObjInfo *s_Create_ObjInfo;
|
||||
/* 80575090 */ static const ActorInfo *s_Create_ActorInfo;
|
||||
/* 80575094 */ static u8 s_Create_Subtype;
|
||||
};
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
u32 roomId
|
||||
);
|
||||
/* 8002efa0 */ void fn_8002efa0();
|
||||
/* 8002eff0 */ bool fn_8002eff0(f32 *, s16 *, UnkCollider *, f32 *, f32 *);
|
||||
/* 8002eff0 */ bool fn_8002eff0(f32 *, s16 *, f32 *, f32 *, f32 *);
|
||||
/* 8002f190 */ void createChildAttached2(
|
||||
fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2,
|
||||
u32 roomId
|
||||
|
||||
@@ -2,13 +2,23 @@
|
||||
#define D_A_OBJ_BLADE_H
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "m/m3d/m_anmmdl.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
|
||||
class dAcOblade_c : public dAcObjBase_c {
|
||||
public:
|
||||
dAcOblade_c() {}
|
||||
virtual ~dAcOblade_c() {}
|
||||
|
||||
virtual bool createHeap() override;
|
||||
virtual int create() override;
|
||||
virtual int doDelete() override;
|
||||
virtual int actorExecute() override;
|
||||
virtual int draw() override;
|
||||
|
||||
private:
|
||||
/* 0x330 */ nw4r::g3d::ResFile mResFile;
|
||||
/* 0x334 */ m3d::mdlAnmChr mMdl;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,13 +2,25 @@
|
||||
#define D_A_OBJ_DISTANT_SHIP_H
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "m/m3d/m_smdl.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
|
||||
class dAcOdistantShip_c : public dAcObjBase_c {
|
||||
public:
|
||||
dAcOdistantShip_c() {}
|
||||
virtual ~dAcOdistantShip_c() {}
|
||||
virtual int create() override;
|
||||
virtual int doDelete() override;
|
||||
virtual int draw() override;
|
||||
virtual bool createHeap() override;
|
||||
virtual int actorExecute() override;
|
||||
const char *getModelName();
|
||||
|
||||
private:
|
||||
/* 0x330 */ nw4r::g3d::ResFile mBrres;
|
||||
/* 0x334 */ m3d::smdl_c mModel;
|
||||
/* 0x350 */ u8 mSubtype;
|
||||
/* 0x351 */ bool mIsVisible;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#define D_A_OBJ_IMPA_DOOR_H
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "m/m3d/m_smdl.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "s/s_StateMgr.hpp"
|
||||
|
||||
class dAcOimpaDoor_c : public dAcObjBase_c {
|
||||
public:
|
||||
@@ -12,8 +13,16 @@ public:
|
||||
|
||||
STATE_FUNC_DECLARE(dAcOimpaDoor_c, Wait);
|
||||
|
||||
virtual bool createHeap() override;
|
||||
virtual int create() override;
|
||||
virtual int doDelete() override;
|
||||
virtual int actorExecute() override;
|
||||
virtual int draw() override;
|
||||
|
||||
private:
|
||||
/* 0x??? */ STATE_MGR_DECLARE(dAcOimpaDoor_c);
|
||||
/* 0x330 */ nw4r::g3d::ResFile mResFile;
|
||||
/* 0x334 */ m3d::smdl_c mMdl;
|
||||
/* 0x350 */ STATE_MGR_DECLARE(dAcOimpaDoor_c);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,13 +2,25 @@
|
||||
#define D_A_OBJ_MOLE_COVER_H
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/col/bg/d_bg_w.h"
|
||||
#include "m/m3d/m_smdl.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
|
||||
class dAcOmoleCover_c : public dAcObjBase_c {
|
||||
public:
|
||||
dAcOmoleCover_c() {}
|
||||
virtual ~dAcOmoleCover_c() {}
|
||||
|
||||
virtual bool createHeap() override;
|
||||
virtual int create() override;
|
||||
virtual int doDelete() override;
|
||||
virtual int actorExecute() override;
|
||||
virtual int draw() override;
|
||||
|
||||
private:
|
||||
/* 0x330 */ nw4r::g3d::ResFile mResFile;
|
||||
/* 0x334 */ m3d::smdl_c mMdl;
|
||||
/* 0x350 */ dBgW mBgW;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,13 +2,26 @@
|
||||
#define D_A_OBJ_ROPE_BASE_H
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "m/m3d/m_smdl.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
|
||||
class dAcOropeBase_c : public dAcObjBase_c {
|
||||
public:
|
||||
dAcOropeBase_c() {}
|
||||
virtual ~dAcOropeBase_c() {}
|
||||
|
||||
virtual bool createHeap() override;
|
||||
virtual int create() override;
|
||||
virtual int doDelete() override;
|
||||
virtual int actorExecute() override;
|
||||
virtual int draw() override;
|
||||
|
||||
private:
|
||||
/* 0x330 */ nw4r::g3d::ResFile mResFile;
|
||||
/* 0x334 */ m3d::smdl_c mMdl;
|
||||
/* 0x350 */ mVec3_c mRopePos;
|
||||
/* 0x35C */ bool field_0x35C;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public:
|
||||
group_type = m_tmpCtData.group_type;
|
||||
}
|
||||
|
||||
inline u32 getFromParams(u8 shift, u32 mask) {
|
||||
u32 getFromParams(u8 shift, u32 mask) {
|
||||
return (params >> shift) & mask;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "nw4r/types_nw4r.h" // IWYU pragma: export
|
||||
#include "rvl/OS.h" // IWYU pragma: export
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#define NW4R_MATH_QNAN (-(0.0f / 0.0f))
|
||||
#define NW4R_MATH_FLT_MAX 3.402823466e+38f
|
||||
|
||||
@@ -30,7 +32,7 @@ inline f32 FAbs(register f32 x) {
|
||||
}
|
||||
|
||||
inline f32 FCeil(f32 x) {
|
||||
return ceilf(x);
|
||||
return std::ceilf(x);
|
||||
}
|
||||
|
||||
inline f32 FExp(f32 x) {
|
||||
@@ -38,7 +40,7 @@ inline f32 FExp(f32 x) {
|
||||
}
|
||||
|
||||
inline f32 FFloor(f32 x) {
|
||||
return floorf(x);
|
||||
return std::floorf(x);
|
||||
}
|
||||
|
||||
inline f32 FInv(register f32 x) {
|
||||
|
||||
@@ -1 +1,129 @@
|
||||
/* Only implemented to the extent necessary to match data sections. */
|
||||
|
||||
#include "nw4r/snd/snd_AnimSoundReader.h"
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
|
||||
// Class and non-inlined function names from InazumaWii
|
||||
// Names of automatically inlined functions from BBA
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
namespace detail {
|
||||
|
||||
class AnimEventPlayer {
|
||||
public:
|
||||
AnimEventPlayer();
|
||||
~AnimEventPlayer();
|
||||
|
||||
SoundHandle *GetHandle() {
|
||||
return &mHandle;
|
||||
}
|
||||
|
||||
bool IsAttachedSound() const {
|
||||
return mHandle.IsAttachedSound();
|
||||
}
|
||||
|
||||
bool IsCurrentEvent(const AnimEvent *event) const {
|
||||
return event == mpEvent;
|
||||
}
|
||||
|
||||
int GetPriority() const {
|
||||
if (!IsAttachedSound()) {
|
||||
return 0;
|
||||
}
|
||||
return mHandle.detail_GetAttachedSound()->GetPriority();
|
||||
}
|
||||
|
||||
bool IsRunning() const {
|
||||
return mIsRunning;
|
||||
}
|
||||
|
||||
void UpdateFrame();
|
||||
|
||||
void ForceStop();
|
||||
|
||||
void StopEvent(const AnimEvent *event) {
|
||||
if (mpEvent == event) {
|
||||
ForceStop();
|
||||
}
|
||||
}
|
||||
|
||||
void SetVolume(f32 volume) {
|
||||
if (IsAttachedSound()) {
|
||||
mHandle.detail_GetAttachedSound()->SetVolume(volume, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void SetPitch(f32 pitch) {
|
||||
if (IsAttachedSound()) {
|
||||
mHandle.detail_GetAttachedSound()->SetPitch(pitch);
|
||||
}
|
||||
}
|
||||
|
||||
void StartEvent(const AnimEvent *event, SoundStartable *startable, bool b);
|
||||
void HoldEvent(const AnimEvent *event, SoundStartable *startable, bool b);
|
||||
|
||||
// Not sure about these, this could be related to
|
||||
// InitParam__Q44nw4r3snd6detail15AnimEventPlayerFPCQ44nw4r3snd6detail9AnimEventb
|
||||
// from BBA, but SetVariable is almost certainly an inline (duplicated code)
|
||||
// but the float argument is read from AnimSoundImpl so something seems to have
|
||||
// changed.
|
||||
void SetVolumePitch(const AnimEvent *event, bool b);
|
||||
void SetVariable(const AnimEvent *event, u32 varNo, f32 f);
|
||||
|
||||
private:
|
||||
SoundHandle mHandle; // at 0x00
|
||||
const AnimEvent *mpEvent; // at 0x04
|
||||
bool mIsRunning; // at 0x08
|
||||
};
|
||||
|
||||
class AnimSoundImpl {
|
||||
public:
|
||||
enum PlayDirection {
|
||||
FORWARD,
|
||||
BACKWARD,
|
||||
};
|
||||
|
||||
AnimSoundImpl(SoundStartable &startable, AnimEventPlayer *player, int);
|
||||
~AnimSoundImpl();
|
||||
|
||||
bool Setup(const void *data);
|
||||
void Shutdown();
|
||||
void ResetFrame(f32, int);
|
||||
void UpdateFrame(f32 frame, PlayDirection dir);
|
||||
void UpdateForward(f32 frame);
|
||||
void UpdateBackward(f32 frame);
|
||||
void UpdateOneFrame(s32 duration, PlayDirection direction);
|
||||
void UpdateTrigger(const AnimEventRef *, s32, PlayDirection);
|
||||
void UpdateForwardRange(const AnimEventRef *, s32);
|
||||
void UpdateBackwardRange(const AnimEventRef *, s32);
|
||||
|
||||
void StartEvent(const AnimEvent *, bool);
|
||||
void HoldEvent(const AnimEvent *, bool);
|
||||
void StopEvent(const AnimEvent *);
|
||||
bool IsPlayableLoopCount(const nw4r::snd::detail::AnimEventFrameInfo&);
|
||||
|
||||
|
||||
typedef void (*Callback)(int, s32, const char *, UNKWORD, UNKWORD);
|
||||
|
||||
private:
|
||||
/* 0x00 */ SoundStartable &mStartable;
|
||||
/* 0x04 */ AnimSoundFileReader mReader;
|
||||
/* 0x0C */ f32 field_0x0C;
|
||||
/* 0x10 */ AnimEventPlayer *mpSounds;
|
||||
/* 0x14 */ int mNumSounds;
|
||||
/* 0x18 */ bool mIsActive;
|
||||
/* 0x19 */ u8 field_0x19;
|
||||
/* 0x1A */ u8 field_0x1A;
|
||||
/* 0x1C */ UNKWORD field_0x1C;
|
||||
/* 0x20 */ Callback mCallback;
|
||||
/* 0x24 */ UNKWORD field_0x24;
|
||||
/* 0x28 */ f32 field_0x28;
|
||||
/* 0x2C */ f32 mVariableValue;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "nw4r/snd/snd_Util.h"
|
||||
#include "nw4r/ut/ut_binaryFileFormat.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
namespace detail {
|
||||
|
||||
// Type and name revealed by BBA
|
||||
struct AnimEventFrameInfo {
|
||||
int field_0x00; // at 0x00
|
||||
int field_0x04; // at 0x04
|
||||
u8 flags; // at 0x08
|
||||
s8 field_0x09; // at 0x09
|
||||
u8 field_0x0A; // at 0x0A
|
||||
};
|
||||
|
||||
struct AnimEvent {
|
||||
u32 flags; // at 0x00
|
||||
u32 soundId; // at 0x04
|
||||
detail::Util::DataRef<const char> soundLabelRef; // at 0x08
|
||||
u8 volume; // at 0x10
|
||||
u8 field_0x11; // at 0x11
|
||||
u8 varNo; // at 0x12
|
||||
f32 pitch; // at 0x14
|
||||
UNKWORD field_0x18; // at 0x18
|
||||
UNKWORD field_0x1C; // at 0x1C
|
||||
|
||||
bool ShouldPreventStart() const {
|
||||
return flags & 1;
|
||||
}
|
||||
|
||||
const char *GetSoundLabel() const {
|
||||
return Util::GetDataRefAddress0(soundLabelRef, this);
|
||||
}
|
||||
|
||||
bool GetVarNo(u32 *var) const {
|
||||
if (flags & 2) {
|
||||
*var = varNo;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MatchesDirection(int playDirection) const {
|
||||
bool ret = 0;
|
||||
u32 config = field_0x11;
|
||||
if ((config == 0 || (playDirection == 0 && config == 1) || (playDirection == 1 && config == 2))) {
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
// Name from Inazuma, BBA
|
||||
struct AnimEventRef {
|
||||
AnimEventFrameInfo mInfo; // at 0x00
|
||||
Util::DataRef<AnimEvent> event; // at 0x0C
|
||||
};
|
||||
|
||||
// Names unknown
|
||||
struct AnimSoundFile {
|
||||
static u32 const SIGNATURE_FILE = NW4R_FOUR_BYTE('R', 'A', 'S', 'D');
|
||||
static int const FILE_VERSION = NW4R_FILE_VERSION(1, 0);
|
||||
|
||||
struct Header {
|
||||
ut::BinaryFileHeader fileHeader; // size 0x10, offset 0x00
|
||||
u32 blockOffset; // at 0x10
|
||||
};
|
||||
|
||||
struct EventTable {
|
||||
Util::Table<AnimEventRef> eventRef; // at 0x00
|
||||
};
|
||||
|
||||
struct Block {
|
||||
ut::BinaryBlockHeader blockHeader; // at 0x00
|
||||
u32 duration; // at 0x08
|
||||
Util::DataRef<EventTable> eventTable; // at 0x0C
|
||||
};
|
||||
};
|
||||
|
||||
// Name from Inazuma
|
||||
class AnimSoundFileReader {
|
||||
public:
|
||||
AnimSoundFileReader();
|
||||
bool Setup(const void *buf);
|
||||
void Shutdown();
|
||||
u32 GetEventCount() const;
|
||||
|
||||
const AnimSoundFile::EventTable *GetEventTable() const;
|
||||
const AnimEventRef *GetEventRef(u32 id) const;
|
||||
const AnimEvent *GetEvent(const AnimEventRef *ref) const;
|
||||
|
||||
bool IsValid() const {
|
||||
return mpHeader != NULL;
|
||||
}
|
||||
|
||||
u32 GetAnimDuration() const {
|
||||
if (!IsValid()) {
|
||||
return 0;
|
||||
}
|
||||
return mpBlock->duration;
|
||||
}
|
||||
|
||||
private:
|
||||
const AnimSoundFile::Header *mpHeader; // at 0x00
|
||||
const AnimSoundFile::Block *mpBlock; // at 0x04
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "nw4r/snd/snd_AxVoice.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
|
||||
#include "nw4r/snd/snd_FxBase.h"
|
||||
@@ -106,6 +107,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
return mResetReadyCounter == 0;
|
||||
}
|
||||
|
||||
AxVoice::SrcType GetSrcType() const {
|
||||
return mSrcType;
|
||||
}
|
||||
|
||||
private:
|
||||
// cdtors
|
||||
AxManager();
|
||||
@@ -117,11 +122,11 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
// static members
|
||||
private:
|
||||
static u8 const AUX_CALLBACK_WAIT_FRAME;
|
||||
static u8 const AUX_CALLBACK_WAIT_FRAME = 6;
|
||||
static u16 const AUX_RETURN_VOLUME_MAX = AX_MAX_VOLUME;
|
||||
static int const FX_SAMPLE_RATE;
|
||||
static SampleFormat const FX_SAMPLE_FORMAT;
|
||||
static int const FX_BUFFER_SIZE;
|
||||
static int const FX_SAMPLE_RATE = 32000;
|
||||
static SampleFormat const FX_SAMPLE_FORMAT = SAMPLE_FORMAT_PCM_S32;
|
||||
static int const FX_BUFFER_SIZE = 0x180;
|
||||
static int const ZERO_BUFFER_SIZE = 256;
|
||||
static int const SAMPLES_PAR_AUDIO_FRAME;
|
||||
static int const AUDIO_FRAME_INTERVAL;
|
||||
@@ -147,7 +152,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
MoveValue<f32, int> mMainOutVolume; // size 0x10, offset 0x2c
|
||||
MoveValue<f32, int> mVolumeForReset; // size 0x10, offset 0x3c
|
||||
AIDMACallback mOldAidCallback; // size 0x04, offset 0x4c
|
||||
s32 mResetReadyCounter; // size 0x04, offset 0x50
|
||||
volatile s32 mResetReadyCounter; // size 0x04, offset 0x50
|
||||
MoveValue<f32, int> mAuxFadeVolume[AUX_BUS_NUM]; // size 0x30, offset 0x54
|
||||
MoveValue<f32, int> mAuxUserVolume[AUX_BUS_NUM]; // size 0x30, offset 0x84
|
||||
FxBase::LinkList mFxList[AUX_BUS_NUM]; // size 0x24, offset 0xb4
|
||||
@@ -156,7 +161,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
u8 mAuxCallbackWaitCounter[AUX_BUS_NUM]; // size 0x03, offset 0xf0
|
||||
/* 1 byte padding */
|
||||
u32 mEffectProcessTick[AUX_BUS_NUM]; // size 0x0c, offset 0xf4
|
||||
}; // size 0x100
|
||||
AxVoice::SrcType mSrcType;
|
||||
}; // size 0x104
|
||||
}}} // namespace nw4r::snd::detail
|
||||
|
||||
#endif // NW4R_SND_AX_MANAGER_H
|
||||
|
||||
@@ -121,6 +121,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void SetVoiceBiquad(AXPBBIQUAD const &biquad);
|
||||
void SetVoiceBiquadCoefs(u16 b0, u16 b1, u16 b2, u16 a1, u16 a2);
|
||||
void SetVoiceRmtIIR(__AXPBRMTIIR const &iir);
|
||||
void SetVoiceRmtOn(u16 on);
|
||||
void SetVoiceRmtMix(_AXPBRMTMIX const &iir);
|
||||
void SetVoiceRmtIIRCoefs(u16 type, ...);
|
||||
|
||||
void Set(AXVPB *vpb);
|
||||
@@ -235,6 +237,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void SetLoopFlag(bool loopFlag);
|
||||
void SetPriority(u32 priority);
|
||||
void SetVoiceType(VoiceType type);
|
||||
void EnableRemote(bool enable);
|
||||
void ResetDelta();
|
||||
void SetAddr(bool loopFlag, void const *waveAddr, u32 startOffset,
|
||||
u32 loopStart, u32 loopEnd);
|
||||
@@ -242,6 +245,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void SetAdpcm(AdpcmParam const *param);
|
||||
void SetAdpcmLoop(AdpcmLoopParam const *param);
|
||||
bool SetMix(MixParam const ¶m);
|
||||
void SetRmtMix(const RemoteMixParam ¶m);
|
||||
void SetSrc(f32 ratio, bool initialUpdate);
|
||||
void SetVe(f32 volume, f32 initVolume);
|
||||
void SetLpf(u16 freq);
|
||||
@@ -269,7 +273,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
static void CalcOffsetAdpcmParam(u16 *outPredScale, u16 *outYn1,
|
||||
u16 *outYn2, u32 offset,
|
||||
void *dataAddr,
|
||||
const void *dataAddr,
|
||||
AdpcmParam const &adpcmParam);
|
||||
|
||||
private:
|
||||
|
||||
@@ -9,13 +9,12 @@ namespace snd {
|
||||
namespace detail {
|
||||
|
||||
struct AxfxImpl {
|
||||
bool mIsActive; // at 0x0
|
||||
MEMiHeapHead *mHeap; // at 0x4
|
||||
u32 mAllocCount; // at 0x8
|
||||
|
||||
static const u32 HEAP_SIZE_MIN = MEM_FRM_HEAP_MIN_SIZE + 32;
|
||||
|
||||
AxfxImpl() : mIsActive(false), mHeap(NULL), mAllocCount(0) {}
|
||||
AxfxImpl() : mHeap(NULL), mAllocCount(0) {}
|
||||
|
||||
bool CreateHeap(void *pBuffer, u32 size);
|
||||
void DestroyHeap();
|
||||
@@ -29,7 +28,7 @@ struct AxfxImpl {
|
||||
}
|
||||
|
||||
void HookAlloc(AXFXAllocHook *pAllocHook, AXFXFreeHook *pFreeHook);
|
||||
void RestoreAlloc(AXFXAllocHook allocHook, AXFXFreeHook freeHook);
|
||||
u32 RestoreAlloc(AXFXAllocHook allocHook, AXFXFreeHook freeHook);
|
||||
|
||||
static void *Alloc(u32 size);
|
||||
static void Free(void *pBlock);
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
PanMode panMode; // size 0x04, offset 0x28
|
||||
PanCurve panCurve; // size 0x04, offset 0x2c
|
||||
f32 fxSend[AUX_BUS_NUM]; // size 0x0c, offset 0x30
|
||||
VoiceOutParam voiceOutParam[4]; // size 0x60, offset 0x3c
|
||||
f32 remoteOutVolume[4]; // size 0x04, offset 0x3c
|
||||
VoiceOutParam voiceOutParam[4]; // size 0x60, offset 0x5c
|
||||
}; // size 0x9c
|
||||
}}} // namespace nw4r::snd::detail
|
||||
|
||||
@@ -75,6 +76,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
// methods
|
||||
void InitParam();
|
||||
void SetRemoteOutVolume(int remote, f32 volume);
|
||||
f32 GetRemoteOutVolume(int remote) const;
|
||||
|
||||
f32 GetVolume() const { return mPlayerParamSet.volume; }
|
||||
f32 GetPitch() const { return mPlayerParamSet.pitch; }
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace nw4r { namespace snd
|
||||
lpf (0.0f),
|
||||
biquadFilterValue (0.0f),
|
||||
biquadFilterType (0),
|
||||
priority (0)
|
||||
priority (0),
|
||||
field_0x24 (0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -59,6 +60,7 @@ namespace nw4r { namespace snd
|
||||
f32 biquadFilterValue; // size 0x04, offset 0x18
|
||||
int biquadFilterType; // size 0x04, offset 0x1c
|
||||
int priority; // size 0x04, offset 0x20
|
||||
UNKWORD field_0x24;
|
||||
}; // size 0x24
|
||||
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27514
|
||||
@@ -76,7 +78,8 @@ namespace nw4r { namespace snd
|
||||
lpf (0.0f),
|
||||
biquadFilterValue (0.0f),
|
||||
biquadFilterType (0),
|
||||
priority (0)
|
||||
priority (0),
|
||||
field_0x24 (0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -91,6 +94,7 @@ namespace nw4r { namespace snd
|
||||
f32 biquadFilterValue; // size 0x04, offset 0x18
|
||||
int biquadFilterType; // size 0x04, offset 0x1c
|
||||
int priority; // size 0x04, offset 0x20
|
||||
UNKWORD field_0x24;
|
||||
VoiceOutParam voiceOutParam[4]; // size 0x60, offset 0x24
|
||||
}; // size 0x84
|
||||
|
||||
@@ -141,10 +145,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
// typedefs
|
||||
public:
|
||||
typedef ut::LinkList<BasicSound, 0xe0> PriorityLinkList;
|
||||
typedef ut::LinkList<BasicSound, 0xe8> SoundPlayerPlayLinkList;
|
||||
typedef ut::LinkList<BasicSound, 0xf0> SoundPlayerPriorityLinkList;
|
||||
typedef ut::LinkList<BasicSound, 0xf8> ExtSoundPlayerPlayLinkList;
|
||||
typedef ut::LinkList<BasicSound, 0xf0> PriorityLinkList;
|
||||
typedef ut::LinkList<BasicSound, 0xf8> SoundPlayerPlayLinkList;
|
||||
typedef ut::LinkList<BasicSound, 0x100> SoundPlayerPriorityLinkList;
|
||||
typedef ut::LinkList<BasicSound, 0x108> ExtSoundPlayerPlayLinkList;
|
||||
|
||||
// nested types
|
||||
public:
|
||||
@@ -165,10 +169,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
};
|
||||
// methods
|
||||
public:
|
||||
virtual void at_0x08();
|
||||
virtual void at_0x0c(void *, int, int, void *);
|
||||
virtual int at_0x10(void *, int);
|
||||
virtual int at_0x14(void *, int);
|
||||
virtual ~AmbientParamUpdateCallback() {}
|
||||
virtual void detail_UpdateAmbientParam(const void*, u32, int, SoundAmbientParam*);
|
||||
virtual int detail_GetAmbientPriority(const void*, u32);
|
||||
virtual int detail_GetRequiredVoiceOutCount(const void*, u32);
|
||||
|
||||
// members
|
||||
private:
|
||||
@@ -182,8 +186,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
public:
|
||||
// virtual function ordering
|
||||
// vtable AmbientArgUpdateCallback
|
||||
virtual void at_0x08();
|
||||
virtual void at_0x0c(void *, void *);
|
||||
virtual ~AmbientArgUpdateCallback() {}
|
||||
virtual void at_0x0c(void *, BasicSound *);
|
||||
|
||||
// members
|
||||
private:
|
||||
@@ -198,9 +202,11 @@ namespace nw4r { namespace snd { namespace detail
|
||||
public:
|
||||
// virtual function ordering
|
||||
// vtable AmbientArgAllocaterCallback
|
||||
virtual void at_0x08();
|
||||
virtual void *at_0x0c(int);
|
||||
virtual void at_0x10(void *, void *);
|
||||
virtual ~AmbientArgAllocaterCallback() {}
|
||||
virtual void *detail_AllocAmbientArg(u32 size); // at 0x8
|
||||
|
||||
virtual void detail_FreeAmbientArg(void *pArg,
|
||||
const detail::BasicSound *pSound); // at 0xC
|
||||
|
||||
// members
|
||||
private:
|
||||
@@ -244,25 +250,32 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void StartPrepared();
|
||||
void Update();
|
||||
void Pause(bool flag, int fadeFrames);
|
||||
bool IsPaused() const;
|
||||
bool IsPause() const;
|
||||
void Stop(int fadeFrames);
|
||||
void SetAutoStopCounter(int count);
|
||||
void FadeIn(int fadeFrames);
|
||||
|
||||
bool GetStartedFlag() const { return mStartedFlag; }
|
||||
u32 GetId() const { return mId; }
|
||||
PlayerHeap *GetPlayerHeap() { return mPlayerHeap; }
|
||||
SoundPlayer *GetSoundPlayer() { return mSoundPlayer; }
|
||||
int GetVoiceOutCount() const;
|
||||
int GetPriority() const { return mPriority; }
|
||||
|
||||
void SetPlayerPriority(int priority);
|
||||
void SetInitialVolume(f32 volume);
|
||||
void SetVolume(f32 volume, int frames);
|
||||
void SetPitch(f32 pitch);
|
||||
void SetPan(f32 pan);
|
||||
void SetSurroundPan(f32 pan);
|
||||
void SetLpfFreq(f32 freq);
|
||||
void SetFxSend(AuxBus bus, f32 send);
|
||||
void SetRemoteFilter(int filter);
|
||||
void SetPanMode(PanMode mode);
|
||||
void SetPanCurve(PanCurve curve);
|
||||
void SetAmbientInfo(AmbientInfo const &ambientArgInfo);
|
||||
void SetId(u32 id);
|
||||
void SetOutputLineFlag(int flag);
|
||||
|
||||
void AttachPlayerHeap(PlayerHeap *heap);
|
||||
void AttachSoundPlayer(SoundPlayer *player);
|
||||
@@ -279,12 +292,18 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void DetachGeneralHandle();
|
||||
void DetachTempGeneralHandle();
|
||||
|
||||
int GetRemainingFadeFrames() const;
|
||||
|
||||
int CalcCurrentPlayerPriority() const
|
||||
{
|
||||
return ut::Clamp(mPriority + mAmbientParam.priority, PRIORITY_MIN,
|
||||
PRIORITY_MAX);
|
||||
}
|
||||
|
||||
void ClearAmbientArgUpdateCallback() {
|
||||
mAmbientInfo.argUpdateCallback = NULL;
|
||||
}
|
||||
|
||||
static int GetAmbientPriority(AmbientInfo const &ambientInfo,
|
||||
u32 soundId);
|
||||
|
||||
@@ -336,8 +355,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
f32 mMainOutVolume; // size 0x04, offset 0xc8
|
||||
f32 mMainSend; // size 0x04, offset 0xcc
|
||||
f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0xd0
|
||||
// NOTE: Name is not from DWARF; derived from usage and other nearby names
|
||||
u32 mPauseNestCounter; // size 0x04, offset 0xdc
|
||||
f32 mRemoteOutVolume[4]; // size 0x10, offset 0xdc
|
||||
public:
|
||||
ut::LinkListNode mPriorityLink; // size 0x08, offset 0xe0
|
||||
ut::LinkListNode mSoundPlayerPlayLink; // size 0x08, offset 0xe8
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
ChannelCallbackStatus status,
|
||||
u32 userData);
|
||||
|
||||
typedef ut::LinkList<Channel, 0xc8> LinkList;
|
||||
typedef ut::LinkList<Channel, 0xd8> LinkList;
|
||||
|
||||
// methods
|
||||
public:
|
||||
@@ -115,6 +115,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
{
|
||||
mUserSurroundPan = surroundPan;
|
||||
}
|
||||
void SetRemoteOutVolume(int channel, f32 volume)
|
||||
{
|
||||
mRemoteOutVolume[channel] = volume;
|
||||
}
|
||||
void SetUserLpfFreq(f32 lpfFreq) { mUserLpfFreq = lpfFreq; }
|
||||
void SetOutputLine(int lineFlag) { mOutputLineFlag = lineFlag; }
|
||||
void SetMainOutVolume(f32 volume) { mMainOutVolume = volume; }
|
||||
@@ -208,6 +212,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
f32 mMainOutVolume; // size 0x04, offset 0x5c
|
||||
f32 mMainSend; // size 0x04, offset 0x60
|
||||
f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0x64
|
||||
f32 mRemoteOutVolume[4];
|
||||
f32 mUserPitch; // size 0x04, offset 0x70
|
||||
f32 mSweepPitch; // size 0x04, offset 0x74
|
||||
s32 mSweepCounter; // size 0x04, offset 0x78
|
||||
|
||||
@@ -6,11 +6,15 @@
|
||||
*/
|
||||
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* classes and functions
|
||||
*/
|
||||
|
||||
namespace nw4r { namespace snd { class SoundActor; }}
|
||||
|
||||
namespace nw4r { namespace snd { namespace detail
|
||||
{
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27049
|
||||
@@ -24,12 +28,43 @@ namespace nw4r { namespace snd { namespace detail
|
||||
int GetPlayingSoundCount() const { return mSoundList.GetSize(); }
|
||||
int GetPlayableSoundCount() const { return mPlayableCount; }
|
||||
void SetPlayableSoundCount(int count);
|
||||
void StopAllSound(int fadeFrames);
|
||||
void PauseAllSound(bool flag, int fadeFrames);
|
||||
void DetachSoundActorAll(SoundActor *sound);
|
||||
|
||||
bool AppendSound(BasicSound *sound);
|
||||
void RemoveSound(BasicSound *sound);
|
||||
|
||||
bool detail_CanPlaySound(int startPriority);
|
||||
|
||||
template <typename TForEachFunc>
|
||||
TForEachFunc ForEachSound(TForEachFunc pFunc, bool reverse) {
|
||||
if (reverse) {
|
||||
detail::BasicSound::ExtSoundPlayerPlayLinkList::ReverseIterator it = mSoundList.GetBeginReverseIter();
|
||||
|
||||
while (it != mSoundList.GetEndReverseIter()) {
|
||||
detail::BasicSound::ExtSoundPlayerPlayLinkList::ReverseIterator curr = it;
|
||||
|
||||
SoundHandle handle;
|
||||
handle.detail_AttachSoundAsTempHandle(&*curr);
|
||||
pFunc(handle);
|
||||
|
||||
if (handle.IsAttachedSound()) {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList) {
|
||||
decltype(it) curItr = it++;
|
||||
SoundHandle handle;
|
||||
handle.detail_AttachSoundAsTempHandle(&*curItr);
|
||||
pFunc(handle);
|
||||
}
|
||||
}
|
||||
|
||||
return pFunc;
|
||||
}
|
||||
|
||||
private:
|
||||
BasicSound *GetLowestPrioritySound();
|
||||
|
||||
|
||||
@@ -34,22 +34,19 @@ public:
|
||||
private:
|
||||
struct Block {
|
||||
NW4R_UT_LIST_NODE_DECL(); // at 0x0
|
||||
u32 mSize; // at 0x8
|
||||
FreeCallback mCallback; // at 0xc
|
||||
void *mCallbackArg; // at 0x10
|
||||
void *mpBuffer; // at 0x8
|
||||
u32 mSize; // at 0xC
|
||||
FreeCallback mCallback; // at 0x10
|
||||
void *mCallbackArg; // at 0x14
|
||||
|
||||
Block(u32 size, FreeCallback pCallback, void *pCallbackArg)
|
||||
: mSize(size), mCallback(pCallback), mCallbackArg(pCallbackArg) {}
|
||||
Block(void *pBuffer2, u32 size, FreeCallback pCallback, void *pCallbackArg)
|
||||
: mSize(size), mCallback(pCallback), mCallbackArg(pCallbackArg), mpBuffer(pBuffer2) {}
|
||||
|
||||
~Block() {
|
||||
if (mCallback != NULL) {
|
||||
mCallback(GetBufferAddr(), mSize, mCallbackArg);
|
||||
mCallback(mpBuffer, mSize, mCallbackArg);
|
||||
}
|
||||
}
|
||||
|
||||
void *GetBufferAddr() {
|
||||
return ut::AddOffsetToPtr(this, BLOCK_BUFFER_SIZE);
|
||||
}
|
||||
};
|
||||
|
||||
NW4R_UT_LIST_TYPEDEF_DECL(Block);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace nw4r { namespace snd
|
||||
// vtable FxBase
|
||||
virtual bool StartUp();
|
||||
virtual void Shutdown();
|
||||
virtual void UpdateBuffer(int, void *, u32, SampleFormat, f32,
|
||||
virtual void UpdateBuffer(int, void **, u32, SampleFormat, f32,
|
||||
OutputMode);
|
||||
virtual void OnChangeOutputMode();
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#ifndef NW4R_SND_FX_REVERB_STD_DPL2_H
|
||||
#define NW4R_SND_FX_REVERB_STD_DPL2_H
|
||||
|
||||
#include "nw4r/snd/snd_AxfxImpl.h"
|
||||
#include "nw4r/snd/snd_FxBase.h"
|
||||
#include "nw4r/types_nw4r.h"
|
||||
|
||||
#include "rvl/AXFX.h" // IWYU pragma: export
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
namespace detail {
|
||||
struct FxReverbStdParam {
|
||||
f32 field_0x00;
|
||||
f32 field_0x04;
|
||||
f32 field_0x08;
|
||||
f32 field_0x0C;
|
||||
f32 field_0x10;
|
||||
int field_0x14;
|
||||
f32 field_0x18;
|
||||
int field_0x1C;
|
||||
f32 field_0x20;
|
||||
f32 field_0x24;
|
||||
|
||||
FxReverbStdParam()
|
||||
: field_0x00(0.02f),
|
||||
field_0x04(3.0f),
|
||||
field_0x08(0.6f),
|
||||
field_0x0C(0.4f),
|
||||
field_0x10(1.0f),
|
||||
field_0x14(5),
|
||||
field_0x18(0.02f),
|
||||
field_0x1C(0),
|
||||
field_0x20(0.0f),
|
||||
field_0x24(1.0f) {}
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
class FxReverbStdDpl2 : public FxBase {
|
||||
public:
|
||||
public:
|
||||
FxReverbStdDpl2();
|
||||
|
||||
virtual ~FxReverbStdDpl2() {
|
||||
Shutdown();
|
||||
ReleaseWorkBuffer();
|
||||
} // at 0x8
|
||||
|
||||
virtual bool StartUp() override; // at 0xC
|
||||
virtual void Shutdown() override; // at 0x10
|
||||
|
||||
virtual void UpdateBuffer(
|
||||
int channels, void **ppBuffer, u32 size, SampleFormat format, f32 sampleRate,
|
||||
OutputMode mode
|
||||
) override; // at 0x14
|
||||
|
||||
virtual bool AssignWorkBuffer(void *pBuffer, u32 size); // at 0x18
|
||||
virtual void ReleaseWorkBuffer(); // at 0x1C
|
||||
|
||||
u32 GetRequiredMemSize();
|
||||
bool SetParam(const detail::FxReverbStdParam &rParam);
|
||||
|
||||
void OnChangeOutputMode() override;
|
||||
|
||||
private:
|
||||
u8 mIsActive;
|
||||
int mOutputMode; // at 0x10
|
||||
detail::AxfxImpl mImpl; // at 0x14
|
||||
detail::FxReverbStdParam mParam; // at 0x1C
|
||||
AXFX_REVERBSTD_EXP mAxfxParam; // at 0x44
|
||||
AXFX_REVERBSTD_EXP_DPL2 mAxfxParamDpl; // at 0x12C
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -41,6 +41,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
bool IsFinished() const { return mCounter >= mFrame; }
|
||||
|
||||
TTime GetRemainingTime() const {
|
||||
return IsFinished() ? 0 : mFrame - mCounter;
|
||||
}
|
||||
|
||||
void InitValue(TValue value)
|
||||
{
|
||||
mOrigin = value;
|
||||
|
||||
@@ -21,8 +21,9 @@ public:
|
||||
private:
|
||||
static const int SPEAKER_ALARM_HZ = 150;
|
||||
|
||||
static const int SPEAKER_ALARM_PERIOD_NSEC = static_cast<int>(1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000);
|
||||
|
||||
// commented out since it causes compiler warnings
|
||||
// static const int SPEAKER_ALARM_PERIOD_NSEC = static_cast<int>(1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000);
|
||||
static const int SPEAKER_ALARM_PERIOD_NSEC = 6666667;
|
||||
private:
|
||||
RemoteSpeakerManager();
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
|
||||
#include "nw4r/snd/snd_BasicPlayer.h"
|
||||
#include "nw4r/snd/snd_DisposeCallbackManager.h" // DisposeCallback
|
||||
#include "nw4r/snd/snd_SeqTrack.h"
|
||||
#include "nw4r/snd/snd_SoundThread.h"
|
||||
#include "nw4r/ut/ut_Lock.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* types
|
||||
@@ -128,6 +130,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
SeqTrack *GetPlayerTrack(int trackNo);
|
||||
s16 volatile *GetVariablePtr(int varNo);
|
||||
|
||||
s16 GetLocalVariable(int varNo) const;
|
||||
void SetLocalVariable(int varNo, s16 value);
|
||||
static void SetGlobalVariable(int varNo, s16 value);
|
||||
|
||||
void SetTempoRatio(f32 tempo);
|
||||
void SetReleasePriorityFix(bool fix);
|
||||
void SetChannelPriority(int priority);
|
||||
@@ -143,11 +149,19 @@ namespace nw4r { namespace snd { namespace detail
|
||||
return mParserParam.timebase * mParserParam.tempo * mTempoRatio;
|
||||
}
|
||||
|
||||
u32 GetTickCounter() const {
|
||||
return mTickCounter;
|
||||
}
|
||||
|
||||
void SetSeqData(void const *seqBase, s32 seqOffset);
|
||||
|
||||
void CallSeqUserprocCallback(u16 procId, SeqTrack *track);
|
||||
Channel *NoteOn(int bankNo, NoteOnInfo const ¬eOnInfo);
|
||||
|
||||
void SetTrackMute(u32 trackFlags, SeqMute mute);
|
||||
void SetTrackSilence(u32 trackFlags, bool silence, int fadeFrames);
|
||||
void SetTrackVolume(u32 trackFlags, f32 volume);
|
||||
|
||||
static void InitSeqPlayer();
|
||||
|
||||
private:
|
||||
@@ -162,6 +176,40 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void UpdateTick(int msec);
|
||||
void SkipTick();
|
||||
|
||||
template <typename T>
|
||||
void SetTrackParam(u32 trackFlags, void (SeqTrack::*pSetter)(T), T param) {
|
||||
ut::AutoInterruptLock lock;
|
||||
|
||||
for (int i = 0; i < TRACK_NUM && trackFlags != 0;
|
||||
trackFlags >>= 1, i++) {
|
||||
|
||||
if (trackFlags & 1) {
|
||||
SeqTrack* pTrack = GetPlayerTrack(i);
|
||||
|
||||
if (pTrack != NULL) {
|
||||
(pTrack->*pSetter)(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
void SetTrackParam(u32 trackFlags, void (SeqTrack::*pSetter)(T, U), T param, U param2) {
|
||||
ut::AutoInterruptLock lock;
|
||||
|
||||
for (int i = 0; i < TRACK_NUM && trackFlags != 0;
|
||||
trackFlags >>= 1, i++) {
|
||||
|
||||
if (trackFlags & 1) {
|
||||
SeqTrack* pTrack = GetPlayerTrack(i);
|
||||
|
||||
if (pTrack != NULL) {
|
||||
(pTrack->*pSetter)(param, param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static members
|
||||
public:
|
||||
static int const MAX_SKIP_TICK_PER_FRAME = 768;
|
||||
@@ -172,6 +220,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
static int const GLOBAL_VARIABLE_NUM = 16;
|
||||
static int const PLAYER_VARIABLE_NUM = 16;
|
||||
|
||||
static const int TRACK_NUM = 16;
|
||||
|
||||
private:
|
||||
static s16 mGlobalVariable[GLOBAL_VARIABLE_NUM];
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
/* redeclare with this class instead of BasicSound for
|
||||
* SoundInstanceManager
|
||||
*/
|
||||
typedef ut::LinkList<SeqSound, 0xe0> PriorityLinkList;
|
||||
typedef ut::LinkList<SeqSound, 0xf0> PriorityLinkList;
|
||||
|
||||
// nested types
|
||||
public:
|
||||
@@ -121,6 +121,15 @@ namespace nw4r { namespace snd { namespace detail
|
||||
static void NotifyLoadAsyncEndSeqData(bool result, void const *seqBase,
|
||||
void *userData);
|
||||
|
||||
void SetTrackMute(u32 trackFlags, SeqMute mute);
|
||||
void SetTrackSilence(u32 trackFlags, bool silence, int fadeFrames);
|
||||
void SetTrackVolume(u32 trackFlags, f32 volume);
|
||||
bool ReadVariable(int varNo, s16 *value) const;
|
||||
bool WriteVariable(int varNo, s16 value);
|
||||
static bool WriteGlobalVariable(int varNo, s16 value);
|
||||
bool WriteTrackVariable(int trackNo, int varNo, s16 value);
|
||||
u32 GetTick() const;
|
||||
|
||||
static DebugSoundType GetSoundType()
|
||||
{
|
||||
return DEBUG_SOUND_TYPE_SEQSOUND;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "common.h" // nullptr
|
||||
|
||||
#include "nw4r/snd/snd_SeqSound.h"
|
||||
#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -27,11 +28,17 @@ namespace nw4r { namespace snd
|
||||
{
|
||||
// methods
|
||||
public:
|
||||
SeqSoundHandle(SoundHandle*);
|
||||
// methods
|
||||
bool IsAttachedSound() const { return mSound != nullptr; }
|
||||
|
||||
void DetachSound();
|
||||
|
||||
void WriteVariable(int varNo, s16 value) {
|
||||
if (IsAttachedSound())
|
||||
mSound->WriteVariable(varNo, value);
|
||||
}
|
||||
|
||||
// members
|
||||
private:
|
||||
/* base ut::NonCopyable */ // size 0x00, offset 0x00
|
||||
|
||||
@@ -93,9 +93,9 @@ namespace nw4r { namespace snd { namespace detail
|
||||
MoveValue<u8, s16> volume; // size 0x06, offset 0x54
|
||||
MoveValue<s8, s16> pan; // size 0x06, offset 0x5a
|
||||
MoveValue<s8, s16> surroundPan; // size 0x06, offset 0x60
|
||||
MoveValue<s8, s16> pitchBend; // size 0x01, offset 0x68
|
||||
u8 volume2; // size 0x01, offset 0x66
|
||||
u8 velocityRange; // size 0x01, offset 0x67
|
||||
s8 pitchBend; // size 0x01, offset 0x68
|
||||
u8 bendRange; // size 0x01, offset 0x69
|
||||
s8 initPan; // size 0x01, offset 0x6a
|
||||
s8 transpose; // size 0x01, offset 0x6b
|
||||
@@ -141,6 +141,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
void SetPlayerTrackNo(int playerTrackNo);
|
||||
void SetVolume(f32);
|
||||
void SetTrackVariable(int variable, s16 value);
|
||||
void SetPitch(f32);
|
||||
void SetPan(f32);
|
||||
void SetSurroundPan(f32);
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
#ifndef NW4R_SND_SOUND_3D_ACTOR_H
|
||||
#define NW4R_SND_SOUND_3D_ACTOR_H
|
||||
|
||||
#include "nw4r/math.h"
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_SoundActor.h"
|
||||
#include "nw4r/types_nw4r.h"
|
||||
|
||||
#include "nw4r/math.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
@@ -14,16 +14,12 @@ namespace snd {
|
||||
class Sound3DActor : public SoundActor, public detail::BasicSound::AmbientInfo::AmbientArgUpdateCallback {
|
||||
public:
|
||||
Sound3DActor(SoundArchivePlayer &rPlayer, Sound3DManager &rManager);
|
||||
virtual ~Sound3DActor(); // at 0x8
|
||||
virtual ~Sound3DActor();
|
||||
|
||||
virtual StartResult detail_SetupSound(
|
||||
SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo,
|
||||
detail::ExternalSoundPlayer *pPlayer, bool hold,
|
||||
const StartInfo *pStartInfo
|
||||
); // at 0xC
|
||||
virtual StartResult SetupSound(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) override;
|
||||
|
||||
virtual void detail_Update(void *pArg,
|
||||
const detail::BasicSound *pSound); // at 0xC
|
||||
// AmbientArgUpdateCallback
|
||||
virtual void at_0x0c(void *arg, detail::BasicSound* sound) override;
|
||||
|
||||
void SetPosition(const math::VEC3 &rPosition);
|
||||
|
||||
@@ -31,10 +27,12 @@ private:
|
||||
static void ClearUpdateCallback(SoundHandle &rHandle);
|
||||
|
||||
private:
|
||||
Sound3DManager &m3DManager; // at 0xAC
|
||||
SoundArchivePlayer &mSoundArchivePlayer; // at 0xB0
|
||||
u32 mUserParam; // at 0xB4
|
||||
math::VEC3 mPosition; // at 0xB8
|
||||
Sound3DManager &m3DManager; // at 0x58
|
||||
SoundArchivePlayer *mSoundArchivePlayer; // at 0x5C
|
||||
u32 mUserParam; // at 0x60
|
||||
math::VEC3 mPosition; // at 0x64
|
||||
math::VEC3 mVelocity; // at 0x70
|
||||
bool mSkipVelocityUpdate; // at 0x7C
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef NW4R_SND_SOUND_3D_CALCULATOR_H
|
||||
#define NW4R_SND_SOUND_3D_CALCULATOR_H
|
||||
|
||||
#include "common.h"
|
||||
#include "nw4r/math/math_triangular.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
class Sound3DManager;
|
||||
class Sound3DParam;
|
||||
|
||||
class Sound3DCalculator {
|
||||
public:
|
||||
struct CalcPanParam {
|
||||
f32 speakerAngleStereo; // at 0x00
|
||||
f32 frontSpeakerAngleDpl2; // at 0x04
|
||||
f32 rearSpeakerAngleDpl2; // at 0x08
|
||||
f32 initPan; // at 0x0C
|
||||
|
||||
CalcPanParam()
|
||||
: speakerAngleStereo(NW4R_MATH_PI / 4),
|
||||
frontSpeakerAngleDpl2(NW4R_MATH_PI / 6),
|
||||
rearSpeakerAngleDpl2(2 * NW4R_MATH_PI / 3),
|
||||
initPan(0.0f) {}
|
||||
};
|
||||
|
||||
static void
|
||||
CalcVolumeAndPriority(const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, float *, int *);
|
||||
static void CalcPan(
|
||||
const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, const Sound3DCalculator::CalcPanParam &,
|
||||
float *pan, float *surroundPan
|
||||
);
|
||||
static void CalcPitch(const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, float *);
|
||||
static void CalcBiquadFilterValue(const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, float *);
|
||||
static void CalcPanDpl2(const nw4r::math::VEC3 &, float, float, float, float, float, float, float *, float *);
|
||||
static void CalcPanStereo(const nw4r::math::VEC3 &, float, float, float, float, float *, float *);
|
||||
static void CalcAngleAndDistance(const nw4r::math::VEC3 &, float, float, float *, float *);
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef NW4R_SND_SOUND_3D_ENGINE_H
|
||||
#define NW4R_SND_SOUND_3D_ENGINE_H
|
||||
|
||||
#include "nw4r/types_nw4r.h"
|
||||
#include "nw4r/snd/snd_Sound3DCalculator.h"
|
||||
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
class Sound3DManager;
|
||||
class SoundAmbientParam;
|
||||
|
||||
class Sound3DEngine {
|
||||
public:
|
||||
Sound3DEngine();
|
||||
virtual ~Sound3DEngine() {}
|
||||
|
||||
virtual void UpdateAmbientParam(const Sound3DManager*, const Sound3DParam*, u32, int, SoundAmbientParam*);
|
||||
virtual s32 GetAmbientPriority(const Sound3DManager*, const Sound3DParam*, u32);
|
||||
virtual s32 GetRequiredVoiceOutCount(const Sound3DManager*, const Sound3DParam*, u32);
|
||||
virtual void UpdateAmbientParam(const Sound3DManager*, const Sound3DParam*, u32, u32, SoundAmbientParam*);
|
||||
|
||||
private:
|
||||
Sound3DCalculator::CalcPanParam mPanParam; // at 0x04
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,10 @@
|
||||
#ifndef NW4R_SND_SOUND_3D_LISTENER_H
|
||||
#define NW4R_SND_SOUND_3D_LISTENER_H
|
||||
#include "nw4r/math.h"
|
||||
#include "common.h"
|
||||
#include "nw4r/types_nw4r.h"
|
||||
#include "nw4r/ut/ut_LinkList.h"
|
||||
|
||||
#include "nw4r/math.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
@@ -15,32 +17,53 @@ public:
|
||||
return mMtx;
|
||||
}
|
||||
|
||||
const math::VEC3 &GetPosition() const {
|
||||
return mPosition;
|
||||
}
|
||||
|
||||
const math::VEC3 &GetVelocity() const {
|
||||
return mVelocity;
|
||||
}
|
||||
|
||||
void SetMatrix(const math::MTX34 &mtx);
|
||||
|
||||
f32 GetInteriorSize() const {
|
||||
return mInteriorSize;
|
||||
}
|
||||
void SetInteriorSize(f32 size) {
|
||||
mInteriorSize = size;
|
||||
}
|
||||
void SetInteriorSize(f32 size);
|
||||
|
||||
f32 GetMaxVolumeDistance() const {
|
||||
return mMaxVolumeDistance;
|
||||
}
|
||||
void SetMaxVolumeDistance(f32 distance) {
|
||||
mMaxVolumeDistance = distance;
|
||||
}
|
||||
void SetMaxVolumeDistance(f32 distance);
|
||||
|
||||
f32 GetUnitDistance() const {
|
||||
return mUnitDistance;
|
||||
}
|
||||
void SetUnitDistance(f32 distance) {
|
||||
mUnitDistance = distance;
|
||||
void SetUnitDistance(f32 distance);
|
||||
|
||||
f32 GetUnitBiquadFilterValue() const {
|
||||
return mUnitBiquadFilterValue;
|
||||
}
|
||||
void SetUnitBiquadFilterValue(f32 value);
|
||||
|
||||
f32 GetUnitBiquadFilterMax() const {
|
||||
return mUnitBiquadFilterMax;
|
||||
}
|
||||
void SetUnitBiquadFilterMax(f32 value);
|
||||
|
||||
private:
|
||||
math::MTX34 mMtx; // at 0x0
|
||||
f32 mInteriorSize; // at 0x30
|
||||
f32 mMaxVolumeDistance; // at 0x34
|
||||
f32 mUnitDistance; // at 0x38
|
||||
math::MTX34 mMtx; // at 0x0
|
||||
math::VEC3 mPosition; // at 0x30
|
||||
math::VEC3 mVelocity; // at 0x3C
|
||||
f32 mInteriorSize; // at 0x48
|
||||
f32 mMaxVolumeDistance; // at 0x4C
|
||||
f32 mUnitDistance; // at 0x50
|
||||
UNKWORD field_0x54; // at 0x54
|
||||
u8 mSkipVelocityUpdate; // at 0x58
|
||||
f32 mUnitBiquadFilterValue; // at 0x5C
|
||||
f32 mUnitBiquadFilterMax; // at 0x60
|
||||
ut::LinkListNode mNode; // at 0x64
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
|
||||
@@ -1,47 +1,55 @@
|
||||
#ifndef NW4R_SND_SOUND_3D_MANAGER_H
|
||||
#define NW4R_SND_SOUND_3D_MANAGER_H
|
||||
#include "nw4r/math.h"
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_InstancePool.h"
|
||||
#include "nw4r/snd/snd_Sound3DEngine.h"
|
||||
#include "nw4r/snd/snd_SoundArchive.h"
|
||||
#include "nw4r/types_nw4r.h"
|
||||
#include "nw4r/ut/ut_LinkList.h"
|
||||
|
||||
#include "nw4r/math.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
struct Sound3DParam {
|
||||
/* 0x00 */ math::VEC3 position;
|
||||
/* 0x0C */ math::VEC3 velocity;
|
||||
/* 0x18 */ UNKWORD field_0x18;
|
||||
/* 0x1C */ u8 decayCurve;
|
||||
/* 0x1D */ u8 decayRatio;
|
||||
/* 0x1E */ u8 field_0x1E;
|
||||
/* 0x20 */ u32 userParam;
|
||||
/* 0x24 */ UNKWORD field_0x24;
|
||||
|
||||
Sound3DParam();
|
||||
};
|
||||
|
||||
class Sound3DManager : public detail::BasicSound::AmbientInfo::AmbientParamUpdateCallback,
|
||||
public detail::BasicSound::AmbientInfo::AmbientArgAllocaterCallback {
|
||||
public:
|
||||
struct Sound3DActorParam {
|
||||
u32 userParam; // at 0x0
|
||||
SoundArchive::Sound3DParam soundParam; // at 0x4
|
||||
math::VEC3 position; // at 0xC
|
||||
typedef ut::LinkList<Sound3DListener, 0x64> ListenerList;
|
||||
|
||||
Sound3DActorParam();
|
||||
};
|
||||
|
||||
public:
|
||||
Sound3DManager();
|
||||
|
||||
virtual void detail_Update(
|
||||
SoundParam *pParam, u32 id, detail::BasicSound *pSound, const void *pArg,
|
||||
u32 flags
|
||||
); // at 0x8
|
||||
virtual void detail_UpdateAmbientParam(const void*, u32, int, SoundAmbientParam*) override;
|
||||
virtual int detail_GetAmbientPriority(const void*, u32) override;
|
||||
virtual int detail_GetRequiredVoiceOutCount(const void*, u32) override;
|
||||
|
||||
virtual void Update(SoundParam *pParam, u32 id, SoundHandle *pHandle, const void *pArg,
|
||||
u32 flags); // at 0x10
|
||||
|
||||
virtual void *detail_AllocAmbientArg(u32 size); // at 0x14
|
||||
virtual void *detail_AllocAmbientArg(u32 size) override;
|
||||
|
||||
virtual void detail_FreeAmbientArg(void *pArg,
|
||||
const detail::BasicSound *pSound); // at 0x18
|
||||
const detail::BasicSound *pSound) override;
|
||||
|
||||
u32 GetRequiredMemSize(const SoundArchive *pArchive);
|
||||
bool Setup(const SoundArchive *pArchive, void *pBuffer, u32 size);
|
||||
|
||||
Sound3DListener *GetListener() const {
|
||||
return mListener;
|
||||
const ListenerList &GetListenerList() const {
|
||||
return mListenerList;
|
||||
}
|
||||
|
||||
ListenerList &GetListenerList() {
|
||||
return mListenerList;
|
||||
}
|
||||
|
||||
int GetMaxPriorityReduction() const {
|
||||
@@ -51,11 +59,21 @@ public:
|
||||
mMaxPriorityReduction = max;
|
||||
}
|
||||
|
||||
f32 GetPanRange() const {
|
||||
return mPanRange;
|
||||
int GetBiquadFilterType() const {
|
||||
return mBiquadFilterType;
|
||||
}
|
||||
void SetBiquadFilterType(int type);
|
||||
|
||||
f32 GetField0x20() const {
|
||||
return field_0x20;
|
||||
}
|
||||
|
||||
private:
|
||||
f32 GetField0x24() const {
|
||||
return field_0x24;
|
||||
}
|
||||
|
||||
void SetEngine(Sound3DEngine *engine);
|
||||
|
||||
enum ParamDecayCurve {
|
||||
DECAY_CURVE_NONE,
|
||||
DECAY_CURVE_LOGARITHMIC,
|
||||
@@ -63,16 +81,13 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
detail::InstancePool<Sound3DActorParam> mParamPool; // at 0x8
|
||||
Sound3DListener *mListener; // at 0xC
|
||||
s32 mMaxPriorityReduction; // at 0x10
|
||||
|
||||
f32 mSpeakerAngleStereo; // at 0x14
|
||||
f32 mFrontSpeakerAngleDpl2; // at 0x18
|
||||
f32 mRearSpeakerAngleDpl2; // at 0x1C
|
||||
|
||||
f32 mInitPan; // at 0x20
|
||||
f32 mPanRange; // at 0x24
|
||||
detail::InstancePool<Sound3DParam> mParamPool; // at 0x8
|
||||
ListenerList mListenerList; // at 0x0C
|
||||
Sound3DEngine *mpEngine; // at 0x18
|
||||
s32 mMaxPriorityReduction; // at 0x1C
|
||||
f32 field_0x20; // at 0x20
|
||||
f32 field_0x24; // at 0x24
|
||||
int mBiquadFilterType; // at 0x28
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
|
||||
@@ -30,8 +30,17 @@ namespace nw4r { namespace snd
|
||||
// methods
|
||||
public:
|
||||
// cdtors
|
||||
SoundActor();
|
||||
SoundActor(SoundArchivePlayer &player);
|
||||
virtual ~SoundActor();
|
||||
|
||||
virtual u32 detail_ConvertLabelStringToSoundId(const char* label) override;
|
||||
virtual StartResult detail_SetupSound(SoundHandle *pHandle, u32 soundId, bool holdFlag, const StartInfo *pStartInfo) override;
|
||||
|
||||
|
||||
virtual StartResult SetupSound(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void*);
|
||||
virtual StartResult detail_SetupSoundWithAmbientInfo(SoundHandle*, u32, const StartInfo*, detail::BasicSound::AmbientInfo*, void*);
|
||||
|
||||
|
||||
// methods
|
||||
detail::ExternalSoundPlayer *detail_GetActorPlayer(int actorPlayerId)
|
||||
{
|
||||
@@ -41,11 +50,25 @@ namespace nw4r { namespace snd
|
||||
return &mActorPlayer[actorPlayerId];
|
||||
}
|
||||
|
||||
|
||||
template <typename TForEachFunc>
|
||||
TForEachFunc ForEachSound(TForEachFunc pFunc, bool reverse) {
|
||||
for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) {
|
||||
mActorPlayer[i].ForEachSound(pFunc, reverse);
|
||||
}
|
||||
|
||||
return pFunc;
|
||||
}
|
||||
|
||||
detail::SoundActorParam const &detail_GetActorParam() const
|
||||
{
|
||||
return mActorParam;
|
||||
}
|
||||
|
||||
void StopAllSound(int fadeFrames);
|
||||
void PauseAllSound(bool flag, int fadeFrames);
|
||||
int GetPlayingSoundCount(int playerId) const;
|
||||
|
||||
// static members
|
||||
public:
|
||||
static int const ACTOR_PLAYER_COUNT = 4;
|
||||
|
||||
@@ -123,6 +123,7 @@ namespace nw4r { namespace snd
|
||||
u32 flags; // at 0x0
|
||||
u8 decayCurve; // at 0x4
|
||||
u8 decayRatio; // at 0x5
|
||||
u8 field_0x06; // at 0x6
|
||||
};
|
||||
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x256dc
|
||||
@@ -180,6 +181,7 @@ namespace nw4r { namespace snd
|
||||
u32 ConvertLabelStringToSoundId(char const *label) const;
|
||||
u32 ConvertLabelStringToPlayerId(const char* pLabel) const;
|
||||
u32 ConvertLabelStringToGroupId(const char* pLabel) const;
|
||||
u32 ConvertLabelStringToBankId(const char* pLabel) const;
|
||||
u32 GetSoundUserParam(u32 id) const;
|
||||
|
||||
bool ReadSoundInfo(u32 soundId, SoundInfo *info) const;
|
||||
@@ -189,6 +191,7 @@ namespace nw4r { namespace snd
|
||||
|
||||
bool ReadPlayerInfo(u32 playerId, PlayerInfo *info) const;
|
||||
bool ReadSoundArchivePlayerInfo(SoundArchivePlayerInfo *info) const;
|
||||
bool detail_ReadSound3DParam(u32 soundId, nw4r::snd::SoundArchive::Sound3DParam*) const;
|
||||
|
||||
bool ReadBankInfo(u32 bankId, BankInfo *info) const;
|
||||
|
||||
|
||||
@@ -99,7 +99,12 @@ namespace nw4r { namespace snd { namespace detail
|
||||
SOUND_TYPE_WAVE,
|
||||
};
|
||||
|
||||
struct Sound3DParam;
|
||||
struct Sound3DParam {
|
||||
u32 flags;
|
||||
u8 decayCurve;
|
||||
u8 decayRatio;
|
||||
u8 field_0x06;
|
||||
};
|
||||
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x25183
|
||||
struct SeqSoundInfo
|
||||
@@ -295,6 +300,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
char const *GetString(u32 id) const;
|
||||
SoundArchive::SoundType GetSoundType(u32 soundId) const;
|
||||
u32 GetSoundStringId(u32 id) const;
|
||||
u32 GetBankCount() const;
|
||||
u32 GetPlayerCount() const;
|
||||
u32 GetGroupCount() const;
|
||||
@@ -323,6 +329,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
bool ReadBankInfo(u32 bankId, SoundArchive::BankInfo *info) const;
|
||||
|
||||
bool ReadPlayerInfo(u32 playerId, SoundArchive::PlayerInfo *info) const;
|
||||
bool ReadSound3DParam(u32 soundId, nw4r::snd::SoundArchive::Sound3DParam* info) const;
|
||||
|
||||
bool ReadGroupItemInfo(u32 groupId, u32 index,
|
||||
SoundArchive::GroupItemInfo *info) const;
|
||||
@@ -346,6 +353,9 @@ namespace nw4r { namespace snd { namespace detail
|
||||
u32 ConvertLabelStringToGroupId(const char* pLabel) const {
|
||||
return ConvertLabelStringToId(mStringTreeGroup, pLabel);
|
||||
}
|
||||
u32 ConvertLabelStringToBankId(const char* pLabel) const {
|
||||
return ConvertLabelStringToId(mStringTreeBank, pLabel);
|
||||
}
|
||||
|
||||
private:
|
||||
static bool IsValidFileHeader(void const *soundArchiveData);
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
~SoundArchiveLoader();
|
||||
|
||||
void *LoadGroup(u32 id, SoundMemoryAllocatable *pAllocatable, void **ppWaveBuffer, u32 blockSize);
|
||||
s32 ReadFile(u32, void *, s32, s32);
|
||||
void *LoadFile(u32 id, SoundMemoryAllocatable* pAllocatable);
|
||||
|
||||
private:
|
||||
mutable OSMutex mMutex; // at 0x0
|
||||
|
||||
@@ -55,8 +55,8 @@ namespace nw4r { namespace snd
|
||||
public:
|
||||
// virtual function ordering
|
||||
// vtable SoundArchivePlayer_FileManager
|
||||
virtual void const *at_0x08(int) = 0;
|
||||
virtual void const *at_0x0c(int) = 0;
|
||||
virtual void const *GetFileAddress(u32) = 0;
|
||||
virtual void const *GetFileWaveDataAddress(u32) = 0;
|
||||
|
||||
// members
|
||||
private:
|
||||
@@ -98,6 +98,8 @@ namespace nw4r { namespace snd
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~SeqNoteOnCallback() {}
|
||||
|
||||
// virtual function ordering
|
||||
// vtable NoteOnCallback
|
||||
virtual detail::Channel *NoteOn(
|
||||
@@ -176,6 +178,8 @@ namespace nw4r { namespace snd
|
||||
return LoadGroup(static_cast<u32>(id), pAllocatable, blockSize);
|
||||
}
|
||||
|
||||
bool IsLoadedGroup(u32 groupId) const;
|
||||
|
||||
SoundArchive const &GetSoundArchive() const;
|
||||
u32 GetSoundPlayerCount() const { return mSoundPlayerCount; }
|
||||
SoundPlayer &GetSoundPlayer(u32 playerId);
|
||||
@@ -218,6 +222,11 @@ namespace nw4r { namespace snd
|
||||
void UpdateCommonSoundParam(detail::BasicSound *sound,
|
||||
SoundArchive::SoundInfo const *commonInfo);
|
||||
|
||||
SoundStartable::StartResult detail_SetupSoundImpl(
|
||||
SoundHandle *handle, u32 soundId,
|
||||
detail::BasicSound::AmbientInfo *ambientArgInfo, SoundActor *actor,
|
||||
bool holdFlag, SoundStartable::StartInfo const *startInfo);
|
||||
|
||||
private:
|
||||
template <typename Sound>
|
||||
Sound *AllocSound(
|
||||
@@ -225,10 +234,6 @@ namespace nw4r { namespace snd
|
||||
int priority, int ambientPriority,
|
||||
detail::BasicSound::AmbientInfo *ambientArgInfo);
|
||||
|
||||
SoundStartable::StartResult detail_SetupSoundImpl(
|
||||
SoundHandle *handle, u32 soundId,
|
||||
detail::BasicSound::AmbientInfo *ambientArgInfo, SoundActor *actor,
|
||||
bool holdFlag, SoundStartable::StartInfo const *startInfo);
|
||||
SoundStartable::StartResult PrepareSeqImpl(
|
||||
detail::SeqSound *sound, SoundArchive::SoundInfo const *commonInfo,
|
||||
SoundArchive::SeqSoundInfo const *info,
|
||||
|
||||
@@ -31,8 +31,14 @@ namespace nw4r { namespace snd
|
||||
void detail_AttachSound(detail::BasicSound *sound);
|
||||
bool IsAttachedSound() const { return mSound != nullptr; }
|
||||
detail::BasicSound *detail_GetAttachedSound() { return mSound; }
|
||||
const detail::BasicSound *detail_GetAttachedSound() const { return mSound; }
|
||||
void DetachSound();
|
||||
|
||||
void Stop() {
|
||||
if (IsAttachedSound())
|
||||
mSound->Stop(0);
|
||||
}
|
||||
|
||||
u32 GetId() const
|
||||
{
|
||||
if (IsAttachedSound())
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
private:
|
||||
MemoryPool<Sound> mPool; // size 0x04, offset 0x00
|
||||
typename Sound::PriorityLinkList mPriorityList; // size 0x0c, offset 0x04
|
||||
mutable OSMutex mMutex; // size 0x18, offset 0x10
|
||||
OSMutex mMutex; // size 0x18, offset 0x10
|
||||
}; // size 0x28
|
||||
}}} // namespace nw4r::snd::detail
|
||||
|
||||
|
||||
@@ -30,15 +30,19 @@ namespace nw4r { namespace snd
|
||||
// methods
|
||||
int GetPlayableSoundCount() const { return mPlayableCount; }
|
||||
f32 GetVolume() const { return mVolume; }
|
||||
void SetVolume(f32 volume);
|
||||
f32 GetLpfFreq() const { return mLpfFreq; }
|
||||
void SetLpfFreq(f32 freq);
|
||||
int GetDefaultOutputLine() const { return mOutputLineFlag; }
|
||||
f32 GetMainOutVolume() const { return mMainOutVolume; }
|
||||
int GetBiquadFilterType() const { return mBiquadType; }
|
||||
f32 GetBiquadFilterValue() const { return mBiquadValue; }
|
||||
f32 GetMainSend() const { return mMainSend; }
|
||||
f32 GetFxSend(int index) const { return mFxSend[index]; }
|
||||
void SetFxSend(AuxBus, f32);
|
||||
|
||||
void SetPlayableSoundCount(int count);
|
||||
f32 GetRemoteOutVolume(int remote) const;
|
||||
|
||||
int GetPlayingSoundCount() const { return mSoundList.GetSize(); }
|
||||
detail::BasicSound *GetLowestPrioritySound()
|
||||
@@ -78,6 +82,7 @@ namespace nw4r { namespace snd
|
||||
f32 mMainOutVolume; // size 0x04, offset 0x38
|
||||
int mBiquadType; // size 0x04, offset 0x3c
|
||||
f32 mBiquadValue; // size 0x04, offset 0x40
|
||||
f32 mRemoteOutVolume[4];
|
||||
f32 mMainSend; // size 0x04, offset 0x44
|
||||
f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0x48
|
||||
}; // size 0x54
|
||||
|
||||
@@ -108,52 +108,58 @@ namespace nw4r { namespace snd
|
||||
SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo
|
||||
);
|
||||
StartResult detail_StartSound(
|
||||
SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo,
|
||||
detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo
|
||||
SoundHandle *pHandle, const char *label, const StartInfo *pStartInfo
|
||||
);
|
||||
|
||||
StartResult detail_HoldSound(
|
||||
SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo
|
||||
);
|
||||
|
||||
StartResult detail_HoldSound(
|
||||
SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo,
|
||||
detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo
|
||||
SoundHandle *pHandle, const char *label, const StartInfo *pStartInfo
|
||||
);
|
||||
|
||||
StartResult detail_PrepareSound(
|
||||
SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo,
|
||||
detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo
|
||||
SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo
|
||||
);
|
||||
StartResult detail_PrepareSound(
|
||||
SoundHandle *pHandle, const char *label,
|
||||
const StartInfo *pStartInfo
|
||||
);
|
||||
|
||||
bool StartSound(SoundHandle *pHandle, u32 id) {
|
||||
return detail_StartSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_StartSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
bool StartSound(SoundHandle *pHandle, const char *label) {
|
||||
return detail_StartSound(pHandle, label, NULL) == START_SUCCESS;
|
||||
}
|
||||
bool StartSound(SoundHandle *pHandle, unsigned int id) {
|
||||
return detail_StartSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_StartSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
bool StartSound(SoundHandle *pHandle, int id) {
|
||||
return detail_StartSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_StartSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
|
||||
bool HoldSound(SoundHandle *pHandle, u32 id) {
|
||||
return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_HoldSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
bool HoldSound(SoundHandle *pHandle, const char *label) {
|
||||
return detail_HoldSound(pHandle, label, NULL) == START_SUCCESS;
|
||||
}
|
||||
bool HoldSound(SoundHandle *pHandle, unsigned int id) {
|
||||
return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_HoldSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
bool HoldSound(SoundHandle *pHandle, int id) {
|
||||
return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_HoldSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
|
||||
bool PrepareSound(SoundHandle *pHandle, u32 id) {
|
||||
return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_PrepareSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
bool PrepareSound(SoundHandle *pHandle, unsigned int id) {
|
||||
return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_PrepareSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
bool PrepareSound(SoundHandle *pHandle, int id) {
|
||||
return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS;
|
||||
return detail_PrepareSound(pHandle, id, NULL) == START_SUCCESS;
|
||||
}
|
||||
|
||||
// members
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
static void *SoundThreadFunc(void *arg);
|
||||
void SoundThreadProc();
|
||||
void FrameProcess();
|
||||
|
||||
// static members
|
||||
private:
|
||||
@@ -121,6 +122,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
PlayerCallback::LinkList mPlayerCallbackList; // size 0x00c, offset 0x384
|
||||
u32 mProcessTick; // size 0x004, offset 0x390
|
||||
bool mCreateFlag; // size 0x001, offset 0x394
|
||||
bool field_0x395; // size 0x001, offset 0x395
|
||||
/* 3 bytes padding */
|
||||
}; // size 0x398
|
||||
}}} // namespace nw4r::snd::detail
|
||||
|
||||
@@ -31,7 +31,17 @@ namespace nw4r { namespace ut { class FileStream; }}
|
||||
* classes and functions
|
||||
*/
|
||||
|
||||
namespace nw4r { namespace snd { namespace detail
|
||||
namespace nw4r { namespace snd {
|
||||
|
||||
struct StrmDataInfo
|
||||
{
|
||||
/* 0x00 */ bool loopFlag;
|
||||
/* 0x04 */ int sampleRate;
|
||||
/* 0x08 */ u32 loopStart;
|
||||
/* 0x0C */ u32 loopEnd;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2fcda
|
||||
class StrmPlayer : public BasicPlayer, public SoundThread::PlayerCallback
|
||||
@@ -162,7 +172,9 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
void SetAdpcmLoopContext(int channelNum, u16 *predScale);
|
||||
void SetTrackVolume(u32 trackBitFlag, f32 volume);
|
||||
u32 GetPlaySamplePosition() const;
|
||||
|
||||
bool ReadStrmDataInfo(StrmDataInfo*) const;
|
||||
void InitParam();
|
||||
bool SetupPlayer();
|
||||
bool Prepare(ut::FileStream *fileStream,
|
||||
@@ -221,8 +233,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
/* base BasicPlayer */ // size 0x0a4, offset 0x000
|
||||
/* base SoundThread::PlayerCallback */ // size 0x00c, offset 0x0a4
|
||||
StrmFileReader::StrmInfo mStrmInfo; // size 0x040, offset 0x0b0
|
||||
bool mSetupFlag; // size 0x001, offset 0x0f0
|
||||
bool volatile mActiveFlag; // size 0x001, offset 0x0f1
|
||||
bool volatile mSetupFlag; // size 0x001, offset 0x0f0
|
||||
bool mActiveFlag; // size 0x001, offset 0x0f1
|
||||
bool mStartedFlag; // size 0x001, offset 0x0f2
|
||||
bool mPreparedFlag; // size 0x001, offset 0x0f3
|
||||
bool mTaskErrorFlag; // size 0x001, offset 0x0f4
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
/* redeclare with this class instead of BasicSound for
|
||||
* SoundInstanceManager
|
||||
*/
|
||||
typedef ut::LinkList<StrmSound, 0xe0> PriorityLinkList;
|
||||
typedef ut::LinkList<StrmSound, 0xf0> PriorityLinkList;
|
||||
|
||||
// methods
|
||||
public:
|
||||
@@ -80,6 +80,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
bool Prepare(StrmPlayer::StartOffsetType startOffsetType, s32 offset,
|
||||
ut::FileStream *fileStream);
|
||||
|
||||
void SetTrackVolume(u32 trackFlags, f32 volume, int fadeFrames);
|
||||
|
||||
static DebugSoundType GetSoundType()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "common.h" // nullptr
|
||||
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -28,6 +29,7 @@ namespace nw4r { namespace snd
|
||||
// methods
|
||||
public:
|
||||
// methods
|
||||
StrmSoundHandle(SoundHandle*);
|
||||
bool IsAttachedSound() const { return mSound != nullptr; }
|
||||
|
||||
void DetachSound();
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
// typedefs
|
||||
public:
|
||||
typedef ut::LinkList<Voice, 0xec> LinkList;
|
||||
typedef ut::LinkList<Voice, 0xfc> LinkList;
|
||||
|
||||
typedef void Callback(Voice *dropVoice, VoiceCallbackStatus status,
|
||||
void *callbackData);
|
||||
@@ -92,6 +92,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
void SetMainOutVolume(f32 volume);
|
||||
void SetMainSend(f32 send);
|
||||
void SetFxSend(AuxBus bus, f32 send);
|
||||
void SetRemoteOutVolume(int remote, f32 volume);
|
||||
void SetPitch(f32 pitch);
|
||||
void SetVolume(f32 volume);
|
||||
void SetVeVolume(f32 targetVolume, f32 initVolume);
|
||||
@@ -103,6 +104,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
{
|
||||
return IsActive() && mAxVoice[0][0]->IsPlayFinished();
|
||||
}
|
||||
bool IsRun() const
|
||||
{
|
||||
return IsActive() && mAxVoice[0][0]->IsRun();
|
||||
}
|
||||
SampleFormat GetFormat() const;
|
||||
u32 GetCurrentPlayingSample() const;
|
||||
int GetPhysicalVoiceCount() const
|
||||
@@ -228,6 +233,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
f32 mMainOutVolume; // size 0x04, offset 0xc0
|
||||
f32 mMainSend; // size 0x04, offset 0xc4
|
||||
f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0xc8
|
||||
f32 mRemoteOutVolume[4]; // size 0x10, offset 0xd4 TODO following sizes wrong
|
||||
f32 mPitch; // size 0x04, offset 0xd4
|
||||
f32 mVolume; // size 0x04, offset 0xd8
|
||||
f32 mVeInitVolume; // size 0x04, offset 0xdc
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
/* redeclare with this class instead of BasicSound for
|
||||
* SoundInstanceManager
|
||||
*/
|
||||
typedef ut::LinkList<WaveSound, 0xe0> PriorityLinkList;
|
||||
typedef ut::LinkList<WaveSound, 0xf0> PriorityLinkList;
|
||||
|
||||
// methods
|
||||
public:
|
||||
|
||||
@@ -18,7 +18,16 @@
|
||||
* classes and functions
|
||||
*/
|
||||
|
||||
namespace nw4r { namespace snd { namespace detail
|
||||
namespace nw4r { namespace snd {
|
||||
|
||||
struct WsdDataInfo {
|
||||
/* 0x00 */ bool loopFlag;
|
||||
/* 0x04 */ int sampleRate;
|
||||
/* 0x08 */ u32 loopStart;
|
||||
/* 0x0C */ u32 loopEnd;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x30b74
|
||||
class WsdPlayer : public BasicPlayer,
|
||||
@@ -98,6 +107,7 @@ namespace nw4r { namespace snd { namespace detail
|
||||
{
|
||||
return mChannel != nullptr && mChannel->IsActive();
|
||||
}
|
||||
bool ReadWsdDataInfo(WsdDataInfo*) const;
|
||||
u32 GetPlaySamplePosition() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -328,7 +328,7 @@ public:
|
||||
return Iterator(LinkListImpl::GetBeginIter());
|
||||
}
|
||||
ConstIterator GetBeginIter() const {
|
||||
return ConstIterator(GetBeginIter());
|
||||
return const_cast<LinkList *>(this)->LinkListImpl::GetBeginIter();
|
||||
}
|
||||
detail::ReverseIterator<Iterator> GetBeginReverseIter() {
|
||||
return detail::ReverseIterator<Iterator>(GetBeginIter());
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
return Iterator(LinkListImpl::GetEndIter());
|
||||
}
|
||||
ConstIterator GetEndIter() const {
|
||||
return ConstIterator(GetEndIter());
|
||||
return const_cast<LinkList *>(this)->LinkListImpl::GetEndIter();
|
||||
}
|
||||
detail::ReverseIterator<Iterator> GetEndReverseIter() {
|
||||
return detail::ReverseIterator<Iterator>(GetEndIter());
|
||||
|
||||
@@ -47,8 +47,12 @@ inline TDerived DynamicCast(TBase *ptr) {
|
||||
// Derived type info
|
||||
const detail::RuntimeTypeInfo *derivedTypeInfo = detail::GetTypeInfoFromPtr_(static_cast<TDerived>(NULL));
|
||||
// Downcast if possible
|
||||
if (ptr && ptr->GetRuntimeTypeInfo()->IsDerivedFrom(derivedTypeInfo)) {
|
||||
return static_cast<TDerived>(ptr);
|
||||
// NB Wii/1.6 used in SND seems to be very sensitive to the way this
|
||||
// is structured while Wii/1.5 and below don't seem to care at all
|
||||
if (ptr) {
|
||||
if (ptr->GetRuntimeTypeInfo()->IsDerivedFrom(derivedTypeInfo)) {
|
||||
return static_cast<TDerived>(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -15,6 +15,7 @@ extern "C" {
|
||||
#include "rvl/AXFX/AXFXReverbHiExp.h"
|
||||
#include "rvl/AXFX/AXFXReverbHiExpDpl2.h"
|
||||
#include "rvl/AXFX/AXFXSrcCoef.h"
|
||||
#include "rvl/AXFX/AXFXReverbStd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef RVL_SDK_AXFX_REVERB_STD_H
|
||||
#define RVL_SDK_AXFX_REVERB_STD_H
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct AXFX_REVERBSTD_EXP {
|
||||
u8 _0x00[0xB4];
|
||||
u32 field_0xB4;
|
||||
f32 field_0xB8;
|
||||
f32 field_0xBC;
|
||||
u32 field_0xC0;
|
||||
f32 field_0xC4;
|
||||
f32 field_0xC8;
|
||||
f32 field_0xCC;
|
||||
f32 field_0xD0;
|
||||
f32 field_0xD4;
|
||||
u32 field_0xD8;
|
||||
u32 field_0xDC;
|
||||
f32 field_0xE0;
|
||||
f32 field_0xE4;
|
||||
} AXFX_REVERBSTD_EXP;
|
||||
|
||||
typedef struct AXFX_REVERBSTD_EXP_DPL2 {
|
||||
u8 _0x00[0xD0];
|
||||
u32 field_0xD0;
|
||||
f32 field_0xD4;
|
||||
f32 field_0xD8;
|
||||
u32 field_0xDC;
|
||||
f32 field_0xE0;
|
||||
f32 field_0xE4;
|
||||
f32 field_0xE8;
|
||||
f32 field_0xEC;
|
||||
f32 field_0xF0;
|
||||
u32 field_0xF4;
|
||||
u32 field_0xF8;
|
||||
f32 field_0xFC;
|
||||
f32 field_0x100;
|
||||
} AXFX_REVERBSTD_EXP_DPL2;
|
||||
|
||||
u32 AXFXReverbStdExpGetMemSize(const AXFX_REVERBSTD_EXP *fx);
|
||||
BOOL AXFXReverbStdExpInit(AXFX_REVERBSTD_EXP *fx);
|
||||
void AXFXReverbStdExpShutdown(AXFX_REVERBSTD_EXP *fx);
|
||||
BOOL AXFXReverbStdExpSettings(AXFX_REVERBSTD_EXP *fx);
|
||||
BOOL AXFXReverbStdExpSettingsUpdate(AXFX_REVERBSTD_EXP *fx);
|
||||
void AXFXReverbStdExpCallback(void* chans, AXFX_REVERBSTD_EXP* context);
|
||||
|
||||
u32 AXFXReverbStdExpGetMemSizeDpl2(const AXFX_REVERBSTD_EXP_DPL2 *fx);
|
||||
BOOL AXFXReverbStdExpInitDpl2(AXFX_REVERBSTD_EXP_DPL2 *fx);
|
||||
void AXFXReverbStdExpShutdownDpl2(AXFX_REVERBSTD_EXP_DPL2 *fx);
|
||||
BOOL AXFXReverbStdExpSettingsDpl2(AXFX_REVERBSTD_EXP_DPL2 *fx);
|
||||
BOOL AXFXReverbStdExpSettingsUpdateDpl2(AXFX_REVERBSTD_EXP_DPL2 *fx);
|
||||
|
||||
void AXFXReverbStdExpCallbackDpl2(void* chans, AXFX_REVERBSTD_EXP_DPL2* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
#ifndef D_ACTOR_INFO_H
|
||||
#define D_ACTOR_INFO_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// TODO: Expand when we figure out what the other entries have in common
|
||||
enum SoundSourceType_e {
|
||||
// 0-1: Player (0)
|
||||
SND_SOURCE_PLAYER = 0,
|
||||
SND_SOURCE_PLAYER_HEAD = 1,
|
||||
|
||||
// 2-9: Equipment (1)
|
||||
SND_SOURCE_NET = 2,
|
||||
SND_SOURCE_BLADE = 3,
|
||||
SND_SOURCE_SHIELD = 4,
|
||||
SND_SOURCE_WHIP = 5,
|
||||
SND_SOURCE_BOOMERANG = 6,
|
||||
SND_SOURCE_ARROW = 7,
|
||||
SND_SOURCE_BOMB = 8,
|
||||
SND_SOURCE_HOOKSHOT = 9,
|
||||
|
||||
// 10-31: Enemy? (2)
|
||||
SND_SOURCE_BIGBOSS = 20,
|
||||
SND_SOURCE_GIRAHUMU_3 = 24,
|
||||
SND_SOURCE_BULLET = 29,
|
||||
|
||||
// 32-42: Object? (3)
|
||||
SND_SOURCE_OBJECT = 32,
|
||||
SND_SOURCE_BAMBOO = 34,
|
||||
SND_SOURCE_ITEM = 35,
|
||||
SND_SOURCE_TERRY_SHOP = 36,
|
||||
SND_SOURCE_TIME_STONE = 37,
|
||||
SND_SOURCE_CLEF = 38,
|
||||
SND_SOURCE_SHUTTER = 39,
|
||||
|
||||
// 43-52: Npc (4)
|
||||
SND_SOURCE_KENSEI = 44,
|
||||
SND_SOURCE_PLAYER_BIRD = 45,
|
||||
SND_SOURCE_INSECT = 49,
|
||||
SND_SOURCE_NPC_NRM = 51,
|
||||
SND_SOURCE_NPC_DRAGON = 52,
|
||||
|
||||
// 53: TagSound (5)
|
||||
SND_SOURCE_TG_SOUND = 53,
|
||||
|
||||
// 54-57: Harp Related (6)
|
||||
SND_SOURCE_OBJECT_WARP = 55,
|
||||
SND_SOURCE_SW_HARP = 56,
|
||||
|
||||
// 58: ? (7)
|
||||
|
||||
// 59: ? (9)
|
||||
};
|
||||
|
||||
/**
|
||||
* profileId and profileId2 are always the same.
|
||||
*/
|
||||
struct ActorInfo {
|
||||
/* 0x00 */ const char *name;
|
||||
/* 0x04 */ u16 profileId;
|
||||
/* 0x06 */ u16 profileId2;
|
||||
/* 0x08 */ u16 fiTextEntryId; // also used for kill counters
|
||||
/* 0x0A */ s8 soundSourceType;
|
||||
/* 0x0B */ u8 subtype;
|
||||
};
|
||||
|
||||
const ActorInfo *getActorInfoByName(const char *name);
|
||||
u16 getProfileIdForName(const char *name);
|
||||
u16 getProfileId2ForName(const char *name);
|
||||
const char *getNameForProfileId(u32 profileId);
|
||||
const char *getActorName(const ActorInfo *actorInfo);
|
||||
const ActorInfo *getActorInfoByProfileAndSubtype(u32 profileId, u32 subtype);
|
||||
s32 getSoundSourceTypeForName(const char *name);
|
||||
|
||||
#endif
|
||||
@@ -15,13 +15,13 @@ using ::atan;
|
||||
using ::atan2;
|
||||
using ::atan2f;
|
||||
using ::ceil;
|
||||
using ::ceilf;
|
||||
// using ::ceilf;
|
||||
using ::copysign;
|
||||
using ::cos;
|
||||
using ::cosf;
|
||||
using ::fabsf;
|
||||
// using ::cosf;
|
||||
// using ::fabsf;
|
||||
using ::floor;
|
||||
using ::floorf;
|
||||
// using ::floorf;
|
||||
using ::fmod;
|
||||
using ::fmodf;
|
||||
using ::frexp;
|
||||
@@ -35,11 +35,23 @@ using ::scalbn;
|
||||
using ::sin;
|
||||
using ::sinf;
|
||||
using ::sqrt;
|
||||
using ::sqrtf;
|
||||
// using ::sqrtf;
|
||||
using ::tan;
|
||||
using ::tanf;
|
||||
|
||||
inline float sqrt(float x) {
|
||||
inline float ceilf(float x) {
|
||||
return ::ceil(x);
|
||||
}
|
||||
|
||||
inline float floorf(float x) {
|
||||
return ::floor(x);
|
||||
}
|
||||
|
||||
inline float cosf(float x) {
|
||||
return cos(x);
|
||||
}
|
||||
|
||||
inline float sqrtf(float x) {
|
||||
return ::sqrtf(x);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,21 +3,14 @@
|
||||
|
||||
|
||||
namespace std {
|
||||
/* float fabs(float num) {
|
||||
return ::fabsf(num);
|
||||
} */
|
||||
|
||||
inline float fabsf(float num) {
|
||||
return ::fabsf(num);
|
||||
}
|
||||
|
||||
inline float sqrt(float x) {
|
||||
return ::sqrtf(x);
|
||||
}
|
||||
|
||||
inline float abs(float x) {
|
||||
return ::fabsf(x);
|
||||
}
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ double cos(double);
|
||||
float cosf(float);
|
||||
double exp(double);
|
||||
double ceil(double);
|
||||
float ceilf(float);
|
||||
// float ceilf(float);
|
||||
double frexp(double, int *);
|
||||
double ldexp(double, int);
|
||||
double modf(double, double *);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
#include "toBeSorted/time_area_mgr.h"
|
||||
|
||||
#include <cmath.h>
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(E_SM, dAcEsm_c, fProfile::E_SM, 0xEB, 0, 4098);
|
||||
|
||||
|
||||
@@ -1,3 +1,42 @@
|
||||
#include "d/a/obj/d_a_obj_blade.h"
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/d_stage.h"
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "toBeSorted/arc_managers/current_stage_arc_manager.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_BLADE, dAcOblade_c, fProfile::OBJ_BLADE, 0x1E4, 0, 4);
|
||||
|
||||
bool dAcOblade_c::createHeap() {
|
||||
void *data = CurrentStageArcManager::GetInstance()->getData("g3d/stage.brres");
|
||||
mResFile = nw4r::g3d::ResFile(data);
|
||||
dStage_c::bindStageResToFile(&mResFile);
|
||||
dStage_c::bindSkyCmnToResFile(&mResFile);
|
||||
TRY_CREATE(mMdl.create(data, "StageF000Blade", "StageF000Blade", &heap_allocator, 0x120));
|
||||
return true;
|
||||
}
|
||||
|
||||
int dAcOblade_c::create() {
|
||||
CREATE_ALLOCATOR(dAcOblade_c);
|
||||
mMdl.setAnm("StageF000Blade", m3d::PLAY_MODE_4);
|
||||
updateMatrix();
|
||||
mMdl.getModel().setLocalMtx(mWorldMtx);
|
||||
boundingBox.Set(mVec3_c(-0.0f, -0.0f, -0.0f), mVec3_c(0.0f, 0.0f, 0.0f));
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOblade_c::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOblade_c::actorExecute() {
|
||||
mMdl.play();
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOblade_c::draw() {
|
||||
drawModelType1(&mMdl.getModel());
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,58 @@
|
||||
#include "d/a/obj/d_a_obj_distant_ship.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "f/f_base.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "toBeSorted/arc_managers/current_stage_arc_manager.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_DIS_SHIP, dAcOdistantShip_c, fProfile::OBJ_DIS_SHIP, 0x143, 0, 0);
|
||||
|
||||
bool dAcOdistantShip_c::createHeap() {
|
||||
const char *modelName = getModelName();
|
||||
mBrres = (nw4r::g3d::ResFile)CurrentStageArcManager::GetInstance()->getData("g3d/stage.brres");
|
||||
TRY_CREATE(mModel.create(mBrres.GetResMdl(modelName), &heap_allocator, 0x120, 1, 0));
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOdistantShip_c::create() {
|
||||
mIsVisible = false;
|
||||
u8 flag = getFromParams(0, 0xFF);
|
||||
mSubtype = getFromParams(8, 0xF);
|
||||
|
||||
if (SceneflagManager::sInstance->checkBoolFlag(roomid, flag)) {
|
||||
mIsVisible = true;
|
||||
}
|
||||
|
||||
if (mIsVisible) {
|
||||
CREATE_ALLOCATOR(dAcOdistantShip_c);
|
||||
updateMatrix();
|
||||
mModel.setLocalMtx(mWorldMtx);
|
||||
boundingBox.Set(mVec3_c(-0.0f, -0.0f, -0.0f), mVec3_c(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOdistantShip_c::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOdistantShip_c::actorExecute() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOdistantShip_c::draw() {
|
||||
if (mIsVisible) {
|
||||
drawModelType1(&mModel);
|
||||
}
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
const char *dAcOdistantShip_c::getModelName() {
|
||||
switch (mSubtype) {
|
||||
case 0: return "StageF301_D300";
|
||||
case 1: return "StageF301_3_D300";
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,48 @@
|
||||
#include "d/a/obj/d_a_obj_impa_door.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "nw4r/g3d/res/g3d_resmdl.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_IMPA_DOOR, dAcOimpaDoor_c, fProfile::OBJ_IMPA_DOOR, 0x20C, 0, 3);
|
||||
|
||||
STATE_DEFINE(dAcOimpaDoor_c, Wait);
|
||||
|
||||
bool dAcOimpaDoor_c::createHeap() {
|
||||
void *data = getOarcFile("DoorG", "g3d/model.brres");
|
||||
mResFile = nw4r::g3d::ResFile(data);
|
||||
nw4r::g3d::ResMdl mdl = mResFile.GetResMdl("DoorG");
|
||||
TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0x120, 1, nullptr));
|
||||
return true;
|
||||
}
|
||||
|
||||
int dAcOimpaDoor_c::create() {
|
||||
CREATE_ALLOCATOR(dAcOimpaDoor_c);
|
||||
updateMatrix();
|
||||
mMdl.setLocalMtx(mWorldMtx);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
mMdl.setPriorityDraw(0x1C, 9);
|
||||
boundingBox.Set(mVec3_c(-250.0f, 0.0f, -30.0f), mVec3_c(250.0f, 940.0f, 30.0f));
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOimpaDoor_c::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOimpaDoor_c::actorExecute() {
|
||||
mStateMgr.executeState();
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOimpaDoor_c::draw() {
|
||||
drawModelType1(&mMdl);
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
void dAcOimpaDoor_c::initializeState_Wait() {}
|
||||
void dAcOimpaDoor_c::executeState_Wait() {}
|
||||
void dAcOimpaDoor_c::finalizeState_Wait() {}
|
||||
|
||||
@@ -1,3 +1,51 @@
|
||||
#include "d/a/obj/d_a_obj_mole_cover.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/col/bg/d_bg_s.h"
|
||||
#include "d/d_stage.h"
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "nw4r/g3d/res/g3d_resmdl.h"
|
||||
#include "toBeSorted/arc_managers/current_stage_arc_manager.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_MOLE_COVER, dAcOmoleCover_c, fProfile::OBJ_MOLE_COVER, 0x20F, 0, 3);
|
||||
|
||||
bool dAcOmoleCover_c::createHeap() {
|
||||
void *data = CurrentStageArcManager::GetInstance()->getData("g3d/stage.brres");
|
||||
mResFile = nw4r::g3d::ResFile(data);
|
||||
dStage_c::bindStageResToFile(&mResFile);
|
||||
dStage_c::bindSkyCmnToResFile(&mResFile);
|
||||
nw4r::g3d::ResMdl mdl = mResFile.GetResMdl("StageF000MallCover");
|
||||
TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0x120, 1, nullptr));
|
||||
void *dzb = CurrentStageArcManager::GetInstance()->getData("dzb/StageF000MallCover.dzb");
|
||||
void *plc = CurrentStageArcManager::GetInstance()->getData("dat/StageF000MallCover.plc");
|
||||
updateMatrix();
|
||||
mMdl.setLocalMtx(mWorldMtx);
|
||||
TRY_CREATE(!mBgW.Set((cBgD_t *)dzb, (PLC *)plc, 1, &mWorldMtx, &mScale));
|
||||
mBgW.Lock();
|
||||
return true;
|
||||
}
|
||||
|
||||
int dAcOmoleCover_c::create() {
|
||||
CREATE_ALLOCATOR(dAcOmoleCover_c);
|
||||
dBgS::GetInstance()->Regist(&mBgW, this);
|
||||
mMdl.setPriorityDraw(0x1C, 9);
|
||||
boundingBox.Set(mVec3_c(-1900.0f, 1100.0f, -5500.0f), mVec3_c(100.0f, 1700.0f, -1800.0f));
|
||||
mCullingDistance = FLOAT_MAX;
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOmoleCover_c::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOmoleCover_c::actorExecute() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOmoleCover_c::draw() {
|
||||
drawModelType1(&mMdl);
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,49 @@
|
||||
#include "d/a/obj/d_a_obj_rope_base.h"
|
||||
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "nw4r/g3d/res/g3d_resmdl.h"
|
||||
#include "nw4r/g3d/res/g3d_resnode.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_ROPE_BASE, dAcOropeBase_c, fProfile::OBJ_ROPE_BASE, 0x216, 0, 3);
|
||||
|
||||
bool dAcOropeBase_c::createHeap() {
|
||||
void *data = getOarcResFile("PracticeWood");
|
||||
mResFile = nw4r::g3d::ResFile(data);
|
||||
nw4r::g3d::ResMdl mdl = mResFile.GetResMdl("RopeBase");
|
||||
TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0x120, 1, nullptr));
|
||||
updateMatrix();
|
||||
mMdl.setLocalMtx(mWorldMtx);
|
||||
mMdl.calc(true);
|
||||
nw4r::g3d::ResNode resNode = mdl.GetResNode("rope_loc");
|
||||
mMdl.getNodeWorldMtxMultVecZero(resNode.GetID(), mRopePos);
|
||||
return true;
|
||||
}
|
||||
|
||||
int dAcOropeBase_c::create() {
|
||||
CREATE_ALLOCATOR(dAcOropeBase_c);
|
||||
updateMatrix();
|
||||
mMdl.setLocalMtx(mWorldMtx);
|
||||
boundingBox.Set(mVec3_c(-525.0f, -0.0f, -500.0f), mVec3_c(-325.0f, 700.0f, -300.0f));
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOropeBase_c::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOropeBase_c::actorExecute() {
|
||||
if (checkObjectProperty(2)) {
|
||||
field_0x35C = true;
|
||||
} else {
|
||||
field_0x35C = false;
|
||||
}
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dAcOropeBase_c::draw() {
|
||||
drawModelType1(&mMdl);
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
+19
-22
@@ -17,6 +17,7 @@
|
||||
#include "f/f_list_nd.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/actor_info.h"
|
||||
#include "toBeSorted/event.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
@@ -33,13 +34,10 @@ mVec3_c *dAcBase_c::s_Create_Position;
|
||||
mAng3_c *dAcBase_c::s_Create_Rotation;
|
||||
mVec3_c *dAcBase_c::s_Create_Scale;
|
||||
dAcBase_c *dAcBase_c::s_Create_Parent;
|
||||
ObjInfo *dAcBase_c::s_Create_ObjInfo;
|
||||
const ActorInfo *dAcBase_c::s_Create_ActorInfo;
|
||||
u8 dAcBase_c::s_Create_Subtype;
|
||||
|
||||
extern "C" ObjInfo *getObjByActorIdAndSubtype_unkNamespace(ProfileName, u8);
|
||||
extern "C" ObjInfo *getObjByActorName_unkNamespace(char *name);
|
||||
extern "C" char *getObjectName_8006a730(ObjInfo *);
|
||||
extern "C" SoundSource *soundForActorInitRelated_803889c0(s8, fBase_c *, char *, u8);
|
||||
extern "C" SoundSource *soundForActorInitRelated_803889c0(s8, fBase_c *, const char *, u8);
|
||||
|
||||
bool dAcBase_c::createHeap() {
|
||||
return true;
|
||||
@@ -50,7 +48,7 @@ bool dAcBase_c::createHeap() {
|
||||
// 8002c3b0
|
||||
dAcBase_c::dAcBase_c()
|
||||
: heap_allocator(),
|
||||
obj_info(s_Create_ObjInfo),
|
||||
mpActorInfo(s_Create_ActorInfo),
|
||||
sound_list(),
|
||||
obj_pos(&position),
|
||||
params2(s_Create_Params2),
|
||||
@@ -82,8 +80,8 @@ dAcBase_c::dAcBase_c()
|
||||
|
||||
fProfile::fActorProfile_c *profile = (fProfile::fActorProfile_c *)((*fProfile::sProfileList)[profile_name]);
|
||||
actor_properties = profile->mActorProperties;
|
||||
if (obj_info == nullptr) {
|
||||
obj_info = getObjByActorIdAndSubtype_unkNamespace(profile_name, actor_subtype);
|
||||
if (mpActorInfo == nullptr) {
|
||||
mpActorInfo = getActorInfoByProfileAndSubtype(profile_name, actor_subtype);
|
||||
}
|
||||
someStr[0] = '\0';
|
||||
}
|
||||
@@ -98,7 +96,7 @@ dAcBase_c::~dAcBase_c() {}
|
||||
|
||||
void dAcBase_c::setTempCreateParams(
|
||||
mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, s32 roomId, u32 params2, dAcBase_c *parent, u8 subtype, u16 unkFlag,
|
||||
s8 viewClipIdx, ObjInfo *objInfo
|
||||
s8 viewClipIdx, const ActorInfo *actorInfo
|
||||
) {
|
||||
s_Create_Position = pos;
|
||||
s_Create_Rotation = rot;
|
||||
@@ -109,22 +107,21 @@ void dAcBase_c::setTempCreateParams(
|
||||
s_Create_Subtype = subtype;
|
||||
s_Create_UnkFlags = unkFlag;
|
||||
s_Create_ViewClipIdx = viewClipIdx;
|
||||
s_Create_ObjInfo = objInfo;
|
||||
s_Create_ActorInfo = actorInfo;
|
||||
}
|
||||
|
||||
// has regswap
|
||||
SoundSource *dAcBase_c::FUN_8002c690() {
|
||||
if (obj_info == nullptr) {
|
||||
SoundSource *dAcBase_c::createSoundSource() {
|
||||
if (mpActorInfo == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
s32 unk_val = obj_info->unk_0xA;
|
||||
if (unk_val == -1) {
|
||||
s32 soundSourceType = mpActorInfo->soundSourceType;
|
||||
if (soundSourceType == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char *objName = getObjectName_8006a730(obj_info);
|
||||
return soundForActorInitRelated_803889c0(unk_val, this, objName, subtype);
|
||||
const char *actorName = getActorName(mpActorInfo);
|
||||
return soundForActorInitRelated_803889c0(soundSourceType, this, actorName, subtype);
|
||||
}
|
||||
|
||||
int dAcBase_c::initAllocatorWork1Heap(int size, char *name, int align) {
|
||||
@@ -135,7 +132,7 @@ int dAcBase_c::initAllocator(int size, char *name, EGG::Heap *heap, int align) {
|
||||
if (!heap_allocator.createNewTempFrmHeap(size, heap, name, 0x20, 0)) {
|
||||
return 0;
|
||||
}
|
||||
sound_source = FUN_8002c690();
|
||||
sound_source = createSoundSource();
|
||||
int success = createHeap();
|
||||
heap_allocator.adjustFrmHeapRestoreCurrent();
|
||||
return success;
|
||||
@@ -344,16 +341,16 @@ u32 dAcBase_c::getParams2Lower() const {
|
||||
|
||||
// 8002d020
|
||||
dAcBase_c *dAcBase_c::findActor(char *objName, dAcBase_c *parent) {
|
||||
ObjInfo *objInfo = getObjByActorName_unkNamespace(objName);
|
||||
if (objInfo == nullptr) {
|
||||
const ActorInfo *actorInfo = getActorInfoByName(objName);
|
||||
if (actorInfo == nullptr) {
|
||||
return nullptr;
|
||||
} else {
|
||||
do {
|
||||
parent = (dAcBase_c *)fManager_c::searchBaseByProfName(objInfo->obj_id, parent);
|
||||
parent = (dAcBase_c *)fManager_c::searchBaseByProfName(actorInfo->profileId, parent);
|
||||
if (parent == nullptr) {
|
||||
break;
|
||||
}
|
||||
} while (parent->actor_subtype != objInfo->subtype);
|
||||
} while (parent->actor_subtype != actorInfo->subtype);
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "m/m_angle.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/actor_info.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
struct BzsHeader {
|
||||
@@ -242,13 +243,11 @@ static void handleBzsPly(int roomid, const BzsSectionHead *section) {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" u16 getActorIdForObjName2(const char *objname);
|
||||
|
||||
static void handleBzsObjn(int roomid, const BzsSectionHead *section) {
|
||||
const OBJN *objn = OFS_TO_PTR(OBJN, section);
|
||||
const char *buf = reinterpret_cast<const char *>(objn);
|
||||
for (s32 i = 0; i < section->mCount; i++) {
|
||||
dStageMgr_c::GetInstance()->addObjId(getActorIdForObjName2(buf + objn->offset));
|
||||
dStageMgr_c::GetInstance()->addObjId(getProfileId2ForName(buf + objn->offset));
|
||||
objn++;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +265,7 @@ static void handleBzsLayerObjn(int roomid, const BzsSectionHead *section) {
|
||||
const OBJN *objn = OFS_TO_PTR(OBJN, section);
|
||||
const char *buf = reinterpret_cast<const char *>(objn);
|
||||
for (s32 i = 0; i < section->mCount; i++) {
|
||||
u16 id = getActorIdForObjName2(buf + objn->offset);
|
||||
u16 id = getProfileId2ForName(buf + objn->offset);
|
||||
dStageMgr_c::GetInstance()->addActorId(id);
|
||||
objn++;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,489 @@
|
||||
/* Only implemented to the extent necessary to match data sections. */
|
||||
|
||||
#include "nw4r/snd/snd_AnimSound.h"
|
||||
|
||||
#include "common.h" // nullptr
|
||||
#include <decomp.h>
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_SeqSound.h"
|
||||
#include "nw4r/snd/snd_SeqSoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
|
||||
#include "nw4r/snd/snd_Util.h"
|
||||
#include <cmath>
|
||||
|
||||
DECOMP_FORCE(nw4r::snd::detail::Util::GetDataRefAddress0(
|
||||
*static_cast<nw4r::snd::detail::Util::DataRef<char> const *>(nullptr),
|
||||
nullptr));
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
namespace detail {
|
||||
|
||||
AnimSoundImpl::AnimSoundImpl(SoundStartable &startable, AnimEventPlayer *player, int numSounds)
|
||||
: mStartable(startable),
|
||||
mpSounds(player),
|
||||
mNumSounds(numSounds),
|
||||
field_0x0C(0.0f),
|
||||
mIsActive(false),
|
||||
field_0x19(0),
|
||||
field_0x1A(0),
|
||||
field_0x1C(0),
|
||||
mCallback(NULL),
|
||||
field_0x28(1.0f) {}
|
||||
|
||||
AnimSoundImpl::~AnimSoundImpl() {
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
bool AnimSoundImpl::Setup(const void *data) {
|
||||
Shutdown();
|
||||
if (!mReader.Setup(data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
field_0x19 = 1;
|
||||
mIsActive = true;
|
||||
field_0x0C = 0.0f;
|
||||
field_0x1C = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AnimSoundImpl::Shutdown() {
|
||||
if (mIsActive) {
|
||||
for (int i = 0; i < mNumSounds; i++) {
|
||||
if (mpSounds[i].GetHandle()->IsAttachedSound() && mpSounds[i].IsRunning()) {
|
||||
mpSounds[i].GetHandle()->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
mReader.Shutdown();
|
||||
mIsActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::ResetFrame(f32 f, int i) {
|
||||
field_0x0C = f;
|
||||
field_0x1C = i;
|
||||
field_0x1A = 1;
|
||||
field_0x19 = 0;
|
||||
}
|
||||
|
||||
void AnimSoundImpl::UpdateFrame(f32 frame, PlayDirection dir) {
|
||||
for (int i = 0; i < mNumSounds; i++) {
|
||||
mpSounds[i].UpdateFrame();
|
||||
}
|
||||
|
||||
if (field_0x19) {
|
||||
if (dir == FORWARD) {
|
||||
ResetFrame(0.0f, 0);
|
||||
} else {
|
||||
u32 duration = mReader.GetAnimDuration();
|
||||
ResetFrame(duration - 1.0f, 0);
|
||||
}
|
||||
field_0x19 = false;
|
||||
}
|
||||
|
||||
mVariableValue = (frame - field_0x0C) / field_0x28;
|
||||
if (dir == FORWARD) {
|
||||
UpdateForward(frame);
|
||||
} else {
|
||||
UpdateBackward(frame);
|
||||
}
|
||||
field_0x0C = frame;
|
||||
field_0x1A = false;
|
||||
}
|
||||
|
||||
void AnimSoundImpl::UpdateForward(f32 frame) {
|
||||
s32 duration = std::floorf(field_0x0C);
|
||||
s32 iFrame = std::floorf(frame);
|
||||
|
||||
if (field_0x1A && field_0x0C == duration) {
|
||||
duration -= 1;
|
||||
}
|
||||
|
||||
if (duration == iFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
s32 loopFrame = duration + 1;
|
||||
while (true) {
|
||||
if (loopFrame == mReader.GetAnimDuration()) {
|
||||
loopFrame -= mReader.GetAnimDuration();
|
||||
field_0x1C++;
|
||||
}
|
||||
|
||||
UpdateOneFrame(loopFrame, FORWARD);
|
||||
|
||||
if (loopFrame == iFrame) {
|
||||
break;
|
||||
}
|
||||
loopFrame++;
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::UpdateBackward(f32 frame) {
|
||||
s32 duration = std::ceilf(field_0x0C);
|
||||
s32 iFrame = std::ceilf(frame);
|
||||
|
||||
if (duration >= mReader.GetAnimDuration()) {
|
||||
duration -= mReader.GetAnimDuration();
|
||||
}
|
||||
|
||||
if (iFrame >= mReader.GetAnimDuration()) {
|
||||
iFrame -= mReader.GetAnimDuration();
|
||||
}
|
||||
|
||||
if (field_0x1A && field_0x0C == duration) {
|
||||
duration += 1;
|
||||
}
|
||||
|
||||
if (duration == iFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
s32 loopFrame = duration - 1;
|
||||
while (true) {
|
||||
if (loopFrame == -1) {
|
||||
loopFrame += mReader.GetAnimDuration();
|
||||
field_0x1C--;
|
||||
}
|
||||
|
||||
UpdateOneFrame(loopFrame, BACKWARD);
|
||||
|
||||
if (loopFrame == iFrame) {
|
||||
break;
|
||||
}
|
||||
loopFrame--;
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::UpdateOneFrame(s32 duration, PlayDirection direction) {
|
||||
for (u32 eventIdx = 0; eventIdx < mReader.GetEventCount(); eventIdx++) {
|
||||
const AnimEventRef *ref = mReader.GetEventRef(eventIdx);
|
||||
if (ref == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (IsPlayableLoopCount(ref->mInfo)) {
|
||||
if ((ref->mInfo.flags) & 1) {
|
||||
UpdateTrigger(ref, duration, direction);
|
||||
} else {
|
||||
if (direction == FORWARD) {
|
||||
UpdateForwardRange(ref, duration);
|
||||
} else {
|
||||
UpdateBackwardRange(ref, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::UpdateTrigger(const AnimEventRef *ref, s32 frame, PlayDirection direction) {
|
||||
const AnimEvent *event = mReader.GetEvent(ref);
|
||||
if (event == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ref->mInfo.flags & 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event->MatchesDirection(direction)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ref->mInfo.flags & 2)) {
|
||||
if (ref->mInfo.field_0x00 == frame) {
|
||||
StopEvent(event);
|
||||
if (mCallback != NULL) {
|
||||
(mCallback)(0, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
StartEvent(event, true);
|
||||
}
|
||||
} else {
|
||||
if (ref->mInfo.field_0x00 == frame) {
|
||||
StopEvent(event);
|
||||
if (mCallback != NULL) {
|
||||
(mCallback)(0, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
StartEvent(event, true);
|
||||
}
|
||||
|
||||
s32 u;
|
||||
if (direction == FORWARD) {
|
||||
u = ref->mInfo.field_0x04;
|
||||
} else {
|
||||
u = ut::Max(ref->mInfo.field_0x00 * 2 - ref->mInfo.field_0x04, 0);
|
||||
}
|
||||
|
||||
if (u == frame) {
|
||||
if (mCallback != NULL) {
|
||||
(mCallback)(1, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
StopEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::UpdateForwardRange(const AnimEventRef *ref, s32 frame) {
|
||||
const AnimEvent *event = mReader.GetEvent(ref);
|
||||
if (event == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ref->mInfo.flags & 4 && ref->mInfo.flags & 2) {
|
||||
HoldEvent(event, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ref->mInfo.flags & 4) {
|
||||
if (ref->mInfo.field_0x04 == frame && mCallback != NULL) {
|
||||
(mCallback)(3, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
if (field_0x1C < ref->mInfo.field_0x09) {
|
||||
HoldEvent(event, true);
|
||||
} else if (field_0x1C == ref->mInfo.field_0x09) {
|
||||
if (frame < ref->mInfo.field_0x04) {
|
||||
HoldEvent(event, true);
|
||||
} else {
|
||||
StopEvent(event);
|
||||
}
|
||||
}
|
||||
} else if ((ref->mInfo.flags & 2)) {
|
||||
if (ref->mInfo.field_0x00 == frame && mCallback != NULL) {
|
||||
(mCallback)(2, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
if (field_0x1C > ref->mInfo.field_0x09) {
|
||||
HoldEvent(event, true);
|
||||
} else if (field_0x1C == ref->mInfo.field_0x09 && ref->mInfo.field_0x00 <= frame) {
|
||||
HoldEvent(event, true);
|
||||
}
|
||||
} else {
|
||||
if (ref->mInfo.field_0x00 == frame && mCallback != NULL) {
|
||||
(mCallback)(2, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
if (ref->mInfo.field_0x04 == frame && mCallback != NULL) {
|
||||
(mCallback)(3, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
if (ref->mInfo.field_0x00 <= frame && frame < ref->mInfo.field_0x04) {
|
||||
HoldEvent(event, true);
|
||||
} else {
|
||||
StopEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::UpdateBackwardRange(const AnimEventRef *ref, s32 frame) {
|
||||
const AnimEvent *event = mReader.GetEvent(ref);
|
||||
if (event == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ref->mInfo.flags & 4 && ref->mInfo.flags & 2) {
|
||||
HoldEvent(event, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ref->mInfo.flags & 4) {
|
||||
if (ref->mInfo.field_0x04 == frame && mCallback != NULL) {
|
||||
(mCallback)(2, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
if (field_0x1C < ref->mInfo.field_0x09) {
|
||||
HoldEvent(event, true);
|
||||
} else if (field_0x1C == ref->mInfo.field_0x09 && frame <= ref->mInfo.field_0x04) {
|
||||
HoldEvent(event, true);
|
||||
}
|
||||
} else if ((ref->mInfo.flags & 2)) {
|
||||
if (ref->mInfo.field_0x00 == frame && mCallback != NULL) {
|
||||
(mCallback)(3, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
if (field_0x1C > ref->mInfo.field_0x09) {
|
||||
HoldEvent(event, true);
|
||||
} else if (field_0x1C == ref->mInfo.field_0x09) {
|
||||
if (ref->mInfo.field_0x00 < frame) {
|
||||
HoldEvent(event, true);
|
||||
} else {
|
||||
StopEvent(event);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ref->mInfo.field_0x00 == frame && mCallback != NULL) {
|
||||
(mCallback)(3, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
if (ref->mInfo.field_0x04 == frame && mCallback != NULL) {
|
||||
(mCallback)(2, frame, event->GetSoundLabel(), event->field_0x1C, field_0x24);
|
||||
}
|
||||
if (ref->mInfo.field_0x00 < frame && frame <= ref->mInfo.field_0x04) {
|
||||
HoldEvent(event, true);
|
||||
} else {
|
||||
StopEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::StartEvent(const AnimEvent *event, bool b) {
|
||||
int leastPriority = 0x80;
|
||||
int leastPriorityIdx = -1;
|
||||
int i = 0;
|
||||
for (; i < mNumSounds; i++) {
|
||||
if (!mpSounds[i].IsAttachedSound()) {
|
||||
break;
|
||||
}
|
||||
int priority = mpSounds[i].GetPriority();
|
||||
if (leastPriority > priority) {
|
||||
leastPriorityIdx = i;
|
||||
leastPriority = priority;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == mNumSounds) {
|
||||
mpSounds[leastPriorityIdx].ForceStop();
|
||||
i = leastPriorityIdx;
|
||||
}
|
||||
|
||||
mpSounds[i].StartEvent(event, &mStartable, b);
|
||||
|
||||
u32 varNo = 0;
|
||||
if (event->GetVarNo(&varNo)) {
|
||||
mpSounds[i].SetVariable(event, varNo, mVariableValue);
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::HoldEvent(const AnimEvent *event, bool b) {
|
||||
int leastPriority = 0x80;
|
||||
int leastPriorityIdx = -1;
|
||||
int i = 0;
|
||||
for (; i < mNumSounds; i++) {
|
||||
if (mpSounds[i].IsCurrentEvent(event)) {
|
||||
return;
|
||||
}
|
||||
if (!mpSounds[i].IsAttachedSound()) {
|
||||
leastPriorityIdx = i;
|
||||
leastPriority = -1;
|
||||
} else {
|
||||
int priority = mpSounds[i].GetPriority();
|
||||
if (leastPriority > priority) {
|
||||
leastPriorityIdx = i;
|
||||
leastPriority = priority;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == mNumSounds) {
|
||||
mpSounds[leastPriorityIdx].ForceStop();
|
||||
i = leastPriorityIdx;
|
||||
}
|
||||
|
||||
mpSounds[i].HoldEvent(event, &mStartable, b);
|
||||
|
||||
u32 varNo = 0;
|
||||
if (event->GetVarNo(&varNo)) {
|
||||
mpSounds[i].SetVariable(event, varNo, mVariableValue);
|
||||
}
|
||||
}
|
||||
|
||||
void AnimSoundImpl::StopEvent(const AnimEvent *event) {
|
||||
for (int i = 0; i < mNumSounds; i++) {
|
||||
mpSounds[i].StopEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
bool AnimSoundImpl::IsPlayableLoopCount(const nw4r::snd::detail::AnimEventFrameInfo &ref) {
|
||||
if (!(ref.flags & 1) && (ref.flags & 4 || ref.flags & 2)) {
|
||||
return true;
|
||||
}
|
||||
int i1 = ut::Max((int)ref.field_0x09, 0);
|
||||
int i2 = ut::Abs(field_0x1C);
|
||||
if (ref.field_0x0A == 0) {
|
||||
if (i2 < i1) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (i2 < i1) {
|
||||
return false;
|
||||
}
|
||||
if ((i2 - i1) % ref.field_0x0A != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AnimEventPlayer::SetVolumePitch(const AnimEvent *event, bool b) {
|
||||
if (event->volume < 128) {
|
||||
SetVolume(event->volume / 128.0f);
|
||||
}
|
||||
if (event->pitch != 1.0f) {
|
||||
SetPitch(event->pitch);
|
||||
}
|
||||
|
||||
mpEvent = event;
|
||||
if (b) {
|
||||
b = !event->ShouldPreventStart();
|
||||
}
|
||||
mIsRunning = b;
|
||||
}
|
||||
|
||||
void AnimEventPlayer::SetVariable(const AnimEvent *event, u32 varNo, f32 f) {
|
||||
if (varNo < 16) {
|
||||
if (GetHandle()->IsAttachedSound()) {
|
||||
SeqSoundHandle handle(GetHandle());
|
||||
int iVal = f * 100.0f;
|
||||
handle.WriteVariable(varNo, ut::Clamp(iVal, -0x8000, 0x7FFF));
|
||||
handle.DetachSound();
|
||||
}
|
||||
} else if (varNo < 32) {
|
||||
int iVal = f * 100.0f;
|
||||
SeqSound::WriteGlobalVariable(varNo - 16, ut::Clamp(iVal, -0x8000, 0x7FFF));
|
||||
}
|
||||
}
|
||||
|
||||
AnimEventPlayer::AnimEventPlayer() : mpEvent(NULL), mIsRunning(false) {}
|
||||
|
||||
AnimEventPlayer::~AnimEventPlayer() {
|
||||
if (mHandle.IsAttachedSound() && IsRunning()) {
|
||||
mHandle.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void AnimEventPlayer::StartEvent(const AnimEvent *event, SoundStartable *startable, bool b) {
|
||||
if (event->soundId == 0xFFFFFFFF) {
|
||||
if (!startable->StartSound(GetHandle(), event->GetSoundLabel())) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!startable->StartSound(GetHandle(), event->soundId)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SetVolumePitch(event, b);
|
||||
}
|
||||
|
||||
void AnimEventPlayer::HoldEvent(const AnimEvent *event, SoundStartable *startable, bool b) {
|
||||
if (event->soundId == 0xFFFFFFFF) {
|
||||
if (!startable->HoldSound(GetHandle(), event->GetSoundLabel())) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!startable->HoldSound(GetHandle(), event->soundId)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GetHandle()->detail_GetAttachedSound()->SetAutoStopCounter(0);
|
||||
SetVolumePitch(event, b);
|
||||
}
|
||||
|
||||
void AnimEventPlayer::ForceStop() {
|
||||
if (IsAttachedSound()) {
|
||||
mHandle.detail_GetAttachedSound()->Stop(0);
|
||||
}
|
||||
mpEvent = 0;
|
||||
}
|
||||
|
||||
void AnimEventPlayer::UpdateFrame() {
|
||||
if (!mHandle.IsAttachedSound()) {
|
||||
mpEvent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/* Only implemented to the extent necessary to match data sections. */
|
||||
|
||||
#include "nw4r/snd/snd_AnimSound.h"
|
||||
|
||||
#include "common.h" // nullptr
|
||||
#include "nw4r/snd/snd_Util.h"
|
||||
#include "nw4r/ut/ut_binaryFileFormat.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
namespace detail {
|
||||
|
||||
bool IsValidFileHeader(const void *data) {
|
||||
ut::BinaryFileHeader const *fileHeader = static_cast<ut::BinaryFileHeader const *>(data);
|
||||
|
||||
if (fileHeader->signature != AnimSoundFile::SIGNATURE_FILE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fileHeader->version < AnimSoundFile::FILE_VERSION) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fileHeader->version > AnimSoundFile::FILE_VERSION) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
AnimSoundFileReader::AnimSoundFileReader() : mpHeader(NULL) {}
|
||||
|
||||
bool AnimSoundFileReader::Setup(const void *buf) {
|
||||
if (!IsValidFileHeader(buf)) {
|
||||
return false;
|
||||
}
|
||||
mpHeader = static_cast<const AnimSoundFile::Header *>(buf);
|
||||
mpBlock = static_cast<const AnimSoundFile::Block *>(ut::AddOffsetToPtr(buf, mpHeader->blockOffset));
|
||||
return true;
|
||||
}
|
||||
|
||||
void AnimSoundFileReader::Shutdown() {
|
||||
mpHeader = NULL;
|
||||
mpBlock = NULL;
|
||||
}
|
||||
|
||||
u32 AnimSoundFileReader::GetEventCount() const {
|
||||
const AnimSoundFile::EventTable *event = GetEventTable();
|
||||
return event->eventRef.count;
|
||||
}
|
||||
|
||||
const AnimEventRef *AnimSoundFileReader::GetEventRef(u32 id) const {
|
||||
const AnimSoundFile::EventTable *event = GetEventTable();
|
||||
return &event->eventRef.item[id];
|
||||
}
|
||||
|
||||
const AnimSoundFile::EventTable *AnimSoundFileReader::GetEventTable() const {
|
||||
if (mpBlock == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return Util::GetDataRefAddress0(mpBlock->eventTable, &mpBlock->duration);
|
||||
}
|
||||
|
||||
const AnimEvent *AnimSoundFileReader::GetEvent(const AnimEventRef *ref) const {
|
||||
if (ref == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
const AnimSoundFile::EventTable *event = GetEventTable(); // unused
|
||||
return Util::GetDataRefAddress0(ref->event, &mpBlock->duration);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
@@ -68,7 +68,8 @@ AxManager::AxManager() :
|
||||
mInitialized (false),
|
||||
mUpdateVoicePrioFlag (true),
|
||||
mOldAidCallback (nullptr),
|
||||
mResetReadyCounter (-1)
|
||||
mResetReadyCounter (-1),
|
||||
mSrcType(AxVoice::SRC_4TAP_AUTO)
|
||||
{
|
||||
mMainOutVolume.InitValue(1.0f);
|
||||
mMasterVolume.InitValue(1.0f);
|
||||
@@ -307,7 +308,10 @@ OutputMode AxManager::GetOutputMode()
|
||||
}
|
||||
|
||||
void AxManager::SetMasterVolume(f32 volume, int frame) {
|
||||
mMasterVolume.SetTarget(ut::Clamp(volume, 0.0f, 1.0f), (frame + 2) / 3);
|
||||
if (volume < 0.0f) {
|
||||
volume = 0.0f;
|
||||
}
|
||||
mMasterVolume.SetTarget(volume, (frame + 2) / 3);
|
||||
|
||||
if (frame == 0) {
|
||||
VoiceManager::GetInstance().UpdateAllVoicesSync(Voice::SYNC_AX_VE);
|
||||
@@ -395,6 +399,9 @@ bool AxManager::AppendEffect(AuxBus bus, FxBase* pFx) {
|
||||
void AxManager::ClearEffect(AuxBus bus, int frame) {
|
||||
if (frame == 0) {
|
||||
ShutdownEffect(bus);
|
||||
if (!mAuxFadeVolume[bus].IsFinished()) {
|
||||
mAuxFadeVolume[bus].SetTarget(0.0f, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -447,6 +454,8 @@ void AxManager::AuxCallbackFunc(void* pChans, void* pContext) {
|
||||
void** ppChans = static_cast<void**>(pChans);
|
||||
AuxBus bus = static_cast<AuxBus>(reinterpret_cast<u32>(pContext));
|
||||
|
||||
int tick = OSGetTick();
|
||||
|
||||
if (GetInstance().GetOutputMode() == OUTPUT_MODE_DPL2) {
|
||||
num = AX_DPL2_MAX;
|
||||
|
||||
@@ -468,10 +477,12 @@ void AxManager::AuxCallbackFunc(void* pChans, void* pContext) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
std::memset(buffer[i], 0, FX_BUFFER_SIZE);
|
||||
}
|
||||
GetInstance().mEffectProcessTick[bus] = OSGetTick() - tick;
|
||||
} else if (GetInstance().GetEffectList(bus).IsEmpty()) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
std::memset(buffer[i], 0, FX_BUFFER_SIZE);
|
||||
}
|
||||
GetInstance().mEffectProcessTick[bus] = OSGetTick() - tick;
|
||||
} else {
|
||||
for (FxBase::LinkList::Iterator it =
|
||||
GetInstance().GetEffectList(bus).GetBeginIter();
|
||||
@@ -480,6 +491,7 @@ void AxManager::AuxCallbackFunc(void* pChans, void* pContext) {
|
||||
it->UpdateBuffer(num, buffer, FX_BUFFER_SIZE, FX_SAMPLE_FORMAT,
|
||||
FX_SAMPLE_RATE, GetInstance().GetOutputMode());
|
||||
}
|
||||
GetInstance().mEffectProcessTick[bus] = OSGetTick() - tick;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -302,6 +302,10 @@ void AxVoice::SetVoiceType(VoiceType type)
|
||||
mVpb.SetVoiceType(type);
|
||||
}
|
||||
|
||||
void AxVoice::EnableRemote(bool enable) {
|
||||
mVpb.SetVoiceRmtOn(enable);
|
||||
}
|
||||
|
||||
void AxVoice::ResetDelta()
|
||||
{
|
||||
ut::AutoInterruptLock lock;
|
||||
@@ -674,6 +678,37 @@ bool AxVoice::SetMix(MixParam const ¶m)
|
||||
return needUpdateFlag;
|
||||
}
|
||||
|
||||
void AxVoice::SetRmtMix(const RemoteMixParam& rParam) {
|
||||
AXPBRMTMIX mix;
|
||||
|
||||
mix.vMain0 = rParam.vMain0;
|
||||
mix.vDeltaMain0 = 0;
|
||||
|
||||
mix.vAux0 = rParam.vAux0;
|
||||
mix.vDeltaAux0 = 0;
|
||||
|
||||
mix.vMain1 = rParam.vMain1;
|
||||
mix.vDeltaMain1 = 0;
|
||||
|
||||
mix.vAux1 = rParam.vAux1;
|
||||
mix.vDeltaAux1 = 0;
|
||||
|
||||
mix.vMain2 = rParam.vMain2;
|
||||
mix.vDeltaMain2 = 0;
|
||||
|
||||
mix.vAux2 = rParam.vAux2;
|
||||
mix.vDeltaAux2 = 0;
|
||||
|
||||
mix.vMain3 = rParam.vMain3;
|
||||
mix.vDeltaMain3 = 0;
|
||||
|
||||
mix.vAux3 = rParam.vAux3;
|
||||
mix.vDeltaAux3 = 0;
|
||||
|
||||
mVpb.SetVoiceRmtMix(mix);
|
||||
}
|
||||
|
||||
|
||||
void AxVoice::SetSrc(f32 ratio, bool initialUpdate)
|
||||
{
|
||||
ut::AutoInterruptLock lock;
|
||||
@@ -713,8 +748,12 @@ void AxVoice::SetVe(f32 volume, f32 initVolume)
|
||||
if (!mVpb.IsAvailable())
|
||||
return;
|
||||
|
||||
mVpb.SetVoiceVe(volume * (AX_MAX_VOLUME - 1),
|
||||
initVolume * (AX_MAX_VOLUME - 1));
|
||||
int v = volume * (AX_MAX_VOLUME - 1);
|
||||
int iv = initVolume * (AX_MAX_VOLUME - 1);
|
||||
v = ut::Clamp(v, 0, 0xFFFF);
|
||||
iv = ut::Clamp(iv, 0, 0xFFFF);
|
||||
|
||||
mVpb.SetVoiceVe(v, iv);
|
||||
}
|
||||
|
||||
void AxVoice::SetLpf(u16 freq)
|
||||
@@ -847,7 +886,7 @@ void AxVoice::SetRemoteFilter(u8 filter)
|
||||
}
|
||||
|
||||
void AxVoice::CalcOffsetAdpcmParam(u16 *outPredScale, u16 *outYn1, u16 *outYn2,
|
||||
u32 offset, void *dataAddr,
|
||||
u32 offset, const void *dataAddr,
|
||||
AdpcmParam const &adpcmParam)
|
||||
{
|
||||
AXPBADPCM adpcm;
|
||||
@@ -921,10 +960,10 @@ void AxVoiceParamBlock::Sync()
|
||||
mVpb->pb.ve.currentDelta =
|
||||
-mPrevVeSetting.currentVolume / AX_SAMPLES_PER_FRAME;
|
||||
}
|
||||
else if (nextVolume > 32767)
|
||||
else if (nextVolume > 65535)
|
||||
{
|
||||
mVpb->pb.ve.currentDelta =
|
||||
(32767 - mPrevVeSetting.currentVolume) / AX_SAMPLES_PER_FRAME;
|
||||
(65535 - mPrevVeSetting.currentVolume) / AX_SAMPLES_PER_FRAME;
|
||||
}
|
||||
|
||||
if (mVpb->pb.ve.currentDelta == 0 && mPrevVeSetting.currentDelta == 0)
|
||||
@@ -1277,6 +1316,102 @@ void AxVoiceParamBlock::SetVoiceBiquadCoefs(u16 b0, u16 b1, u16 b2, u16 a1,
|
||||
mSync |= AX_VPB_SYNC_FLAG_BIQUAD_COEFS;
|
||||
}
|
||||
|
||||
void AxVoiceParamBlock::SetVoiceRmtOn(u16 on) {
|
||||
ut::AutoInterruptLock lock;
|
||||
|
||||
if (!IsAvailable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mVpb->pb.remote = on;
|
||||
mSync |= AX_VPB_SYNC_FLAG_RMT_ON;
|
||||
}
|
||||
|
||||
void AxVoiceParamBlock::SetVoiceRmtMix(_AXPBRMTMIX const &rMix)
|
||||
{
|
||||
ut::AutoInterruptLock lock;
|
||||
|
||||
if (!IsAvailable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
u16* pDst = reinterpret_cast<u16*>(&mVpb->pb.rmtMix);
|
||||
const u16* pSrc = reinterpret_cast<const u16*>(&rMix);
|
||||
|
||||
u16 ctrl = 0;
|
||||
|
||||
// vMain0
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_M0;
|
||||
}
|
||||
// vDeltaMain0
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_DELTA_M0;
|
||||
}
|
||||
// vAux0
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_A0;
|
||||
}
|
||||
// vDeltaAux0
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_DELTA_A0;
|
||||
}
|
||||
|
||||
// vMain1
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_M1;
|
||||
}
|
||||
// vDeltaMain1
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_DELTA_M1;
|
||||
}
|
||||
// vAux1
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_A1;
|
||||
}
|
||||
// vDeltaAux1
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_DELTA_A1;
|
||||
}
|
||||
|
||||
// vMain2
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_M2;
|
||||
}
|
||||
// vDeltaMain2
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_DELTA_M2;
|
||||
}
|
||||
// vAux2
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_A2;
|
||||
}
|
||||
// vDeltaAux2
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_DELTA_A2;
|
||||
}
|
||||
|
||||
// vMain3
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_M3;
|
||||
}
|
||||
// vDeltaMain3
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_DELTA_M3;
|
||||
}
|
||||
// vAux3
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_A3;
|
||||
}
|
||||
// vDeltaAux3
|
||||
if ((*pDst++ = *pSrc++) != 0) {
|
||||
ctrl |= AX_MIXER_CTRL_RMT_DELTA_A3;
|
||||
}
|
||||
|
||||
mVpb->pb.rmtMixerCtrl = ctrl;
|
||||
mSync |= AX_VPB_SYNC_FLAG_RMT_MIXER_CTRL | AX_VPB_SYNC_FLAG_RMT_MIX;
|
||||
}
|
||||
|
||||
void AxVoiceParamBlock::SetVoiceRmtIIR(__AXPBRMTIIR const &iir)
|
||||
{
|
||||
ut::AutoInterruptLock lock;
|
||||
|
||||
@@ -10,6 +10,11 @@ AxfxImpl* AxfxImpl::mCurrentFx = NULL;
|
||||
u32 AxfxImpl::mAllocatedSize = 0;
|
||||
|
||||
bool AxfxImpl::CreateHeap(void* pBuffer, u32 size) {
|
||||
if (pBuffer == NULL || size == 0)
|
||||
{
|
||||
mHeap = NULL;
|
||||
return false;
|
||||
}
|
||||
mHeap = MEMCreateFrmHeap(pBuffer, size);
|
||||
return mHeap != NULL;
|
||||
}
|
||||
@@ -17,6 +22,7 @@ bool AxfxImpl::CreateHeap(void* pBuffer, u32 size) {
|
||||
void AxfxImpl::DestroyHeap() {
|
||||
if (mHeap != NULL) {
|
||||
MEMDestroyFrmHeap(mHeap);
|
||||
mHeap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +30,13 @@ void AxfxImpl::HookAlloc(AXFXAllocHook* pAllocHook, AXFXFreeHook* pFreeHook) {
|
||||
AXFXGetHooks(pAllocHook, pFreeHook);
|
||||
AXFXSetHooks(Alloc, Free);
|
||||
mCurrentFx = this;
|
||||
mAllocatedSize = 0;
|
||||
}
|
||||
|
||||
void AxfxImpl::RestoreAlloc(AXFXAllocHook allocHook, AXFXFreeHook freeHook) {
|
||||
u32 AxfxImpl::RestoreAlloc(AXFXAllocHook allocHook, AXFXFreeHook freeHook) {
|
||||
AXFXSetHooks(allocHook, freeHook);
|
||||
mCurrentFx = NULL;
|
||||
return mAllocatedSize;
|
||||
}
|
||||
|
||||
void* AxfxImpl::Alloc(u32 size) {
|
||||
|
||||
@@ -41,6 +41,9 @@ void PlayerParamSet::Init()
|
||||
for (int i = 0; i < AUX_BUS_NUM; i++)
|
||||
fxSend[i] = 0.0f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
remoteOutVolume[i] = 1.0f;
|
||||
|
||||
for (int i = 0; i < (int)ARRAY_LENGTH(voiceOutParam); i++)
|
||||
{
|
||||
VoiceOutParam *param = &voiceOutParam[i];
|
||||
@@ -99,4 +102,14 @@ void BasicPlayer::SetRemoteFilter(int filter)
|
||||
mPlayerParamSet.remoteFilter = filter;
|
||||
}
|
||||
|
||||
void BasicPlayer::SetRemoteOutVolume(int remote, f32 volume)
|
||||
{
|
||||
mPlayerParamSet.remoteOutVolume[remote] = volume;
|
||||
}
|
||||
|
||||
f32 BasicPlayer::GetRemoteOutVolume(int remote) const
|
||||
{
|
||||
return mPlayerParamSet.remoteOutVolume[remote];
|
||||
}
|
||||
|
||||
}}} // namespace nw4r::snd::detail
|
||||
|
||||
@@ -56,8 +56,8 @@ BasicSound::BasicSound(int priority, int ambientPriority) :
|
||||
mSoundPlayer (nullptr),
|
||||
mSoundActor (nullptr),
|
||||
mExtSoundPlayer (nullptr),
|
||||
mId (INVALID_ID),
|
||||
mPauseNestCounter (0)
|
||||
mId (INVALID_ID)
|
||||
// mPauseNestCounter (0)
|
||||
{
|
||||
// specifically not the source variant
|
||||
NW4RAssertHeaderClampedLRValue_Line(53, priority, PRIORITY_MIN,
|
||||
@@ -108,6 +108,9 @@ void BasicSound::InitParam()
|
||||
for (int i = 0; i < AUX_BUS_NUM; i++)
|
||||
mFxSend[i] = 0.0f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
mRemoteOutVolume[i] = 1.0f;
|
||||
|
||||
mAmbientParam.volume = 1.0f;
|
||||
mAmbientParam.pitch = 1.0f;
|
||||
mAmbientParam.pan = 0.0f;
|
||||
@@ -118,7 +121,7 @@ void BasicSound::InitParam()
|
||||
mAmbientParam.biquadFilterType = 0;
|
||||
mAmbientParam.priority = 0;
|
||||
|
||||
mPauseNestCounter = 0;
|
||||
// mPauseNestCounter = 0;
|
||||
}
|
||||
|
||||
void BasicSound::StartPrepared()
|
||||
@@ -155,7 +158,7 @@ void BasicSound::Pause(bool flag, int fadeFrames)
|
||||
|
||||
if (flag)
|
||||
{
|
||||
mPauseNestCounter++;
|
||||
// mPauseNestCounter++;
|
||||
|
||||
switch (mPauseState)
|
||||
{
|
||||
@@ -183,8 +186,8 @@ void BasicSound::Pause(bool flag, int fadeFrames)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mPauseNestCounter && --mPauseNestCounter)
|
||||
return;
|
||||
// if (mPauseNestCounter && --mPauseNestCounter)
|
||||
// return;
|
||||
|
||||
switch (mPauseState)
|
||||
{
|
||||
@@ -218,7 +221,16 @@ void BasicSound::SetAutoStopCounter(int count)
|
||||
mAutoStopFlag = count > 0;
|
||||
}
|
||||
|
||||
bool BasicSound::IsPaused() const
|
||||
void BasicSound::FadeIn(int fadeFrames)
|
||||
{
|
||||
if (!mFadeOutFlag)
|
||||
{
|
||||
int duration = fadeFrames * (1.0f - mFadeVolume.GetValue());
|
||||
mFadeVolume.SetTarget(1.0f, duration);
|
||||
}
|
||||
}
|
||||
|
||||
bool BasicSound::IsPause() const
|
||||
{
|
||||
return mPauseState == PAUSE_STATE_PAUSING
|
||||
|| mPauseState == PAUSE_STATE_PAUSED;
|
||||
@@ -289,7 +301,28 @@ void BasicSound::Update()
|
||||
{
|
||||
SoundAmbientParam ambientParam;
|
||||
|
||||
mAmbientInfo.paramUpdateCallback->at_0x0c(
|
||||
if (mUpdateCounter != 0)
|
||||
{
|
||||
ambientParam.volume = mAmbientParam.volume;
|
||||
ambientParam.pitch = mAmbientParam.pitch;
|
||||
ambientParam.pan = mAmbientParam.pan;
|
||||
ambientParam.surroundPan = mAmbientParam.surroundPan;
|
||||
ambientParam.fxSend = mAmbientParam.fxSend;
|
||||
ambientParam.lpf = mAmbientParam.lpf;
|
||||
ambientParam.biquadFilterValue = mAmbientParam.biquadFilterValue;
|
||||
ambientParam.biquadFilterType = mAmbientParam.biquadFilterType;
|
||||
ambientParam.priority = mAmbientParam.priority;
|
||||
ambientParam.field_0x24 = mAmbientParam.field_0x24;
|
||||
}
|
||||
else
|
||||
{
|
||||
ambientParam.field_0x24 = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < mVoiceOutCount; i++)
|
||||
ambientParam.voiceOutParam[i] = basicPlayer.GetVoiceOutParam(i);
|
||||
|
||||
mAmbientInfo.paramUpdateCallback->detail_UpdateAmbientParam(
|
||||
mAmbientInfo.arg, mId, mVoiceOutCount, &ambientParam);
|
||||
|
||||
mAmbientParam.volume = ambientParam.volume;
|
||||
@@ -301,10 +334,11 @@ void BasicSound::Update()
|
||||
mAmbientParam.biquadFilterValue = ambientParam.biquadFilterValue;
|
||||
mAmbientParam.biquadFilterType = ambientParam.biquadFilterType;
|
||||
mAmbientParam.priority = ambientParam.priority;
|
||||
mAmbientParam.field_0x24 = ambientParam.field_0x24;
|
||||
|
||||
for (int i = 0; i < mVoiceOutCount; i++)
|
||||
basicPlayer.SetVoiceOutParam(i, ambientParam.voiceOutParam[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (mSoundActor)
|
||||
mActorParam = mSoundActor->detail_GetActorParam();
|
||||
@@ -410,6 +444,13 @@ void BasicSound::UpdateParam()
|
||||
mainOutVolume *= mMainOutVolume;
|
||||
mainOutVolume *= GetSoundPlayer()->GetMainOutVolume();
|
||||
|
||||
f32 remoteOutVolume[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
remoteOutVolume[i] = 1.0f;
|
||||
remoteOutVolume[i] *= GetSoundPlayer()->GetRemoteOutVolume(i);
|
||||
remoteOutVolume[i] *= mRemoteOutVolume[i];
|
||||
}
|
||||
|
||||
f32 mainSend = 0.0f;
|
||||
mainSend += mMainSend;
|
||||
mainSend += GetSoundPlayer()->GetMainSend();
|
||||
@@ -434,6 +475,10 @@ void BasicSound::UpdateParam()
|
||||
basicPlayer.SetOutputLine(outputLineFlag);
|
||||
basicPlayer.SetMainOutVolume(mainOutVolume);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
basicPlayer.SetRemoteOutVolume(i, remoteOutVolume[i]);
|
||||
}
|
||||
|
||||
basicPlayer.SetMainSend(mainSend);
|
||||
|
||||
for (int i = 0; i < AUX_BUS_NUM; i++)
|
||||
@@ -474,7 +519,7 @@ void BasicSound::Shutdown()
|
||||
|
||||
if (mAmbientInfo.argAllocaterCallback)
|
||||
{
|
||||
mAmbientInfo.argAllocaterCallback->at_0x10(mAmbientInfo.arg, this);
|
||||
mAmbientInfo.argAllocaterCallback->detail_FreeAmbientArg(mAmbientInfo.arg, this);
|
||||
|
||||
mAmbientInfo.arg = nullptr;
|
||||
}
|
||||
@@ -547,6 +592,11 @@ void BasicSound::DetachExternalSoundPlayer(ExternalSoundPlayer *extPlayer)
|
||||
mExtSoundPlayer = nullptr;
|
||||
}
|
||||
|
||||
int BasicSound::GetRemainingFadeFrames() const
|
||||
{
|
||||
return mPauseFadeVolume.GetRemainingTime();
|
||||
}
|
||||
|
||||
int BasicSound::GetVoiceOutCount() const
|
||||
{
|
||||
return mVoiceOutCount;
|
||||
@@ -569,15 +619,21 @@ void BasicSound::SetPlayerPriority(int priority)
|
||||
void BasicSound::SetInitialVolume(f32 volume)
|
||||
{
|
||||
NW4RAssert_Line(818, volume >= 0.0f);
|
||||
if (volume < 0.0f) {
|
||||
volume = 0.0f;
|
||||
}
|
||||
|
||||
mInitVolume = ut::Clamp(volume, 0.0f, 1.0f);
|
||||
mInitVolume = mInitVolume = volume;
|
||||
}
|
||||
|
||||
void BasicSound::SetVolume(f32 volume, int frames)
|
||||
{
|
||||
NW4RAssert_Line(833, volume >= 0.0f);
|
||||
if (volume < 0.0f) {
|
||||
volume = 0.0f;
|
||||
}
|
||||
|
||||
mExtMoveVolume.SetTarget(ut::Clamp(volume, 0.0f, 1.0f), frames);
|
||||
mExtMoveVolume.SetTarget(volume, frames);
|
||||
}
|
||||
|
||||
void BasicSound::SetPitch(f32 pitch)
|
||||
@@ -587,12 +643,32 @@ void BasicSound::SetPitch(f32 pitch)
|
||||
mExtPitch = pitch;
|
||||
}
|
||||
|
||||
void BasicSound::SetPan(f32 pan)
|
||||
{
|
||||
mExtPan = pan;
|
||||
}
|
||||
|
||||
void BasicSound::SetSurroundPan(f32 pan)
|
||||
{
|
||||
mExtSurroundPan = pan;
|
||||
}
|
||||
|
||||
void BasicSound::SetLpfFreq(f32 freq)
|
||||
{
|
||||
mLpfFreq = freq;
|
||||
}
|
||||
|
||||
void BasicSound::SetOutputLineFlag(int flag)
|
||||
{
|
||||
mOutputLineFlag = flag;
|
||||
}
|
||||
|
||||
void BasicSound::SetFxSend(AuxBus bus, f32 send)
|
||||
{
|
||||
// specifically not the source variant
|
||||
NW4RAssertHeaderClampedLValue_Line(979, bus, AUX_A, AUX_BUS_NUM);
|
||||
|
||||
GetBasicPlayer().SetFxSend(bus, send);
|
||||
mFxSend[bus] = send;
|
||||
}
|
||||
|
||||
void BasicSound::SetRemoteFilter(int filter)
|
||||
@@ -615,7 +691,7 @@ void BasicSound::SetAmbientInfo(AmbientInfo const &ambientArgInfo)
|
||||
NW4RAssertPointerNonnull_Line(1090, ambientArgInfo.argAllocaterCallback);
|
||||
|
||||
void *ambientArg =
|
||||
ambientArgInfo.argAllocaterCallback->at_0x0c(ambientArgInfo.argSize);
|
||||
ambientArgInfo.argAllocaterCallback->detail_AllocAmbientArg(ambientArgInfo.argSize);
|
||||
if (!ambientArg)
|
||||
{
|
||||
NW4RCheckMessage_Line(1093, ambientArg, "Failed to alloc AmbientArg.");
|
||||
@@ -629,7 +705,7 @@ void BasicSound::SetAmbientInfo(AmbientInfo const &ambientArgInfo)
|
||||
if (ambientArgInfo.paramUpdateCallback)
|
||||
{
|
||||
int voiceOutCount =
|
||||
mAmbientInfo.paramUpdateCallback->at_0x14(mAmbientInfo.arg, mId);
|
||||
mAmbientInfo.paramUpdateCallback->detail_GetRequiredVoiceOutCount(mAmbientInfo.arg, mId);
|
||||
|
||||
if (voiceOutCount > 4)
|
||||
voiceOutCount = 4;
|
||||
@@ -644,7 +720,7 @@ int BasicSound::GetAmbientPriority(AmbientInfo const &ambientInfo, u32 soundId)
|
||||
return PRIORITY_MIN;
|
||||
|
||||
int priority =
|
||||
ambientInfo.paramUpdateCallback->at_0x10(ambientInfo.arg, soundId);
|
||||
ambientInfo.paramUpdateCallback->detail_GetAmbientPriority(ambientInfo.arg, soundId);
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
@@ -150,6 +150,9 @@ void Channel::InitParam(Callback *callback, u32 callbackData)
|
||||
for (int i = 0; i < AUX_BUS_NUM; i++)
|
||||
mFxSend[i] = 0.0f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
mRemoteOutVolume[i] = 1.0f;
|
||||
|
||||
mSilenceVolume.InitValue(SILENCE_VOLUME_MAX);
|
||||
|
||||
mSweepPitch = 0.0f;
|
||||
@@ -252,6 +255,12 @@ void Channel::Update(bool doPeriodicProc)
|
||||
fxSend[i] += mFxSend[i];
|
||||
}
|
||||
|
||||
f32 remoteOutVolume[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
remoteOutVolume[i] = 1.0f;
|
||||
remoteOutVolume[i] *= mRemoteOutVolume[i];
|
||||
}
|
||||
|
||||
if (doPeriodicProc)
|
||||
{
|
||||
if (mAutoSweep)
|
||||
@@ -287,6 +296,10 @@ void Channel::Update(bool doPeriodicProc)
|
||||
|
||||
for (int i = 0; i < AUX_BUS_NUM; i++)
|
||||
mVoice->SetFxSend(static_cast<AuxBus>(i), fxSend[i]);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mVoice->SetRemoteOutVolume(i, remoteOutVolume[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ void DisposeCallbackManager::Dispose(void *mem, u32 size, void *arg ATTR_UNUSED)
|
||||
{
|
||||
decltype(itr) curItr = itr++;
|
||||
|
||||
// the post-increment is in ketteiban
|
||||
curItr++->InvalidateData(start, end);
|
||||
curItr->InvalidateData(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +72,7 @@ void DisposeCallbackManager::DisposeWave(void *mem, u32 size,
|
||||
{
|
||||
decltype(itr) curItr = itr++;
|
||||
|
||||
curItr++->InvalidateWaveData(start, end);
|
||||
curItr->InvalidateWaveData(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,10 @@ bool DvdSoundArchive::Open(const char* pPath) {
|
||||
|
||||
char extRoot[FILE_PATH_MAX];
|
||||
for (int i = std::strlen(pPath) - 1; i >= 0; i--) {
|
||||
if (pPath[i] == '/' || pPath[i] == '\\') {
|
||||
// @bug Long path can overflow extRoot buffer
|
||||
if ((pPath[i] == '/' || pPath[i] == '\\')) {
|
||||
if (i >= FILE_PATH_MAX + 1) {
|
||||
return false;
|
||||
}
|
||||
std::strncpy(extRoot, pPath, i);
|
||||
extRoot[i] = '\0';
|
||||
|
||||
@@ -70,8 +72,10 @@ bool DvdSoundArchive::Open(const char* pPath) {
|
||||
}
|
||||
|
||||
void DvdSoundArchive::Close() {
|
||||
DVDClose(&mFileInfo);
|
||||
mOpen = false;
|
||||
if (mOpen) {
|
||||
DVDClose(&mFileInfo);
|
||||
mOpen = false;
|
||||
}
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
@@ -115,7 +119,7 @@ bool DvdSoundArchive::LoadFileHeader() {
|
||||
u8 headerArea[detail::SoundArchiveFile::HEADER_AREA_SIZE];
|
||||
|
||||
static const u32 headerAlignSize =
|
||||
ut::RoundUp(sizeof(detail::SoundArchiveFile::Header), 32);
|
||||
ROUND_UP(sizeof(detail::SoundArchiveFile::Header), 32);
|
||||
|
||||
void* pFile = ut::RoundUp<u8>(headerArea, 32);
|
||||
|
||||
@@ -173,9 +177,6 @@ bool DvdSoundArchive::LoadLabelStringData(void* pBuffer, u32 size) {
|
||||
DvdSoundArchive::DvdFileStream::DvdFileStream(const DVDFileInfo* pFileInfo,
|
||||
u32 offset, u32 size)
|
||||
: DvdLockedFileStream(pFileInfo, false), mOffset(offset), mSize(size) {
|
||||
if (mSize == 0) {
|
||||
mSize = ut::DvdFileStream::GetSize();
|
||||
}
|
||||
|
||||
ut::DvdFileStream::Seek(mOffset, SEEKORG_BEG);
|
||||
}
|
||||
@@ -183,9 +184,6 @@ DvdSoundArchive::DvdFileStream::DvdFileStream(const DVDFileInfo* pFileInfo,
|
||||
DvdSoundArchive::DvdFileStream::DvdFileStream(s32 entrynum, u32 offset,
|
||||
u32 size)
|
||||
: DvdLockedFileStream(entrynum), mOffset(offset), mSize(size) {
|
||||
if (mSize == 0) {
|
||||
mSize = ut::DvdFileStream::GetSize();
|
||||
}
|
||||
|
||||
ut::DvdFileStream::Seek(mOffset, SEEKORG_BEG);
|
||||
}
|
||||
|
||||
@@ -42,10 +42,37 @@ ExternalSoundPlayer::~ExternalSoundPlayer() {
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// not sure which one uses this exactly, maybe StopAllSound?
|
||||
DECOMP_FORCE_CLASS_METHOD(
|
||||
BasicSound::ExtSoundPlayerPlayLinkList,
|
||||
GetPointerFromNode(static_cast<ut::LinkListNode *>(nullptr)));
|
||||
#endif
|
||||
|
||||
void ExternalSoundPlayer::StopAllSound(int fadeFrames)
|
||||
{
|
||||
NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList)
|
||||
{
|
||||
it++->Stop(fadeFrames);
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalSoundPlayer::PauseAllSound(bool flag, int fadeFrames)
|
||||
{
|
||||
NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList)
|
||||
{
|
||||
it++->Pause(flag, fadeFrames);
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalSoundPlayer::DetachSoundActorAll(SoundActor *sound)
|
||||
{
|
||||
NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList)
|
||||
{
|
||||
it++->DetachSoundActor(sound);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ExternalSoundPlayer::AppendSound(BasicSound *sound)
|
||||
{
|
||||
|
||||
@@ -63,10 +63,11 @@ void* FrameHeap::Alloc(u32 size, FreeCallback pCallback, void* pCallbackArg) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Block* pBlock = new (pBuffer) Block(size, pCallback, pCallbackArg);
|
||||
void *pBuffer2 = ut::AddOffsetToPtr(pBuffer, BLOCK_BUFFER_SIZE);
|
||||
Block* pBlock = new (pBuffer) Block(pBuffer2, size, pCallback, pCallbackArg);
|
||||
mSectionList.GetBack().AppendBlock(pBlock);
|
||||
|
||||
return pBlock->GetBufferAddr();
|
||||
return pBuffer2;
|
||||
}
|
||||
|
||||
int FrameHeap::SaveState() {
|
||||
@@ -106,11 +107,11 @@ int FrameHeap::GetCurrentLevel() const {
|
||||
|
||||
u32 FrameHeap::GetFreeSize() const {
|
||||
u32 freeSize = MEMGetAllocatableSizeForFrmHeapEx(mHandle, HEAP_ALIGN);
|
||||
if (freeSize < BLOCK_BUFFER_SIZE) {
|
||||
if (freeSize < sizeof(Block)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ut::RoundDown(freeSize - BLOCK_BUFFER_SIZE, HEAP_ALIGN);
|
||||
return ut::RoundDown(freeSize - sizeof(Block), HEAP_ALIGN);
|
||||
}
|
||||
|
||||
bool FrameHeap::NewSection() {
|
||||
|
||||
@@ -1 +1,186 @@
|
||||
// #include "nw4r/snd/snd_FxReverbStdDpl2.h"
|
||||
#include "nw4r/snd/snd_FxReverbStdDpl2.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "nw4r/snd/snd_AxManager.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
#include "nw4r/ut/ut_algorithm.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
FxReverbStdDpl2::FxReverbStdDpl2() : mIsActive(0) {
|
||||
detail::FxReverbStdParam p;
|
||||
SetParam(p);
|
||||
}
|
||||
|
||||
u32 FxReverbStdDpl2::GetRequiredMemSize() {
|
||||
return ut::Max(
|
||||
ut::RoundUp(AXFXReverbStdExpGetMemSizeDpl2(&mAxfxParamDpl) + detail::AxfxImpl::HEAP_SIZE_MIN, 32),
|
||||
ut::RoundUp(AXFXReverbStdExpGetMemSize(&mAxfxParam) + detail::AxfxImpl::HEAP_SIZE_MIN, 32)
|
||||
);
|
||||
}
|
||||
|
||||
bool FxReverbStdDpl2::AssignWorkBuffer(void *pBuffer, u32 size) {
|
||||
return mImpl.CreateHeap(pBuffer, size);
|
||||
}
|
||||
|
||||
void FxReverbStdDpl2::ReleaseWorkBuffer() {
|
||||
mImpl.DestroyHeap();
|
||||
}
|
||||
|
||||
bool FxReverbStdDpl2::StartUp() {
|
||||
u32 memSize = GetRequiredMemSize();
|
||||
if (memSize > mImpl.GetHeapTotalSize()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AXFXAllocHook allocHook;
|
||||
AXFXFreeHook freeHook;
|
||||
BOOL success;
|
||||
switch (detail::AxManager::GetInstance().GetOutputMode()) {
|
||||
case OUTPUT_MODE_DPL2: {
|
||||
mOutputMode = 1;
|
||||
|
||||
mImpl.HookAlloc(&allocHook, &freeHook);
|
||||
success = AXFXReverbStdExpInitDpl2(&mAxfxParamDpl);
|
||||
mImpl.RestoreAlloc(allocHook, freeHook);
|
||||
|
||||
(void)AXFXReverbStdExpGetMemSizeDpl2(&mAxfxParamDpl); // debug leftover
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
mOutputMode = 0;
|
||||
|
||||
mImpl.HookAlloc(&allocHook, &freeHook);
|
||||
success = AXFXReverbStdExpInit(&mAxfxParam);
|
||||
mImpl.RestoreAlloc(allocHook, freeHook);
|
||||
|
||||
(void)AXFXReverbStdExpGetMemSize(&mAxfxParam); // debug leftover
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mIsActive = 1;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void FxReverbStdDpl2::Shutdown() {
|
||||
if (!mIsActive) {
|
||||
return;
|
||||
}
|
||||
AXFXAllocHook allocHook;
|
||||
AXFXFreeHook freeHook;
|
||||
mIsActive = 0;
|
||||
mImpl.HookAlloc(&allocHook, &freeHook);
|
||||
|
||||
switch (mOutputMode) {
|
||||
case 1: {
|
||||
AXFXReverbStdExpShutdownDpl2(&mAxfxParamDpl);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
AXFXReverbStdExpShutdown(&mAxfxParam);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mImpl.RestoreAlloc(allocHook, freeHook);
|
||||
}
|
||||
|
||||
bool FxReverbStdDpl2::SetParam(const detail::FxReverbStdParam &rParam) {
|
||||
mParam = rParam;
|
||||
|
||||
f32 f1 = ut::Max(rParam.field_0x18, 0.0f);
|
||||
bool b = f1 != mAxfxParam.field_0xB8;
|
||||
|
||||
mAxfxParam.field_0xB4 = mAxfxParamDpl.field_0xD0 = rParam.field_0x14;
|
||||
mAxfxParam.field_0xB8 = mAxfxParamDpl.field_0xD4 = f1;
|
||||
|
||||
mAxfxParam.field_0xBC = mAxfxParamDpl.field_0xD8 = ut::Clamp(rParam.field_0x00, 0.0f, rParam.field_0x18);
|
||||
mAxfxParam.field_0xC0 = mAxfxParamDpl.field_0xDC = rParam.field_0x1C;
|
||||
mAxfxParam.field_0xC4 = mAxfxParamDpl.field_0xE0 = ut::Max(rParam.field_0x04, 0.0f);
|
||||
mAxfxParam.field_0xC8 = mAxfxParamDpl.field_0xE4 = ut::Clamp(rParam.field_0x08, 0.0f, 1.0f);
|
||||
mAxfxParam.field_0xCC = mAxfxParamDpl.field_0xE8 = ut::Clamp(rParam.field_0x0C, 0.0f, 1.0f);
|
||||
mAxfxParam.field_0xD0 = mAxfxParamDpl.field_0xEC = ut::Clamp(rParam.field_0x20, 0.0f, 1.0f);
|
||||
mAxfxParam.field_0xD4 = mAxfxParamDpl.field_0xF0 = ut::Clamp(rParam.field_0x24, 0.0f, 1.0f);
|
||||
mAxfxParam.field_0xE0 = mAxfxParamDpl.field_0xFC = ut::Clamp(rParam.field_0x10, 0.0f, 1.0f);
|
||||
|
||||
mAxfxParam.field_0xD8 = 0;
|
||||
mAxfxParam.field_0xDC = 0;
|
||||
mAxfxParam.field_0xE4 = 0.0f;
|
||||
|
||||
mAxfxParamDpl.field_0xF4 = 0;
|
||||
mAxfxParamDpl.field_0xF8 = 0;
|
||||
mAxfxParamDpl.field_0x100 = 0.0f;
|
||||
|
||||
if (!mIsActive) {
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 memSize = GetRequiredMemSize();
|
||||
if (memSize > mImpl.GetHeapTotalSize()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AXFXAllocHook allocHook;
|
||||
AXFXFreeHook freeHook;
|
||||
BOOL success;
|
||||
if (b) {
|
||||
mImpl.HookAlloc(&allocHook, &freeHook);
|
||||
switch (mOutputMode) {
|
||||
case 1: success = AXFXReverbStdExpSettingsDpl2(&mAxfxParamDpl); break;
|
||||
default: success = AXFXReverbStdExpSettings(&mAxfxParam); break;
|
||||
}
|
||||
|
||||
mImpl.RestoreAlloc(allocHook, freeHook);
|
||||
} else {
|
||||
switch (mOutputMode) {
|
||||
case 1: success = AXFXReverbStdExpSettingsUpdateDpl2(&mAxfxParamDpl); break;
|
||||
default: success = AXFXReverbStdExpSettingsUpdate(&mAxfxParam); break;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void FxReverbStdDpl2::UpdateBuffer(
|
||||
int channels, void **ppBuffer, u32 size, SampleFormat sampleFormat, f32 sampleRate, OutputMode outputMode
|
||||
) {
|
||||
if (!mIsActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((outputMode == OUTPUT_MODE_DPL2) != mOutputMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mOutputMode) {
|
||||
case 1: {
|
||||
void *chans[AX_DPL2_MAX];
|
||||
chans[AX_DPL2_L] = ppBuffer[AX_DPL2_L];
|
||||
chans[AX_DPL2_R] = ppBuffer[AX_DPL2_R];
|
||||
chans[AX_DPL2_LS] = ppBuffer[AX_DPL2_LS];
|
||||
chans[AX_DPL2_RS] = ppBuffer[AX_DPL2_RS];
|
||||
AXFXReverbStdExpCallbackDpl2(chans, &mAxfxParamDpl);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
void *chans[3];
|
||||
chans[0] = ppBuffer[0];
|
||||
chans[1] = ppBuffer[1];
|
||||
chans[2] = ppBuffer[2];
|
||||
AXFXReverbStdExpCallback(chans, &mAxfxParam);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FxReverbStdDpl2::OnChangeOutputMode() {
|
||||
if (mOutputMode != (detail::AxManager::GetInstance().GetOutputMode() == OUTPUT_MODE_DPL2)) {
|
||||
Shutdown();
|
||||
StartUp();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -176,7 +176,7 @@ void MemorySoundArchive::MemoryFileStream::Seek(s32 offset, u32 origin)
|
||||
|
||||
default:
|
||||
NW4RPanicMessage_Line(234, "Unsupported Seek origin");
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ MmlSeqTrack::ParseResult MmlParser::Parse(MmlSeqTrack *track,
|
||||
s32 commandArg1 = 0;
|
||||
s32 commandArg2 = 0;
|
||||
|
||||
switch (static_cast<int>(cmd & MML_CMD_SET_MASK))
|
||||
switch (cmd & MML_CMD_SET_MASK)
|
||||
{
|
||||
case 0x80:
|
||||
{
|
||||
@@ -410,7 +410,7 @@ void MmlParser::CommandProc(MmlSeqTrack *track, u32 command, s32 commandArg1,
|
||||
break;
|
||||
|
||||
case MML_SET_PITCH_BEND:
|
||||
trackParam.pitchBend = commandArg1;
|
||||
trackParam.pitchBend.SetTarget(commandArg1, commandArg2);
|
||||
break;
|
||||
|
||||
case MML_SET_BEND_RANGE:
|
||||
|
||||
@@ -47,22 +47,48 @@ bool NandSoundArchive::Open(const char* pPath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char currentDir[64];
|
||||
NANDGetCurrentDir(currentDir);
|
||||
u32 currDirLen = std::strlen(currentDir);
|
||||
|
||||
char extRoot[FILE_PATH_MAX];
|
||||
std::strncpy(extRoot, currentDir, currDirLen + 1);
|
||||
|
||||
for (int i = std::strlen(pPath) - 1; i >= 0; i--) {
|
||||
if (pPath[i] == '/' || pPath[i] == '\\') {
|
||||
// @bug Long path can overflow extRoot buffer
|
||||
std::strncat(extRoot, pPath, i);
|
||||
extRoot[currDirLen + i] = '\0';
|
||||
break;
|
||||
char *pExtRoot = extRoot;
|
||||
// UB: (?) Array index 256 is past the end of the array
|
||||
char *pEnd = &extRoot[FILE_PATH_MAX + 1];
|
||||
if (pPath[0] != '/' && pPath[0] != '\\') {
|
||||
char currentDir[64];
|
||||
if (NANDGetCurrentDir(currentDir) != NAND_RESULT_OK) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char *pCurrentDir = currentDir;
|
||||
while (*pCurrentDir != '\0') {
|
||||
if (pExtRoot >= pEnd) {
|
||||
return false;
|
||||
}
|
||||
*pExtRoot++ = *pCurrentDir++;
|
||||
}
|
||||
if (pExtRoot >= pEnd) {
|
||||
return false;
|
||||
}
|
||||
*pExtRoot++ = '/';
|
||||
}
|
||||
|
||||
const char *pPath2 = pPath;
|
||||
const char *p3 = pPath;
|
||||
while (*pPath2 != '\0') {
|
||||
if (*pPath2 == '/' || *pPath2 == '\\') {
|
||||
while (p3 < pPath2) {
|
||||
if (pExtRoot >= pEnd) {
|
||||
return false;
|
||||
}
|
||||
*pExtRoot++ = *p3++;
|
||||
}
|
||||
}
|
||||
pPath2++;
|
||||
}
|
||||
|
||||
|
||||
if (pExtRoot >= pEnd) {
|
||||
return false;
|
||||
}
|
||||
*pExtRoot = '\0';
|
||||
SetExternalFileRoot(extRoot);
|
||||
return true;
|
||||
}
|
||||
@@ -193,9 +219,6 @@ NandSoundArchive::NandFileStream::NandFileStream(const NANDFileInfo* pFileInfo,
|
||||
mSize(size) {
|
||||
|
||||
if (IsAvailable()) {
|
||||
if (mSize == 0) {
|
||||
mSize = ut::NandFileStream::GetSize();
|
||||
}
|
||||
|
||||
ut::NandFileStream::Seek(mOffset, SEEKORG_BEG);
|
||||
}
|
||||
@@ -208,9 +231,6 @@ NandSoundArchive::NandFileStream::NandFileStream(const char* pPath, u32 offset,
|
||||
mSize(size) {
|
||||
|
||||
if (IsAvailable()) {
|
||||
if (mSize == 0) {
|
||||
mSize = ut::NandFileStream::GetSize();
|
||||
}
|
||||
|
||||
ut::NandFileStream::Seek(mOffset, SEEKORG_BEG);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ bool RemoteSpeaker::Setup(WPADCallback pCallback) {
|
||||
mValidCallbackFlag = false;
|
||||
}
|
||||
|
||||
mWpadCallback = pCallback;
|
||||
mUserCommand = COMMAND_SPEAKER_ON;
|
||||
mWpadCallback = pCallback;
|
||||
mInitFlag = true;
|
||||
|
||||
return true;
|
||||
@@ -357,7 +357,7 @@ void RemoteSpeaker::ContinueAlarmHandler(OSAlarm* pAlarm, OSContext* pCtx) {
|
||||
RemoteSpeaker* p = static_cast<RemoteSpeaker*>(OSGetAlarmUserData(pAlarm));
|
||||
|
||||
// p->mForceResumeFlag = true;
|
||||
p->mContinueFlag = false;
|
||||
// p->mContinueFlag = false;
|
||||
}
|
||||
|
||||
void RemoteSpeaker::IntervalAlarmHandler(OSAlarm* pAlarm, OSContext* pCtx) {
|
||||
|
||||
@@ -238,8 +238,10 @@ void SeqPlayer::Skip(OffsetType offsetType, int offset)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// SeqPlayer::SetTempoRatio ([R89JEL]:/bin/RVL/Debug/mainD.MAP:13781)
|
||||
DECOMP_FORCE(NW4RAssert_String(tempoRatio >= 0.0f));
|
||||
#endif
|
||||
|
||||
void SeqPlayer::SetTempoRatio(f32 tempo) {
|
||||
mTempoRatio = tempo;
|
||||
@@ -284,6 +286,31 @@ void SeqPlayer::CallSeqUserprocCallback(u16 procId, SeqTrack *track)
|
||||
trackParam.cmpFlag = param.cmpFlag;
|
||||
}
|
||||
|
||||
s16 SeqPlayer::GetLocalVariable(int varNo) const {
|
||||
return mLocalVariable[varNo];
|
||||
}
|
||||
|
||||
void SeqPlayer::SetLocalVariable(int varNo, s16 value) {
|
||||
mLocalVariable[varNo] = value;
|
||||
}
|
||||
|
||||
void SeqPlayer::SetGlobalVariable(int varNo, s16 value) {
|
||||
mGlobalVariable[varNo] = value;
|
||||
}
|
||||
|
||||
void SeqPlayer::SetTrackMute(u32 trackFlags, SeqMute mute) {
|
||||
SetTrackParam<SeqMute>(trackFlags, &SeqTrack::SetMute, mute);
|
||||
}
|
||||
|
||||
void SeqPlayer::SetTrackSilence(u32 trackFlags, bool silence, int fadeFrames) {
|
||||
SetTrackParam<bool, int>(trackFlags, &SeqTrack::SetSilence, silence, fadeFrames);
|
||||
}
|
||||
|
||||
void SeqPlayer::SetTrackVolume(u32 trackFlags, f32 volume) {
|
||||
SetTrackParam<f32>(trackFlags, &SeqTrack::SetVolume, volume);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// SeqPlayer::GetLocalVariable? maybe all of them?
|
||||
DECOMP_FORCE(NW4RAssertHeaderClampedLValue_String(varNo));
|
||||
|
||||
@@ -321,6 +348,7 @@ DECOMP_FORCE(&SeqTrack::SetModDepth);
|
||||
|
||||
// SeqPlayer::SetTrackModSpeed ([R89JEL]:/bin/RVL/Debug/mainD.MAP:13801)
|
||||
DECOMP_FORCE(&SeqTrack::SetModSpeed);
|
||||
#endif
|
||||
|
||||
void SeqPlayer::InvalidateData(void const *start, void const *end)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "nw4r/snd/snd_SeqFile.h"
|
||||
#include "nw4r/snd/snd_SeqPlayer.h"
|
||||
#include "nw4r/snd/snd_SeqSoundHandle.h"
|
||||
#include "nw4r/snd/snd_SeqTrack.h"
|
||||
#include "nw4r/snd/snd_SoundInstanceManager.h"
|
||||
#include "nw4r/snd/snd_TaskManager.h"
|
||||
|
||||
@@ -165,9 +166,10 @@ void SeqSound::Shutdown()
|
||||
BasicSound::Shutdown();
|
||||
mManager->Free(this);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// SeqSound::SetTempoRatio ([R89JEL]:/bin/RVL/Debug/mainD.MAP:13849)
|
||||
DECOMP_FORCE(NW4RAssert_String(tempoRatio >= 0.0f));
|
||||
#endif
|
||||
|
||||
void SeqSound::SetTempoRatio(f32 tempo) {
|
||||
mSeqPlayer.SetTempoRatio(tempo);
|
||||
@@ -197,6 +199,60 @@ void SeqSound::OnUpdatePlayerPriority()
|
||||
mManager->UpdatePriority(this, CalcCurrentPlayerPriority());
|
||||
}
|
||||
|
||||
void SeqSound::SetTrackMute(u32 trackFlags, SeqMute mute)
|
||||
{
|
||||
mSeqPlayer.SetTrackMute(trackFlags, mute);
|
||||
}
|
||||
|
||||
void SeqSound::SetTrackSilence(u32 trackFlags, bool silence, int fadeFrames)
|
||||
{
|
||||
mSeqPlayer.SetTrackSilence(trackFlags, silence, fadeFrames);
|
||||
}
|
||||
|
||||
void SeqSound::SetTrackVolume(u32 trackFlags, f32 volume)
|
||||
{
|
||||
mSeqPlayer.SetTrackVolume(trackFlags, volume);
|
||||
}
|
||||
|
||||
bool SeqSound::ReadVariable(int varNo, s16 *value) const
|
||||
{
|
||||
if (!GetStartedFlag()) {
|
||||
*value = -1;
|
||||
} else {
|
||||
*value = mSeqPlayer.GetLocalVariable(varNo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SeqSound::WriteVariable(int varNo, s16 value)
|
||||
{
|
||||
mSeqPlayer.SetLocalVariable(varNo, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SeqSound::WriteGlobalVariable(int varNo, s16 value)
|
||||
{
|
||||
SeqPlayer::SetGlobalVariable(varNo, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SeqSound::WriteTrackVariable(int trackNo, int varNo, s16 value)
|
||||
{
|
||||
SeqTrack *track = mSeqPlayer.GetPlayerTrack(trackNo);
|
||||
if (track == NULL)
|
||||
return false;
|
||||
|
||||
track->SetTrackVariable(varNo, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 SeqSound::GetTick() const
|
||||
{
|
||||
return !GetStartedFlag() ? 0 : mSeqPlayer.GetTickCounter();
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// SeqSound::SetTrackVolume ([R89JEL]:/bin/RVL/Debug/mainD.MAP:13857)
|
||||
DECOMP_FORCE(NW4RAssert_String(volume >= 0.0f));
|
||||
|
||||
@@ -211,7 +267,7 @@ DECOMP_FORCE(NW4RAssertHeaderClampedLValue_String(varNo));
|
||||
|
||||
// SeqSound::ReadTrackVariable? maybe both of them?
|
||||
DECOMP_FORCE(NW4RAssertHeaderClampedLValue_String(trackNo));
|
||||
|
||||
#endif
|
||||
bool SeqSound::IsAttachedTempSpecialHandle()
|
||||
{
|
||||
return mTempSpecialHandle != nullptr;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "common.h" // nullptr
|
||||
|
||||
#include "nw4r/snd/snd_SeqSound.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/ut/ut_RuntimeTypeInfo.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* functions
|
||||
@@ -19,6 +21,29 @@
|
||||
|
||||
namespace nw4r { namespace snd {
|
||||
|
||||
SeqSoundHandle::SeqSoundHandle(SoundHandle *handle) :
|
||||
mSound (nullptr)
|
||||
{
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
detail::BasicSound *basicSound = handle->detail_GetAttachedSound();
|
||||
if (!basicSound)
|
||||
return;
|
||||
|
||||
if (detail::SeqSound *sound =
|
||||
ut::DynamicCast<detail::SeqSound *>(basicSound))
|
||||
{
|
||||
|
||||
mSound = sound;
|
||||
|
||||
if (mSound->IsAttachedTempSpecialHandle())
|
||||
mSound->DetachTempSpecialHandle();
|
||||
|
||||
mSound->mTempSpecialHandle = this;
|
||||
}
|
||||
}
|
||||
|
||||
void SeqSoundHandle::DetachSound()
|
||||
{
|
||||
if (IsAttachedSound())
|
||||
|
||||
@@ -83,7 +83,7 @@ void SeqTrack::InitParam()
|
||||
mParserTrackParam.surroundPan.InitValue(0);
|
||||
mParserTrackParam.volume2 = 127;
|
||||
mParserTrackParam.velocityRange = 127;
|
||||
mParserTrackParam.pitchBend = 0;
|
||||
mParserTrackParam.pitchBend.InitValue(0);
|
||||
mParserTrackParam.bendRange = DEFAULT_BENDRANGE;
|
||||
mParserTrackParam.initPan = 0;
|
||||
mParserTrackParam.transpose = 0;
|
||||
@@ -172,6 +172,7 @@ int SeqTrack::ParseNextTick(bool doNoteOn)
|
||||
mParserTrackParam.volume.Update();
|
||||
mParserTrackParam.pan.Update();
|
||||
mParserTrackParam.surroundPan.Update();
|
||||
mParserTrackParam.pitchBend.Update();
|
||||
|
||||
if (mParserTrackParam.noteFinishWait)
|
||||
{
|
||||
@@ -277,7 +278,7 @@ void SeqTrack::UpdateChannelParam()
|
||||
volume *= mSeqPlayer->GetVolume();
|
||||
|
||||
f32 pitch =
|
||||
mParserTrackParam.pitchBend / 128.0f * mParserTrackParam.bendRange;
|
||||
mParserTrackParam.pitchBend.GetValue() / 128.0f * mParserTrackParam.bendRange;
|
||||
|
||||
f32 pitchRatio = 1.0f;
|
||||
pitchRatio *= mSeqPlayer->GetPitch();
|
||||
@@ -339,13 +340,17 @@ void SeqTrack::UpdateChannelParam()
|
||||
channel->SetOutputLine(mSeqPlayer->GetOutputLine());
|
||||
channel->SetMainOutVolume(mSeqPlayer->GetMainOutVolume());
|
||||
channel->SetMainSend(mainSend);
|
||||
|
||||
|
||||
for (int i = 0; i < AUX_BUS_NUM; i++)
|
||||
{
|
||||
AuxBus bus = static_cast<AuxBus>(i);
|
||||
channel->SetFxSend(bus, fxSend[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
channel->SetRemoteOutVolume(i, mSeqPlayer->GetRemoteOutVolume(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < mSeqPlayer->GetVoiceOutCount(); i++)
|
||||
channel->SetVoiceOutParam(i, mSeqPlayer->GetVoiceOutParam(i));
|
||||
|
||||
@@ -500,8 +505,14 @@ void SeqTrack::SetModSpeed(f32 modSpeed)
|
||||
mParserTrackParam.lfoParam.speed = modSpeed;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// SeqTrack::GetTrackVariable? maybe both?
|
||||
DECOMP_FORCE(NW4RAssertHeaderClampedLValue_String(varNo));
|
||||
#endif
|
||||
|
||||
void SeqTrack::SetTrackVariable(int variable, s16 value) {
|
||||
mTrackVariable[variable] = value;
|
||||
}
|
||||
|
||||
s16 volatile *SeqTrack::GetVariablePtr(int varNo)
|
||||
{
|
||||
|
||||
@@ -1 +1,87 @@
|
||||
#include "nw4r/snd/snd_Sound3DActor.h"
|
||||
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_ExternalSoundPlayer.h"
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
#include "nw4r/snd/snd_SoundArchive.h"
|
||||
#include "nw4r/snd/snd_SoundArchivePlayer.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
Sound3DActor::Sound3DActor(SoundArchivePlayer &rPlayer, Sound3DManager &rManager)
|
||||
: SoundActor(rPlayer),
|
||||
m3DManager(rManager),
|
||||
mSoundArchivePlayer(&rPlayer),
|
||||
mUserParam(0),
|
||||
mPosition(0.0f, 0.0f, 0.0f),
|
||||
mVelocity(0.0f, 0.0f, 0.0f),
|
||||
mSkipVelocityUpdate(true) {}
|
||||
|
||||
|
||||
Sound3DActor::~Sound3DActor() {
|
||||
ForEachSound(ClearUpdateCallback, false);
|
||||
}
|
||||
|
||||
SoundStartable::StartResult
|
||||
Sound3DActor::SetupSound(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *pArg) {
|
||||
Sound3DParam param;
|
||||
param.position = mPosition;
|
||||
param.velocity = mVelocity;
|
||||
param.userParam = mUserParam;
|
||||
|
||||
if (mSoundArchivePlayer != NULL) {
|
||||
const SoundArchive &archive = mSoundArchivePlayer->GetSoundArchive();
|
||||
nw4r::snd::SoundArchive::Sound3DParam arParam;
|
||||
if (archive.detail_ReadSound3DParam(soundId, &arParam)) {
|
||||
param.field_0x18 = arParam.flags;
|
||||
param.decayRatio = arParam.decayRatio;
|
||||
param.field_0x1E = arParam.field_0x06;
|
||||
switch (arParam.decayCurve) {
|
||||
case 1: param.decayCurve = 1; break;
|
||||
case 2: param.decayCurve = 2; break;
|
||||
default: param.decayCurve = 1; break;
|
||||
}
|
||||
}
|
||||
param.field_0x24 = archive.GetSoundUserParam(soundId);
|
||||
}
|
||||
|
||||
detail::BasicSound::AmbientInfo info = {
|
||||
&m3DManager, this, &m3DManager, ¶m, sizeof(Sound3DParam),
|
||||
|
||||
};
|
||||
SoundStartable::StartResult result =
|
||||
SoundActor::detail_SetupSoundWithAmbientInfo(pHandle, soundId, pStartInfo, &info, pArg);
|
||||
if (pHandle->detail_GetAttachedSound() != NULL) {
|
||||
pHandle->detail_GetAttachedSound()->SetPanCurve(PAN_CURVE_SINCOS);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void Sound3DActor::SetPosition(const math::VEC3 &position) {
|
||||
if (!mSkipVelocityUpdate) {
|
||||
VEC3Sub(&mVelocity, &position, &mPosition);
|
||||
}
|
||||
|
||||
mPosition = position;
|
||||
mSkipVelocityUpdate = 0;
|
||||
}
|
||||
|
||||
void Sound3DActor::at_0x0c(void *arg, detail::BasicSound *sound) {
|
||||
Sound3DParam *p = static_cast<Sound3DParam *>(arg);
|
||||
p->position = mPosition;
|
||||
p->velocity = mVelocity;
|
||||
p->userParam = mUserParam;
|
||||
}
|
||||
|
||||
void Sound3DActor::ClearUpdateCallback(SoundHandle& rHandle) {
|
||||
if (rHandle.IsAttachedSound()) {
|
||||
rHandle.detail_GetAttachedSound()->ClearAmbientArgUpdateCallback();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -1 +1,286 @@
|
||||
// #include "nw4r/snd/snd_Sound3DCalculator.h"
|
||||
#include "nw4r/snd/snd_Sound3DCalculator.h"
|
||||
|
||||
#include "nw4r/snd/snd_AxManager.h"
|
||||
#include "nw4r/snd/snd_Sound3DListener.h"
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace nw4r {
|
||||
|
||||
namespace snd {
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* Solves the linear equation:
|
||||
* a*x + b*y + c = d
|
||||
*
|
||||
* Where:
|
||||
* a = dFactor - cFactor
|
||||
* b = dAngle - cAngle
|
||||
* c = cAngle * cFactor
|
||||
* d = dAngle * dFactor
|
||||
*/
|
||||
inline f32 SolveLinerFunction(f32 x, f32 dAngle, f32 cAngle, f32 dFactor,
|
||||
f32 cFactor) { // @typo
|
||||
if (dAngle == cAngle) {
|
||||
return (dFactor + cFactor) / 2;
|
||||
}
|
||||
|
||||
f32 b = dAngle - cAngle;
|
||||
|
||||
return x * (cFactor - dFactor) / b + (dAngle * dFactor - cAngle * cFactor) / b;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void Sound3DCalculator::CalcVolumeAndPriority(
|
||||
const nw4r::snd::Sound3DManager &mgr, const nw4r::snd::Sound3DListener &listener,
|
||||
const nw4r::snd::Sound3DParam ¶m, f32 *pVolume, int *pPriority
|
||||
) {
|
||||
math::VEC3 relativePos;
|
||||
math::VEC3Sub(&relativePos, ¶m.position, &listener.GetPosition());
|
||||
|
||||
f32 distance = VEC3Len(&relativePos);
|
||||
f32 decayRatio = param.decayRatio / 256.0f;
|
||||
f32 maxVolumeDistance = listener.GetMaxVolumeDistance();
|
||||
f32 unitDistance = listener.GetUnitDistance();
|
||||
s32 maxPriorityReduction = mgr.GetMaxPriorityReduction();
|
||||
u8 decayCurve = param.decayCurve;
|
||||
|
||||
f32 volume = 1.0f;
|
||||
if (distance > maxVolumeDistance) {
|
||||
switch (decayCurve) {
|
||||
case Sound3DManager::DECAY_CURVE_LOGARITHMIC: {
|
||||
f32 units = (distance - maxVolumeDistance) / unitDistance;
|
||||
|
||||
volume = std::pow(decayRatio, units);
|
||||
break;
|
||||
}
|
||||
|
||||
case Sound3DManager::DECAY_CURVE_LINEAR: {
|
||||
f32 units = (distance - maxVolumeDistance) / unitDistance * (1.0f - decayRatio);
|
||||
|
||||
volume = 1.0f - units;
|
||||
if (volume < 0.0f) {
|
||||
volume = 0.0f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*pVolume = volume;
|
||||
*pPriority = -static_cast<int>((1.0f - volume) * maxPriorityReduction);
|
||||
}
|
||||
|
||||
inline void CalcPanInline(
|
||||
const nw4r::math::VEC3 &relativePos, f32 speakerAngleStereo, f32 interiorSize, f32 distance, f32 panRange,
|
||||
f32 frontSpeakerAngleDpl2, f32 rearSpeakerAngleDpl2, f32 initPan, f32 *pan, f32 *surroundPan
|
||||
) {
|
||||
switch (detail::AxManager::GetInstance().GetOutputMode()) {
|
||||
case OUTPUT_MODE_SURROUND:
|
||||
case OUTPUT_MODE_DPL2:
|
||||
Sound3DCalculator::CalcPanDpl2(
|
||||
relativePos, interiorSize, distance, panRange, frontSpeakerAngleDpl2, rearSpeakerAngleDpl2, initPan,
|
||||
pan, surroundPan
|
||||
);
|
||||
break;
|
||||
case OUTPUT_MODE_STEREO:
|
||||
Sound3DCalculator::CalcPanStereo(
|
||||
relativePos, interiorSize, distance, panRange, speakerAngleStereo, pan, surroundPan
|
||||
);
|
||||
break;
|
||||
default:
|
||||
*pan = 0.0f;
|
||||
*surroundPan = 0.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Sound3DCalculator::CalcPan(
|
||||
const Sound3DManager &mgr, const Sound3DListener &listener, const Sound3DParam ¶m,
|
||||
const Sound3DCalculator::CalcPanParam &panParam, f32 *pan, f32 *surroundPan
|
||||
) {
|
||||
math::VEC3 relativePos;
|
||||
VEC3Transform(&relativePos, &listener.GetMatrix(), ¶m.position);
|
||||
f32 distance = math::VEC3Len(&relativePos);
|
||||
|
||||
CalcPanInline(
|
||||
relativePos, panParam.speakerAngleStereo, listener.GetInteriorSize(), distance, mgr.GetField0x20(), panParam.frontSpeakerAngleDpl2,
|
||||
panParam.rearSpeakerAngleDpl2, panParam.initPan, pan, surroundPan
|
||||
);
|
||||
}
|
||||
|
||||
void Sound3DCalculator::CalcPitch(
|
||||
const nw4r::snd::Sound3DManager &mgr, const nw4r::snd::Sound3DListener &listener,
|
||||
const nw4r::snd::Sound3DParam ¶m, f32 *pPitch
|
||||
) {
|
||||
f32 f0 = mgr.GetField0x24();
|
||||
if (f0 == 0.0f) {
|
||||
*pPitch = 1.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
math::VEC3 relativePos;
|
||||
math::VEC3Sub(&relativePos, ¶m.position, &listener.GetPosition());
|
||||
f32 distance = VEC3Len(&relativePos);
|
||||
if (distance > 0.0f) {
|
||||
relativePos /= distance;
|
||||
}
|
||||
f32 f3 = param.field_0x1E / 32.0f;
|
||||
f32 f1, f2;
|
||||
if (distance > 0.0f) {
|
||||
f1 = -math::VEC3Dot(&relativePos, ¶m.velocity);
|
||||
f2 = -math::VEC3Dot(&relativePos, &listener.GetVelocity());
|
||||
} else {
|
||||
f1 = -math::VEC3Len(¶m.velocity);
|
||||
f2 = math::VEC3Len(&listener.GetVelocity());
|
||||
}
|
||||
f32 pitch;
|
||||
f1 *= f3;
|
||||
f2 *= f3;
|
||||
if (f2 > f0) {
|
||||
pitch = 0.0f;
|
||||
} else if (f1 >= f0) {
|
||||
pitch = 65535.0f;
|
||||
} else {
|
||||
pitch = (f0 - f2) / (f0 - f1);
|
||||
}
|
||||
*pPitch = pitch;
|
||||
}
|
||||
|
||||
void Sound3DCalculator::CalcBiquadFilterValue(
|
||||
const nw4r::snd::Sound3DManager &mgr, const nw4r::snd::Sound3DListener &listener,
|
||||
const nw4r::snd::Sound3DParam ¶m, f32 *pBiquadValue
|
||||
) {
|
||||
math::VEC3 relativePos;
|
||||
math::VEC3Sub(&relativePos, ¶m.position, &listener.GetPosition());
|
||||
f32 distance = VEC3Len(&relativePos);
|
||||
|
||||
f32 value = 0.0f;
|
||||
f32 maxVolumeDistance = listener.GetMaxVolumeDistance();
|
||||
f32 maxValue = listener.GetUnitBiquadFilterMax();
|
||||
|
||||
if (distance > maxVolumeDistance) {
|
||||
value = ((distance - maxVolumeDistance) / listener.GetUnitDistance()) * listener.GetUnitBiquadFilterValue();
|
||||
if (value > maxValue) {
|
||||
value = maxValue;
|
||||
}
|
||||
}
|
||||
*pBiquadValue = value;
|
||||
}
|
||||
|
||||
void Sound3DCalculator::CalcPanDpl2(
|
||||
const nw4r::math::VEC3 &relativePos, f32 interiorSize, f32 distance, f32 mPanRange, f32 mFrontSpeakerAngleDpl2,
|
||||
f32 mRearSpeakerAngleDpl2, f32 mInitPan, f32 *pan, f32 *surroundPan
|
||||
) {
|
||||
f32 angle, distanceNrm;
|
||||
CalcAngleAndDistance(relativePos, distance, interiorSize, &angle, &distanceNrm);
|
||||
|
||||
f32 panLR, panFR;
|
||||
|
||||
f32 angleRearLeft = -mRearSpeakerAngleDpl2;
|
||||
f32 angleFrontLeft = -mFrontSpeakerAngleDpl2;
|
||||
f32 angleFrontRight = mFrontSpeakerAngleDpl2;
|
||||
f32 angleRearRight = mRearSpeakerAngleDpl2;
|
||||
|
||||
// clang-format off
|
||||
if (angle < angleRearLeft) {
|
||||
panLR = SolveLinerFunction(angle, -NW4R_MATH_PI, angleRearLeft, -1.0f, 0.0f);
|
||||
panFR = 1.0f;
|
||||
} else if (angle < -NW4R_MATH_PI / 2) {
|
||||
panLR = -1.0f;
|
||||
panFR = SolveLinerFunction(angle, angleRearLeft, -NW4R_MATH_PI / 2, 0.0f, 1.0f);
|
||||
} else if (angle < angleFrontLeft) {
|
||||
panLR = -1.0f;
|
||||
panFR = SolveLinerFunction(angle, -NW4R_MATH_PI / 2, angleFrontLeft, -1.0f, 0.0f);
|
||||
} else if (angle < angleFrontRight) {
|
||||
panLR = SolveLinerFunction(angle, angleFrontLeft, angleFrontRight, 1.0f, -1.0f);
|
||||
panFR = -1.0f;
|
||||
} else if (angle < NW4R_MATH_PI / 2) {
|
||||
panLR = 1.0f;
|
||||
panFR = SolveLinerFunction(angle, angleFrontRight, NW4R_MATH_PI / 2, 0.0f, -1.0f);
|
||||
} else if (angle < angleRearRight) {
|
||||
panLR = 1.0f;
|
||||
panFR = SolveLinerFunction(angle, NW4R_MATH_PI / 2, angleRearRight, 1.0f, 0.0f);
|
||||
} else {
|
||||
panLR = SolveLinerFunction(angle, angleRearRight, NW4R_MATH_PI, 0.0f, 1.0f);
|
||||
panFR = 1.0f;
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
f32 cosAvg = (std::cosf(mFrontSpeakerAngleDpl2) + std::cosf(mRearSpeakerAngleDpl2)) / 2.0f;
|
||||
|
||||
f32 rearFactor = cosAvg / (cosAvg + -std::cosf(mRearSpeakerAngleDpl2));
|
||||
|
||||
panLR *= mPanRange;
|
||||
panFR *= mPanRange;
|
||||
|
||||
*pan = panLR * distanceNrm;
|
||||
|
||||
*surroundPan = mInitPan + (1.0f + (panFR * distanceNrm + rearFactor * (1.0f - distanceNrm)));
|
||||
}
|
||||
|
||||
void Sound3DCalculator::CalcPanStereo(
|
||||
const nw4r::math::VEC3 &relativePos, f32 interiorSize, f32 distance, f32 panRange, f32 speakerAngleStereo,
|
||||
f32 *surroundPan, f32 *pan
|
||||
) {
|
||||
f32 angle, distanceNrm;
|
||||
CalcAngleAndDistance(relativePos, distance, interiorSize, &angle, &distanceNrm);
|
||||
|
||||
f32 factor;
|
||||
|
||||
f32 angleRearLeft = -NW4R_MATH_PI + speakerAngleStereo;
|
||||
f32 angleFrontLeft = -speakerAngleStereo;
|
||||
f32 angleFrontRight = speakerAngleStereo;
|
||||
f32 angleRearRight = NW4R_MATH_PI - speakerAngleStereo;
|
||||
|
||||
if (angle < angleRearLeft) {
|
||||
factor = SolveLinerFunction(angle, -NW4R_MATH_PI, angleRearLeft, -1.0f, 0.0f);
|
||||
} else if (angle < angleFrontLeft) {
|
||||
factor = -1.0f;
|
||||
} else if (angle < angleFrontRight) {
|
||||
factor = SolveLinerFunction(angle, angleFrontLeft, angleFrontRight, 1.0f, -1.0f);
|
||||
} else if (angle < angleRearRight) {
|
||||
factor = 1.0f;
|
||||
} else {
|
||||
factor = SolveLinerFunction(angle, angleRearRight, NW4R_MATH_PI, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
factor *= panRange;
|
||||
|
||||
*surroundPan = factor * distanceNrm;
|
||||
*pan = 0.0f;
|
||||
}
|
||||
|
||||
void Sound3DCalculator::CalcAngleAndDistance(
|
||||
const nw4r::math::VEC3 &relativePos, f32 distance, f32 interiorSize, f32 *pAngle, f32 *pDistance
|
||||
) {
|
||||
math::VEC3 adjustedPos;
|
||||
|
||||
if (0.0f == distance) {
|
||||
adjustedPos.z = 0.0f;
|
||||
adjustedPos.y = 0.0f;
|
||||
adjustedPos.x = 0.0f;
|
||||
} else {
|
||||
math::VEC3 relativeXZ(relativePos.x, 0.0f, relativePos.z);
|
||||
|
||||
f32 distanceXZ = VEC3Len(&relativeXZ);
|
||||
if (distanceXZ > interiorSize) {
|
||||
relativeXZ.x *= interiorSize / distanceXZ;
|
||||
relativeXZ.z *= interiorSize / distanceXZ;
|
||||
}
|
||||
|
||||
f32 ratioXZ = VEC3Len(&relativeXZ);
|
||||
adjustedPos.x = relativePos.x * ratioXZ / distance;
|
||||
adjustedPos.y = 0.0f;
|
||||
adjustedPos.z = relativePos.z * ratioXZ / distance;
|
||||
}
|
||||
|
||||
*pAngle = atan2(adjustedPos.x, -adjustedPos.z);
|
||||
*pDistance = VEC3Len(&adjustedPos) / interiorSize;
|
||||
}
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -1 +1,110 @@
|
||||
// #include "nw4r/snd/snd_Sound3DEngine.h"
|
||||
#include "nw4r/snd/snd_Sound3DEngine.h"
|
||||
|
||||
#include "nw4r/snd/snd_Sound3DCalculator.h"
|
||||
#include "nw4r/snd/snd_Sound3DListener.h"
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
Sound3DEngine::Sound3DEngine() {}
|
||||
|
||||
void Sound3DEngine::UpdateAmbientParam(
|
||||
const Sound3DManager *mgr, const Sound3DParam *pParam, u32, u32 flags, SoundAmbientParam *pAmbientParam
|
||||
) {
|
||||
if (flags & 1) {
|
||||
pAmbientParam->volume = 0.0f;
|
||||
}
|
||||
|
||||
if (flags & 8) {
|
||||
pAmbientParam->priority = -mgr->GetMaxPriorityReduction();
|
||||
}
|
||||
|
||||
if (mgr->GetListenerList().GetSize() > 1) {
|
||||
flags &= -0x17;
|
||||
}
|
||||
|
||||
NW4R_RANGE_FOR(it, mgr->GetListenerList()) {
|
||||
const Sound3DListener &listener = *it;
|
||||
if (flags & 9) {
|
||||
f32 volume;
|
||||
int priority;
|
||||
Sound3DCalculator::CalcVolumeAndPriority(*mgr, listener, *pParam, &volume, &priority);
|
||||
if (flags & 1) {
|
||||
pAmbientParam->volume = ut::Max(volume, pAmbientParam->volume);
|
||||
}
|
||||
|
||||
if (flags & 8) {
|
||||
pAmbientParam->priority = ut::Max(priority, pAmbientParam->priority);
|
||||
}
|
||||
}
|
||||
if (flags & 6) {
|
||||
f32 pan, surroundPan;
|
||||
Sound3DCalculator::CalcPan(*mgr, listener, *pParam, mPanParam, &pan, &surroundPan);
|
||||
if (flags & 2) {
|
||||
pAmbientParam->pan = pan;
|
||||
}
|
||||
if (flags & 4) {
|
||||
pAmbientParam->surroundPan = surroundPan;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & 0x10) {
|
||||
f32 pitch;
|
||||
Sound3DCalculator::CalcPitch(*mgr, listener, *pParam, &pitch);
|
||||
pAmbientParam->pitch = pitch;
|
||||
}
|
||||
|
||||
if (flags & 0x20) {
|
||||
f32 biquadFilterValue;
|
||||
Sound3DCalculator::CalcBiquadFilterValue(*mgr, listener, *pParam, &biquadFilterValue);
|
||||
pAmbientParam->biquadFilterType = mgr->GetBiquadFilterType();
|
||||
pAmbientParam->biquadFilterValue = ut::Min(biquadFilterValue, pAmbientParam->biquadFilterValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sound3DEngine::UpdateAmbientParam(
|
||||
const Sound3DManager *mgr, const Sound3DParam *param, u32 unused1, int unused2, SoundAmbientParam *pAmbientParam
|
||||
) {
|
||||
u32 flags = 0x1F;
|
||||
if (param->field_0x18 & 1) {
|
||||
flags &= ~1;
|
||||
}
|
||||
if (param->field_0x18 & 2) {
|
||||
flags &= ~2;
|
||||
}
|
||||
if (param->field_0x18 & 4) {
|
||||
flags &= ~4;
|
||||
}
|
||||
if (param->field_0x18 & 8) {
|
||||
flags &= ~8;
|
||||
}
|
||||
if (!param->field_0x1E) {
|
||||
flags &= ~0x10;
|
||||
}
|
||||
if (param->field_0x18 & 0x10) {
|
||||
flags |= 0x20;
|
||||
}
|
||||
UpdateAmbientParam(mgr, param, unused1, flags, pAmbientParam);
|
||||
}
|
||||
|
||||
s32 Sound3DEngine::GetAmbientPriority(const Sound3DManager *mgr, const Sound3DParam *param, u32 arg) {
|
||||
u32 flags = 0x1000008;
|
||||
if (param->field_0x18 & 8) {
|
||||
flags &= ~8;
|
||||
}
|
||||
|
||||
SoundAmbientParam ambientParam;
|
||||
|
||||
UpdateAmbientParam(mgr, param, arg, flags, &ambientParam);
|
||||
return ambientParam.priority;
|
||||
}
|
||||
|
||||
s32 Sound3DEngine::GetRequiredVoiceOutCount(const Sound3DManager *, const Sound3DParam *, u32) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -1 +1,56 @@
|
||||
#include "nw4r/snd/snd_Sound3DListener.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
Sound3DListener::Sound3DListener()
|
||||
: mPosition(0.0f, 0.0f, 0.0f),
|
||||
mVelocity(0.0f, 0.0f, 0.0f),
|
||||
mInteriorSize(1.0f),
|
||||
mMaxVolumeDistance(1.0f),
|
||||
mUnitDistance(1.0f),
|
||||
field_0x54(0),
|
||||
mSkipVelocityUpdate(1),
|
||||
mUnitBiquadFilterValue(0.5f),
|
||||
mUnitBiquadFilterMax(1.0f) {
|
||||
math::MTX34Zero(&mMtx);
|
||||
}
|
||||
|
||||
void Sound3DListener::SetMatrix(const math::MTX34 &mtx) {
|
||||
math::VEC3 prevPosition = mPosition;
|
||||
|
||||
mPosition.x = -(mtx._00 * mtx._03 + mtx._10 * mtx._13 + mtx._20 * mtx._23);
|
||||
mPosition.y = -(mtx._01 * mtx._03 + mtx._11 * mtx._13 + mtx._21 * mtx._23);
|
||||
mPosition.z = -(mtx._02 * mtx._03 + mtx._12 * mtx._13 + mtx._22 * mtx._23);
|
||||
|
||||
if (mSkipVelocityUpdate) {
|
||||
mMtx = mtx;
|
||||
mSkipVelocityUpdate = 0;
|
||||
} else {
|
||||
mMtx = mtx;
|
||||
VEC3Sub(&mVelocity, &mPosition, &prevPosition);
|
||||
}
|
||||
}
|
||||
|
||||
void Sound3DListener::SetInteriorSize(f32 size) {
|
||||
mInteriorSize = size;
|
||||
}
|
||||
|
||||
void Sound3DListener::SetMaxVolumeDistance(f32 distance) {
|
||||
mMaxVolumeDistance = distance;
|
||||
}
|
||||
|
||||
void Sound3DListener::SetUnitDistance(f32 distance) {
|
||||
mUnitDistance = distance;
|
||||
}
|
||||
|
||||
void Sound3DListener::SetUnitBiquadFilterValue(f32 value) {
|
||||
mUnitBiquadFilterValue = value;
|
||||
}
|
||||
|
||||
void Sound3DListener::SetUnitBiquadFilterMax(f32 value) {
|
||||
mUnitBiquadFilterMax = value;
|
||||
}
|
||||
|
||||
} // namespace snd
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
|
||||
#include "nw4r/snd/snd_AxManager.h"
|
||||
#include "nw4r/snd/snd_Sound3DEngine.h"
|
||||
#include "nw4r/snd/snd_Sound3DListener.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
|
||||
@@ -11,39 +13,14 @@ namespace nw4r {
|
||||
namespace snd {
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* Solves the linear equation:
|
||||
* a*x + b*y + c = d
|
||||
*
|
||||
* Where:
|
||||
* a = dFactor - cFactor
|
||||
* b = dAngle - cAngle
|
||||
* c = cAngle * cFactor
|
||||
* d = dAngle * dFactor
|
||||
*/
|
||||
inline f32 SolveLinerFunction(f32 x, f32 dAngle, f32 cAngle, f32 dFactor,
|
||||
f32 cFactor) { // @typo
|
||||
if (dAngle == cAngle) {
|
||||
return (dFactor + cFactor) / 2;
|
||||
}
|
||||
|
||||
f32 b = dAngle - cAngle;
|
||||
|
||||
return x * (cFactor - dFactor) / b +
|
||||
(dAngle * dFactor - cAngle * cFactor) / b;
|
||||
}
|
||||
static Sound3DEngine sEngine;
|
||||
|
||||
} // namespace
|
||||
|
||||
Sound3DManager::Sound3DManager()
|
||||
: mMaxPriorityReduction(32),
|
||||
mSpeakerAngleStereo(NW4R_MATH_PI / 4),
|
||||
mFrontSpeakerAngleDpl2(NW4R_MATH_PI / 6),
|
||||
mRearSpeakerAngleDpl2(2 * NW4R_MATH_PI / 3),
|
||||
mInitPan(0.0f),
|
||||
mPanRange(0.9f) {}
|
||||
: mpEngine(&sEngine), mMaxPriorityReduction(32), field_0x20(0.9f), field_0x24(0.0f), mBiquadFilterType(0) {}
|
||||
|
||||
u32 Sound3DManager::GetRequiredMemSize(const SoundArchive* pArchive) {
|
||||
u32 Sound3DManager::GetRequiredMemSize(const SoundArchive *pArchive) {
|
||||
u32 numParam = 0;
|
||||
|
||||
SoundArchive::SoundArchivePlayerInfo playerInfo;
|
||||
@@ -53,241 +30,72 @@ u32 Sound3DManager::GetRequiredMemSize(const SoundArchive* pArchive) {
|
||||
numParam += playerInfo.waveSoundCount;
|
||||
}
|
||||
|
||||
return numParam * sizeof(Sound3DActorParam);
|
||||
return numParam * sizeof(Sound3DParam);
|
||||
}
|
||||
|
||||
bool Sound3DManager::Setup(const SoundArchive* pArchive, void* pBuffer,
|
||||
u32 size) {
|
||||
bool Sound3DManager::Setup(const SoundArchive *pArchive, void *pBuffer, u32 size) {
|
||||
#pragma unused(pArchive)
|
||||
|
||||
mParamPool.Create(pBuffer, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Sound3DManager::detail_Update(SoundParam* pParam, u32 id,
|
||||
detail::BasicSound* pSound, const void* pArg,
|
||||
u32 flags) {
|
||||
SoundHandle handle;
|
||||
if (pSound != NULL) {
|
||||
handle.detail_AttachSoundAsTempHandle(pSound);
|
||||
}
|
||||
|
||||
Update(pParam, id, pSound != NULL ? &handle : NULL, pArg, flags);
|
||||
void Sound3DManager::SetEngine(Sound3DEngine *engine) {
|
||||
mpEngine = engine;
|
||||
}
|
||||
|
||||
void Sound3DManager::Update(SoundParam* pParam, u32 id, SoundHandle* pHandle,
|
||||
const void* pArg, u32 flags) {
|
||||
#pragma unused(id)
|
||||
#pragma unused(pHandle)
|
||||
|
||||
f32 angle;
|
||||
f32 panLR, panFR;
|
||||
f32 pan, surroundPan;
|
||||
|
||||
const Sound3DActorParam* pActorParam =
|
||||
static_cast<const Sound3DActorParam*>(pArg);
|
||||
|
||||
Sound3DListener* pListener = GetListener();
|
||||
if (pListener == NULL) {
|
||||
pParam->volume = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
math::VEC3 relativePos;
|
||||
VEC3Transform(&relativePos, &pListener->GetMatrix(),
|
||||
&pActorParam->position);
|
||||
|
||||
f32 distance = VEC3Len(&relativePos);
|
||||
f32 volume = 1.0f;
|
||||
|
||||
if ((flags & (PARAM_UPDATE_VOLUME | PARAM_UPDATE_PRIORITY)) &&
|
||||
distance > pListener->GetMaxVolumeDistance()) {
|
||||
|
||||
switch (pActorParam->soundParam.decayCurve) {
|
||||
case DECAY_CURVE_LOGARITHMIC: {
|
||||
f32 units = (distance - pListener->GetMaxVolumeDistance()) /
|
||||
pListener->GetUnitDistance();
|
||||
|
||||
volume =
|
||||
std::pow(pActorParam->soundParam.decayRatio / 256.0f, units);
|
||||
break;
|
||||
}
|
||||
|
||||
case DECAY_CURVE_LINEAR: {
|
||||
f32 units = (distance - pListener->GetMaxVolumeDistance()) /
|
||||
pListener->GetUnitDistance() *
|
||||
pActorParam->soundParam.decayRatio;
|
||||
|
||||
units = units / 256.0f;
|
||||
volume = ut::Max(0.0f, 1.0f - units);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & PARAM_UPDATE_VOLUME) &&
|
||||
!(pActorParam->soundParam.flags & PARAM_UPDATE_VOLUME)) {
|
||||
|
||||
pParam->volume = volume;
|
||||
}
|
||||
|
||||
if (flags & (PARAM_UPDATE_PAN | PARAM_UPDATE_SURROUND_PAN)) {
|
||||
math::VEC3 adjustedPos;
|
||||
|
||||
if (0.0f == distance) {
|
||||
adjustedPos.z = 0.0f;
|
||||
adjustedPos.y = 0.0f;
|
||||
adjustedPos.x = 0.0f;
|
||||
} else {
|
||||
math::VEC3 relativeXZ(relativePos.x, 0.0f, relativePos.z);
|
||||
|
||||
f32 distanceXZ = VEC3Len(&relativeXZ);
|
||||
if (distanceXZ > pListener->GetInteriorSize()) {
|
||||
relativeXZ.x *= pListener->GetInteriorSize() / distanceXZ;
|
||||
relativeXZ.z *= pListener->GetInteriorSize() / distanceXZ;
|
||||
}
|
||||
|
||||
f32 ratioXZ = VEC3Len(&relativeXZ);
|
||||
adjustedPos.x = relativePos.x * ratioXZ / distance;
|
||||
adjustedPos.y = 0.0f;
|
||||
adjustedPos.z = relativePos.z * ratioXZ / distance;
|
||||
}
|
||||
|
||||
angle = atan2(adjustedPos.x, -adjustedPos.z);
|
||||
f32 distanceNrm = VEC3Len(&adjustedPos) / pListener->GetInteriorSize();
|
||||
|
||||
switch (detail::AxManager::GetInstance().GetOutputMode()) {
|
||||
case OUTPUT_MODE_SURROUND:
|
||||
case OUTPUT_MODE_DPL2: {
|
||||
static f32 angleRearLeft = -mRearSpeakerAngleDpl2;
|
||||
static f32 angleFrontLeft = -mFrontSpeakerAngleDpl2;
|
||||
static f32 angleFrontRight = mFrontSpeakerAngleDpl2;
|
||||
static f32 angleRearRight = mRearSpeakerAngleDpl2;
|
||||
|
||||
// clang-format off
|
||||
if (angle < angleRearLeft) {
|
||||
panLR = SolveLinerFunction(angle, -NW4R_MATH_PI, angleRearLeft, -1.0f, 0.0f);
|
||||
panFR = 1.0f;
|
||||
} else if (angle < -NW4R_MATH_PI / 2) {
|
||||
panLR = -1.0f;
|
||||
panFR = SolveLinerFunction(angle, angleRearLeft, -NW4R_MATH_PI / 2, 0.0f, 1.0f);
|
||||
} else if (angle < angleFrontLeft) {
|
||||
panLR = -1.0f;
|
||||
panFR = SolveLinerFunction(angle, -NW4R_MATH_PI / 2, angleFrontLeft, -1.0f, 0.0f);
|
||||
} else if (angle < angleFrontRight) {
|
||||
panLR = SolveLinerFunction(angle, angleFrontLeft, angleFrontRight, 1.0f, -1.0f);
|
||||
panFR = -1.0f;
|
||||
} else if (angle < NW4R_MATH_PI / 2) {
|
||||
panLR = 1.0f;
|
||||
panFR = SolveLinerFunction(angle, angleFrontRight, NW4R_MATH_PI / 2, 0.0f, -1.0f);
|
||||
} else if (angle < angleRearRight) {
|
||||
panLR = 1.0f;
|
||||
panFR = SolveLinerFunction(angle, NW4R_MATH_PI / 2, angleRearRight, 1.0f, 0.0f);
|
||||
} else {
|
||||
panLR = SolveLinerFunction(angle, angleRearRight, NW4R_MATH_PI, 0.0f, 1.0f);
|
||||
panFR = 1.0f;
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
f32 cosAvg = (std::cosf(mFrontSpeakerAngleDpl2) +
|
||||
std::cosf(mRearSpeakerAngleDpl2)) /
|
||||
2.0f;
|
||||
|
||||
f32 rearFactor =
|
||||
cosAvg / (cosAvg + -std::cosf(mRearSpeakerAngleDpl2));
|
||||
|
||||
panLR *= mPanRange;
|
||||
panFR *= mPanRange;
|
||||
|
||||
pan = panLR * distanceNrm;
|
||||
|
||||
surroundPan =
|
||||
mInitPan + (1.0f + (panFR * distanceNrm +
|
||||
rearFactor * (1.0f - distanceNrm)));
|
||||
break;
|
||||
}
|
||||
|
||||
case OUTPUT_MODE_STEREO: {
|
||||
static f32 angleRearLeft = -NW4R_MATH_PI + mSpeakerAngleStereo;
|
||||
static f32 angleFrontLeft = -mSpeakerAngleStereo;
|
||||
static f32 angleFrontRight = mSpeakerAngleStereo;
|
||||
static f32 angleRearRight = NW4R_MATH_PI - mSpeakerAngleStereo;
|
||||
|
||||
// clang-format off
|
||||
if (angle < angleRearLeft) {
|
||||
panLR = SolveLinerFunction(angle, -NW4R_MATH_PI, angleRearLeft, -1.0f, 0.0f);
|
||||
panFR = 1.0f;
|
||||
} else if (angle < angleFrontLeft) {
|
||||
panLR = -1.0f;
|
||||
panFR = SolveLinerFunction(angle, angleRearLeft, angleFrontLeft, -1.0f, 1.0f);
|
||||
} else if (angle < angleFrontRight) {
|
||||
panLR = SolveLinerFunction(angle, angleFrontLeft, angleFrontRight, 1.0f, -1.0f);
|
||||
panFR = -1.0f;
|
||||
} else if (angle < angleRearRight) {
|
||||
panLR = 1.0f;
|
||||
panFR = SolveLinerFunction(angle, angleFrontRight, angleRearRight, 1.0f, -1.0f);
|
||||
} else {
|
||||
panLR = SolveLinerFunction(angle, angleRearRight, NW4R_MATH_PI, 0.0f, 1.0f);
|
||||
panFR = 1.0f;
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
panLR *= mPanRange;
|
||||
panFR *= mPanRange;
|
||||
|
||||
surroundPan = 1.0f + panFR * distanceNrm;
|
||||
pan = panLR * distanceNrm;
|
||||
break;
|
||||
}
|
||||
|
||||
case OUTPUT_MODE_MONO:
|
||||
default: {
|
||||
pan = 0.0f;
|
||||
surroundPan = 0.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & PARAM_UPDATE_PAN) &&
|
||||
!(pActorParam->soundParam.flags & PARAM_UPDATE_PAN)) {
|
||||
|
||||
pParam->pan = pan;
|
||||
}
|
||||
|
||||
if ((flags & PARAM_UPDATE_SURROUND_PAN) &&
|
||||
!(pActorParam->soundParam.flags & PARAM_UPDATE_SURROUND_PAN)) {
|
||||
|
||||
pParam->surroundPan = surroundPan;
|
||||
}
|
||||
|
||||
if ((flags & PARAM_UPDATE_PRIORITY) &&
|
||||
!(pActorParam->soundParam.flags & PARAM_UPDATE_PRIORITY)) {
|
||||
|
||||
pParam->priority =
|
||||
-static_cast<int>((1.0f - volume) * GetMaxPriorityReduction());
|
||||
void Sound3DManager::detail_UpdateAmbientParam(
|
||||
const void *param, u32 unused1, int unused2, SoundAmbientParam *ambientParam
|
||||
) {
|
||||
const Sound3DParam *p = static_cast<const Sound3DParam *>(param);
|
||||
if (mpEngine != NULL) {
|
||||
mpEngine->UpdateAmbientParam(this, p, unused1, unused2, ambientParam);
|
||||
}
|
||||
}
|
||||
|
||||
void* Sound3DManager::detail_AllocAmbientArg(u32 size) {
|
||||
if (size != sizeof(Sound3DActorParam)) {
|
||||
int Sound3DManager::detail_GetAmbientPriority(const void *param, u32 arg) {
|
||||
int result = 0;
|
||||
if (mpEngine != NULL) {
|
||||
const Sound3DParam *p = static_cast<const Sound3DParam *>(param);
|
||||
result = mpEngine->GetAmbientPriority(this, p, arg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int Sound3DManager::detail_GetRequiredVoiceOutCount(const void *param, u32 arg) {
|
||||
int result = 1;
|
||||
if (mpEngine != NULL) {
|
||||
const Sound3DParam *p = static_cast<const Sound3DParam *>(param);
|
||||
result = mpEngine->GetRequiredVoiceOutCount(this, p, arg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void *Sound3DManager::detail_AllocAmbientArg(u32 size) {
|
||||
if (size != sizeof(Sound3DParam)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return mParamPool.Alloc();
|
||||
}
|
||||
|
||||
void Sound3DManager::detail_FreeAmbientArg(void* pArg,
|
||||
const detail::BasicSound* pSound) {
|
||||
void Sound3DManager::detail_FreeAmbientArg(void *pArg, const detail::BasicSound *pSound) {
|
||||
#pragma unused(pSound)
|
||||
|
||||
mParamPool.Free(static_cast<Sound3DActorParam*>(pArg));
|
||||
mParamPool.Free(static_cast<Sound3DParam *>(pArg));
|
||||
}
|
||||
|
||||
Sound3DManager::Sound3DActorParam::Sound3DActorParam() : userParam(-1) {
|
||||
soundParam.flags = 0;
|
||||
soundParam.decayCurve = DECAY_CURVE_LOGARITHMIC;
|
||||
soundParam.decayRatio = 128;
|
||||
void Sound3DManager::SetBiquadFilterType(int type) {
|
||||
mBiquadFilterType = type;
|
||||
}
|
||||
|
||||
Sound3DParam::Sound3DParam() {
|
||||
field_0x18 = 0;
|
||||
decayCurve = Sound3DManager::DECAY_CURVE_LOGARITHMIC;
|
||||
decayRatio = 128;
|
||||
field_0x1E = 0;
|
||||
userParam = 0;
|
||||
field_0x24 = 0;
|
||||
}
|
||||
|
||||
} // namespace snd
|
||||
|
||||
@@ -8,9 +8,65 @@
|
||||
|
||||
#include "nw4r/snd/snd_SoundArchivePlayer.h"
|
||||
|
||||
nw4r::snd::SoundActor::SoundActor() :
|
||||
mSoundArchivePlayer (*new SoundArchivePlayer)
|
||||
namespace nw4r { namespace snd {
|
||||
|
||||
SoundActor::SoundActor(SoundArchivePlayer &player) :
|
||||
mSoundArchivePlayer (player)
|
||||
{
|
||||
// DECOMP_FORCE_CLASS_METHOD
|
||||
(void)mSoundArchivePlayer.detail_ConvertLabelStringToSoundId(nullptr);
|
||||
|
||||
for (int i = 0; i < ACTOR_PLAYER_COUNT; i++)
|
||||
{
|
||||
mActorPlayer[i].SetPlayableSoundCount(i == 0 ? INT_MAX : 1);
|
||||
}
|
||||
}
|
||||
|
||||
SoundActor::~SoundActor()
|
||||
{
|
||||
for (int i = 0; i < ACTOR_PLAYER_COUNT; i++)
|
||||
{
|
||||
mActorPlayer[i].DetachSoundActorAll(this);
|
||||
}
|
||||
}
|
||||
|
||||
void SoundActor::StopAllSound(int fadeFrames)
|
||||
{
|
||||
for (int i = 0; i < ACTOR_PLAYER_COUNT; i++)
|
||||
{
|
||||
mActorPlayer[i].StopAllSound(fadeFrames);
|
||||
}
|
||||
}
|
||||
|
||||
void SoundActor::PauseAllSound(bool flag, int fadeFrames)
|
||||
{
|
||||
for (int i = 0; i < ACTOR_PLAYER_COUNT; i++)
|
||||
{
|
||||
mActorPlayer[i].PauseAllSound(flag, fadeFrames);
|
||||
}
|
||||
}
|
||||
|
||||
int SoundActor::GetPlayingSoundCount(int playerId) const
|
||||
{
|
||||
return mActorPlayer[playerId].GetPlayingSoundCount();
|
||||
}
|
||||
|
||||
SoundStartable::StartResult SoundActor::SetupSound(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void* arg)
|
||||
{
|
||||
return mSoundArchivePlayer.detail_SetupSoundImpl(pHandle, soundId, nullptr, this, *(bool*)arg, pStartInfo);
|
||||
}
|
||||
|
||||
SoundStartable::StartResult SoundActor::detail_SetupSoundWithAmbientInfo(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, detail::BasicSound::AmbientInfo *pAmbientInfo, void* arg)
|
||||
{
|
||||
return mSoundArchivePlayer.detail_SetupSoundImpl(pHandle, soundId, pAmbientInfo, this, *(bool*)arg, pStartInfo);
|
||||
}
|
||||
|
||||
SoundStartable::StartResult SoundActor::detail_SetupSound(SoundHandle *pHandle, u32 soundId, bool holdFlag, const StartInfo *pStartInfo)
|
||||
{
|
||||
return SetupSound(pHandle, soundId, pStartInfo, &holdFlag);
|
||||
}
|
||||
|
||||
u32 SoundActor::detail_ConvertLabelStringToSoundId(const char* label)
|
||||
{
|
||||
return mSoundArchivePlayer.detail_ConvertLabelStringToSoundId(label);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user