c#里音量控制
来源:互联网 发布:java单点登录sso例子 编辑:程序博客网 时间:2024/04/29 15:18
ppc平台下把winmm.dll换成coredll.dll
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace VolumeControl
{
public partial class Form1 : Form
{
[DllImport("winmm.dll")]
public static extern int waveOutGetVolume(IntPtr hwo, out uint dwVolume);
[DllImport("winmm.dll")]
public static extern int waveOutSetVolume(IntPtr hwo, uint dwVolume);
public Form1()
{
InitializeComponent();
// By the default set the volume to 0
uint CurrVol = 0;
// At this point, CurrVol gets assigned the volume
waveOutGetVolume(IntPtr.Zero, out CurrVol);
// Calculate the volume
ushort CalcVol = (ushort)(CurrVol & 0x0000ffff);
// Get the volume on a scale of 1 to 10 (to fit the trackbar)
trackWave.Value = CalcVol / (ushort.MaxValue / 10);
}
private void trackWave_Scroll(object sender, EventArgs e)
{
// Calculate the volume that's being set
int NewVolume = ((ushort.MaxValue / 10) * trackWave.Value);
// Set the same volume for both the left and the right channels
uint NewVolumeAllChannels = (((uint)NewVolume & 0x0000ffff) | ((uint)NewVolume << 16));
// Set the volume
waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels);
}
}
}
- c#里音量控制
- c#里音量控制
- c#音量控制
- C# 控制PPC音量
- C#控制音量
- C# 控制音量大小
- C# 按钮控制windows音量
- C#控制音量、实现摄像头
- c# 控制音量大小 CoreAudioApi
- C# 控制音量 (滚动条形式)
- C#控制音量、实现摄像头(荐)
- 在HGE里添加音乐,并实时控制音量
- 在HGE里添加音乐,并实时控制音量
- 音量控制
- c# Winform 获取麦克风音量 控制麦克风音量大小 (自用笔记未测试)
- [翻译]VISTA音量控制
- 12.1.7 控制音量
- VISTA音量控制
- 最令PHP初学者头痛的十四个问题
- C#可否对内存进行直接的操作
- 的的等待
- Boox Viewer安装
- LINUX
- c#里音量控制
- 文件服务器 文件夹带权限移动工具--FSMT
- C#中通过DllImport使用 Win32 API
- 硬盘基本知识
- 第一天
- RFI/RFP/RFQ的区别
- Window API函数大全(一)
- 嵌入式linux系统的启动过程[转载]
- mbr 全面分析(附带计算机引导顺序)