Issue #24: Mute prevents any sound mixer from being created; error in sound init fixed; fixed incorrect assumption in CPU addition test

This commit is contained in:
Brendan Robert 2016-02-14 22:59:40 -06:00
parent 4a371ceec3
commit 609ad08bfd
3 changed files with 15 additions and 1 deletions

View File

@ -61,6 +61,9 @@ public class SoundMixer extends Device {
*/
@ConfigurableField(name = "Playback Rate", shortName = "freq")
public static int RATE = 48000;
@ConfigurableField(name = "Mute", shortName = "mute")
public static boolean MUTE = false;
/**
* Sound format used for playback
*/
@ -104,7 +107,9 @@ public class SoundMixer extends Device {
@Override
public synchronized void reconfigure() {
if (isConfigDifferent()) {
if (MUTE) {
detach();
} else if (isConfigDifferent()) {
detach();
try {
initMixer();

View File

@ -285,6 +285,10 @@ public class Utility {
public static void setHeadlessMode(boolean headless) {
isHeadless = headless;
}
public static boolean isHeadlessMode() {
return isHeadless;
}
public static Optional<Image> loadIcon(String filename) {
if (isHeadless) {

View File

@ -20,6 +20,7 @@ import jace.apple2e.Apple2e;
import jace.apple2e.MOS65C02;
import jace.core.Computer;
import jace.core.RAM;
import jace.core.SoundMixer;
import jace.core.Utility;
import jace.ide.HeadlessProgram;
import jace.ide.Program;
@ -45,10 +46,12 @@ public class Basic6502FuncationalityTest {
@BeforeClass
public static void setupClass() {
Utility.setHeadlessMode(true);
SoundMixer.MUTE = true;
computer = new Apple2e();
cpu = (MOS65C02) computer.getCpu();
ram = computer.getMemory();
Emulator.computer = (Apple2e) computer;
computer.pause();
}
@AfterClass
@ -57,6 +60,7 @@ public class Basic6502FuncationalityTest {
@Before
public void setup() {
cpu.suspend();
for (int i = 0; i < 1024; i++) {
ram.write(i, (byte) 0, false, false);
}
@ -74,6 +78,7 @@ public class Basic6502FuncationalityTest {
public void testAdditionNonDecimal() {
cpu.A = 0;
cpu.D = false;
cpu.C = 0;
assemble(" adc #1");
assertEquals("Nothing should change yet", 0, cpu.A);
cpu.tick();