From d40a05871fdbe7bc1b67a034ec178f748590d162 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Sun, 9 Jun 2013 21:03:51 -0700 Subject: [PATCH] Minor tweaks This version was published to Play Store as 0.91. Train patch didn't render right. Should investigate further, but in the meantime swap out one that does. Also narrow filter range, increase touch count to 10, and fix pitch env for L4 != 50 case (take-off patch). --- android/AndroidManifest.xml | 4 +- android/res/raw/rom1a.syx | Bin 4104 -> 4104 bytes .../android/ui/PianoActivity2.java | 6 ++- .../android/widgets/piano/PianoView.java | 2 +- cpp/src/pitchenv.cc | 40 +++++++++--------- cpp/src/synth_unit.cc | 2 +- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 9c582b7..8a10e0e 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="3" + android:versionName="0.91"> diff --git a/android/res/raw/rom1a.syx b/android/res/raw/rom1a.syx index ae79b4627aa29f6388aec5d1e9eb0f887d06cf94..027a9c0ac109cfbeeef272c79a2e406b3c65908b 100644 GIT binary patch delta 143 zcmeBB=up_e#y^>jhp*m?fk9QvT`4&^nSq~yfu)!snSmkMLtc=_ze<=XpL>S%x delta 141 zcmeBB=up_e#$RtJC~2CUoSdY>z`$(5kj%xP1rbOF2?Q_)3o#_g%19?OFffQPFtBPc zM2aQ@1r$L7$w>^X9t_F4mg>Ab9?7;&3?@J=whSI@jE)k*mdT-^4C)L?%+?IaOb*`8 d@is<4z{0N%)W;wZ66EOVrvL deviceList = usbManager.getDeviceList(); - TextView label = (TextView)findViewById(R.id.volumeLabel); + TextView label = (TextView)findViewById(R.id.status); if (!deviceList.isEmpty()) { UsbDevice device = deviceList.values().iterator().next(); //label.setText("ic:" + device.getInterfaceCount()); @@ -240,7 +240,9 @@ public class PianoActivity2 extends Activity { //label.setText(endpoint.toString()); startUsbThread(connection, endpoint); } else { - label.setText("error opening device"); + if (label != null) { + label.setText("error opening device"); + } } } } diff --git a/android/src/com/levien/synthesizer/android/widgets/piano/PianoView.java b/android/src/com/levien/synthesizer/android/widgets/piano/PianoView.java index 6dd2884..18f3f8a 100644 --- a/android/src/com/levien/synthesizer/android/widgets/piano/PianoView.java +++ b/android/src/com/levien/synthesizer/android/widgets/piano/PianoView.java @@ -413,7 +413,7 @@ public class PianoView extends View { private PianoViewListener pianoViewListener_; // The number of simultaneous fingers supported by this control. - protected static final int FINGERS = 5; + protected static final int FINGERS = 10; // Whether to use pressure (doesn't work well on all hardware) private boolean usePressure_ = false; diff --git a/cpp/src/pitchenv.cc b/cpp/src/pitchenv.cc index 6c0780f..ee91b03 100644 --- a/cpp/src/pitchenv.cc +++ b/cpp/src/pitchenv.cc @@ -25,12 +25,31 @@ void PitchEnv::init(double sample_rate) { unit_ = N * (1 << 24) / (21.3 * sample_rate) + 0.5; } +static uint8_t ratetab[] = { + 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, + 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 30, 31, 33, 34, 36, 37, 38, 39, 41, 42, 44, 46, 47, + 49, 51, 53, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 79, 82, + 85, 88, 91, 94, 98, 102, 106, 110, 115, 120, 125, 130, 135, 141, 147, + 153, 159, 165, 171, 178, 185, 193, 202, 211, 232, 243, 254, 255 +}; + +static int8_t pitchtab[] = { + -128, -116, -104, -95, -85, -76, -68, -61, -56, -52, -49, -46, -43, + -41, -39, -37, -35, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, + -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, + -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 38, 40, 43, 46, 49, 53, 58, 65, 73, + 82, 92, 103, 115, 127 +}; + void PitchEnv::set(const int r[4], const int l[4]) { for (int i = 0; i < 4; i++) { rates_[i] = r[i]; levels_[i] = l[i]; } - level_ = 0; + level_ = pitchtab[l[3]] << 19; down_ = true; advance(0); } @@ -61,25 +80,6 @@ void PitchEnv::keydown(bool d) { } } -static uint8_t ratetab[] = { - 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, - 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 30, 31, 33, 34, 36, 37, 38, 39, 41, 42, 44, 46, 47, - 49, 51, 53, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 79, 82, - 85, 88, 91, 94, 98, 102, 106, 110, 115, 120, 125, 130, 135, 141, 147, - 153, 159, 165, 171, 178, 185, 193, 202, 211, 232, 243, 254, 255 -}; - -static int8_t pitchtab[] = { - -128, -116, -104, -95, -85, -76, -68, -61, -56, -52, -49, -46, -43, - -41, -39, -37, -35, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, - -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, - -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 38, 40, 43, 46, 49, 53, 58, 65, 73, - 82, 92, 103, 115, 127 -}; - void PitchEnv::advance(int newix) { ix_ = newix; if (ix_ < 4) { diff --git a/cpp/src/synth_unit.cc b/cpp/src/synth_unit.cc index 6dafc9f..546766a 100644 --- a/cpp/src/synth_unit.cc +++ b/cpp/src/synth_unit.cc @@ -160,7 +160,7 @@ int SynthUnit::ProcessMidiMessage(const uint8_t *buf, int buf_size) { int controller = buf[1]; int value = buf[2]; if (controller == 1) { - filter_control_[0] = 129423563 + value * 1019083; + filter_control_[0] = 142365917 + value * 917175; } else if (controller == 2) { filter_control_[1] = value * 528416; } else if (controller == 64) {