Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f46e9b8f
Commit
f46e9b8f
authored
May 03, 2023
by
Davide Beatrici
Committed by
Alexandre Julliard
May 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecoreaudio: Implement per-channel volume control.
parent
bd89ab30
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
26 deletions
+27
-26
coreaudio.c
dlls/winecoreaudio.drv/coreaudio.c
+20
-17
mmdevdrv.c
dlls/winecoreaudio.drv/mmdevdrv.c
+7
-9
No files found.
dlls/winecoreaudio.drv/coreaudio.c
View file @
f46e9b8f
...
...
@@ -1665,28 +1665,31 @@ static NTSTATUS unix_set_volumes(void *args)
{
struct
set_volumes_params
*
params
=
args
;
struct
coreaudio_stream
*
stream
=
handle_get_stream
(
params
->
stream
);
Float32
level
=
1
.
0
,
tmp
;
Float32
level
=
params
->
master_volume
;
OSStatus
sc
;
UINT32
i
;
AudioObjectPropertyAddress
prop_addr
=
{
kAudioDevicePropertyVolumeScalar
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElementMaster
};
if
(
params
->
channel
>=
stream
->
fmt
->
nChannels
||
params
->
channel
<
-
1
){
ERR
(
"Incorrect channel %d
\n
"
,
params
->
channel
);
return
STATUS_SUCCESS
;
}
sc
=
AudioObjectSetPropertyData
(
stream
->
dev_id
,
&
prop_addr
,
0
,
NULL
,
sizeof
(
float
),
&
level
);
if
(
sc
==
noErr
)
level
=
1
.
0
f
;
else
WARN
(
"Couldn't set master volume, applying it directly to the channels: %x
\n
"
,
(
int
)
sc
);
if
(
params
->
channel
==
-
1
){
for
(
i
=
0
;
i
<
stream
->
fmt
->
nChannels
;
++
i
){
tmp
=
params
->
master_volume
*
params
->
volumes
[
i
]
*
params
->
session_volumes
[
i
];
level
=
tmp
<
level
?
tmp
:
level
;
}
}
else
level
=
params
->
master_volume
*
params
->
volumes
[
params
->
channel
]
*
params
->
session_volumes
[
params
->
channel
];
for
(
i
=
1
;
i
<=
stream
->
fmt
->
nChannels
;
++
i
)
{
const
float
vol
=
level
*
params
->
session_volumes
[
i
-
1
]
*
params
->
volumes
[
i
-
1
];
prop_addr
.
mElement
=
i
;
sc
=
AudioUnitSetParameter
(
stream
->
unit
,
kHALOutputParam_Volume
,
kAudioUnitScope_Global
,
0
,
level
,
0
);
if
(
sc
!=
noErr
)
WARN
(
"Couldn't set volume: %x
\n
"
,
(
int
)
sc
);
sc
=
AudioObjectSetPropertyData
(
stream
->
dev_id
,
&
prop_addr
,
0
,
NULL
,
sizeof
(
float
),
&
vol
);
if
(
sc
!=
noErr
)
{
WARN
(
"Couldn't set channel #%u volume: %x
\n
"
,
i
,
(
int
)
sc
);
}
}
return
STATUS_SUCCESS
;
}
...
...
dlls/winecoreaudio.drv/mmdevdrv.c
View file @
f46e9b8f
...
...
@@ -224,7 +224,7 @@ static void get_device_guid(EDataFlow flow, const char *dev, GUID *guid)
RegCloseKey
(
key
);
}
static
void
set_stream_volumes
(
ACImpl
*
This
,
int
channel
)
static
void
set_stream_volumes
(
ACImpl
*
This
)
{
struct
set_volumes_params
params
;
...
...
@@ -232,7 +232,7 @@ static void set_stream_volumes(ACImpl *This, int channel)
params
.
master_volume
=
This
->
session
->
mute
?
0
.
0
f
:
This
->
session
->
master_vol
;
params
.
volumes
=
This
->
vols
;
params
.
session_volumes
=
This
->
session
->
channel_vols
;
params
.
channel
=
channel
;
params
.
channel
=
0
;
UNIX_CALL
(
set_volumes
,
&
params
);
}
...
...
@@ -689,7 +689,7 @@ end:
This
->
vols
=
NULL
;
}
else
{
This
->
stream
=
stream
;
set_stream_volumes
(
This
,
-
1
);
set_stream_volumes
(
This
);
}
sessions_unlock
();
...
...
@@ -1521,8 +1521,7 @@ static HRESULT WINAPI AudioStreamVolume_SetChannelVolume(
This
->
vols
[
index
]
=
level
;
WARN
(
"CoreAudio doesn't support per-channel volume control
\n
"
);
set_stream_volumes
(
This
,
index
);
set_stream_volumes
(
This
);
sessions_unlock
();
...
...
@@ -1566,7 +1565,7 @@ static HRESULT WINAPI AudioStreamVolume_SetAllVolumes(
for
(
i
=
0
;
i
<
count
;
++
i
)
This
->
vols
[
i
]
=
levels
[
i
];
set_stream_volumes
(
This
,
-
1
);
set_stream_volumes
(
This
);
sessions_unlock
();
...
...
@@ -1682,9 +1681,8 @@ static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume(
session
->
channel_vols
[
index
]
=
level
;
WARN
(
"CoreAudio doesn't support per-channel volume control
\n
"
);
LIST_FOR_EACH_ENTRY
(
client
,
&
session
->
clients
,
ACImpl
,
entry
)
set_stream_volumes
(
client
,
index
);
set_stream_volumes
(
client
);
sessions_unlock
();
...
...
@@ -1737,7 +1735,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes(
session
->
channel_vols
[
i
]
=
levels
[
i
];
LIST_FOR_EACH_ENTRY
(
client
,
&
session
->
clients
,
ACImpl
,
entry
)
set_stream_volumes
(
client
,
-
1
);
set_stream_volumes
(
client
);
sessions_unlock
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment