I'm not prepared for cross-platform programming yet. I need to have a solid base of c++ knowledge first(and, as I know, wine can emulate windows apps).Thanks for the attention,though, Caboose.
Ok, the program I succeded to make, thanks to ChickenFist, was an auto-sequence-writer for a "while" pseudo-code we currently learn at school(I promised this to my informatics teacher when I saw how much takes him to write these sequences on the blackboard).
And I noticed something strance for 0+1+2+3+.....+36 . Try it out yourself(well, use
[n(n+1)]\2 if you don't already know this)
O.K. Yesterday I discovered the
Beep function ! I had fun with it, modifying the pitch and time it plays. And I made a little program ! :
[quote]#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
int x,i,f,g,speed;
x=0;
Beep(900,50);
Beep(900,50);
Beep(100,50);
Beep(900,100);
Beep(900,100);
Beep(100,100);
Beep(900,50);
Beep(900,50);
Beep(900,50);
cout<<"What the fuck was that ? Wanna' hear some more ?
"<<endl;
cout<<"You know the while instruction can come in handy here :P" <<endl<<"Have a ...hmm... listen !"<<endl;
Sleep(2000);
cout<<" "<<endl;
cout<<"Type here a number for how fast you want the pitch sounds cycle to be(in miliseconds !)"<<endl;
cin>>speed;
cout<<" "<<endl;
cout<<"Type the number of times the beep will play ( each time the pitch increases) "<<endl;
cin>>i;
cout<<" "<<endl;
cout<<"Type the pitch multiplier ( pitch starts at 0 , so the first sound won't be played because 0*multiplier=0 "<<endl;
cout<<"Also pitch*multiplier is measured in Hz(hertz) . So for example, if you have the multiplier at 40 and the pitch is at the second cycle, the result will be 2*40=80 Hz "<<endl;
cin>>g;
cout<<" "<<endl;
cout<<"Ready ! Press any key to continue with the cycle ! "<<endl;
cout<<" "<<endl;
system("pause");
while(x<=i){
f=x*g;
Beep(static_cast<DWORD>(f),static_cast<DWORD>(speed));
cout<<"Beep number "<<x<<" "<<endl;
x=x+1;
}
system("pause");
system("CLS");
return main();
}
[/quote]
I recommend you to use it in class if you want to get over somebody's nerves
And today I discovered how to play a sound with playsound function !!!
I had to hardly google every minute ...
Something like this : [quote]#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
cout<<"This program will be a test program for sounds !"<<endl;
PlaySound(TEXT("test/sunetul.wav"), NULL, SND_FILENAME);
system("pause");
return 0;
}
[/quote]
But at first I didn't know I had to include a library, and had to make a project instead of a simple source file ( dev-c++). Well , for this
PlaySound function I want to ask you a couple of things :
How can I adjust the volume for it ? Is there any pitch option ? How can cout(or do something else) some things while a sound runs in the backround ?
Thank you.