?
Solved

Keypad beeping

Posted on 2011-02-15
10
Medium Priority
?
431 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
Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

 

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 400 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 400 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 200 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 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