AbstractVolumeService
On this page
- AbstractVolumeService ⇐
Abstract
- AbstractVolumeService()
- init() ⇒
Promise.<*, Error>
- dimVolume(dimming) ⇒
Promise.<number>
- setVolume(volume, [options]) ⇒
Promise.<number>
- getVolume([options]) ⇒
Promise.<number>
- volumeUp([options]) ⇒
Promise.<number>
- volumeDown([options]) ⇒
Promise.<number>
- mute([options]) ⇒
Promise
- unMute([options]) ⇒
Promise
- toggleMute([options]) ⇒
Promise.<boolean>
- isMuted([options]) ⇒
Promise.<boolean>
- restoreLastVolume([options]) ⇒
Promise.<number>
- _init() ⇒
Promise
- _setVolume(volume) ⇒
Promise.<number>
- _getVolume() ⇒
Promise.<number>
- _mute() ⇒
Promise
- _unMute() ⇒
Promise
- _isMuted() ⇒
Promise.<boolean>
- _storeLastVolume(volume) ⇒
Promise.<number>
- _restoreLastVolume() ⇒
Promise.<number>
- _onVolumeChange(volume) ⇒
Promise
- _onMuteStateChange(muted) ⇒
Promise
- “volumeChange” (volume)
- “muteStateChange” (muted)
AbstractVolumeService ⇐ Abstract
Kind: global abstract class
Extends: Abstract
Service:
Properties
Name | Type | Description |
---|---|---|
defaultVolume | number | Default value of the volume at startup (Integer defaulted to 50) |
volumeStepPercent | number | Steps when doing a volume up or down (Integer defaulted to 10) |
maxVolume | number | Maximum value for the output volume (Integer defaulted to 100) |
defaultVolume | number | |
volumeStepPercent | number | |
dimDefaultValue | number | |
dimVoiceValue | number | |
maxVolume | number |
- AbstractVolumeService ⇐
Abstract
- new AbstractVolumeService()
- .init() ⇒
Promise.<*, Error>
- .dimVolume(dimming) ⇒
Promise.<number>
- .setVolume(volume, [options]) ⇒
Promise.<number>
- .getVolume([options]) ⇒
Promise.<number>
- .volumeUp([options]) ⇒
Promise.<number>
- .volumeDown([options]) ⇒
Promise.<number>
- .mute([options]) ⇒
Promise
- .unMute([options]) ⇒
Promise
- .toggleMute([options]) ⇒
Promise.<boolean>
- .isMuted([options]) ⇒
Promise.<boolean>
- .restoreLastVolume([options]) ⇒
Promise.<number>
- ._init() ⇒
Promise
- ._setVolume(volume) ⇒
Promise.<number>
- ._getVolume() ⇒
Promise.<number>
- ._mute() ⇒
Promise
- ._unMute() ⇒
Promise
- ._isMuted() ⇒
Promise.<boolean>
- ._storeLastVolume(volume) ⇒
Promise.<number>
- ._restoreLastVolume() ⇒
Promise.<number>
- ._onVolumeChange(volume) ⇒
Promise
- ._onMuteStateChange(muted) ⇒
Promise
- “volumeChange” (volume)
- “muteStateChange” (muted)
AbstractVolumeService()
The AbstractVolumeService handles the volume management.
init() ⇒ Promise.<*, Error>
Init the service.
Kind: instance method of AbstractVolumeService
Returns: Promise.<*, Error>
- Promise resolved when init is done
dimVolume(dimming) ⇒ Promise.<number>
Allows to dim volume by a percentage dimming value
Kind: instance method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved when the dimming is actually changed, with the new dimming percentage between 0 and this.maxVolume inclusive.
Param | Type | Description |
---|---|---|
dimming | Number | Percentage dimming value for volume reduction (default: 0, no dimming). |
setVolume(volume, [options]) ⇒ Promise.<number>
Set the main volume.
Kind: instance method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved when the main volume is actually changed, with the new volume percentage between 0 and this.maxVolume inclusive.
Emits: volumeChange
Param | Type | Description |
---|---|---|
volume | number | Volume percent between 0 and 100 inclusive. |
[options] | object | |
[options.skipNotify] | boolean | True if the method shouldn't dispatch an event, false otherwise. |
getVolume([options]) ⇒ Promise.<number>
Get the current main volume.
Kind: instance method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved with the main volume percentage between 0 and 100 inclusive.
Param | Type | Description |
---|---|---|
[options] | object | Additional options |
[options.force] | boolean | If true, renew the cache |
volumeUp([options]) ⇒ Promise.<number>
Increase the volume by volumeStepPercent.
Kind: instance method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved with the new main volume percentage between 0 and 100 inclusive.
Emits: volumeChange
Param | Type | Description |
---|---|---|
[options] | object | |
[options.skipNotify] | boolean | True if the method shouldn't dispatch an event, false otherwise |
[options.force] | boolean | If true, force to renew the cache when getting the current volume. |
volumeDown([options]) ⇒ Promise.<number>
Decrease the volume by volumeStepPercent.
Kind: instance method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved with the new main volume percentage between 0 and 100 inclusive.
Emits: volumeChange
Param | Type | Description |
---|---|---|
[options] | object | |
[options.skipNotify] | boolean | True if the method shouldn't dispatch an event, false otherwise |
[options.force] | boolean | If true, force to renew the cache when getting the current volume. |
mute([options]) ⇒ Promise
Mute the main volume. Note: not equivalent to setVolume(0) ! Mute preserves the current volume.
Kind: instance method of AbstractVolumeService
Returns: Promise
- A Promise resolved when the main volume is actually muted.
Emits: muteStateChange
Param | Type | Description |
---|---|---|
[options] | object | |
[options.skipNotify] | boolean | True if the method shouldn't dispatch an event, false otherwise |
unMute([options]) ⇒ Promise
UnMute the main volume.
Kind: instance method of AbstractVolumeService
Returns: Promise
- A Promise resolved when the main volume is actually unMuted.
Emits: muteStateChange
Param | Type | Description |
---|---|---|
[options] | object | |
[options.skipNotify] | boolean | True if the method shouldn't dispatch an event, false otherwise. |
toggleMute([options]) ⇒ Promise.<boolean>
Toggle the main volume mute status.
Kind: instance method of AbstractVolumeService
Returns: Promise.<boolean>
- A Promise resolved with the main volume mute status.
Emits: muteStateChange
Param | Type | Description |
---|---|---|
[options] | object | |
[options.skipNotify] | boolean | True if the method shouldn't dispatch an event, false otherwise |
[options.force] | boolean | If true, refresh the cache |
isMuted([options]) ⇒ Promise.<boolean>
Check if the main volume is muted.
Kind: instance method of AbstractVolumeService
Returns: Promise.<boolean>
- A Promise resolved with the main volume mute status.
Param | Type | Description |
---|---|---|
[options] | object | Additional options |
[options.force] | boolean | If true, refresh the cache |
restoreLastVolume([options]) ⇒ Promise.<number>
Restore the last volume, ie set the volume to the last value it was set Note: it does not trigger the #volumeChange event
Kind: instance method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved when the last volume
Param | Type | Description |
---|---|---|
[options] | object | Options |
_init() ⇒ Promise
Kind: instance method of AbstractVolumeService
Returns: Promise
- A Promise resolved when the service is initialized
_setVolume(volume) ⇒ Promise.<number>
Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved when the main volume is actually changed, with the volume percentage between 0 and this.maxVolume inclusive.
Param | Type |
---|---|
volume | number |
_getVolume() ⇒ Promise.<number>
Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved with the main volume percentage between 0 and this.maxVolume inclusive.
_mute() ⇒ Promise
Kind: instance abstract method of AbstractVolumeService
Returns: Promise
- A Promise resolved when the main volume is actually muted.
_unMute() ⇒ Promise
Kind: instance abstract method of AbstractVolumeService
Returns: Promise
- A Promise resolved when the main volume is actually unmuted.
Access: protected
_isMuted() ⇒ Promise.<boolean>
Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<boolean>
- A Promise resolved with the main volume mute status.
_storeLastVolume(volume) ⇒ Promise.<number>
Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved when the last volume
Param | Type |
---|---|
volume | number |
_restoreLastVolume() ⇒ Promise.<number>
Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<number>
- A Promise resolved when the last volume
_onVolumeChange(volume) ⇒ Promise
Kind: instance method of AbstractVolumeService
Access: protected
Param | Type |
---|---|
volume | number |
_onMuteStateChange(muted) ⇒ Promise
Kind: instance method of AbstractVolumeService
Access: protected
Param | Type |
---|---|
muted | boolean |
“volumeChange” (volume)
Fired when the main volume has been changed
Kind: event emitted by AbstractVolumeService
Param | Type | Description |
---|---|---|
volume | number | The new volume |
“muteStateChange” (muted)
Fired when the main volume mute state has been changed
Kind: event emitted by AbstractVolumeService
Param | Type | Description |
---|---|---|
muted | boolean | True if muted |