MIDI support in simulator (#1332)
* gluing to support MIDI devices in the simulator * sim support for midi * simplify interface * ensure helper function does not show up in TS * bump pxt
This commit is contained in:
parent
710abd50cb
commit
1a9235e333
@ -302,4 +302,13 @@ namespace control {
|
||||
int deviceSerialNumber() {
|
||||
return microbit_serial_number();
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs simulator/runtime of a MIDI message
|
||||
* Internal function to support the simulator.
|
||||
*/
|
||||
//% part=midioutput block
|
||||
void __midiSend(Buffer buffer) {
|
||||
// this is a stub to support the simulator
|
||||
}
|
||||
}
|
||||
|
7
libs/core/shims.d.ts
vendored
7
libs/core/shims.d.ts
vendored
@ -431,6 +431,13 @@ declare namespace control {
|
||||
//% blockId="control_device_serial_number" block="device serial number" weight=9
|
||||
//% advanced=true shim=control::deviceSerialNumber
|
||||
function deviceSerialNumber(): int32;
|
||||
|
||||
/**
|
||||
* Informs simulator/runtime of a MIDI message
|
||||
* Internal function to support the simulator.
|
||||
*/
|
||||
//% part=midioutput block shim=control::__midiSend
|
||||
function __midiSend(buffer: Buffer): void;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,6 +42,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-common-packages": "0.23.57",
|
||||
"pxt-core": "4.1.12"
|
||||
"pxt-core": "4.1.13"
|
||||
}
|
||||
}
|
||||
|
7
sim/state/midi.ts
Normal file
7
sim/state/midi.ts
Normal file
@ -0,0 +1,7 @@
|
||||
namespace pxsim.control {
|
||||
export function __midiSend(data: RefBuffer) {
|
||||
const b = board();
|
||||
pxsim.AudioContextManager.sendMidiMessageAsync(data)
|
||||
.done();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user