diff options
Diffstat (limited to 'src/flowgraph/FlowGraphNode.h')
-rw-r--r-- | src/flowgraph/FlowGraphNode.h | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/flowgraph/FlowGraphNode.h b/src/flowgraph/FlowGraphNode.h index acbee565..2884c081 100644 --- a/src/flowgraph/FlowGraphNode.h +++ b/src/flowgraph/FlowGraphNode.h @@ -38,23 +38,26 @@ // TODO Review use of raw pointers for connect(). Maybe use smart pointers but need to avoid // run-time deallocation in audio thread. -// Set this to 1 if using it inside the Android framework. -// This code is kept here so that it can be moved easily between Oboe and AAudio. +// Set flags FLOWGRAPH_ANDROID_INTERNAL and FLOWGRAPH_OUTER_NAMESPACE based on whether compiler +// flag __ANDROID_NDK__ is defined. __ANDROID_NDK__ should be defined in oboe and not aaudio. + #ifndef FLOWGRAPH_ANDROID_INTERNAL +#ifdef __ANDROID_NDK__ #define FLOWGRAPH_ANDROID_INTERNAL 0 -#endif +#else +#define FLOWGRAPH_ANDROID_INTERNAL 1 +#endif // __ANDROID_NDK__ +#endif // FLOWGRAPH_ANDROID_INTERNAL -// Set this to a name that will prevent AAudio from calling into Oboe. -// AAudio and Oboe both use a version of this flowgraph package. -// There was a problem in the unit tests where AAudio would call a constructor -// in AAudio and then call a destructor in Oboe! That caused memory corruption. -// For more details, see Issue #930. #ifndef FLOWGRAPH_OUTER_NAMESPACE +#ifdef __ANDROID_NDK__ #define FLOWGRAPH_OUTER_NAMESPACE oboe -#endif +#else +#define FLOWGRAPH_OUTER_NAMESPACE aaudio +#endif // __ANDROID_NDK__ +#endif // FLOWGRAPH_OUTER_NAMESPACE -namespace FLOWGRAPH_OUTER_NAMESPACE { -namespace flowgraph { +namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph { // Default block size that can be overridden when the FlowGraphPortFloat is created. // If it is too small then we will have too much overhead from switching between nodes. @@ -70,7 +73,7 @@ class FlowGraphPortFloatInput; */ class FlowGraphNode { public: - FlowGraphNode() {} + FlowGraphNode() = default; virtual ~FlowGraphNode() = default; /** @@ -108,7 +111,7 @@ public: virtual void reset(); void addInputPort(FlowGraphPort &port) { - mInputPorts.push_back(port); + mInputPorts.emplace_back(port); } bool isDataPulledAutomatically() const { @@ -164,7 +167,7 @@ public: : mContainingNode(parent) , mSamplesPerFrame(samplesPerFrame) { } - + virtual ~FlowGraphPort() = default; // Ports are often declared public. So let's make them non-copyable. @@ -403,7 +406,7 @@ public: FlowGraphPortFloatInput input; /** - * Dummy processor. The work happens in the read() method. + * Do nothing. The work happens in the read() method. * * @param numFrames * @return number of frames actually processed @@ -442,7 +445,6 @@ public: FlowGraphPortFloatOutput output; }; -} /* namespace flowgraph */ -} /* namespace FLOWGRAPH_OUTER_NAMESPACE */ +} /* namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph */ #endif /* FLOWGRAPH_FLOW_GRAPH_NODE_H */ |