BaseMachine UI Controllerに分離
Dependencies: AverageAnalogIn PinDetect RotaryEncoder Sequence SequencerDisplay mbed-rtos mbed st7567LCD BaseMachineComon
Fork of BaseMachine_Sequencer by
Diff: main.cpp
- Revision:
- 24:040cdcb2ff14
- Parent:
- 23:5fe70293e34c
- Child:
- 25:7382bc0a0329
--- a/main.cpp Tue Aug 23 12:14:34 2016 +0000 +++ b/main.cpp Tue Aug 23 13:41:27 2016 +0000 @@ -180,7 +180,7 @@ filterController.setCutoff(AinCutOff.read_u16() >> 8); filterController.setResonance(AinResonance.read_u16() >> 8); - //envMod = AinEnvMod.read_u16() >> 8; + //envMod = AinEnvMod.read_u16() >> 8; //envelope.setLevel(AinLevel.read_u16() >> 4); envelope.setLevel(4095); @@ -302,40 +302,29 @@ gLCD.clear(); - sprintf(buff, "Run: %d", isRunning); + sprintf(buff, "Run:%d BPM:%03d", isRunning, sequenceSender.getBpm()); gLCD.drawstring(0, col++, buff); - sprintf(buff, "BPM: %d", sequenceSender.getBpm()); + + sprintf(buff, "Stp:%02d Nto:%d Pch:%02d", + currentStep, sequences[currentStep].isNoteOn(), sequences[currentStep].getPitch()); + gLCD.drawstring(0, col++, buff); + + sprintf(buff, "Oct:%-2d Tie:%d Acc:%d", + sequences[currentStep].getOctave(), sequences[currentStep].isTie(),sequences[currentStep].isAccent()); gLCD.drawstring(0, col++, buff); - sprintf(buff, "Step: %d", currentStep); - gLCD.drawstring(0, col++, buff); - sprintf(buff, "NoteOn: %d", sequences[currentStep].isNoteOn()); - gLCD.drawstring(0, col++, buff); - sprintf(buff, "Pitch: %d", sequences[currentStep].getPitch()); - gLCD.drawstring(0, col++, buff); - sprintf(buff, "Octave: %d", sequences[currentStep].getOctave()); - gLCD.drawstring(0, col++, buff); - sprintf(buff, "Tie: %d", sequences[currentStep].isTie()); - gLCD.drawstring(0, col++, buff); - sprintf(buff, "Accent: %d", sequences[currentStep].isAccent()); + sprintf(buff, "Wsp:%d Mdn:%d", sequenceSender.getWaveShape(), modNumber); gLCD.drawstring(0, col++, buff); - col = 0; - sprintf(buff, "WavS: %d", sequenceSender.getWaveShape()); - gLCD.drawstring(64, col++, buff); - sprintf(buff, "ModN: %d", modNumber); - gLCD.drawstring(64, col++, buff); + sprintf(buff, "PW :%4d CO :%4d", sequenceSender.getPulseWidth(), filterController.getCutoff()); + gLCD.drawstring(0, col++, buff); + sprintf(buff, "RSO:%4d ENV:%4d", filterController.getResonance(), envMod); + gLCD.drawstring(0, col++, buff); + sprintf(buff, "LVL:%4d DUR:%4d", envelope.getLevel(), envelope.getDuration()); + gLCD.drawstring(0, col++, buff); + sprintf(buff, "DCY:%4d SUS:%4d", envelope.getDecay(), envelope.getSustain()); + gLCD.drawstring(0, col++, buff); - col = 2; - sprintf(buff, "PW%3d CO%3d", sequenceSender.getPulseWidth(), filterController.getCutoff()); - gLCD.drawstring(60, col++, buff); - sprintf(buff, "RS%3d EV%3d", filterController.getResonance(), envMod); - gLCD.drawstring(60, col++, buff); - sprintf(buff, "LV%3d DR%3d", envelope.getLevel(), envelope.getDuration()); - gLCD.drawstring(60, col++, buff); - sprintf(buff, "DC%3d ST%3d", envelope.getDecay(), envelope.getSustain()); - gLCD.drawstring(60, col++, buff); - gLCD.display(); } @@ -348,11 +337,15 @@ printf("*** BaseMachine Sequencer ***\r\n"); #endif + //-------------------------------------------------------------------- // Setup Devices // spiMaster.format(8, 0); spiMaster.frequency(SPI_RATE); + // Mute output + ampController.outDca(0); + gLCD.begin(0x12); gLCD.clear(); gLCD.drawstring(0, 0, TITLE_STR1); @@ -360,9 +353,6 @@ gLCD.display(); Thread::wait(1000); - dumpToLCD(); - Thread::wait(1000); - RotEncStep.setInterval(100); RotEncPitch.setInterval(100); RotEncBpm.setInterval(100); @@ -399,11 +389,11 @@ PinRunStop.setAssertValue(0); PinRunStop.setSampleFrequency(); + //-------------------------------------------------------------------- // Initialize objects // Sequence::setBaseNoteNumber(baseNoteNumber); - // Initialize sequences for (int i = 0; i < SEQUENCE_N; i++) { Sequence& seq = sequenceSender.getSequences()[i]; seq.setPitch(pitch[i]); @@ -418,12 +408,16 @@ sequenceSender.setWaveShape(waveShape); //sequenceSender.run(0); + //-------------------------------------------------------------------- + // Main loop + // for (;;) { pollingPots(); pollingRotEncs(); pollingPins(); if (!isRunning) { - dumpToLCD(); + sequencerDisplay.update(SequencerDisplay::stop, currentStep); + //dumpToLCD(); } } }