mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Implemented left/right/stereo selection
This commit is contained in:
		
							
								
								
									
										8
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -3254,7 +3254,7 @@ Video Disk Recorder Revision History | ||||
| - The new remote control button "Audio" can be used to switch between different | ||||
|   audio tracks. The "Green" button in the "Main" menu has been changed from "Language" | ||||
|   to "Audio", since it now also controls switching between normal and Dolby Digital | ||||
|   audio tracks. | ||||
|   audio tracks (see MANUAL for details). | ||||
| - The description of the audio tracks is now taken from the "component descriptors" | ||||
|   that are broadcast in the EPG data. However (as no big surprise), not all channels | ||||
|   actually provide useful data here, so there are now some additional EPG bugfixes, | ||||
| @@ -3269,3 +3269,9 @@ Video Disk Recorder Revision History | ||||
| - The new setup option "DVB/Audio languages" can be used to control which audio | ||||
|   language shall be selected in case a channel broadcasts in different languages | ||||
|   (see MANUAL for details).  | ||||
| - The "Left" and "Right" keys in the "Audio" menu can be used to switch between | ||||
|   the left and right stereo channels in case there are different audio tracks | ||||
|   in these channels (see MANUAL for details). | ||||
|   Currently there is no visual indicator of the audio channel, yet, and it | ||||
|   doesn't work with the selected audio languages. It also doesn't appear to | ||||
|   work with some DVB cards (esp. the Siemens DVB-S Rev 1.3). | ||||
|   | ||||
							
								
								
									
										34
									
								
								MANUAL
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								MANUAL
									
									
									
									
									
								
							| @@ -11,20 +11,20 @@ Version 1.2 | ||||
|   possible, several keys have different meanings in the various | ||||
|   modes: | ||||
|  | ||||
|   Key     Normal      VDR          Channels   Timers     Edit/New      Recordings        Replay | ||||
|   Key     Normal      VDR          Channels   Timers     Edit/New      Recordings        Replay           Audio | ||||
|  | ||||
|   Up      Ch up       Crsr up      Crsr up    Crsr up    Crsr up       Crsr up           Play | ||||
|   Down    Ch down     Crsr down    Crsr down  Crsr down  Crsr down     Crsr down         Pause | ||||
|   Left    Prev group  -            Page up    Page up    Decrement     Page up           Search back | ||||
|   Right   Next group  -            Page down  Page down  Increment     Page down         Search forward | ||||
|   Ok      Ch display  Select       Switch     Edit       Accept        Play              Progress disp. | ||||
|   Menu    Menu on     Menu off     Menu off   Menu off   Menu off      Menu off          Menu on | ||||
|   Back    -           Menu off     VDR menu   VDR menu   Discard       VDR menu          Recordings menu | ||||
|   Red     -           Record       Edit       Edit       ABC/abc       Play/Commands(2)  Jump | ||||
|   Green   -           Audio        New        New        Ins/Ovr       Rewind            Skip -60s | ||||
|   Yellow  -           Pause live   Delete     Delete     Delete        Delete            Skip +60s | ||||
|   Blue    -           Stop/Resume  Mark       On/Off(1)  -             Summary           Stop | ||||
|   0..9    Ch select   -            Sort(3)    Day(4)     Numeric inp.  Exec cmd(2)       Editing | ||||
|   Up      Ch up       Crsr up      Crsr up    Crsr up    Crsr up       Crsr up           Play             Sel. track | ||||
|   Down    Ch down     Crsr down    Crsr down  Crsr down  Crsr down     Crsr down         Pause            Sel. track | ||||
|   Left    Prev group  -            Page up    Page up    Decrement     Page up           Search back      Sel. channel | ||||
|   Right   Next group  -            Page down  Page down  Increment     Page down         Search forward   Sel. channel | ||||
|   Ok      Ch display  Select       Switch     Edit       Accept        Play              Progress disp.   Switch & Close | ||||
|   Menu    Menu on     Menu off     Menu off   Menu off   Menu off      Menu off          Menu on          Menu on | ||||
|   Back    -           Menu off     VDR menu   VDR menu   Discard       VDR menu          Recordings menu  Close | ||||
|   Red     -           Record       Edit       Edit       ABC/abc       Play/Commands(2)  Jump             - | ||||
|   Green   -           Audio        New        New        Ins/Ovr       Rewind            Skip -60s        - | ||||
|   Yellow  -           Pause live   Delete     Delete     Delete        Delete            Skip +60s        - | ||||
|   Blue    -           Stop/Resume  Mark       On/Off(1)  -             Summary           Stop             - | ||||
|   0..9    Ch select   -            Sort(3)    Day(4)     Numeric inp.  Exec cmd(2)       Editing          - | ||||
|  | ||||
|   In a numerical input field (like the response to a CAM enquiry) the keys 0..9 | ||||
|   are used to enter the data, and the Left key can be used to delete the last | ||||
| @@ -197,6 +197,14 @@ Version 1.2 | ||||
|   keys can be used to switch between the audio tracks. If your remote control has | ||||
|   a dedicated "Audio" button, the first press of that button brings up the "Audio" | ||||
|   menu, and every further press switches to the next available audio track. | ||||
|  | ||||
|   The "Left" and "Right" keys can be used to switch between "mono left", "stereo" | ||||
|   and "mono right" for channels that broadcast different audio tracks in the | ||||
|   left and right stereo channels (as was often done in the old analog days). | ||||
|  | ||||
|   The "Ok" key explicitly switches to the selected track (in case the device | ||||
|   for some reason doesn't play it) and closes the "Audio" menu. | ||||
|  | ||||
|   The "Audio" menu will automatically disappear after 5 seconds of user inactivity, | ||||
|   or if any key other than the ones described above is pressed. | ||||
|  | ||||
|   | ||||
							
								
								
									
										27
									
								
								device.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								device.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: device.c 1.67 2005/01/04 15:38:46 kls Exp $ | ||||
|  * $Id: device.c 1.68 2005/01/06 13:30:30 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "device.h" | ||||
| @@ -582,10 +582,23 @@ bool cDevice::HasProgramme(void) | ||||
|   return Replaying() || pidHandles[ptAudio].pid || pidHandles[ptVideo].pid; | ||||
| } | ||||
|  | ||||
| int cDevice::GetAudioChannelDevice(void) | ||||
| { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| void cDevice::SetAudioChannelDevice(int AudioChannel) | ||||
| { | ||||
| } | ||||
|  | ||||
| void cDevice::SetVolumeDevice(int Volume) | ||||
| { | ||||
| } | ||||
|  | ||||
| void cDevice::SetDigitalAudioDevice(bool On) | ||||
| { | ||||
| } | ||||
|  | ||||
| void cDevice::SetAudioTrackDevice(eTrackType Type) | ||||
| { | ||||
| } | ||||
| @@ -607,6 +620,18 @@ bool cDevice::ToggleMute(void) | ||||
|   return mute; | ||||
| } | ||||
|  | ||||
| int cDevice::GetAudioChannel(void) | ||||
| { | ||||
|   int c = GetAudioChannelDevice(); | ||||
|   return (0 <= c && c <= 2) ? c : 0; | ||||
| } | ||||
|  | ||||
| void cDevice::SetAudioChannel(int AudioChannel) | ||||
| { | ||||
|   if (0 <= AudioChannel && AudioChannel <= 2) | ||||
|      SetAudioChannelDevice(AudioChannel); | ||||
| } | ||||
|  | ||||
| void cDevice::SetVolume(int Volume, bool Absolute) | ||||
| { | ||||
|   volume = min(max(Absolute ? Volume : volume + Volume, 0), MAXVOLUME); | ||||
|   | ||||
							
								
								
									
										15
									
								
								device.h
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								device.h
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: device.h 1.49 2005/01/02 14:08:36 kls Exp $ | ||||
|  * $Id: device.h 1.50 2005/01/06 13:27:42 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #ifndef __DEVICE_H | ||||
| @@ -345,15 +345,26 @@ private: | ||||
|   bool mute; | ||||
|   int volume; | ||||
| protected: | ||||
|   virtual int GetAudioChannelDevice(void); | ||||
|        ///< Gets the current audio channel, which is stereo (0), mono left (1) or | ||||
|        ///< mono right (2). | ||||
|   virtual void SetAudioChannelDevice(int AudioChannel); | ||||
|        ///< Sets the audio channel to stereo (0), mono left (1) or mono right (2). | ||||
|   virtual void SetVolumeDevice(int Volume); | ||||
|        ///< Sets the audio volume on this device (Volume = 0...255). | ||||
|   virtual void SetDigitalAudioDevice(bool On) {} | ||||
|   virtual void SetDigitalAudioDevice(bool On); | ||||
|        ///< Tells the actual device that digital audio output shall be switched | ||||
|        ///< on or off. | ||||
| public: | ||||
|   bool IsMute(void) const { return mute; } | ||||
|   bool ToggleMute(void); | ||||
|        ///< Turns the volume off or on and returns the new mute state. | ||||
|   int GetAudioChannel(void); | ||||
|        ///< Gets the current audio channel, which is stereo (0), mono left (1) or | ||||
|        ///< mono right (2). | ||||
|   void SetAudioChannel(int AudioChannel); | ||||
|        ///< Sets the audio channel to stereo (0), mono left (1) or mono right (2). | ||||
|        ///< Any other values will be silently ignored. | ||||
|   void SetVolume(int Volume, bool Absolute = false); | ||||
|        ///< Sets the volume to the given value, either absolutely or relative to | ||||
|        ///< the current volume. | ||||
|   | ||||
							
								
								
									
										18
									
								
								dvbdevice.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								dvbdevice.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: dvbdevice.c 1.109 2005/01/04 13:13:32 kls Exp $ | ||||
|  * $Id: dvbdevice.c 1.110 2005/01/06 13:32:41 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "dvbdevice.h" | ||||
| @@ -823,6 +823,22 @@ bool cDvbDevice::HasLock(int TimeoutMs) | ||||
|   return dvbTuner ? dvbTuner->Locked(TimeoutMs) : false; | ||||
| } | ||||
|  | ||||
| int cDvbDevice::GetAudioChannelDevice(void) | ||||
| { | ||||
|   if (HasDecoder()) { | ||||
|      audio_status_t as; | ||||
|      CHECK(ioctl(fd_audio, AUDIO_GET_STATUS, &as)); | ||||
|      return as.channel_select; | ||||
|      } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| void cDvbDevice::SetAudioChannelDevice(int AudioChannel) | ||||
| { | ||||
|   if (HasDecoder()) | ||||
|      CHECK(ioctl(fd_audio, AUDIO_CHANNEL_SELECT, AudioChannel)); | ||||
| } | ||||
|  | ||||
| void cDvbDevice::SetVolumeDevice(int Volume) | ||||
| { | ||||
|   if (HasDecoder()) { | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: dvbdevice.h 1.31 2004/12/17 14:01:31 kls Exp $ | ||||
|  * $Id: dvbdevice.h 1.32 2005/01/06 13:30:51 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #ifndef __DVBDEVICE_H | ||||
| @@ -100,6 +100,8 @@ protected: | ||||
| private: | ||||
|   bool digitalAudio; | ||||
| protected: | ||||
|   virtual int GetAudioChannelDevice(void); | ||||
|   virtual void SetAudioChannelDevice(int AudioChannel); | ||||
|   virtual void SetVolumeDevice(int Volume); | ||||
|   virtual void SetDigitalAudioDevice(bool On); | ||||
|  | ||||
|   | ||||
							
								
								
									
										19
									
								
								menu.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								menu.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: menu.c 1.328 2005/01/05 10:26:59 kls Exp $ | ||||
|  * $Id: menu.c 1.329 2005/01/06 13:27:00 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "menu.h" | ||||
| @@ -2913,6 +2913,20 @@ eOSState cDisplayTracks::ProcessKey(eKeys Key) | ||||
|             track++; | ||||
|          timeout.Set(TRACKTIMEOUT); | ||||
|          break; | ||||
|     case kLeft|k_Repeat: | ||||
|     case kLeft: | ||||
|     case kRight|k_Repeat: | ||||
|     case kRight: { | ||||
|          static int ac[] = { 1, 0, 2 }; | ||||
|          int AudioChannel = ac[cDevice::PrimaryDevice()->GetAudioChannel()]; | ||||
|          if (NORMALKEY(Key) == kLeft && AudioChannel > 0) | ||||
|             AudioChannel--; | ||||
|          else if (NORMALKEY(Key) == kRight && AudioChannel < 2) | ||||
|             AudioChannel++; | ||||
|          cDevice::PrimaryDevice()->SetAudioChannel(ac[AudioChannel]); | ||||
|          timeout.Set(TRACKTIMEOUT); | ||||
|          } | ||||
|          break; | ||||
|     case kAudio: | ||||
|          if (++track >= numTracks) | ||||
|             track = 0; | ||||
| @@ -2924,7 +2938,8 @@ eOSState cDisplayTracks::ProcessKey(eKeys Key) | ||||
|          timeout.Set(); | ||||
|          break; | ||||
|     case kNone: break; | ||||
|     default: return osEnd; | ||||
|     default: if ((Key & k_Release) == 0) | ||||
|                 return osEnd; | ||||
|     } | ||||
|   if (track != oldTrack) { | ||||
|      Show(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user