Mute system from code

跟風遠走 提交于 2019-12-08 08:16:12
问题 I'm trying to mute the PC speaker from my C# console application. I've tried the code suggested on this site and it doesn't affect the volume on my machine. I need the code to work on Win7 and I assume that code only works on XP. I also tried this: [DllImport("winmm.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] public static extern int waveOutSetVolume(IntPtr uDeviceID, int dwVolume); waveOutSetVolume(IntPtr.Zero, 0); But when the waveOutSetVolume method is called,

Batch: list available hard drives and work with chosen option

坚强是说给别人听的谎言 提交于 2019-12-08 06:17:25
问题 I would like to list all available, removable hard drives in a batch script and continue to work with the chosen option. I know there are options like wmic logicaldisk get caption,volumename to list the hard drives and SET /P M=Type 1 or 2 then press ENTER: IF %M%==1 GOTO One IF %M%==2 GOTO Two to create a menu. But how do I store the volumes in variables and list them in a menu? Something like: Choose from list: 1) D:\Harddrivename1 2) E:\Harddrivename2 Enter option: 2 Any help is

Docker compose. The volume inside another volume on the same container. How does it work?

◇◆丶佛笑我妖孽 提交于 2019-12-08 05:11:12
问题 I'm trying to create a relatively simple setup to develop and test npm packages. A problem was in the fact, that after you mounted a code volume to the container it replaces node_modules. I tried a lot of generally logical stuff, mostly aimed to move node_modules to another location and then reference it within configuration files. It works, but the solution is ugly. Also, it's not good practice to install webpack globally, but my solution requires it. However, after some time I found this

Setting iOS MPMusicPlayerController volume relative to AVAudioPlayer

纵然是瞬间 提交于 2019-12-08 04:35:51
问题 I have an app that plays background music using MPMusicPlayerController and foreground sounds using AVAudioPlayer. I want to control the relative volume so that MPMusicPlayerController is much lower, but setting the volumne changes the overall system volume as if using the buttons on the side of the phone. Is there way to lower the volumne of MPMusicPlayerController without lowering the system volume? MPMusicPlayerController *musicPlayer = [MPMusicPlayerController applicationMusicPlayer];

Set volume of Java Clip

我是研究僧i 提交于 2019-12-08 04:16:07
问题 Is there any way to set the respective volume of a Clip in Java ? I have this method: public static void play(Clip clip) { if (Settings.getSettings().isVolumeOn()) { FloatControl volume = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN); volume.setValue(-1 * Settings.getSettings().getVolume()); clip.start(); } } The Settings.getSettings().getVolume() returns an Integer in the range of 0 - 100 Volumes: 0 : No Sound 40 : Optimal Sound with headphones 60 : Optimal Sound 100: Full

Detecting when a volume is mounted in Windows with Delphi

你。 提交于 2019-12-08 03:31:06
问题 I am trying to understand the documentation at MSDN regarding Device Events and how to trigger a notification whenever a volume has been mounted. I have managed to do this for USB devices using information presented in the following post: detect usb drive/device using delphi as well as other information found on the internet, but I have noticed that it would be easier to detect when a volume has been mounted directly. So my question is: how do I implement Device Events handling in my Delphi

Android setStreamVolume for STREAM_RING doesn't always work while RINGING

末鹿安然 提交于 2019-12-07 22:49:47
问题 I am trying to do this simple App that allows the phone to ring but not to play a sound when receiving notifications under Android 4 (ICS). In order to do that I set the ring/notification stream to 0 (mute). When receiving a call I set the ring volume to max (p.e. 7) and then, on Idle, I turn it back to 0 (mute). To do that I use this simple code. public class ReceiverClass extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if ("android.intent.action

Control Volume in vb.net

邮差的信 提交于 2019-12-07 19:39:26
I need to control the main computer volume in vb.net. I have searched the web and tried all the examples I could find. None of the have worked. Does anyone have some snippets of code that work with vb.net 2010 to control volume? Thanks giodamelio I know this question is really old, but this worked

How to change volume with Python?

被刻印的时光 ゝ 提交于 2019-12-07 18:23:11
问题 I'm writing a program to wake me up mornings, but I want my program to play alarm sound as loud as its possible. so it needs to raise up volume to 100%. but I don't know how. I'm using python3 on macOS Sierra. 回答1: You can control the volume of your computer with Applescript: set volume output volume 100 To execute Applescript from python you can use py-applescript which can be installed with sudo easy_install py-applescript . The following script will set the volume: import applescript

Surface mesh to volume mesh

99封情书 提交于 2019-12-07 16:27:30
问题 I have a closed surface mesh generated using Meshlab from point clouds. I need to get a volume mesh for that so that it is not a hollow object. I can't figure it out. I need to get an *.stl file for printing. Can anyone help me to get a volume mesh? (I would prefer an easy solution rather than a complex algorithm). 回答1: Given an oriented watertight surface mesh, an oracle function can be derived that determines whether a query line segment intersects the surface (and where): shoot a ray from