Michael Stefaniuc : dmusic: Implement IDirectMusicBuffer::PackUnstructured ().

Alexandre Julliard julliard at winehq.org
Mon May 1 16:38:05 CDT 2017


Module: wine
Branch: master
Commit: 7cd7f14696dc3fb7aa41ef253ad144d458304a28
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7cd7f14696dc3fb7aa41ef253ad144d458304a28

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Mon May  1 18:51:30 2017 +0200

dmusic: Implement IDirectMusicBuffer::PackUnstructured().

Based on a patch by Michael Müller <michael at fds-team.de>.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dmusic/buffer.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/dmusic/buffer.c b/dlls/dmusic/buffer.c
index eecacbb..dbc8058 100644
--- a/dlls/dmusic/buffer.c
+++ b/dlls/dmusic/buffer.c
@@ -131,11 +131,29 @@ static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured(LPDIRECTMUSICBUFFER
     return S_OK;
 }
 
-static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD cb, LPBYTE lpb)
+static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured(IDirectMusicBuffer *iface,
+        REFERENCE_TIME ref_time, DWORD channel_group, DWORD len, BYTE *data)
 {
     IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
+    DWORD new_write_pos = This->write_pos + DMUS_EVENT_SIZE(len);
+    DMUS_EVENTHEADER *header;
 
-    FIXME("(%p, 0x%s, %d, %d, %p): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, cb, lpb);
+    TRACE("(%p, 0x%s, %d, %d, %p)\n", This, wine_dbgstr_longlong(ref_time), channel_group, len, data);
+
+    if (new_write_pos > This->size)
+        return DMUS_E_BUFFER_FULL;
+
+    if (!This->write_pos)
+        This->start_time = ref_time;
+
+    header = (DMUS_EVENTHEADER*)&This->data[This->write_pos];
+    header->cbEvent = len;
+    header->dwChannelGroup = channel_group;
+    header->rtDelta = ref_time - This->start_time;
+    header->dwFlags = 0;
+
+    memcpy(&header[1], data, len);
+    This->write_pos = new_write_pos;
 
     return S_OK;
 }




More information about the wine-cvs mailing list