gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
|
|
|
|
* Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-audioamplify
|
2018-10-22 09:39:24 +00:00
|
|
|
* @title: audioamplify
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
*
|
|
|
|
* Amplifies an audio stream by a given factor and allows the selection of different clipping modes.
|
|
|
|
* The difference between the clipping modes is best evaluated by testing.
|
2010-04-08 07:15:08 +00:00
|
|
|
*
|
2018-10-22 09:39:24 +00:00
|
|
|
* ## Example launch line
|
2009-01-28 10:29:42 +00:00
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 audiotestsrc wave=saw ! audioamplify amplification=1.5 ! alsasink
|
2015-04-17 06:24:23 +00:00
|
|
|
* gst-launch-1.0 filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audioamplify amplification=1.5 clipping-method=wrap-negative ! alsasink
|
|
|
|
* gst-launch-1.0 audiotestsrc wave=saw ! audioconvert ! audioamplify amplification=1.5 clipping-method=wrap-positive ! audioconvert ! alsasink
|
2009-01-28 10:29:42 +00:00
|
|
|
* ]|
|
2018-10-22 09:39:24 +00:00
|
|
|
*
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/base/gstbasetransform.h>
|
2007-02-06 11:16:49 +00:00
|
|
|
#include <gst/audio/audio.h>
|
|
|
|
#include <gst/audio/gstaudiofilter.h>
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
|
|
|
#include "audioamplify.h"
|
|
|
|
|
|
|
|
#define GST_CAT_DEFAULT gst_audio_amplify_debug
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
|
|
|
|
|
|
|
/* Filter signals and args */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_AMPLIFICATION,
|
|
|
|
PROP_CLIPPING_METHOD
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
METHOD_CLIP = 0,
|
|
|
|
METHOD_WRAP_NEGATIVE,
|
|
|
|
METHOD_WRAP_POSITIVE,
|
2009-06-19 20:20:45 +00:00
|
|
|
METHOD_NOCLIP,
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
NUM_METHODS
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GST_TYPE_AUDIO_AMPLIFY_CLIPPING_METHOD (gst_audio_amplify_clipping_method_get_type ())
|
|
|
|
static GType
|
|
|
|
gst_audio_amplify_clipping_method_get_type (void)
|
|
|
|
{
|
|
|
|
static GType gtype = 0;
|
|
|
|
|
|
|
|
if (gtype == 0) {
|
|
|
|
static const GEnumValue values[] = {
|
2009-06-19 20:20:45 +00:00
|
|
|
{METHOD_CLIP, "Normal clipping (default)", "clip"},
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
{METHOD_WRAP_NEGATIVE,
|
|
|
|
"Push overdriven values back from the opposite side",
|
|
|
|
"wrap-negative"},
|
|
|
|
{METHOD_WRAP_POSITIVE, "Push overdriven values back from the same side",
|
|
|
|
"wrap-positive"},
|
2009-06-19 20:20:45 +00:00
|
|
|
{METHOD_NOCLIP, "No clipping", "none"},
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
{0, NULL, NULL}
|
|
|
|
};
|
2011-08-19 09:49:44 +00:00
|
|
|
gtype = g_enum_register_static ("GstAudioAmplifyClippingMethod", values);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
}
|
|
|
|
return gtype;
|
|
|
|
}
|
|
|
|
|
2009-06-19 20:20:45 +00:00
|
|
|
#define ALLOWED_CAPS \
|
2011-08-19 09:49:44 +00:00
|
|
|
"audio/x-raw," \
|
|
|
|
" format=(string) {S8,"GST_AUDIO_NE(S16)","GST_AUDIO_NE(S32)"," \
|
|
|
|
GST_AUDIO_NE(F32)","GST_AUDIO_NE(F64)"}," \
|
2007-02-06 11:16:49 +00:00
|
|
|
" rate=(int)[1,MAX]," \
|
2012-01-04 10:02:43 +00:00
|
|
|
" channels=(int)[1,MAX], " \
|
|
|
|
" layout=(string) {interleaved, non-interleaved}"
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
2011-04-25 10:49:36 +00:00
|
|
|
G_DEFINE_TYPE (GstAudioAmplify, gst_audio_amplify, GST_TYPE_AUDIO_FILTER);
|
2021-02-12 14:27:31 +00:00
|
|
|
GST_ELEMENT_REGISTER_DEFINE (audioamplify, "audioamplify",
|
|
|
|
GST_RANK_NONE, GST_TYPE_AUDIO_AMPLIFY);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
2009-06-19 20:20:45 +00:00
|
|
|
static gboolean gst_audio_amplify_set_process_function (GstAudioAmplify *
|
2011-08-19 09:49:44 +00:00
|
|
|
filter, gint clipping, GstAudioFormat format);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
static void gst_audio_amplify_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_audio_amplify_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2007-02-06 11:16:49 +00:00
|
|
|
static gboolean gst_audio_amplify_setup (GstAudioFilter * filter,
|
2011-08-19 14:09:48 +00:00
|
|
|
const GstAudioInfo * info);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
static GstFlowReturn gst_audio_amplify_transform_ip (GstBaseTransform * base,
|
|
|
|
GstBuffer * buf);
|
|
|
|
|
2009-06-19 20:20:45 +00:00
|
|
|
#define MIN_gint8 G_MININT8
|
|
|
|
#define MAX_gint8 G_MAXINT8
|
|
|
|
#define MIN_gint16 G_MININT16
|
|
|
|
#define MAX_gint16 G_MAXINT16
|
|
|
|
#define MIN_gint32 G_MININT32
|
|
|
|
#define MAX_gint32 G_MAXINT32
|
|
|
|
|
2009-06-21 15:13:43 +00:00
|
|
|
#define MAKE_INT_FUNCS(type,largetype) \
|
2009-06-19 20:20:45 +00:00
|
|
|
static void \
|
|
|
|
gst_audio_amplify_transform_##type##_clip (GstAudioAmplify * filter, \
|
|
|
|
void * data, guint num_samples) \
|
|
|
|
{ \
|
|
|
|
type *d = data; \
|
|
|
|
\
|
|
|
|
while (num_samples--) { \
|
2009-06-21 15:13:43 +00:00
|
|
|
largetype val = *d * filter->amplification; \
|
2009-06-19 20:20:45 +00:00
|
|
|
*d++ = CLAMP (val, MIN_##type, MAX_##type); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
static void \
|
|
|
|
gst_audio_amplify_transform_##type##_wrap_negative (GstAudioAmplify * filter, \
|
|
|
|
void * data, guint num_samples) \
|
|
|
|
{ \
|
|
|
|
type *d = data; \
|
|
|
|
\
|
|
|
|
while (num_samples--) { \
|
2009-06-21 15:13:43 +00:00
|
|
|
largetype val = *d * filter->amplification; \
|
2009-06-19 20:20:45 +00:00
|
|
|
if (val > MAX_##type) \
|
2009-06-21 15:13:43 +00:00
|
|
|
val = MIN_##type + (val - MIN_##type) % ((largetype) MAX_##type + 1 - \
|
2009-06-19 20:20:45 +00:00
|
|
|
MIN_##type); \
|
|
|
|
else if (val < MIN_##type) \
|
2009-06-21 15:13:43 +00:00
|
|
|
val = MAX_##type - (MAX_##type - val) % ((largetype) MAX_##type + 1 - \
|
2009-06-19 20:20:45 +00:00
|
|
|
MIN_##type); \
|
|
|
|
*d++ = val; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
static void \
|
|
|
|
gst_audio_amplify_transform_##type##_wrap_positive (GstAudioAmplify * filter, \
|
|
|
|
void * data, guint num_samples) \
|
|
|
|
{ \
|
|
|
|
type *d = data; \
|
|
|
|
\
|
|
|
|
while (num_samples--) { \
|
2009-06-21 15:13:43 +00:00
|
|
|
largetype val = *d * filter->amplification; \
|
2009-06-19 20:20:45 +00:00
|
|
|
do { \
|
|
|
|
if (val > MAX_##type) \
|
|
|
|
val = MAX_##type - (val - MAX_##type); \
|
|
|
|
else if (val < MIN_##type) \
|
|
|
|
val = MIN_##type + (MIN_##type - val); \
|
|
|
|
else \
|
|
|
|
break; \
|
|
|
|
} while (1); \
|
|
|
|
*d++ = val; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
static void \
|
|
|
|
gst_audio_amplify_transform_##type##_noclip (GstAudioAmplify * filter, \
|
|
|
|
void * data, guint num_samples) \
|
|
|
|
{ \
|
|
|
|
type *d = data; \
|
|
|
|
\
|
|
|
|
while (num_samples--) \
|
|
|
|
*d++ *= filter->amplification; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MAKE_FLOAT_FUNCS(type) \
|
|
|
|
static void \
|
|
|
|
gst_audio_amplify_transform_##type##_clip (GstAudioAmplify * filter, \
|
|
|
|
void * data, guint num_samples) \
|
|
|
|
{ \
|
|
|
|
type *d = data; \
|
|
|
|
\
|
|
|
|
while (num_samples--) { \
|
|
|
|
type val = *d* filter->amplification; \
|
|
|
|
*d++ = CLAMP (val, -1.0, +1.0); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
static void \
|
|
|
|
gst_audio_amplify_transform_##type##_wrap_negative (GstAudioAmplify * \
|
|
|
|
filter, void * data, guint num_samples) \
|
|
|
|
{ \
|
|
|
|
type *d = data; \
|
|
|
|
\
|
|
|
|
while (num_samples--) { \
|
|
|
|
type val = *d * filter->amplification; \
|
|
|
|
do { \
|
|
|
|
if (val > 1.0) \
|
|
|
|
val = -1.0 + (val - 1.0); \
|
|
|
|
else if (val < -1.0) \
|
|
|
|
val = 1.0 - (1.0 - val); \
|
|
|
|
else \
|
|
|
|
break; \
|
|
|
|
} while (1); \
|
|
|
|
*d++ = val; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
static void \
|
|
|
|
gst_audio_amplify_transform_##type##_wrap_positive (GstAudioAmplify * filter, \
|
|
|
|
void * data, guint num_samples) \
|
|
|
|
{ \
|
|
|
|
type *d = data; \
|
|
|
|
\
|
|
|
|
while (num_samples--) { \
|
|
|
|
type val = *d* filter->amplification; \
|
|
|
|
do { \
|
|
|
|
if (val > 1.0) \
|
|
|
|
val = 1.0 - (val - 1.0); \
|
|
|
|
else if (val < -1.0) \
|
|
|
|
val = -1.0 + (-1.0 - val); \
|
|
|
|
else \
|
|
|
|
break; \
|
|
|
|
} while (1); \
|
|
|
|
*d++ = val; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
static void \
|
|
|
|
gst_audio_amplify_transform_##type##_noclip (GstAudioAmplify * filter, \
|
|
|
|
void * data, guint num_samples) \
|
|
|
|
{ \
|
|
|
|
type *d = data; \
|
|
|
|
\
|
|
|
|
while (num_samples--) \
|
|
|
|
*d++ *= filter->amplification; \
|
|
|
|
}
|
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
2009-06-21 15:13:43 +00:00
|
|
|
MAKE_INT_FUNCS (gint8,gint)
|
|
|
|
MAKE_INT_FUNCS (gint16,gint)
|
|
|
|
MAKE_INT_FUNCS (gint32,gint64)
|
2009-06-19 20:20:45 +00:00
|
|
|
MAKE_FLOAT_FUNCS (gfloat)
|
|
|
|
MAKE_FLOAT_FUNCS (gdouble)
|
2009-06-21 07:50:54 +00:00
|
|
|
/* *INDENT-ON* */
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
|
|
|
/* GObject vmethod implementations */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_audio_amplify_class_init (GstAudioAmplifyClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2011-04-25 10:49:36 +00:00
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_audio_amplify_debug, "audioamplify", 0,
|
|
|
|
"audioamplify element");
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
2011-04-25 10:49:36 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
gobject_class->set_property = gst_audio_amplify_set_property;
|
|
|
|
gobject_class->get_property = gst_audio_amplify_get_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_AMPLIFICATION,
|
|
|
|
g_param_spec_float ("amplification", "Amplification",
|
2010-01-13 08:22:20 +00:00
|
|
|
"Factor of amplification", -G_MAXFLOAT, G_MAXFLOAT,
|
2010-10-13 14:21:23 +00:00
|
|
|
1.0,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstAudioAmplify:clipping-method
|
|
|
|
*
|
|
|
|
* Clipping method: clip mode set values higher than the maximum to the
|
|
|
|
* maximum. The wrap-negative mode pushes those values back from the
|
|
|
|
* opposite side, wrap-positive pushes them back from the same side.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_CLIPPING_METHOD,
|
|
|
|
g_param_spec_enum ("clipping-method", "Clipping method",
|
|
|
|
"Selects how to handle values higher than the maximum",
|
|
|
|
GST_TYPE_AUDIO_AMPLIFY_CLIPPING_METHOD, METHOD_CLIP,
|
2010-10-13 14:21:23 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Audio amplifier",
|
2011-04-25 10:49:36 +00:00
|
|
|
"Filter/Effect/Audio",
|
|
|
|
"Amplifies an audio stream by a given factor",
|
|
|
|
"Sebastian Dröge <slomo@circular-chaos.org>");
|
|
|
|
|
|
|
|
caps = gst_caps_from_string (ALLOWED_CAPS);
|
|
|
|
gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
|
|
|
|
caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_amplify_transform_ip);
|
2012-04-02 09:13:09 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip_on_passthrough = FALSE;
|
|
|
|
|
|
|
|
GST_AUDIO_FILTER_CLASS (klass)->setup =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_amplify_setup);
|
2020-05-29 23:29:03 +00:00
|
|
|
|
2020-06-05 22:42:25 +00:00
|
|
|
gst_type_mark_as_plugin_api (GST_TYPE_AUDIO_AMPLIFY_CLIPPING_METHOD, 0);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-25 10:49:36 +00:00
|
|
|
gst_audio_amplify_init (GstAudioAmplify * filter)
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
{
|
|
|
|
filter->amplification = 1.0;
|
2009-06-19 20:20:45 +00:00
|
|
|
gst_audio_amplify_set_process_function (filter, METHOD_CLIP,
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S16);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
gst_base_transform_set_in_place (GST_BASE_TRANSFORM (filter), TRUE);
|
2008-01-08 14:58:18 +00:00
|
|
|
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (filter), TRUE);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 20:20:45 +00:00
|
|
|
static GstAudioAmplifyProcessFunc
|
2011-08-19 09:49:44 +00:00
|
|
|
gst_audio_amplify_process_function (gint clipping, GstAudioFormat format)
|
2009-06-19 20:20:45 +00:00
|
|
|
{
|
2009-06-21 07:50:54 +00:00
|
|
|
static const struct process
|
|
|
|
{
|
2011-08-19 09:49:44 +00:00
|
|
|
GstAudioFormat format;
|
2009-06-19 20:20:45 +00:00
|
|
|
gint clipping;
|
|
|
|
GstAudioAmplifyProcessFunc func;
|
2009-06-21 07:50:54 +00:00
|
|
|
} process[] = {
|
|
|
|
{
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_F32, METHOD_CLIP, gst_audio_amplify_transform_gfloat_clip}, {
|
|
|
|
GST_AUDIO_FORMAT_F32, METHOD_WRAP_NEGATIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gfloat_wrap_negative}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_F32, METHOD_WRAP_POSITIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gfloat_wrap_positive}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_F32, METHOD_NOCLIP,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gfloat_noclip}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_F64, METHOD_CLIP,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gdouble_clip}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_F64, METHOD_WRAP_NEGATIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gdouble_wrap_negative}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_F64, METHOD_WRAP_POSITIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gdouble_wrap_positive}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_F64, METHOD_NOCLIP,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gdouble_noclip}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S8, METHOD_CLIP, gst_audio_amplify_transform_gint8_clip}, {
|
|
|
|
GST_AUDIO_FORMAT_S8, METHOD_WRAP_NEGATIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint8_wrap_negative}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S8, METHOD_WRAP_POSITIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint8_wrap_positive}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S8, METHOD_NOCLIP,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint8_noclip}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S16, METHOD_CLIP, gst_audio_amplify_transform_gint16_clip}, {
|
|
|
|
GST_AUDIO_FORMAT_S16, METHOD_WRAP_NEGATIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint16_wrap_negative}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S16, METHOD_WRAP_POSITIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint16_wrap_positive}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S16, METHOD_NOCLIP,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint16_noclip}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S32, METHOD_CLIP, gst_audio_amplify_transform_gint32_clip}, {
|
|
|
|
GST_AUDIO_FORMAT_S32, METHOD_WRAP_NEGATIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint32_wrap_negative}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S32, METHOD_WRAP_POSITIVE,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint32_wrap_positive}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
GST_AUDIO_FORMAT_S32, METHOD_NOCLIP,
|
2009-06-21 07:50:54 +00:00
|
|
|
gst_audio_amplify_transform_gint32_noclip}, {
|
2011-08-19 09:49:44 +00:00
|
|
|
0, 0, NULL}
|
2009-06-19 20:20:45 +00:00
|
|
|
};
|
2009-06-21 07:50:54 +00:00
|
|
|
const struct process *p;
|
2009-06-19 20:20:45 +00:00
|
|
|
|
|
|
|
for (p = process; p->func; p++)
|
2011-08-19 09:49:44 +00:00
|
|
|
if (p->format == format && p->clipping == clipping)
|
2009-06-19 20:20:45 +00:00
|
|
|
return p->func;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
static gboolean
|
2009-06-19 20:20:45 +00:00
|
|
|
gst_audio_amplify_set_process_function (GstAudioAmplify * filter, gint
|
2011-08-19 09:49:44 +00:00
|
|
|
clipping_method, GstAudioFormat format)
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
{
|
2009-06-19 20:20:45 +00:00
|
|
|
GstAudioAmplifyProcessFunc process;
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
|
|
|
/* set processing function */
|
|
|
|
|
2011-08-19 09:49:44 +00:00
|
|
|
process = gst_audio_amplify_process_function (clipping_method, format);
|
2009-06-19 20:20:45 +00:00
|
|
|
if (!process) {
|
|
|
|
GST_DEBUG ("wrong format");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
filter->process = process;
|
|
|
|
filter->clipping_method = clipping_method;
|
|
|
|
filter->format = format;
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_audio_amplify_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstAudioAmplify *filter = GST_AUDIO_AMPLIFY (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_AMPLIFICATION:
|
|
|
|
filter->amplification = g_value_get_float (value);
|
|
|
|
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter),
|
|
|
|
filter->amplification == 1.0);
|
|
|
|
break;
|
|
|
|
case PROP_CLIPPING_METHOD:
|
2009-06-19 20:20:45 +00:00
|
|
|
gst_audio_amplify_set_process_function (filter, g_value_get_enum (value),
|
2011-08-19 09:49:44 +00:00
|
|
|
filter->format);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_audio_amplify_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstAudioAmplify *filter = GST_AUDIO_AMPLIFY (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_AMPLIFICATION:
|
|
|
|
g_value_set_float (value, filter->amplification);
|
|
|
|
break;
|
|
|
|
case PROP_CLIPPING_METHOD:
|
|
|
|
g_value_set_enum (value, filter->clipping_method);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-06 11:16:49 +00:00
|
|
|
/* GstAudioFilter vmethod implementations */
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
static gboolean
|
2011-08-19 14:09:48 +00:00
|
|
|
gst_audio_amplify_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
{
|
|
|
|
GstAudioAmplify *filter = GST_AUDIO_AMPLIFY (base);
|
|
|
|
|
2009-06-19 20:20:45 +00:00
|
|
|
return gst_audio_amplify_set_process_function (filter,
|
2011-08-19 09:49:44 +00:00
|
|
|
filter->clipping_method, GST_AUDIO_INFO_FORMAT (info));
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
}
|
|
|
|
|
2007-02-06 11:16:49 +00:00
|
|
|
/* GstBaseTransform vmethod implementations */
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_audio_amplify_transform_ip (GstBaseTransform * base, GstBuffer * buf)
|
|
|
|
{
|
|
|
|
GstAudioAmplify *filter = GST_AUDIO_AMPLIFY (base);
|
2010-03-08 19:28:47 +00:00
|
|
|
guint num_samples;
|
|
|
|
GstClockTime timestamp, stream_time;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
2010-03-08 19:28:47 +00:00
|
|
|
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
stream_time =
|
|
|
|
gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (filter, "sync to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp));
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
2010-03-08 19:28:47 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
2011-11-04 17:41:36 +00:00
|
|
|
gst_object_sync_values (GST_OBJECT (filter), stream_time);
|
2010-03-08 19:28:47 +00:00
|
|
|
|
2012-04-02 09:13:09 +00:00
|
|
|
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)))
|
2008-01-08 14:58:18 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READWRITE);
|
|
|
|
num_samples = map.size / GST_AUDIO_FILTER_BPS (filter);
|
2011-04-25 10:49:36 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
filter->process (filter, map.data, num_samples);
|
2011-04-25 10:49:36 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
gst/audiofx/: Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" eleme...
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audioamplify.c:
(gst_audio_amplify_clipping_method_get_type),
(gst_audio_amplify_base_init), (gst_audio_amplify_class_init),
(gst_audio_amplify_init), (gst_audio_amplify_set_process_function),
(gst_audio_amplify_set_property), (gst_audio_amplify_get_property),
(gst_audio_amplify_set_caps),
(gst_audio_amplify_transform_int_clip),
(gst_audio_amplify_transform_int_wrap_negative),
(gst_audio_amplify_transform_int_wrap_positive),
(gst_audio_amplify_transform_float_clip),
(gst_audio_amplify_transform_float_wrap_negative),
(gst_audio_amplify_transform_float_wrap_positive),
(gst_audio_amplify_transform_ip):
* gst/audiofx/audioamplify.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add new element "audioamplify". This allows scaling of raw audio
samples, similar to the "volume" element, but provides different modes
for clipping and allows unlimited amplification. It's mainly targeted
for creative sound design and not as a replacement of the "volume"
element. Fixes #397162
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
Add docs for audioamplify and integrate them into the build system
* tests/check/Makefile.am:
* tests/check/elements/audioamplify.c: (setup_amplify),
(cleanup_amplify), (GST_START_TEST), (amplify_suite), (main):
Add fairly extensive unit test suite for audioamplify
2007-01-24 12:41:03 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|