| 527 | { |
| 528 | public: |
| 529 | Doppler() : |
| 530 | Effect("Doppler Shift"), |
| 531 | m_currentVelocity(getFont(), "Velocity: " + std::to_string(m_velocity)), |
| 532 | m_currentFactor(getFont(), "Doppler Factor: " + std::to_string(m_factor)) |
| 533 | { |
| 534 | m_listener.setPosition({(windowWidth - 20.f) / 2.f, (windowHeight - 20.f) / 2.f}); |
| 535 | m_listener.setFillColor(sf::Color::Red); |
| 536 | |
| 537 | m_position.y = (windowHeight - 20.f) / 2.f - 40.f; |
| 538 | |
| 539 | m_currentVelocity.setPosition({windowWidth / 2.f - 150.f, windowHeight * 3.f / 4.f - 50.f}); |
| 540 | m_currentFactor.setPosition({windowWidth / 2.f - 150.f, windowHeight * 3.f / 4.f}); |
| 541 | |
| 542 | // Set attenuation to a nice value |
| 543 | setAttenuation(0.05f); |
| 544 | |
| 545 | sf::SoundStream::initialize(1, sampleRate, {sf::SoundChannel::Mono}); |
| 546 | } |
| 547 | |
| 548 | void onUpdate(float time, float x, float y) override |
| 549 | { |
nothing calls this directly
no test coverage detected