Skip to content

Commit f97cc04

Browse files
committed
fix(project): Project Submission fixes.
1 parent 1b9ef82 commit f97cc04

File tree

5 files changed

+6
-65
lines changed

5 files changed

+6
-65
lines changed

lib/blocs/audio_player/audio_player_bloc.dart

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ part 'audio_player_state.dart';
1414
class AudioPlayerBloc extends Bloc<AudioPlayerEvent, AudioPlayerState> {
1515
static const maxPlayers = 4;
1616
final List<Player> _players = [];
17-
static const int defaultBassOctave = 2;
18-
static const int defaultBassOctaves = defaultBassOctave * 12;
19-
static const int defaultNoteOctave = 4;
20-
static const int defaultNoteOctaves = defaultNoteOctave * 12;
2117
static const int maxMelody = 71; // B4.
2218
static const int minBass = 31; // G2.
2319
bool _baseControl = true;
@@ -96,10 +92,7 @@ class AudioPlayerBloc extends Bloc<AudioPlayerEvent, AudioPlayerState> {
9692
emit(Idle());
9793
}
9894

99-
Future<void> _play({
100-
required Emitter<AudioPlayerState> emit,
101-
bool arpeggio = false,
102-
}) async {
95+
Future<void> _play({required Emitter<AudioPlayerState> emit}) async {
10396
if (_currentMeasures != null) {
10497
double millisecondsPerBeat = (60 / _bpm) * 1000;
10598
double mult =
@@ -121,15 +114,7 @@ class AudioPlayerBloc extends Bloc<AudioPlayerEvent, AudioPlayerState> {
121114
Duration duration =
122115
Duration(milliseconds: (prog.durations[_cC] * mult).toInt());
123116
if (prog[_cC] != null) {
124-
if (arpeggio) {
125-
_playChordArpeggio(
126-
chord: prog[_cC]!,
127-
duration: duration,
128-
noteLength:
129-
Duration(milliseconds: ((0.125 / 2) * mult).toInt()));
130-
} else {
131-
prevPitches = _playChord(prog[_cC]!, prevPitches);
132-
}
117+
prevPitches = _playChord(prog[_cC]!, prevPitches);
133118
}
134119
await Future.delayed(duration);
135120
} else {
@@ -153,24 +138,6 @@ class AudioPlayerBloc extends Bloc<AudioPlayerEvent, AudioPlayerState> {
153138
return pitches;
154139
}
155140

156-
void _playChordArpeggio({
157-
required Chord chord,
158-
required Duration duration,
159-
required Duration noteLength,
160-
}) async {
161-
int times = duration.inMilliseconds ~/ noteLength.inMilliseconds;
162-
List<Pitch> pitches = _walk(chord);
163-
for (int i = 0; i < times; i++) {
164-
try {
165-
_players[i].open(Media.asset(pitchFileName(pitches[i % maxPlayers])));
166-
_players[i].play();
167-
await Future.delayed(noteLength);
168-
} catch (e) {
169-
rethrow;
170-
}
171-
}
172-
}
173-
174141
Pitch getBase(Pitch pitch) {
175142
int note = pitch.midiNumber % 12;
176143
int minBassNote = minBass % 12;

lib/blocs/substitution_handler/substitution_handler_bloc.dart

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:thoery_test/modals/pitch_scale.dart';
88
import 'package:thoery_test/modals/progression.dart';
99
import 'package:thoery_test/modals/scale_degree_progression.dart';
1010
import 'package:thoery_test/modals/substitution.dart';
11-
import 'package:thoery_test/modals/substitution_match.dart';
1211
import 'package:thoery_test/modals/weights/keep_harmonic_function_weight.dart';
1312
import 'package:thoery_test/modals/weights/weight.dart';
1413
import 'package:thoery_test/state/progression_bank.dart';
@@ -151,21 +150,6 @@ class SubstitutionHandlerBloc
151150
return _chordProgressions![index]!;
152151
}
153152

154-
ChordProgression getOriginalSubChords(PitchScale scale, int index) {
155-
assert(index >= 0 && index < _originalSubs!.length);
156-
if (_originalSubs![index] == null) {
157-
ScaleDegreeProgression originalSub =
158-
_substitutions![index].originalSubstitution;
159-
SubstitutionMatch match = _substitutions![index].match;
160-
if (match.type == SubstitutionMatchType.tonicization) {
161-
originalSub = originalSub.tonicizedFor(
162-
_substitutions![index].substitutedBase[match.baseIndex]!);
163-
}
164-
_originalSubs![index] = originalSub.inScale(scale);
165-
}
166-
return _originalSubs![index]!;
167-
}
168-
169153
/// Creates an [Isolate] to compute the substitution. The isolate will be
170154
/// saved in [_substituteByIsolate] until it is complete.
171155
Future<Substitution> _isolateSubstituteBy(int iterations) async {

lib/constants.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
22

33
abstract class Constants {
44
static const Size minimumWindowSize = Size(855, 378);
5-
6-
static const Color titleBarColor = Color.fromARGB(255, 196, 196, 196);
75
static const Color buttonBackgroundColor = Color.fromARGB(255, 227, 227, 227);
86
static const Color buttonUnfocusedColor = Color.fromARGB(255, 192, 192, 192);
97
static const Color buttonUnfocusedTextColor =
@@ -13,7 +11,6 @@ abstract class Constants {
1311
Color.fromARGB(100, 206, 206, 206);
1412
static const Color selectedColor = Color.fromARGB(255, 187, 187, 187);
1513
static const Color measureColor = Color.fromARGB(255, 171, 171, 171);
16-
static const Color playedValueColor = Colors.blue;
1714
static const double measureWidth = 315;
1815
static const double measureHeight = 66;
1916
static const double measureSpacing = measureHeight / 2;

lib/main.dart

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,9 @@ void main() async {
1515
runApp(const MyApp());
1616
}
1717

18-
class MyApp extends StatefulWidget {
18+
class MyApp extends StatelessWidget {
1919
const MyApp({Key? key}) : super(key: key);
2020

21-
@override
22-
State<MyApp> createState() => _MyAppState();
23-
}
24-
25-
class _MyAppState extends State<MyApp> {
2621
@override
2722
Widget build(BuildContext context) {
2823
return MaterialApp(
@@ -81,15 +76,13 @@ class _MyAppState extends State<MyApp> {
8176
textStyle: const TextStyle(fontSize: 12, color: Colors.black),
8277
),
8378
),
84-
home: const MyHomePage(title: 'Flutter Demo Home Page'),
79+
home: const MyHomePage(),
8580
);
8681
}
8782
}
8883

8984
class MyHomePage extends StatelessWidget {
90-
const MyHomePage({Key? key, required this.title}) : super(key: key);
91-
92-
final String title;
85+
const MyHomePage({Key? key}) : super(key: key);
9386

9487
@override
9588
Widget build(BuildContext context) {

lib/screens/progression_screen/widgets/bank_progression_button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _BankProgressionButtonState extends State<BankProgressionButton> {
4242
int id = _bloc.currentProgression.id;
4343
if (ProgressionBank.idFreeInSubs(_bloc.title, id)) {
4444
if (!ProgressionBank.canBeSubstitution(_bloc.currentProgression)) {
45-
_error = 'Progression is does not consist of 2 - 8 chords';
45+
_error = 'Progression does not consist of 2 - 8 chords';
4646
}
4747
} else {
4848
String title =

0 commit comments

Comments
 (0)