diff options
author | Wohlstand <admin@wohlnet.ru> | 2018-06-03 15:46:50 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2018-06-03 15:46:50 +0300 |
commit | adcf702a7e18846ad4f8753ec5a32cf56585ca23 (patch) | |
tree | d2b357b91695868c8d2b48ecf6e4cd82d2f9cfe6 /src/chips | |
parent | c4c36c82919b3136b9592db1f7872fc7d4907589 (diff) | |
download | libADLMIDI-adcf702a7e18846ad4f8753ec5a32cf56585ca23.tar.gz libADLMIDI-adcf702a7e18846ad4f8753ec5a32cf56585ca23.tar.bz2 libADLMIDI-adcf702a7e18846ad4f8753ec5a32cf56585ca23.zip |
Bugfixes
- Fixed all MSVC 2015/2017 warnings in both 32 and 64 bit builds
- Fixed weird behavior when using adl_setHVibrato, adl_setHTremolo, adl_setScaleModulators, and adl_setVolumeRangeModel when passing the -1 "Auto" state
- Move arpeggio counter into the MIDIPlay class as originally it was a global static variable which is ugly and danger when running multiple instances of the same library
Diffstat (limited to 'src/chips')
-rw-r--r-- | src/chips/dosbox/dbopl.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/chips/dosbox/dbopl.cpp b/src/chips/dosbox/dbopl.cpp index 098eb13..7d78c5f 100644 --- a/src/chips/dosbox/dbopl.cpp +++ b/src/chips/dosbox/dbopl.cpp @@ -819,7 +819,7 @@ INLINE void Channel::GeneratePercussion( Chip* chip, Bit32s* output ) { //BassDrum Bit32s mod = (Bit32u)((old[0] + old[1])) >> feedback; old[0] = old[1]; - old[1] = Op(0)->GetSample( mod ); + old[1] = static_cast<Bit32u>(Op(0)->GetSample( mod )); //When bassdrum is in AM mode first operator is ignoed if ( chan->regC0 & 1 ) { @@ -827,35 +827,35 @@ INLINE void Channel::GeneratePercussion( Chip* chip, Bit32s* output ) { } else { mod = old[0]; } - Bit32s sample = Op(1)->GetSample( mod ); + Bit32s sample = static_cast<Bit32u>(Op(1)->GetSample( mod )); //Precalculate stuff used by other outputs Bit32u noiseBit = chip->ForwardNoise() & 0x1; - Bit32u c2 = Op(2)->ForwardWave(); - Bit32u c5 = Op(5)->ForwardWave(); + Bit32u c2 = static_cast<Bit32u>(Op(2)->ForwardWave()); + Bit32u c5 = static_cast<Bit32u>(Op(5)->ForwardWave()); Bit32u phaseBit = (((c2 & 0x88) ^ ((c2<<5) & 0x80)) | ((c5 ^ (c5<<2)) & 0x20)) ? 0x02 : 0x00; //Hi-Hat - Bit32u hhVol = Op(2)->ForwardVolume(); + Bit32u hhVol = static_cast<Bit32u>(Op(2)->ForwardVolume()); if ( !ENV_SILENT( hhVol ) ) { Bit32u hhIndex = (phaseBit<<8) | (0x34 << ( phaseBit ^ (noiseBit << 1 ))); - sample += Op(2)->GetWave( hhIndex, hhVol ); + sample += static_cast<Bit32u>(Op(2)->GetWave( hhIndex, hhVol )); } //Snare Drum - Bit32u sdVol = Op(3)->ForwardVolume(); + Bit32u sdVol = static_cast<Bit32u>(Op(3)->ForwardVolume()); if ( !ENV_SILENT( sdVol ) ) { Bit32u sdIndex = ( 0x100 + (c2 & 0x100) ) ^ ( noiseBit << 8 ); - sample += Op(3)->GetWave( sdIndex, sdVol ); + sample += static_cast<Bit32u>(Op(3)->GetWave( sdIndex, sdVol )); } //Tom-tom - sample += Op(4)->GetSample( 0 ); + sample += static_cast<Bit32u>(Op(4)->GetSample( 0 )); //Top-Cymbal - Bit32u tcVol = Op(5)->ForwardVolume(); + Bit32u tcVol = static_cast<Bit32u>(Op(5)->ForwardVolume()); if ( !ENV_SILENT( tcVol ) ) { Bit32u tcIndex = (1 + phaseBit) << 8; - sample += Op(5)->GetWave( tcIndex, tcVol ); + sample += static_cast<Bit32u>(Op(5)->GetWave( tcIndex, tcVol )); } sample <<= 1; if ( opl3Mode ) { @@ -934,31 +934,31 @@ Channel* Channel::BlockTemplate( Chip* chip, Bit32u samples, Bit32s* output ) { //Do unsigned shift so we can shift out all bits but still stay in 10 bit range otherwise Bit32s mod = (Bit32u)((old[0] + old[1])) >> feedback; old[0] = old[1]; - old[1] = Op(0)->GetSample( mod ); + old[1] = static_cast<Bit32u>(Op(0)->GetSample( mod )); Bit32s sample; Bit32s out0 = old[0]; if ( mode == sm2AM || mode == sm3AM ) { - sample = out0 + Op(1)->GetSample( 0 ); + sample = static_cast<Bit32u>(out0 + Op(1)->GetSample( 0 )); } else if ( mode == sm2FM || mode == sm3FM ) { - sample = Op(1)->GetSample( out0 ); + sample = static_cast<Bit32u>(Op(1)->GetSample( out0 )); } else if ( mode == sm3FMFM ) { Bits next = Op(1)->GetSample( out0 ); next = Op(2)->GetSample( next ); - sample = Op(3)->GetSample( next ); + sample = static_cast<Bit32u>(Op(3)->GetSample( next )); } else if ( mode == sm3AMFM ) { sample = out0; Bits next = Op(1)->GetSample( 0 ); next = Op(2)->GetSample( next ); - sample += Op(3)->GetSample( next ); + sample += static_cast<Bit32u>(Op(3)->GetSample( next )); } else if ( mode == sm3FMAM ) { - sample = Op(1)->GetSample( out0 ); + sample = static_cast<Bit32u>(Op(1)->GetSample( out0 )); Bits next = Op(2)->GetSample( 0 ); - sample += Op(3)->GetSample( next ); + sample += static_cast<Bit32u>(Op(3)->GetSample( next )); } else if ( mode == sm3AMAM ) { sample = out0; Bits next = Op(1)->GetSample( 0 ); - sample += Op(2)->GetSample( next ); - sample += Op(3)->GetSample( 0 ); + sample += static_cast<Bit32u>(Op(2)->GetSample( next )); + sample += static_cast<Bit32u>(Op(3)->GetSample( 0 )); } switch( mode ) { case sm2AM: @@ -1213,7 +1213,7 @@ Bit32u Chip::WriteAddr( Bit32u port, Bit8u val ) { void Chip::GenerateBlock2( Bitu total, Bit32s* output ) { while ( total > 0 ) { - Bit32u samples = ForwardLFO( total ); + Bit32u samples = ForwardLFO( static_cast<Bit32u>(total) ); memset(output, 0, sizeof(Bit32s) * samples); // int count = 0; for( Channel* ch = chan; ch < chan + 9; ) { @@ -1227,7 +1227,7 @@ void Chip::GenerateBlock2( Bitu total, Bit32s* output ) { void Chip::GenerateBlock2_Mix( Bitu total, Bit32s* output ) { while ( total > 0 ) { - Bit32u samples = ForwardLFO( total ); + Bit32u samples = ForwardLFO( static_cast<Bit32u>(total) ); // int count = 0; for( Channel* ch = chan; ch < chan + 9; ) { // count++; @@ -1240,7 +1240,7 @@ void Chip::GenerateBlock2_Mix( Bitu total, Bit32s* output ) { void Chip::GenerateBlock3( Bitu total, Bit32s* output ) { while ( total > 0 ) { - Bit32u samples = ForwardLFO( total ); + Bit32u samples = ForwardLFO( static_cast<Bit32u>(total) ); memset(output, 0, sizeof(Bit32s) * samples *2); // int count = 0; for( Channel* ch = chan; ch < chan + 18; ) { @@ -1254,7 +1254,7 @@ void Chip::GenerateBlock3( Bitu total, Bit32s* output ) { void Chip::GenerateBlock3_Mix( Bitu total, Bit32s* output ) { while ( total > 0 ) { - Bit32u samples = ForwardLFO( total ); + Bit32u samples = ForwardLFO( static_cast<Bit32u>(total) ); // int count = 0; for( Channel* ch = chan; ch < chan + 18; ) { // count++; @@ -1500,7 +1500,7 @@ void InitTables( void ) { if ( i >= 16 ) index += 9; Bitu blah = reinterpret_cast<Bitu>( &(chip->chan[ index ]) ); - ChanOffsetTable[i] = blah; + ChanOffsetTable[i] = static_cast<Bit16u>(blah); } //Same for operators for ( Bitu i = 0; i < 64; i++ ) { @@ -1515,7 +1515,7 @@ void InitTables( void ) { Bitu opNum = ( i % 8 ) / 3; DBOPL::Channel* chan = 0; Bitu blah = reinterpret_cast<Bitu>( &(chan->op[opNum]) ); - OpOffsetTable[i] = ChanOffsetTable[ chNum ] + blah; + OpOffsetTable[i] = static_cast<Bit16u>(ChanOffsetTable[ chNum ] + blah); } #if 0 //Stupid checks if table's are correct @@ -1611,7 +1611,7 @@ void Handler::GenerateArrMix(Bit16s *out, Bitu *samples) void Handler::Init( Bitu rate ) { InitTables(); - chip.Setup( rate ); + chip.Setup( static_cast<Bit32u>(rate) ); } |