lms-audio/src/defines.h
2024-06-16 18:15:27 +02:00

118 lines
3.2 KiB
C++

#ifndef DEFINES_H
#define DEFINES_H
#define VERSION "LibreMediaServerAudio v0.2.0 Antigona"
#define COPYRIGHT "(C) 2014-2024 Santi Noreña <lms@criptomart.net>"
#define LICENSE "GPL3 Licensed. See LICENSE.txt."
#define DEFAULT_FILE "lms-audio.xlm"
#define MAX_LAYERS 4
#define MAX_AUDIODEVICES 8
#define FORMAT ma_format_f32 /* Must always be f32. */
#define CHANNELS 2
#define SAMPLE_RATE 48000
#define UI_REFRESH_TIME 123
#define FADE_TIME 25
#define FILTER_CHANNELS 16 // number of dmx channels dedicated to filters by layer
#define MAX_WIDTH 500
#define MIN_WIDTH 50
struct dmxSetting {
int address;
unsigned int universe;
int layer;
int audioDevice;
};
enum Status
{
Stopped,
Paused,
PlayingOnce,
PlayingLoop,
Iddle,
PlayingFolder,
PlayingFolderLoop,
PlayingFolderRandom
};
enum Slider
{
Volume,
Pan,
Pitch,
Bypass,
Bus1,
Bus2
};
#ifdef __cplusplus
constexpr const char* statusToString(Status e) noexcept
{
switch (e)
{
case Status::Stopped: return "Stop";
case Status::Paused: return "Paused";
case Status::PlayingOnce: return "Play 1";
case Status::PlayingLoop: return "Play Loop";
case Status::Iddle: return "Iddle";
case Status::PlayingFolder: return "Play Folder";
case Status::PlayingFolderLoop: return "Play Folder Loop";
case Status::PlayingFolderRandom: return "Playing Folder Random";
default: return "--++--";
}
}
#include <QString>
static Status stringToStatus(QString *statusStr) {
if (statusStr->compare("Stopped")) return Stopped;
else if (statusStr->compare("Paused")) return Paused;
else if (statusStr->compare("PlayingOnce")) return PlayingOnce;
else if (statusStr->compare("PlayingLoop")) return PlayingLoop;
else if (statusStr->compare("Iddle")) return Iddle;
else if (statusStr->compare("PlayingFolder")) return PlayingFolder;
else if (statusStr->compare("PlayingFolderLoop")) return PlayingFolderLoop;
else if (statusStr->compare("PlayingFolderRandom")) return PlayingFolderRandom;
else return Stopped; // Valor por defecto o manejar como error
}
struct layerData {
QString media;
Status status;
bool updated;
float vol;
float cursor;
int pan;
int pitch;
float duration;
int address;
unsigned int universe;
int device;
int bus1Vol;
int bus2Vol;
float level;
};
struct CueTrack {
std::string filePath;
int volume = 0; // 0 - 65535 ToDo: change to db -85 - 0
int pan = 128; // 0 - 255
int pitch = 128; // 0 - 255
int bus1 = 255; // 0 - 255
int bus2 = 255; // 0 - 255
Status status;
int fadeOut = 3; // ToDo: change to float or milliseconds
int fadeIn = 3;
int waitIn = 0;
int waitOut = 0;
bool stopAtEnd = false; // trigger next cue when this is executed
std::string name;
std::string description;
int userNumber; // cue user id
int entryPoint; // 0 - 255
int exitPoint; // 0 - 255
int audioLayer; // internal audio layer used when cue is loaded
};
#endif // __cplusplus
#endif // DEFINES_H