-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use program change instead of control change for sketch switch (#8
- Loading branch information
Showing
18 changed files
with
98 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
export const configFileName = "8tlr-router.config.yaml"; | ||
|
||
export const sketchSwitchControlChangeNumber = 119; | ||
|
||
export const frontendUpdateInterval = 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
import type { MidiMessage } from "@julusian/midi"; | ||
|
||
import { isSketchSwitch } from "./isSketchSwitch"; | ||
import { isNoteOn } from "./isNoteOn"; | ||
import { isNoteOff } from "./isNoteOff"; | ||
import { isControlChange } from "./isControlChange"; | ||
import { isAfterTouch } from "./isAfterTouch"; | ||
import { isControlChange } from "./isControlChange"; | ||
import { isNoteOff } from "./isNoteOff"; | ||
import { isNoteOn } from "./isNoteOn"; | ||
import { isPitchBend } from "./isPitchBend"; | ||
import { isProgramChange } from "./isProgramChange"; | ||
|
||
export function getMidiMessageType(midiMessage: MidiMessage): MidiMessageType | null { | ||
if (isSketchSwitch(midiMessage)) { | ||
return "sketch"; | ||
if (isAfterTouch(midiMessage)) { | ||
return "at"; | ||
} | ||
if (isNoteOn(midiMessage)) { | ||
return "note-on"; | ||
if (isControlChange(midiMessage)) { | ||
return "cc"; | ||
} | ||
if (isNoteOff(midiMessage)) { | ||
return "note-off"; | ||
} | ||
if (isControlChange(midiMessage)) { | ||
return "cc"; | ||
} | ||
if (isAfterTouch(midiMessage)) { | ||
return "at"; | ||
if (isNoteOn(midiMessage)) { | ||
return "note-on"; | ||
} | ||
if (isPitchBend(midiMessage)) { | ||
return "sketch"; | ||
return "pb"; | ||
} | ||
if (isProgramChange(midiMessage)) { | ||
return "pgm"; | ||
} | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
import type { MidiMessage } from "@julusian/midi"; | ||
|
||
import { isSketchSwitch } from "./isSketchSwitch"; | ||
import { isNoteOn } from "./isNoteOn"; | ||
import { isNoteOff } from "./isNoteOff"; | ||
import { isControlChange } from "./isControlChange"; | ||
import { isAfterTouch } from "./isAfterTouch"; | ||
import { isControlChange } from "./isControlChange"; | ||
import { isNoteOff } from "./isNoteOff"; | ||
import { isNoteOn } from "./isNoteOn"; | ||
import { isPitchBend } from "./isPitchBend"; | ||
import { isProgramChange } from "./isProgramChange"; | ||
|
||
export function getMidiMessageTypeName(midiMessage: MidiMessage, verbose = false) { | ||
if (isSketchSwitch(midiMessage)) { | ||
return verbose ? "sketch switch" : "SK"; | ||
if (isAfterTouch(midiMessage)) { | ||
return verbose ? "aftertouch" : "AT"; | ||
} | ||
if (isNoteOn(midiMessage)) { | ||
return verbose ? "note on" : "NO"; | ||
if (isControlChange(midiMessage)) { | ||
return verbose ? "control change" : "CC"; | ||
} | ||
if (isNoteOff(midiMessage)) { | ||
return verbose ? "note off" : "NF"; | ||
} | ||
if (isControlChange(midiMessage)) { | ||
return verbose ? "control change" : "CC"; | ||
} | ||
if (isAfterTouch(midiMessage)) { | ||
return verbose ? "aftertouch" : "AT"; | ||
if (isNoteOn(midiMessage)) { | ||
return verbose ? "note on" : "NO"; | ||
} | ||
if (isPitchBend(midiMessage)) { | ||
return verbose ? "pitch bend" : "PB"; | ||
} | ||
if (isProgramChange(midiMessage)) { | ||
return verbose ? "program change" : "PG"; | ||
} | ||
return null; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import type { MidiMessage } from "@julusian/midi"; | ||
import { sketchSwitchControlChangeNumber } from "../constants"; | ||
|
||
export function isControlChange(message: MidiMessage) { | ||
const [statusByte, controlNumber] = message; | ||
return (statusByte & 0xf0) === 0xb0 && controlNumber !== sketchSwitchControlChangeNumber; | ||
const [statusByte] = message; | ||
return (statusByte & 0xf0) === 0xb0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { MidiMessage } from "@julusian/midi"; | ||
|
||
export function isProgramChange(message: MidiMessage) { | ||
const [statusByte] = message; | ||
return (statusByte & 0xf0) === 0xc0; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.