From 2630dff5acd7eb700d5422be889060c1b338d08d Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Mon, 28 Nov 2022 02:12:25 +0100 Subject: [PATCH] Sending proper Program Change MIDI message --- CHANGELOG.md | 3 + instruments.mq | 256 ++++++++++++++++++++-------------------- musique/midi/rt_midi.cc | 2 +- 3 files changed, 132 insertions(+), 129 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e971d6a..c89cd75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.1] + ### Fixed - release build script was producing executable with wrong path - `examples/for-elise.mq` had bug in it - in error reporting printing garbage instead of function name was fixed +- sending proper program change message ## [0.3.0] diff --git a/instruments.mq b/instruments.mq index 07b079c..2be56da 100644 --- a/instruments.mq +++ b/instruments.mq @@ -4,161 +4,161 @@ This may be unsupported by your device. --------------------------------------------------------- -- Piano ------------------------------------------------ -AcousticGrandPiano := 0; -BrightAcousticPiano := 1; -ElectricGrandPiano := 2; -HonkyTonkPiano := 3; -RhodesPiano := 4; -ChorusedPiano := 5; -Harpsichord := 6; -Clavinet := 7; +AcousticGrandPiano := 0, +BrightAcousticPiano := 1, +ElectricGrandPiano := 2, +HonkyTonkPiano := 3, +RhodesPiano := 4, +ChorusedPiano := 5, +Harpsichord := 6, +Clavinet := 7, -- Chromatic percussion --------------------------------- -Celesta := 8; -Glockenspiel := 9; -MusicBox := 10; -Vibraphone := 11; -Marimba := 12; -Xylophone := 13; -TubularBells := 14; -Dulcimer := 15; +Celesta := 8, +Glockenspiel := 9, +MusicBox := 10, +Vibraphone := 11, +Marimba := 12, +Xylophone := 13, +TubularBells := 14, +Dulcimer := 15, -- Organ ------------------------------------------------ -HammondOrgan := 16; -PercussiveOrgan := 17; -RockOrgan := 18; -ChurchOrgan := 19; -ReedOrgan := 20; -Accordion := 21; -Harmonica := 22; -TangoAccordion := 23; +HammondOrgan := 16, +PercussiveOrgan := 17, +RockOrgan := 18, +ChurchOrgan := 19, +ReedOrgan := 20, +Accordion := 21, +Harmonica := 22, +TangoAccordion := 23, -- Guitar ----------------------------------------------- -AcousticGuitarNylon := 24; -AcousticGuitarSteel := 25; -ElectricGuitarJazz := 26; -ElectricGuitarClean := 27; -ElectricGuitarMuted := 28; -OverdrivenGuitar := 29; -DistortionGuitar := 30; -GuitarHarmonics := 31; +AcousticGuitarNylon := 24, +AcousticGuitarSteel := 25, +ElectricGuitarJazz := 26, +ElectricGuitarClean := 27, +ElectricGuitarMuted := 28, +OverdrivenGuitar := 29, +DistortionGuitar := 30, +GuitarHarmonics := 31, -- Bass ------------------------------------------------- -AcousticBass := 32; -ElectricBassFingered := 33; -ElectricBassPicked := 34; -FretlessBass := 35; -SlapBass1 := 36; -SlapBass2 := 37; -SynthBass1 := 38; -SynthBass2 := 39; +AcousticBass := 32, +ElectricBassFingered := 33, +ElectricBassPicked := 34, +FretlessBass := 35, +SlapBass1 := 36, +SlapBass2 := 37, +SynthBass1 := 38, +SynthBass2 := 39, -- Solo strings ----------------------------------------- -Violin := 40; -Viola := 41; -Cello := 42; -Contrabass := 43; -TremoloStrings := 44; -PizzicatoStrings := 45; -OrchestralHarp := 46; -Timpani := 47; +Violin := 40, +Viola := 41, +Cello := 42, +Contrabass := 43, +TremoloStrings := 44, +PizzicatoStrings := 45, +OrchestralHarp := 46, +Timpani := 47, -- Ensamble --------------------------------------------- -StringEnsemble1 := 48; -StringEnsemble2 := 49; -SynthStrings1 := 50; -SynthStrings2 := 51; -ChoirAahs := 52; -VoiceOohs := 53; -SynthVoice := 54; -OrchestraHit := 55; +StringEnsemble1 := 48, +StringEnsemble2 := 49, +SynthStrings1 := 50, +SynthStrings2 := 51, +ChoirAahs := 52, +VoiceOohs := 53, +SynthVoice := 54, +OrchestraHit := 55, -- Brass ------------------------------------------------ -Trumpet := 56; -Trombone := 57; -Tuba := 58; -MutedTrumpet := 59; -FrenchHorn := 60; -BrassSection := 61; -SynthBrass1 := 62; -SynthBrass2 := 63; +Trumpet := 56, +Trombone := 57, +Tuba := 58, +MutedTrumpet := 59, +FrenchHorn := 60, +BrassSection := 61, +SynthBrass1 := 62, +SynthBrass2 := 63, -- Reed ------------------------------------------------- -SopranoSax := 64; -AltoSax := 65; -TenorSax := 66; -BaritoneSax := 67; -Oboe := 68; -EnglishHorn := 69; -Bassoon := 70; -Clarinet := 71; +SopranoSax := 64, +AltoSax := 65, +TenorSax := 66, +BaritoneSax := 67, +Oboe := 68, +EnglishHorn := 69, +Bassoon := 70, +Clarinet := 71, -- Pipe ------------------------------------------------- -Piccolo := 72; -Flute := 73; -Recorder := 74; -PanFlute := 75; -BlownBottle := 76; -Shakuhachi := 77; -Whistle := 78; -Ocarina := 79; +Piccolo := 72, +Flute := 73, +Recorder := 74, +PanFlute := 75, +BlownBottle := 76, +Shakuhachi := 77, +Whistle := 78, +Ocarina := 79, -- Synth lead ------------------------------------------- -Lead1Square := 80; -Lead2Sawtooth := 81; -Lead3Calliope := 82; -Lead4Chiff := 83; -Lead5Charang := 84; -Lead6Voice := 85; -Lead7Fifths := 86; -Lead8BassLead := 87; +Lead1Square := 80, +Lead2Sawtooth := 81, +Lead3Calliope := 82, +Lead4Chiff := 83, +Lead5Charang := 84, +Lead6Voice := 85, +Lead7Fifths := 86, +Lead8BassLead := 87, -- Synth pad -------------------------------------------- -Pad1NewAge := 88; -Pad2Warm := 89; -Pad3Polysynth := 90; -Pad4Choir := 91; -Pad5Bowed := 92; -Pad6Metallic := 93; -Pad7Halo := 94; -Pad8Sweep := 95; +Pad1NewAge := 88, +Pad2Warm := 89, +Pad3Polysynth := 90, +Pad4Choir := 91, +Pad5Bowed := 92, +Pad6Metallic := 93, +Pad7Halo := 94, +Pad8Sweep := 95, -- Synth effects ---------------------------------------- -FX1Train := 96; -FX2Soundtrack := 97; -FX3Crystal := 98; -FX4Atmosphere := 99; -FX5Brightness := 100; -FX6Goblins := 101; -FX7Echoes := 102; -FX8SciFi := 103; +FX1Train := 96, +FX2Soundtrack := 97, +FX3Crystal := 98, +FX4Atmosphere := 99, +FX5Brightness := 100, +FX6Goblins := 101, +FX7Echoes := 102, +FX8SciFi := 103, -- Ethnic ----------------------------------------------- -Sitar := 104; -Banjo := 105; -Shamisen := 106; -Koto := 107; -Kalimba := 108; -Bagpipe := 109; -Fiddle := 110; -Shanai := 111; +Sitar := 104, +Banjo := 105, +Shamisen := 106, +Koto := 107, +Kalimba := 108, +Bagpipe := 109, +Fiddle := 110, +Shanai := 111, -- Percussive ------------------------------------------- -TinkleBell := 112; -Agogo := 113; -SteelDrums := 114; -Woodblock := 115; -TaikoDrum := 116; -MelodicDrum := 117; -SynthDrum := 118; -ReverseCymbal := 119; +TinkleBell := 112, +Agogo := 113, +SteelDrums := 114, +Woodblock := 115, +TaikoDrum := 116, +MelodicDrum := 117, +SynthDrum := 118, +ReverseCymbal := 119, -- Sound effects ---------------------------------------- -GuitarFretNoise := 120; -BreathNoise := 121; -Seashore := 122; -BirdTweet := 123; -TelephoneRing := 124; -Helicopter := 125; -Applause := 126; -Gunshot := 127; +GuitarFretNoise := 120, +BreathNoise := 121, +Seashore := 122, +BirdTweet := 123, +TelephoneRing := 124, +Helicopter := 125, +Applause := 126, +Gunshot := 127, diff --git a/musique/midi/rt_midi.cc b/musique/midi/rt_midi.cc index 0e21ae6..c95f8dd 100644 --- a/musique/midi/rt_midi.cc +++ b/musique/midi/rt_midi.cc @@ -107,7 +107,7 @@ void midi::Rt_Midi::send_note_off(uint8_t channel, uint8_t note_number, uint8_t void midi::Rt_Midi::send_program_change(uint8_t channel, uint8_t program) { - send_message(*output, std::array { std::uint8_t(channel), program }); + send_message(*output, std::array { std::uint8_t(Program_Change + channel), program }); } void midi::Rt_Midi::send_controller_change(uint8_t channel, uint8_t controller_number, uint8_t value)