liquidsfz
liquidsfz.hh
Go to the documentation of this file.
1 /*
2  * liquidsfz - sfz sampler
3  *
4  * Copyright (C) 2019 Stefan Westerfeld
5  *
6  * This library is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or (at your
9  * option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef LIQUIDSFZ_LIQUIDSFZ_HH
22 #define LIQUIDSFZ_LIQUIDSFZ_HH
23 
24 #include <memory>
25 #include <functional>
26 
31 namespace LiquidSFZ
32 {
33 
37 enum class Log {
38  DEBUG,
39  INFO,
40  WARNING,
41  ERROR,
42  DISABLE_ALL // special log level which can be used to disable all logging
43 };
44 
48 class CCInfo
49 {
50  friend class Synth;
51 
52  struct Impl;
53  std::unique_ptr<Impl> impl;
54 public:
55  CCInfo();
56  CCInfo (CCInfo&&) = default;
57  ~CCInfo();
58 
62  int cc() const;
63 
72  std::string label() const;
73 
80  bool has_label() const;
81 
87  int default_value() const;
88 };
89 
93 class Synth
94 {
95  struct Impl;
96  std::unique_ptr<Impl> impl;
97 
98 public:
99  Synth();
100  ~Synth();
101 
107  void set_sample_rate (uint sample_rate);
108 
114  void set_max_voices (uint n_voices);
115 
121  void set_gain (float gain);
122 
130  bool load (const std::string& filename);
131 
137  std::vector<CCInfo> list_ccs() const;
138 
153  void add_event_note_on (uint time_frames, int channel, int key, int velocity);
154 
167  void add_event_note_off (uint time_frames, int channel, int key);
168 
182  void add_event_cc (uint time_frames, int channel, int cc, int value);
183 
197  void add_event_pitch_bend (uint time_frames, int channel, int value);
198 
220  void process (float **outputs, uint n_frames);
221 
236  void set_log_level (Log log_level);
237 
243  void set_log_function (std::function<void (Log, const char *)> log_function);
244 
256  void set_progress_function (std::function<void (double)> progress_function);
257 };
258 
259 }
260 
312 #endif
Log
Log levels for LiquidSFZ::Synth.
Definition: liquidsfz.hh:37
SFZ Synthesizer (main API)
Definition: liquidsfz.hh:93
Information for one continuous controller.
Definition: liquidsfz.hh:48
Definition: liquidsfz.hh:31