Skip to content

Commit 557e996

Browse files
committed
2.3.6: minor updates
1 parent 449abda commit 557e996

24 files changed

+467
-145
lines changed

devel/mk_dist.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ cat sim_core/sim_cfg.js \
109109
sim_core/sim_api_native.js \
110110
sim_core/sim_api_stateshots.js \
111111
sim_core/sim_core_voice.js \
112+
sim_core/sim_core_sound.js \
112113
sim_core/sim_core_rest.js \
113114
sim_core/sim_core_notify.js \
114115
sim_core/sim_core_values.js \
@@ -135,6 +136,7 @@ cat sim_core/sim_cfg.js \
135136
sim_hw/hw_items/io_keyboard_base.js \
136137
sim_hw/hw_items/io_ldm_base.js \
137138
sim_hw/hw_items/io_l3d_base.js \
139+
sim_hw/hw_items/io_sound_base.js \
138140
\
139141
sim_hw/hw_ep.js \
140142
sim_hw/hw_poc.js \

sim_core/sim_core_sound.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2015-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
3+
*
4+
* This file is part of WepSIM.
5+
*
6+
* WepSIM is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* WepSIM is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with WepSIM. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
*/
20+
21+
22+
/*
23+
* Sound (Tune.js)
24+
*/
25+
26+
function simcore_sound_init ( )
27+
{
28+
if (typeof window !== "undefined") {
29+
window.TONE_SILENCE_LOGGING = true;
30+
}
31+
}
32+
33+
function simcore_sound_canPlay ( )
34+
{
35+
if (typeof Tone.context == "undefined") {
36+
return false ;
37+
}
38+
39+
return true ;
40+
}
41+
42+
async function simcore_sound_playNote ( note_str, time_str )
43+
{
44+
if (simcore_sound_canPlay() == false) {
45+
return ;
46+
}
47+
48+
await Tone.start();
49+
if (Tone.context.state !== 'running') {
50+
Tone.context.resume() ;
51+
}
52+
53+
synth1 = new Tone.Synth().toDestination() ;
54+
synth1.triggerAttackRelease(note_str, time_str) ;
55+
}
56+

sim_hw/hw_ep.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
io_clk_base_register ( ep_def ) ;
5151
io_l3d_base_register ( ep_def ) ;
5252
io_ldm_base_register ( ep_def ) ;
53+
io_sound_base_register ( ep_def ) ;
5354

5455
simhw_add(ep_def) ;
5556

sim_hw/hw_items/cpu_ep.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,12 +937,12 @@ function cpu_ep_register ( sim_p )
937937

938938
/* I/O Devices */
939939
sim_p.signals["IOR"] = { name: "IOR", visible: true, type: "L", value: 0, default_value:0, nbits: "1",
940-
behavior: ["NOP", "MOVE_BITS KBD_IOR 0 1 IOR; MOVE_BITS SCR_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE KBD_IOR; FIRE SCR_IOR; FIRE L3D_IOR; FIRE LEDM_IOR"],
940+
behavior: ["NOP", "MOVE_BITS KBD_IOR 0 1 IOR; MOVE_BITS SCR_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE KBD_IOR; FIRE SCR_IOR; FIRE L3D_IOR; FIRE LEDM_IOR; MOVE_BITS SND_IOR 0 1 IOR; FIRE SND_IOR"],
941941
fire_name: ['svg_p:text3715'],
942942
draw_data: [[], ['svg_p:path3733', 'svg_p:path3491', 'svg_p:text3715']],
943943
draw_name: [[], []]};
944944
sim_p.signals["IOW"] = { name: "IOW", visible: true, type: "L", value: 0, default_value:0, nbits: "1",
945-
behavior: ["NOP", "MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW; MOVE_BITS LEDM_IOW 0 1 IOW; FIRE LEDM_IOW"],
945+
behavior: ["NOP", "MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW; MOVE_BITS LEDM_IOW 0 1 IOW; FIRE LEDM_IOW; MOVE_BITS SND_IOW 0 1 IOW; FIRE SND_IOW"],
946946
fire_name: ['svg_p:text3717'],
947947
draw_data: [[], ['svg_p:path3735', 'svg_p:path3491', 'svg_p:text3717']],
948948
draw_name: [[], []]};

sim_hw/hw_items/cpu_poc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,12 +668,12 @@ function cpu_poc_register ( sim_p )
668668
draw_data: [[]],
669669
draw_name: [[]] };
670670
sim_p.signals["IOR"] = { name: "IOR", visible: true, type: "L", value: 0, default_value:0, nbits: "1",
671-
behavior: ["NOP", "MOVE_BITS SCR_IOR 0 1 IOR; FIRE SCR_IOR; MOVE_BITS IO_IOR 0 1 IOR; FIRE IO_IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE L3D_IOR; MOVE_BITS KBD_IOR 0 1 IOR; FIRE KBD_IOR; MOVE_BITS LEDM_IOR 0 1 IOR; FIRE LEDM_IOR"],
671+
behavior: ["NOP", "MOVE_BITS SCR_IOR 0 1 IOR; FIRE SCR_IOR; MOVE_BITS IO_IOR 0 1 IOR; FIRE IO_IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE L3D_IOR; MOVE_BITS KBD_IOR 0 1 IOR; FIRE KBD_IOR; MOVE_BITS LEDM_IOR 0 1 IOR; FIRE LEDM_IOR; MOVE_BITS SND_IOR 0 1 IOR; FIRE SND_IOR"],
672672
fire_name: [],
673673
draw_data: [[], ['svg_p:path3733', 'svg_p:path3491', 'svg_p:text3715']],
674674
draw_name: [[], []]};
675675
sim_p.signals["IOW"] = { name: "IOW", visible: true, type: "L", value: 0, default_value:0, nbits: "1",
676-
behavior: ["NOP", "MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW; MOVE_BITS LEDM_IOW 0 1 IOW; FIRE LEDM_IOW"],
676+
behavior: ["NOP", "MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW; MOVE_BITS LEDM_IOW 0 1 IOW; FIRE LEDM_IOW; MOVE_BITS SND_IOW 0 1 IOW; FIRE SND_IOW"],
677677
fire_name: [],
678678
draw_data: [[], ['svg_p:path3735', 'svg_p:path3491', 'svg_p:text3717']],
679679
draw_name: [[], []]};

0 commit comments

Comments
 (0)