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).
master
Raph Levien 12 years ago
parent 36ec0aa640
commit d40a05871f
  1. 4
      android/AndroidManifest.xml
  2. BIN
      android/res/raw/rom1a.syx
  3. 6
      android/src/com/levien/synthesizer/android/ui/PianoActivity2.java
  4. 2
      android/src/com/levien/synthesizer/android/widgets/piano/PianoView.java
  5. 40
      cpp/src/pitchenv.cc
  6. 2
      cpp/src/synth_unit.cc

@ -2,8 +2,8 @@
<manifest <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="com.levien.synthesizer" package="com.levien.synthesizer"
android:versionCode="2" android:versionCode="3"
android:versionName="0.9"> android:versionName="0.91">
<uses-sdk android:minSdkVersion="9" <uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="17" android:targetSdkVersion="17"
/> <!-- 9 = Gingerbread --> /> <!-- 9 = Gingerbread -->

Binary file not shown.

@ -228,7 +228,7 @@ public class PianoActivity2 extends Activity {
private void tryConnectUsb() { private void tryConnectUsb() {
UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList(); HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();
TextView label = (TextView)findViewById(R.id.volumeLabel); TextView label = (TextView)findViewById(R.id.status);
if (!deviceList.isEmpty()) { if (!deviceList.isEmpty()) {
UsbDevice device = deviceList.values().iterator().next(); UsbDevice device = deviceList.values().iterator().next();
//label.setText("ic:" + device.getInterfaceCount()); //label.setText("ic:" + device.getInterfaceCount());
@ -240,7 +240,9 @@ public class PianoActivity2 extends Activity {
//label.setText(endpoint.toString()); //label.setText(endpoint.toString());
startUsbThread(connection, endpoint); startUsbThread(connection, endpoint);
} else { } else {
label.setText("error opening device"); if (label != null) {
label.setText("error opening device");
}
} }
} }
} }

@ -413,7 +413,7 @@ public class PianoView extends View {
private PianoViewListener pianoViewListener_; private PianoViewListener pianoViewListener_;
// The number of simultaneous fingers supported by this control. // 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) // Whether to use pressure (doesn't work well on all hardware)
private boolean usePressure_ = false; private boolean usePressure_ = false;

@ -25,12 +25,31 @@ void PitchEnv::init(double sample_rate) {
unit_ = N * (1 << 24) / (21.3 * sample_rate) + 0.5; 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]) { void PitchEnv::set(const int r[4], const int l[4]) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
rates_[i] = r[i]; rates_[i] = r[i];
levels_[i] = l[i]; levels_[i] = l[i];
} }
level_ = 0; level_ = pitchtab[l[3]] << 19;
down_ = true; down_ = true;
advance(0); 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) { void PitchEnv::advance(int newix) {
ix_ = newix; ix_ = newix;
if (ix_ < 4) { if (ix_ < 4) {

@ -160,7 +160,7 @@ int SynthUnit::ProcessMidiMessage(const uint8_t *buf, int buf_size) {
int controller = buf[1]; int controller = buf[1];
int value = buf[2]; int value = buf[2];
if (controller == 1) { if (controller == 1) {
filter_control_[0] = 129423563 + value * 1019083; filter_control_[0] = 142365917 + value * 917175;
} else if (controller == 2) { } else if (controller == 2) {
filter_control_[1] = value * 528416; filter_control_[1] = value * 528416;
} else if (controller == 64) { } else if (controller == 64) {

Loading…
Cancel
Save