-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspeaker.h
More file actions
42 lines (35 loc) · 740 Bytes
/
speaker.h
File metadata and controls
42 lines (35 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef SPEAKER_H
#define SPEAKER_H
#include <vector>
#include <Arduino.h>
using namespace std;
struct SpeakerNote
{
int note;
int duration;
};
struct Ringtone
{
char *notes;
int *beats;
int tempo;
int length;
};
class Speaker
{
protected:
int pin;
vector<vector<SpeakerNote>> soundLibrary;
vector<Ringtone> ringtoneLibrary;
public:
Speaker(int pin);
void addSound(vector<SpeakerNote> *ringtone);
void playAt(int index);
void play(vector<SpeakerNote> *ringtone);
void playNote(char note, int duration);
void playTone(int tone, int duration);
void addRingtone(Ringtone *ringtone);
void playRingtone(Ringtone *ringtone);
void playRingtoneAt(int index);
};
#endif