Commit 086e114f authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dmusic: Implement SoundFont2 instrument parsing.

parent 215a55d6
......@@ -580,6 +580,17 @@ static HRESULT parse_sfbk_chunk(struct collection *This, IStream *stream, struct
}
}
for (i = 0; SUCCEEDED(hr) && i < soundfont.preset_count; i++)
{
struct instrument_entry *entry;
if (!(entry = malloc(sizeof(*entry)))) return E_OUTOFMEMORY;
hr = instrument_create_from_soundfont(&soundfont, i, This, &entry->desc, &entry->instrument);
if (SUCCEEDED(hr)) hr = IDirectMusicInstrument_GetPatch(entry->instrument, &entry->patch);
if (SUCCEEDED(hr)) list_add_tail(&This->instruments, &entry->entry);
else free(entry);
}
if (SUCCEEDED(hr))
{
UINT size = offsetof(struct pool, cues[soundfont.sample_count]);
......
......@@ -92,6 +92,8 @@ extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj,
extern HRESULT download_create(DWORD size, IDirectMusicDownload **ret_iface);
struct soundfont;
extern HRESULT instrument_create_from_soundfont(struct soundfont *soundfont, UINT index,
struct collection *collection, DMUS_OBJECTDESC *desc, IDirectMusicInstrument **ret_iface);
extern HRESULT instrument_create_from_chunk(IStream *stream, struct chunk_entry *parent,
struct collection *collection, DMUS_OBJECTDESC *desc, IDirectMusicInstrument **ret_iface);
extern HRESULT instrument_download_to_port(IDirectMusicInstrument *iface, IDirectMusicPortDownload *port,
......
......@@ -1619,7 +1619,7 @@ static void test_default_gm_collection(void)
}
if (hr == S_FALSE) i--;
ok(hr == S_FALSE, "got %#lx\n", hr);
todo_wine ok(i > 0, "got %lu\n", i);
ok(i > 0, "got %lu\n", i);
todo_wine ok(i == ARRAY_SIZE(expected), "got %lu\n", i);
qsort(results, i, sizeof(*results), result_cmp);
......@@ -1628,6 +1628,7 @@ static void test_default_gm_collection(void)
{
winetest_push_context("%lu", i);
trace("got %#lx %s\n", results[i].patch, debugstr_w(results[i].name));
todo_wine_if(expected[i].patch >= 128)
ok(results[i].patch == expected[i].patch, "got %#lx\n", results[i].patch);
/* system soundfont names are not very predictable, let's not check them */
winetest_pop_context();
......
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