2009-03-12 18:34:37 +01:00
|
|
|
/*
|
2022-07-14 17:58:12 +02:00
|
|
|
* Copyright 2003-2022 The Music Player Daemon Project
|
2009-03-12 18:34:37 +01:00
|
|
|
* http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-03-12 18:34:37 +01:00
|
|
|
*/
|
|
|
|
|
2022-08-18 17:00:45 +02:00
|
|
|
#include "Control.hxx"
|
|
|
|
#include "Mixer.hxx"
|
2013-04-16 23:46:36 +02:00
|
|
|
|
2020-03-12 23:20:59 +01:00
|
|
|
#include <cassert>
|
2009-03-14 11:36:50 +01:00
|
|
|
|
2013-04-16 21:33:25 +02:00
|
|
|
Mixer *
|
2014-02-05 00:02:02 +01:00
|
|
|
mixer_new(EventLoop &event_loop,
|
2017-08-10 13:07:36 +02:00
|
|
|
const MixerPlugin &plugin, AudioOutput &ao,
|
2014-02-05 23:20:33 +01:00
|
|
|
MixerListener &listener,
|
2016-09-09 12:52:51 +02:00
|
|
|
const ConfigBlock &block)
|
2009-03-14 11:36:50 +01:00
|
|
|
{
|
2016-09-09 12:52:51 +02:00
|
|
|
Mixer *mixer = plugin.init(event_loop, ao, listener, block);
|
2009-03-14 11:36:50 +01:00
|
|
|
|
2014-02-05 17:25:47 +01:00
|
|
|
assert(mixer == nullptr || mixer->IsPlugin(plugin));
|
2009-03-14 11:36:50 +01:00
|
|
|
|
|
|
|
return mixer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-08-18 14:16:50 +02:00
|
|
|
mixer_free(Mixer *mixer) noexcept
|
2009-03-14 11:36:50 +01:00
|
|
|
{
|
2013-10-19 18:19:03 +02:00
|
|
|
assert(mixer != nullptr);
|
2009-03-14 11:53:28 +01:00
|
|
|
|
2009-12-08 08:47:47 +01:00
|
|
|
/* mixers with the "global" flag set might still be open at
|
2022-08-18 14:29:07 +02:00
|
|
|
this point (see Mixer::LockAutoClose()) */
|
|
|
|
mixer->LockClose();
|
2009-12-08 08:47:47 +01:00
|
|
|
|
2014-02-06 20:44:33 +01:00
|
|
|
delete mixer;
|
2009-03-14 11:36:50 +01:00
|
|
|
}
|