-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathVoice.h
78 lines (64 loc) · 2.26 KB
/
Voice.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright (C) 2017,2018,2021,2024 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(Voice_H)
#define Voice_H
#include "StopWatch.h"
#include "M17LSF.h"
#include "Timer.h"
#include <cstdint>
#include <string>
#include <vector>
#include <unordered_map>
enum VOICE_STATUS {
VS_NONE,
VS_WAITING,
VS_SENDING
};
struct CPositions {
unsigned int m_start;
unsigned int m_length;
};
class CVoice {
public:
CVoice(const std::string& directory, const std::string& language, const std::string& callsign);
~CVoice();
bool open();
void linkedTo(const std::string& reflector);
void unlinked();
bool read(unsigned char* data);
void start();
void clock(unsigned int ms);
private:
std::string m_language;
std::string m_indxFile;
std::string m_m17File;
CM17LSF m_lsf;
VOICE_STATUS m_status;
CTimer m_timer;
CStopWatch m_stopWatch;
unsigned int m_sent;
unsigned char* m_m17;
unsigned char* m_voiceData;
unsigned int m_voiceLength;
std::unordered_map<std::string, CPositions*> m_positions;
std::vector<const unsigned char*> m_metaArray;
std::vector<const unsigned char*>::const_iterator m_itMeta;
void createVoice(const std::vector<std::string>& words, const char* text);
void createFrame(uint16_t id, uint16_t& fn, const unsigned char* audio, unsigned int length, bool end);
};
#endif