+ }
+ if (tmp != stereo)
+ {
+ wxLogTrace(_T("sound"), _T("Unable to set DSP to %s."), stereo? _T("stereo"):_T("mono"));
+ m_needConversion = true;
+ }
+
+ tmp = data->m_samplingRate;
+ if (ioctl(dev, SNDCTL_DSP_SPEED, &tmp) < 0)
+ {
+ wxLogTrace(_T("sound"), _T("IOCTL failure (SNDCTL_DSP_SPEED)"));
+ return false;
+ }
+ if (tmp != data->m_samplingRate)
+ {
+ // If the rate the sound card is using is not within 1% of what the
+ // data specified then override the data setting. The only reason not
+ // to always override this is because of clock-rounding
+ // problems. Sound cards will sometimes use things like 44101 when you
+ // ask for 44100. No need overriding this and having strange output
+ // file rates for something that we can't hear anyways.
+ if (data->m_samplingRate - tmp > (tmp * .01) ||
+ tmp - data->m_samplingRate > (tmp * .01)) {
+ wxLogTrace(_T("sound"),
+ _T("Unable to set DSP sampling rate to %d (wants %d)"),
+ data->m_samplingRate, tmp);
+ m_needConversion = true;
+ }
+ }
+
+ // Do this last because some drivers can adjust the buffer sized based on
+ // the sampling rate, etc.
+ if (ioctl(dev, SNDCTL_DSP_GETBLKSIZE, &m_DSPblkSize) < 0)
+ {
+ wxLogTrace(_T("sound"), _T("IOCTL failure (SNDCTL_DSP_GETBLKSIZE)"));