Mercurial > audlegacy-plugins
diff src/disk_writer/disk_writer.c @ 658:a9199ee8e5c0 trunk
[svn] - disk writer: do effects processing.
- flac113 plugin: pass a valid InputPlayback reference to the thread
constructor. closes #797 for real.
author | nenolod |
---|---|
date | Thu, 15 Feb 2007 23:36:36 -0800 |
parents | d124034ebea3 |
children | 4a2e5c1e7c3b |
line wrap: on
line diff
--- a/src/disk_writer/disk_writer.c Thu Feb 15 19:28:20 2007 -0800 +++ b/src/disk_writer/disk_writer.c Thu Feb 15 23:36:36 2007 -0800 @@ -34,6 +34,14 @@ #include "audacious/util.h" #include "audacious/vfs.h" + +struct format_info { + AFormat format; + int frequency; + int channels; +}; +struct format_info input; + struct wavhead { guint32 main_chunk; @@ -193,6 +201,10 @@ header.data_length = GUINT32_TO_LE(0); vfs_fwrite(&header, sizeof (struct wavhead), 1, output_file); + input.format = fmt; + input.frequency = rate; + input.channels = nch; + return 1; } @@ -250,6 +262,26 @@ static void disk_write(void *ptr, gint length) { + AFormat new_format; + int new_frequency, new_channels; + EffectPlugin *ep; + + new_format = input.format; + new_frequency = input.frequency; + new_channels = input.channels; + + ep = get_current_effect_plugin(); + if ( effects_enabled() && ep && ep->query_format ) { + ep->query_format(&new_format,&new_frequency,&new_channels); + } + + if ( effects_enabled() && ep && ep->mod_samples ) { + length = ep->mod_samples(&ptr,length, + input.format, + input.frequency, + input.channels ); + } + if (afmt == FMT_S8 || afmt == FMT_S16_BE || afmt == FMT_U16_LE || afmt == FMT_U16_BE || afmt == FMT_U16_NE) convert_buffer(ptr, length);