const VisPluginInfo *get_plugin_info (void)
{
	static VisActorPlugin actor = {
		.requisition = lv_goom_requisition,
		.palette = lv_goom_palette,
		.render = lv_goom_render,
		.vidoptions.depth = VISUAL_VIDEO_DEPTH_32BIT
	};

	static VisPluginInfo info = {
		.type = VISUAL_PLUGIN_TYPE_ACTOR,

		.plugname = "goom2k4",
		.name = "libvisual goom2k4 plugin",
		.author = "Dennis Smit <*****@*****.**>, goom2k4 by: Jean-Christophe Hoelt <*****@*****.**>",
		.version = "0.1",
		.about = N_("Libvisual goom2k4 plugin"),
		.help = N_("This plugin adds support for the supercool goom2k4 plugin that is simply awesome"),
		.license = VISUAL_PLUGIN_LICENSE_LGPL,

		.init = lv_goom_init,
		.cleanup = lv_goom_cleanup,
		.events = lv_goom_events,

		.plugin = VISUAL_OBJECT (&actor)
	};

	return &info;
}

static int lv_goom_init (VisPluginData *plugin)
{
	GoomPrivate *priv;

#if ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
#endif

	priv = visual_mem_new0 (GoomPrivate, 1);
	visual_object_set_private (VISUAL_OBJECT (plugin), priv);

	priv->goominfo = goom_init (128, 128);

	priv->pcmbuf1 = visual_buffer_new ();
	priv->pcmbuf2 = visual_buffer_new ();

	return 0;
}
static int act_infinite_render (VisPluginData *plugin, VisVideo *video, VisAudio *audio)
{
	VisBuffer *buffer;
	InfinitePrivate *priv;

	visual_return_val_if_fail (plugin != NULL, -1);
	visual_return_val_if_fail (video != NULL, -1);
	visual_return_val_if_fail (audio != NULL, -1);

	priv = visual_object_get_private (VISUAL_OBJECT (plugin));

	buffer = visual_buffer_new ();

	visual_buffer_set_data_pair (buffer, priv->pcm_data[0], sizeof (float) * 512);
	visual_audio_get_sample (audio, buffer, VISUAL_AUDIO_CHANNEL_LEFT);

	visual_buffer_set_data_pair (buffer, priv->pcm_data[1], sizeof (float) * 512);
	visual_audio_get_sample (audio, buffer, VISUAL_AUDIO_CHANNEL_LEFT);

	_inf_renderer (priv);
	_inf_display (priv, (uint8_t *) visual_video_get_pixels (video), video->pitch);

	visual_buffer_free (buffer);

	return 0;
}
Beispiel #3
0
int visual_video_init (VisVideo *video)
{
	visual_return_val_if_fail (video != NULL, -VISUAL_ERROR_VIDEO_NULL);

	/* Do the VisObject initialization */
	visual_object_clear (VISUAL_OBJECT (video));
	visual_object_set_dtor (VISUAL_OBJECT (video), video_dtor);
	visual_object_set_allocated (VISUAL_OBJECT (video), FALSE);

	/* Reset the VisVideo data */
	video->buffer = visual_buffer_new ();

	video->pixel_rows = NULL;

	visual_video_set_attributes (video, 0, 0, 0, VISUAL_VIDEO_DEPTH_NONE);
	visual_video_set_buffer (video, NULL);
	visual_video_set_palette (video, NULL);

	video->parent = NULL;
	video->rect = visual_rectangle_new_empty ();

	/* Composite control */
	video->compositetype = VISUAL_VIDEO_COMPOSITE_TYPE_SRC;

	/* Colors */
	video->colorkey = visual_color_new ();

	return VISUAL_OK;
}
Beispiel #4
0
int visual_audio_samplepool_input_channel (VisAudioSamplePool *samplepool, VisBuffer *buffer,
		VisAudioSampleRateType rate,
		VisAudioSampleFormatType format,
		const char *channelid)
{
	VisAudioSample *sample;
	VisBuffer *pcmbuf;
	VisTime timestamp;

	visual_return_val_if_fail (samplepool != NULL, -VISUAL_ERROR_AUDIO_SAMPLEPOOL_NULL);
	visual_return_val_if_fail (buffer != NULL, -VISUAL_ERROR_BUFFER_NULL);

	pcmbuf = visual_buffer_new ();
	visual_buffer_clone (pcmbuf, buffer);

	visual_time_get (&timestamp);

	visual_buffer_set_destroyer (pcmbuf, visual_buffer_destroyer_free);

	sample = visual_audio_sample_new (pcmbuf, &timestamp, format, rate);
	visual_audio_samplepool_add (samplepool, sample, channelid);

	return VISUAL_OK;
}
static int lv_flower_render (VisPluginData *plugin, VisVideo *video, VisAudio *audio)
{
	FlowerPrivate *priv = visual_object_get_private (VISUAL_OBJECT (plugin));
	VisBuffer *pcmbuf;
	VisBuffer *freqbuf;
	float pcm[512];
	float freqnorm[256];
	float temp_bars[NOTCH_BANDS];
	float f;
	int b;
	int i;

	pcmbuf = visual_buffer_new ();
	freqbuf = visual_buffer_new ();

	visual_buffer_set_data_pair (pcmbuf, pcm, sizeof (pcm));
	visual_buffer_set_data_pair (freqbuf, freqnorm, sizeof (freqnorm));

	visual_audio_get_sample_mixed_simple (audio, pcmbuf, 2,
			VISUAL_AUDIO_CHANNEL_LEFT,
			VISUAL_AUDIO_CHANNEL_RIGHT);

	visual_audio_get_spectrum_for_sample (freqbuf, pcmbuf, TRUE);

	/* Activate the effect change timer */
	if (!visual_timer_is_active (priv->t))
		visual_timer_start (priv->t);

	/* At 15 secs, do with new settings, reset timer */
	if (visual_timer_is_past2 (priv->t, 15, 0)) {
		priv->flower.tension_new = (-visual_random_context_float (priv->rcxt)) * 12.0;
		priv->flower.continuity_new = (visual_random_context_float (priv->rcxt) - 0.5) * 32.0;

		visual_timer_start (priv->t);
	}

	/* Activate global timer */
	if (!visual_timer_is_active (priv->flower.timer))
		visual_timer_start (priv->flower.timer);

	for (b=0; b<priv->nof_bands; b++)
		temp_bars[b]=0.0;

	for (i=0; i<256; i++) {
		for (b=0; b<priv->nof_bands; b++) {
			f=process_notch (priv->notch[b], freqnorm[i] * 15);
			if (fabs(f)>temp_bars[b])
				temp_bars[b]=fabs(f);
		}
	}


	/* Not part of the if !!! */
	{
#define HEIGHT 1.0
#define D 0.45
#define TAU 0.25
#define DIF 5.0
		float lk=2.0;
		float l0=2.0;

		float scale = HEIGHT / ( log((1 - D) / D) * 2 );
		float x00 = D*D*1.0/(2 * D - 1);
		float y00 = -log(-x00) * scale;
		float y;
		int i;
		for (i=0; i<priv->nof_bands; i++) {
			y=temp_bars[i * 8];
			y=y*(i*lk+l0);

			y = ( log(y - x00) * scale + y00 ); /* Logarithmic amplitude */

			y = ( (DIF-2.0)*y +
					(i==0  ? 0 : temp_bars[i - 1]) +
					(i==31 ? 0 : temp_bars[i + 1])) / DIF;

			y=((1.0-TAU)*priv->flower.audio_bars[i]+TAU*y) * 1.00;
			priv->flower.audio_bars[i]=y;
		}
	}


	priv->flower.roty += (priv->flower.audio_bars[15]) * 0.6;
	priv->flower.rotx += (priv->flower.audio_bars[1]) * 0.7;
	priv->flower.posz = +1;

	render_flower_effect (&priv->flower);

	visual_buffer_free (pcmbuf);
	visual_buffer_free (freqbuf);

	return 0;
}