Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
aebcb1a9
Commit
aebcb1a9
authored
Feb 27, 2024
by
Yuxuan Shui
Committed by
Alexandre Julliard
Feb 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmime: Better MIDI parsing interface.
MIDI tracks don't map one-to-one to segment tracks, so it doesn't make sense to use a "get_next_track()" interface.
parent
09c6f48b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
26 deletions
+20
-26
dmime_private.h
dlls/dmime/dmime_private.h
+2
-5
midi.c
dlls/dmime/midi.c
+17
-6
segment.c
dlls/dmime/segment.c
+1
-15
No files found.
dlls/dmime/dmime_private.h
View file @
aebcb1a9
...
@@ -70,11 +70,8 @@ extern HRESULT create_dmtempotrack(REFIID riid, void **ret_iface);
...
@@ -70,11 +70,8 @@ extern HRESULT create_dmtempotrack(REFIID riid, void **ret_iface);
extern
HRESULT
create_dmtimesigtrack
(
REFIID
riid
,
void
**
ret_iface
);
extern
HRESULT
create_dmtimesigtrack
(
REFIID
riid
,
void
**
ret_iface
);
extern
HRESULT
create_dmwavetrack
(
REFIID
riid
,
void
**
ret_iface
);
extern
HRESULT
create_dmwavetrack
(
REFIID
riid
,
void
**
ret_iface
);
/* Create a new MIDI file parser. Note the stream might still be modified even
/* Parse a MIDI file. Note the stream might still be modified even when this function fails. */
* when this function fails. */
extern
HRESULT
parse_midi
(
IStream
*
stream
,
IDirectMusicSegment8
*
segment
);
extern
HRESULT
midi_parser_new
(
IStream
*
stream
,
struct
midi_parser
**
out_parser
);
extern
HRESULT
midi_parser_next_track
(
struct
midi_parser
*
parser
,
IDirectMusicTrack
**
out_track
,
MUSIC_TIME
*
out_length
);
extern
void
midi_parser_destroy
(
struct
midi_parser
*
parser
);
extern
void
set_audiopath_perf_pointer
(
IDirectMusicAudioPath
*
,
IDirectMusicPerformance8
*
);
extern
void
set_audiopath_perf_pointer
(
IDirectMusicAudioPath
*
,
IDirectMusicPerformance8
*
);
extern
void
set_audiopath_dsound_buffer
(
IDirectMusicAudioPath
*
,
IDirectSoundBuffer
*
);
extern
void
set_audiopath_dsound_buffer
(
IDirectMusicAudioPath
*
,
IDirectSoundBuffer
*
);
...
...
dlls/dmime/midi.c
View file @
aebcb1a9
...
@@ -125,10 +125,10 @@ static HRESULT read_midi_event(IStream *stream, BYTE *last_status, ULONG *bytes_
...
@@ -125,10 +125,10 @@ static HRESULT read_midi_event(IStream *stream, BYTE *last_status, ULONG *bytes_
return
S_OK
;
return
S_OK
;
}
}
HRESULT
midi_parser_next_track
(
struct
midi_parser
*
parser
,
IDirectMusicTrack
**
out_track
,
MUSIC_TIME
*
out_length
)
static
HRESULT
midi_parser_parse
(
struct
midi_parser
*
parser
,
IDirectMusicSegment8
*
segment
)
{
{
WORD
i
=
0
;
WORD
i
=
0
;
TRACE
(
"(%p, %p): stub
\n
"
,
parser
,
out_length
);
TRACE
(
"(%p, %p): stub
\n
"
,
parser
,
segment
);
for
(
i
=
0
;;
i
++
)
for
(
i
=
0
;;
i
++
)
{
{
HRESULT
hr
;
HRESULT
hr
;
...
@@ -159,7 +159,13 @@ HRESULT midi_parser_next_track(struct midi_parser *parser, IDirectMusicTrack **o
...
@@ -159,7 +159,13 @@ HRESULT midi_parser_next_track(struct midi_parser *parser, IDirectMusicTrack **o
return
S_FALSE
;
return
S_FALSE
;
}
}
HRESULT
midi_parser_new
(
IStream
*
stream
,
struct
midi_parser
**
out_parser
)
static
void
midi_parser_destroy
(
struct
midi_parser
*
parser
)
{
IStream_Release
(
parser
->
stream
);
free
(
parser
);
}
static
HRESULT
midi_parser_new
(
IStream
*
stream
,
struct
midi_parser
**
out_parser
)
{
{
LARGE_INTEGER
offset
;
LARGE_INTEGER
offset
;
DWORD
length
;
DWORD
length
;
...
@@ -202,8 +208,13 @@ HRESULT midi_parser_new(IStream *stream, struct midi_parser **out_parser)
...
@@ -202,8 +208,13 @@ HRESULT midi_parser_new(IStream *stream, struct midi_parser **out_parser)
return
hr
;
return
hr
;
}
}
void
midi_parser_destroy
(
struct
midi_parser
*
parser
)
HRESULT
parse_midi
(
IStream
*
stream
,
IDirectMusicSegment8
*
segment
)
{
{
IStream_Release
(
parser
->
stream
);
struct
midi_parser
*
parser
;
free
(
parser
);
HRESULT
hr
;
if
(
FAILED
(
hr
=
midi_parser_new
(
stream
,
&
parser
)))
return
hr
;
hr
=
midi_parser_parse
(
parser
,
segment
);
midi_parser_destroy
(
parser
);
return
hr
;
}
}
dlls/dmime/segment.c
View file @
aebcb1a9
...
@@ -791,10 +791,7 @@ static inline struct segment *impl_from_IPersistStream(IPersistStream *iface)
...
@@ -791,10 +791,7 @@ static inline struct segment *impl_from_IPersistStream(IPersistStream *iface)
static
HRESULT
WINAPI
segment_persist_stream_Load
(
IPersistStream
*
iface
,
IStream
*
stream
)
static
HRESULT
WINAPI
segment_persist_stream_Load
(
IPersistStream
*
iface
,
IStream
*
stream
)
{
{
struct
segment
*
This
=
impl_from_IPersistStream
(
iface
);
struct
segment
*
This
=
impl_from_IPersistStream
(
iface
);
IDirectMusicTrack
*
track
;
MUSIC_TIME
length
;
struct
chunk_entry
chunk
=
{
0
};
struct
chunk_entry
chunk
=
{
0
};
struct
midi_parser
*
midi_parser
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"(%p, %p): Loading
\n
"
,
This
,
stream
);
TRACE
(
"(%p, %p): Loading
\n
"
,
This
,
stream
);
...
@@ -810,18 +807,7 @@ static HRESULT WINAPI segment_persist_stream_Load(IPersistStream *iface, IStream
...
@@ -810,18 +807,7 @@ static HRESULT WINAPI segment_persist_stream_Load(IPersistStream *iface, IStream
break
;
break
;
case
mmioFOURCC
(
'M'
,
'T'
,
'h'
,
'd'
):
case
mmioFOURCC
(
'M'
,
'T'
,
'h'
,
'd'
):
hr
=
midi_parser_new
(
stream
,
&
midi_parser
);
hr
=
parse_midi
(
stream
,
&
This
->
IDirectMusicSegment8_iface
);
if
(
FAILED
(
hr
))
break
;
This
->
header
.
mtLength
=
0
;
while
((
hr
=
midi_parser_next_track
(
midi_parser
,
&
track
,
&
length
))
==
S_OK
)
{
hr
=
segment_append_track
(
This
,
track
,
1
,
0
);
IDirectMusicTrack_Release
(
track
);
if
(
FAILED
(
hr
))
break
;
if
(
length
>
This
->
header
.
mtLength
)
This
->
header
.
mtLength
=
length
;
}
midi_parser_destroy
(
midi_parser
);
break
;
break
;
case
MAKE_IDTYPE
(
FOURCC_RIFF
,
mmioFOURCC
(
'W'
,
'A'
,
'V'
,
'E'
)):
case
MAKE_IDTYPE
(
FOURCC_RIFF
,
mmioFOURCC
(
'W'
,
'A'
,
'V'
,
'E'
)):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment