ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/BeepRemote.cpp
(Generate patch)

Comparing:
DecentralizedMedia/BeepRemote.hpp (file contents), Revision 466 by douglas, 2005-06-07T06:07:49-07:00 vs.
DecentralizedMedia/BeepRemote.cpp (file contents), Revision 480 by douglas, 2005-06-14T20:15:18-07:00

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines