2
* Copyright © 2012 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
#define G_LOG_DOMAIN "hudvoice"
26
* @g_iface: the #GTypeInterface
27
* @query: virtual function pointer for hud_voice_query()
29
* This is the interface vtable for #HudVoice.
32
G_DEFINE_INTERFACE (HudVoice, hud_voice, G_TYPE_OBJECT)
35
hud_voice_default_init (HudVoiceInterface *iface)
40
hud_voice_new (HudQueryIfaceComCanonicalHudQuery *skel, const gchar *device,
43
if (hud_julius_is_installed())
44
return HUD_VOICE(hud_julius_new (skel));
46
return HUD_VOICE(hud_sphinx_new (skel, device, error));
53
* @source: a #HudSource to interrogate #HudItem s from
54
* @result: the text result of the voice query will be returned here
55
* @error: if the method returns FALSE, an error will be provdided here
57
* Run a voice query against the given source.
59
* It is your resposibility to free the returned result and error.
62
hud_voice_query (HudVoice *self, HudSource *source, gchar **result,
65
g_debug ("voice query on %s %p", G_OBJECT_TYPE_NAME (self), self);
66
HudVoiceInterface *iface = HUD_VOICE_GET_IFACE (self);
67
g_return_val_if_fail(iface != NULL, FALSE);
68
g_return_val_if_fail(iface->query != NULL, FALSE);
69
return iface->query(self, source, result, error);