]> mj.ucw.cz Git - ursary.git/blobdiff - ursaryd.h
Lights: Long press = full power
[ursary.git] / ursaryd.h
index 8342e83eb56ae8a37b510d7c58ed33c319467560..8b743345e3e341f68be14f74c91a8378ff5ea474 100644 (file)
--- a/ursaryd.h
+++ b/ursaryd.h
@@ -1,8 +1,19 @@
-/* main */
+/*
+ *     The Ursary Audio Controls
+ *
+ *     (c) 2014 Martin Mares <mj@ucw.cz>
+ */
+
+#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);
 
 void notify_rotary(int rotary, int delta);
+void notify_touch(int rotary, int on);
 void notify_button(int button, int on);
 
 /* nocturn.c */
@@ -11,6 +22,10 @@ void noct_init(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];
 
 enum ring_mode {
   RING_MODE_LEFT,
@@ -21,8 +36,84 @@ enum ring_mode {
   RING_MODE_SINGLE_OFF,
 };
 
+/* dmx.c */
+
+void dmx_init(void);
+void dmx_set_pwm(uint index, uint val);
+bool dmx_is_ready(void);
+
+/* pulse.c */
+
+extern char *pulse_default_sink_name;
+
+struct pulse_client {
+  cnode n;
+  int idx;
+  char *name;
+  char *host;
+};
+
+struct pulse_sink {
+  cnode n;
+  int idx;
+  char *name;
+  uint channels;
+  uint volume;
+  uint base_volume;
+  bool mute;
+  bool suspended;
+  char *active_port;
+};
+
+struct pulse_sink_input {
+  cnode n;
+  int idx;
+  char *name;
+  int client_idx;
+  int sink_idx;
+  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);
+struct pulse_client *pulse_client_by_idx(int idx);
+void pulse_server_set_default_sink(const char *name);
+
 /* pulse-ucw.c */
 
 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);