mixer

Set ALSA master volume from C code

≡放荡痞女 提交于 2019-11-26 22:06:21
I've been looking for a simple C code example to set the master volume of the ALSA mixer but could not find anything simple for this supposedly common operation. I'm totally unfamiliar with ALSA, so making my own minimal example will take time. I would be happy if anyone could provide one. The following works for me. The parameter volume is to be given in the range [0, 100]. Beware, there is no error handling! void SetAlsaMasterVolume(long volume) { long min, max; snd_mixer_t *handle; snd_mixer_selem_id_t *sid; const char *card = "default"; const char *selem_name = "Master"; snd_mixer_open(

Can Java Sound be used to control the system volume?

风格不统一 提交于 2019-11-26 09:54:48
问题 Java Sound offers FloatControl instances for various sound line functionality, and both a MASTER_GAIN & VOLUME control type. Can these controls be used to change the system volume? 回答1: No, it cannot. Here is source adapted from an answer to Adjusting master volume on coderanch. The source iterates the available lines, checks if they have a control of the right type, and if so, puts them in a GUI attached to a JSlider import java.awt.*; import javax.swing.*; import javax.sound.sampled.*;

Getting individual windows application current volume output level as visualized in audio Mixer

你离开我真会死。 提交于 2019-11-26 08:23:30
问题 I am trying to write a C# code that outputs the current audio output level from each of the windows application accessing the sound output (as shown with constantly changing green bars of the Volume mixer). The program will check every 10 ms, and outputs sth like this: Windows Media Player: 30, Mozilla Firefox: 0, Adobe Flash Player: 35 (as per the figure) I am using Windows 7, and trying it in C# (as Java cannot achieve this). I have found ways to get and set the Master Volume (the handle

Get Master Sound Volume in c#

眉间皱痕 提交于 2019-11-26 08:19:34
问题 I need to get the current volume of the output to the sound card. Any ideas how? 回答1: You can get at these values using IAudioMeterInformation in the CoreAudio APIs in Vista and Win 7. Managed wrappers are available in NAudio (get at the AudioMeterInformation from the MMDevice). 回答2: static int PlayerVolume() { RecordPlayer rp = new RecordPlayer(); rp.PlayerID = -1; int playerVolume = rp.PlayerVolume; return playerVolume; } from modified Microphone Volume in c# article 回答3: Look in MSDN

Set ALSA master volume from C code

戏子无情 提交于 2019-11-26 08:08:47
问题 I\'ve been looking for a simple C code example to set the master volume of the ALSA mixer but could not find anything simple for this supposedly common operation. I\'m totally unfamiliar with ALSA, so making my own minimal example will take time. I would be happy if anyone could provide one. 回答1: The following works for me. The parameter volume is to be given in the range [0, 100]. Beware, there is no error handling! void SetAlsaMasterVolume(long volume) { long min, max; snd_mixer_t *handle;