Added Scripting interface for AudioClips #320
|
@ -368,6 +368,19 @@ namespace SHADE
|
||||||
sfxChannelGroup->addGroup(channelGroup);
|
sfxChannelGroup->addGroup(channelGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHAudioSystem::AttachAudioClipToObject(Handle<AudioClip> handle, EntityID eid)
|
||||||
|
{
|
||||||
|
if (auto transform = SHComponentManager::GetComponent_s<SHTransformComponent>(eid))
|
||||||
|
{
|
||||||
|
handle->transformRef = transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHAudioSystem::DetachAudioClipToObject(Handle<AudioClip> handle, EntityID eid)
|
||||||
|
{
|
||||||
|
handle->transformRef = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//AudioClip* SHAudioSystem::CreateAudioClip(const char* path)
|
//AudioClip* SHAudioSystem::CreateAudioClip(const char* path)
|
||||||
//{
|
//{
|
||||||
// AudioClipID newID{};
|
// AudioClipID newID{};
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace SHADE
|
||||||
class AudioClip
|
class AudioClip
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//expose to sxripting
|
||||||
void Play();
|
void Play();
|
||||||
//void Play(SHVec3 position);
|
//void Play(SHVec3 position);
|
||||||
void Stop(bool fadeOut = true);
|
void Stop(bool fadeOut = true);
|
||||||
|
@ -38,7 +39,7 @@ namespace SHADE
|
||||||
friend class SHAudioSystem;
|
friend class SHAudioSystem;
|
||||||
private:
|
private:
|
||||||
FMOD::Studio::EventInstance* instance = nullptr;
|
FMOD::Studio::EventInstance* instance = nullptr;
|
||||||
//SHTransformComponent* transformRef;
|
SHTransformComponent* transformRef = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SH_API SHAudioSystem : public SHSystem
|
class SH_API SHAudioSystem : public SHSystem
|
||||||
|
@ -68,10 +69,14 @@ namespace SHADE
|
||||||
|
|
||||||
std::optional<FMOD_GUID> GetEventGUID(const char* path);
|
std::optional<FMOD_GUID> GetEventGUID(const char* path);
|
||||||
//AudioClip* CreateAudioClip(const char* path);
|
//AudioClip* CreateAudioClip(const char* path);
|
||||||
|
//AUDIO CLIP
|
||||||
Handle<AudioClip> CreateAudioClip(const char* path);
|
Handle<AudioClip> CreateAudioClip(const char* path);
|
||||||
void AddAudioClipToBGMChannelGroup(Handle<AudioClip> handle);
|
void AddAudioClipToBGMChannelGroup(Handle<AudioClip> handle);
|
||||||
void AddAudioClipToSFXChannelGroup(Handle<AudioClip> handle);
|
void AddAudioClipToSFXChannelGroup(Handle<AudioClip> handle);
|
||||||
|
|
||||||
|
void AttachAudioClipToObject(Handle<AudioClip> handle, EntityID eid);
|
||||||
|
void DetachAudioClipToObject(Handle<AudioClip> handle, EntityID eid);
|
||||||
|
///
|
||||||
float GetBgmVolume();
|
float GetBgmVolume();
|
||||||
float GetSfxVolume();
|
float GetSfxVolume();
|
||||||
float GetMasterVolume();
|
float GetMasterVolume();
|
||||||
|
|
Loading…
Reference in New Issue