Minetest 5.10.0-dev
 
Loading...
Searching...
No Matches
l_client_sound.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2023 DS
4Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU Lesser General Public License as published by
9the Free Software Foundation; either version 2.1 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along
18with this program; if not, write to the Free Software Foundation, Inc.,
1951 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20*/
21
22#pragma once
23
24#include "lua_api/l_base.h"
25#include "util/basic_macros.h"
26
27using sound_handle_t = int;
28
30{
31private:
32 // sound_play(spec, parameters)
33 static int l_sound_play(lua_State *L);
34
35public:
36 static void Initialize(lua_State *L, int top);
37};
38
39class ClientSoundHandle final : public ModApiBase
40{
41private:
43
44 static const char className[];
45 static const luaL_Reg methods[];
46
48
50
51 static ClientSoundHandle *checkobject(lua_State *L, int narg);
52
53 static int gc_object(lua_State *L);
54
55 // :stop()
56 static int l_stop(lua_State *L);
57
58 // :fade(step, gain)
59 static int l_fade(lua_State *L);
60
61public:
62 ~ClientSoundHandle() = default;
63
64 static void create(lua_State *L, sound_handle_t handle);
65 static void Register(lua_State *L);
66};
#define DISABLE_CLASS_COPY(C)
Definition basic_macros.h:41
Definition l_client_sound.h:40
static int gc_object(lua_State *L)
Definition l_client_sound.cpp:85
~ClientSoundHandle()=default
static const char className[]
Definition l_client_sound.h:44
static int l_stop(lua_State *L)
Definition l_client_sound.cpp:95
static const luaL_Reg methods[]
Definition l_client_sound.h:146
static void create(lua_State *L, sound_handle_t handle)
Definition l_client_sound.cpp:112
ClientSoundHandle(sound_handle_t handle)
Definition l_client_sound.h:47
sound_handle_t m_handle
Definition l_client_sound.h:42
static ClientSoundHandle * checkobject(lua_State *L, int narg)
Definition l_client_sound.cpp:76
static int l_fade(lua_State *L)
Definition l_client_sound.cpp:103
Definition l_base.h:43
Definition l_client_sound.h:30
static void Initialize(lua_State *L, int top)
Definition l_client_sound.cpp:69
static int l_sound_play(lua_State *L)
Definition l_client_sound.cpp:32
int sound_handle_t
Definition client.h:75
int sound_handle_t
Definition l_client_sound.h:27