/*
ESP8266SAM
Port of SAM to the ESP8266
Copyright (C) 2017 Earle F. Philhower, III
*/
#pragma once
#include <stdint.h> // int16_t usw.
#include <avr/pgmspace.h> // strncpy_P
#include "AudioOutput.h"
class ESP8266SAM {
public:
ESP8266SAM()
{
singmode = false;
phonetic = false;
pitch = 0;
mouth = 0;
throat = 0;
speed = 0;
output = 0;
};
enum SAMVoice { VOICE_SAM, VOICE_ELF, VOICE_ROBOT, VOICE_STUFFY, VOICE_OLDLADY, VOICE_ET };
void SetVoice(enum SAMVoice voice);
void SetSingMode(bool val) { singmode = val; }
void SetPhonetic(bool val) { phonetic = val; }
void SetPitch(uint8_t val) { pitch = val; }
void SetMouth(uint8_t val) { mouth = val; }
void SetThroat(uint8_t val) { throat = val; }
void SetSpeed(uint8_t val) { speed = val; }
bool Say(AudioOutput *out, const char *str);
bool Say_P(AudioOutput *out, const char *str) {
char ram[256];
strncpy_P(ram, str, 256);
ram[255] = 0;
return Say(out, ram);
};
private:
static void OutputByteCallback(void *cbdata, unsigned char b);
void OutputByte(unsigned char b);
bool singmode;
bool phonetic;
int pitch;
int speed;
int mouth;
int throat;
AudioOutput *output;
};
Detected encoding: UTF-8 | 0
|