xradiotrack patch pro SB16-FMI
Milan Kopacka
mkop5230 na ss1000.ms.mff.cuni.cz
Pondělí Listopad 30 10:30:49 CET 1998
Zdravim,
Nasledujici je patch na program xradiotrack, ktery ho upravi pro
pouziti s kartou SB16-FMI.
Uprava spociva ve zmene adresy pro io-port a presmerovani ovladani
hlasitosti na mixer zvukove karty. (Takze je treba mit funkcni ovladac
zvukovky). Jeste je treba v /etc/radio.conf zmenit io-port na ten, ktery
pouzivate (0x384 nebo 0x284).
Je to zalozeno na uprave programu radiotrack, kterou do konference posilal
Tom Mazouch (v archivu 9712/msg00438.html) .
Protoze predpokladam, ze se to muze hodit vice lidem, posilam
to do konference.
zdravi
Milan Kopacka
-cut----------------------------------------------------------
diff -wu -r xradiotrack.1.1.orig/Makefile xradiotrack.1.1/Makefile
--- xradiotrack.1.1.orig/Makefile Sat May 4 18:49:02 1996
+++ xradiotrack.1.1/Makefile Fri Nov 27 20:05:23 1998
@@ -9,7 +9,7 @@
LNKOPTS=-lfl -L/usr/X11R6/lib -lXaw -lXt -lX11
-CC = gcc -Wall -m486 -O2
+CC = gcc -Wall -m486 -O2 -DVIBRA
xradiotrack: xradiotrack.c $(OBJS)
$(CC) -o $@ $(OBJS) $(LNKOPTS)
@@ -20,7 +20,7 @@
config.o : config.l config.h commondefs.h
flex config.l
- gcc -c -pedantic -W -Wparentheses -o config.o lex.yy.c
+ $(CC) -c -pedantic -W -Wparentheses -o config.o lex.yy.c
rm lex.yy.c
xpriv.o : xpriv.c
diff -wu -r xradiotrack.1.1.orig/config.l xradiotrack.1.1/config.l
--- xradiotrack.1.1.orig/config.l Sat May 4 22:19:20 1996
+++ xradiotrack.1.1/config.l Fri Nov 27 20:00:12 1998
@@ -86,7 +86,13 @@
token=(char*)strtok(text,delims); /* swallow "port" */
sscanf((char*)strtok(NULL,delims),"%x",&port); /* get port number */
RadioBase=port;
+
+#ifdef VIBRA
+ if ((RadioBase!=0x384) && (RadioBase!=0x284)) { have_error(2); }
+#else
if ((RadioBase!=0x30c) && (RadioBase!=0x20c)) { have_error(2); }
+#endif /* VIBRA */
+
}
%}
/* now the rules */
diff -wu -r xradiotrack.1.1.orig/xcard.c xradiotrack.1.1/xcard.c
--- xradiotrack.1.1.orig/xcard.c Sat Apr 13 23:21:45 1996
+++ xradiotrack.1.1/xcard.c Fri Nov 27 19:48:38 1998
@@ -24,6 +24,13 @@
#include <asm/io.h>
#include <unistd.h>
+#ifdef VIBRA
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/soundcard.h>
+#include <sys/ioctl.h>
+#endif
+
extern int muted;
unsigned long RadioBase; /* base port for RadioTrack */
@@ -57,14 +64,56 @@
}
+
+#ifdef VIBRA
+void MixerMove(int num) /* num specifies the change, mixer has values 0-100 */
+{
+
+ int mixer;
+ int temp;
+ if ((mixer=open("/dev/mixer",O_RDWR))<0){
+ fprintf(stderr, "Error opening /dev/mixer.");
+ return;
+ }
+ if (ioctl(mixer, SOUND_MIXER_READ_LINE, &temp) == -1) {
+ perror("MIXER_READ");
+ close(mixer);return;
+ }
+
+/* for both left and right setting please use mixer, OK ? :) */
+
+ temp = ((temp & 0x7F) + ((temp >> 8) & 0x7F)) / 2;
+ temp+=num;
+ if (temp<0) temp=0;
+ if (temp>100) temp=100;
+ temp |= (temp << 8);
+ if (ioctl(mixer, SOUND_MIXER_WRITE_LINE, &temp) == -1) {
+ perror("MIXER_WRITE");
+ }
+ close (mixer);
+
+}
+
+#define MIXER_MOVE 2 /* mixer change */
+
+#endif /* VIBRA */
+
void VolumeDown(void)
{
if ( ! muted )
{
+
+#ifdef VIBRA
+ MixerMove((-1)*MIXER_MOVE);
+#else
+
/* vol down a notch */
outb(0x48,RadioBase);
usleep(10000);
outb(0xc8,RadioBase);
+
+#endif /* VIBRA */
+
}
else
{
@@ -78,10 +127,17 @@
{
if ( ! muted )
{
+
+#ifdef VIBRA
+ MixerMove(MIXER_MOVE);
+#else
+
/* vol up a notch */
outb(0x88,RadioBase);
usleep(10000);
outb(0xc8,RadioBase);
+
+#endif /* VIBRA */
}
else
{
diff -wu -r xradiotrack.1.1.orig/xpriv.c xradiotrack.1.1/xpriv.c
--- xradiotrack.1.1.orig/xpriv.c Sat May 4 22:10:56 1996
+++ xradiotrack.1.1/xpriv.c Fri Nov 27 19:44:35 1998
@@ -12,6 +12,8 @@
#include <unistd.h>
#include <stdio.h>
+#include <sys/types.h>
+#include <sys/perm.h>
int get_io_privs(unsigned long baseport)
{
diff -wu -r xradiotrack.1.1.orig/xradioinit.c xradiotrack.1.1/xradioinit.c
--- xradiotrack.1.1.orig/xradioinit.c Sat Apr 13 23:21:45 1996
+++ xradiotrack.1.1/xradioinit.c Fri Nov 27 19:59:52 1998
@@ -114,7 +114,11 @@
/* ok, now station info in station array and default array */
-if (!(RadioBase==0x30c || RadioBase==0x20c)) { have_error(2);}
+#ifdef VIBRA
+ if ((RadioBase!=0x384) && (RadioBase!=0x284)) { have_error(2); }
+#else
+ if ((RadioBase!=0x30c) && (RadioBase!=0x20c)) { have_error(2); }
+#endif /* VIBRA */
/* first ask for the radio track ports */
-cut-------------------------------------------------------------------------------
Další informace o konferenci Linux