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