1 |
< |
// Beep Remote |
1 |
> |
// Audacious |
2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
10 |
|
#include <cstdlib> |
11 |
|
#include <string> |
12 |
|
|
13 |
+ |
#include <dbus/dbus-glib.h> |
14 |
|
#include <glib.h> |
15 |
|
|
16 |
|
#include <foreach.hpp> |
17 |
|
|
18 |
+ |
namespace Audacious |
19 |
+ |
{ |
20 |
+ |
|
21 |
+ |
class Error : public std::exception |
22 |
+ |
{ |
23 |
+ |
::GError *error; |
24 |
+ |
public: |
25 |
+ |
Error(::GError *error) : error(error) {} |
26 |
+ |
virtual ~Error() throw() { ::g_error_free(error); } |
27 |
+ |
virtual const char *what() const throw() { return error->message; } |
28 |
+ |
}; |
29 |
+ |
|
30 |
|
class Audacious |
31 |
|
{ |
32 |
< |
int session; |
32 |
> |
::DBusGProxy *session; |
33 |
|
public: |
34 |
< |
Audacious(int session = 0) : session(session) {} |
34 |
> |
Audacious(); |
35 |
|
|
36 |
|
template <typename Type_> |
37 |
< |
void Playlist(const Type_ &list, bool enqueue = false) |
37 |
> |
inline void Playlist(const Type_ &list, bool enqueue = false) |
38 |
|
{ |
39 |
|
char **list_(NULL); |
40 |
|
int size(0); |
52 |
|
} |
53 |
|
|
54 |
|
void Playlist(char **list, int size, bool enqueue = false); |
55 |
< |
int GetVersion() const; |
55 |
> |
std::string GetVersion() const; |
56 |
|
|
57 |
|
template <typename Type_> |
58 |
< |
void PlaylistAdd(const Type_ &list) |
58 |
> |
inline void PlaylistAdd(const Type_ &list) |
59 |
|
{ |
60 |
|
::GList *list_(NULL); |
61 |
|
|
67 |
|
} |
68 |
|
|
69 |
|
void PlaylistAdd(::GList *list); |
70 |
< |
void PlaylistDelete(int position); |
70 |
> |
void PlaylistDelete(unsigned position); |
71 |
|
void Play(); |
72 |
|
void Pause(); |
73 |
|
void Stop(); |
74 |
|
bool IsPlaying() const; |
75 |
|
bool IsPaused() const; |
76 |
|
int GetPlaylistPosition() const; |
77 |
< |
void SetPlaylistPosition(int position); |
77 |
> |
void SetPlaylistPosition(unsigned position); |
78 |
|
int GetPlaylistLength() const; |
79 |
|
void PlaylistClear(); |
80 |
|
int GetOutputTime() const; |
81 |
|
void JumpToTime(int position); |
82 |
< |
int GetVolume(int &left, int &right) const; |
82 |
> |
void GetVolume(int &left, int &right) const; |
83 |
|
int GetMainVolume() const; |
84 |
|
int GetBalance() const; |
85 |
|
void SetVolume(int left, int right); |
86 |
|
void SetMainVolume(int volume); |
87 |
|
void SetBalance(int balance); |
88 |
|
std::string GetSkin() const; |
89 |
< |
void SetSkin(std::string &skin); |
89 |
> |
void SetSkin(const std::string &skin); |
90 |
|
std::string GetPlaylistFile(int position) const; |
91 |
|
std::string GetPlaylistTitle(int position) const; |
92 |
|
int GetPlaylistTime(int position) const; |
121 |
|
ToggleShuffle(); |
122 |
|
} |
123 |
|
|
124 |
< |
void GetEqualizer(float &preamp, float bands[10]) const; |
125 |
< |
float GetEqualizerPreamp() const; |
126 |
< |
float GetEqualizerBand(int band) const; |
127 |
< |
void SetEqualizer(float preamp, float bands[10]); |
128 |
< |
void SetEqualizerPreamp(float preamp); |
129 |
< |
void SetEqualizerBand(int band, float value); |
124 |
> |
void GetEqualizer(double &preamp, double bands[10]) const; |
125 |
> |
double GetEqualizerPreamp() const; |
126 |
> |
double GetEqualizerBand(int band) const; |
127 |
> |
void SetEqualizer(double preamp, double bands[10]); |
128 |
> |
void SetEqualizerPreamp(double preamp); |
129 |
> |
void SetEqualizerBand(int band, double value); |
130 |
|
|
131 |
|
// XMMS 1.2.1 |
132 |
|
void Quit(); |
138 |
|
// XMMS 1.2.11 |
139 |
|
void PlayqueueAdd(int position); |
140 |
|
void PlayqueueRemove(int position); |
141 |
< |
int GetPlayqueueLength(int session) const; |
141 |
> |
int GetPlayqueueLength() const; |
142 |
|
void ToggleAdvance(); |
143 |
< |
bool IsAdvance(); |
143 |
> |
bool IsAdvance() const; |
144 |
|
|
145 |
|
inline void ToggleAdvance(bool advance) |
146 |
|
{ |
155 |
|
void ShowJumpToFileBox(); |
156 |
|
void PlayqueueClear(); |
157 |
|
bool PlayqueueIsQueued(int position) const; |
145 |
– |
int GetPlayqueuePosition(int position) const; |
158 |
|
int GetPlayqueueQueuePosition(int position) const; |
159 |
|
|
148 |
– |
// Audacious 1.2 |
149 |
– |
void SetSessionUri(const std::string &uri); |
150 |
– |
std::string GetSessionUri() const; |
151 |
– |
|
152 |
– |
enum Type { Unix, Tcp }; |
153 |
– |
|
154 |
– |
void SetSessionType(Type type); |
155 |
– |
|
160 |
|
// Audacious 1.3 |
161 |
|
void PlaylistEnqueueToTemp(const std::string &string); |
162 |
|
std::string GetTupleFieldData(const std::string &field, int position); |
163 |
+ |
|
164 |
+ |
// Audacious 1.4 |
165 |
+ |
void ShowAboutBox(); |
166 |
+ |
void ToggleAboutBox(bool show); |
167 |
+ |
void ToggleJumpToFileBox(bool show); |
168 |
+ |
void TogglePreferencesBox(bool show); |
169 |
+ |
void ToggleFileBrowser(bool show); |
170 |
+ |
void EqualizerActivate(bool active); |
171 |
|
}; |
172 |
|
|
173 |
|
template <> |
174 |
< |
void Audacious::PlaylistAdd(const std::string &item); |
174 |
> |
inline void Audacious::PlaylistAdd(const std::string &item) |
175 |
> |
{ |
176 |
> |
::GList list = { const_cast<char *>(item.c_str()), NULL, NULL }; |
177 |
> |
|
178 |
> |
PlaylistAdd(&list); |
179 |
> |
} |
180 |
> |
|
181 |
> |
} |
182 |
|
|
183 |
|
#endif//_Audacious_hpp_ |