@@ -1,6 +1,5 @@ | |||||
#pragma once | #pragma once | ||||
#include <string> | |||||
#include "common.hpp" | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
@@ -9,6 +9,8 @@ | |||||
#include <RtAudio.h> | #include <RtAudio.h> | ||||
#pragma GCC diagnostic pop | #pragma GCC diagnostic pop | ||||
#include "common.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,6 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include "util/common.hpp" | |||||
#include "common.hpp" | |||||
#include "string.hpp" | #include "string.hpp" | ||||
#include "nanovg.h" | #include "nanovg.h" | ||||
@@ -1,5 +1,20 @@ | |||||
#pragma once | #pragma once | ||||
// Include some of the C++ standard library for convenience | |||||
#include <cstdlib> | |||||
#include <cstdio> | |||||
#include <cstdint> | |||||
#include <cstdarg> | |||||
#include <climits> | |||||
#include <cmath> | |||||
#include <cstring> | |||||
#include <cassert> | |||||
#include <string> | |||||
/** Deprecation notice for GCC */ | |||||
#define DEPRECATED __attribute__ ((deprecated)) | |||||
/** Concatenates two literals or two macros | /** Concatenates two literals or two macros | ||||
Example: | Example: | ||||
@@ -11,6 +26,7 @@ expands to | |||||
#define CONCAT_LITERAL(x, y) x ## y | #define CONCAT_LITERAL(x, y) x ## y | ||||
#define CONCAT(x, y) CONCAT_LITERAL(x, y) | #define CONCAT(x, y) CONCAT_LITERAL(x, y) | ||||
/** Surrounds raw text with quotes | /** Surrounds raw text with quotes | ||||
Example: | Example: | ||||
#define NAME "world" | #define NAME "world" | ||||
@@ -22,9 +38,11 @@ and of course the C++ lexer/parser then concatenates the string literals. | |||||
#define TOSTRING_LITERAL(x) #x | #define TOSTRING_LITERAL(x) #x | ||||
#define TOSTRING(x) TOSTRING_LITERAL(x) | #define TOSTRING(x) TOSTRING_LITERAL(x) | ||||
/** Produces the length of a static array in number of elements */ | /** Produces the length of a static array in number of elements */ | ||||
#define LENGTHOF(arr) (sizeof(arr) / sizeof((arr)[0])) | #define LENGTHOF(arr) (sizeof(arr) / sizeof((arr)[0])) | ||||
/** Reserve space for `count` enums starting with `name`. | /** Reserve space for `count` enums starting with `name`. | ||||
Example: | Example: | ||||
enum Foo { | enum Foo { | ||||
@@ -36,9 +54,6 @@ Example: | |||||
*/ | */ | ||||
#define ENUMS(name, count) name, name ## _LAST = name + (count) - 1 | #define ENUMS(name, count) name, name ## _LAST = name + (count) - 1 | ||||
/** Deprecation notice for GCC */ | |||||
#define DEPRECATED __attribute__ ((deprecated)) | |||||
/** References binary files compiled into the program. | /** References binary files compiled into the program. | ||||
For example, to include a file "Test.dat" directly into your program binary, add | For example, to include a file "Test.dat" directly into your program binary, add | ||||
@@ -65,3 +80,46 @@ to get its size in bytes. | |||||
// The symbol "_binary_##sym##_size" doesn't seem to be valid after a plugin is dynamically loaded, so simply take the difference between the two addresses. | // The symbol "_binary_##sym##_size" doesn't seem to be valid after a plugin is dynamically loaded, so simply take the difference between the two addresses. | ||||
#define BINARY_SIZE(sym) ((size_t) (&_binary_##sym##_end - &_binary_##sym##_start)) | #define BINARY_SIZE(sym) ((size_t) (&_binary_##sym##_end - &_binary_##sym##_start)) | ||||
#endif | #endif | ||||
/** C#-style property constructor | |||||
Example: | |||||
Foo *foo = construct<Foo>(&Foo::greeting, "Hello world"); | |||||
*/ | |||||
template<typename T> | |||||
T *construct() { | |||||
return new T(); | |||||
} | |||||
template<typename T, typename F, typename V, typename... Args> | |||||
T *construct(F f, V v, Args... args) { | |||||
T *o = construct<T>(args...); | |||||
o->*f = v; | |||||
return o; | |||||
} | |||||
/** Defers code until the scope is destructed | |||||
From http://www.gingerbill.org/article/defer-in-cpp.html | |||||
Example: | |||||
file = fopen(...); | |||||
DEFER({ | |||||
fclose(file); | |||||
}); | |||||
*/ | |||||
template<typename F> | |||||
struct DeferWrapper { | |||||
F f; | |||||
DeferWrapper(F f) : f(f) {} | |||||
~DeferWrapper() { f(); } | |||||
}; | |||||
template<typename F> | |||||
DeferWrapper<F> deferWrapper(F f) { | |||||
return DeferWrapper<F>(f); | |||||
} | |||||
#define DEFER(code) auto CONCAT(_defer_, __COUNTER__) = deferWrapper([&]() code) | |||||
/** Deprecated lowercase macro */ | |||||
#define defer(...) DEFER(__VA_ARGS__) |
@@ -1,7 +1,7 @@ | |||||
#pragma once | #pragma once | ||||
#include <string.h> | #include <string.h> | ||||
#include "util/common.hpp" | |||||
#include "common.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,6 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include <vector> | #include <vector> | ||||
#include "util/common.hpp" | |||||
#include "common.hpp" | |||||
#include <jansson.h> | #include <jansson.h> | ||||
@@ -1,6 +1,5 @@ | |||||
#pragma once | #pragma once | ||||
#include "util/common.hpp" | |||||
#include "common.hpp" | |||||
#include "midi.hpp" | #include "midi.hpp" | ||||
@@ -1,8 +1,7 @@ | |||||
#pragma once | #pragma once | ||||
#include "util/common.hpp" | |||||
#include "midi.hpp" | |||||
#include <map> | #include <map> | ||||
#include "common.hpp" | |||||
#include "midi.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,4 +1,5 @@ | |||||
#pragma once | #pragma once | ||||
#include "common.hpp" | |||||
/** Example usage: | /** Example usage: | ||||
@@ -1,8 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include <cmath> | |||||
#include <cstdlib> | |||||
#include <algorithm> // for std::min, max | #include <algorithm> // for std::min, max | ||||
#include "macros.hpp" | |||||
#include "common.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,10 +1,9 @@ | |||||
#pragma once | #pragma once | ||||
#include "util/common.hpp" | |||||
#include <vector> | #include <vector> | ||||
#include <queue> | #include <queue> | ||||
#include <set> | #include <set> | ||||
#include <jansson.h> | #include <jansson.h> | ||||
#include "common.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,6 +1,7 @@ | |||||
#pragma once | #pragma once | ||||
#include <string> | #include <string> | ||||
#include <jansson.h> | #include <jansson.h> | ||||
#include "common.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,6 +1,7 @@ | |||||
#pragma once | #pragma once | ||||
#include <string> | #include <string> | ||||
#include <list> | #include <list> | ||||
#include "common.hpp" | |||||
#include "tags.hpp" | #include "tags.hpp" | ||||
@@ -1,10 +1,17 @@ | |||||
#pragma once | #pragma once | ||||
// Include headers that plugins will likely use, for convenience | // Include headers that plugins will likely use, for convenience | ||||
#include "util/common.hpp" | |||||
#include "common.hpp" | |||||
#include "math.hpp" | |||||
#include "string.hpp" | |||||
#include "logger.hpp" | |||||
#include "system.hpp" | |||||
#include "random.hpp" | |||||
#include "network.hpp" | |||||
#include "asset.hpp" | #include "asset.hpp" | ||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "engine.hpp" | #include "engine.hpp" | ||||
#include "window.hpp" | |||||
#include "widgets.hpp" | #include "widgets.hpp" | ||||
#include "app.hpp" | #include "app.hpp" | ||||
#include "ui.hpp" | #include "ui.hpp" | ||||
@@ -16,7 +23,6 @@ namespace rack { | |||||
using namespace math; | using namespace math; | ||||
using namespace string; | using namespace string; | ||||
using namespace logger; | |||||
} // namespace rack | } // namespace rack |
@@ -0,0 +1,31 @@ | |||||
#pragma once | |||||
#include <cstdint> | |||||
#include "common.hpp" | |||||
namespace rack { | |||||
namespace random { | |||||
/** Seeds the RNG with the current time */ | |||||
void init(); | |||||
/** Returns a uniform random uint32_t from 0 to UINT32_MAX */ | |||||
uint32_t u32(); | |||||
uint64_t u64(); | |||||
/** Returns a uniform random float in the interval [0.0, 1.0) */ | |||||
float uniform(); | |||||
/** Returns a normal random number with mean 0 and standard deviation 1 */ | |||||
float normal(); | |||||
} // 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 |
@@ -1,6 +1,5 @@ | |||||
#pragma once | #pragma once | ||||
#include <string> | |||||
#include "common.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,7 +1,7 @@ | |||||
#pragma once | #pragma once | ||||
#include "util/common.hpp" | |||||
#include <cstdarg> | |||||
#include "common.hpp" | |||||
#include <algorithm> // for transform | |||||
#include <libgen.h> // for dirname and basename | #include <libgen.h> // for dirname and basename | ||||
@@ -1,6 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include <string> | |||||
#include <vector> | #include <vector> | ||||
#include "common.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,86 +0,0 @@ | |||||
#pragma once | |||||
// Include most of the C++ standard library for convenience | |||||
#include <cstdlib> | |||||
#include <cstdio> | |||||
#include <cstdint> | |||||
#include <cstring> | |||||
#include <cassert> | |||||
#include <climits> | |||||
#include <string> | |||||
#include <vector> | |||||
#include <condition_variable> | |||||
#include <mutex> | |||||
#include "macros.hpp" | |||||
#include "math.hpp" | |||||
#include "string.hpp" | |||||
#include "logger.hpp" | |||||
#include "system.hpp" | |||||
namespace rack { | |||||
//////////////////// | |||||
// Template hacks | |||||
//////////////////// | |||||
/** C#-style property constructor | |||||
Example: | |||||
Foo *foo = construct<Foo>(&Foo::greeting, "Hello world"); | |||||
*/ | |||||
template<typename T> | |||||
T *construct() { | |||||
return new T(); | |||||
} | |||||
template<typename T, typename F, typename V, typename... Args> | |||||
T *construct(F f, V v, Args... args) { | |||||
T *o = construct<T>(args...); | |||||
o->*f = v; | |||||
return o; | |||||
} | |||||
/** Defers code until the scope is destructed | |||||
From http://www.gingerbill.org/article/defer-in-cpp.html | |||||
Example: | |||||
file = fopen(...); | |||||
defer({ | |||||
fclose(file); | |||||
}); | |||||
*/ | |||||
template<typename F> | |||||
struct DeferWrapper { | |||||
F f; | |||||
DeferWrapper(F f) : f(f) {} | |||||
~DeferWrapper() { f(); } | |||||
}; | |||||
template<typename F> | |||||
DeferWrapper<F> deferWrapper(F f) { | |||||
return DeferWrapper<F>(f); | |||||
} | |||||
#define defer(code) auto CONCAT(_defer_, __COUNTER__) = deferWrapper([&]() code) | |||||
//////////////////// | |||||
// Random number generator | |||||
// random.cpp | |||||
//////////////////// | |||||
/** Seeds the RNG with the current time */ | |||||
void randomInit(); | |||||
/** Returns a uniform random uint32_t from 0 to UINT32_MAX */ | |||||
uint32_t randomu32(); | |||||
uint64_t randomu64(); | |||||
/** Returns a uniform random float in the interval [0.0, 1.0) */ | |||||
float randomUniform(); | |||||
/** Returns a normal random number with mean 0 and standard deviation 1 */ | |||||
float randomNormal(); | |||||
DEPRECATED inline float randomf() {return randomUniform();} | |||||
} // namespace rack |
@@ -5,7 +5,7 @@ | |||||
#include "nanovg.h" | #include "nanovg.h" | ||||
#include "nanosvg.h" | #include "nanosvg.h" | ||||
#include "util/common.hpp" | |||||
#include "common.hpp" | |||||
#include "events.hpp" | #include "events.hpp" | ||||
#include "color.hpp" | #include "color.hpp" | ||||
@@ -1,9 +1,11 @@ | |||||
#pragma once | #pragma once | ||||
#include "widgets.hpp" | |||||
#define GLEW_STATIC | #define GLEW_STATIC | ||||
#include <GL/glew.h> | #include <GL/glew.h> | ||||
#include <GLFW/glfw3.h> | #include <GLFW/glfw3.h> | ||||
#include "common.hpp" | |||||
#include "widgets.hpp" | |||||
#ifdef ARCH_MAC | #ifdef ARCH_MAC | ||||
#define WINDOW_MOD_KEY_NAME "Cmd" | #define WINDOW_MOD_KEY_NAME "Cmd" | ||||
@@ -1,9 +1,5 @@ | |||||
#include "app.hpp" | |||||
#include "engine.hpp" | |||||
#include "plugin.hpp" | |||||
#include "window.hpp" | |||||
#include "asset.hpp" | |||||
#include "osdialog.h" | #include "osdialog.h" | ||||
#include "rack.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,5 +1,6 @@ | |||||
#include "app.hpp" | #include "app.hpp" | ||||
#include "engine.hpp" | #include "engine.hpp" | ||||
#include "random.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -31,7 +32,7 @@ void ParamWidget::reset() { | |||||
void ParamWidget::randomize() { | void ParamWidget::randomize() { | ||||
// Infinite params should not be randomized | // Infinite params should not be randomized | ||||
if (randomizable && std::isfinite(minValue) && std::isfinite(maxValue)) { | if (randomizable && std::isfinite(minValue) && std::isfinite(maxValue)) { | ||||
setValue(math::rescale(randomUniform(), 0.f, 1.f, minValue, maxValue)); | |||||
setValue(math::rescale(random::uniform(), 0.f, 1.f, minValue, maxValue)); | |||||
} | } | ||||
} | } | ||||
@@ -1,4 +1,5 @@ | |||||
#include <thread> | #include <thread> | ||||
#include "system.hpp" | |||||
#include "app.hpp" | #include "app.hpp" | ||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "window.hpp" | #include "window.hpp" | ||||
@@ -1,8 +1,6 @@ | |||||
#include "app.hpp" | |||||
#include "window.hpp" | |||||
#include "osdialog.h" | |||||
#include <string.h> | |||||
#include <thread> | #include <thread> | ||||
#include "osdialog.h" | |||||
#include "rack.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,12 +1,8 @@ | |||||
#include "app.hpp" | |||||
#include "engine.hpp" | |||||
#include "plugin.hpp" | |||||
#include "window.hpp" | |||||
#include "settings.hpp" | |||||
#include "asset.hpp" | |||||
#include <map> | #include <map> | ||||
#include <algorithm> | #include <algorithm> | ||||
#include "osdialog.h" | #include "osdialog.h" | ||||
#include "rack.hpp" | |||||
#include "settings.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,7 +1,3 @@ | |||||
#include "asset.hpp" | |||||
#include "util/common.hpp" | |||||
#include "osdialog.h" | |||||
#if ARCH_MAC | #if ARCH_MAC | ||||
#include <CoreFoundation/CoreFoundation.h> | #include <CoreFoundation/CoreFoundation.h> | ||||
#include <pwd.h> | #include <pwd.h> | ||||
@@ -19,6 +15,9 @@ | |||||
#include <pwd.h> | #include <pwd.h> | ||||
#endif | #endif | ||||
#include "rack.hpp" | |||||
#include "osdialog.h" | |||||
namespace rack { | namespace rack { | ||||
namespace asset { | namespace asset { | ||||
@@ -1,5 +1,5 @@ | |||||
#include "rack.hpp" | |||||
#include "audio.hpp" | #include "audio.hpp" | ||||
#include "util/common.hpp" | |||||
#include "bridge.hpp" | #include "bridge.hpp" | ||||
@@ -1,7 +1,3 @@ | |||||
#include "bridge.hpp" | |||||
#include "util/common.hpp" | |||||
#include "dsp/ringbuffer.hpp" | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#if ARCH_WIN | #if ARCH_WIN | ||||
#include <winsock2.h> | #include <winsock2.h> | ||||
@@ -13,9 +9,12 @@ | |||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#endif | #endif | ||||
#include <thread> | #include <thread> | ||||
#include "rack.hpp" | |||||
#include "bridge.hpp" | |||||
#include "dsp/ringbuffer.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,14 +1,14 @@ | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <assert.h> | |||||
#include <math.h> | |||||
#include <vector> | #include <vector> | ||||
#include <algorithm> | #include <algorithm> | ||||
#include <chrono> | #include <chrono> | ||||
#include <thread> | #include <thread> | ||||
#include <condition_variable> | |||||
#include <mutex> | |||||
#include <xmmintrin.h> | #include <xmmintrin.h> | ||||
#include <pmmintrin.h> | #include <pmmintrin.h> | ||||
#include "rack.hpp" | |||||
#include "engine.hpp" | #include "engine.hpp" | ||||
@@ -1,4 +1,4 @@ | |||||
#include <GLFW/glfw3.h> | |||||
#include "rack.hpp" | |||||
#include "gamepad.hpp" | #include "gamepad.hpp" | ||||
@@ -1,5 +1,5 @@ | |||||
#include "rack.hpp" | |||||
#include "keyboard.hpp" | #include "keyboard.hpp" | ||||
#include <GLFW/glfw3.h> | |||||
namespace rack { | namespace rack { | ||||
@@ -1,4 +1,3 @@ | |||||
#include <cstdarg> | |||||
#include <chrono> | #include <chrono> | ||||
#include "logger.hpp" | #include "logger.hpp" | ||||
#include "asset.hpp" | #include "asset.hpp" | ||||
@@ -1,19 +1,11 @@ | |||||
#include "util/common.hpp" | |||||
#include "engine.hpp" | |||||
#include "window.hpp" | |||||
#include "app.hpp" | |||||
#include "plugin.hpp" | |||||
#include "settings.hpp" | |||||
#include "asset.hpp" | |||||
#include "bridge.hpp" | |||||
#include "midi.hpp" | |||||
#include <unistd.h> | |||||
#include "osdialog.h" | |||||
#include "rack.hpp" | |||||
#include "rtmidi.hpp" | #include "rtmidi.hpp" | ||||
#include "keyboard.hpp" | #include "keyboard.hpp" | ||||
#include "gamepad.hpp" | #include "gamepad.hpp" | ||||
#include "color.hpp" | |||||
#include "osdialog.h" | |||||
#include <unistd.h> | |||||
#include "bridge.hpp" | |||||
#include "settings.hpp" | |||||
#ifdef ARCH_WIN | #ifdef ARCH_WIN | ||||
#include <Windows.h> | #include <Windows.h> | ||||
@@ -59,7 +51,7 @@ int main(int argc, char* argv[]) { | |||||
#endif | #endif | ||||
// Initialize environment | // Initialize environment | ||||
randomInit(); | |||||
random::init(); | |||||
asset::init(devMode); | asset::init(devMode); | ||||
logger::init(devMode); | logger::init(devMode); | ||||
@@ -1,3 +1,4 @@ | |||||
#include "rack.hpp" | |||||
#include "midi.hpp" | #include "midi.hpp" | ||||
#include "rtmidi.hpp" | #include "rtmidi.hpp" | ||||
#include "bridge.hpp" | #include "bridge.hpp" | ||||
@@ -2,7 +2,6 @@ | |||||
#include <curl/curl.h> | #include <curl/curl.h> | ||||
#include <openssl/sha.h> | #include <openssl/sha.h> | ||||
#include "util/common.hpp" | |||||
#include "network.hpp" | #include "network.hpp" | ||||
@@ -1,12 +1,3 @@ | |||||
#include "plugin.hpp" | |||||
#include "app.hpp" | |||||
#include "asset.hpp" | |||||
#include "network.hpp" | |||||
#include "osdialog.h" | |||||
#include <stdio.h> | |||||
#include <assert.h> | |||||
#include <string.h> | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
@@ -28,6 +19,9 @@ | |||||
#endif | #endif | ||||
#include <dirent.h> | #include <dirent.h> | ||||
#include "rack.hpp" | |||||
#include "osdialog.h" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,9 +1,11 @@ | |||||
#include "util/common.hpp" | |||||
#include <time.h> | #include <time.h> | ||||
#include <sys/time.h> | #include <sys/time.h> | ||||
#include "random.hpp" | |||||
#include "math.hpp" | |||||
namespace rack { | namespace rack { | ||||
namespace random { | |||||
// xoroshiro128+ | // xoroshiro128+ | ||||
@@ -27,7 +29,7 @@ static uint64_t xoroshiro128plus_next(void) { | |||||
return result; | return result; | ||||
} | } | ||||
void randomInit() { | |||||
void init() { | |||||
// Only allow the seed to be initialized once during the lifetime of the program. | // Only allow the seed to be initialized once during the lifetime of the program. | ||||
assert(xoroshiro128plus_state[0] == 0 && xoroshiro128plus_state[1] == 0); | assert(xoroshiro128plus_state[0] == 0 && xoroshiro128plus_state[1] == 0); | ||||
struct timeval tv; | struct timeval tv; | ||||
@@ -40,33 +42,34 @@ void randomInit() { | |||||
} | } | ||||
} | } | ||||
uint32_t randomu32() { | |||||
uint32_t u32() { | |||||
return xoroshiro128plus_next() >> 32; | return xoroshiro128plus_next() >> 32; | ||||
} | } | ||||
uint64_t randomu64() { | |||||
uint64_t u64() { | |||||
return xoroshiro128plus_next(); | return xoroshiro128plus_next(); | ||||
} | } | ||||
float randomUniform() { | |||||
float uniform() { | |||||
// 24 bits of granularity is the best that can be done with floats while ensuring that the return value lies in [0.0, 1.0). | // 24 bits of granularity is the best that can be done with floats while ensuring that the return value lies in [0.0, 1.0). | ||||
return (xoroshiro128plus_next() >> (64 - 24)) / powf(2, 24); | return (xoroshiro128plus_next() >> (64 - 24)) / powf(2, 24); | ||||
} | } | ||||
float randomNormal() { | |||||
float normal() { | |||||
// Box-Muller transform | // Box-Muller transform | ||||
float radius = sqrtf(-2.f * logf(1.f - randomUniform())); | |||||
float theta = 2.f * M_PI * randomUniform(); | |||||
float radius = sqrtf(-2.f * logf(1.f - uniform())); | |||||
float theta = 2.f * M_PI * uniform(); | |||||
return radius * sinf(theta); | return radius * sinf(theta); | ||||
// // Central Limit Theorem | // // Central Limit Theorem | ||||
// const int n = 8; | // const int n = 8; | ||||
// float sum = 0.0; | // float sum = 0.0; | ||||
// for (int i = 0; i < n; i++) { | // for (int i = 0; i < n; i++) { | ||||
// sum += randomUniform(); | |||||
// sum += uniform(); | |||||
// } | // } | ||||
// return (sum - n / 2.f) / sqrtf(n / 12.f); | // return (sum - n / 2.f) / sqrtf(n / 12.f); | ||||
} | } | ||||
} // namespace random | |||||
} // namespace rack | } // namespace rack |
@@ -1,5 +1,6 @@ | |||||
#include "rtmidi.hpp" | |||||
#include <map> | #include <map> | ||||
#include "rack.hpp" | |||||
#include "rtmidi.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,9 +1,6 @@ | |||||
#include "settings.hpp" | |||||
#include "app.hpp" | |||||
#include "window.hpp" | |||||
#include "engine.hpp" | |||||
#include "plugin.hpp" | |||||
#include <jansson.h> | #include <jansson.h> | ||||
#include "rack.hpp" | |||||
#include "settings.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -7,7 +7,6 @@ | |||||
#endif | #endif | ||||
#include "system.hpp" | #include "system.hpp" | ||||
#include "util/common.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,16 +1,20 @@ | |||||
#include "window.hpp" | |||||
#include "app.hpp" | |||||
#include "asset.hpp" | |||||
#include "gamepad.hpp" | |||||
#include "keyboard.hpp" | |||||
#include "color.hpp" | |||||
#include <map> | #include <map> | ||||
#include <queue> | #include <queue> | ||||
#include <thread> | #include <thread> | ||||
#ifdef ARCH_MAC | |||||
// For CGAssociateMouseAndMouseCursorPosition | |||||
#include <ApplicationServices/ApplicationServices.h> | |||||
#endif | |||||
#include "osdialog.h" | #include "osdialog.h" | ||||
#include "rack.hpp" | |||||
#include "window.hpp" | |||||
#include "keyboard.hpp" | |||||
#include "gamepad.hpp" | |||||
#define NANOVG_GL2_IMPLEMENTATION 1 | #define NANOVG_GL2_IMPLEMENTATION 1 | ||||
// #define NANOVG_GL3_IMPLEMENTATION 1 | // #define NANOVG_GL3_IMPLEMENTATION 1 | ||||
// #define NANOVG_GLES2_IMPLEMENTATION 1 | // #define NANOVG_GLES2_IMPLEMENTATION 1 | ||||
@@ -25,11 +29,6 @@ | |||||
#define NANOSVG_ALL_COLOR_KEYWORDS | #define NANOSVG_ALL_COLOR_KEYWORDS | ||||
#include "nanosvg.h" | #include "nanosvg.h" | ||||
#ifdef ARCH_MAC | |||||
// For CGAssociateMouseAndMouseCursorPosition | |||||
#include <ApplicationServices/ApplicationServices.h> | |||||
#endif | |||||
namespace rack { | namespace rack { | ||||