Mercurial > audlegacy-plugins
changeset 183:37b53a5a9aa4 trunk
[svn] - allow waves to be drawn with a custom value instead of just 255
author | nenolod |
---|---|
date | Wed, 01 Nov 2006 21:52:23 -0800 |
parents | 6048abdac7d1 |
children | 8e77ac977ca1 |
files | ChangeLog src/paranormal/wave.c |
diffstat | 2 files changed, 25 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Nov 01 20:50:58 2006 -0800 +++ b/ChangeLog Wed Nov 01 21:52:23 2006 -0800 @@ -1,3 +1,15 @@ +2006-11-02 04:50:58 +0000 William Pitcock <nenolod@nenolod.net> + revision [364] + - add value replace filter, replaces a range of values with a different value + - add preset which demonstrates how this can be abused + + trunk/src/paranormal/builtins.c | 2 + trunk/src/paranormal/general.c | 38 +++++++++++ + trunk/src/paranormal/presets/Makefile | 3 + trunk/src/paranormal/presets/nenolod_-_value_replace_fun.pnv | 31 ++++++++ + 4 files changed, 73 insertions(+), 1 deletion(-) + + 2006-11-01 21:19:36 +0000 William Pitcock <nenolod@nenolod.net> revision [362] - add value invert filter
--- a/src/paranormal/wave.c Wed Nov 01 20:50:58 2006 -0800 +++ b/src/paranormal/wave.c Wed Nov 01 21:52:23 2006 -0800 @@ -11,6 +11,7 @@ { {"channels", "Which sound channels to use: negative = channel 1, \npositive = channel 2, " "zero = both (two wave-forms.)", OPT_TYPE_INT, {ival: -1} }, + {"value", "The colour value to use.", OPT_TYPE_INT, {ival: 255} }, { 0 } }; @@ -20,6 +21,7 @@ { int i; int channel = ( opts[0].val.ival < 0 ) ? 0 : 1; + guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival; for (i=0; i<pn_image_data->width; i++) { @@ -29,7 +31,7 @@ - CAP (pn_sound_data->pcm_data[channel] [i*512/pn_image_data->width]>>8, (pn_image_data->height>>1)-1))] - = 0xff; + = value; } /*both channels, at 1/4 and 3/4 of the screen*/ @@ -38,13 +40,13 @@ CAP( (pn_sound_data->pcm_data[0] [i*512/pn_image_data->width]>>9), (pn_image_data->height>>2)-1))] - = 0xff; + = value; pn_image_data->surface[0][PN_IMG_INDEX( i, 3*(pn_image_data->height>>2) - CAP( (pn_sound_data->pcm_data[1] [i*512/pn_image_data->width]>>9), (pn_image_data->height>>2)-1))] - = 0xff; + = value; } } } @@ -63,6 +65,7 @@ { {"channels", "Which sound channels to use: negative = channel 1, \npositive = channel 2, " "zero = both (two wave-forms.)", OPT_TYPE_INT, {ival: -1} }, + {"value", "The colour value to use.", OPT_TYPE_INT, {ival: 255} }, { 0 } }; @@ -72,6 +75,7 @@ { int i; int channel = ( opts[0].val.ival < 0 ) ? 0 : 1; + guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival; for (i=0; i<pn_image_data->height; i++) { if ( opts[0].val.ival ) { @@ -79,20 +83,20 @@ - CAP (pn_sound_data->pcm_data[channel] [i*512/pn_image_data->height]>>8, (pn_image_data->width>>1)-1), i)] - = 0xff; + = value; } else { pn_image_data->surface[0][PN_IMG_INDEX ((pn_image_data->width>>2) - CAP (pn_sound_data->pcm_data[0] [i*512/pn_image_data->height]>>9, (pn_image_data->width>>2)-1), i)] - = 0xff; + = value; pn_image_data->surface[0][PN_IMG_INDEX ((3*pn_image_data->width>>2) -CAP (pn_sound_data->pcm_data[1] [i*512/pn_image_data->height]>>9, (pn_image_data->width>>2)-1), i)] - = 0xff; + = value; } } } @@ -216,6 +220,7 @@ { { "base_radius", " ", OPT_TYPE_FLOAT, { fval: 0 } }, + {"value", "The colour value to use.", OPT_TYPE_INT, {ival: 255} }, { 0 } }; @@ -224,6 +229,7 @@ gpointer data) { int i, x, y; + guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival; for(i=0; i<360; i++) { @@ -236,7 +242,7 @@ pn_image_data->surface[0][PN_IMG_INDEX (CAPHILO(x,pn_image_data->width,0), CAPHILO(y,pn_image_data->height,0))] - = 0xff; + = value; } };