Fix dequeuing (#594)
This commit is contained in:
parent
eda7605739
commit
57c1680537
1 changed files with 4 additions and 4 deletions
|
@ -128,6 +128,10 @@ namespace BetterJoyForCemu {
|
||||||
|
|
||||||
public void set_vals(float low_freq, float high_freq, float amplitude) {
|
public void set_vals(float low_freq, float high_freq, float amplitude) {
|
||||||
float[] rumbleQueue = new float[] {low_freq, high_freq, amplitude};
|
float[] rumbleQueue = new float[] {low_freq, high_freq, amplitude};
|
||||||
|
// Keep a queue of 15 items, discard oldest item if queue is full.
|
||||||
|
if (queue.Count > 15) {
|
||||||
|
queue.Dequeue();
|
||||||
|
}
|
||||||
queue.Enqueue(rumbleQueue);
|
queue.Enqueue(rumbleQueue);
|
||||||
}
|
}
|
||||||
public Rumble(float[] rumble_info) {
|
public Rumble(float[] rumble_info) {
|
||||||
|
@ -767,10 +771,6 @@ namespace BetterJoyForCemu {
|
||||||
while (!stop_polling & state > state_.NO_JOYCONS) {
|
while (!stop_polling & state > state_.NO_JOYCONS) {
|
||||||
if (rumble_obj.queue.Count > 0) {
|
if (rumble_obj.queue.Count > 0) {
|
||||||
SendRumble(rumble_obj.GetData());
|
SendRumble(rumble_obj.GetData());
|
||||||
// Keep a queue of 15 items, discard oldest item if queue is full.
|
|
||||||
if (rumble_obj.queue.Count > 15) {
|
|
||||||
rumble_obj.queue.Dequeue();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
int a = ReceiveRaw();
|
int a = ReceiveRaw();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue