1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2009 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains code for JACK server monitor and control
9 **************************************************************************
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include "../jack_proxy.h"
30 #include "dbus_iface_control.h"
33 on_jack_server_started(
36 lash_info("JACK server start detected.");
40 if (!studio_create(&g_studio
))
42 lash_error("failed to create studio object");
47 if (!studio_fetch_jack_settings(g_studio
))
49 lash_error("studio_fetch_jack_settings() failed.");
51 if (!studio_is_persisted(g_studio
))
53 emit_studio_disappeared();
54 studio_destroy(g_studio
);
60 lash_info("jack conf successfully retrieved");
61 studio_activate(g_studio
);
62 emit_studio_appeared();
63 studio_save(g_studio
, NULL
); /* XXX - to test save functionality, we should not save unless requested by user */
68 on_jack_server_stopped(
71 lash_info("JACK server stop detected.");
78 if (!studio_is_persisted(g_studio
))
80 emit_studio_disappeared();
81 studio_destroy(g_studio
);
86 /* TODO: if user wants, restart jack server and reconnect all jack apps to it */
90 on_jack_server_appeared(
93 lash_info("JACK controller appeared.");
97 on_jack_server_disappeared(
100 lash_info("JACK controller disappeared.");
109 if (!jack_proxy_init(
110 on_jack_server_started
,
111 on_jack_server_stopped
,
112 on_jack_server_appeared
,
113 on_jack_server_disappeared
))
118 if (jack_proxy_is_started(&started
) && started
)
120 on_jack_server_started();