1997-06-11 19:01:07 +00:00
|
|
|
*** soundbyte.c.orig Wed Mar 5 23:04:49 1997
|
1997-09-23 23:30:44 +00:00
|
|
|
--- soundbyte.c Wed Sep 24 02:39:23 1997
|
1997-06-11 19:01:07 +00:00
|
|
|
***************
|
|
|
|
*** 15,21 ****
|
|
|
|
--- 15,23 ----
|
|
|
|
#ifdef Solaris
|
|
|
|
#include <sys/filio.h>
|
|
|
|
#else
|
|
|
|
+ #ifndef __FreeBSD__
|
|
|
|
#include <sys/dir.h>
|
|
|
|
+ #endif
|
|
|
|
#include <sys/file.h>
|
|
|
|
#endif
|
|
|
|
|
1996-11-11 23:17:44 +00:00
|
|
|
***************
|
1997-09-23 23:30:44 +00:00
|
|
|
*** 72,77 ****
|
|
|
|
--- 74,81 ----
|
|
|
|
static unsigned char *playbuf= NULL; /* Current play pointer */
|
|
|
|
static int squelch = 0; /* Squelch value */
|
|
|
|
|
|
|
|
+ void soundplayvol();
|
|
|
|
+
|
|
|
|
/* Convert local gain into device parameters */
|
|
|
|
|
|
|
|
static unsigned scale_gain(g)
|
|
|
|
***************
|
1996-11-11 23:17:44 +00:00
|
|
|
*** 96,101 ****
|
1997-09-23 23:30:44 +00:00
|
|
|
--- 100,110 ----
|
1996-11-11 23:17:44 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ #ifndef sun
|
|
|
|
+ #ifdef HALF_DUPLEX
|
|
|
|
+ static int oldvol = -1;
|
|
|
|
+ #endif
|
|
|
|
+ #endif
|
|
|
|
|
|
|
|
/* SOUNDINIT -- Open the sound peripheral and initialise for
|
|
|
|
access. Return TRUE if successful, FALSE
|
|
|
|
***************
|
|
|
|
*** 145,150 ****
|
1997-09-23 23:30:44 +00:00
|
|
|
--- 154,174 ----
|
1996-11-11 23:17:44 +00:00
|
|
|
}
|
|
|
|
ioctl(Audio_fd, AUDIO_SETINFO, &Audio_info);
|
|
|
|
#endif
|
|
|
|
+ #ifndef sun
|
|
|
|
+ #ifdef HALF_DUPLEX
|
|
|
|
+ if (iomode == O_RDONLY) {
|
|
|
|
+ if (oldvol == -1)
|
|
|
|
+ oldvol = soundgetvol();
|
|
|
|
+ soundplayvol(0);
|
|
|
|
+ } else if ( iomode == O_WRONLY
|
|
|
|
+ && oldvol != -1
|
|
|
|
+ ) {
|
|
|
|
+ if (soundgetvol() == 0)
|
|
|
|
+ soundplayvol(oldvol);
|
|
|
|
+ oldvol = -1;
|
|
|
|
+ }
|
|
|
|
+ #endif
|
|
|
|
+ #endif
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (errno != EINTR) {
|
|
|
|
***************
|
|
|
|
*** 160,165 ****
|
1997-09-23 23:30:44 +00:00
|
|
|
--- 184,198 ----
|
1996-11-11 23:17:44 +00:00
|
|
|
void soundterm()
|
|
|
|
{
|
|
|
|
if (audiof >= 0) {
|
|
|
|
+ #ifndef sun
|
|
|
|
+ #ifdef HALF_DUPLEX
|
|
|
|
+ if (oldvol != -1) {
|
|
|
|
+ if (soundgetvol() == 0)
|
|
|
|
+ soundplayvol(oldvol);
|
|
|
|
+ oldvol = -1;
|
|
|
|
+ }
|
|
|
|
+ #endif
|
|
|
|
+ #endif
|
|
|
|
if (close(audiof) < 0) {
|
1997-06-11 19:01:07 +00:00
|
|
|
perror("closing audio device");
|
1996-11-11 23:17:44 +00:00
|
|
|
}
|
|
|
|
***************
|
|
|
|
*** 210,219 ****
|
|
|
|
|
|
|
|
arg = (value << 8) | value;
|
|
|
|
|
|
|
|
! if (ioctl(Audio_fd, MIXER_WRITE(SOUND_MIXER_PCM), &arg) < 0)
|
1997-06-11 19:01:07 +00:00
|
|
|
! perror("SOUND_MIXER_PCM");
|
1996-11-11 23:17:44 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SOUNDRECGAIN -- Set recording gain from 0 (minimum) to 100 (maximum). */
|
|
|
|
|
1997-09-23 23:30:44 +00:00
|
|
|
--- 243,272 ----
|
1996-11-11 23:17:44 +00:00
|
|
|
|
|
|
|
arg = (value << 8) | value;
|
|
|
|
|
|
|
|
! if (ioctl(Audio_fd, SOUND_MIXER_WRITE_PCM, &arg) < 0)
|
|
|
|
! perror("SOUND_MIXER_WRITE_PCM");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ #ifndef sun
|
|
|
|
+ #ifdef HALF_DUPLEX
|
|
|
|
+
|
|
|
|
+ /* SOUNDGETVOL -- Get current playback volume. */
|
|
|
|
+
|
|
|
|
+ int soundgetvol()
|
|
|
|
+ {
|
|
|
|
+ int arg, v1, v2;
|
|
|
|
+
|
|
|
|
+ if (ioctl(Audio_fd, SOUND_MIXER_READ_PCM, &arg) < 0) {
|
1997-06-11 19:01:07 +00:00
|
|
|
+ perror("SOUND_MIXER_READ_PCM");
|
|
|
|
+ return -1;
|
1996-11-11 23:17:44 +00:00
|
|
|
+ }
|
|
|
|
+ v1 = arg & 0xFF;
|
|
|
|
+ v2 = (arg >> 8) & 0xFF;
|
|
|
|
+ return (v1 > v2) ? v1 : v2;
|
|
|
|
+ }
|
|
|
|
+ #endif
|
|
|
|
+ #endif
|
|
|
|
|
|
|
|
/* SOUNDRECGAIN -- Set recording gain from 0 (minimum) to 100 (maximum). */
|
|
|
|
|