dmsynth: Implement IDirectMusicSynthSink_Activate semi-stub.
This commit is contained in:
parent
1b3cc0ce49
commit
10da838a78
2 changed files with 32 additions and 9 deletions
|
@ -35,7 +35,9 @@ struct synth_sink
|
|||
IReferenceClock *master_clock;
|
||||
IDirectMusicSynth *synth; /* No reference hold! */
|
||||
IDirectSound *dsound;
|
||||
|
||||
BOOL active;
|
||||
REFERENCE_TIME activate_time;
|
||||
};
|
||||
|
||||
static inline struct synth_sink *impl_from_IDirectMusicSynthSink(IDirectMusicSynthSink *iface)
|
||||
|
@ -43,6 +45,27 @@ static inline struct synth_sink *impl_from_IDirectMusicSynthSink(IDirectMusicSyn
|
|||
return CONTAINING_RECORD(iface, struct synth_sink, IDirectMusicSynthSink_iface);
|
||||
}
|
||||
|
||||
static HRESULT synth_sink_activate(struct synth_sink *This)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (!This->synth) return DMUS_E_SYNTHNOTCONFIGURED;
|
||||
if (!This->dsound) return DMUS_E_DSOUND_NOT_SET;
|
||||
if (!This->master_clock) return DMUS_E_NO_MASTER_CLOCK;
|
||||
if (This->active) return DMUS_E_SYNTHACTIVE;
|
||||
|
||||
if (FAILED(hr = IReferenceClock_GetTime(This->master_clock, &This->activate_time))) return hr;
|
||||
|
||||
This->active = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT synth_sink_deactivate(struct synth_sink *This)
|
||||
{
|
||||
This->active = FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI synth_sink_QueryInterface(IDirectMusicSynthSink *iface,
|
||||
REFIID riid, void **ret_iface)
|
||||
{
|
||||
|
@ -151,9 +174,9 @@ static HRESULT WINAPI synth_sink_Activate(IDirectMusicSynthSink *iface,
|
|||
{
|
||||
struct synth_sink *This = impl_from_IDirectMusicSynthSink(iface);
|
||||
|
||||
FIXME("(%p)->(%d): stub\n", This, enable);
|
||||
FIXME("(%p)->(%d): semi-stub\n", This, enable);
|
||||
|
||||
return S_OK;
|
||||
return enable ? synth_sink_activate(This) : synth_sink_deactivate(This);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI synth_sink_SampleToRefTime(IDirectMusicSynthSink *iface,
|
||||
|
|
|
@ -1192,7 +1192,7 @@ static void test_IDirectMusicSynthSink(void)
|
|||
|
||||
/* sink is not configured */
|
||||
hr = IDirectMusicSynthSink_Activate(sink, TRUE);
|
||||
todo_wine ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr);
|
||||
ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSynthSink_Activate(sink, FALSE);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
|
@ -1247,11 +1247,11 @@ static void test_IDirectMusicSynthSink(void)
|
|||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(size == 352800, "got %lu\n", size);
|
||||
hr = IDirectMusicSynthSink_Activate(sink, TRUE);
|
||||
todo_wine ok(hr == DMUS_E_DSOUND_NOT_SET, "got %#lx\n", hr);
|
||||
ok(hr == DMUS_E_DSOUND_NOT_SET, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSynthSink_SetDirectSound(sink, dsound, NULL);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSynthSink_Activate(sink, TRUE);
|
||||
todo_wine ok(hr == DMUS_E_NO_MASTER_CLOCK, "got %#lx\n", hr);
|
||||
ok(hr == DMUS_E_NO_MASTER_CLOCK, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSynthSink_SetMasterClock(sink, clock);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
hr = IReferenceClock_GetTime(latency_clock, &time);
|
||||
|
@ -1259,7 +1259,7 @@ static void test_IDirectMusicSynthSink(void)
|
|||
hr = IDirectMusicSynthSink_Activate(sink, TRUE);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSynthSink_Activate(sink, TRUE);
|
||||
todo_wine ok(hr == DMUS_E_SYNTHACTIVE, "got %#lx\n", hr);
|
||||
ok(hr == DMUS_E_SYNTHACTIVE, "got %#lx\n", hr);
|
||||
ref = get_refcount(synth);
|
||||
ok(ref == 1, "got %#lx\n", ref);
|
||||
|
||||
|
@ -1297,13 +1297,13 @@ static void test_IDirectMusicSynthSink(void)
|
|||
ref = get_refcount(synth);
|
||||
ok(ref == 1, "got %#lx\n", ref);
|
||||
hr = IDirectMusicSynthSink_Activate(sink, TRUE);
|
||||
todo_wine ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr);
|
||||
ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr);
|
||||
|
||||
/* changing dsound while active fails */
|
||||
hr = IDirectMusicSynthSink_SetDirectSound(sink, dsound, NULL);
|
||||
todo_wine ok(hr == DMUS_E_SYNTHACTIVE, "got %#lx\n", hr);
|
||||
ok(hr == DMUS_E_SYNTHACTIVE, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSynthSink_SetDirectSound(sink, NULL, NULL);
|
||||
todo_wine ok(hr == DMUS_E_SYNTHACTIVE, "got %#lx\n", hr);
|
||||
ok(hr == DMUS_E_SYNTHACTIVE, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSynthSink_Activate(sink, FALSE);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSynthSink_SetDirectSound(sink, NULL, NULL);
|
||||
|
|
Loading…
Add table
Reference in a new issue