Skip to content

Commit 499442f

Browse files
committed
0.13.2
1 parent 55cf7d7 commit 499442f

File tree

5 files changed

+53
-37
lines changed

5 files changed

+53
-37
lines changed

buildspec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@
4343
"uuids": {
4444
"windowsApp": "ad885c58-5ca9-44de-8f4f-1c12676626a9"
4545
},
46-
"version": "0.13.1",
46+
"version": "0.13.2",
4747
"website": "https://www.atkaudio.com"
4848
}

lib/atkaudio/src/atkaudio/FifoBuffer2.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include <juce_audio_utils/juce_audio_utils.h>
44

5-
constexpr auto ATK_CORRECTION_RATE = 1 + 1000.0f / 1000000; // 1000 ppm
6-
constexpr auto ATK_SMOOTHING_TIME = 1.0f; // 1 second
5+
constexpr auto ATK_CORRECTION_RATE = 1 + 300.0f / 1000000; // 300 ppm
6+
constexpr auto ATK_SMOOTHING_TIME = 1.0f; // 1 second
77

88
class FifoBuffer2 : public juce::Timer
99
{
@@ -221,8 +221,8 @@ class SyncBuffer : public juce::Timer
221221

222222
isPrepared.store(false, std::memory_order_release);
223223

224-
if (readerNumChannels < 1 || writerNumChannels < 1 || readerBufferSize < 1 || writerBufferSize < 1 ||
225-
readerSampleRate <= 0.0 || writerSampleRate <= 0.0)
224+
if (readerNumChannels < 1 || writerNumChannels < 1 || readerBufferSize < 1 || writerBufferSize < 1
225+
|| readerSampleRate <= 0.0 || writerSampleRate <= 0.0)
226226
{
227227
return;
228228
}
@@ -330,9 +330,10 @@ class SyncBuffer : public juce::Timer
330330
if (writerSamples < writerSamplesNeeded)
331331
{
332332
#ifdef JUCE_DEBUG
333-
DBG("got " << writerSamples << " needed " << writerSamplesNeeded << " ratio " << ratio);
333+
DBG(juce::Time::getCurrentTime().toString(true, true)
334+
<< " got " << writerSamples << " needed " << writerSamplesNeeded << " ratio " << ratio);
334335
#endif
335-
return false;
336+
// return false;
336337
}
337338

338339
if (!addToBuffer)
@@ -360,6 +361,8 @@ class SyncBuffer : public juce::Timer
360361
tempBuffer.getReadPointer(i) + totalSamplesConsumed,
361362
dest[ch] + j,
362363
1,
364+
samplesAvailable,
365+
0,
363366
1.0f
364367
);
365368
samplesAvailable -= samplesConsumed;
@@ -368,8 +371,8 @@ class SyncBuffer : public juce::Timer
368371
}
369372

370373
#ifdef JUCE_DEBUG
371-
if (!juce::approximatelyEqual(finalRatio, prevFinalRatio) &&
372-
juce::approximatelyEqual(finalRatio, (float)(writerSampleRate / readerSampleRate)))
374+
if (!juce::approximatelyEqual(finalRatio, prevFinalRatio)
375+
&& juce::approximatelyEqual(finalRatio, (float)(writerSampleRate / readerSampleRate)))
373376
DBG("time: " << juce::Time::getCurrentTime().toString(true, true)
374377
<< juce::String(" final ratio ") + juce::String(finalRatio));
375378
#endif

lib/atkaudio/src/atkaudio/PluginHost2/UI/GraphEditorPanel.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ struct GraphEditorPanel::PinComponent final
2828
auto channel = processor.getOffsetInBusBufferForAbsoluteChannelIndex(isInput, pin.channelIndex, busIdx);
2929

3030
if (auto* bus = processor.getBus(isInput, busIdx))
31-
tip =
32-
bus->getName() + ": " +
33-
AudioChannelSet::getAbbreviatedChannelTypeName(bus->getCurrentLayout().getTypeOfChannel(channel)
31+
tip = bus->getName() + ": "
32+
+ AudioChannelSet::getAbbreviatedChannelTypeName(
33+
bus->getCurrentLayout().getTypeOfChannel(channel)
3434
);
3535
else
3636
tip = (isInput ? "Main Input: " : "Main Output: ") + String(pin.channelIndex + 1);
@@ -212,8 +212,8 @@ struct GraphEditorPanel::PluginComponent final
212212
const int total = isInput ? numIns : numOuts;
213213
const int index = pin->pin.isMIDI() ? (total - 1) : channelIndex;
214214

215-
auto totalSpaces = static_cast<float>(total) +
216-
(static_cast<float>(jmax(0, processor->getBusCount(isInput) - 1)) * 0.5f);
215+
auto totalSpaces = static_cast<float>(total)
216+
+ (static_cast<float>(jmax(0, processor->getBusCount(isInput) - 1)) * 0.5f);
217217
auto indexPos = static_cast<float>(index) + (static_cast<float>(busIdx) * 0.5f);
218218

219219
pin->setBounds(
@@ -1181,7 +1181,7 @@ GraphDocumentComponent::~GraphDocumentComponent()
11811181
void GraphDocumentComponent::resized()
11821182
{
11831183
auto area = getLocalBounds();
1184-
cpuLoadLabel.setBounds(area.removeFromTop(24).removeFromRight(120));
1184+
cpuLoadLabel.setBounds(area.removeFromTop(24).removeFromRight(180));
11851185

11861186
auto r = [this]
11871187
{
@@ -1230,8 +1230,8 @@ void GraphDocumentComponent::releaseGraph()
12301230
bool GraphDocumentComponent::isInterestedInDragSource(const SourceDetails& details)
12311231
{
12321232
return (
1233-
(dynamic_cast<ListBox*>(details.sourceComponent.get()) != nullptr) &&
1234-
details.description.toString().startsWith("PLUGIN")
1233+
(dynamic_cast<ListBox*>(details.sourceComponent.get()) != nullptr)
1234+
&& details.description.toString().startsWith("PLUGIN")
12351235
);
12361236
}
12371237

lib/atkaudio/src/atkaudio/PluginHost2/UI/GraphEditorPanel.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,20 @@ class GraphDocumentComponent final
112112
}
113113
cpuLoadPrev = cpuLoad;
114114

115-
cpuLoadLabel.setText("CPU: " + juce::String(cpuLoad, 2).replace("0.", "."), juce::dontSendNotification);
115+
auto latencySamples = graph->graph.getLatencySamples();
116+
auto latencyMs =
117+
latencySamples > 0
118+
? (int)std::round(
119+
(float)latencySamples / deviceManager.getCurrentAudioDevice()->getCurrentSampleRate() * 1000.0f
120+
)
121+
: 0;
122+
123+
cpuLoadLabel.setText(
124+
"dly: "
125+
// + juce::String(latencySamples) + "smp/"
126+
+ juce::String(latencyMs) + "ms, " + "cpu: " + juce::String(cpuLoad, 2).replace("0.", "."),
127+
juce::dontSendNotification
128+
);
116129
}
117130

118131
void timerCallback() override

src/source_mixer.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static inline obs_source_t* get_sidechain(source_data& sourceData, struct audios
162162
{
163163
if (sourceData.weak_sidechain)
164164
return obs_weak_source_get_source(sourceData.weak_sidechain);
165-
return NULL;
165+
return nullptr;
166166
}
167167

168168
static void asmd_capture(void* param, obs_source_t* sourceIn, const struct audio_data* audio_data, bool muted)
@@ -331,7 +331,7 @@ static void asmd_destroy(void* data)
331331
obs_source_t* sidechain = get_sidechain(source, asmd);
332332
if (sidechain)
333333
{
334-
source.source = NULL;
334+
source.source = nullptr;
335335
obs_source_remove_audio_capture_callback(sidechain, asmd_capture, asmd);
336336
obs_source_release(sidechain);
337337
}
@@ -387,7 +387,7 @@ static obs_properties_t* properties(void* data)
387387
obs_property_list_add_int(layout, TEXT_LAYOUT_MONO, 1);
388388
obs_property_list_add_int(layout, TEXT_LAYOUT_STEREO, 2);
389389

390-
obs_source_t* parent = NULL;
390+
obs_source_t* parent = nullptr;
391391

392392
if (asmd)
393393
parent = obs_filter_get_parent(asmd->source);
@@ -433,8 +433,8 @@ static void update(void* data, obs_data_t* s)
433433
{
434434
struct audiosourcemixer_data* asmd = (struct audiosourcemixer_data*)data;
435435

436-
const uint32_t sample_rate = audio_output_get_sample_rate(obs_get_audio());
437-
size_t num_channels = audio_output_get_channels(obs_get_audio());
436+
// const uint32_t sample_rate = audio_output_get_sample_rate(obs_get_audio());
437+
// size_t num_channels = audio_output_get_channels(obs_get_audio());
438438

439439
auto layout = obs_data_get_int(s, S_LAYOUT);
440440

@@ -459,7 +459,7 @@ static void update(void* data, obs_data_t* s)
459459
const char* sidechain_name = obs_data_get_string(s, sidechainText.c_str());
460460

461461
bool valid_sidechain = *sidechain_name && strcmp(sidechain_name, "none") != 0;
462-
obs_weak_source_t* old_weak_sidechain = NULL;
462+
obs_weak_source_t* old_weak_sidechain = nullptr;
463463

464464
asmd->sidechain_update_mutex.lock();
465465

@@ -468,18 +468,18 @@ static void update(void* data, obs_data_t* s)
468468
if (source.weak_sidechain)
469469
{
470470
old_weak_sidechain = source.weak_sidechain;
471-
source.weak_sidechain = NULL;
471+
source.weak_sidechain = nullptr;
472472
}
473473

474474
bfree(source.sidechain_name);
475-
source.sidechain_name = NULL;
475+
source.sidechain_name = nullptr;
476476
}
477477
else if (!source.sidechain_name || strcmp(source.sidechain_name, sidechain_name) != 0)
478478
{
479479
if (source.weak_sidechain)
480480
{
481481
old_weak_sidechain = source.weak_sidechain;
482-
source.weak_sidechain = NULL;
482+
source.weak_sidechain = nullptr;
483483
}
484484

485485
bfree(source.sidechain_name);
@@ -495,7 +495,7 @@ static void update(void* data, obs_data_t* s)
495495

496496
if (old_sidechain)
497497
{
498-
source.source = NULL;
498+
source.source = nullptr;
499499
obs_source_remove_audio_capture_callback(old_sidechain, asmd_capture, asmd);
500500
obs_source_release(old_sidechain);
501501
}
@@ -520,7 +520,7 @@ static void* asmd_create(obs_data_t* settings, obs_source_t* source)
520520

521521
update(asmd, settings);
522522

523-
obs_add_raw_audio_callback(0, NULL, audio_output_callback, asmd);
523+
obs_add_raw_audio_callback(0, nullptr, audio_output_callback, asmd);
524524

525525
UNUSED_PARAMETER(settings);
526526
return asmd;
@@ -541,11 +541,11 @@ static void asmd_tick(void* data, float seconds)
541541

542542
for (auto& source : *asmd->sources)
543543
{
544-
char* new_name = NULL;
544+
char* new_name = nullptr;
545545
asmd->sidechain_update_mutex.lock();
546546

547-
if (t - source.last_callback_time.load(std::memory_order_acquire) >
548-
(2.0 * source.frames.load()) / sampleRate * 1000000000)
547+
if (t - source.last_callback_time.load(std::memory_order_acquire)
548+
> (2.0 * source.frames.load()) / sampleRate * 1000000000)
549549
source.isActive.store(false, std::memory_order_release);
550550

551551
if (source.sidechain_name && !source.weak_sidechain)
@@ -561,17 +561,17 @@ static void asmd_tick(void* data, float seconds)
561561

562562
if (new_name)
563563
{
564-
obs_source_t* sidechain = *new_name ? obs_get_source_by_name(new_name) : NULL;
565-
obs_weak_source_t* weak_sidechain = sidechain ? obs_source_get_weak_source(sidechain) : NULL;
564+
obs_source_t* sidechain = *new_name ? obs_get_source_by_name(new_name) : nullptr;
565+
obs_weak_source_t* weak_sidechain = sidechain ? obs_source_get_weak_source(sidechain) : nullptr;
566566

567567
for (auto& source : *asmd->sources)
568568
{
569569
if (source.weak_sidechain == weak_sidechain)
570570
{
571571
obs_weak_source_release(weak_sidechain);
572572
obs_source_release(sidechain);
573-
weak_sidechain = NULL;
574-
sidechain = NULL;
573+
weak_sidechain = nullptr;
574+
sidechain = nullptr;
575575
break;
576576
}
577577
}
@@ -581,7 +581,7 @@ static void asmd_tick(void* data, float seconds)
581581
if (source.sidechain_name && strcmp(source.sidechain_name, new_name) == 0)
582582
{
583583
source.weak_sidechain = weak_sidechain;
584-
weak_sidechain = NULL;
584+
weak_sidechain = nullptr;
585585
}
586586

587587
asmd->sidechain_update_mutex.unlock();

0 commit comments

Comments
 (0)