Added function to get all the informations of a given audio path

This commit is contained in:
Silvano Seva 2023-04-21 21:58:14 +02:00
parent f56771734f
commit 60b771b375
2 changed files with 39 additions and 0 deletions

View File

@ -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.
*

View File

@ -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);