Tizen.Multimedia.AudioIO 1.0.0 \
Tizen.Multimedia.Camera 1.0.0 \
Tizen.Multimedia.MediaCodec 1.0.0 \
- Tizen.Multimedia.MediaPlayer 1.0.0 \
+ Tizen.Multimedia.MediaPlayer 1.0.1 \
Tizen.Multimedia.Metadata 1.0.0 \
Tizen.Multimedia.Radio 1.0.1 \
Tizen.Multimedia.Recorder 1.0.0 \
ThrowIfFailed("Failed to initialize the AudioEffect");
Count = count;
- MinBandLevel = min;
- MaxBandLevel = max;
+ BandLevelRange = new Range(min, max);
_bands = new EqualizerBand[count];
}
public int Count{ get; }
- // TODO replace with range struct
/// <summary>
- /// Get the minimum band level of the bands in dB.
+ /// Get the band level range of the bands in dB.
/// </summary>
- public int MinBandLevel { get; }
-
- /// <summary>
- /// Gets the maximum band level of the bands in dB.
- /// </summary>
- public int MaxBandLevel { get; }
+ public Range BandLevelRange { get; }
/// <summary>
/// Gets the value whether the AudioEffect is available or not.
}
/// <summary>
- /// Sets the gain for the equalizer band.
+ /// Sets or gets the gain for the equalizer band.
/// </summary>
/// <param name="value">The value indicating new gain in decibel(dB).</param>
/// <exception cref="ObjectDisposedException">The player that this EqualizerBand belongs to has already been disposed of.</exception>
/// <exception cref="ArgumentOutOfRangeException">
- /// value is less than <see cref="AudioEffect.MinBandLevel"/>.\n
+ /// <paramref name="value"/> is less than <see cref="AudioEffect.MinBandLevel"/>.\n
/// -or-\n
- /// value is greater than <see cref="AudioEffect.MaxBandLevel"/>.
+ /// <paramref name="value"/> is greater than <see cref="AudioEffect.MaxBandLevel"/>.
/// </exception>
- public void SetLevel(int value)
+ public int Level
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- _owner.Player.ValidateNotDisposed();
-
- if (value < _owner.MinBandLevel || _owner.MaxBandLevel < value)
+ get
{
- Log.Error(PlayerLog.Tag, "invalid level : " + value);
- throw new ArgumentOutOfRangeException(nameof(value), value,
- $"valid value range is { nameof(AudioEffect.MinBandLevel) } <= level <= { nameof(AudioEffect.MaxBandLevel) }. " +
- $"but got {value}.");
+ Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
+ _owner.Player.ValidateNotDisposed();
+
+ int value = 0;
+ Native.GetEqualizerBandLevel(_owner.Player.Handle, _index, out value).
+ ThrowIfFailed("Failed to get the level of the equalizer band");
+ Log.Info(PlayerLog.Tag, "get level : " + value);
+ return value;
+ }
+ set
+ {
+ Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
+ _owner.Player.ValidateNotDisposed();
+
+ if (value < _owner.BandLevelRange.Min || _owner.BandLevelRange.Max < value)
+ {
+ Log.Error(PlayerLog.Tag, "invalid level : " + value);
+ throw new ArgumentOutOfRangeException(nameof(value), value,
+ $"valid value range is { nameof(AudioEffect.BandLevelRange) }." +
+ $"but got {value}.");
+ }
+
+ Native.SetEqualizerBandLevel(_owner.Player.Handle, _index, value).
+ ThrowIfFailed("Failed to set the level of the equalizer band");
}
-
- Native.SetEqualizerBandLevel(_owner.Player.Handle, _index, value).
- ThrowIfFailed("Failed to set the level of the equalizer band");
}
- /// <summary>
- /// Gets the gain for the equalizer band.
- /// </summary>
- /// <exception cref="ObjectDisposedException">The player that this EqualizerBand belongs to has already been disposed of.</exception>
- public int GetLevel()
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- _owner.Player.ValidateNotDisposed();
-
- int value = 0;
- Native.GetEqualizerBandLevel(_owner.Player.Handle, _index, out value).
- ThrowIfFailed("Failed to get the level of the equalizer band");
- Log.Info(PlayerLog.Tag, "get level : " + value);
- return value;
- }
/// <summary>
/// Gets the frequency in dB.
public int Frequency { get; }
/// <summary>
- /// Gets the frequency range oin dB.
+ /// Gets the frequency range in dB.
/// </summary>
public int FrequencyRange { get; }
private void RetrieveProperties()
{
Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- NativePlayer.GetVolume(Handle, out _volume, out _volume).
- ThrowIfFailed("Failed to initialize the player");
NativePlayer.GetAudioLatencyMode(Handle, out _audioLatencyMode).
ThrowIfFailed("Failed to initialize the player");
#region Methods
/// <summary>
- /// Gets the mute state.
+ /// Gets or sets the mute state.
/// </summary>
+ /// <value>true if the player is muted; otherwise, false.</value>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- public bool IsMuted()
+ public bool Muted
{
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- ValidateNotDisposed();
-
- bool value = false;
- NativePlayer.IsMuted(Handle, out value).ThrowIfFailed("Failed to get the mute state of the player");
-
- Log.Info(PlayerLog.Tag, "get mute : " + value);
+ get
+ {
+ Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- return value;
- }
+ bool value = false;
+ NativePlayer.IsMuted(Handle, out value).ThrowIfFailed("Failed to get the mute state of the player");
- /// <summary>
- /// Sets the mute state.
- /// </summary>
- /// <param name="mute">true to mute the player; otherwise, false.</param>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- public void SetMute(bool mute)
- {
- Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
- ValidateNotDisposed();
+ Log.Info(PlayerLog.Tag, "get mute : " + value);
- NativePlayer.SetMute(Handle, mute).ThrowIfFailed("Failed to set the mute state of the player");
+ return value;
+ }
+ set
+ {
+ NativePlayer.SetMute(Handle, value).ThrowIfFailed("Failed to set the mute state of the player");
+ }
}
/// <summary>
}
#region Volume
- private float _volume;
-
/// <summary>
- /// Sets the current volume.
+ /// Gets or sets the current volume.
/// </summary>
/// <remarks>Valid volume range is from 0 to 1.0, inclusive.</remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// -or-\n
/// <paramref name="value"/> is greater than 1.0.
/// </exception>
- public void SetVolume(float value)
+ public float Volume
{
- ValidateNotDisposed();
-
- if (value < 0F || 1.0F < value)
+ get
{
- throw new ArgumentOutOfRangeException(nameof(value), value,
- $"Valid volume range is 0 <= value <= 1.0, but got { value }.");
+ float value = 0.0F;
+ NativePlayer.GetVolume(Handle, out value, out value).
+ ThrowIfFailed("Failed to get the volume of the player");
+ return value;
}
+ set
+ {
+ if (value < 0F || 1.0F < value)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value), value,
+ $"Valid volume range is 0 <= value <= 1.0, but got { value }.");
+ }
- NativePlayer.SetVolume(Handle, value, value).
- ThrowIfFailed("Failed to set the volume of the player");
+ NativePlayer.SetVolume(Handle, value, value).
+ ThrowIfFailed("Failed to set the volume of the player");
+ }
}
- /// <summary>
- /// Gets the current volume.
- /// </summary>
- /// <remarks>the volume range is from 0 to 1.0, inclusive.</remarks>
- /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
- public float GetVolume()
- {
- ValidateNotDisposed();
-
- float value = 0.0F;
- NativePlayer.GetVolume(Handle, out value, out value).
- ThrowIfFailed("Failed to get the volume of the player");
- return value;
- }
#endregion
/// <summary>
}
/// <summary>
- /// Gets the selected track index.
+ /// Gets or sets the selected track index.
/// </summary>
- /// <returns>The currently selected track index.</returns>
- /// <remarks>The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
- /// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed.</exception>
- /// <exception cref="InvalidOperationException">The <see cref="Player"/> that this instance belongs to is not in the valid state.</exception>
- public int GetSelected()
- {
- _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
-
- int value = 0;
-
- NativePlayer.GetCurrentTrack(_owner.Handle, _streamType, out value).
- ThrowIfFailed("Failed to get the selected index of the player");
- Log.Debug(PlayerLog.Tag, "get selected index : " + value);
- return value;
- }
-
- /// <summary>
- /// Selects the track.
- /// </summary>
- /// <param name="index">The index to select.</param>
+ /// <value>The currently selected track index.</value>
/// <remarks>The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
/// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed.</exception>
/// <exception cref="InvalidOperationException">The <see cref="Player"/> that this instance belongs to is not in the valid state.</exception>
/// <exception cref="ArgumentOutOfRangeException">
- /// <paramref name="index"/> is less than zero.\n
+ /// <paramref name="value"/> is less than zero.\n
/// -or-\n
- /// <paramref name="index"/> is equal to or greater than <see cref="GetCount()"/>
+ /// <paramref name="value"/> is equal to or greater than <see cref="GetCount()"/>
/// </exception>
- public void SetSelected(int index)
+ public int Selected
{
- if (index < 0 || GetCount() <= index)
+ get
{
- Log.Error(PlayerLog.Tag, "invalid index");
- throw new ArgumentOutOfRangeException(nameof(index), index,
- $"valid index range is 0 <= x < {nameof(GetCount)}(), but got { index }.");
+ _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
+
+ int value = 0;
+
+ NativePlayer.GetCurrentTrack(_owner.Handle, _streamType, out value).
+ ThrowIfFailed("Failed to get the selected index of the player");
+ Log.Debug(PlayerLog.Tag, "get selected index : " + value);
+ return value;
}
+ set
+ {
+ if (value < 0 || GetCount() <= value)
+ {
+ Log.Error(PlayerLog.Tag, "invalid index");
+ throw new ArgumentOutOfRangeException(nameof(value), value,
+ $"valid index range is 0 <= x < {nameof(GetCount)}(), but got { value }.");
+ }
- _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
+ _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
- NativePlayer.SelectTrack(_owner.Handle, _streamType, index).
- ThrowIfFailed("Failed to set the selected index of the player");
+ NativePlayer.SelectTrack(_owner.Handle, _streamType, value).
+ ThrowIfFailed("Failed to set the selected index of the player");
+ }
}
-
}
}