LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mute/unmute volume controls by LabVIEW pragramaticlly ??

Hi all,

 

Can somebody help me to figure out how I can mute and unmute different volume controls using winmm.dll. I have come across this post ( see below) that shows how to control individual volume controls but I am more interested how to mute or unmute these controls programmaticlly by calling winmm.dll. So specifically I am looking for something were I can send a Boolean true (mute ON) or false (mute OFF) that will to the task.

 

http://forums.ni.com/ni/board/message?board.id=170​&message.id=22278&requireLogin=False

 

I have been looking under "Mixercontroldetail_Boolean" under http://msdn.microsoft.com/en-us/library/aa910066.aspx but I am having very difficult time to configure it properly so that it can do its task. I would really appreciate if somebody can help me on this because I am running out of ideas.

 

Thanks

0 Kudos
Message 1 of 8
(6,964 Views)

nxb,
Have you considered using the waveOutSetVolume function inside winmm.dll, and writing '0' to mute the volume or '65535' to unmute the volume.

 

I have attached an example that achieves this functionality:

 

Mute Unmute winmm.png

 

Jared A.
Applications Engineer
National Instruments
Message 2 of 8
(6,918 Views)

Hi jallen88

 

Thanks so much for responding back to me. This is an option that I was thinking before and unfortunately it does not satisfy my goal. Here is an explanation why it would not fit properly: If I would execute your code and at the same time open up volume control in windows, executing your code would not do anything to the mute check box in volume control it would only increase or decrease the slider on the actual volume but nothing would happen to the actual mute control. My goal is to be able to check on or to check off that Mute box in volume control using winmm.dll while running LabVIEW.

Please feel free to provide any further suggestions that would help me to resolve this problem.

 

Thank you 

0 Kudos
Message 3 of 8
(6,910 Views)

The solution I was going to post is not as elegant as a simple DLL call.  In the past I've used NirCmd which is a commandline application.

 

http://www.nirsoft.net/utils/nircmd.html

 

It can do a bunch of other functions but if the DLL method works I would recommend using that.

0 Kudos
Message 4 of 8
(6,908 Views)

The link to the post is broken. Do you have the correct link?

 

I'm not sure what you mean about muting using winmm. There are no mute/unmute functions in the winmm DLL.

 

I'm also not sure what the page from MSDN that you linked to is supposed to show. That's just a datatype, not a function.

0 Kudos
Message 5 of 8
(6,898 Views)

After tinkering around with this, it seems the only way to do this with the Windows API is to use SendMessage. You can use it to send a message to the active window. Since LabVIEW won't handle the message, it will get passed up the chain, eventually reaching the shell. Note that there is no UNMUTE application command - to unmute just run the VI again. The operation acts like a toggle. 

 

The attached example is in LabVIEW 8.2.

 

NOTE: I have no idea whether this will work under all versions of Windows.

Message 6 of 8
(6,892 Views)

Hi friends:

Thanks for your attach

And I have a QUESTION that how can I get the device ID.

Thanks and Regards

 

DK John

Primary Engineer

0 Kudos
Message 7 of 8
(4,640 Views)

Hi,

You can use NI MAX to get the Device ID.

 

 

 
 
0 Kudos
Message 8 of 8
(4,620 Views)