move from private r&d repo
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#ifndef AUDIOCAPTURE_H
|
||||
#define AUDIOCAPTURE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <alsa/control.h>
|
||||
#include <alsa/pcm.h>
|
||||
|
||||
// NOTE: find this via `arecord -l`
|
||||
#define ALSA_MIC_HARDWARE_DEVICE "hw:3"
|
||||
#define ALSA_SPEAKER_HARDWARE_DEVICE "default"
|
||||
|
||||
// Captures audio for given seconds, and returns file name that we captured the
|
||||
// audio into
|
||||
char *audio_capture(uint seconds);
|
||||
|
||||
/* count: how many bytes in the buffer
|
||||
* returns int: 0 if success, -1 if failure
|
||||
* NOTE: This function assumes that the audio data is using:
|
||||
* - linear16 formatting (each sample is 16 bits)
|
||||
* - one channel (1 sample)
|
||||
* - with 48000 HZ sampling rate
|
||||
* Hence, it's 2 bytes per frame.
|
||||
*/
|
||||
int audio_play(char *buf, size_t byte_count);
|
||||
|
||||
#endif // AUDIOCAPTURE_H
|
||||
Reference in New Issue
Block a user