Skip to content

Commit a838d8a

Browse files
QuzarDCQuzarDC
authored andcommitted
mic: Use bool where appropriate.
1 parent 39b83ff commit a838d8a

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

  • kernel/arch/dreamcast

kernel/arch/dreamcast/hardware/maple/sip.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void sip_start_sampling_cb(maple_state_t *st, maple_frame_t *frame) {
3333

3434
/* Set the is_sampling flag. */
3535
sip = (sip_state_t *)frame->dev->status;
36-
sip->is_sampling = 1;
36+
sip->is_sampling = true;
3737

3838
/* Wake up! */
3939
genwait_wake_all(frame);
@@ -56,7 +56,7 @@ static void sip_stop_sampling_cb(maple_state_t *st, maple_frame_t *frame) {
5656

5757
/* Clear the is_sampling flag. */
5858
sip = (sip_state_t *)frame->dev->status;
59-
sip->is_sampling = 0;
59+
sip->is_sampling = false;
6060
sip->callback = NULL;
6161

6262
/* Wake up! */
@@ -118,7 +118,7 @@ int sip_set_frequency(maple_device_t *dev, unsigned int freq) {
118118
return MAPLE_EOK;
119119
}
120120

121-
int sip_start_sampling(maple_device_t *dev, sip_sample_cb cb, int block) {
121+
int sip_start_sampling(maple_device_t *dev, sip_sample_cb cb, bool block) {
122122
sip_state_t *sip;
123123

124124
assert(dev != NULL);
@@ -164,7 +164,7 @@ int sip_start_sampling(maple_device_t *dev, sip_sample_cb cb, int block) {
164164
return MAPLE_EOK;
165165
}
166166

167-
int sip_stop_sampling(maple_device_t *dev, int block) {
167+
int sip_stop_sampling(maple_device_t *dev, bool block) {
168168
sip_state_t *sip;
169169
assert(dev != NULL);
170170

@@ -272,7 +272,7 @@ static int sip_attach(maple_driver_t *drv, maple_device_t *dev) {
272272
(void)drv;
273273

274274
sip = (sip_state_t *)dev->status;
275-
sip->is_sampling = 0;
275+
sip->is_sampling = false;
276276
sip->amp_gain = SIP_DEFAULT_GAIN;
277277
sip->callback = NULL;
278278

kernel/arch/dreamcast/include/dc/maple/sip.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <kos/cdefs.h>
2727
__BEGIN_DECLS
2828

29+
#include <stdbool.h>
2930
#include <stdint.h>
3031
#include <dc/maple.h>
3132

@@ -74,7 +75,7 @@ typedef struct sip_state {
7475
int frequency;
7576

7677
/** \brief Is the mic currently sampling? */
77-
int is_sampling;
78+
bool is_sampling;
7879

7980
/** \brief Sampling callback. */
8081
sip_sample_cb callback;
@@ -176,7 +177,7 @@ int sip_set_frequency(maple_device_t *dev, unsigned int freq);
176177
177178
\param dev The device to start sampling on.
178179
\param cb A callback to call when samples are ready.
179-
\param block Set to 1 to wait for the SIP to start sampling.
180+
\param block Set to true to wait for the SIP to start sampling.
180181
Otherwise check the is_sampling member of the status
181182
for dev to know when it has started.
182183
\retval MAPLE_EOK On success.
@@ -185,22 +186,22 @@ int sip_set_frequency(maple_device_t *dev, unsigned int freq);
185186
callback function is NULL.
186187
\retval MAPLE_ETIMEOUT If the command timed out while blocking.
187188
*/
188-
int sip_start_sampling(maple_device_t *dev, sip_sample_cb cb, int block);
189+
int sip_start_sampling(maple_device_t *dev, sip_sample_cb cb, bool block);
189190

190191
/** \brief Stop sampling on a microphone.
191192
192193
This function informs a microphone it should stop recording samples.
193194
194195
\param dev The device to stop sampling on.
195-
\param block Set to 1 to wait for the SIP to stop sampling.
196+
\param block Set to true to wait for the SIP to stop sampling.
196197
Otherwise check the is_sampling member of the status
197198
for dev to know when it has finished.
198199
\retval MAPLE_EOK On success.
199200
\retval MAPLE_EAGAIN If the command couldn't be sent, try again later.
200201
\retval MAPLE_EFAIL If the microphone is not sampling.
201202
\retval MAPLE_ETIMEOUT If the command timed out while blocking.
202203
*/
203-
int sip_stop_sampling(maple_device_t *dev, int block);
204+
int sip_stop_sampling(maple_device_t *dev, bool block);
204205

205206
/* \cond */
206207
/* Init / Shutdown */

0 commit comments

Comments
 (0)