Beep()

Hi I am using the Beep(hertz, millisecond duration)

and I was wondering how I can decrease the time it takes for each beep to start, because the duration only effects the beep time but I want the beeps to play right after each other instead of pausing for a split second.
Sleep(milliseconds);

http://msdn.microsoft.com/en-us/library/ms686298%28VS.85%29.aspx

EDIT:

Though, I hear that microsoft has removed access to the internal speaker
(see Community Content here -> http://msdn.microsoft.com/en-us/library/ms679277%28VS.85%29.aspx ).

So, a better way to go would be a music library, like this one -> http://gpalem.web.officelive.com/CFugue.html

EDIT 2: Oh, sorry, I misread your post... You want to decrease, not to increase the duration between beeps. AFAIK, you can't do that. Again, a music library would help a lot here.
Last edited on
hmm allright thanks... bummber that micrsoft removed that seemed like exactly what i needed

EDIT: oh i see. well yea we arent working with anything to spizzy yet I just wanted to try to show off to the professor.. But W/e's. While I am here how do I find out what libraries I need to link to my program for it to be able to play .mp3 sounds?
Last edited on
Last edited on
should I be able to understand the MCI stuff? I really don't understand it at all..
vlad61 wrote:
I really don't understand it at all..

Neither do I xD That's why I searched a bit more and put that irrklang library there. Anyway it shouldn't be difficult to find a good sound library. Just google around for a while and something good will show up soon.
i tried using irrklang - do i just copy the contents of the bin, include, and lib folders into visual studios own lib, include, and bin folders? Sorry if that sounds stupid I have never used a library that doesnt come with a compiler.
Ok, let's see... First, you don't have to do anything with the bin folder, it just contains example programs. As for the include and lib folders, you guessed right. But, in the lib folder of irrklang you'll see two subfolders, win32-gcc, win32-visualStudio. If you're using Visual Studio, copy the contents of the second folder inside your own lib folder. Else copy the contents of the first folder inside your own lib folder. But there's one more thing to do. When you want to use irrklang in a project, it's not just enough to #include the headers. After all, the header files only contain the declarations of the functions, the definitions are inside the lib files. So, you have to link to the irrklang lib file you copied inside your lib folder. I can't recall how exactly this is done in Visual Studio... Search for something like Project Properties -> Linker Options in the menu.

EDIT: Though... I'm not sure you'll be able to play mp3 files, since this feature comes as a plug-in... Just try the above and see if you can get it to play other sound files (e.g. wav). I'll do some more experiments here and tell you how you can play mp3 files. Be patient...
Last edited on
Ok, I did it :P You just have to copy somewhere to your project folder the irrKlang, ikpFlac and ikpMP3 dlls found inside the bin\win32-visualStudio folder. It can play mp3 files then.

EDIT: In fact, irrKlang.dll is necessary for any irrklang program. If you want to add mp3 support, you must also have ikpMP3.dll and I don't know what ikpFlac does.
Last edited on
I can play .wav using
1
2
3
4
5
6
7
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")
int main(){

PlaySound(TEXT("rawhide.wav"), 0, SND_ASYNC);	 //Play until interrupted

}


EDIT: and yes I am using visual studio, and i think I copied everything over correctly but it did not even allow it to compile.
Last edited on
vlad61 wrote:
it did not even allow it to compile

Could you post your code and the errors you get?
Alternatively, you could use SFML, it has Audio-support too.
Topic archived. No new replies allowed.