Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
729 changes: 729 additions & 0 deletions examples/audiograph/source/AudioGraphApp.cpp

Large diffs are not rendered by default.

716 changes: 70 additions & 646 deletions examples/audiograph/source/AudioGraphApp.h

Large diffs are not rendered by default.

22 changes: 1 addition & 21 deletions examples/audiograph/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,8 @@
==============================================================================
*/

#include <yup_core/yup_core.h>
#include <yup_audio_basics/yup_audio_basics.h>
#include <yup_audio_devices/yup_audio_devices.h>
#include <yup_audio_formats/yup_audio_formats.h>
#include <yup_audio_processors/yup_audio_processors.h>
#include <yup_audio_graph/yup_audio_graph.h>
#include <yup_events/yup_events.h>
#include <yup_graphics/yup_graphics.h>
#include <yup_gui/yup_gui.h>
#include <yup_audio_gui/yup_audio_gui.h>

#if YUP_DESKTOP
#include <yup_audio_plugin_host/yup_audio_plugin_host.h>
#endif

#include "nodes/OscillatorNode.h"
#include "nodes/GainNode.h"
#include "nodes/LowPassFilterNode.h"
#include "nodes/SamplePlayerNode.h"
#include "nodes/PluginNodeView.h"
#include "nodes/NodeRegistry.h"
#include "ui/PluginEditorWindow.h"

#include "AudioGraphApp.h"

//==============================================================================
Expand Down
27 changes: 27 additions & 0 deletions examples/audiograph/source/nodes/GraphEndpointNodeViews.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
==============================================================================

This file is part of the YUP library.
Copyright (c) 2026 - kunitoki@gmail.com

YUP is an open source library subject to open-source licensing.

The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
to use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.

YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.

==============================================================================
*/

#pragma once

#include "GraphInputNodeView.h"
#include "GraphOutputNodeView.h"
#include "SoundCardInputNodeView.h"
#include "SoundCardOutputNodeView.h"
73 changes: 73 additions & 0 deletions examples/audiograph/source/nodes/GraphInputNodeView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
==============================================================================

This file is part of the YUP library.
Copyright (c) 2026 - kunitoki@gmail.com

YUP is an open source library subject to open-source licensing.

The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
to use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.

YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.

==============================================================================
*/

#pragma once

#include <memory>

//==============================================================================
class GraphInputNodeView final : public yup::AudioGraphNodeView
{
public:
GraphInputNodeView (std::shared_ptr<yup::AudioGraphProcessor> graphIn, yup::StringRef subtitleIn)
: AudioGraphNodeView (yup::AudioGraphNodeID::invalid())
, graph (std::move (graphIn))
, subtitle (subtitleIn)
{
}

yup::String getNodeTitle() const override { return "INPUT"; }

yup::String getNodeSubtitle() const override { return subtitle; }

int getNumInputPorts() const override { return 0; }

int getNumOutputPorts() const override
{
return graph != nullptr ? static_cast<int> (graph->getBusLayout().getInputBuses().size()) : 0;
}

int getPreferredWidth() const override { return 160; }

yup::Color getNodeColor() const override { return yup::Color (0xfff97316); }

PortInfo getOutputPortInfo (int busIndex) const override
{
if (graph == nullptr)
return { "?", getPortKindColor (PortKind::audio), PortKind::audio };

return getPortInfo (graph->getBusLayout().getInputBuses(), busIndex);
}

private:
static PortInfo getPortInfo (yup::Span<const yup::AudioBus> buses, int busIndex)
{
if (busIndex < 0 || busIndex >= static_cast<int> (buses.size()))
return { "?", getPortKindColor (PortKind::audio), PortKind::audio };

const auto& bus = buses[static_cast<size_t> (busIndex)];
const auto kind = bus.getType() == yup::AudioBus::Type::Audio ? PortKind::audio : PortKind::midi;
return { bus.getName(), getPortKindColor (kind), kind };
}

std::shared_ptr<yup::AudioGraphProcessor> graph;
yup::String subtitle;
};
73 changes: 73 additions & 0 deletions examples/audiograph/source/nodes/GraphOutputNodeView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
==============================================================================

This file is part of the YUP library.
Copyright (c) 2026 - kunitoki@gmail.com

YUP is an open source library subject to open-source licensing.

The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
to use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.

YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.

==============================================================================
*/

#pragma once

#include <memory>

//==============================================================================
class GraphOutputNodeView final : public yup::AudioGraphNodeView
{
public:
GraphOutputNodeView (std::shared_ptr<yup::AudioGraphProcessor> graphIn, yup::StringRef subtitleIn)
: AudioGraphNodeView (yup::AudioGraphNodeID::invalid())
, graph (std::move (graphIn))
, subtitle (subtitleIn)
{
}

yup::String getNodeTitle() const override { return "OUTPUT"; }

yup::String getNodeSubtitle() const override { return subtitle; }

int getNumInputPorts() const override
{
return graph != nullptr ? static_cast<int> (graph->getBusLayout().getOutputBuses().size()) : 0;
}

int getNumOutputPorts() const override { return 0; }

int getPreferredWidth() const override { return 160; }

yup::Color getNodeColor() const override { return yup::Color (0xff06b6d4); }

PortInfo getInputPortInfo (int busIndex) const override
{
if (graph == nullptr)
return { "?", getPortKindColor (PortKind::audio), PortKind::audio };

return getPortInfo (graph->getBusLayout().getOutputBuses(), busIndex);
}

private:
static PortInfo getPortInfo (yup::Span<const yup::AudioBus> buses, int busIndex)
{
if (busIndex < 0 || busIndex >= static_cast<int> (buses.size()))
return { "?", getPortKindColor (PortKind::audio), PortKind::audio };

const auto& bus = buses[static_cast<size_t> (busIndex)];
const auto kind = bus.getType() == yup::AudioBus::Type::Audio ? PortKind::audio : PortKind::midi;
return { bus.getName(), getPortKindColor (kind), kind };
}

std::shared_ptr<yup::AudioGraphProcessor> graph;
yup::String subtitle;
};
Loading
Loading