From 3d723de1022d2fdeccb9bae6f934e6936445ef21 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= jaakko.keranen@iki.fi

Date: Fri, 16 Oct 2020 19:04:14 +0300

Subject: [PATCH 1/1] Player: Hide volume slider after 3 sec idle time


src/audio/player.c | 14 ++++++++++++++

src/audio/player.h | 2 ++

src/ui/documentwidget.c | 7 ++++++-

3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/audio/player.c b/src/audio/player.c

index e0003168..77c23104 100644

--- a/src/audio/player.c

+++ b/src/audio/player.c

@@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

#include <the_Foundation/buffer.h>

#include <the_Foundation/thread.h>

#include <SDL_audio.h>

+#include <SDL_timer.h>

#if defined (LAGRANGE_ENABLE_MPG123)

include <mpg123.h>

@@ -443,6 +444,7 @@ struct Impl_Player {

 float             volume;

 int               flags;

 iInputBuf *       data;

 iDecoder *        decoder;

};

@@ -695,12 +697,14 @@ iBool start_Player(iPlayer *d) {

 d->decoder = new_Decoder(d->data, &content);

 d->decoder->gain = d->volume;

 SDL_PauseAudioDevice(d->device, SDL_FALSE);

 return iTrue;

}

void setPaused_Player(iPlayer *d, iBool isPaused) {

 if (isStarted_Player(d)) {

     SDL_PauseAudioDevice(d->device, isPaused ? SDL_TRUE : SDL_FALSE);

 }

}

@@ -720,10 +724,16 @@ void setVolume_Player(iPlayer *d, float volume) {

 if (d->decoder) {

     d->decoder->gain = d->volume;

 }

}

void setFlags_Player(iPlayer *d, int flags, iBool set) {

 iChangeFlags(d->flags, flags, set);

+}

+void setNotIdle_Player(iPlayer *d) {

}

int flags_Player(const iPlayer *d) {

@@ -760,6 +770,10 @@ float streamProgress_Player(const iPlayer *d) {

 return 0;

}

+uint32_t idleTimeMs_Player(const iPlayer *d) {

+}

iString *metadataLabel_Player(const iPlayer *d) {

 iString *meta = new_String();

 if (d->decoder) {

diff --git a/src/audio/player.h b/src/audio/player.h

index 58947ef4..82d95fd2 100644

--- a/src/audio/player.h

+++ b/src/audio/player.h

@@ -54,6 +54,7 @@ void stop_Player (iPlayer *);

void setPaused_Player (iPlayer *, iBool isPaused);

void setVolume_Player (iPlayer *, float volume);

void setFlags_Player (iPlayer *, int flags, iBool set);

+void setNotIdle_Player (iPlayer *);

int flags_Player (const iPlayer *);

const iString *tag_Player (const iPlayer *, enum iPlayerTag tag);

@@ -64,4 +65,5 @@ float time_Player (const iPlayer *);

float duration_Player (const iPlayer *);

float streamProgress_Player (const iPlayer ); / normalized 0...1 */

+uint32_t idleTimeMs_Player (const iPlayer *);

iString * metadataLabel_Player (const iPlayer *);

diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c

index 1a7bf4a4..85c17a5b 100644

--- a/src/ui/documentwidget.c

+++ b/src/ui/documentwidget.c

@@ -460,7 +460,12 @@ static void animatePlayingAudio_DocumentWidget_(void *widget) {

 if (document_App() != d) return;

 iConstForEach(PtrArray, i, &d->visiblePlayers) {

     const iGmRun *run = i.ptr;

     if (isStarted_Player(plr) && !isPaused_Player(plr)) {

         refresh_Widget(d);

         addTicker_App(animatePlayingAudio_DocumentWidget_, d);

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.17/patch/3d723de1022d2fdeccb9bae6f934e6936445ef21.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
63.984253 milliseconds
Gemini-to-HTML Time
3.201994 milliseconds

This content has been proxied by September (ba2dc).