mirror of
https://github.com/badvision/jace.git
synced 2024-11-28 10:52:33 +00:00
Adjustment of playback buffer and reset behavior
This commit is contained in:
parent
52e07ebd54
commit
2f9b38e570
@ -30,14 +30,12 @@ import jace.core.SoundMixer;
|
|||||||
import static jace.core.Utility.*;
|
import static jace.core.Utility.*;
|
||||||
import jace.hardware.mockingboard.PSG;
|
import jace.hardware.mockingboard.PSG;
|
||||||
import jace.hardware.mockingboard.R6522;
|
import jace.hardware.mockingboard.R6522;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.locks.Condition;
|
import java.util.concurrent.locks.Condition;
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javafx.application.Platform;
|
|
||||||
import javax.sound.sampled.LineUnavailableException;
|
import javax.sound.sampled.LineUnavailableException;
|
||||||
import javax.sound.sampled.SourceDataLine;
|
import javax.sound.sampled.SourceDataLine;
|
||||||
|
|
||||||
@ -70,12 +68,12 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
@ConfigurableField(name = "Buffer size",
|
@ConfigurableField(name = "Buffer size",
|
||||||
category = "Sound",
|
category = "Sound",
|
||||||
description = "Number of samples to generate on each pass")
|
description = "Number of samples to generate on each pass")
|
||||||
public int BUFFER_LENGTH = 64;
|
public int BUFFER_LENGTH = 2;
|
||||||
// The array of configured AY chips
|
// The array of configured AY chips
|
||||||
public PSG[] chips;
|
public PSG[] chips;
|
||||||
// The 6522 controllr chips (always 2)
|
// The 6522 controllr chips (always 2)
|
||||||
public R6522[] controllers;
|
public R6522[] controllers;
|
||||||
private int ticksBeteenPlayback = 5000;
|
static private int ticksBeteenPlayback = 200;
|
||||||
Lock timerSync = new ReentrantLock();
|
Lock timerSync = new ReentrantLock();
|
||||||
Condition cpuCountReached = timerSync.newCondition();
|
Condition cpuCountReached = timerSync.newCondition();
|
||||||
Condition playbackFinished = timerSync.newCondition();
|
Condition playbackFinished = timerSync.newCondition();
|
||||||
@ -138,13 +136,7 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
// Reset PSG registers
|
|
||||||
suspend();
|
suspend();
|
||||||
if (chips != null) {
|
|
||||||
for (PSG psg : chips) {
|
|
||||||
psg.reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RAMListener mainListener = null;
|
RAMListener mainListener = null;
|
||||||
|
|
||||||
@ -291,6 +283,12 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
controller.suspend();
|
controller.suspend();
|
||||||
controller.detach();
|
controller.detach();
|
||||||
}
|
}
|
||||||
|
// Reset PSG registers
|
||||||
|
if (chips != null) {
|
||||||
|
for (PSG psg : chips) {
|
||||||
|
psg.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (playbackThread == null || !playbackThread.isAlive()) {
|
if (playbackThread == null || !playbackThread.isAlive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user