Rebase against 3db7506221e44e8091887d7eb42fe1666d422166.

This commit is contained in:
Alistair Leslie-Hughes
2023-09-30 08:20:32 +10:00
parent b7b4fbcd32
commit 82924e9a17
4 changed files with 31 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
From cdbd2714d5454e6518b699e3cdbedd3e0a1243c5 Mon Sep 17 00:00:00 2001
From aa953a66080d49a697101fb55a1bd950de4a59db Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 2 Dec 2022 14:41:30 +1100
Subject: [PATCH] dmime: Implement IDirectMusicSegment8 Download
@@ -6,8 +6,8 @@ Subject: [PATCH] dmime: Implement IDirectMusicSegment8 Download
---
dlls/dmime/dmime_private.h | 2 +
dlls/dmime/performance.c | 7 ++++
dlls/dmime/segment.c | 80 +++++++++++++++++++++++++++++++++++++-
3 files changed, 88 insertions(+), 1 deletion(-)
dlls/dmime/segment.c | 84 +++++++++++++++++++++++++++++++++++++-
3 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/dlls/dmime/dmime_private.h b/dlls/dmime/dmime_private.h
index eacde4b46be..cd34378b66e 100644
@@ -23,7 +23,7 @@ index eacde4b46be..cd34378b66e 100644
* Auxiliary definitions
*/
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index d8624427423..a707de39d50 100644
index 111d7c60568..8a418b8df13 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -251,6 +251,13 @@ static inline struct performance *impl_from_IDirectMusicPerformance8(IDirectMusi
@@ -41,7 +41,7 @@ index d8624427423..a707de39d50 100644
static HRESULT WINAPI performance_QueryInterface(IDirectMusicPerformance8 *iface, REFIID riid, void **ret_iface)
{
diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index a72ec786623..ebee90eee92 100644
index af7729f34b9..284564749df 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -54,6 +54,7 @@ struct segment
@@ -61,11 +61,10 @@ index a72ec786623..ebee90eee92 100644
if (This->wave_data)
free(This->wave_data);
@@ -517,7 +520,82 @@ static HRESULT WINAPI segment_Compose(IDirectMusicSegment8 *iface, MUSIC_TIME mt
static HRESULT WINAPI segment_Download(IDirectMusicSegment8 *iface, IUnknown *pAudioPath)
@@ -533,8 +536,87 @@ static HRESULT WINAPI segment_Compose(IDirectMusicSegment8 *iface, MUSIC_TIME mt
static HRESULT WINAPI segment_Download(IDirectMusicSegment8 *iface, IUnknown *audio_path)
{
struct segment *This = impl_from_IDirectMusicSegment8(iface);
- FIXME("(%p, %p): stub\n", This, pAudioPath);
+ IDirectMusicPerformance8 *perf;
+ IDirectMusicAudioPath *audio;
+ IDirectSound *dsound;
@@ -75,11 +74,16 @@ index a72ec786623..ebee90eee92 100644
+ DWORD size;
+ DWORD buffer = 0;
+
+ TRACE("(%p, %p)\n", This, pAudioPath);
TRACE("(%p, %p)\n", This, audio_path);
- return IDirectMusicSegment8_SetParam(iface, &GUID_DownloadToAudioPath, -1, DMUS_SEG_ALLTRACKS, 0, audio_path);
+
+ if (!pAudioPath)
+ if (!audio_path)
+ return E_INVALIDARG;
+
+ hr = IDirectMusicSegment8_SetParam(iface, &GUID_DownloadToAudioPath, -1, DMUS_SEG_ALLTRACKS, 0, audio_path);
+ if (FAILED(hr))
+ return hr;
+
+ if (This->buffer)
+ {
+ TRACE("Using Cached buffer\n");
@@ -87,11 +91,11 @@ index a72ec786623..ebee90eee92 100644
+ }
+
+ /* pAudioPath can either be IDirectMusicAudioPath or IDirectMusicPerformance */
+ hr = IUnknown_QueryInterface(pAudioPath, &IID_IDirectMusicPerformance8, (void**)&perf);
+ hr = IUnknown_QueryInterface(audio_path, &IID_IDirectMusicPerformance8, (void**)&perf);
+ if (FAILED(hr))
+ {
+ TRACE("Checking for IDirectMusicAudioPath interface\n");
+ hr = IUnknown_QueryInterface(pAudioPath, &IID_IDirectMusicAudioPath, (void**)&audio);
+ hr = IUnknown_QueryInterface(audio_path, &IID_IDirectMusicAudioPath, (void**)&audio);
+ if (FAILED(hr))
+ {
+ WARN("Cannot query for IDirectMusicAudioPath\n");
@@ -142,9 +146,10 @@ index a72ec786623..ebee90eee92 100644
+ hr = IDirectSoundBuffer_Unlock(This->buffer, data, This->data_size, NULL, 0);
+ TRACE("IDirectSoundBuffer_Unlock hr 0x%08lx\n", hr);
+
return S_OK;
+ return S_OK;
}
static HRESULT WINAPI segment_Unload(IDirectMusicSegment8 *iface, IUnknown *audio_path)
--
2.40.1
2.42.0

View File

@@ -1,4 +1,4 @@
From ea9bd0ec85254305b5783e1890ded6b21d200f41 Mon Sep 17 00:00:00 2001
From 5c84cc44881073aa756e4797a776acbde4d063ae Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 12 Dec 2022 15:20:10 +1100
Subject: [PATCH] dmime: Play a sound in IDirectMusicPerformance8 PlaySegmentEx
@@ -22,10 +22,10 @@ index cd34378b66e..c83f6675333 100644
/*****************************************************************************
* Auxiliary definitions
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index a707de39d50..2b09814cd6b 100644
index 8a418b8df13..a0dbdbd5aad 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -1053,13 +1053,26 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface,
@@ -1075,13 +1075,26 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface,
WCHAR *pwzSegmentName, IUnknown *pTransition, DWORD dwFlags, __int64 i64StartTime,
IDirectMusicSegmentState **ppSegmentState, IUnknown *pFrom, IUnknown *pAudioPath)
{
@@ -59,7 +59,7 @@ index a707de39d50..2b09814cd6b 100644
static HRESULT WINAPI performance_StopEx(IDirectMusicPerformance8 *iface, IUnknown *pObjectToStop,
diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index ebee90eee92..8482cb21d34 100644
index 284564749df..af76258c979 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -64,6 +64,12 @@ static inline struct segment *impl_from_IDirectMusicSegment8(IDirectMusicSegment
@@ -76,5 +76,5 @@ index ebee90eee92..8482cb21d34 100644
{
struct segment *This = impl_from_IDirectMusicSegment8(iface);
--
2.40.1
2.42.0