ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/Audacious/Audacious.hpp
Revision: 12
Committed: 2007-05-13T04:38:16-07:00 (15 years, 1 month ago) by douglas
Original Path: SteeringWheelRemote/Audacious.hpp
File size: 3974 byte(s)
Log Message:
Switch to Menes C++, hmm?

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

Properties

Name Value
svn:keywords Id