Skip to content

Commit c05215b

Browse files
committed
SuperSonic - update, and follow Clockwork's rename of scope streams to taps
1 parent 6ea981e commit c05215b

12 files changed

Lines changed: 30 additions & 30 deletions

File tree

‎app/api/include/api/audio/audio_processor.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class AudioProcessor
6262
// (the full mix); slots 1..N are fed by fx_scope_out / ScopeOut2 taps.
6363
// Invalid reader if the shm client is not connected or the index is out
6464
// of range. Like the audio tap reader, it keeps its mapping alive.
65-
shm_scope_stream_reader GetScopeReader(unsigned int index);
65+
shm_tap_stream_reader GetScopeReader(unsigned int index);
6666

6767
// Seqlock snapshot of the engine sample clock (sample position ↔ DAC NTP);
6868
// invalid when disconnected or before the engine's first publish.
@@ -96,7 +96,7 @@ class AudioProcessor
9696
void AttachLocked();
9797

9898
std::unique_ptr<shm_segment_client> m_shmClient;
99-
shm_scope_stream_reader m_shmReader;
99+
shm_tap_stream_reader m_shmReader;
100100

101101
// Rate-limits Run()'s reattach attempts while unattached.
102102
std::chrono::steady_clock::time_point m_lastAttachAttempt{};

‎app/api/include/api/sonicpi_api.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ class SonicPiAPI
691691
// live-loop scopes, cards, the Examples jukebox). Invalid reader if the
692692
// audio processor hasn't connected. Combine with AudioProcessor_GetSampleClock
693693
// to window the stream on what the listener is currently hearing.
694-
virtual shm_scope_stream_reader AudioProcessor_GetScopeReader(unsigned int scope_num);
694+
virtual shm_tap_stream_reader AudioProcessor_GetScopeReader(unsigned int scope_num);
695695

696696
// Seqlock-consistent snapshot of the engine's sample clock (sample
697697
// position ↔ wall-clock DAC time). `valid` is false until the engine has

‎app/api/src/audio/audio_processor.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,11 @@ shm_audio_buffer_reader AudioProcessor::GetAudioBufferReader(unsigned int slot)
283283
return m_shmClient->get_audio_buffer_reader(slot);
284284
}
285285

286-
shm_scope_stream_reader AudioProcessor::GetScopeReader(unsigned int index)
286+
shm_tap_stream_reader AudioProcessor::GetScopeReader(unsigned int index)
287287
{
288288
std::lock_guard<std::mutex> lock(m_mutex);
289-
if (!m_shmClient) return shm_scope_stream_reader();
290-
return m_shmClient->get_scope_stream_reader(index);
289+
if (!m_shmClient) return shm_tap_stream_reader();
290+
return m_shmClient->get_tap_stream_reader(index);
291291
}
292292

293293
sample_clock_view AudioProcessor::GetSampleClock()
@@ -364,7 +364,7 @@ void AudioProcessor::AttachLocked()
364364
if (!detail_shm_segment::shm_handle_valid(handle))
365365
throw std::runtime_error("shm attach: " + err);
366366
m_shmClient.reset(new shm_segment_client(handle));
367-
m_shmReader = m_shmClient->get_scope_stream_reader(0);
367+
m_shmReader = m_shmClient->get_tap_stream_reader(0);
368368
m_lastAttachError.clear(); // a later recurrence is worth reporting again
369369
}
370370
catch (const std::exception& e)
@@ -391,7 +391,7 @@ void AudioProcessor::AttachLocked()
391391
m_lastAttachError = what;
392392
}
393393
m_shmClient.reset();
394-
m_shmReader = shm_scope_stream_reader();
394+
m_shmReader = shm_tap_stream_reader();
395395
}
396396
m_lastEndCursor = 0;
397397
m_stalledTicks = 0;
@@ -495,7 +495,7 @@ void AudioProcessor::Run()
495495
m_lastEndCursor = endCursor;
496496
// Scratch sized for the max stride; copy_window reports the one
497497
// it used (a separate channels() read would race re-activation).
498-
m_windowScratch.resize(static_cast<size_t>(FrameSamples) * SHM_SCOPE_STREAM_CHANNELS);
498+
m_windowScratch.resize(static_cast<size_t>(FrameSamples) * SHM_TAP_STREAM_CHANNELS);
499499
uint32_t ch = 1;
500500
m_shmReader.copy_window(endCursor, FrameSamples, m_windowScratch.data(), &ch);
501501

‎app/api/src/osc/osc_handler.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ void OscHandler::oscMessage(std::vector<char> buffer)
597597
ok = arg.isOk();
598598
t.id = id; t.slot = slot; t.sendChannel = send; t.returnChannel = ret;
599599
t.gain = gain; t.mute = mute != 0;
600-
if (slot >= 0 && slot < SHM_SCOPE_TRACK_SLOTS)
601-
t.scopeSlot = SHM_SCOPE_TRACK_SLOT_BASE + slot;
600+
if (slot >= 0 && slot < SHM_TAP_TRACK_SLOTS)
601+
t.scopeSlot = SHM_TAP_TRACK_SLOT_BASE + slot;
602602
for (int32_t k = 0; ok && k < nodeCount; ++k)
603603
{
604604
TrackNodeInfo n;

‎app/api/src/sonicpi_api.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,13 +1149,13 @@ shm_audio_buffer_reader SonicPiAPI::AudioProcessor_GetAudioBufferReader(unsigned
11491149
return shm_audio_buffer_reader();
11501150
}
11511151

1152-
shm_scope_stream_reader SonicPiAPI::AudioProcessor_GetScopeReader(unsigned int scope_num)
1152+
shm_tap_stream_reader SonicPiAPI::AudioProcessor_GetScopeReader(unsigned int scope_num)
11531153
{
11541154
if (m_spAudioProcessor)
11551155
{
11561156
return m_spAudioProcessor->GetScopeReader(scope_num);
11571157
}
1158-
return shm_scope_stream_reader();
1158+
return shm_tap_stream_reader();
11591159
}
11601160

11611161
sample_clock_view SonicPiAPI::AudioProcessor_GetSampleClock()

‎app/gui-tests/loopscope_lifecycle.test.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <memory>
2222

23-
#include <shm_scope_stream.hpp>
23+
#include <shm_tap_stream.hpp>
2424

2525
#include "model/sonicpitheme.h"
2626
#include "utils/scintilla_api.h"
@@ -73,11 +73,11 @@ struct Editor
7373
// A scope-stream slot, as the engine's shared memory holds one.
7474
struct Slot
7575
{
76-
std::unique_ptr<shm_scope_stream> mem = std::make_unique<shm_scope_stream>();
76+
std::unique_ptr<shm_tap_stream> mem = std::make_unique<shm_tap_stream>();
7777
Slot() { mem->state.store(0); }
78-
void live() { shm_scope_stream_writer(mem.get()).activate(2); }
78+
void live() { shm_tap_stream_writer(mem.get()).activate(2); }
7979
void release() { mem->state.store(0); }
80-
shm_scope_stream_reader reader() const { return shm_scope_stream_reader(mem.get()); }
80+
shm_tap_stream_reader reader() const { return shm_tap_stream_reader(mem.get()); }
8181
};
8282

8383
const QString kCode = QStringLiteral("live_loop :t do\n play 60\n sleep 1\nend\n");
@@ -281,7 +281,7 @@ void writeLoudWave(Slot& s, int frames = 16384)
281281
for (int i = 0; i < frames; i++)
282282
l[(size_t)i] = r[(size_t)i] = ((i / 256) % 2) ? 0.9f : -0.9f;
283283
const float* chans[2] = { l.data(), r.data() };
284-
shm_scope_stream_writer(s.mem.get()).write(chans, (uint32_t)frames, 0);
284+
shm_tap_stream_writer(s.mem.get()).write(chans, (uint32_t)frames, 0);
285285
}
286286

287287
QImage rendered(QWidget* w)

‎app/gui/visualizer/scope_window.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ void ScopeWindow::DrawLevels(const ProcessedAudio& audio, QPainter& painter, Sco
346346
{
347347
m_preLimLastEnd = end;
348348
const uint32_t frames = 1024;
349-
m_grScratch.resize(size_t(frames) * SHM_SCOPE_STREAM_CHANNELS);
349+
m_grScratch.resize(size_t(frames) * SHM_TAP_STREAM_CHANNELS);
350350
uint32_t chans = 1;
351351
const uint32_t got = m_preLimReader.copy_window(end, frames, m_grScratch.data(), &chans);
352352
float p = 0.0f;

‎app/gui/visualizer/scope_window.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public slots :
214214
// reserved scope slot (see etc/synthdefs/designs/supercollider/mixer.scd).
215215
// How far that input pushes past the ceiling is what the limiter must
216216
// take off — drawn as the bar's tip crossing into the hot zone.
217-
shm_scope_stream_reader m_preLimReader;
217+
shm_tap_stream_reader m_preLimReader;
218218
uint64_t m_preLimLastEnd = 0;
219219
std::vector<float> m_grScratch;
220220
float m_grTargetDb = 0.0f; // latest window's dB past the ceiling

‎app/gui/widgets/scopesampler.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ScopeSampler : public QWidget
4040
{
4141
m_api = api;
4242
m_reader = api ? api->AudioProcessor_GetScopeReader(scopeNum)
43-
: shm_scope_stream_reader();
43+
: shm_tap_stream_reader();
4444
m_lastEnd = 0;
4545
// Display frame rate only — the stream is lossless at any poll rate.
4646
if (!m_timer->isActive())
@@ -50,7 +50,7 @@ class ScopeSampler : public QWidget
5050
void stopSampling()
5151
{
5252
m_timer->stop();
53-
m_reader = shm_scope_stream_reader();
53+
m_reader = shm_tap_stream_reader();
5454
}
5555

5656
// Frames of stream history the subclass renders per tick.
@@ -81,14 +81,14 @@ class ScopeSampler : public QWidget
8181
// it used (sizing from a separate channels() read would race a slot
8282
// re-activation).
8383
const unsigned int frames = windowFrames();
84-
m_scratch.resize((size_t)frames * SHM_SCOPE_STREAM_CHANNELS);
84+
m_scratch.resize((size_t)frames * SHM_TAP_STREAM_CHANNELS);
8585
uint32_t ch = 1;
8686
m_reader.copy_window(end, frames, m_scratch.data(), &ch);
8787
storeWindow(m_scratch.data(), frames, ch);
8888
update();
8989
}
9090

91-
shm_scope_stream_reader m_reader;
91+
shm_tap_stream_reader m_reader;
9292
SonicPi::SonicPiAPI* m_api = nullptr;
9393
QTimer* m_timer = nullptr;
9494
uint64_t m_lastEnd = 0;

0 commit comments

Comments
 (0)