Skip to content

Commit

Permalink
dmime: Play a sound in IDirectMusicPerformance8 PlaySegmentEx
Browse files Browse the repository at this point in the history
Wine-Staging: dmime-load-wave
CW-Bug-Id: #22409
  • Loading branch information
alesliehughes authored and ivyl committed Sep 12, 2023
1 parent 6024e7a commit 6a6da86
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions dlls/dmime/dmime_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ extern void set_audiopath_dsound_buffer(IDirectMusicAudioPath*,IDirectSoundBuffe
extern void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath*,IDirectSoundBuffer*) DECLSPEC_HIDDEN;

extern IDirectSound *get_dsound_interface(IDirectMusicPerformance8*) DECLSPEC_HIDDEN;
extern IDirectSoundBuffer *get_segment_buffer(IDirectMusicSegment8 *iface) DECLSPEC_HIDDEN;

/*****************************************************************************
* Auxiliary definitions
Expand Down
25 changes: 19 additions & 6 deletions dlls/dmime/performance.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,13 +1043,26 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_PlaySegmentEx(IDirectMusicPer
__int64 i64StartTime, IDirectMusicSegmentState **ppSegmentState, IUnknown *pFrom,
IUnknown *pAudioPath)
{
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
IDirectMusicSegment8 *segment;
IDirectSoundBuffer *buffer;
HRESULT hr;

FIXME("(%p, %p, %p, %p, %ld, 0x%s, %p, %p, %p): stub\n", This, pSource, pwzSegmentName,
pTransition, dwFlags, wine_dbgstr_longlong(i64StartTime), ppSegmentState, pFrom, pAudioPath);
if (ppSegmentState)
return create_dmsegmentstate(&IID_IDirectMusicSegmentState,(void**)ppSegmentState);
return S_OK;
FIXME("(%p, %p, %p, %p, %ld, 0x%s, %p, %p, %p): semi-stub\n", This, pSource, pwzSegmentName,
pTransition, dwFlags, wine_dbgstr_longlong(i64StartTime), ppSegmentState, pFrom, pAudioPath);

hr = IUnknown_QueryInterface(pSource, &IID_IDirectMusicSegment8, (void**)&segment);
if (FAILED(hr))
return hr;

buffer = get_segment_buffer(segment);

if (segment)
hr = IDirectSoundBuffer_Play(buffer, 0, 0, 0);

if (ppSegmentState)
return create_dmsegmentstate(&IID_IDirectMusicSegmentState,(void**)ppSegmentState);
return S_OK;
}

static HRESULT WINAPI IDirectMusicPerformance8Impl_StopEx(IDirectMusicPerformance8 *iface,
Expand Down
6 changes: 6 additions & 0 deletions dlls/dmime/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ static inline IDirectMusicSegment8Impl *impl_from_IDirectMusicSegment8(IDirectMu
return CONTAINING_RECORD(iface, IDirectMusicSegment8Impl, IDirectMusicSegment8_iface);
}

IDirectSoundBuffer *get_segment_buffer(IDirectMusicSegment8 *iface)
{
IDirectMusicSegment8Impl *This = impl_from_IDirectMusicSegment8(iface);
return This->buffer;
}

static HRESULT WINAPI IDirectMusicSegment8Impl_QueryInterface(IDirectMusicSegment8 *iface,
REFIID riid, void **ret_iface)
{
Expand Down

0 comments on commit 6a6da86

Please sign in to comment.