take out lovrDataNewSoundDataStream
@@ -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);
+ const char *other = lua_tostring(L, 5);
+ bool isStream = other && strcmp(other, "stream") == 0;
+ SoundData* soundData = isStream ?
+ lovrSoundDataCreateStream(frames, channels, sampleRate, format) :
+ lovrSoundDataCreateRaw(frames, channels, sampleRate, format, blob);
+
luax_pushtype(L, SoundData, soundData);
lovrRelease(SoundData, soundData);
return 1;
@@ -93,17 +98,6 @@ static int l_lovrDataNewSoundData(lua_State* L) {
return 1;
}
-static int l_lovrDataNewSoundDataStream(lua_State* L) {
- uint64_t frames = luaL_checkinteger(L, 1);
- uint32_t channels = luaL_optinteger(L, 2, 2);
- uint32_t sampleRate = luaL_optinteger(L, 3, 44100);
- SampleFormat format = luax_checkenum(L, 4, SampleFormat, "i16");
- SoundData* soundData = lovrSoundDataCreateStream(frames, channels, sampleRate, format);
- luax_pushtype(L, SoundData, soundData);
- lovrRelease(SoundData, soundData);
- return 1;
-}
-
static int l_lovrDataNewTextureData(lua_State* L) {
TextureData* textureData = NULL;
if (lua_type(L, 1) == LUA_TNUMBER) {
@@ -134,7 +128,6 @@ static const luaL_Reg lovrData[] = {
{ "newModelData", l_lovrDataNewModelData },
{ "newRasterizer", l_lovrDataNewRasterizer },
{ "newSoundData", l_lovrDataNewSoundData },
- { "newSoundDataStream", l_lovrDataNewSoundDataStream },
{ "newTextureData", l_lovrDataNewTextureData },
{ NULL, NULL }
};
