Dicto

Dicto — Audio dictation gobject

Stability Level

Unstable, unless otherwise indicated

Synopsis

#define             DICTO_TYPE
#define             DICTO                               (obj)
#define             DICTO_CLASS                         (klass)
#define             IS_DICTO                            (obj)
#define             IS_DICTO_CLASS                      (klass)
#define             DICTO_GET_CLASS                     (obj)
                    DictoFormat;
struct              dicto;
typedef             Dicto;
GType               dicto_get_type                      (void);
Dicto *             dicto_new                           (gchar *basedir);
Dicto *             dicto_new_full                      (gchar *basedir,
                                                         DictoFormats f,
                                                         gchar *sink,
                                                         gchar *source);
gboolean            dicto_set_basedir                   (Dicto *d,
                                                         const gchar *basedir);
gboolean            dicto_record                        (Dicto *d,
                                                         const gchar *file);
gboolean            dicto_play                          (Dicto *d,
                                                         const gchar *file);
gboolean            dicto_prepare                       (Dicto *d,
                                                         const gchar *file);
gboolean            dicto_stop                          (Dicto *d);
gboolean            dicto_seek                          (Dicto *d,
                                                         gdouble pos);
gboolean            dicto_delete                        (Dicto *d,
                                                         const gchar *file);
gboolean            dicto_toggle_record                 (Dicto *d,
                                                         const gchar *file);
gchar *             dicto_filename_time_new             (Dicto *d,
                                                         time_t t);
gboolean            dicto_refresh_list                  (Dicto *d);
GHashTable *        dicto_notes_get_list                (Dicto *d);
gboolean            dicto_remove                        (Dicto *d,
                                                         const gchar *file);
gboolean            dicto_get_position                  (Dicto *d,
                                                         gdouble *length,
                                                         gdouble *position);

Description

Dicto is object that simplifies creating audio dictations in applications, it can be combined with DictoWidget to create a simple and automatic UI.

It uses a predefined list of some common formats, suitable for both speech and music.

The object takes care of a list of notes in the given base directory. Signals are emited when playing, recording, stopping, seeking and note list changes.

Details

DICTO_TYPE

#define DICTO_TYPE				(dicto_get_type ())


DICTO()

#define DICTO(obj)				(G_TYPE_CHECK_INSTANCE_CAST ((obj), DICTO_TYPE, Dicto))

obj :


DICTO_CLASS()

#define DICTO_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), DICTO_TYPE, DictoClass))

klass :


IS_DICTO()

#define IS_DICTO(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), DICTO_TYPE))

obj :


IS_DICTO_CLASS()

#define IS_DICTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DICTO_TYPE))

klass :


DICTO_GET_CLASS()

#define DICTO_GET_CLASS(obj)		(G_TYPE_INSTANCE_GET_CLASS ((obj), DICTO_TYPE, DictoClass))

obj :


DictoFormat

typedef struct {
	gint id;
	const gchar *desc;
	const gchar *ext;
	const gchar *filter;
	const gchar *muxer;
	const gchar *encoder;
	const gchar *mime;
	guint channels;
	guint rate;
	guint bits;
} DictoFormat;


struct dicto

struct dicto {
	GObject parent;

	/* Private */
	gpointer priv;
};


Dicto

typedef struct _dicto Dicto;


dicto_get_type ()

GType               dicto_get_type                      (void);

Returns :


dicto_new ()

Dicto *             dicto_new                           (gchar *basedir);

Creates a new Dicto object ready for use with default format and audio sink/source, determined at ./configure time.

Default for desktop gtk build uses alsasink and alsasrc. Default for hildon 2.2 build uses pulsesink and pulsesrc. Default for hildon 2.0 build uses dsppcmsink and dsppcmsrc.

basedir :

Directory to use for file lists and new recordings

Returns :

See dicto_new_full()

dicto_new_full ()

Dicto *             dicto_new_full                      (gchar *basedir,
                                                         DictoFormats f,
                                                         gchar *sink,
                                                         gchar *source);

Creates a new Dicto object ready for use.

basedir :

Directory to use for file lists and new recordings

f :

Audio format to use

sink :

GstElement audio sink element

source :

GstElement audio source element

Returns :

The new Dicto object.

dicto_set_basedir ()

gboolean            dicto_set_basedir                   (Dicto *d,
                                                         const gchar *basedir);

Set base directory to use to for recordings.

d :

A Dicto object.

basedir :

An absolute UNIX path to notes, it will be created if it does not exists.

Returns :

TRUE if new basedir was set. FALSE if basedir is not a directory or if creation failed.

dicto_record ()

gboolean            dicto_record                        (Dicto *d,
                                                         const gchar *file);

Records to given file without a limit. Emits "recording" when recording starts.

d :

A Dicto object

file :

Destination filename to record to.

Returns :

TRUE if recording started, FALSE on error.

dicto_play ()

gboolean            dicto_play                          (Dicto *d,
                                                         const gchar *file);

Plays given audio note file. Does nothing if already playing. Clears current note on error.

d :

A Dicto object

file :

A file to play

Returns :

TRUE if playback started, FALSE on error and if recording.

dicto_prepare ()

gboolean            dicto_prepare                       (Dicto *d,
                                                         const gchar *file);

Prepares given file for playback but does not start playback. Use dicto_play() with same filename to start playback. Does nothing if we are already playing. Clears current file if error happens.

d :

A Dicto object

file :

A file to prepare for playback

Returns :

TRUE if preparation was successfull, FALSE otherwise.

dicto_stop ()

gboolean            dicto_stop                          (Dicto *d);

Stop recording or playback. Emits signals "stopped_play" or "stopped_record" if pipelines where stopped.

d :

A Dicto object

Returns :

TRUE if a pipeline was stopped.

dicto_seek ()

gboolean            dicto_seek                          (Dicto *d,
                                                         gdouble pos);

Seeks to given position in the current playback note. The note must have been prepared with dicto_prepare() or beeing played back by dicto_play().

d :

A Dicto object

pos :

Position to seek to

Returns :

TRUE if seeking was successfull.

dicto_delete ()

gboolean            dicto_delete                        (Dicto *d,
                                                         const gchar *file);

Simple version of dicto_delete_full

d :

A Dicto object

file :

A note to delete, must be an existing note file name

Returns :

FALSE on error, TRUE otherwise.

dicto_toggle_record ()

gboolean            dicto_toggle_record                 (Dicto *d,
                                                         const gchar *file);

Toggles recording: stops if recording, records if stopped.

d :

A Dicto object

file :

Filename to use for new recording.

Returns :

TRUE if successfull, FALSE if playing or other error.

dicto_filename_time_new ()

gchar *             dicto_filename_time_new             (Dicto *d,
                                                         time_t t);

d :

A Dicto object

t :

A unix timestamp, or 0 for current time.

Returns :

A string containg a filename with the given or current timestamp using given format or the default "Y-m-d-H-M-S".

dicto_refresh_list ()

gboolean            dicto_refresh_list                  (Dicto *d);

d :

Returns :


dicto_notes_get_list ()

GHashTable *        dicto_notes_get_list                (Dicto *d);

d :

Returns :


dicto_remove ()

gboolean            dicto_remove                        (Dicto *d,
                                                         const gchar *file);

d :

file :

Returns :


dicto_get_position ()

gboolean            dicto_get_position                  (Dicto *d,
                                                         gdouble *length,
                                                         gdouble *position);

Get the current playback/recording position and stream length. If any of two arguments are null the queries will be skipped.

d :

A Dicto object

length :

Pointer to a gdouble, to store length of the currently playing recording, dummy if recording.

position :

Pointer to a gdouble, to store the current position of playing recording or length to current recording.

Returns :

TRUE if any of the two queries was ok.

See Also

DictoWidget