Skip to content

Commit

Permalink
Rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
SirBob01 committed May 15, 2023
1 parent 17cd2c5 commit 0331248
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions src/Sound/AudioGraph/AudioNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
#include <cstdio>

namespace Dynamo::Sound {
const std::vector<AudioConnection> &AudioNode::get_output_edges() const {
return _output_edges;
const std::vector<AudioConnection> &AudioNode::get_outgoing() const {
return _outgoing;
}

void AudioNode::connect(AudioNode &destination,
u32 input_channel,
u32 output_channel) {
_output_edges.push_back({destination, input_channel, output_channel});
_outgoing.push_back({destination, input_channel, output_channel});
}

void AudioNode::disconnect() { _output_edges.clear(); }
void AudioNode::disconnect() { _outgoing.clear(); }

void AudioNode::disconnect(AudioNode &destination,
u32 input_channel,
u32 output_channel) {
auto it = _output_edges.begin();
while (it != _output_edges.end()) {
auto it = _outgoing.begin();
while (it != _outgoing.end()) {
AudioConnection &edge = *it;
if (&edge.destination.get() == &destination &&
if (&edge.outnode.get() == &destination &&
edge.input_channel == input_channel &&
edge.output_channel == output_channel) {
it = _output_edges.erase(it);
it = _outgoing.erase(it);
return;
} else {
it++;
Expand Down
12 changes: 6 additions & 6 deletions src/Sound/AudioGraph/AudioNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ namespace Dynamo::Sound {
class AudioNode;

/**
* @brief Connection between two AudioNodes.
* @brief Connection with an outgoing AudioNode.
*
*/
struct AudioConnection {
/**
* @brief Destination node.
* @brief Out node.
*
*/
std::reference_wrapper<AudioNode> destination;
std::reference_wrapper<AudioNode> outnode;

/**
* @brief Input channel index.
Expand All @@ -42,7 +42,7 @@ namespace Dynamo::Sound {
*
*/
class AudioNode {
std::vector<AudioConnection> _output_edges;
std::vector<AudioConnection> _outgoing;

public:
/**
Expand All @@ -52,11 +52,11 @@ namespace Dynamo::Sound {
virtual ~AudioNode() = 0;

/**
* @brief Get the output edges object.
* @brief Get the outgoing connections.
*
* @return const std::vector<AudioConnection>&
*/
const std::vector<AudioConnection> &get_output_edges() const;
const std::vector<AudioConnection> &get_outgoing() const;

/**
* @brief Connect another AudioNode.
Expand Down

0 comments on commit 0331248

Please sign in to comment.