Mercurial > audlegacy
changeset 256:84aabc053b6e trunk
[svn] C++ warning fixes by external contractor Stephen Bennett.
author | chainsaw |
---|---|
date | Sun, 04 Dec 2005 08:49:53 -0800 |
parents | ad1e65c6a854 |
children | 256b3acc87d4 |
files | Plugins/Input/console/Effects_Buffer.cpp Plugins/Input/console/Fir_Resampler.cpp Plugins/Input/console/Gbs_Emu.cpp Plugins/Input/console/Gym_Emu.cpp Plugins/Input/console/Nes_Namco.cpp Plugins/Input/console/Nes_Vrc6.cpp Plugins/Input/console/Nsf_Emu.cpp Plugins/Input/console/Spc_Dsp.h |
diffstat | 8 files changed, 28 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/console/Effects_Buffer.cpp Sun Dec 04 07:37:06 2005 -0800 +++ b/Plugins/Input/console/Effects_Buffer.cpp Sun Dec 04 08:49:53 2005 -0800 @@ -144,15 +144,15 @@ chans.reverb_level = TO_FIXED( config_.reverb_level ); chans.echo_level = TO_FIXED( config_.echo_level ); - const int delay_offset = config_.delay_variance * sample_rate_ / (1000 * 2); + const int delay_offset = (int) config_.delay_variance * sample_rate_ / (1000 * 2); - const int reverb_sample_delay = config_.reverb_delay * sample_rate_ / 1000; + const int reverb_sample_delay = (int) config_.reverb_delay * sample_rate_ / 1000; chans.reverb_delay_l = pin_range( reverb_size - (reverb_sample_delay - delay_offset) * 2, reverb_size - 2, 0 ); chans.reverb_delay_r = pin_range( reverb_size + 1 - (reverb_sample_delay + delay_offset) * 2, reverb_size - 1, 1 ); - const int echo_sample_delay = config_.echo_delay * sample_rate_ / 1000; + const int echo_sample_delay = (int) config_.echo_delay * sample_rate_ / 1000; chans.echo_delay_l = pin_range( echo_size - 1 - (echo_sample_delay - delay_offset), echo_size - 1 ); chans.echo_delay_r = pin_range( echo_size - 1 - (echo_sample_delay + delay_offset),
--- a/Plugins/Input/console/Fir_Resampler.cpp Sun Dec 04 07:37:06 2005 -0800 +++ b/Plugins/Input/console/Fir_Resampler.cpp Sun Dec 04 08:49:53 2005 -0800 @@ -70,7 +70,7 @@ y *= sinc( a ); } - *p++ = y * scale; + *p++ = (T) (y * scale); a += step; } }
--- a/Plugins/Input/console/Gbs_Emu.cpp Sun Dec 04 07:37:06 2005 -0800 +++ b/Plugins/Input/console/Gbs_Emu.cpp Sun Dec 04 08:49:53 2005 -0800 @@ -299,7 +299,7 @@ { require( rom ); // file must be loaded - gb_time_t duration = clock_rate * (1.0 / 1000.0) * msec; + gb_time_t duration = (gb_time_t) (clock_rate * (1.0 / 1000.0) * msec); cpu_time = 0; while ( cpu_time < duration ) {
--- a/Plugins/Input/console/Gym_Emu.cpp Sun Dec 04 07:37:06 2005 -0800 +++ b/Plugins/Input/console/Gym_Emu.cpp Sun Dec 04 08:49:53 2005 -0800 @@ -64,7 +64,7 @@ BLARGG_RETURN_ERR( blip_buf.sample_rate( sample_rate, 1000 / 30 ) ); - BLARGG_RETURN_ERR( fm.set_rate( sample_rate * oversample, base_clock / 7 ) ); + BLARGG_RETURN_ERR( fm.set_rate( (long) (sample_rate * oversample), base_clock / 7 ) ); blip_buf.clock_rate( clock_rate ); @@ -219,8 +219,8 @@ parse_frame(); // run SMS APU and buffer - blip_time_t clock_count = (pairs_per_frame + 1 - blip_buf.samples_avail()) * - clocks_per_sample; + blip_time_t clock_count = (blip_time_t) ((pairs_per_frame + 1 - blip_buf.samples_avail()) * + clocks_per_sample); apu.end_frame( clock_count ); blip_buf.end_frame( clock_count ); assert( unsigned (blip_buf.samples_avail() - pairs_per_frame) <= 4 ); @@ -343,8 +343,8 @@ this->last_dac = last_dac; } - int const step = 6 * oversample; - int remain = pairs_per_frame * oversample; + int const step = (int) (6 * oversample); + int remain = (int) (pairs_per_frame * oversample); while ( remain ) { int n = step; if ( n > remain )
--- a/Plugins/Input/console/Nes_Namco.cpp Sun Dec 04 07:37:06 2005 -0800 +++ b/Plugins/Input/console/Nes_Namco.cpp Sun Dec 04 08:49:53 2005 -0800 @@ -58,18 +58,21 @@ return reg [addr]; } +#define chars_to_long(s) ( (unsigned long)(s[0] << 24) | (unsigned long)(s[1] << 16) | \ + (unsigned long)(s[2] << 8) | (unsigned long)(s[3]) ) + void Nes_Namco::reflect_state( Tagged_Data& data ) { - reflect_int16( data, 'ADDR', &addr_reg ); + reflect_int16( data, chars_to_long("ADDR"), &addr_reg ); static const char hex [17] = "0123456789ABCDEF"; int i; for ( i = 0; i < reg_count; i++ ) - reflect_int16( data, 'RG\0\0' + hex [i >> 4] * 0x100 + hex [i & 15], ® [i] ); + reflect_int16( data, chars_to_long("RG\0\0") + hex [i >> 4] * 0x100 + hex [i & 15], ® [i] ); for ( i = 0; i < osc_count; i++ ) { - reflect_int32( data, 'DLY0' + i, &oscs [i].delay ); - reflect_int16( data, 'POS0' + i, &oscs [i].wave_pos ); + reflect_int32( data, chars_to_long("DLY0") + i, &oscs [i].delay ); + reflect_int16( data, chars_to_long("POS0") + i, &oscs [i].wave_pos ); } }
--- a/Plugins/Input/console/Nes_Vrc6.cpp Sun Dec 04 07:37:06 2005 -0800 +++ b/Plugins/Input/console/Nes_Vrc6.cpp Sun Dec 04 08:49:53 2005 -0800 @@ -89,18 +89,21 @@ assert( last_time >= 0 ); } +#define chars_to_long(s) ( (long)(s[0] << 24) | (long)(s[1] << 16) | \ + (long)(s[2] << 8) | (long)(s[3]) ) + void Nes_Vrc6::reflect_state( Tagged_Data& data ) { for ( int i = 0; i < osc_count; i++ ) { - Tagged_Data odata( data, 'cCH0' + i ); + Tagged_Data odata( data, chars_to_long("cCH0") + i ); Vrc6_Osc& osc = oscs [i]; for ( int r = 0; r < reg_count; r++ ) - reflect_int16( odata, 'REG0' + r, &osc.regs [r] ); - reflect_int16( odata, 'DELY', &osc.delay ); - reflect_int16( odata, 'PHAS', &osc.phase ); + reflect_int16( odata, chars_to_long("REG0") + r, &osc.regs [r] ); + reflect_int16( odata, chars_to_long("DELY"), &osc.delay ); + reflect_int16( odata, chars_to_long("PHAS"), &osc.phase ); if ( i == 2 ) - reflect_int16( odata, 'AMPL', &osc.amp ); + reflect_int16( odata, chars_to_long("AMPL"), &osc.amp ); } }
--- a/Plugins/Input/console/Nsf_Emu.cpp Sun Dec 04 07:37:06 2005 -0800 +++ b/Plugins/Input/console/Nsf_Emu.cpp Sun Dec 04 08:49:53 2005 -0800 @@ -347,7 +347,7 @@ track_count_ = h.track_count; - return setup_buffer( clock_rate + 0.5 ); + return setup_buffer( ( int) (clock_rate + 0.5) ); } void Nsf_Emu::set_voice( int i, Blip_Buffer* buf, Blip_Buffer*, Blip_Buffer* ) @@ -423,7 +423,7 @@ blip_time_t Nsf_Emu::run( int msec, bool* ) { // run cpu - blip_time_t duration = clocks_per_msec * msec; + blip_time_t duration = (blip_time_t) (clocks_per_msec * msec); cpu.time( 0 ); while ( cpu.time() < duration ) {