%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
tsukuba_bunko.peko.canvas.stage.AudioClip |
|
|
1 | /* |
|
2 | * All Rights Reserved. |
|
3 | * Copyright (C) 1999-2005 Tsukuba Bunko. |
|
4 | * |
|
5 | * Licensed under the BSD License ("the License"); you may not use |
|
6 | * this file except in compliance with the License. |
|
7 | * You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.tsukuba-bunko.org/licenses/LICENSE.txt |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | * |
|
17 | * $Id: AudioClip.java,v 1.2 2005/08/19 03:18:11 ppoi Exp $ |
|
18 | */ |
|
19 | package tsukuba_bunko.peko.canvas.stage; |
|
20 | ||
21 | import java.net.URL; |
|
22 | ||
23 | ||
24 | /** |
|
25 | * 音楽クリップの基本的な機能を提供します。 |
|
26 | * @author $Author: ppoi $ |
|
27 | * @version $Revision: 1.2 $ $Date: 2005/08/19 03:18:11 $ |
|
28 | */ |
|
29 | public abstract class AudioClip { |
|
30 | ||
31 | /** |
|
32 | * クリップ ID |
|
33 | */ |
|
34 | 0 | private String _id = null; |
35 | ||
36 | /** |
|
37 | * このクリップを管理する AudioPlayer |
|
38 | */ |
|
39 | 0 | private AudioPlayer _player = null; |
40 | ||
41 | /** |
|
42 | * 再生クリップの URL |
|
43 | */ |
|
44 | 0 | private URL _clipURL = null; |
45 | ||
46 | /** |
|
47 | * ループするかどうか |
|
48 | */ |
|
49 | 0 | private boolean _isLoop = false; |
50 | ||
51 | ||
52 | /** |
|
53 | * <code>AudioClip</code> のインスタンスを作成するためにサブクラスのコンストラクタから呼ばれます。 |
|
54 | * @param id クリップ ID |
|
55 | * @param clipURL クリップの URL |
|
56 | */ |
|
57 | protected AudioClip( String id, URL clipURL ) |
|
58 | { |
|
59 | 0 | super(); |
60 | 0 | _id = id; |
61 | 0 | _clipURL = clipURL; |
62 | 0 | } |
63 | ||
64 | ||
65 | /** |
|
66 | * このクリップのクリップ ID を取得します。 |
|
67 | * @return クリップ ID |
|
68 | */ |
|
69 | public String getID() |
|
70 | { |
|
71 | 0 | return _id; |
72 | } |
|
73 | ||
74 | /** |
|
75 | * このクリップを管理する AudioPlayer を設定します。 |
|
76 | * @param player このクリップを管理する AudioPlayer |
|
77 | */ |
|
78 | public void setAudioPlayer( AudioPlayer player ) |
|
79 | { |
|
80 | 0 | _player = player; |
81 | 0 | } |
82 | ||
83 | /** |
|
84 | * このクリップを管理する AudioPlayer を取得します。 |
|
85 | * @return このクリップを管理する AudioPlayer |
|
86 | */ |
|
87 | public AudioPlayer getAudioPlayer() |
|
88 | { |
|
89 | 0 | return _player; |
90 | } |
|
91 | ||
92 | /** |
|
93 | * このクリップのソースデータの URL を取得します。 |
|
94 | * @return このクリップのソースデータの URL |
|
95 | */ |
|
96 | public URL getClipURL() |
|
97 | { |
|
98 | 0 | return _clipURL; |
99 | } |
|
100 | ||
101 | /** |
|
102 | * このクリップの再生をループするかどうかを判定します。 |
|
103 | * @return ループする場合 <code>true</code>、しない場合 <code>false</code> |
|
104 | */ |
|
105 | public boolean isLoop() |
|
106 | { |
|
107 | 0 | return _isLoop; |
108 | } |
|
109 | ||
110 | /** |
|
111 | * このクリップを再生を開始します。 |
|
112 | * @param loop ループする場合は <code>true</code>、しない場合は <code>false</code>。 |
|
113 | */ |
|
114 | public void play( boolean loop ) |
|
115 | { |
|
116 | 0 | _isLoop = loop; |
117 | 0 | play(); |
118 | 0 | } |
119 | ||
120 | /** |
|
121 | * このクリップの再生を開始します。 |
|
122 | */ |
|
123 | public abstract void play(); |
|
124 | ||
125 | /** |
|
126 | * このクリップの再生を停止します。 |
|
127 | */ |
|
128 | public void stop() |
|
129 | { |
|
130 | 0 | stop( AudioPlayer.STOP_WITH_SYNC_FADEOUT ); |
131 | 0 | } |
132 | ||
133 | /** |
|
134 | * このクリップの再生を停止します。 |
|
135 | * @param mode 停止モード |
|
136 | */ |
|
137 | public abstract void stop( int mode ); |
|
138 | ||
139 | /** |
|
140 | * 演奏が終了したことを AudioPlayer に通知します。 |
|
141 | */ |
|
142 | protected void playingFinished() |
|
143 | { |
|
144 | 0 | AudioPlayer player = getAudioPlayer(); |
145 | 0 | if( player != null ) { |
146 | 0 | player.unregister( this ); |
147 | } |
|
148 | 0 | } |
149 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |