diff options
author | Michiel Van Der Kolk <not.valid@email.address> | 2005-07-11 15:42:37 +0000 |
---|---|---|
committer | Michiel Van Der Kolk <not.valid@email.address> | 2005-07-11 15:42:37 +0000 |
commit | 9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e (patch) | |
tree | 4c304cd4151020bd5494d279ee68a105ae3a5a3a /songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java | |
parent | dfa8ecbe609ca8ea194d08560a44fb9a92e94b4b (diff) | |
download | rockbox-9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e.tar.gz rockbox-9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e.zip |
Songdb java version, source. only 1.5 compatible
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7101 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java')
-rw-r--r-- | songdbj/org/tritonus/share/sampled/mixer/TBaseDataLine.java | 107 |
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 | |||
29 | package org.tritonus.share.sampled.mixer; | ||
30 | |||
31 | import java.util.Collection; | ||
32 | import java.util.EventListener; | ||
33 | import java.util.EventObject; | ||
34 | import java.util.HashSet; | ||
35 | import java.util.Set; | ||
36 | |||
37 | import javax.sound.sampled.AudioFormat; | ||
38 | import javax.sound.sampled.AudioSystem; | ||
39 | import javax.sound.sampled.Control; | ||
40 | import javax.sound.sampled.DataLine; | ||
41 | import javax.sound.sampled.LineEvent; | ||
42 | import javax.sound.sampled.Line; | ||
43 | import javax.sound.sampled.LineUnavailableException; | ||
44 | |||
45 | import org.tritonus.share.TDebug; | ||
46 | |||
47 | |||
48 | |||
49 | /** Base class for implementing SourceDataLine or TargetDataLine. | ||
50 | */ | ||
51 | public abstract class TBaseDataLine | ||
52 | extends 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 | |||