Class AudioDucking
Definition
- Namespace:
- Tizen.Multimedia
- Assembly:
- Tizen.Multimedia.dll
Controls audio ducking for specific audio streams, allowing for dynamic adjustment of audio levels during playback. This class enables the activation and deactivation of ducking, monitors ducking state changes, and ensures proper privileges are in place for volume adjustments.
public sealed class AudioDucking : IDisposable
- Inheritance
-
objectAudioDucking
- Implements
-
System.IDisposable
Constructors
View SourceAudioDucking(AudioStreamType)
Initializes a new instance of the AudioDucking class for a specified audio stream type. This constructor sets up the audio ducking mechanism for the target stream, allowing the application to respond to ducking state changes.
Declaration
public AudioDucking(AudioStreamType targetType)
Parameters
Type | Name | Description |
---|---|---|
AudioStreamType | targetType | The type of sound stream affected by this new instance. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
System.InvalidOperationException | Operation failed; internal error. |
See Also
Properties
View SourceIsDucked
Gets a value indicating whether the audio stream is currently ducked. This property checks the ducking state and returns true if the audio level is lowered; otherwise, false.
Declaration
public bool IsDucked { get; }
Property Value
Type | Description |
---|---|
bool | true if the audio stream is ducked; otherwise, false. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Operation failed; internal error. |
System.ObjectDisposedException | The AudioDucking has already been disposed of. |
See Also
Methods
View SourceActivate(uint, double)
Activates audio ducking for a specified duration and volume ratio. This method lowers the audio level of the target stream for a defined period, enabling a smoother audio experience during events like notifications.
Declaration
public void Activate(uint duration, double ratio)
Parameters
Type | Name | Description |
---|---|---|
uint | duration | The duration for ducking in milliseconds. |
double | ratio | The volume ratio when ducked. |
Remarks
To activate ducking, the specified privilege is required.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
System.InvalidOperationException | Operation failed; internal error. |
System.UnauthorizedAccessException | The caller does not have required privilege to set volume. |
System.ObjectDisposedException | The AudioDucking has already been disposed of. |
See Also
View SourceDeactivate()
Deactivates audio ducking, restoring the audio levels of the target stream to their original state. This method is used to stop the ducking effect applied earlier when needed.
Declaration
public void Deactivate()
Remarks
To deactivate ducking, the specified privilege is required.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Operation failed; internal error. |
System.UnauthorizedAccessException | The caller does not have required privilege to set volume. |
System.ObjectDisposedException | The AudioDucking has already been disposed of. |
See Also
View SourceDispose()
Releases all resources used by the AudioDucking instance. This method clears any allocated resources and should be called when the AudioDucking object is no longer needed.
Declaration
public void Dispose()
See Also
Events
View SourceDuckingStateChanged
Occurs when the ducking state of the audio stream changes, notifying subscribers of the current ducking status.
Declaration
public event EventHandler<AudioDuckingStateChangedEventArgs> DuckingStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><AudioDuckingStateChangedEventArgs> |