Skip to content

Commit b7d14d4

Browse files
committed
Split graph in smaller chunks
1 parent e704710 commit b7d14d4

10 files changed

Lines changed: 1408 additions & 381 deletions
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
==============================================================================
3+
4+
This file is part of the YUP library.
5+
Copyright (c) 2026 - kunitoki@gmail.com
6+
7+
YUP is an open source library subject to open-source licensing.
8+
9+
The code included in this file is provided under the terms of the ISC license
10+
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
11+
to use, copy, modify, and/or distribute this software for any purpose with or
12+
without fee is hereby granted provided that the above copyright notice and
13+
this permission notice appear in all copies.
14+
15+
YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
16+
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
17+
DISCLAIMED.
18+
19+
==============================================================================
20+
*/
21+
22+
namespace yup
23+
{
24+
25+
//==============================================================================
26+
/**
27+
Lightweight diagnostics describing the most recently compiled graph plan.
28+
*/
29+
struct AudioGraphAllocationStats
30+
{
31+
/** Number of preallocated node scratch audio buffers. */
32+
int scratchAudioBuffers = 0;
33+
34+
/** Number of preallocated node MIDI buffers. */
35+
int midiBuffers = 0;
36+
37+
/** Number of per-connection delay lines. */
38+
int delayLines = 0;
39+
40+
/** Maximum latency compensation inserted on any graph output path. */
41+
int totalCompensationSamples = 0;
42+
43+
/** Maximum preallocated audio channel count used by any node or graph endpoint. */
44+
int maxPreallocatedChannels = 0;
45+
46+
/** Maximum preallocated block size for the compiled plan. */
47+
int maxPreallocatedBlockSize = 0;
48+
};
49+
50+
} // namespace yup
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
==============================================================================
3+
4+
This file is part of the YUP library.
5+
Copyright (c) 2026 - kunitoki@gmail.com
6+
7+
YUP is an open source library subject to open-source licensing.
8+
9+
The code included in this file is provided under the terms of the ISC license
10+
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
11+
to use, copy, modify, and/or distribute this software for any purpose with or
12+
without fee is hereby granted provided that the above copyright notice and
13+
this permission notice appear in all copies.
14+
15+
YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
16+
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
17+
DISCLAIMED.
18+
19+
==============================================================================
20+
*/
21+
22+
namespace yup
23+
{
24+
25+
//==============================================================================
26+
/**
27+
A directed connection between two graph endpoints.
28+
*/
29+
class AudioGraphConnection
30+
{
31+
public:
32+
AudioGraphConnection() = default;
33+
34+
/** Creates a connection from sourceEndpoint to destinationEndpoint. */
35+
AudioGraphConnection (AudioGraphEndpoint sourceEndpoint, AudioGraphEndpoint destinationEndpoint) noexcept
36+
: source (sourceEndpoint)
37+
, destination (destinationEndpoint)
38+
{
39+
}
40+
41+
bool operator== (const AudioGraphConnection& other) const noexcept
42+
{
43+
return source == other.source && destination == other.destination;
44+
}
45+
46+
bool operator!= (const AudioGraphConnection& other) const noexcept { return ! (*this == other); }
47+
48+
/** Source endpoint. */
49+
AudioGraphEndpoint source;
50+
51+
/** Destination endpoint. */
52+
AudioGraphEndpoint destination;
53+
};
54+
55+
} // namespace yup
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
==============================================================================
3+
4+
This file is part of the YUP library.
5+
Copyright (c) 2026 - kunitoki@gmail.com
6+
7+
YUP is an open source library subject to open-source licensing.
8+
9+
The code included in this file is provided under the terms of the ISC license
10+
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
11+
to use, copy, modify, and/or distribute this software for any purpose with or
12+
without fee is hereby granted provided that the above copyright notice and
13+
this permission notice appear in all copies.
14+
15+
YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
16+
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
17+
DISCLAIMED.
18+
19+
==============================================================================
20+
*/
21+
22+
namespace yup
23+
{
24+
25+
//==============================================================================
26+
/**
27+
Describes one routable audio or MIDI endpoint in an AudioGraphProcessor.
28+
29+
Source endpoints are graphInput() and nodeOutput(). Destination endpoints are
30+
graphOutput() and nodeInput(). The bus index refers to the AudioBusLayout of the
31+
graph or the addressed processor node.
32+
*/
33+
class AudioGraphEndpoint
34+
{
35+
public:
36+
/** The endpoint owner and direction. */
37+
enum class Kind
38+
{
39+
graphInput,
40+
graphOutput,
41+
nodeInput,
42+
nodeOutput
43+
};
44+
45+
/** Creates an invalid graph input endpoint. */
46+
AudioGraphEndpoint() = default;
47+
48+
/** Creates a source endpoint for one graph input bus. */
49+
static AudioGraphEndpoint graphInput (int busIndex) noexcept
50+
{
51+
return AudioGraphEndpoint (Kind::graphInput, AudioGraphNodeID::invalid(), busIndex);
52+
}
53+
54+
/** Creates a destination endpoint for one graph output bus. */
55+
static AudioGraphEndpoint graphOutput (int busIndex) noexcept
56+
{
57+
return AudioGraphEndpoint (Kind::graphOutput, AudioGraphNodeID::invalid(), busIndex);
58+
}
59+
60+
/** Creates a destination endpoint for one node input bus. */
61+
static AudioGraphEndpoint nodeInput (AudioGraphNodeID nodeID, int busIndex) noexcept
62+
{
63+
return AudioGraphEndpoint (Kind::nodeInput, nodeID, busIndex);
64+
}
65+
66+
/** Creates a source endpoint for one node output bus. */
67+
static AudioGraphEndpoint nodeOutput (AudioGraphNodeID nodeID, int busIndex) noexcept
68+
{
69+
return AudioGraphEndpoint (Kind::nodeOutput, nodeID, busIndex);
70+
}
71+
72+
/** Returns the endpoint kind. */
73+
Kind getKind() const noexcept { return kind; }
74+
75+
/** Returns the addressed node, or an invalid ID for graph endpoints. */
76+
AudioGraphNodeID getNodeID() const noexcept { return nodeID; }
77+
78+
/** Returns the bus index on the graph or processor layout. */
79+
int getBusIndex() const noexcept { return busIndex; }
80+
81+
/** Returns true when this endpoint can appear as a connection source. */
82+
bool isSource() const noexcept { return kind == Kind::graphInput || kind == Kind::nodeOutput; }
83+
84+
/** Returns true when this endpoint can appear as a connection destination. */
85+
bool isDestination() const noexcept { return kind == Kind::graphOutput || kind == Kind::nodeInput; }
86+
87+
bool operator== (const AudioGraphEndpoint& other) const noexcept
88+
{
89+
return kind == other.kind && nodeID == other.nodeID && busIndex == other.busIndex;
90+
}
91+
92+
bool operator!= (const AudioGraphEndpoint& other) const noexcept { return ! (*this == other); }
93+
94+
private:
95+
AudioGraphEndpoint (Kind endpointKind, AudioGraphNodeID endpointNodeID, int endpointBusIndex) noexcept
96+
: kind (endpointKind)
97+
, nodeID (endpointNodeID)
98+
, busIndex (endpointBusIndex)
99+
{
100+
}
101+
102+
Kind kind = Kind::graphInput;
103+
AudioGraphNodeID nodeID;
104+
int busIndex = -1;
105+
};
106+
107+
} // namespace yup
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
==============================================================================
3+
4+
This file is part of the YUP library.
5+
Copyright (c) 2026 - kunitoki@gmail.com
6+
7+
YUP is an open source library subject to open-source licensing.
8+
9+
The code included in this file is provided under the terms of the ISC license
10+
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
11+
to use, copy, modify, and/or distribute this software for any purpose with or
12+
without fee is hereby granted provided that the above copyright notice and
13+
this permission notice appear in all copies.
14+
15+
YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
16+
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
17+
DISCLAIMED.
18+
19+
==============================================================================
20+
*/
21+
22+
namespace yup
23+
{
24+
25+
//==============================================================================
26+
/**
27+
Opaque identifier for a processor node owned by an AudioGraphProcessor.
28+
29+
Node identifiers remain stable until the node is removed. The invalid identifier
30+
is used by graph input and graph output endpoints, and by failed addNode calls.
31+
*/
32+
class AudioGraphNodeID
33+
{
34+
public:
35+
/** Creates an invalid node identifier. */
36+
constexpr AudioGraphNodeID() noexcept = default;
37+
38+
/** Returns an invalid node identifier. */
39+
static constexpr AudioGraphNodeID invalid() noexcept { return {}; }
40+
41+
/** Returns true when this identifier names a graph node. */
42+
constexpr bool isValid() const noexcept { return value != 0; }
43+
44+
/** Returns the raw integer identifier. */
45+
constexpr uint64_t getRawID() const noexcept { return value; }
46+
47+
/** Creates an identifier from a raw value. Prefer IDs returned by addNode(). */
48+
explicit constexpr AudioGraphNodeID (uint64_t rawValue) noexcept
49+
: value (rawValue)
50+
{
51+
}
52+
53+
constexpr bool operator== (AudioGraphNodeID other) const noexcept { return value == other.value; }
54+
55+
constexpr bool operator!= (AudioGraphNodeID other) const noexcept { return value != other.value; }
56+
57+
constexpr bool operator< (AudioGraphNodeID other) const noexcept { return value < other.value; }
58+
59+
private:
60+
uint64_t value = 0;
61+
};
62+
63+
} // namespace yup
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
==============================================================================
3+
4+
This file is part of the YUP library.
5+
Copyright (c) 2026 - kunitoki@gmail.com
6+
7+
YUP is an open source library subject to open-source licensing.
8+
9+
The code included in this file is provided under the terms of the ISC license
10+
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
11+
to use, copy, modify, and/or distribute this software for any purpose with or
12+
without fee is hereby granted provided that the above copyright notice and
13+
this permission notice appear in all copies.
14+
15+
YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
16+
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
17+
DISCLAIMED.
18+
19+
==============================================================================
20+
*/
21+
22+
namespace yup
23+
{
24+
25+
//==============================================================================
26+
/**
27+
Persistent metadata used to save and recreate an AudioGraphProcessor node.
28+
29+
Set identifier to a stable application-defined factory key. If node creation
30+
needs additional metadata, store it in creationData. Callers that also link a
31+
plugin-host module can encode plugin descriptions there and recreate hosted
32+
plugin instances from the node factory.
33+
*/
34+
struct AudioGraphNodeProperties
35+
{
36+
/** Stable factory key used when loading graph state. */
37+
String identifier;
38+
39+
/** Human-readable node name. */
40+
String name;
41+
42+
/** Canvas X position in caller-defined units. */
43+
float positionX = 0.0f;
44+
45+
/** Canvas Y position in caller-defined units. */
46+
float positionY = 0.0f;
47+
48+
/** Opaque caller-defined metadata used to recreate the node. */
49+
MemoryBlock creationData;
50+
};
51+
52+
} // namespace yup

0 commit comments

Comments
 (0)