Add audio support

This commit is contained in:
dec05eba
2020-04-01 19:25:16 +02:00
parent 5e60805c36
commit 2fcd3ee3e5
5 changed files with 233 additions and 64 deletions

View File

@@ -3,7 +3,7 @@
typedef struct {
void *handle;
char *buffer;
void *buffer;
int buffer_size;
unsigned int frames;
} SoundDevice;
@@ -14,14 +14,16 @@ typedef struct {
to clean up internal resources.
Returns 0 on success, or a negative value on failure.
*/
int sound_device_get_by_name(SoundDevice *device, const char *name = "default", unsigned int num_channels = 1, unsigned int period_frame_size = 32);
int sound_device_get_by_name(SoundDevice *device, const char *name = "default", unsigned int num_channels = 2, unsigned int period_frame_size = 32);
void sound_device_close(SoundDevice *device);
/*
Returns the next chunk of audio into @buffer.
Returns the size of the buffer, or a negative value on failure.
Returns the number of frames read, or a negative value on failure.
*/
int sound_device_read_next_chunk(SoundDevice *device, char **buffer);
int sound_device_read_next_chunk(SoundDevice *device, void **buffer);
int sound_device_get_buffer_size(SoundDevice *device);
#endif /* GPU_SCREEN_RECORDER_H */