1 /*****************************************************************************
2 * mixer.c : audio output mixing operations
3 *****************************************************************************
4 * Copyright (C) 2002-2004 the VideoLAN team
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
32 #include <vlc_common.h>
34 #include <vlc_modules.h>
36 #include <vlc_aout_mixer.h>
37 #include "aout_internal.h"
41 * Creates a software amplifier.
43 audio_mixer_t *aout_MixerNew(vlc_object_t *obj, vlc_fourcc_t format)
45 audio_mixer_t *mixer = vlc_custom_create(obj, sizeof (*mixer), "mixer");
46 if (unlikely(mixer == NULL))
49 mixer->format = format;
51 mixer->module = module_need(mixer, "audio mixer", NULL, false);
52 if (mixer->module == NULL)
54 msg_Err(mixer, "no suitable audio mixer");
55 vlc_object_release(mixer);
62 * Destroys a software amplifier.
64 void aout_MixerDelete(audio_mixer_t *mixer)
69 module_unneed(mixer, mixer->module);
70 vlc_object_release(mixer);
74 * Applies replay gain and software volume to an audio buffer.
76 void aout_MixerRun(audio_mixer_t *mixer, block_t *block, float amp)
78 mixer->mix(mixer, block, amp);