[AudioManager] Add a property to get current playback volume type, revise descriptions
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 25 Jan 2017 05:20:37 +0000 (14:20 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 8 Feb 2017 08:42:38 +0000 (00:42 -0800)
Change-Id: I567a846354c4191dfce0656a6e1b917cf0cde429
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
src/Tizen.Multimedia/AudioManager/AudioManagerEnumerations.cs
src/Tizen.Multimedia/AudioManager/AudioVolume.cs
src/Tizen.Multimedia/Interop/Interop.Volume.cs

index 5a08957..6b50ee2 100755 (executable)
@@ -134,41 +134,44 @@ namespace Tizen.Multimedia
     }
 
     /// <summary>
-    /// Enumeration for audio type.
+    /// Enumeration for audio volume type.
     /// </summary>
     public enum AudioVolumeType
     {
         /// <summary>
-        /// Audio type for system
+        /// Volume type for system
         /// </summary>
         System,
         /// <summary>
-        /// Audio type for notifications
+        /// Volume type for notification
         /// </summary>
         Notification,
         /// <summary>
-        /// Audio type for alarm
+        /// Volume type for alarm
         /// </summary>
         Alarm,
         /// <summary>
-        /// Audio type for ringtones
+        /// Volume type for ringtone
         /// </summary>
         Ringtone,
         /// <summary>
-        /// Audio type for media
+        /// Volume type for media
         /// </summary>
         Media,
+        /// <summary>
+        /// Volume type for call
+        /// </summary>
         Call,
         /// <summary>
-        /// Audio type for voip
+        /// Volume type for voip
         /// </summary>
         Voip,
         /// <summary>
-        /// Audio type for voice
+        /// Volume type for voice
         /// </summary>
         Voice,
         /// <summary>
-        /// Audio type None
+        /// Volume type None
         /// </summary>
         None
     }
@@ -299,8 +302,8 @@ namespace Tizen.Multimedia
         ///Focus state for acquisition
         /// </summary>
         Acquired
-    }\r
-\r
+    }
+
     /// <summary>
     /// Enumeration for audio stream behavior
     /// </summary>
index c4a0921..7f01942 100755 (executable)
@@ -59,6 +59,22 @@ namespace Tizen.Multimedia
         }
 
         /// <summary>
+        /// The Audio Manager has predefined volume types.(system, notification, alarm, ringtone, media, call, voip, voice).
+        /// The volume type of the sound being currently played.
+        /// </summary>
+        public AudioVolumeType CurrentPlaybackType {
+            get {
+                AudioVolumeType currentType;
+                int ret = Interop.AudioVolume.GetCurrentSoundType(out currentType);
+                if(ret != 0) {
+                    Tizen.Log.Info(AudioVolumeLog.Tag, "Unable to get current playback sound type" + (AudioManagerError)ret);
+                    return AudioVolumeType.None;
+                }
+                return currentType;
+            }
+        }
+
+        /// <summary>
         /// The indexer class which is used to get/set volume level specified for a particular sound type.
         /// </summary>
         public VolumeLevel Level;
@@ -75,7 +91,7 @@ namespace Tizen.Multimedia
                 _volumeChanged.Invoke(this, eventArgs);
             };
             int error = Interop.AudioVolume.AddVolumeChangedCallback(_volumeChangedCallback, IntPtr.Zero, out _volumeChangedCallbackId);
-            Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Changed Event return:" + error);
+            Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Add Changed Event return id:" + _volumeChangedCallbackId + "error:" + error);
             AudioManagerErrorFactory.CheckAndThrowException(error, "unable to add level changed callback");
         }
 
@@ -83,7 +99,7 @@ namespace Tizen.Multimedia
         {
             if (_volumeChangedCallbackId > 0) {
                 int error = Interop.AudioVolume.RemoveVolumeChangedCallback(_volumeChangedCallbackId);
-                Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Changed remove Event return: " + error);
+                Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Remove Changed Event(id:" + _volumeChangedCallbackId + ") return error: " + error);
                 AudioManagerErrorFactory.CheckAndThrowException(error, "unable to remove level changed callback");
             }
         }
index 43975f9..b40fdf0 100755 (executable)
@@ -18,6 +18,9 @@ internal static partial class Interop
         [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_volume")]\r
         internal static extern int GetVolume(AudioVolumeType type, out int volume);\r
 \r
+        [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_current_sound_type")]\r
+        internal static extern int GetCurrentSoundType(out AudioVolumeType type);\r
+\r
         [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_volume_changed_cb")]\r
         internal static extern int AddVolumeChangedCallback(SoundManagerVolumeChangedCallback callback, IntPtr userData, out int id);\r
 \r