mirror of https://github.com/bjornbytes/lovr.git
SoundData stream lua API
This commit is contained in:
parent
7b58561c03
commit
d1f6e27437
|
@ -78,7 +78,12 @@ static int l_lovrDataNewSoundData(lua_State* L) {
|
|||
uint32_t sampleRate = luaL_optinteger(L, 3, 44100);
|
||||
SampleFormat format = luax_checkenum(L, 4, SampleFormat, "i16");
|
||||
Blob* blob = luax_totype(L, 5, Blob);
|
||||
SoundData* soundData = lovrSoundDataCreateRaw(frames, channels, sampleRate, format, blob);
|
||||
SoundData* soundData;
|
||||
if(blob) {
|
||||
soundData = lovrSoundDataCreateRaw(frames, channels, sampleRate, format, blob);
|
||||
} else {
|
||||
soundData = lovrSoundDataCreateStream(frames, channels, sampleRate, format);
|
||||
}
|
||||
luax_pushtype(L, SoundData, soundData);
|
||||
lovrRelease(SoundData, soundData);
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue