summaryrefslogtreecommitdiff
path: root/status.c
blob: 969fdafc2c5e93e1a32183e767bde6b2c1b83938 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * sndctl  -  a plugin for the Video Disk Recorder
 *        file: status.c
 * description: status monitor to get informations from VDR
 *
 *      author: Thomas Hildebrandt <toxym@web.de>
 *
 * inspired by and reengineered from 'avolctl'
 * thanks to Martin Prochnow <nordlichtl@martins-kabuff.de>
 */

#include "defaults.h"
#include "status.h"

/*********************************************************
 * member functions for class cStatusSndctl
 *********************************************************/

/*
 * constructor
 */
cStatusSndctl::cStatusSndctl( const cSoundMan *Soundman ){
  // save sound manager pointer
  soundman = (cSoundMan*) Soundman;
}

void cStatusSndctl::SetAudioTrack( int Index, const char * const *Tracks ){
  isyslog( "sndctl (cStatusSndctl::SetAudioTrack): Audio track switched to '%s'.", Tracks[Index] );

  // inform sound manager
  soundman->AudioTrack( Tracks[Index] );
}

/*
 * the volume has been set to the given value, either
 * absolutely or relative to the current volume.
 */
void cStatusSndctl::SetVolume( int Volume, bool Absolute ){

  isyslog( "sndctl (cStatusSndctl::SetVolume): Received volume from VDR: '%d'.", Volume );

  // set current volume
  if( Absolute )
    soundman->SetVolume( Volume );
  else
    soundman->SetVolume( soundman->GetVolume() + Volume );
}