summaryrefslogtreecommitdiff
path: root/songdbj/javazoom/jl/converter/WaveFileObuffer.java
diff options
context:
space:
mode:
Diffstat (limited to 'songdbj/javazoom/jl/converter/WaveFileObuffer.java')
-rw-r--r--songdbj/javazoom/jl/converter/WaveFileObuffer.java141
1 files changed, 0 insertions, 141 deletions
diff --git a/songdbj/javazoom/jl/converter/WaveFileObuffer.java b/songdbj/javazoom/jl/converter/WaveFileObuffer.java
deleted file mode 100644
index eaa1dd46d4..0000000000
--- a/songdbj/javazoom/jl/converter/WaveFileObuffer.java
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2 * 11/19/04 1.0 moved to LGPL.
3 *
4 * 12/12/99 0.0.7 Renamed class, additional constructor arguments
5 * and larger write buffers. mdm@techie.com.
6 *
7 * 15/02/99 Java Conversion by E.B ,javalayer@javazoom.net
8 *
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
26package javazoom.jl.converter;
27
28import javazoom.jl.decoder.Obuffer;
29
30/**
31 * Implements an Obuffer by writing the data to
32 * a file in RIFF WAVE format.
33 *
34 * @since 0.0
35 */
36
37
38public class WaveFileObuffer extends Obuffer
39{
40 private short[] buffer;
41 private short[] bufferp;
42 private int channels;
43 private WaveFile outWave;
44
45 /**
46 * Creates a new WareFileObuffer instance.
47 *
48 * @param number_of_channels
49 * The number of channels of audio data
50 * this buffer will receive.
51 *
52 * @param freq The sample frequency of the samples in the buffer.
53 *
54 * @param fileName The filename to write the data to.
55 */
56 public WaveFileObuffer(int number_of_channels, int freq, String FileName)
57 {
58 if (FileName==null)
59 throw new NullPointerException("FileName");
60
61 buffer = new short[OBUFFERSIZE];
62 bufferp = new short[MAXCHANNELS];
63 channels = number_of_channels;
64
65 for (int i = 0; i < number_of_channels; ++i)
66 bufferp[i] = (short)i;
67
68 outWave = new WaveFile();
69
70 int rc = outWave.OpenForWrite (FileName,freq,(short)16,(short)channels);
71 }
72
73 /**
74 * Takes a 16 Bit PCM sample.
75 */
76 public void append(int channel, short value)
77 {
78 buffer[bufferp[channel]] = value;
79 bufferp[channel] += channels;
80 }
81
82 /**
83 * Write the samples to the file (Random Acces).
84 */
85 short[] myBuffer = new short[2];
86 public void write_buffer(int val)
87 {
88
89 int k = 0;
90 int rc = 0;
91
92 rc = outWave.WriteData(buffer, bufferp[0]);
93 // REVIEW: handle RiffFile errors.
94 /*
95 for (int j=0;j<bufferp[0];j=j+2)
96 {
97
98 //myBuffer[0] = (short)(((buffer[j]>>8)&0x000000FF) | ((buffer[j]<<8)&0x0000FF00));
99 //myBuffer[1] = (short) (((buffer[j+1]>>8)&0x000000FF) | ((buffer[j+1]<<8)&0x0000FF00));
100 myBuffer[0] = buffer[j];
101 myBuffer[1] = buffer[j+1];
102 rc = outWave.WriteData (myBuffer,2);
103 }
104 */
105 for (int i = 0; i < channels; ++i) bufferp[i] = (short)i;
106 }
107
108 public void close()
109 {
110 outWave.Close();
111 }
112
113 /**
114 *
115 */
116 public void clear_buffer()
117 {}
118
119 /**
120 *
121 */
122 public void set_stop_flag()
123 {}
124
125 /*
126 * Create STDOUT buffer
127 *
128 *
129 public static Obuffer create_stdout_obuffer(MPEG_Args maplay_args)
130 {
131 Obuffer thebuffer = null;
132 int mode = maplay_args.MPEGheader.mode();
133 int which_channels = maplay_args.which_c;
134 if (mode == Header.single_channel || which_channels != MPEG_Args.both)
135 thebuffer = new FileObuffer(1,maplay_args.output_filename);
136 else
137 thebuffer = new FileObuffer(2,maplay_args.output_filename);
138 return(thebuffer);
139 }
140 */
141}