Web: add panning, move mixing to wasm
This commit is contained in:
@@ -285,6 +285,7 @@ class Sim extends HTMLElement {
|
||||
#core; // Core proxy
|
||||
#emulating; // Current emulation status
|
||||
#keys; // Controller state
|
||||
#panning; // Audio stereo balance
|
||||
#peer; // Communication peer
|
||||
#pointer; // Pointer in core memory
|
||||
#volume; // Audio output volume
|
||||
@@ -313,9 +314,10 @@ class Sim extends HTMLElement {
|
||||
this.#core = core;
|
||||
this.#emulating = false;
|
||||
this.#keys = Constants.VB.SGN;
|
||||
this.#panning = 0.0;
|
||||
this.#peer = null;
|
||||
this.#pointer = pointer;
|
||||
this.#volume = 1;
|
||||
this.#volume = 1.0;
|
||||
delete this.proxy;
|
||||
|
||||
// Create a <canvas> for the video image
|
||||
@@ -358,10 +360,11 @@ class Sim extends HTMLElement {
|
||||
/////////////////////////// Property Accessors ////////////////////////////
|
||||
|
||||
get anaglyph() { return this.#anaglyph.slice(); }
|
||||
get core () { return this.#core.core; }
|
||||
get keys () { return this.#keys; }
|
||||
get peer () { return this.#peer; }
|
||||
get volume () { return this.#volume; }
|
||||
get core () { return this.#core.core ; }
|
||||
get keys () { return this.#keys ; }
|
||||
get panning () { return this.#panning ; }
|
||||
get peer () { return this.#peer ; }
|
||||
get volume () { return this.#volume ; }
|
||||
|
||||
|
||||
|
||||
@@ -479,6 +482,27 @@ class Sim extends HTMLElement {
|
||||
});
|
||||
}
|
||||
|
||||
// Specify audio panning
|
||||
async setPanning(panning) {
|
||||
|
||||
// Error checking
|
||||
if (!Number.isFinite(panning) ||panning < -1 || panning > +1) {
|
||||
throw new RangeError(
|
||||
"Panning must be a number from -1 to +1.");
|
||||
}
|
||||
|
||||
// Configure instance fields
|
||||
this.#panning = panning;
|
||||
|
||||
// Send the panning to the core
|
||||
await this.#core.toCore({
|
||||
command : "setPanning",
|
||||
promised: true,
|
||||
sim : this.#pointer,
|
||||
panning : panning
|
||||
});
|
||||
}
|
||||
|
||||
// Specify a new communication peer
|
||||
async setPeer(peer = null) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user