~ubuntu-branches/ubuntu/trusty/hud/trusty-updates

« back to all changes in this revision

Viewing changes to src/voice.c

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-01-20 19:43:59 UTC
  • mfrom: (1.1.26)
  • Revision ID: package-import@ubuntu.com-20140120194359-jxxxqtd4ql9elvpf
Tags: 13.10.1+14.04.20140120-0ubuntu1
* New rebuild forced
* Automatic snapshot from revision 362

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2012 Canonical Ltd.
3
 
 *
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.
7
 
 *
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.
12
 
 *
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/>.
15
 
 *
16
 
 */
17
 
 
18
 
#define G_LOG_DOMAIN "hudvoice"
19
 
 
20
 
#include "voice.h"
21
 
#include "sphinx.h"
22
 
#include "julius.h"
23
 
 
24
 
/**
25
 
 * HudVoiceace:
26
 
 * @g_iface: the #GTypeInterface
27
 
 * @query: virtual function pointer for hud_voice_query()
28
 
 *
29
 
 * This is the interface vtable for #HudVoice.
30
 
 **/
31
 
 
32
 
G_DEFINE_INTERFACE (HudVoice, hud_voice, G_TYPE_OBJECT)
33
 
 
34
 
static void
35
 
hud_voice_default_init (HudVoiceInterface *iface)
36
 
{
37
 
}
38
 
 
39
 
HudVoice *
40
 
hud_voice_new (HudQueryIfaceComCanonicalHudQuery *skel, const gchar *device,
41
 
    GError **error)
42
 
{
43
 
  if (hud_julius_is_installed())
44
 
    return HUD_VOICE(hud_julius_new (skel));
45
 
 
46
 
  return HUD_VOICE(hud_sphinx_new (skel, device, error));
47
 
}
48
 
 
49
 
 
50
 
/**
51
 
 * hud_voice_query:
52
 
 * @voice: a #HudVoice
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
56
 
 *
57
 
 * Run a voice query against the given source.
58
 
 * 
59
 
 * It is your resposibility to free the returned result and error.
60
 
 **/
61
 
gboolean
62
 
hud_voice_query (HudVoice *self, HudSource *source, gchar **result,
63
 
    GError **error)
64
 
{
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);
70
 
}