mirror of https://github.com/bjornbytes/lovr.git
Create Sources from AudioStreams;
This commit is contained in:
parent
e5a17a4160
commit
89891811b7
|
@ -62,12 +62,19 @@ int l_lovrAudioIsSpatialized(lua_State* L) {
|
|||
}
|
||||
|
||||
int l_lovrAudioNewSource(lua_State* L) {
|
||||
Blob* blob = luax_readblob(L, 1, "Source");
|
||||
AudioStream* stream = lovrAudioStreamCreate(blob, 4096);
|
||||
void** type;
|
||||
AudioStream* stream;
|
||||
if ((type = luax_totype(L, 1, AudioStream)) != NULL) {
|
||||
stream = *type;
|
||||
} else {
|
||||
Blob* blob = luax_readblob(L, 1, "Source");
|
||||
stream = lovrAudioStreamCreate(blob, 4096);
|
||||
lovrRelease(&blob->ref);
|
||||
}
|
||||
|
||||
Source* source = lovrSourceCreate(stream);
|
||||
luax_pushtype(L, Source, source);
|
||||
lovrRelease(&source->ref);
|
||||
lovrRelease(&blob->ref);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue