+ if(file_info_.has_replaygain && flac_cfg.output.replaygain.enable) {
+ if(flac_cfg.output.resolution.replaygain.bps_out == 8) {
+ file_info_.sample_format = FMT_U8;
+ file_info_.sample_format_bytes_per_sample = 1;
+ }
+ else if(flac_cfg.output.resolution.replaygain.bps_out == 16) {
+ file_info_.sample_format = (is_big_endian_host_) ? FMT_S16_BE : FMT_S16_LE;
+ file_info_.sample_format_bytes_per_sample = 2;
+ }
+ else {
+ /*@@@ need some error here like wa2: MessageBox(mod_.hMainWindow, "ERROR: plugin can only handle 8/16-bit samples\n", "ERROR: plugin can only handle 8/16-bit samples", 0); */
+ fprintf(stderr, "libxmms-flac: can't handle %d bit output\n", flac_cfg.output.resolution.replaygain.bps_out);
+ safe_decoder_finish_(decoder_);
+ return;
+ }
+ }
+ else {
+ if(file_info_.bits_per_sample == 8) {
+ file_info_.sample_format = FMT_U8;
+ file_info_.sample_format_bytes_per_sample = 1;
+ }
+ else if(file_info_.bits_per_sample == 16 || (file_info_.bits_per_sample == 24 && flac_cfg.output.resolution.normal.dither_24_to_16)) {
+ file_info_.sample_format = (is_big_endian_host_) ? FMT_S16_BE : FMT_S16_LE;
+ file_info_.sample_format_bytes_per_sample = 2;
+ }
+ else {
+ /*@@@ need some error here like wa2: MessageBox(mod_.hMainWindow, "ERROR: plugin can only handle 8/16-bit samples\n", "ERROR: plugin can only handle 8/16-bit samples", 0); */
+ fprintf(stderr, "libxmms-flac: can't handle %d bit output\n", file_info_.bits_per_sample);
+ safe_decoder_finish_(decoder_);
+ return;
+ }
+ }
+ FLAC__replaygain_synthesis__init_dither_context(&file_info_.dither_context, file_info_.sample_format_bytes_per_sample * 8, flac_cfg.output.resolution.replaygain.noise_shaping);