summaryrefslogtreecommitdiffstats
path: root/src/ahl-interface.h
diff options
context:
space:
mode:
authorTai Vuong <tvuong@audiokinetic.com>2017-10-27 21:40:20 -0400
committerTai Vuong <tvuong@audiokinetic.com>2017-10-27 21:40:20 -0400
commit8a584f01b46d251fdc5de8b071eff755d99f0090 (patch)
tree625bfb4d66933b8fd18428027aa38c8a708368ce /src/ahl-interface.h
parent9b7e1d0361d1a5eee415e453ae79925084552c68 (diff)
Add JSON object parameters for policy functions call, fix various bug and code stabilisation
Diffstat (limited to 'src/ahl-interface.h')
-rw-r--r--src/ahl-interface.h115
1 files changed, 46 insertions, 69 deletions
diff --git a/src/ahl-interface.h b/src/ahl-interface.h
index 04b2865..0488e96 100644
--- a/src/ahl-interface.h
+++ b/src/ahl-interface.h
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2017 "Audiokinetic Inc"
- * Author Francois Thibault <fthibault@audiokinetic.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,76 +17,39 @@
#ifndef AHL_INTERFACE_INCLUDE
#define AHL_INTERFACE_INCLUDE
-typedef enum EndpointType {
- ENDPOINTTYPE_SOURCE = 0, // source devices
- ENDPOINTTYPE_SINK, // sink devices
- ENDPOINTTYPE_MAXVALUE // Enum count, keep at the end
-} EndpointTypeT;
-
-typedef enum DeviceURIType {
- DEVICEURITYPE_ALSA_HW = 0, // Alsa hardware device URI
- DEVICEURITYPE_ALSA_DMIX, // Alsa Dmix device URI (only for playback devices)
- DEVICEURITYPE_ALSA_DSNOOP, // Alsa DSnoop device URI (only for capture devices)
- DEVICEURITYPE_ALSA_SOFTVOL, // Alsa softvol device URI
- DEVICEURITYPE_ALSA_PLUG, // Alsa plug device URI
- DEVICEURITYPE_ALSA_OTHER, // Alsa domain URI device of unspecified type
- DEVICEURITYPE_PULSE, // Pulse device URI
- DEVICEURITYPE_GSTREAMER, // GStreamer device URI
- DEVICEURITYPE_EXTERNAL, // Device URI for external ECU device
- DEVICEURITYPE_MAXVALUE // Enum count, keep at the end
-} DeviceURITypeT;
-
-typedef enum StreamState {
- STREAM_STATE_IDLE = 0, // Stream is inactive
- STREAM_STATE_RUNNING, // Stream is active and running
- STREAM_STATE_PAUSED, // Stream is active but paused
- STREAM_STATE_MAXVALUE // Enum count, keep at the end
-} StreamStateT;
-
-typedef enum StreamMute {
- STREAM_UNMUTED = 0, // Stream is not muted
- STREAM_MUTED, // Stream is muted
- STREAM_MUTE_MAXVALUE, // Enum count, keep at the end
-} StreamMuteT;
-
-typedef enum StreamEvent {
- STREAM_EVENT_START = 0, // Stream is inactive
- STREAM_EVENT_STOP, // Stream is running
- STREAM_EVENT_PAUSE, // Audio stream paused
- STREAM_EVENT_RESUME, // Audio stream resumed
- STREAM_EVENT_MUTED, // Audio stream muted
- STREAM_EVENT_UNMUTED, // Audio stream unmuted
- STREAM_STATUS_MAXVALUE // Enum count, keep at the end
-} StreamEventT;
-
-// Define default behavior of audio role when interrupted by higher priority sources (in configuration)
-#define AHL_INTERRUPTEDBEHAVIOR_CONTINUE_STR "continue" // Continue to play when interrupted (e.g. media may be ducked)
-#define AHL_INTERRUPTEDBEHAVIOR_CANCEL_STR "cancel" // Abort playback when interrupted (e.g. non-important HMI feedback that does not make sense later)
-#define AHL_INTERRUPTEDBEHAVIOR_PAUSE_STR "pause" // Pause source when interrupted, to be resumed afterwards (e.g. non-temporal guidance)
+///// API /////
+// Endpoint types
+#define AHL_ENDPOINTTYPE_SOURCE "source" // source devices
+#define AHL_ENDPOINTTYPE_SINK "sink" // sink devices
+
+// Stream state
+#define AHL_STREAM_STATE_IDLE "idle" // Stream is inactive
+#define AHL_STREAM_STATE_RUNNING "running" // Stream is active and running
+#define AHL_STREAM_STATE_PAUSED "paused" // Stream is active but paused
+
+// Stream mute state
+#define AHL_STREAM_UNMUTED "off" // Stream is not muted
+#define AHL_STREAM_MUTED "on" // Stream is muted
+
+// Property/Volume/Action events
#define AHL_ENDPOINT_PROPERTY_EVENT "ahl_endpoint_property_event"
#define AHL_ENDPOINT_VOLUME_EVENT "ahl_endpoint_volume_event"
-#define AHL_POST_EVENT "ahl_post_event"
-
-// CPU endianness assumed in all formats
-typedef enum SampleType {
- AHL_FORMAT_UNKNOWN = -1, // Unknown
- AHL_FORMAT_U8 = 0, // Unsigned 8 bit
- AHL_FORMAT_S16, // Signed 16 bit Little Endian
- AHL_FORMAT_S24, // Signed 24 bit Little Endian using low three bytes in 32-bit word
- AHL_FORMAT_S32, // Signed 32 bit Little Endian
- AHL_FORMAT_FLOAT, // Float 32 bit Little Endian, Range -1.0 to 1.0
- AHL_FORMAT_FLOAT64, // Float 64 bit Little Endian, Range -1.0 to 1.0
- AHL_FORMAT_IEC958, // IEC-958 Little Endian (SPDIF)
- AHL_FORMAT_MU_LAW, // Mu-Law
- AHL_FORMAT_A_LAW, // A-Law
- AHL_FORMAT_IMA_ADPCM, // Ima-ADPCM
- AHL_FORMAT_MPEG, // MPEG
- AHL_FORMAT_GSM, // GSM
- AHL_FORMAT_G723, // G723
- AHL_FORMAT_DSD, // Direct stream digital
- AHL_FORMAT_MAXVALUE, // Enum count, keep at the end
-} SampleTypeT;
+#define AHL_ENDPOINT_INIT_EVENT "ahl_endpoint_init_event"
+#define AHL_POST_ACTION_EVENT "ahl_post_action"
+#define AHL_STREAM_STATE_EVENT "ahl_stream_state_event"
+#define AHL_ENDPOINT_INIT_EVENT "ahl_endpoint_init_event"
+
+
+// Stream state event types
+#define AHL_STREAM_EVENT_START "start" // Stream is inactive
+#define AHL_STREAM_EVENT_STOP "stop" // Stream is running
+#define AHL_STREAM_EVENT_PAUSE "pause" // Audio stream paused
+#define AHL_STREAM_EVENT_RESUME "resume" // Audio stream resumed
+#define AHL_STREAM_EVENT_MUTE "mute" // Audio stream muted
+#define AHL_STREAM_EVENT_UNMUTE "unmute" // Audio stream unmuted
+
+///// Interpret returned or configuration information /////
// Known audio domain string definitions (for configuration file format and device URI interpretation)
#define AHL_DOMAIN_ALSA "alsa"
@@ -95,6 +57,22 @@ typedef enum SampleType {
#define AHL_DOMAIN_GSTREAMER "gstreamer"
#define AHL_DOMAIN_EXTERNAL "external"
+// ALSA Device URI type
+#define AHL_DEVICEURITYPE_ALSA_HW "hw" // Alsa hardware device URI
+#define AHL_DEVICEURITYPE_ALSA_DMIX "dmix" // Alsa Dmix device URI (only for playback devices)
+#define AHL_DEVICEURITYPE_ALSA_DSNOOP "dsnoop" // Alsa DSnoop device URI (only for capture devices)
+#define AHL_DEVICEURITYPE_ALSA_SOFTVOL "softvol" // Alsa softvol device URI
+#define AHL_DEVICEURITYPE_ALSA_PLUG "plug" // Alsa plug device URI
+#define AHL_DEVICEURITYPE_ALSA_OTHER "other" // Alsa domain URI device of unspecified type
+#define AHL_DEVICEURITYPE_NOT_ALSA "nonalsa"
+
+// Define default behavior of audio role when interrupting lower priority sources (in configuration)
+#define AHL_INTERRUPTBEHAVIOR_CONTINUE "continue" // Continue to play when interrupted (e.g. media may be ducked)
+#define AHL_INTERRUPTBEHAVIOR_CANCEL "cancel" // Abort playback when interrupted (e.g. non-important HMI feedback that does not make sense later)
+#define AHL_INTERRUPTBEHAVIOR_PAUSE "pause" // Pause source when interrupted, to be resumed afterwards (e.g. non-temporal guidance)
+
+///// Naming convention /////
+
// Standardized name for common audio roles (not enforced in any way, just helps compatibility)
#define AHL_ROLE_WARNING "warning" // Safety-relevant or critical alerts/alarms
#define AHL_ROLE_GUIDANCE "guidance" // Important user information where user action is expected (e.g. navigation instruction)
@@ -118,5 +96,4 @@ typedef enum SampleType {
#define AHL_EVENTS_ECHOCANCEL_ENABLE "echocancel_enable"
#define AHL_EVENTS_ECHOCANCEL_DISABLE "echocancel_disable"
-
#endif // AHL_INTERFACE_INCLUDE