Commit Graph

75 Commits

Author SHA1 Message Date
Anna Schumaker f9cec5e1b3 audio: Use the new match / case statement in scale.py:format_value()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-12-28 17:24:09 -05:00
Anna Schumaker 915e3c8340 Remove unused tagdb module
Implements #23 (Remove tagdb/ code)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-12-26 10:08:33 -05:00
Anna Schumaker be7e8e6073 audio: Reset the pipeline whenever we reach EOS
This fixes a bug where a different track would be selected when hitting
"Play" after an autopause

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-12-10 12:00:20 -05:00
Anna Schumaker ba06eca07f audio: Switch to the Collection playlist if the current playlist has finished
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-12-09 17:51:02 -05:00
Anna Schumaker 4cdf4c528a audio: Implement our own about-to-finish handling
The playbin's about-to-finish signal triggers in a different thread,
which Gtk is very much not happy about, and often results in both the
about-to-finish and eos handlers getting called (and therefore multiple
tracks getting picked from the queue).

Fix this by checking how much time is left during the regular position
changed timeout function and triggering about-to-finish manually

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-12-09 17:51:02 -05:00
Anna Schumaker 594f7991f2 audio: Pick next track from the Previous playlist first
This lets us move up and down the Previous playlist through the buttons,
in case we go back too far by accident.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-12-05 13:49:24 -05:00
Anna Schumaker 27ad8d72b4 audio: Pick the next track from the current playlist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-12-05 13:49:24 -05:00
Anna Schumaker 45b7f9595c audio: Give the Player a set_playlist() function
With a callback to notify when the current playlist changes.
Additionally, I make sure to reset playlist.current if the playlist has
previously finished playing.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-12-05 13:49:24 -05:00
Anna Schumaker 7979cb1a4a ui: Switch to the new audio.Header()
And delete the old ui/header.py code

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 880f0a686b audio: Replace load_track() with change_track()
To mark tracks played and then emit the track-changed signal to start
the next track.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 97a05efe7e audio: Give the Player a play_track() function
To load and play a different track

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 96956c730d audio: Give the AutoPauseScale a keep_playing property
And a function to find out if we are about to pause or not.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 16:49:58 -05:00
Anna Schumaker 049eeec38a audio: Implement a Header bar
This moves the code out of ui/ and turns it into a class for easier
testing.

Implements: Issue #22 (Move Gtk.HeaderBar code into audio/)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 03b3c4a806 audio: Fix GstOutputSelector pad negotiation
All sinks need to post the EOS message before the pipeline can pass it
on to our application. Using pad negotiation mode 2 means that the
message is only sent to the active path in the output selector, leaving
our application hanging waiting for the inactive path to post EOS as
well.

Fixes: #33 (Fix Autopause not resetting)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-11-18 10:20:24 -05:00
Anna Schumaker 6fc0fb6b26 audio: Create a new Selector object
This is used to query for the next or previous track. The Playlist layer
will implement our playlist stack as one of these objects, and set it on
the Player

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-30 11:07:20 -04:00
Anna Schumaker e38ce61cf7 audio: Convert our MenuButton into a Gtk.MenuButton
The Gtk.MenuButton doesn't have the same issue with staying "pressed in"
after changing replaygain settings that our custom version does.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-28 16:56:16 -04:00
Anna Schumaker 9c5b409d02 audio: Add ReplayGainComboBox and ReplayGainControl widgets
For setting the replaygain mode on the player

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-14 14:30:04 -04:00
Anna Schumaker 4f4e9efa28 audio: Set a ReplayGainSink as the playbin's audio sink
And create a rplaygain property that acts as a passthrough for
controlling the element.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-14 14:29:14 -04:00
Anna Schumaker 6792971ef7 audio: Add a custom ReplayGainSink
I use output-switcher and funnel elements so we can disable the
replaygain plugins by routing the stream around them if necessary.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-14 14:26:54 -04:00
Anna Schumaker d6a442277f audio: Clean up imports
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-08 10:07:46 -04:00
Anna Schumaker 8efb752614 audio: Add support for gapless playback
By responding to the about-to-finish signal. If it looks like we're
about to pause, then we let the EOS handler handle it instead.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-08 10:07:46 -04:00
Anna Schumaker ba1a444bdf audio: Have the player handle Autopause adjustments
Putting this in the playlist layer was an experiment, but it's easier to
do from the Player now that we've abstracted out all the Gstreamer stuff
into the BassClass

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-08 10:07:46 -04:00
Anna Schumaker 3a50235c38 audio: Rework the Artwork widget
It now sets artwork based on the signals sent by the player, allowing us
to move it out of the Player class and create instances based on the
global Player instead.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-08 10:07:45 -04:00
Anna Schumaker f55377cc69 audio: Remove the Player get_state() function
We can just check the playing property from the BasePlayer instead

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 15:55:11 -04:00
Anna Schumaker 8e509345bf audio: Clean up loading tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 15:55:07 -04:00
Anna Schumaker 39794c0830 audio: Move play_track() out of the Player
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 15:55:03 -04:00
Anna Schumaker b95ad55c9a audio: Give the BassPlayer an artwork signal
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 14:46:29 -04:00
Anna Schumaker 08696dd17a audio: Give the BassPlayer signals for eos and about-to-finish
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 14:46:00 -04:00
Anna Schumaker e467b784e4 audio: Give the BassPlayer a play_percent property
For calculating what percentage of a song has been played, which is used
to determine if a track can be marked as played or not

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 14:46:00 -04:00
Anna Schumaker 51e8bc295d audio: Give the BassPlayer a volume property
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 14:46:00 -04:00
Anna Schumaker fa2cbcc261 audio: Give the BassPlayer a position property
I use the state change callbacks to send a position-changed signal on a
regular interval when playback is going. Seeking is handled by setting
the position property to a new value.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 14:45:42 -04:00
Anna Schumaker a4595eab93 audio: Give the BassPlayer a duration property
I also add a duration-changed signal so the seek scale can update its
range.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 14:45:42 -04:00
Anna Schumaker a4464cd7d9 audio: Give the BassPlayer a playing property
To set either Gst.State.PLAYING or Gst.State.PAUSED on the playbin. I
also add two signals for playback-start and playback-paused that the
PlayPause button can use.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-07 14:45:34 -04:00
Anna Schumaker c2c6ac7890 audio: Give the BassPlayer a uri property
With both setter and getter to change the playbin uri

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-06 10:48:03 -04:00
Anna Schumaker 574e49ef09 audio: Give the BassPlayer a bus property
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-04 08:33:15 -04:00
Anna Schumaker 990a8047d9 audio: Create a new BassPlayer class
My intention is to use this to handle GStreamer stuff so I can separate
out the higher level functions like next(), previous(), and load_track()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-04 08:32:14 -04:00
Anna Schumaker 76bf68f484 audio: Replace the old Controls widget with AudioControls
And grab the global Player instance during construction.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:26:58 -04:00
Anna Schumaker ef1d3f0985 audio: Create a custom AudioControls widget
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:26:58 -04:00
Anna Schumaker ca47bd052f audio: Create a custom MenuButton and MenuIcon
This mimics the behavior of the Gtk.MenuButton(), except it allows
updating the ToggleButton child widget with the current autopause count.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:26:58 -04:00
Anna Schumaker bd49396210 audio: Create a custom ControlsPopover widget
For displaying our menu controls

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:26:58 -04:00
Anna Schumaker 68f0541079 audio: Create a custom AutoPauseControlBox
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:26:58 -04:00
Anna Schumaker d551e0ea13 audio: Create a custom VolumeControlBox
I also create a shared base class at the same time so autopause controls
can use it as well.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:26:57 -04:00
Anna Schumaker da1211f595 audio: Add a custom AutoPauseScale widget
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:23:38 -04:00
Anna Schumaker edc3e7f876 audio: Add a custom VolumeScale widget
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:23:37 -04:00
Anna Schumaker 33c7bdf517 audio: Add a custom PlayPause button
And update the image based on the current playback state

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:15:43 -04:00
Anna Schumaker ec9ed14474 audio: Create custom PreviousButton and NextButton buttons
Along with a shared base class for these buttons, and soon the
PlayPause button

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:15:43 -04:00
Anna Schumaker e4f6018195 audio: Replace the old Seeker widget with a ScaleButtonbox
And make the widget separate from the audio Player

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:15:43 -04:00
Anna Schumaker e4236b0bf4 audio: Create a custom ScaleButtonBox
This configures the buttons for a scale and places them into a GtkBox
widget for us to use.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:15:43 -04:00
Anna Schumaker 644706ef50 audio: Add custom ScaleButtons
Thes buttons handle Increment and Decrement operations

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:15:43 -04:00
Anna Schumaker 1c53886152 audio: Add a custom SeekScale widget
For handling seeks to the audio player

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-02 16:15:43 -04:00