开发者

Can I change the volume/mute the microphone from foxpro?

开发者 https://www.devze.com 2023-02-16 05:46 出处:网络
I have been reading examples in other pro开发者_StackOverflowgramming languages for a couple of days now but I haven\'t managed to translate them into visual foxpro. Has anyone done it before and coul

I have been reading examples in other pro开发者_StackOverflowgramming languages for a couple of days now but I haven't managed to translate them into visual foxpro. Has anyone done it before and could provide me with a working example? Thank you!


Checkout following function in Foxpro,

DECLARE INTEGER waveOutSetVolume IN winmm;
    INTEGER hwo,;
    INTEGER dwVolume

Also check the documentation here,

http://www.news2news.com/vfp/?group=-1&function=675

I hope it helps.


For Windows Vista and up, audio device volume/mute -- that includes both playback and recording devices (e.g. microphone) -- can be set via calling methods of several Windows Core Audio interfaces. Examples are IAudioEndpointVolume::SetMute and IAudioEndpointVolume::SetMasterVolumeLevel.

While one cannot call these methods directly from Visual FoxPro, it is possible to wrap this functionality in FLL or in ActiveX control. The former of which I developed in November 2013.

This is how to mute the default recording device.

SET LIBRARY TO AudioDeviceLib.fll 
adl_SetOperationScope(0) && global volume
adl_SetFlowMode(1) && recording device
adl_SetMute(.T.) && mutes the device

This is how to set the default recording device's volume to 50%.

adl_SetVolume(0.5)

The described FLL library also allows enumerating audio devices, getting and setting the default device, getting and setting volume and mute states, operates with channels, and plays WAV sounds.

While the library is not a freeware, its demo version is fully functional. Again please note that it requires at least Windows Vista to run.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号