Skip to content

Commit

Permalink
Fixing simplex edge case when input device supports lower buffer sizes
Browse files Browse the repository at this point in the history
Fix compiler warning for Settings constructor

Version bump and changelog update for 2.2.0-beta1
  • Loading branch information
mikedickey committed Jan 12, 2024
1 parent 6baacac commit c7aeef5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
6 changes: 4 additions & 2 deletions docs/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
- Version: "2.1.1"
Date: 2023-12-xx
- Version: "2.2.0-beta1"
Date: 2023-01-15
Description:
- (updated) Improved support for different input & output devices
- (updated) Various latency improvements for packet loss concealment
- (updated) VS Mode error message for disconnected audio interfaces
- (fixed) VS Mode refused to connect to studios not 48khz
- Version: "2.1.0"
Expand Down
41 changes: 36 additions & 5 deletions src/RtAudioInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,23 @@ void RtAudioInterface::setup(bool verbose)
mRtAudioInput->openStream(
nullptr, &in_params, RTAUDIO_FLOAT32, sampleRate, &bufferFrames,
&RtAudioInterface::wrapperRtAudioCallback, this, &options, errorFunc);
const unsigned int inputBufferFrames = bufferFrames;
mRtAudioOutput->openStream(
&out_params, nullptr, RTAUDIO_FLOAT32, sampleRate, &bufferFrames,
&RtAudioInterface::wrapperRtAudioCallback, this, &options, errorFunc);
if (inputBufferFrames != bufferFrames) {
// output device doesn't support the same buffer size
// try to reopen the input device with new size
const unsigned int outputBufferFrames = bufferFrames;
mRtAudioInput->closeStream();
mRtAudioInput->openStream(
nullptr, &in_params, RTAUDIO_FLOAT32, sampleRate, &bufferFrames,
&RtAudioInterface::wrapperRtAudioCallback, this, &options, errorFunc);
if (outputBufferFrames != bufferFrames) {
// just give up if this still doesn't work
errorText = "The two devices selected are incompatible";
}
}
}
} catch (RtAudioError& e) {
errorText = e.getMessage();
Expand All @@ -374,11 +388,28 @@ void RtAudioInterface::setup(bool verbose)
nullptr, &in_params, RTAUDIO_FLOAT32, sampleRate, &bufferFrames,
&RtAudioInterface::wrapperRtAudioCallback, this, &options)) {
errorText = mRtAudioInput->getErrorText();
} else if (RTAUDIO_NO_ERROR
!= mRtAudioOutput->openStream(
&out_params, nullptr, RTAUDIO_FLOAT32, sampleRate, &bufferFrames,
&RtAudioInterface::wrapperRtAudioCallback, this, &options)) {
errorText = mRtAudioOutput->getErrorText();
} else {
const unsigned int inputBufferFrames = bufferFrames;
if (RTAUDIO_NO_ERROR
!= mRtAudioOutput->openStream(
&out_params, nullptr, RTAUDIO_FLOAT32, sampleRate, &bufferFrames,
&RtAudioInterface::wrapperRtAudioCallback, this, &options)) {
errorText = mRtAudioOutput->getErrorText();
} else if (inputBufferFrames != bufferFrames) {
// output device doesn't support the same buffer size
// try to reopen the input device with new size
const unsigned int outputBufferFrames = bufferFrames;
mRtAudioInput->closeStream();
if (RTAUDIO_NO_ERROR
!= mRtAudioInput->openStream(
nullptr, &in_params, RTAUDIO_FLOAT32, sampleRate, &bufferFrames,
&RtAudioInterface::wrapperRtAudioCallback, this, &options)) {
errorText = mRtAudioInput->getErrorText();
} else if (outputBufferFrames != bufferFrames) {
// just give up if this still doesn't work
errorText = "The two devices selected are incompatible";
}
}
}
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class Settings : public QObject
public:
Settings(bool guiEnabled = false, QObject* parent = nullptr)
: QObject(parent)
#ifndef NO_GUI
#ifdef NO_GUI
, mGuiEnabled(false)
#else
, mGuiEnabled(guiEnabled)
#endif
, mAudioTester(new AudioTester)
Expand Down
2 changes: 1 addition & 1 deletion src/jacktrip_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#include "AudioInterface.h"

constexpr const char* const gVersion = "2.1.1"; ///< JackTrip version
constexpr const char* const gVersion = "2.2.0-beta1"; ///< JackTrip version

//*******************************************************************************
/// \name Default Values
Expand Down

0 comments on commit c7aeef5

Please sign in to comment.