gpu-screen-recorder/include/sound.hpp

28 lines
867 B
C++
Raw Normal View History

2020-03-29 07:10:24 +00:00
#ifndef GPU_SCREEN_RECORDER_H
#define GPU_SCREEN_RECORDER_H
typedef struct {
void *handle;
2020-04-01 17:25:16 +00:00
void *buffer;
2020-03-29 07:10:24 +00:00
int buffer_size;
unsigned int frames;
} SoundDevice;
/*
Get a sound device by name, returning the device into the @device parameter.
The device should be closed with @sound_device_close after it has been used
to clean up internal resources.
Returns 0 on success, or a negative value on failure.
*/
2020-04-01 17:25:16 +00:00
int sound_device_get_by_name(SoundDevice *device, const char *name = "default", unsigned int num_channels = 2, unsigned int period_frame_size = 32);
2020-03-29 07:10:24 +00:00
2020-03-29 15:48:17 +00:00
void sound_device_close(SoundDevice *device);
2020-03-29 07:10:24 +00:00
/*
Returns the next chunk of audio into @buffer.
2020-04-01 17:25:16 +00:00
Returns the number of frames read, or a negative value on failure.
2020-03-29 07:10:24 +00:00
*/
2020-04-01 17:25:16 +00:00
int sound_device_read_next_chunk(SoundDevice *device, void **buffer);
2020-03-29 07:10:24 +00:00
#endif /* GPU_SCREEN_RECORDER_H */