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