Make audio/maplay compiling under -current again.

Noticed by: bento
This commit is contained in:
Edwin Groothuis 2002-11-21 05:49:07 +00:00
parent f2b8102515
commit c47d0fa49a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=70641
14 changed files with 898 additions and 364 deletions

View file

@ -1,83 +0,0 @@
*** obuffer.cc.orig Thu Jun 23 21:14:36 1994
--- obuffer.cc Thu Dec 9 05:10:51 1999
***************
*** 217,226 ****
int SparcObuffer::audio_fd = -1;
#ifdef ULAW
! SparcObuffer::SparcObuffer (Header *header, bool use_speaker, bool use_headphone, bool use_line_out)
#else
SparcObuffer::SparcObuffer (uint32 number_of_channels, Header *header,
! bool use_speaker, bool use_headphone, bool use_line_out)
#endif
{
#ifndef ULAW
--- 217,226 ----
int SparcObuffer::audio_fd = -1;
#ifdef ULAW
! SparcObuffer::SparcObuffer (Header *header, boolean use_speaker, boolean use_headphone, boolean use_line_out)
#else
SparcObuffer::SparcObuffer (uint32 number_of_channels, Header *header,
! boolean use_speaker, boolean use_headphone, boolean use_line_out)
#endif
{
#ifndef ULAW
***************
*** 406,414 ****
#ifdef ULAW
! bool SparcObuffer::class_suitable (uint32 number_of_channels, bool force_amd)
#else
! bool SparcObuffer::class_suitable (void)
#endif
{
#ifdef ULAW
--- 406,414 ----
#ifdef ULAW
! boolean SparcObuffer::class_suitable (uint32 number_of_channels, boolean force_amd)
#else
! boolean SparcObuffer::class_suitable (void)
#endif
{
#ifdef ULAW
***************
*** 537,542 ****
--- 537,543 ----
}
// turn NDELAY mode off:
+ #ifndef __FreeBSD__ /* Our /dev/audio doesn't like non-blocking I/O */
int flags;
if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
{
***************
*** 549,554 ****
--- 550,556 ----
perror ("fcntl F_SETFL on /dev/audio failed");
exit (1);
}
+ #endif
return fd;
}
***************
*** 629,635 ****
}
! bool LinuxObuffer::class_suitable (uint32 number_of_channels)
{
// open the dsp audio device:
audio_fd = open_audio_device ();
--- 631,637 ----
}
! boolean LinuxObuffer::class_suitable (uint32 number_of_channels)
{
// open the dsp audio device:
audio_fd = open_audio_device ();

View file

@ -1,20 +0,0 @@
--- header.cc.orig Thu Jun 23 07:14:35 1994
+++ header.cc Fri Nov 26 16:18:21 1999
@@ -36,7 +36,7 @@
const uint32 Header::frequencies[3] = { 44100, 48000, 32000 };
-bool Header::read_header (Ibitstream *stream, Crc16 **crcp)
+boolean Header::read_header (Ibitstream *stream, Crc16 **crcp)
{
uint32 headerstring;
@@ -161,7 +161,7 @@
static const int32 bitrates_layer_2[15] = {
0 /*free format*/, 32000, 48000, 56000, 64000, 80000, 96000,
112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000 };
- static const samplefrequencies[3] = { 44100, 48000, 32000 };
+ static const int32 samplefrequencies[3] = { 44100, 48000, 32000 };
uint32 framesize;
if (h_layer == 1)

View file

@ -1,36 +0,0 @@
*** ibitstream.cc.orig Thu Jun 23 21:14:35 1994
--- ibitstream.cc Thu Dec 9 05:32:18 1999
***************
*** 64,70 ****
}
! bool Ibitstream::get_header (uint32 *headerstring)
{
int readvalue;
--- 64,70 ----
}
! boolean Ibitstream::get_header (uint32 *headerstring)
{
int readvalue;
***************
*** 102,108 ****
}
! bool Ibitstream::read_frame (uint32 bytesize)
{
int readvalue;
--- 102,108 ----
}
! boolean Ibitstream::read_frame (uint32 bytesize)
{
int readvalue;

View file

@ -1,72 +0,0 @@
*** maplay.cc.orig Thu Jun 23 21:14:36 1994
--- maplay.cc Thu Dec 9 05:32:18 1999
***************
*** 54,67 ****
// data extracted from commandline arguments:
static char *filename;
! static bool verbose_mode = False, filter_check = False;
! static bool stdout_mode = False;
static enum e_channels which_channels = both;
! static bool use_speaker = False, use_headphone = False, use_line_out = False;
#ifdef ULAW
! static bool force_amd = False;
#endif
! static bool use_own_scalefactor = False;
static real scalefactor;
// data extracted from header of first frame:
--- 54,67 ----
// data extracted from commandline arguments:
static char *filename;
! static boolean verbose_mode = False, filter_check = False;
! static boolean stdout_mode = False;
static enum e_channels which_channels = both;
! static boolean use_speaker = False, use_headphone = False, use_line_out = False;
#ifdef ULAW
! static boolean force_amd = False;
#endif
! static boolean use_own_scalefactor = False;
static real scalefactor;
// data extracted from header of first frame:
***************
*** 93,99 ****
main (int argc, char *argv[])
{
int i;
! bool read_ready = False, write_ready = False;
if (argc < 2 || !strncmp (argv[1], "-h", 2))
{
--- 93,99 ----
main (int argc, char *argv[])
{
int i;
! boolean read_ready = False, write_ready = False;
if (argc < 2 || !strncmp (argv[1], "-h", 2))
{
***************
*** 146,151 ****
--- 146,154 ----
#ifdef Solaris
"SPARC Solaris 2.x"
#else
+ #ifdef __FreeBSD__
+ "FreeBSD"
+ #else
#ifdef LINUX
"Linux"
#else
***************
*** 153,158 ****
--- 156,162 ----
"RISC ULTRIX 4.x"
#else
"unknown"
+ #endif
#endif
#endif
#endif

View file

@ -1,62 +0,0 @@
*** obuffer.h.orig Thu Jun 23 21:14:40 1994
--- obuffer.h Thu Dec 9 05:32:18 1999
***************
*** 123,142 ****
public:
#ifdef ULAW
! SparcObuffer (Header *, bool use_speaker, bool use_headphone, bool use_line_out);
#else
SparcObuffer (uint32 number_of_channels, Header *,
! bool use_speaker, bool use_headphone, bool use_line_out);
#endif
~SparcObuffer (void);
void append (uint32 channel, int16 value);
void write_buffer (int dummy);
#ifdef ULAW
! static bool class_suitable (uint32 number_of_channels, bool force_amd);
// returnvalue == False: no u-law output possible (class unsuitable)
#else
! static bool class_suitable (void);
// returnvalue == False: no 16-bit output possible (class unsuitable)
#endif
};
--- 123,142 ----
public:
#ifdef ULAW
! SparcObuffer (Header *, boolean use_speaker, boolean use_headphone, boolean use_line_out);
#else
SparcObuffer (uint32 number_of_channels, Header *,
! boolean use_speaker, boolean use_headphone, boolean use_line_out);
#endif
~SparcObuffer (void);
void append (uint32 channel, int16 value);
void write_buffer (int dummy);
#ifdef ULAW
! static boolean class_suitable (uint32 number_of_channels, boolean force_amd);
// returnvalue == False: no u-law output possible (class unsuitable)
#else
! static boolean class_suitable (void);
// returnvalue == False: no 16-bit output possible (class unsuitable)
#endif
};
***************
*** 159,165 ****
void append (uint32 channel, int16 value);
void write_buffer (int dummy);
! static bool class_suitable (uint32 number_of_channels);
};
#endif // LINUX
--- 159,165 ----
void append (uint32 channel, int16 value);
void write_buffer (int dummy);
! static boolean class_suitable (uint32 number_of_channels);
};
#endif // LINUX

View file

@ -1,91 +0,0 @@
*** subband_layer_1.cc.orig Thu Jun 23 21:14:36 1994
--- subband_layer_1.cc Thu Dec 9 05:32:19 1999
***************
*** 86,92 ****
}
! bool SubbandLayer1::read_sampledata (Ibitstream *stream)
{
if (allocation)
{
--- 86,92 ----
}
! boolean SubbandLayer1::read_sampledata (Ibitstream *stream)
{
if (allocation)
{
***************
*** 105,111 ****
}
! bool SubbandLayer1::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *)
{
if (allocation && channels != right)
--- 105,111 ----
}
! boolean SubbandLayer1::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *)
{
if (allocation && channels != right)
***************
*** 142,148 ****
}
! bool SubbandLayer1IntensityStereo::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *filter2)
{
if (allocation)
--- 142,148 ----
}
! boolean SubbandLayer1IntensityStereo::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *filter2)
{
if (allocation)
***************
*** 231,239 ****
}
! bool SubbandLayer1Stereo::read_sampledata (Ibitstream *stream)
{
! bool returnvalue = SubbandLayer1::read_sampledata (stream);
if (channel2_allocation)
{
channel2_sample = real (stream->get_bits (channel2_samplelength));
--- 231,239 ----
}
! boolean SubbandLayer1Stereo::read_sampledata (Ibitstream *stream)
{
! boolean returnvalue = SubbandLayer1::read_sampledata (stream);
if (channel2_allocation)
{
channel2_sample = real (stream->get_bits (channel2_samplelength));
***************
*** 246,252 ****
}
! bool SubbandLayer1Stereo::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *filter2)
{
SubbandLayer1::put_next_sample (channels, filter1, filter2);
--- 246,252 ----
}
! boolean SubbandLayer1Stereo::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *filter2)
{
SubbandLayer1::put_next_sample (channels, filter1, filter2);

View file

@ -0,0 +1,20 @@
--- crc.cc.orig Thu Nov 21 16:44:18 2002
+++ crc.cc Thu Nov 21 16:44:30 2002
@@ -18,7 +18,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <iostream.h>
+#include <iostream>
#include <stdlib.h>
#include "crc.h"
@@ -32,7 +32,7 @@
#ifdef DEBUG
if (!length)
{
- cerr << "Length of bitstring has to be > 0 in Crc16::add_bits()!\n";
+ std::cerr << "Length of bitstring has to be > 0 in Crc16::add_bits()!\n";
exit (1);
}
#endif

View file

@ -0,0 +1,101 @@
--- header.cc.orig Thu Jun 23 22:14:35 1994
+++ header.cc Thu Nov 21 16:42:47 2002
@@ -20,15 +20,15 @@
/*
* Changes from version 1.1 to 1.2:
- * - iostreams manipulator calls like "cerr << setw (2) << ..." replaced by
- * "cerr.width (2); ..." due to problems with older GNU C++ releases.
+ * - iostreams manipulator calls like "std::cerr << setw (2) << ..." replaced by
+ * "std::cerr.width (2); ..." due to problems with older GNU C++ releases.
* - syncword recognition slightly changed
*/
#include <sys/types.h>
#include <unistd.h>
-#include <iostream.h>
-#include <iomanip.h>
+#include <iostream>
+#include <iomanip>
#include <stdlib.h>
#include "header.h"
@@ -36,7 +36,7 @@
const uint32 Header::frequencies[3] = { 44100, 48000, 32000 };
-bool Header::read_header (Ibitstream *stream, Crc16 **crcp)
+boolean Header::read_header (Ibitstream *stream, Crc16 **crcp)
{
uint32 headerstring;
@@ -45,41 +45,41 @@
if ((headerstring & 0xFFF80000) != 0xFFF80000)
{
- cerr << "invalid syncword 0x";
- cerr.width (8);
- cerr.fill ('0');
- cerr << hex << headerstring
- << " found at fileoffset " << dec
+ std::cerr << "invalid syncword 0x";
+ std::cerr.width (8);
+ std::cerr.fill ('0');
+ std::cerr << std::hex << headerstring
+ << " found at fileoffset " << std::dec
<< lseek (stream->filedescriptor (), 0, SEEK_CUR) - 4 << '\n';
return False;
}
if ((h_layer = (headerstring >> 17) & 3) == 0)
{
- cerr << "unknown layer identifier found!\n";
+ std::cerr << "unknown layer identifier found!\n";
exit (1);
}
h_layer = 4 - h_layer; // now 1 means Layer I and 3 means Layer III
if (h_layer == 3)
{
- cerr << "Sorry, Layer III not implemented!\n";
+ std::cerr << "Sorry, Layer III not implemented!\n";
exit (1);
}
h_protection_bit = (headerstring >> 16) & 1;
if ((h_bitrate_index = (headerstring >> 12) & 0xF) == 15)
{
- cerr << "unknown bitrate index found!\n";
+ std::cerr << "unknown bitrate index found!\n";
exit (1);
}
if (!h_bitrate_index)
{
- cerr << "free format not yet implemented!\n";
+ std::cerr << "free format not yet implemented!\n";
exit (1);
}
if ((h_sample_frequency = (e_sample_frequency)((headerstring >> 10) & 3)) == 3)
{
- cerr << "unknown sample frequency!\n";
+ std::cerr << "unknown sample frequency!\n";
exit (1);
}
h_padding_bit = (headerstring >> 9) & 1;
@@ -90,7 +90,7 @@
h_mode != single_channel) ||
(h_bitrate_index >= 11 && h_mode == single_channel))
{
- cerr << "illegal combination of mode and bitrate in a layer II stream:\n"
+ std::cerr << "illegal combination of mode and bitrate in a layer II stream:\n"
" mode: " << mode_string ()
<< "\n bitrate: " << bitrate_string () << '\n';
exit (1);
@@ -161,7 +161,7 @@
static const int32 bitrates_layer_2[15] = {
0 /*free format*/, 32000, 48000, 56000, 64000, 80000, 96000,
112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000 };
- static const samplefrequencies[3] = { 44100, 48000, 32000 };
+ static const int32 samplefrequencies[3] = { 44100, 48000, 32000 };
uint32 framesize;
if (h_layer == 1)

View file

@ -0,0 +1,81 @@
--- ibitstream.cc.orig Thu Jun 23 22:14:35 1994
+++ ibitstream.cc Thu Nov 21 16:41:11 2002
@@ -29,7 +29,7 @@
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
-#include <iostream.h>
+#include <iostream>
#include "all.h"
#include "ibitstream.h"
@@ -50,7 +50,7 @@
{
if ((fd = open (filename, O_RDONLY, 0)) < 0)
{
- cerr << "can't open file \"" << filename << "\" for reading!\n";
+ std::cerr << "can't open file \"" << filename << "\" for reading!\n";
exit (1);
}
wordpointer = buffer;
@@ -64,7 +64,7 @@
}
-bool Ibitstream::get_header (uint32 *headerstring)
+boolean Ibitstream::get_header (uint32 *headerstring)
{
int readvalue;
@@ -102,13 +102,13 @@
}
-bool Ibitstream::read_frame (uint32 bytesize)
+boolean Ibitstream::read_frame (uint32 bytesize)
{
int readvalue;
if (bytesize > (bufferintsize << 2))
{
- cerr << "Internal error: framelength > bufferlength?!\n";
+ std::cerr << "Internal error: framelength > bufferlength?!\n";
exit (1);
}
@@ -170,7 +170,7 @@
#ifdef DEBUG
if (number_of_bits < 1 || number_of_bits > 16)
{
- cerr << "illegal parameter in Ibitstream::get_bits() !\n";
+ std::cerr << "illegal parameter in Ibitstream::get_bits() !\n";
exit (1);
}
#endif
@@ -184,7 +184,7 @@
bitindex = 0;
if ((char *)++wordpointer > (char *)buffer + framesize)
{
- cerr << "Ibitstream::get_bits(): no more bits in buffer!\n";
+ std::cerr << "Ibitstream::get_bits(): no more bits in buffer!\n";
exit (1);
}
}
@@ -197,7 +197,7 @@
*(int16 *)&returnvalue = *((int16 *)wordpointer + 1);
if ((char *)++wordpointer > (char *)buffer + framesize)
{
- cerr << "Ibitstream::get_bits(): no more bits in buffer!\n";
+ std::cerr << "Ibitstream::get_bits(): no more bits in buffer!\n";
exit (1);
}
*((int16 *)&returnvalue + 1) = *(int16 *)wordpointer;
@@ -205,7 +205,7 @@
*((int16 *)&returnvalue + 1) = *(int16 *)wordpointer;
if ((char *)++wordpointer > (char *)buffer + framesize)
{
- cerr << "Ibitstream::get_bits(): no more bits in buffer!\n";
+ std::cerr << "Ibitstream::get_bits(): no more bits in buffer!\n";
exit (1);
}
*(int16 *)&returnvalue = *((int16 *)wordpointer + 1);

View file

@ -0,0 +1,216 @@
--- maplay.cc.orig Thu Jun 23 22:14:36 1994
+++ maplay.cc Thu Nov 21 16:40:21 2002
@@ -39,8 +39,8 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include <iostream.h>
-#include <iomanip.h>
+#include <iostream>
+#include <iomanip>
#include "all.h"
#include "crc.h"
#include "header.h"
@@ -51,17 +51,16 @@
#include "subband_layer_2.h"
#include "synthesis_filter.h"
-
// data extracted from commandline arguments:
static char *filename;
-static bool verbose_mode = False, filter_check = False;
-static bool stdout_mode = False;
+static boolean verbose_mode = False, filter_check = False;
+static boolean stdout_mode = False;
static enum e_channels which_channels = both;
-static bool use_speaker = False, use_headphone = False, use_line_out = False;
+static boolean use_speaker = False, use_headphone = False, use_line_out = False;
#ifdef ULAW
-static bool force_amd = False;
+static boolean force_amd = False;
#endif
-static bool use_own_scalefactor = False;
+static boolean use_own_scalefactor = False;
static real scalefactor;
// data extracted from header of first frame:
@@ -93,12 +92,12 @@
main (int argc, char *argv[])
{
int i;
- bool read_ready = False, write_ready = False;
+ boolean read_ready = False, write_ready = False;
if (argc < 2 || !strncmp (argv[1], "-h", 2))
{
usage:
- cerr << "\nusage: " << argv[0]
+ std::cerr << "\nusage: " << argv[0]
<< " [-v] [-s] [-l] [-r] "
#ifdef SPARC
"[-us] [-uh] "
@@ -146,6 +145,9 @@
#ifdef Solaris
"SPARC Solaris 2.x"
#else
+#ifdef __FreeBSD__
+ "FreeBSD"
+#else
#ifdef LINUX
"Linux"
#else
@@ -159,6 +161,7 @@
#endif
#endif
#endif
+#endif
" version)\n"
"@(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)\n"
"@(#) Berlin University of Technology\n"
@@ -216,7 +219,7 @@
case 'f':
if (++i == argc)
{
- cerr << "please specify a new scalefactor after the -f option!\n";
+ std::cerr << "please specify a new scalefactor after the -f option!\n";
exit (1);
}
use_own_scalefactor = True;
@@ -243,7 +246,7 @@
header = new Header;
if (!header->read_header (stream, &crc))
{
- cerr << "no header found!\n";
+ std::cerr << "no header found!\n";
Exit (1);
}
@@ -328,7 +331,7 @@
// }
//#else
{
- cerr << "Sorry, I don't know your audio device.\n"
+ std::cerr << "Sorry, I don't know your audio device.\n"
"Please use the stdout mode.\n";
Exit (0);
}
@@ -345,22 +348,22 @@
++name;
else
name = filename;
- cerr << name << " is a layer " << header->layer_string () << ' '
+ std::cerr << name << " is a layer " << header->layer_string () << ' '
<< header->mode_string () << " MPEG audio stream with";
if (!header->checksums ())
- cerr << "out";
- cerr << " checksums.\nThe sample frequency is "
+ std::cerr << "out";
+ std::cerr << " checksums.\nThe sample frequency is "
<< header->sample_frequency_string () << " at a bitrate of "
<< header->bitrate_string () << ".\n"
"This stream is ";
if (header->original ())
- cerr << "an original";
+ std::cerr << "an original";
else
- cerr << "a copy";
- cerr << " and is ";
+ std::cerr << "a copy";
+ std::cerr << " and is ";
if (!header->copyright ())
- cerr << "not ";
- cerr << "copyright protected.\n";
+ std::cerr << "not ";
+ std::cerr << "copyright protected.\n";
}
do
@@ -371,20 +374,20 @@
{
// layer switching is allowed
if (verbose_mode)
- cerr << "switching to layer " << header->layer_string () << ".\n";
+ std::cerr << "switching to layer " << header->layer_string () << ".\n";
layer = header->layer ();
}
if ((mode == single_channel && header->mode () != single_channel) ||
(mode != single_channel && header->mode () == single_channel))
{
// switching from single channel to stereo or vice versa is not allowed
- cerr << "illegal switch from single channel to stereo or vice versa!\n";
+ std::cerr << "illegal switch from single channel to stereo or vice versa!\n";
Exit (1);
}
if (header->sample_frequency () != sample_frequency)
{
// switching the sample frequency is not allowed
- cerr << "sorry, can't switch the sample frequency in the middle of the stream!\n";
+ std::cerr << "sorry, can't switch the sample frequency in the middle of the stream!\n";
Exit (1);
}
@@ -423,7 +426,7 @@
}
else
{
- cerr << "sorry, layer 3 not implemented!\n";
+ std::cerr << "sorry, layer 3 not implemented!\n";
Exit (0);
}
@@ -463,7 +466,7 @@
}
else
// Sh*t! Wrong crc checksum in frame!
- cerr << "WARNING: frame contains wrong crc checksum! (throwing frame away)\n";
+ std::cerr << "WARNING: frame contains wrong crc checksum! (throwing frame away)\n";
for (i = 0; i < header->number_of_subbands (); ++i)
delete subbands[i];
@@ -481,18 +484,18 @@
// check whether (one of) the filter(s) produced values not in [-1.0, 1.0]:
if (range_violations)
{
- cerr << range_violations << " range violations have occured!\n";
+ std::cerr << range_violations << " range violations have occured!\n";
if (stdout_mode)
- cerr << "If you notice these violations,\n";
+ std::cerr << "If you notice these violations,\n";
else
- cerr << "If you have noticed these violations,\n";
- cerr << "please use the -f option with the value ";
+ std::cerr << "If you have noticed these violations,\n";
+ std::cerr << "please use the -f option with the value ";
if (mode != single_channel && which_channels == both &&
filter2->hardest_violation () > filter1->hardest_violation ())
- cerr << filter2->recommended_scalefactor ();
+ std::cerr << filter2->recommended_scalefactor ();
else
- cerr << filter1->recommended_scalefactor ();
- cerr << "\nor a greater value up to 32768 and try again.\n";
+ std::cerr << filter1->recommended_scalefactor ();
+ std::cerr << "\nor a greater value up to 32768 and try again.\n";
}
}
if (verbose_mode)
@@ -502,13 +505,13 @@
uint32 minutes = (uint32)(playtime / 60.0);
uint32 seconds = (uint32)playtime - minutes * 60;
uint32 centiseconds = (uint32)((playtime - (real)(minutes * 60) - (real)seconds) * 100.0);
- cerr << "end of stream, playtime: " << minutes << ':';
- cerr.width (2);
- cerr.fill ('0');
- cerr << seconds << '.';
- cerr.width (2);
- cerr.fill ('0');
- cerr << centiseconds << '\n';
+ std::cerr << "end of stream, playtime: " << minutes << ':';
+ std::cerr.width (2);
+ std::cerr.fill ('0');
+ std::cerr << seconds << '.';
+ std::cerr.width (2);
+ std::cerr.fill ('0');
+ std::cerr << centiseconds << '\n';
}
return 0;

View file

@ -0,0 +1,297 @@
--- obuffer.cc.orig Mon Jun 27 21:14:03 1994
+++ obuffer.cc Thu Nov 21 16:45:14 2002
@@ -47,7 +47,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <iostream.h>
+#include <iostream>
#include "obuffer.h"
#include "header.h"
#ifdef ULAW
@@ -65,14 +65,14 @@
#ifdef DEBUG
if (!number_of_channels || number_of_channels > MAXCHANNELS)
{
- cerr << "FileObuffer: number of channels has to be in [1, " << MAXCHANNELS << "] !\n";
+ std::cerr << "FileObuffer: number of channels has to be in [1, " << MAXCHANNELS << "] !\n";
exit (1);
}
#endif
#ifdef ULAW
if (number_of_channels > 1)
- cerr << "Are you sure you need stereo u-law output?\n";
+ std::cerr << "Are you sure you need stereo u-law output?\n";
#endif
channels = number_of_channels;
for (int i = 0; i < number_of_channels; ++i)
@@ -85,12 +85,12 @@
#ifdef DEBUG
if (channel >= channels)
{
- cerr << "illegal channelnumber in FileObuffer::append()!\n";
+ std::cerr << "illegal channelnumber in FileObuffer::append()!\n";
exit (1);
}
if (bufferp[channel] - buffer >= OBUFFERSIZE)
{
- cerr << "FileObuffer: buffer overflow!\n";
+ std::cerr << "FileObuffer: buffer overflow!\n";
exit (1);
}
#endif
@@ -143,7 +143,7 @@
#ifdef DEBUG
if (!number_of_channels || number_of_channels > MAXCHANNELS)
{
- cerr << "IndigoObuffer: number of channels has to be in [1, " << MAXCHANNELS << "] !\n";
+ std::cerr << "IndigoObuffer: number of channels has to be in [1, " << MAXCHANNELS << "] !\n";
exit (1);
}
#endif
@@ -155,7 +155,7 @@
ALconfig config;
if (!(config = ALnewconfig ()))
{
- cerr << "ALnewconfig failed!\n";
+ std::cerr << "ALnewconfig failed!\n";
exit (1);
}
ALsetwidth (config, AL_SAMPLE_16);
@@ -165,7 +165,7 @@
ALsetchannels (config, AL_STEREO);
if (!(port = ALopenport ("MPEG audio player", "w", config)))
{
- cerr << "can't allocate an audio port!\n";
+ std::cerr << "can't allocate an audio port!\n";
exit (1);
}
@@ -190,12 +190,12 @@
#ifdef DEBUG
if (channel >= channels)
{
- cerr << "illegal channelnumber in IndigoObuffer::append()!\n";
+ std::cerr << "illegal channelnumber in IndigoObuffer::append()!\n";
exit (1);
}
if (bufferp[channel] - buffer >= OBUFFERSIZE)
{
- cerr << "IndigoObuffer: buffer overflow!\n";
+ std::cerr << "IndigoObuffer: buffer overflow!\n";
exit (1);
}
#endif
@@ -217,17 +217,17 @@
int SparcObuffer::audio_fd = -1;
#ifdef ULAW
-SparcObuffer::SparcObuffer (Header *header, bool use_speaker, bool use_headphone, bool use_line_out)
+SparcObuffer::SparcObuffer (Header *header, boolean use_speaker, boolean use_headphone, boolean use_line_out)
#else
SparcObuffer::SparcObuffer (uint32 number_of_channels, Header *header,
- bool use_speaker, bool use_headphone, bool use_line_out)
+ boolean use_speaker, boolean use_headphone, boolean use_line_out)
#endif
{
#ifndef ULAW
#ifdef DEBUG
if (!number_of_channels || number_of_channels > MAXCHANNELS)
{
- cerr << "SparcObuffer: 0 < number of channels < " << MAXCHANNELS << "!\n";
+ std::cerr << "SparcObuffer: 0 < number of channels < " << MAXCHANNELS << "!\n";
exit (1);
}
#endif
@@ -235,7 +235,7 @@
if (audio_fd < 0)
{
- cerr << "Internal error: SparcObuffer::audio_fd has to be initialized\n"
+ std::cerr << "Internal error: SparcObuffer::audio_fd has to be initialized\n"
"by SparcObuffer::class_suitable()!\n";
exit (1);
}
@@ -296,7 +296,7 @@
#ifdef DEBUG
if (bufferp - buffer >= OBUFFERSIZE >> 1)
{
- cerr << "SparcObuffer: buffer overflow!\n";
+ std::cerr << "SparcObuffer: buffer overflow!\n";
exit (1);
}
#endif
@@ -307,12 +307,12 @@
#ifdef DEBUG
if (channel >= channels)
{
- cerr << "illegal channelnumber in SparcObuffer::append()!\n";
+ std::cerr << "illegal channelnumber in SparcObuffer::append()!\n";
exit (1);
}
if (bufferp[channel] - buffer >= OBUFFERSIZE)
{
- cerr << "SparcObuffer: buffer overflow!\n";
+ std::cerr << "SparcObuffer: buffer overflow!\n";
exit (1);
}
#endif
@@ -351,7 +351,7 @@
if ((fd = open ("/dev/audio", O_WRONLY | O_NDELAY, 0)) < 0)
if (errno == EBUSY)
{
- cerr << "Sorry, the audio device is busy!\n";
+ std::cerr << "Sorry, the audio device is busy!\n";
exit (1);
}
else
@@ -398,7 +398,7 @@
}
return devtype;
#else
- cerr << "SparcObuffer::get_device_type(): AUDIO_GETDEV ioctl not available!\n";
+ std::cerr << "SparcObuffer::get_device_type(): AUDIO_GETDEV ioctl not available!\n";
return -1;
#endif
}
@@ -406,15 +406,15 @@
#ifdef ULAW
-bool SparcObuffer::class_suitable (uint32 number_of_channels, bool force_amd)
+boolean SparcObuffer::class_suitable (uint32 number_of_channels, boolean force_amd)
#else
-bool SparcObuffer::class_suitable (void)
+boolean SparcObuffer::class_suitable (void)
#endif
{
#ifdef ULAW
if (number_of_channels > 1)
{
- cerr << "Your audio hardware cannot handle more than one audio channel.\n"
+ std::cerr << "Your audio hardware cannot handle more than one audio channel.\n"
"Please use the option -l or -r for stereo streams.\n";
return False;
}
@@ -436,7 +436,7 @@
return True;
else if (!strcmp (devtype.name, "SUNW,dbri"))
{
- cerr << "Your machine can produce CD-quality audio output,\n"
+ std::cerr << "Your machine can produce CD-quality audio output,\n"
"but this binary was compiled for 8 kHz u-law ouput. (telephone quality)\n"
"Please recompile it without the ULAW define in COMPILERFLAGS.\n"
"(or use the -amd option to use this binary with low-quality output)\n";
@@ -448,7 +448,7 @@
return True;
else if (!strcmp (devtype.name, "SUNW,am79c30"))
{
- cerr << "Your machine can produce 8 kHz u-law audio output only,\n"
+ std::cerr << "Your machine can produce 8 kHz u-law audio output only,\n"
"but this binary was compiled for CD-quality output.\n"
"Please recompile it with ULAW defined in COMPILERFLAGS\n"
"or use it in stdout mode as an decoder only.\n";
@@ -464,7 +464,7 @@
# ifdef ULAW
return True;
# else
- cerr << "Your machine can produce 8 kHz u-law audio output only,\n"
+ std::cerr << "Your machine can produce 8 kHz u-law audio output only,\n"
"but this binary was compiled for CD-quality output.\n"
"Please recompile it with ULAW defined in COMPILERFLAGS\n"
"or use it in stdout mode as an decoder only.\n";
@@ -479,7 +479,7 @@
return True;
else if (device_type == AUDIO_DEV_SPEAKERBOX)
{
- cerr << "Your machine can produce CD-quality audio output,\n"
+ std::cerr << "Your machine can produce CD-quality audio output,\n"
"but this binary was compiled for 8 kHz u-law ouput. (telephone quality)\n"
"Please recompile it without the ULAW define in COMPILERFLAGS.\n"
"(or use the -amd option to use this binary with low-quality output)\n";
@@ -491,7 +491,7 @@
return True;
else if (device_type == AUDIO_DEV_AMD)
{
- cerr << "Your machine can produce 8 kHz u-law audio output only,\n"
+ std::cerr << "Your machine can produce 8 kHz u-law audio output only,\n"
"but this binary was compiled for CD-quality output.\n"
"Please recompile it with ULAW defined in COMPILERFLAGS\n"
"or use it in stdout mode as an decoder only.\n";
@@ -504,7 +504,7 @@
#ifndef SunOS4_1_1
close (audio_fd);
- cerr << "Sorry, I don't recognize your audio device.\n"
+ std::cerr << "Sorry, I don't recognize your audio device.\n"
# ifdef ULAW
"Please try the -amd option or use the stdout mode.\n";
# else
@@ -527,7 +527,7 @@
if ((fd = open ("/dev/dsp", O_WRONLY | O_NDELAY, 0)) < 0)
if (errno == EBUSY)
{
- cerr << "Sorry, the audio device is busy!\n";
+ std::cerr << "Sorry, the audio device is busy!\n";
exit (1);
}
else
@@ -537,6 +537,7 @@
}
// turn NDELAY mode off:
+#ifndef __FreeBSD__ /* Our /dev/audio doesn't like non-blocking I/O */
int flags;
if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
{
@@ -549,6 +550,7 @@
perror ("fcntl F_SETFL on /dev/audio failed");
exit (1);
}
+#endif
return fd;
}
@@ -558,7 +560,7 @@
#ifdef DEBUG
if (!number_of_channels || number_of_channels > MAXCHANNELS)
{
- cerr << "LinuxObuffer: 0 < number of channels < " << MAXCHANNELS << "!\n";
+ std::cerr << "LinuxObuffer: 0 < number of channels < " << MAXCHANNELS << "!\n";
exit (1);
}
#endif
@@ -568,7 +570,7 @@
if (audio_fd < 0)
{
- cerr << "Internal error, LinuxObuffer::audio_fd has to be initialized\n"
+ std::cerr << "Internal error, LinuxObuffer::audio_fd has to be initialized\n"
"by LinuxObuffer::class_suitable()!\n";
exit (1);
}
@@ -602,12 +604,12 @@
#ifdef DEBUG
if (channel >= channels)
{
- cerr << "illegal channelnumber in LinuxObuffer::append()!\n";
+ std::cerr << "illegal channelnumber in LinuxObuffer::append()!\n";
exit (1);
}
if (bufferp[channel] - buffer >= OBUFFERSIZE)
{
- cerr << "buffer overflow!\n";
+ std::cerr << "buffer overflow!\n";
exit (1);
}
#endif
@@ -629,7 +631,7 @@
}
-bool LinuxObuffer::class_suitable (uint32 number_of_channels)
+boolean LinuxObuffer::class_suitable (uint32 number_of_channels)
{
// open the dsp audio device:
audio_fd = open_audio_device ();

View file

@ -0,0 +1,45 @@
--- obuffer.h.orig Thu Jun 23 22:14:40 1994
+++ obuffer.h Thu Nov 21 16:35:11 2002
@@ -27,7 +27,7 @@
#ifndef OBUFFER_H
#define OBUFFER_H
-#include <iostream.h>
+#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include "all.h"
@@ -123,20 +123,20 @@
public:
#ifdef ULAW
- SparcObuffer (Header *, bool use_speaker, bool use_headphone, bool use_line_out);
+ SparcObuffer (Header *, boolean use_speaker, boolean use_headphone, boolean use_line_out);
#else
SparcObuffer (uint32 number_of_channels, Header *,
- bool use_speaker, bool use_headphone, bool use_line_out);
+ boolean use_speaker, boolean use_headphone, boolean use_line_out);
#endif
~SparcObuffer (void);
void append (uint32 channel, int16 value);
void write_buffer (int dummy);
#ifdef ULAW
- static bool class_suitable (uint32 number_of_channels, bool force_amd);
+ static boolean class_suitable (uint32 number_of_channels, boolean force_amd);
// returnvalue == False: no u-law output possible (class unsuitable)
#else
- static bool class_suitable (void);
+ static boolean class_suitable (void);
// returnvalue == False: no 16-bit output possible (class unsuitable)
#endif
};
@@ -159,7 +159,7 @@
void append (uint32 channel, int16 value);
void write_buffer (int dummy);
- static bool class_suitable (uint32 number_of_channels);
+ static boolean class_suitable (uint32 number_of_channels);
};
#endif // LINUX

View file

@ -0,0 +1,127 @@
--- subband_layer_1.cc.orig Thu Jun 23 22:14:36 1994
+++ subband_layer_1.cc Thu Nov 21 16:43:38 2002
@@ -67,7 +67,7 @@
void SubbandLayer1::read_allocation (Ibitstream *stream, Header *, Crc16 *crc)
{
if ((allocation = stream->get_bits (4)) == 15)
- cerr << "WARNING: stream contains an illegal allocation!\n"; // MPEG-stream is corrupted!
+ std::cerr << "WARNING: stream contains an illegal allocation!\n"; // MPEG-stream is corrupted!
if (crc)
crc->add_bits (allocation, 4);
if (allocation)
@@ -86,14 +86,14 @@
}
-bool SubbandLayer1::read_sampledata (Ibitstream *stream)
+boolean SubbandLayer1::read_sampledata (Ibitstream *stream)
{
if (allocation)
{
sample = real (stream->get_bits (samplelength));
#ifdef DEBUG
if (sample == (1 << samplelength) - 1)
- cerr << "WARNING: stream contains an illegal subband sample!\n"; // MPEG-stream is corrupted!
+ std::cerr << "WARNING: stream contains an illegal subband sample!\n"; // MPEG-stream is corrupted!
#endif
}
if (++samplenumber == 12)
@@ -105,7 +105,7 @@
}
-bool SubbandLayer1::put_next_sample (e_channels channels,
+boolean SubbandLayer1::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *)
{
if (allocation && channels != right)
@@ -113,7 +113,7 @@
register real scaled_sample = (sample * factor + offset) * scalefactor;
#ifdef DEBUG
if (scaled_sample < -1.0 || scaled_sample > 1.0)
- cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
+ std::cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
// this should never occur
#endif
filter1->input_sample (scaled_sample, subbandnumber);
@@ -142,7 +142,7 @@
}
-bool SubbandLayer1IntensityStereo::put_next_sample (e_channels channels,
+boolean SubbandLayer1IntensityStereo::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *filter2)
{
if (allocation)
@@ -154,7 +154,7 @@
sample2 = sample * channel2_scalefactor;
#ifdef DEBUG
if (sample1 < -1.0 || sample1 > 1.0 || sample2 < -1.0 || sample2 > 1.0)
- cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
+ std::cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
// this should never occur
#endif
filter1->input_sample (sample1, subbandnumber);
@@ -165,7 +165,7 @@
register real sample1 = sample * scalefactor;
#ifdef DEBUG
if (sample1 < -1.0 || sample1 > 1.0)
- cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
+ std::cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
// this should never occur
#endif
filter1->input_sample (sample1, subbandnumber);
@@ -175,7 +175,7 @@
register real sample2 = sample * channel2_scalefactor;
#ifdef DEBUG
if (sample2 < -1.0 || sample2 > 1.0)
- cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
+ std::cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
// this should never occur
#endif
filter1->input_sample (sample2, subbandnumber);
@@ -206,7 +206,7 @@
crc->add_bits (channel2_allocation, 4);
}
if (allocation == 15 || channel2_allocation == 15)
- cerr << "WARNING: stream contains an illegal allocation!\n"; // MPEG-stream is corrupted!
+ std::cerr << "WARNING: stream contains an illegal allocation!\n"; // MPEG-stream is corrupted!
if (allocation)
{
samplelength = allocation + 1;
@@ -231,22 +231,22 @@
}
-bool SubbandLayer1Stereo::read_sampledata (Ibitstream *stream)
+boolean SubbandLayer1Stereo::read_sampledata (Ibitstream *stream)
{
- bool returnvalue = SubbandLayer1::read_sampledata (stream);
+ boolean returnvalue = SubbandLayer1::read_sampledata (stream);
if (channel2_allocation)
{
channel2_sample = real (stream->get_bits (channel2_samplelength));
#ifdef DEBUG
if (channel2_sample == (1 << channel2_samplelength) - 1)
- cerr << "WARNING: stream contains an illegal subband sample!\n"; // MPEG-stream is corrupted!
+ std::cerr << "WARNING: stream contains an illegal subband sample!\n"; // MPEG-stream is corrupted!
#endif
}
return returnvalue;
}
-bool SubbandLayer1Stereo::put_next_sample (e_channels channels,
+boolean SubbandLayer1Stereo::put_next_sample (e_channels channels,
SynthesisFilter *filter1, SynthesisFilter *filter2)
{
SubbandLayer1::put_next_sample (channels, filter1, filter2);
@@ -256,7 +256,7 @@
channel2_scalefactor;
#ifdef DEBUG
if (sample2 < -1.0 || sample2 > 1.0)
- cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
+ std::cerr << "WARNING: rescaled subband sample is not in [-1.0, 1.0]\n";
// this should never occur
#endif
if (channels == both)

View file

@ -0,0 +1,11 @@
--- synthesis_filter.h.orig Thu Nov 21 16:36:03 2002
+++ synthesis_filter.h Thu Nov 21 16:36:10 2002
@@ -21,7 +21,7 @@
#ifndef SYNTHESIS_FILTER_H
#define SYNTHESIS_FILTER_H
-#include <iostream.h>
+#include <iostream>
#include "all.h"
#include "obuffer.h"