aboutsummaryrefslogtreecommitdiff
path: root/audio/softsynth
diff options
context:
space:
mode:
Diffstat (limited to 'audio/softsynth')
-rw-r--r--audio/softsynth/fluidsynth.cpp52
-rw-r--r--audio/softsynth/mt32/Part.cpp16
-rw-r--r--audio/softsynth/mt32/Part.h5
-rw-r--r--audio/softsynth/mt32/TVA.cpp2
-rw-r--r--audio/softsynth/sid.cpp2
5 files changed, 60 insertions, 17 deletions
diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp
index 2451336784..518e260175 100644
--- a/audio/softsynth/fluidsynth.cpp
+++ b/audio/softsynth/fluidsynth.cpp
@@ -127,12 +127,54 @@ int MidiDriver_FluidSynth::open() {
_synth = new_fluid_synth(_settings);
- // In theory, this ought to reduce CPU load... but it doesn't make any
- // noticeable difference for me, so disable it for now.
+ if (ConfMan.getBool("fluidsynth_chorus_activate")) {
+ fluid_synth_set_chorus_on(_synth, 1);
+
+ int chorusNr = ConfMan.getInt("fluidsynth_chorus_nr");
+ double chorusLevel = (double)ConfMan.getInt("fluidsynth_chorus_level") / 100.0;
+ double chorusSpeed = (double)ConfMan.getInt("fluidsynth_chorus_speed") / 100.0;
+ double chorusDepthMs = (double)ConfMan.getInt("fluidsynth_chorus_depth") / 10.0;
+
+ Common::String chorusWaveForm = ConfMan.get("fluidsynth_chorus_waveform");
+ int chorusType = FLUID_CHORUS_MOD_SINE;
+ if (chorusWaveForm == "sine") {
+ chorusType = FLUID_CHORUS_MOD_SINE;
+ } else {
+ chorusType = FLUID_CHORUS_MOD_TRIANGLE;
+ }
+
+ fluid_synth_set_chorus(_synth, chorusNr, chorusLevel, chorusSpeed, chorusDepthMs, chorusType);
+ } else {
+ fluid_synth_set_chorus_on(_synth, 0);
+ }
+
+ if (ConfMan.getBool("fluidsynth_reverb_activate")) {
+ fluid_synth_set_reverb_on(_synth, 1);
+
+ double reverbRoomSize = (double)ConfMan.getInt("fluidsynth_reverb_roomsize") / 100.0;
+ double reverbDamping = (double)ConfMan.getInt("fluidsynth_reverb_damping") / 100.0;
+ int reverbWidth = ConfMan.getInt("fluidsynth_reverb_width");
+ double reverbLevel = (double)ConfMan.getInt("fluidsynth_reverb_level") / 100.0;
+
+ fluid_synth_set_reverb(_synth, reverbRoomSize, reverbDamping, reverbWidth, reverbLevel);
+ } else {
+ fluid_synth_set_reverb_on(_synth, 0);
+ }
+
+ Common::String interpolation = ConfMan.get("fluidsynth_misc_interpolation");
+ int interpMethod = FLUID_INTERP_4THORDER;
+
+ if (interpolation == "none") {
+ interpMethod = FLUID_INTERP_NONE;
+ } else if (interpolation == "linear") {
+ interpMethod = FLUID_INTERP_LINEAR;
+ } else if (interpolation == "4th") {
+ interpMethod = FLUID_INTERP_4THORDER;
+ } else if (interpolation == "7th") {
+ interpMethod = FLUID_INTERP_7THORDER;
+ }
- // fluid_synth_set_interp_method(_synth, -1, FLUID_INTERP_LINEAR);
- // fluid_synth_set_reverb_on(_synth, 0);
- // fluid_synth_set_chorus_on(_synth, 0);
+ fluid_synth_set_interp_method(_synth, -1, interpMethod);
const char *soundfont = ConfMan.get("soundfont").c_str();
diff --git a/audio/softsynth/mt32/Part.cpp b/audio/softsynth/mt32/Part.cpp
index 852319be70..0c9e576100 100644
--- a/audio/softsynth/mt32/Part.cpp
+++ b/audio/softsynth/mt32/Part.cpp
@@ -246,7 +246,7 @@ void Part::backupCacheToPartials(PatchCache cache[4]) {
// if so then duplicate the cached data from the part to the partial so that
// we can change the part's cache without affecting the partial.
// We delay this until now to avoid a copy operation with every note played
- for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ for (PolyList::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
(*polyIt)->backupCacheToPartials(cache);
}
}
@@ -446,7 +446,7 @@ void Part::abortPoly(Poly *poly) {
}
bool Part::abortFirstPoly(unsigned int key) {
- for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ for (PolyList::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
Poly *poly = *polyIt;
if (poly->getKey() == key) {
abortPoly(poly);
@@ -457,7 +457,7 @@ bool Part::abortFirstPoly(unsigned int key) {
}
bool Part::abortFirstPoly(PolyState polyState) {
- for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ for (PolyList::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
Poly *poly = *polyIt;
if (poly->getState() == polyState) {
abortPoly(poly);
@@ -545,7 +545,7 @@ void Part::playPoly(const PatchCache cache[4], const MemParams::RhythmTemp *rhyt
void Part::allNotesOff() {
// The MIDI specification states - and Mok confirms - that all notes off (0x7B)
// should treat the hold pedal as usual.
- for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ for (PolyList::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
Poly *poly = *polyIt;
// FIXME: This has special handling of key 0 in NoteOff that Mok has not yet confirmed applies to AllNotesOff.
// if (poly->canSustain() || poly->getKey() == 0) {
@@ -560,14 +560,14 @@ void Part::allSoundOff() {
// MIDI "All sound off" (0x78) should release notes immediately regardless of the hold pedal.
// This controller is not actually implemented by the synths, though (according to the docs and Mok) -
// we're only using this method internally.
- for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ for (PolyList::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
Poly *poly = *polyIt;
poly->startDecay();
}
}
void Part::stopPedalHold() {
- for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ for (PolyList::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
Poly *poly = *polyIt;
poly->stopPedalHold();
}
@@ -586,7 +586,7 @@ void Part::stopNote(unsigned int key) {
synth->printDebug("%s (%s): stopping key %d", name, currentInstr, key);
#endif
- for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ for (PolyList::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
Poly *poly = *polyIt;
// Generally, non-sustaining instruments ignore note off. They die away eventually anyway.
// Key 0 (only used by special cases on rhythm part) reacts to note off even if non-sustaining or pedal held.
@@ -608,7 +608,7 @@ unsigned int Part::getActivePartialCount() const {
unsigned int Part::getActiveNonReleasingPartialCount() const {
unsigned int activeNonReleasingPartialCount = 0;
- for (Common::List<Poly *>::const_iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ for (PolyList::const_iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
Poly *poly = *polyIt;
if (poly->getState() != POLY_Releasing) {
activeNonReleasingPartialCount += poly->getActivePartialCount();
diff --git a/audio/softsynth/mt32/Part.h b/audio/softsynth/mt32/Part.h
index 5c59c6d61f..7ae73a818c 100644
--- a/audio/softsynth/mt32/Part.h
+++ b/audio/softsynth/mt32/Part.h
@@ -24,6 +24,7 @@ namespace MT32Emu {
class PartialManager;
class Synth;
+typedef Common::List<Poly *> PolyList;
class Part {
private:
@@ -37,8 +38,8 @@ private:
unsigned int activePartialCount;
PatchCache patchCache[4];
- Common::List<Poly *> freePolys;
- Common::List<Poly *> activePolys;
+ PolyList freePolys;
+ PolyList activePolys;
void setPatch(const PatchParam *patch);
unsigned int midiKeyToKey(unsigned int midiKey);
diff --git a/audio/softsynth/mt32/TVA.cpp b/audio/softsynth/mt32/TVA.cpp
index 7aadd64522..19a01cfc73 100644
--- a/audio/softsynth/mt32/TVA.cpp
+++ b/audio/softsynth/mt32/TVA.cpp
@@ -280,7 +280,7 @@ void TVA::nextPhase() {
}
int newTarget;
- int newIncrement = 0;
+ int newIncrement = 0; // Initialised to please compilers
int envPointIndex = phase;
if (!allLevelsZeroFromNowOn) {
diff --git a/audio/softsynth/sid.cpp b/audio/softsynth/sid.cpp
index 1ad822b86a..b6f1c87c4b 100644
--- a/audio/softsynth/sid.cpp
+++ b/audio/softsynth/sid.cpp
@@ -512,7 +512,7 @@ void Filter::enable_filter(bool enable) {
enabled = enable;
}
-void Filter::reset(){
+void Filter::reset() {
fc = 0;
res = 0;