mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Saving current volume to setup.conf
This commit is contained in:
		
							
								
								
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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. | ||||
|   | ||||
							
								
								
									
										5
									
								
								config.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								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; | ||||
|   | ||||
							
								
								
									
										3
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								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); | ||||
|   | ||||
							
								
								
									
										6
									
								
								dvbapi.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								dvbapi.c
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ | ||||
|  * DVD support initially written by Andreas Schultz <aschultz@warp10.net> | ||||
|  * 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 | ||||
| @@ -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)); | ||||
|   | ||||
							
								
								
									
										4
									
								
								dvbapi.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								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); | ||||
|   | ||||
							
								
								
									
										3
									
								
								vdr.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								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; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user