Advertisement

Playsound?

Started by October 11, 2001 03:15 PM
1 comment, last by IRDumb 23 years, 2 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?
Wow, it messed that up pretty good. Those spacing errors are not mine.
Advertisement
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