2012-04-06 13:39:02 +02:00
|
|
|
/*
|
|
|
|
* Unit tests for dmsynth functions
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Christian Costa
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
#include "uuids.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "initguid.h"
|
|
|
|
#include "dmusics.h"
|
|
|
|
#include "dmusici.h"
|
2012-05-03 23:05:42 +02:00
|
|
|
#include "dmksctrl.h"
|
2012-04-06 13:39:02 +02:00
|
|
|
|
|
|
|
static void test_dmsynth(void)
|
|
|
|
{
|
|
|
|
IDirectMusicSynth *dmsynth = NULL;
|
|
|
|
IDirectMusicSynthSink *dmsynth_sink = NULL;
|
2012-05-03 23:05:33 +02:00
|
|
|
IReferenceClock* clock_synth = NULL;
|
2012-04-30 11:43:26 +02:00
|
|
|
IReferenceClock* clock_sink = NULL;
|
2012-05-03 23:05:42 +02:00
|
|
|
IKsControl* control_synth = NULL;
|
|
|
|
IKsControl* control_sink = NULL;
|
2012-04-06 13:39:02 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth, (LPVOID*)&dmsynth);
|
|
|
|
if (hr != S_OK)
|
|
|
|
{
|
|
|
|
skip("Cannot create DirectMusicSync object (%x)\n", hr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSynthSink, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynthSink, (LPVOID*)&dmsynth_sink);
|
2012-04-06 13:39:10 +02:00
|
|
|
ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr);
|
2012-04-06 13:39:02 +02:00
|
|
|
|
2012-05-03 23:05:42 +02:00
|
|
|
hr = IDirectMusicSynth_QueryInterface(dmsynth, &IID_IKsControl, (LPVOID*)&control_synth);
|
2012-05-03 23:05:51 +02:00
|
|
|
ok(hr == S_OK, "IDirectMusicSynth_QueryInterface returned: %x\n", hr);
|
2012-05-03 23:05:42 +02:00
|
|
|
hr = IDirectMusicSynthSink_QueryInterface(dmsynth_sink, &IID_IKsControl, (LPVOID*)&control_sink);
|
2012-05-08 22:27:44 +02:00
|
|
|
ok(hr == S_OK, "IDirectMusicSynthSink_QueryInterface returned: %x\n", hr);
|
2012-05-03 23:05:42 +02:00
|
|
|
|
2012-04-30 11:43:26 +02:00
|
|
|
/* Synth has no default clock */
|
2012-05-03 23:05:33 +02:00
|
|
|
hr = IDirectMusicSynth_GetLatencyClock(dmsynth, &clock_synth);
|
|
|
|
ok(hr == DMUS_E_NOSYNTHSINK, "IDirectMusicSynth_GetLatencyClock returned: %x\n", hr);
|
2012-04-30 11:43:26 +02:00
|
|
|
|
|
|
|
/* SynthSink has a default clock */
|
|
|
|
hr = IDirectMusicSynthSink_GetLatencyClock(dmsynth_sink, &clock_sink);
|
|
|
|
ok(hr == S_OK, "IDirectMusicSynth_GetLatencyClock returned: %x\n", hr);
|
2012-05-03 23:05:33 +02:00
|
|
|
ok(clock_sink != NULL, "No clock returned\n");
|
2012-04-30 11:43:26 +02:00
|
|
|
|
|
|
|
/* This will set clock to Synth */
|
|
|
|
hr = IDirectMusicSynth_SetSynthSink(dmsynth, dmsynth_sink);
|
|
|
|
ok(hr == S_OK, "IDirectMusicSynth_SetSynthSink returned: %x\n", hr);
|
|
|
|
|
|
|
|
/* Check clocks are the same */
|
2012-05-03 23:05:33 +02:00
|
|
|
hr = IDirectMusicSynth_GetLatencyClock(dmsynth, &clock_synth);
|
2012-04-30 11:43:26 +02:00
|
|
|
ok(hr == S_OK, "IDirectMusicSynth_GetLatencyClock returned: %x\n", hr);
|
2012-05-03 23:05:33 +02:00
|
|
|
ok(clock_synth != NULL, "No clock returned\n");
|
|
|
|
ok(clock_synth == clock_sink, "Synth and SynthSink clocks are not the same\n");
|
2012-04-30 11:43:26 +02:00
|
|
|
|
2012-05-03 23:05:42 +02:00
|
|
|
if (control_synth)
|
|
|
|
IDirectMusicSynth_Release(control_synth);
|
|
|
|
if (control_sink)
|
|
|
|
IDirectMusicSynth_Release(control_sink);
|
2012-05-03 23:05:33 +02:00
|
|
|
if (clock_synth)
|
|
|
|
IReferenceClock_Release(clock_synth);
|
|
|
|
if (clock_sink)
|
|
|
|
IReferenceClock_Release(clock_sink);
|
2012-04-06 13:39:02 +02:00
|
|
|
if (dmsynth_sink)
|
|
|
|
IDirectMusicSynthSink_Release(dmsynth_sink);
|
|
|
|
IDirectMusicSynth_Release(dmsynth);
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(dmsynth)
|
|
|
|
{
|
|
|
|
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
|
|
|
|
|
|
|
test_dmsynth();
|
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
}
|