SlideShare a Scribd company logo
1 of 28
Download to read offline
4A (AGL Audio Advanced Architecture)
Kickstart with AGL/FF
English presentation Oct. 18
Loïc Collignon – Embedded Engineer
loic.collignon@iot.bzh
Oct 17, 2018 2
IoT.bzh
IoT.bzh team
●
Mostly dedicated to AGL
●
https://iot.bzh/en/
●
http://github.com/iotbzh
Workshop in Lorient
LORIENT
vannes
Oct 17, 2018 3
4A Kickstart
Loïc Collignon
High Level API
Jonathan Aillet
HALs
Thierry Bultel
SoftMixer
Oct 17, 2018 4
4A Kickstart
●
I have this OGG file, how do I play it?
Oct 17, 2018 5
4A Kickstart
●
I have this OGG file, how do I play it?
– Use alsa, Gstreamer, etc., 4A doesn’t play any
audio! It handles permissions, signals and policies.
Oct 17, 2018 6
4A Kickstart
●
Why do we need this extra layer of complexity?
Oct 17, 2018 7
4A Kickstart
●
Why do we need this extra layer of complexity?
– Because a car is not a home Hi-Fi system:
●
Multiple concurrent audio sources (i.e.
navigation+multimedia)
●
Features required by law (i.e. emergency notifications,
turn indicators sound, ...)
●
Ambiant noise (i.e. speed correlated noise)
Oct 17, 2018 8
4A Kickstart
●
Applications still have to use audio libraries
(i.e. Gstreamer)
●
Applications also have to use 4a
HARDWARE
APPLICATIONS
Audio lib 4a
Oct 17, 2018 9
4A Kickstart
1) Open the audio-role
you want
2) Use the returned
device to play audio
3) Close the audio-role
when finished
Oct 17, 2018 10
4A Kickstart
ahl-4a/get_roles
{
“response”: [
“multimedia”,
“navigation”,
“emergency”
]
}
Oct 17, 2018 11
4A Kickstart
ahl-4a/<role> { “action”: “open” }
{
“response”: {
“device_uri”: “hw:2,0,1”
}
}
Oct 17, 2018 12
4A Kickstart
json_object *jsonData = json_object_new_object();
json_object_object_add(jsonData, "action", json_object_new_string("open"));
ret = afb_service_call_sync("ahl-4a", "multimedia", jsonData, &response);
if (!ret) {
json_object *valJson = NULL;
json_object *val = NULL;
gboolean ret;
ret = json_object_object_get_ex(response, "response", &valJson);
if (ret) {
ret = json_object_object_get_ex(valJson, "device_uri", &val);
if (ret) {
char* jres_pcm = json_object_get_string(val);
g_object_set(data.alsa_sink, "device", jres_pcm, NULL);
}
ret = json_object_object_get_ex(valJson, "stream_id", &val);
if (ret) int stream_id = json_object_get_int(val);
}
}
Oct 17, 2018 13
4A Kickstart
ahl-4a/<role> { “action”: “volume”, “value”: 80 }
ahl-4a/<role> { “action”: “volume”, “value”: “+50” }
{
“response”: {
“volnew”: 80,
“volold”: 30
}
}
Oct 17, 2018 14
4A Kickstart
●
Audio roles
– Multimedia
– Navigation
– Emergency
– ...
●
Interruptions
– Ramp
– Mute
– Pause
– ...
Oct 17, 2018 15
4A Kickstart
"roles":[
{
"uid": "multimedia",
"description": "Multimedia content",
"priority": 0,
"stream": "multimedia"
},
{
"uid": "emergency",
"description": "Safety-relevant or critical alerts/alarms",
"priority": 100,
"stream": "emergency",
"interrupts":[
{"type": "ramp", "args": { "uid": "ramp-fast", "volume": 30} }
]
}
]
}
Oct 17, 2018 16
4A Kickstart
●
What is an audio role?
●
An abstraction on which we can apply permissions and
policies
●
It’s not an audio card
Oct 17, 2018 17
4A Kickstart
●
What is an audio stream?
●
A device that can play audio
●
Can be virtual
●
Set up at the factory
Oct 17, 2018 18
4A Kickstart
Oct 17, 2018 19
4A Kickstart
●
HALs
●
Abstract the hardware
●
Maps ALSA controls
●
Exposes streams
●
Use the controller
Oct 17, 2018 20
4A Kickstart
"ramps": [
{
"uid": "ramp-fast",
"delay": 50,
"up": 2,
"down": 10
},
],
Oct 17, 2018 21
4A Kickstart
"playbacks" : {
"uid": "RCAR-M3",
"path": "/dev/snd/by-path/platform-sound",
"params": { "rate": 48000, "format": "S24_LE" },
"sink": {
"controls": {
"volume": { "name": "DVC Out Playback Volume", "value": 80 },
"mute": { "name": "SRC Out Rate Switch" }
},
"channels": [ { "uid": "front-right", "port": 0 }, { "uid": "front-left", "port":
1 } ]
}
},
Oct 17, 2018 22
4A Kickstart
"captures": {
"uid": "RCAR-M3",
"path": "/dev/snd/by-path/platform-sound",
"params": {
"rate": 48000
},
"source": {
"controls": {
"volume": { "name": "DVC In Capture Volume" },
"mute": { "name": "DVC In Mute Switch" }
},
"channels": [
{ "uid": "mic-right", "port": 0 },
{ "uid": "mic-left", "port": 1 }
]
}
},
Oct 17, 2018 23
4A Kickstart
"zones": [
{
"uid": "full-stereo",
"sink": [
{ "target": "front-right", "channel": 0 },
{ "target": "front-left", "channel": 1 }
]
},
{
"uid": "front-seats",
"sink": [
{ "target": "front-right", "channel": 0 },
{ "target": "front-left", "channel": 1 }
]
}
],
Oct 17, 2018 24
4A Kickstart
"streams": [
{
"uid": "multimedia",
"verb": "multimedia",
"zone": "full-stereo",
"volume": 60,
"mute": false,
"params": { "rate": 48000, "format": "S16_LE" }
},
{
"uid": "emergency",
"verb": "emergency",
"zone": "front-seats",
"volume": 60,
"mute": false,
"params": { "rate": 48000, "format": "S16_LE" }
}
]
Oct 17, 2018 25
4A Kickstart
●
Softmixer
●
Uses snd-aloop to provide virtual devices
●
Maps streams to actual hardware
●
Provides basic mixing capabilities
Oct 17, 2018 26
4A Kickstart
Any question?
Oct 17, 2018 27
4A Next Steps
Oct 17, 2018 28
4A Next Steps

More Related Content

Similar to 4a-kickstart-Loic-IoTbzh-Dresden-2018.pdf

Introduction to the rockwell automation library of process objects
Introduction to the rockwell automation library of process objectsIntroduction to the rockwell automation library of process objects
Introduction to the rockwell automation library of process objectsIntelligentManufacturingInstitute
 
The MRAA and UPM Middleware Libraries
The MRAA and UPM Middleware LibrariesThe MRAA and UPM Middleware Libraries
The MRAA and UPM Middleware LibrariesIntel® Software
 
HKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteHKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteLinaro
 
BKK16-100K1 George Grey, Linaro CEO Opening Keynote
BKK16-100K1 George Grey, Linaro CEO Opening KeynoteBKK16-100K1 George Grey, Linaro CEO Opening Keynote
BKK16-100K1 George Grey, Linaro CEO Opening KeynoteLinaro
 
Building a Remote Control Robot with Automotive Grade Linux
Building a Remote Control Robot with Automotive Grade LinuxBuilding a Remote Control Robot with Automotive Grade Linux
Building a Remote Control Robot with Automotive Grade LinuxLeon Anavi
 
TEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source securityTEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source securityLinaro
 
NAB 2019 Latest Technical and Business Progress with AV1
NAB 2019 Latest Technical and Business Progress with AV1NAB 2019 Latest Technical and Business Progress with AV1
NAB 2019 Latest Technical and Business Progress with AV1Karan "Kay" Singh
 
[Oracle Innovation Summit Tokyo 2018] インダストリアルIoTの今、そしてこれからの進化
[Oracle Innovation Summit Tokyo 2018] インダストリアルIoTの今、そしてこれからの進化[Oracle Innovation Summit Tokyo 2018] インダストリアルIoTの今、そしてこれからの進化
[Oracle Innovation Summit Tokyo 2018] インダストリアルIoTの今、そしてこれからの進化オラクルエンジニア通信
 
Umit - europython2008
Umit - europython2008Umit - europython2008
Umit - europython2008getxsick
 
From shipping rpms to helm charts - Lessons learned and best practices
From shipping rpms to helm charts - Lessons learned and best practicesFrom shipping rpms to helm charts - Lessons learned and best practices
From shipping rpms to helm charts - Lessons learned and best practicesAnkush Chadha, MBA, MS
 
Introduction to Raspberry Pi
Introduction to Raspberry PiIntroduction to Raspberry Pi
Introduction to Raspberry PiIsuru Jayarathne
 
LEGO IR Controller
LEGO IR ControllerLEGO IR Controller
LEGO IR Controllerjtyr
 
How to design your own chip?
How to design your own chip?How to design your own chip?
How to design your own chip?Philipp Wagner
 
Os hardware meets os software
Os hardware meets os softwareOs hardware meets os software
Os hardware meets os softwarePaul Tanner
 
Raspberry Pi GPIO Tutorial - Make Your Own Game Console
Raspberry Pi GPIO Tutorial - Make Your Own Game ConsoleRaspberry Pi GPIO Tutorial - Make Your Own Game Console
Raspberry Pi GPIO Tutorial - Make Your Own Game ConsoleRICELEEIO
 
Running BGP with Mikrotik
Running BGP with MikrotikRunning BGP with Mikrotik
Running BGP with MikrotikGLC Networks
 
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre SiliconEmbedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre SiliconAnne Nicolas
 
Mob modcon 2015-android rom cooking tutorial
Mob modcon 2015-android rom cooking tutorialMob modcon 2015-android rom cooking tutorial
Mob modcon 2015-android rom cooking tutorialRon Munitz
 

Similar to 4a-kickstart-Loic-IoTbzh-Dresden-2018.pdf (20)

Introduction to the rockwell automation library of process objects
Introduction to the rockwell automation library of process objectsIntroduction to the rockwell automation library of process objects
Introduction to the rockwell automation library of process objects
 
The MRAA and UPM Middleware Libraries
The MRAA and UPM Middleware LibrariesThe MRAA and UPM Middleware Libraries
The MRAA and UPM Middleware Libraries
 
HKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteHKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening Keynote
 
BKK16-100K1 George Grey, Linaro CEO Opening Keynote
BKK16-100K1 George Grey, Linaro CEO Opening KeynoteBKK16-100K1 George Grey, Linaro CEO Opening Keynote
BKK16-100K1 George Grey, Linaro CEO Opening Keynote
 
Building a Remote Control Robot with Automotive Grade Linux
Building a Remote Control Robot with Automotive Grade LinuxBuilding a Remote Control Robot with Automotive Grade Linux
Building a Remote Control Robot with Automotive Grade Linux
 
TEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source securityTEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source security
 
NAB 2019 Latest Technical and Business Progress with AV1
NAB 2019 Latest Technical and Business Progress with AV1NAB 2019 Latest Technical and Business Progress with AV1
NAB 2019 Latest Technical and Business Progress with AV1
 
[Oracle Innovation Summit Tokyo 2018] インダストリアルIoTの今、そしてこれからの進化
[Oracle Innovation Summit Tokyo 2018] インダストリアルIoTの今、そしてこれからの進化[Oracle Innovation Summit Tokyo 2018] インダストリアルIoTの今、そしてこれからの進化
[Oracle Innovation Summit Tokyo 2018] インダストリアルIoTの今、そしてこれからの進化
 
Umit - europython2008
Umit - europython2008Umit - europython2008
Umit - europython2008
 
Sidecars
SidecarsSidecars
Sidecars
 
From shipping rpms to helm charts - Lessons learned and best practices
From shipping rpms to helm charts - Lessons learned and best practicesFrom shipping rpms to helm charts - Lessons learned and best practices
From shipping rpms to helm charts - Lessons learned and best practices
 
Introduction to Raspberry Pi
Introduction to Raspberry PiIntroduction to Raspberry Pi
Introduction to Raspberry Pi
 
LEGO IR Controller
LEGO IR ControllerLEGO IR Controller
LEGO IR Controller
 
How to design your own chip?
How to design your own chip?How to design your own chip?
How to design your own chip?
 
Os hardware meets os software
Os hardware meets os softwareOs hardware meets os software
Os hardware meets os software
 
Raspberry Pi GPIO Tutorial - Make Your Own Game Console
Raspberry Pi GPIO Tutorial - Make Your Own Game ConsoleRaspberry Pi GPIO Tutorial - Make Your Own Game Console
Raspberry Pi GPIO Tutorial - Make Your Own Game Console
 
Running BGP with Mikrotik
Running BGP with MikrotikRunning BGP with Mikrotik
Running BGP with Mikrotik
 
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre SiliconEmbedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
Embedded Recipes 2019 - Linux on Open Source Hardware and Libre Silicon
 
Sipana Opensourcejam
Sipana OpensourcejamSipana Opensourcejam
Sipana Opensourcejam
 
Mob modcon 2015-android rom cooking tutorial
Mob modcon 2015-android rom cooking tutorialMob modcon 2015-android rom cooking tutorial
Mob modcon 2015-android rom cooking tutorial
 

Recently uploaded

analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxKarpagam Institute of Teechnology
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Studentskannan348865
 
Intro to Design (for Engineers) at Sydney Uni
Intro to Design (for Engineers) at Sydney UniIntro to Design (for Engineers) at Sydney Uni
Intro to Design (for Engineers) at Sydney UniR. Sosa
 
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUUNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUankushspencer015
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1T.D. Shashikala
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationEmaan Sharma
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Studentskannan348865
 
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and ToolsMaximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Toolssoginsider
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxCHAIRMAN M
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxMANASINANDKISHORDEOR
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..MaherOthman7
 
Software Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdfSoftware Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdfssuser5c9d4b1
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfSkNahidulIslamShrabo
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docxrahulmanepalli02
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfKira Dess
 
Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...IJECEIAES
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxMustafa Ahmed
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisDr.Costas Sachpazis
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsVIEW
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdfAlexander Litvinenko
 

Recently uploaded (20)

analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Students
 
Intro to Design (for Engineers) at Sydney Uni
Intro to Design (for Engineers) at Sydney UniIntro to Design (for Engineers) at Sydney Uni
Intro to Design (for Engineers) at Sydney Uni
 
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUUNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & Modernization
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and ToolsMaximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
 
Software Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdfSoftware Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdf
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdf
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 
Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, Functions
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 

4a-kickstart-Loic-IoTbzh-Dresden-2018.pdf

  • 1. 4A (AGL Audio Advanced Architecture) Kickstart with AGL/FF English presentation Oct. 18 Loïc Collignon – Embedded Engineer loic.collignon@iot.bzh
  • 2. Oct 17, 2018 2 IoT.bzh IoT.bzh team ● Mostly dedicated to AGL ● https://iot.bzh/en/ ● http://github.com/iotbzh Workshop in Lorient LORIENT vannes
  • 3. Oct 17, 2018 3 4A Kickstart Loïc Collignon High Level API Jonathan Aillet HALs Thierry Bultel SoftMixer
  • 4. Oct 17, 2018 4 4A Kickstart ● I have this OGG file, how do I play it?
  • 5. Oct 17, 2018 5 4A Kickstart ● I have this OGG file, how do I play it? – Use alsa, Gstreamer, etc., 4A doesn’t play any audio! It handles permissions, signals and policies.
  • 6. Oct 17, 2018 6 4A Kickstart ● Why do we need this extra layer of complexity?
  • 7. Oct 17, 2018 7 4A Kickstart ● Why do we need this extra layer of complexity? – Because a car is not a home Hi-Fi system: ● Multiple concurrent audio sources (i.e. navigation+multimedia) ● Features required by law (i.e. emergency notifications, turn indicators sound, ...) ● Ambiant noise (i.e. speed correlated noise)
  • 8. Oct 17, 2018 8 4A Kickstart ● Applications still have to use audio libraries (i.e. Gstreamer) ● Applications also have to use 4a HARDWARE APPLICATIONS Audio lib 4a
  • 9. Oct 17, 2018 9 4A Kickstart 1) Open the audio-role you want 2) Use the returned device to play audio 3) Close the audio-role when finished
  • 10. Oct 17, 2018 10 4A Kickstart ahl-4a/get_roles { “response”: [ “multimedia”, “navigation”, “emergency” ] }
  • 11. Oct 17, 2018 11 4A Kickstart ahl-4a/<role> { “action”: “open” } { “response”: { “device_uri”: “hw:2,0,1” } }
  • 12. Oct 17, 2018 12 4A Kickstart json_object *jsonData = json_object_new_object(); json_object_object_add(jsonData, "action", json_object_new_string("open")); ret = afb_service_call_sync("ahl-4a", "multimedia", jsonData, &response); if (!ret) { json_object *valJson = NULL; json_object *val = NULL; gboolean ret; ret = json_object_object_get_ex(response, "response", &valJson); if (ret) { ret = json_object_object_get_ex(valJson, "device_uri", &val); if (ret) { char* jres_pcm = json_object_get_string(val); g_object_set(data.alsa_sink, "device", jres_pcm, NULL); } ret = json_object_object_get_ex(valJson, "stream_id", &val); if (ret) int stream_id = json_object_get_int(val); } }
  • 13. Oct 17, 2018 13 4A Kickstart ahl-4a/<role> { “action”: “volume”, “value”: 80 } ahl-4a/<role> { “action”: “volume”, “value”: “+50” } { “response”: { “volnew”: 80, “volold”: 30 } }
  • 14. Oct 17, 2018 14 4A Kickstart ● Audio roles – Multimedia – Navigation – Emergency – ... ● Interruptions – Ramp – Mute – Pause – ...
  • 15. Oct 17, 2018 15 4A Kickstart "roles":[ { "uid": "multimedia", "description": "Multimedia content", "priority": 0, "stream": "multimedia" }, { "uid": "emergency", "description": "Safety-relevant or critical alerts/alarms", "priority": 100, "stream": "emergency", "interrupts":[ {"type": "ramp", "args": { "uid": "ramp-fast", "volume": 30} } ] } ] }
  • 16. Oct 17, 2018 16 4A Kickstart ● What is an audio role? ● An abstraction on which we can apply permissions and policies ● It’s not an audio card
  • 17. Oct 17, 2018 17 4A Kickstart ● What is an audio stream? ● A device that can play audio ● Can be virtual ● Set up at the factory
  • 18. Oct 17, 2018 18 4A Kickstart
  • 19. Oct 17, 2018 19 4A Kickstart ● HALs ● Abstract the hardware ● Maps ALSA controls ● Exposes streams ● Use the controller
  • 20. Oct 17, 2018 20 4A Kickstart "ramps": [ { "uid": "ramp-fast", "delay": 50, "up": 2, "down": 10 }, ],
  • 21. Oct 17, 2018 21 4A Kickstart "playbacks" : { "uid": "RCAR-M3", "path": "/dev/snd/by-path/platform-sound", "params": { "rate": 48000, "format": "S24_LE" }, "sink": { "controls": { "volume": { "name": "DVC Out Playback Volume", "value": 80 }, "mute": { "name": "SRC Out Rate Switch" } }, "channels": [ { "uid": "front-right", "port": 0 }, { "uid": "front-left", "port": 1 } ] } },
  • 22. Oct 17, 2018 22 4A Kickstart "captures": { "uid": "RCAR-M3", "path": "/dev/snd/by-path/platform-sound", "params": { "rate": 48000 }, "source": { "controls": { "volume": { "name": "DVC In Capture Volume" }, "mute": { "name": "DVC In Mute Switch" } }, "channels": [ { "uid": "mic-right", "port": 0 }, { "uid": "mic-left", "port": 1 } ] } },
  • 23. Oct 17, 2018 23 4A Kickstart "zones": [ { "uid": "full-stereo", "sink": [ { "target": "front-right", "channel": 0 }, { "target": "front-left", "channel": 1 } ] }, { "uid": "front-seats", "sink": [ { "target": "front-right", "channel": 0 }, { "target": "front-left", "channel": 1 } ] } ],
  • 24. Oct 17, 2018 24 4A Kickstart "streams": [ { "uid": "multimedia", "verb": "multimedia", "zone": "full-stereo", "volume": 60, "mute": false, "params": { "rate": 48000, "format": "S16_LE" } }, { "uid": "emergency", "verb": "emergency", "zone": "front-seats", "volume": 60, "mute": false, "params": { "rate": 48000, "format": "S16_LE" } } ]
  • 25. Oct 17, 2018 25 4A Kickstart ● Softmixer ● Uses snd-aloop to provide virtual devices ● Maps streams to actual hardware ● Provides basic mixing capabilities
  • 26. Oct 17, 2018 26 4A Kickstart Any question?
  • 27. Oct 17, 2018 27 4A Next Steps
  • 28. Oct 17, 2018 28 4A Next Steps