ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/BeepRemote.hpp
Revision: 560
Committed: 2005-08-27T17:38:18-07:00 (19 years, 9 months ago) by douglas
File size: 5420 byte(s)
Log Message:
Hmm, no worky yet.

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

Properties

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