mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 18:07:21 +00:00
sapi: Implement ISpVoice::Set/GetVolume.
This commit is contained in:
parent
5793c57cbc
commit
02081ed6ff
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue