Skip to content

Commit

Permalink
Fixed tickets: #3 and #4
Browse files Browse the repository at this point in the history
Closes #3: allow to build with Qt6 without mixing Qt5 libs
Closes #4: errors initializing ALSA, Pulse and Sonivox emit qFatal
instead of qCritical.
  • Loading branch information
pedrolcl committed Sep 2, 2022
1 parent 33cccc7 commit 7d802ab
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cmdlnsynth/CMakeLists.txt
Expand Up @@ -5,7 +5,7 @@ get_target_property( SONIVOX_HEADERS sonivox::sonivox INTERFACE_INCLUDE_DIRECTOR
target_include_directories( cmdlnsynth PRIVATE ${SONIVOX_HEADERS} )

target_link_libraries( cmdlnsynth
Qt5::Core
Qt${QT_VERSION_MAJOR}::Core
Drumstick::ALSA
svoxeas
)
Expand Down
2 changes: 1 addition & 1 deletion guisynth/CMakeLists.txt
Expand Up @@ -20,7 +20,7 @@ get_target_property( SONIVOX_HEADERS sonivox::sonivox INTERFACE_INCLUDE_DIRECTOR
target_include_directories( guisynth PRIVATE ${SONIVOX_HEADERS} )

target_link_libraries( guisynth
Qt5::Widgets
Qt${QT_VERSION_MAJOR}::Widgets
Drumstick::ALSA
svoxeas
)
Expand Down
2 changes: 1 addition & 1 deletion libsvoxeas/CMakeLists.txt
Expand Up @@ -25,7 +25,7 @@ set_target_properties( svoxeas PROPERTIES

target_link_libraries( svoxeas PRIVATE
sonivox::sonivox
Qt5::Core
Qt${QT_VERSION_MAJOR}::Core
Drumstick::ALSA
PkgConfig::PULSE
)
Expand Down
18 changes: 9 additions & 9 deletions libsvoxeas/synthrenderer.cpp
Expand Up @@ -26,6 +26,7 @@
#include "eas_reverb.h"
#include "eas_chorus.h"
#include <pulse/simple.h>
#include <pulse/error.h>
#include <drumstick/sequencererror.h>
#include "synthrenderer.h"
#include "filewrapper.h"
Expand All @@ -45,7 +46,7 @@ SynthRenderer::SynthRenderer(int bufTime, QObject *parent) : QObject(parent),
void
SynthRenderer::initALSA()
{
const QString errorstr = "Fatal error from the ALSA sequencer. "
const char* errorstr = "Fatal error from the ALSA sequencer. "
"This usually happens when the kernel doesn't have ALSA support, "
"or the device node (/dev/snd/seq) doesn't exists, "
"or the kernel module (snd_seq) is not loaded. "
Expand All @@ -69,9 +70,9 @@ SynthRenderer::initALSA()
m_codec = new MidiCodec(256);
m_codec->enableRunningStatus(false);
} catch (const SequencerError& ex) {
qCritical() << errorstr + "Returned error was:" + ex.qstrError();
qFatal("%s Returned error was: %s\n", errorstr, ex.what());
} catch (...) {
qCritical() << errorstr;
qFatal("%s\n", errorstr);
}
qDebug() << Q_FUNC_INFO;
}
Expand All @@ -86,19 +87,19 @@ SynthRenderer::initEAS()

const S_EAS_LIB_CONFIG *easConfig = EAS_Config();
if (easConfig == 0) {
qCritical() << "EAS_Config returned null";
qFatal("EAS_Config returned null\n");
return;
}

eas_res = EAS_Init(&dataHandle);
if (eas_res != EAS_SUCCESS) {
qCritical() << "EAS_Init error: " << eas_res;
qFatal("EAS_Init error: %ld\n", eas_res);
return;
}

eas_res = EAS_OpenMIDIStream(dataHandle, &handle, NULL);
if (eas_res != EAS_SUCCESS) {
qCritical() << "EAS_OpenMIDIStream error: " << eas_res;
qFatal("EAS_OpenMIDIStream error: %ld\n", eas_res);
EAS_Shutdown(dataHandle);
return;
}
Expand Down Expand Up @@ -138,10 +139,9 @@ SynthRenderer::initPulse()
device, "Synthesizer output", &samplespec,
NULL, /* pa_channel_map */
&bufattr, &err);

if (!m_pulseHandle)
if (err != PA_OK || !m_pulseHandle)
{
qCritical() << "Failed to create PulseAudio connection";
qFatal("Failed to create PulseAudio connection. err:%d - %s", err, pa_strerror(err));
}
qDebug() << Q_FUNC_INFO << "latency:" << pa_simple_get_latency(m_pulseHandle, &err);
}
Expand Down

0 comments on commit 7d802ab

Please sign in to comment.