mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
gst/audiotestsrc/gstaudiotestsrc.*: Add 'ticks', a 1/30 second sine wave pulse every second.
Original commit message from CVS: * gst/audiotestsrc/gstaudiotestsrc.c: * gst/audiotestsrc/gstaudiotestsrc.h: Add 'ticks', a 1/30 second sine wave pulse every second.
This commit is contained in:
parent
47eafd3466
commit
cc74285d12
3 changed files with 49 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2008-07-16 David Schleef <ds@schleef.org>
|
||||||
|
|
||||||
|
* gst/audiotestsrc/gstaudiotestsrc.c:
|
||||||
|
* gst/audiotestsrc/gstaudiotestsrc.h:
|
||||||
|
Add 'ticks', a 1/30 second sine wave pulse every second.
|
||||||
|
|
||||||
2008-07-15 David Schleef <ds@schleef.org>
|
2008-07-15 David Schleef <ds@schleef.org>
|
||||||
|
|
||||||
* gst-libs/gst/video/video.c: Revert ABI change.
|
* gst-libs/gst/video/video.c: Revert ABI change.
|
||||||
|
|
|
@ -121,6 +121,7 @@ gst_audiostestsrc_wave_get_type (void)
|
||||||
{GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, "White noise", "white-noise"},
|
{GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, "White noise", "white-noise"},
|
||||||
{GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE, "Pink noise", "pink-noise"},
|
{GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE, "Pink noise", "pink-noise"},
|
||||||
{GST_AUDIO_TEST_SRC_WAVE_SINE_TAB, "Sine table", "sine table"},
|
{GST_AUDIO_TEST_SRC_WAVE_SINE_TAB, "Sine table", "sine table"},
|
||||||
|
{GST_AUDIO_TEST_SRC_WAVE_TICKS, "Periodic Ticks", "ticks"},
|
||||||
{0, NULL, NULL},
|
{0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -659,6 +660,41 @@ static ProcessFunc sine_table_funcs[] = {
|
||||||
(ProcessFunc) gst_audio_test_src_create_sine_table_double
|
(ProcessFunc) gst_audio_test_src_create_sine_table_double
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DEFINE_TICKS(type,scale) \
|
||||||
|
static void \
|
||||||
|
gst_audio_test_src_create_tick_##type (GstAudioTestSrc * src, g##type * samples) \
|
||||||
|
{ \
|
||||||
|
gint i; \
|
||||||
|
gdouble step, scl; \
|
||||||
|
\
|
||||||
|
step = M_PI_M2 * src->freq / src->samplerate; \
|
||||||
|
scl = 1024.0 / M_PI_M2; \
|
||||||
|
\
|
||||||
|
for (i = 0; i < src->generate_samples_per_buffer; i++) { \
|
||||||
|
src->accumulator += step; \
|
||||||
|
if (src->accumulator >= M_PI_M2) \
|
||||||
|
src->accumulator -= M_PI_M2; \
|
||||||
|
\
|
||||||
|
if ((src->n_samples + i)%src->samplerate < 1600) { \
|
||||||
|
samples[i] = (g##type) scale * src->wave_table[(gint) (src->accumulator * scl)]; \
|
||||||
|
} else { \
|
||||||
|
samples[i] = 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_TICKS (int16, 32767.0);
|
||||||
|
DEFINE_TICKS (int32, 2147483647.0);
|
||||||
|
DEFINE_TICKS (float, 1.0);
|
||||||
|
DEFINE_TICKS (double, 1.0);
|
||||||
|
|
||||||
|
static ProcessFunc tick_funcs[] = {
|
||||||
|
(ProcessFunc) gst_audio_test_src_create_tick_int16,
|
||||||
|
(ProcessFunc) gst_audio_test_src_create_tick_int32,
|
||||||
|
(ProcessFunc) gst_audio_test_src_create_tick_float,
|
||||||
|
(ProcessFunc) gst_audio_test_src_create_tick_double
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gst_audio_test_src_change_wave:
|
* gst_audio_test_src_change_wave:
|
||||||
* Assign function pointer of wave genrator.
|
* Assign function pointer of wave genrator.
|
||||||
|
@ -698,6 +734,10 @@ gst_audio_test_src_change_wave (GstAudioTestSrc * src)
|
||||||
gst_audio_test_src_init_sine_table (src);
|
gst_audio_test_src_init_sine_table (src);
|
||||||
src->process = sine_table_funcs[src->format];
|
src->process = sine_table_funcs[src->format];
|
||||||
break;
|
break;
|
||||||
|
case GST_AUDIO_TEST_SRC_WAVE_TICKS:
|
||||||
|
gst_audio_test_src_init_sine_table (src);
|
||||||
|
src->process = tick_funcs[src->format];
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
GST_ERROR ("invalid wave-form");
|
GST_ERROR ("invalid wave-form");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -48,6 +48,7 @@ G_BEGIN_DECLS
|
||||||
* @GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE: white noise
|
* @GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE: white noise
|
||||||
* @GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE: pink noise
|
* @GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE: pink noise
|
||||||
* @GST_AUDIO_TEST_SRC_WAVE_SINE_TAB: sine wave using a table
|
* @GST_AUDIO_TEST_SRC_WAVE_SINE_TAB: sine wave using a table
|
||||||
|
* @GST_AUDIO_TEST_SRC_WAVE_TICKS: periodic ticks
|
||||||
*
|
*
|
||||||
* Different types of supported sound waves.
|
* Different types of supported sound waves.
|
||||||
*/
|
*/
|
||||||
|
@ -59,7 +60,8 @@ typedef enum {
|
||||||
GST_AUDIO_TEST_SRC_WAVE_SILENCE,
|
GST_AUDIO_TEST_SRC_WAVE_SILENCE,
|
||||||
GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE,
|
GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE,
|
||||||
GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE,
|
GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE,
|
||||||
GST_AUDIO_TEST_SRC_WAVE_SINE_TAB
|
GST_AUDIO_TEST_SRC_WAVE_SINE_TAB,
|
||||||
|
GST_AUDIO_TEST_SRC_WAVE_TICKS
|
||||||
} GstAudioTestSrcWave;
|
} GstAudioTestSrcWave;
|
||||||
|
|
||||||
#define PINK_MAX_RANDOM_ROWS (30)
|
#define PINK_MAX_RANDOM_ROWS (30)
|
||||||
|
|
Loading…
Reference in a new issue