Skip to content

Commit

Permalink
Prepare for review
Browse files Browse the repository at this point in the history
  • Loading branch information
oshibka404 committed Jul 13, 2020
1 parent dea65a6 commit b4f10a6
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 185 deletions.
12 changes: 6 additions & 6 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 0.1.0;
CURRENT_PROJECT_VERSION = 1.0;
DEVELOPMENT_TEAM = 4PSBF4AXSS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -349,7 +349,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = in.ozorn.synt;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
Expand Down Expand Up @@ -467,7 +467,7 @@
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 0.1.0;
CURRENT_PROJECT_VERSION = 1.0;
DEVELOPMENT_TEAM = 4PSBF4AXSS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -483,7 +483,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = in.ozorn.synt;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
Expand All @@ -496,7 +496,7 @@
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 0.1.0;
CURRENT_PROJECT_VERSION = 1.0;
DEVELOPMENT_TEAM = 4PSBF4AXSS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -512,7 +512,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = in.ozorn.synt;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
Expand Down
12 changes: 6 additions & 6 deletions lib/arpeggiator/arpeggio_banks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ Map<String, List<Arpeggio>> arpeggioBank = {
Arpeggio([
PlayerAction(),
PlayerAction.stop(),
PlayerAction(velocity: .2),
PlayerAction.stop(),
PlayerAction(velocity: .5),
PlayerAction.stop(),
PlayerAction(velocity: .2),
PlayerAction(),
PlayerAction.stop(),
PlayerAction(velocity: .7),
PlayerAction(velocity: .5),
PlayerAction.stop(),
PlayerAction(velocity: .2),
PlayerAction(),
PlayerAction.stop(),
PlayerAction(velocity: .5),
PlayerAction.stop(),
PlayerAction(velocity: .2),
PlayerAction(),
PlayerAction.stop(),
PlayerAction(velocity: .5),
PlayerAction.stop(),
])
],
Expand Down
106 changes: 4 additions & 102 deletions lib/controller/settings/controls.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import 'dart:convert';

import 'package:flutter/material.dart';

import '../../faust_ui/faust_ui.dart';
import '../../synth/dsp_api.dart';
import '../keyboard_preset.dart';
import '../../scales/scale_patterns.dart';
import 'synth_controls.dart';
import '../keyboard_preset.dart';
import 'global_controls.dart';

/// Settings screen
class Controls extends StatefulWidget {
class Controls extends StatelessWidget {
final KeyboardPreset preset;
final double tempo;
final Function setTempo;
Expand All @@ -18,105 +14,11 @@ class Controls extends StatefulWidget {

Controls(this.preset, this.tempo, this.setTempo, this.scale, this.setScale);

@override
State<Controls> createState() => ControlsState();
}

class ControlsState extends State<Controls> {
FaustUi faustUi;

bool _advancedExpanded = false;

@override
Widget build(context) {
if (faustUi == null) return Center();

return ListView(
children: [
GlobalControls(
widget.tempo, widget.setTempo, widget.scale, widget.setScale),
RaisedButton(
color: widget.preset.color,
child: Text('Experimental voice settings'),
onPressed: _toggleAdvancedSettings),
if (_advancedExpanded)
SynthControls.fromFaustUi(faustUi, widget.preset),
],
);
}

@override
void initState() {
_getInitialParams();
super.initState();
}

void _getInitialParams() async {
String jsonUi = await DspApi.getJsonUi();
Map<String, dynamic> uiParams = jsonDecode(jsonUi);
setState(() {
faustUi = FaustUi.fromJson(uiParams);
});
}

_toggleAdvancedSettings() {
setState(() {
_advancedExpanded = !_advancedExpanded;
});
}
}

class GlobalControls extends StatelessWidget {
final ScalePattern _scale;
final Function _setScale;

final Map<ScalePattern, String> scaleNames = {
ScalePattern.chromatic: 'Chromatic',

ScalePattern.pentatonic: 'Pentatonic',
ScalePattern.blues: 'Blues',

ScalePattern.harmonicMinor: 'Harmonic minor',
ScalePattern.melodicMinor: 'Melodic minor',

// Diatonic scales
ScalePattern.major: 'Major',
ScalePattern.minor: 'Minor',
ScalePattern.ionian: 'Ionian',
ScalePattern.dorian: 'Dorian',
ScalePattern.phrygian: 'Phrygian',
ScalePattern.lydian: 'Lydian',
ScalePattern.myxolydian: 'Myxolydian',
ScalePattern.aeolian: 'Aeolian',
ScalePattern.locrian: 'Locrian',
};

final double _tempo;
final Function _setTempo;
GlobalControls(this._tempo, this._setTempo, this._scale, this._setScale);
Widget build(BuildContext context) {
return Column(
children: [
Text("Tempo: ${_tempo.toStringAsFixed(0)} bpm"),
Slider(
min: 60,
max: 240,
value: _tempo,
activeColor: Colors.black,
inactiveColor: Colors.grey,
onChanged: (tempo) => _setTempo(tempo.roundToDouble()),
),
Text("Scale:"),
DropdownButton<ScalePattern>(
value: _scale,
items: scaleNames.keys
.map<DropdownMenuItem<ScalePattern>>(
(scale) => DropdownMenuItem<ScalePattern>(
value: scale,
child: Text(scaleNames[scale]),
))
.toList(),
onChanged: _setScale),
GlobalControls(tempo, setTempo, scale, setScale),
],
);
}
Expand Down
61 changes: 61 additions & 0 deletions lib/controller/settings/global_controls.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:flutter/material.dart';

import '../../scales/scale_patterns.dart';

class GlobalControls extends StatelessWidget {
final ScalePattern _scale;
final Function _setScale;

final Map<ScalePattern, String> scaleNames = {
ScalePattern.chromatic: 'Chromatic',

ScalePattern.pentatonic: 'Pentatonic',
ScalePattern.blues: 'Blues',

ScalePattern.harmonicMinor: 'Harmonic minor',
ScalePattern.melodicMinor: 'Melodic minor',

// Diatonic scales
ScalePattern.major: 'Major',
ScalePattern.minor: 'Minor',
ScalePattern.ionian: 'Ionian',
ScalePattern.dorian: 'Dorian',
ScalePattern.phrygian: 'Phrygian',
ScalePattern.lydian: 'Lydian',
ScalePattern.myxolydian: 'Myxolydian',
ScalePattern.aeolian: 'Aeolian',
ScalePattern.locrian: 'Locrian',
};

final double _tempo;
final Function _setTempo;

GlobalControls(this._tempo, this._setTempo, this._scale, this._setScale);

Widget build(BuildContext context) {
return Column(
children: [
Text("Tempo: ${_tempo.toStringAsFixed(0)} bpm"),
Slider(
min: 60,
max: 120,
value: _tempo,
activeColor: Colors.black,
inactiveColor: Colors.grey,
onChanged: (tempo) => _setTempo(tempo.roundToDouble()),
),
Text("Scale:"),
DropdownButton<ScalePattern>(
value: _scale,
items: scaleNames.keys
.map<DropdownMenuItem<ScalePattern>>(
(scale) => DropdownMenuItem<ScalePattern>(
value: scale,
child: Text(scaleNames[scale]),
))
.toList(),
onChanged: _setScale),
],
);
}
}
70 changes: 0 additions & 70 deletions lib/controller/settings/synth_controls.dart

This file was deleted.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: perfect_first_synth
description: A project with ambitions of becoming the perfect first synthesizer

publish_to: 'none'
version: 0.0.1
version: 1.0

repository: https://github.com/oshibka404/perfect-first-synth
issue_tracker: https://github.com/oshibka404/perfect-first-synth/issues
Expand Down

0 comments on commit b4f10a6

Please sign in to comment.