mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-05 13:53:38 +00:00
lovrSoundFormat
This commit is contained in:
parent
cd1cddcd93
commit
7b58561c03
|
@ -102,6 +102,7 @@ extern StringEntry lovrStencilAction[];
|
||||||
extern StringEntry lovrTextureFormat[];
|
extern StringEntry lovrTextureFormat[];
|
||||||
extern StringEntry lovrTextureType[];
|
extern StringEntry lovrTextureType[];
|
||||||
extern StringEntry lovrTimeUnit[];
|
extern StringEntry lovrTimeUnit[];
|
||||||
|
extern StringEntry lovrSampleFormat[];
|
||||||
extern StringEntry lovrUniformAccess[];
|
extern StringEntry lovrUniformAccess[];
|
||||||
extern StringEntry lovrVerticalAlign[];
|
extern StringEntry lovrVerticalAlign[];
|
||||||
extern StringEntry lovrWinding[];
|
extern StringEntry lovrWinding[];
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
StringEntry lovrSampleFormat[] = {
|
||||||
|
[SAMPLE_F32] = ENTRY("f32"),
|
||||||
|
[SAMPLE_I16] = ENTRY("i16"),
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
static int l_lovrDataNewBlob(lua_State* L) {
|
static int l_lovrDataNewBlob(lua_State* L) {
|
||||||
size_t size;
|
size_t size;
|
||||||
uint8_t* data = NULL;
|
uint8_t* data = NULL;
|
||||||
|
@ -70,7 +76,7 @@ static int l_lovrDataNewSoundData(lua_State* L) {
|
||||||
uint64_t frames = luaL_checkinteger(L, 1);
|
uint64_t frames = luaL_checkinteger(L, 1);
|
||||||
uint32_t channels = luaL_optinteger(L, 2, 2);
|
uint32_t channels = luaL_optinteger(L, 2, 2);
|
||||||
uint32_t sampleRate = luaL_optinteger(L, 3, 44100);
|
uint32_t sampleRate = luaL_optinteger(L, 3, 44100);
|
||||||
uint32_t format = luaL_optinteger(L, 4, 16);
|
SampleFormat format = luax_checkenum(L, 4, SampleFormat, "i16");
|
||||||
Blob* blob = luax_totype(L, 5, Blob);
|
Blob* blob = luax_totype(L, 5, Blob);
|
||||||
SoundData* soundData = lovrSoundDataCreateRaw(frames, channels, sampleRate, format, blob);
|
SoundData* soundData = lovrSoundDataCreateRaw(frames, channels, sampleRate, format, blob);
|
||||||
luax_pushtype(L, SoundData, soundData);
|
luax_pushtype(L, SoundData, soundData);
|
||||||
|
|
Loading…
Reference in a new issue