Michael Stefaniuc : dmsynth: Implement the synth GetFormat method.

Alexandre Julliard julliard at winehq.org
Tue Feb 22 16:06:49 CST 2022


Module: wine
Branch: master
Commit: 5715d2b5b2019deaa145f48f951ec0c6c94cb281
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5715d2b5b2019deaa145f48f951ec0c6c94cb281

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Tue Feb 22 00:49:56 2022 +0100

dmsynth: Implement the synth GetFormat method.

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

---

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

diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c
index 2db80726408..d96ee943a5e 100644
--- a/dlls/dmsynth/synth.c
+++ b/dlls/dmsynth/synth.c
@@ -505,11 +505,29 @@ static HRESULT WINAPI IDirectMusicSynth8Impl_GetChannelPriority(IDirectMusicSynt
 }
 
 static HRESULT WINAPI IDirectMusicSynth8Impl_GetFormat(IDirectMusicSynth8 *iface,
-        WAVEFORMATEX *wave_format, DWORD *wave_format_size)
+        WAVEFORMATEX *format, DWORD *size)
 {
     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
+    WAVEFORMATEX fmt;
 
-    FIXME("(%p)->(%p, %p): stub\n", This, wave_format, wave_format_size);
+    TRACE("(%p, %p, %p)\n", This, format, size);
+
+    if (!size)
+        return E_POINTER;
+    if (!This->open)
+        return DMUS_E_SYNTHNOTCONFIGURED;
+
+    if (format) {
+        fmt.wFormatTag = WAVE_FORMAT_PCM;
+        fmt.nChannels = This->params.dwAudioChannels;
+        fmt.nSamplesPerSec = This->params.dwSampleRate;
+        fmt.wBitsPerSample = 16;
+        fmt.nBlockAlign = This->params.dwAudioChannels * fmt.wBitsPerSample / 8;
+        fmt.nAvgBytesPerSec = This->params.dwSampleRate * fmt.nBlockAlign;
+        fmt.cbSize = 0;
+        memcpy(format, &fmt, min(*size, sizeof(fmt)));
+    }
+    *size = sizeof(fmt);
 
     return S_OK;
 }




More information about the wine-cvs mailing list