IET
Decrease font size
Increase font size
Topic Title: GRAPHICS PROGRAMMING IN C LANGUAGE
Topic Summary: PROB IN ADDING SONG
Created On: 15 July 2011 02:43 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 15 July 2011 02:43 PM
User is offline View Users Profile Print this message



chirag0610

Posts: 4
Joined: 02 July 2011

Actually I am creating a HOTEL MANAGEMENT PROJECT IN C LANGUAGE (GRAPHICALY) in which..................

I am having problem to understand that how to add song in it (is it possible in c language or not?) ...............................

Also in adding sound having problem to understand its working through frequency variation ...............

could any one help me to understand it?[/I]
 03 August 2011 04:01 AM
User is offline View Users Profile Print this message



deleted_1_Nimer

Posts: 223
Joined: 22 April 2006

Audio is tricky in C language; by default, most IDE systems have no include files or header files to let programmers incorporate music easily. The only one I know of is Visual Studio, where you can invoke the PlaySound() to play WAV files like so:

#include <iostream>
#include <windows.h> // for PlaySound()
#define SND_FILENAME 0x20000
#define SND_LOOP 8
#define SND_ASYNC 1
using namespace std;
int main()
{
// play sound as loop (remove SND_LOOP for one time play)
// file boing.wav has be in the working directory
PlaySound("song.wav",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);

cin.get(); // wait
return 0;
}


Otherwise, you may have to look for an open-source audio playback library.

-------------------------
Technology: something that's hated & cursed at by all engineers, technologists & technicians!

( Lousy modern technology! )
 18 January 2012 08:01 PM
User is offline View Users Profile Print this message



interlocked

Posts: 6
Joined: 18 January 2012

Well that's actually the Windows API doing that, not Visual Studio. You could write the same thing in Notepad, push it through the compiler and get the same result.

But yes, working with sound is difficult. I have recently implemented MP3/Ogg Vorbis playback using the OpenAL library, with tutorials I have found via Google. You may wish to do the same.
Statistics

See Also:



FuseTalk Standard Edition v3.2 - © 1999-2014 FuseTalk Inc. All rights reserved.