Plasma Engine  2.0
Loading...
Searching...
No Matches
FmodSoundEventResource.h
1#pragma once
2
3#include <Core/ResourceManager/Resource.h>
4#include <FmodPlugin/FmodPluginDLL.h>
5
8
9struct PL_FMODPLUGIN_DLL plFmodSoundEventResourceDescriptor
10{
11 // empty, these types of resources must be loaded from file
12};
13
14class PL_FMODPLUGIN_DLL plFmodSoundEventResource : public plResource
15{
16 PL_ADD_DYNAMIC_REFLECTION(plFmodSoundEventResource, plResource);
17 PL_RESOURCE_DECLARE_COMMON_CODE(plFmodSoundEventResource);
18 PL_RESOURCE_DECLARE_CREATEABLE(plFmodSoundEventResource, plFmodSoundEventResourceDescriptor);
19
20public:
23
27 plResult PlayOnce(const plTransform& globalPosition, float fPitch = 1.0f, float fVolume = 1.0f) const;
28
30 FMOD::Studio::EventInstance* CreateInstance() const;
31
33 FMOD::Studio::EventDescription* GetDescriptor() const { return m_pEventDescription; }
34
35private:
36 virtual plResourceLoadDesc UnloadData(Unload WhatToUnload) override;
37 virtual plResourceLoadDesc UpdateContent(plStreamReader* Stream) override;
38 virtual void UpdateMemoryUsage(MemoryUsage& out_NewMemoryUsage) override;
39
40private:
42 FMOD::Studio::EventDescription* m_pEventDescription = nullptr;
43};
44
46{
47public:
49 {
51 : m_Reader(&m_Storage)
52
53 {
54 }
55
57 plMemoryStreamReader m_Reader;
59 FMOD::Studio::EventDescription* m_pEventDescription = nullptr;
60 };
61
62 virtual plResourceLoadData OpenDataStream(const plResource* pResource) override;
63 virtual void CloseDataStream(const plResource* pResource, const plResourceLoadData& loaderData) override;
64 virtual bool IsResourceOutdated(const plResource* pResource) const override;
65};
The default implementation for memory stream storage.
Definition MemoryStream.h:161
Definition FmodSoundEventResource.h:15
FMOD::Studio::EventDescription * GetDescriptor() const
Returns the Fmod sound event descriptor. May be nullptr, if the sound bank could not be loaded or the...
Definition FmodSoundEventResource.h:33
Definition FmodSoundEventResource.h:46
A reader which can access a memory stream.
Definition MemoryStream.h:259
The base class for all resources.
Definition Resource.h:10
Base class for all resource loaders.
Definition ResourceTypeLoader.h:29
Interface for binary in (read) streams.
Definition Stream.h:22
Definition FmodSoundEventResource.h:10
Definition FmodSoundEventResource.h:49
Data returned by plResourceTypeLoader implementations.
Definition ResourceTypeLoader.h:10
Describes in which loading state a resource currently is, and how many different quality levels there...
Definition Declarations.h:102
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54