|
Duration(msec) / 1000.0 = durationSec
durationSec * samplesPerSecond = numOfSamplesRequired
for (i=0; i<numOfSamplesRequired; i++)
{
// ** Generate the sound wave based on FREQUENCY define
}
WaveHeader.dwBufferLength = numOfSamplesRequired * bytesPerSample
|
|
|
|
|
Thanks. I didn't quite understand what the code does. It seems to me you mean that I should loop for the number of seconds I want to sound to last. But that creates a non-smooth sounds, like noise.
But I understood from your code that by playing with the size of BUFFERSIZE I can make the sound shorter or longer, and that seems to work well.
Thank you.
|
|
|
|
|
That's okay. I hope you can forgive me for my poorly formatted (i.e - not at all)
answer.
I had hoped you would understand as much as I do from what I wrote, and it seems to have served its purpose.
Have a nice weekend.
|
|
|
|
|
It certainly did serve it's purpose. Thank you, it was helpful.
|
|
|
|
|
Hi, I have started to use Visual Studio 2010, and First I started to make a sample dialog based application when I used the new controls of MFC like CMFCMenuButton or CMFCPropertyGridCtrl I found that these controls loose their visual style at ruining time, I should notice that I derived my dialog class from CDialog not CDialogEx, after all How could i solve the problem.
|
|
|
|
|
Did you ensure that, the project contains the manifest file? All other controls in the Window are enabled with Visual Styles?
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
Thank you for replaying the post, I just use the Visual Studio wizard to create the Dialog and again the Other buttons and controls lies on their own style and this happens only to new controls , I tested this experience for several times and the result was the same. I wonder if others had the same problem or not.
|
|
|
|
|
i met the same problem. At first,I deleted all features in mfc wizard because i draw all window by myself,but at last i found i need a dialog.I used ::InitCommonControlsEx() and it returned TRUE.
OK,this function did not work probably as it said on msdn,all controls on the dialog looks like old win98 style.I also modified the manifest file to enable xp style,but this style only appears in xp OS.
i dont why the ::InitCommonControlsEx() returned TRUE but it didnt do anything i could see.
|
|
|
|
|
Hy everyone ! What is the best way to send an mail through MFC application ? I study some methods , but I wish to send an mail whitout default mail settings ... is imposible ?
|
|
|
|
|
|
|
That's why I said "If you can afford it" and then added that you can search for SMTP code here on code project (or through Google.)
|
|
|
|
|
Sorry , I understand that .. my mistake !
|
|
|
|
|
|
Yes , it will help , that's what I'm looking for ... thanks !
|
|
|
|
|
Happy coding! Let me know if you have further questions.
|
|
|
|
|
hi,
for(int i = 0;i < n; i++)
{
try
{
//.........
}
catch(exception e)
{
//........
}
}
In tha above code,in catch block im printing some error message after the for loop terminated.my problem is when the for loop get terminates,im having the last error message only(the catch is called 2 times,so i need to display 2 error messages)...
pls help me...
|
|
|
|
|
Gomathy_84 wrote: im printing some error message after the for loop terminated
What do you mean by printing exactly ? Print on the console with printf ?
Furthermore, you don't print after the for loop is terminated but in the loop itself.
|
|
|
|
|
From what I understand, you're collecting error message inside the catch block and then displaying it after the loop terminates.
If so you will need to collect multiple strings.
You can do this using a vector of strings.
std::vector<std:string> vstrErrors;
try
{
}
catch(std::exception e)
{
vstrErrors.push_back(e.what());
}
|
|
|
|
|
Yes...ThankYou so much
|
|
|
|
|
here,im having seperate exception class like connectionException class.I derived it from std::exception.
In the place of throw ..i wrote as throw connectionException(...some error message).
In the place of Catch...how to catch my class exception and covert into std::exception???
Thanx.
|
|
|
|
|
This should do it.
This is the C++ concept of "a base class object can reference a derived class object".
catch (connectionException& ce)
{
std::exception& e = ce;
}
|
|
|
|
|
In general it's best to catch exceptions by reference, generally a const reference.
try
{
}
catch (const exception &e)
{
}
Steve
|
|
|
|
|
Dear Exprets,
I am not a fresher, But would like to refresh my C++ skills and learn
more concepts towards desing. I am also attending few interviews now a days.
I am not just looking for interview question / FAQs.
Can any one advice a good book/ resource for me please
Many thanks in advance !
|
|
|
|
|
For MFC: "MFC Internals".
For C++ and STL ) : "Effective ++", "More Effective C++", "C++ Gotchas", "Effective STL", "Exceptional C++", ...
Added :
"Large-Scale C++ Software Design", "Code Complete", "The Pragmatic Programmer"
Watched code never compiles.
|
|
|
|