Rémi Bernon (@rbernon) commented about dlls/dmusic/wave.c:
struct wave *This = impl_from_IDirectMusicObject(iface); DWORD size = offsetof(struct download_buffer, data.byData[This->data_size]); - IDirectMusicDownload *download; + struct wave_download *download; HRESULT hr;
- if (FAILED(hr = IDirectMusicPortDownload_AllocateBuffer(port, size, &download))) return hr; + LIST_FOR_EACH_ENTRY(download, &This->downloads, struct wave_download, entry) + { + if (download->port == port) + break; + }
I think it would be better to handle this on the instrument side, which would cache its downloaded wave/port pairs and call `wave_download_to_port` only when necessary. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9296#note_120443