aboutsummaryrefslogtreecommitdiff
path: root/src/lua/audio/luaopen_audio.cpp
blob: 73c5bea65eea586ebf322089cbc2987eb126d44b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "lua/luax.h"
#include "libjin/jin.h"

namespace jin
{
namespace lua
{   
    using namespace jin::audio;

    static int l_init(lua_State* L) 
    {
        SDLAudioSetting setting;
        if (! SDLAudio::get()->init(&setting))
        {
            luax_error(L, "could not init audio");
            luax_pushboolean(L, false);
            return 1;
        }
        luax_pushboolean(L, true); 
        return 1;
    }
   
    static int l_newSound(lua_State* L) 
    {
        
        return 0; 
    }
    
    static const luaL_Reg f[] = { 
        {"init",  l_init},
        {"Sound", l_newSound},
        {0, 0}
    };

    int luaopen_audio(lua_State* L)
    {
        luax_newlib(L, f);

        return 1; 
    }
}
}