- // Look for an appropriate sound format
- // TODO: we should also test mono/stereo and bits
- // TODO: support "-sndspeed", "-sndbits", "-sndmono" and "-sndstereo"
- shm->format.channels = 2;
- shm->format.width = 2;
- for (i = 0; i < sizeof (tryrates) / sizeof (tryrates[0]); i++)
- {
- shm->format.speed = tryrates[i];
-
- AUDIO_INITINFO (&info);
- info.play.sample_rate = shm->format.speed;
- info.play.channels = shm->format.channels;
- info.play.precision = shm->format.width * 8;
-// We only handle sound cards of the same endianess than the CPU
-#if BYTE_ORDER == BIG_ENDIAN
- info.play.encoding = AUDIO_ENCODING_SLINEAR_BE;
-#else
-#ifndef SUNOS
- info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
+ AUDIO_INITINFO (&info);
+#ifdef AUMODE_PLAY // NetBSD / OpenBSD
+ info.mode = AUMODE_PLAY;
+#endif
+ info.play.sample_rate = requested->speed;
+ info.play.channels = requested->channels;
+ info.play.precision = requested->width * 8;
+ if (requested->width == 1)
+#ifdef SUNOS
+ info.play.encoding = AUDIO_ENCODING_LINEAR8;