@@ -84,7 +84,7 @@ to get its size in bytes. | |||||
/** C#-style property constructor | /** C#-style property constructor | ||||
Example: | Example: | ||||
Foo *foo = construct<Foo>(&Foo::greeting, "Hello world"); | |||||
Foo *foo = construct<Foo>(&Foo::greeting, "Hello world", &Foo::legs, 2); | |||||
*/ | */ | ||||
template<typename T> | template<typename T> | ||||
T *construct() { | T *construct() { | ||||
@@ -120,6 +120,3 @@ DeferWrapper<F> deferWrapper(F f) { | |||||
} | } | ||||
#define DEFER(code) auto CONCAT(_defer_, __COUNTER__) = deferWrapper([&]() code) | #define DEFER(code) auto CONCAT(_defer_, __COUNTER__) = deferWrapper([&]() code) | ||||
/** Deprecated lowercase macro */ | |||||
#define defer(...) DEFER(__VA_ARGS__) |
@@ -3,7 +3,7 @@ | |||||
/** Example usage: | /** Example usage: | ||||
debug("error: %d", errno); | |||||
DEBUG("error: %d", errno); | |||||
will print something like | will print something like | ||||
[0.123 debug myfile.cpp:45] error: 67 | [0.123 debug myfile.cpp:45] error: 67 | ||||
*/ | */ | ||||
@@ -13,13 +13,6 @@ will print something like | |||||
#define FATAL(format, ...) rack::logger::log(rack::logger::FATAL_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) | #define FATAL(format, ...) rack::logger::log(rack::logger::FATAL_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) | ||||
/** Deprecated lowercase log functions */ | |||||
#define debug(...) DEBUG(__VA_ARGS__) | |||||
#define info(...) INFO(__VA_ARGS__) | |||||
#define warn(...) WARN(__VA_ARGS__) | |||||
#define fatal(...) FATAL(__VA_ARGS__) | |||||
namespace rack { | namespace rack { | ||||
namespace logger { | namespace logger { | ||||
@@ -305,39 +305,5 @@ inline Vec Vec::clampBetween(Rect bound) { | |||||
inline Vec Vec::clamp2(Rect bound) {return clampBetween(bound);} | inline Vec Vec::clamp2(Rect bound) {return clampBetween(bound);} | ||||
//////////////////// | |||||
// Deprecated functions | |||||
//////////////////// | |||||
DEPRECATED inline int min(int a, int b) {return std::min(a, b);} | |||||
DEPRECATED inline int max(int a, int b) {return std::max(a, b);} | |||||
DEPRECATED inline int eucmod(int a, int base) {return eucMod(a, base);} | |||||
DEPRECATED inline bool ispow2(int n) {return isPow2(n);} | |||||
DEPRECATED inline int clamp2(int x, int a, int b) {return clampBetween(x, a, b);} | |||||
DEPRECATED inline float min(float a, float b) {return std::min(a, b);} | |||||
DEPRECATED inline float max(float a, float b) {return std::max(a, b);} | |||||
DEPRECATED inline float eucmod(float a, float base) {return eucMod(a, base);} | |||||
DEPRECATED inline float clamp2(float x, float a, float b) {return clampBetween(x, a, b);} | |||||
DEPRECATED inline int mini(int a, int b) {return std::min(a, b);} | |||||
DEPRECATED inline int maxi(int a, int b) {return std::max(a, b);} | |||||
DEPRECATED inline int clampi(int x, int min, int max) {return clamp(x, min, max);} | |||||
DEPRECATED inline int absi(int a) {return std::abs(a);} | |||||
DEPRECATED inline int eucmodi(int a, int base) {return eucMod(a, base);} | |||||
DEPRECATED inline int log2i(int n) {return log2(n);} | |||||
DEPRECATED inline bool ispow2i(int n) {return isPow2(n);} | |||||
DEPRECATED inline float absf(float x) {return std::abs(x);} | |||||
DEPRECATED inline float sgnf(float x) {return sgn(x);} | |||||
DEPRECATED inline float eucmodf(float a, float base) {return eucMod(a, base);} | |||||
DEPRECATED inline bool nearf(float a, float b, float epsilon = 1.0e-6f) {return isNear(a, b, epsilon);} | |||||
DEPRECATED inline float clampf(float x, float min, float max) {return clamp(x, min, max);} | |||||
DEPRECATED inline float clamp2f(float x, float min, float max) {return clampBetween(x, min, max);} | |||||
DEPRECATED inline float chopf(float x, float eps) {return chop(x, eps);} | |||||
DEPRECATED inline float rescalef(float x, float a, float b, float yMin, float yMax) {return rescale(x, a, b, yMin, yMax);} | |||||
DEPRECATED inline float crossf(float a, float b, float frac) {return crossfade(a, b, frac);} | |||||
DEPRECATED inline float interpf(const float *p, float x) {return interpolateLinear(p, x);} | |||||
DEPRECATED inline void cmultf(float *cr, float *ci, float ar, float ai, float br, float bi) {return cmult(cr, ci, ar, ai, br, bi);} | |||||
} // namespace math | } // namespace math | ||||
} // namespace rack | } // namespace rack |
@@ -0,0 +1,75 @@ | |||||
#pragma once | |||||
#include "rack.hpp" | |||||
namespace rack { | |||||
//////////////////// | |||||
// common | |||||
//////////////////// | |||||
/** Deprecated lowercase macro */ | |||||
#define defer(...) DEFER(__VA_ARGS__) | |||||
//////////////////// | |||||
// math | |||||
//////////////////// | |||||
DEPRECATED inline int min(int a, int b) {return std::min(a, b);} | |||||
DEPRECATED inline int max(int a, int b) {return std::max(a, b);} | |||||
DEPRECATED inline int eucmod(int a, int base) {return eucMod(a, base);} | |||||
DEPRECATED inline bool ispow2(int n) {return isPow2(n);} | |||||
DEPRECATED inline int clamp2(int x, int a, int b) {return clampBetween(x, a, b);} | |||||
DEPRECATED inline float min(float a, float b) {return std::min(a, b);} | |||||
DEPRECATED inline float max(float a, float b) {return std::max(a, b);} | |||||
DEPRECATED inline float eucmod(float a, float base) {return eucMod(a, base);} | |||||
DEPRECATED inline float clamp2(float x, float a, float b) {return clampBetween(x, a, b);} | |||||
DEPRECATED inline int mini(int a, int b) {return std::min(a, b);} | |||||
DEPRECATED inline int maxi(int a, int b) {return std::max(a, b);} | |||||
DEPRECATED inline int clampi(int x, int min, int max) {return clamp(x, min, max);} | |||||
DEPRECATED inline int absi(int a) {return std::abs(a);} | |||||
DEPRECATED inline int eucmodi(int a, int base) {return eucMod(a, base);} | |||||
DEPRECATED inline int log2i(int n) {return log2(n);} | |||||
DEPRECATED inline bool ispow2i(int n) {return isPow2(n);} | |||||
DEPRECATED inline float absf(float x) {return std::abs(x);} | |||||
DEPRECATED inline float sgnf(float x) {return sgn(x);} | |||||
DEPRECATED inline float eucmodf(float a, float base) {return eucMod(a, base);} | |||||
DEPRECATED inline bool nearf(float a, float b, float epsilon = 1.0e-6f) {return isNear(a, b, epsilon);} | |||||
DEPRECATED inline float clampf(float x, float min, float max) {return clamp(x, min, max);} | |||||
DEPRECATED inline float clamp2f(float x, float min, float max) {return clampBetween(x, min, max);} | |||||
DEPRECATED inline float chopf(float x, float eps) {return chop(x, eps);} | |||||
DEPRECATED inline float rescalef(float x, float a, float b, float yMin, float yMax) {return rescale(x, a, b, yMin, yMax);} | |||||
DEPRECATED inline float crossf(float a, float b, float frac) {return crossfade(a, b, frac);} | |||||
DEPRECATED inline float interpf(const float *p, float x) {return interpolateLinear(p, x);} | |||||
DEPRECATED inline void cmultf(float *cr, float *ci, float ar, float ai, float br, float bi) {return cmult(cr, ci, ar, ai, br, bi);} | |||||
//////////////////// | |||||
// random | |||||
//////////////////// | |||||
DEPRECATED inline float randomu32() {return random::u32();} | |||||
DEPRECATED inline float randomu64() {return random::u64();} | |||||
DEPRECATED inline float randomUniform() {return random::uniform();} | |||||
DEPRECATED inline float randomNormal() {return random::normal();} | |||||
DEPRECATED inline float randomf() {return random::uniform();} | |||||
//////////////////// | |||||
// string | |||||
//////////////////// | |||||
using string::stringf; | |||||
//////////////////// | |||||
// logger | |||||
//////////////////// | |||||
/** Deprecated lowercase log functions */ | |||||
#define debug(...) DEBUG(__VA_ARGS__) | |||||
#define info(...) INFO(__VA_ARGS__) | |||||
#define warn(...) WARN(__VA_ARGS__) | |||||
#define fatal(...) FATAL(__VA_ARGS__) | |||||
} // namespace rack |
@@ -19,13 +19,4 @@ float normal(); | |||||
} // namespace random | } // namespace random | ||||
DEPRECATED inline float randomu32() {return random::u32();} | |||||
DEPRECATED inline float randomu64() {return random::u64();} | |||||
DEPRECATED inline float randomUniform() {return random::uniform();} | |||||
DEPRECATED inline float randomNormal() {return random::normal();} | |||||
DEPRECATED inline float randomf() {return random::uniform();} | |||||
} // namespace rack | } // namespace rack |
@@ -71,7 +71,7 @@ struct AudioInterfaceIO : AudioIO { | |||||
else { | else { | ||||
// Timed out, fill output with zeros | // Timed out, fill output with zeros | ||||
memset(output, 0, frames * numOutputs * sizeof(float)); | memset(output, 0, frames * numOutputs * sizeof(float)); | ||||
debug("Audio Interface IO underflow"); | |||||
DEBUG("Audio Interface IO underflow"); | |||||
} | } | ||||
} | } | ||||
@@ -171,7 +171,7 @@ void AudioInterface::step() { | |||||
else { | else { | ||||
// Give up on pulling input | // Give up on pulling input | ||||
audioIO.active = false; | audioIO.active = false; | ||||
debug("Audio Interface underflow"); | |||||
DEBUG("Audio Interface underflow"); | |||||
} | } | ||||
} | } | ||||
@@ -221,7 +221,7 @@ void AudioInterface::step() { | |||||
// Give up on pushing output | // Give up on pushing output | ||||
audioIO.active = false; | audioIO.active = false; | ||||
outputBuffer.clear(); | outputBuffer.clear(); | ||||
debug("Audio Interface underflow"); | |||||
DEBUG("Audio Interface underflow"); | |||||
} | } | ||||
} | } | ||||
@@ -166,7 +166,7 @@ struct MIDIToCVInterface : Module { | |||||
} | } | ||||
void processMessage(MidiMessage msg) { | void processMessage(MidiMessage msg) { | ||||
// debug("MIDI: %01x %01x %02x %02x", msg.status(), msg.channel(), msg.note(), msg.value()); | |||||
// DEBUG("MIDI: %01x %01x %02x %02x", msg.status(), msg.channel(), msg.note(), msg.value()); | |||||
switch (msg.status()) { | switch (msg.status()) { | ||||
// note off | // note off | ||||
@@ -91,7 +91,7 @@ void ModuleWidget::fromJson(json_t *rootJ) { | |||||
if (pluginJ) { | if (pluginJ) { | ||||
pluginSlug = json_string_value(pluginJ); | pluginSlug = json_string_value(pluginJ); | ||||
if (pluginSlug != model->plugin->slug) { | if (pluginSlug != model->plugin->slug) { | ||||
warn("Plugin %s does not match ModuleWidget's plugin %s.", pluginSlug.c_str(), model->plugin->slug.c_str()); | |||||
WARN("Plugin %s does not match ModuleWidget's plugin %s.", pluginSlug.c_str(), model->plugin->slug.c_str()); | |||||
return; | return; | ||||
} | } | ||||
} | } | ||||
@@ -101,7 +101,7 @@ void ModuleWidget::fromJson(json_t *rootJ) { | |||||
if (modelJ) { | if (modelJ) { | ||||
modelSlug = json_string_value(modelJ); | modelSlug = json_string_value(modelJ); | ||||
if (modelSlug != model->slug) { | if (modelSlug != model->slug) { | ||||
warn("Model %s does not match ModuleWidget's model %s.", modelSlug.c_str(), model->slug.c_str()); | |||||
WARN("Model %s does not match ModuleWidget's model %s.", modelSlug.c_str(), model->slug.c_str()); | |||||
return; | return; | ||||
} | } | ||||
} | } | ||||
@@ -111,7 +111,7 @@ void ModuleWidget::fromJson(json_t *rootJ) { | |||||
if (versionJ) { | if (versionJ) { | ||||
std::string version = json_string_value(versionJ); | std::string version = json_string_value(versionJ); | ||||
if (version != model->plugin->version) { | if (version != model->plugin->version) { | ||||
info("Patch created with %s version %s, using version %s.", pluginSlug.c_str(), version.c_str(), model->plugin->version.c_str()); | |||||
INFO("Patch created with %s version %s, using version %s.", pluginSlug.c_str(), version.c_str(), model->plugin->version.c_str()); | |||||
} | } | ||||
} | } | ||||
@@ -169,7 +169,7 @@ void ModuleWidget::copyClipboard() { | |||||
void ModuleWidget::pasteClipboard() { | void ModuleWidget::pasteClipboard() { | ||||
const char *moduleJson = glfwGetClipboardString(gWindow); | const char *moduleJson = glfwGetClipboardString(gWindow); | ||||
if (!moduleJson) { | if (!moduleJson) { | ||||
warn("Could not get text from clipboard."); | |||||
WARN("Could not get text from clipboard."); | |||||
return; | return; | ||||
} | } | ||||
@@ -180,12 +180,12 @@ void ModuleWidget::pasteClipboard() { | |||||
json_decref(moduleJ); | json_decref(moduleJ); | ||||
} | } | ||||
else { | else { | ||||
warn("JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text); | |||||
WARN("JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text); | |||||
} | } | ||||
} | } | ||||
void ModuleWidget::load(std::string filename) { | void ModuleWidget::load(std::string filename) { | ||||
info("Loading preset %s", filename.c_str()); | |||||
INFO("Loading preset %s", filename.c_str()); | |||||
FILE *file = fopen(filename.c_str(), "r"); | FILE *file = fopen(filename.c_str(), "r"); | ||||
if (!file) { | if (!file) { | ||||
// Exit silently | // Exit silently | ||||
@@ -207,7 +207,7 @@ void ModuleWidget::load(std::string filename) { | |||||
} | } | ||||
void ModuleWidget::save(std::string filename) { | void ModuleWidget::save(std::string filename) { | ||||
info("Saving preset %s", filename.c_str()); | |||||
INFO("Saving preset %s", filename.c_str()); | |||||
json_t *moduleJ = toJson(); | json_t *moduleJ = toJson(); | ||||
if (!moduleJ) | if (!moduleJ) | ||||
return; | return; | ||||
@@ -121,7 +121,7 @@ void RackWidget::saveAsDialog() { | |||||
} | } | ||||
void RackWidget::save(std::string filename) { | void RackWidget::save(std::string filename) { | ||||
info("Saving patch %s", filename.c_str()); | |||||
INFO("Saving patch %s", filename.c_str()); | |||||
json_t *rootJ = toJson(); | json_t *rootJ = toJson(); | ||||
if (!rootJ) | if (!rootJ) | ||||
return; | return; | ||||
@@ -136,7 +136,7 @@ void RackWidget::save(std::string filename) { | |||||
} | } | ||||
void RackWidget::load(std::string filename) { | void RackWidget::load(std::string filename) { | ||||
info("Loading patch %s", filename.c_str()); | |||||
INFO("Loading patch %s", filename.c_str()); | |||||
FILE *file = fopen(filename.c_str(), "r"); | FILE *file = fopen(filename.c_str(), "r"); | ||||
if (!file) { | if (!file) { | ||||
// Exit silently | // Exit silently | ||||
@@ -259,7 +259,7 @@ void RackWidget::fromJson(json_t *rootJ) { | |||||
legacy = 1; | legacy = 1; | ||||
} | } | ||||
if (legacy) { | if (legacy) { | ||||
info("Loading patch using legacy mode %d", legacy); | |||||
INFO("Loading patch using legacy mode %d", legacy); | |||||
} | } | ||||
// modules | // modules | ||||
@@ -386,7 +386,7 @@ ModuleWidget *RackWidget::moduleFromJson(json_t *moduleJ) { | |||||
void RackWidget::pastePresetClipboard() { | void RackWidget::pastePresetClipboard() { | ||||
const char *moduleJson = glfwGetClipboardString(gWindow); | const char *moduleJson = glfwGetClipboardString(gWindow); | ||||
if (!moduleJson) { | if (!moduleJson) { | ||||
warn("Could not get text from clipboard."); | |||||
WARN("Could not get text from clipboard."); | |||||
return; | return; | ||||
} | } | ||||
@@ -402,7 +402,7 @@ void RackWidget::pastePresetClipboard() { | |||||
json_decref(moduleJ); | json_decref(moduleJ); | ||||
} | } | ||||
else { | else { | ||||
warn("JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text); | |||||
WARN("JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text); | |||||
} | } | ||||
} | } | ||||
@@ -89,7 +89,7 @@ bool AudioIO::getDeviceInfo(int device, RtAudio::DeviceInfo *deviceInfo) { | |||||
return true; | return true; | ||||
} | } | ||||
catch (RtAudioError &e) { | catch (RtAudioError &e) { | ||||
warn("Failed to query RtAudio device: %s", e.what()); | |||||
WARN("Failed to query RtAudio device: %s", e.what()); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -166,7 +166,7 @@ std::vector<int> AudioIO::getSampleRates() { | |||||
return sampleRates; | return sampleRates; | ||||
} | } | ||||
catch (RtAudioError &e) { | catch (RtAudioError &e) { | ||||
warn("Failed to query RtAudio device: %s", e.what()); | |||||
WARN("Failed to query RtAudio device: %s", e.what()); | |||||
} | } | ||||
} | } | ||||
return {}; | return {}; | ||||
@@ -219,7 +219,7 @@ void AudioIO::openStream() { | |||||
deviceInfo = rtAudio->getDeviceInfo(device); | deviceInfo = rtAudio->getDeviceInfo(device); | ||||
} | } | ||||
catch (RtAudioError &e) { | catch (RtAudioError &e) { | ||||
warn("Failed to query RtAudio device: %s", e.what()); | |||||
WARN("Failed to query RtAudio device: %s", e.what()); | |||||
return; | return; | ||||
} | } | ||||
@@ -229,7 +229,7 @@ void AudioIO::openStream() { | |||||
setChannels(math::clamp((int) deviceInfo.outputChannels - offset, 0, maxChannels), math::clamp((int) deviceInfo.inputChannels - offset, 0, maxChannels)); | setChannels(math::clamp((int) deviceInfo.outputChannels - offset, 0, maxChannels), math::clamp((int) deviceInfo.inputChannels - offset, 0, maxChannels)); | ||||
if (numOutputs == 0 && numInputs == 0) { | if (numOutputs == 0 && numInputs == 0) { | ||||
warn("RtAudio device %d has 0 inputs and 0 outputs", device); | |||||
WARN("RtAudio device %d has 0 inputs and 0 outputs", device); | |||||
return; | return; | ||||
} | } | ||||
@@ -255,7 +255,7 @@ void AudioIO::openStream() { | |||||
} | } | ||||
try { | try { | ||||
info("Opening audio RtAudio device %d with %d in %d out", device, numInputs, numOutputs); | |||||
INFO("Opening audio RtAudio device %d with %d in %d out", device, numInputs, numOutputs); | |||||
rtAudio->openStream( | rtAudio->openStream( | ||||
numOutputs == 0 ? NULL : &outParameters, | numOutputs == 0 ? NULL : &outParameters, | ||||
numInputs == 0 ? NULL : &inParameters, | numInputs == 0 ? NULL : &inParameters, | ||||
@@ -263,16 +263,16 @@ void AudioIO::openStream() { | |||||
&rtCallback, this, &options, NULL); | &rtCallback, this, &options, NULL); | ||||
} | } | ||||
catch (RtAudioError &e) { | catch (RtAudioError &e) { | ||||
warn("Failed to open RtAudio stream: %s", e.what()); | |||||
WARN("Failed to open RtAudio stream: %s", e.what()); | |||||
return; | return; | ||||
} | } | ||||
try { | try { | ||||
info("Starting RtAudio stream %d", device); | |||||
INFO("Starting RtAudio stream %d", device); | |||||
rtAudio->startStream(); | rtAudio->startStream(); | ||||
} | } | ||||
catch (RtAudioError &e) { | catch (RtAudioError &e) { | ||||
warn("Failed to start RtAudio stream: %s", e.what()); | |||||
WARN("Failed to start RtAudio stream: %s", e.what()); | |||||
return; | return; | ||||
} | } | ||||
@@ -291,21 +291,21 @@ void AudioIO::closeStream() { | |||||
if (rtAudio) { | if (rtAudio) { | ||||
if (rtAudio->isStreamRunning()) { | if (rtAudio->isStreamRunning()) { | ||||
info("Stopping RtAudio stream %d", device); | |||||
INFO("Stopping RtAudio stream %d", device); | |||||
try { | try { | ||||
rtAudio->stopStream(); | rtAudio->stopStream(); | ||||
} | } | ||||
catch (RtAudioError &e) { | catch (RtAudioError &e) { | ||||
warn("Failed to stop RtAudio stream %s", e.what()); | |||||
WARN("Failed to stop RtAudio stream %s", e.what()); | |||||
} | } | ||||
} | } | ||||
if (rtAudio->isStreamOpen()) { | if (rtAudio->isStreamOpen()) { | ||||
info("Closing RtAudio stream %d", device); | |||||
INFO("Closing RtAudio stream %d", device); | |||||
try { | try { | ||||
rtAudio->closeStream(); | rtAudio->closeStream(); | ||||
} | } | ||||
catch (RtAudioError &e) { | catch (RtAudioError &e) { | ||||
warn("Failed to close RtAudio stream %s", e.what()); | |||||
WARN("Failed to close RtAudio stream %s", e.what()); | |||||
} | } | ||||
} | } | ||||
deviceInfo = RtAudio::DeviceInfo(); | deviceInfo = RtAudio::DeviceInfo(); | ||||
@@ -102,13 +102,13 @@ struct BridgeClientConnection { | |||||
} | } | ||||
void run() { | void run() { | ||||
info("Bridge client connected"); | |||||
INFO("Bridge client connected"); | |||||
// Check hello key | // Check hello key | ||||
uint32_t hello = -1; | uint32_t hello = -1; | ||||
recv<uint32_t>(&hello); | recv<uint32_t>(&hello); | ||||
if (hello != BRIDGE_HELLO) { | if (hello != BRIDGE_HELLO) { | ||||
info("Bridge client protocol mismatch %x %x", hello, BRIDGE_HELLO); | |||||
INFO("Bridge client protocol mismatch %x %x", hello, BRIDGE_HELLO); | |||||
return; | return; | ||||
} | } | ||||
@@ -118,7 +118,7 @@ struct BridgeClientConnection { | |||||
step(); | step(); | ||||
} | } | ||||
info("Bridge client closed"); | |||||
INFO("Bridge client closed"); | |||||
} | } | ||||
/** Accepts a command from the client */ | /** Accepts a command from the client */ | ||||
@@ -131,7 +131,7 @@ struct BridgeClientConnection { | |||||
switch (command) { | switch (command) { | ||||
default: | default: | ||||
case NO_COMMAND: { | case NO_COMMAND: { | ||||
warn("Bridge client: bad command %d detected, closing", command); | |||||
WARN("Bridge client: bad command %d detected, closing", command); | |||||
ready = false; | ready = false; | ||||
} break; | } break; | ||||
@@ -169,7 +169,7 @@ struct BridgeClientConnection { | |||||
float input[BRIDGE_INPUTS * frames]; | float input[BRIDGE_INPUTS * frames]; | ||||
if (!recv(&input, BRIDGE_INPUTS * frames * sizeof(float))) { | if (!recv(&input, BRIDGE_INPUTS * frames * sizeof(float))) { | ||||
debug("Failed to receive"); | |||||
DEBUG("Failed to receive"); | |||||
return; | return; | ||||
} | } | ||||
@@ -177,7 +177,7 @@ struct BridgeClientConnection { | |||||
memset(&output, 0, sizeof(output)); | memset(&output, 0, sizeof(output)); | ||||
processStream(input, output, frames); | processStream(input, output, frames); | ||||
if (!send(&output, BRIDGE_OUTPUTS * frames * sizeof(float))) { | if (!send(&output, BRIDGE_OUTPUTS * frames * sizeof(float))) { | ||||
debug("Failed to send"); | |||||
DEBUG("Failed to send"); | |||||
return; | return; | ||||
} | } | ||||
// flush(); | // flush(); | ||||
@@ -237,17 +237,17 @@ struct BridgeClientConnection { | |||||
static void clientRun(int client) { | static void clientRun(int client) { | ||||
defer({ | |||||
DEFER({ | |||||
#if ARCH_WIN | #if ARCH_WIN | ||||
if (shutdown(client, SD_SEND)) { | if (shutdown(client, SD_SEND)) { | ||||
warn("Bridge client shutdown() failed"); | |||||
WARN("Bridge client shutdown() failed"); | |||||
} | } | ||||
if (closesocket(client)) { | if (closesocket(client)) { | ||||
warn("Bridge client closesocket() failed"); | |||||
WARN("Bridge client closesocket() failed"); | |||||
} | } | ||||
#else | #else | ||||
if (close(client)) { | if (close(client)) { | ||||
warn("Bridge client close() failed"); | |||||
WARN("Bridge client close() failed"); | |||||
} | } | ||||
#endif | #endif | ||||
}); | }); | ||||
@@ -256,7 +256,7 @@ static void clientRun(int client) { | |||||
// Avoid SIGPIPE | // Avoid SIGPIPE | ||||
int flag = 1; | int flag = 1; | ||||
if (setsockopt(client, SOL_SOCKET, SO_NOSIGPIPE, &flag, sizeof(int))) { | if (setsockopt(client, SOL_SOCKET, SO_NOSIGPIPE, &flag, sizeof(int))) { | ||||
warn("Bridge client setsockopt() failed"); | |||||
WARN("Bridge client setsockopt() failed"); | |||||
return; | return; | ||||
} | } | ||||
#endif | #endif | ||||
@@ -265,12 +265,12 @@ static void clientRun(int client) { | |||||
#if ARCH_WIN | #if ARCH_WIN | ||||
unsigned long blockingMode = 0; | unsigned long blockingMode = 0; | ||||
if (ioctlsocket(client, FIONBIO, &blockingMode)) { | if (ioctlsocket(client, FIONBIO, &blockingMode)) { | ||||
warn("Bridge client ioctlsocket() failed"); | |||||
WARN("Bridge client ioctlsocket() failed"); | |||||
return; | return; | ||||
} | } | ||||
#else | #else | ||||
if (fcntl(client, F_SETFL, fcntl(client, F_GETFL, 0) & ~O_NONBLOCK)) { | if (fcntl(client, F_SETFL, fcntl(client, F_GETFL, 0) & ~O_NONBLOCK)) { | ||||
warn("Bridge client fcntl() failed"); | |||||
WARN("Bridge client fcntl() failed"); | |||||
return; | return; | ||||
} | } | ||||
#endif | #endif | ||||
@@ -286,10 +286,10 @@ static void serverConnect() { | |||||
#if ARCH_WIN | #if ARCH_WIN | ||||
WSADATA wsaData; | WSADATA wsaData; | ||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData)) { | if (WSAStartup(MAKEWORD(2, 2), &wsaData)) { | ||||
warn("Bridge server WSAStartup() failed"); | |||||
WARN("Bridge server WSAStartup() failed"); | |||||
return; | return; | ||||
} | } | ||||
defer({ | |||||
DEFER({ | |||||
WSACleanup(); | WSACleanup(); | ||||
}); | }); | ||||
#endif | #endif | ||||
@@ -308,15 +308,15 @@ static void serverConnect() { | |||||
// Open socket | // Open socket | ||||
int server = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | int server = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | ||||
if (server < 0) { | if (server < 0) { | ||||
warn("Bridge server socket() failed"); | |||||
WARN("Bridge server socket() failed"); | |||||
return; | return; | ||||
} | } | ||||
defer({ | |||||
DEFER({ | |||||
if (close(server)) { | if (close(server)) { | ||||
warn("Bridge server close() failed"); | |||||
WARN("Bridge server close() failed"); | |||||
return; | return; | ||||
} | } | ||||
info("Bridge server closed"); | |||||
INFO("Bridge server closed"); | |||||
}); | }); | ||||
#if ARCH_MAC || ARCH_LIN | #if ARCH_MAC || ARCH_LIN | ||||
@@ -326,22 +326,22 @@ static void serverConnect() { | |||||
// Bind socket to address | // Bind socket to address | ||||
if (bind(server, (struct sockaddr*) &addr, sizeof(addr))) { | if (bind(server, (struct sockaddr*) &addr, sizeof(addr))) { | ||||
warn("Bridge server bind() failed"); | |||||
WARN("Bridge server bind() failed"); | |||||
return; | return; | ||||
} | } | ||||
// Listen for clients | // Listen for clients | ||||
if (listen(server, 20)) { | if (listen(server, 20)) { | ||||
warn("Bridge server listen() failed"); | |||||
WARN("Bridge server listen() failed"); | |||||
return; | return; | ||||
} | } | ||||
info("Bridge server started"); | |||||
INFO("Bridge server started"); | |||||
// Enable non-blocking | // Enable non-blocking | ||||
#if ARCH_WIN | #if ARCH_WIN | ||||
unsigned long blockingMode = 1; | unsigned long blockingMode = 1; | ||||
if (ioctlsocket(server, FIONBIO, &blockingMode)) { | if (ioctlsocket(server, FIONBIO, &blockingMode)) { | ||||
warn("Bridge server ioctlsocket() failed"); | |||||
WARN("Bridge server ioctlsocket() failed"); | |||||
return; | return; | ||||
} | } | ||||
#else | #else | ||||
@@ -56,11 +56,11 @@ int main(int argc, char* argv[]) { | |||||
logger::init(devMode); | logger::init(devMode); | ||||
// Log environment | // Log environment | ||||
info("%s %s", gApplicationName.c_str(), gApplicationVersion.c_str()); | |||||
INFO("%s %s", gApplicationName.c_str(), gApplicationVersion.c_str()); | |||||
if (devMode) | if (devMode) | ||||
info("Development mode"); | |||||
info("Global directory: %s", asset::global("").c_str()); | |||||
info("Local directory: %s", asset::local("").c_str()); | |||||
INFO("Development mode"); | |||||
INFO("Global directory: %s", asset::global("").c_str()); | |||||
INFO("Local directory: %s", asset::local("").c_str()); | |||||
// Initialize app | // Initialize app | ||||
pluginInit(devMode); | pluginInit(devMode); | ||||
@@ -85,7 +85,7 @@ json_t *requestJson(Method method, std::string url, json_t *dataJ) { | |||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resText); | curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resText); | ||||
// Perform request | // Perform request | ||||
// info("Requesting %s", url.c_str()); | |||||
// INFO("Requesting %s", url.c_str()); | |||||
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); | // curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); | ||||
CURLcode res = curl_easy_perform(curl); | CURLcode res = curl_easy_perform(curl); | ||||
@@ -64,7 +64,7 @@ static bool loadPlugin(std::string path) { | |||||
// Check file existence | // Check file existence | ||||
if (!system::isFile(libraryFilename)) { | if (!system::isFile(libraryFilename)) { | ||||
warn("Plugin file %s does not exist", libraryFilename.c_str()); | |||||
WARN("Plugin file %s does not exist", libraryFilename.c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -75,13 +75,13 @@ static bool loadPlugin(std::string path) { | |||||
SetErrorMode(0); | SetErrorMode(0); | ||||
if (!handle) { | if (!handle) { | ||||
int error = GetLastError(); | int error = GetLastError(); | ||||
warn("Failed to load library %s: code %d", libraryFilename.c_str(), error); | |||||
WARN("Failed to load library %s: code %d", libraryFilename.c_str(), error); | |||||
return false; | return false; | ||||
} | } | ||||
#else | #else | ||||
void *handle = dlopen(libraryFilename.c_str(), RTLD_NOW); | void *handle = dlopen(libraryFilename.c_str(), RTLD_NOW); | ||||
if (!handle) { | if (!handle) { | ||||
warn("Failed to load library %s: %s", libraryFilename.c_str(), dlerror()); | |||||
WARN("Failed to load library %s: %s", libraryFilename.c_str(), dlerror()); | |||||
return false; | return false; | ||||
} | } | ||||
#endif | #endif | ||||
@@ -95,7 +95,7 @@ static bool loadPlugin(std::string path) { | |||||
initCallback = (InitCallback) dlsym(handle, "init"); | initCallback = (InitCallback) dlsym(handle, "init"); | ||||
#endif | #endif | ||||
if (!initCallback) { | if (!initCallback) { | ||||
warn("Failed to read init() symbol in %s", libraryFilename.c_str()); | |||||
WARN("Failed to read init() symbol in %s", libraryFilename.c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -108,7 +108,7 @@ static bool loadPlugin(std::string path) { | |||||
// Reject plugin if slug already exists | // Reject plugin if slug already exists | ||||
Plugin *oldPlugin = pluginGetPlugin(plugin->slug); | Plugin *oldPlugin = pluginGetPlugin(plugin->slug); | ||||
if (oldPlugin) { | if (oldPlugin) { | ||||
warn("Plugin \"%s\" is already loaded, not attempting to load it again", plugin->slug.c_str()); | |||||
WARN("Plugin \"%s\" is already loaded, not attempting to load it again", plugin->slug.c_str()); | |||||
// TODO | // TODO | ||||
// Fix memory leak with `plugin` here | // Fix memory leak with `plugin` here | ||||
return false; | return false; | ||||
@@ -116,7 +116,7 @@ static bool loadPlugin(std::string path) { | |||||
// Add plugin to list | // Add plugin to list | ||||
gPlugins.push_back(plugin); | gPlugins.push_back(plugin); | ||||
info("Loaded plugin %s %s from %s", plugin->slug.c_str(), plugin->version.c_str(), libraryFilename.c_str()); | |||||
INFO("Loaded plugin %s %s from %s", plugin->slug.c_str(), plugin->version.c_str(), libraryFilename.c_str()); | |||||
return true; | return true; | ||||
} | } | ||||
@@ -135,7 +135,7 @@ static bool syncPlugin(std::string slug, json_t *manifestJ, bool dryRun) { | |||||
// Get latest version | // Get latest version | ||||
json_t *latestVersionJ = json_object_get(manifestJ, "latestVersion"); | json_t *latestVersionJ = json_object_get(manifestJ, "latestVersion"); | ||||
if (!latestVersionJ) { | if (!latestVersionJ) { | ||||
warn("Could not get latest version of plugin %s", slug.c_str()); | |||||
WARN("Could not get latest version of plugin %s", slug.c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
std::string latestVersion = json_string_value(latestVersionJ); | std::string latestVersion = json_string_value(latestVersionJ); | ||||
@@ -178,10 +178,10 @@ static bool syncPlugin(std::string slug, json_t *manifestJ, bool dryRun) { | |||||
// Check if available | // Check if available | ||||
json_t *availableResJ = network::requestJson(network::METHOD_GET, downloadUrl, NULL); | json_t *availableResJ = network::requestJson(network::METHOD_GET, downloadUrl, NULL); | ||||
if (!availableResJ) { | if (!availableResJ) { | ||||
warn("Could not check whether download is available"); | |||||
WARN("Could not check whether download is available"); | |||||
return false; | return false; | ||||
} | } | ||||
defer({ | |||||
DEFER({ | |||||
json_decref(availableResJ); | json_decref(availableResJ); | ||||
}); | }); | ||||
json_t *successJ = json_object_get(availableResJ, "success"); | json_t *successJ = json_object_get(availableResJ, "success"); | ||||
@@ -190,12 +190,12 @@ static bool syncPlugin(std::string slug, json_t *manifestJ, bool dryRun) { | |||||
else { | else { | ||||
downloadName = name; | downloadName = name; | ||||
downloadProgress = 0.0; | downloadProgress = 0.0; | ||||
info("Downloading plugin %s %s %s", slug.c_str(), latestVersion.c_str(), arch.c_str()); | |||||
INFO("Downloading plugin %s %s %s", slug.c_str(), latestVersion.c_str(), arch.c_str()); | |||||
// Download zip | // Download zip | ||||
std::string pluginDest = asset::local("plugins/" + slug + ".zip"); | std::string pluginDest = asset::local("plugins/" + slug + ".zip"); | ||||
if (!network::requestDownload(downloadUrl, pluginDest, &downloadProgress)) { | if (!network::requestDownload(downloadUrl, pluginDest, &downloadProgress)) { | ||||
warn("Plugin %s download was unsuccessful", slug.c_str()); | |||||
WARN("Plugin %s download was unsuccessful", slug.c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -226,7 +226,7 @@ static int extractZipHandle(zip_t *za, const char *dir) { | |||||
zip_stat_t zs; | zip_stat_t zs; | ||||
err = zip_stat_index(za, i, 0, &zs); | err = zip_stat_index(za, i, 0, &zs); | ||||
if (err) { | if (err) { | ||||
warn("zip_stat_index() failed: error %d", err); | |||||
WARN("zip_stat_index() failed: error %d", err); | |||||
return err; | return err; | ||||
} | } | ||||
int nameLen = strlen(zs.name); | int nameLen = strlen(zs.name); | ||||
@@ -237,7 +237,7 @@ static int extractZipHandle(zip_t *za, const char *dir) { | |||||
if (zs.name[nameLen - 1] == '/') { | if (zs.name[nameLen - 1] == '/') { | ||||
if (mkdir(path, 0755)) { | if (mkdir(path, 0755)) { | ||||
if (errno != EEXIST) { | if (errno != EEXIST) { | ||||
warn("mkdir(%s) failed: error %d", path, errno); | |||||
WARN("mkdir(%s) failed: error %d", path, errno); | |||||
return errno; | return errno; | ||||
} | } | ||||
} | } | ||||
@@ -245,7 +245,7 @@ static int extractZipHandle(zip_t *za, const char *dir) { | |||||
else { | else { | ||||
zip_file_t *zf = zip_fopen_index(za, i, 0); | zip_file_t *zf = zip_fopen_index(za, i, 0); | ||||
if (!zf) { | if (!zf) { | ||||
warn("zip_fopen_index() failed"); | |||||
WARN("zip_fopen_index() failed"); | |||||
return -1; | return -1; | ||||
} | } | ||||
@@ -263,7 +263,7 @@ static int extractZipHandle(zip_t *za, const char *dir) { | |||||
err = zip_fclose(zf); | err = zip_fclose(zf); | ||||
if (err) { | if (err) { | ||||
warn("zip_fclose() failed: error %d", err); | |||||
WARN("zip_fclose() failed: error %d", err); | |||||
return err; | return err; | ||||
} | } | ||||
fclose(outFile); | fclose(outFile); | ||||
@@ -277,10 +277,10 @@ static int extractZip(const char *filename, const char *path) { | |||||
int err; | int err; | ||||
zip_t *za = zip_open(filename, 0, &err); | zip_t *za = zip_open(filename, 0, &err); | ||||
if (!za) { | if (!za) { | ||||
warn("Could not open zip %s: error %d", filename, err); | |||||
WARN("Could not open zip %s: error %d", filename, err); | |||||
return err; | return err; | ||||
} | } | ||||
defer({ | |||||
DEFER({ | |||||
zip_close(za); | zip_close(za); | ||||
}); | }); | ||||
@@ -294,16 +294,16 @@ static void extractPackages(std::string path) { | |||||
for (std::string packagePath : system::listEntries(path)) { | for (std::string packagePath : system::listEntries(path)) { | ||||
if (string::extension(packagePath) != "zip") | if (string::extension(packagePath) != "zip") | ||||
continue; | continue; | ||||
info("Extracting package %s", packagePath.c_str()); | |||||
INFO("Extracting package %s", packagePath.c_str()); | |||||
// Extract package | // Extract package | ||||
if (extractZip(packagePath.c_str(), path.c_str())) { | if (extractZip(packagePath.c_str(), path.c_str())) { | ||||
warn("Package %s failed to extract", packagePath.c_str()); | |||||
WARN("Package %s failed to extract", packagePath.c_str()); | |||||
message += string::stringf("Could not extract package %s\n", packagePath.c_str()); | message += string::stringf("Could not extract package %s\n", packagePath.c_str()); | ||||
continue; | continue; | ||||
} | } | ||||
// Remove package | // Remove package | ||||
if (remove(packagePath.c_str())) { | if (remove(packagePath.c_str())) { | ||||
warn("Could not delete file %s: error %d", packagePath.c_str(), errno); | |||||
WARN("Could not delete file %s: error %d", packagePath.c_str(), errno); | |||||
} | } | ||||
} | } | ||||
if (!message.empty()) { | if (!message.empty()) { | ||||
@@ -372,7 +372,7 @@ bool pluginSync(bool dryRun) { | |||||
downloadProgress = 0.0; | downloadProgress = 0.0; | ||||
downloadName = "Updating plugins..."; | downloadName = "Updating plugins..."; | ||||
} | } | ||||
defer({ | |||||
DEFER({ | |||||
isDownloading = false; | isDownloading = false; | ||||
}); | }); | ||||
@@ -382,38 +382,38 @@ bool pluginSync(bool dryRun) { | |||||
json_t *pluginsResJ = network::requestJson(network::METHOD_GET, gApiHost + "/plugins", pluginsReqJ); | json_t *pluginsResJ = network::requestJson(network::METHOD_GET, gApiHost + "/plugins", pluginsReqJ); | ||||
json_decref(pluginsReqJ); | json_decref(pluginsReqJ); | ||||
if (!pluginsResJ) { | if (!pluginsResJ) { | ||||
warn("Request for user's plugins failed"); | |||||
WARN("Request for user's plugins failed"); | |||||
return false; | return false; | ||||
} | } | ||||
defer({ | |||||
DEFER({ | |||||
json_decref(pluginsResJ); | json_decref(pluginsResJ); | ||||
}); | }); | ||||
json_t *errorJ = json_object_get(pluginsResJ, "error"); | json_t *errorJ = json_object_get(pluginsResJ, "error"); | ||||
if (errorJ) { | if (errorJ) { | ||||
warn("Request for user's plugins returned an error: %s", json_string_value(errorJ)); | |||||
WARN("Request for user's plugins returned an error: %s", json_string_value(errorJ)); | |||||
return false; | return false; | ||||
} | } | ||||
// Get community manifests | // Get community manifests | ||||
json_t *manifestsResJ = network::requestJson(network::METHOD_GET, gApiHost + "/community/manifests", NULL); | json_t *manifestsResJ = network::requestJson(network::METHOD_GET, gApiHost + "/community/manifests", NULL); | ||||
if (!manifestsResJ) { | if (!manifestsResJ) { | ||||
warn("Request for community manifests failed"); | |||||
WARN("Request for community manifests failed"); | |||||
return false; | return false; | ||||
} | } | ||||
defer({ | |||||
DEFER({ | |||||
json_decref(manifestsResJ); | json_decref(manifestsResJ); | ||||
}); | }); | ||||
// Check each plugin in list of plugin slugs | // Check each plugin in list of plugin slugs | ||||
json_t *pluginsJ = json_object_get(pluginsResJ, "plugins"); | json_t *pluginsJ = json_object_get(pluginsResJ, "plugins"); | ||||
if (!pluginsJ) { | if (!pluginsJ) { | ||||
warn("No plugins array"); | |||||
WARN("No plugins array"); | |||||
return false; | return false; | ||||
} | } | ||||
json_t *manifestsJ = json_object_get(manifestsResJ, "manifests"); | json_t *manifestsJ = json_object_get(manifestsResJ, "manifests"); | ||||
if (!manifestsJ) { | if (!manifestsJ) { | ||||
warn("No manifests object"); | |||||
WARN("No manifests object"); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -152,7 +152,7 @@ static void settingsFromJson(json_t *rootJ) { | |||||
void settingsSave(std::string filename) { | void settingsSave(std::string filename) { | ||||
info("Saving settings %s", filename.c_str()); | |||||
INFO("Saving settings %s", filename.c_str()); | |||||
json_t *rootJ = settingsToJson(); | json_t *rootJ = settingsToJson(); | ||||
if (rootJ) { | if (rootJ) { | ||||
FILE *file = fopen(filename.c_str(), "w"); | FILE *file = fopen(filename.c_str(), "w"); | ||||
@@ -166,7 +166,7 @@ void settingsSave(std::string filename) { | |||||
} | } | ||||
void settingsLoad(std::string filename) { | void settingsLoad(std::string filename) { | ||||
info("Loading settings %s", filename.c_str()); | |||||
INFO("Loading settings %s", filename.c_str()); | |||||
FILE *file = fopen(filename.c_str(), "r"); | FILE *file = fopen(filename.c_str(), "r"); | ||||
if (!file) | if (!file) | ||||
return; | return; | ||||
@@ -178,7 +178,7 @@ void settingsLoad(std::string filename) { | |||||
json_decref(rootJ); | json_decref(rootJ); | ||||
} | } | ||||
else { | else { | ||||
warn("JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text); | |||||
WARN("JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text); | |||||
} | } | ||||
fclose(file); | fclose(file); | ||||
@@ -48,13 +48,13 @@ void copyFile(std::string srcPath, std::string destPath) { | |||||
FILE *source = fopen(srcPath.c_str(), "rb"); | FILE *source = fopen(srcPath.c_str(), "rb"); | ||||
if (!source) | if (!source) | ||||
return; | return; | ||||
defer({ | |||||
DEFER({ | |||||
fclose(source); | fclose(source); | ||||
}); | }); | ||||
FILE *dest = fopen(destPath.c_str(), "wb"); | FILE *dest = fopen(destPath.c_str(), "wb"); | ||||
if (!dest) | if (!dest) | ||||
return; | return; | ||||
defer({ | |||||
DEFER({ | |||||
fclose(dest); | fclose(dest); | ||||
}); | }); | ||||
// Copy buffer | // Copy buffer | ||||
@@ -62,7 +62,7 @@ void FramebufferWidget::draw(NVGcontext *vg) { | |||||
if (fbSize.isZero()) | if (fbSize.isZero()) | ||||
return; | return; | ||||
// info("rendering framebuffer %f %f", fbSize.x, fbSize.y); | |||||
// INFO("rendering framebuffer %f %f", fbSize.x, fbSize.y); | |||||
// Delete old one first to free up GPU memory | // Delete old one first to free up GPU memory | ||||
internal->setFramebuffer(NULL); | internal->setFramebuffer(NULL); | ||||
// Create a framebuffer from the main nanovg context. We will draw to this in the secondary nanovg context. | // Create a framebuffer from the main nanovg context. We will draw to this in the secondary nanovg context. | ||||
@@ -300,7 +300,7 @@ void dropCallback(GLFWwindow *window, int count, const char **paths) { | |||||
} | } | ||||
void errorCallback(int error, const char *description) { | void errorCallback(int error, const char *description) { | ||||
warn("GLFW error %d: %s", error, description); | |||||
WARN("GLFW error %d: %s", error, description); | |||||
} | } | ||||
void renderGui() { | void renderGui() { | ||||
@@ -496,7 +496,7 @@ void windowRun() { | |||||
std::this_thread::sleep_for(std::chrono::duration<double>(minTime - frameTime)); | std::this_thread::sleep_for(std::chrono::duration<double>(minTime - frameTime)); | ||||
} | } | ||||
endTime = glfwGetTime(); | endTime = glfwGetTime(); | ||||
// info("%lf fps", 1.0 / (endTime - startTime)); | |||||
// INFO("%lf fps", 1.0 / (endTime - startTime)); | |||||
} | } | ||||
} | } | ||||
@@ -637,10 +637,10 @@ bool windowGetFullScreen() { | |||||
Font::Font(const std::string &filename) { | Font::Font(const std::string &filename) { | ||||
handle = nvgCreateFont(gVg, filename.c_str(), filename.c_str()); | handle = nvgCreateFont(gVg, filename.c_str(), filename.c_str()); | ||||
if (handle >= 0) { | if (handle >= 0) { | ||||
info("Loaded font %s", filename.c_str()); | |||||
INFO("Loaded font %s", filename.c_str()); | |||||
} | } | ||||
else { | else { | ||||
warn("Failed to load font %s", filename.c_str()); | |||||
WARN("Failed to load font %s", filename.c_str()); | |||||
} | } | ||||
} | } | ||||
@@ -663,10 +663,10 @@ std::shared_ptr<Font> Font::load(const std::string &filename) { | |||||
Image::Image(const std::string &filename) { | Image::Image(const std::string &filename) { | ||||
handle = nvgCreateImage(gVg, filename.c_str(), NVG_IMAGE_REPEATX | NVG_IMAGE_REPEATY); | handle = nvgCreateImage(gVg, filename.c_str(), NVG_IMAGE_REPEATX | NVG_IMAGE_REPEATY); | ||||
if (handle > 0) { | if (handle > 0) { | ||||
info("Loaded image %s", filename.c_str()); | |||||
INFO("Loaded image %s", filename.c_str()); | |||||
} | } | ||||
else { | else { | ||||
warn("Failed to load image %s", filename.c_str()); | |||||
WARN("Failed to load image %s", filename.c_str()); | |||||
} | } | ||||
} | } | ||||
@@ -690,10 +690,10 @@ std::shared_ptr<Image> Image::load(const std::string &filename) { | |||||
SVG::SVG(const std::string &filename) { | SVG::SVG(const std::string &filename) { | ||||
handle = nsvgParseFromFile(filename.c_str(), "px", SVG_DPI); | handle = nsvgParseFromFile(filename.c_str(), "px", SVG_DPI); | ||||
if (handle) { | if (handle) { | ||||
info("Loaded SVG %s", filename.c_str()); | |||||
INFO("Loaded SVG %s", filename.c_str()); | |||||
} | } | ||||
else { | else { | ||||
warn("Failed to load SVG %s", filename.c_str()); | |||||
WARN("Failed to load SVG %s", filename.c_str()); | |||||
} | } | ||||
} | } | ||||