home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1989 Oki Electric Industry Co., Ltd.
- *
- * This file is part of vtalk.
- *
- * Permission to use, copy, modify and distribute this program without
- * fee is grtanted, provided that the above copyright notice appear
- * in all copies.
- *
- */
- /*
- * audio.c audio control routine for vtalk
- *
- * vtalk is a command for
- * Voice TALK with the user on another machine.
- *
- */
-
- #include <stdio.h>
- #include <sys/ioctl.h> /* for audio */
- #define AUDIO_CHIP
- #include <sbusdev/audio_79C30.h>
- #include <sun/audioio.h>
-
- int fd_audio;
-
-
- device_open()
- {
- struct audio_ioctl audioreg;
-
- if((fd_audio = open("/dev/audio", 2)) < 0){
- fprintf(stderr,"vtalk: can't open /dev/audio\n");
- exit(1);
- }
-
- /* set MMR1 register */
- audioreg.control = AUDIO_MAP_MMR1;
- audioreg.data[0] = AUDIO_MMR1_BITS_LOAD_GX |
- AUDIO_MMR1_BITS_LOAD_GR | AUDIO_MMR1_BITS_LOAD_GER;
- if (ioctl(fd_audio,AUDIOSETREG,&audioreg) < 0) {
- perror("vtalk: set MMR1 register");
- }
-
- /* set MMR2 register *
- * send the output to the builtin speaker */
- audioreg.control = AUDIO_MAP_MMR2;
- if (ioctl(fd_audio,AUDIOGETREG,&audioreg) < 0) {
- perror("vtalk: set MMR2 register");
- }
- audioreg.data[0] |= AUDIO_MMR2_BITS_LS;
- if (ioctl(fd_audio,AUDIOSETREG,&audioreg) < 0) {
- perror("vtalk: set MMR2 register");
- }
-
- return(fd_audio);
- }
-
-
- void
- set_volume()
- {
- struct audio_ioctl audioreg;
-
- /* register GR set 5db for play volume */
- audioreg.control = AUDIO_MAP_GR;
- audioreg.data[0] = 0x3b;
- audioreg.data[1] = 0x11;
- if (ioctl(fd_audio,AUDIOSETREG,&audioreg) < 0) {
- perror("vtalk: set GR register");
- }
-
- /* register GER set 5db for play volume */
- audioreg.control = AUDIO_MAP_GER;
- audioreg.data[0] = 0x31;
- audioreg.data[1] = 0xdd;
- if (ioctl(fd_audio,AUDIOSETREG,&audioreg) < 0) {
- perror("vtalk: set GER register");
- }
-
- /* register GX set 11db for record volume */
- audioreg.control = AUDIO_MAP_GX;
- audioreg.data[0] = 0x13;
- audioreg.data[1] = 0x00;
- if (ioctl(fd_audio,AUDIOSETREG,&audioreg) < 0) {
- perror("vtalk: set GX register");
- }
- }
-
-
-
-
-