forked from SamuraiSigma/speech-to-text
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstt_error.h
67 lines (54 loc) · 1.25 KB
/
stt_error.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
#ifndef STT_ERROR_H
#define STT_ERROR_H
#include "core/object.h"
#include "core/ustring.h"
// Shortcut for printing STTError::Error values with ERR_PRINT()
#define STT_ERR_PRINTS(e) ERR_PRINT(STTError::get_singleton()->get_error_string(e));
class STTError : public Object {
GDCLASS(STTError, Object);
public:
/*
* Defines error values that some speech recognition-related functions may
* return.
*/
enum Error {
OK,
UNDEF_FILES_ERR,
UNDEF_CONFIG_ERR,
UNDEF_QUEUE_ERR,
USER_DIR_MAKE_ERR,
USER_DIR_COPY_ERR,
MULTIBYTE_STR_ERR,
MEM_ALLOC_ERR,
CONFIG_CREATE_ERR,
REC_CREATE_ERR,
DECODER_CREATE_ERR,
REC_START_ERR,
REC_STOP_ERR,
UTT_START_ERR,
UTT_RESTART_ERR,
AUDIO_READ_ERR
};
protected:
static STTError *singleton; // Singleton for this class's only instance.
static void _bind_methods();
public:
/*
* Returns this class's only instance (or NULL, if it wasn't instanced yet).
*
* @return This class's singleton.
*/
static STTError * get_singleton();
String get_error_string(Error err);
/*
* Initializes the class singleton.
*/
STTError();
/*
* Doesn't actually do anything. :P
*/
~STTError();
};
// Makes the enum work when binding to methods
VARIANT_ENUM_CAST(STTError::Error);
#endif // STT_ERROR_H