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 |
|
|
#include <menes-ext/string.hpp> |
17 |
|
|
|
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 |
468 |
void Playlist(const _L<ext::String>& list, bool enqueue = false) |
27 |
douglas |
464 |
{ |
28 |
douglas |
468 |
char** list_(new char*[list.GetSize()]); |
29 |
douglas |
464 |
|
30 |
douglas |
468 |
_foreach (const _L<ext::String>, item, list) |
31 |
|
|
list_[_index] = const_cast<char*>(item->NullTerminate()); |
32 |
douglas |
464 |
|
33 |
douglas |
468 |
::xmms_remote_playlist(session, list_, list.GetSize(), enqueue); |
34 |
douglas |
464 |
|
35 |
|
|
delete [] list_; |
36 |
|
|
} |
37 |
|
|
int GetVersion() { return ::xmms_remote_get_version(session); } |
38 |
douglas |
468 |
void PlaylistAdd(const _L<ext::String>& list) |
39 |
douglas |
464 |
{ |
40 |
|
|
::GList* list_(NULL); |
41 |
|
|
|
42 |
douglas |
468 |
_foreach (const _L<ext::String>, item, list) |
43 |
|
|
list_ = ::g_list_append(list_, const_cast<char*>(item->NullTerminate())); |
44 |
douglas |
464 |
|
45 |
|
|
::xmms_remote_playlist_add(session, list_); |
46 |
|
|
::g_list_free(list_); |
47 |
|
|
} |
48 |
douglas |
468 |
void PlaylistAdd(const ext::String& item) |
49 |
douglas |
464 |
{ |
50 |
douglas |
468 |
::GList list = { const_cast<char*>(item.NullTerminate()), NULL, NULL }; |
51 |
douglas |
464 |
|
52 |
|
|
::xmms_remote_playlist_add(session, &list); |
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() { return ::xmms_remote_is_playing(session); } |
59 |
|
|
bool IsPaused() { return ::xmms_remote_is_paused(session); } |
60 |
|
|
int GetPlaylistPosition() { return ::xmms_remote_get_playlist_pos(session); } |
61 |
|
|
void SetPlaylistPosition(int position) { ::xmms_remote_set_playlist_pos(session, position); } |
62 |
|
|
int GetPlaylistLength() { return ::xmms_remote_get_playlist_length(session); } |
63 |
|
|
void PlaylistClear() { return ::xmms_remote_playlist_clear(session); } |
64 |
|
|
int GetOutputTime() { 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) { ::xmms_remote_get_volume(session, &left, &right); } |
67 |
|
|
int GetMainVolume() { return ::xmms_remote_get_main_volume(session); } |
68 |
|
|
int GetBalance() { 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 |
douglas |
468 |
ext::String GetSkin() { return ::xmms_remote_get_skin(session); } |
73 |
|
|
void SetSkin(const ext::String& skin) { ::xmms_remote_set_skin(session, const_cast<char*>(skin.NullTerminate())); } |
74 |
|
|
ext::String GetPlaylistFile(int position) { return ::xmms_remote_get_playlist_file(session, position); } |
75 |
|
|
ext::String GetPlaylistTitle(int position) { return ::xmms_remote_get_playlist_title(session, position); } |
76 |
douglas |
464 |
int GetPlaylistTime(int position) { return ::xmms_remote_get_playlist_time(session, position); } |
77 |
|
|
void GetInfo(int& rate, int& frequency, int& channels) { ::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() { return ::xmms_remote_is_main_win(session); } |
82 |
|
|
bool IsPlaylistWindow() { return ::xmms_remote_is_pl_win(session); } |
83 |
|
|
bool IsEqualizerWindow() { 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 |
douglas |
468 |
void PlaylistAddUrl(const ext::String& url) { ::xmms_remote_playlist_add_url_string(session, const_cast<char*>(url.NullTerminate())); } |
90 |
douglas |
464 |
bool IsRunning() { 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() { return ::xmms_remote_is_repeat(session); } |
94 |
|
|
bool IsShuffle() { return ::xmms_remote_is_shuffle(session); } |
95 |
|
|
void ToggleRepeat(bool repeat) |
96 |
|
|
{ |
97 |
|
|
if (repeat != IsRepeat()) |
98 |
|
|
ToggleRepeat(); |
99 |
|
|
} |
100 |
|
|
void ToggleShuffle(bool shuffle) |
101 |
|
|
{ |
102 |
|
|
if (shuffle != IsShuffle()) |
103 |
|
|
ToggleShuffle(); |
104 |
|
|
} |
105 |
douglas |
466 |
void GetEqualizer(float& preamp, float bands[10]) |
106 |
|
|
{ |
107 |
|
|
float* bands_; |
108 |
|
|
|
109 |
|
|
::xmms_remote_get_eq(session, &preamp, &bands_); |
110 |
douglas |
469 |
ext::CopyAssign(bands, bands_, 10); |
111 |
douglas |
466 |
::g_free(bands_); |
112 |
|
|
} |
113 |
douglas |
468 |
float GetEqualizerPreamp() { return ::xmms_remote_get_eq_preamp(session); } |
114 |
|
|
float GetEqualizerBand(int band) { return ::xmms_remote_get_eq_band(session, band); } |
115 |
douglas |
466 |
void SetEqualizer(float preamp, float bands[10]) { ::xmms_remote_set_eq(session, preamp, bands); } |
116 |
douglas |
464 |
void SetEqualizerPreamp(float preamp) { ::xmms_remote_set_eq_preamp(session, preamp); } |
117 |
|
|
void SetEqualizerBand(int band, float value) { ::xmms_remote_set_eq_band(session, band, value); } |
118 |
|
|
void Quit() { ::xmms_remote_quit(session); } |
119 |
|
|
void PlayPause() { ::xmms_remote_play_pause(session); } |
120 |
douglas |
468 |
void PlaylistInsertUrl(const ext::String& url, int position) { ::xmms_remote_playlist_ins_url_string(session, const_cast<char*>(url.NullTerminate()), position); } |
121 |
douglas |
464 |
void Activate() { ::xmms_remote_activate(session); } |
122 |
|
|
}; |
123 |
|
|
|
124 |
|
|
#endif//_BeepRemote_hpp_ |