mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
44f1e36c29
commit
415d28f180
|
@ -17,7 +17,7 @@ implementation
|
||||||
uses
|
uses
|
||||||
sysutils,
|
sysutils,
|
||||||
atomic,
|
atomic,
|
||||||
kern_rwlock,
|
kern_mtx,
|
||||||
kern_proc,
|
kern_proc,
|
||||||
ps4_libSceMbus;
|
ps4_libSceMbus;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ var
|
||||||
|
|
||||||
g_port_table:array[0..24] of TAudioOutHandle;
|
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;
|
function alloc_port_id(a,b:Byte):Integer;
|
||||||
begin
|
begin
|
||||||
|
@ -159,6 +159,8 @@ begin
|
||||||
|
|
||||||
g_audioout_interface:=TAudioOutNull;
|
g_audioout_interface:=TAudioOutNull;
|
||||||
|
|
||||||
|
mtx_init(g_port_lock,'AudioOut');
|
||||||
|
|
||||||
Result:=0;
|
Result:=0;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
|
@ -329,6 +331,8 @@ begin
|
||||||
handle.SetMixLevelPadSpk(11626);
|
handle.SetMixLevelPadSpk(11626);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Assert(port_id<Length(g_port_table));
|
||||||
|
|
||||||
//save handle
|
//save handle
|
||||||
g_port_table[port_id]:=handle;
|
g_port_table[port_id]:=handle;
|
||||||
|
|
||||||
|
@ -429,9 +433,9 @@ begin
|
||||||
|
|
||||||
DWORD(_type):=DWORD(_type) and $7fffffff;
|
DWORD(_type):=DWORD(_type) and $7fffffff;
|
||||||
|
|
||||||
rw_wlock(g_port_lock);
|
mtx_lock(g_port_lock);
|
||||||
Result:=_out_open(userId,_type,len,param);
|
Result:=_out_open(userId,_type,len,param);
|
||||||
rw_wunlock(g_port_lock);
|
mtx_unlock(g_port_lock);
|
||||||
|
|
||||||
if (Result<0) then Exit;
|
if (Result<0) then Exit;
|
||||||
|
|
||||||
|
@ -587,9 +591,9 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wlock(g_port_lock);
|
mtx_lock(g_port_lock);
|
||||||
Result:=_out_close(port_id);
|
Result:=_out_close(port_id);
|
||||||
rw_wunlock(g_port_lock);
|
mtx_unlock(g_port_lock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ps4_sceAudioOutGetPortState(handle:Integer;state:pSceAudioOutPortState):Integer;
|
function ps4_sceAudioOutGetPortState(handle:Integer;state:pSceAudioOutPortState):Integer;
|
||||||
|
@ -629,7 +633,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wlock(g_port_lock);
|
mtx_lock(g_port_lock);
|
||||||
|
|
||||||
if (g_port_table[port_id]<>nil) then
|
if (g_port_table[port_id]<>nil) then
|
||||||
begin
|
begin
|
||||||
|
@ -677,7 +681,7 @@ begin
|
||||||
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wunlock(g_port_lock);
|
mtx_unlock(g_port_lock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ps4_sceAudioOutSetVolume(handle,flag:Integer;p_vol:PInteger):Integer;
|
function ps4_sceAudioOutSetVolume(handle,flag:Integer;p_vol:PInteger):Integer;
|
||||||
|
@ -728,7 +732,7 @@ begin
|
||||||
|
|
||||||
{$ifdef silent}if (volume>800) then volume:=800;{$endif}
|
{$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];
|
ahandle:=g_port_table[port_id];
|
||||||
|
|
||||||
|
@ -749,7 +753,7 @@ begin
|
||||||
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wunlock(g_port_lock);
|
mtx_unlock(g_port_lock);
|
||||||
|
|
||||||
Result:=0;
|
Result:=0;
|
||||||
end;
|
end;
|
||||||
|
@ -778,7 +782,7 @@ begin
|
||||||
Exit(SCE_AUDIO_OUT_ERROR_INVALID_MIXLEVEL);
|
Exit(SCE_AUDIO_OUT_ERROR_INVALID_MIXLEVEL);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wlock(g_port_lock);
|
mtx_lock(g_port_lock);
|
||||||
|
|
||||||
if (g_port_table[port_id]<>nil) then
|
if (g_port_table[port_id]<>nil) then
|
||||||
begin
|
begin
|
||||||
|
@ -788,7 +792,7 @@ begin
|
||||||
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wunlock(g_port_lock);
|
mtx_unlock(g_port_lock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ps4_sceAudioOutGetLastOutputTime(handle:Integer;outputTime:PQWORD):Integer;
|
function ps4_sceAudioOutGetLastOutputTime(handle:Integer;outputTime:PQWORD):Integer;
|
||||||
|
@ -828,7 +832,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wlock(g_port_lock);
|
mtx_lock(g_port_lock);
|
||||||
|
|
||||||
if (g_port_table[port_id]<>nil) then
|
if (g_port_table[port_id]<>nil) then
|
||||||
begin
|
begin
|
||||||
|
@ -838,7 +842,7 @@ begin
|
||||||
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wunlock(g_port_lock);
|
mtx_unlock(g_port_lock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure _VecMulI16M(Src,Dst:Pointer;count:Integer;volume:Integer);// inline;
|
procedure _VecMulI16M(Src,Dst:Pointer;count:Integer;volume:Integer);// inline;
|
||||||
|
@ -1077,7 +1081,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wlock(g_port_lock);
|
mtx_lock(g_port_lock);
|
||||||
|
|
||||||
if (g_port_table[port_id]<>nil) then
|
if (g_port_table[port_id]<>nil) then
|
||||||
begin
|
begin
|
||||||
|
@ -1088,7 +1092,7 @@ begin
|
||||||
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
Result:=SCE_AUDIO_OUT_ERROR_NOT_OPENED;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
rw_wunlock(g_port_lock);
|
mtx_unlock(g_port_lock);
|
||||||
|
|
||||||
{
|
{
|
||||||
if (HAudioOuts=nil) then Exit(SCE_AUDIO_OUT_ERROR_NOT_INIT);
|
if (HAudioOuts=nil) then Exit(SCE_AUDIO_OUT_ERROR_NOT_INIT);
|
||||||
|
@ -1260,7 +1264,7 @@ begin
|
||||||
|
|
||||||
Result:=0;
|
Result:=0;
|
||||||
|
|
||||||
rw_wlock(g_port_lock);
|
mtx_lock(g_port_lock);
|
||||||
|
|
||||||
//test opened
|
//test opened
|
||||||
For i:=0 to num-1 do
|
For i:=0 to num-1 do
|
||||||
|
@ -1303,7 +1307,7 @@ begin
|
||||||
|
|
||||||
_unlock:
|
_unlock:
|
||||||
|
|
||||||
rw_wunlock(g_port_lock);
|
mtx_unlock(g_port_lock);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue