Commit 5793c57c authored by Shaun Ren's avatar Shaun Ren Committed by Alexandre Julliard

sapi: Implement ISpVoice::Set/GetRate.

parent 17635423
......@@ -100,6 +100,7 @@ static void test_spvoice(void)
ISpObjectTokenCategory *token_cat;
ISpObjectToken *token;
WCHAR *token_id = NULL, *default_token_id = NULL;
LONG rate;
HRESULT hr;
if (waveOutGetNumDevs() == 0) {
......@@ -149,6 +150,35 @@ static void test_spvoice(void)
ISpObjectTokenCategory_Release(token_cat);
}
rate = 0xdeadbeef;
hr = ISpVoice_GetRate(voice, &rate);
ok(hr == S_OK, "got %#lx.\n", hr);
ok(rate == 0, "rate = %ld\n", rate);
hr = ISpVoice_SetRate(voice, 1);
ok(hr == S_OK, "got %#lx.\n", hr);
rate = 0xdeadbeef;
hr = ISpVoice_GetRate(voice, &rate);
ok(hr == S_OK, "got %#lx.\n", hr);
ok(rate == 1, "rate = %ld\n", rate);
hr = ISpVoice_SetRate(voice, -1000);
ok(hr == S_OK, "got %#lx.\n", hr);
rate = 0xdeadbeef;
hr = ISpVoice_GetRate(voice, &rate);
ok(hr == S_OK, "got %#lx.\n", hr);
ok(rate == -1000, "rate = %ld\n", rate);
hr = ISpVoice_SetRate(voice, 1000);
ok(hr == S_OK, "got %#lx.\n", hr);
rate = 0xdeadbeef;
hr = ISpVoice_GetRate(voice, &rate);
ok(hr == S_OK, "got %#lx.\n", hr);
ok(rate == 1000, "rate = %ld\n", rate);
ISpVoice_Release(voice);
ISpMMSysAudio_Release(audio_out);
}
......
......@@ -43,6 +43,7 @@ struct speech_voice
ISpStreamFormat *output;
ISpTTSEngine *engine;
LONG rate;
CRITICAL_SECTION cs;
};
......@@ -750,18 +751,30 @@ static HRESULT WINAPI spvoice_GetAlertBoundary(ISpVoice *iface, SPEVENTENUM *bou
return E_NOTIMPL;
}
static HRESULT WINAPI spvoice_SetRate(ISpVoice *iface, LONG adjust)
static HRESULT WINAPI spvoice_SetRate(ISpVoice *iface, LONG rate)
{
FIXME("(%p, %ld): stub.\n", iface, adjust);
struct speech_voice *This = impl_from_ISpVoice(iface);
return E_NOTIMPL;
TRACE("(%p, %ld).\n", iface, rate);
EnterCriticalSection(&This->cs);
This->rate = rate;
LeaveCriticalSection(&This->cs);
return S_OK;
}
static HRESULT WINAPI spvoice_GetRate(ISpVoice *iface, LONG *adjust)
static HRESULT WINAPI spvoice_GetRate(ISpVoice *iface, LONG *rate)
{
FIXME("(%p, %p): stub.\n", iface, adjust);
struct speech_voice *This = impl_from_ISpVoice(iface);
return E_NOTIMPL;
TRACE("(%p, %p).\n", iface, rate);
EnterCriticalSection(&This->cs);
*rate = This->rate;
LeaveCriticalSection(&This->cs);
return S_OK;
}
static HRESULT WINAPI spvoice_SetVolume(ISpVoice *iface, USHORT volume)
......@@ -930,6 +943,7 @@ HRESULT speech_voice_create(IUnknown *outer, REFIID iid, void **obj)
This->output = NULL;
This->engine = NULL;
This->rate = 0;
InitializeCriticalSection(&This->cs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment