mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 10:36:44 +00:00
Add support for byte arrays to audio.play
This commit is contained in:
parent
8191c7dc85
commit
3502da4889
1 changed files with 19 additions and 1 deletions
|
@ -90,7 +90,25 @@ public class Audio : IPlugin
|
|||
{
|
||||
var L = Lua.FromIntPtr(state);
|
||||
|
||||
var buffer = L.CheckBuffer(1);
|
||||
byte[] buffer;
|
||||
|
||||
if (L.IsString(1))
|
||||
{
|
||||
buffer = L.CheckBuffer(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
L.CheckType(1, LuaType.Table);
|
||||
var len = L.RawLen(1);
|
||||
buffer = new byte[len];
|
||||
for (int i = 1; i <= len; i++)
|
||||
{
|
||||
L.GetInteger(1, i);
|
||||
var value = L.CheckInteger(-1);
|
||||
buffer[i - 1] = (byte)value;
|
||||
L.Pop(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (_game.Audio.Sound.PendingBufferCount > queueLimit)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue