1 |
// Beep Remote |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _Audacious_hpp_ |
8 |
#define _Audacious_hpp_ |
9 |
|
10 |
#include <cxx/platform.hpp> |
11 |
|
12 |
#ifdef MENES_PRAGMA_ONCE |
13 |
#pragma once |
14 |
#endif |
15 |
|
16 |
#include <stdlib.h> |
17 |
#include <glib.h> |
18 |
|
19 |
class Audacious |
20 |
{ |
21 |
int session; |
22 |
public: |
23 |
Audacious(int session = 0) : session(session) {} |
24 |
|
25 |
template <typename Type_> |
26 |
inline void Playlist(const Type_ &list, bool enqueue = false) |
27 |
{ |
28 |
char **list_(NULL); |
29 |
int size(0); |
30 |
|
31 |
_tforeach (const Type_, item, list) |
32 |
{ |
33 |
list_ = list_ ? ::realloc(list_, ++size) : ::malloc(++size); |
34 |
list_[_index] = const_cast<char *>(item->NullTerminate()); |
35 |
} |
36 |
|
37 |
Playlist(list_, size, enqueue); |
38 |
|
39 |
if (list_) |
40 |
::free(list_); |
41 |
} |
42 |
|
43 |
void Playlist(char **list, int size, bool enqueue = false); |
44 |
int GetVersion() const; |
45 |
|
46 |
template <typename Type_> |
47 |
inline void PlaylistAdd(const Type_ &list) |
48 |
{ |
49 |
::GList *list_(NULL); |
50 |
|
51 |
_tforeach (const Type_, item, list) |
52 |
list_ = ::g_list_append(list_, const_cast<char *>(item->NullTerminate())); |
53 |
|
54 |
PlaylistAdd(list_); |
55 |
::g_list_free(list_); |
56 |
} |
57 |
|
58 |
void PlaylistAdd(::GList *list); |
59 |
void PlaylistDelete(int position); |
60 |
void Play(); |
61 |
void Pause(); |
62 |
void Stop(); |
63 |
bool IsPlaying() const; |
64 |
bool IsPaused() const; |
65 |
int GetPlaylistPosition() const; |
66 |
void SetPlaylistPosition(int position); |
67 |
int GetPlaylistLength() const; |
68 |
void PlaylistClear(); |
69 |
int GetOutputTime() const; |
70 |
void JumpToTime(int position); |
71 |
void GetVolume(int &left, int &right) const; |
72 |
int GetMainVolume() const; |
73 |
int GetBalance() const; |
74 |
void SetVolume(int left, int right); |
75 |
void SetMainVolume(int volume); |
76 |
void SetBalance(int balance); |
77 |
cse::String GetSkin() const; |
78 |
void SetSkin(const cse::String &skin); |
79 |
cse::String GetPlaylistFile(int position) const; |
80 |
cse::String GetPlaylistTitle(int position) const; |
81 |
int GetPlaylistTime(int position) const; |
82 |
void GetInfo(int &rate, int &frequency, int &channels) const; |
83 |
void MainWindowToggle(bool show); |
84 |
void PlaylistWindowToggle(bool show); |
85 |
void EqualizerWindowToggle(bool show); |
86 |
bool IsMainWindow() const; |
87 |
bool IsPlaylistWindow() const; |
88 |
bool IsEqualizerWindow() const; |
89 |
void ShowPreferencesBox(); |
90 |
void ToggleAlwaysOnTop(bool always); |
91 |
void Eject(); |
92 |
void PlaylistPrevious(); |
93 |
void PlaylistNext(); |
94 |
void PlaylistAddUrl(const cse::String &url); |
95 |
bool IsRunning() const; |
96 |
void ToggleRepeat(); |
97 |
void ToggleShuffle(); |
98 |
bool IsRepeat() const; |
99 |
bool IsShuffle() const; |
100 |
|
101 |
inline void ToggleRepeat(bool repeat) |
102 |
{ |
103 |
if (repeat != IsRepeat()) |
104 |
ToggleRepeat(); |
105 |
} |
106 |
|
107 |
inline void ToggleShuffle(bool shuffle) |
108 |
{ |
109 |
if (shuffle != IsShuffle()) |
110 |
ToggleShuffle(); |
111 |
} |
112 |
|
113 |
void GetEqualizer(float &preamp, float bands[10]) const; |
114 |
float GetEqualizerPreamp() const; |
115 |
float GetEqualizerBand(int band) const; |
116 |
void SetEqualizer(float preamp, float bands[10]); |
117 |
void SetEqualizerPreamp(float preamp); |
118 |
void SetEqualizerBand(int band, float value); |
119 |
|
120 |
// XMMS 1.2.1 |
121 |
void Quit(); |
122 |
|
123 |
// XMMS 1.2.6 |
124 |
void PlayPause(); |
125 |
void PlaylistInsertUrl(const cse::String &url, int position); |
126 |
|
127 |
// XMMS 1.2.11 |
128 |
void PlayqueueAdd(int position); |
129 |
void PlayqueueRemove(int position); |
130 |
int GetPlayqueueLength() const; |
131 |
void ToggleAdvance(); |
132 |
bool IsAdvance() const; |
133 |
|
134 |
inline void ToggleAdvance(bool advance) |
135 |
{ |
136 |
if (advance != IsAdvance()) |
137 |
ToggleAdvance(); |
138 |
} |
139 |
|
140 |
// BMP 0.9.7 |
141 |
void Activate(); |
142 |
|
143 |
// Audacious 1.1 |
144 |
void ShowJumpToFileBox(); |
145 |
void PlayqueueClear(); |
146 |
bool PlayqueueIsQueued(int position) const; |
147 |
int GetPlayqueuePosition(int position) const; |
148 |
int GetPlayqueueQueuePosition(int position) const; |
149 |
|
150 |
// Audacious 1.2 |
151 |
void SetSessionUri(const cse::String &uri); |
152 |
cse::String GetSessionUri() const; |
153 |
|
154 |
enum Type { Unix, Tcp }; |
155 |
|
156 |
void SetSessionType(Type type); |
157 |
|
158 |
// Audacious 1.3 |
159 |
void PlaylistEnqueueToTemp(const cse::String &string); |
160 |
cse::String GetTupleFieldData(const cse::String &field, int position); |
161 |
}; |
162 |
|
163 |
template <> |
164 |
inline void Audacious::PlaylistAdd(const cse::String &item) |
165 |
{ |
166 |
::GList list = { const_cast<char *>(item.NullTerminate()), NULL, NULL }; |
167 |
|
168 |
PlaylistAdd(&list); |
169 |
} |
170 |
|
171 |
#endif//_Audacious_hpp_ |