File: mixctl.h

package info (click to toggle)
wmmixer 1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 496 kB
  • ctags: 216
  • sloc: cpp: 1,374; sh: 974; makefile: 13
file content (106 lines) | stat: -rw-r--r-- 2,348 bytes parent folder | download
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// mixctl.h - MixCtl class provides control of audio mixer functions
//
// Release 1.5
// Copyright (C) 1998  Sam Hawker <shawkie@geocities.com>
// Copyright (C) 2002 Gordon Fraser <gordon@debian.org>
// This software comes with ABSOLUTELY NO WARRANTY
// This software is free software, and you are welcome to redistribute it
// under certain conditions
// See the COPYING file for details.

#ifndef __mixctl_h__
#define __mixctl_h__


#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#ifdef __NetBSD__
#include <soundcard.h>
#endif
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <sys/soundcard.h>
#endif
#ifdef __linux__
#include <linux/soundcard.h>
#endif
#ifdef __GNU__  // Hurd
#include <sys/soundcard.h>
#endif

#include "exception.h"

//----------------------------------------------------------------------
struct _MixerDevice_{
  bool support;
  bool stereo;
  bool recsrc;
  bool records;
  char *name;
  char *label;
  int value;
  int mask;
  int muted;
};

typedef struct _MixerDevice_ MixerDevice;

//----------------------------------------------------------------------
class MixCtl
{
 protected:
  int mixfd;
  int mixfdopen;
  char* device_;
  int muted_;

  unsigned num_devices_;       // maximum number of devices
  int devmask;         // supported devices
  int stmask;          // stereo devices
  int recmask;         // devices which can be recorded from
  int caps;            // capabilities
  int recsrc;          // devices which are being recorded from
  int modify_counter;
  MixerDevice* mixer_devices_;

  void doStatus();

 public:
  MixCtl(char *dname) throw(MixerDeviceException);
  virtual ~MixCtl();
  int readVol(int, bool);
  int readLeft(int);
  int readRight(int);
  void writeVol(int);

  void setVol(int, int);
  void setBoth(int, int, int);
  void setLeft(int, int);
  void setRight(int, int);

  bool readRec(int, bool);
  void writeRec();
  void setRec(int, bool);

  char *getDevName();
  unsigned getNrDevices();
  int getCapabilities();
  bool getSupport(int);
  bool getStereo(int);
  bool getRecords(int);
  char *getName(int);
  char *getLabel(int);
  bool hasChanged();

  bool isMuted(int);
  void mute(int);
  void unmute(int);
};

#endif // __mixctl_h__