X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ursaryd.h;h=ddfc18d2fc6de7c6f85ae9963b4a6e7c29bb5c83;hb=eae1e2244fbaae868c9770a050516a731ba90f5f;hp=8342e83eb56ae8a37b510d7c58ed33c319467560;hpb=a8719b51a34bd66742c2585041c0e0315ff25ebb;p=ursary.git diff --git a/ursaryd.h b/ursaryd.h index 8342e83..ddfc18d 100644 --- a/ursaryd.h +++ b/ursaryd.h @@ -1,8 +1,19 @@ -/* main */ +/* + * The Ursary Audio Controls + * + * (c) 2014 Martin Mares + */ + +#include + +#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 */ @@ -12,6 +23,9 @@ bool noct_is_ready(void); void noct_set_ring(int ring, int mode, int val); void noct_set_button(int button, int val); +extern char noct_rotary_touched[10]; // 8=center, 9=slider +extern char noct_button_pressed[16]; + enum ring_mode { RING_MODE_LEFT, RING_MODE_RIGHT, @@ -21,8 +35,83 @@ enum ring_mode { RING_MODE_SINGLE_OFF, }; +/* pulse.c */ + +enum pulse_state { + PS_OFFLINE, + PS_SUBSCRIBE, + PS_GET_CLIENTS, + PS_GET_SINKS, + PS_GET_SINK_INPUTS, + PS_GET_SERVER, + PS_ONLINE, +}; + +extern enum pulse_state pulse_state; +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; + int mute; +}; + +struct pulse_sink_input { + cnode n; + int idx; + char *name; + int client_idx; + int sink_idx; + uint channels; + uint volume; + uint mute; + int noct_client_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); +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_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);