My professor told me to put an audio in my program but he did not taught me how to. please help me because i do not have any idea on how to do this thing. i know that you guys are experties so please help me.. tnx alot.. :)
franmaez_0716 0 Newbie Poster
gusano79 247 Posting Shark
franmaez_0716 0 Newbie Poster
..sorry but i can't get your point maybe because i'm just a beginner.. anyway.. what i want to know is that.. what code should i type to put a sound in my codes (simple c++ program).. tnx for the reply..
DeanMSands3 69 Junior Poster
Are you running Windows, Mac, or Linux?
If Windows, are you using Visual Studio, NetBeans, Eclipse, Dev-C++ or Turbo C++?
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Here's a link for MS-Windows (and it won't matter which 32-bit compiler you use. It won't work with Turbo C or Turbo C++)
DeanMSands3 commented: Rock on, Ancient Dragon. +4
Ancient Dragon commented: nice link :) +17
franmaez_0716 0 Newbie Poster
Thank you for the link.. the samples are working but i used karlwakim's link for it allow mp3 files.. but i have 1 error..
c:\users\user\documents\kisses\cs102l\sramble rumble\scramble rumble.cpp(5) : fatal error C1083: Cannot open include file: 'irrKlang.h': No such file or directory
the samples given is working but when i've already put the code in my program.. it does not work..
please help me to fix my problem..
by the way.. this is my code..
#include<iostream>
#include<string>
#include<windows.h>
#include <conio.h>
#include <irrKlang.h>
using namespace std;
using namespace irrklang;
int main(int argc, const char** argv)
{
// start the sound engine with default parameters
ISoundEngine* engine = createIrrKlangDevice();
if (!engine)
return 0; // error starting up the engine
// play some sound stream, looped
engine->play2D("somefile.mp3", true);
char i = 0;
std::cin >> i; // wait for user to press some key
engine->drop(); // delete engine
const int a=5, b=5, c=5, d=5;
string aword[a]={"valentines","internet","computer", "blanket", "mango"};
string xword[a]={"veailtnnes","iteennrt","coemtupr", "blaknet", "mngao"};
string bword[b]={"interfere", "necessary", "decision", "download", "official"};
string yword[b]={"rfrtnieee", "nrsscyeea", "donsieci", "dloodwan", "oiialcff"};
string cword[c]={"simultaneously", "successive", "equipments", "direction", "sphygmomanometer"};
string zword[c]={"ylsuintlmsaeou", "uevsscceis", "steunmiepq", "ntcrdieio", "amermpegotsmnyho"};
string j;
int menu;
int level;
int point1=0;
int point2=0;
int p=0;
int ctr=0;
cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\tInitializing";
cout<<"\n\n\t\t\t\t .";
Sleep(350);
cout<<".";
Sleep(350);
cout<<".";
Sleep(350);
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\tInitializing";
cout<<"\n\n\t\t\t\t .";
Sleep(350);
cout<<".";
Sleep(350);
cout<<".";
Sleep(350);
system("cls");
a:
cout<<"\n\n\n\n";
Sleep(150);
cout<<"\t##### ##### ##### # # # ##### # #####"<<endl;
Sleep(150);
cout<<"\t# # # # # # ## ## # # # # "<<endl;
Sleep(150);
cout<<"\t##### # ##### # # # # # # ##### # #### "<<endl;
Sleep(150);
cout<<"\t # # # # ####### # ## # # # # # "<<endl;
Sleep(150);
cout<<"\t # # # # # # # # # # # # "<<endl;
Sleep(150);
cout<<"\t##### ##### # # # # # # ##### ##### #####"<<endl;
Sleep(250);
cout<<"\n"<<endl;
Sleep(250);
cout<<"\t ##### # # # # ##### # ##### "<<endl;
Sleep(150);
cout<<"\t # # # # ## ## # # # # "<<endl;
Sleep(150);
cout<<"\t ##### # # # # # # ##### # #### "<<endl;
Sleep(150);
cout<<"\t # # # # # ## # # # # # "<<endl;
Sleep(150);
cout<<"\t # # # # # # # # # # "<<endl;
Sleep(150);
cout<<"\t # # ##### # # ##### ##### ##### "<<endl;
Sleep(250);
system("cls");
Sleep(150);
cout<<"\n\n\n\n";
cout<<"\t##### ##### ##### # # # ##### # #####"<<endl;
cout<<"\t# # # # # # ## ## # # # # "<<endl;
cout<<"\t##### # ##### # # # # # # ##### # #### "<<endl;
cout<<"\t # # # # ####### # ## # # # # # "<<endl;
cout<<"\t # # # # # # # # # # # # "<<endl;
cout<<"\t##### ##### # # # # # # ##### ##### #####"<<endl;
cout<<"\n"<<endl;
cout<<"\t ##### # # # # ##### # ##### "<<endl;
cout<<"\t # # # # ## ## # # # # "<<endl;
cout<<"\t ##### # # # # # # ##### # #### "<<endl;
cout<<"\t # # # # # ## # # # # # "<<endl;
cout<<"\t # # # # # # # # # # "<<endl;
cout<<"\t # # ##### # # ##### ##### ##### "<<endl;
Sleep(450);
cout<<"\n\n\n\t\t\t Press any key to play." << endl;
getch();
system("cls");
b:
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\t Main Menu"<<endl;
cout<<"\n\t\t\t\t [1]Play"<<endl;
cout<<"\t\t\t\t [2]Exit"<<endl;
cin>>menu;
system("cls");
if(menu==1)
{
goto c;
}
else if(menu==2)
{
exit(0);
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tInvalid Selection"<<endl;
cout<<"\t\t\t\tPlease Try Again!"<<endl;
getch();
system("cls");
goto b;
}
c:
cout<<"\n\n\n\n\n\n\n\n\n\t\t\t Select Difficulty Level"<<endl;
cout<<"\n\t\t\t\t [1]Easy"<<endl;
cout<<"\t\t\t\t [2]Normal"<<endl;
cout<<"\t\t\t\t [3]Hard"<<endl;
cout<<"\t\t\t\t [4]Main Menu"<<endl;
cin>>level;
system("cls");
switch(level)
{
case 1: cout<<"\n\n\t\t\t\t| Easy Level |"<<endl;
Sleep(500);
cout<<"\nAre you ready? [ENTER]"<<endl;
getch();
goto d; break;
case 2: cout<<"\n\n\t\t\t\t| Normal Level |"<<endl;
Sleep(500);
cout<<"\nAre you ready? [ENTER]"<<endl;
getch();
goto d; break;
case 3: cout<<"\n\n\t\t\t\t| Hard Level |"<<endl;
Sleep(500);
cout<<"\nAre you ready? [ENTER]"<<endl;
getch();
goto d; break;
case 4: goto b; break;
default:
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tInvalid Selection"<<endl;
cout<<"\t\t\t\tPlease Try Again!"<<endl; break;
}
getch();
system("cls");
goto c;
d:
if(level==1)
{
for(int i=0;i<a;i++)
{
cout<<"\n "<<xword[i]<<endl;
cout<<" ";
cin>>j;
ctr++;
if(j==aword[i])
{
cout<<"\n"<<endl;
cout<<" "<<i+1<<" "<<"Point(s)"<<endl;
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"<<endl; Sleep(100);
Sleep(500);
}
else
{
cout<<"\nWrong"<<endl;
cout<<" "<<i-0<<" "<<"Point(s)"<<endl;
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"<<endl; Sleep(100);
Sleep(500);
}
}
}
else if(level==2)
{
for(int i=0;i<b;i++)
{
cout<<"\n "<<yword[i]<<endl;
cout<<" ";
cin>>j;
ctr++;
if(j==bword[i])
{
cout<<"\n"<<endl;
cout<<" "<<i+1<<" "<<"Point(s)"<<endl;
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"<<endl; Sleep(100);
Sleep(500);
}
else
{
cout<<"\nWrong"<<endl;
cout<<" "<<i-0<<" "<<"Point(s)"<<endl;
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"<<endl; Sleep(100);
Sleep(500);
}
}
}
else if(level==3)
{
for(int i=0;i<a;i++)
{
cout<<"\n "<<zword[i]<<endl;
cout<<" ";
cin>>j;
ctr++;
if(j==cword[i])
{
cout<<"\n";
cout<<" "<<i+1<<" "<<"Point(s)"<<endl;
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"<<endl; Sleep(100);
Sleep(500);
}
else
{
cout<<"\nWrong"<<endl;
cout<<" "<<i-0<<" "<<"Point(s)"<<endl;
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"; Sleep(100);
cout<<"-"<<endl; Sleep(100);
Sleep(500);
}
}
}
return 0;
}
thanks for the help..
zeroliken 79 Nearly a Posting Virtuoso
did you download the appropriate header files?
Kanoisa 52 Posting Whiz in Training
#include <irrKlang.h>
should be #include "irrKlang.h"
??
if the file lives in your project not in CC it should almost definatley be in quotes instead of angle brackets.
franmaez_0716 0 Newbie Poster
yes i've downloaded the irrklang header files and the samples are working.. i've also tried replacing brackets with quotes but still the error is the same..
Kanoisa 52 Posting Whiz in Training
So then are the headders where your project expects them?
The files being on your computer is not enough, the compiler and linker need to know where the files live, the easy test is to first try copying the headder file into your projects directory in the same folder as main.cpp, Then the compiler should find it for sure.
franmaez_0716 0 Newbie Poster
..thank you for helping me..:)
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.