liquidsfz
Loading...
Searching...
No Matches
liquidsfz.hh
Go to the documentation of this file.
1// This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
2
3#pragma once
4
5#include <memory>
6#include <functional>
7#include <vector>
8#include <string>
9
10typedef unsigned int uint;
11
16namespace LiquidSFZ
17{
18
22enum class Log {
23 DEBUG,
24 INFO,
25 WARNING,
26 ERROR,
27 DISABLE_ALL // special log level which can be used to disable all logging
28};
29
33class CCInfo
34{
35 friend class Synth;
36
37 struct Impl;
38 std::unique_ptr<Impl> impl;
39public:
40 CCInfo();
41 CCInfo (CCInfo&&) = default;
42 ~CCInfo();
43
47 int cc() const;
48
57 std::string label() const;
58
65 bool has_label() const;
66
72 int default_value() const;
73};
74
79{
80 friend class Synth;
81
82 struct Impl;
83 std::unique_ptr<Impl> impl;
84public:
85 KeyInfo();
86 KeyInfo (KeyInfo&&) = default;
87 ~KeyInfo();
88
92 int key() const;
93
100 std::string label() const;
101
108 bool is_switch() const;
109};
110
115{
116 friend class Synth;
117
118 struct Impl;
119 std::unique_ptr<Impl> impl;
120public:
121 ProgramInfo();
122 ProgramInfo (ProgramInfo&&) = default;
123 ~ProgramInfo();
124
131 uint index() const;
132
138 std::string label() const;
139};
140
144class Synth
145{
146 struct Impl;
147 std::unique_ptr<Impl> impl;
148
149public:
150 Synth();
151 ~Synth();
152
159
165 uint sample_rate() const;
166
172 void set_max_voices (uint n_voices);
173
181 uint max_voices() const;
182
196
206 bool live_mode() const;
207
220 void set_preload_time (uint time_ms);
221
231 uint preload_time() const;
232
252
261
274 uint active_voice_count() const;
275
283 void set_gain (float gain);
284
297 bool load (const std::string& filename);
298
307 bool is_bank (const std::string& filename) const;
308
319 bool load_bank (const std::string& filename);
320
329 std::vector<ProgramInfo> list_programs() const;
330
336 bool select_program (uint program);
337
343 std::vector<CCInfo> list_ccs() const;
344
354 std::vector<KeyInfo> list_keys() const;
355
372 void add_event_note_on (uint time_frames, int channel, int key, int velocity);
373
388 void add_event_note_off (uint time_frames, int channel, int key);
389
405 void add_event_cc (uint time_frames, int channel, int cc, int value);
406
422 void add_event_pitch_bend (uint time_frames, int channel, int value);
423
447 void process (float **outputs, uint n_frames);
448
458
471
486 void set_log_level (Log log_level);
487
493 void set_log_function (std::function<void (Log, const char *)> log_function);
494
506 void set_progress_function (std::function<void (double)> progress_function);
507
520 size_t cache_size() const;
521
534 uint cache_file_count() const;
535
553 uint cache_miss_count() const;
554
571
581 size_t max_cache_size() const;
582};
583
584
717}
Information for one continuous controller.
Definition liquidsfz.hh:34
std::string label() const
int default_value() const
bool has_label() const
int cc() const
Information for one key.
Definition liquidsfz.hh:79
std::string label() const
bool is_switch() const
Information for one AriaBank program.
Definition liquidsfz.hh:115
std::string label() const
SFZ Synthesizer (main API)
Definition liquidsfz.hh:145
std::vector< KeyInfo > list_keys() const
List active keys used by this .sfz file.
uint cache_miss_count() const
Get number of sample cache lookup misses.
uint cache_file_count() const
Get number of cached samples.
void system_reset()
System reset.
void set_max_voices(uint n_voices)
Set maximum number of voices.
size_t max_cache_size() const
Get maximum memory used by sample cache.
void set_log_function(std::function< void(Log, const char *)> log_function)
Set custom logging function.
void add_event_note_on(uint time_frames, int channel, int key, int velocity)
Add a note on event.
void set_sample_quality(int sample_quality)
Set sample quality.
bool select_program(uint program)
Select program from previously loaded AriaBank file.
void set_live_mode(bool live_mode)
Set live mode.
void add_event_pitch_bend(uint time_frames, int channel, int value)
Add a pitch bend event.
std::vector< CCInfo > list_ccs() const
List CCs supported by this .sfz file.
int sample_quality()
Get sample quality.
void all_sound_off()
All sound off.
uint preload_time() const
Get preload time.
bool load_bank(const std::string &filename)
Load an AriaBank file.
bool is_bank(const std::string &filename) const
Check if the file is in AriaBank format.
void set_gain(float gain)
Set global gain.
void add_event_cc(uint time_frames, int channel, int cc, int value)
Add a cc event.
void set_max_cache_size(size_t max_cache_size)
Set maximum memory used by sample cache.
uint max_voices() const
Get maximum number of voices.
bool live_mode() const
Get live mode.
bool load(const std::string &filename)
Load .sfz file including all samples.
std::vector< ProgramInfo > list_programs() const
List available programs defined in AriaBank file.
void set_sample_rate(uint sample_rate)
Set sample rate of the synthesizer.
void set_log_level(Log log_level)
Set minimum log level.
uint sample_rate() const
Get sample rate.
void set_progress_function(std::function< void(double)> progress_function)
Set progress function.
void add_event_note_off(uint time_frames, int channel, int key)
Add a note off event.
size_t cache_size() const
Get memory used by sample cache.
void set_preload_time(uint time_ms)
Set preload time.
uint active_voice_count() const
Get active voice count.
void process(float **outputs, uint n_frames)
Synthesize audio.
Log
Log levels for LiquidSFZ::Synth.
Definition liquidsfz.hh:22