Changeset 34
- Timestamp:
- 03/02/2008 17:28:19 (3 years ago)
- Files:
-
- 4 edited
-
Audacious/Audacious.cpp (modified) (8 diffs)
-
Audacious/Audacious.hpp (modified) (7 diffs)
-
Audacious/Audacious.mk (modified) (1 diff)
-
SteeringWheelRemote/SteeringWheelRemote.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Audacious/Audacious.cpp
r23 r34 5 5 // $Id$ 6 6 7 #include <audacious/beepctrl.h> 7 #include <audacious/audctrl.h> 8 #include <audacious/dbus.h> 8 9 9 10 #include "Audacious.hpp" 10 11 12 namespace Audacious 13 { 14 15 Audacious::Audacious() 16 { 17 ::g_type_init(); 18 19 ::GError *error(NULL); 20 ::DBusGConnection *connection(::dbus_g_bus_get(DBUS_BUS_SESSION, &error)); 21 22 if (connection == NULL) 23 throw Error(error); 24 25 session = ::dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE, AUDACIOUS_DBUS_PATH, AUDACIOUS_DBUS_INTERFACE); 26 } 27 11 28 void Audacious::Playlist(char **list, int size, bool enqueue) 12 29 { 13 :: xmms_remote_playlist(session, list, size, enqueue);14 } 15 16 intAudacious::GetVersion() const17 { 18 return :: xmms_remote_get_version(session);30 ::audacious_remote_playlist(session, list, size, enqueue); 31 } 32 33 std::string Audacious::GetVersion() const 34 { 35 return ::audacious_remote_get_version(session); 19 36 } 20 37 21 38 void Audacious::PlaylistAdd(::GList *list) 22 39 { 23 :: xmms_remote_playlist_add(session, list);24 } 25 26 void Audacious::PlaylistDelete( intposition)27 { 28 :: xmms_remote_playlist_delete(session, position);40 ::audacious_remote_playlist_add(session, list); 41 } 42 43 void Audacious::PlaylistDelete(unsigned position) 44 { 45 ::audacious_remote_playlist_delete(session, position); 29 46 } 30 47 31 48 void Audacious::Play() 32 49 { 33 :: xmms_remote_play(session);50 ::audacious_remote_play(session); 34 51 } 35 52 36 53 void Audacious::Pause() 37 54 { 38 :: xmms_remote_pause(session);55 ::audacious_remote_pause(session); 39 56 } 40 57 41 58 void Audacious::Stop() 42 59 { 43 :: xmms_remote_stop(session);60 ::audacious_remote_stop(session); 44 61 } 45 62 46 63 bool Audacious::IsPlaying() const 47 64 { 48 return :: xmms_remote_is_playing(session);65 return ::audacious_remote_is_playing(session); 49 66 } 50 67 51 68 bool Audacious::IsPaused() const 52 69 { 53 return :: xmms_remote_is_paused(session);70 return ::audacious_remote_is_paused(session); 54 71 } 55 72 56 73 int Audacious::GetPlaylistPosition() const 57 74 { 58 return :: xmms_remote_get_playlist_pos(session);59 } 60 61 void Audacious::SetPlaylistPosition( intposition)62 { 63 :: xmms_remote_set_playlist_pos(session, position);75 return ::audacious_remote_get_playlist_pos(session); 76 } 77 78 void Audacious::SetPlaylistPosition(unsigned position) 79 { 80 ::audacious_remote_set_playlist_pos(session, position); 64 81 } 65 82 66 83 int Audacious::GetPlaylistLength() const 67 84 { 68 return :: xmms_remote_get_playlist_length(session);85 return ::audacious_remote_get_playlist_length(session); 69 86 } 70 87 71 88 void Audacious::PlaylistClear() 72 89 { 73 return :: xmms_remote_playlist_clear(session);90 return ::audacious_remote_playlist_clear(session); 74 91 } 75 92 76 93 int Audacious::GetOutputTime() const 77 94 { 78 return :: xmms_remote_get_output_time(session);95 return ::audacious_remote_get_output_time(session); 79 96 } 80 97 81 98 void Audacious::JumpToTime(int position) 82 99 { 83 :: xmms_remote_jump_to_time(session, position);100 ::audacious_remote_jump_to_time(session, position); 84 101 } 85 102 86 103 void Audacious::GetVolume(int& left, int& right) const 87 104 { 88 :: xmms_remote_get_volume(session, &left, &right);105 ::audacious_remote_get_volume(session, &left, &right); 89 106 } 90 107 91 108 int Audacious::GetMainVolume() const 92 109 { 93 return :: xmms_remote_get_main_volume(session);110 return ::audacious_remote_get_main_volume(session); 94 111 } 95 112 96 113 int Audacious::GetBalance() const 97 114 { 98 return :: xmms_remote_get_balance(session);115 return ::audacious_remote_get_balance(session); 99 116 } 100 117 101 118 void Audacious::SetVolume(int left, int right) 102 119 { 103 :: xmms_remote_set_volume(session, left, right);120 ::audacious_remote_set_volume(session, left, right); 104 121 } 105 122 106 123 void Audacious::SetMainVolume(int volume) 107 124 { 108 :: xmms_remote_set_main_volume(session, volume);125 ::audacious_remote_set_main_volume(session, volume); 109 126 } 110 127 111 128 void Audacious::SetBalance(int balance) 112 129 { 113 :: xmms_remote_set_balance(session, balance);130 ::audacious_remote_set_balance(session, balance); 114 131 } 115 132 116 133 std::string Audacious::GetSkin() const 117 134 { 118 return :: xmms_remote_get_skin(session);135 return ::audacious_remote_get_skin(session); 119 136 } 120 137 121 138 void Audacious::SetSkin(const std::string &skin) 122 139 { 123 :: xmms_remote_set_skin(session, const_cast<char*>(skin.c_str()));140 ::audacious_remote_set_skin(session, const_cast<char*>(skin.c_str())); 124 141 } 125 142 126 143 std::string Audacious::GetPlaylistFile(int position) const 127 144 { 128 return :: xmms_remote_get_playlist_file(session, position);145 return ::audacious_remote_get_playlist_file(session, position); 129 146 } 130 147 131 148 std::string Audacious::GetPlaylistTitle(int position) const 132 149 { 133 return :: xmms_remote_get_playlist_title(session, position);150 return ::audacious_remote_get_playlist_title(session, position); 134 151 } 135 152 136 153 int Audacious::GetPlaylistTime(int position) const 137 154 { 138 return :: xmms_remote_get_playlist_time(session, position);155 return ::audacious_remote_get_playlist_time(session, position); 139 156 } 140 157 141 158 void Audacious::GetInfo(int &rate, int &frequency, int &channels) const 142 159 { 143 :: xmms_remote_get_info(session, &rate, &frequency, &channels);160 ::audacious_remote_get_info(session, &rate, &frequency, &channels); 144 161 } 145 162 146 163 void Audacious::MainWindowToggle(bool show) 147 164 { 148 :: xmms_remote_main_win_toggle(session, show);165 ::audacious_remote_main_win_toggle(session, show); 149 166 } 150 167 151 168 void Audacious::PlaylistWindowToggle(bool show) 152 169 { 153 :: xmms_remote_pl_win_toggle(session, show);170 ::audacious_remote_pl_win_toggle(session, show); 154 171 } 155 172 156 173 void Audacious::EqualizerWindowToggle(bool show) 157 174 { 158 :: xmms_remote_eq_win_toggle(session, show);175 ::audacious_remote_eq_win_toggle(session, show); 159 176 } 160 177 161 178 bool Audacious::IsMainWindow() const 162 179 { 163 return :: xmms_remote_is_main_win(session);180 return ::audacious_remote_is_main_win(session); 164 181 } 165 182 166 183 bool Audacious::IsPlaylistWindow() const 167 184 { 168 return :: xmms_remote_is_pl_win(session);185 return ::audacious_remote_is_pl_win(session); 169 186 } 170 187 171 188 bool Audacious::IsEqualizerWindow() const 172 189 { 173 return :: xmms_remote_is_eq_win(session);190 return ::audacious_remote_is_eq_win(session); 174 191 } 175 192 176 193 void Audacious::ShowPreferencesBox() 177 194 { 178 :: xmms_remote_show_prefs_box(session);195 ::audacious_remote_show_prefs_box(session); 179 196 } 180 197 181 198 void Audacious::ToggleAlwaysOnTop(bool always) 182 199 { 183 :: xmms_remote_toggle_aot(session, always);200 ::audacious_remote_toggle_aot(session, always); 184 201 } 185 202 186 203 void Audacious::Eject() 187 204 { 188 :: xmms_remote_eject(session);205 ::audacious_remote_eject(session); 189 206 } 190 207 191 208 void Audacious::PlaylistPrevious() 192 209 { 193 :: xmms_remote_playlist_prev(session);210 ::audacious_remote_playlist_prev(session); 194 211 } 195 212 196 213 void Audacious::PlaylistNext() 197 214 { 198 :: xmms_remote_playlist_next(session);215 ::audacious_remote_playlist_next(session); 199 216 } 200 217 201 218 void Audacious::PlaylistAddUrl(const std::string &url) 202 219 { 203 :: xmms_remote_playlist_add_url_string(session, const_cast<char*>(url.c_str()));220 ::audacious_remote_playlist_add_url_string(session, const_cast<char*>(url.c_str())); 204 221 } 205 222 206 223 bool Audacious::IsRunning() const 207 224 { 208 return :: xmms_remote_is_running(session);225 return ::audacious_remote_is_running(session); 209 226 } 210 227 211 228 void Audacious::ToggleRepeat() 212 229 { 213 :: xmms_remote_toggle_repeat(session);230 ::audacious_remote_toggle_repeat(session); 214 231 } 215 232 216 233 void Audacious::ToggleShuffle() 217 234 { 218 :: xmms_remote_toggle_shuffle(session);235 ::audacious_remote_toggle_shuffle(session); 219 236 } 220 237 221 238 bool Audacious::IsRepeat() const 222 239 { 223 return :: xmms_remote_is_repeat(session);240 return ::audacious_remote_is_repeat(session); 224 241 } 225 242 226 243 bool Audacious::IsShuffle() const 227 244 { 228 return :: xmms_remote_is_shuffle(session);229 } 230 231 void Audacious::GetEqualizer( float& preamp, floatbands[10]) const232 { 233 float* bands_;234 235 :: xmms_remote_get_eq(session, &preamp, &bands_);236 237 _forall (u int8_t, index, 0, 10)238 bands[index] = bands[index];245 return ::audacious_remote_is_shuffle(session); 246 } 247 248 void Audacious::GetEqualizer(double& preamp, double bands[10]) const 249 { 250 ::GArray* bands_; 251 252 ::audacious_remote_get_eq(session, &preamp, &bands_); 253 254 _forall (unsigned, index, 0, 10) 255 bands[index] = g_array_index(bands_, ::gdouble, index); 239 256 240 257 ::g_free(bands_); 241 258 } 242 259 243 float Audacious::GetEqualizerPreamp() const 244 { 245 return ::xmms_remote_get_eq_preamp(session); 246 } 247 248 float Audacious::GetEqualizerBand(int band) const 249 { 250 return ::xmms_remote_get_eq_band(session, band); 251 } 252 253 void Audacious::SetEqualizer(float preamp, float bands[10]) 254 { 255 ::xmms_remote_set_eq(session, preamp, bands); 256 } 257 258 void Audacious::SetEqualizerPreamp(float preamp) 259 { 260 ::xmms_remote_set_eq_preamp(session, preamp); 261 } 262 263 void Audacious::SetEqualizerBand(int band, float value) 264 { 265 ::xmms_remote_set_eq_band(session, band, value); 260 double Audacious::GetEqualizerPreamp() const 261 { 262 return ::audacious_remote_get_eq_preamp(session); 263 } 264 265 double Audacious::GetEqualizerBand(int band) const 266 { 267 return ::audacious_remote_get_eq_band(session, band); 268 } 269 270 void Audacious::SetEqualizer(double preamp, double bands[10]) 271 { 272 ::GArray *bands_(::g_array_sized_new(FALSE, FALSE, sizeof (::gdouble), 10)); 273 274 _forall (unsigned, index, 0, 10) 275 ::g_array_append_val(bands_, bands[index]); 276 277 ::audacious_remote_set_eq(session, preamp, bands_); 278 } 279 280 void Audacious::SetEqualizerPreamp(double preamp) 281 { 282 ::audacious_remote_set_eq_preamp(session, preamp); 283 } 284 285 void Audacious::SetEqualizerBand(int band, double value) 286 { 287 ::audacious_remote_set_eq_band(session, band, value); 266 288 } 267 289 … … 269 291 void Audacious::Quit() 270 292 { 271 :: xmms_remote_quit(session);293 ::audacious_remote_quit(session); 272 294 } 273 295 … … 275 297 void Audacious::PlayPause() 276 298 { 277 :: xmms_remote_play_pause(session);299 ::audacious_remote_play_pause(session); 278 300 } 279 301 280 302 void Audacious::PlaylistInsertUrl(const std::string &url, int position) 281 303 { 282 :: xmms_remote_playlist_ins_url_string(session, const_cast<char*>(url.c_str()), position);304 ::audacious_remote_playlist_ins_url_string(session, const_cast<char*>(url.c_str()), position); 283 305 } 284 306 … … 286 308 void Audacious::PlayqueueAdd(int position) 287 309 { 288 :: xmms_remote_playqueue_add(session, position);310 ::audacious_remote_playqueue_add(session, position); 289 311 } 290 312 291 313 void Audacious::PlayqueueRemove(int position) 292 314 { 293 :: xmms_remote_playqueue_remove(session, position);315 ::audacious_remote_playqueue_remove(session, position); 294 316 } 295 317 296 318 int Audacious::GetPlayqueueLength() const 297 319 { 298 return :: xmms_remote_get_playqueue_length(session);320 return ::audacious_remote_get_playqueue_length(session); 299 321 } 300 322 301 323 void Audacious::ToggleAdvance() 302 324 { 303 :: xmms_remote_toggle_advance(session);325 ::audacious_remote_toggle_advance(session); 304 326 } 305 327 306 328 bool Audacious::IsAdvance() const 307 329 { 308 return :: xmms_remote_is_advance(session);330 return ::audacious_remote_is_advance(session); 309 331 } 310 332 … … 312 334 void Audacious::Activate() 313 335 { 314 :: xmms_remote_activate(session);336 ::audacious_remote_activate(session); 315 337 } 316 338 … … 318 340 void Audacious::ShowJumpToFileBox() 319 341 { 320 :: xmms_remote_show_jtf_box(session);342 ::audacious_remote_show_jtf_box(session); 321 343 } 322 344 323 345 void Audacious::PlayqueueClear() 324 346 { 325 :: xmms_remote_playqueue_clear(session);347 ::audacious_remote_playqueue_clear(session); 326 348 } 327 349 328 350 bool Audacious::PlayqueueIsQueued(int position) const 329 351 { 330 return ::xmms_remote_playqueue_is_queued(session, position); 331 } 332 333 int Audacious::GetPlayqueuePosition(int position) const 334 { 335 return ::xmms_remote_get_playqueue_position(session, position); 352 return ::audacious_remote_playqueue_is_queued(session, position); 336 353 } 337 354 338 355 int Audacious::GetPlayqueueQueuePosition(int position) const 339 356 { 340 return ::xmms_remote_get_playqueue_queue_position(session, position); 341 } 342 343 // Audacious 1.2 344 void Audacious::SetSessionUri(const std::string &uri) 345 { 346 ::audacious_set_session_uri(const_cast<char *>(uri.c_str())); 347 } 348 349 std::string Audacious::GetSessionUri() const 350 { 351 return ::audacious_get_session_uri(session); 352 } 353 354 void Audacious::SetSessionType(Type type) 355 { 356 ::audacious_set_session_type(type); 357 return ::audacious_remote_get_playqueue_queue_position(session, position); 357 358 } 358 359 … … 360 361 void Audacious::PlaylistEnqueueToTemp(const std::string &string) 361 362 { 362 :: xmms_remote_playlist_enqueue_to_temp(session, const_cast<char *>(string.c_str()));363 ::audacious_remote_playlist_enqueue_to_temp(session, const_cast<char *>(string.c_str())); 363 364 } 364 365 … … 367 368 return ::audacious_get_tuple_field_data(session, const_cast<char *>(field.c_str()), position); 368 369 } 370 371 // Audacious 1.4 372 void Audacious::ShowAboutBox() 373 { 374 ::audacious_remote_show_about_box(session); 375 } 376 377 void Audacious::ToggleAboutBox(bool show) 378 { 379 ::audacious_remote_toggle_about_box(session, show); 380 } 381 382 void Audacious::ToggleJumpToFileBox(bool show) 383 { 384 ::audacious_remote_toggle_jtf_box(session, show); 385 } 386 387 void Audacious::TogglePreferencesBox(bool show) 388 { 389 ::audacious_remote_toggle_prefs_box(session, show); 390 } 391 392 void Audacious::ToggleFileBrowser(bool show) 393 { 394 ::audacious_remote_toggle_filebrowser(session, show); 395 } 396 397 void Audacious::EqualizerActivate(bool active) 398 { 399 ::audacious_remote_eq_activate(session, active); 400 } 401 402 } -
Audacious/Audacious.hpp
r23 r34 11 11 #include <string> 12 12 13 #include <dbus/dbus-glib.h> 13 14 #include <glib.h> 14 15 15 16 #include <foreach.hpp> 16 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 17 30 class Audacious 18 31 { 19 intsession;32 ::DBusGProxy *session; 20 33 public: 21 Audacious( int session = 0) : session(session) {}34 Audacious(); 22 35 23 36 template <typename Type_> … … 40 53 41 54 void Playlist(char **list, int size, bool enqueue = false); 42 intGetVersion() const;55 std::string GetVersion() const; 43 56 44 57 template <typename Type_> … … 55 68 56 69 void PlaylistAdd(::GList *list); 57 void PlaylistDelete( intposition);70 void PlaylistDelete(unsigned position); 58 71 void Play(); 59 72 void Pause(); … … 62 75 bool IsPaused() const; 63 76 int GetPlaylistPosition() const; 64 void SetPlaylistPosition( intposition);77 void SetPlaylistPosition(unsigned position); 65 78 int GetPlaylistLength() const; 66 79 void PlaylistClear(); … … 109 122 } 110 123 111 void GetEqualizer( float &preamp, floatbands[10]) const;112 floatGetEqualizerPreamp() const;113 floatGetEqualizerBand(int band) const;114 void SetEqualizer( float preamp, floatbands[10]);115 void SetEqualizerPreamp( floatpreamp);116 void SetEqualizerBand(int band, floatvalue);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); 117 130 118 131 // XMMS 1.2.1 … … 143 156 void PlayqueueClear(); 144 157 bool PlayqueueIsQueued(int position) const; 145 int GetPlayqueuePosition(int position) const;146 158 int GetPlayqueueQueuePosition(int position) const; 147 148 // Audacious 1.2149 void SetSessionUri(const std::string &uri);150 std::string GetSessionUri() const;151 152 enum Type { Unix, Tcp };153 154 void SetSessionType(Type type);155 159 156 160 // Audacious 1.3 157 161 void PlaylistEnqueueToTemp(const std::string &string); 158 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); 159 171 }; 160 172 … … 167 179 } 168 180 181 } 182 169 183 #endif//_Audacious_hpp_ -
Audacious/Audacious.mk
r23 r34 5 5 # $Id$ 6 6 7 CPPFLAGS += -I$(audacious) $(shell pkg-config --cflags-only-I audacious )8 CFLAGS += $(shell pkg-config --cflags-only-other audacious )9 LDFLAGS += -L$(audacious) $(shell pkg-config --libs-only-L audacious ) $(shell pkg-config --libs-only-other audacious)10 LDLIBS += -lAudacious $(shell pkg-config --libs-only-l audacious )7 CPPFLAGS += -I$(audacious) $(shell pkg-config --cflags-only-I audacious dbus-glib-1) 8 CFLAGS += $(shell pkg-config --cflags-only-other audacious dbus-glib-1) 9 LDFLAGS += -L$(audacious) $(shell pkg-config --libs-only-L audacious dbus-glib-1) $(shell pkg-config --libs-only-other audacious dbus-glib-1) 10 LDLIBS += -lAudacious $(shell pkg-config --libs-only-l audacious dbus-glib-1) -
SteeringWheelRemote/SteeringWheelRemote.cpp
r26 r34 140 140 uint8_t bytes[8]; 141 141 Buttons buttons; 142 Audacious audacious;142 Audacious::Audacious audacious; 143 143 144 144 _forever
Note: See TracChangeset
for help on using the changeset viewer.
