2 * Copyright (c) 2018 AlaskanEmily
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 #include "cin_export.h"
13 #include "cin_format.h"
24 * @defgroup Driver Functions that create, destroy, and manipulate the Driver.
31 * @brief Errors that occur when creating or manipulating a Driver.
33 enum Cin_DriverError {
34 Cin_eDriverSuccess, /**< No error occured */
36 Cin_eDriverUnsupportedFormat, /**< The specified format is not supported */
37 Cin_eDriverInvalidFormat, /**< The specified format is invalid */
38 Cin_eDriverUnsupportedNumChannels, /**< Unsupported number of channels */
39 Cin_eDriverUnsupportedSampleRate, /**< Unsupported sample rate */
44 * @brief Returns the size of struct Cin_Driver
46 * The client is expected to allocate space for the driver.
48 CIN_EXPORT(unsigned) Cin_StructDriverSize(void);
51 * @brief Initializes a Driver.
53 * The client is expected to allocate space for the driver. Use
54 * Cin_StructDriverSize to get the size of the driver struct.
56 * @warning The data that is placed in drv must NOT be copied. Do not use
57 * memcpy on @p sdrv, other structures may depend on the address of @p drv.
59 * @sa Cin_StructDriverSize
60 * @sa Cin_DestroyDriver
61 * @todo There is currently no way to enumerate devices.
63 CIN_EXPORT(enum Cin_DriverError) Cin_CreateDriver(struct Cin_Driver *drv);
66 * @brief Destroys the Driver
68 * As the storage space for @p drv was allocated by the client, they must also
69 * free the space after use.
71 CIN_EXPORT(void) Cin_DestroyDriver(struct Cin_Driver *drv);
74 * @brief Returns if the Driver supports creating loaders for a format.
76 CIN_EXPORT(enum Cin_DriverError) Cin_DriverSupportsFormat(
77 const struct Cin_Driver *drv,
78 enum Cin_Format format,
79 unsigned num_channels);
81 CIN_EXPORT(enum Cin_DriverError) Cin_DriverSupportsSampleRate(
82 const struct Cin_Driver *drv,
85 /** @} */ /* End Driver group. */
91 #endif /* CIN_DRIVER_H */