From a4e97d871e2d85819d957f4df10ab650ef0447ab Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 16 Sep 2001 15:06:54 +0200 Subject: New keys 'Volume+', 'Volume-' and 'Mute' --- HISTORY | 2 ++ INSTALL | 2 ++ MANUAL | 5 ++++- config.c | 5 ++++- config.h | 5 ++++- dvbapi.c | 22 +++++++++++++++++++++- dvbapi.h | 14 +++++++++++++- i18n.c | 29 ++++++++++++++++++++++++++++- keys-pc.conf | 3 +++ vdr.c | 14 +++++++++++++- 10 files changed, 94 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index a50e8764..16e52835 100644 --- a/HISTORY +++ b/HISTORY @@ -755,3 +755,5 @@ Video Disk Recorder Revision History - Fixed manipulating an editing mark at the very end of a recording. - Fixed starting a new replay immediately after stopping a previous one (had caused a mix between live video and replay). +- Three new keys ("Volume+", Volume-" and "Mute") to control the DVB card's + audio output volume. diff --git a/INSTALL b/INSTALL index b3271f9d..56200e86 100644 --- a/INSTALL +++ b/INSTALL @@ -294,6 +294,8 @@ The default PC key assignments are: Red, Green, Yellow, Blue 'F1'..'F4' 0..9 '0'..'9' in top row Power 'P' + Volume+/- '+', '-' + Mute 'm' If you prefer different key assignments, or if the default doesn't work for your keyboard, simply delete the file 'keys-pc.conf' and restart 'vdr' to get diff --git a/MANUAL b/MANUAL index 83a1aa2a..05f2f3ca 100644 --- a/MANUAL +++ b/MANUAL @@ -8,7 +8,7 @@ Video Disk Recorder User's Manual possible, several keys have different meanings in the various modes: - Key Normal Main Channels Timers Edit/New Recordings Replay + Key Normal Main Channels Timers Edit/New Recordings Replay 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 @@ -23,6 +23,9 @@ Video Disk Recorder User's Manual Blue - Resume Mark Mark(1) - Summary Stop 0..9 Ch select - - - Numeric inp. - Editing Power Shutdown - - - - - - + Volume+ Volume up - - - - - - + Volume- Volume down - - - - - - + Mute Mute - - - - - - (1) The "Mark" button in the "Timers" menu only works if sorting the timers has been disabled in the "Setup" menu. diff --git a/config.c b/config.c index 15042ef0..87e83323 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.71 2001/09/16 08:57:58 kls Exp $ + * $Id: config.c 1.72 2001/09/16 14:54:32 kls Exp $ */ #include "config.h" @@ -39,6 +39,9 @@ tKey keyTable[] = { // "Up" and "Down" must be the first two keys! { k8, "8", 0 }, { k9, "9", 0 }, { kPower, "Power", 0 }, + { kVolUp, "Volume+", 0 }, + { kVolDn, "Volume-", 0 }, + { kMute, "Mute", 0 }, { kNone, "", 0 }, }; diff --git a/config.h b/config.h index a4bfa5bf..194d04e2 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.78 2001/09/15 15:38:40 kls Exp $ + * $Id: config.h 1.79 2001/09/16 14:54:36 kls Exp $ */ #ifndef __CONFIG_H @@ -43,6 +43,9 @@ enum eKeys { // "Up" and "Down" must be the first two keys! kBlue, k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, kPower, + kVolUp, + kVolDn, + kMute, kNone, // The following flags are OR'd with the above codes: k_Repeat = 0x8000, diff --git a/dvbapi.c b/dvbapi.c index 462e1954..16b3e308 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.124 2001/09/16 10:10:28 kls Exp $ + * $Id: dvbapi.c 1.125 2001/09/16 13:55:03 kls Exp $ */ //#define DVDDEBUG 1 @@ -2539,6 +2539,8 @@ cDvbApi::cDvbApi(int n) osd = NULL; #endif currentChannel = 1; + mute = false; + volume = 255; } cDvbApi::~cDvbApi() @@ -3622,6 +3624,24 @@ bool cDvbApi::ToggleAudioTrack(void) return false; } +void cDvbApi::ToggleMute(void) +{ + int OldVolume = volume; + mute = !mute; + SetVolume(0, mute); + volume = OldVolume; +} + +void cDvbApi::SetVolume(int Volume, bool Absolute) +{ + if (fd_audio >= 0) { + volume = min(max(Absolute ? Volume : volume + Volume, 0), 255); + audioMixer_t am; + am.volume_left = am.volume_right = volume; + CHECK(ioctl(fd_audio, AUDIO_SET_MIXER, &am)); + } +} + void cDvbApi::SetAudioCommand(const char *Command) { delete audioCommand; diff --git a/dvbapi.h b/dvbapi.h index 5e19a8e1..d0a68e79 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.50 2001/09/15 13:46:00 kls Exp $ + * $Id: dvbapi.h 1.51 2001/09/16 13:54:23 kls Exp $ */ #ifndef __DVBAPI_H @@ -315,6 +315,18 @@ private: public: static void SetAudioCommand(const char *Command); static const char *AudioCommand(void) { return audioCommand; } + + // Volume facilities: + +private: + bool mute; + int volume; +public: + void ToggleMute(void); + // Turns the volume off or on. + void SetVolume(int Volume, bool Absolute = false); + // Sets the volume to the given value, either absolutely or relative to + // the current volume. }; class cEITScanner { diff --git a/i18n.c b/i18n.c index 1170c244..5e440c95 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.42 2001/09/09 13:54:35 kls Exp $ + * $Id: i18n.c 1.43 2001/09/16 14:43:05 kls Exp $ * * Slovenian translations provided by Miha Setina * Italian translations provided by Alberto Carraro @@ -1211,6 +1211,33 @@ const tPhrase Phrases[] = { "", // TODO "", // TODO }, + { "Volume+", + "Lautstärke+", + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + }, + { "Volume-", + "Lautstärke-", + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + }, + { "Mute", + "Stumm", + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + }, // Miscellaneous: { "yes", "ja", diff --git a/keys-pc.conf b/keys-pc.conf index ab4b58d5..d727712d 100644 --- a/keys-pc.conf +++ b/keys-pc.conf @@ -22,3 +22,6 @@ Blue 0000010C 8 00000038 9 00000039 Power 00000050 +Volume+ 0000002B +Volume- 0000002D +Mute 0000006D diff --git a/vdr.c b/vdr.c index 2ba16905..b288108d 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.72 2001/09/08 14:34:29 kls Exp $ + * $Id: vdr.c 1.73 2001/09/16 14:54:45 kls Exp $ */ #define _GNU_SOURCE @@ -52,6 +52,8 @@ #define SHUTDOWNWAIT 300 // seconds to wait in user prompt before automatic shutdown #define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start +#define VOLUMEDELTA 5 // used to increase/decrease the volume + static int Interrupted = 0; static void SignalHandler(int signum) @@ -424,6 +426,16 @@ int main(int argc, char *argv[]) case kMenu: Menu = new cMenuMain(ReplayControl); break; // Viewing Control: case kOk: LastChannel = -1; break; // forces channel display + // Volume Control: + case kVolUp|k_Repeat: + case kVolUp: + case kVolDn|k_Repeat: + case kVolDn: + cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA); + break; + case kMute: + cDvbApi::PrimaryDvbApi->ToggleMute(); + break; // Power off: case kPower: isyslog(LOG_INFO, "Power button pressed"); DELETENULL(*Interact); -- cgit v1.2.3