1
#ifndef __FWEELIN_FLUIDSYNTH_H
2
#define __FWEELIN_FLUIDSYNTH_H
6
#include <fluidsynth.h>
8
#include "fweelin_core_dsp.h"
9
#include "fweelin_browser.h"
11
// Whacky FluidSynth center of pitchbend is 0x2000 not 0
12
#define FLUIDSYNTH_PITCHBEND_CENTER 0x2000
14
// Small class to encapsulate FluidSynth patches
15
class FluidPatch : public BrowserItem {
18
FluidPatch (int sfontid = 0, int bank = 0, int prog = 0, char *name = 0) :
19
BrowserItem(name), sfontid(sfontid), bank(bank), prog(prog) {};
21
virtual BrowserItemType GetType() { return B_FluidPatch; };
28
// Integrated soft-synth based on libfluidsynth
29
class FluidSynthProcessor : public Processor, public EventListener,
30
public BrowserCallback {
34
FluidSynthProcessor(Fweelin *app, char stereo);
35
virtual ~FluidSynthProcessor();
37
virtual void process(char pre, nframes_t len, AudioBuffers *ab);
39
virtual void ReceiveEvent(Event *ev, EventProducer *from);
41
virtual void ItemBrowsed(BrowserItem *i) { ItemSelected(i); };
42
virtual void ItemSelected(BrowserItem *i);
44
// Send a new patch to synth
45
void SendPatchChange(FluidPatch *p);
47
// Change patches by moving 'patchofs' patches forward or 'fontofs'
48
// soundfonts forward.
49
void AdjustPatch (int patchofs, int fontofs);
51
// Enable/disable FluidSynth- if disabled, bypasses
52
// processor stage to reduce CPU usage, but leaves memory allocated
53
void SetEnable(char en) {
54
// Preprocess audio for smoothing
59
char GetEnable() { return enable; };
61
// Sets up browser patches based on loaded soundfonts
66
// Run FluidSynth in stereo?
69
// Left and right output buffers
73
// And fluidsynth variables..
74
fluid_settings_t *settings;
77
// Currently processing?