home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
MM1
/
SOUNDUTILS
/
audioplay.lzh
/
AUDIOPLAY
/
SRC
/
dial.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-26
|
1KB
|
96 lines
/* dial - a simple touchtone dialer */
/* could be used as a speed dialer in an application */
/* Boisy G. Pitre - 3/19/95 */
#include <stdio.h>
#include <types.h>
#include <errno.h>
#ifndef _TYPES_H
typedef unsigned long u_int32;
typedef long int32;
typedef int32 process_id;
typedef int32 status_code;
typedef int32 error_code;
#endif
int os9forkc();
extern char **environ;
main(argc, argv)
int argc;
char *argv[];
{
char *p;
char file[24];
u_int32 sleepTime;
p = argv[1];
while (*p) {
switch (*p) {
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '0':
sprintf(file, "tt%c.iff", *p);
playsound(file);
break;
case '*':
strcpy(file, "ttstar.iff");
playsound(file);
break;
case '#':
strcpy(file, "ttpound.iff");
playsound(file);
break;
case ',':
/* sleep for 1 second */
sleepTime = 0x80000100;
tsleep(sleepTime);
break;
}
p++;
}
}
/*
* void playsound(char *file)
*
* Plays either a .wav or .iff sound file
*/
playsound(file)
char *file;
{
char tmp[10], tmp2[10];
char *argv[6];
process_id pid;
status_code status;
error_code err;
argv[0] = "audioplay";
argv[1] = "-q";
argv[2] = file;
argv[3] = NULL;
pid = os9exec(os9forkc, argv[0], argv, environ, 0, 0, 3);
if (pid == -1) {
Bell(1);
} else {
while (pid != wait(&status));
}
}