m5stack-avatar
Loading...
Searching...
No Matches
LipSync.h
1
// Copyright (c) Shinya Ishikawa. All rights reserved.
2
// Licensed under the MIT license. See LICENSE file in the project root for full
3
// license information.
4
5
#ifndef TASKS_LIPSYNC_H_
6
#define TASKS_LIPSYNC_H_
7
8
#include <AquesTalkTTS.h>
9
# if defined(ARDUINO_M5STACK_Core2) || defined(M5AVATAR_CORE2)
10
#include <M5Core2.h>
11
# else
12
#include <M5Unified.h>
13
# endif
14
#include <Arduino.h>
15
#include "../Avatar.h"
16
17
namespace
m5avatar {
18
extern
void
lipSync(
void
*args) {
19
DriveContext *ctx =
reinterpret_cast<
DriveContext *
>
(args);
20
Avatar *avatar = ctx->getAvatar();
21
for
(;;) {
22
int
level = TTS.getLevel();
23
float
f = level / 12000.0;
24
float
open = min(1.0, f);
25
avatar->setMouthOpenRatio(open);
26
delay(33);
27
}
28
}
29
}
// namespace m5avatar
30
31
#endif
// SRC_TASKS_LIPSYNC_H_
src
tasks
LipSync.h
Generated by
1.9.5