Immersitech Logo Developer Resources
immersitech_general.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef HAVE_VISIBILITY
4#if HAVE_VISIBILITY
5#define IMMERSITECH_LOGGER_API __attribute__((__visibility__("default")))
6#else
7#define IMMERSITECH_LOGGER_API
8#endif
9#elif defined _WIN32
10#define IMMERSITECH_LOGGER_API __declspec(dllexport)
11#else
12#define IMMERSITECH_LOGGER_API
13#endif
14
15#ifdef __ANDROID__
16#include <android/log.h>
17#define LOG_TAG "immersitech"
18#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
19#endif
20
21#include <string>
22#include <mutex>
23
26typedef enum imm_error_code {
27 IMM_ERROR_START = -10001,
54
58typedef enum {
65
69extern "C" IMMERSITECH_LOGGER_API const char* imm_get_version();
70
80
87
94
99public:
103
107
113 virtual void handle(imm_log_level level, const char* str);
114};
115
121 static imm_logger* m_pThis;
122public:
123
126 virtual ~imm_logger();
127
131
136
141 virtual void log(imm_log_level level, const char* format, ...);
142
147 static std::string to_string(imm_log_level level);
148
152 void set_enabled(bool enable);
153
158
159private:
162 imm_logger();
163
167 imm_logger_handler* handler;
168
171 std::mutex _log_lock;
172
175 bool _enabled;
176
179 imm_log_level _imm_log_level;
180};
181
182#ifndef IMM_LOGGER
183#define IMM_LOGGER imm_logger::get_logger()
184#endif
Default Immersitech logger handler.
Definition: immersitech_general.h:98
virtual ~imm_logger_handler()
Destroy the immersitech logger handler object.
imm_logger_handler()
Construct a new immersitech logger handler object.
virtual void handle(imm_log_level level, const char *str)
This function will process a message and post it to the appropriate log.
Logger class.
Definition: immersitech_general.h:118
virtual void log(imm_log_level level, const char *format,...)
write a message to a log
static std::string to_string(imm_log_level level)
Convert log level to string.
static imm_logger * get_logger()
Get the logger object.
virtual ~imm_logger()
Destroy the logger object.
void set_enabled(bool enable)
Turn the logger on or off.
void initialize(imm_logger_handler *handler)
Initialize logger with speficied handler.
void set_log_level(imm_log_level level)
Set the log level.
#define IMMERSITECH_LOGGER_API
Definition: immersitech_general.h:12
imm_error_code
All error codes that may be produced by the library.
Definition: immersitech_general.h:26
@ IMM_ERROR_LICENSE_VERSION_MISMATCH
This error code indicates your license files version requirements no longer match....
Definition: immersitech_general.h:45
@ IMM_ERROR_LICENSE_DATE_EXPIRED
This error code indicates your license files no longer matches the date requirements....
Definition: immersitech_general.h:44
@ IMM_ERROR_END
This value allows you to identify the end of the enum.
Definition: immersitech_general.h:52
@ IMM_ERROR_NONE
This error code indicates the function worked successfully without error.
Definition: immersitech_general.h:28
@ IMM_ERROR_MISSING_OR_INVALID_PARAMETER
This error code indicates that a parameter is either missing or invalid.
Definition: immersitech_general.h:49
@ IMM_ERROR_DATA_NULL
This error code indicates you tried to use a buffer or variable that wasn't allocated properly.
Definition: immersitech_general.h:30
@ IMM_ERROR_INVALID_FUNCTION_CALL
This error code indicates you called a function that is incompatible with your configuration,...
Definition: immersitech_general.h:50
@ IMM_ERROR_START
This value allows you to identify the start of the enum.
Definition: immersitech_general.h:27
@ IMM_ERROR_FILE_DOES_NOT_EXIST
This error code indicates that an invalid file path was provided (invalid path or invalid filename).
Definition: immersitech_general.h:48
@ IMM_ERROR_INVALID_STREAM_ID
This error code indicates that you supplied an invalid stream ID. Perhaps you've already removed this...
Definition: immersitech_general.h:51
@ IMM_ERROR_INVALID_CONTROL
This error code indicates the control specified is not a valid one with the bounds of imm_audio_contr...
Definition: immersitech_general.h:37
@ IMM_ERROR_INVALID_JSON_FILE
This error code indicates a syntax error in the provided JSON file (parameter, formating).
Definition: immersitech_general.h:40
@ IMM_ERROR_PARTICIPANT_TYPE
This error code matches the exceptions specified under imm_participant_type.
Definition: immersitech_general.h:42
@ IMM_ERROR_INVALID_VALUE
This error code indicates the value provided is outside the bounds specified for the various imm_audi...
Definition: immersitech_general.h:38
@ IMM_ERROR_DATA_LENGTH
This error code indicates there is a mismatch between the size of the data buffer you provided and th...
Definition: immersitech_general.h:31
@ IMM_ERROR_NO_INPUT_AUDIO
This error code indicates that there was no input audio to be processed, meaning an output buffer cou...
Definition: immersitech_general.h:41
@ IMM_ERROR_SPATIAL_QUALITY
This error code indicates that you specified an invalid spatial quality value. Allowable values are f...
Definition: immersitech_general.h:34
@ IMM_ERROR_INVALID_HEADING
This error code indicates you provide a heading that was outside the allowed values....
Definition: immersitech_general.h:39
@ IMM_ERROR_HANDLE_NULL
This error code indicates you have not initialized your imm_handle properly yet.
Definition: immersitech_general.h:29
@ IMM_ERROR_NUM_CHANNELS
This error code indicates that you tried to specify a number of channels outside the allowed bounds....
Definition: immersitech_general.h:32
@ IMM_ERROR_INVALID_ROOM_ID
This error code indicates that you requested a room with an ID that doesn't exist or tried to create ...
Definition: immersitech_general.h:35
@ IMM_ERROR_INVALID_PARTICIPANT_ID
This error code indicates that you requested a participant with an ID that doesn't exist or tried to ...
Definition: immersitech_general.h:36
@ IMM_ERROR_SAMPLE_RATE
This error code indicates that you tried to specify an output sampling rate that is unsupported or an...
Definition: immersitech_general.h:33
@ IMM_ERROR_LIBRARY_NOT_YET_INITIALIZED
This error code will be generated if you call any functions before initializing the library.
Definition: immersitech_general.h:43
@ IMM_ERROR_LICENSE_MISSING
This error code indicates the path to your license file is invalid. All audio effects will be bypasse...
Definition: immersitech_general.h:47
@ IMM_ERROR_LICENSE_TAMPERED
This error code indicates your license file has been corrupted. All audio effects will be bypassed.
Definition: immersitech_general.h:46
IMMERSITECH_LOGGER_API const char * imm_error_code_to_string(imm_error_code error_code)
Get a human readable string for an error code.
imm_log_level
Log level definition.
Definition: immersitech_general.h:58
@ IMM_LOG_VERBOSE
This level is used for anything, no matter how unimportant.
Definition: immersitech_general.h:59
@ IMM_LOG_WARNING
This level should be used for something that happened that could lead to an error or unexpected behav...
Definition: immersitech_general.h:62
@ IMM_LOG_ERROR
This level is exclusively for critical errors that have affected functionality.
Definition: immersitech_general.h:63
@ IMM_LOG_INFO
This level can be used to print generic information. For example, a participant was added to a room.
Definition: immersitech_general.h:61
@ IMM_LOG_DEBUG
This level should be used only during a debugging session. It should print information that is helpfu...
Definition: immersitech_general.h:60
IMMERSITECH_LOGGER_API imm_error_code imm_set_log_level(int level)
Function to set the log level of the Immersitech logger.
IMMERSITECH_LOGGER_API const char * imm_get_version()
Function to return the current version of the immersitech library.
IMMERSITECH_LOGGER_API imm_error_code imm_enable_logging(bool enable)
Function to turn on or off logging within the Immersitech Library.