home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 24
/
CD_ASCQ_24_0995.iso
/
dos
/
prg
/
dsik205
/
dsik.dat
/
EXAMPLES
/
EXAMP02.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-10
|
2KB
|
60 lines
/****************************************************************************
*
* Digital Sound Interface Kit (DSIK)
* Version 2.00
*
* by Carlos Hasan
*
* Filename: example2.c
* Version: Revision 1.0
*
* Language: WATCOM C
* Environment: IBM PC (DOS/4GW)
*
* Description: Play a sample file.
*
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include "audio.h"
#include "import.h"
#define SMPPATH "SAMPLE.WAV"
#define SMPFORM FORM_WAV
int main(void)
{
SoundCard SC;
Sample *S;
dRegisterDrivers();
if (dLoadSetup(&SC,"SETUP.CFG")) {
printf("Please run SETUP.EXE to configure.\n");
exit(EXIT_FAILURE);
}
if (dInit(&SC)) {
printf("Error initializing the sound system.\n");
exit(EXIT_FAILURE);
}
atexit((void(*)(void))dDone);
if (!(S = dImportSample(SMPPATH,SMPFORM))) {
printf("Error (%03d) loading %s sample file: %s.\n",
dError, SMPPATH, dErrorMsg[dError]);
exit(EXIT_FAILURE);
}
dSetupVoices(1,255);
dPlayVoice(0,S);
printf("Playing sample file at %d hertz. Press any key to exit.\n", S->Rate);
while (!kbhit() && dGetVoiceStatus(0) == PS_PLAYING) {
printf("(pos=%8ld)\r", dGetVoicePos(0));
dPoll();
}
if (kbhit()) getch();
dFreeSample(S);
return 0;
}