7 |
|
#ifndef _BeepRemote_hpp_ |
8 |
|
#define _BeepRemote_hpp_ |
9 |
|
|
10 |
< |
#include <bmp/beepctrl.h> |
10 |
> |
#include <menes/platform.hpp> |
11 |
> |
|
12 |
> |
#ifdef MENES_PRAGMA_ONCE |
13 |
> |
#pragma once |
14 |
> |
#endif |
15 |
|
|
16 |
< |
#include <string> |
17 |
< |
#include <vector> |
16 |
> |
#include <menes-ext/string.hpp> |
17 |
> |
|
18 |
> |
#include <bmp/beepctrl.h> |
19 |
|
|
20 |
|
class BeepRemote |
21 |
|
{ |
23 |
|
int session; |
24 |
|
public: |
25 |
|
BeepRemote(int session = 0) : session(session) {} |
26 |
< |
void Playlist(const std::vector<std::string>& list, bool enqueue = false) |
26 |
> |
void Playlist(const _L<ext::String>& list, bool enqueue = false) |
27 |
|
{ |
28 |
< |
char** list_(new char*[list.size()]); |
28 |
> |
char** list_(new char*[list.GetSize()]); |
29 |
|
|
30 |
< |
for (size_t index(0); index != list.size(); ++index) |
31 |
< |
list_[index] = const_cast<char*>(list[index].c_str()); |
30 |
> |
_foreach (const _L<ext::String>, item, list) |
31 |
> |
list_[_index] = const_cast<char*>(item->NullTerminate()); |
32 |
|
|
33 |
< |
::xmms_remote_playlist(session, list_, list.size(), enqueue); |
33 |
> |
::xmms_remote_playlist(session, list_, list.GetSize(), enqueue); |
34 |
|
|
35 |
|
delete [] list_; |
36 |
|
} |
37 |
|
int GetVersion() { return ::xmms_remote_get_version(session); } |
38 |
< |
void PlaylistAdd(const std::vector<std::string>& list) |
38 |
> |
void PlaylistAdd(const _L<ext::String>& list) |
39 |
|
{ |
40 |
|
::GList* list_(NULL); |
41 |
|
|
42 |
< |
for (std::vector<std::string>::const_iterator item(list.begin()); item != list.end(); ++item) |
43 |
< |
list_ = ::g_list_append(list_, const_cast<char*>(item->c_str())); |
42 |
> |
_foreach (const _L<ext::String>, item, list) |
43 |
> |
list_ = ::g_list_append(list_, const_cast<char*>(item->NullTerminate())); |
44 |
|
|
45 |
|
::xmms_remote_playlist_add(session, list_); |
46 |
|
::g_list_free(list_); |
47 |
|
} |
48 |
< |
void PlaylistAdd(const std::string& item) |
48 |
> |
void PlaylistAdd(const ext::String& item) |
49 |
|
{ |
50 |
< |
::GList list = { const_cast<char*>(item.c_str()), NULL, NULL }; |
50 |
> |
::GList list = { const_cast<char*>(item.NullTerminate()), NULL, NULL }; |
51 |
|
|
52 |
|
::xmms_remote_playlist_add(session, &list); |
53 |
|
} |
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 |
< |
std::string GetSkin() { return ::xmms_remote_get_skin(session); } |
73 |
< |
void SetSkin(const std::string& skin) { ::xmms_remote_set_skin(session, const_cast<char*>(skin.c_str())); } |
74 |
< |
std::string GetPlaylistFile(int position) { return ::xmms_remote_get_playlist_file(session, position); } |
75 |
< |
std::string GetPlaylistTitle(int position) { return ::xmms_remote_get_playlist_title(session, position); } |
72 |
> |
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 |
|
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); } |
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 std::string& url) { ::xmms_remote_playlist_add_url_string(session, const_cast<char*>(url.c_str())); } |
89 |
> |
void PlaylistAddUrl(const ext::String& url) { ::xmms_remote_playlist_add_url_string(session, const_cast<char*>(url.NullTerminate())); } |
90 |
|
bool IsRunning() { return ::xmms_remote_is_running(session); } |
91 |
|
void ToggleRepeat() { ::xmms_remote_toggle_repeat(session); } |
92 |
|
void ToggleShuffle() { ::xmms_remote_toggle_shuffle(session); } |
110 |
|
g_memmove(bands_, bands, sizeof (bands)); |
111 |
|
::g_free(bands_); |
112 |
|
} |
113 |
< |
float GetEqualizerPreamp() { ::xmms_remote_get_eq_preamp(session); } |
114 |
< |
float GetEqualizerBand(int band) { ::xmms_remote_get_eq_band(session, band); } |
113 |
> |
float GetEqualizerPreamp() { return ::xmms_remote_get_eq_preamp(session); } |
114 |
> |
float GetEqualizerBand(int band) { return ::xmms_remote_get_eq_band(session, band); } |
115 |
|
void SetEqualizer(float preamp, float bands[10]) { ::xmms_remote_set_eq(session, preamp, bands); } |
116 |
|
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 |
< |
void PlaylistInsertUrl(const std::string& url, int position) { ::xmms_remote_playlist_ins_url_string(session, const_cast<char*>(url.c_str()), position); } |
120 |
> |
void PlaylistInsertUrl(const ext::String& url, int position) { ::xmms_remote_playlist_ins_url_string(session, const_cast<char*>(url.NullTerminate()), position); } |
121 |
|
void Activate() { ::xmms_remote_activate(session); } |
122 |
|
}; |
123 |
|
|