summaryrefslogtreecommitdiff
path: root/songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java
diff options
context:
space:
mode:
Diffstat (limited to 'songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java')
-rw-r--r--songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java107
1 files changed, 107 insertions, 0 deletions
diff --git a/songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java b/songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java
new file mode 100644
index 0000000000..e589439838
--- /dev/null
+++ b/songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java
@@ -0,0 +1,107 @@
1/*
2 * TBaseDataLine.java
3 *
4 * This file is part of Tritonus: http://www.tritonus.org/
5 */
6
7/*
8 * Copyright (c) 1999 - 2004 by Matthias Pfisterer
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Library General Public License as published
12 * by the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * You should have received a copy of the GNU Library General Public
21 * License along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25/*
26|<--- this code is formatted to fit into 80 columns --->|
27*/
28
29package org.tritonus.share.sampled.mixer;
30
31import java.util.Collection;
32import java.util.EventListener;
33import java.util.EventObject;
34import java.util.HashSet;
35import java.util.Set;
36
37import javax.sound.sampled.AudioFormat;
38import javax.sound.sampled.AudioSystem;
39import javax.sound.sampled.Control;
40import javax.sound.sampled.DataLine;
41import javax.sound.sampled.LineEvent;
42import javax.sound.sampled.Line;
43import javax.sound.sampled.LineUnavailableException;
44
45import org.tritonus.share.TDebug;
46
47
48
49/** Base class for implementing SourceDataLine or TargetDataLine.
50 */
51public abstract class TBaseDataLine
52extends TDataLine
53{
54 public TBaseDataLine(TMixer mixer,
55 DataLine.Info info)
56 {
57 super(mixer,
58 info);
59 }
60
61
62
63 public TBaseDataLine(TMixer mixer,
64 DataLine.Info info,
65 Collection<Control> controls)
66 {
67 super(mixer,
68 info,
69 controls);
70 }
71
72
73
74 public void open(AudioFormat format, int nBufferSize)
75 throws LineUnavailableException
76 {
77 if (TDebug.TraceDataLine) { TDebug.out("TBaseDataLine.open(AudioFormat, int): called with buffer size: " + nBufferSize); }
78 setBufferSize(nBufferSize);
79 open(format);
80 }
81
82
83
84 public void open(AudioFormat format)
85 throws LineUnavailableException
86 {
87 if (TDebug.TraceDataLine) { TDebug.out("TBaseDataLine.open(AudioFormat): called"); }
88 setFormat(format);
89 open();
90 }
91
92
93 // IDEA: move to TDataLine or TLine?
94 // necessary and wise at all?
95 protected void finalize()
96 {
97 if (isOpen())
98 {
99 close();
100 }
101 }
102}
103
104
105
106/*** TBaseDataLine.java ***/
107