diff --git a/xybrid/data/porttypes.cpp b/xybrid/data/porttypes.cpp index a41e6e8..5ef90dc 100644 --- a/xybrid/data/porttypes.cpp +++ b/xybrid/data/porttypes.cpp @@ -60,13 +60,13 @@ void CommandPort::pull() { lock.lock(); if (tickUpdatedOn == t) { lock.unlock(); return; } // someone else got here before us - dataSize = 0; + size = 0; if (type == Input) { for (auto c : connections) { if (auto p = std::static_pointer_cast(c.lock()); p && p->dataType() == Command) { p->pull(); data = p->data; // just repoint to input's buffer - dataSize = p->dataSize; + size = p->size; break; } } @@ -74,7 +74,7 @@ void CommandPort::pull() { // valid passthrough pt->pull(); data = pt->data; // again, just repoint - dataSize = pt->dataSize; + size = pt->size; } // don't need an else case, size is already zero tickUpdatedOn = t; @@ -83,9 +83,9 @@ void CommandPort::pull() { void CommandPort::push(std::vector v) { tickUpdatedOn = audioEngine->curTickId(); - dataSize = v.size(); - data = static_cast(audioEngine->tickAlloc(dataSize)); - memcpy(data, v.data(), dataSize); + size = v.size(); + data = static_cast(audioEngine->tickAlloc(size)); + memcpy(data, v.data(), size); } void ParameterPort::pull() { @@ -94,24 +94,24 @@ void ParameterPort::pull() { lock.lock(); if (tickUpdatedOn == t) { lock.unlock(); return; } // someone else got here before us - buf = nullptr; + data = nullptr; if (type == Input) { if (isConnected()) { if (auto p = std::static_pointer_cast(connections[0].lock()); p) { p->pull(); - buf = p->buf; + data = p->data; size = p->size; } } } else if (auto pt = std::static_pointer_cast(passthroughTo.lock()); pt && pt->dataType() == Parameter) { pt->pull(); - buf = pt->buf; + data = pt->data; size = pt->size; } - if (!buf) { // no buffer pulled from input or passthrough; create a new one + if (!data) { // no buffer pulled from input or passthrough; create a new one size = audioEngine->curTickSize(); - buf = static_cast(audioEngine->tickAlloc(size * sizeof(double))); - std::fill_n(buf, size, std::numeric_limits::quiet_NaN()); + data = static_cast(audioEngine->tickAlloc(size * sizeof(double))); + std::fill_n(data, size, std::numeric_limits::quiet_NaN()); } tickUpdatedOn = t; diff --git a/xybrid/data/porttypes.h b/xybrid/data/porttypes.h index a3fd79e..754754e 100644 --- a/xybrid/data/porttypes.h +++ b/xybrid/data/porttypes.h @@ -44,7 +44,7 @@ namespace Xybrid::Data { class CommandPort : public Port { public: uint8_t* data; - size_t dataSize; + size_t size; CommandPort() = default; ~CommandPort() override = default; @@ -60,14 +60,14 @@ namespace Xybrid::Data { class ParameterPort : public Port { public: - double* buf; + double* data; size_t size; ParameterPort() = default; ~ParameterPort() override = default; - double& operator[](size_t at) { return buf[at]; } - double& at(size_t at) { return buf[at]; } + double& operator[](size_t at) { return data[at]; } + double& at(size_t at) { return data[at]; } Port::DataType dataType() const override { return Port::Parameter; } diff --git a/xybrid/nodelib/commandreader.cpp b/xybrid/nodelib/commandreader.cpp index e18a1ab..1e4345d 100644 --- a/xybrid/nodelib/commandreader.cpp +++ b/xybrid/nodelib/commandreader.cpp @@ -8,7 +8,7 @@ using namespace Xybrid::Data; CommandReader::CommandReader(CommandPort* p) { p->pull(); data = p->data; - dataSize = p->dataSize; + dataSize = p->size; } CommandReader::operator bool() const { return dataSize >= cur+5; } diff --git a/xybrid/nodes/gadget/transpose.cpp b/xybrid/nodes/gadget/transpose.cpp index 9341e25..c77b499 100644 --- a/xybrid/nodes/gadget/transpose.cpp +++ b/xybrid/nodes/gadget/transpose.cpp @@ -49,12 +49,12 @@ void Transpose::process() { in->pull(); out->pull(); - out->data = reinterpret_cast(audioEngine->tickAlloc(in->dataSize)); - out->dataSize = in->dataSize; - memcpy(out->data, in->data, in->dataSize); // precopy + out->data = reinterpret_cast(audioEngine->tickAlloc(in->size)); + out->size = in->size; + memcpy(out->data, in->data, in->size); // precopy size_t mi = 0; - while (out->dataSize >= mi+5) { + while (out->size >= mi+5) { int16_t& n = reinterpret_cast(out->data[mi+2]); if (n > -1) { int nn = n; diff --git a/xybrid/nodes/instrument/testsynth.cpp b/xybrid/nodes/instrument/testsynth.cpp index c37e335..44bcb76 100644 --- a/xybrid/nodes/instrument/testsynth.cpp +++ b/xybrid/nodes/instrument/testsynth.cpp @@ -74,7 +74,7 @@ void TestSynth::process() { auto smp = *(project->samples.begin()); size_t mi = 0; - while (cp->dataSize >= mi+5) { + while (cp->size >= mi+5) { uint16_t id = reinterpret_cast(cp->data[mi]); int16_t n = reinterpret_cast(cp->data[mi+2]); if (n > -1) {