1 /* Copyright (c) 2019-2021 AlaskanEmily, Transnat Games
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/.
8 #ifndef CIN_OSS_DRIVER_H
9 #define CIN_OSS_DRIVER_H
12 #include "cin_export.h"
18 #define CIN_OSS_SOUND_CHANNELS 16
20 #define CIN_OSS_INSERT 0
21 #define CIN_OSS_DELETE 1
22 #define CIN_OSS_PLAY 2
23 #define CIN_OSS_STOP 3
24 #define CIN_OSS_QUIT 0x80
26 /*****************************************************************************/
28 struct Cin_MixerSound;
29 typedef struct Cin_MixerSound **Cin_MixerSound_PtrPtr;
31 /*****************************************************************************/
33 struct Cin_OSS_Command;
34 typedef struct Cin_OSS_Command *Cin_OSS_Command_Ptr;
35 typedef const struct Cin_OSS_Command *Cin_OSS_Command_ConstPtr;
37 /*****************************************************************************/
41 /*****************************************************************************/
43 CIN_PRIVATE(Cin_OSS_Command_Ptr) Cin_OSS_NewCommand(int id, int cmd);
44 CIN_PRIVATE(Cin_OSS_Command_Ptr) Cin_OSS_CommandInsertSound(
45 struct Cin_OSS_Command *cmd,
46 struct Cin_MixerSound *snd);
48 #define CIN_OSS_INSERT_SOUND_CMD(ID, SND) \
49 Cin_OSS_CommandInsertSound(Cin_OSS_NewCommand((ID), CIN_OSS_INSERT), (SND))
51 /*****************************************************************************/
53 CIN_PRIVATE(int) Cin_OSS_Lock(struct Cin_Driver *);
55 /*****************************************************************************/
57 CIN_PRIVATE(int) Cin_OSS_Unlock(struct Cin_Driver *);
59 /*****************************************************************************/
61 CIN_PRIVATE(int) Cin_OSS_NewID(struct Cin_Driver *);
63 /*****************************************************************************/
65 CIN_PRIVATE(int) Cin_OSS_PushCommand(struct Cin_Driver *,
66 struct Cin_OSS_Command *);
68 /*****************************************************************************/
69 /* Used by the the thread backend to play channels. */
70 CIN_PRIVATE_PURE(Cin_MixerSound_PtrPtr) Cin_OSS_GetChannels(
71 const struct Cin_Driver *);
73 /*****************************************************************************/
75 CIN_PRIVATE_PURE(int) Cin_OSS_GetDevice(const struct Cin_Driver *);
77 /*****************************************************************************/
78 /* Does not require locking. */
79 CIN_PRIVATE_PURE(unsigned) Cin_OSS_GetSampleRate(const struct Cin_Driver *);
81 /*****************************************************************************/
82 /* Does not require locking. */
83 CIN_PRIVATE_PURE(int) Cin_OSS_GetNumChannels(const struct Cin_Driver *);
85 /*****************************************************************************/
86 /* Does not require locking. */
87 CIN_PRIVATE_PURE(int) Cin_OSS_GetFormat(const struct Cin_Driver *);
89 /*****************************************************************************/
90 /* As with all thread functions, the driver must NOT be locked when called.
91 * returns 1 if the calling thread should die.
93 CIN_PRIVATE(int) Cin_OSS_ProcessCommands(struct Cin_Driver *);
95 /*****************************************************************************/
101 #endif /* CIN_OSS_DRIVER_H */