Solved

Keypad beeping

Posted on 2011-02-15
10
425 Views
Last Modified: 2013-12-17
Hi,

During download file, I'd like the keypad beeping by writing C#
program. But I don't know how, could you give me a hand?
Thanks,
JT
0
Comment
Question by:jtran007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 9

Expert Comment

by:s_chilkury
ID: 34903720
Playing Beep :

public void playBeep()
{
    SystemSounds.Exclamation.Play();
}

Playing custom sound:

private void playCustomSound()
{
    SoundPlayer simpleSound = new SoundPlayer(@"c:\Windows\Media\chimes.wav");
    simpleSound.Play();
}
0
 
LVL 30

Expert Comment

by:anarki_jimbel
ID: 34903756
You may need to add name spaces like System.Media.

You can utilize the namespace and its SystemSound and SystemSounds classes (http://msdn.microsoft.com/en-us/library/system.media.systemsound.aspx)

The SystemSounds class contains five static properties that you can use to retrieve instances of the SystemSound class. This class in turn contains the Play() method, which you can use to play the wave file associated with the sound in Windows Control Panel. Note that the user can also disable all sounds altogether, which would mean that no sound can be heard through the computer speakers.

To play for example the classical beep sound, you could use the following code:

System.Media.SystemSounds.Beep.Play();
Similarly, you could play the “Question” sound with this code:

System.Media.SystemSounds.Question.Play();
The System.Media namespace is defined in System.dll, so there are no new DLLs you would need to add to your project’s references to use the above code.
0
 
LVL 30

Expert Comment

by:anarki_jimbel
ID: 34903786
0
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

Author Comment

by:jtran007
ID: 34903875
Hi,

Thanks, but how can I play it continuously until my file download is completed.

Regards,
JT
0
 
LVL 11

Assisted Solution

by:SAMIR BHOGAYTA
SAMIR BHOGAYTA earned 100 total points
ID: 34904534
Hi, use this code

//First add reference 'Microsoft.VisualBasic.DLL' to the project.
//then include
using Microsoft.VisualBasic.Devices;
//Now

Audio myAudio = new Audio();

myAudio.Play(@"d:\abc.wav");
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 100 total points
ID: 34908679
>>  Thanks, but how can I play it continuously until my file download is completed.

You're going to have to spawn a separate thread. You might want to take a look at BackgroundWorker (http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx) or ThreadPool (http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx).
0
 
LVL 30

Assisted Solution

by:anarki_jimbel
anarki_jimbel earned 50 total points
ID: 34913329
I'd use wav player (see reference above), use PlayLooping mode, detect when dowloading completes (it depends, I don't know how you download - just handle events, I believe), then call player.stop:

http://msdn.microsoft.com/en-us/library/system.media.soundplayer.aspx

0
 

Accepted Solution

by:
jtran007 earned 0 total points
ID: 34914519
Hi ,

Since I have a background thread handling download file, and I prefer the playing sound thread
not interferering with the background process. So which approach is the best way.

Thanks for your input.
JT
0
 

Author Comment

by:jtran007
ID: 34940290
Hi,

Sorry I still don't know how to stop the sound even at the end of uploading file, I stop the
background task where I play sound in the loop. But the sound keeps playing. Please help.

Thanks,
JT
0
 

Author Closing Comment

by:jtran007
ID: 34968331
Thanks,
JT
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question