Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActGlobals.oFormActMain.TTS does not reset audio volume #60

Open
xpdota opened this issue Jan 11, 2023 · 4 comments
Open

ActGlobals.oFormActMain.TTS does not reset audio volume #60

xpdota opened this issue Jan 11, 2023 · 4 comments
Labels
limitation May be impossible to fix due to design limitations

Comments

@xpdota
Copy link

xpdota commented Jan 11, 2023

  1. Open ACT, navigate to sound settings, set Wav Vol to 20% and TTS Vol to 100%
  2. Call ActGlobals.oFormActMain.TTS("something"), observe it is at full volume
  3. Call ActGlobals.oFormActMain.PlaySound("some_file.wav"), observe it has the correct reduced volume
  4. Call the TTS method again - now, it still has the reduced volume from WAV (and the windows volume mixer still shows the reduced volume)

This also happens if you call ActGlobals.oFormActMain.PlaySoundMethod(file, volume), and the issue persists until you either go into volume mixer and reset the level manually, or you call PlaySoundMethod with a new volume level.

Reading through PlaySound, the if statement involving "sapi.wav" makes it seem like this should work.

@EQAditu
Copy link
Owner

EQAditu commented Jan 13, 2023

The real problem is that the WMP API is the thing that is changing the mixer volume. When I started using it, I thought it had an internal mixer and did not realize it modified the Windows mixer for the host program. This should have the side effect of changing the volume of one sound mid-way through if the types change. Obviously this isn't great.

I'm suspicious that this reported issue is also related to how WMP alters the Windows Mixer and does it haphazardly. Other sound APIs do not change the host process mixer volume.

I imagine using TTS in SAPI direct mode should not have this bug occur because WMP will no longer be called for TTS at all.

@xpdota
Copy link
Author

xpdota commented Jan 13, 2023

I think this bug wouldn't happen in SAPI mode regardless because of this:

        if (pszSound.EndsWith("sapi.wav"))
          this.PlaySoundMethod(pszSound, this.opSound.tbarTtsVol.Value);
        else
          this.PlaySoundMethod(pszSound, this.opSound.tbarWavVol.Value);

If this works how I think it does, TTS is supposed to set the volume to the selected TTS volume setting, but this code path is only used when playing TTS via SAPI?

@EQAditu
Copy link
Owner

EQAditu commented Jan 13, 2023

Direct SAPI does not use PlaySound() at all... so WAV files would go to the else.

@EQAditu
Copy link
Owner

EQAditu commented Jan 14, 2023

This and other problems would be fixed if ACT no longer used WMP as the default sound engine. ACT does not change the volume mixer, the WMP API does.

WMP API was attractive because it was preinstalled on every version of Windows. There may be newer options that are similarly ubiquitous, but I would have to do a bit of research.

@EQAditu EQAditu added the limitation May be impossible to fix due to design limitations label Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
limitation May be impossible to fix due to design limitations
Projects
None yet
Development

No branches or pull requests

2 participants