mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
less CPU demanding InputStrobing
This commit is contained in:
@@ -964,8 +964,10 @@ input.withEvent = function(callback) {
|
||||
inputwork.stroboStatus = 0;
|
||||
inputwork.repeatCount = 0;
|
||||
|
||||
if (keys[0] == 0)
|
||||
if (keys[0] == 0) {
|
||||
inputwork.keyChanged = false;
|
||||
sys.sleep(25)
|
||||
}
|
||||
|
||||
if (keyChanged) {
|
||||
//callback(["key_change", keysToStr(arrayDiff(keys, inputwork.oldKeys)), inputwork.repeatCount].concat(keys));
|
||||
@@ -977,7 +979,7 @@ input.withEvent = function(callback) {
|
||||
}
|
||||
}
|
||||
else if (inputwork.stroboStatus % 2 == 1 && sys.nanoTime() - inputwork.stroboTime < inputwork.stroboDelays[inputwork.stroboStatus]) {
|
||||
sys.spin();
|
||||
sys.sleep(25);
|
||||
}
|
||||
else {
|
||||
inputwork.stroboStatus += 1;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
println("DEPRECATION NOTICE: MP3 Playback function will be removed for following reason")
|
||||
println("\tMP3 does not really fit in the time TSVM targets to emulate")
|
||||
return 1
|
||||
|
||||
|
||||
const Mp3 = require('mp3dec')
|
||||
const pcm = require("pcm")
|
||||
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "/i"
|
||||
@@ -114,7 +119,6 @@ let readPtr = sys.malloc(8000)
|
||||
let decodePtr = sys.malloc(12000)
|
||||
|
||||
function bytesToSec(i) {
|
||||
// using fixed value: FRAME_SIZE(216) bytes for 36 ms on sampling rate 32000 Hz
|
||||
return i / (FRAME_SIZE * 1000 / bufRealTimeLen)
|
||||
}
|
||||
function secToReadable(n) {
|
||||
|
||||
Reference in New Issue
Block a user