galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
LuaMem.cpp
Go to the documentation of this file.
1
7
8#include <entt/locator/locator.hpp>
9#include <sol/sol.hpp>
10
12
13namespace galaxy
14{
15 namespace lua
16 {
18 {
19 auto& lua = entt::locator<sol::state>::value();
20
21 auto rb_type = lua.new_usertype<mem::RingBuffer>("Ringbuffer", sol::constructors<mem::RingBuffer(const int)>());
22 rb_type["write"] = &mem::RingBuffer::write;
23 rb_type["read"] = &mem::RingBuffer::read;
24 rb_type["direct_read_pointer"] = &mem::RingBuffer::direct_read_pointer;
25 rb_type["available_bytes"] = &mem::RingBuffer::available_bytes;
26 rb_type["set_volume"] = &mem::RingBuffer::set_volume;
27 rb_type["get_volume"] = &mem::RingBuffer::get_volume;
28 }
29 } // namespace lua
30} // namespace galaxy
Memory manager in a ring buffer format.
int read(float *data, int count) noexcept
Read data from buffer.
int write(float *data, const int count) noexcept
Write data to ring buffer.
void set_volume(const float volume) noexcept
Sets audio volume of the buffer.
int available_bytes() const noexcept
Available bytes left in the ring buffer.
float get_volume() const noexcept
Gets current buffer volume.
float * direct_read_pointer(const int count) noexcept
Read the ring buffer.
void inject_mem()
Inject custom memory stuff into Lua.
Definition LuaMem.cpp:17
Timer.hpp galaxy.
Definition Async.hpp:17