From 793503a2f548dae46e2505fd63e7b541543c45a8 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 22 Sep 2001 13:41:49 +0200 Subject: Saving current volume to setup.conf --- HISTORY | 2 ++ config.c | 5 ++++- config.h | 3 ++- dvbapi.c | 6 +++--- dvbapi.h | 4 +++- vdr.c | 3 ++- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index ade7a7da..f9c3ecd3 100644 --- a/HISTORY +++ b/HISTORY @@ -776,3 +776,5 @@ Video Disk Recorder Revision History - EPG info is now updated if the contents changes but the ID remains the same. - Fixed handling SVDRP commands whith more than one blank between the command word and the options. +- The current volume setting is now saved to setup.conf and restored at the + next program start. diff --git a/config.c b/config.c index 87e83323..4df73614 100644 --- a/config.c +++ b/config.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.72 2001/09/16 14:54:32 kls Exp $ + * $Id: config.c 1.73 2001/09/22 13:36:59 kls Exp $ */ #include "config.h" @@ -808,6 +808,7 @@ cSetup::cSetup(void) MultiSpeedMode = 0; ShowReplayMode = 0; CurrentChannel = -1; + CurrentVolume = MAXVOLUME; } bool cSetup::Parse(char *s) @@ -847,6 +848,7 @@ bool cSetup::Parse(char *s) else if (!strcasecmp(Name, "MultiSpeedMode")) MultiSpeedMode = atoi(Value); else if (!strcasecmp(Name, "ShowReplayMode")) ShowReplayMode = atoi(Value); else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value); + else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value); else return false; return true; @@ -921,6 +923,7 @@ bool cSetup::Save(const char *FileName) fprintf(f, "MultiSpeedMode = %d\n", MultiSpeedMode); fprintf(f, "ShowReplayMode = %d\n", ShowReplayMode); fprintf(f, "CurrentChannel = %d\n", CurrentChannel); + fprintf(f, "CurrentVolume = %d\n", CurrentVolume); if (f.Close()) { isyslog(LOG_INFO, "saved setup to %s", FileName); return true; diff --git a/config.h b/config.h index 62d198a2..8012cd26 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.80 2001/09/22 13:00:04 kls Exp $ + * $Id: config.h 1.81 2001/09/22 13:37:05 kls Exp $ */ #ifndef __CONFIG_H @@ -302,6 +302,7 @@ public: int MultiSpeedMode; int ShowReplayMode; int CurrentChannel; + int CurrentVolume; cSetup(void); bool Load(const char *FileName); bool Save(const char *FileName = NULL); diff --git a/dvbapi.c b/dvbapi.c index d7b4ebfb..064bb49c 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz * based on dvdplayer-0.5 by Matjaz Thaler * - * $Id: dvbapi.c 1.127 2001/09/22 09:24:59 kls Exp $ + * $Id: dvbapi.c 1.128 2001/09/22 13:39:56 kls Exp $ */ //#define DVDDEBUG 1 @@ -2540,7 +2540,7 @@ cDvbApi::cDvbApi(int n) #endif currentChannel = 1; mute = false; - volume = 255; + volume = MAXVOLUME; } cDvbApi::~cDvbApi() @@ -3637,7 +3637,7 @@ void cDvbApi::ToggleMute(void) void cDvbApi::SetVolume(int Volume, bool Absolute) { if (fd_audio >= 0) { - volume = min(max(Absolute ? Volume : volume + Volume, 0), 255); + volume = min(max(Absolute ? Volume : volume + Volume, 0), MAXVOLUME); audioMixer_t am; am.volume_left = am.volume_right = volume; CHECK(ioctl(fd_audio, AUDIO_SET_MIXER, &am)); diff --git a/dvbapi.h b/dvbapi.h index d0a68e79..13365e47 100644 --- a/dvbapi.h +++ b/dvbapi.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.h 1.51 2001/09/16 13:54:23 kls Exp $ + * $Id: dvbapi.h 1.52 2001/09/22 13:40:30 kls Exp $ */ #ifndef __DVBAPI_H @@ -51,6 +51,8 @@ typedef struct CRect { #define MAXVIDEOFILESIZE 2000 // MB #define MINVIDEOFILESIZE 100 // MB +#define MAXVOLUME 255 + const char *IndexToHMSF(int Index, bool WithFrame = false); // Converts the given index to a string, optionally containing the frame number. int HMSFToIndex(const char *HMSF); diff --git a/vdr.c b/vdr.c index b288108d..0c9b98c0 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: vdr.c 1.73 2001/09/16 14:54:45 kls Exp $ + * $Id: vdr.c 1.74 2001/09/22 13:38:28 kls Exp $ */ #define _GNU_SOURCE @@ -278,6 +278,7 @@ int main(int argc, char *argv[]) cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); Channels.SwitchTo(Setup.CurrentChannel); + cDvbApi::PrimaryDvbApi->SetVolume(Setup.CurrentVolume, true); cEITScanner EITScanner; -- cgit v1.2.3