ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/Audacious/Audacious.hpp
(Generate patch)

Comparing:
SteeringWheelRemote/Audacious.hpp (file contents), Revision 12 by douglas, 2007-05-13T04:38:16-07:00 vs.
Audacious/Audacious.hpp (file contents), Revision 44 by douglas, 2008-03-06T15:21:03-08:00

# Line 1 | Line 1
1 < // Beep Remote
1 > // Audacious
2   //
3   // Douglas Thrift
4   //
# Line 7 | Line 7
7   #ifndef _Audacious_hpp_
8   #define _Audacious_hpp_
9  
10 < #include <cxx/platform.hpp>
10 > #include <cstdlib>
11 > #include <string>
12  
13 < #ifdef MENES_PRAGMA_ONCE
13 < #pragma once
14 < #endif
15 <
16 < #include <stdlib.h>
13 > #include <dbus/dbus-glib.h>
14   #include <glib.h>
15  
16 + #include <foreach.hpp>
17 +
18 + namespace Audacious
19 + {
20 +
21 + class Error : public std::exception
22 + {
23 +        ::GError *error;
24 + public:
25 +        Error(::GError *error) : error(error) {}
26 +        virtual ~Error() throw() { ::g_error_free(error); }
27 +        virtual const char *what() const throw() { return error->message; }
28 + };
29 +
30   class Audacious
31   {
32 <        int session;
32 >        ::DBusGProxy *session;
33   public:
34 <        Audacious(int session = 0) : session(session) {}
34 >        Audacious();
35  
36          template <typename Type_>
37          inline void Playlist(const Type_ &list, bool enqueue = false)
# Line 30 | Line 41 | public:
41  
42                  _tforeach (const Type_, item, list)
43                  {
44 <                        list_ = list_ ? ::realloc(list_, ++size) : ::malloc(++size);
45 <                        list_[_index] = const_cast<char *>(item->NullTerminate());
44 >                        list_ = list_ ? std::realloc(list_, ++size) : std::malloc(++size);
45 >                        list_[_index] = const_cast<char *>(item->c_str());
46                  }
47  
48                  Playlist(list_, size, enqueue);
49  
50                  if (list_)
51 <                        ::free(list_);
51 >                        std::free(list_);
52          }
53  
54          void Playlist(char **list, int size, bool enqueue = false);
55 <        int GetVersion() const;
55 >        std::string GetVersion() const;
56  
57          template <typename Type_>
58          inline void PlaylistAdd(const Type_ &list)
# Line 49 | Line 60 | public:
60                  ::GList *list_(NULL);
61  
62                  _tforeach (const Type_, item, list)
63 <                        list_ = ::g_list_append(list_, const_cast<char *>(item->NullTerminate()));
63 >                        list_ = ::g_list_append(list_, const_cast<char *>(item->c_str()));
64  
65                  PlaylistAdd(list_);
66                  ::g_list_free(list_);
67          }
68  
69          void PlaylistAdd(::GList *list);
70 <        void PlaylistDelete(int position);
70 >        void PlaylistDelete(unsigned position);
71          void Play();
72          void Pause();
73          void Stop();
74          bool IsPlaying() const;
75          bool IsPaused() const;
76          int GetPlaylistPosition() const;
77 <        void SetPlaylistPosition(int position);
77 >        void SetPlaylistPosition(unsigned position);
78          int GetPlaylistLength() const;
79          void PlaylistClear();
80          int GetOutputTime() const;
# Line 74 | Line 85 | public:
85          void SetVolume(int left, int right);
86          void SetMainVolume(int volume);
87          void SetBalance(int balance);
88 <        cse::String GetSkin() const;
89 <        void SetSkin(const cse::String &skin);
90 <        cse::String GetPlaylistFile(int position) const;
91 <        cse::String GetPlaylistTitle(int position) const;
88 >        std::string GetSkin() const;
89 >        void SetSkin(const std::string &skin);
90 >        std::string GetPlaylistFile(int position) const;
91 >        std::string GetPlaylistTitle(int position) const;
92          int GetPlaylistTime(int position) const;
93          void GetInfo(int &rate, int &frequency, int &channels) const;
94          void MainWindowToggle(bool show);
# Line 91 | Line 102 | public:
102          void Eject();
103          void PlaylistPrevious();
104          void PlaylistNext();
105 <        void PlaylistAddUrl(const cse::String &url);
105 >        void PlaylistAddUrl(const std::string &url);
106          bool IsRunning() const;
107          void ToggleRepeat();
108          void ToggleShuffle();
# Line 110 | Line 121 | public:
121                          ToggleShuffle();
122          }
123  
124 <        void GetEqualizer(float &preamp, float bands[10]) const;
125 <        float GetEqualizerPreamp() const;
126 <        float GetEqualizerBand(int band) const;
127 <        void SetEqualizer(float preamp, float bands[10]);
128 <        void SetEqualizerPreamp(float preamp);
129 <        void SetEqualizerBand(int band, float value);
124 >        void GetEqualizer(double &preamp, double bands[10]) const;
125 >        double GetEqualizerPreamp() const;
126 >        double GetEqualizerBand(int band) const;
127 >        void SetEqualizer(double preamp, double bands[10]);
128 >        void SetEqualizerPreamp(double preamp);
129 >        void SetEqualizerBand(int band, double value);
130  
131          // XMMS 1.2.1
132          void Quit();
133  
134          // XMMS 1.2.6
135          void PlayPause();
136 <        void PlaylistInsertUrl(const cse::String &url, int position);
136 >        void PlaylistInsertUrl(const std::string &url, int position);
137  
138          // XMMS 1.2.11
139          void PlayqueueAdd(int position);
# Line 144 | Line 155 | public:
155          void ShowJumpToFileBox();
156          void PlayqueueClear();
157          bool PlayqueueIsQueued(int position) const;
147        int GetPlayqueuePosition(int position) const;
158          int GetPlayqueueQueuePosition(int position) const;
159  
160 <        // Audacious 1.2
161 <        void SetSessionUri(const cse::String &uri);
162 <        cse::String GetSessionUri() const;
160 >        // Audacious 1.3
161 >        void PlaylistEnqueueToTemp(const std::string &string);
162 >        std::string GetTupleFieldData(const std::string &field, int position);
163  
164 <        enum Type { Unix, Tcp };
164 >        // Audacious 1.4
165 >        void ShowAboutBox();
166 >        void ToggleAboutBox(bool show);
167 >        void ToggleJumpToFileBox(bool show);
168 >        void TogglePreferencesBox(bool show);
169 >        void ToggleFileBrowser(bool show);
170 >        void EqualizerActivate(bool active);
171 > };
172  
173 <        void SetSessionType(Type type);
173 > template <>
174 > inline void Audacious::Playlist(const std::string &item, bool enqueue)
175 > {
176 >        char *list[] = { const_cast<char *>(item.c_str()) };
177  
178 <        // Audacious 1.3
179 <        void PlaylistEnqueueToTemp(const cse::String &string);
160 <        cse::String GetTupleFieldData(const cse::String &field, int position);
161 < };
178 >        Playlist(list, 1, enqueue);
179 > }
180  
181   template <>
182 < inline void Audacious::PlaylistAdd(const cse::String &item)
182 > inline void Audacious::PlaylistAdd(const std::string &item)
183   {
184 <        ::GList list = { const_cast<char *>(item.NullTerminate()), NULL, NULL };
184 >        ::GList list = { const_cast<char *>(item.c_str()), NULL, NULL };
185  
186          PlaylistAdd(&list);
187   }
188  
189 + }
190 +
191   #endif//_Audacious_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines