Date: Sat, 19 Aug 2006 00:13:54 +0200
authorSam Lantinga <slouken@libsdl.org>
Sun, 20 Aug 2006 23:25:46 +0000
changeset 333b5fd2f76ed9c
parent 332 fb7c3d64963d
child 334 caef5cca8fd0
Date: Sat, 19 Aug 2006 00:13:54 +0200
From: Hans de Goede
Subject: PATCH: add volume control to playmus interactive mode

Hi,

First a short intro I'm a Linux enthousiast and developer, mainly
working on Linux gaming related stuff.

I've been working on getting d1x (descent 3d-shooter linux port) to play
the music from the original game. Now, 2 full days further I'm getting
there (as in nearly finished).

Because of <insert long story here if you really want to know ask> I
cannot use SDL_mixer directly from d1x, so I'm using popen("playmus -i
xxxx", "w") to start playmus todo the playback and I control it (-i is
interactive mode) by writing the nescesarry commands to the stdin FILE *
returned by popen.

However by default playmus' interactive mode doesn't allow changing the
volume, which I need to be able todo. The attached patch adds this
capability to playmus, and is otherwise harmless. I hope you can
incorperate this patch into playmus, so that I don't have to ship a
modified version as part of the d1x package.

Thanks & Regards,

Hans
playmus.c
     1.1 --- a/playmus.c	Thu Aug 10 15:06:40 2006 +0000
     1.2 +++ b/playmus.c	Sun Aug 20 23:25:46 2006 +0000
     1.3 @@ -65,7 +65,7 @@
     1.4  {
     1.5  	char buf[10];
     1.6  
     1.7 -	printf("Available commands: (p)ause (r)esume (h)alt > ");
     1.8 +	printf("Available commands: (p)ause (r)esume (h)alt volume(v#) > ");
     1.9  	fflush(stdin);
    1.10  	scanf("%s",buf);
    1.11  	switch(buf[0]){
    1.12 @@ -78,6 +78,9 @@
    1.13  	case 'h': case 'H':
    1.14  		Mix_HaltMusic();
    1.15  		break;
    1.16 +	case 'v': case 'V':
    1.17 +		Mix_VolumeMusic(atoi(buf+1));
    1.18 +		break;
    1.19  	}
    1.20  	printf("Music playing: %s Paused: %s\n", Mix_PlayingMusic() ? "yes" : "no", 
    1.21  		   Mix_PausedMusic() ? "yes" : "no");