winecoreaudio: Use create_stream's channel count in AudioClient's Initialize.

This commit is contained in:
Davide Beatrici 2023-06-21 12:41:13 +02:00 committed by Alexandre Julliard
parent b115d90b9a
commit 546a62087d
2 changed files with 9 additions and 8 deletions

View file

@ -776,8 +776,10 @@ end:
if(stream->unit) AudioComponentInstanceDispose(stream->unit);
free(stream->fmt);
free(stream);
} else
} else {
*params->channel_count = params->fmt->nChannels;
*params->stream = (stream_handle)(UINT_PTR)stream;
}
return STATUS_SUCCESS;
}

View file

@ -545,7 +545,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
ACImpl *This = impl_from_IAudioClient3(iface);
struct create_stream_params params;
stream_handle stream;
UINT32 i;
UINT32 i, channel_count;
WCHAR *name;
TRACE("(%p)->(%x, %lx, %s, %s, %p, %s)\n", This, mode, flags,
@ -593,7 +593,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
params.duration = duration;
params.period = period;
params.fmt = fmt;
params.channel_count = NULL;
params.channel_count = &channel_count;
params.stream = &stream;
UNIX_CALL(create_stream, &params);
@ -605,18 +605,16 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
return params.result;
}
This->channel_count = fmt->nChannels;
This->vols = HeapAlloc(GetProcessHeap(), 0, This->channel_count * sizeof(float));
This->vols = HeapAlloc(GetProcessHeap(), 0, channel_count * sizeof(float));
if(!This->vols){
params.result = E_OUTOFMEMORY;
goto end;
}
for(i = 0; i < This->channel_count; ++i)
for(i = 0; i < channel_count; ++i)
This->vols[i] = 1.f;
params.result = get_audio_session(sessionguid, This->parent, fmt->nChannels, &This->session);
params.result = get_audio_session(sessionguid, This->parent, channel_count, &This->session);
if(FAILED(params.result)) goto end;
list_add_tail(&This->session->clients, &This->entry);
@ -628,6 +626,7 @@ end:
This->vols = NULL;
}else{
This->stream = stream;
This->channel_count = channel_count;
set_stream_volumes(This);
}