wmclockmon: update change-log
[dockapps.git] / wmmixer / mixctl.h
blobd9c5dca9290fe0573bb0fc3ff5fe8b88e23faf87
1 // mixctl.h - MixCtl class provides control of audio mixer functions
2 //
3 // Release 1.5
4 // Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
5 // Copyright (C) 2002 Gordon Fraser <gordon@debian.org>
6 // This software comes with ABSOLUTELY NO WARRANTY
7 // This software is free software, and you are welcome to redistribute it
8 // under certain conditions
9 // See the COPYING file for details.
11 #ifndef __mixctl_h__
12 #define __mixctl_h__
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <sys/ioctl.h>
18 #include <sys/types.h>
19 #include <sys/stat.h>
20 #include <fcntl.h>
21 #include <unistd.h>
22 #include <string.h>
23 #ifdef __NetBSD__
24 #include <soundcard.h>
25 #endif
26 #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
27 #include <sys/soundcard.h>
28 #endif
29 #ifdef __linux__
30 #include <linux/soundcard.h>
31 #endif
32 #ifdef __GNU__ // Hurd
33 #include <sys/soundcard.h>
34 #endif
36 #include "exception.h"
38 //----------------------------------------------------------------------
39 struct _MixerDevice_{
40 bool support;
41 bool stereo;
42 bool recsrc;
43 bool records;
44 char *name;
45 char *label;
46 int value;
47 int mask;
48 int muted;
51 typedef struct _MixerDevice_ MixerDevice;
53 //----------------------------------------------------------------------
54 class MixCtl
56 protected:
57 int mixfd;
58 int mixfdopen;
59 char* device_;
60 int muted_;
62 unsigned num_devices_; // maximum number of devices
63 int devmask; // supported devices
64 int stmask; // stereo devices
65 int recmask; // devices which can be recorded from
66 int caps; // capabilities
67 int recsrc; // devices which are being recorded from
68 int modify_counter;
69 MixerDevice* mixer_devices_;
71 void doStatus();
73 public:
74 MixCtl(char *dname);
75 virtual ~MixCtl();
76 int readVol(int, bool);
77 int readLeft(int);
78 int readRight(int);
79 void writeVol(int);
81 void setVol(int, int);
82 void setBoth(int, int, int);
83 void setLeft(int, int);
84 void setRight(int, int);
86 bool readRec(int, bool);
87 void writeRec();
88 void setRec(int, bool);
90 char *getDevName();
91 unsigned getNrDevices();
92 int getCapabilities();
93 bool getSupport(int);
94 bool getStereo(int);
95 bool getRecords(int);
96 char *getName(int);
97 char *getLabel(int);
98 bool hasChanged();
100 bool isMuted(int);
101 void mute(int);
102 void unmute(int);
105 #endif // __mixctl_h__