You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#ifndef _SOUND_H
|
|
|
|
#define _SOUND_H
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
#include "driver/i2s.h"
|
|
|
|
#include "hardware.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int16_t buf[512];
|
|
|
|
int len;
|
|
|
|
int index;
|
|
|
|
int playing;
|
|
|
|
} i2sbuffer_t;
|
|
|
|
|
|
|
|
class Sound {
|
|
|
|
public:
|
|
|
|
Sound();
|
|
|
|
void init();
|
|
|
|
void end();
|
|
|
|
void loop();
|
|
|
|
// void close();
|
|
|
|
void play();
|
|
|
|
// void pause();
|
|
|
|
void stop();
|
|
|
|
int render_sample_block(uint16_t *sample_buf_left, uint16_t *sample_buf_right, int num_samples);
|
|
|
|
const i2s_port_t i2s_num = (i2s_port_t)I2S_NUM;
|
|
|
|
bool playing;
|
|
|
|
private:
|
|
|
|
i2sbuffer_t buffer;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _SOUND_H */
|