Example #1
0
void NLXmms::update()
{
	//look for running xmms
	if ( xmms_remote_get_version( 0 ) )
	{
		QString newTrack;
		// see if it's playing
		if ( xmms_remote_is_playing( 0 ) && !xmms_remote_is_paused( 0 ) )
		{
			m_playing = true;

			// get the artist and album title
			// get the song title
			newTrack = xmms_remote_get_playlist_title( 0, xmms_remote_get_playlist_pos( 0 ) );
			//kdDebug( 14307 ) << "NLXmms::update() - track is: " << m_track << endl;
			m_artist = newTrack.section( " - ", 0, 0 );
			newTrack = newTrack.section( " - ", -1, -1 );
		}
		else
			m_playing = false;
		// check if it's a new song
		if ( newTrack != m_track )
		{
			m_newTrack = true;
			m_track = newTrack;
		}
		else
			m_newTrack = false;
		kdDebug( 14307 ) << k_funcinfo << " - found xmms - " << m_track << endl;
	}
	else
		kdDebug( 14307 ) << k_funcinfo << " - xmms not found" << endl;
}
Example #2
0
int
main(int argc, char *argv[]) {
	int session = 0;
	int pos;
	char *text;

	if (argc > 1) {
		if (isdigit(argv[1][0])) {
			session = atoi(argv[1]);
		} else {
			/* translators: this is the logjam-xmms-client command line. */
			fprintf(stderr, _("usage: %s [session_number]\n"), argv[0]);
			return -1;
		}
	}

	pos = xmms_remote_get_playlist_pos(session);
	text = xmms_remote_get_playlist_title(session, pos);

	if (!text) {
		fprintf(stderr, _("XMMS error.  Is XMMS running?\n"));
		return -1;
	}
	printf("%s\n", text);
	return 0;
}
Example #3
0
static int timeout_func(gpointer data)
{
	int pos;
	gboolean playing;
	static char *previous_file = NULL;
	static gboolean cmd_after_already_run = FALSE;
	char *current_file;

	GDK_THREADS_ENTER();

	playing = xmms_remote_is_playing(sc_gp.xmms_session);
	pos = xmms_remote_get_playlist_pos(sc_gp.xmms_session);
	current_file = xmms_remote_get_playlist_file(sc_gp.xmms_session, pos);
	
	if ((pos != previous_song ||
	     (!previous_file && current_file) ||
	     (previous_file && !current_file) ||
	     (previous_file && current_file &&
	      strcmp(previous_file, current_file))) &&
	    xmms_remote_get_output_time(sc_gp.xmms_session) > 0)
	{
		do_command(cmd_line, current_file, pos);
		g_free(previous_file);
		previous_file = g_strdup(current_file);
		previous_song = pos;
		cmd_after_already_run = FALSE;
	}
	if (!cmd_after_already_run &&
	    ((xmms_remote_get_playlist_time(sc_gp.xmms_session,pos) -
	      xmms_remote_get_output_time(sc_gp.xmms_session)) < 100))
	{
		do_command(cmd_line_after, current_file, pos);
		cmd_after_already_run = TRUE;
	}

	if (playing)
	{
		int playlist_length = xmms_remote_get_playlist_length(sc_gp.xmms_session);
		if (pos + 1 == playlist_length)
			possible_pl_end = TRUE;
		else
			possible_pl_end = FALSE;
	}
	else if (possible_pl_end)
	{
		if (pos == 0)
			do_command(cmd_line_end, current_file, pos);
		possible_pl_end = FALSE;
		g_free(previous_file);
		previous_file = NULL;
	}

	g_free(current_file);
	current_file = NULL;

	GDK_THREADS_LEAVE();

	return TRUE;
}
Example #4
0
Uint32 get_xmms_title(Uint32 something, void *somethingelse) {
	static char check_title = 1;
	static int last_pos;
	static char *last_title = NULL;
	int pos;
	char *title = NULL;

	//Nice optimization, but we want the title no matter what so I can display it when the song changes
#if 0
	if(!(globalPM->showtitle%2)) {
		/* Repeat less often when not showing title */
		return 1000;
	}
#endif

	pos = xmms_remote_get_playlist_pos(projectM_vtable.xmms_session);
	/* Only check every 1 second for title change, otherwise check pos */
	if(check_title || pos != last_pos) {
		title = xmms_remote_get_playlist_title(
				projectM_vtable.xmms_session, pos);
		if(title && (!last_title || strcmp(last_title,title))) {
		  //globalPM->renderer->title = title;
			//globalPM->renderer->drawtitle = 1;

		  std::string titlepp(title);
		  globalPM->projectM_setTitle(titlepp);
			g_free(last_title);
			last_title = title;
		} else if(title && last_title != title) {
			/* New copy of last title */
			g_free(title);
		}
		check_title = !check_title;
	}
	last_pos = pos;
	/* Repeat every 500ms */
	return 500;
}
Example #5
0
File: ir.c Project: sedwards/xmms3
/* Our main thread */
static void *xmms_irapp_routine(void *arg)
{
	unsigned char *code;
	char *text;
	gint playlist_time, playlist_pos, output_time, vl, vr, i;
	gint ir_numpress = -1;
	gint ir_hundreds = 0;
	gboolean ir_playlist_mode = FALSE;
	GList *ir_playlist;
	GTimer *timer1, *timer2;

#define S_PAUSE	0.2
#define L_PAUSE 0.4
#define PL_PAUSE 2.0

	timer1 = g_timer_new();
	timer2 = g_timer_new();
	g_timer_start(timer1);

	while (keepGoing)
	{
		if (!irconf_is_going)
		{
			code = ir_poll_code();
			if (code)
			{
				text = ir_code_to_text(code);
				if (!strcmp(text, ircfg.button_play) && g_timer_elapsed(timer1, NULL) > L_PAUSE)
				{
					xmms_remote_play(ir_gp.xmms_session);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}

				else if (!strcmp(text, ircfg.button_stop) && g_timer_elapsed(timer1, NULL) > L_PAUSE)
				{
					xmms_remote_stop(ir_gp.xmms_session);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_pause) && g_timer_elapsed(timer1, NULL) > L_PAUSE)
				{
					xmms_remote_pause(ir_gp.xmms_session);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_shuffle) && g_timer_elapsed(timer1, NULL) > L_PAUSE)
				{
					xmms_remote_toggle_shuffle(ir_gp.xmms_session);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_repeat) && g_timer_elapsed(timer1, NULL) > L_PAUSE)
				{
					xmms_remote_toggle_repeat(ir_gp.xmms_session);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_playlist) && g_timer_elapsed(timer1, NULL) > L_PAUSE)
				{
					ir_playlist_mode = !ir_playlist_mode;
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_next) && g_timer_elapsed(timer1, NULL) > L_PAUSE)
				{
					xmms_remote_playlist_next(ir_gp.xmms_session);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_prev) && g_timer_elapsed(timer1, NULL) > L_PAUSE)
				{
					xmms_remote_playlist_prev(ir_gp.xmms_session);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_seekf) && g_timer_elapsed(timer1, NULL) > S_PAUSE / 2)
				{
					output_time = xmms_remote_get_output_time(ir_gp.xmms_session);
					playlist_pos = xmms_remote_get_playlist_pos(ir_gp.xmms_session);
					playlist_time = xmms_remote_get_playlist_time(ir_gp.xmms_session, playlist_pos);
					if (playlist_time - output_time < 5000)
						output_time = playlist_time - 5000;
					xmms_remote_jump_to_time(ir_gp.xmms_session, output_time + 5000);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_seekb) && g_timer_elapsed(timer1, NULL) > S_PAUSE / 2)
				{
					output_time = xmms_remote_get_output_time(ir_gp.xmms_session);
					if (output_time < 5000)
						output_time = 5000;
					xmms_remote_jump_to_time(ir_gp.xmms_session, output_time - 5000);
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_stop(timer2);
					ir_hundreds = 0;
				}
				else if (!strcmp(text, ircfg.button_volup) && g_timer_elapsed(timer1, NULL) > S_PAUSE)
				{
					xmms_remote_get_volume(ir_gp.xmms_session, &vl, &vr);
					if (vl > 95)
						vl = 95;
					if (vr > 95)
						vr = 95;
					xmms_remote_set_volume(ir_gp.xmms_session, vl + 5, vr + 5);
					g_timer_reset(timer1);
				}
				else if (!strcmp(text, ircfg.button_voldown) && g_timer_elapsed(timer1, NULL) > S_PAUSE)
				{
					xmms_remote_get_volume(ir_gp.xmms_session, &vl, &vr);
					if (vl < 5)
						vl = 5;
					if (vr < 5)
						vr = 5;
					xmms_remote_set_volume(ir_gp.xmms_session, vl - 5, vr - 5);
					g_timer_reset(timer1);
				}
				else if (!strcmp(text, ircfg.button_plus100) && g_timer_elapsed(timer1, NULL) > S_PAUSE)
				{
					ir_hundreds += 1;
					g_timer_reset(timer1);
					g_timer_reset(timer2);
					g_timer_start(timer2);
				}
				else
				{
					for (i = 0; i < 10; i++)
					{
						if (!strcmp(text, ircfg.button[i]) && g_timer_elapsed(timer1, NULL) > S_PAUSE)
						{
							g_timer_reset(timer2);
							if (ir_numpress >= 0)
							{
								g_timer_stop(timer2);
								if (ir_playlist_mode)
								{
									if (strcmp(ircfg.playlist[(10 * ir_numpress) + i], ""))
									{
										ir_playlist = NULL;
										ir_playlist = g_list_append(ir_playlist, ircfg.playlist[(10 * ir_numpress) + i]);
										xmms_remote_play_files(ir_gp.xmms_session, ir_playlist);
										g_list_free(ir_playlist);
									}
									ir_playlist_mode = FALSE;
								}
								else
								{
									ir_numpress = (100 * ir_hundreds) + (10 * ir_numpress) + i;
									if (ir_numpress == 0)
										xmms_remote_set_playlist_pos(ir_gp.xmms_session,
													     xmms_remote_get_playlist_length(ir_gp.xmms_session) - 1);
									else
										xmms_remote_set_playlist_pos(ir_gp.xmms_session, ir_numpress - 1);
								}
								ir_numpress = -1;
								ir_hundreds = 0;
							}
							else
							{
								g_timer_start(timer2);
								ir_numpress = i;
							}
							g_timer_reset(timer1);
						}
					}
				}
			}
			if (g_timer_elapsed(timer2, NULL) > PL_PAUSE)
			{
				if (ir_numpress >= 0 || ir_hundreds > 0)
				{
					if (ir_playlist_mode)
					{
						if (strcmp(ircfg.playlist[ir_numpress], ""))
						{
							ir_playlist = NULL;
							ir_playlist = g_list_append(ir_playlist, ircfg.playlist[ir_numpress]);
							xmms_remote_play_files(ir_gp.xmms_session, ir_playlist);
							g_list_free(ir_playlist);
						}
					}
					else if (ir_numpress <= 0)
						if (ir_hundreds > 0)
							xmms_remote_set_playlist_pos(ir_gp.xmms_session, (100 * ir_hundreds) - 1);
						else
							xmms_remote_set_playlist_pos(ir_gp.xmms_session,
										     xmms_remote_get_playlist_length(ir_gp.xmms_session) - 1);
					else
						xmms_remote_set_playlist_pos(ir_gp.xmms_session, (100 * ir_hundreds) + ir_numpress - 1);
				}
				ir_numpress = -1;
				ir_hundreds = 0;
				ir_playlist_mode = FALSE;
				g_timer_reset(timer2);
				g_timer_stop(timer2);
			}
		}
		ir_usleep(20000L);
	}
	g_timer_destroy(timer1);
	ir_close_port();
	pthread_exit(NULL);
}
Example #6
0
File: joy.c Project: sedwards/xmms3
/* ---------------------------------------------------------------------- */
static void *xmms_joyapp_routine(void *arg)
{
	gint vl, vr, output_time, playlist_pos, playlist_time, playlist_length;
	struct js_event js;
	struct timeval tv;
	fd_set set;
	int max_fd, js_alt = 0;
	joy_cmd js_command;

	while (keep_going)
	{
		max_fd = joy_fd1 + 1;
		tv.tv_sec = 0;
		tv.tv_usec = 1000;
		FD_ZERO(&set);
		FD_SET(joy_fd1, &set);
		if (joy_fd2 > 0)
		{
			FD_SET(joy_fd2, &set);
			max_fd = joy_fd2 + 1;
		}
		js_command = JC_NONE;

		if (select(max_fd, &set, NULL, NULL, &tv))
		{
			if (FD_ISSET(joy_fd1, &set))
			{
				if (read(joy_fd1, &js, sizeof (struct js_event)) != sizeof (struct js_event))
					perror(_("\nJoystick Control: error reading"));

				switch (js.type & ~JS_EVENT_INIT)
				{
					case JS_EVENT_BUTTON:
						if (js.number <= joy_cfg.num_buttons) {js_command = joy_cfg.button_cmd[js.number];}
						break;
					case JS_EVENT_AXIS:
						if (js.number == 0)
						{
							if (js.value > joy_cfg.sens)
							{
								if (js_alt)
									js_command = joy_cfg.alt_right;
								else
									js_command = joy_cfg.right;
							}
							else if (js.value < -joy_cfg.sens)
							{
								if (js_alt)
									js_command = joy_cfg.alt_left;
								else
									js_command = joy_cfg.left;
							}
						}
						else if (js.number == 1)
						{
							if (js.value > joy_cfg.sens)
							{
								if (js_alt)
									js_command = joy_cfg.alt_down;
								else
									js_command = joy_cfg.down;
							}
							else if (js.value < -joy_cfg.sens)
							{
								if (js_alt)
									js_command = joy_cfg.alt_up;
								else
									js_command = joy_cfg.up;
							}
						}
						break;
				}
			}
			if (joy_fd2 > 0)
			{
				if (FD_ISSET(joy_fd2, &set))
				{
					if (read(joy_fd2, &js, sizeof (struct js_event)) != sizeof (struct js_event))
					        	 perror(_("\nJoystick Control: error reading"));

					switch (js.type & ~JS_EVENT_INIT)
					{
						case JS_EVENT_BUTTON:
							if (js.number == 0)
								js_command = joy_cfg.button_cmd[2];
							else if (js.number == 1)
								js_command = joy_cfg.button_cmd[3];
							break;
						case JS_EVENT_AXIS:
							if (js.number == 0)
							{
								if (js.value > joy_cfg.sens)
									js_command = joy_cfg.alt_right;
								else if (js.value < -joy_cfg.sens)
									js_command = joy_cfg.alt_left;
							}
							else if (js.number == 1)
							{
								if (js.value > joy_cfg.sens)
									js_command = joy_cfg.alt_down;
								else if (js.value < -joy_cfg.sens)
									js_command = joy_cfg.alt_up;
							}
							break;
					}
				}
			}
			if (js_command != JC_ALT && js.value == 0)
				js_command = JC_NONE;

			switch (js_command)
			{
				case JC_PLAYPAUSE:
					if (xmms_remote_is_playing(joy_gp.xmms_session))
						xmms_remote_pause(joy_gp.xmms_session);
					else
						xmms_remote_play(joy_gp.xmms_session);
					break;
				case JC_STOP:
					xmms_remote_stop(joy_gp.xmms_session);
					break;
				case JC_NEXT:
					xmms_remote_playlist_next(joy_gp.xmms_session);
					break;
				case JC_PREV:
					xmms_remote_playlist_prev(joy_gp.xmms_session);
					break;
				case JC_FWD5:
					playlist_pos = xmms_remote_get_playlist_pos(joy_gp.xmms_session);
					playlist_length = xmms_remote_get_playlist_length(joy_gp.xmms_session);
					if (playlist_length - playlist_pos < 5)
						playlist_pos = playlist_length - 5;
					xmms_remote_set_playlist_pos(joy_gp.xmms_session, playlist_pos + 5);
					break;
				case JC_BWD5:
					playlist_pos = xmms_remote_get_playlist_pos(joy_gp.xmms_session);
					if (playlist_pos < 5)
						playlist_pos = 5;
					xmms_remote_set_playlist_pos(joy_gp.xmms_session, playlist_pos - 5);
					break;
				case JC_VOLUP:
					xmms_remote_get_volume(joy_gp.xmms_session, &vl, &vr);
					if (vl > 95)
						vl = 95;
					if (vr > 95)
						vr = 95;
					xmms_remote_set_volume(joy_gp.xmms_session, vl + 5, vr + 5);
					break;
				case JC_VOLDWN:
					xmms_remote_get_volume(joy_gp.xmms_session, &vl, &vr);
					if (vl < 5)
						vl = 5;
					if (vr < 5)
						vr = 5;
					xmms_remote_set_volume(joy_gp.xmms_session, vl - 5, vr - 5);
					break;
				case JC_FWD:
					output_time = xmms_remote_get_output_time(joy_gp.xmms_session);
					playlist_pos = xmms_remote_get_playlist_pos(joy_gp.xmms_session);
					playlist_time = xmms_remote_get_playlist_time(joy_gp.xmms_session, playlist_pos);
					if (playlist_time - output_time < 5000)
						output_time = playlist_time - 5000;
					xmms_remote_jump_to_time(joy_gp.xmms_session, output_time + 5000);
					break;
				case JC_RWD:
					output_time = xmms_remote_get_output_time(joy_gp.xmms_session);
					if (output_time < 5000)
						output_time = 5000;
					xmms_remote_jump_to_time(joy_gp.xmms_session, output_time - 5000);
					break;
				case JC_SHUFFLE:
					xmms_remote_toggle_shuffle(joy_gp.xmms_session);
					break;
				case JC_REPEAT:
					xmms_remote_toggle_repeat(joy_gp.xmms_session);
					break;
				case JC_ALT:
					js_alt = js.value;
					break;
			        case JC_NONE:
				        break;
			}
		}
	}

	pthread_exit(NULL);
}
Example #7
0
void XMMSSensor::update()
{
    QString format;
    SensorParams *sp;
    Meter *meter;
    QObjectListIt it( *objList );

#ifdef HAVE_XMMS

    int pos;
    QString title;
    int songLength = 0;
    int currentTime = 0;
    bool isPlaying = false;
    bool isRunning = xmms_remote_is_running(0);

    if( isRunning )
    {
        isPlaying = xmms_remote_is_playing(0);
        pos = xmms_remote_get_playlist_pos(0);
        qDebug("unicode start");
        title = codec->toUnicode( QCString( xmms_remote_get_playlist_title( 0, pos ) )  );
        qDebug("unicode end");
        if( title.isEmpty() )
            title = "XMMS";

        qDebug("Title: %s", title.ascii());
        songLength = xmms_remote_get_playlist_time( 0, pos );
        currentTime = xmms_remote_get_output_time( 0 );
    }
#endif // HAVE_XMMS

    while (it != 0)
    {
        sp = (SensorParams*)(*it);
        meter = sp->getMeter();

#ifdef HAVE_XMMS

        if( isRunning )
        {

            format = sp->getParam("FORMAT");


            if (format.length() == 0 )
            {
                format = "%title %time / %length";
            }

            if( format == "%ms" )
            {
                meter->setMax( songLength );
                meter->setValue( currentTime );
            }
            else

                if ( format == "%full" )
                {
                    meter->setValue( 1 );
                }
                else

                {


                    format.replace( QRegExp("%title", false), title );

                    format.replace( QRegExp("%length", false), QTime( 0,0,0 ).
                                    addMSecs( songLength )
                                    .toString( "h:mm:ss" ) );

                    format.replace( QRegExp("%time", false), QTime( 0,0,0 ).
                                    addMSecs( currentTime )
                                    .toString( "h:mm:ss" ) );

                    if( isPlaying  )
                    {
                        format.replace( QRegExp("%remain", false), QTime( 0,0,0 ).
                                        addMSecs( songLength )
                                        .addMSecs(-currentTime )
                                        .toString( "h:mm:ss" ) );
                    }

                    else
                    {
                        format.replace( QRegExp("%remain", false), QTime( 0,0,0 ).toString("h:mm:ss" ) );
                    }
                    meter->setValue(format);
                }
        }
        else
#endif // HAVE_XMMS

        {
            meter->setValue("");
        }
        ++it;

    }

}
Example #8
0
/*
 * Callback funtion to handle delayed display.
 */
static gint timeout_func(gpointer data)
{
  gint pos, volume, balance;
  gboolean playing, paused, repeat, shuffle;
  gchar *text;

  if (!osd)
    return FALSE;

  GDK_THREADS_ENTER();

  pos = xmms_remote_get_playlist_pos (gp.xmms_session);
  playing = xmms_remote_is_playing (gp.xmms_session);
  paused = xmms_remote_is_paused (gp.xmms_session);
  volume = xmms_remote_get_main_volume (gp.xmms_session);
  shuffle = xmms_remote_is_shuffle (gp.xmms_session);
  repeat = xmms_remote_is_repeat (gp.xmms_session);
  balance = (xmms_remote_get_balance(gp.xmms_session) + 100) / 2;

  /**
   * Check if the position of the current song has changed.
   * DTM: bugfix
   *        1) 'get_playlist_time' seems "variable" for a song, don't use it
   *        2) we must free the titles we download
   */
  if (pos != previous_song)
    {
      if (xmms_remote_get_playlist_length (gp.xmms_session)) /* otherwise it'll crash */
	{

	  text = xmms_remote_get_playlist_title (gp.xmms_session, pos);
	  if (text)
	    replace_hexcodes (text);

	  /**
	   * Check to see if the title of the song has changed.
	   */
	  if ( !previous_title ||
	       g_strcasecmp(text, previous_title) != 0 ) {
	    if (show_stop) {
	      xosd_display (osd, 0, XOSD_string, playing ? "Play" : "Stopped");
	      xosd_display (osd, 1, XOSD_string, text);
	    }
	    save_previous_title( text );
	  }

	} else {
	  /** No song titles available. */
	  if (show_stop) {
	    xosd_display (osd, 0, XOSD_string, playing ? "Play" : "Stopped");
	  }
	  save_previous_title( 0 );
	}

      previous_song = pos;
    }

  else if (playing != previous_playing )
    {
      if (playing && show_trackname)
	{
	  xosd_display (osd, 0, XOSD_string, "Play");
	  text = xmms_remote_get_playlist_title (gp.xmms_session, pos);
	  if (text) {
	    replace_hexcodes (text);
	    xosd_display (osd, 1, XOSD_string, text);
	    save_previous_title ( text );
	  }
	}
      else if (!playing && show_stop )
	{
	  xosd_display (osd, 0, XOSD_string, "Stop");
	  xosd_display (osd, 1, XOSD_string, "");
	}

      previous_playing = playing;
    }

  else if (paused != previous_paused && show_pause)
    {
      if (paused)
	{
	  xosd_display (osd, 0, XOSD_string, "Paused");
	  xosd_display (osd, 1, XOSD_string, "");
	}
      else
	{
	  xosd_display (osd, 0, XOSD_string, "Unpaused");
	  text = xmms_remote_get_playlist_title (gp.xmms_session, pos);
	  if (text) {
	    replace_hexcodes (text);
	    xosd_display (osd, 1, XOSD_string, text);
	    save_previous_title( text );
	  }
	}
      previous_paused = paused;
    }

  else if (volume != previous_volume && show_volume)
    {
      xosd_display (osd, 0, XOSD_string, "Volume");
      xosd_display (osd, 1, XOSD_percentage, volume);
      previous_volume = volume;
    }

  else if (balance != previous_balance && show_balance)
    {
      xosd_display (osd, 0, XOSD_string, "Balance");
      xosd_display (osd, 1, XOSD_slider, balance);

      previous_balance = balance;
    }

  else if (repeat != previous_repeat && show_repeat )
    {
      xosd_display (osd, 0, XOSD_string, "Repeat");
      xosd_display (osd, 1, XOSD_string, repeat ? "On" : "Off");

      previous_repeat = repeat;
    }

  else if (shuffle != previous_shuffle && show_shuffle )
    {
      xosd_display (osd, 0, XOSD_string, "Shuffle");
      xosd_display (osd, 1, XOSD_string, shuffle ? "On" : "Off");

      previous_shuffle = shuffle;
    }

  GDK_THREADS_LEAVE();

  return TRUE;
}