Switch to unified view

a b/upmpd/mpdcli.hxx
1
/* Copyright (C) 2014 J.F.Dockes
2
 *     This program is free software; you can redistribute it and/or modify
3
 *     it under the terms of the GNU General Public License as published by
4
 *     the Free Software Foundation; either version 2 of the License, or
5
 *     (at your option) any later version.
6
 *
7
 *     This program is distributed in the hope that it will be useful,
8
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *     GNU General Public License for more details.
11
 *
12
 *     You should have received a copy of the GNU General Public License
13
 *     along with this program; if not, write to the
14
 *     Free Software Foundation, Inc.,
15
 *     59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
17
#ifndef _MPDCLI_H_X_INCLUDED_
18
#define _MPDCLI_H_X_INCLUDED_
19
20
#include <string>
21
22
struct MpdStatus {
23
    enum State {MPDS_UNK, MPDS_STOP, MPDS_PLAY, MPDS_PAUSE};
24
    int volume;
25
    bool rept;
26
    bool random;
27
    bool single;
28
    bool consume;
29
    int qlen;
30
    int qvers;
31
    State state;
32
    unsigned int crossfade;
33
    float mixrampdb;
34
    float mixrampdelay;
35
    int songpos;
36
    int songid;
37
    unsigned int songms; //current ms
38
    unsigned int songlen; // seconds
39
    unsigned int kbrate;
40
    std::string errormessage;
41
};
42
43
class MPDCli {
44
public:
45
    MPDCli(const std::string& host, int port = 6600, const std::string& pass="");
46
    ~MPDCli();
47
    bool ok() {return m_ok;}
48
    bool setVolume(int ivol, bool relative = false);
49
50
51
private:
52
    void *m_conn;
53
    bool m_ok;
54
    MpdStatus m_stat;
55
    int m_premutevolume;
56
    bool updStatus();
57
};
58
59
60
#endif /* _MPDCLI_H_X_INCLUDED_ */