OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
soundfont.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
6namespace Dx8 {
7
8class DlsCollection;
9class Wave;
10
11class SoundFont final {
12 private:
13 struct Impl;
14 struct Instance;
15
16 public:
17 enum {
18 SampleRate = 44100,
20 };
21 struct Data;
22
23 class Ticket final {
24 private:
25 std::shared_ptr<Instance> impl;
26 uint8_t note=0;
27
28 public:
29 bool operator==(const std::nullptr_t&) const {
30 return impl==nullptr;
31 }
32
33 friend class SoundFont;
34 };
35
36 SoundFont();
37 SoundFont(std::shared_ptr<Data> &sh, uint32_t dwPatch);
38 ~SoundFont();
39
40 static std::shared_ptr<Data> shared(const DlsCollection& dls, const std::vector<Wave>& wave);
41
42 bool hasNotes() const;
43 void setVolume(float v);
44 void setPan(float p);
45 void mix(float* samples,size_t count);
46
47 Ticket noteOn(uint8_t note, uint8_t velosity);
48 static void noteOff(Ticket& t);
49
50 private:
51 std::shared_ptr<Impl> impl;
52 };
53
54}
bool operator==(const std::nullptr_t &) const
Definition soundfont.h:29
static void noteOff(Ticket &t)
Ticket noteOn(uint8_t note, uint8_t velosity)
bool hasNotes() const
void mix(float *samples, size_t count)
void setPan(float p)
static std::shared_ptr< Data > shared(const DlsCollection &dls, const std::vector< Wave > &wave)
void setVolume(float v)
Definition band.h:10