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.
34 lines
468 B
34 lines
468 B
8 years ago
|
#ifndef _SOUND_H
|
||
|
#define _SOUND_H
|
||
|
|
||
|
#include "Arduino.h"
|
||
|
|
||
|
#include "driver/i2s.h"
|
||
|
|
||
|
#define I2S_NUM 0
|
||
|
|
||
|
|
||
|
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();
|
||
|
private:
|
||
|
i2sbuffer_t buffer;
|
||
|
const i2s_port_t i2s_num = (i2s_port_t)I2S_NUM;
|
||
|
};
|
||
|
|
||
|
#endif /* _SOUND_H */
|