diff options
author | Björn Stenberg <bjorn@haxx.se> | 2007-01-08 23:53:00 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2007-01-08 23:53:00 +0000 |
commit | 7039a05147b8bbfc829babea1c65bd436450b505 (patch) | |
tree | 4ba555eb84ed97b72b0575034d5b0530a393713e /songdbj/org/tritonus/file/WaveAudioFileWriter.java | |
parent | 6d4c19707ef95942e323cbdc89fbbfdbe45e7cc5 (diff) | |
download | rockbox-7039a05147b8bbfc829babea1c65bd436450b505.tar.gz rockbox-7039a05147b8bbfc829babea1c65bd436450b505.zip |
Splitting out songdbj
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11953 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'songdbj/org/tritonus/file/WaveAudioFileWriter.java')
-rw-r--r-- | songdbj/org/tritonus/file/WaveAudioFileWriter.java | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/songdbj/org/tritonus/file/WaveAudioFileWriter.java b/songdbj/org/tritonus/file/WaveAudioFileWriter.java deleted file mode 100644 index d501b5b2b1..0000000000 --- a/songdbj/org/tritonus/file/WaveAudioFileWriter.java +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* | ||
2 | * WaveAudioFileWriter.java | ||
3 | * | ||
4 | * This file is part of Tritonus: http://www.tritonus.org/ | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * Copyright (c) 1999,2000 by Florian Bomers <http://www.bomers.de> | ||
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.sampled.file; | ||
32 | |||
33 | import java.io.IOException; | ||
34 | import java.util.Arrays; | ||
35 | |||
36 | import javax.sound.sampled.AudioFileFormat; | ||
37 | import javax.sound.sampled.AudioFormat; | ||
38 | import javax.sound.sampled.AudioInputStream; | ||
39 | import javax.sound.sampled.AudioSystem; | ||
40 | |||
41 | import org.tritonus.share.TDebug; | ||
42 | import org.tritonus.share.sampled.file.AudioOutputStream; | ||
43 | import org.tritonus.share.sampled.file.TAudioFileWriter; | ||
44 | import org.tritonus.share.sampled.file.TDataOutputStream; | ||
45 | |||
46 | |||
47 | /** | ||
48 | * Class for writing Microsoft(tm) WAVE files | ||
49 | * | ||
50 | * @author Florian Bomers | ||
51 | */ | ||
52 | public class WaveAudioFileWriter | ||
53 | extends TAudioFileWriter { | ||
54 | |||
55 | private static final AudioFileFormat.Type[] FILE_TYPES = | ||
56 | { | ||
57 | AudioFileFormat.Type.WAVE | ||
58 | }; | ||
59 | |||
60 | private static final int ALL=AudioSystem.NOT_SPECIFIED; | ||
61 | |||
62 | // IMPORTANT: this array depends on the AudioFormat.match() algorithm which takes | ||
63 | // AudioSystem.NOT_SPECIFIED into account ! | ||
64 | private static final AudioFormat[] AUDIO_FORMATS = | ||
65 | { | ||
66 | // Encoding, SampleRate, sampleSizeInBits, channels, frameSize, frameRate, bigEndian | ||
67 | new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, true), | ||
68 | new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, false), | ||
69 | new AudioFormat(AudioFormat.Encoding.ULAW, ALL, 8, ALL, ALL, ALL, false), | ||
70 | new AudioFormat(AudioFormat.Encoding.ULAW, ALL, 8, ALL, ALL, ALL, true), | ||
71 | new AudioFormat(AudioFormat.Encoding.ALAW, ALL, 8, ALL, ALL, ALL, false), | ||
72 | new AudioFormat(AudioFormat.Encoding.ALAW, ALL, 8, ALL, ALL, ALL, true), | ||
73 | new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, ALL, 16, ALL, ALL, ALL, false), | ||
74 | new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, ALL, 24, ALL, ALL, ALL, false), | ||
75 | new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, ALL, 32, ALL, ALL, ALL, false), | ||
76 | new AudioFormat(WaveTool.GSM0610, ALL, ALL, ALL, ALL, ALL, false), | ||
77 | new AudioFormat(WaveTool.GSM0610, ALL, ALL, ALL, ALL, ALL, true), | ||
78 | }; | ||
79 | |||
80 | public WaveAudioFileWriter() { | ||
81 | super(Arrays.asList(FILE_TYPES), | ||
82 | Arrays.asList(AUDIO_FORMATS)); | ||
83 | } | ||
84 | |||
85 | // overwritten for quicker and more accurate check | ||
86 | protected boolean isAudioFormatSupportedImpl(AudioFormat format, | ||
87 | AudioFileFormat.Type fileType) { | ||
88 | return WaveTool.getFormatCode(format) != WaveTool.WAVE_FORMAT_UNSPECIFIED; | ||
89 | } | ||
90 | |||
91 | |||
92 | protected AudioOutputStream getAudioOutputStream(AudioFormat audioFormat, | ||
93 | long lLengthInBytes, | ||
94 | AudioFileFormat.Type fileType, | ||
95 | TDataOutputStream dataOutputStream) throws IOException { | ||
96 | return new WaveAudioOutputStream(audioFormat, | ||
97 | lLengthInBytes, | ||
98 | dataOutputStream); | ||
99 | } | ||
100 | |||
101 | } | ||
102 | |||
103 | /*** WaveAudioFileWriter.java ***/ | ||