This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMusicEditor.java
51 lines (41 loc) · 1.48 KB
/
MusicEditor.java
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package cs3500.music;
import cs3500.music.Util.MusicReader;
import cs3500.music.View.ConcreteGuiViewPanel;
import cs3500.music.View.MidiViewImpl;
import cs3500.music.View.SynthesizerMock;
import cs3500.music.iMusic.Sheet;
import cs3500.music.View.toConsole;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import javax.sound.midi.InvalidMidiDataException;
public class MusicEditor {
public static void main(String[] args) throws IOException, InvalidMidiDataException,
InterruptedException {
try {
FileReader reader = new FileReader(args[0]);
Sheet s = MusicReader.parseFile(reader, new Sheet.Builder());
SynthesizerMock sMock = new SynthesizerMock();
ConcreteGuiViewPanel view = new ConcreteGuiViewPanel(s);
MidiViewImpl midiView = new MidiViewImpl(s);
MidiViewImpl midiview2 = new MidiViewImpl(s, sMock);
toConsole myToConsole = new toConsole(s);
//Factory that outputs the view based on the string taken in
switch (args[1]) {
case "midi":
midiView.render();
// midiview2.render();
//System.out.println(midiview2.toString());
break;
case "console":
myToConsole.toConsole(System.out);
break;
case "graphic":
view.render();
}
} catch (FileNotFoundException e) {
throw new FileNotFoundException();
}
// You probably need to connect these views to your model, too...
}
}