Audio-C4Stream-Wav

 view release on metacpan or  search on metacpan

lib/Audio/C4Stream/Wav.pm  view on Meta::CPAN


	my $wavDraw = WAV_init_draw(
		$this->{_wavReader},
		{
			data_size => $read->length,
			data_len  => $read->length_seconds,
			font      => 'fonts/ arialbd . ttf '
		}
	);

	my $png;
	WAV_draw( $wavDraw, 634, 77 * 2 + 2 + 6, $png );

	WAV_final_draw($wavDraw);

	return $png;
}

sub getNextRawData {
	my $this = shift;

	my $data;
	WAV_read_block( $this->{_wavReader}, $data );

	return $data;
}

lib/Audio/C4Stream/Wav.pm  view on Meta::CPAN

	gdImagePtr im;
	int styleDotted[4];
  	int white, blue, orange, color, hblue, lblue, green, second, thrid;
  	int i, r, offset, data_size;
  	int xval, yval1, yval2, ymin1, ymin2, ymax1, ymax2;
  	int xtmp = 0, ytmp = 0, lx, ly1 = 0, ly2 = 0;
  	int draw1, draw2, pos;
  	int limit, mlimit1, mlimit2;
  	double step, curr;
  	char *font = "fonts/db.ttf";
  	char *png_ptr, *err;
  	int brect[8];
	
	if ((im = gdImageCreate(width, height)) == NULL) {
		fprintf(stderr, "gdImageCreate failed");
		return NULL;
	}
	
	white = gdImageColorAllocate(im, 255, 255, 255 );
	gdImageRectangle(im, 0, 0, width, height, white);
	

lib/Audio/C4Stream/Wav.pm  view on Meta::CPAN

	gdImageLine(im, 0, mlimit2, width, mlimit2, second);
	gdImageLine(im, 0, mlimit2 + 1, width, mlimit2 + 1, blue);
	
	gdImageSetStyle(im, styleDotted, 4);
	gdImageLine(im, 1, height / 8 - 1, width - 2, height / 8 - 1, gdStyled);
	gdImageLine(im, 1, mlimit2 + height / 8 + 1, width - 2, mlimit2 + height / 8 + 1, gdStyled);
	gdImageLine(im, 1, mlimit2 - height / 8 + 1, width - 2, mlimit2 - height / 8 + 1, gdStyled);
	gdImageLine(im, 1, mlimit1 + height / 8 - 1, width - 2, mlimit1 + height / 8 - 1, gdStyled);
	
	
	png_ptr = gdImagePngPtr(im, size);

	lseek (draw->reader->fd, pos, 0);
	
	return png_ptr;

}

int WAV_draw (int draw_ptr, int width, int height, SV *png) {
	char *png_ptr;
	int size;
	
	if ((png_ptr = wav_draw ((struct wav_draw_s *) draw_ptr, width, height, &size)) == NULL) {
		return 0;
	}
	
	sv_setpvn(png, png_ptr, size);
	
	return size;
}



( run in 1.074 second using v1.01-cache-2.11-cpan-df04353d9ac )