Jump to content

Atlas Sound Playback


Recommended Posts

Hi

I found that function : void StopMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) in the JSInterfaceSound.cpp and I was wondering how to use it to stop music playback in atlas.

From my little understanding I have to use it there (LINE 474) :

void MapSidebar::OnSimPlay(wxCommandEvent& event){	float speed = 1.f;	int newState = SimPlaying;	if (event.GetId() == ID_SimFast)	{		speed = 8.f;		newState = SimPlayingFast;	}	else if (event.GetId() == ID_SimSlow)	{		speed = 0.125f;		newState = SimPlayingSlow;	}	if (m_SimState == SimInactive)	{		// Force update of player settings		POST_MESSAGE(LoadPlayerSettings, (false));		POST_MESSAGE(SimStateSave, (L"default"));		POST_MESSAGE(GuiSwitchPage, (L"page_session.xml"));		POST_MESSAGE(SimPlay, (speed, true));		m_SimState = newState;	}	else // paused or already playing at a different speed	{		POST_MESSAGE(SimPlay, (speed, true));		m_SimState = newState;	}	UpdateSimButtons();}void MapSidebar::OnSimPause(wxCommandEvent& WXUNUSED(event)){	if (IsPlaying(m_SimState))	{		POST_MESSAGE(SimPlay, (0.f, true));		m_SimState = SimPaused;		StopMusic()	}	UpdateSimButtons();}void MapSidebar::OnSimReset(wxCommandEvent& WXUNUSED(event)){	if (IsPlaying(m_SimState))	{		POST_MESSAGE(SimPlay, (0.f, true));		POST_MESSAGE(SimStateRestore, (L"default"));		POST_MESSAGE(SimPlay, (0.f, false));		POST_MESSAGE(GuiSwitchPage, (L"page_atlas.xml"));		m_SimState = SimInactive;	}	else if (m_SimState == SimPaused)	{		POST_MESSAGE(SimPlay, (0.f, true));		POST_MESSAGE(SimStateRestore, (L"default"));		POST_MESSAGE(SimPlay, (0.f, false));		POST_MESSAGE(GuiSwitchPage, (L"page_atlas.xml"));		m_SimState = SimInactive;	}	UpdateSimButtons();}

But I was wondering if it would stop all sounds, and if it's the correct function to use.

Edited by stanislas69
Link to comment
Share on other sites

It's easier to look at a diff/patch. If you're using SVN, you should be able to generate a patch of the file(s) you change. I don't know your OS, but on Windows w/ TortoiseSVN, just right-click the folder or file and choose TortoiseSVN > Create patch - you can then copy/paste the diff. On *nix, you would want something like "svn diff" to accomplish the same.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...