Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
80e6310a
Commit
80e6310a
authored
Oct 17, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Oct 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Use the IDirectMusicObject interface for waves.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55792
parent
dc0431b8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
30 deletions
+36
-30
wavetrack.c
dlls/dmime/wavetrack.c
+3
-3
collection.c
dlls/dmusic/collection.c
+4
-4
dmusic_private.h
dlls/dmusic/dmusic_private.h
+1
-1
dmusic_wave.h
dlls/dmusic/dmusic_wave.h
+6
-5
instrument.c
dlls/dmusic/instrument.c
+2
-2
wave.c
dlls/dmusic/wave.c
+20
-15
No files found.
dlls/dmime/wavetrack.c
View file @
80e6310a
...
@@ -24,7 +24,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmime);
...
@@ -24,7 +24,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmime);
struct
wave_item
{
struct
wave_item
{
struct
list
entry
;
struct
list
entry
;
DMUS_IO_WAVE_ITEM_HEADER
header
;
DMUS_IO_WAVE_ITEM_HEADER
header
;
I
Unknown
*
object
;
I
DirectMusicObject
*
object
;
IDirectSoundBuffer
*
buffer
;
IDirectSoundBuffer
*
buffer
;
};
};
...
@@ -106,7 +106,7 @@ static ULONG WINAPI wave_track_Release(IDirectMusicTrack8 *iface)
...
@@ -106,7 +106,7 @@ static ULONG WINAPI wave_track_Release(IDirectMusicTrack8 *iface)
{
{
list_remove
(
&
item
->
entry
);
list_remove
(
&
item
->
entry
);
if
(
item
->
buffer
)
IDirectSoundBuffer_Release
(
item
->
buffer
);
if
(
item
->
buffer
)
IDirectSoundBuffer_Release
(
item
->
buffer
);
if
(
item
->
object
)
I
Unknown
_Release
(
item
->
object
);
if
(
item
->
object
)
I
DirectMusicObject
_Release
(
item
->
object
);
free
(
item
);
free
(
item
);
}
}
...
@@ -469,7 +469,7 @@ static HRESULT parse_wave_item(struct wave_part *part, IStream *stream, struct c
...
@@ -469,7 +469,7 @@ static HRESULT parse_wave_item(struct wave_part *part, IStream *stream, struct c
hr
=
DMUS_E_UNSUPPORTED_STREAM
;
hr
=
DMUS_E_UNSUPPORTED_STREAM
;
goto
error
;
goto
error
;
}
}
if
(
FAILED
(
hr
=
dmobj_parsereference
(
stream
,
&
chunk
,
(
IDirectMusicObject
**
)
&
item
->
object
)))
if
(
FAILED
(
hr
=
dmobj_parsereference
(
stream
,
&
chunk
,
&
item
->
object
)))
goto
error
;
goto
error
;
list_add_tail
(
&
part
->
items
,
&
item
->
entry
);
list_add_tail
(
&
part
->
items
,
&
item
->
entry
);
...
...
dlls/dmusic/collection.c
View file @
80e6310a
...
@@ -42,7 +42,7 @@ C_ASSERT(sizeof(struct pool) == offsetof(struct pool, cues[0]));
...
@@ -42,7 +42,7 @@ C_ASSERT(sizeof(struct pool) == offsetof(struct pool, cues[0]));
struct
wave_entry
struct
wave_entry
{
{
struct
list
entry
;
struct
list
entry
;
I
Unknown
*
wave
;
I
DirectMusicObject
*
wave
;
DWORD
offset
;
DWORD
offset
;
};
};
...
@@ -59,13 +59,13 @@ struct collection
...
@@ -59,13 +59,13 @@ struct collection
struct
list
waves
;
struct
list
waves
;
};
};
extern
void
collection_internal_addref
(
struct
collection
*
collection
)
void
collection_internal_addref
(
struct
collection
*
collection
)
{
{
ULONG
ref
=
InterlockedIncrement
(
&
collection
->
internal_ref
);
ULONG
ref
=
InterlockedIncrement
(
&
collection
->
internal_ref
);
TRACE
(
"collection %p, internal ref %lu.
\n
"
,
collection
,
ref
);
TRACE
(
"collection %p, internal ref %lu.
\n
"
,
collection
,
ref
);
}
}
extern
void
collection_internal_release
(
struct
collection
*
collection
)
void
collection_internal_release
(
struct
collection
*
collection
)
{
{
ULONG
ref
=
InterlockedDecrement
(
&
collection
->
internal_ref
);
ULONG
ref
=
InterlockedDecrement
(
&
collection
->
internal_ref
);
TRACE
(
"collection %p, internal ref %lu.
\n
"
,
collection
,
ref
);
TRACE
(
"collection %p, internal ref %lu.
\n
"
,
collection
,
ref
);
...
@@ -74,7 +74,7 @@ extern void collection_internal_release(struct collection *collection)
...
@@ -74,7 +74,7 @@ extern void collection_internal_release(struct collection *collection)
free
(
collection
);
free
(
collection
);
}
}
extern
HRESULT
collection_get_wave
(
struct
collection
*
collection
,
DWORD
index
,
IUnknown
**
out
)
HRESULT
collection_get_wave
(
struct
collection
*
collection
,
DWORD
index
,
IDirectMusicObject
**
out
)
{
{
struct
wave_entry
*
wave_entry
;
struct
wave_entry
*
wave_entry
;
DWORD
offset
;
DWORD
offset
;
...
...
dlls/dmusic/dmusic_private.h
View file @
80e6310a
...
@@ -80,7 +80,7 @@ typedef struct port_info {
...
@@ -80,7 +80,7 @@ typedef struct port_info {
struct
collection
;
struct
collection
;
extern
void
collection_internal_addref
(
struct
collection
*
collection
);
extern
void
collection_internal_addref
(
struct
collection
*
collection
);
extern
void
collection_internal_release
(
struct
collection
*
collection
);
extern
void
collection_internal_release
(
struct
collection
*
collection
);
extern
HRESULT
collection_get_wave
(
struct
collection
*
collection
,
DWORD
index
,
I
Unknown
**
out
);
extern
HRESULT
collection_get_wave
(
struct
collection
*
collection
,
DWORD
index
,
I
DirectMusicObject
**
out
);
/* CLSID */
/* CLSID */
extern
HRESULT
music_create
(
IUnknown
**
ret_iface
);
extern
HRESULT
music_create
(
IUnknown
**
ret_iface
);
...
...
dlls/dmusic/dmusic_wave.h
View file @
80e6310a
...
@@ -29,8 +29,9 @@
...
@@ -29,8 +29,9 @@
struct
soundfont
;
struct
soundfont
;
struct
chunk_entry
;
struct
chunk_entry
;
extern
HRESULT
wave_create_from_soundfont
(
struct
soundfont
*
soundfont
,
UINT
index
,
IUnknown
**
out
);
extern
HRESULT
wave_create_from_soundfont
(
struct
soundfont
*
soundfont
,
UINT
index
,
IDirectMusicObject
**
out
);
extern
HRESULT
wave_create_from_chunk
(
IStream
*
stream
,
struct
chunk_entry
*
parent
,
IUnknown
**
out
);
extern
HRESULT
wave_create_from_chunk
(
IStream
*
stream
,
struct
chunk_entry
*
parent
,
IDirectMusicObject
**
out
);
extern
HRESULT
wave_download_to_port
(
IUnknown
*
iface
,
IDirectMusicPortDownload
*
port
,
DWORD
*
id
);
extern
HRESULT
wave_download_to_port
(
IDirectMusicObject
*
iface
,
IDirectMusicPortDownload
*
port
,
DWORD
*
id
);
extern
HRESULT
wave_download_to_dsound
(
IUnknown
*
iface
,
IDirectSound
*
dsound
,
IDirectSoundBuffer
**
ret_iface
);
extern
HRESULT
wave_download_to_dsound
(
IDirectMusicObject
*
iface
,
IDirectSound
*
dsound
,
extern
HRESULT
wave_get_duration
(
IUnknown
*
iface
,
REFERENCE_TIME
*
duration
);
IDirectSoundBuffer
**
ret_iface
);
extern
HRESULT
wave_get_duration
(
IDirectMusicObject
*
iface
,
REFERENCE_TIME
*
duration
);
dlls/dmusic/instrument.c
View file @
80e6310a
...
@@ -747,7 +747,7 @@ HRESULT instrument_download_to_port(IDirectMusicInstrument *iface, IDirectMusicP
...
@@ -747,7 +747,7 @@ HRESULT instrument_download_to_port(IDirectMusicInstrument *iface, IDirectMusicP
IDirectMusicDownload
*
download
;
IDirectMusicDownload
*
download
;
DWORD
size
,
offset_count
;
DWORD
size
,
offset_count
;
struct
region
*
region
;
struct
region
*
region
;
I
Unknown
*
wave
;
I
DirectMusicObject
*
wave
;
HRESULT
hr
;
HRESULT
hr
;
if
(
This
->
download
)
goto
done
;
if
(
This
->
download
)
goto
done
;
...
@@ -827,7 +827,7 @@ HRESULT instrument_download_to_port(IDirectMusicInstrument *iface, IDirectMusicP
...
@@ -827,7 +827,7 @@ HRESULT instrument_download_to_port(IDirectMusicInstrument *iface, IDirectMusicP
if
(
SUCCEEDED
(
hr
=
collection_get_wave
(
This
->
collection
,
region
->
wave_link
.
ulTableIndex
,
&
wave
)))
if
(
SUCCEEDED
(
hr
=
collection_get_wave
(
This
->
collection
,
region
->
wave_link
.
ulTableIndex
,
&
wave
)))
{
{
hr
=
wave_download_to_port
(
wave
,
port
,
&
dmus_region
->
WaveLink
.
ulTableIndex
);
hr
=
wave_download_to_port
(
wave
,
port
,
&
dmus_region
->
WaveLink
.
ulTableIndex
);
I
Unknown
_Release
(
wave
);
I
DirectMusicObject
_Release
(
wave
);
}
}
if
(
FAILED
(
hr
))
goto
failed
;
if
(
FAILED
(
hr
))
goto
failed
;
...
...
dlls/dmusic/wave.c
View file @
80e6310a
...
@@ -170,6 +170,11 @@ static HRESULT parse_wave_chunk(struct wave *This, IStream *stream, struct chunk
...
@@ -170,6 +170,11 @@ static HRESULT parse_wave_chunk(struct wave *This, IStream *stream, struct chunk
return
hr
;
return
hr
;
}
}
static
inline
struct
wave
*
impl_from_IDirectMusicObject
(
IDirectMusicObject
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
wave
,
dmobj
.
IDirectMusicObject_iface
);
}
static
HRESULT
WINAPI
wave_object_ParseDescriptor
(
IDirectMusicObject
*
iface
,
static
HRESULT
WINAPI
wave_object_ParseDescriptor
(
IDirectMusicObject
*
iface
,
IStream
*
stream
,
DMUS_OBJECTDESC
*
desc
)
IStream
*
stream
,
DMUS_OBJECTDESC
*
desc
)
{
{
...
@@ -259,7 +264,7 @@ static const IPersistStreamVtbl wave_persist_stream_vtbl =
...
@@ -259,7 +264,7 @@ static const IPersistStreamVtbl wave_persist_stream_vtbl =
unimpl_IPersistStream_GetSizeMax
,
unimpl_IPersistStream_GetSizeMax
,
};
};
static
HRESULT
wave_create
(
I
Unknown
**
ret_iface
)
static
HRESULT
wave_create
(
I
DirectMusicObject
**
ret_iface
)
{
{
struct
wave
*
obj
;
struct
wave
*
obj
;
...
@@ -270,24 +275,24 @@ static HRESULT wave_create(IUnknown **ret_iface)
...
@@ -270,24 +275,24 @@ static HRESULT wave_create(IUnknown **ret_iface)
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
wave_object_vtbl
;
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
wave_object_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
wave_persist_stream_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
wave_persist_stream_vtbl
;
*
ret_iface
=
&
obj
->
IUnknown
_iface
;
*
ret_iface
=
&
obj
->
dmobj
.
IDirectMusicObject
_iface
;
return
S_OK
;
return
S_OK
;
}
}
HRESULT
wave_create_from_chunk
(
IStream
*
stream
,
struct
chunk_entry
*
parent
,
I
Unknown
**
ret_iface
)
HRESULT
wave_create_from_chunk
(
IStream
*
stream
,
struct
chunk_entry
*
parent
,
I
DirectMusicObject
**
ret_iface
)
{
{
struct
wave
*
This
;
struct
wave
*
This
;
I
Unknown
*
iface
;
I
DirectMusicObject
*
iface
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"(%p, %p, %p)
\n
"
,
stream
,
parent
,
ret_iface
);
TRACE
(
"(%p, %p, %p)
\n
"
,
stream
,
parent
,
ret_iface
);
if
(
FAILED
(
hr
=
wave_create
(
&
iface
)))
return
hr
;
if
(
FAILED
(
hr
=
wave_create
(
&
iface
)))
return
hr
;
This
=
impl_from_I
Unknown
(
iface
);
This
=
impl_from_I
DirectMusicObject
(
iface
);
if
(
FAILED
(
hr
=
parse_wave_chunk
(
This
,
stream
,
parent
)))
if
(
FAILED
(
hr
=
parse_wave_chunk
(
This
,
stream
,
parent
)))
{
{
I
Unknown
_Release
(
iface
);
I
DirectMusicObject
_Release
(
iface
);
return
DMUS_E_UNSUPPORTED_STREAM
;
return
DMUS_E_UNSUPPORTED_STREAM
;
}
}
...
@@ -324,7 +329,7 @@ HRESULT wave_create_from_chunk(IStream *stream, struct chunk_entry *parent, IUnk
...
@@ -324,7 +329,7 @@ HRESULT wave_create_from_chunk(IStream *stream, struct chunk_entry *parent, IUnk
return
S_OK
;
return
S_OK
;
}
}
HRESULT
wave_create_from_soundfont
(
struct
soundfont
*
soundfont
,
UINT
index
,
I
Unknown
**
ret_iface
)
HRESULT
wave_create_from_soundfont
(
struct
soundfont
*
soundfont
,
UINT
index
,
I
DirectMusicObject
**
ret_iface
)
{
{
struct
sf_sample
*
sf_sample
=
soundfont
->
shdr
+
index
;
struct
sf_sample
*
sf_sample
=
soundfont
->
shdr
+
index
;
struct
sample
*
sample
=
NULL
;
struct
sample
*
sample
=
NULL
;
...
@@ -333,7 +338,7 @@ HRESULT wave_create_from_soundfont(struct soundfont *soundfont, UINT index, IUnk
...
@@ -333,7 +338,7 @@ HRESULT wave_create_from_soundfont(struct soundfont *soundfont, UINT index, IUnk
UINT
data_size
,
offset
;
UINT
data_size
,
offset
;
struct
wave
*
This
;
struct
wave
*
This
;
void
*
data
=
NULL
;
void
*
data
=
NULL
;
I
Unknown
*
iface
;
I
DirectMusicObject
*
iface
;
TRACE
(
"(%p, %u, %p)
\n
"
,
soundfont
,
index
,
ret_iface
);
TRACE
(
"(%p, %u, %p)
\n
"
,
soundfont
,
index
,
ret_iface
);
...
@@ -360,7 +365,7 @@ HRESULT wave_create_from_soundfont(struct soundfont *soundfont, UINT index, IUnk
...
@@ -360,7 +365,7 @@ HRESULT wave_create_from_soundfont(struct soundfont *soundfont, UINT index, IUnk
if
(
FAILED
(
hr
=
wave_create
(
&
iface
)))
goto
failed
;
if
(
FAILED
(
hr
=
wave_create
(
&
iface
)))
goto
failed
;
This
=
impl_from_I
Unknown
(
iface
);
This
=
impl_from_I
DirectMusicObject
(
iface
);
This
->
format
=
format
;
This
->
format
=
format
;
This
->
sample
=
sample
;
This
->
sample
=
sample
;
This
->
data_size
=
data_size
;
This
->
data_size
=
data_size
;
...
@@ -403,7 +408,7 @@ failed:
...
@@ -403,7 +408,7 @@ failed:
return
hr
;
return
hr
;
}
}
HRESULT
wave_download_to_port
(
I
Unknown
*
iface
,
IDirectMusicPortDownload
*
port
,
DWORD
*
id
)
HRESULT
wave_download_to_port
(
I
DirectMusicObject
*
iface
,
IDirectMusicPortDownload
*
port
,
DWORD
*
id
)
{
{
struct
download_buffer
struct
download_buffer
{
{
...
@@ -413,7 +418,7 @@ HRESULT wave_download_to_port(IUnknown *iface, IDirectMusicPortDownload *port, D
...
@@ -413,7 +418,7 @@ HRESULT wave_download_to_port(IUnknown *iface, IDirectMusicPortDownload *port, D
DMUS_WAVEDATA
data
;
DMUS_WAVEDATA
data
;
}
*
buffer
;
}
*
buffer
;
struct
wave
*
This
=
impl_from_I
Unknown
(
iface
);
struct
wave
*
This
=
impl_from_I
DirectMusicObject
(
iface
);
DWORD
size
=
offsetof
(
struct
download_buffer
,
data
.
byData
[
This
->
data_size
]);
DWORD
size
=
offsetof
(
struct
download_buffer
,
data
.
byData
[
This
->
data_size
]);
IDirectMusicDownload
*
download
;
IDirectMusicDownload
*
download
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -446,9 +451,9 @@ HRESULT wave_download_to_port(IUnknown *iface, IDirectMusicPortDownload *port, D
...
@@ -446,9 +451,9 @@ HRESULT wave_download_to_port(IUnknown *iface, IDirectMusicPortDownload *port, D
return
hr
;
return
hr
;
}
}
HRESULT
wave_download_to_dsound
(
I
Unknown
*
iface
,
IDirectSound
*
dsound
,
IDirectSoundBuffer
**
ret_iface
)
HRESULT
wave_download_to_dsound
(
I
DirectMusicObject
*
iface
,
IDirectSound
*
dsound
,
IDirectSoundBuffer
**
ret_iface
)
{
{
struct
wave
*
This
=
impl_from_I
Unknown
(
iface
);
struct
wave
*
This
=
impl_from_I
DirectMusicObject
(
iface
);
DSBUFFERDESC
desc
=
DSBUFFERDESC
desc
=
{
{
.
dwSize
=
sizeof
(
desc
),
.
dwSize
=
sizeof
(
desc
),
...
@@ -485,9 +490,9 @@ HRESULT wave_download_to_dsound(IUnknown *iface, IDirectSound *dsound, IDirectSo
...
@@ -485,9 +490,9 @@ HRESULT wave_download_to_dsound(IUnknown *iface, IDirectSound *dsound, IDirectSo
return
S_OK
;
return
S_OK
;
}
}
HRESULT
wave_get_duration
(
I
Unknown
*
iface
,
REFERENCE_TIME
*
duration
)
HRESULT
wave_get_duration
(
I
DirectMusicObject
*
iface
,
REFERENCE_TIME
*
duration
)
{
{
struct
wave
*
This
=
impl_from_I
Unknown
(
iface
);
struct
wave
*
This
=
impl_from_I
DirectMusicObject
(
iface
);
*
duration
=
(
REFERENCE_TIME
)
This
->
data_size
*
10000000
/
This
->
format
->
nAvgBytesPerSec
;
*
duration
=
(
REFERENCE_TIME
)
This
->
data_size
*
10000000
/
This
->
format
->
nAvgBytesPerSec
;
return
S_OK
;
return
S_OK
;
}
}
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