mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Extract event queueing snippet from Audio.cs
This commit is contained in:
parent
dee550b28d
commit
ac9081cf89
1 changed files with 9 additions and 10 deletions
|
@ -51,17 +51,22 @@ public class Audio : IDisposable
|
|||
HQChannel.BufferNeeded += HQChannel_BufferNeeded;
|
||||
}
|
||||
|
||||
private void HQChannel_BufferNeeded(object sender, EventArgs e)
|
||||
private static void EnqueueAudioNeedEvent(int i, int pending)
|
||||
{
|
||||
var pending = HQChannel.PendingBufferCount;
|
||||
Capy64.Instance.LuaRuntime.QueueEvent("audio_need", LK =>
|
||||
{
|
||||
LK.PushInteger(-1);
|
||||
LK.PushInteger(i);
|
||||
LK.PushInteger(pending);
|
||||
return 2;
|
||||
});
|
||||
}
|
||||
|
||||
private void HQChannel_BufferNeeded(object sender, EventArgs e)
|
||||
{
|
||||
var pending = HQChannel.PendingBufferCount;
|
||||
EnqueueAudioNeedEvent(-1, pending);
|
||||
}
|
||||
|
||||
private void Audio_BufferNeeded(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < ChannelsCount; i++)
|
||||
|
@ -70,15 +75,9 @@ public class Audio : IDisposable
|
|||
{
|
||||
freeChannels[i] = true;
|
||||
var pending = Channels[i].PendingBufferCount;
|
||||
Capy64.Instance.LuaRuntime.QueueEvent("audio_need", LK =>
|
||||
{
|
||||
LK.PushInteger(i);
|
||||
LK.PushInteger(pending);
|
||||
return 2;
|
||||
});
|
||||
EnqueueAudioNeedEvent(i, pending);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int GetChannelId(int inp)
|
||||
|
|
Loading…
Reference in a new issue