how to pause and play sound - c

Hey all I want to play a sound. I issue a c command and it plays the sound, then the user presses a key, let's say "h" and then the sound stops for 5 seconds, and returns after 5 seconds. What c command can i use to do this? I thought mci send string might work, but I'm not sure.
Play Sound was my go to but it doesn't have this functionality.
any code suggestions?

I assume you are using Windows
Use the waveOutPause() to pause the audio.
Use Sleep(5000);
Use the waveOutRestart() to start the audio from where it paused.
See also: waveOutPause MSDN documentation

Related

How to loop audio clip in unity infinitely

I set my audio clip to loop (by checking off the loop checkbox in the audio source) however, after about an hour the audio stops playing. How do I fix this? Is there code that I have to add to the script?
Apparently the loop function is not indefinite.. not too sure about this.
Thank you!!
If your sound file is an .mp3, try changing it to an .ogg file. Unity seems to have some problems with .mp3.
Also, it could be simply be a lack of computing resources to run in play mode that long. Try building your application and seeing if the error still occurs.

IRC(Twitch chat) Text-to-speech

Hey everyone I'm looking for a way to code a program/bot in VB that would read my chat, but only if a command is used
For example: "!tts Hello"
And It would read it using TTS and show it on screen
$USERNAME$ !tts: Hello
Now the thing I don't know how to set up is the program reading the chat, printing it on screen I believe is the easy part.
Also if it's possible to add an option to select to which audio output it will go.
You need to study more coding...
Im not a master at it myself. but i would make a boolean that could be true if the first letter in a chatline is a "!". And then a command that would add that line to a text-to-speech module

How to show a long usage information with "Press any key to continue" message?

Sorry, this might be a simple question, but I can't find a solution to that. I have a console application, which has several parameters. I show a usage information, how to use the application correctly, but since I have to explain each parameter it is very long. The whole usage won't fit in the console window.
So how can I display only that much from the usage which fits to actual window size?
A good example is cmd. If you open a command prompt, and then type cmd /? the usage information will be shown, but it will only show that much of the usage which will fit to the actual window size, and then waits for a keypress. If the window is small, you have to press a key 7 times. But if you make the console window bigger you have to press a key less.
So my question, how can I achieve this?
I don't know how you would execute it, but what you need is a pager.
I haven't tested it, but here it says the more command is available in MS-DOS and most Windows versions (Windows 95, 98, ME, NT, 2000, XP, Vista, 7 & 8).
If you were running it standalone, you'd do echo some-long-text | more. I don't know how you'd use this from your own program, but that should be the way (I imagine there should be something like POSIX's system() syscall to run a command).

Bat file is not running untill any key pressed from keyboard

My computer has a different problem.
Whatever the batch file i run, it won't starts its execution until i press any key from keyboard until that it holds the data without printing on console/command prompt.
once i press a key the execution starts.
Again somewhere else it does the same thing then i need to repeat the same.
My Operating System is Windows 7 Ultimate 64 bit.
I looked in the internet for solution. but strangely it seems like no one got this problem.
Can anyone please provide me a solution for this?

Animate console graphics without Curses

I have been using the SoX play command line tool to playback audio files from the console, and have noticed that there is a nice little display of the time info and left/right levels that update in real time with the audio source . . .
Screenshot from SoX homepage
However, after cloning the source, I could not find any mention of Ncurses. Does anyone know how SoX achieves this neat little console trick? I just don't know what to look for, or which file to look in to see how this is implemented.
I doubt it's merely using the \b character. My guess would be that it's using the terminal cursor movement commands, which are a set of escape sequences supported by many (but not all) Linux terminals.
You can even use these straight from the command line using echo. For instance:
$ s=($(stty size)); echo -en "\e[2J\e[$((s[0]/2));$((s[1]/2-6))HHello world.\e[${s[0]};0H"
This should give you a blank screen, except for the the message "Hello world." printed right in the middle of the screen, and a prompt at the very bottom.

Resources