static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME ref_time, DWORD channel_group, DWORD channel_message) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); DWORD new_write_pos = This->write_pos + DMUS_EVENT_SIZE(sizeof(channel_message)); DMUS_EVENTHEADER *header; TRACE("(%p)->(0x%s, %u, 0x%x)\n", iface, wine_dbgstr_longlong(ref_time), channel_group, channel_message); if (new_write_pos > This->size) return DMUS_E_BUFFER_FULL; /* Channel_message 0xZZYYXX (3 bytes) is a midi message where XX = status byte, YY = byte 1 and ZZ = byte 2 */ if (!(channel_message & 0x80)) { /* Status byte MSB is always set */ return DMUS_E_INVALID_EVENT; } if (!This->write_pos) This->start_time = ref_time; header = (DMUS_EVENTHEADER*)&This->data[This->write_pos]; header->cbEvent = 3; /* Midi message takes 4 bytes space but only 3 are relevant */ header->dwChannelGroup = channel_group; header->rtDelta = ref_time - This->start_time; header->dwFlags = DMUS_EVENT_STRUCTURED; *(DWORD*)&header[1] = channel_message; This->write_pos = new_write_pos; return S_OK; }
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; 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; }
static HRESULT WINAPI IDirectMusicBufferImpl_TotalTime(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prtTime) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); FIXME("(%p, %p): stub\n", This, prtTime); return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_GetNextEvent(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt, LPDWORD pdwChannelGroup, LPDWORD pdwLength, LPBYTE* ppData) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); FIXME("(%p, %p, %p, %p, %p): stub\n", This, prt, pdwChannelGroup, pdwLength, ppData); return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_ResetReadPtr(LPDIRECTMUSICBUFFER iface) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); FIXME("(%p): stub\n", This); return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD cb, LPBYTE lpb) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); FIXME("(%p, 0x%s, %d, %d, %p): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, cb, lpb); return S_OK; }
static ULONG WINAPI IDirectMusicBufferImpl_AddRef(LPDIRECTMUSICBUFFER iface) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p)->(): new ref = %u\n", iface, ref); return ref; }
/* IDirectMusicBufferImpl IDirectMusicBuffer part: */ static HRESULT WINAPI IDirectMusicBufferImpl_Flush(LPDIRECTMUSICBUFFER iface) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); TRACE("(%p)->()\n", iface); This->write_pos = 0; return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_SetStartTime(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME ref_time) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); TRACE("(%p)->(0x%s)\n", This, wine_dbgstr_longlong(ref_time)); This->start_time = ref_time; return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_GetBufferFormat(LPDIRECTMUSICBUFFER iface, LPGUID format) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); TRACE("(%p)->(%p)\n", iface, format); if (!format) return E_POINTER; *format = This->format; return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_SetUsedBytes(LPDIRECTMUSICBUFFER iface, DWORD used_bytes) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); TRACE("(%p)->(%u)\n", iface, used_bytes); if (used_bytes > This->size) return DMUS_E_BUFFER_FULL; This->write_pos = used_bytes; return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_GetMaxBytes(LPDIRECTMUSICBUFFER iface, LPDWORD max_bytes) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); TRACE("(%p)->(%p)\n", iface, max_bytes); if (!max_bytes) return E_POINTER; *max_bytes = This->size; return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_GetUsedBytes(LPDIRECTMUSICBUFFER iface, LPDWORD used_bytes) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); TRACE("(%p)->(%p)\n", iface, used_bytes); if (!used_bytes) return E_POINTER; *used_bytes = This->write_pos; return S_OK; }
static HRESULT WINAPI IDirectMusicBufferImpl_GetRawBufferPtr(LPDIRECTMUSICBUFFER iface, LPBYTE* data) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); TRACE("(%p)->(%p)\n", iface, data); if (!data) return E_POINTER; *data = This->data; return S_OK; }
static ULONG WINAPI IDirectMusicBufferImpl_Release(LPDIRECTMUSICBUFFER iface) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p)->(): new ref = %u\n", iface, ref); if (!ref) { HeapFree(GetProcessHeap(), 0, This->data); HeapFree(GetProcessHeap(), 0, This); DMUSIC_UnlockModule(); } return ref; }
static HRESULT WINAPI IDirectMusicBufferImpl_GetStartTime(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME ref_time) { IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface); TRACE("(%p)->(%p)\n", iface, ref_time); if (!ref_time) return E_POINTER; if (!This->write_pos) return DMUS_E_BUFFER_EMPTY; *ref_time = This->start_time; return S_OK; }