~ubuntu-branches/ubuntu/maverick/gnome-media/maverick

« back to all changes in this revision

Viewing changes to gnome-volume-control/src/gvc-channel-map.c

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette, Josselin Mouette, Luca Bruno
  • Date: 2009-05-28 00:05:41 UTC
  • mfrom: (0.1.28 upstream)
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: james.westby@ubuntu.com-20090528000541-s3h2g1jjw8sodkfi
Tags: 2.26.0-1
[ Josselin Mouette ]
* Set the team as primary maintainer. Closes: #523538.

[ Luca Bruno ]
* New upstream release. Closes: #526798.
  + Features a MP2 audio profile. Closes: #502059.
* debian/control.in:
  - Build-Depends:
    + Add libcanberra-gtk-dev 0.4.
    + Add libunique-dev.
    + Bump libglib2.0-dev to 2.18.2.
* debian/patches/01_vumeter_nodisplay.patch:
  - Remove, vu-meter isn't being built by default since 2.23.

[ Josselin Mouette ]
* Update build-dependencies, include libpulse.
* Explicitly enable the gst mixer.
* Install the autostart file in /usr/share/gnome/autostart.
* Install OMF and sound files.
* 10_applet_tryexec.patch: new patch. Only run 
  gnome-volume-control-applet when pulseaudio is installed.
* Split install targets for gnome-volume-control and gst-mixer. 
  Install selectively what comes from each of them.
* Install both gnome-volume-control.pulse and 
  gnome-volume-control.gstreamer. The real gnome-volume-control is now  
  a wrapper script.
* Depend on x11-utils for the wrapper script to work.
* Suggest pulseaudio.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 
2
 *
 
3
 * Copyright (C) 2008 William Jon McCann
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
 *
 
19
 */
 
20
 
 
21
#include "config.h"
 
22
 
 
23
#include <stdlib.h>
 
24
#include <stdio.h>
 
25
#include <unistd.h>
 
26
 
 
27
#include <glib.h>
 
28
#include <glib/gi18n.h>
 
29
 
 
30
#include <pulse/pulseaudio.h>
 
31
 
 
32
#include "gvc-channel-map.h"
 
33
 
 
34
#define GVC_CHANNEL_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_CHANNEL_MAP, GvcChannelMapPrivate))
 
35
 
 
36
struct GvcChannelMapPrivate
 
37
{
 
38
        guint                 num_channels;
 
39
        pa_channel_position_t positions[PA_CHANNELS_MAX];
 
40
        gdouble               gains[PA_CHANNELS_MAX];
 
41
        gboolean              can_balance;
 
42
};
 
43
 
 
44
enum {
 
45
        GAINS_CHANGED,
 
46
        LAST_SIGNAL
 
47
};
 
48
 
 
49
static guint signals [LAST_SIGNAL] = { 0, };
 
50
 
 
51
static void     gvc_channel_map_class_init (GvcChannelMapClass *klass);
 
52
static void     gvc_channel_map_init       (GvcChannelMap      *channel_map);
 
53
static void     gvc_channel_map_finalize   (GObject            *object);
 
54
 
 
55
G_DEFINE_TYPE (GvcChannelMap, gvc_channel_map, G_TYPE_OBJECT)
 
56
 
 
57
guint
 
58
gvc_channel_map_get_num_channels (GvcChannelMap *map)
 
59
{
 
60
        g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), 0);
 
61
        return map->priv->num_channels;
 
62
}
 
63
 
 
64
gdouble *
 
65
gvc_channel_map_get_gains (GvcChannelMap *map)
 
66
{
 
67
        g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL);
 
68
        return map->priv->gains;
 
69
}
 
70
 
 
71
pa_channel_position_t *
 
72
gvc_channel_map_get_positions (GvcChannelMap *map)
 
73
{
 
74
        g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL);
 
75
        return map->priv->positions;
 
76
}
 
77
 
 
78
gboolean
 
79
gvc_channel_map_can_balance (GvcChannelMap  *map)
 
80
{
 
81
        g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE);
 
82
        return map->priv->can_balance;
 
83
}
 
84
 
 
85
static void
 
86
gvc_channel_map_class_init (GvcChannelMapClass *klass)
 
87
{
 
88
        GObjectClass   *gobject_class = G_OBJECT_CLASS (klass);
 
89
 
 
90
        gobject_class->finalize = gvc_channel_map_finalize;
 
91
 
 
92
        signals [GAINS_CHANGED] =
 
93
                g_signal_new ("gains-changed",
 
94
                              G_TYPE_FROM_CLASS (klass),
 
95
                              G_SIGNAL_RUN_LAST,
 
96
                              G_STRUCT_OFFSET (GvcChannelMapClass, gains_changed),
 
97
                              NULL, NULL,
 
98
                              g_cclosure_marshal_VOID__VOID,
 
99
                              G_TYPE_NONE, 0);
 
100
 
 
101
        g_type_class_add_private (klass, sizeof (GvcChannelMapPrivate));
 
102
}
 
103
 
 
104
void
 
105
gvc_channel_map_gains_changed (GvcChannelMap *map)
 
106
{
 
107
        g_return_if_fail (GVC_IS_CHANNEL_MAP (map));
 
108
        g_signal_emit (map, signals[GAINS_CHANGED], 0);
 
109
}
 
110
 
 
111
static void
 
112
gvc_channel_map_init (GvcChannelMap *map)
 
113
{
 
114
        map->priv = GVC_CHANNEL_MAP_GET_PRIVATE (map);
 
115
}
 
116
 
 
117
static void
 
118
gvc_channel_map_finalize (GObject *object)
 
119
{
 
120
        GvcChannelMap *channel_map;
 
121
 
 
122
        g_return_if_fail (object != NULL);
 
123
        g_return_if_fail (GVC_IS_CHANNEL_MAP (object));
 
124
 
 
125
        channel_map = GVC_CHANNEL_MAP (object);
 
126
 
 
127
        g_return_if_fail (channel_map->priv != NULL);
 
128
 
 
129
        G_OBJECT_CLASS (gvc_channel_map_parent_class)->finalize (object);
 
130
}
 
131
 
 
132
GvcChannelMap *
 
133
gvc_channel_map_new (void)
 
134
{
 
135
        GObject *map;
 
136
        map = g_object_new (GVC_TYPE_CHANNEL_MAP, NULL);
 
137
        return GVC_CHANNEL_MAP (map);
 
138
}
 
139
 
 
140
static void
 
141
set_from_pa_map (GvcChannelMap        *map,
 
142
                 const pa_channel_map *pa_map)
 
143
{
 
144
        guint i;
 
145
 
 
146
        map->priv->num_channels = pa_map->channels;
 
147
#ifdef HAVE_NEW_PULSE
 
148
        map->priv->can_balance = pa_channel_map_can_balance (pa_map);
 
149
#else
 
150
        map->priv->can_balance = TRUE;
 
151
#endif
 
152
        for (i = 0; i < pa_map->channels; i++) {
 
153
                map->priv->positions[i] = pa_map->map[i];
 
154
                map->priv->gains[i] = 1.0;
 
155
        }
 
156
}
 
157
 
 
158
GvcChannelMap *
 
159
gvc_channel_map_new_from_pa_channel_map (const pa_channel_map *pa_map)
 
160
{
 
161
        GObject *map;
 
162
        map = g_object_new (GVC_TYPE_CHANNEL_MAP, NULL);
 
163
 
 
164
        set_from_pa_map (GVC_CHANNEL_MAP (map), pa_map);
 
165
 
 
166
        return GVC_CHANNEL_MAP (map);
 
167
}