OSDN Git Service

Add readme
[cinnamon-audio/cinnamon.git] / cin_loader.h
1 /*
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/.
6  */
7
8 #ifndef CIN_LOADER_H
9 #define CIN_LOADER_H
10 #pragma once
11
12 #include "cin_export.h"
13 #include "cin_format.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 struct Cin_Driver;
20
21 struct Cin_Sound;
22
23 /**
24  * @defgroup Loader Functions that play, stop, and destroy Loaders.
25  * @{
26  */
27
28 struct Cin_Loader;
29
30 /**
31  * @brief Errors that occur when manipulating a Loader.
32  */
33 enum Cin_LoaderError {
34     Cin_eLoaderSuccess, /**< No error occured */
35     Cin_eLoaderFailure, /**< An unspecified error occured */
36     Cin_eLoaderUnsupportedFormat, /**< The specified format is not supported */
37     Cin_eLoaderInvalidFormat, /**< The specified format is invalid */
38     Cin_eLoaderUnsupportedNumChannels, /**< Unsupported number of channels */
39     Cin_eLoaderUnsupportedSampleRate /**< Unsupported sample rate */
40 };
41
42 /**
43  * @brief Returns the size of struct Cin_Loader
44  *
45  * The client is expected to allocate space for the Loader.
46  */
47 CIN_EXPORT(unsigned) Cin_StructLoaderSize();
48
49 CIN_EXPORT(enum Cin_LoaderError) Cin_CreateLoader(struct Cin_Loader *out,
50     struct Cin_Driver *drv,
51     unsigned sample_rate,
52     unsigned channels,
53     enum Cin_Format format);
54
55 CIN_EXPORT(enum Cin_LoaderError) Cin_LoaderPut(struct Cin_Loader *ld,
56     const void *data,
57     unsigned byte_size);
58
59 CIN_EXPORT(enum Cin_LoaderError) Cin_LoaderFinalize(struct Cin_Loader *ld,
60     struct Cin_Sound *out);
61
62 /** @} */ /* End Loader group. */
63
64 #ifdef __cplusplus
65 } // extern "C"
66 #endif
67
68 #endif /* CIN_LOADER_H */