Skip to content
Snippets Groups Projects
Commit dbc3eccd authored by deuce's avatar deuce
Browse files

Added support for /dev/speaker for BSD builds... you'll need /dev/speaker

enabled in your kernel and be writeable by the uid/gid the BBS runs as.
parent b970a2fa
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,11 @@
#include <sys/kbio.h>
#include <sys/kbd.h>
#endif
#if defined(__OpenBSD__) || defined(__NetBSD__)
#include <machine/spkr.h>
#elif defined(__FreeBSD__)
#include <machine/speaker.h>
#endif
#endif /* __unix__ */
#include "genwrap.h" /* Verify prototypes */
......@@ -128,18 +133,31 @@ char* strrev(char* str)
}
return str;
}
#endif
/****************************************************************************/
/* Generate a tone at specified frequency for specified milliseconds */
/* Thanks to Casey Martin for this code */
/****************************************************************************/
#if defined(__unix__)
void DLLCALL unix_beep(int freq, int dur)
{
static int console_fd=-1;
#if !defined(__OpenBSD__) && !defined(__GNU__) && !defined(__NetBSD__) && !defined(__QNX__)
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
int speaker_fd=-1;
tone_t tone;
speaker_fd = open("/dev/speaker", O_WRONLY|O_APPEND);
if(speaker_fd != -1) {
tone.frequency=freq;
tone.duration=dur;
ioctl(speaker_fd,SPKRTONE,&tone);
SLEEP(dur);
close(speaker_fd);
return;
}
#endif
#if !defined(__GNU__) && !defined(__QNX__)
if(console_fd == -1)
console_fd = open("/dev/console", O_NOCTTY);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment