Zakhar Levchenko wrote:
> Now when a device is opened with open() call OSS driver automatically 
> sets some default sample rate (usually 48000). I think it is good to have an 
> option to disable setting default sample rate when opening a device. 
> This may be some compile option or an 
> option from some configuration file (I don't insist that this should 
> be done by default, it should be done for those who absolutely need 
> it). It may be useful sometimes. 
> For example, on my sound card (ESI Juli@) changing sample rate causes an 
> audible click (I believe it is not an OSS driver fault but some hardware 
> limitation, the same effect is observable on WinXP by the way).
> This effect may be noticeable when a series of audio file is 
> played. Suppose all files are in 44100, and 
> an audio player opens a device for each file (most common situation), so for 
> each file sample rate is set two times (48000 and 44100 then). So when each 
> file is started a click is audible.
> But actually there is no much sense to switch sample rate when a 
> device is opened.
> In this case just previously set sample rate will be used, and it is 
> desirable sometimes. The idea is that changing sample rate should be done 
> only when it is absolutely necesserily. 
> Anyway, audio applications need to set sample rate explicitly with 
> SNDCTL_DSP_SPEED call. I myself use OSS 
> compiled 
> with my own modification of audio_core.c where line that sets a default 
> sample rate when 
> a device is opened 
> is removed, and everything works fine. So it is not problem for me.
> I just think that this may be useful for other people (for example for 
> other owners of ESI Juli@ card) who may experience similar problems.
> Does anybody else think that it is worthy idea?
Nothing is supposed to get changed in the hardware registers at the 
moment when open() or SNDCTL_DSP_SPEED is called. The hardware will be 
programmed to the selected sampling rate just before the moment when 
playback/recording is actually started. So if several 44100 files are 
played in row then the device should stay at 44100 even open() changes 
the rate to 48000.

If the hardware gets reprogrammed to 48000 between the files then there 
is a bug in the driver.

Best regards,

Hannu
_______________________________________________
oss-devel mailing list
oss-devel@mailman.opensound.com
http://mailman.opensound.com/mailman/listinfo/oss-devel

Reply via email to