Resuming, Repeating and Terminating

1.0 Introduction

Starting with Giocoso version 2.01, it is now possible to (sort of!) pause and resume music playback. It is also possible to request a repeat of the currently-playing recording or to request that all playback terminate immediately (again, both features of Giocoso version 2.01 and above only).

The pause/resume and repeat options are made available by two new runtime parameters (--resume and --repeat).

The new termination capability is really a combination of pre-existing runtime parameters: an --autostop, followed by a --skip and so could have been achieved by issuing two separate commands in Giocoso version 2, but is now made available in version 2.01 via the menu interface (as Option 7).

I'll now explore each of these features in more detail, in turn.

2.0 Pause and Resume

Giocoso has never, by design, had a pause/resume capability, on the grounds that you don't go to a concert of Beethoven symphonies and ask the orchestra to pause playing in the middle of the slow movement! However, your author was recently listening to large chunks of his opera collection -and they can go on for hours. Now, not even Wagner expected you to be able to sit through the entire 4 hours+ of Götterdämmerung without taking a break of some sort in between the (still rather long!) acts of which it is comprised. It therefore became apparent that there is, indeed, a case for being able to pause the playback of classical music, after all!

Being a command-line, text-based program, however, Giocoso cannot literally sport a pause button! Instead, pause and resume functionality consists of:

  • Pressing Ctrl+C when the playing window has focus to terminate music playback
  • Subsequently launching a new Giocoso session with the --resume runtime parameter (or taking menu option 3)

You have to terminate the current play with force by pressing Ctrl+C. You cannot simply close the playing window down by clicking it's 'X' close button in its title bar, because that mode of close-down doesn't trigger Giocoso to store where it was up to at the point where play was interrupted. Similarly, if you are more technically inclined, a kill -9 giocoso or a killall giocoso won't preserve the state of play that the new resume functionality depends on. Only Ctrl+C with the playback window having focus as it's issued will do the trick.

Once playback has been terminated with Ctrl+C, you can launch a new Giocoso session with the command: giocoso --resume (or take Option 3 from the simplified menu interface) and Giocoso will automatically retrieve the earlier playback details (i.e., recording being played and how many seconds into it the previous play session got) and resume playback from the precise second when the previous playback was killed off. There is no limit to how much time can elapse between the Ctrl+C termination and the use of the --resume command.

If you launch another music playing session in between the Ctrl+C and the use of the --resume runtime parameter, however, then resumption is not possible. That is, the following scenario is resumable:

  • 09:00 Playback begins of Götterdämmerung
  • 09:30 Postman knocks at the door: Ctrl+C, playback terminated
  • 09:35 Neighbour comes in asking to borrow some sugar
  • 13:33 Neighbour finally departs
  • 13:34 Stiff whisky
  • 14:00 Giocoso launched with --resume, playback resumes from the exact point it had reached at 09:30

But this scenario is not resumable:

  • 09:00 Playback begins of Götterdämmerung
  • 09:30 Postman knocks at the door: Ctrl+C, playback terminated
  • 09:35 Neighbour comes in asking to borrow some sugar
  • 13:33 Neighbour finally departs
  • 13:34 Stiff whisky
  • 13:55 Giocoso launched in database-based playback mode, and Peter Grimes starts playing through random choice

A new music play means that the data the --resume functionality requires to achieve previous-play resumption is over-written. In this second scenario, therefore, there is no way at 14:00 to request a resumption of the 9:00 play of Götterdämmerung. The half-hour of it you did manage to hear is 'lost': there is no record made of it in the 'Plays' table of the Giocoso database; no scrobbling of it to Last.fm took place, either. In short, resume functionality only works when there is no other music played by Giocoso between the termination and attempted resumption of play.

Plays which are interrupted are not recorded in the database or scrobbled, as previously mentioned. However, if the same play is successfully resumed and allowed to play through to completion, the play is recorded in the database (and scrobbled, if configured and requested) in the normal fashion. A 'resumed play' looks no different to Giocoso (or Last.fm, come to that) than a 'normal, straight-through play', in other words.

3.0 Repeats

Another feature new to Giocoso version 2.01 and above is the ability to request that Giocoso repeats playing whatever music is currently playing. This is achieved by launching a new Giocoso session with the command: giocoso --repeat (or by taking option 4 from the simplified menu interface).

Repeats work rather like Autostops: they send a message to the playing session which you'll see acknowledged by the word 'Repeat' appearing in the footer area of the play window:

Note the blue 'Repeat' indicator in the footer, letting you know that the repeat request has been received and will be actioned, once normal playback of the currently playing recording completes in the ordinary way. Repeats only take practical effect once the currently-playing work reaches its natural conclusion.

Just like Autostop requests, however, repeat requests can be revoked by re-issuing the request. And if you re-re-issue the request, it will be re-instated. And a re-re-re-issue will result in the reinstated request being revoked once more... and so ad infinitum.

Thus, if you starting playing a symphony that lasts for 30 minutes at 9:00AM, if you issue the command giocoso --repeat at 9:15, then at 9:30 (and a few seconds), the same symphony will start playing again for a second time. However, if you issue a second giocoso --repeat at 9:20, then the symphony will not be repeated at 9:30. But if you issue a third giocoso --repeat at 9:27, the symphony will repeat at 9:30. There are no limits to how often you can request and revoke a repeat in this manner, so long as all requests are issued within the time that the relevant piece of music is still playing.

A repeat request only results in the single repeat of the currently-playing recording. Pursuing the earlier example: if I started the symphony at 9:00 and requested a repeat at 9:10, then at 9:30, the same symphony will play for a second time and will conclude at 10:00, after which no further plays of it will take place. Of course, there is nothing stopping you from issuing a new repeat request at, say, 9:40 and that will trigger a third play of the symphony, ending at 10:30. Another request issued at 10:29, however, will trigger a fourth play of the symphony, which will end normally at 11:00. There is no limit to how many times you can repeat the same recording, in other words, provided only that each new repeat request is issued during a new repeat-play: you can't issue 4 repeat requests at 9:10, for example, in the hope of queuing the requests up!

4.0 Termination

In Giocoso version 2.0, you could achieve an 'instant termination' of all music playback by issuing the commands giocoso --autostop and giocoso --skip in quick succession from two separate terminal sessions. The autostop request tells Giocoso 'do not play any new music after the current recording has finished'; the 'skip' request tells Giocoso 'do not let the currently-playing recording play out naturally, but immediate end it and move on'. The combination of the two messages means 'stop playing the current recording and don't play anything after it, either'.

The new feature in Giocoso version 2.01 is that the simplified menu interface has a dedicated menu option for achieving the same thing in one key-press: Option 7.