🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Playsound?

Started by
1 comment, last by IRDumb 22 years, 8 months ago
Today, I downloaded a tutorial on putting sound in your file. The example was a dos window that played two sounds and then quit. Here is the code.
  
#include <iostream>
#include <windows.h>
using namespace std;

void main()
{
cout << "Playing synchronous sound..." << endl;

PlaySound("mysound.wav", NULL, SND_FILENAME | SND_SYNC);
Sleep(1500);				
PlaySound("mysound2.wav", NULL, SND_FILENAME | SND_ASYNC);
cout << "playing asynchronous sound";
for(int i = 0; i < 50; i++)
{
cout<<".";
sleep(50);
}
cout<<endl;
}  
It also included some other files. When I tried to do this in my file, cutting and pasting this stuff, I got all these errors saying "SND_FILENAME undeclared" and stuff. So, is it possible for me to do this in my dos program?
Advertisement
Wow, it messed that up pretty good. Those spacing errors are not mine.
DOS? No. Win32 Console? Yes. Make sure to include mmsystem.h and link winmm.lib.

[Resist Windows XP''s Invasive Production Activation Technology!]

This topic is closed to new replies.

Advertisement