Reputation: 47
I'm making a program in c++ that reads Morse Code and prints it to the terminal, and gives the user the option to hear it. I know that, in order to make a "beep," you can use:
cout<<'\a';
However, since Morse Code contains with longer and shorter beeps, I would like to know how to make longer beeps than what would be produced by this command.
I'm using a Mac.
Upvotes: 1
Views: 1019
Reputation: 9444
If you write multiple bells. i.e. cout << "\a\a\a\a"
it will come out as a longer beep.
However you also need a way to write the "silence"
between the beeps, and the bell sound may be different from one environment to another, so this is not really a good approach.
There is no standard library support for controlling sound on the computer, but if you look for platform-specific functionality, you are likely to find it, and ultimately this will give much better results.
Upvotes: 1