Commit 29f73d66 authored by Yuxuan Shui's avatar Yuxuan Shui Committed by Alexandre Julliard

dmime: Add a stub chordtrack for MIDI segments.

parent 05347b97
......@@ -40,6 +40,7 @@ struct midi_event
struct midi_parser
{
IDirectMusicTrack *chordtrack;
IDirectMusicTrack *bandtrack;
MUSIC_TIME time;
IStream *stream;
......@@ -221,13 +222,16 @@ static HRESULT midi_parser_parse(struct midi_parser *parser, IDirectMusicSegment
music_length = (ULONGLONG)music_length * DMUS_PPQ / parser->division + 1;
if (SUCCEEDED(hr)) hr = IDirectMusicSegment8_SetLength(segment, music_length);
if (SUCCEEDED(hr)) hr = IDirectMusicSegment8_InsertTrack(segment, parser->bandtrack, 0xffff);
if (SUCCEEDED(hr)) hr = IDirectMusicSegment8_InsertTrack(segment, parser->chordtrack, 0xffff);
return hr;
}
static void midi_parser_destroy(struct midi_parser *parser)
{
IStream_Release(parser->stream);
IDirectMusicTrack_Release(parser->bandtrack);
if (parser->bandtrack) IDirectMusicTrack_Release(parser->bandtrack);
if (parser->chordtrack) IDirectMusicTrack_Release(parser->chordtrack);
free(parser);
}
......@@ -267,18 +271,16 @@ static HRESULT midi_parser_new(IStream *stream, struct midi_parser **out_parser)
parser = calloc(1, sizeof(struct midi_parser));
if (!parser) return E_OUTOFMEMORY;
IStream_AddRef(stream);
parser->stream = stream;
parser->division = division;
hr = CoCreateInstance(&CLSID_DirectMusicBandTrack, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectMusicTrack, (void **)&parser->bandtrack);
if (FAILED(hr))
{
free(parser);
return hr;
}
*out_parser = parser;
IStream_AddRef(stream);
if (SUCCEEDED(hr))
hr = CoCreateInstance(&CLSID_DirectMusicChordTrack, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectMusicTrack, (void **)&parser->chordtrack);
if (FAILED(hr)) midi_parser_destroy(parser);
else *out_parser = parser;
return hr;
}
......
......@@ -1681,7 +1681,7 @@ static void test_midi(void)
ok(hr == S_OK, "got %#lx\n", hr);
expect_track(segment, BandTrack, -1, 0);
todo_wine expect_track(segment, ChordTrack, -1, 1);
expect_track(segment, ChordTrack, -1, 1);
todo_wine expect_track(segment, TempoTrack, -1, 2);
todo_wine expect_track(segment, TimeSigTrack, -1, 3);
todo_wine expect_track(segment, SeqTrack, -1, 4);
......@@ -1723,7 +1723,7 @@ static void test_midi(void)
IStream_Release(stream);
/* TempoTrack and TimeSigTrack seems to be optional. */
expect_track(segment, BandTrack, -1, 0);
todo_wine expect_track(segment, ChordTrack, -1, 1);
expect_track(segment, ChordTrack, -1, 1);
todo_wine expect_track(segment, SeqTrack, -1, 2);
IDirectMusicSegment_Release(segment);
......@@ -1759,7 +1759,7 @@ static void test_midi(void)
IPersistStream_Release(persist);
IStream_Release(stream);
expect_track(segment, BandTrack, -1, 0);
todo_wine expect_track(segment, ChordTrack, -1, 1);
expect_track(segment, ChordTrack, -1, 1);
todo_wine expect_track(segment, TempoTrack, -1, 2);
todo_wine expect_track(segment, SeqTrack, -1, 3);
IDirectMusicSegment_Release(segment);
......@@ -1795,7 +1795,7 @@ static void test_midi(void)
IPersistStream_Release(persist);
IStream_Release(stream);
expect_track(segment, BandTrack, -1, 0);
todo_wine expect_track(segment, ChordTrack, -1, 1);
expect_track(segment, ChordTrack, -1, 1);
/* there is no tempo track. */
todo_wine expect_track(segment, SeqTrack, -1, 2);
IDirectMusicSegment_Release(segment);
......@@ -1832,7 +1832,7 @@ static void test_midi(void)
IPersistStream_Release(persist);
IStream_Release(stream);
expect_track(segment, BandTrack, -1, 0);
todo_wine expect_track(segment, ChordTrack, -1, 1);
expect_track(segment, ChordTrack, -1, 1);
todo_wine expect_track(segment, SeqTrack, -1, 2);
hr = test_tool_create(message_types, ARRAY_SIZE(message_types), &tool);
......
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