From 265c381d5f10dd552dfc9b8f49430ff4b2e8ca04 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 26 Feb 2023 16:18:20 -0600 Subject: bind (almost) all miniaudio functions --- demo/fancy/honey.lua | 319 ----------------------------- demo/fancy/main.lua | 319 +++++++++++++++++++++++++++++ src/audio/CMakeLists.txt | 1 + src/audio/audio.h | 235 +++++++++++++-------- src/audio/bind | 123 +++++------ src/audio/bind.bind | 472 +++++++++++++++--------------------------- src/audio/engine.c | 11 +- src/audio/sound_group.c | 522 +++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 1209 insertions(+), 793 deletions(-) delete mode 100644 demo/fancy/honey.lua create mode 100644 demo/fancy/main.lua create mode 100644 src/audio/sound_group.c diff --git a/demo/fancy/honey.lua b/demo/fancy/honey.lua deleted file mode 100644 index 5a93a0e..0000000 --- a/demo/fancy/honey.lua +++ /dev/null @@ -1,319 +0,0 @@ -local gl = honey.gl -local window = honey.window - - ---===== initialize audio =====-- - -local engine = honey.audio.engine_init() -honey.audio.engine_play_sound(engine, 'example_sound.ogg') - - ---====== initialize opengl ======-- - -gl.Init() -window.setHint(window.hintType.contextVersionMajor, 3) -window.setHint(window.hintType.contextVersionMinor, 3) -window.setHint(window.hintType.openGlProfile, window.profileType.openGlCoreProfile) - - ---====== create window ======-- - -local w = window.create(640, 480, 'hello, world!') -window.makeContextCurrent(w) -gl.InitGlad() -gl.Enable(gl.DEPTH_TEST) - -window.setFramebufferSizeCallback(w, function(_, width, height) - print(string.format("resize: (%d, %d)", width, height)) - gl.Viewport(0, 0, width, height) -end) - - ---====== compile shaders ======-- - -local vertexShaderSource = [[ -#version 330 core -layout (location = 0) in vec3 aPos; -layout (location = 1) in vec2 aTexCoord; - -uniform mat4 model; -uniform mat4 view; -uniform mat4 projection; - -out vec3 pos; -out vec2 TexCoord; - -void main() -{ - gl_Position = projection * view * model * vec4(aPos, 1.0); - TexCoord = aTexCoord; - pos = aPos; -} -]] - -local fragmentShaderSource = [[ -#version 330 core -out vec4 FragColor; - -in vec3 pos; -in vec2 TexCoord; - -uniform sampler2D ourTexture; - -void main() -{ - // FragColor = vec4(pos, 1.0f); - FragColor = texture(ourTexture, TexCoord); -} -]] - --- vertex shader -local vertexShader = gl.CreateShader(gl.VERTEX_SHADER) -gl.ShaderSource(vertexShader, vertexShaderSource) -gl.CompileShader(vertexShader) - --- fragment shader -local fragmentShader = gl.CreateShader(gl.FRAGMENT_SHADER) -gl.ShaderSource(fragmentShader, fragmentShaderSource) -gl.CompileShader(fragmentShader) - --- link -local shader = gl.CreateProgram() -gl.AttachShader(shader, vertexShader) -gl.AttachShader(shader, fragmentShader) -gl.LinkProgram(shader) --- clean up -gl.DeleteShader(vertexShader) -gl.DeleteShader(fragmentShader) - - ---====== set up mesh data manually ======-- - -local vertices = { --- positions uvs - 0.5, 0.5, 0.0, 1.0, 1.0, -- top right - 0.5, -0.5, 0.0, 1.0, 0.0, -- bottom right - -0.5, -0.5, 0.0, 0.0, 0.0, -- bottom let - -0.5, 0.5, 0.0, 0.0, 1.0 -- top let -} -local indices = { - 0, 1, 3, -- first triangle - 1, 2, 3 -- second triangle -} - --- buffers -local vertexArray = gl.GenVertexArrays() -local vertexBuffer = gl.GenBuffers() -local elementBuffer = gl.GenBuffers() - -gl.BindVertexArray(vertexArray) - -gl.BindBuffer(gl.ARRAY_BUFFER, vertexBuffer) -gl.BufferData(gl.ARRAY_BUFFER, gl.FLOAT, vertices, gl.STATIC_DRAW) - -gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, elementBuffer) -gl.BufferData(gl.ELEMENT_ARRAY_BUFFER, gl.UNSIGNED_INT, indices, gl.STATIC_DRAW) - --- position -gl.VertexAttribPointer(0, 3, false, 5, 0) -gl.EnableVertexAttribArray(0) - --- uv -gl.VertexAttribPointer(1, 2, false, 5, 3) -gl.EnableVertexAttribArray(1) - - ---===== load mesh from file =====-- - -local attrib, shapes, materials = honey.tinyobj.parse_obj('suzanne.obj', 1) -print(#attrib.vertices) -print(#attrib.face_num_verts) - -print("mesh face_offset", shapes[1].face_offset) -print("mesh length", shapes[1].length) -print("#attrib.faces", #attrib.faces) -print("#attrib.face_num_verts", #attrib.face_num_verts) - -local suzanne = {} -suzanne.vertices = {} -suzanne.indices = {} - -function addVertex(vertex) - local pos = 3*vertex.v_idx - table.insert(suzanne.vertices, attrib.vertices[pos+1]) - table.insert(suzanne.vertices, attrib.vertices[pos+2]) - table.insert(suzanne.vertices, attrib.vertices[pos+3]) - - local tex = 3*vertex.vt_idx - table.insert(suzanne.vertices, attrib.texcoords[tex+1]) - table.insert(suzanne.vertices, attrib.texcoords[tex+2]) - - table.insert(suzanne.indices, #suzanne.indices) -end - -local start = shapes[1].face_offset -local finish = start + shapes[1].length -for i=start,finish-1 do - local numVerts = attrib.face_num_verts[i+1] - for j=0,numVerts-1 do - local vertex = attrib.faces[(3*i)+j+1] - addVertex(vertex) - end -end - ---for i, vertex in ipairs(suzanne.vertices) do --- io.write(tostring(vertex) .. ", ") --- if i % 3 == 0 then print() end ---end ---print() --- ---local indices = {} ---for i=1,#suzanne.indices do --- io.write(tostring(suzanne.indices[i]) .. ", ") --- if i % 3 == 0 then print() end ---end ---print() - - -print("#suzanne.vertices", #suzanne.vertices) -print("#suzanne.indices", #suzanne.indices) - - - -suzanne.vertexArr = gl.GenVertexArrays() -suzanne.vertexBuf = gl.GenBuffers() -suzanne.elementBuf = gl.GenBuffers() - -gl.BindVertexArray(suzanne.vertexArr) -gl.BindBuffer(gl.ARRAY_BUFFER, suzanne.vertexBuf) -gl.BufferData(gl.ARRAY_BUFFER, gl.FLOAT, suzanne.vertices, gl.STATIC_DRAW) - -gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, suzanne.elementBuf) -gl.BufferData(gl.ELEMENT_ARRAY_BUFFER, gl.UNSIGNED_INT, suzanne.indices, gl.STATIC_DRAW) - -local size = 5 -gl.VertexAttribPointer(0, 3, false, size, 0) -gl.EnableVertexAttribArray(0) -gl.VertexAttribPointer(1, 2, false, size, 3) -gl.EnableVertexAttribArray(1) - - ---====== load texture ======-- - -local texture = gl.GenTextures() -gl.BindTexture(gl.TEXTURE_2D, texture) - -gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT) -gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT) - -gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) -gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) - -local image, width, height = honey.image.load('container.jpg', 3) -gl.TexImage2D( - gl.TEXTURE_2D, 0, - gl.RGB, width, height, - gl.RGB, gl.UNSIGNED_BYTE, - image -) -gl.GenerateMipmap(gl.TEXTURE_2D) -honey.image.destroy(image) - --- connect shader samplers to texture units -gl.UseProgram(shader) -gl.Uniform1i(gl.GetUniformLocation(shader, 'ourTexture'), 0) - - ---===== generate cairo texture =====-- - --- local image = honey.image --- local surface = image.surface_create(image.FORMAT_ARGB32, 512, 512) --- local cr = image.context_create(surface) --- image.context_select_font_face(cr, "sans-serif", image.FONT_SLANT_NORMAL, image.FONT_WEIGHT_NORMAL) --- image.context_set_font_size(cr, 32) --- image.context_set_source_rgb(cr, 1, 0, 0) --- image.context_move_to(cr, 100, 100) --- image.context_show_text(cr, "hello, world!") --- local data = image.surface_get_data(surface) --- gl.BindTexture(gl.TEXTURE_2D, texture) --- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_SWIZZLE_R, gl.BLUE) --- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_SWIZZLE_B, gl.RED) --- --gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_SWIZZLE_A, gl.RED) --- gl.TexImage2D( --- gl.TEXTURE_2D, 0, --- gl.RGB, width, height, --- gl.RGBA, gl.UNSIGNED_BYTE, --- data --- ) --- gl.GenerateMipmap(gl.TEXTURE_2D) - - ---====== matrices ======-- - -local model = honey.glm.mat4_create() -local axis1 = honey.glm.vec3_create() -honey.glm.vec3_set(axis1, 0, 1.0) -honey.glm.vec3_set(axis1, 1, 0.0) -honey.glm.vec3_set(axis1, 2, 0.0) - -local axis2 = honey.glm.vec3_create() -honey.glm.vec3_set(axis2, 0, 0.0) -honey.glm.vec3_set(axis2, 1, 1.0) -honey.glm.vec3_set(axis2, 2, 0.0) - -local view = honey.glm.mat4_create() -honey.glm.mat4_identity(view) -local translation = honey.glm.vec3_create() -honey.glm.vec3_set(translation, 0, 0.0) -honey.glm.vec3_set(translation, 1, 0.0) -honey.glm.vec3_set(translation, 2, -3.0) -honey.glm.translate(view, translation) - -local projection = honey.glm.mat4_create() -honey.glm.perspective(math.rad(45), 800/600, 0.1, 100, projection) - - ---====== main loop ======-- - -local transform = honey.glm.mat4_create() - -while not window.shouldClose(w) do - local time = window.getTime() - - gl.ClearColor(0.2, 0.3, 0.3, 1.0) - gl.Clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT) - - gl.ActiveTexture(0) - gl.BindTexture(gl.TEXTURE_2D, texture) - - gl.UseProgram(shader) - - local modelL = gl.GetUniformLocation(shader, 'model') - local viewL = gl.GetUniformLocation(shader, 'view') - local projectionL = gl.GetUniformLocation(shader, 'projection') - - honey.glm.mat4_identity(model) - honey.glm.rotate(model, 0.5*math.pi*time, axis2) - honey.glm.rotate(model, math.rad(-90), axis1) - - gl.UniformMatrix4fv(modelL, false, model) - gl.UniformMatrix4fv(viewL, false, view) - gl.UniformMatrix4fv(projectionL, false, projection) - - --gl.BindVertexArray(vertexArray) - --gl.DrawElements(gl.TRIANGLES, 6, gl.UNSIGNED_INT, 0) - - gl.BindVertexArray(suzanne.vertexArr) - gl.DrawElements(gl.TRIANGLES, #suzanne.indices, gl.UNSIGNED_INT, 0) - - window.swapBuffers(w) - window.pollEvents() -end - ---===== shut down =====-- - -window.destroy(w) -gl.Terminate() -honey.audio.engine_uninit(engine) ---image.surface_destroy(surface) ---image.context_destroy(cr) diff --git a/demo/fancy/main.lua b/demo/fancy/main.lua new file mode 100644 index 0000000..54472c5 --- /dev/null +++ b/demo/fancy/main.lua @@ -0,0 +1,319 @@ +local gl = honey.gl +local window = honey.window + + +--===== initialize audio =====-- + +local result, engine = honey.ma.engine_init({}) +honey.ma.engine_play_sound(engine, 'example_sound.ogg', nil) + + +--====== initialize opengl ======-- + +gl.Init() +window.setHint(window.hintType.contextVersionMajor, 3) +window.setHint(window.hintType.contextVersionMinor, 3) +window.setHint(window.hintType.openGlProfile, window.profileType.openGlCoreProfile) + + +--====== create window ======-- + +local w = window.create(640, 480, 'hello, world!') +window.makeContextCurrent(w) +gl.InitGlad() +gl.Enable(gl.DEPTH_TEST) + +window.setFramebufferSizeCallback(w, function(_, width, height) + print(string.format("resize: (%d, %d)", width, height)) + gl.Viewport(0, 0, width, height) +end) + + +--====== compile shaders ======-- + +local vertexShaderSource = [[ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec2 aTexCoord; + +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +out vec3 pos; +out vec2 TexCoord; + +void main() +{ + gl_Position = projection * view * model * vec4(aPos, 1.0); + TexCoord = aTexCoord; + pos = aPos; +} +]] + +local fragmentShaderSource = [[ +#version 330 core +out vec4 FragColor; + +in vec3 pos; +in vec2 TexCoord; + +uniform sampler2D ourTexture; + +void main() +{ + // FragColor = vec4(pos, 1.0f); + FragColor = texture(ourTexture, TexCoord); +} +]] + +-- vertex shader +local vertexShader = gl.CreateShader(gl.VERTEX_SHADER) +gl.ShaderSource(vertexShader, vertexShaderSource) +gl.CompileShader(vertexShader) + +-- fragment shader +local fragmentShader = gl.CreateShader(gl.FRAGMENT_SHADER) +gl.ShaderSource(fragmentShader, fragmentShaderSource) +gl.CompileShader(fragmentShader) + +-- link +local shader = gl.CreateProgram() +gl.AttachShader(shader, vertexShader) +gl.AttachShader(shader, fragmentShader) +gl.LinkProgram(shader) +-- clean up +gl.DeleteShader(vertexShader) +gl.DeleteShader(fragmentShader) + + +--====== set up mesh data manually ======-- + +local vertices = { +-- positions uvs + 0.5, 0.5, 0.0, 1.0, 1.0, -- top right + 0.5, -0.5, 0.0, 1.0, 0.0, -- bottom right + -0.5, -0.5, 0.0, 0.0, 0.0, -- bottom let + -0.5, 0.5, 0.0, 0.0, 1.0 -- top let +} +local indices = { + 0, 1, 3, -- first triangle + 1, 2, 3 -- second triangle +} + +-- buffers +local vertexArray = gl.GenVertexArrays() +local vertexBuffer = gl.GenBuffers() +local elementBuffer = gl.GenBuffers() + +gl.BindVertexArray(vertexArray) + +gl.BindBuffer(gl.ARRAY_BUFFER, vertexBuffer) +gl.BufferData(gl.ARRAY_BUFFER, gl.FLOAT, vertices, gl.STATIC_DRAW) + +gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, elementBuffer) +gl.BufferData(gl.ELEMENT_ARRAY_BUFFER, gl.UNSIGNED_INT, indices, gl.STATIC_DRAW) + +-- position +gl.VertexAttribPointer(0, 3, false, 5, 0) +gl.EnableVertexAttribArray(0) + +-- uv +gl.VertexAttribPointer(1, 2, false, 5, 3) +gl.EnableVertexAttribArray(1) + + +--===== load mesh from file =====-- + +local attrib, shapes, materials = honey.tinyobj.parse_obj('suzanne.obj', 1) +print(#attrib.vertices) +print(#attrib.face_num_verts) + +print("mesh face_offset", shapes[1].face_offset) +print("mesh length", shapes[1].length) +print("#attrib.faces", #attrib.faces) +print("#attrib.face_num_verts", #attrib.face_num_verts) + +local suzanne = {} +suzanne.vertices = {} +suzanne.indices = {} + +function addVertex(vertex) + local pos = 3*vertex.v_idx + table.insert(suzanne.vertices, attrib.vertices[pos+1]) + table.insert(suzanne.vertices, attrib.vertices[pos+2]) + table.insert(suzanne.vertices, attrib.vertices[pos+3]) + + local tex = 3*vertex.vt_idx + table.insert(suzanne.vertices, attrib.texcoords[tex+1]) + table.insert(suzanne.vertices, attrib.texcoords[tex+2]) + + table.insert(suzanne.indices, #suzanne.indices) +end + +local start = shapes[1].face_offset +local finish = start + shapes[1].length +for i=start,finish-1 do + local numVerts = attrib.face_num_verts[i+1] + for j=0,numVerts-1 do + local vertex = attrib.faces[(3*i)+j+1] + addVertex(vertex) + end +end + +--for i, vertex in ipairs(suzanne.vertices) do +-- io.write(tostring(vertex) .. ", ") +-- if i % 3 == 0 then print() end +--end +--print() +-- +--local indices = {} +--for i=1,#suzanne.indices do +-- io.write(tostring(suzanne.indices[i]) .. ", ") +-- if i % 3 == 0 then print() end +--end +--print() + + +print("#suzanne.vertices", #suzanne.vertices) +print("#suzanne.indices", #suzanne.indices) + + + +suzanne.vertexArr = gl.GenVertexArrays() +suzanne.vertexBuf = gl.GenBuffers() +suzanne.elementBuf = gl.GenBuffers() + +gl.BindVertexArray(suzanne.vertexArr) +gl.BindBuffer(gl.ARRAY_BUFFER, suzanne.vertexBuf) +gl.BufferData(gl.ARRAY_BUFFER, gl.FLOAT, suzanne.vertices, gl.STATIC_DRAW) + +gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, suzanne.elementBuf) +gl.BufferData(gl.ELEMENT_ARRAY_BUFFER, gl.UNSIGNED_INT, suzanne.indices, gl.STATIC_DRAW) + +local size = 5 +gl.VertexAttribPointer(0, 3, false, size, 0) +gl.EnableVertexAttribArray(0) +gl.VertexAttribPointer(1, 2, false, size, 3) +gl.EnableVertexAttribArray(1) + + +--====== load texture ======-- + +local texture = gl.GenTextures() +gl.BindTexture(gl.TEXTURE_2D, texture) + +gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT) +gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT) + +gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) +gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) + +local image, width, height = honey.image.load('container.jpg', 3) +gl.TexImage2D( + gl.TEXTURE_2D, 0, + gl.RGB, width, height, + gl.RGB, gl.UNSIGNED_BYTE, + image +) +gl.GenerateMipmap(gl.TEXTURE_2D) +honey.image.destroy(image) + +-- connect shader samplers to texture units +gl.UseProgram(shader) +gl.Uniform1i(gl.GetUniformLocation(shader, 'ourTexture'), 0) + + +--===== generate cairo texture =====-- + +-- local image = honey.image +-- local surface = image.surface_create(image.FORMAT_ARGB32, 512, 512) +-- local cr = image.context_create(surface) +-- image.context_select_font_face(cr, "sans-serif", image.FONT_SLANT_NORMAL, image.FONT_WEIGHT_NORMAL) +-- image.context_set_font_size(cr, 32) +-- image.context_set_source_rgb(cr, 1, 0, 0) +-- image.context_move_to(cr, 100, 100) +-- image.context_show_text(cr, "hello, world!") +-- local data = image.surface_get_data(surface) +-- gl.BindTexture(gl.TEXTURE_2D, texture) +-- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_SWIZZLE_R, gl.BLUE) +-- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_SWIZZLE_B, gl.RED) +-- --gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_SWIZZLE_A, gl.RED) +-- gl.TexImage2D( +-- gl.TEXTURE_2D, 0, +-- gl.RGB, width, height, +-- gl.RGBA, gl.UNSIGNED_BYTE, +-- data +-- ) +-- gl.GenerateMipmap(gl.TEXTURE_2D) + + +--====== matrices ======-- + +local model = honey.glm.mat4_create() +local axis1 = honey.glm.vec3_create() +honey.glm.vec3_set(axis1, 0, 1.0) +honey.glm.vec3_set(axis1, 1, 0.0) +honey.glm.vec3_set(axis1, 2, 0.0) + +local axis2 = honey.glm.vec3_create() +honey.glm.vec3_set(axis2, 0, 0.0) +honey.glm.vec3_set(axis2, 1, 1.0) +honey.glm.vec3_set(axis2, 2, 0.0) + +local view = honey.glm.mat4_create() +honey.glm.mat4_identity(view) +local translation = honey.glm.vec3_create() +honey.glm.vec3_set(translation, 0, 0.0) +honey.glm.vec3_set(translation, 1, 0.0) +honey.glm.vec3_set(translation, 2, -3.0) +honey.glm.translate(view, translation) + +local projection = honey.glm.mat4_create() +honey.glm.perspective(math.rad(45), 800/600, 0.1, 100, projection) + + +--====== main loop ======-- + +local transform = honey.glm.mat4_create() + +while not window.shouldClose(w) do + local time = window.getTime() + + gl.ClearColor(0.2, 0.3, 0.3, 1.0) + gl.Clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT) + + gl.ActiveTexture(0) + gl.BindTexture(gl.TEXTURE_2D, texture) + + gl.UseProgram(shader) + + local modelL = gl.GetUniformLocation(shader, 'model') + local viewL = gl.GetUniformLocation(shader, 'view') + local projectionL = gl.GetUniformLocation(shader, 'projection') + + honey.glm.mat4_identity(model) + honey.glm.rotate(model, 0.5*math.pi*time, axis2) + honey.glm.rotate(model, math.rad(-90), axis1) + + gl.UniformMatrix4fv(modelL, false, model) + gl.UniformMatrix4fv(viewL, false, view) + gl.UniformMatrix4fv(projectionL, false, projection) + + --gl.BindVertexArray(vertexArray) + --gl.DrawElements(gl.TRIANGLES, 6, gl.UNSIGNED_INT, 0) + + gl.BindVertexArray(suzanne.vertexArr) + gl.DrawElements(gl.TRIANGLES, #suzanne.indices, gl.UNSIGNED_INT, 0) + + window.swapBuffers(w) + window.pollEvents() +end + +--===== shut down =====-- + +window.destroy(w) +gl.Terminate() +honey.ma.engine_uninit(engine) +--image.surface_destroy(surface) +--image.context_destroy(cr) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 8d38f01..c4b333c 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -5,4 +5,5 @@ target_sources(honey PUBLIC ${CMAKE_CURRENT_LIST_DIR}/setup.c ${CMAKE_CURRENT_LIST_DIR}/engine.c ${CMAKE_CURRENT_LIST_DIR}/sound.c + ${CMAKE_CURRENT_LIST_DIR}/sound_group.c ) diff --git a/src/audio/audio.h b/src/audio/audio.h index 984e1ea..0ea02d0 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -12,6 +12,7 @@ void ma_push_node(lua_State *L, ma_node *n); X("ma.engine", ma_engine_tname) \ X("ma.node", ma_node_tname) \ X("ma.sound", ma_sound_tname) \ + X("ma.sound_group", ma_sound_group_tname) \ #define X(name, mt) extern const char *mt; AUDIO_METATABLES @@ -20,98 +21,152 @@ AUDIO_METATABLES #define AUDIO_FUNCTIONS \ /* engine */ \ - X("ma_engine_init", ma_engine_init_bind) \ - X("ma_engine_uninit", ma_engine_uninit_bind) \ - X("ma_engine_get_endpoint", ma_engine_get_endpoint_bind) \ - X("ma_engine_get_time", ma_engine_get_time_bind) \ - X("ma_engine_set_time", ma_engine_set_time_bind) \ - X("ma_engine_get_channels", ma_engine_get_channels_bind) \ - X("ma_engine_get_sample_rate", ma_engine_get_sample_rate_bind) \ - X("ma_engine_start", ma_engine_start_bind) \ - X("ma_engine_stop", ma_engine_stop_bind) \ - X("ma_engine_set_volume", ma_engine_set_volume_bind) \ - X("ma_engine_set_gain_db", ma_engine_set_gain_db_bind) \ - X("ma_engine_get_listener_count", ma_engine_get_listener_count_bind) \ - X("ma_engine_find_closest_listener", ma_engine_find_closest_listener_bind) \ - X("ma_engine_listener_set_position", ma_engine_listener_set_position_bind) \ - X("ma_engine_listener_get_position", ma_engine_listener_get_position_bind) \ - X("ma_engine_listener_set_direction", ma_engine_listener_set_direction_bind) \ - X("ma_engine_listener_get_direction", ma_engine_listener_get_direction_bind) \ - X("ma_engine_listener_set_velocity", ma_engine_listener_set_velocity_bind) \ - X("ma_engine_listener_get_velocity", ma_engine_listener_get_velocity_bind) \ - X("ma_engine_listener_set_cone", ma_engine_listener_set_cone_bind) \ - X("ma_engine_listener_get_cone", ma_engine_listener_get_cone_bind) \ - X("ma_engine_listener_set_world_up", ma_engine_listener_set_world_up_bind) \ - X("ma_engine_listener_get_world_up", ma_engine_listener_get_world_up_bind) \ - X("ma_engine_listener_set_enabled", ma_engine_listener_set_enabled_bind) \ - X("ma_engine_listener_is_enabled", ma_engine_listener_is_enabled_bind) \ - X("ma_engine_play_sound_ex", ma_engine_play_sound_ex_bind) \ - X("ma_engine_play_sound", ma_engine_play_sound_bind) \ + X("engine_init", ma_engine_init_bind) \ + X("engine_uninit", ma_engine_uninit_bind) \ + X("engine_get_time", ma_engine_get_time_bind) \ + X("engine_set_time", ma_engine_set_time_bind) \ + X("engine_get_channels", ma_engine_get_channels_bind) \ + X("engine_get_sample_rate", ma_engine_get_sample_rate_bind) \ + X("engine_start", ma_engine_start_bind) \ + X("engine_stop", ma_engine_stop_bind) \ + X("engine_set_volume", ma_engine_set_volume_bind) \ + X("engine_set_gain_db", ma_engine_set_gain_db_bind) \ + X("engine_get_listener_count", ma_engine_get_listener_count_bind) \ + X("engine_find_closest_listener", ma_engine_find_closest_listener_bind) \ + X("engine_listener_set_position", ma_engine_listener_set_position_bind) \ + X("engine_listener_get_position", ma_engine_listener_get_position_bind) \ + X("engine_listener_set_direction", ma_engine_listener_set_direction_bind) \ + X("engine_listener_get_direction", ma_engine_listener_get_direction_bind) \ + X("engine_listener_set_velocity", ma_engine_listener_set_velocity_bind) \ + X("engine_listener_get_velocity", ma_engine_listener_get_velocity_bind) \ + X("engine_listener_set_cone", ma_engine_listener_set_cone_bind) \ + X("engine_listener_get_cone", ma_engine_listener_get_cone_bind) \ + X("engine_listener_set_world_up", ma_engine_listener_set_world_up_bind) \ + X("engine_listener_get_world_up", ma_engine_listener_get_world_up_bind) \ + X("engine_listener_set_enabled", ma_engine_listener_set_enabled_bind) \ + X("engine_listener_is_enabled", ma_engine_listener_is_enabled_bind) \ + X("engine_play_sound_ex", ma_engine_play_sound_ex_bind) \ + X("engine_play_sound", ma_engine_play_sound_bind) \ \ /* sound */ \ - X("ma_sound_init_from_file", ma_sound_init_from_file_bind) \ - X("ma_sound_init_copy", ma_sound_init_copy_bind) \ - X("ma_sound_uninit", ma_sound_uninit_bind) \ - X("ma_sound_start", ma_sound_start_bind) \ - X("ma_sound_stop", ma_sound_stop_bind) \ - X("ma_sound_set_volume", ma_sound_set_volume_bind) \ - X("ma_sound_get_volume", ma_sound_get_volume_bind) \ - X("ma_sound_set_pan", ma_sound_set_pan_bind) \ - X("ma_sound_get_pan", ma_sound_get_pan_bind) \ - X("ma_sound_set_pan_mode", ma_sound_set_pan_mode_bind) \ - X("ma_sound_get_pan_mode", ma_sound_get_pan_mode_bind) \ - X("ma_sound_set_pitch", ma_sound_set_pitch_bind) \ - X("ma_sound_get_pitch", ma_sound_get_pitch_bind) \ - X("ma_sound_set_spatialization_enabled", ma_sound_set_spatialization_enabled_bind) \ - X("ma_sound_is_spatialization_enabled", ma_sound_is_spatialization_enabled_bind) \ - X("ma_sound_set_pinned_listener_index", ma_sound_set_pinned_listener_index_bind) \ - X("ma_sound_get_pinned_listener_index", ma_sound_get_pinned_listener_index_bind) \ - X("ma_sound_get_listener_index", ma_sound_get_listener_index_bind) \ - X("ma_sound_get_direction_to_listener", ma_sound_get_direction_to_listener_bind) \ - X("ma_sound_set_position", ma_sound_set_position_bind) \ - X("ma_sound_get_position", ma_sound_get_position_bind) \ - X("ma_sound_set_direction", ma_sound_set_direction_bind) \ - X("ma_sound_get_direction", ma_sound_get_direction_bind) \ - X("ma_sound_set_velocity", ma_sound_set_velocity_bind) \ - X("ma_sound_get_velocity", ma_sound_get_velocity_bind) \ - X("ma_sound_set_attenuation_model", ma_sound_set_attenuation_model_bind) \ - X("ma_sound_get_attenuation_model", ma_sound_get_attenuation_model_bind) \ - X("ma_sound_set_positioning", ma_sound_set_positioning_bind) \ - X("ma_sound_get_positioning", ma_sound_get_positioning_bind) \ - X("ma_sound_set_rolloff", ma_sound_set_rolloff_bind) \ - X("ma_sound_get_rolloff", ma_sound_get_rolloff_bind) \ - X("ma_sound_set_min_gain", ma_sound_set_min_gain_bind) \ - X("ma_sound_get_min_gain", ma_sound_get_min_gain_bind) \ - X("ma_sound_set_max_gain", ma_sound_set_max_gain_bind) \ - X("ma_sound_get_max_gain", ma_sound_get_max_gain_bind) \ - X("ma_sound_set_min_distance", ma_sound_set_min_distance_bind) \ - X("ma_sound_get_min_distance", ma_sound_get_min_distance_bind) \ - X("ma_sound_set_max_distance", ma_sound_set_max_distance_bind) \ - X("ma_sound_get_max_distance", ma_sound_get_max_distance_bind) \ - X("ma_sound_set_cone", ma_sound_set_cone_bind) \ - X("ma_sound_get_cone", ma_sound_get_cone_bind) \ - X("ma_sound_set_doppler_factor", ma_sound_set_doppler_factor_bind) \ - X("ma_sound_get_doppler_factor", ma_sound_get_doppler_factor_bind) \ - X("ma_sound_set_directional_attenuation_factor", ma_sound_set_directional_attenuation_factor_bind) \ - X("ma_sound_get_directional_attenuation_factor", ma_sound_get_directional_attenuation_factor_bind) \ - X("ma_sound_set_fade_in_pcm_frames", ma_sound_set_fade_in_pcm_frames_bind) \ - X("ma_sound_set_fade_in_milliseconds", ma_sound_set_fade_in_milliseconds_bind) \ - X("ma_sound_get_current_fade_volume", ma_sound_get_current_fade_volume_bind) \ - X("ma_sound_set_start_time_in_pcm_frames", ma_sound_set_start_time_in_pcm_frames_bind) \ - X("ma_sound_set_start_time_in_milliseconds", ma_sound_set_start_time_in_milliseconds_bind) \ - X("ma_sound_set_stop_time_in_pcm_frames", ma_sound_set_stop_time_in_pcm_frames_bind) \ - X("ma_sound_set_stop_time_in_milliseconds", ma_sound_set_stop_time_in_milliseconds_bind) \ - X("ma_sound_is_playing", ma_sound_is_playing_bind) \ - X("ma_sound_get_time_in_pcm_frames", ma_sound_get_time_in_pcm_frames_bind) \ - X("ma_sound_set_looping", ma_sound_set_looping_bind) \ - X("ma_sound_is_looping", ma_sound_is_looping_bind) \ - X("ma_sound_at_end", ma_sound_at_end_bind) \ - X("ma_sound_seek_to_pcm_frame", ma_sound_seek_to_pcm_frame_bind) \ - X("ma_sound_get_data_format", ma_sound_get_data_format_bind) \ - X("ma_sound_get_cursor_in_pcm_frames", ma_sound_get_cursor_in_pcm_frames_bind) \ - X("ma_sound_get_length_in_pcm_frames", ma_sound_get_length_in_pcm_frames_bind) \ - X("ma_sound_get_cursor_in_seconds", ma_sound_get_cursor_in_seconds_bind) \ - X("ma_sound_get_length_in_seconds", ma_sound_get_length_in_seconds_bind) \ + X("sound_init_from_file", ma_sound_init_from_file_bind) \ + X("sound_init_copy", ma_sound_init_copy_bind) \ + X("sound_uninit", ma_sound_uninit_bind) \ + X("sound_start", ma_sound_start_bind) \ + X("sound_stop", ma_sound_stop_bind) \ + X("sound_set_volume", ma_sound_set_volume_bind) \ + X("sound_get_volume", ma_sound_get_volume_bind) \ + X("sound_set_pan", ma_sound_set_pan_bind) \ + X("sound_get_pan", ma_sound_get_pan_bind) \ + X("sound_set_pan_mode", ma_sound_set_pan_mode_bind) \ + X("sound_get_pan_mode", ma_sound_get_pan_mode_bind) \ + X("sound_set_pitch", ma_sound_set_pitch_bind) \ + X("sound_get_pitch", ma_sound_get_pitch_bind) \ + X("sound_set_spatialization_enabled", ma_sound_set_spatialization_enabled_bind) \ + X("sound_is_spatialization_enabled", ma_sound_is_spatialization_enabled_bind) \ + X("sound_set_pinned_listener_index", ma_sound_set_pinned_listener_index_bind) \ + X("sound_get_pinned_listener_index", ma_sound_get_pinned_listener_index_bind) \ + X("sound_get_listener_index", ma_sound_get_listener_index_bind) \ + X("sound_get_direction_to_listener", ma_sound_get_direction_to_listener_bind) \ + X("sound_set_position", ma_sound_set_position_bind) \ + X("sound_get_position", ma_sound_get_position_bind) \ + X("sound_set_direction", ma_sound_set_direction_bind) \ + X("sound_get_direction", ma_sound_get_direction_bind) \ + X("sound_set_velocity", ma_sound_set_velocity_bind) \ + X("sound_get_velocity", ma_sound_get_velocity_bind) \ + X("sound_set_attenuation_model", ma_sound_set_attenuation_model_bind) \ + X("sound_get_attenuation_model", ma_sound_get_attenuation_model_bind) \ + X("sound_set_positioning", ma_sound_set_positioning_bind) \ + X("sound_get_positioning", ma_sound_get_positioning_bind) \ + X("sound_set_rolloff", ma_sound_set_rolloff_bind) \ + X("sound_get_rolloff", ma_sound_get_rolloff_bind) \ + X("sound_set_min_gain", ma_sound_set_min_gain_bind) \ + X("sound_get_min_gain", ma_sound_get_min_gain_bind) \ + X("sound_set_max_gain", ma_sound_set_max_gain_bind) \ + X("sound_get_max_gain", ma_sound_get_max_gain_bind) \ + X("sound_set_min_distance", ma_sound_set_min_distance_bind) \ + X("sound_get_min_distance", ma_sound_get_min_distance_bind) \ + X("sound_set_max_distance", ma_sound_set_max_distance_bind) \ + X("sound_get_max_distance", ma_sound_get_max_distance_bind) \ + X("sound_set_cone", ma_sound_set_cone_bind) \ + X("sound_get_cone", ma_sound_get_cone_bind) \ + X("sound_set_doppler_factor", ma_sound_set_doppler_factor_bind) \ + X("sound_get_doppler_factor", ma_sound_get_doppler_factor_bind) \ + X("sound_set_directional_attenuation_factor", ma_sound_set_directional_attenuation_factor_bind) \ + X("sound_get_directional_attenuation_factor", ma_sound_get_directional_attenuation_factor_bind) \ + X("sound_set_fade_in_pcm_frames", ma_sound_set_fade_in_pcm_frames_bind) \ + X("sound_set_fade_in_milliseconds", ma_sound_set_fade_in_milliseconds_bind) \ + X("sound_get_current_fade_volume", ma_sound_get_current_fade_volume_bind) \ + X("sound_set_start_time_in_pcm_frames", ma_sound_set_start_time_in_pcm_frames_bind) \ + X("sound_set_start_time_in_milliseconds", ma_sound_set_start_time_in_milliseconds_bind) \ + X("sound_set_stop_time_in_pcm_frames", ma_sound_set_stop_time_in_pcm_frames_bind) \ + X("sound_set_stop_time_in_milliseconds", ma_sound_set_stop_time_in_milliseconds_bind) \ + X("sound_is_playing", ma_sound_is_playing_bind) \ + X("sound_get_time_in_pcm_frames", ma_sound_get_time_in_pcm_frames_bind) \ + X("sound_set_looping", ma_sound_set_looping_bind) \ + X("sound_is_looping", ma_sound_is_looping_bind) \ + X("sound_at_end", ma_sound_at_end_bind) \ + X("sound_seek_to_pcm_frame", ma_sound_seek_to_pcm_frame_bind) \ + X("sound_get_data_format", ma_sound_get_data_format_bind) \ + X("sound_get_cursor_in_pcm_frames", ma_sound_get_cursor_in_pcm_frames_bind) \ + X("sound_get_length_in_pcm_frames", ma_sound_get_length_in_pcm_frames_bind) \ + X("sound_get_cursor_in_seconds", ma_sound_get_cursor_in_seconds_bind) \ + X("sound_get_length_in_seconds", ma_sound_get_length_in_seconds_bind) \ +\ + /* sound group */ \ + X("sound_group_init", ma_sound_group_init_bind) \ + X("sound_group_uninit", ma_sound_group_uninit_bind) \ + X("sound_group_start", ma_sound_group_start_bind) \ + X("sound_group_stop", ma_sound_group_stop_bind) \ + X("sound_group_set_volume", ma_sound_group_set_volume_bind) \ + X("sound_group_get_volume", ma_sound_group_get_volume_bind) \ + X("sound_group_set_pan", ma_sound_group_set_pan_bind) \ + X("sound_group_get_pan", ma_sound_group_get_pan_bind) \ + X("sound_group_set_pan_mode", ma_sound_group_set_pan_mode_bind) \ + X("sound_group_get_pan_mode", ma_sound_group_get_pan_mode_bind) \ + X("sound_group_set_pitch", ma_sound_group_set_pitch_bind) \ + X("sound_group_get_pitch", ma_sound_group_get_pitch_bind) \ + X("sound_group_set_spatialization_enabled", ma_sound_group_set_spatialization_enabled_bind) \ + X("sound_group_is_spatialization_enabled", ma_sound_group_is_spatialization_enabled_bind) \ + X("sound_group_set_pinned_listener_index", ma_sound_group_set_pinned_listener_index_bind) \ + X("sound_group_get_pinned_listener_index", ma_sound_group_get_pinned_listener_index_bind) \ + X("sound_group_get_listener_index", ma_sound_group_get_listener_index_bind) \ + X("sound_group_get_direction_to_listener", ma_sound_group_get_direction_to_listener_bind) \ + X("sound_group_set_position", ma_sound_group_set_position_bind) \ + X("sound_group_get_position", ma_sound_group_get_position_bind) \ + X("sound_group_set_direction", ma_sound_group_set_direction_bind) \ + X("sound_group_get_direction", ma_sound_group_get_direction_bind) \ + X("sound_group_set_velocity", ma_sound_group_set_velocity_bind) \ + X("sound_group_get_velocity", ma_sound_group_get_velocity_bind) \ + X("sound_group_set_attenuation_model", ma_sound_group_set_attenuation_model_bind) \ + X("sound_group_get_attenuation_model", ma_sound_group_get_attenuation_model_bind) \ + X("sound_group_set_positioning", ma_sound_group_set_positioning_bind) \ + X("sound_group_get_positioning", ma_sound_group_get_positioning_bind) \ + X("sound_group_set_rolloff", ma_sound_group_set_rolloff_bind) \ + X("sound_group_get_rolloff", ma_sound_group_get_rolloff_bind) \ + X("sound_group_set_min_gain", ma_sound_group_set_min_gain_bind) \ + X("sound_group_get_min_gain", ma_sound_group_get_min_gain_bind) \ + X("sound_group_set_max_gain", ma_sound_group_set_max_gain_bind) \ + X("sound_group_get_max_gain", ma_sound_group_get_max_gain_bind) \ + X("sound_group_set_min_distance", ma_sound_group_set_min_distance_bind) \ + X("sound_group_get_min_distance", ma_sound_group_get_min_distance_bind) \ + X("sound_group_set_max_distance", ma_sound_group_set_max_distance_bind) \ + X("sound_group_get_max_distance", ma_sound_group_get_max_distance_bind) \ + X("sound_group_set_cone", ma_sound_group_set_cone_bind) \ + X("sound_group_get_cone", ma_sound_group_get_cone_bind) \ + X("sound_group_set_doppler_factor", ma_sound_group_set_doppler_factor_bind) \ + X("sound_group_get_doppler_factor", ma_sound_group_get_doppler_factor_bind) \ + X("sound_group_set_directional_attenuation_factor", ma_sound_group_set_directional_attenuation_factor_bind) \ + X("sound_group_get_directional_attenuation_factor", ma_sound_group_get_directional_attenuation_factor_bind) \ + X("sound_group_set_fade_in_pcm_frames", ma_sound_group_set_fade_in_pcm_frames_bind) \ + X("sound_group_set_fade_in_milliseconds", ma_sound_group_set_fade_in_milliseconds_bind) \ + X("sound_group_get_current_fade_volume", ma_sound_group_get_current_fade_volume_bind) \ + X("sound_group_set_start_time_in_pcm_frames", ma_sound_group_set_start_time_in_pcm_frames_bind) \ + X("sound_group_set_start_time_in_milliseconds", ma_sound_group_set_start_time_in_milliseconds_bind) \ + X("sound_group_set_stop_time_in_pcm_frames", ma_sound_group_set_stop_time_in_pcm_frames_bind) \ + X("sound_group_set_stop_time_in_milliseconds", ma_sound_group_set_stop_time_in_milliseconds_bind) \ + X("sound_group_is_playing", ma_sound_group_is_playing_bind) \ + X("sound_group_get_time_in_pcm_frames", ma_sound_group_get_time_in_pcm_frames_bind) \ #define X(name, func) int func(lua_State *L); diff --git a/src/audio/bind b/src/audio/bind index 6f7e41c..3a9befe 100644 --- a/src/audio/bind +++ b/src/audio/bind @@ -1,68 +1,55 @@ -ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePath, ma_uint32 flags, ma_sound_group* pGroup, ma_fence* pDoneFence, ma_sound* pSound); -ma_result ma_sound_init_from_file_w(ma_engine* pEngine, const wchar_t* pFilePath, ma_uint32 flags, ma_sound_group* pGroup, ma_fence* pDoneFence, ma_sound* pSound); -ma_result ma_sound_init_copy(ma_engine* pEngine, const ma_sound* pExistingSound, ma_uint32 flags, ma_sound_group* pGroup, ma_sound* pSound); -ma_result ma_sound_init_from_data_source(ma_engine* pEngine, ma_data_source* pDataSource, ma_uint32 flags, ma_sound_group* pGroup, ma_sound* pSound); -ma_result ma_sound_init_ex(ma_engine* pEngine, const ma_sound_config* pConfig, ma_sound* pSound); -void ma_sound_uninit(ma_sound* pSound); -ma_engine* ma_sound_get_engine(const ma_sound* pSound); -ma_data_source* ma_sound_get_data_source(const ma_sound* pSound); -ma_result ma_sound_start(ma_sound* pSound); -ma_result ma_sound_stop(ma_sound* pSound); -void ma_sound_set_volume(ma_sound* pSound, float volume); -float ma_sound_get_volume(const ma_sound* pSound); -void ma_sound_set_pan(ma_sound* pSound, float pan); -float ma_sound_get_pan(const ma_sound* pSound); -void ma_sound_set_pan_mode(ma_sound* pSound, ma_pan_mode panMode); -ma_pan_mode ma_sound_get_pan_mode(const ma_sound* pSound); -void ma_sound_set_pitch(ma_sound* pSound, float pitch); -float ma_sound_get_pitch(const ma_sound* pSound); -void ma_sound_set_spatialization_enabled(ma_sound* pSound, ma_bool32 enabled); -ma_bool32 ma_sound_is_spatialization_enabled(const ma_sound* pSound); -void ma_sound_set_pinned_listener_index(ma_sound* pSound, ma_uint32 listenerIndex); -ma_uint32 ma_sound_get_pinned_listener_index(const ma_sound* pSound); -ma_uint32 ma_sound_get_listener_index(const ma_sound* pSound); -ma_vec3f ma_sound_get_direction_to_listener(const ma_sound* pSound); -void ma_sound_set_position(ma_sound* pSound, float x, float y, float z); -ma_vec3f ma_sound_get_position(const ma_sound* pSound); -void ma_sound_set_direction(ma_sound* pSound, float x, float y, float z); -ma_vec3f ma_sound_get_direction(const ma_sound* pSound); -void ma_sound_set_velocity(ma_sound* pSound, float x, float y, float z); -ma_vec3f ma_sound_get_velocity(const ma_sound* pSound); -void ma_sound_set_attenuation_model(ma_sound* pSound, ma_attenuation_model attenuationModel); -ma_attenuation_model ma_sound_get_attenuation_model(const ma_sound* pSound); -void ma_sound_set_positioning(ma_sound* pSound, ma_positioning positioning); -ma_positioning ma_sound_get_positioning(const ma_sound* pSound); -void ma_sound_set_rolloff(ma_sound* pSound, float rolloff); -float ma_sound_get_rolloff(const ma_sound* pSound); -void ma_sound_set_min_gain(ma_sound* pSound, float minGain); -float ma_sound_get_min_gain(const ma_sound* pSound); -void ma_sound_set_max_gain(ma_sound* pSound, float maxGain); -float ma_sound_get_max_gain(const ma_sound* pSound); -void ma_sound_set_min_distance(ma_sound* pSound, float minDistance); -float ma_sound_get_min_distance(const ma_sound* pSound); -void ma_sound_set_max_distance(ma_sound* pSound, float maxDistance); -float ma_sound_get_max_distance(const ma_sound* pSound); -void ma_sound_set_cone(ma_sound* pSound, float innerAngleInRadians, float outerAngleInRadians, float outerGain); -void ma_sound_get_cone(const ma_sound* pSound, float* pInnerAngleInRadians, float* pOuterAngleInRadians, float* pOuterGain); -void ma_sound_set_doppler_factor(ma_sound* pSound, float dopplerFactor); -float ma_sound_get_doppler_factor(const ma_sound* pSound); -void ma_sound_set_directional_attenuation_factor(ma_sound* pSound, float directionalAttenuationFactor); -float ma_sound_get_directional_attenuation_factor(const ma_sound* pSound); -void ma_sound_set_fade_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames); -void ma_sound_set_fade_in_milliseconds(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds); -float ma_sound_get_current_fade_volume(ma_sound* pSound); -void ma_sound_set_start_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames); -void ma_sound_set_start_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds); -void ma_sound_set_stop_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames); -void ma_sound_set_stop_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds); -ma_bool32 ma_sound_is_playing(const ma_sound* pSound); -ma_uint64 ma_sound_get_time_in_pcm_frames(const ma_sound* pSound); -void ma_sound_set_looping(ma_sound* pSound, ma_bool32 isLooping); -ma_bool32 ma_sound_is_looping(const ma_sound* pSound); -ma_bool32 ma_sound_at_end(const ma_sound* pSound); -ma_result ma_sound_seek_to_pcm_frame(ma_sound* pSound, ma_uint64 frameIndex); -ma_result ma_sound_get_data_format(ma_sound* pSound, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap); -ma_result ma_sound_get_cursor_in_pcm_frames(ma_sound* pSound, ma_uint64* pCursor); -ma_result ma_sound_get_length_in_pcm_frames(ma_sound* pSound, ma_uint64* pLength); -ma_result ma_sound_get_cursor_in_seconds(ma_sound* pSound, float* pCursor); -ma_result ma_sound_get_length_in_seconds(ma_sound* pSound, float* pLength); +ma_result ma_sound_group_init(ma_engine* pEngine, ma_uint32 flags, ma_sound_group* pParentGroup, ma_sound_group* pGroup); +ma_result ma_sound_group_init_ex(ma_engine* pEngine, const ma_sound_group_config* pConfig, ma_sound_group* pGroup); +void ma_sound_group_uninit(ma_sound_group* pGroup); +ma_engine* ma_sound_group_get_engine(const ma_sound_group* pGroup); +ma_result ma_sound_group_start(ma_sound_group* pGroup); +ma_result ma_sound_group_stop(ma_sound_group* pGroup); +void ma_sound_group_set_volume(ma_sound_group* pGroup, float volume); +float ma_sound_group_get_volume(const ma_sound_group* pGroup); +void ma_sound_group_set_pan(ma_sound_group* pGroup, float pan); +float ma_sound_group_get_pan(const ma_sound_group* pGroup); +void ma_sound_group_set_pan_mode(ma_sound_group* pGroup, ma_pan_mode panMode); +ma_pan_mode ma_sound_group_get_pan_mode(const ma_sound_group* pGroup); +void ma_sound_group_set_pitch(ma_sound_group* pGroup, float pitch); +float ma_sound_group_get_pitch(const ma_sound_group* pGroup); +void ma_sound_group_set_spatialization_enabled(ma_sound_group* pGroup, ma_bool32 enabled); +ma_bool32 ma_sound_group_is_spatialization_enabled(const ma_sound_group* pGroup); +void ma_sound_group_set_pinned_listener_index(ma_sound_group* pGroup, ma_uint32 listenerIndex); +ma_uint32 ma_sound_group_get_pinned_listener_index(const ma_sound_group* pGroup); +ma_uint32 ma_sound_group_get_listener_index(const ma_sound_group* pGroup); +ma_vec3f ma_sound_group_get_direction_to_listener(const ma_sound_group* pGroup); +void ma_sound_group_set_position(ma_sound_group* pGroup, float x, float y, float z); +ma_vec3f ma_sound_group_get_position(const ma_sound_group* pGroup); +void ma_sound_group_set_direction(ma_sound_group* pGroup, float x, float y, float z); +ma_vec3f ma_sound_group_get_direction(const ma_sound_group* pGroup); +void ma_sound_group_set_velocity(ma_sound_group* pGroup, float x, float y, float z); +ma_vec3f ma_sound_group_get_velocity(const ma_sound_group* pGroup); +void ma_sound_group_set_attenuation_model(ma_sound_group* pGroup, ma_attenuation_model attenuationModel); +ma_attenuation_model ma_sound_group_get_attenuation_model(const ma_sound_group* pGroup); +void ma_sound_group_set_positioning(ma_sound_group* pGroup, ma_positioning positioning); +ma_positioning ma_sound_group_get_positioning(const ma_sound_group* pGroup); +void ma_sound_group_set_rolloff(ma_sound_group* pGroup, float rolloff); +float ma_sound_group_get_rolloff(const ma_sound_group* pGroup); +void ma_sound_group_set_min_gain(ma_sound_group* pGroup, float minGain); +float ma_sound_group_get_min_gain(const ma_sound_group* pGroup); +void ma_sound_group_set_max_gain(ma_sound_group* pGroup, float maxGain); +float ma_sound_group_get_max_gain(const ma_sound_group* pGroup); +void ma_sound_group_set_min_distance(ma_sound_group* pGroup, float minDistance); +float ma_sound_group_get_min_distance(const ma_sound_group* pGroup); +void ma_sound_group_set_max_distance(ma_sound_group* pGroup, float maxDistance); +float ma_sound_group_get_max_distance(const ma_sound_group* pGroup); +void ma_sound_group_set_cone(ma_sound_group* pGroup, float innerAngleInRadians, float outerAngleInRadians, float outerGain); +void ma_sound_group_get_cone(const ma_sound_group* pGroup, float* pInnerAngleInRadians, float* pOuterAngleInRadians, float* pOuterGain); +void ma_sound_group_set_doppler_factor(ma_sound_group* pGroup, float dopplerFactor); +float ma_sound_group_get_doppler_factor(const ma_sound_group* pGroup); +void ma_sound_group_set_directional_attenuation_factor(ma_sound_group* pGroup, float directionalAttenuationFactor); +float ma_sound_group_get_directional_attenuation_factor(const ma_sound_group* pGroup); +void ma_sound_group_set_fade_in_pcm_frames(ma_sound_group* pGroup, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames); +void ma_sound_group_set_fade_in_milliseconds(ma_sound_group* pGroup, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds); +float ma_sound_group_get_current_fade_volume(ma_sound_group* pGroup); +void ma_sound_group_set_start_time_in_pcm_frames(ma_sound_group* pGroup, ma_uint64 absoluteGlobalTimeInFrames); +void ma_sound_group_set_start_time_in_milliseconds(ma_sound_group* pGroup, ma_uint64 absoluteGlobalTimeInMilliseconds); +void ma_sound_group_set_stop_time_in_pcm_frames(ma_sound_group* pGroup, ma_uint64 absoluteGlobalTimeInFrames); +void ma_sound_group_set_stop_time_in_milliseconds(ma_sound_group* pGroup, ma_uint64 absoluteGlobalTimeInMilliseconds); +ma_bool32 ma_sound_group_is_playing(const ma_sound_group* pGroup); +ma_uint64 ma_sound_group_get_time_in_pcm_frames(const ma_sound_group* pGroup); diff --git a/src/audio/bind.bind b/src/audio/bind.bind index c09a1ca..41fddd6 100644 --- a/src/audio/bind.bind +++ b/src/audio/bind.bind @@ -1,653 +1,511 @@ -int ma_sound_init_from_file_bind(lua_State *L) +int ma_sound_group_init_bind(lua_State *L) { ma_engine * pEngine = get: ma_engine * - const char * pFilePath = luaL_checkstring(L, 2); - ma_uint32 flags = luaL_checkinteger(L, 3); + ma_uint32 flags = luaL_checkinteger(L, 2); + ma_sound_group * pParentGroup = get: ma_sound_group * ma_sound_group * pGroup = get: ma_sound_group * - ma_fence * pDoneFence = get: ma_fence * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_from_file(pEngine, pFilePath, flags, pGroup, pDoneFence, pSound); + ma_result bind_result = ma_sound_group_init(pEngine, flags, pParentGroup, pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_init_from_file_w_bind(lua_State *L) +int ma_sound_group_init_ex_bind(lua_State *L) { ma_engine * pEngine = get: ma_engine * - const wchar_t * pFilePath = luaL_checkstring(L, 2); - ma_uint32 flags = luaL_checkinteger(L, 3); + const ma_sound_group_config * pConfig = get: const ma_sound_group_config * ma_sound_group * pGroup = get: ma_sound_group * - ma_fence * pDoneFence = get: ma_fence * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_from_file_w(pEngine, pFilePath, flags, pGroup, pDoneFence, pSound); + ma_result bind_result = ma_sound_group_init_ex(pEngine, pConfig, pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_init_copy_bind(lua_State *L) +int ma_sound_group_uninit_bind(lua_State *L) { - ma_engine * pEngine = get: ma_engine * - const ma_sound * pExistingSound = get: const ma_sound * - ma_uint32 flags = luaL_checkinteger(L, 3); - ma_sound_group * pGroup = get: ma_sound_group * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_copy(pEngine, pExistingSound, flags, pGroup, pSound); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_init_from_data_source_bind(lua_State *L) -{ - ma_engine * pEngine = get: ma_engine * - ma_data_source * pDataSource = get: ma_data_source * - ma_uint32 flags = luaL_checkinteger(L, 3); ma_sound_group * pGroup = get: ma_sound_group * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_from_data_source(pEngine, pDataSource, flags, pGroup, pSound); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_init_ex_bind(lua_State *L) -{ - ma_engine * pEngine = get: ma_engine * - const ma_sound_config * pConfig = get: const ma_sound_config * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_ex(pEngine, pConfig, pSound); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_uninit_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_sound_uninit(pSound); + ma_sound_group_uninit(pGroup); return 0; } -int ma_sound_get_engine_bind(lua_State *L) -{ - const ma_sound * pSound = get: const ma_sound * - ma_engine* bind_result = ma_sound_get_engine(pSound); - /* push result */ - return /* count */; -} - - -int ma_sound_get_data_source_bind(lua_State *L) +int ma_sound_group_get_engine_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_data_source* bind_result = ma_sound_get_data_source(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_engine* bind_result = ma_sound_group_get_engine(pGroup); /* push result */ return /* count */; } -int ma_sound_start_bind(lua_State *L) +int ma_sound_group_start_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_start(pSound); + ma_sound_group * pGroup = get: ma_sound_group * + ma_result bind_result = ma_sound_group_start(pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_stop_bind(lua_State *L) +int ma_sound_group_stop_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_stop(pSound); + ma_sound_group * pGroup = get: ma_sound_group * + ma_result bind_result = ma_sound_group_stop(pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_set_volume_bind(lua_State *L) +int ma_sound_group_set_volume_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float volume = luaL_checknumber(L, 2); - ma_sound_set_volume(pSound, volume); + ma_sound_group_set_volume(pGroup, volume); return 0; } -int ma_sound_get_volume_bind(lua_State *L) +int ma_sound_group_get_volume_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_volume(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_volume(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_pan_bind(lua_State *L) +int ma_sound_group_set_pan_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float pan = luaL_checknumber(L, 2); - ma_sound_set_pan(pSound, pan); + ma_sound_group_set_pan(pGroup, pan); return 0; } -int ma_sound_get_pan_bind(lua_State *L) +int ma_sound_group_get_pan_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_pan(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_pan(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_pan_mode_bind(lua_State *L) +int ma_sound_group_set_pan_mode_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_pan_mode panMode = get: ma_pan_mode - ma_sound_set_pan_mode(pSound, panMode); + ma_sound_group_set_pan_mode(pGroup, panMode); return 0; } -int ma_sound_get_pan_mode_bind(lua_State *L) +int ma_sound_group_get_pan_mode_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_pan_mode bind_result = ma_sound_get_pan_mode(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_pan_mode bind_result = ma_sound_group_get_pan_mode(pGroup); /* push result */ return /* count */; } -int ma_sound_set_pitch_bind(lua_State *L) +int ma_sound_group_set_pitch_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float pitch = luaL_checknumber(L, 2); - ma_sound_set_pitch(pSound, pitch); + ma_sound_group_set_pitch(pGroup, pitch); return 0; } -int ma_sound_get_pitch_bind(lua_State *L) +int ma_sound_group_get_pitch_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_pitch(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_pitch(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_spatialization_enabled_bind(lua_State *L) +int ma_sound_group_set_spatialization_enabled_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_bool32 enabled = get: ma_bool32 - ma_sound_set_spatialization_enabled(pSound, enabled); + ma_sound_group_set_spatialization_enabled(pGroup, enabled); return 0; } -int ma_sound_is_spatialization_enabled_bind(lua_State *L) +int ma_sound_group_is_spatialization_enabled_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_bool32 bind_result = ma_sound_is_spatialization_enabled(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_bool32 bind_result = ma_sound_group_is_spatialization_enabled(pGroup); /* push result */ return /* count */; } -int ma_sound_set_pinned_listener_index_bind(lua_State *L) +int ma_sound_group_set_pinned_listener_index_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint32 listenerIndex = luaL_checkinteger(L, 2); - ma_sound_set_pinned_listener_index(pSound, listenerIndex); + ma_sound_group_set_pinned_listener_index(pGroup, listenerIndex); return 0; } -int ma_sound_get_pinned_listener_index_bind(lua_State *L) +int ma_sound_group_get_pinned_listener_index_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_uint32 bind_result = ma_sound_get_pinned_listener_index(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_uint32 bind_result = ma_sound_group_get_pinned_listener_index(pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_get_listener_index_bind(lua_State *L) +int ma_sound_group_get_listener_index_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_uint32 bind_result = ma_sound_get_listener_index(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_uint32 bind_result = ma_sound_group_get_listener_index(pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_get_direction_to_listener_bind(lua_State *L) +int ma_sound_group_get_direction_to_listener_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_vec3f bind_result = ma_sound_get_direction_to_listener(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_vec3f bind_result = ma_sound_group_get_direction_to_listener(pGroup); /* push result */ return /* count */; } -int ma_sound_set_position_bind(lua_State *L) +int ma_sound_group_set_position_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float x = luaL_checknumber(L, 2); float y = luaL_checknumber(L, 3); float z = luaL_checknumber(L, 4); - ma_sound_set_position(pSound, x, y, z); + ma_sound_group_set_position(pGroup, x, y, z); return 0; } -int ma_sound_get_position_bind(lua_State *L) +int ma_sound_group_get_position_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_vec3f bind_result = ma_sound_get_position(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_vec3f bind_result = ma_sound_group_get_position(pGroup); /* push result */ return /* count */; } -int ma_sound_set_direction_bind(lua_State *L) +int ma_sound_group_set_direction_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float x = luaL_checknumber(L, 2); float y = luaL_checknumber(L, 3); float z = luaL_checknumber(L, 4); - ma_sound_set_direction(pSound, x, y, z); + ma_sound_group_set_direction(pGroup, x, y, z); return 0; } -int ma_sound_get_direction_bind(lua_State *L) +int ma_sound_group_get_direction_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_vec3f bind_result = ma_sound_get_direction(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_vec3f bind_result = ma_sound_group_get_direction(pGroup); /* push result */ return /* count */; } -int ma_sound_set_velocity_bind(lua_State *L) +int ma_sound_group_set_velocity_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float x = luaL_checknumber(L, 2); float y = luaL_checknumber(L, 3); float z = luaL_checknumber(L, 4); - ma_sound_set_velocity(pSound, x, y, z); + ma_sound_group_set_velocity(pGroup, x, y, z); return 0; } -int ma_sound_get_velocity_bind(lua_State *L) +int ma_sound_group_get_velocity_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_vec3f bind_result = ma_sound_get_velocity(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_vec3f bind_result = ma_sound_group_get_velocity(pGroup); /* push result */ return /* count */; } -int ma_sound_set_attenuation_model_bind(lua_State *L) +int ma_sound_group_set_attenuation_model_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_attenuation_model attenuationModel = get: ma_attenuation_model - ma_sound_set_attenuation_model(pSound, attenuationModel); + ma_sound_group_set_attenuation_model(pGroup, attenuationModel); return 0; } -int ma_sound_get_attenuation_model_bind(lua_State *L) +int ma_sound_group_get_attenuation_model_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_attenuation_model bind_result = ma_sound_get_attenuation_model(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_attenuation_model bind_result = ma_sound_group_get_attenuation_model(pGroup); /* push result */ return /* count */; } -int ma_sound_set_positioning_bind(lua_State *L) +int ma_sound_group_set_positioning_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_positioning positioning = get: ma_positioning - ma_sound_set_positioning(pSound, positioning); + ma_sound_group_set_positioning(pGroup, positioning); return 0; } -int ma_sound_get_positioning_bind(lua_State *L) +int ma_sound_group_get_positioning_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_positioning bind_result = ma_sound_get_positioning(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_positioning bind_result = ma_sound_group_get_positioning(pGroup); /* push result */ return /* count */; } -int ma_sound_set_rolloff_bind(lua_State *L) +int ma_sound_group_set_rolloff_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float rolloff = luaL_checknumber(L, 2); - ma_sound_set_rolloff(pSound, rolloff); + ma_sound_group_set_rolloff(pGroup, rolloff); return 0; } -int ma_sound_get_rolloff_bind(lua_State *L) +int ma_sound_group_get_rolloff_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_rolloff(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_rolloff(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_min_gain_bind(lua_State *L) +int ma_sound_group_set_min_gain_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float minGain = luaL_checknumber(L, 2); - ma_sound_set_min_gain(pSound, minGain); + ma_sound_group_set_min_gain(pGroup, minGain); return 0; } -int ma_sound_get_min_gain_bind(lua_State *L) +int ma_sound_group_get_min_gain_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_min_gain(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_min_gain(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_max_gain_bind(lua_State *L) +int ma_sound_group_set_max_gain_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float maxGain = luaL_checknumber(L, 2); - ma_sound_set_max_gain(pSound, maxGain); + ma_sound_group_set_max_gain(pGroup, maxGain); return 0; } -int ma_sound_get_max_gain_bind(lua_State *L) +int ma_sound_group_get_max_gain_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_max_gain(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_max_gain(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_min_distance_bind(lua_State *L) +int ma_sound_group_set_min_distance_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float minDistance = luaL_checknumber(L, 2); - ma_sound_set_min_distance(pSound, minDistance); + ma_sound_group_set_min_distance(pGroup, minDistance); return 0; } -int ma_sound_get_min_distance_bind(lua_State *L) +int ma_sound_group_get_min_distance_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_min_distance(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_min_distance(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_max_distance_bind(lua_State *L) +int ma_sound_group_set_max_distance_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float maxDistance = luaL_checknumber(L, 2); - ma_sound_set_max_distance(pSound, maxDistance); + ma_sound_group_set_max_distance(pGroup, maxDistance); return 0; } -int ma_sound_get_max_distance_bind(lua_State *L) +int ma_sound_group_get_max_distance_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_max_distance(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_max_distance(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_cone_bind(lua_State *L) +int ma_sound_group_set_cone_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float innerAngleInRadians = luaL_checknumber(L, 2); float outerAngleInRadians = luaL_checknumber(L, 3); float outerGain = luaL_checknumber(L, 4); - ma_sound_set_cone(pSound, innerAngleInRadians, outerAngleInRadians, outerGain); + ma_sound_group_set_cone(pGroup, innerAngleInRadians, outerAngleInRadians, outerGain); return 0; } -int ma_sound_get_cone_bind(lua_State *L) +int ma_sound_group_get_cone_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * + const ma_sound_group * pGroup = get: const ma_sound_group * float * pInnerAngleInRadians = get: float * float * pOuterAngleInRadians = get: float * float * pOuterGain = get: float * - ma_sound_get_cone(pSound, pInnerAngleInRadians, pOuterAngleInRadians, pOuterGain); + ma_sound_group_get_cone(pGroup, pInnerAngleInRadians, pOuterAngleInRadians, pOuterGain); return 0; } -int ma_sound_set_doppler_factor_bind(lua_State *L) +int ma_sound_group_set_doppler_factor_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float dopplerFactor = luaL_checknumber(L, 2); - ma_sound_set_doppler_factor(pSound, dopplerFactor); + ma_sound_group_set_doppler_factor(pGroup, dopplerFactor); return 0; } -int ma_sound_get_doppler_factor_bind(lua_State *L) +int ma_sound_group_get_doppler_factor_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_doppler_factor(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_doppler_factor(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_directional_attenuation_factor_bind(lua_State *L) +int ma_sound_group_set_directional_attenuation_factor_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float directionalAttenuationFactor = luaL_checknumber(L, 2); - ma_sound_set_directional_attenuation_factor(pSound, directionalAttenuationFactor); + ma_sound_group_set_directional_attenuation_factor(pGroup, directionalAttenuationFactor); return 0; } -int ma_sound_get_directional_attenuation_factor_bind(lua_State *L) +int ma_sound_group_get_directional_attenuation_factor_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_directional_attenuation_factor(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_directional_attenuation_factor(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_fade_in_pcm_frames_bind(lua_State *L) +int ma_sound_group_set_fade_in_pcm_frames_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float volumeBeg = luaL_checknumber(L, 2); float volumeEnd = luaL_checknumber(L, 3); ma_uint64 fadeLengthInFrames = luaL_checkinteger(L, 4); - ma_sound_set_fade_in_pcm_frames(pSound, volumeBeg, volumeEnd, fadeLengthInFrames); + ma_sound_group_set_fade_in_pcm_frames(pGroup, volumeBeg, volumeEnd, fadeLengthInFrames); return 0; } -int ma_sound_set_fade_in_milliseconds_bind(lua_State *L) +int ma_sound_group_set_fade_in_milliseconds_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float volumeBeg = luaL_checknumber(L, 2); float volumeEnd = luaL_checknumber(L, 3); ma_uint64 fadeLengthInMilliseconds = luaL_checkinteger(L, 4); - ma_sound_set_fade_in_milliseconds(pSound, volumeBeg, volumeEnd, fadeLengthInMilliseconds); + ma_sound_group_set_fade_in_milliseconds(pGroup, volumeBeg, volumeEnd, fadeLengthInMilliseconds); return 0; } -int ma_sound_get_current_fade_volume_bind(lua_State *L) +int ma_sound_group_get_current_fade_volume_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * - float bind_result = ma_sound_get_current_fade_volume(pSound); + ma_sound_group * pGroup = get: ma_sound_group * + float bind_result = ma_sound_group_get_current_fade_volume(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_start_time_in_pcm_frames_bind(lua_State *L) +int ma_sound_group_set_start_time_in_pcm_frames_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint64 absoluteGlobalTimeInFrames = luaL_checkinteger(L, 2); - ma_sound_set_start_time_in_pcm_frames(pSound, absoluteGlobalTimeInFrames); + ma_sound_group_set_start_time_in_pcm_frames(pGroup, absoluteGlobalTimeInFrames); return 0; } -int ma_sound_set_start_time_in_milliseconds_bind(lua_State *L) +int ma_sound_group_set_start_time_in_milliseconds_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint64 absoluteGlobalTimeInMilliseconds = luaL_checkinteger(L, 2); - ma_sound_set_start_time_in_milliseconds(pSound, absoluteGlobalTimeInMilliseconds); + ma_sound_group_set_start_time_in_milliseconds(pGroup, absoluteGlobalTimeInMilliseconds); return 0; } -int ma_sound_set_stop_time_in_pcm_frames_bind(lua_State *L) +int ma_sound_group_set_stop_time_in_pcm_frames_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint64 absoluteGlobalTimeInFrames = luaL_checkinteger(L, 2); - ma_sound_set_stop_time_in_pcm_frames(pSound, absoluteGlobalTimeInFrames); + ma_sound_group_set_stop_time_in_pcm_frames(pGroup, absoluteGlobalTimeInFrames); return 0; } -int ma_sound_set_stop_time_in_milliseconds_bind(lua_State *L) +int ma_sound_group_set_stop_time_in_milliseconds_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint64 absoluteGlobalTimeInMilliseconds = luaL_checkinteger(L, 2); - ma_sound_set_stop_time_in_milliseconds(pSound, absoluteGlobalTimeInMilliseconds); + ma_sound_group_set_stop_time_in_milliseconds(pGroup, absoluteGlobalTimeInMilliseconds); return 0; } -int ma_sound_is_playing_bind(lua_State *L) +int ma_sound_group_is_playing_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_bool32 bind_result = ma_sound_is_playing(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_bool32 bind_result = ma_sound_group_is_playing(pGroup); /* push result */ return /* count */; } -int ma_sound_get_time_in_pcm_frames_bind(lua_State *L) -{ - const ma_sound * pSound = get: const ma_sound * - ma_uint64 bind_result = ma_sound_get_time_in_pcm_frames(pSound); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_set_looping_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_bool32 isLooping = get: ma_bool32 - ma_sound_set_looping(pSound, isLooping); - return 0; -} - - -int ma_sound_is_looping_bind(lua_State *L) -{ - const ma_sound * pSound = get: const ma_sound * - ma_bool32 bind_result = ma_sound_is_looping(pSound); - /* push result */ - return /* count */; -} - - -int ma_sound_at_end_bind(lua_State *L) -{ - const ma_sound * pSound = get: const ma_sound * - ma_bool32 bind_result = ma_sound_at_end(pSound); - /* push result */ - return /* count */; -} - - -int ma_sound_seek_to_pcm_frame_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_uint64 frameIndex = luaL_checkinteger(L, 2); - ma_result bind_result = ma_sound_seek_to_pcm_frame(pSound, frameIndex); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_data_format_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_format * pFormat = get: ma_format * - ma_uint32 * pChannels = get: ma_uint32 * - ma_uint32 * pSampleRate = get: ma_uint32 * - ma_channel * pChannelMap = get: ma_channel * - size_t channelMapCap = get: size_t - ma_result bind_result = ma_sound_get_data_format(pSound, pFormat, pChannels, pSampleRate, pChannelMap, channelMapCap); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_cursor_in_pcm_frames_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_uint64 * pCursor = get: ma_uint64 * - ma_result bind_result = ma_sound_get_cursor_in_pcm_frames(pSound, pCursor); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_length_in_pcm_frames_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_uint64 * pLength = get: ma_uint64 * - ma_result bind_result = ma_sound_get_length_in_pcm_frames(pSound, pLength); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_cursor_in_seconds_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - float * pCursor = get: float * - ma_result bind_result = ma_sound_get_cursor_in_seconds(pSound, pCursor); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_length_in_seconds_bind(lua_State *L) +int ma_sound_group_get_time_in_pcm_frames_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * - float * pLength = get: float * - ma_result bind_result = ma_sound_get_length_in_seconds(pSound, pLength); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_uint64 bind_result = ma_sound_group_get_time_in_pcm_frames(pGroup); lua_pushinteger(L, bind_result); return 1; } diff --git a/src/audio/engine.c b/src/audio/engine.c index 4d2caba..ec43728 100644 --- a/src/audio/engine.c +++ b/src/audio/engine.c @@ -29,6 +29,8 @@ int ma_engine_init_bind(lua_State *L) lua_pushinteger(L, result); lua_pushvalue(L, engine_index); lua_remove(L, engine_index); + luaL_getmetatable(L, ma_engine_tname); + lua_setmetatable(L, -2); return 2; } @@ -41,15 +43,6 @@ int ma_engine_uninit_bind(lua_State *L) } -int ma_engine_get_endpoint_bind(lua_State *L) -{ - ma_engine * pEngine = luaL_checkudata(L, 1, ma_engine_tname); - ma_node* bind_result = ma_engine_get_endpoint(pEngine); - ma_push_node(L, bind_result); - return 1; -} - - int ma_engine_get_time_bind(lua_State *L) { ma_engine * pEngine = luaL_checkudata(L, 1, ma_engine_tname); diff --git a/src/audio/sound_group.c b/src/audio/sound_group.c new file mode 100644 index 0000000..c52b3be --- /dev/null +++ b/src/audio/sound_group.c @@ -0,0 +1,522 @@ +#include +#include +#include +#include "audio.h" + + +ma_sound_group * to_sound_group(lua_State *L, int index) +{ + if (lua_isnil(L, index)) { + return NULL; + } + return luaL_checkudata(L, index, ma_sound_group_tname); +} + + +int ma_sound_group_init_bind(lua_State *L) +{ + ma_engine * pEngine = luaL_checkudata(L, 1, ma_engine_tname); + ma_uint32 flags = luaL_checkinteger(L, 2); + ma_sound_group * pParentGroup = to_sound_group(L, 3); + ma_sound_group * pGroup = lua_newuserdata(L, sizeof(ma_sound_group)); + int gindex = lua_gettop(L); + ma_result bind_result = ma_sound_group_init(pEngine, flags, pParentGroup, pGroup); + lua_pushinteger(L, bind_result); + lua_pushvalue(L, gindex); + lua_remove(L, gindex); + luaL_getmetatable(L, ma_sound_group_tname); + lua_setmetatable(L, -2); + return 2; +} + + +int ma_sound_group_uninit_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_sound_group_uninit(pGroup); + return 0; +} + + +int ma_sound_group_start_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_result bind_result = ma_sound_group_start(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_stop_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_result bind_result = ma_sound_group_stop(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_volume_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float volume = luaL_checknumber(L, 2); + ma_sound_group_set_volume(pGroup, volume); + return 0; +} + + +int ma_sound_group_get_volume_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_volume(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_pan_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float pan = luaL_checknumber(L, 2); + ma_sound_group_set_pan(pGroup, pan); + return 0; +} + + +int ma_sound_group_get_pan_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_pan(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_pan_mode_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_pan_mode panMode = luaL_checkinteger(L, 2); + ma_sound_group_set_pan_mode(pGroup, panMode); + return 0; +} + + +int ma_sound_group_get_pan_mode_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_pan_mode bind_result = ma_sound_group_get_pan_mode(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_pitch_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float pitch = luaL_checknumber(L, 2); + ma_sound_group_set_pitch(pGroup, pitch); + return 0; +} + + +int ma_sound_group_get_pitch_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_pitch(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_spatialization_enabled_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_bool32 enabled = lua_toboolean(L, 2); + ma_sound_group_set_spatialization_enabled(pGroup, enabled); + return 0; +} + + +int ma_sound_group_is_spatialization_enabled_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_bool32 bind_result = ma_sound_group_is_spatialization_enabled(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_pinned_listener_index_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint32 listenerIndex = luaL_checkinteger(L, 2); + ma_sound_group_set_pinned_listener_index(pGroup, listenerIndex); + return 0; +} + + +int ma_sound_group_get_pinned_listener_index_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint32 bind_result = ma_sound_group_get_pinned_listener_index(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_get_listener_index_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint32 bind_result = ma_sound_group_get_listener_index(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_get_direction_to_listener_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_vec3f bind_result = ma_sound_group_get_direction_to_listener(pGroup); + lua_pushnumber(L, bind_result.x); + lua_pushnumber(L, bind_result.y); + lua_pushnumber(L, bind_result.z); + return 3; +} + + +int ma_sound_group_set_position_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float x = luaL_checknumber(L, 2); + float y = luaL_checknumber(L, 3); + float z = luaL_checknumber(L, 4); + ma_sound_group_set_position(pGroup, x, y, z); + return 0; +} + + +int ma_sound_group_get_position_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_vec3f bind_result = ma_sound_group_get_position(pGroup); + lua_pushnumber(L, bind_result.x); + lua_pushnumber(L, bind_result.y); + lua_pushnumber(L, bind_result.z); + return 3; +} + + +int ma_sound_group_set_direction_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float x = luaL_checknumber(L, 2); + float y = luaL_checknumber(L, 3); + float z = luaL_checknumber(L, 4); + ma_sound_group_set_direction(pGroup, x, y, z); + return 0; +} + + +int ma_sound_group_get_direction_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_vec3f bind_result = ma_sound_group_get_direction(pGroup); + lua_pushnumber(L, bind_result.x); + lua_pushnumber(L, bind_result.y); + lua_pushnumber(L, bind_result.z); + return 3; +} + + +int ma_sound_group_set_velocity_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float x = luaL_checknumber(L, 2); + float y = luaL_checknumber(L, 3); + float z = luaL_checknumber(L, 4); + ma_sound_group_set_velocity(pGroup, x, y, z); + return 0; +} + + +int ma_sound_group_get_velocity_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_vec3f bind_result = ma_sound_group_get_velocity(pGroup); + lua_pushnumber(L, bind_result.x); + lua_pushnumber(L, bind_result.y); + lua_pushnumber(L, bind_result.z); + return 3; +} + + +int ma_sound_group_set_attenuation_model_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_attenuation_model attenuationModel = luaL_checkinteger(L, 2); + ma_sound_group_set_attenuation_model(pGroup, attenuationModel); + return 0; +} + + +int ma_sound_group_get_attenuation_model_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_attenuation_model bind_result = ma_sound_group_get_attenuation_model(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_positioning_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_positioning positioning = luaL_checkinteger(L, 2); + ma_sound_group_set_positioning(pGroup, positioning); + return 0; +} + + +int ma_sound_group_get_positioning_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_positioning bind_result = ma_sound_group_get_positioning(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_rolloff_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float rolloff = luaL_checknumber(L, 2); + ma_sound_group_set_rolloff(pGroup, rolloff); + return 0; +} + + +int ma_sound_group_get_rolloff_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_rolloff(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_min_gain_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float minGain = luaL_checknumber(L, 2); + ma_sound_group_set_min_gain(pGroup, minGain); + return 0; +} + + +int ma_sound_group_get_min_gain_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_min_gain(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_max_gain_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float maxGain = luaL_checknumber(L, 2); + ma_sound_group_set_max_gain(pGroup, maxGain); + return 0; +} + + +int ma_sound_group_get_max_gain_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_max_gain(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_min_distance_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float minDistance = luaL_checknumber(L, 2); + ma_sound_group_set_min_distance(pGroup, minDistance); + return 0; +} + + +int ma_sound_group_get_min_distance_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_min_distance(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_max_distance_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float maxDistance = luaL_checknumber(L, 2); + ma_sound_group_set_max_distance(pGroup, maxDistance); + return 0; +} + + +int ma_sound_group_get_max_distance_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_max_distance(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_cone_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float innerAngleInRadians = luaL_checknumber(L, 2); + float outerAngleInRadians = luaL_checknumber(L, 3); + float outerGain = luaL_checknumber(L, 4); + ma_sound_group_set_cone(pGroup, innerAngleInRadians, outerAngleInRadians, outerGain); + return 0; +} + + +int ma_sound_group_get_cone_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float InnerAngleInRadians, OuterAngleInRadians, OuterGain; + ma_sound_group_get_cone(pGroup, &InnerAngleInRadians, &OuterAngleInRadians, &OuterGain); + lua_pushnumber(L, InnerAngleInRadians); + lua_pushnumber(L, OuterAngleInRadians); + lua_pushnumber(L, OuterGain); + return 3; +} + + +int ma_sound_group_set_doppler_factor_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float dopplerFactor = luaL_checknumber(L, 2); + ma_sound_group_set_doppler_factor(pGroup, dopplerFactor); + return 0; +} + + +int ma_sound_group_get_doppler_factor_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_doppler_factor(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_directional_attenuation_factor_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float directionalAttenuationFactor = luaL_checknumber(L, 2); + ma_sound_group_set_directional_attenuation_factor(pGroup, directionalAttenuationFactor); + return 0; +} + + +int ma_sound_group_get_directional_attenuation_factor_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_directional_attenuation_factor(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_fade_in_pcm_frames_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float volumeBeg = luaL_checknumber(L, 2); + float volumeEnd = luaL_checknumber(L, 3); + ma_uint64 fadeLengthInFrames = luaL_checkinteger(L, 4); + ma_sound_group_set_fade_in_pcm_frames(pGroup, volumeBeg, volumeEnd, fadeLengthInFrames); + return 0; +} + + +int ma_sound_group_set_fade_in_milliseconds_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float volumeBeg = luaL_checknumber(L, 2); + float volumeEnd = luaL_checknumber(L, 3); + ma_uint64 fadeLengthInMilliseconds = luaL_checkinteger(L, 4); + ma_sound_group_set_fade_in_milliseconds(pGroup, volumeBeg, volumeEnd, fadeLengthInMilliseconds); + return 0; +} + + +int ma_sound_group_get_current_fade_volume_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_current_fade_volume(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_start_time_in_pcm_frames_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 absoluteGlobalTimeInFrames = luaL_checkinteger(L, 2); + ma_sound_group_set_start_time_in_pcm_frames(pGroup, absoluteGlobalTimeInFrames); + return 0; +} + + +int ma_sound_group_set_start_time_in_milliseconds_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 absoluteGlobalTimeInMilliseconds = luaL_checkinteger(L, 2); + ma_sound_group_set_start_time_in_milliseconds(pGroup, absoluteGlobalTimeInMilliseconds); + return 0; +} + + +int ma_sound_group_set_stop_time_in_pcm_frames_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 absoluteGlobalTimeInFrames = luaL_checkinteger(L, 2); + ma_sound_group_set_stop_time_in_pcm_frames(pGroup, absoluteGlobalTimeInFrames); + return 0; +} + + +int ma_sound_group_set_stop_time_in_milliseconds_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 absoluteGlobalTimeInMilliseconds = luaL_checkinteger(L, 2); + ma_sound_group_set_stop_time_in_milliseconds(pGroup, absoluteGlobalTimeInMilliseconds); + return 0; +} + + +int ma_sound_group_is_playing_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_bool32 bind_result = ma_sound_group_is_playing(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_get_time_in_pcm_frames_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 bind_result = ma_sound_group_get_time_in_pcm_frames(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + -- cgit v1.2.1