| 53 | // ---------------------------------------------------------------------------------------------------- |
| 54 | |
| 55 | void Wall::handleCollision( const Gear *gear, const vec2 &contactPoint ) |
| 56 | { |
| 57 | const float maxVibration = 6.0f; |
| 58 | |
| 59 | mVibrationLevel.stop(); |
| 60 | mVibrationLevel = ( maxVibration + mVibrationLevel ) / 2; |
| 61 | |
| 62 | app::timeline().apply( &mVibrationLevel, 0.0f, 1.0f ); |
| 63 | |
| 64 | float panPos; |
| 65 | float freqMidi = mFundamentalMidi; |
| 66 | |
| 67 | if( mSide == Wall::Side::RIGHT ) { |
| 68 | freqMidi += 7; |
| 69 | panPos = 0.9f; // almost all the way to the right |
| 70 | } |
| 71 | else |
| 72 | panPos = 0.1f; // almost all the way to the left |
| 73 | |
| 74 | while( freqMidi > BASS_MAX ) |
| 75 | freqMidi -= 12; |
| 76 | |
| 77 | // CI_LOG_V( "f0: " << mFundamentalMidi << ", freqMidi: " << freqMidi << ", bassMaxFreq: " << audio::midiToFreq( BASS_MAX ) << ", resulting bass note: " << audio::midiToFreq( freqMidi ) ); |
| 78 | |
| 79 | auto bassSynth = mAudio->getNextBassSynth(); |
| 80 | bassSynth->setPan( panPos ); |
| 81 | bassSynth->trigger( freqMidi, 2.0f ); |
| 82 | } |
| 83 | |
| 84 | void Wall::draw() |
| 85 | { |
no test coverage detected