Index: src/libmpdclient.c =================================================================== --- src/libmpdclient.c (revision 2798) +++ src/libmpdclient.c (working copy) @@ -1,5 +1,6 @@ /* libmpdclient (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu) + Daniel Brown (danb@cs.utexas.edu) This project's homepage is: http://www.musicpd.org Redistribution and use in source and binary forms, with or without @@ -565,6 +566,7 @@ status = malloc(sizeof(mpd_Status)); status->volume = -1; + status->mute = 0; status->repeat = 0; status->random = 0; status->playlist = -1; @@ -590,6 +592,9 @@ if(strcmp(re->name,"volume")==0) { status->volume = atoi(re->value); } + else if(strcmp(re->name,"mute")==0) { + status->mute = atoi(re->value); + } else if(strcmp(re->name,"repeat")==0) { status->repeat = atoi(re->value); } @@ -1310,6 +1315,13 @@ mpd_executeCommand(connection,"previous\n"); } +void mpd_sendMuteCommand(mpd_Connection * connection, int muteMode) { + char * string = malloc(strlen("mute")+25); + sprintf(string,"mute \"%i\"\n",muteMode); + mpd_executeCommand(connection,string); + free(string); +} + void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode) { char * string = malloc(strlen("repeat")+25); sprintf(string,"repeat \"%i\"\n",repeatMode); Index: src/libmpdclient.h =================================================================== --- src/libmpdclient.h (revision 2798) +++ src/libmpdclient.h (working copy) @@ -1,5 +1,6 @@ /* libmpdclient (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu) + Daniel Brown (danb@cs.utexas.edu) This project's homepage is: http://www.musicpd.org Redistribution and use in source and binary forms, with or without @@ -140,6 +141,8 @@ typedef struct mpd_Status { /* 0-100, or MPD_STATUS_NO_VOLUME when there is no volume support */ int volume; + /* 1 if mute is on, 0 otherwise */ + int mute; /* 1 if repeat is on, 0 otherwise */ int repeat; /* 1 if random is on, 0 otherwise */ @@ -447,6 +450,8 @@ /* WARNING: don't use volume command, its depreacted */ void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange); +void mpd_sendMuteCommand(mpd_Connection * connection, int muteMode); + void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds); void mpd_sendUpdateCommand(mpd_Connection * connection, char * path); Index: src/util.c =================================================================== --- src/util.c (revision 2798) +++ src/util.c (working copy) @@ -1,6 +1,6 @@ /* mpc * (c) 2003-2004 by normalperson and Warren Dukes (shank@mercury.chem.pitt.edu) - * and Daniel Brown (danb@cs.utexas.edu) + * and Daniel Brown (danb@cs.utexas.edu) * This project's homepage is: http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify Index: src/command.c =================================================================== --- src/command.c (revision 2798) +++ src/command.c (working copy) @@ -1,6 +1,6 @@ /* mpc * (c) 2003-2004 by normalperson and Warren Dukes (shank@mercury.chem.pitt.edu) - * and Daniel Brown (danb@cs.utexas.edu) + * and Daniel Brown (danb@cs.utexas.edu) * This project's homepage is: http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -633,6 +633,31 @@ return 1; } +int cmd_mute ( int argc, char ** argv, mpd_Connection * conn ) +{ + int mode; + + if(argc==1) { + mode = get_boolean(argv[0]); + if (mode < 0) + return -1; + } + else { + mpd_Status * status; + status = getStatus(conn); + mode = !status->mute; + mpd_freeStatus(status); + } + + + mpd_sendMuteCommand(conn,mode); + printErrorAndExit(conn); + my_finishCommand(conn); + printErrorAndExit(conn); + + return 1; +} + int cmd_repeat ( int argc, char ** argv, mpd_Connection * conn ) { int mode; Index: src/util.h =================================================================== --- src/util.h (revision 2798) +++ src/util.h (working copy) @@ -1,6 +1,6 @@ /* mpc * (c) 2003-2004 by normalperson and Warren Dukes (shank@mercury.chem.pitt.edu) - * and Daniel Brown (danb@cs.utexas.edu) + * and Daniel Brown (danb@cs.utexas.edu) * This project's homepage is: http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify Index: src/status.c =================================================================== --- src/status.c (revision 2798) +++ src/status.c (working copy) @@ -101,6 +101,10 @@ printf("volume: n/a "); } + printf("mute: "); + if(status->mute) printf("on "); + else printf("off "); + printf("repeat: "); if(status->repeat) printf("on "); else printf("off "); Index: src/command.h =================================================================== --- src/command.h (revision 2798) +++ src/command.h (working copy) @@ -1,5 +1,6 @@ /* mpc * (c) 2003-2004 by normalperson and Warren Dukes (shank@mercury.chem.pitt.edu) + * and Daniel Brown (danb@cs.utexas.edu) * This project's homepage is: http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -40,6 +41,7 @@ int cmd_save ( int argc, char ** argv, mpd_Connection * conn ) ; int cmd_rm ( int argc, char ** argv, mpd_Connection * conn ); int cmd_volume ( int argc, char ** argv, mpd_Connection * conn ) ; +int cmd_mute ( int argc, char ** argv, mpd_Connection * conn ); int cmd_repeat ( int argc, char ** argv, mpd_Connection * conn ); int cmd_random ( int argc, char ** argv, mpd_Connection * conn ); int cmd_crossfade ( int argc, char ** argv, mpd_Connection * conn ); Index: src/main.c =================================================================== --- src/main.c (revision 2798) +++ src/main.c (working copy) @@ -67,6 +67,7 @@ {"save", 1, 1, 0, cmd_save,"", "Saves a playlist as "}, {"rm", 1, 1, 0, cmd_rm,"","Removes a playlist"}, {"volume", 0, 1, 0, cmd_volume,"[+-]","Sets volume to or adjusts by [+-]"}, + {"mute", 0, 1, 0, cmd_mute,"", "Toggle mute mode, or specify state"}, {"repeat", 0, 1, 0, cmd_repeat,"", "Toggle repeat mode, or specify state"}, {"random", 0, 1, 0, cmd_random,"", "Toggle random mode, or specify state"}, {"search", 2, -1, 3, cmd_search, " ", "Search for a song"},