Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 76596fa

Browse files
committed
Make SoundContainer a Concrete lua entity
Updated SoundContainer and AudioMan lua bindings to match up Updated meson build to point to new fmod version
1 parent 78a410a commit 76596fa

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

Managers/LuaMan.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ struct enum_wrapper {
186186
TYPE * Random##TYPE(std::string group) { return Random##TYPE(group, "All"); }
187187

188188
// These are expanded by the preprocessor to all the different cloning function definitions.
189+
LUAENTITYCREATE(SoundContainer)
189190
LUAENTITYCREATE(Attachable)
190191
LUAENTITYCREATE(AEmitter)
191192
LUAENTITYCREATE(Turret)
@@ -229,6 +230,7 @@ LUAENTITYCREATE(PEmitter)
229230

230231
// These are expanded by the preprocessor to all the different cloning function definitions.
231232
LUAENTITYCLONE(Entity)
233+
LUAENTITYCLONE(SoundContainer)
232234
LUAENTITYCLONE(SceneObject)
233235
LUAENTITYCLONE(MovableObject)
234236
LUAENTITYCLONE(Attachable)
@@ -287,9 +289,10 @@ void DeleteEntity(Entity *pEntity)
287289
bool Is##TYPE(Entity *pEntity) { return dynamic_cast<TYPE *>(pEntity) ? true : false; }
288290

289291
// These are expanded by the preprocessor to all the different casting function definitions named: To[Type]()
292+
LUAENTITYCAST(Entity)
293+
LUAENTITYCAST(SoundContainer)
290294
LUAENTITYCAST(SceneObject)
291295
LUAENTITYCAST(MovableObject)
292-
LUAENTITYCAST(Entity)
293296
LUAENTITYCAST(Attachable)
294297
LUAENTITYCAST(Arm)
295298
LUAENTITYCAST(Leg)
@@ -569,23 +572,28 @@ int LuaMan::Create() {
569572
.def("AddToGroup", &Entity::AddToGroup)
570573
.def("IsInGroup", (bool (Entity::*)(const string &))&Entity::IsInGroup),
571574

572-
class_<SoundContainer>("SoundContainer")
575+
CONCRETELUABINDING(SoundContainer, Entity)
573576
.def(constructor<>())
577+
.property("Immobile", &SoundContainer::IsImmobile, &SoundContainer::SetImmobile)
578+
.property("AttenuationStartDistance", &SoundContainer::GetAttenuationStartDistance, &SoundContainer::SetAttenuationStartDistance)
579+
.property("Loops", &SoundContainer::GetLoopSetting, &SoundContainer::SetLoopSetting)
580+
.property("Priority", &SoundContainer::GetPriority, &SoundContainer::SetPriority)
581+
.property("AffectedByGlobalPitch", &SoundContainer::IsAffectedByGlobalPitch, &SoundContainer::SetAffectedByGlobalPitch)
582+
.property("Pos", &SoundContainer::GetPosition, &SoundContainer::SetPosition)
583+
.property("Volume", &SoundContainer::GetVolume, &SoundContainer::SetVolume)
584+
.property("Pitch", &SoundContainer::GetPitch, &SoundContainer::SetPitch)
574585
.def("HasAnySounds", &SoundContainer::HasAnySounds)
575586
.def("IsBeingPlayed", &SoundContainer::IsBeingPlayed)
576587
.def("Play", (bool (SoundContainer:: *)()) &SoundContainer::Play)
588+
.def("Play", (bool (SoundContainer:: *)(const int player)) &SoundContainer::Play)
577589
.def("Play", (bool (SoundContainer:: *)(const Vector &position)) &SoundContainer::Play)
578590
.def("Play", (bool (SoundContainer:: *)(const Vector &position, int player)) &SoundContainer::Play)
579591
.def("Stop", (bool (SoundContainer:: *)()) &SoundContainer::Stop)
580592
.def("Stop", (bool (SoundContainer:: *)(int player)) &SoundContainer::Stop)
581593
.def("AddSound", (void (SoundContainer:: *)(std::string const &soundFilePath)) &SoundContainer::AddSound)
582594
.def("AddSound", (void (SoundContainer:: *)(std::string const &soundFilePath, const Vector &offset, float attenuationStartDistance, bool abortGameForInvalidSound)) &SoundContainer::AddSound)
583595
.def("AddSound", (void (SoundContainer:: *)(std::string const &soundFilePath, unsigned int soundSetIndex, const Vector &offset, float minimumAudibleDistance, float attenuationStartDistance, bool abortGameForInvalidSound)) &SoundContainer::AddSound)
584-
.def("SetPosition", &SoundContainer::SetPosition)
585-
.def("SelectNextSoundSet", &SoundContainer::SelectNextSoundSet)
586-
.property("Loops", &SoundContainer::GetLoopSetting, &SoundContainer::SetLoopSetting)
587-
.property("Priority", &SoundContainer::GetPriority, &SoundContainer::SetPriority)
588-
.property("AffectedByGlobalPitch", &SoundContainer::IsAffectedByGlobalPitch, &SoundContainer::SetAffectedByGlobalPitch),
596+
.def("SelectNextSoundSet", &SoundContainer::SelectNextSoundSet),
589597

590598
ABSTRACTLUABINDING(SceneObject, Entity)
591599
.property("Pos", &SceneObject::GetPos, &SceneObject::SetPos)
@@ -1515,19 +1523,16 @@ int LuaMan::Create() {
15151523
.def("SetMusicPosition", &AudioMan::SetMusicPosition)
15161524
.def("SetMusicPitch", &AudioMan::SetMusicPitch)
15171525
.property("SoundsVolume", &AudioMan::GetSoundsVolume, &AudioMan::SetSoundsVolume)
1518-
.def("SetSoundPosition", &AudioMan::SetSoundPosition)
1519-
.def("SetSoundPitch", &AudioMan::SetSoundPitch)
15201526
.def("StopAll", &AudioMan::StopMusic)
15211527
.def("PlayMusic", &AudioMan::PlayMusic)
15221528
.def("PlayNextStream", &AudioMan::PlayNextStream)
15231529
.def("StopMusic", &AudioMan::StopMusic)
15241530
.def("QueueMusicStream", &AudioMan::QueueMusicStream)
15251531
.def("QueueSilence", &AudioMan::QueueSilence)
15261532
.def("ClearMusicQueue", &AudioMan::ClearMusicQueue)
1527-
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath)) &AudioMan::PlaySound)
1528-
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, const Vector &position)) &AudioMan::PlaySound)
1529-
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, const Vector &position, int player)) &AudioMan::PlaySound)
1530-
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, const Vector &position, int player, int loops, int priority, double pitchOrAffectedByGlobalPitch, float attenuationStartDistance, bool immobile)) &AudioMan::PlaySound)
1533+
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const std::string &filePath)) &AudioMan::PlaySound, adopt(result))
1534+
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const std::string &filePath, const Vector &position)) &AudioMan::PlaySound, adopt(result))
1535+
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const std::string &filePath, const Vector &position, int player)) &AudioMan::PlaySound, adopt(result))
15311536
.def("StopSound", (bool (AudioMan:: *)(SoundContainer *soundContainer)) &AudioMan::StopSound)
15321537
.def("StopSound", (bool (AudioMan:: *)(SoundContainer *soundContainer, int player)) &AudioMan::StopSound)
15331538
.def("FadeOutSound", &AudioMan::FadeOutSound),

external/lib/linux/x86_64/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
cp = find_program('cp')
2-
fmod_so = files('libfmod.so.11', 'libfmod.so')
2+
fmod_so = files('libfmod.so.12', 'libfmod.so')
33
fmod = custom_target('libfmod', output:['libfmod.so'], input:fmod_so, command:[cp, '-P', '@INPUT@', '@OUTDIR@'])

0 commit comments

Comments
 (0)