--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+ <meta http-equiv="X-UA-Compatible" content="IE=9" />
+ <link rel="stylesheet" type="text/css" href="../../css/styles.css" />
+ <link rel="stylesheet" type="text/css" href="../../css/snippet.css" />
+ <script type="text/javascript" src="../../scripts/snippet.js"></script>
+ <script type="text/javascript" src="../../scripts/jquery.util.js" charset="utf-8"></script>
+ <script type="text/javascript" src="../../scripts/common.js" charset="utf-8"></script>
+ <script type="text/javascript" src="../../scripts/core.js" charset="utf-8"></script>
+ <script type="text/javascript" src="../../scripts/search.js" charset="utf-8"></script>
+
+ <title>Audio Management</title>
+</head>
+
+<body onload="prettyPrint()" style="overflow: auto;">
+
+
+<div id="toc-navigation">
+
+ <div id="toc_border"><div id="toc">
+ <p class="toc-title">Dependencies</p>
+ <ul class="toc">
+ <li>Tizen 4.0 and Higher</li>
+ </ul>
+
+ <p class="toc-title">Content</p>
+ <ul class="toc">
+ <li><a href="#prerequisites">Prerequisites</a></li>
+ <li><a href="#manage">Controlling Volume Levels</a></li>
+ <li><a href="#query_device">Querying Audio Devices</a></li>
+ </ul>
+
+ <p class="toc-title">Related Info</p>
+ <ul class="toc">
+ <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1AudioManager.html">Tizen.Multimedia.AudioManager Class</a></li>
+ </ul>
+ </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+<h1>Audio Management</h1>
+<p>You can control the audio behavior of your application.</p>
+<p>The main features of the <code>Tizen.Multimedia.AudioManager</code> class include:</p>
+<ul>
+<li>Controlling the volume
+<p>You can <a href="#manage">control the output volume</a> by managing the audio type and its volume level.</p>
+</li>
+<li>Querying audio devices
+<p>You can <a href="#query_device">retrieve various device information</a>, such as the device state.</p></li>
+</ul>
+<h2 id="prerequisites">Prerequisites</h2>
+<p>To control volume levels, the application has to request permission by adding the following privilege to the <code>tizen-manifest.xml</code> file:</p>
+<pre class="prettyprint">
+<privileges>
+ <privilege>http://tizen.org/privilege/volume.set</privilege>
+</privileges>
+</pre>
+<h2 id="manage">Controlling Volume Levels</h2>
+<p>You can manage the volume level of a specific audio type. You can set and get a volume level and a maximum volume level of a particular audio type.</p>
+<p>Normally, if there is an active output stream, the <code>VolumeController.CurrentPlaybackType</code> property of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1AudioManager.html">Tizen.Multimedia.AudioManager</a> class returns the stream audio type, and if not, it returns <code>AudioVolumeType.None</code>.</p>
+<p>To control the volume of your application:</p>
+<ul>
+<li>To receive a notification whenever the volume changes, define and register an event handler for the <code>VolumeController.Changed</code> event of the <code>Tizen.Multimedia.AudioManager</code> class:
+<pre class="prettyprint">
+void OnVolumeChanged(object sender, VolumeChangedEventArgs args)
+{
+ Tizen.Log.Info("AudioManager", $"{args.Type} volume changed to {args.Level}");
+}
+
+AudioManager.VolumeController.Changed += OnVolumeChanged;
+</pre>
+<p>When the volume changes, the event handler provides in its parameters the audio type that has changed and the new volume level.</p>
+</li>
+<li>To retrieve the current and maximum volumes for a specific audio type, use the <code>VolumeController.Level</code> and <code>VolumeController.MaxLevel</code> properties of the <code>Tizen.Multimedia.AudioManager</code> class:
+
+<pre class="prettyprint">
+var type = AudioVolumeType.Media;
+
+var curVol = AudioManager.VolumeController.Level[type];
+
+var maxVol = AudioManager.VolumeController.MaxLevel[type];
+</pre>
+</li>
+<li>To set the volume level, use the <code>VolumeController.Level</code> property.
+<p>In the following example, a value is received from application UI slider, with which the user sets the volume level.</p>
+<pre class="prettyprint">
+var type = AudioVolumeType.Media;
+int value;
+
+/// Make sure the value is within the system maximum volume
+/// by checking the VolumeController.MaxLevel property
+
+AudioManager.VolumeController.Level[type] = value;
+</pre>
+</li>
+</ul>
+
+<h2 id="query_device">Querying Audio Devices</h2>
+<p>The audio behavior of your application must change depending on the audio devices that are connected.</p>
+
+<p>To query audio device information:</p>
+<ul>
+<li>To access device information:
+<ol>
+<li>Retrieve the list of the currently connected audio devices with the <code>GetConnectedDevices()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1AudioManager.html">Tizen.Multimedia.AudioManager</a> class:
+<pre class="prettyprint">
+IEnumerable<AudioDevice> connectedDevices = AudioManager.GetConnectedDevices();
+</pre>
+</li>
+<li>Retrieve the device information from the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1AudioDevice.html">Tizen.Multimedia.AudioDevice</a> class, which has the following properties:
+<ul>
+<li><code>Type</code>: Device type</li>
+<li><code>IoDirection</code>: Device IO direction</li>
+<li><code>Id</code>: Device ID</li>
+<li><code>Name</code>: Device name</li>
+<li><code>State</code>: Device state</li>
+</ul>
+</li>
+</ol>
+</li>
+<li>To get a notification when the audio device connection or state changes, add event handlers for the <code>DeviceConnectionChanged</code> and <code>DeviceStateChanged</code> events of the <code>Tizen.Multimedia.AudioManager</code> class:
+<ul><li>To receive a notification whenever the device connection state changes:
+<pre class="prettyprint">
+void OnDeviceConnectionChanged(object sender, AudioDeviceConnectionChangedEventArgs args)
+{
+ if (args.IsConnected)
+ {
+ if (args.Device.Type == AudioDeviceType.BluetoothMedia)
+ /// Connected device type is Bluetooth, handle accordingly
+ else
+ /// Handle accordingly
+ }
+ else
+ {
+ if (args.Device.Type == AudioDeviceType.BluetoothMedia)
+ /// Disconnected device type is Bluetooth, handle accordingly
+ else
+ /// Handle accordingly
+ }
+}
+
+AudioManager.DeviceConnectionChanged += OnDeviceConnectionChanged;
+</pre>
+</li>
+<li>To receive a notification whenever the device state changes:
+<pre class="prettyprint">
+void OnDeviceStateChanged(object sender, AudioDeviceStateChangedEventArgs args)
+{
+ if (args.Device.Type == AudioDeviceType.BluetoothMedia)
+ {
+ if (args.Device.State == AudioDeviceState.Deactivated)
+ /// Bluetooth device has been deactivated, handle accordingly
+ else
+ /// Handle accordingly
+ }
+ else
+ {
+ /// Handle accordingly
+ }
+}
+
+AudioManager.DeviceStateChanged += OnDeviceStateChanged;
+</pre>
+<div class="note">
+ <strong>Note</strong>
+ The initial state of the connected device is <code>Deactivated</code>.
+</div>
+</li>
+</ul></li>
+</ul>
+
+<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../scripts/showhide.js"></script>
+</div></div></div>
+
+
+<a class="top sms" href="#"><img src="../../images/btn_top.gif" alt="Go to top" /></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body></html>