1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00

Fetch volume through Audacious API (thanks Erik)

This commit is contained in:
Erik Waling 2008-12-07 00:38:06 -07:00 committed by Brenden Matthews
parent b64203b547
commit 51fe4fa419
5 changed files with 24 additions and 2 deletions

View File

@ -6,6 +6,7 @@
* Adds a variable if_xmms2_connected to hide objects when xmms2d is not
running (thanks Lassi)
* Fix for buffer overflow with $execi (thanks Cesare)
* Fetch volume through Audacious API (thanks Erik)
2008-12-06
* Removed duplicate sanity check for diskio

View File

@ -240,6 +240,15 @@
Title of current tune with optional maximum length specifier
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>audacious_main_volume</option></command>
</term>
<listitem>
The current volume fetched from Audacious
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>

View File

@ -125,7 +125,7 @@ void *audacious_thread_func(void *pvoid)
{
static audacious_t items;
gint playpos, frames, length;
gint rate, freq, chans;
gint rate, freq, chans, vol;
gchar *psong, *pfilename;
#ifndef AUDACIOUS_LEGACY
@ -233,6 +233,11 @@ void *audacious_thread_func(void *pvoid)
/* Playlist position (index of song) */
snprintf(items[AUDACIOUS_PLAYLIST_POSITION],
sizeof(items[AUDACIOUS_PLAYLIST_POSITION]) - 1, "%d", playpos + 1);
/* Main volume */
vol = audacious_remote_get_main_volume(session);
snprintf(items[AUDACIOUS_MAIN_VOLUME],
sizeof(items[AUDACIOUS_MAIN_VOLUME]) - 1, "%d", vol);
} while (0);
/* Deliver the refreshed items array to audacious_items. */
timed_thread_lock(info.audacious.p_timed_thread);

View File

@ -37,10 +37,11 @@ enum _audacious_items {
AUDACIOUS_FILENAME,
AUDACIOUS_PLAYLIST_LENGTH,
AUDACIOUS_PLAYLIST_POSITION,
AUDACIOUS_MAIN_VOLUME,
};
/* 12 slots for the audacious values */
typedef char audacious_t[12][128];
typedef char audacious_t[13][128];
/* type for data exchange with main thread */
typedef struct audacious_s {

View File

@ -1373,6 +1373,7 @@ enum text_object_type {
OBJ_audacious_filename,
OBJ_audacious_playlist_length,
OBJ_audacious_playlist_position,
OBJ_audacious_main_volume,
OBJ_audacious_bar,
#endif
#ifdef BMPX
@ -4071,6 +4072,7 @@ static struct text_object *construct_text_object(const char *s,
END OBJ(audacious_filename, INFO_AUDACIOUS)
END OBJ(audacious_playlist_length, INFO_AUDACIOUS)
END OBJ(audacious_playlist_position, INFO_AUDACIOUS)
END OBJ(audacious_main_volume, INFO_AUDACIOUS)
END OBJ(audacious_bar, INFO_AUDACIOUS)
scan_bar(arg, &obj->a, &obj->b);
#endif
@ -6283,6 +6285,10 @@ static void generate_text_internal(char *p, int p_max_size,
snprintf(p, p_max_size, "%s",
cur->audacious.items[AUDACIOUS_PLAYLIST_POSITION]);
}
OBJ(audacious_main_volume) {
snprintf(p, p_max_size, "%s",
cur->audacious.items[AUDACIOUS_MAIN_VOLUME]);
}
OBJ(audacious_bar) {
double progress;