diff --git a/src/asio-input.cpp b/src/asio-input.cpp
index 45699f8..3851c4a 100644
--- a/src/asio-input.cpp
+++ b/src/asio-input.cpp
@@ -26,7 +26,7 @@ along with this program. If not, see .
#include
#include
#include
-//#include
+// #include
#include
#include
using namespace juce;
@@ -162,16 +162,16 @@ class AudioCB : public juce::AudioIODeviceCallback {
private:
static constexpr unsigned int client_mask = 0x1;
static constexpr unsigned int device_mask = 0x2;
- std::vector _route;
- std::vector _route_out;
- obs_source_audio in;
- obs_source_t *source;
+ std::vector _route;
+ std::vector _route_out;
+ obs_source_audio in;
+ obs_source_t *source;
unsigned int active;
- int read_index = 0;
- int wait_time = 4;
- AudioCB *callback;
- AudioCB *current_callback;
+ int read_index = 0;
+ int wait_time = 4;
+ AudioCB *callback;
+ AudioCB *current_callback;
size_t silent_buffer_size = 0;
uint8_t *silent_buffer = nullptr;
@@ -226,11 +226,13 @@ class AudioCB : public juce::AudioIODeviceCallback {
active |= client_mask;
}
- void device_disconnect() {
+ void device_disconnect()
+ {
active &= client_mask;
}
- void device_reconnect() {
+ void device_reconnect()
+ {
active |= device_mask;
}
@@ -292,10 +294,11 @@ class AudioCB : public juce::AudioIODeviceCallback {
return wait_time;
}
};
+
private:
std::vector _clients;
-public:
+public:
AudioIODevice *getDevice()
{
return _device;
@@ -354,10 +357,10 @@ class AudioCB : public juce::AudioIODeviceCallback {
break;
}
}
-
+
if (!found_client)
_clients.push_back(client);
-
+
client->setCurrentCallback(this);
client->setReadIndex(_write_index);
_thread->addTimeSliceClient(client);
@@ -412,7 +415,7 @@ class AudioCB : public juce::AudioIODeviceCallback {
_thread = global_thread;
} else {
/*
- // update clients with this device to use this callback
+ // update clients with this device to use this callback
// BUGFIX: when pkv modified the source code to use one global thread
// this became bugged, originally
for (int i = 0; i < _thread->getNumClients(); i++) {
@@ -430,7 +433,6 @@ class AudioCB : public juce::AudioIODeviceCallback {
// since we're here, we can mark the device as being ok
known_client->device_reconnect();
}
-
}
if (!_thread->isThreadRunning())
_thread->startThread(10);
@@ -441,7 +443,7 @@ class AudioCB : public juce::AudioIODeviceCallback {
for (auto known_client : _clients) {
known_client->device_disconnect();
}
-
+
blog(LOG_INFO, "Stopped (%s)", _device->getName().toStdString().c_str());
std::string timestamp_string = std::to_string(last_audio_ts);
@@ -456,14 +458,14 @@ class AudioCB : public juce::AudioIODeviceCallback {
if (_thread)
_thread->stopThread(200);
// was ok because _thread was unique to each AudioCB (the this pointer)
- // now any device that sends an error effectively nukes all other processing
- // which likely will cause problems
- */
+ // now any device that sends an error effectively nukes all other processing
+ // which likely will cause problems
+ */
// Instead we'll mark all clients as having the device disconnected
for (auto known_client : _clients) {
known_client->device_disconnect();
}
-
+
std::string error = errorMessage.toStdString();
blog(LOG_ERROR, "Device Error!\n%s", error.c_str());