beep

How to cancel the timer and renew the same timer?

走远了吗. 提交于 2019-12-02 05:46:35
I am creating an app that vibrate and beep every 30 sec and when I log out the vibrate and beep must be cancelled and when I log in the vibrate and beep should resume. NOTE: it must vibrate and beep for every 30 sec until I log out In my app I am using TimerTask for this implementation this is the code for vibrate and beep using TimerTask static TimerTask Task; final static Handler handler = new Handler(); static Timer t = new Timer(); public static void vib() { Task = new TimerTask() { public void run() { handler.post(new Runnable() { public void run() { Vibrator vibrator = (Vibrator)

Strange beep when using cout

喜欢而已 提交于 2019-12-01 18:07:25
today when I was working on some code of mine I came across a beeping sound when printing a buffer to the screen. Here's the mysterious character that produces the beep: '' I don't know if you can see it, but my computer beeps when I try to print it like this: cout<<(char)7<<endl; Another point of interest is that the 'beep' doesn't originate from my on board beeper, but from my headphone/speaker Is this just my computer or there something wrong with the cout function? EDIT: But then why does printing this character produce the beep sound? does that mean that I could send other such characters

Playing beep in C++ (Linux) [duplicate]

天涯浪子 提交于 2019-12-01 08:57:00
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Beep on Linux in C I have been looking for a way to play a simple beep in Linux, but all what I found don't work. I've tried the \a, \b \7 but anyone play the beep. I would like to play it without the use of sound libraries, later I will change the beep for a real sound using any library, but right now I'm only interested in play a beep for testing purposes As I said, I'm using Linux (exactly LMDE) so the

Java equivalent of C# system.beep?

十年热恋 提交于 2019-12-01 02:07:59
I am working on a Java program, and I really need to be able to play a sound by a certain frequency and duration, similarly to the c# method System.Beep, I know how to use it in C#, but I can't find a way to do this in Java. Is there some equivalent, or another way to do this? using System; class Program { static void Main() { // The official music of Dot Net Perls. for (int i = 37; i <= 32767; i += 200) { Console.Beep(i, 100); } } } I don't think there's a way to play tunes 1 with "beep" in portable 2 Java. You'll need to use the javax.sound.* APIs I think ... unless you can find a third

How to beep using PC speaker?

江枫思渺然 提交于 2019-11-30 15:11:22
问题 I want to make a beep sound using PC speaker in C#. When using the following code: [DllImport("kernel32.dll", EntryPoint = "Beep", SetLastError = true, ExactSpelling = true)] public static extern bool Beep(uint frequency, uint duration); static void Main() { while (true) { Beep(1000, 500); Thread.Sleep(2000); } } instead of beeping through the PC speaker, it simply outputs a sound of a given frequency and duration to the default sound device (as a headset for example). The same thing happens

Java equivalent of C# system.beep?

断了今生、忘了曾经 提交于 2019-11-30 00:57:40
问题 I am working on a Java program, and I really need to be able to play a sound by a certain frequency and duration, similarly to the c# method System.Beep, I know how to use it in C#, but I can't find a way to do this in Java. Is there some equivalent, or another way to do this? using System; class Program { static void Main() { // The official music of Dot Net Perls. for (int i = 37; i <= 32767; i += 200) { Console.Beep(i, 100); } } } 回答1: I don't think there's a way to play tunes 1 with "beep

How to make the hardware beep sound in Mac OS X 10.6

放肆的年华 提交于 2019-11-29 19:02:07
I just want that Mac OS X 10.6 does a hardware beep sound like in open suse and other distributions. I tried following approaches Terminal -> beep = -bash: beep: command not found Terminal -> say beep = voice speaks out beep (Not a Hardware beep but awesome ;) ) applescript -> beep = Macintosh bell (I want a Hardware beep!) Does anybody know how to make the Hardware beep in bin/bash or applescript? There is no "hardware beep" in macOS. The functionality you're thinking of is an artifact of very old (pre-1990s) IBM PC-compatible hardware. Before most computers had sound cards, most machines had

Play sound on internal speakers and possibility to use old xp api function?

北战南征 提交于 2019-11-29 17:11:35
After the release of windows vista the Windows Function Beep plays a beep on your connected speakers instead of the internal one. Is there anyway to access the old function? Would it be possible by getting hold in an older windows api? Or is there any other way i can make this possible? If so i would like the ability to set both the frequency and duration. I should mention that I´m actually targeting the windows xp platform. No. The function is implemented in a Kernel32.dll, which is loaded at runtime from whatever version of the OS you're currently running. Since the code isn't there in

Is there a way to play a system beep on Mac OS?

南楼画角 提交于 2019-11-29 14:15:24
Is there a way to play a system beep on Mac OS using C++ and Xcode? I understand that I need to use a library. Is there a library that works across both the Mac and Windows platforms? I think you probably want to use NSBeep . NSBeep Plays the system beep. #include <AppKit/AppKit.h> void NSBeep (void); This seems to work OK for a command line tool: #include <AppKit/AppKit.h> #include <iostream> using namespace std; int main(void) { cout << "Hello world !" << endl; NSBeep (); return 0; } $ g++ -Wall -framework AppKit beep.cpp -o beep $ ./beep The cross platform way to play a beep is std::cout <<

C#: Produce a continuous tone until interrupted

孤街醉人 提交于 2019-11-29 08:13:39
I have a device that a user interacts with alongside of a C# WPF program. This program must beep when the user presses a button on the device, for either a specified amount of time or for as long as the user presses the button, whichever is shorter. The only speaker available to produce the beep/tone is the computer BIOS speaker; we cannot assume that other speakers are around (and it's actually safe to assume that there won't be any other speakers). How can I produce a continuous tone for the necessary duration? What I have so far produces lots of beeps, but not a continuous tone. First, a