home *** CD-ROM | disk | FTP | other *** search
- // Copyright 1993, Mark T. Pflaging
- // This is the test suite for all of the other routines.
- // It plays sounds through the Sound Blaster Digital to
- // Analog converter, directly from Expanded memory using
- // DMA (direct memory access) for "background" operation.
- // The program preloads sounds into Expanded memory and
- // assigns them names. Then it plays the sounds back
- // directly from EMM based on the name they have been given.
- #include "sb.hpp"
- #include "sndfile.hpp"
-
- #include <conio.h>
-
- void SndPlaySnd(SoundBlaster & sb, SB_SoundFile & test)
- {
- test.Play(sb);
-
- while(!kbhit() && !(sb.DMA_Complete()))
- ;
- if(!(sb.DMA_Complete())) {
- sb.Halt_DMA();
- getch();
- }
- }
-
- #pragma argsused
- void main(int argc, char *argv[])
- {
- SoundBlaster sb;
-
- cout << "Playing sample" << endl;
-
- sb.Init_Voice_DMA(); // Use default interrupt handler
-
- SB_SoundFile test1("Organ", "test1.wav");
- SB_SoundFile test2("Hit", "test2.wav");
- SB_SoundFile test3("Brass", "test3.wav");
- SB_SoundFile test4("Music", "test4.wav");
-
- SndPlaySnd(sb, *SB_SoundFile::Find("Organ"));
- SndPlaySnd(sb, *SB_SoundFile::Find("Hit"));
- SndPlaySnd(sb, *SB_SoundFile::Find("Music"));
- SndPlaySnd(sb, *SB_SoundFile::Find("Brass"));
- SndPlaySnd(sb, *SB_SoundFile::Find("Organ"));
- SndPlaySnd(sb, *SB_SoundFile::Find("Brass"));
- SndPlaySnd(sb, *SB_SoundFile::Find("Music"));
-
- sb.DeInit_Voice_DMA();
-
- cout << "Done." << endl;
- }
-