* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
return xstrdup(*valuep);
}
-/** @brief Set sample format
+/** @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)
uaudio_sample_size = bits / CHAR_BIT;
}
+/** @brief Choose the default audio API by context
+ * @param apis Table of APIs or a null pointer
+ * @param context @ref UAUDIO_API_SERVER or @ref UAUDIO_API_CLIENT
+ * @return Default API or a null pointer
+ */
+const struct uaudio *uaudio_default(const struct uaudio *const *apis,
+ unsigned context) {
+ if(apis) {
+ for(int n = 0; apis[n]; ++n)
+ if(apis[n]->flags & context)
+ return apis[n];
+ }
+ return 0;
+}
+
/*
Local Variables:
c-basic-offset:2