ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/BeepRemote.cpp
Revision: 464
Committed: 2005-06-07T05:40:41-07:00 (20 years ago) by douglas
Original Path: DecentralizedMedia/BeepRemote.hpp
File size: 5361 byte(s)
Log Message:
Meep!

File Contents

# Content
1 // Beep Remote
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #ifndef _BeepRemote_hpp_
8 #define _BeepRemote_hpp_
9
10 #include <bmp/beepctrl.h>
11
12 #include <string>
13 #include <vector>
14
15 class BeepRemote
16 {
17 private:
18 int session;
19 public:
20 BeepRemote(int session = 0) : session(session) {}
21 void Playlist(const std::vector<std::string>& list, bool enqueue = false)
22 {
23 char** list_(new char*[list.size()]);
24
25 for (size_t index(0); index != list.size(); ++index)
26 list_[index] = const_cast<char*>(list[index].c_str());
27
28 ::xmms_remote_playlist(session, list_, list.size(), enqueue);
29
30 delete [] list_;
31 }
32 int GetVersion() { return ::xmms_remote_get_version(session); }
33 void PlaylistAdd(const std::vector<std::string>& list)
34 {
35 ::GList* list_(NULL);
36
37 for (std::vector<std::string>::const_iterator item(list.begin()); item != list.end(); ++item)
38 list_ = ::g_list_append(list_, const_cast<char*>(item->c_str()));
39
40 ::xmms_remote_playlist_add(session, list_);
41
42 ::g_list_free(list_);
43 }
44 void PlaylistAdd(const std::string& item)
45 {
46 ::GList list = { const_cast<char*>(item.c_str()), NULL, NULL };
47
48 ::xmms_remote_playlist_add(session, &list);
49 }
50 void PlaylistDelete(int position) { ::xmms_remote_playlist_delete(session, position); }
51 void Play() { ::xmms_remote_play(session); }
52 void Pause() { ::xmms_remote_pause(session); }
53 void Stop() { ::xmms_remote_stop(session); }
54 bool IsPlaying() { return ::xmms_remote_is_playing(session); }
55 bool IsPaused() { return ::xmms_remote_is_paused(session); }
56 int GetPlaylistPosition() { return ::xmms_remote_get_playlist_pos(session); }
57 void SetPlaylistPosition(int position) { ::xmms_remote_set_playlist_pos(session, position); }
58 int GetPlaylistLength() { return ::xmms_remote_get_playlist_length(session); }
59 void PlaylistClear() { return ::xmms_remote_playlist_clear(session); }
60 int GetOutputTime() { return ::xmms_remote_get_output_time(session); }
61 void JumpToTime(int position) { ::xmms_remote_jump_to_time(session, position); }
62 void GetVolume(int& left, int& right) { ::xmms_remote_get_volume(session, &left, &right); }
63 int GetMainVolume() { return ::xmms_remote_get_main_volume(session); }
64 int GetBalance() { return ::xmms_remote_get_balance(session); }
65 void SetVolume(int left, int right) { ::xmms_remote_set_volume(session, left, right); }
66 void SetMainVolume(int volume) { ::xmms_remote_set_main_volume(session, volume); }
67 void SetBalance(int balance) { ::xmms_remote_set_balance(session, balance); }
68 std::string GetSkin() { return ::xmms_remote_get_skin(session); }
69 void SetSkin(const std::string& skin) { ::xmms_remote_set_skin(session, const_cast<char*>(skin.c_str())); }
70 std::string GetPlaylistFile(int position) { return ::xmms_remote_get_playlist_file(session, position); }
71 std::string GetPlaylistTitle(int position) { return ::xmms_remote_get_playlist_title(session, position); }
72 int GetPlaylistTime(int position) { return ::xmms_remote_get_playlist_time(session, position); }
73 void GetInfo(int& rate, int& frequency, int& channels) { ::xmms_remote_get_info(session, &rate, &frequency, &channels); }
74 void MainWindowToggle(bool show) { ::xmms_remote_main_win_toggle(session, show); }
75 void PlaylistWindowToggle(bool show) { ::xmms_remote_pl_win_toggle(session, show); }
76 void EqualizerWindowToggle(bool show) { ::xmms_remote_eq_win_toggle(session, show); }
77 bool IsMainWindow() { return ::xmms_remote_is_main_win(session); }
78 bool IsPlaylistWindow() { return ::xmms_remote_is_pl_win(session); }
79 bool IsEqualizerWindow() { return ::xmms_remote_is_eq_win(session); }
80 void ShowPreferencesBox() { ::xmms_remote_show_prefs_box(session); }
81 void ToggleAlwaysOnTop(bool always) { ::xmms_remote_toggle_aot(session, always); }
82 void Eject() { ::xmms_remote_eject(session); }
83 void PlaylistPrevious() { ::xmms_remote_playlist_prev(session); }
84 void PlaylistNext() { ::xmms_remote_playlist_next(session); }
85 void PlaylistAddUrl(const std::string& url) { ::xmms_remote_playlist_add_url_string(session, const_cast<char*>(url.c_str())); }
86 bool IsRunning() { return ::xmms_remote_is_running(session); }
87 void ToggleRepeat() { ::xmms_remote_toggle_repeat(session); }
88 void ToggleShuffle() { ::xmms_remote_toggle_shuffle(session); }
89 bool IsRepeat() { return ::xmms_remote_is_repeat(session); }
90 bool IsShuffle() { return ::xmms_remote_is_shuffle(session); }
91 void ToggleRepeat(bool repeat)
92 {
93 if (repeat != IsRepeat())
94 ToggleRepeat();
95 }
96 void ToggleShuffle(bool shuffle)
97 {
98 if (shuffle != IsShuffle())
99 ToggleShuffle();
100 }
101 void GetEqualizer(float& preamp, float*& bands) { ::xmms_remote_get_eq(session, &preamp, &bands); }
102 float GetEqualizerPreamp() { ::xmms_remote_get_eq_preamp(session); }
103 float GetEqualizerBand(int band) { ::xmms_remote_get_eq_band(session, band); }
104 void SetEqualizer(float preamp, float* bands) { ::xmms_remote_set_eq(session, preamp, bands); }
105 void SetEqualizerPreamp(float preamp) { ::xmms_remote_set_eq_preamp(session, preamp); }
106 void SetEqualizerBand(int band, float value) { ::xmms_remote_set_eq_band(session, band, value); }
107 void Quit() { ::xmms_remote_quit(session); }
108 void PlayPause() { ::xmms_remote_play_pause(session); }
109 void PlaylistInsertUrl(const std::string& url, int position) { ::xmms_remote_playlist_ins_url_string(session, const_cast<char*>(url.c_str()), position); }
110 void Activate() { ::xmms_remote_activate(session); }
111 };
112
113 #endif//_BeepRemote_hpp_

Properties

Name Value
svn:eol-style native
svn:keywords Id