]> git.vomp.tv Git - vompclient.git/blob - audio.h
Connection failure detection
[vompclient.git] / audio.h
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 // Thanks to Jon Gettler and BtB for all the ioctl information
22
23 #ifndef AUDIO_H
24 #define AUDIO_H
25
26 #include <stdio.h>
27 #include <unistd.h>
28 #include <fcntl.h>
29 #include <sys/ioctl.h>
30
31 #include "defines.h"
32 #include "log.h"
33 #include "stb.h"
34
35 class Audio
36 {
37   public:
38     Audio();
39     ~Audio();
40     static Audio* getInstance();
41
42     int init(UCHAR streamType);
43     int shutdown();
44
45     // Audio stream type
46     const static UCHAR MPEG2_PES = 2;
47     const static UCHAR MPEG1_PES = 3; // unused
48
49     int setStreamType(UCHAR streamType);
50     int setChannel();
51     int setSource();
52     int sync();
53     int play();
54     int stop();
55     int pause();
56     int unPause();
57     int reset();
58     int setVolume(int volume);
59     int volumeUp();
60     int volumeDown();
61     int getVolume();
62     int toggleUserMute();
63     int systemMuteOn();
64     int systemMuteOff();
65 #ifdef DEV
66     int test();
67 #endif
68
69     int write(char *buf, int len);
70
71     int getFD();
72
73     int doMuting();
74   private:
75     static Audio* instance;
76     int initted;
77     int volume;
78     UCHAR muted;
79     UCHAR userMute;
80     UCHAR systemMute;
81
82     int mute();
83     int unMute();
84     int initAllParams();
85
86     UCHAR streamType;
87
88     int fdAudio;
89 };
90
91 #endif