public AudioDeviceIoDirection IoDirection => _ioDirection;
/// <summary>
- /// Gets the state of the device.
- /// </summary>
- /// <value>The <see cref="AudioDeviceState"/> of the device.</value>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated since API level 5. Please use the IsRunning property instead.")]
- public AudioDeviceState State
- {
- get
- {
- Interop.AudioDevice.GetDeviceState(Id, out var state).
- ThrowIfError("Failed to get the state of the device");
-
- return state;
- }
- }
-
- /// <summary>
/// Gets the running state of the device.
/// </summary>
/// <value>true if the audio stream of device is running actually; otherwise, false.</value>
External = 0x0020,
/// <summary>
- /// Deactivated devices.
- /// </summary>
- [Obsolete("Deprecated since API level 5.")]
- Deactivated = 0x1000,
-
- /// <summary>
- /// Activated devices.
- /// </summary>
- [Obsolete("Deprecated since API level 5.")]
- Activated = 0x2000,
-
- /// <summary>
/// All devices.
/// </summary>
All = 0xFFFF
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-
-namespace Tizen.Multimedia
-{
- /// <summary>
- /// Specifies the audio device states.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated since API level 5.")]
- public enum AudioDeviceState
- {
- /// <summary>
- /// Deactivated state.
- /// </summary>
- Deactivated,
-
- /// <summary>
- /// Activated state.
- /// </summary>
- Activated
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-
-namespace Tizen.Multimedia
-{
- /// <summary>
- /// Provides data for the <see cref="AudioManager.DeviceStateChanged"/> event.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated since API level 5. Please use the AudioDeviceRunningChangedEventArgs class instead.")]
- public class AudioDeviceStateChangedEventArgs : EventArgs
- {
- internal AudioDeviceStateChangedEventArgs(AudioDevice device, AudioDeviceState changedState)
- {
- Device = device;
- State = changedState;
- }
-
- /// <summary>
- /// Gets the device.
- /// </summary>
- /// <value>The <see cref="AudioDevice"/>.</value>
- /// <since_tizen> 3 </since_tizen>
- public AudioDevice Device { get; }
-
- /// <summary>
- /// Gets the state of the device.
- /// </summary>
- /// <value>The <see cref="AudioDeviceState"/> of the device.</value>
- /// <since_tizen> 4 </since_tizen>
- public AudioDeviceState State { get; }
- }
-}
}
#endregion
- #region DeviceStateChanged event
- private static int _deviceStateChangedCallbackId = -1;
-
-#pragma warning disable CS0618 // Type or member is obsolete
-
- private static Interop.AudioDevice.StateChangedCallback _audioDeviceStateChangedCallback;
- private static EventHandler<AudioDeviceStateChangedEventArgs> _audioDeviceStateChanged;
- private static readonly object _audioDeviceStateLock = new object();
-
- /// <summary>
- /// Occurs when the state of an audio device changes.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated since API level 5. Please use the DeviceRunningStateChanged property instead.")]
- public static event EventHandler<AudioDeviceStateChangedEventArgs> DeviceStateChanged
- {
- add
- {
- if (value == null)
- {
- return;
- }
-
- lock (_audioDeviceStateLock)
- {
- if (_audioDeviceStateChanged == null)
- {
- RegisterDeviceStateChangedEvent();
- }
- _audioDeviceStateChanged += value;
- }
- }
- remove
- {
- if (value == null)
- {
- return;
- }
-
- lock (_audioDeviceStateLock)
- {
- if (_audioDeviceStateChanged == value)
- {
- UnregisterDeviceStateChangedEvent();
- }
- _audioDeviceStateChanged -= value;
- }
- }
- }
-
- private static void RegisterDeviceStateChangedEvent()
- {
- _audioDeviceStateChangedCallback = (device, changedState, _) =>
- {
- _audioDeviceStateChanged?.Invoke(null,
- new AudioDeviceStateChangedEventArgs(new AudioDevice(device), changedState));
- };
-
- Interop.AudioDevice.AddDeviceStateChangedCallback(AudioDeviceOptions.All,
- _audioDeviceStateChangedCallback, IntPtr.Zero, out _deviceStateChangedCallbackId).
- ThrowIfError("Failed to add device state changed event");
- }
-
-#pragma warning restore CS0618 // Type or member is obsolete
-
- private static void UnregisterDeviceStateChangedEvent()
- {
- Interop.AudioDevice.RemoveDeviceStateChangedCallback(_deviceStateChangedCallbackId).
- ThrowIfError("Failed to remove device state changed event");
- }
- #endregion
-
#region DeviceRunningStateChanged event
private static int _deviceRunningChangedCallbackId = -1;
private static Interop.AudioDevice.RunningChangedCallback _audioDeviceRunningChangedCallback;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void ConnectionChangedCallback(IntPtr device, bool isConnected, IntPtr userData);
-#pragma warning disable CS0618 // Type or member is obsolete
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void StateChangedCallback(IntPtr device, AudioDeviceState changedState, IntPtr userData);
-#pragma warning restore CS0618 // Type or member is obsolete
-
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void RunningChangedCallback(IntPtr device, bool isRunning, IntPtr userData);
[DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_name")]
internal static extern int GetDeviceName(IntPtr device, out IntPtr name);
-#pragma warning disable CS0618 // Type or member is obsolete
- [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_state_by_id")]
- internal static extern AudioManagerError GetDeviceState(int deviceId, out AudioDeviceState state);
-#pragma warning restore CS0618 // Type or member is obsolete
-
[DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_is_device_running_by_id")]
internal static extern AudioManagerError IsDeviceRunning(int deviceId, out bool isRunning);
[DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_connection_changed_cb")]
internal static extern AudioManagerError RemoveDeviceConnectionChangedCallback(int id);
- [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_state_changed_cb")]
- internal static extern AudioManagerError AddDeviceStateChangedCallback(AudioDeviceOptions deviceMask,
- StateChangedCallback callback, IntPtr userData, out int id);
-
- [DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_state_changed_cb")]
- internal static extern AudioManagerError RemoveDeviceStateChangedCallback(int id);
-
[DllImport(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_running_changed_cb")]
internal static extern AudioManagerError AddDeviceRunningChangedCallback(AudioDeviceOptions deviceMask,
RunningChangedCallback callback, IntPtr userData, out int id);