1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Saving current volume to setup.conf

This commit is contained in:
Klaus Schmidinger 2001-09-22 13:41:49 +02:00
parent fe9d7f0545
commit 793503a2f5
6 changed files with 16 additions and 7 deletions

View File

@ -776,3 +776,5 @@ Video Disk Recorder Revision History
- EPG info is now updated if the contents changes but the ID remains the same. - 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 - Fixed handling SVDRP commands whith more than one blank between the command
word and the options. word and the options.
- The current volume setting is now saved to setup.conf and restored at the
next program start.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "config.h"
@ -808,6 +808,7 @@ cSetup::cSetup(void)
MultiSpeedMode = 0; MultiSpeedMode = 0;
ShowReplayMode = 0; ShowReplayMode = 0;
CurrentChannel = -1; CurrentChannel = -1;
CurrentVolume = MAXVOLUME;
} }
bool cSetup::Parse(char *s) 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, "MultiSpeedMode")) MultiSpeedMode = atoi(Value);
else if (!strcasecmp(Name, "ShowReplayMode")) ShowReplayMode = atoi(Value); else if (!strcasecmp(Name, "ShowReplayMode")) ShowReplayMode = atoi(Value);
else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value); else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value);
else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value);
else else
return false; return false;
return true; return true;
@ -921,6 +923,7 @@ bool cSetup::Save(const char *FileName)
fprintf(f, "MultiSpeedMode = %d\n", MultiSpeedMode); fprintf(f, "MultiSpeedMode = %d\n", MultiSpeedMode);
fprintf(f, "ShowReplayMode = %d\n", ShowReplayMode); fprintf(f, "ShowReplayMode = %d\n", ShowReplayMode);
fprintf(f, "CurrentChannel = %d\n", CurrentChannel); fprintf(f, "CurrentChannel = %d\n", CurrentChannel);
fprintf(f, "CurrentVolume = %d\n", CurrentVolume);
if (f.Close()) { if (f.Close()) {
isyslog(LOG_INFO, "saved setup to %s", FileName); isyslog(LOG_INFO, "saved setup to %s", FileName);
return true; return true;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __CONFIG_H
@ -302,6 +302,7 @@ public:
int MultiSpeedMode; int MultiSpeedMode;
int ShowReplayMode; int ShowReplayMode;
int CurrentChannel; int CurrentChannel;
int CurrentVolume;
cSetup(void); cSetup(void);
bool Load(const char *FileName); bool Load(const char *FileName);
bool Save(const char *FileName = NULL); bool Save(const char *FileName = NULL);

View File

@ -7,7 +7,7 @@
* DVD support initially written by Andreas Schultz <aschultz@warp10.net> * DVD support initially written by Andreas Schultz <aschultz@warp10.net>
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si> * based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si>
* *
* $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 //#define DVDDEBUG 1
@ -2540,7 +2540,7 @@ cDvbApi::cDvbApi(int n)
#endif #endif
currentChannel = 1; currentChannel = 1;
mute = false; mute = false;
volume = 255; volume = MAXVOLUME;
} }
cDvbApi::~cDvbApi() cDvbApi::~cDvbApi()
@ -3637,7 +3637,7 @@ void cDvbApi::ToggleMute(void)
void cDvbApi::SetVolume(int Volume, bool Absolute) void cDvbApi::SetVolume(int Volume, bool Absolute)
{ {
if (fd_audio >= 0) { 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; audioMixer_t am;
am.volume_left = am.volume_right = volume; am.volume_left = am.volume_right = volume;
CHECK(ioctl(fd_audio, AUDIO_SET_MIXER, &am)); CHECK(ioctl(fd_audio, AUDIO_SET_MIXER, &am));

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __DVBAPI_H
@ -51,6 +51,8 @@ typedef struct CRect {
#define MAXVIDEOFILESIZE 2000 // MB #define MAXVIDEOFILESIZE 2000 // MB
#define MINVIDEOFILESIZE 100 // MB #define MINVIDEOFILESIZE 100 // MB
#define MAXVOLUME 255
const char *IndexToHMSF(int Index, bool WithFrame = false); const char *IndexToHMSF(int Index, bool WithFrame = false);
// Converts the given index to a string, optionally containing the frame number. // Converts the given index to a string, optionally containing the frame number.
int HMSFToIndex(const char *HMSF); int HMSFToIndex(const char *HMSF);

3
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/people/kls/vdr * 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 #define _GNU_SOURCE
@ -278,6 +278,7 @@ int main(int argc, char *argv[])
cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
Channels.SwitchTo(Setup.CurrentChannel); Channels.SwitchTo(Setup.CurrentChannel);
cDvbApi::PrimaryDvbApi->SetVolume(Setup.CurrentVolume, true);
cEITScanner EITScanner; cEITScanner EITScanner;