32 |
32 |
#include <libaudcore/i18n.h>
|
33 |
33 |
#include <libaudcore/plugin.h>
|
34 |
34 |
#include <libaudcore/runtime.h>
|
|
35 |
#include <libaudcore/preferences.h>
|
35 |
36 |
|
36 |
37 |
#include "adplug-xmms.h"
|
37 |
38 |
|
|
39 |
#define MIN_RATE 8000
|
|
40 |
#define MAX_RATE 192000
|
|
41 |
#define RATE_STEP 50
|
|
42 |
#define CFG_VERSION "AdPlug"
|
|
43 |
|
38 |
44 |
class AdPlugXMMS : public InputPlugin
|
39 |
45 |
{
|
40 |
46 |
public:
|
41 |
47 |
static const char * const exts[];
|
|
48 |
static const PreferencesWidget widgets[];
|
|
49 |
static const PluginPreferences prefs;
|
|
50 |
static const char * const defaults[];
|
42 |
51 |
|
43 |
52 |
static constexpr PluginInfo info = {
|
44 |
53 |
N_("AdPlug (AdLib Player)"),
|
45 |
|
PACKAGE
|
|
54 |
PACKAGE,
|
|
55 |
nullptr,
|
|
56 |
& prefs
|
46 |
57 |
};
|
47 |
58 |
|
48 |
59 |
constexpr AdPlugXMMS () : InputPlugin (info, InputInfo ()
|
... | ... | |
113 |
124 |
}
|
114 |
125 |
|
115 |
126 |
#else
|
116 |
|
|
117 |
|
static void
|
118 |
|
dbg_printf (const char *fmt, ...)
|
119 |
|
{
|
120 |
|
}
|
121 |
|
|
|
127 |
#define dbg_printf AUDINFO
|
122 |
128 |
#endif
|
123 |
129 |
|
124 |
130 |
/***** Main player (!! threaded !!) *****/
|
... | ... | |
155 |
161 |
{
|
156 |
162 |
dbg_printf ("adplug_play(\"%s\"): ", filename);
|
157 |
163 |
|
|
164 |
conf.bit16 = aud_get_bool (CFG_VERSION, "16bit");
|
|
165 |
conf.stereo = aud_get_bool (CFG_VERSION, "Stereo");
|
|
166 |
conf.freq = aud_get_int (CFG_VERSION, "Frequency");
|
|
167 |
conf.endless = aud_get_bool (CFG_VERSION, "Endless");
|
|
168 |
|
158 |
169 |
// Set XMMS main window information
|
159 |
|
dbg_printf ("xmms, ");
|
160 |
170 |
int sampsize = (conf.bit16 ? 2 : 1) * (conf.stereo ? 2 : 1);
|
|
171 |
dbg_printf ("xmms, samplerate=%d, bitrate=%d.\n", sampsize, (conf.freq * sampsize * 8));
|
161 |
172 |
set_stream_bitrate (conf.freq * sampsize * 8);
|
162 |
173 |
|
163 |
174 |
// open output plugin
|
... | ... | |
279 |
290 |
|
280 |
291 |
/***** Configuration file handling *****/
|
281 |
292 |
|
282 |
|
#define CFG_VERSION "AdPlug"
|
283 |
|
|
284 |
293 |
static const char * const adplug_defaults[] = {
|
285 |
294 |
"16bit", "TRUE",
|
286 |
295 |
"Stereo", "FALSE",
|
... | ... | |
288 |
297 |
"Endless", "FALSE",
|
289 |
298 |
nullptr};
|
290 |
299 |
|
|
300 |
const PreferencesWidget AdPlugXMMS::widgets[] = {
|
|
301 |
WidgetLabel (N_("<b>Advanced</b>")),
|
|
302 |
WidgetCheck (N_("16 Bit Format (vs. 8 Bit)?"),
|
|
303 |
WidgetBool (CFG_VERSION, "16bit")),
|
|
304 |
WidgetCheck (N_("Stereo?"),
|
|
305 |
WidgetBool (CFG_VERSION, "Stereo")),
|
|
306 |
WidgetSpin (N_("Frequency (Rate)"),
|
|
307 |
WidgetInt (CFG_VERSION, "Frequency"), {MIN_RATE, MAX_RATE, RATE_STEP, N_("Hz")}),
|
|
308 |
WidgetCheck (N_("Repeat song in continuous loop?"),
|
|
309 |
WidgetBool (CFG_VERSION, "Endless")),
|
|
310 |
WidgetLabel (N_("<b>(Changes take effect after restarting play)</b>"))
|
|
311 |
};
|
|
312 |
|
|
313 |
const PluginPreferences AdPlugXMMS::prefs = {{widgets}};
|
|
314 |
|
291 |
315 |
bool AdPlugXMMS::init ()
|
292 |
316 |
{
|
293 |
317 |
aud_config_set_defaults (CFG_VERSION, adplug_defaults);
|