Commit 02081ed6 authored by Shaun Ren's avatar Shaun Ren Committed by Alexandre Julliard

sapi: Implement ISpVoice::Set/GetVolume.

parent 5793c57c
......@@ -101,6 +101,7 @@ static void test_spvoice(void)
ISpObjectToken *token;
WCHAR *token_id = NULL, *default_token_id = NULL;
LONG rate;
USHORT volume;
HRESULT hr;
if (waveOutGetNumDevs() == 0) {
......@@ -179,6 +180,30 @@ static void test_spvoice(void)
ok(hr == S_OK, "got %#lx.\n", hr);
ok(rate == 1000, "rate = %ld\n", rate);
volume = 0xbeef;
hr = ISpVoice_GetVolume(voice, &volume);
ok(hr == S_OK, "got %#lx.\n", hr);
ok(volume == 100, "volume = %d\n", volume);
hr = ISpVoice_SetVolume(voice, 0);
ok(hr == S_OK, "got %#lx.\n", hr);
volume = 0xbeef;
hr = ISpVoice_GetVolume(voice, &volume);
ok(hr == S_OK, "got %#lx.\n", hr);
ok(volume == 0, "volume = %d\n", volume);
hr = ISpVoice_SetVolume(voice, 100);
ok(hr == S_OK, "got %#lx.\n", hr);
volume = 0xbeef;
hr = ISpVoice_GetVolume(voice, &volume);
ok(hr == S_OK, "got %#lx.\n", hr);
ok(volume == 100, "volume = %d\n", volume);
hr = ISpVoice_SetVolume(voice, 101);
ok(hr == E_INVALIDARG, "got %#lx.\n", hr);
ISpVoice_Release(voice);
ISpMMSysAudio_Release(audio_out);
}
......
......@@ -43,6 +43,7 @@ struct speech_voice
ISpStreamFormat *output;
ISpTTSEngine *engine;
USHORT volume;
LONG rate;
CRITICAL_SECTION cs;
};
......@@ -779,16 +780,31 @@ static HRESULT WINAPI spvoice_GetRate(ISpVoice *iface, LONG *rate)
static HRESULT WINAPI spvoice_SetVolume(ISpVoice *iface, USHORT volume)
{
FIXME("(%p, %d): stub.\n", iface, volume);
struct speech_voice *This = impl_from_ISpVoice(iface);
return E_NOTIMPL;
TRACE("(%p, %d).\n", iface, volume);
if (volume > 100)
return E_INVALIDARG;
EnterCriticalSection(&This->cs);
This->volume = volume;
LeaveCriticalSection(&This->cs);
return S_OK;
}
static HRESULT WINAPI spvoice_GetVolume(ISpVoice *iface, USHORT *volume)
{
FIXME("(%p, %p): stub.\n", iface, volume);
struct speech_voice *This = impl_from_ISpVoice(iface);
return E_NOTIMPL;
TRACE("(%p, %p).\n", iface, volume);
EnterCriticalSection(&This->cs);
*volume = This->volume;
LeaveCriticalSection(&This->cs);
return S_OK;
}
static HRESULT WINAPI spvoice_WaitUntilDone(ISpVoice *iface, ULONG timeout)
......@@ -943,6 +959,7 @@ HRESULT speech_voice_create(IUnknown *outer, REFIID iid, void **obj)
This->output = NULL;
This->engine = NULL;
This->volume = 100;
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