|
If you want to read yourself the data to get the samples and modify them you have to read corretly the header (after that you will find the row data):
http://www.sonicspot.com/guide/wavefiles.html[^]
I don't know if some functions are jet available in C++.
Don't warning, ... it's not hard, I do something similar by myself using Matlab years ago in less then 1 day.
good luck
Russell
|
|
|
|
|
|
When I apply new lines, I feel that there's got to be a more easier and byte consuming way of making new lines. I'm new to the programming scene, so much help is appreciated. Instead of applying cout and endl beside every line, is there a more common and better way of doing this? Please offer advice. Thank you.
Here's my code:
<br />
#include "stdafx.h"<br />
#include <iostream><br />
<br />
using namespace std;<br />
<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
<br />
cout << "'Gone Crazy'" << endl;<br />
cout << "by Alan Jackson" << endl;<br />
cout << endl;<br />
<br />
cout << "Here I am all alone again tonight" << endl;<br />
cout << "In this old empty house" << endl;<br />
cout << "It's hard to learn what you don't think you need" << endl;<br />
cout << "You can't live without" << endl;<br />
cout << "Never leave the sound of the telephone" << endl;<br />
cout << "But ever since you left" << endl;<br />
cout << "I've been gone" << endl;<br />
cout << "Gone carzy, goin' out of my mind" << endl;<br />
cout << "I've asked myself the reasons," << endl;<br />
cout << "at least least thousand times," << endl;<br />
cout << endl;<br />
<br />
cout << "Press the Enter key to continue...";<br />
cin.ignore(99,'\n');<br />
<br />
return 0;<br />
}
|
|
|
|
|
put the text in a file.
read each line of the file in a loop and spit it out onto the console with cout.
Much less typing
|
|
|
|
|
I need to print all my lines on one paper (hw assignment). So I don't think putting the text in a file is optional at the moment. I remember my professor giving shortcuts but forgot what he did. Any ideas?
|
|
|
|
|
Then how about...
Type one line like this:
cout << "" << endl;
Select the line, Ctrl-C to copy to clipboard, Ctrl-V to copy it a couple hundred times.
Navigate to the top line and start typing text between the quotes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
lol I didn't mean that kind of shortcut. But I think I've figured it out, instead of using endl, I now use \n for new line. But what's the difference between endl and \n? Which should I use for this situation?
|
|
|
|
|
MoboTech wrote: But what's the difference between endl and \n?
endl writes a '\n' to the stream AND flushes the stream.
You could do cout.flush(); after you've written the lines of text.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
MoboTech wrote: But what's the difference between endl and \n?
In a word...caching.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
void cout (char* szMsg)
{
cout << szMsg << endl;
}
cout("abc");
|
|
|
|
|
// Lyrics.cpp : Displaying Lyrics.
// Steve Baker
#include "stdafx.h"
char* stuff[]= {
{"'Gone Crazy'"},
{"by Alan Jackson"},
{""},
{"Here I am all alone again tonight"},
{"In this old empty house"},
{"It's hard to learn what you don't think you need"},
{"You can't live without"},
{"Never leave the sound of the telephone"},
{"But ever since you left"},
{"I've been gone"},
{"Gone carzy, goin' out of my mind"},
{"I've asked myself the reasons,"},
{"at least least thousand times,"},
{""}
};
char otherStuff[]={
"\
'Gone Crazy'\n\
by Alan Jackson\n\
\n\
Here I am all alone again tonight\n\
In this old empty house\n\
It's hard to learn what you don't think you need\n\
You can't live without\n\
Never leave the sound of the telephone\n\
But ever since you left\n\
I've been gone\n\
Gone carzy, goin' out of my mind\n\
I've asked myself the reasons,\n\
at least least thousand times,\n\
\n"
};
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int nCount=(sizeof(stuff)/sizeof(char*));
// One way...
for (int i=0;i<nCount;++i) {
cout << stuff[i] << endl;
}
// Another way...
cout << otherStuff << endl;
cout << "Press the Enter key to continue...";
cin.ignore(99,'\n');
return 0;
}
|
|
|
|
|
I am writing an application that runs as a Windows Service to measure user inactivity - for the purpose of timing out applications. How best to do it?
None
|
|
|
|
|
Oops: My bad. I just noticed a similar thread below.
But coming to think of it, I am not particularly interesting in using Mouse/Keyboard hooks since they may affect over-all computer response. Is there a way to tell MS Windows to wake up a certain CALLBACK if the user doesn't input for a certain period of time?
None
|
|
|
|
|
look CWinApp::OnIdle (MFC)
Russell
|
|
|
|
|
Wrong. Did you read the docs to find out what OnIdle() does?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
brahmma wrote: Wrong
brahmma wrote: Did you read the docs to find out what OnIdle() does?
Did you?
Russell
|
|
|
|
|
I don't care you voting me 1 for that, but at least try to realize that you are providing wrong guidance to a person seeking help. That is plainly unacceptable.
Russell` wrote: Did you?
Of course I do read the docs and I've provided him the correct solution.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Sorry,...I haven't seen that him was talking to windows-inactivity and not his app-inactivity.
Next time I'll read the question better.
Thank you
...and sorry to the OP
Russell
|
|
|
|
|
concoran wrote: I am not particularly interesting in using Mouse/Keyboard hooks since they may affect over-all computer response. Is there a way to tell MS Windows to wake up a certain CALLBACK if the user doesn't input for a certain period of time?
If you run Windows 2000 or above, you can use GetLastInputInfo() API.
See here[^].
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
I am looking for some help on terminating an application after a certain period of inactivity.
I need to terminate the application if the user does not perform any actviity for certain amount of time.
Any help or direction will be appreciated.
Thanks
Sri Rama
|
|
|
|
|
1) For mouse/keyboard messages pretranslate might do or setup message hooks, whatever works. If other devices are used to interact with the program you have to account for them as well.
2) Upon any of those messages you cancel the previous duration timer and set a new one.
3) If the timer ever expires you exit the application.
|
|
|
|
|
Can you use a timer in your application class - likes of the of fashioned watch dog timer? Than all you have to do is reset it on any user activity or let it timeout and exit the app.
|
|
|
|
|
Sriramak wrote: Any help or direction will be appreciated.
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Nice but ... does it defeat the windows very basics?
Would you have to put this API in some kinda of wait loop?
Just wondering.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: does it defeat the windows very basics?
Not sure what you mean by this.
Vaclav_Sal wrote: Would you have to put this API in some kinda of wait loop?
Most likely using WM_TIMER .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|