summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-03-24 22:23:51 +0000
committerache <ache@FreeBSD.org>1994-03-24 22:23:51 +0000
commitf4bbdc7da6e18ffed99f492f7865dcaf729ff629 (patch)
treee52bc9806f3ef874fc2311a78b9c781227cb4bdb /sys/i386
parent2f48f24d378d175cee9b6b47d4846f7225d93f1b (diff)
downloadFreeBSD-src-f4bbdc7da6e18ffed99f492f7865dcaf729ff629.zip
FreeBSD-src-f4bbdc7da6e18ffed99f492f7865dcaf729ff629.tar.gz
1) After discussion with Hannu, returning speed changed back.
Real problem fixed by my previous fix for SB 2.x 2) get_time function slightly modified to minimize possible overflowing.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/isa/sound/sb_dsp.c13
-rw-r--r--sys/i386/isa/sound/soundcard.c7
2 files changed, 9 insertions, 11 deletions
diff --git a/sys/i386/isa/sound/sb_dsp.c b/sys/i386/isa/sound/sb_dsp.c
index 403bdae..f19f4f8 100644
--- a/sys/i386/isa/sound/sb_dsp.c
+++ b/sys/i386/isa/sound/sb_dsp.c
@@ -52,7 +52,6 @@ int sb_dsp_highspeed = 0;
static int major = 1, minor = 0; /* DSP version */
static int dsp_stereo = 0;
static int dsp_current_speed = DSP_DEFAULT_SPEED;
-static int user_speed = DSP_DEFAULT_SPEED;
static int sb16 = 0;
static int irq_verified = 0;
@@ -257,8 +256,6 @@ dsp_speed (int speed)
speed = 22050;
}
- user_speed = speed;
-
if (dsp_stereo)
speed *= 2;
@@ -300,7 +297,7 @@ dsp_speed (int speed)
speed /= 2;
dsp_current_speed = speed;
- return user_speed;
+ return speed;
}
static int
@@ -435,7 +432,7 @@ sb_dsp_prepare_for_input (int dev, int bsize, int bcount)
else
sb_dsp_command (0xa0);
- dsp_speed (user_speed); /* Speed must be recalculated if #channels
+ dsp_speed (dsp_current_speed); /* Speed must be recalculated if #channels
* changes */
}
return 0;
@@ -451,7 +448,7 @@ sb_dsp_prepare_for_output (int dev, int bsize, int bcount)
if (major == 3) /* SB Pro */
{
sb_mixer_set_stereo (dsp_stereo);
- dsp_speed (user_speed); /* Speed must be recalculated if #channels
+ dsp_speed (dsp_current_speed); /* Speed must be recalculated if #channels
* changes */
}
#endif
@@ -565,8 +562,8 @@ sb_dsp_ioctl (int dev, unsigned int cmd, unsigned int arg, int local)
case SOUND_PCM_READ_RATE:
if (local)
- return user_speed;
- return IOCTL_OUT (arg, user_speed);
+ return dsp_current_speed;
+ return IOCTL_OUT (arg, dsp_current_speed);
break;
case SOUND_PCM_WRITE_CHANNELS:
diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c
index 36b5a1e..dae5a54 100644
--- a/sys/i386/isa/sound/soundcard.c
+++ b/sys/i386/isa/sound/soundcard.c
@@ -73,11 +73,12 @@ get_time()
{
extern struct timeval time;
struct timeval timecopy;
-int x = splclock();
-
+int x;
+
+ x = splclock();
timecopy = time;
splx(x);
- return ((unsigned long)timecopy.tv_usec*HZ)/1000000 +
+ return timecopy.tv_usec/(1000000/HZ) +
(unsigned long)timecopy.tv_sec*HZ;
}
OpenPOWER on IntegriCloud