#include <pulse/pulseaudio.h>
+#define SET_STRING(_field, _val) do { if (!_field || strcmp(_field, _val)) { xfree(_field); _field = xstrdup(_val); } } while (0)
+
/* ursary.c */
void schedule_update(void);
bool noct_is_ready(void);
void noct_set_ring(int ring, int mode, int val);
void noct_set_button(int button, int val);
+void noct_clear(void);
extern char noct_rotary_touched[10]; // 8=center, 9=slider
extern char noct_button_pressed[16];
RING_MODE_SINGLE_OFF,
};
-/* pulse.c */
+/* dmx.c */
-enum pulse_state {
- PS_OFFLINE,
- PS_SUBSCRIBE,
- PS_GET_CLIENTS,
- PS_GET_SINKS,
- PS_GET_SINK_INPUTS,
- PS_GET_SERVER,
- PS_ONLINE,
-};
+void dmx_init(void);
+void dmx_set_pwm(uint index, uint val);
+bool dmx_is_ready(void);
+
+/* pulse.c */
-extern enum pulse_state pulse_state;
extern char *pulse_default_sink_name;
struct pulse_client {
cnode n;
int idx;
char *name;
- uns channels;
- uns volume;
- uns base_volume;
- int mute;
+ uint channels;
+ uint volume;
+ uint base_volume;
+ bool mute;
+ bool suspended;
+ char *active_port;
};
struct pulse_sink_input {
char *name;
int client_idx;
int sink_idx;
- uns channels;
- uns volume;
- uns mute;
- int noct_client_idx; // Used by the high-level logic below
+ uint channels;
+ uint volume;
+ bool mute;
+ int noct_group_idx; // Used by the high-level logic below
};
extern clist pulse_client_list, pulse_sink_list, pulse_sink_input_list;
void pulse_init(void);
void pulse_dump(void);
+bool pulse_is_ready(void);
struct pulse_sink *pulse_sink_by_name(const char *name);
struct pulse_sink *pulse_sink_by_idx(int idx);
void pulse_sink_set_volume(int idx, pa_cvolume *cvol);
void pulse_sink_set_mute(int idx, bool mute);
+void pulse_sink_set_port(int idx, const char *port);
void pulse_sink_input_set_volume(int idx, pa_cvolume *cvol);
void pulse_sink_input_set_mute(int idx, bool mute);
void pulse_sink_input_move(int input_idx, int sink_idx);
extern struct pa_mainloop_api pmain_api;
void pmain_init(void);
+
+/* mpd.c */
+
+enum mpd_state {
+ MPD_OFFLINE,
+ MPD_CONNECTING,
+ MPD_WAIT_GREETING,
+ MPD_ONLINE,
+};
+
+extern enum mpd_state mpd_state;
+
+void mpd_init(void);
+const char *mpd_get_player_state(void);
+void mpd_play(void);
+void mpd_stop(void);
+void mpd_pause(int arg);
+void mpd_next(void);
+void mpd_prev(void);