1
0
forked from 0ad/0ad

Fix whitespace in JSInterface_Sound.*

This was SVN commit r21776.
This commit is contained in:
elexis 2018-04-24 11:44:26 +00:00
parent 5a34c9e570
commit 067bbb38d6
2 changed files with 93 additions and 96 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games. /* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -30,93 +30,93 @@
namespace JSI_Sound namespace JSI_Sound
{ {
#if CONFIG2_AUDIO #if CONFIG2_AUDIO
void StartMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) void StartMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->SetMusicEnabled(true); sndManager->SetMusicEnabled(true);
} }
void StopMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) void StopMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->SetMusicEnabled(false); sndManager->SetMusicEnabled(false);
} }
void ClearPlaylist(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) void ClearPlaylist(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->ClearPlayListItems(); sndManager->ClearPlayListItems();
} }
void AddPlaylistItem(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& filename) void AddPlaylistItem(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& filename)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->AddPlayListItem(VfsPath(filename)); sndManager->AddPlayListItem(VfsPath(filename));
} }
void StartPlaylist(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool looping) void StartPlaylist(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool looping)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->StartPlayList( looping ); sndManager->StartPlayList(looping );
} }
void PlayMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& filename, bool looping) void PlayMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& filename, bool looping)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->PlayAsMusic( filename, looping); sndManager->PlayAsMusic(filename, looping);
} }
void PlayUISound(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& filename, bool looping) void PlayUISound(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& filename, bool looping)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->PlayAsUI( filename, looping); sndManager->PlayAsUI(filename, looping);
} }
void PlayAmbientSound(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& filename, bool looping) void PlayAmbientSound(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& filename, bool looping)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->PlayAsAmbient( filename, looping); sndManager->PlayAsAmbient(filename, looping);
} }
bool MusicPlaying(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) bool MusicPlaying(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
{ {
return true; return true;
} }
void SetMasterGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain) void SetMasterGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->SetMasterGain(gain); sndManager->SetMasterGain(gain);
} }
void SetMusicGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain) void SetMusicGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->SetMusicGain(gain); sndManager->SetMusicGain(gain);
} }
void SetAmbientGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain) void SetAmbientGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->SetAmbientGain(gain); sndManager->SetAmbientGain(gain);
} }
void SetActionGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain) void SetActionGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->SetActionGain(gain); sndManager->SetActionGain(gain);
} }
void SetUIGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain) void SetUIGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain)
{ {
if ( CSoundManager* sndManager = (CSoundManager*)g_SoundManager ) if (CSoundManager* sndManager = (CSoundManager*)g_SoundManager)
sndManager->SetUIGain(gain); sndManager->SetUIGain(gain);
} }
#else
#else
bool MusicPlaying(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){ return false; } bool MusicPlaying(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){ return false; }
void PlayAmbientSound(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& UNUSED(filename), bool UNUSED(looping) ){} void PlayAmbientSound(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& UNUSED(filename), bool UNUSED(looping) ){}
void PlayUISound(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& UNUSED(filename), bool UNUSED(looping) ) {} void PlayUISound(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& UNUSED(filename), bool UNUSED(looping) ) {}
@ -132,26 +132,23 @@ namespace JSI_Sound
void SetActionGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){} void SetActionGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
void SetUIGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){} void SetUIGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
#endif #endif
void RegisterScriptFunctions(const ScriptInterface& scriptInterface)
void RegisterScriptFunctions(const ScriptInterface& scriptInterface) {
{ scriptInterface.RegisterFunction<void, &StartMusic>("StartMusic");
scriptInterface.RegisterFunction<void, &StartMusic>("StartMusic"); scriptInterface.RegisterFunction<void, &StopMusic>("StopMusic");
scriptInterface.RegisterFunction<void, &StopMusic>("StopMusic"); scriptInterface.RegisterFunction<void, &ClearPlaylist>("ClearPlaylist");
scriptInterface.RegisterFunction<void, &ClearPlaylist>("ClearPlaylist"); scriptInterface.RegisterFunction<void, std::wstring, &AddPlaylistItem>("AddPlaylistItem");
scriptInterface.RegisterFunction<void, std::wstring, &AddPlaylistItem>("AddPlaylistItem"); scriptInterface.RegisterFunction<void, bool, &StartPlaylist>("StartPlaylist");
scriptInterface.RegisterFunction<void, bool, &StartPlaylist>("StartPlaylist"); scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayMusic>("PlayMusic");
scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayMusic>("PlayMusic"); scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayUISound>("PlayUISound");
scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayUISound>("PlayUISound"); scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayAmbientSound>("PlayAmbientSound");
scriptInterface.RegisterFunction<void, std::wstring, bool, &PlayAmbientSound>("PlayAmbientSound"); scriptInterface.RegisterFunction<bool, &MusicPlaying>("MusicPlaying");
scriptInterface.RegisterFunction<bool, &MusicPlaying>("MusicPlaying"); scriptInterface.RegisterFunction<void, float, &SetMasterGain>("SetMasterGain");
scriptInterface.RegisterFunction<void, float, &SetMasterGain>("SetMasterGain"); scriptInterface.RegisterFunction<void, float, &SetMusicGain>("SetMusicGain");
scriptInterface.RegisterFunction<void, float, &SetMusicGain>("SetMusicGain"); scriptInterface.RegisterFunction<void, float, &SetAmbientGain>("SetAmbientGain");
scriptInterface.RegisterFunction<void, float, &SetAmbientGain>("SetAmbientGain"); scriptInterface.RegisterFunction<void, float, &SetActionGain>("SetActionGain");
scriptInterface.RegisterFunction<void, float, &SetActionGain>("SetActionGain"); scriptInterface.RegisterFunction<void, float, &SetUIGain>("SetUIGain");
scriptInterface.RegisterFunction<void, float, &SetUIGain>("SetUIGain"); }
}
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games. /* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -23,7 +23,7 @@ class ScriptInterface;
namespace JSI_Sound namespace JSI_Sound
{ {
void RegisterScriptFunctions(const ScriptInterface& scriptInterface); void RegisterScriptFunctions(const ScriptInterface& scriptInterface);
} }
#endif // #ifndef INCLUDED_SOUNDSCRIPTINTERFACE #endif // #ifndef INCLUDED_SOUNDSCRIPTINTERFACE