Var Value As Integer //Between 0 and 100
if Value<1 then //Mute
SetSoundVolumeMBS 0
SetSoundMuteMBS True
Else //Unmute
SetSoundMuteMBS False
SetSoundVolumeMBS Value/100
end if
For example, even when value=0, I can still listen to the running music.
It’s on MacOS 12. Does it works for someone else or it’s just broken?
That’s useful. I always wonder about that and never found a definitive answer (never searched enough, either).
Same as me…
So if we have the same OS version, it shouldn’t be a permission issue
Could it be related to our configuration? Like you’re trying on the built-in speaker and I’m attempting on the Line-out, giving different results?
(the last number is the ticks, so I can monitor that the app didn’t hang. The other numbers are the properties of the WindowsAudioMixer object (code below)).
Whatever volume I set, the numbers don’t change (except the ticks).
Here’s the code, in a timer (“wam” is the WindowsAudioMixer property of the window):
if wam.DestinationDigitalMute or wam.DestinationHeadPhonesMute or wam.DestinationLineMute or wam.DestinationMonitorMute or wam.DestinationSpeakersMute or wam.DestinationTelephoneMute or wam.DestinationVoiceInMute or wam.DestinationWaveInMute or wam.SourceWaveOutMute or wam.SourceTelephoneMute or wam.SourceSynthesizerMute or wam.SourcePCSpeakerMute or wam.SourceMicrophoneMute or wam.SourceLineMute or wam.SourceDigitalMute or wam.SourceCompactDiscMute or wam.SourceAuxiliaryMute or wam.SourceAnalogMute then break
Therefore, I also get wrong results here.
For the Windows 10 tests, I tried on Boot Camp, a real PC and Parallels Desktop (32 bits there).
Does this exact code give you better results?
Plugin version=21.5, if it matters.
Could someone please try it on Windows 10 and tell me whether I’m alone with this trouble on all my computers?
I’m rather annoyed to not be trusted because it appears to work for you, Christian, but it doesn’t work on all my Windows 10 devices.
I can move the control for the app on the right side and the percent fraction changes in the app.
So the plugin can report the settings correctly.
Also I added a muted flag to show:
Sub Action() Handles Action
If wam=Nil Then wam=New WindowsAudioMixerMBS
Label1.Text="DD: "+wam.DestinationDigitalVolume.ToString+EndOfLine+"DHP: "+wam.DestinationHeadPhonesVolume.ToString+EndOfLine+"DL: "+wam.DestinationLineVolume.ToString+EndOfLine+"DM: "+wam.DestinationMonitorVolume.ToString+EndOfLine+"DS: "+wam.DestinationSpeakersVolume.ToString+EndOfLine+"DT: "+wam.DestinationTelephoneVolume.ToString+EndOfLine+"DVI: "+wam.DestinationVoiceInVolume.ToString+EndOfLine+"DWI: "+wam.DestinationWaveInVolume.ToString+EndOfLine+"SA: "+wam.SourceAnalogVolume.ToString+EndOfLine+"SAU: "+wam.SourceAuxiliaryVolume.ToString+EndOfLine+"SCD: "+wam.SourceCompactDiscVolume.ToString+EndOfLine+"SD: "+wam.SourceDigitalVolume.ToString+EndOfLine+"SM: "+wam.SourceMicrophoneVolume.ToString+EndOfLine+"SPCS: "+wam.SourcePCSpeakerVolume.ToString+EndOfLine+"SS: "+wam.SourceSynthesizerVolume.ToString+EndOfLine+"ST: "+wam.SourceTelephoneVolume.ToString+EndOfLine+"SWO: "+wam.SourceWaveOutVolume.ToString+EndOfLine+System.Ticks.ToString
If wam.DestinationDigitalMute Or wam.DestinationHeadPhonesMute Or wam.DestinationLineMute Or wam.DestinationMonitorMute Or wam.DestinationSpeakersMute Or wam.DestinationTelephoneMute Or wam.DestinationVoiceInMute Or wam.DestinationWaveInMute Or wam.SourceWaveOutMute Or wam.SourceTelephoneMute Or wam.SourceSynthesizerMute Or wam.SourcePCSpeakerMute Or wam.SourceMicrophoneMute Or wam.SourceLineMute Or wam.SourceDigitalMute Or wam.SourceCompactDiscMute Or wam.SourceAuxiliaryMute Or wam.SourceAnalogMute Then
label1.Text = label1.Text + EndOfLine+"muted!"
Break
End If
End Sub
Thanks for your answer.
That’s really weird; it clearly doesn’t work on my side.
First, I’m noticing you don’t use my example project the way I do. I don’t open the volume mixer at all, but rather change the overall volume using standard volume keys on the keyboard. Does this make any difference?
I’ll try using the volume mixer, just to see, but it won’t suit my needs.
The strange thing is, I’ve tried on several computers (1 physical Windows 10 laptop, 1 MacBook Air with Boot Camp (Windows 10) and 1 virtual machine (Parallels Desktop, Windows 10 32 bits)) and they all show only zeroes for all fields and won’t detect muting (again, using the keyboard’s volume keys).
These systems are all up to date; yours are too? (I’m thinking perhaps you tried on an not updated system; that would perhaps explain the difference?).
It’s disappointing when all tests one makes show (prove) a thing but someone else gets different proofs; it makes me looking like a liar or such, but I’d hate to lie. That’s why I have to find what’s going on.
Thanks again.
You are certainly right, that it doesn’t work well for you.
I think this class using the old mixer interface from Windows may have worked years ago, but now in Windows 10 it seems to only control sound within the application.
Thanks for your replies and explanations.
Dead end, then. I’ve already searched several times and only found similar, unanswered, questions or answers I can’t coerce in Xojo code.
After checking its documentation, it seems NirCmd, albeit having a lot of features, can only set the sound volume, not get and report it. And that’s what I’m looking for.
Thanks anyway.