mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-08 19:34:13 +01:00
Add new :volume command.
This commit is contained in:
@@ -2,6 +2,7 @@ Priority list:
|
||||
1-9 as in Vim (9 = required for next release, 5 = would be nice, 1 = probably not)
|
||||
|
||||
BUGS:
|
||||
- SB doesn't support tab-undo yet so :undo and "u" etc don't work
|
||||
|
||||
FEATURES:
|
||||
9 / and ? possibly reusing "Jump to" functionality directly.
|
||||
|
||||
@@ -11,10 +11,13 @@ function Player() // {{{
|
||||
// Get the focus to the visible playlist first
|
||||
//window._SBShowMainLibrary();
|
||||
|
||||
// FIXME: need to test that we're playing - why is gMM.playbackControl.status always null?
|
||||
// FIXME: need to test that we're playing - gMM.status.state
|
||||
// interval (seconds)
|
||||
function seek(interval, direction)
|
||||
{
|
||||
if (!gMM.playbackControl)
|
||||
return;
|
||||
|
||||
interval = interval * 1000;
|
||||
|
||||
let min = 0;
|
||||
@@ -127,7 +130,15 @@ function Player() // {{{
|
||||
completer: function (context, args) completion.song(context, args)
|
||||
});
|
||||
|
||||
// TODO: better of as a single command, or cmus compatible E.g. :player-next? --djk
|
||||
// TODO: better off as a single command, or cmus compatible E.g. :player-next? --djk
|
||||
commands.add(["playerp[lay]"],
|
||||
"Play track",
|
||||
function () { player.play(); });
|
||||
|
||||
commands.add(["playerpa[use]"],
|
||||
"Pause/unpause track",
|
||||
function () { player.togglePlayPause(); });
|
||||
|
||||
commands.add(["playern[ext]"],
|
||||
"Play next track",
|
||||
function () { player.next(); });
|
||||
@@ -140,13 +151,26 @@ function Player() // {{{
|
||||
"Stop track",
|
||||
function () { player.stop(); });
|
||||
|
||||
commands.add(["playerp[lay]"],
|
||||
"Play track",
|
||||
function () { player.play(); });
|
||||
commands.add(["vol[ume]"],
|
||||
"Set the volume",
|
||||
function (args)
|
||||
{
|
||||
let arg = args[0];
|
||||
|
||||
commands.add(["playerpa[use]"],
|
||||
"Pause/unpause track",
|
||||
function () { player.togglePlayPause(); });
|
||||
if (!/^[+-]?\d+$/.test(arg))
|
||||
{
|
||||
liberator.echoerr("E488: Trailing characters");
|
||||
return;
|
||||
}
|
||||
|
||||
let level = parseInt(arg, 10) / 100;
|
||||
|
||||
if (/^[+-]/.test(arg))
|
||||
level = player.volume + level;
|
||||
|
||||
player.volume = Math.min(Math.max(level, 0), 1);
|
||||
},
|
||||
{ argCount: 1 });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
@@ -154,6 +178,13 @@ function Player() // {{{
|
||||
|
||||
return {
|
||||
|
||||
// TODO: check bounds and round, 0 - 1 or 0 - 100?
|
||||
get volume() gMM.volumeControl.volume,
|
||||
set volume(value)
|
||||
{
|
||||
gMM.volumeControl.volume = value;
|
||||
},
|
||||
|
||||
play: function play()
|
||||
{
|
||||
gMM.sequencer.play();
|
||||
@@ -209,14 +240,12 @@ function Player() // {{{
|
||||
|
||||
seekForward: function seekForward(interval)
|
||||
{
|
||||
if (gMM.playbackControl)
|
||||
seek(interval, true);
|
||||
seek(interval, true);
|
||||
},
|
||||
|
||||
seekBackward: function seekBackward(interval)
|
||||
{
|
||||
if (gMM.playbackControl)
|
||||
seek(interval, false);
|
||||
seek(interval, false);
|
||||
},
|
||||
|
||||
//FIXME: 10% ?
|
||||
|
||||
@@ -5,6 +5,8 @@ HEADER
|
||||
The following features apply to Player mode which is activated when the media
|
||||
tab has focus.
|
||||
|
||||
section:Playing{nbsp}tracks[playing-tracks]
|
||||
|
||||
|x| |:playerp| |:playerplay|
|
||||
||:playerp[lay]|| +
|
||||
||x||
|
||||
@@ -57,6 +59,20 @@ ________________________________________________________________________________
|
||||
Toggle repeat mode.
|
||||
________________________________________________________________________________
|
||||
|
||||
section:Filtering{nbsp}the{nbsp}library[filter,filtering]
|
||||
|
||||
|f| |:f| |:filter|
|
||||
||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| +
|
||||
||f||
|
||||
________________________________________________________________________________
|
||||
Filter and play tracks. If only [a][artist][a] is specified then all tracks for
|
||||
that artist are played in album order. If {album} is also specified then all
|
||||
tracks for that album are played. A specific track can be specified with
|
||||
{track}.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
section:Seeking{nbsp}to{nbsp}a{nbsp}track{nbsp}position[seeking]
|
||||
|
||||
|h|
|
||||
||h||
|
||||
@@ -86,6 +102,8 @@ Seek -1m.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
section:Adjusting{nbsp}the{nbsp}volume[volume]
|
||||
|
||||
|+| |=|
|
||||
||+|| +
|
||||
||=||
|
||||
@@ -93,6 +111,7 @@ ________________________________________________________________________________
|
||||
Increase volume by 10%.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
|-|
|
||||
||-||
|
||||
________________________________________________________________________________
|
||||
@@ -100,14 +119,12 @@ Decrease volume by 10%.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
|f| |:f| |:filter|
|
||||
||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| +
|
||||
||f||
|
||||
|:vol| |:volume|
|
||||
||:vol[ume][!] [a][value][a]|| +
|
||||
||:vol[ume][!] +{value} | -{value}|| +
|
||||
________________________________________________________________________________
|
||||
Filter and play tracks. If only [a][artist][a] is specified then all tracks for
|
||||
that artist are played in album order. If {album} is also specified then all
|
||||
tracks for that album are played. A specific track can be specified with
|
||||
{track}.
|
||||
Set the player volume. [a][value][a] can be an absolute value between 0 and
|
||||
100% or a relative value if prefixed with "-" or "+".
|
||||
________________________________________________________________________________
|
||||
|
||||
// vim: set filetype=asciidoc:
|
||||
|
||||
Reference in New Issue
Block a user