Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop Audio Nodes #1115

Open
wants to merge 55 commits into
base: v3_develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
216b064
Added AudioIn node.
TheMutta Aug 12, 2024
d9cc8cc
Added audio to CMakeLists
TheMutta Aug 13, 2024
8f531f6
Removed unused functions.
TheMutta Aug 13, 2024
0c8df80
Audio nodes skeleton
TheMutta Aug 14, 2024
ee7a202
Removed log files.
TheMutta Aug 14, 2024
29ec561
Added new audio helpers with the use of libsndfile.
TheMutta Aug 19, 2024
ab482c4
Fixed bugs in AudioReplay and made AudioIn/Out host runnable
TheMutta Aug 20, 2024
9c5ac1d
Implemented basic mixer
TheMutta Aug 20, 2024
098c776
Example for audio testing updated.
TheMutta Aug 20, 2024
fd2bd3e
Added AudioFrame for future use.
TheMutta Aug 21, 2024
7851fb6
Supporting all audio formats from 8 bit to double
TheMutta Aug 21, 2024
3efa2bb
Added audio frame to cmake.
TheMutta Aug 21, 2024
a67e60d
Added audio encoder for format/rate
TheMutta Aug 23, 2024
a79ed6b
Finalized design and layout of AudioFrame datatype.
TheMutta Aug 23, 2024
204d989
Usign AudioFrame in place of Buffer for audio nodes.
TheMutta Aug 23, 2024
f40443f
Finalized properties for audio encoder.
TheMutta Aug 23, 2024
0be58ae
Added libsamplerate
TheMutta Aug 23, 2024
41a8e06
Audio example.
TheMutta Aug 23, 2024
85afbef
Mixer now supports fully AudioFrames
TheMutta Aug 23, 2024
ae0ca2c
Multithreaded mixer.
TheMutta Aug 26, 2024
c8457cb
Removed debug messages.
TheMutta Aug 27, 2024
3406ece
AudioFrame to StreamMessageParser
TheMutta Aug 27, 2024
f860250
Added examples.
Aug 27, 2024
97a640a
Transformed AudioNodes private fields into protected.
Aug 27, 2024
a16bd47
Removed eccess function from audio nodes.
Aug 29, 2024
307aced
Added helper constructors to AudioFrame.
Aug 29, 2024
51eda95
Added missing frames metadata from AudioFrame
Aug 29, 2024
ff86777
TODO: mixer only runs on host
Aug 29, 2024
ee0da3f
Running encoder not on host in examples.
Aug 29, 2024
fb6b3ee
Clangformat
Aug 29, 2024
9f7427c
Added test for encoder.
Aug 29, 2024
b4df862
Fixed bug in frame calculation in AudioMixer
Aug 29, 2024
789b7ae
Encoder and mixer test.
Aug 29, 2024
bd40c69
Added RPC getAlsaDevices
Aug 30, 2024
c8228b0
Fixed audio list example.
Aug 30, 2024
c2329d2
Audio nodes python bindings.
Sep 3, 2024
f130cb7
Finalised python bindings for Audio nodes.
Sep 3, 2024
5119284
Added AudioFormat enum to be compatible with SF_FORMAT
Sep 3, 2024
e616c8d
Added AudioFormat binding.
Sep 3, 2024
6589a73
Added missing running host function on bindings for AudioOut
Sep 3, 2024
70b2bea
Added python Audio examples.
Sep 3, 2024
b2169ef
Added GetAlsaPCMs function
Sep 4, 2024
8c14ad5
Added GetAlsaPCMs callback
Sep 4, 2024
a41f224
Added verbose error messages to AudioIn and AudioOut nodes.
Oct 11, 2024
b5b8aa3
Moved snd_pcm_t *captureHandle to the run() function in AudioIn and A…
Nov 2, 2024
d4119af
Added additional tests in configuration stage of AudioIn
Nov 2, 2024
ad3852d
Added additional tests AudioOut
Nov 2, 2024
ffaee85
Added more explicative error messages + added snd_pcm_wait()
Nov 2, 2024
d1816e1
Fixed typo
Nov 2, 2024
7a3e91b
Update src/utility/AudioHelpers.cpp
TheMutta Nov 20, 2024
475c44c
Update src/utility/AudioHelpers.cpp
TheMutta Nov 20, 2024
1ed2951
Removed unused outputs from replay node.
Nov 20, 2024
23ea050
TODO: possible sw_params?
Nov 20, 2024
992f75a
getAlsaPCMs now returns both playback and capture devices.
Dec 9, 2024
1a60efc
Fixed capitalization issue in getAlsaDevices.
Dec 9, 2024
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
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ set(TARGET_CORE_SOURCES
src/pipeline/InputQueue.cpp
src/pipeline/ThreadedNode.cpp
src/pipeline/DeviceNode.cpp
src/pipeline/node/AudioIn.cpp
src/pipeline/node/AudioOut.cpp
src/pipeline/node/AudioEncoder.cpp
src/pipeline/node/AudioMixer.cpp
src/pipeline/node/AudioReplay.cpp
src/pipeline/node/XLinkIn.cpp
src/pipeline/node/XLinkOut.cpp
src/pipeline/node/ColorCamera.cpp
Expand Down Expand Up @@ -317,6 +322,7 @@ set(TARGET_CORE_SOURCES
src/pipeline/node/host/HostNode.cpp
src/pipeline/datatype/DatatypeEnum.cpp
src/pipeline/node/PointCloud.cpp
src/pipeline/datatype/AudioFrame.cpp
src/pipeline/datatype/Buffer.cpp
src/pipeline/datatype/ImgFrame.cpp
src/pipeline/datatype/ImgTransformations.cpp
Expand Down Expand Up @@ -347,6 +353,7 @@ set(TARGET_CORE_SOURCES
src/pipeline/datatype/MessageGroup.cpp
src/pipeline/datatype/TransformData.cpp
src/utility/H26xParsers.cpp
src/utility/AudioHelpers.cpp
src/utility/ImageManipV2Impl.cpp
src/utility/Initialization.cpp
src/utility/Resources.cpp
Expand Down Expand Up @@ -647,6 +654,9 @@ target_link_libraries(${TARGET_CORE_NAME}
INTERFACE
XLinkPublic
PRIVATE
sndfile
samplerate
asound
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix indentation

XLink
Threads::Threads
BZip2::bz2
Expand Down
6 changes: 6 additions & 0 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ set(SOURCE_LIST
src/pipeline/node/HostNodeBindings.cpp
src/pipeline/node/RecordBindings.cpp
src/pipeline/node/ReplayBindings.cpp
src/pipeline/node/AudioInBindings.cpp
src/pipeline/node/AudioOutBindings.cpp
src/pipeline/node/AudioMixerBindings.cpp
src/pipeline/node/AudioEncoderBindings.cpp
src/pipeline/node/AudioReplayBindings.cpp

src/pipeline/datatype/ADatatypeBindings.cpp
src/pipeline/datatype/AprilTagConfigBindings.cpp
Expand Down Expand Up @@ -139,6 +144,7 @@ set(SOURCE_LIST
src/pipeline/datatype/PointCloudConfigBindings.cpp
src/pipeline/datatype/PointCloudDataBindings.cpp
src/pipeline/datatype/TransformDataBindings.cpp
src/pipeline/datatype/AudioFrameBindings.cpp

src/capabilities/CapabilityBindings.cpp
src/capabilities/CapabilityRangeBindings.cpp
Expand Down
3 changes: 3 additions & 0 deletions bindings/python/src/DatatypeBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void bind_benchmarkreport(pybind11::module& m, void* pCallstack);
void bind_pointcloudconfig(pybind11::module& m, void* pCallstack);
void bind_pointclouddata(pybind11::module& m, void* pCallstack);
void bind_transformdata(pybind11::module& m, void* pCallstack);
void bind_audioframe(pybind11::module& m, void* pCallstack);

void DatatypeBindings::addToCallstack(std::deque<StackFunction>& callstack) {
// Bind common datatypebindings
Expand Down Expand Up @@ -65,6 +66,7 @@ void DatatypeBindings::addToCallstack(std::deque<StackFunction>& callstack) {
callstack.push_front(bind_pointcloudconfig);
callstack.push_front(bind_pointclouddata);
callstack.push_front(bind_transformdata);
callstack.push_front(bind_audioframe);
}

void DatatypeBindings::bind(pybind11::module& m, void* pCallstack){
Expand Down Expand Up @@ -111,6 +113,7 @@ void DatatypeBindings::bind(pybind11::module& m, void* pCallstack){
.value("PointCloudConfig", DatatypeEnum::PointCloudConfig)
.value("PointCloudData", DatatypeEnum::PointCloudData)
.value("TransformData", DatatypeEnum::TransformData)
.value("AudioFrame", DatatypeEnum::AudioFrame)
;

}
2 changes: 2 additions & 0 deletions bindings/python/src/DeviceBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){
.def("setTimesync", [](DeviceBase& d, bool e) { py::gil_scoped_release release; return d.setTimesync(e); }, py::arg("enable"), DOC(dai, DeviceBase, setTimesync, 2))
.def("getDeviceName", [](DeviceBase& d) { std::string name; { py::gil_scoped_release release; name = d.getDeviceName(); } return py::bytes(name).attr("decode")("utf-8", "replace"); }, DOC(dai, DeviceBase, getDeviceName))
.def("getProductName", [](DeviceBase& d) { std::string name; { py::gil_scoped_release release; name = d.getProductName(); } return py::bytes(name).attr("decode")("utf-8", "replace"); }, DOC(dai, DeviceBase, getProductName))
.def("getAlsaDevices", [](DeviceBase& d) { py::gil_scoped_release release; return d.getAlsaDevices(); }, DOC(dai, DeviceBase, getAlsaDevices))
.def("getAlsaPCMs", [](DeviceBase& d) { py::gil_scoped_release release; return d.getAlsaPCMs(); }, DOC(dai, DeviceBase, getAlsaPCMs))
Comment on lines +559 to +560
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO:

  • Add impl on RVC2 side of things as well to return empty arrays

;


Expand Down
19 changes: 19 additions & 0 deletions bindings/python/src/pipeline/CommonBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "depthai/common/CameraExposureOffset.hpp"
#include "depthai/common/StereoPair.hpp"
#include "depthai/utility/ProfilingData.hpp"
#include "depthai/utility/AudioHelpers.hpp"

void CommonBindings::bind(pybind11::module& m, void* pCallstack){

Expand Down Expand Up @@ -77,6 +78,8 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){
py::enum_<FrameEvent> frameEvent(m, "FrameEvent", DOC(dai, FrameEvent));
py::class_<ProfilingData> profilingData(m, "ProfilingData", DOC(dai, ProfilingData));
py::enum_<Interpolation> interpolation(m, "Interpolation", DOC(dai, Interpolation));
py::class_<dai::audio::AudioDevice> audioDevice(m, "AudioDevice", DOC(dai, audio, AudioDevice));
py::class_<dai::audio::AudioPCM> audioPCM(m, "AudioPCM", DOC(dai, audio, AudioPCM));

///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -474,4 +477,20 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){
.def_readwrite("numBytesRead", &ProfilingData::numBytesRead, DOC(dai, ProfilingData, numBytesRead))
;


audioDevice
.def(py::init<>())
.def_readwrite("name", &dai::audio::AudioDevice::name)
.def_readwrite("desc", &dai::audio::AudioDevice::desc)
.def_readwrite("ioid", &dai::audio::AudioDevice::ioid)
;

audioPCM
.def(py::init<>())
.def_readwrite("name", &dai::audio::AudioPCM::name)
.def_readwrite("id", &dai::audio::AudioPCM::id)
.def_readwrite("cardNumber", &dai::audio::AudioPCM::cardNumber)
.def_readwrite("deviceNumber", &dai::audio::AudioPCM::deviceNumber)
;

}
109 changes: 109 additions & 0 deletions bindings/python/src/pipeline/datatype/AudioFrameBindings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#include "DatatypeBindings.hpp"
#include "pipeline/CommonBindings.hpp"
#include <unordered_map>
#include <memory>

// depthai
#include "depthai/pipeline/datatype/AudioFrame.hpp"

//pybind
#include <pybind11/chrono.h>
#include <pybind11/numpy.h>

// #include "spdlog/spdlog.h"

void bind_audioframe(pybind11::module& m, void* pCallstack){

using namespace dai;

// py::class_<RawBuffer, std::shared_ptr<RawBuffer>> rawBuffer(m, "RawBuffer", DOC(dai, RawBuffer));
py::class_<AudioFrame, Py<AudioFrame>, Buffer, std::shared_ptr<AudioFrame>> audioFrame(m, "AudioFrame", DOC(dai, AudioFrame));
py::enum_<AudioFrame::AudioFormat> audioFormat(audioFrame, "AudioFormat");

audioFormat
.value("AUDIO_FORMAT_PCM_S8", AudioFrame::AudioFormat::AUDIO_FORMAT_PCM_S8)
.value("AUDIO_FORMAT_PCM_16", AudioFrame::AudioFormat::AUDIO_FORMAT_PCM_16)
.value("AUDIO_FORMAT_PCM_24", AudioFrame::AudioFormat::AUDIO_FORMAT_PCM_24)
.value("AUDIO_FORMAT_PCM_32", AudioFrame::AudioFormat::AUDIO_FORMAT_PCM_32)
;


///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Call the rest of the type defines, then perform the actual bindings
Callstack* callstack = (Callstack*) pCallstack;
auto cb = callstack->top();
callstack->pop();
cb(m, pCallstack);
// Actual bindings
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////

// // Metadata / raw
// rawBuffer
// .def(py::init<>())
// // .def_property("data", [](py::object &obj){
// // dai::RawBuffer &a = obj.cast<dai::RawBuffer&>();
// // return py::array_t<uint8_t>(a.data.size(), a.data.data(), obj);
// // }, [](py::object &obj, py::array_t<std::uint8_t, py::array::c_style> array){
// // dai::RawBuffer &a = obj.cast<dai::RawBuffer&>();
// // a.data = {array.data(), array.data() + array.size()};
// // })
// .def_property("ts",
// [](const RawBuffer& o){
// double ts = o.ts.sec + o.ts.nsec / 1000000000.0;
// return ts;
// },
// [](RawBuffer& o, double ts){
// o.ts.sec = ts;
// o.ts.nsec = (ts - o.ts.sec) * 1000000000.0;
// }
// )
// .def_property("tsDevice",
// [](const RawBuffer& o){
// double ts = o.tsDevice.sec + o.tsDevice.nsec / 1000000000.0;
// return ts;
// },
// [](RawBuffer& o, double ts){
// o.tsDevice.sec = ts;
// o.tsDevice.nsec = (ts - o.tsDevice.sec) * 1000000000.0;
// }
// )
// .def_readwrite("sequenceNum", &RawBuffer::sequenceNum)
// ;

// Message
audioFrame
.def(py::init<>(), DOC(dai, AudioFrame, AudioFrame))
.def(py::init<size_t>(), DOC(dai, AudioFrame, AudioFrame, 2))

// obj is "Python" object, which we used then to bind the numpy arrays lifespan to
.def("getData", [](py::object &obj){
// creates numpy array (zero-copy) which holds correct information such as shape, ...
dai::AudioFrame &a = obj.cast<dai::AudioFrame&>();
return py::array_t<uint8_t>(a.getData().size(), a.getData().data(), obj);
}, DOC(dai, AudioFrame, getData))
.def("setData", py::overload_cast<const std::vector<std::uint8_t>&>(&AudioFrame::setData), DOC(dai, AudioFrame, setData))
.def("setData", [](AudioFrame& audioFrame, py::array_t<std::uint8_t, py::array::c_style | py::array::forcecast> array){
audioFrame.setData({array.data(), array.data() + array.nbytes()});
}, DOC(dai, AudioFrame, setData))
.def("setData", [](AudioFrame& audioFrame, py::buffer data){
std::string str = data.cast<std::string>();
audioFrame.setData({str.data(), str.data() + str.size()});
}, DOC(dai, AudioFrame, setData))
.def("getTimestamp", &AudioFrame::getTimestamp, DOC(dai, AudioFrame, getTimestamp))
.def("getFrames", &AudioFrame::getFrames, DOC(dai, AudioFrame, getFrames))
.def("getBitrate", &AudioFrame::getBitrate, DOC(dai, AudioFrame, getBitrate))
.def("getChannels", &AudioFrame::getChannels, DOC(dai, AudioFrame, getChannels))
.def("getFormat", &AudioFrame::getFormat, DOC(dai, AudioFrame, getFormat))
.def("setTimestamp", &AudioFrame::setTimestamp, DOC(dai, AudioFrame, setTimestamp))
.def("setFrames", &AudioFrame::setFrames, DOC(dai, AudioFrame, setFrames))
.def("setBitrate", &AudioFrame::setBitrate, DOC(dai, AudioFrame, setBitrate))
.def("setChannels", &AudioFrame::setChannels, DOC(dai, AudioFrame, setChannels))
.def("setFormat", &AudioFrame::setFormat, DOC(dai, AudioFrame, setFormat))
;


}
34 changes: 34 additions & 0 deletions bindings/python/src/pipeline/node/AudioEncoderBindings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "Common.hpp"
#include "NodeBindings.hpp"
#include "depthai/pipeline/Node.hpp"
#include "depthai/pipeline/Pipeline.hpp"
#include "depthai/pipeline/node/AudioEncoder.hpp"

void bind_audioencoder(pybind11::module& m, void* pCallstack) {
using namespace dai;
using namespace dai::node;
using namespace pybind11::literals;

// Declare node upfront
auto audioEncoder = ADD_NODE(AudioEncoder);

// Call the rest of the type defines, then perform the actual bindings
Callstack* callstack = (Callstack*)pCallstack;
auto cb = callstack->top();
callstack->pop();
cb(m, pCallstack);

// Actual bindings
audioEncoder.def_readonly("input", &AudioEncoder::input, DOC(dai, node, AudioEncoder, input))
.def_readonly("out", &AudioEncoder::out, DOC(dai, node, AudioEncoder, out))
.def("build", &AudioEncoder::build, DOC(dai, node, AudioEncoder, build))
.def("setBitrate", &AudioEncoder::setBitrate, DOC(dai, node, AudioEncoder, setBitrate))
.def("setChannels", &AudioEncoder::setChannels, DOC(dai, node, AudioEncoder, setChannels))
.def("setFormat", &AudioEncoder::setFormat, DOC(dai, node, AudioEncoder, setFormat))
.def("getBitrate", &AudioEncoder::getBitrate, DOC(dai, node, AudioEncoder, getBitrate))
.def("getChannels", &AudioEncoder::getChannels, DOC(dai, node, AudioEncoder, getChannels))
.def("getFormat", &AudioEncoder::getFormat, DOC(dai, node, AudioEncoder, getFormat))
.def("setRunOnHost", &AudioEncoder::setRunOnHost, py::arg("runOnHost"), DOC(dai, node, AudioEncoder, setRunOnHost))
.def("runOnHost", &AudioEncoder::runOnHost, DOC(dai, node, AudioEncoder, runOnHost))
;
}
40 changes: 40 additions & 0 deletions bindings/python/src/pipeline/node/AudioInBindings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "Common.hpp"
#include "NodeBindings.hpp"
#include "depthai/pipeline/Node.hpp"
#include "depthai/pipeline/Pipeline.hpp"
#include "depthai/pipeline/node/AudioIn.hpp"

void bind_audioin(pybind11::module& m, void* pCallstack) {
using namespace dai;
using namespace dai::node;
using namespace pybind11::literals;

// Declare node upfront
auto audioIn = ADD_NODE(AudioIn);

// Call the rest of the type defines, then perform the actual bindings
Callstack* callstack = (Callstack*)pCallstack;
auto cb = callstack->top();
callstack->pop();
cb(m, pCallstack);

// Actual bindings
audioIn.def_readonly("out", &AudioIn::out, DOC(dai, node, AudioIn, out))
.def("build", &AudioIn::build, DOC(dai, node, AudioIn, build))
.def("setDeviceName", &AudioIn::setDeviceName, DOC(dai, node, AudioIn, setDeviceName))
.def("setDevicePath", &AudioIn::setDevicePath, DOC(dai, node, AudioIn, setDevicePath))
.def("setBitrate", &AudioIn::setBitrate, DOC(dai, node, AudioIn, setBitrate))
.def("setFps", &AudioIn::setFps, DOC(dai, node, AudioIn, setFps))
.def("setChannels", &AudioIn::setChannels, DOC(dai, node, AudioIn, setChannels))
.def("setFormat", &AudioIn::setFormat, DOC(dai, node, AudioIn, setFormat))
.def("getDeviceName", &AudioIn::getDeviceName, DOC(dai, node, AudioIn, getDeviceName))
.def("getDevicePath", &AudioIn::getDevicePath, DOC(dai, node, AudioIn, getDevicePath))
.def("getBitrate", &AudioIn::getBitrate, DOC(dai, node, AudioIn, getBitrate))
.def("getFps", &AudioIn::getFps, DOC(dai, node, AudioIn, getFps))
.def("getChannels", &AudioIn::getChannels, DOC(dai, node, AudioIn, getChannels))
.def("getFormat", &AudioIn::getFormat, DOC(dai, node, AudioIn, getFormat))
.def("setRunOnHost", &AudioIn::setRunOnHost, py::arg("runOnHost"), DOC(dai, node, AudioIn, setRunOnHost))
.def("runOnHost", &AudioIn::runOnHost, DOC(dai, node, AudioIn, runOnHost))

;
}
36 changes: 36 additions & 0 deletions bindings/python/src/pipeline/node/AudioMixerBindings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "Common.hpp"
#include "NodeBindings.hpp"
#include "depthai/pipeline/Node.hpp"
#include "depthai/pipeline/Pipeline.hpp"
#include "depthai/pipeline/node/AudioMixer.hpp"

void bind_audiomixer(pybind11::module& m, void* pCallstack) {
using namespace dai;
using namespace dai::node;
using namespace pybind11::literals;

// Declare node upfront
auto audioMixer = ADD_NODE(AudioMixer);

// Call the rest of the type defines, then perform the actual bindings
Callstack* callstack = (Callstack*)pCallstack;
auto cb = callstack->top();
callstack->pop();
cb(m, pCallstack);

// Actual bindings
audioMixer.def_readonly("outputs", &AudioMixer::outputs, DOC(dai, node, AudioMixer, outputs))
.def_readonly("inputs", &AudioMixer::inputs, DOC(dai, node, AudioMixer, inputs))
.def("build", &AudioMixer::build,DOC(dai, node, AudioMixer, build))
.def("registerSource", &AudioMixer::registerSource, DOC(dai, node, AudioMixer, registerSource))
.def("registerSink", &AudioMixer::registerSink, DOC(dai, node, AudioMixer, registerSink))
.def("linkSourceToSink", &AudioMixer::linkSourceToSink, DOC(dai, node, AudioMixer, linkSourceToSink))
.def("unregisterSource", &AudioMixer::unregisterSource, DOC(dai, node, AudioMixer, unregisterSource))
.def("unregisterSink", &AudioMixer::unregisterSink, DOC(dai, node, AudioMixer, unregisterSink))
.def("unlinkSourceFromSink", &AudioMixer::unlinkSourceFromSink, DOC(dai, node, AudioMixer, unlinkSourceFromSink))
.def("setRunOnHost", &AudioMixer::setRunOnHost, py::arg("runOnHost"), DOC(dai, node, AudioMixer, setRunOnHost))
.def("runOnHost", &AudioMixer::runOnHost, DOC(dai, node, AudioMixer, runOnHost))

;

}
39 changes: 39 additions & 0 deletions bindings/python/src/pipeline/node/AudioOutBindings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "Common.hpp"
#include "NodeBindings.hpp"
#include "depthai/pipeline/Node.hpp"
#include "depthai/pipeline/Pipeline.hpp"
#include "depthai/pipeline/node/AudioOut.hpp"

void bind_audioout(pybind11::module& m, void* pCallstack) {
using namespace dai;
using namespace dai::node;
using namespace pybind11::literals;

// Declare node upfront
auto audioOut = ADD_NODE(AudioOut);

// Call the rest of the type defines, then perform the actual bindings
Callstack* callstack = (Callstack*)pCallstack;
auto cb = callstack->top();
callstack->pop();
cb(m, pCallstack);

// Actual bindings
audioOut.def_readonly("input", &AudioOut::input, DOC(dai, node, AudioOut, input))
.def("build", &AudioOut::build, DOC(dai, node, AudioOut, build))
.def("setDeviceName", &AudioOut::setDeviceName, DOC(dai, node, AudioOut, setDeviceName))
.def("setDevicePath", &AudioOut::setDevicePath, DOC(dai, node, AudioOut, setDevicePath))
.def("setBitrate", &AudioOut::setBitrate, DOC(dai, node, AudioOut, setBitrate))
.def("setFps", &AudioOut::setFps, DOC(dai, node, AudioOut, setFps))
.def("setChannels", &AudioOut::setChannels, DOC(dai, node, AudioOut, setChannels))
.def("setFormat", &AudioOut::setFormat, DOC(dai, node, AudioOut, setFormat))
.def("getDeviceName", &AudioOut::getDeviceName, DOC(dai, node, AudioOut, getDeviceName))
.def("getDevicePath", &AudioOut::getDevicePath, DOC(dai, node, AudioOut, getDevicePath))
.def("getBitrate", &AudioOut::getBitrate, DOC(dai, node, AudioOut, getBitrate))
.def("getFps", &AudioOut::getFps, DOC(dai, node, AudioOut, getFps))
.def("getChannels", &AudioOut::getChannels, DOC(dai, node, AudioOut, getChannels))
.def("getFormat", &AudioOut::getFormat, DOC(dai, node, AudioOut, getFormat))
.def("setRunOnHost", &AudioOut::setRunOnHost, py::arg("runOnHost"), DOC(dai, node, AudioOut, setRunOnHost))
.def("runOnHost", &AudioOut::runOnHost, DOC(dai, node, AudioOut, runOnHost))
;
}
Loading