aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-11-03 18:31:47 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-11-03 18:31:47 +0100
commit1e79d4a544dc762e5606ceafd9b380344ab11e32 (patch)
treee5ccbfa1e99e07913ae38152a6d073a7819c31e4
parent1363f808f98eccfe113624cfcf3291fd601fbac2 (diff)
Change-Id: Id7daa210fe7519dedebd070eaef10992ef45549f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh> # Conflicts: # doc/ApplicationGuide.md
-rw-r--r--doc/ApplicationGuide.md133
1 files changed, 73 insertions, 60 deletions
diff --git a/doc/ApplicationGuide.md b/doc/ApplicationGuide.md
index e8c57e7..1a1e501 100644
--- a/doc/ApplicationGuide.md
+++ b/doc/ApplicationGuide.md
@@ -1,5 +1,5 @@
-**Sound Manager Application Guide**
-====
+# **Sound Manager Application Guide**
+
<div align="right">Revision: 0.2Final</div>
<div align="right">TOYOTA MOTOR CORPORATION</div>
<div align="right">Advanced Driver Information Technology</div>
@@ -10,6 +10,7 @@
<div id="Table\ of\ content"></div>
## Table of content
+
- [Target reader of this document](#Target\ reader\ of\ this\ document)
- [Overview](#Overview)
- [Getting Start](#Getting\ Start)
@@ -51,34 +52,36 @@ Application developer whose software uses sound output.
<div id="Overview"></div>
## Overview
-The sound manager is the service which provides **sound-right management** for multiple sound sources.
-This service is based on GENIVI Audio Manager, and this package contains service binding and library for API calling.
+
+The sound manager is the service which provides **sound-right management** for multiple sound sources.
+This service is based on GENIVI Audio Manager, and this package contains service binding and library for API calling.
The reason why this service is based on GENIVI Audio Manager is because GENIVI Audio Manager supports highly strong and flexible sound-right management function.
In order to understand, the below figure shows the one of typical usecases.
In this example, there are four sound mode.
1. Audio Off
-2. Media Player
-3. Tel (Ring and talking)
-4. TTS (Text To Speech; typically it's used by Navigation sound)
+1. Media Player
+1. Tel (Ring and talking)
+1. TTS (Text To Speech; typically it's used by Navigation sound)
![Figure: Typical usecase](parts/typical-usecase.png)
The important points are:
+
- **There is a priority for each sound source.**
- In this example, the priority of "Tel" and "TTS" is higher than "MediaPlayer". Therefore when the system got incoming call, all four outputs of MediaPlayer are muted automatically by Sound Manager. And in this timing, Sound Manager will issue the event to Media Player, then Media Player can stop the music. (Because depending on OEM's requirement, "Stop" is required.)
- "Tel" and "TTS" have the same priority. So if TTS event happened on talking, each sound will output from independent speaker.
- If on-hook button is touched, Sound Manager will resume previous sound mode. In this example, basically it's MediaPlayer sound. But if TTS still playing, three speaker will output MediaPlayer sound but one speaker will continue to output TTS sound.
+ In this example, the priority of "Tel" and "TTS" is higher than "MediaPlayer". Therefore when the system got incoming call, all four outputs of MediaPlayer are muted automatically by Sound Manager. And in this timing, Sound Manager will issue the event to Media Player, then Media Player can stop the music. (Because depending on OEM's requirement, "Stop" is required.)
+ "Tel" and "TTS" have the same priority. So if TTS event happened on talking, each sound will output from independent speaker.
+ If on-hook button is touched, Sound Manager will resume previous sound mode. In this example, basically it's MediaPlayer sound. But if TTS still playing, three speaker will output MediaPlayer sound but one speaker will continue to output TTS sound.
- **Sound mode transition should be done by Sound Manager not Applications.**
- Actually application cannot recognize all sound source and its priority, so some centerized manager is required. Sound Manager provides this function. Sound Manager has a database for usecase and priority and in line with this policy Sound Manager controls proper sound mode.
-
+ Actually application cannot recognize all sound source and its priority, so some centerized manager is required. Sound Manager provides this function. Sound Manager has a database for usecase and priority and in line with this policy Sound Manager controls proper sound mode.
The below links show the example of Sound/Window mode transition.
-* [Single window application](Display_Audio_Transition1.html)
- This transition assumes target IVI system support only one window on screen. It's a similar transition to CES2017 demo.
-* [Dual window application](Display_Audio_Transition2.html)
- This transition assumes target IVI system support two window (split screen) on screen.
- Of course user can customize shortcut menu, but since it's too many states so this example limits shortcut menu as "Home", "MediaPlayer", "HVAC" and "Navigation".
+- [Single window application](Display_Audio_Transition1.html)
+ This transition assumes target IVI system support only one window on screen. It's a similar transition to CES2017 demo.
+- [Dual window application](Display_Audio_Transition2.html)
+ This transition assumes target IVI system support two window (split screen) on screen.
+
+Of course user can customize shortcut menu, but since it's too many states so this example limits shortcut menu as "Home", "MediaPlayer", "HVAC" and "Navigation".
* * *
@@ -95,39 +98,40 @@ The below links show the example of Sound/Window mode transition.
| AGL version | Electric Eel |
| Hardware | Renesas R-Car Starter Kit Pro(M3) |
-
<div id="Build"></div>
### Build
+
You can make Sound Manager object files by the following two stage operations.
**Download recipe**
If repo is already done, please start with git clone
-```
-$ mkdir WORK
-$ cd WORK
-$ repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
-$ repo sync
+```bash
+mkdir WORK
+cd WORK
+repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
+repo sync
```
-
**Bitbake**
-```
-$ source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo agl-devel agl-appfw-smack agl-hmi-framework
-$ bitbake agl-demo-platform
-```
+```bash
+source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo agl-devel agl-appfw-smack agl-hmi-framework
+bitbake agl-demo-platform
+```
* * *
<div id="Configuring"></div>
### Configuring
+
To use Sound Manager API, an application shall paste the following configuration definition into "config.xml" of application.
-```
+
+```xml
<feature name="urn:AGL:widget:required-api">
- <param name="soundmanager" value="ws" />
+ <param name="soundmanager" value="ws" />
</feature>
```
@@ -136,41 +140,38 @@ To use Sound Manager API, an application shall paste the following configuration
<div id="Additional\ work"></div>
### Additional work
-**Add Policy file**
+
+#### **Add Policy file**
To add Sound Manager Domain into policy, put the following file to /etc/audiomanager/control on the target rootfs.
-` ${SOUNDMANAGER_DIR}/conf/audiomanager-config-sample/configuration.xml`
+`${SOUNDMANAGER_DIR}/conf/audiomanager-config-sample/configuration.xml`
This is a sample configuration.
+#### **Remove Module router of Pulse Audio**
-**Remove Module router of Pulse Audio**
-
-Because the module rounter accesses Audio manager for getting sound right instead of application in CES2017, after you changed your application code for Sound manager, you shall modify the configuration for puluse audio not to load module router.
+Because the module rounter accesses Audio manager for getting sound right instead of application in CES2017, after you changed your application code for Sound manager, you shall modify the configuration for puluse audio not to load module router.
To do this, you shall comment out line.143 of /etc/pulse/default.pa on the target rootfs as below.
-```
+```conf
.ifexists module-router.so
#load-module module-router
.endif
-
```
-
* * *
<div id="How\ to\ call\ Sound\ Manager\ APIs\ from\ your\ Application?"></div>
### How to call Sound Manager APIs from your Application?
+
Sound Manager provides a library which is called "libsoundmanager".
This library provides function style API calling interface. So you can include libsoundmanager.hpp headerfile, and can link this library.
Please also refer sample application and template.
-
See also our [Sample code](#Sample\ code).
-
<br />
* * *
@@ -178,24 +179,25 @@ See also our [Sample code](#Sample\ code).
<div id="Supported\ usecase"></div>
## Supported usecase
+
1. Active source change
- - When user choose different audio source with current one, IVI system stop or pause current source and activate new one.
- - When user connect external device e.g. iPhone, USB memory IVI system change active source automatically to connected one.
+- When user choose different audio source with current one, IVI system stop or pause current source and activate new one.
+- When user connect external device e.g. iPhone, USB memory IVI system change active source automatically to connected one.
2. Active source locking
- - When user is in phone call, IVI restrict to change active source.
+- When user is in phone call, IVI restrict to change active source.
3. Interrupt source mixing
- - When car close to cross road IVI system reduce the volume of current source and mix with interrupt source e.g. Navigation Guidance.
+- When car close to cross road IVI system reduce the volume of current source and mix with interrupt source e.g. Navigation Guidance.
4. Volume change
- - User can change the volume of active source or sink.
- - When user change volume during interruption e.g. Navigation Guidance, IVI system change its volume temporary or permanently.
+- User can change the volume of active source or sink.
+- When user change volume during interruption e.g. Navigation Guidance, IVI system change its volume temporary or permanently.
5. Mute/unmute
- - User can mute/unmute current active source.
+- User can mute/unmute current active source.
6. Volume management
- - When user change active source, IVI system mute/unmute to avoid distortion of sound.
+- When user change active source, IVI system mute/unmute to avoid distortion of sound.
7. Volume acceleration
- - When road noise is increased by speed, IVI system automatically change the volume of active source.
+- When road noise is increased by speed, IVI system automatically change the volume of active source.
8. Routing sound
- - System needs to route sound stream to proper zones. (driver zone, passenger zone, rear seat zone)
+- System needs to route sound stream to proper zones. (driver zone, passenger zone, rear seat zone)
[See also this page](https://wiki.automotivelinux.org/eg-ui-graphics-req-audiorouting)
@@ -204,11 +206,12 @@ See also our [Sample code](#Sample\ code).
<div id="Software\ Architecture"></div>
## Software Architecture
+
The architecture of Sound Manager is shown below.
Sound Manager is the service designed to be used by multiple applications.
-Therefore Sound Manager framework consists of two binder layers. Please refer the following figure.
-The upper binder is for application side security context. The lower binder is for server side security context.
-Usually an application side binder has some business logic for each application, so the number of binders depend on the number of applications which use Sound Manager.
+Therefore Sound Manager framework consists of two binder layers. Please refer the following figure.
+The upper binder is for application side security context. The lower binder is for server side security context.
+Usually an application side binder has some business logic for each application, so the number of binders depend on the number of applications which use Sound Manager.
On the other hand, regarding lower binder there is only one module in the system. This binder receives messages from multiple applications (in detail, it comes from upper layer binder).
The communication protocols between libsoundmanager and upper binder, upper binder and lower binder, are WebSocket. The protocols between lower binder (soundmanager-binding) and AudioManager is D-Bus.
@@ -220,6 +223,7 @@ The communication protocols between libsoundmanager and upper binder, upper bind
<div id="API\ reference"></div>
## API reference
+
"libsoundmanager" and "soundmanager_binding" provides several kinds of APIs, and these APIs basically correspond to GENIVI Audio Manager API. (Some APIs are Sound Manager original functions.)
For understanding, GENIVI Audio Manager stands for one core module and three plug-ins.
@@ -237,10 +241,10 @@ For understanding, GENIVI Audio Manager stands for one core module and three plu
![See also GENIVI AudioManager Components](parts/am-component.png)
(This figure was copied from GENIVI Web page.)
-
<div id="APIs"></div>
### APIs
+
- init(int port, const std::string& token)
- registerSource(const std::string& sourceName)
- connect(int sourceID, int sinkID)
@@ -291,16 +295,19 @@ Regarding more detail, please refer doxygen documents.
<div id="StartUp"></div>
### StartUp
+
![seq_startup.png](parts/seq_startup.svg)
<div id="Registration"></div>
### Registration
+
![seq_registration.png](parts/seq_registration.svg)
<div id="Request\ Sound\ Right"></div>
### Request Sound Right
+
![seq_requestsoundmode.png](parts/seq_requestsoundmode.svg)
<div id="Connect\ Sound\ Route"></div>
@@ -311,31 +318,37 @@ Regarding more detail, please refer doxygen documents.
<div id="Start\ Sound\ Streaming"></div>
### Start Sound Streaming
+
![seq_startsoundstreaming.png](parts/seq_startsoundstreaming.svg)
<div id="Stop\ Sound\ Streaming"></div>
### Stop Sound Streaming
+
![seq_stopsoundstreaming.png](parts/seq_stopsoundstreaming.svg)
<div id="Disconnect\ Sound\ Route"></div>
### Disconnect Sound Route
+
![seq_disconnectsoundroute.png](parts/seq_disconnectsoundroute.svg)
<div id="Change\ Volume"></div>
### Change Volume
+
![seq_changevolume.png](parts/seq_changevolume.svg)
<div id="Set\ Mute\ State"></div>
### Set Mute State
+
![seq_setmutestate.png](parts/seq_setmutestate.svg)
<div id="Release\ Sound\ Right"></div>
### Release Sound Right
+
![seq_releasesoundmode.png](parts/seq_releasesoundmode.svg)
* * *
@@ -352,21 +365,21 @@ The below document should bring good understanding.
Although strongly recommended to read whole pages, but you can get quick understanding by page.10 to 14.
-
<div id="Sample\ code"></div>
# Sample code
+
You can find samples using Sound Manager as below.
-* `apps/agl-service-homescreen-2017/sample/template`
-* `apps/radio (branch=sandbox/knimitz/hmi-framework)`
+- `apps/agl-service-homescreen-2017/sample/template`
+- `apps/radio (branch=sandbox/knimitz/hmi-framework)`
<div id="Limitation"></div>
# Limitation
-* Minimum APIs and Events are prepared for RC2, the following APIs will be available for final version of EE.
- * getListMainSinks
+- Minimum APIs and Events are prepared for RC2, the following APIs will be available for final version of EE.
-* Sound of application is not automatically muted for now because Audio Manager doesn't automatically stop with current plugins.
+- getListMainSinks
+- Sound of application is not automatically muted for now because Audio Manager doesn't automatically stop with current plugins.