-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRPController.java
74 lines (61 loc) · 1.72 KB
/
RPController.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.util.*;
/**
* controllerクラス定義
* @author myy
*
*/
public class RPController implements RecordOperationListener, RecordListener {
// viewのインスタンス
private RPView view;
// modelのインスタンス
private RPModel model;
/**
* コンストラクタ
*/
public RPController() {
System.out.println("RPController constructor");
try {
// view,modelのインスタンスの生成
this.view = new RPView();
this.model = new RPModel();
System.out.println("instances are generated.");
// 表示の初期化
this.view.setButtonStatus(RPView.ButtonStatus.init);
this.view.addRecordOperationListener(this);
this.model.addRecordListener(this);
} catch (TooManyListenersException ex) {
}
}
// viewからの通知処理
// 録音スタート通知ハンドラ
@Override public void rStartReq(RecordOperationEvent e) {
this.model.startRecording();
this.view.setButtonStatus(RPView.ButtonStatus.recording);
}
// 録音ストップ通知ハンドラ
@Override public void rStopReq(RecordOperationEvent e) {
this.model.stopRecording();
}
// 再生通知ハンドラ
@Override public void mPlayReq(RecordOperationEvent e) {
this.model.midiPlay();
this.view.setButtonStatus(RPView.ButtonStatus.playing);
}
// 停止通知ハンドラ
@Override public void mStopReq(RecordOperationEvent e) {
this.model.midiStop();
}
// プログラム終了通知ハンドラ
@Override public void eReq(RecordOperationEvent e) {
this.model.exitSystem();
}
// modelからの通知処理
// 録音終了通知ハンドラ
@Override public void rFinish(RecordEvent e) {
this.view.setButtonStatus(RPView.ButtonStatus.recorded);
}
// mid再生停止・完了通知ハンドラ
@Override public void mFinish(RecordEvent e) {
this.view.setButtonStatus(RPView.ButtonStatus.recorded);
}
}