PDA

View Full Version : کم و زیاد کردن صدا



sarnev6t
جمعه 13 اردیبهشت 1387, 23:26 عصر
چطور میشه صدای سیستم را کم و زیاد کرد؟

smt_414
جمعه 13 اردیبهشت 1387, 23:50 عصر
سلام

این سوال قبلا هم مطرح شده با جستجو ( عنوان سوال) جواب رو پیدا می کنید

موفق باشید

sarnev6t
شنبه 14 اردیبهشت 1387, 23:47 عصر
http://barnamenevis.org/forum/showthread.php?t=73702

http://barnamenevis.org/forum/showthread.php?t=76082

?????????????????

sarnev6t
یک شنبه 15 اردیبهشت 1387, 15:20 عصر
دوست عزیز که گفته بودی جستجو کن! من قبل زدن این تاپیک جستجو کرده بودم ولی نتجه ای نداشت اما اگه قبلا در این مورد صحبت شده من چیزه به درد بخوری پیدا نکردم!:چشمک:
لطفا لینکشو بگید!

smt_414
یک شنبه 15 اردیبهشت 1387, 18:18 عصر
سلام

همونطور که گفته بودم

این سوال قبلا هم مطرح شده با جستجو ( عنوان سوال) جواب رو پیدا می کنید

این یه دونش
http://barnamenevis.org/forum/showthread.php?t=68289&referrerid=15482
البته شاید جز اون تعداد باشه

اگه قبلا در این مورد صحبت شده من چیزه به درد بخوری پیدا نکردم!

موفق باشید

sarnev6t
یک شنبه 15 اردیبهشت 1387, 22:37 عصر
دوست عزیز نمیدونم چه اصراری داری من جستجو کنم با وجود اینکه من چندین بار این کارو کردم!
من میدونم این موضوع قبلا مطرح شده اما من جوابی ندیدم! (پست 3+پست 6 شما)
شاید من دنبال لقمه ی آماده میگردم و همین مشکل ایجاد میکنه!!!!:بامزه:
گذشته از این حرفها خداییش من چیزی از این 3 تا لینک دستگیرم نشد!!

smt_414
یک شنبه 15 اردیبهشت 1387, 23:09 عصر
سلام

چه اصراری داری من جستجو کنم

اصراری ندارم ، دیدم کسی جوابی نداده ،گفتم جستجو کنید شاید سریعتر به جواب برسید



چطور میشه صدای سیستم را کم و زیاد کرد؟

البته یه ذره هم سوالتون کلی، اگه دقیقتر بگید شاید فرجی بشه

موفق باشید

razavi_university
دوشنبه 16 اردیبهشت 1387, 01:32 صبح
دوست عزيز اين لينك (http://www.geekpedia.com/tutorial176_Get-and-set-the-wave-sound-volume.html) كه با عكس و مثال و كد و ... لقمه رو واسه شما آماده كرده :کف:
پس چرا ناشكري مي‌كنين و مي‌گين چيزي از جستجو بدست نيومد:متعجب:

sarnev6t
دوشنبه 16 اردیبهشت 1387, 05:27 صبح
دوست من متاسفانه سرور من ف ی ل ت ر کرده!!!
قبلا رفته بودم!!

hassan razavi
دوشنبه 16 اردیبهشت 1387, 07:39 صبح
با تشکر از جناب رضوی (نمیدونم چرا کلید تشکر من امروز صبح نیستش !)

razavi_university
دوشنبه 16 اردیبهشت 1387, 13:21 عصر
نمي دونم اين ISP ها بيكارند هرچي دم دستشون مي رسه مي بندند
براي دوستاني كه نتونستند به اين لينك (http://www.geekpedia.com/tutorial176_Get-and-set-the-wave-sound-volume.html)دسترسي داشته باشند


You will learn how to retrieve and change the current wave volume of the sound card by using waveOutGetVolume() and waveOutSetVolume() from the unmanaged Windows API in C# through P/Invoke.


http://www.geekpedia.com/pics/vstudio/VS2005%20Icon.gif Download this project (http://www.geekpedia.com/sample/Volume%20Control/VolumeControl.zip) (Visual Studio 2005)


http://www.geekpedia.com/pics/VolumeControl/Volume%20Control.gif



The .NET Framework has a multitude of methods you can use to retrieve and set different system settings, however controlling the output volume of the soundcard is not one of them. As a result, we will have no other option than to call the unmanaged Windows API, more exactly the waveOutGetVolume() and waveOutSetVolume() functions from the winmm.dll library.


Start by creating a Windows Application project inside Visual Studio 2005. You can use Visual Studio 2003 just as well, only that the project attached to this tutorial was created inside Visual Studio 2005.
Inside the Windows Application form, place a label and TrackBar object entitled trackWave which we'll use to change the sound volume.


http://www.geekpedia.com/pics/VolumeControl/TrackBar%20Object.gif


The form with its label and trackWave TrackBar should look similar to the following:


http://www.geekpedia.com/pics/VolumeControl/Volume%20Control%20Form.gif


You can, by the way, change the orientation of the TrackBar object to vertical so that it looks like the one in the popular Volume Control Windows application, using the Orientation property. There's no need to change other properties of the TrackBar control - the Minimum and Maximum properties should be left to their default values, 0 and 10 respectively. This will give us 10 steps to control the volume of the wave sound. Obviously, you can later tweak this to your preference, in case you want to give the user the possibility of a finer volume level adjustment.


Switch to code view, and add the following using directive, since we'll be calling an unmanaged DLL:



using System.Runtime.InteropServices;



Now that we have this using statement in place, we can call the two functions from the winmm.dll. This DLL is located in the Windows System32 directory and has a size of about 172 KB.



[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);



Now we are ready to make function calls, but unlike other Windows API calls, these two are a little more difficult and we need to do a few calculations before being able to get and set the volume.


To make our application work correctly, the first thing we need to do is retrieve the current sound volume level and set it on our TrackBar (trackWave), otherwise it will always stay at its default value of 0. We want to do that when the application loads, so that the user immediately sees a well adjusted TrackBar when the application has started.
Thus, inside the constructor of our form (Form1()) right after InitializeComponent() place the following lines of code:




// 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);



At this time you can compile the application, and you should see the trackbar adjusted to your current wave volume level.
Now we are ready to change the volume using waveOutSetVolume(). We will do that in the Scroll event of trackWave (the TrackBar). To get to that event handler, you can simply double click the control in the form designer. Now inside the trackWave_Scroll() event handler, use the following lines of code:




// 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);



Now you should be able to compile the application successfully and move the trackbar to adjust the wave volume.


Here is the complete code of Form1.cs, in case you want to have an overall look:




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);
}
}
}



منبع: همون لينك بالايي

sarnev6t
سه شنبه 17 اردیبهشت 1387, 21:54 عصر
آقایون رضوی از هر دو شما متشکرم !
(به خدا من اول سرچ میکنم بعد سوال میپرسم)
خیلی خوب و مفید بود!!