4 |
|
// |
5 |
|
// $Id$ |
6 |
|
|
7 |
< |
#ifndef _BeepRemote_hpp_ |
8 |
< |
#define _BeepRemote_hpp_ |
7 |
> |
#include <menes/standard.hh> |
8 |
|
|
9 |
< |
#include <menes/platform.hpp> |
9 |
> |
#include "BeepRemote.hpp" |
10 |
|
|
11 |
< |
#ifdef MENES_PRAGMA_ONCE |
12 |
< |
#pragma once |
13 |
< |
#endif |
11 |
> |
void BeepRemote::Playlist(const _L<ext::String>& list, bool enqueue) |
12 |
> |
{ |
13 |
> |
char** list_(new char*[list.GetSize()]); |
14 |
> |
|
15 |
> |
_foreach (const _L<ext::String>, item, list) |
16 |
> |
list_[_index] = const_cast<char*>(item->NullTerminate()); |
17 |
> |
|
18 |
> |
::xmms_remote_playlist(session, list_, list.GetSize(), enqueue); |
19 |
|
|
20 |
< |
#include <menes-ext/string.hpp> |
20 |
> |
delete [] list_; |
21 |
> |
} |
22 |
> |
|
23 |
> |
void BeepRemote::PlaylistAdd(const _L<ext::String>& list) |
24 |
> |
{ |
25 |
> |
::GList* list_(NULL); |
26 |
> |
|
27 |
> |
_foreach (const _L<ext::String>, item, list) |
28 |
> |
list_ = ::g_list_append(list_, const_cast<char*>(item->NullTerminate())); |
29 |
> |
|
30 |
> |
::xmms_remote_playlist_add(session, list_); |
31 |
> |
::g_list_free(list_); |
32 |
> |
} |
33 |
> |
|
34 |
> |
void BeepRemote::PlaylistAdd(const ext::String& item) |
35 |
> |
{ |
36 |
> |
::GList list = { const_cast<char*>(item.NullTerminate()), NULL, NULL }; |
37 |
|
|
38 |
< |
#include <bmp/beepctrl.h> |
38 |
> |
::xmms_remote_playlist_add(session, &list); |
39 |
> |
} |
40 |
|
|
41 |
< |
class BeepRemote |
41 |
> |
void BeepRemote::GetEqualizer(float& preamp, float bands[10]) |
42 |
|
{ |
43 |
< |
private: |
23 |
< |
int session; |
24 |
< |
public: |
25 |
< |
BeepRemote(int session = 0) : session(session) {} |
26 |
< |
void Playlist(const _L<ext::String>& list, bool enqueue = false) |
27 |
< |
{ |
28 |
< |
char** list_(new char*[list.GetSize()]); |
29 |
< |
|
30 |
< |
_foreach (const _L<ext::String>, item, list) |
31 |
< |
list_[_index] = const_cast<char*>(item->NullTerminate()); |
32 |
< |
|
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 _L<ext::String>& list) |
39 |
< |
{ |
40 |
< |
::GList* list_(NULL); |
41 |
< |
|
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 ext::String& item) |
49 |
< |
{ |
50 |
< |
::GList list = { const_cast<char*>(item.NullTerminate()), NULL, NULL }; |
51 |
< |
|
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 |
< |
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); } |
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 |
< |
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); } |
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 |
< |
void GetEqualizer(float& preamp, float bands[10]) |
106 |
< |
{ |
107 |
< |
float* bands_; |
108 |
< |
|
109 |
< |
::xmms_remote_get_eq(session, &preamp, &bands_); |
110 |
< |
ext::CopyAssign(bands, bands_, 10); |
111 |
< |
::g_free(bands_); |
112 |
< |
} |
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 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 |
< |
}; |
43 |
> |
float* bands_; |
44 |
|
|
45 |
< |
#endif//_BeepRemote_hpp_ |
45 |
> |
::xmms_remote_get_eq(session, &preamp, &bands_); |
46 |
> |
ext::CopyAssign(bands, bands_, 10); |
47 |
> |
::g_free(bands_); |
48 |
> |
} |