Moved audio_path header file from interfaces to core, moved enums of audio source, sink and priority to audio.h
This commit is contained in:
parent
ec6519425c
commit
ad3390696e
|
|
@ -21,7 +21,7 @@
|
||||||
#ifndef AUDIO_CODEC_H
|
#ifndef AUDIO_CODEC_H
|
||||||
#define AUDIO_CODEC_H
|
#define AUDIO_CODEC_H
|
||||||
|
|
||||||
#include <interfaces/audio_path.h>
|
#include <interfaces/audio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2021 - 2022 by Federico Amedeo Izzo IU2NUO, *
|
* Copyright (C) 2022 by Federico Amedeo Izzo IU2NUO, *
|
||||||
* Niccolò Izzo IU2KIN *
|
* Niccolò Izzo IU2KIN *
|
||||||
* Frederik Saraci IU2NRO *
|
* Silvano Seva IU2KWO *
|
||||||
* Silvano Seva IU2KWO *
|
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
@ -21,57 +20,48 @@
|
||||||
#ifndef AUDIO_PATH_H
|
#ifndef AUDIO_PATH_H
|
||||||
#define AUDIO_PATH_H
|
#define AUDIO_PATH_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <interfaces/audio.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum AudioSource
|
enum PathStatus
|
||||||
{
|
{
|
||||||
SOURCE_MIC, ///< Receive audio signal from the microphone
|
PATH_CLOSED,
|
||||||
SOURCE_RTX, ///< Receive audio signal from the transceiver
|
PATH_OPEN,
|
||||||
SOURCE_MCU ///< Receive audio signal from a memory buffer
|
PATH_SUSPENDED
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AudioSink
|
typedef int32_t pathId;
|
||||||
{
|
|
||||||
SINK_SPK, ///< Send audio signal to the speaker
|
|
||||||
SINK_RTX, ///< Send audio signal to the transceiver
|
|
||||||
SINK_MCU ///< Send audio signal to a memory buffer
|
|
||||||
};
|
|
||||||
|
|
||||||
enum AudioPriority
|
|
||||||
{
|
|
||||||
PRIO_BEEP = 1, ///< Priority level of system beeps
|
|
||||||
PRIO_RX, ///< Priority level of incoming audio from RX stage
|
|
||||||
PRIO_PROMPT, ///< Priority level of voice prompts
|
|
||||||
PRIO_TX ///< Priority level of outward audio directed to TX stage
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef int8_t pathId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to connect an audio path, returns an error if the path is already used
|
* Request to set up an audio path, returns an error if the path is already used
|
||||||
* with an higher priority.
|
* with an higher priority.
|
||||||
*
|
*
|
||||||
* @param source: identifier of the input audio peripheral.
|
* @param source: identifier of the input audio peripheral.
|
||||||
* @param sink: identifier of the output audio peripheral.
|
* @param destination: identifier of the output audio peripheral.
|
||||||
* @param prio: priority of the requester.
|
* @param prio: priority of the requester.
|
||||||
* @return a unique identifier of the opened path or -1 if path is already in use.
|
* @return a unique identifier of the opened path or -1 if path is already in use.
|
||||||
*/
|
*/
|
||||||
pathId audioPath_open(enum AudioSource source,
|
pathId audioPath_request(enum AudioSource source, enum AudioSink destination,
|
||||||
enum AudioSink sink,
|
enum AudioPriority prio);
|
||||||
enum AudioPriority prio);
|
|
||||||
|
/**
|
||||||
|
* Get the current status of an audio path.
|
||||||
|
*
|
||||||
|
* @param pathId: ID of the audio path.
|
||||||
|
* @return status of the path queried.
|
||||||
|
*/
|
||||||
|
enum PathStatus audioPath_getStatus(const pathId pathId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release an audio path.
|
* Release an audio path.
|
||||||
*
|
*
|
||||||
* @param id: identifier of the previously opened path.
|
* @param pathId: identifier of the path.
|
||||||
* @return true on success, false on error.
|
|
||||||
*/
|
*/
|
||||||
bool audioPath_close(pathId id);
|
void audioPath_release(const pathId pathId);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
@ -21,10 +21,6 @@
|
||||||
#ifndef AUDIO_H
|
#ifndef AUDIO_H
|
||||||
#define AUDIO_H
|
#define AUDIO_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <rtx.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -34,6 +30,28 @@ extern "C" {
|
||||||
* audio driver, in charge of managing microphone and audio amplifier.
|
* audio driver, in charge of managing microphone and audio amplifier.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
enum AudioSource
|
||||||
|
{
|
||||||
|
SOURCE_MIC, ///< Receive audio signal from the microphone
|
||||||
|
SOURCE_RTX, ///< Receive audio signal from the transceiver
|
||||||
|
SOURCE_MCU ///< Receive audio signal from a memory buffer
|
||||||
|
};
|
||||||
|
|
||||||
|
enum AudioSink
|
||||||
|
{
|
||||||
|
SINK_SPK, ///< Send audio signal to the speaker
|
||||||
|
SINK_RTX, ///< Send audio signal to the transceiver
|
||||||
|
SINK_MCU ///< Send audio signal to a memory buffer
|
||||||
|
};
|
||||||
|
|
||||||
|
enum AudioPriority
|
||||||
|
{
|
||||||
|
PRIO_BEEP = 1, ///< Priority level of system beeps
|
||||||
|
PRIO_RX, ///< Priority level of incoming audio from RX stage
|
||||||
|
PRIO_PROMPT, ///< Priority level of voice prompts
|
||||||
|
PRIO_TX ///< Priority level of outward audio directed to TX stage
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise low-level audio management module.
|
* Initialise low-level audio management module.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,9 @@
|
||||||
#define AUDIO_STREAM_H
|
#define AUDIO_STREAM_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "audio_path.h"
|
#include "audio.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue