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.
This commit is contained in:
Andrey A. Chernov 1994-03-24 22:23:51 +00:00
parent 6378ff1e87
commit c9ffdca0a7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1306
2 changed files with 9 additions and 11 deletions

View file

@ -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:

View file

@ -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;
}