2020-01-25 10:04:31 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
|
2020-01-25 13:13:07 +01:00
|
|
|
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
|
|
|
// license. You should have receive a LICENSE.md file along with the code.
|
|
|
|
|
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
2019-08-30 13:07:37 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
2020-01-04 16:30:23 +01:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
// There's a spurious min/max function in MSVC that makes everything go badly...
|
2020-02-02 21:30:26 +01:00
|
|
|
#ifndef NOMINMAX
|
|
|
|
|
#define NOMINMAX 1
|
|
|
|
|
#endif
|
2020-01-05 00:20:37 +01:00
|
|
|
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
|
2020-01-04 16:30:23 +01:00
|
|
|
#endif
|
2020-02-26 15:27:44 +01:00
|
|
|
#include "absl/strings/string_view.h"
|
2020-01-05 00:58:28 +01:00
|
|
|
#include <cstddef>
|
2020-01-28 21:42:15 +01:00
|
|
|
#include <cstdint>
|
2020-01-04 16:30:23 +01:00
|
|
|
|
2019-08-30 13:07:37 +02:00
|
|
|
namespace sfz {
|
2019-12-22 23:37:22 +01:00
|
|
|
enum class Oversampling: int {
|
2019-12-01 11:57:42 +01:00
|
|
|
x1 = 1,
|
|
|
|
|
x2 = 2,
|
|
|
|
|
x4 = 4,
|
|
|
|
|
x8 = 8
|
|
|
|
|
};
|
2019-08-30 13:07:37 +02:00
|
|
|
|
|
|
|
|
namespace config {
|
|
|
|
|
constexpr float defaultSampleRate { 48000 };
|
2020-03-31 20:13:13 +02:00
|
|
|
constexpr float maxSampleRate { 192000 };
|
2019-08-30 13:07:37 +02:00
|
|
|
constexpr int defaultSamplesPerBlock { 1024 };
|
2019-12-17 22:48:06 +01:00
|
|
|
constexpr int maxBlockSize { 8192 };
|
2020-05-07 20:48:18 +02:00
|
|
|
constexpr int bufferPoolSize { 6 };
|
2020-03-29 17:37:30 +02:00
|
|
|
constexpr int stereoBufferPoolSize { 4 };
|
2020-03-29 17:54:47 +02:00
|
|
|
constexpr int indexBufferPoolSize { 2 };
|
2019-11-30 16:32:43 +01:00
|
|
|
constexpr int preloadSize { 8192 };
|
2020-02-28 01:17:38 +01:00
|
|
|
constexpr int loggerQueueSize { 256 };
|
2020-02-17 00:01:15 +01:00
|
|
|
constexpr int voiceLoggerQueueSize { 256 };
|
2020-01-19 19:02:06 +01:00
|
|
|
constexpr bool loggingEnabled { false };
|
2020-01-05 00:20:37 +01:00
|
|
|
constexpr size_t numChannels { 2 };
|
2019-12-03 21:30:00 +01:00
|
|
|
constexpr int numBackgroundThreads { 4 };
|
2020-06-15 02:06:55 +02:00
|
|
|
constexpr int numVoices { 64 };
|
|
|
|
|
constexpr unsigned maxVoices { 256 };
|
2020-03-31 20:13:13 +02:00
|
|
|
constexpr unsigned smoothingSteps { 512 };
|
2020-04-18 21:01:56 +02:00
|
|
|
constexpr uint8_t gainSmoothing { 5 };
|
2020-03-31 20:13:13 +02:00
|
|
|
constexpr unsigned powerTableSizeExponent { 11 };
|
2020-05-05 23:18:08 +02:00
|
|
|
constexpr int maxFilePromises { maxVoices };
|
2019-12-17 22:49:16 +01:00
|
|
|
constexpr int allSoundOffCC { 120 };
|
|
|
|
|
constexpr int resetCC { 121 };
|
|
|
|
|
constexpr int allNotesOffCC { 123 };
|
|
|
|
|
constexpr int omniOffCC { 124 };
|
|
|
|
|
constexpr int omniOnCC { 125 };
|
2020-03-26 00:12:30 +01:00
|
|
|
constexpr float halfCCThreshold { 0.5f };
|
2019-08-30 13:07:37 +02:00
|
|
|
constexpr int centPerSemitone { 100 };
|
2020-03-31 22:14:48 +02:00
|
|
|
constexpr float virtuallyZero { 0.001f };
|
2020-01-04 16:33:54 +01:00
|
|
|
constexpr float fastReleaseDuration { 0.01f };
|
2019-08-30 13:07:37 +02:00
|
|
|
constexpr char defineCharacter { '$' };
|
2019-12-01 11:57:42 +01:00
|
|
|
constexpr Oversampling defaultOversamplingFactor { Oversampling::x1 };
|
2019-08-30 13:07:37 +02:00
|
|
|
constexpr float A440 { 440.0 };
|
2020-01-05 00:20:37 +01:00
|
|
|
constexpr size_t powerHistoryLength { 16 };
|
2020-05-07 01:27:20 +02:00
|
|
|
constexpr float filteredEnvelopeCutoff { 5 };
|
2020-03-16 23:47:54 +01:00
|
|
|
constexpr uint16_t numCCs { 512 };
|
2020-04-06 01:22:14 +02:00
|
|
|
constexpr int maxCurves { 256 };
|
2019-12-22 23:37:44 +01:00
|
|
|
constexpr int chunkSize { 1024 };
|
2020-05-30 10:41:50 +02:00
|
|
|
constexpr unsigned int defaultAlignment { 16 };
|
2020-02-09 14:45:11 +01:00
|
|
|
constexpr int filtersInPool { maxVoices * 2 };
|
2020-05-16 00:07:27 +02:00
|
|
|
constexpr int excessFileFrames { 8 };
|
2020-05-08 00:20:28 +02:00
|
|
|
/**
|
|
|
|
|
* @brief The threshold for age stealing.
|
|
|
|
|
* In percentage of the voice's max age.
|
|
|
|
|
*/
|
|
|
|
|
constexpr float stealingAgeCoeff { 0.5f };
|
|
|
|
|
/**
|
|
|
|
|
* @brief The threshold for envelope stealing.
|
|
|
|
|
* In percentage of the sum of all envelopes.
|
|
|
|
|
*/
|
|
|
|
|
constexpr float stealingEnvelopeCoeff { 0.5f };
|
2020-02-09 14:45:11 +01:00
|
|
|
constexpr int filtersPerVoice { 2 };
|
|
|
|
|
constexpr int eqsPerVoice { 3 };
|
2020-04-07 16:12:29 +02:00
|
|
|
constexpr int oscillatorsPerVoice { 9 };
|
2020-02-09 16:49:19 +01:00
|
|
|
constexpr float noiseVariance { 0.25f };
|
2020-02-03 00:55:50 +01:00
|
|
|
/**
|
|
|
|
|
Minimum interval in frames between recomputations of coefficients of the
|
|
|
|
|
modulated filter. The lower, the more CPU resources are consumed.
|
|
|
|
|
*/
|
|
|
|
|
constexpr int filterControlInterval { 16 };
|
2020-02-26 15:27:44 +01:00
|
|
|
/**
|
|
|
|
|
Default metadata for MIDIName documents
|
|
|
|
|
*/
|
|
|
|
|
const absl::string_view midnamManufacturer { "The Sfizz authors" };
|
|
|
|
|
const absl::string_view midnamModel { "Sfizz" };
|
2020-02-26 21:09:34 +01:00
|
|
|
/**
|
|
|
|
|
Limit of how many "fxN" buses are accepted (in SFZv2, maximum is 4)
|
|
|
|
|
*/
|
|
|
|
|
constexpr int maxEffectBuses { 256 };
|
2020-03-15 19:12:49 +01:00
|
|
|
// Wavetable constants; amplitude values are matched to reference
|
|
|
|
|
static constexpr unsigned tableSize = 1024;
|
|
|
|
|
static constexpr double amplitudeSine = 0.625;
|
|
|
|
|
static constexpr double amplitudeTriangle = 0.625;
|
|
|
|
|
static constexpr double amplitudeSaw = 0.515;
|
|
|
|
|
static constexpr double amplitudeSquare = 0.515;
|
2019-08-30 13:07:37 +02:00
|
|
|
} // namespace config
|
|
|
|
|
|
2019-11-30 00:52:15 +01:00
|
|
|
} // namespace sfz
|