Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
0f79287b
Commit
0f79287b
authored
Oct 17, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
queue/Playlist: move code to MoveOrderToCurrent()
parent
f2fac77d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
+31
-7
Playlist.hxx
src/queue/Playlist.hxx
+12
-0
PlaylistControl.cxx
src/queue/PlaylistControl.cxx
+19
-7
No files found.
src/queue/Playlist.hxx
View file @
0f79287b
...
...
@@ -356,6 +356,18 @@ public:
}
void
SetConsume
(
bool
new_value
);
private
:
/**
* Prepare a manual song change: move the given song to the
* current playback order. This is done to avoid skipping
* upcoming songs in the order list. The newly selected song
* shall be inserted in the order list, and the rest shall be
* played after that as previously planned.
*
* @return the new order number of the given song
*/
unsigned
MoveOrderToCurrent
(
unsigned
old_order
);
};
#endif
src/queue/PlaylistControl.cxx
View file @
0f79287b
...
...
@@ -56,6 +56,24 @@ playlist::Stop(PlayerControl &pc)
}
}
unsigned
playlist
::
MoveOrderToCurrent
(
unsigned
old_order
)
{
if
(
!
queue
.
random
)
/* no-op because there is no order list */
return
old_order
;
const
unsigned
destination_order
=
playing
?
(
unsigned
)
current
:
0
;
/* swap the new song with the previous "current" one, so
playback continues as planned */
queue
.
SwapOrders
(
old_order
,
destination_order
);
return
destination_order
;
}
void
playlist
::
PlayPosition
(
PlayerControl
&
pc
,
int
song
)
{
...
...
@@ -90,13 +108,7 @@ playlist::PlayPosition(PlayerControl &pc, int song)
number, because random mode is enabled */
i
=
queue
.
PositionToOrder
(
song
);
if
(
!
playing
)
current
=
0
;
/* swap the new song with the previous "current" one,
so playback continues as planned */
queue
.
SwapOrders
(
i
,
current
);
i
=
current
;
i
=
MoveOrderToCurrent
(
i
);
}
stop_on_error
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment