+/** @brief Set sample format
+ * @param rate Sample rate in KHz
+ * @param channels Number of channels (i.e. 2 for stereo)
+ * @param bits Number of bits per channel (typically 8 or 16)
+ * @param signed_ True for signed samples, false for unsigned
+ *
+ * Sets @ref uaudio_rate, @ref uaudio_channels, @ref uaudio_bits, @ref
+ * uaudio_signed and @ref uaudio_sample_size.
+ *
+ * Currently there is no way to specify non-native endian formats even if the
+ * underlying API can conveniently handle them. Actually this would be quite
+ * convenient for playrtp, so it might be added at some point.
+ *
+ * Not all APIs can support all sample formats. Generally the @c start
+ * function will do some error checking but some may be deferred to the point
+ * the device is opened (which might be @c activate).
+ */
+void uaudio_set_format(int rate, int channels, int bits, int signed_) {
+ uaudio_rate = rate;
+ uaudio_channels = channels;
+ uaudio_bits = bits;
+ uaudio_signed = signed_;
+ uaudio_sample_size = bits / CHAR_BIT;
+}
+