@marmooo/midi-player 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  - [Basic usage](https://marmooo.github.io/midi-player/)
9
9
  - [Humidy](https://marmooo.github.io/humidy/) - GM2 MIDI mixer app
10
+ - [Timidy](https://marmooo.github.io/timidy/) - Timidity++ style MIDI player
10
11
 
11
12
  ## Usage
12
13
 
@@ -32,8 +33,9 @@
32
33
  // import { MidyGM2 as Midy } from "midy/dist/midy-GM2.min.js";
33
34
  import { Midy } from "midy/dist/midy.min.js";
34
35
 
35
- const midy = new Midy(new AudioContext());
36
- await midy.audioContext.suspend();
36
+ const audioContext = new AudioContext();
37
+ if (audioContext.state === "running") await audioContext.suspend();
38
+ const midy = new Midy(audioContext);
37
39
  ```
38
40
 
39
41
  3. Add Player.
@@ -297,7 +297,7 @@ export class MIDIPlayer {
297
297
  volume() {
298
298
  const muteOn = this.button("mute ON", "midi-player-muteOn", "volume_down", "initial");
299
299
  const muteOff = this.button("mute OFF", "midi-player-muteOff", "volume_off", "none");
300
- const volumeBar = this.formRange("volume", "midi-player-volume", 1, "none");
300
+ const volumeBar = this.formRange("volume", "midi-player-volume", 100 / 128, "none");
301
301
  muteOn.onclick = () => {
302
302
  muteOn.style.display = "none";
303
303
  muteOff.style.display = "initial";
@@ -306,7 +306,7 @@ export class MIDIPlayer {
306
306
  muteOff.onclick = () => {
307
307
  muteOn.style.display = "initial";
308
308
  muteOff.style.display = "none";
309
- this.midy.setMasterVolume(1);
309
+ this.midy.setMasterVolume(Number(volumeBar.value));
310
310
  };
311
311
  volumeBar.oninput = (event) => {
312
312
  this.midy.setMasterVolume(event.target.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marmooo/midi-player",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "<midi-player> HTML elements powered by Midy.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -300,7 +300,7 @@ class MIDIPlayer {
300
300
  volume() {
301
301
  const muteOn = this.button("mute ON", "midi-player-muteOn", "volume_down", "initial");
302
302
  const muteOff = this.button("mute OFF", "midi-player-muteOff", "volume_off", "none");
303
- const volumeBar = this.formRange("volume", "midi-player-volume", 1, "none");
303
+ const volumeBar = this.formRange("volume", "midi-player-volume", 100 / 128, "none");
304
304
  muteOn.onclick = () => {
305
305
  muteOn.style.display = "none";
306
306
  muteOff.style.display = "initial";
@@ -309,7 +309,7 @@ class MIDIPlayer {
309
309
  muteOff.onclick = () => {
310
310
  muteOn.style.display = "initial";
311
311
  muteOff.style.display = "none";
312
- this.midy.setMasterVolume(1);
312
+ this.midy.setMasterVolume(Number(volumeBar.value));
313
313
  };
314
314
  volumeBar.oninput = (event) => {
315
315
  this.midy.setMasterVolume(event.target.value);