Small programs in C# and control of volume

How to control system volume in C#

Page 1 of 1

6 Replies - 11437 Views - Last Post: 21 December 2009 - 07:04 AM Rate Topic: -----

#1 KarlJay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-May 09

Small programs in C# and control of volume

Post icon  Posted 20 December 2009 - 07:34 PM

I've written a small program that's a simple timer to shut down the computer as a set time, I'm kinda new to .net. I used to be able to make a small .exe and copy it to a computer and run it. Can you still do this with VS2005 or do you have to make a full distribution setup? This is really just a small utility program for personal use. I'd also like it to be a tool bar / background type program like the virus scanners do (just rest down in the shortcut/toolbar.

Question 2: I'm watching TV over the net, some commercials are VERY loud and I'm looking for a way to control the system volume. In order to hear the TV, I have to turn up the speakers, then when it gets to a commercial, it blasts at me. I'd like to set a max volume to keep it level, is there any way to do this?

Thanks, KarlJay
VS2005 C#, WinXP/Vista

Is This A Good Question/Topic? 0
  • +

Replies To: Small programs in C# and control of volume

#2 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Small programs in C# and control of volume

Posted 21 December 2009 - 12:55 AM

1. answer: You can still do this with Visual Studio 2005, 2008 and 2010 :-) You executable file is in applications ../bin/debug or ../bin/release folder (depends on how you compile your application).

2. it is possible to like minimize your running application and sent it to system tray where it is running until terminated or user shuts down a computer.

3. I believe there is a solution to this, but this is beyond the scope of my knowledge.


Hope this helps.
Was This Post Helpful? 0
  • +
  • -

#3 remorseless  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 29
  • View blog
  • Posts: 129
  • Joined: 08-August 09

Re: Small programs in C# and control of volume

Posted 21 December 2009 - 04:12 AM

You can still run the application you have created, but you need to debug it first I believe. It'll be found in your ../bin/Debug or ../bin/Release folders just like FlashM said. The .exe file should be there and you just double click it and it is ready to go ;)

Secondly, you can hide the form from the user and still have it running in the background, and you can use a NotifyIcon and a ContextMenu with options for it to maximize again, sort of like how Windows Live Messenger works. (e.g. Has a menu when you right click on the icon, and if you double click it would maximize)

Lastly, I have no idea how to do that, and I'm not too sure anyone who is not skilled enough at C# or the .Net Framework could do it. I have found a tutorial by PsychoCoder on how to control volume, but I don't think that it's what you're looking for. I'll link it to you anyway.
http://www.dreaminco...wtopic45693.htm Have a read of it and see if it helps you.

Hope I helped :^:
Was This Post Helpful? 1
  • +
  • -

#4 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Small programs in C# and control of volume

Posted 21 December 2009 - 04:28 AM

Some useful text on getting and setting volume in Windows can be found here:
http://www.geekpedia...und-volume.html

But the other part of detecting the loudness of the playing media will be another task which I have no idea how to do.
Was This Post Helpful? 0
  • +
  • -

#5 Shane Hudson  Icon User is offline

  • D.I.C Technophile
  • member icon

Reputation: 343
  • View blog
  • Posts: 1,286
  • Joined: 06-December 09

Re: Small programs in C# and control of volume

Posted 21 December 2009 - 04:48 AM

This idea intrigues me. I had never thought of setting a "maximum" volume before but I can see how it could be very useful. I shall watch this thread in hope that somebody with a bit more knowledge than myself will come along!
Was This Post Helpful? 0
  • +
  • -

#6 crepitus  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 84
  • View blog
  • Posts: 383
  • Joined: 08-September 09

Re: Small programs in C# and control of volume

Posted 21 December 2009 - 05:57 AM

View PostKarlJay, on 21 Dec, 2009 - 01:34 AM, said:

I'm watching TV over the net, some commercials are VERY loud and I'm looking for a way to control the system volume. In order to hear the TV, I have to turn up the speakers, then when it gets to a commercial, it blasts at me. I'd like to set a max volume to keep it level, is there any way to do this?


Hmm: House votes to turn down volume of noisy TV ads. Wrong country for me...

Some media players have the option built in to perform "Dynamic range compression". I'd first look to see if you can find it as an option. There's some software at the bottom of that wikipedia page too.

The volume apis have changed their behaviour since Vista. I'm not sure how you would go about doing what you suggest. Maybe you can hook into the level meter that shows to get the currently playing loudness, and then set it for the application itself.

The approach might not work though. See what the folk over at reddit had to say about how the volume levels are only perceived as being louder - the peak level doesn't change:
http://www.reddit.co...ouder_than_the/
Was This Post Helpful? 0
  • +
  • -

#7 lesPaul456  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 173
  • View blog
  • Posts: 729
  • Joined: 16-April 09

Re: Small programs in C# and control of volume

Posted 21 December 2009 - 07:04 AM

Quote

I'd also like it to be a tool bar / background type program like the virus scanners do (just rest down in the shortcut/toolbar.


You could create an application that utilizes the NotifyIcon class, or you can just create a windows service...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1