Merge pull request #14 from blind/sim

Use keys 1-7 for valve and trills
This commit is contained in:
Mikael Degerfält 2019-06-23 17:07:31 +02:00 committed by GitHub
commit 435ad106d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 36 deletions

View file

@ -1,22 +1,22 @@
## Simulator for NuEVI
# Simulator for NuEVI
This is a simple SDL2 based simulator that runs the NuEVI firmware compiled for MacOS. This is for testing the menu and is not supposed to produce any midi events.
## Requirements
### Requirements
* The Filters library must be installed in ~/Documents/Arduino/libraries/Filters.
* SDL2 must be installed on your machine.
* You probably need to have XCode and XCodes command line tools installed as well.
* The Filters library must be installed in ~/Documents/Arduino/libraries/Filters.
* [SDL2.framework](https://www.libsdl.org/download-2.0.php) must be installed on your machine in /Library/Frameworks/ (or ~/Library/Frameworks/).
* You probably need to have XCode and XCodes command line tools installed as well, but using brew to install make and clang might be enough.
[Dear Imgui](https://github.com/ocornut/imgui) is pulled in as an git submodule. Run `git submodule init` and `git submodule update` to get the code. The code is tested with tag v1.70 of ImGui, so if you run into problems make sure that is the checked out version.
## Know limitations
### Know limitations
Currently only some input is simulated, and the default values are not based on real hardware. There is also a limitation on some keyboards on how many buttons can be pressed at the same time. This means that all menu functions cannot be tested.
Currently the only input simulated are the menu buttons (use the arrow keys). This means that all menu functions cannot be tested, since the rotator menu cannot be opened. There is also a limitation on some keyboard on how many buttons can be pressed at the same time.
## Future plans
### Future plans
* Add a Dear ImGUI based UI for simulating all other inputs.
* Add simulation for all inputs
* Show MIDI status in UI
* Add in-app log window
* Fake real breath input by keypress

View file

@ -289,20 +289,6 @@ static void doGlobalsWindow()
// int vibThrLo;
// int vibZero;
// // Key variables, TRUE (1) for pressed, FALSE (0) for not pressed
// byte K1; // Valve 1 (pitch change -2)
// byte K2; // Valve 2 (pitch change -1)
// byte K3; // Valve 3 (pitch change -3)
// byte K4; // Left Hand index finger (pitch change -5)
// byte K5; // Trill key 1 (pitch change +2)
// byte K6; // Trill key 2 (pitch change +1)
// byte K7; // Trill key 3 (pitch change +4)
// byte halfPitchBendKey;
// byte specialKey;
// byte pinkyKey;
}
ImGui::End();
@ -439,6 +425,14 @@ static void SimLoop(std::function<bool()> continue_predicate, std::function<void
case SDLK_RIGHT: digitalInputs[ePin] = 0; break;
case SDLK_UP: digitalInputs[uPin] = 0; break;
case SDLK_DOWN: digitalInputs[dPin] = 0; break;
case SDLK_1: touchSensor.mockFilteredData(K1Pin, ctouchThrVal -100); break;
case SDLK_2: touchSensor.mockFilteredData(K2Pin, ctouchThrVal -100); break;
case SDLK_3: touchSensor.mockFilteredData(K3Pin, ctouchThrVal -100); break;
case SDLK_4: touchSensor.mockFilteredData(K4Pin, ctouchThrVal -100); break;
case SDLK_5: touchSensor.mockFilteredData(K5Pin, ctouchThrVal -100); break;
case SDLK_6: touchSensor.mockFilteredData(K6Pin, ctouchThrVal -100); break;
case SDLK_7: touchSensor.mockFilteredData(K7Pin, ctouchThrVal -100); break;
}
}
else if(event.type == SDL_KEYUP )
@ -450,6 +444,15 @@ static void SimLoop(std::function<bool()> continue_predicate, std::function<void
case SDLK_UP: digitalInputs[uPin] = 1; break;
case SDLK_DOWN: digitalInputs[dPin] = 1; break;
case SDLK_w: toggleAnalogAnimation(); break;
case SDLK_1: touchSensor.mockFilteredData(K1Pin, ctouchThrVal +100); break;
case SDLK_2: touchSensor.mockFilteredData(K2Pin, ctouchThrVal +100); break;
case SDLK_3: touchSensor.mockFilteredData(K3Pin, ctouchThrVal +100); break;
case SDLK_4: touchSensor.mockFilteredData(K4Pin, ctouchThrVal +100); break;
case SDLK_5: touchSensor.mockFilteredData(K5Pin, ctouchThrVal +100); break;
case SDLK_6: touchSensor.mockFilteredData(K6Pin, ctouchThrVal +100); break;
case SDLK_7: touchSensor.mockFilteredData(K7Pin, ctouchThrVal +100); break;
}
fflush(stdout);
}
@ -503,12 +506,16 @@ static void SimLoop(std::function<bool()> continue_predicate, std::function<void
static int SimRun( )
{
if( 0 != SimInit() ) { return 1; }
// Dummy to always force full reset of EEPROM, to circumvent bug in NuEVI.ino
digitalInputs[mPin] = 0;
digitalInputs[ePin] = 0;
setup();
{
// See comment in SimInit why I do this..
digitalInputs[mPin] = 1;
digitalInputs[ePin] = 1;
}
digitalInputs[mPin] = 1;
digitalInputs[ePin] = 1;
SimLoop( []() -> bool { return true; }, loop );
SimQuit();
return 0;
@ -568,11 +575,6 @@ static int SimInit()
touchSensor.mockFilteredData(i, 4095);
}
// Dummy to always force full reset of EEPROM, to circumvent bug in NuEVI.ino
digitalInputs[mPin] = 0;
digitalInputs[ePin] = 0;
return result;
}