update 0.9.0

This commit is contained in:
Rupert Hausberger 2016-08-02 22:03:47 +02:00
commit 470f65cca4
9 changed files with 104 additions and 45 deletions

View file

@ -133,6 +133,7 @@
<td><button onclick="stop()">Stop</button></td>
<td><button onclick="reset()">Reset</button></td>
<td><button onclick="pause(1)" id="controls_pr">Pause</button></td>
<td><button onclick="mute(1)" id="controls_mp">Mute</button></td>
</tr>
</table>
</td>
@ -144,8 +145,12 @@
<!-- Method 1: SAE will create a canvas and add it into the div-element below -->
<div id="myVideo" style="margin:auto"></div>
<!-- Method 2: The canvas is already defined. SAE will output to the element below.
The size of the canvas is set by SAE according your settings -->
The size of the canvas is set by SAE according your settings.
See example2.htm -->
<!--<canvas id="myVideo" style="margin:auto;background-color:#000"></canvas>-->
</td>
</tr>

View file

@ -23,6 +23,7 @@ var inf = null; /* Reference to the info-object */
var running = false; /* Is the emualtion currently running? */
var paused = false; /* Is the emualtion currently paused? */
var muted = false; /* Is the audio-output currently muted? */
/*-----------------------------------------------------------------------*/
/* Helpers */
@ -64,14 +65,27 @@ function switchPauseResume(p) {
}
}
function switchMutePlay(m) {
var e = document.getElementById("controls_mp");
if (m) {
e.innerHTML = "Play";
e.onclick = function() { mute(false); };
} else {
e.innerHTML = "Mute";
e.onclick = function() { mute(true); };
}
}
function saee2text(err) {
switch (err) {
case SAEE_AlreadyRunning: return "The emulator is already running.";
case SAEE_NotRunning: return "The emulator is not running.";
case SAEE_NoTimer: return "No timing-functions avail. Please upgrade your browser.";
case SAEE_NoMemory: return "Out of memory.";
case SAEE_Assert: return "Assertiation failed.";
case SAEE_Internal: return "Internal emulator error.";
case SAEE_Config_Invalid: return "Invalid configuration.";
case SAEE_Config_Compressed: return "A ZIP file was detected. Compressed files are not yet supported.";
case SAEE_CPU_Internal: return "Internal CPU-error.";
case SAEE_CPU_Requires68020: return "The selected kickstart-rom does require a 68020 and 32bit address-space";
case SAEE_CPU_Requires680EC20: return "The selected kickstart-rom does require a 68020.";
@ -327,6 +341,18 @@ function pause(p) {
alert(saee2text(err));
}
function mute(m) {
/* Mute or play audio.
true == mute, false == play */
var err = sae.mute(m);
if (err == SAEE_None) {
muted = m;
switchMutePlay(muted);
/* ... */
} else
alert(saee2text(err));
}
function romSelect() {
var e = document.getElementById("cfg_rom_file").files[0];
if (e) {
@ -441,6 +467,10 @@ function hook_event_stopped() {
paused = false;
switchPauseResume(paused);
}
if (muted) {
muted = false;
switchMutePlay(muted);
}
resetLEDs();
}
@ -450,6 +480,10 @@ function hook_event_reseted(hard) {
paused = false;
switchPauseResume(paused);
}
if (muted) {
muted = false;
switchMutePlay(muted);
}
}
/* Get call after the emulator has finished switching between pause-resume. */

View file

@ -133,6 +133,7 @@
<td><button onclick="stop()">Stop</button></td>
<td><button onclick="reset()">Reset</button></td>
<td><button onclick="pause(1)" id="controls_pr">Pause</button></td>
<td><button onclick="mute(1)" id="controls_mp">Mute</button></td>
</tr>
</table>
</td>
@ -141,9 +142,13 @@
<tr>
<td class="arm">Output</td>
<td class="alm">
<!-- Method 1: SAE will create a canvas and add it into the div-element below -->
<!-- Method 1: SAE will create a canvas and add it into the div-element below
See example2.htm -->
<!--<div id="myVideo" style="margin:auto"></div>-->
<!-- Method 2: The canvas is already defined. SAE will output to the element below.
The size of the canvas is set by SAE according your settings -->
<canvas id="myVideo" style="margin:auto;background-color:#000"></canvas>

View file

@ -1678,6 +1678,7 @@
<td><button onclick="reset()">Reset</button></td>
<td><button onclick="stop()">Stop</button></td>
<td><button onclick="pause(1)" id="controls_pr">Pause</button></td>
<td><button onclick="mute(1)" id="controls_mp">Mute</button></td>
<td id="controls_disk"><button onclick="dskchgOpen()">Disk</button></td>
<!--<td><button onclick="toggleFullScreen()">FS</button></td>-->
</tr>

View file

@ -199,6 +199,7 @@ var amaxInfo = null; /* amax rom-info */
var floppyNum = -1; /* current floppy-unit if floppy-info is shown */
var mountConfigNum = -1; /* current mount-unit if mount-info is shown */
var paused = false; /* is the emualtion currently paused? */
var muted = false; /* is the audio-output currently muted? */
var dskchg = false; /* disk-change requester in database-mode */
var dskchgList = []; /* list of floppies to change, created dynamicaly */
@ -439,6 +440,17 @@ function switchPauseResume(p) {
}
}
function switchMutePlay(m) {
var e = document.getElementById("controls_mp");
if (m) {
e.innerHTML = "Play";
e.onclick = function() { mute(false); };
} else {
e.innerHTML = "Mute";
e.onclick = function() { mute(true); };
}
}
function switchBaseEmul(emul) {
if (emul) {
document.body.style.backgroundColor = "#000000";
@ -1433,6 +1445,13 @@ function reset() {
sae.reset(false, false);
}
function mute(m) {
sae.mute(m);
muted = m;
switchMutePlay(muted);
}
/*---------------------------------*/
function init() {
@ -2468,6 +2487,10 @@ function hook_event_stopped() {
paused = false;
switchPauseResume(paused);
}
if (muted) {
muted = false;
switchMutePlay(muted);
}
if (dskchg)
dskchgClose();
@ -2482,6 +2505,10 @@ function hook_event_reseted(hard) {
paused = false;
switchPauseResume(paused);
}
if (muted) {
muted = false;
switchMutePlay(muted);
}
if (dskchg)
dskchgClose();
}

View file

@ -586,9 +586,15 @@ function ScriptedAmigaEmulator() {
return SAEE_None;
};
this.mute = function(mute) {
this.audio.mute(mute);
return SAEE_None;
};
this.keyPress = function(e, down) {
this.input.keyPress(e, down);
}
return SAEE_None;
};
/*---------------------------------*/

View file

@ -54,6 +54,7 @@ function SAEO_Audio() {
const SOUND_SYNC_MULTIPLIER = 1.0;
var scaled_sample_evtime_orig = 0.0;
var muted = false;
var paused = false;
var have_sound = false;
var sound_available = false;
@ -213,6 +214,14 @@ function SAEO_Audio() {
const INV32768 = 1.0 / 32768; /* mul is always fasten than div */
function scaleplay(e, buffer, frames) {
if (muted) {
for (var ch = 0; ch < SAEV_config.audio.channels; ch++) {
var data = e.outputBuffer.getChannelData(ch);
for (var i = 0; i < e.outputBuffer.length; i++)
data[i] = 0.0;
}
return;
}
/*if (driver.context.sampleRate != used_freq) {
} else*/ {
var step = frames / e.outputBuffer.length;
@ -372,6 +381,8 @@ function SAEO_Audio() {
}
function reset_sound() { //reset_sound()
muted = paused = false;
cache.readoffset = 0;
cache.writeoffset = 0;
cache.wait = true;
@ -379,6 +390,10 @@ function SAEO_Audio() {
paula.average.clr();
}
function mute_sound(mute) { //OWN
muted = mute;
}
/*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
@ -1457,11 +1472,9 @@ function SAEO_Audio() {
}
this.reset = function() {
var i;
reset_sound();
for (i = 0; i < sound_filter_state.length; i++)
for (var i = 0; i < sound_filter_state.length; i++)
sound_filter_state[i].clr();
for (i = 0; i < AUDIO_CHANNELS_MAX; i++) {
@ -1487,6 +1500,10 @@ function SAEO_Audio() {
resume_sound();
}
this.mute = function(mute) {
mute_sound(mute)
}
/*-----------------------------------------------------------------------*/
var prevcon = -1;

View file

@ -10229,39 +10229,3 @@ function SAEO_CPU() {
return true;
}
}

View file

@ -497,7 +497,7 @@ function SAEF_ZFile_fopen_file(file) {
//SAEF_log("SAEF_ZFile_fopen_file() opening '%s', %d/%d bytes, crc32 0x%08x, magic %08x", l.name, l.size, l.data.length, file.crc32 !== false ? file.crc32 : 0, magic);
if (magic == 0x04034B50 || magic == 0x504B0304)
if (magic == 0x504B0304 || magic == 0x04034B50)
SAEF_fatal(SAEE_Config_Compressed, "A ZIP file was detected. Compressed files are not yet supported.");
//if (l.data[0] == 68 && l.data[1] == 77 && l.data[2] == 83 && l.data[3] == 33) { /* DMS! */