diff --git a/src/audio/ps4_libsceaudioout.pas b/src/audio/ps4_libsceaudioout.pas index f5330aad..7cb136cd 100644 --- a/src/audio/ps4_libsceaudioout.pas +++ b/src/audio/ps4_libsceaudioout.pas @@ -17,7 +17,7 @@ implementation uses sysutils, atomic, - kern_rwlock, + kern_mtx, kern_proc, ps4_libSceMbus; @@ -32,7 +32,7 @@ var g_port_table:array[0..24] of TAudioOutHandle; - g_port_lock:Pointer=nil; + g_port_lock:mtx; function alloc_port_id(a,b:Byte):Integer; begin @@ -159,6 +159,8 @@ begin g_audioout_interface:=TAudioOutNull; + mtx_init(g_port_lock,'AudioOut'); + Result:=0; end else begin @@ -329,6 +331,8 @@ begin handle.SetMixLevelPadSpk(11626); end; + Assert(port_idnil) then begin @@ -677,7 +681,7 @@ begin Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED; end; - rw_wunlock(g_port_lock); + mtx_unlock(g_port_lock); end; function ps4_sceAudioOutSetVolume(handle,flag:Integer;p_vol:PInteger):Integer; @@ -728,7 +732,7 @@ begin {$ifdef silent}if (volume>800) then volume:=800;{$endif} - rw_wlock(g_port_lock); + mtx_lock(g_port_lock); ahandle:=g_port_table[port_id]; @@ -749,7 +753,7 @@ begin Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED; end; - rw_wunlock(g_port_lock); + mtx_unlock(g_port_lock); Result:=0; end; @@ -778,7 +782,7 @@ begin Exit(SCE_AUDIO_OUT_ERROR_INVALID_MIXLEVEL); end; - rw_wlock(g_port_lock); + mtx_lock(g_port_lock); if (g_port_table[port_id]<>nil) then begin @@ -788,7 +792,7 @@ begin Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED; end; - rw_wunlock(g_port_lock); + mtx_unlock(g_port_lock); end; function ps4_sceAudioOutGetLastOutputTime(handle:Integer;outputTime:PQWORD):Integer; @@ -828,7 +832,7 @@ begin end; end; - rw_wlock(g_port_lock); + mtx_lock(g_port_lock); if (g_port_table[port_id]<>nil) then begin @@ -838,7 +842,7 @@ begin Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED; end; - rw_wunlock(g_port_lock); + mtx_unlock(g_port_lock); end; procedure _VecMulI16M(Src,Dst:Pointer;count:Integer;volume:Integer);// inline; @@ -1077,7 +1081,7 @@ begin end; end; - rw_wlock(g_port_lock); + mtx_lock(g_port_lock); if (g_port_table[port_id]<>nil) then begin @@ -1088,7 +1092,7 @@ begin Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED; end; - rw_wunlock(g_port_lock); + mtx_unlock(g_port_lock); { if (HAudioOuts=nil) then Exit(SCE_AUDIO_OUT_ERROR_NOT_INIT); @@ -1260,7 +1264,7 @@ begin Result:=0; - rw_wlock(g_port_lock); + mtx_lock(g_port_lock); //test opened For i:=0 to num-1 do @@ -1303,7 +1307,7 @@ begin _unlock: - rw_wunlock(g_port_lock); + mtx_unlock(g_port_lock); end;