ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/Display.hpp
Revision: 14
Committed: 2007-05-14T18:24:34-07:00 (18 years, 1 month ago) by douglas
Original Path: SteeringWheelRemote/Audacious.hpp
File size: 3926 byte(s)
Log Message:
Switch back from Menes C++ to stl and hacks.

File Contents

# User Rev Content
1 douglas 6 // Beep Remote
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #ifndef _Audacious_hpp_
8     #define _Audacious_hpp_
9    
10 douglas 14 #include <cstdlib>
11     #include <string>
12 douglas 6
13     #include <glib.h>
14    
15 douglas 14 #include <foreach.hpp>
16    
17 douglas 6 class Audacious
18     {
19     int session;
20     public:
21     Audacious(int session = 0) : session(session) {}
22    
23     template <typename Type_>
24 douglas 7 inline void Playlist(const Type_ &list, bool enqueue = false)
25 douglas 6 {
26     char **list_(NULL);
27     int size(0);
28    
29     _tforeach (const Type_, item, list)
30     {
31 douglas 14 list_ = list_ ? std::realloc(list_, ++size) : std::malloc(++size);
32     list_[_index] = const_cast<char *>(item->c_str());
33 douglas 6 }
34    
35     Playlist(list_, size, enqueue);
36    
37     if (list_)
38 douglas 14 std::free(list_);
39 douglas 6 }
40    
41     void Playlist(char **list, int size, bool enqueue = false);
42     int GetVersion() const;
43    
44     template <typename Type_>
45 douglas 7 inline void PlaylistAdd(const Type_ &list)
46 douglas 6 {
47     ::GList *list_(NULL);
48    
49     _tforeach (const Type_, item, list)
50 douglas 14 list_ = ::g_list_append(list_, const_cast<char *>(item->c_str()));
51 douglas 6
52     PlaylistAdd(list_);
53     ::g_list_free(list_);
54     }
55    
56     void PlaylistAdd(::GList *list);
57     void PlaylistDelete(int position);
58     void Play();
59     void Pause();
60     void Stop();
61     bool IsPlaying() const;
62     bool IsPaused() const;
63     int GetPlaylistPosition() const;
64     void SetPlaylistPosition(int position);
65     int GetPlaylistLength() const;
66     void PlaylistClear();
67     int GetOutputTime() const;
68     void JumpToTime(int position);
69 douglas 7 void GetVolume(int &left, int &right) const;
70 douglas 6 int GetMainVolume() const;
71     int GetBalance() const;
72     void SetVolume(int left, int right);
73     void SetMainVolume(int volume);
74     void SetBalance(int balance);
75 douglas 14 std::string GetSkin() const;
76     void SetSkin(const std::string &skin);
77     std::string GetPlaylistFile(int position) const;
78     std::string GetPlaylistTitle(int position) const;
79 douglas 6 int GetPlaylistTime(int position) const;
80     void GetInfo(int &rate, int &frequency, int &channels) const;
81     void MainWindowToggle(bool show);
82     void PlaylistWindowToggle(bool show);
83     void EqualizerWindowToggle(bool show);
84     bool IsMainWindow() const;
85     bool IsPlaylistWindow() const;
86     bool IsEqualizerWindow() const;
87     void ShowPreferencesBox();
88     void ToggleAlwaysOnTop(bool always);
89     void Eject();
90     void PlaylistPrevious();
91     void PlaylistNext();
92 douglas 14 void PlaylistAddUrl(const std::string &url);
93 douglas 6 bool IsRunning() const;
94     void ToggleRepeat();
95     void ToggleShuffle();
96     bool IsRepeat() const;
97     bool IsShuffle() const;
98    
99     inline void ToggleRepeat(bool repeat)
100     {
101     if (repeat != IsRepeat())
102     ToggleRepeat();
103     }
104    
105     inline void ToggleShuffle(bool shuffle)
106     {
107     if (shuffle != IsShuffle())
108     ToggleShuffle();
109     }
110    
111     void GetEqualizer(float &preamp, float bands[10]) const;
112     float GetEqualizerPreamp() const;
113     float GetEqualizerBand(int band) const;
114     void SetEqualizer(float preamp, float bands[10]);
115     void SetEqualizerPreamp(float preamp);
116     void SetEqualizerBand(int band, float value);
117    
118     // XMMS 1.2.1
119     void Quit();
120    
121     // XMMS 1.2.6
122     void PlayPause();
123 douglas 14 void PlaylistInsertUrl(const std::string &url, int position);
124 douglas 6
125     // XMMS 1.2.11
126     void PlayqueueAdd(int position);
127     void PlayqueueRemove(int position);
128 douglas 7 int GetPlayqueueLength() const;
129 douglas 6 void ToggleAdvance();
130 douglas 7 bool IsAdvance() const;
131 douglas 6
132     inline void ToggleAdvance(bool advance)
133     {
134     if (advance != IsAdvance())
135     ToggleAdvance();
136     }
137    
138     // BMP 0.9.7
139     void Activate();
140    
141     // Audacious 1.1
142     void ShowJumpToFileBox();
143     void PlayqueueClear();
144     bool PlayqueueIsQueued(int position) const;
145     int GetPlayqueuePosition(int position) const;
146     int GetPlayqueueQueuePosition(int position) const;
147    
148     // Audacious 1.2
149 douglas 14 void SetSessionUri(const std::string &uri);
150     std::string GetSessionUri() const;
151 douglas 6
152     enum Type { Unix, Tcp };
153    
154     void SetSessionType(Type type);
155    
156     // Audacious 1.3
157 douglas 14 void PlaylistEnqueueToTemp(const std::string &string);
158     std::string GetTupleFieldData(const std::string &field, int position);
159 douglas 6 };
160    
161     template <>
162 douglas 14 inline void Audacious::PlaylistAdd(const std::string &item)
163 douglas 7 {
164 douglas 14 ::GList list = { const_cast<char *>(item.c_str()), NULL, NULL };
165 douglas 6
166 douglas 7 PlaylistAdd(&list);
167     }
168    
169 douglas 6 #endif//_Audacious_hpp_

Properties

Name Value
svn:keywords Id