diff options
Diffstat (limited to 'songdbj/org/tritonus/share/sampled/file/AudioOutputStream.java')
-rw-r--r-- | songdbj/org/tritonus/share/sampled/file/AudioOutputStream.java | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/songdbj/org/tritonus/share/sampled/file/AudioOutputStream.java b/songdbj/org/tritonus/share/sampled/file/AudioOutputStream.java deleted file mode 100644 index d76296cd2d..0000000000 --- a/songdbj/org/tritonus/share/sampled/file/AudioOutputStream.java +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | /* | ||
2 | * AudioOutputStream.java | ||
3 | * | ||
4 | * This file is part of Tritonus: http://www.tritonus.org/ | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * Copyright (c) 2000 by Matthias Pfisterer | ||
9 | * | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU Library General Public License as published | ||
13 | * by the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU Library General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU Library General Public | ||
22 | * License along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | |<--- this code is formatted to fit into 80 columns --->| | ||
29 | */ | ||
30 | |||
31 | package org.tritonus.share.sampled.file; | ||
32 | |||
33 | import java.io.IOException; | ||
34 | |||
35 | import javax.sound.sampled.AudioFormat; | ||
36 | |||
37 | |||
38 | |||
39 | /** Represents a one-time writing of audio data to a destination (file or output stream). | ||
40 | * | ||
41 | * This interface is the lowest abstraction level of writing audio data. | ||
42 | * Implementations of this interface should, when write() is called, never | ||
43 | * do buffering and they should never do format conversions. However, | ||
44 | * this interface is intended to abstract the file format (how the | ||
45 | * headers and data chunks look like) and the way of writing to the | ||
46 | * destination object. (implementation note [non-normative]: the last | ||
47 | * should be done by using TDataOutputStream implementing classes). | ||
48 | * | ||
49 | * One reasoning behind this interface was to allow direct, unbuffered | ||
50 | * writing of recorded data. | ||
51 | * In JS API 0.90, there was no obvious way for this. | ||
52 | * Data have had to be recorded to a buffer, then written to a file | ||
53 | * from that buffer. | ||
54 | * This gave problems with long recordings, where the main | ||
55 | * memory of the machine is not big enough to hold all data. There are | ||
56 | * two ways so solve this: | ||
57 | * | ||
58 | * a) Having a special AudioInputStream that fetches its data from a | ||
59 | * TargetDataLine. This way, the loop inside the AudioFileWriters reads | ||
60 | * directely from the recording line via the special AudioInputStream. | ||
61 | * This is the solution Sun adopted for JS 1.0. | ||
62 | * | ||
63 | * b) The other way is to expose a direct interface to the writing of the | ||
64 | * audio file with no loop inside it. This is to enable the application | ||
65 | * programmer to write the main loop itself, possibly doing some | ||
66 | * additional processing inside it. This is the more flexible way. | ||
67 | * The drawback is that it requires a new architecture for writing files. | ||
68 | * | ||
69 | * This interface is the central part of a proposal for the second | ||
70 | * solution. | ||
71 | * The idea is now to use the new structure inside the old one to gain | ||
72 | * experience with it before proposing to make it a public interface | ||
73 | * (public in the sense that it is part of the javax.sound.sampled | ||
74 | * package). | ||
75 | * | ||
76 | * @author Matthias Pfisterer | ||
77 | */ | ||
78 | public interface AudioOutputStream | ||
79 | { | ||
80 | /** | ||
81 | * Retrieves the AufioFormat of this AudioOutputStream. | ||
82 | */ | ||
83 | public AudioFormat getFormat(); | ||
84 | |||
85 | |||
86 | /** Gives length of the stream. | ||
87 | * This value is in bytes. It may be AudioSystem.NOT_SPECIFIED | ||
88 | * to express that the length is unknown. | ||
89 | */ | ||
90 | public long getLength(); | ||
91 | |||
92 | |||
93 | |||
94 | /** | ||
95 | * Writes a chunk of audio data to the destination (file or output stream). | ||
96 | */ | ||
97 | // IDEA: use long? | ||
98 | public int write(byte[] abData, int nOffset, int nLength) | ||
99 | throws IOException; | ||
100 | |||
101 | |||
102 | |||
103 | /** Closes the stream. | ||
104 | * This does write remaining buffered data to the destination, | ||
105 | * backpatch the header, if necessary, and closes the destination. | ||
106 | */ | ||
107 | public void close() | ||
108 | throws IOException; | ||
109 | } | ||
110 | |||
111 | |||
112 | |||
113 | /*** AudioOutputStream.java ***/ | ||