Test with D47639 for `AFMT_FLOAT`, aka `AFMT_F32_NE`. On a little-endian machine, to test `AFMT_F32_BE` explicitly, you can apply the following patch to beep(1) instead:
```
diff --git a/usr.bin/beep/beep.c b/usr.bin/beep/beep.c
index 151236b4825b..96e13cc86e9d 100644
--- a/usr.bin/beep/beep.c
+++ b/usr.bin/beep/beep.c
@@ -152,7 +152,7 @@ usage(void)
int
main(int argc, char **argv)
{
- int32_t *buffer;
+ float *buffer;
size_t slope;
size_t size;
size_t off;
@@ -208,9 +208,9 @@ main(int argc, char **argv)
if (ioctl(f, SOUND_PCM_WRITE_CHANNELS, &c) != 0)
errx(1, "ioctl SOUND_PCM_WRITE_CHANNELS(1) failed");
- c = AFMT_S32_NE;
+ c = AFMT_F32_BE;
if (ioctl(f, SNDCTL_DSP_SETFMT, &c) != 0)
- errx(1, "ioctl SNDCTL_DSP_SETFMT(AFMT_S32_NE) failed");
+ errx(1, "ioctl SNDCTL_DSP_SETFMT(AFMT_F32_BE) failed");
if (ioctl(f, SNDCTL_DSP_SPEED, &sample_rate) != 0)
errx(1, "ioctl SNDCTL_DSP_SPEED(%d) failed", sample_rate);
@@ -251,7 +251,15 @@ main(int argc, char **argv)
else if (off > (size - slope))
sample = sample * (size - off - 1) / (float)slope;
- buffer[off] = sample * 0x7fffff00;
+ int32_t tmp;
+ memcpy(&tmp, &sample, sizeof(tmp));
+ tmp = ((uint32_t)tmp & 0x000000ff) << 24 |
+ (tmp & 0x0000ff00) << 8 |
+ (tmp & 0x00ff0000) >> 8 |
+ (tmp & 0xff000000) >> 24;
+ memcpy(&sample, &tmp, sizeof(sample));
+
+ buffer[off] = sample;
}
if (write(f, buffer, size * sizeof(buffer[0])) !=
```