Bug#1051559: grandorgue: FTBFS with RtAudio 6

2023-09-09 Thread IOhannes m zmoelnig
Source: grandorgue
Version: 3.12.3-1
Followup-For: Bug #1051559
Control: tags -1 patch

Dear Maintainer,

the attached patch fixes the FTBFS (no debdiff for now, sorry).
I haven't really done any functional tests though, so use it with care.
Description: Fix FTBFS with RtAudio6
 Use return codes instead of catching exceptions
Author: IOhannes m zmölnig
Origin: Debian
Forwarded: no
Last-Update: 2023-09-09
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: grandorgue-3.12.3/src/grandorgue/sound/ports/GOSoundRtPort.cpp
===
--- grandorgue-3.12.3.orig/src/grandorgue/sound/ports/GOSoundRtPort.cpp
+++ grandorgue-3.12.3/src/grandorgue/sound/ports/GOSoundRtPort.cpp
@@ -24,26 +24,21 @@ GOSoundRtPort::GOSoundRtPort(
 
 GOSoundRtPort::~GOSoundRtPort() {
   Close();
-  try {
 if (m_rtApi) {
   const RtAudio *rtApi = m_rtApi;
 
   m_rtApi = NULL;
   delete rtApi;
 }
-  } catch (RtAudioError ) {
-wxString error = wxString::FromAscii(e.getMessage().c_str());
-wxLogError(_("RtAudio error: %s"), error.c_str());
-  }
 }
 
 void GOSoundRtPort::Open() {
   Close();
-  if (!m_rtApi)
+  if (!m_rtApi) {
 throw wxString::Format(
   _("Audio device %s not initialised"), m_Name.c_str());
+  }
 
-  try {
 RtAudio::StreamParameters aOutputParam;
 RtAudio::StreamOptions aOptions;
 
@@ -58,7 +53,7 @@ void GOSoundRtPort::Open() {
 
 unsigned samples_per_buffer = m_SamplesPerBuffer;
 
-m_rtApi->openStream(
+if (m_rtApi->openStream(
   ,
   NULL,
   RTAUDIO_FLOAT32,
@@ -66,7 +61,10 @@ void GOSoundRtPort::Open() {
   _per_buffer,
   ,
   this,
-  );
+  )) {
+wxString error = wxString::FromAscii(m_rtApi->getErrorText().c_str());
+throw wxString::Format(_("RtAudio error: %s"), error.c_str());
+}
 m_nBuffers = aOptions.numberOfBuffers;
 if (samples_per_buffer != m_SamplesPerBuffer) {
   if (samples_per_buffer != m_SamplesPerBuffer)
@@ -77,18 +75,17 @@ void GOSoundRtPort::Open() {
   samples_per_buffer);
 }
 m_IsOpen = true;
-  } catch (RtAudioError ) {
-wxString error = wxString::FromAscii(e.getMessage().c_str());
-throw wxString::Format(_("RtAudio error: %s"), error.c_str());
-  }
 }
 
 void GOSoundRtPort::StartStream() {
-  if (!m_rtApi || !m_IsOpen)
+  if (!m_rtApi || !m_IsOpen) {
 throw wxString::Format(_("Audio device %s not open"), m_Name.c_str());
+  }
 
-  try {
-m_rtApi->startStream();
+  if (m_rtApi->startStream()) {
+wxString error = wxString::FromAscii(m_rtApi->getErrorText().c_str());
+throw wxString::Format(_("RtAudio error: %s"), error.c_str());
+  }
 double actual_latency = m_rtApi->getStreamLatency();
 
 /* getStreamLatency returns zero if not supported by the API, in which
@@ -98,10 +95,6 @@ void GOSoundRtPort::StartStream() {
   actual_latency = m_SamplesPerBuffer * m_nBuffers;
 
 SetActualLatency(actual_latency / m_SampleRate);
-  } catch (RtAudioError ) {
-wxString error = wxString::FromAscii(e.getMessage().c_str());
-throw wxString::Format(_("RtAudio error: %s"), error.c_str());
-  }
 
   if (m_rtApi->getStreamSampleRate() != m_SampleRate)
 throw wxString::Format(
@@ -111,18 +104,11 @@ void GOSoundRtPort::StartStream() {
 void GOSoundRtPort::Close() {
   if (!m_rtApi || !m_IsOpen)
 return;
-  try {
-m_rtApi->abortStream();
-  } catch (RtAudioError ) {
-wxString error = wxString::FromAscii(e.getMessage().c_str());
-wxLogError(_("RtAudio error: %s"), error.c_str());
-  }
-  try {
-m_rtApi->closeStream();
-  } catch (RtAudioError ) {
-wxString error = wxString::FromAscii(e.getMessage().c_str());
+  if(m_rtApi->abortStream()) {
+wxString error = wxString::FromAscii(m_rtApi->getErrorText().c_str());
 wxLogError(_("RtAudio error: %s"), error.c_str());
   }
+  m_rtApi->closeStream();
   m_IsOpen = false;
 }
 
@@ -209,8 +195,7 @@ GOSoundPort *GOSoundRtPort::create(
   const GOPortsConfig , GOSound *sound, wxString name) {
   GOSoundRtPort *port = NULL;
 
-  if (portsConfig.IsEnabled(PORT_NAME))
-try {
+  if (portsConfig.IsEnabled(PORT_NAME)) {
   GOSoundPortFactory::NameParser parser(name);
   const wxString subsysName = parser.nextComp();
   wxString apiName
@@ -230,7 +215,6 @@ GOSoundPort *GOSoundRtPort::create(
   && (apiName == rtApiName || apiName.IsEmpty())) {
   RtAudio *rtApi = NULL;
 
-  try {
 rtApi = new RtAudio(apiIndex);
 for (unsigned l = rtApi->getDeviceCount(), i = 0; i < l; i++) {
   const RtAudio::DeviceInfo info = rtApi->getDeviceInfo(i);
@@ -247,10 +231,6 @@ GOSoundPort *GOSoundRtPort::create(
 break;
   }
 }
-  } catch (RtAudioError ) {
-wxString error = wxString::FromAscii(e.getMessage().c_str());
-wxLogError(_("RtAudio error: %s"), error.c_str());
-  }
 

Bug#1051559: grandorgue: FTBFS with RtAudio 6

2023-09-09 Thread IOhannes m zmoelnig
Source: grandorgue
Version: 3.12.3-1
Severity: important
Tags: ftbfs

Dear Maintainer,

grandorgue ftbfs with RtAudio 6 (currently in experimental):

```
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp: In destructor 
‘virtual GOSoundRtPort::~GOSoundRtPort()’:
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:34:12: error: 
‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’?
   34 |   } catch (RtAudioError ) {
  |^~~~
  |RtAudioErrorType
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:35:42: error: ‘e’ 
was not declared in this scope
   35 | wxString error = wxString::FromAscii(e.getMessage().c_str());
  |  ^
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp: In member 
function ‘virtual void GOSoundRtPort::Open()’:
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:80:12: error: 
‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’?
   80 |   } catch (RtAudioError ) {
  |^~~~
  |RtAudioErrorType
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:81:42: error: ‘e’ 
was not declared in this scope
   81 | wxString error = wxString::FromAscii(e.getMessage().c_str());
  |  ^
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp: In member 
function ‘virtual void GOSoundRtPort::StartStream()’:
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:101:12: error: 
‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’?
  101 |   } catch (RtAudioError ) {
  |^~~~
  |RtAudioErrorType
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:102:42: error: 
‘e’ was not declared in this scope
  102 | wxString error = wxString::FromAscii(e.getMessage().c_str());
  |  ^
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp: In member 
function ‘virtual void GOSoundRtPort::Close()’:
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:116:12: error: 
‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’?
  116 |   } catch (RtAudioError ) {
  |^~~~
  |RtAudioErrorType
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:117:42: error: 
‘e’ was not declared in this scope
  117 | wxString error = wxString::FromAscii(e.getMessage().c_str());
  |  ^
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:122:12: error: 
‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’?
  122 |   } catch (RtAudioError ) {
  |^~~~
  |RtAudioErrorType
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:123:42: error: 
‘e’ was not declared in this scope
  123 | wxString error = wxString::FromAscii(e.getMessage().c_str());
  |  ^
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp: In static member 
function ‘static GOSoundPort* GOSoundRtPort::create(const GOPortsConfig&, 
GOSound*, wxString)’:
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:250:20: error: 
‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’?
  250 |   } catch (RtAudioError ) {
  |^~~~
  |RtAudioErrorType
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:251:50: error: 
‘e’ was not declared in this scope
  251 | wxString error = 
wxString::FromAscii(e.getMessage().c_str());
  |  ^
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:261:14: error: 
‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’?
  261 | } catch (RtAudioError ) {
  |  ^~~~
  |  RtAudioErrorType
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:262:44: error: 
‘e’ was not declared in this scope
  262 |   wxString error = wxString::FromAscii(e.getMessage().c_str());
  |^
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp: In static member 
function ‘static void GOSoundRtPort::addDevices(const GOPortsConfig&, 
std::vector&)’:
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:285:29: error: 
‘struct RtAudio::DeviceInfo’ has no member named ‘probed’
  285 |   if (!dev_info.probed)
  | ^~
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:295:20: error: 
‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’?
  295 |   } catch (RtAudioError ) {
  |^~~~
  |RtAudioErrorType
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:296:50: error: 
‘e’ was not declared in this scope
  296 | wxString error = 
wxString::FromAscii(e.getMessage().c_str());
  |  ^
/<>/src/grandorgue/sound/ports/GOSoundRtPort.cpp:303:14: error: