ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/BeepRemote.hpp
Revision: 534
Committed: 2005-06-29T23:01:02-07:00 (19 years, 11 months ago) by douglas
File size: 5428 byte(s)
Log Message:
So long ext::String, we'll miss you, but not much we really still have you as cse::String. Also, other stuff.

File Contents

# User Rev Content
1 douglas 464 // Beep Remote
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #ifndef _BeepRemote_hpp_
8     #define _BeepRemote_hpp_
9    
10 douglas 468 #include <menes/platform.hpp>
11    
12     #ifdef MENES_PRAGMA_ONCE
13     #pragma once
14     #endif
15    
16 douglas 534 #include <menes-cse/string.hpp>
17 douglas 468
18 douglas 464 #include <bmp/beepctrl.h>
19    
20     class BeepRemote
21     {
22     private:
23     int session;
24     public:
25     BeepRemote(int session = 0) : session(session) {}
26 douglas 480
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 douglas 478 int GetVersion() const { return ::xmms_remote_get_version(session); }
41 douglas 480
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 douglas 464 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 douglas 478 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 douglas 464 void SetPlaylistPosition(int position) { ::xmms_remote_set_playlist_pos(session, position); }
62 douglas 478 int GetPlaylistLength() const { return ::xmms_remote_get_playlist_length(session); }
63 douglas 464 void PlaylistClear() { return ::xmms_remote_playlist_clear(session); }
64 douglas 478 int GetOutputTime() const { return ::xmms_remote_get_output_time(session); }
65 douglas 464 void JumpToTime(int position) { ::xmms_remote_jump_to_time(session, position); }
66 douglas 478 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 douglas 464 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 douglas 534 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 douglas 478 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 douglas 464 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 douglas 478 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 douglas 464 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 douglas 534 void PlaylistAddUrl(const cse::String& url) { ::xmms_remote_playlist_add_url_string(session, const_cast<char*>(url.NullTerminate())); }
90 douglas 478 bool IsRunning() const { return ::xmms_remote_is_running(session); }
91 douglas 464 void ToggleRepeat() { ::xmms_remote_toggle_repeat(session); }
92     void ToggleShuffle() { ::xmms_remote_toggle_shuffle(session); }
93 douglas 478 bool IsRepeat() const { return ::xmms_remote_is_repeat(session); }
94     bool IsShuffle() const { return ::xmms_remote_is_shuffle(session); }
95 douglas 480
96 douglas 464 void ToggleRepeat(bool repeat)
97     {
98     if (repeat != IsRepeat())
99     ToggleRepeat();
100     }
101 douglas 480
102 douglas 464 void ToggleShuffle(bool shuffle)
103     {
104     if (shuffle != IsShuffle())
105     ToggleShuffle();
106     }
107 douglas 480
108 douglas 478 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 douglas 466 void SetEqualizer(float preamp, float bands[10]) { ::xmms_remote_set_eq(session, preamp, bands); }
112 douglas 464 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 douglas 534 void PlaylistInsertUrl(const cse::String& url, int position) { ::xmms_remote_playlist_ins_url_string(session, const_cast<char*>(url.NullTerminate()), position); }
117 douglas 464 void Activate() { ::xmms_remote_activate(session); }
118     };
119    
120 douglas 480 template <>
121 douglas 534 void BeepRemote::PlaylistAdd(const cse::String& item);
122 douglas 480
123 douglas 464 #endif//_BeepRemote_hpp_

Properties

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