Skip to content

Commit 23f5463

Browse files
committed
sapi/tts: Support allow_format_changes in ISpVoice::SetOutput.
(cherry picked from commit da13c9b) CW-Bug-Id: #22894
1 parent c4a8404 commit 23f5463

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

dlls/sapi/tts.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct speech_voice
4949

5050
ISpStreamFormat *output;
5151
IMFTransform *resampler;
52+
BOOL allow_format_changes;
5253
ISpObjectToken *engine_token;
5354
ISpTTSEngine *engine;
5455
LONG cur_stream_num;
@@ -683,9 +684,6 @@ static HRESULT WINAPI spvoice_SetOutput(ISpVoice *iface, IUnknown *unk, BOOL all
683684

684685
TRACE("(%p, %p, %d).\n", iface, unk, allow_format_changes);
685686

686-
if (!allow_format_changes)
687-
FIXME("ignoring allow_format_changes = FALSE.\n");
688-
689687
if (FAILED(hr = async_start_queue(&This->queue)))
690688
return hr;
691689

@@ -719,6 +717,8 @@ static HRESULT WINAPI spvoice_SetOutput(ISpVoice *iface, IUnknown *unk, BOOL all
719717
ISpStreamFormat_Release(This->output);
720718
This->output = stream;
721719

720+
This->allow_format_changes = allow_format_changes;
721+
722722
LeaveCriticalSection(&This->cs);
723723

724724
return S_OK;
@@ -925,7 +925,8 @@ static HRESULT set_output_format(struct speech_voice *voice, GUID *fmtid, WAVEFO
925925
if (memcmp(output_wfx, *engine_wfx, sizeof(WAVEFORMATEX)) ||
926926
memcmp(output_wfx + 1, *engine_wfx + 1, output_wfx->cbSize))
927927
{
928-
if (SUCCEEDED(ISpStreamFormat_QueryInterface(voice->output, &IID_ISpAudio, (void **)&audio)))
928+
if (voice->allow_format_changes &&
929+
SUCCEEDED(ISpStreamFormat_QueryInterface(voice->output, &IID_ISpAudio, (void **)&audio)))
929930
{
930931
hr = ISpAudio_SetFormat(audio, &SPDFID_WaveFormatEx, *engine_wfx);
931932
if (hr == SPERR_UNSUPPORTED_FORMAT)
@@ -1706,6 +1707,7 @@ HRESULT speech_voice_create(IUnknown *outer, REFIID iid, void **obj)
17061707

17071708
This->output = NULL;
17081709
This->resampler = NULL;
1710+
This->allow_format_changes = TRUE;
17091711
This->engine_token = NULL;
17101712
This->engine = NULL;
17111713
This->cur_stream_num = 0;

0 commit comments

Comments
 (0)