https://bugs.winehq.org/show_bug.cgi?id=44277
Bug ID: 44277 Summary: WOLF RPG Editor: Certain background music doesn't stop when using XAudio2 Product: Wine Version: 3.0-rc4 Hardware: x86-64 URL: https://www.freem.ne.jp/win/game/10030 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: xaudio2 Assignee: wine-bugs@winehq.org Reporter: kakurasan@gmail.com Distribution: ---
Created attachment 60102 --> https://bugs.winehq.org/attachment.cgi?id=60102 savegame
In a game created with WOLF RPG Editor v2.10 (Japanese), certain background music doesn't stop when using XAudio2. If WINEDLLOVERRIDES="xaudio2_7=;xaudio2_8=" is specified, it works as expected (DirectSound is used instead).
Steps to reproduce:
1. Download the game "Time Flow" from https://www.freem.ne.jp/dl/win/10030 2. Unpack TimeFlow.zip (e.g. unar -e cp932 TimeFlow.zip) 3. Unpack timeflow-save.tar.xz and put the *.sav files into "TimeFlow/Save/" 4. Run Game.exe without disabling XAudio2 5. Hold "Enter" key for a while (Load savegame, start battle, and defeat all enemies) 6. The background music (in the battle) doesn't stop and the program plays multiple music at the same time
$ sha1sum TimeFlow.zip 4242dbbbce3f610647841e8b45d375cad76a189d TimeFlow.zip
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #1 from kakurasan@gmail.com --- Created attachment 60103 --> https://bugs.winehq.org/attachment.cgi?id=60103 DX Library v3.11 source (WOLF RPG Editor v2.10 uses this version)
https://bugs.winehq.org/show_bug.cgi?id=44277
kakurasan@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
https://bugs.winehq.org/show_bug.cgi?id=44277
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #2 from Fabian Maurer dark.shadow4@web.de --- Confirming. It works when using native xaudio2_7 and disabling xaudio2_8, too. I also noticed that, with builtin audio2 the battle music starts with full volume, while with native it fades in. Makes me think there is a problem with setting the volume.
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #3 from kakurasan@gmail.com --- Created attachment 60115 --> https://bugs.winehq.org/attachment.cgi?id=60115 testcase for setting volume with ChangeVolumeSoundMem() in DX Library
(In reply to Fabian Maurer from comment #2)
I also noticed that, with builtin audio2 the battle music starts with full volume, while with native it fades in. Makes me think there is a problem with setting the volume.
Yeah, I tested ChangeVolumeSoundMem() and found this function doesn't work with builtin XAudio2, however, StopSoundMem() works with builtin XAudio2.
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #4 from Fabian Maurer dark.shadow4@web.de --- Maybe they don't stop the sound, but just change the volume to zero?
https://bugs.winehq.org/show_bug.cgi?id=44277
kakurasan@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |aeikum@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #5 from kakurasan@gmail.com --- Created attachment 60122 --> https://bugs.winehq.org/attachment.cgi?id=60122 A hack for setting volume
The problem is that SetChannelVolumes() is unimplemented.
I confirmed this game tries to set the volume to zero in XA2SRC_SetChannelVolumes() when winning in the battle.
StopSoundMem() really stops the sound because Stop() is implemented properly. This works without the hack.
The hack works for me, but I think this is not "proper" fix because this is a hack for limited cases. However, I don't know how to set volume per channel with OpenAL API.
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #6 from Andrew Eikum aeikum@codeweavers.com --- (In reply to kakurasan from comment #5)
The hack works for me, but I think this is not "proper" fix because this is a hack for limited cases. However, I don't know how to set volume per channel with OpenAL API.
I'd be OK with a partial implementation like that. It could use some tests, input validation, and I'd probably use a do-while instead of the if(i>0) bit.
In the case where the volumes are not the same, I think we should WARN. It might make sense to average the volumes as an approximation. Or maybe take the lowest, or do nothing, I don't know. In practice I suspect few applications actually use this feature.
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #7 from Fabian Maurer dark.shadow4@web.de --- Created attachment 60126 --> https://bugs.winehq.org/attachment.cgi?id=60126 patch
How about something like this? It's a bit simpler, I think.
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #8 from Andrew Eikum aeikum@codeweavers.com --- That looks OK, but it still needs input validation and some tests. You could also break out of the loop early if the volumes change. I'd also prefer WARN, because I think FIXME will flood normal output.
https://bugs.winehq.org/show_bug.cgi?id=44277
kakurasan@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #60122|0 |1 is obsolete| |
--- Comment #9 from kakurasan@gmail.com --- Created attachment 60140 --> https://bugs.winehq.org/attachment.cgi?id=60140 partially implement XA2SRC_SetChannelVolumes()
I added some checks for Channels and pVolumes, and changed to take the highest volume when the volumes are not the same. I think this is slightly better than doing nothing or using the lowest or the average. The coding style is also changed for XAudio2.
Andrew, is the patch still incomplete (especially input validation and tests)? If OK, I'd like to send this to wine-devel list later.
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #10 from Fabian Maurer dark.shadow4@web.de --- Well, there's still no tests.
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #11 from Andrew Eikum aeikum@codeweavers.com --- Right. You should confirm the behavior on NULL pVolumes, and tests will show what will happen if you give the wrong channel count. According to MSDN, it must be the same as the number of channels on the source voice.
https://bugs.winehq.org/show_bug.cgi?id=44277
kakurasan@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #60140|0 |1 is obsolete| |
--- Comment #12 from kakurasan@gmail.com --- Created attachment 60142 --> https://bugs.winehq.org/attachment.cgi?id=60142 work-in-progress patch
Sorry, I have no time today. Here is work-in-progress patch with some tests.
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #13 from Andrew Eikum aeikum@codeweavers.com --- We're still in code freeze for another couple weeks, so there is no hurry.
You'll probably want to validate Channels against This->fmt->nChannels, and don't forget to verify that your tests pass on the test bot before sending to wine-devel: https://testbot.winehq.org/
https://bugs.winehq.org/show_bug.cgi?id=44277
kakurasan@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #60142|0 |1 is obsolete| |
--- Comment #14 from kakurasan@gmail.com --- Created attachment 60156 --> https://bugs.winehq.org/attachment.cgi?id=60156 partially implement XA2SRC_SetChannelVolumes()
The check for Channels and related tests are fixed. All tests are passed (Test Bot Job id: 35122).
https://bugs.winehq.org/show_bug.cgi?id=44277
--- Comment #15 from Andrew Eikum aeikum@codeweavers.com --- Looks good to me! Code freeze should be over in a couple of weeks, submit it then and I'll sign-off on it. Thanks!
https://bugs.winehq.org/show_bug.cgi?id=44277
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |7ff08817758e48bd42911e56ec7 | |2c67a2bc12c5c Resolution|--- |FIXED
--- Comment #16 from Fabian Maurer dark.shadow4@web.de --- Fixed by 7ff08817758e48bd42911e56ec72c67a2bc12c5c.
https://bugs.winehq.org/show_bug.cgi?id=44277
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #17 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.1.