diff --git a/openrtx/include/core/audio_path.h b/openrtx/include/core/audio_path.h index 7f785e72..67a6c3c6 100644 --- a/openrtx/include/core/audio_path.h +++ b/openrtx/include/core/audio_path.h @@ -34,6 +34,15 @@ enum PathStatus PATH_SUSPENDED }; +typedef struct +{ + uint8_t source; + uint8_t sink; + uint8_t prio; + uint8_t status; +} +pathInfo_t; + typedef int32_t pathId; @@ -49,6 +58,14 @@ typedef int32_t pathId; pathId audioPath_request(enum AudioSource source, enum AudioSink sink, enum AudioPriority prio); +/** + * Get all the informations of an audio path. + * + * @param id: ID of the audio path. + * @return audio path informations. + */ +pathInfo_t audioPath_getInfo(const pathId id); + /** * Get the current status of an audio path. * diff --git a/openrtx/src/core/audio_path.cpp b/openrtx/src/core/audio_path.cpp index 578c75b6..a46668f4 100644 --- a/openrtx/src/core/audio_path.cpp +++ b/openrtx/src/core/audio_path.cpp @@ -153,6 +153,28 @@ pathId audioPath_request(enum AudioSource source, enum AudioSink sink, return newPathId; } +pathInfo_t audioPath_getInfo(const pathId id) +{ + pathInfo_t info = {0, 0, 0, 0}; + + const auto it = routes.find(id); + if(it == routes.end()) + { + info.status = PATH_CLOSED; + return info; + } + + info.source = it->second.path.source; + info.sink = it->second.path.destination; + info.prio = it->second.path.priority; + if(it->second.isActive()) + info.status = PATH_OPEN; + else + info.status = PATH_SUSPENDED; + + return info; +} + enum PathStatus audioPath_getStatus(const pathId id) { const auto it = routes.find(id);