This file contains hidden or 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
| ############################################### | |
| # Programa de exemplo para Syscall MIDI # | |
| # Implementação assíncrona (non-blocking) # | |
| # ISC Oct 2020 # | |
| # Davi Jesus de Almeida Paturi # | |
| ############################################### | |
| .data | |
| LAST_DURATION: .word 0 # duracao da ultima nota | |
| LAST_PLAYED: .word 0 # quando a ultima nota foi tocada |
This file contains hidden or 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
| (async () => { | |
| const noteTable = { | |
| '1': 72, | |
| '#1': 73, | |
| '1s': 73, | |
| '1f': 73, | |
| 'b1': 73, | |
| 'b2': 73, | |
| '2': 74, | |
| '#2': 75, |
This file contains hidden or 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
| /* | |
| * Compara dois naipes: | |
| * se o naipeA for maior que o naipeB, irá retornar um valor positivo | |
| * se o naipeA for menor que o naipeB, irá retornar um valor negativo | |
| * se o naipeA for igual ao naipeB, irá retornar 0 | |
| */ | |
| const compararNaipe = (naipeA, naipeB) => { | |
| const ordemNaipes = [ '♣', '♦', '♥', '♠' ] | |
| return ordemNaipes.indexOf(naipeA) - ordemNaipes.indexOf(naipeB) | |
| } |