~audio-recorder/audio-recorder/trunk

199 by osmoma at gmail
Changes towards v0.9.5 on Ubuntu 12.10 and Fedora 18.
1
#ifndef _AUDIO_SOURCES_H__
2
#define _AUDIO_SOURCES_H__
1 by Osmo Antero Maatta
Initial import 17.jan.2011
3
4
#include <glib.h>
5
#include <gtk/gtk.h>
6
#include <gdk/gdk.h>
7
8
#define DEFAULT_AUDIO_SOURCE "pulsesrc"
9
69 by Osmo Antero
Ported this application to GTK/GDK 3. Using now GSettings (and dconf) instead of GConf2
10
// Types of audio devices (audio sources)
1 by Osmo Antero Maatta
Initial import 17.jan.2011
11
enum DeviceType {
47 by Osmo Antero Maatta
Formatted code (in src/*.[ch]) with astyle. Ref. README file.
12
    NOT_DEFINED = 0x0,
199 by osmoma at gmail
Changes towards v0.9.5 on Ubuntu 12.10 and Fedora 18.
13
14
    // GNOME-desktop's default device. Defined as "gconfaudiosrc" or "autoaudiosrc".
15
    DEFAULT_DEVICE = 0x1,
16
17
    // Real audio card with sound output, audio sink. This is an audio-card with loudspeakers. Useless for recording.
18
    AUDIO_SINK = 0x2,
19
20
    // This is the monitor device for AUDIO_SINK. We use this to record from an audio-card (think loudspeakers).
21
    AUDIO_SINK_MONITOR = 0x4,
22
23
    // Standalone microphone or webcam with microphone. Many audio-cards have also microphone input.
24
    AUDIO_INPUT = 0x8,
25
26
    // DBus entity. Media Players like RhythmBox, Amarok and Banshee. These can control the recording via DBus.
27
    MEDIA_PLAYER = 0x10,
28
29
    // DBus entity. Communication program like Skype. Skype can control the recording via DBus.
30
    COMM_PROGRAM = 0x20,
31
32
    // User-defined group of devices. User can record from several inputs (eg. several microphones) and record from'em.
33
    USER_DEFINED = 0x40   
1 by Osmo Antero Maatta
Initial import 17.jan.2011
34
};
35
36
typedef struct {
199 by osmoma at gmail
Changes towards v0.9.5 on Ubuntu 12.10 and Fedora 18.
37
    // Device type. See above.
38
    enum DeviceType type;
39
40
    // Pulseaudio.c: this value is pulseaudio's pa_source_info->index or pa_sink_info->index.
83 by Osmo Antero
Version 0.8 with some clean ups.
41
    // Ref: http://freedesktop.org/software/pulseaudio/doxygen/structpa__sink__info.html
199 by osmoma at gmail
Changes towards v0.9.5 on Ubuntu 12.10 and Fedora 18.
42
    gint index;           
43
44
    // Internal device id (audio device id). In Pulseaudio this field is called "name".
45
    gchar *id;
46
47
    // Human readable device description shown in listboxes.
48
    gchar *description;
49
50
    // Pulseaudio.c: this value is pulseaudio's pa_source_info->monitor_of_sink. This points to another
51
    // DeviceItem where DeviceItem->index = DeviceItem->sink_index. 
52
    // We simply need this to get the audio cards real name.
53
    gint sink_index;
54
55
    // Icon name for this device or source type
56
    gchar *icon_name; 	  
1 by Osmo Antero Maatta
Initial import 17.jan.2011
57
} DeviceItem;
58
40 by Osmo Antero Maatta
Added ability to record from multiple devices. Major changes in all modules.
59
DeviceItem *device_item_create(gchar *id, gchar *description);
1 by Osmo Antero Maatta
Initial import 17.jan.2011
60
DeviceItem *device_item_copy_node(DeviceItem *item);
61
void device_item_free(DeviceItem *item);
62
const gchar *device_item_get_type_name(guint type);
63
64
// ComboBox columns
65
enum {
199 by osmoma at gmail
Changes towards v0.9.5 on Ubuntu 12.10 and Fedora 18.
66
    // DeviceType (see above), hidden column
67
    COL_DEVICE_TYPE,
68
69
    // Device id or DBus id for media players/skype, hidden column
70
    COL_DEVICE_ID,  
71
72
    // Icon for device or media players/skype, visible
73
    COL_DEVICE_ICON, 
74
75
    // Description device or media players/skype, visible column
76
    COL_DEVICE_DESCR,
77
78
    // Number of columns in the combobox
79
    N_DEVICE_COLUMNS  
1 by Osmo Antero Maatta
Initial import 17.jan.2011
80
};
81
82
gboolean filter_for_sink_dev(DeviceItem *item);
83
84
void audio_sources_init();
85
void audio_sources_exit();
86
40 by Osmo Antero Maatta
Added ability to record from multiple devices. Major changes in all modules.
87
void audio_sources_reload_device_list();
88
1 by Osmo Antero Maatta
Initial import 17.jan.2011
89
void audio_sources_free_list(GList *lst);
90
void audio_sources_print_list(GList *list, gchar *tag);
91
void audio_sources_print_list_ex();
92
40 by Osmo Antero Maatta
Added ability to record from multiple devices. Major changes in all modules.
93
GList *audio_sources_get_for_type(gint type);
94
1 by Osmo Antero Maatta
Initial import 17.jan.2011
95
DeviceItem *audio_sources_find_id(gchar *device_id);
96
97
void audio_sources_device_changed(gchar *device_id);
40 by Osmo Antero Maatta
Added ability to record from multiple devices. Major changes in all modules.
98
GList *audio_sources_wash_device_list(GList *dev_list);
99
GList *audio_sources_get_device_NEW(gchar **audio_source);
1 by Osmo Antero Maatta
Initial import 17.jan.2011
100
101
GtkWidget *audio_sources_create_combo();
40 by Osmo Antero Maatta
Added ability to record from multiple devices. Major changes in all modules.
102
1 by Osmo Antero Maatta
Initial import 17.jan.2011
103
void audio_source_fill_combo(GtkWidget *combo);
40 by Osmo Antero Maatta
Added ability to record from multiple devices. Major changes in all modules.
104
1 by Osmo Antero Maatta
Initial import 17.jan.2011
105
void audio_sources_combo_set_id(GtkWidget *combo, gchar *device_id);
106
gint audio_sources_get_combo_index(GtkWidget *combo);
107
gboolean audio_sources_combo_get_values(GtkWidget *combo, gchar **device_name, gchar **device_id, gint *device_type);
108
40 by Osmo Antero Maatta
Added ability to record from multiple devices. Major changes in all modules.
109
gboolean audio_sources_device_is_webcam(gchar *dev_name);
110
111
1 by Osmo Antero Maatta
Initial import 17.jan.2011
112
#endif
113
114
115