Added fluidsynth fixes for macOS and added fluidsynth debug logs.
This commit is contained in:
parent
f57ccb310a
commit
a9e0809a82
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2008-2013 Louis James Barman, all rights reserved
|
||||
Copyright (c) 2008-2021 Louis James Barman, all rights reserved
|
||||
Copyright (c) 2018-2019 Fabien Givors, all rights reserved
|
||||
|
||||
The PianoBooster application
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "Cfg.h"
|
||||
|
||||
float Cfg::m_staveEndX;
|
||||
int Cfg::logLevel = 1;
|
||||
int Cfg::logLevel = LOG_LEVEL_INFO;
|
||||
int Cfg::m_appX;
|
||||
int Cfg::m_appY;
|
||||
int Cfg::m_appWidth;
|
||||
|
|
|
@ -40,6 +40,11 @@
|
|||
#define BENCHMARK_RESULTS()
|
||||
#endif
|
||||
|
||||
#define LOG_LEVEL_NONE 0
|
||||
#define LOG_LEVEL_INFO 1
|
||||
#define LOG_LEVEL_WARN 2
|
||||
#define LOG_LEVEL_DEBUG 3
|
||||
|
||||
class CColor
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -82,7 +82,9 @@ void GuiMidiSetupDialog::init(CSong* song, CSettings* settings)
|
|||
|
||||
#if defined (Q_OS_LINUX)
|
||||
audioDriverCombo->addItems({"pulseaudio", "alsa"});
|
||||
#elif defined (Q_OS_UNIX) || defined (Q_OS_DARWIN)
|
||||
#elif defined (Q_OS_DARWIN)
|
||||
audioDriverCombo->addItems({"coreaudio", "pulseaudio"});
|
||||
#elif defined (Q_OS_UNIX)
|
||||
audioDriverCombo->addItems({"pulseaudio"});
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,6 +28,15 @@
|
|||
|
||||
#include "MidiDeviceFluidSynth.h"
|
||||
|
||||
static fluid_settings_t* s_debug_fluid_settings;
|
||||
|
||||
static void debug_settings_foreach_func (void *data, const char *name, int type)
|
||||
{
|
||||
char buffer[300];
|
||||
fluid_settings_copystr(s_debug_fluid_settings, name, buffer, sizeof (buffer));
|
||||
ppLogDebug("settings_foreach_func %s : %s", name , buffer );
|
||||
}
|
||||
|
||||
CMidiDeviceFluidSynth::CMidiDeviceFluidSynth()
|
||||
{
|
||||
m_synth = nullptr;
|
||||
|
@ -88,8 +97,8 @@ bool CMidiDeviceFluidSynth::openMidiPort(midiType_t type, QString portName)
|
|||
fluid_settings_setint(m_fluidSettings, "audio.period-size", qsettings->value("FluidSynth/bufferSizeCombo", 128).toInt());
|
||||
fluid_settings_setint(m_fluidSettings, "audio.periods", qsettings->value("FluidSynth/bufferCountCombo", 4).toInt());
|
||||
|
||||
#if defined (Q_OS_LINUX)
|
||||
fluid_settings_setstr(m_fluidSettings, "audio.driver", qsettings->value("FluidSynth/audioDriverCombo", "alsa").toString().toStdString().c_str());
|
||||
#if !defined (Q_OS_WINDOWS)
|
||||
fluid_settings_setstr(m_fluidSettings, "audio.driver", qsettings->value("FluidSynth/audioDriverCombo", "pulseaudio").toString().toStdString().c_str());
|
||||
#endif
|
||||
|
||||
// Create the synthesizer.
|
||||
|
@ -113,6 +122,10 @@ bool CMidiDeviceFluidSynth::openMidiPort(midiType_t type, QString portName)
|
|||
}
|
||||
fluid_synth_set_gain(m_synth, qsettings->value("FluidSynth/masterGainSpin", FLUID_DEFAULT_GAIN).toFloat()/100.0f );
|
||||
m_validConnection = true;
|
||||
if (Cfg::logLevel >= LOG_LEVEL_DEBUG) {
|
||||
s_debug_fluid_settings = m_fluidSettings;
|
||||
fluid_settings_foreach(m_fluidSettings, 0, debug_settings_foreach_func);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ void ppLogInfo(const char *msg, ...)
|
|||
va_list ap;
|
||||
|
||||
//fixme should call ppLog
|
||||
if (Cfg::logLevel < 1)
|
||||
if (Cfg::logLevel < LOG_LEVEL_INFO)
|
||||
return;
|
||||
|
||||
openLogFile();
|
||||
|
@ -130,7 +130,7 @@ void ppLogWarn(const char *msg, ...)
|
|||
{
|
||||
va_list ap;
|
||||
|
||||
if (Cfg::logLevel < 2)
|
||||
if (Cfg::logLevel < LOG_LEVEL_WARN)
|
||||
return;
|
||||
|
||||
openLogFile();
|
||||
|
@ -163,7 +163,7 @@ void ppLogDebug( const char *msg, ...)
|
|||
{
|
||||
va_list ap;
|
||||
|
||||
if (Cfg::logLevel < 2)
|
||||
if (Cfg::logLevel < LOG_LEVEL_DEBUG)
|
||||
return;
|
||||
|
||||
openLogFile();
|
||||
|
|
Loading…
Reference in New Issue