Ticket #1712: sound_1712.patch

File sound_1712.patch, 2.3 KB (added by trompetin17, 10 years ago)

Fixed

  • source/simulation2/components/CCmpSoundManager.cpp

     
    8585        }
    8686    }
    8787
     88    virtual void PauseMusic(bool isPause)
     89    {
     90        if (!g_SoundManager)
     91            return;
     92
     93        g_SoundManager->Pause(isPause);
     94    }
     95
    8896};
    8997
    9098REGISTER_COMPONENT_TYPE(SoundManager)
  • source/simulation2/components/ICmpSoundManager.cpp

     
    2323
    2424BEGIN_INTERFACE_WRAPPER(SoundManager)
    2525DEFINE_INTERFACE_METHOD_2("PlaySoundGroup", void, ICmpSoundManager, PlaySoundGroup, std::wstring, entity_id_t)
     26DEFINE_INTERFACE_METHOD_1("PauseMusic", void, ICmpSoundManager, PauseMusic, bool)
    2627END_INTERFACE_WRAPPER(SoundManager)
  • source/simulation2/components/ICmpSoundManager.h

     
    3333     */
    3434    virtual void PlaySoundGroup(std::wstring name, entity_id_t source) = 0;
    3535
     36    virtual void PauseMusic(bool isPause) = 0;
     37
    3638    DECLARE_INTERFACE_TYPE(SoundManager)
    3739};
    3840
  • source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp

     
    3434#include "ps/GameSetup/Config.h"
    3535#include "ps/GameSetup/GameSetup.h"
    3636#include "renderer/Renderer.h"
     37#include "simulation2/Simulation2.h"
     38#include "simulation2/components/ICmpSoundManager.h"
    3739
    3840extern void (*Atlas_GLSwapBuffers)(void* context);
    3941
     
    145147{
    146148    AtlasView::GetView_Game()->SetSpeedMultiplier(msg->speed);
    147149    AtlasView::GetView_Game()->SetTesting(msg->simTest);
     150
     151    CmpPtr<ICmpSoundManager> cmpSoundManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
     152    if (cmpSoundManager)
     153        cmpSoundManager->PauseMusic(msg->speed == 0.f);
     154
    148155}
    149156
    150157MESSAGEHANDLER(JavaScript)