ref: 20603b91e326cac50b0021649af73a2a06c3ba13
parent: fff250a95553eda37d81f3d80ef3db2adab33de0
author: robs <robs>
date: Sun Sep 13 05:52:56 EDT 2009
bit-rot reorg
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,7 +30,7 @@
LibSoX interface changes:
o Added new variants of sox_open to allow read/write from/to memory
- buffers (in POSIX 200x environment); see example5.c (robs)
+ buffers (in POSIX 2008 environment); see example5.c (robs)
File formats:
@@ -67,7 +67,8 @@
Internal improvements:
- None.
+ o Move bit-rot detection support files to sub-directory (had
+ been causing some build problems). (robs)
sox-14.3.0 2009-06-14
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -57,6 +57,7 @@
# Uncomment for bit-rot detection on linux
#set(formats_srcs ${formats_srcs} coreaudio sndio sunaudio waveaudio)
+#add_definitions(-Isrc/bit-rot)
add_library(lib${PROJECT_NAME}
effects formats_i libsox_i
--- a/src/CoreAudio/CoreAudio.h
+++ /dev/null
@@ -1,264 +1,0 @@
-#ifndef HAVE_COREAUDIO
-/*
- * SoX bit-rot detection file; cobbled together
- */
-
-enum {
- kAudioHardwarePropertyProcessIsMaster,
- kAudioHardwarePropertyIsInitingOrExiting,
- kAudioHardwarePropertyDevices,
- kAudioHardwarePropertyDefaultInputDevice,
- kAudioHardwarePropertyDefaultOutputDevice,
- kAudioHardwarePropertyDefaultSystemOutputDevice,
- kAudioHardwarePropertyDeviceForUID,
- kAudioHardwarePropertySleepingIsAllowed,
- kAudioHardwarePropertyUnloadingIsAllowed,
- kAudioHardwarePropertyHogModeIsAllowed,
- kAudioHardwarePropertyRunLoop,
- kAudioHardwarePropertyPlugInForBundleID
-};
-
-enum {
- kAudioObjectPropertyClass,
- kAudioObjectPropertyOwner,
- kAudioObjectPropertyCreator,
- kAudioObjectPropertyName,
- kAudioObjectPropertyManufacturer,
- kAudioObjectPropertyElementName,
- kAudioObjectPropertyElementCategoryName,
- kAudioObjectPropertyElementNumberName,
- kAudioObjectPropertyOwnedObjects,
- kAudioObjectPropertyListenerAdded,
- kAudioObjectPropertyListenerRemoved
-};
-
-enum {
- kAudioDevicePropertyDeviceName,
- kAudioDevicePropertyDeviceNameCFString = kAudioObjectPropertyName,
- kAudioDevicePropertyDeviceManufacturer,
- kAudioDevicePropertyDeviceManufacturerCFString =
- kAudioObjectPropertyManufacturer,
- kAudioDevicePropertyRegisterBufferList,
- kAudioDevicePropertyBufferSize,
- kAudioDevicePropertyBufferSizeRange,
- kAudioDevicePropertyChannelName,
- kAudioDevicePropertyChannelNameCFString = kAudioObjectPropertyElementName,
- kAudioDevicePropertyChannelCategoryName,
- kAudioDevicePropertyChannelCategoryNameCFString =
- kAudioObjectPropertyElementCategoryName,
- kAudioDevicePropertyChannelNumberName,
- kAudioDevicePropertyChannelNumberNameCFString =
- kAudioObjectPropertyElementNumberName,
- kAudioDevicePropertySupportsMixing,
- kAudioDevicePropertyStreamFormat,
- kAudioDevicePropertyStreamFormats,
- kAudioDevicePropertyStreamFormatSupported,
- kAudioDevicePropertyStreamFormatMatch,
- kAudioDevicePropertyDataSourceNameForID,
- kAudioDevicePropertyClockSourceNameForID,
- kAudioDevicePropertyPlayThruDestinationNameForID,
- kAudioDevicePropertyChannelNominalLineLevelNameForID
-};
-
-enum {
- kAudioDevicePropertyPlugIn,
- kAudioDevicePropertyConfigurationApplication,
- kAudioDevicePropertyDeviceUID,
- kAudioDevicePropertyModelUID,
- kAudioDevicePropertyTransportType,
- kAudioDevicePropertyRelatedDevices,
- kAudioDevicePropertyClockDomain,
- kAudioDevicePropertyDeviceIsAlive,
- kAudioDevicePropertyDeviceHasChanged,
- kAudioDevicePropertyDeviceIsRunning,
- kAudioDevicePropertyDeviceIsRunningSomewhere,
- kAudioDevicePropertyDeviceCanBeDefaultDevice,
- kAudioDevicePropertyDeviceCanBeDefaultSystemDevice,
- kAudioDeviceProcessorOverload,
- kAudioDevicePropertyHogMode,
- kAudioDevicePropertyLatency,
- kAudioDevicePropertyBufferFrameSize,
- kAudioDevicePropertyBufferFrameSizeRange,
- kAudioDevicePropertyUsesVariableBufferFrameSizes,
- kAudioDevicePropertyStreams,
- kAudioDevicePropertySafetyOffset,
- kAudioDevicePropertyIOCycleUsage,
- kAudioDevicePropertyStreamConfiguration,
- kAudioDevicePropertyIOProcStreamUsage,
- kAudioDevicePropertyPreferredChannelsForStereo,
- kAudioDevicePropertyPreferredChannelLayout,
- kAudioDevicePropertyNominalSampleRate,
- kAudioDevicePropertyAvailableNominalSampleRates,
- kAudioDevicePropertyActualSampleRate
-};
-
-enum {
- kAudioFormatLinearPCM,
- kAudioFormatAC3,
- kAudioFormat60958AC3,
- kAudioFormatAppleIMA4,
- kAudioFormatMPEG4AAC,
- kAudioFormatMPEG4CELP,
- kAudioFormatMPEG4HVXC,
- kAudioFormatMPEG4TwinVQ,
- kAudioFormatMACE3,
- kAudioFormatMACE6,
- kAudioFormatULaw,
- kAudioFormatALaw,
- kAudioFormatQDesign,
- kAudioFormatQDesign2,
- kAudioFormatQUALCOMM,
- kAudioFormatMPEGLayer1,
- kAudioFormatMPEGLayer2,
- kAudioFormatMPEGLayer3,
- kAudioFormatDVAudio,
- kAudioFormatVariableDurationDVAudio,
- kAudioFormatTimeCode,
- kAudioFormatMIDIStream,
- kAudioFormatParameterValueStream,
- kAudioFormatAppleLossless
-};
-
-enum {
- kAudioFormatFlagIsFloat = (1L << 0),
- kAudioFormatFlagIsBigEndian = (1L << 1),
- kAudioFormatFlagIsSignedInteger = (1L << 2),
- kAudioFormatFlagIsPacked = (1L << 3),
- kAudioFormatFlagIsAlignedHigh = (1L << 4),
- kAudioFormatFlagIsNonInterleaved = (1L << 5),
- kAudioFormatFlagIsNonMixable = (1L << 6),
-
- kLinearPCMFormatFlagIsFloat = kAudioFormatFlagIsFloat,
- kLinearPCMFormatFlagIsBigEndian = kAudioFormatFlagIsBigEndian,
- kLinearPCMFormatFlagIsSignedInteger = kAudioFormatFlagIsSignedInteger,
- kLinearPCMFormatFlagIsPacked = kAudioFormatFlagIsPacked,
- kLinearPCMFormatFlagIsAlignedHigh = kAudioFormatFlagIsAlignedHigh,
- kLinearPCMFormatFlagIsNonInterleaved = kAudioFormatFlagIsNonInterleaved,
- kLinearPCMFormatFlagIsNonMixable = kAudioFormatFlagIsNonMixable,
-
- kAppleLosslessFormatFlag_16BitSourceData = 1,
- kAppleLosslessFormatFlag_20BitSourceData = 2,
- kAppleLosslessFormatFlag_24BitSourceData = 3,
- kAppleLosslessFormatFlag_32BitSourceData = 4
-};
-
-enum {
- kAudioFormatFlagsNativeEndian = kAudioFormatFlagIsBigEndian,
- kAudioFormatFlagsNativeFloatPacked =
- kAudioFormatFlagIsFloat | kAudioFormatFlagsNativeEndian |
- kAudioFormatFlagIsPacked
-};
-
-enum {
- kAudioDeviceUnknown
-};
-
-enum {
- kVariableLengthArray = 1
-};
-
-enum {
- kAudioHardwareNoError = 0
-};
-
-typedef double Float64;
-typedef float Float32;
-typedef int SInt32;
-typedef int Boolean;
-typedef int OSErr;
-typedef short SInt16;
-typedef unsigned int UInt32;
-typedef unsigned long int UInt64;
-
-typedef SInt32 OSStatus;
-typedef UInt32 AudioObjectID;
-typedef UInt32 AudioHardwarePropertyID;
-typedef UInt32 AudioDevicePropertyID;
-typedef AudioObjectID AudioDeviceID;
-
-struct AudioStreamBasicDescription {
- Float64 mSampleRate;
- UInt32 mFormatID;
- UInt32 mFormatFlags;
- UInt32 mBytesPerPacket;
- UInt32 mFramesPerPacket;
- UInt32 mBytesPerFrame;
- UInt32 mChannelsPerFrame;
- UInt32 mBitsPerChannel;
- UInt32 mReserved;
-};
-typedef struct AudioStreamBasicDescription AudioStreamBasicDescription;
-
-
-
-struct SMPTETime {
- SInt16 mSubframes;
- SInt16 mSubframeDivisor;
- UInt32 mCounter;
- UInt32 mType;
- UInt32 mFlags;
- SInt16 mHours;
- SInt16 mMinutes;
- SInt16 mSeconds;
- SInt16 mFrames;
-};
-typedef struct SMPTETime SMPTETime;
-
-struct AudioTimeStamp {
- Float64 mSampleTime;
- UInt64 mHostTime;
- Float64 mRateScalar;
- UInt64 mWordClockTime;
- SMPTETime mSMPTETime;
- UInt32 mFlags;
- UInt32 mReserved;
-};
-typedef struct AudioTimeStamp AudioTimeStamp;
-
-struct AudioBuffer {
- UInt32 mNumberChannels;
- UInt32 mDataByteSize;
- void *mData;
-};
-typedef struct AudioBuffer AudioBuffer;
-
-struct AudioBufferList {
- UInt32 mNumberBuffers;
- AudioBuffer mBuffers[kVariableLengthArray];
-};
-typedef struct AudioBufferList AudioBufferList;
-
-typedef OSStatus(*AudioDeviceIOProc) (AudioDeviceID inDevice,
- const AudioTimeStamp * inNow,
- const AudioBufferList * inInputData,
- const AudioTimeStamp * inInputTime,
- AudioBufferList * outOutputData,
- const AudioTimeStamp * inOutputTime,
- void *inClientData);
-
-
-
-OSStatus AudioHardwareGetProperty(AudioHardwarePropertyID inPropertyID,
- UInt32 * ioPropertyDataSize,
- void *outPropertyData);
-
-OSStatus AudioDeviceSetProperty(AudioDeviceID inDevice,
- const AudioTimeStamp * inWhen,
- UInt32 inChannel, Boolean isInput,
- AudioDevicePropertyID inPropertyID,
- UInt32 inPropertyDataSize,
- const void *inPropertyData);
-OSStatus AudioDeviceGetProperty(AudioDeviceID inDevice, UInt32 inChannel,
- Boolean isInput,
- AudioDevicePropertyID inPropertyID,
- UInt32 * ioPropertyDataSize,
- void *outPropertyData);
-
-
-OSStatus AudioDeviceAddIOProc(AudioDeviceID inDevice,
- AudioDeviceIOProc inProc, void *inClientData);
-OSStatus AudioDeviceStart(AudioDeviceID inDevice, AudioDeviceIOProc inProc);
-
-
-OSStatus AudioDeviceStop(AudioDeviceID inDevice, AudioDeviceIOProc inProc);
-#endif
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,7 +100,8 @@
#########################
# Uncomment for bit-rot detection on linux
-#libsox_la_SOURCES += coreaudio.c sndio.c sunaudio.c
+libsox_la_SOURCES += coreaudio.c sndio.c sunaudio.c
+libsox_la_CFLAGS += -Ibit-rot
libsox_la_SOURCES += raw-fmt.c s1-fmt.c s2-fmt.c s3-fmt.c \
s4-fmt.c u1-fmt.c u2-fmt.c u3-fmt.c u4-fmt.c al-fmt.c la-fmt.c ul-fmt.c \
--- /dev/null
+++ b/src/bit-rot/CoreAudio/CoreAudio.h
@@ -1,0 +1,264 @@
+#ifndef HAVE_COREAUDIO
+/*
+ * SoX bit-rot detection file; cobbled together
+ */
+
+enum {
+ kAudioHardwarePropertyProcessIsMaster,
+ kAudioHardwarePropertyIsInitingOrExiting,
+ kAudioHardwarePropertyDevices,
+ kAudioHardwarePropertyDefaultInputDevice,
+ kAudioHardwarePropertyDefaultOutputDevice,
+ kAudioHardwarePropertyDefaultSystemOutputDevice,
+ kAudioHardwarePropertyDeviceForUID,
+ kAudioHardwarePropertySleepingIsAllowed,
+ kAudioHardwarePropertyUnloadingIsAllowed,
+ kAudioHardwarePropertyHogModeIsAllowed,
+ kAudioHardwarePropertyRunLoop,
+ kAudioHardwarePropertyPlugInForBundleID
+};
+
+enum {
+ kAudioObjectPropertyClass,
+ kAudioObjectPropertyOwner,
+ kAudioObjectPropertyCreator,
+ kAudioObjectPropertyName,
+ kAudioObjectPropertyManufacturer,
+ kAudioObjectPropertyElementName,
+ kAudioObjectPropertyElementCategoryName,
+ kAudioObjectPropertyElementNumberName,
+ kAudioObjectPropertyOwnedObjects,
+ kAudioObjectPropertyListenerAdded,
+ kAudioObjectPropertyListenerRemoved
+};
+
+enum {
+ kAudioDevicePropertyDeviceName,
+ kAudioDevicePropertyDeviceNameCFString = kAudioObjectPropertyName,
+ kAudioDevicePropertyDeviceManufacturer,
+ kAudioDevicePropertyDeviceManufacturerCFString =
+ kAudioObjectPropertyManufacturer,
+ kAudioDevicePropertyRegisterBufferList,
+ kAudioDevicePropertyBufferSize,
+ kAudioDevicePropertyBufferSizeRange,
+ kAudioDevicePropertyChannelName,
+ kAudioDevicePropertyChannelNameCFString = kAudioObjectPropertyElementName,
+ kAudioDevicePropertyChannelCategoryName,
+ kAudioDevicePropertyChannelCategoryNameCFString =
+ kAudioObjectPropertyElementCategoryName,
+ kAudioDevicePropertyChannelNumberName,
+ kAudioDevicePropertyChannelNumberNameCFString =
+ kAudioObjectPropertyElementNumberName,
+ kAudioDevicePropertySupportsMixing,
+ kAudioDevicePropertyStreamFormat,
+ kAudioDevicePropertyStreamFormats,
+ kAudioDevicePropertyStreamFormatSupported,
+ kAudioDevicePropertyStreamFormatMatch,
+ kAudioDevicePropertyDataSourceNameForID,
+ kAudioDevicePropertyClockSourceNameForID,
+ kAudioDevicePropertyPlayThruDestinationNameForID,
+ kAudioDevicePropertyChannelNominalLineLevelNameForID
+};
+
+enum {
+ kAudioDevicePropertyPlugIn,
+ kAudioDevicePropertyConfigurationApplication,
+ kAudioDevicePropertyDeviceUID,
+ kAudioDevicePropertyModelUID,
+ kAudioDevicePropertyTransportType,
+ kAudioDevicePropertyRelatedDevices,
+ kAudioDevicePropertyClockDomain,
+ kAudioDevicePropertyDeviceIsAlive,
+ kAudioDevicePropertyDeviceHasChanged,
+ kAudioDevicePropertyDeviceIsRunning,
+ kAudioDevicePropertyDeviceIsRunningSomewhere,
+ kAudioDevicePropertyDeviceCanBeDefaultDevice,
+ kAudioDevicePropertyDeviceCanBeDefaultSystemDevice,
+ kAudioDeviceProcessorOverload,
+ kAudioDevicePropertyHogMode,
+ kAudioDevicePropertyLatency,
+ kAudioDevicePropertyBufferFrameSize,
+ kAudioDevicePropertyBufferFrameSizeRange,
+ kAudioDevicePropertyUsesVariableBufferFrameSizes,
+ kAudioDevicePropertyStreams,
+ kAudioDevicePropertySafetyOffset,
+ kAudioDevicePropertyIOCycleUsage,
+ kAudioDevicePropertyStreamConfiguration,
+ kAudioDevicePropertyIOProcStreamUsage,
+ kAudioDevicePropertyPreferredChannelsForStereo,
+ kAudioDevicePropertyPreferredChannelLayout,
+ kAudioDevicePropertyNominalSampleRate,
+ kAudioDevicePropertyAvailableNominalSampleRates,
+ kAudioDevicePropertyActualSampleRate
+};
+
+enum {
+ kAudioFormatLinearPCM,
+ kAudioFormatAC3,
+ kAudioFormat60958AC3,
+ kAudioFormatAppleIMA4,
+ kAudioFormatMPEG4AAC,
+ kAudioFormatMPEG4CELP,
+ kAudioFormatMPEG4HVXC,
+ kAudioFormatMPEG4TwinVQ,
+ kAudioFormatMACE3,
+ kAudioFormatMACE6,
+ kAudioFormatULaw,
+ kAudioFormatALaw,
+ kAudioFormatQDesign,
+ kAudioFormatQDesign2,
+ kAudioFormatQUALCOMM,
+ kAudioFormatMPEGLayer1,
+ kAudioFormatMPEGLayer2,
+ kAudioFormatMPEGLayer3,
+ kAudioFormatDVAudio,
+ kAudioFormatVariableDurationDVAudio,
+ kAudioFormatTimeCode,
+ kAudioFormatMIDIStream,
+ kAudioFormatParameterValueStream,
+ kAudioFormatAppleLossless
+};
+
+enum {
+ kAudioFormatFlagIsFloat = (1L << 0),
+ kAudioFormatFlagIsBigEndian = (1L << 1),
+ kAudioFormatFlagIsSignedInteger = (1L << 2),
+ kAudioFormatFlagIsPacked = (1L << 3),
+ kAudioFormatFlagIsAlignedHigh = (1L << 4),
+ kAudioFormatFlagIsNonInterleaved = (1L << 5),
+ kAudioFormatFlagIsNonMixable = (1L << 6),
+
+ kLinearPCMFormatFlagIsFloat = kAudioFormatFlagIsFloat,
+ kLinearPCMFormatFlagIsBigEndian = kAudioFormatFlagIsBigEndian,
+ kLinearPCMFormatFlagIsSignedInteger = kAudioFormatFlagIsSignedInteger,
+ kLinearPCMFormatFlagIsPacked = kAudioFormatFlagIsPacked,
+ kLinearPCMFormatFlagIsAlignedHigh = kAudioFormatFlagIsAlignedHigh,
+ kLinearPCMFormatFlagIsNonInterleaved = kAudioFormatFlagIsNonInterleaved,
+ kLinearPCMFormatFlagIsNonMixable = kAudioFormatFlagIsNonMixable,
+
+ kAppleLosslessFormatFlag_16BitSourceData = 1,
+ kAppleLosslessFormatFlag_20BitSourceData = 2,
+ kAppleLosslessFormatFlag_24BitSourceData = 3,
+ kAppleLosslessFormatFlag_32BitSourceData = 4
+};
+
+enum {
+ kAudioFormatFlagsNativeEndian = kAudioFormatFlagIsBigEndian,
+ kAudioFormatFlagsNativeFloatPacked =
+ kAudioFormatFlagIsFloat | kAudioFormatFlagsNativeEndian |
+ kAudioFormatFlagIsPacked
+};
+
+enum {
+ kAudioDeviceUnknown
+};
+
+enum {
+ kVariableLengthArray = 1
+};
+
+enum {
+ kAudioHardwareNoError = 0
+};
+
+typedef double Float64;
+typedef float Float32;
+typedef int SInt32;
+typedef int Boolean;
+typedef int OSErr;
+typedef short SInt16;
+typedef unsigned int UInt32;
+typedef unsigned long int UInt64;
+
+typedef SInt32 OSStatus;
+typedef UInt32 AudioObjectID;
+typedef UInt32 AudioHardwarePropertyID;
+typedef UInt32 AudioDevicePropertyID;
+typedef AudioObjectID AudioDeviceID;
+
+struct AudioStreamBasicDescription {
+ Float64 mSampleRate;
+ UInt32 mFormatID;
+ UInt32 mFormatFlags;
+ UInt32 mBytesPerPacket;
+ UInt32 mFramesPerPacket;
+ UInt32 mBytesPerFrame;
+ UInt32 mChannelsPerFrame;
+ UInt32 mBitsPerChannel;
+ UInt32 mReserved;
+};
+typedef struct AudioStreamBasicDescription AudioStreamBasicDescription;
+
+
+
+struct SMPTETime {
+ SInt16 mSubframes;
+ SInt16 mSubframeDivisor;
+ UInt32 mCounter;
+ UInt32 mType;
+ UInt32 mFlags;
+ SInt16 mHours;
+ SInt16 mMinutes;
+ SInt16 mSeconds;
+ SInt16 mFrames;
+};
+typedef struct SMPTETime SMPTETime;
+
+struct AudioTimeStamp {
+ Float64 mSampleTime;
+ UInt64 mHostTime;
+ Float64 mRateScalar;
+ UInt64 mWordClockTime;
+ SMPTETime mSMPTETime;
+ UInt32 mFlags;
+ UInt32 mReserved;
+};
+typedef struct AudioTimeStamp AudioTimeStamp;
+
+struct AudioBuffer {
+ UInt32 mNumberChannels;
+ UInt32 mDataByteSize;
+ void *mData;
+};
+typedef struct AudioBuffer AudioBuffer;
+
+struct AudioBufferList {
+ UInt32 mNumberBuffers;
+ AudioBuffer mBuffers[kVariableLengthArray];
+};
+typedef struct AudioBufferList AudioBufferList;
+
+typedef OSStatus(*AudioDeviceIOProc) (AudioDeviceID inDevice,
+ const AudioTimeStamp * inNow,
+ const AudioBufferList * inInputData,
+ const AudioTimeStamp * inInputTime,
+ AudioBufferList * outOutputData,
+ const AudioTimeStamp * inOutputTime,
+ void *inClientData);
+
+
+
+OSStatus AudioHardwareGetProperty(AudioHardwarePropertyID inPropertyID,
+ UInt32 * ioPropertyDataSize,
+ void *outPropertyData);
+
+OSStatus AudioDeviceSetProperty(AudioDeviceID inDevice,
+ const AudioTimeStamp * inWhen,
+ UInt32 inChannel, Boolean isInput,
+ AudioDevicePropertyID inPropertyID,
+ UInt32 inPropertyDataSize,
+ const void *inPropertyData);
+OSStatus AudioDeviceGetProperty(AudioDeviceID inDevice, UInt32 inChannel,
+ Boolean isInput,
+ AudioDevicePropertyID inPropertyID,
+ UInt32 * ioPropertyDataSize,
+ void *outPropertyData);
+
+
+OSStatus AudioDeviceAddIOProc(AudioDeviceID inDevice,
+ AudioDeviceIOProc inProc, void *inClientData);
+OSStatus AudioDeviceStart(AudioDeviceID inDevice, AudioDeviceIOProc inProc);
+
+
+OSStatus AudioDeviceStop(AudioDeviceID inDevice, AudioDeviceIOProc inProc);
+#endif
--- /dev/null
+++ b/src/bit-rot/sndio.h
@@ -1,0 +1,160 @@
+#ifndef HAVE_SNDIO
+/*
+ * SoX bit-rot detection file, obtained from:
+ * http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libsndio/sndio.h
+ */
+#if defined __GNUC__
+ #pragma GCC system_header
+#endif
+
+/* $OpenBSD: sndio.h,v 1.7 2009/02/03 19:44:58 ratchov Exp $ */
+/*
+ * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifndef SNDIO_H
+#define SNDIO_H
+
+#include <sys/param.h>
+
+/*
+ * private ``handle'' structure
+ */
+struct sio_hdl;
+
+/*
+ * parameters of a full-duplex stream
+ */
+struct sio_par {
+ unsigned bits; /* bits per sample */
+ unsigned bps; /* bytes per sample */
+ unsigned sig; /* 1 = signed, 0 = unsigned */
+ unsigned le; /* 1 = LE, 0 = BE byte order */
+ unsigned msb; /* 1 = MSB, 0 = LSB aligned */
+ unsigned rchan; /* number channels for recording direction */
+ unsigned pchan; /* number channels for playback direction */
+ unsigned rate; /* frames per second */
+ unsigned bufsz; /* end-to-end buffer size */
+#define SIO_IGNORE 0 /* pause during xrun */
+#define SIO_SYNC 1 /* resync after xrun */
+#define SIO_ERROR 2 /* terminate on xrun */
+ unsigned xrun; /* what to do on overruns/underruns */
+ unsigned round; /* optimal bufsz divisor */
+ unsigned appbufsz; /* minimum buffer size */
+ int __pad[3]; /* for future use */
+ int __magic; /* for internal/debug purposes only */
+};
+
+/*
+ * capabilities of a stream
+ */
+struct sio_cap {
+#define SIO_NENC 8
+#define SIO_NCHAN 8
+#define SIO_NRATE 16
+#define SIO_NCONF 4
+ struct sio_enc { /* allowed sample encodings */
+ unsigned bits;
+ unsigned bps;
+ unsigned sig;
+ unsigned le;
+ unsigned msb;
+ } enc[SIO_NENC];
+ unsigned rchan[SIO_NCHAN]; /* allowed values for rchan */
+ unsigned pchan[SIO_NCHAN]; /* allowed values for pchan */
+ unsigned rate[SIO_NRATE]; /* allowed rates */
+ int __pad[7]; /* for future use */
+ unsigned nconf; /* number of elements in confs[] */
+ struct sio_conf {
+ unsigned enc; /* mask of enc[] indexes */
+ unsigned rchan; /* mask of chan[] indexes (rec) */
+ unsigned pchan; /* mask of chan[] indexes (play) */
+ unsigned rate; /* mask of rate[] indexes */
+ } confs[SIO_NCONF];
+};
+
+#define SIO_XSTRINGS { "ignore", "sync", "error" }
+
+/*
+ * mode bitmap
+ */
+#define SIO_PLAY 1
+#define SIO_REC 2
+
+/*
+ * maximum size of the encording string (the longest possible
+ * encoding is ``s24le3msb'')
+ */
+#define SIO_ENCMAX 10
+
+/*
+ * default bytes per sample for the given bits per sample
+ */
+#define SIO_BPS(bits) (((bits) <= 8) ? 1 : (((bits) <= 16) ? 2 : 4))
+
+/*
+ * default value of "sio_par->le" flag
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define SIO_LE_NATIVE 1
+#else
+#define SIO_LE_NATIVE 0
+#endif
+
+/*
+ * default device for the sun audio(4) back-end
+ */
+#define SIO_SUN_PATH "/dev/audio"
+
+/*
+ * default socket name for the aucat(1) back-end
+ */
+#define SIO_AUCAT_PATH "default"
+
+/*
+ * maximum value of volume, eg. for sio_setvol()
+ */
+#define SIO_MAXVOL 127
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int sio_strtoenc(struct sio_par *, char *);
+int sio_enctostr(struct sio_par *, char *);
+void sio_initpar(struct sio_par *);
+
+struct sio_hdl *sio_open(char *, unsigned, int);
+void sio_close(struct sio_hdl *);
+int sio_setpar(struct sio_hdl *, struct sio_par *);
+int sio_getpar(struct sio_hdl *, struct sio_par *);
+int sio_getcap(struct sio_hdl *, struct sio_cap *);
+void sio_onmove(struct sio_hdl *, void (*)(void *, int), void *);
+size_t sio_write(struct sio_hdl *, void *, size_t);
+size_t sio_read(struct sio_hdl *, void *, size_t);
+int sio_start(struct sio_hdl *);
+int sio_stop(struct sio_hdl *);
+int sio_nfds(struct sio_hdl *);
+int sio_pollfd(struct sio_hdl *, struct pollfd *, int);
+int sio_revents(struct sio_hdl *, struct pollfd *);
+int sio_eof(struct sio_hdl *);
+int sio_setvol(struct sio_hdl *, unsigned);
+void sio_onvol(struct sio_hdl *, void (*)(void *, unsigned), void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !defined(SNDIO_H) */
+#endif
--- /dev/null
+++ b/src/bit-rot/windows.h
@@ -1,0 +1,33 @@
+/*
+ * SoX bit-rot detection file; cobbled together
+ */
+
+#define BYTE uint8_t
+#define CHAR char
+#define DWORD_PTR DWORD *
+#define DWORD uint32_t
+#define HANDLE void *
+#define LPCSTR char *
+#define LPCVOID void *
+#define LPDWORD DWORD *
+#define LPSTR char const *
+#define UINT DWORD
+#define WCHAR int16_t
+#define WINAPI
+#define WIN_BOOL int
+#define WORD uint16_t
+
+enum {
+ FALSE,
+ TRUE,
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ INFINITE,
+ CALLBACK_EVENT
+};
+
+DWORD CloseHandle(HANDLE);
+DWORD FormatMessageA(DWORD,LPCVOID,DWORD,DWORD,LPSTR, DWORD,LPDWORD);
+DWORD GetLastError(void);
+DWORD WaitForSingleObject(HANDLE, DWORD);
+HANDLE CreateEventA(LPCVOID,WIN_BOOL,WIN_BOOL,LPCSTR);
--- a/src/mmsystem.h
+++ /dev/null
@@ -1,75 +1,0 @@
-/*
- * SoX bit-rot detection file; cobbled together
- */
-#define HWAVEIN HANDLE
-#define HWAVEOUT HANDLE
-#define MMRESULT UINT
-#define MMVERSION UINT
-
-enum {
- MMSYSERR_NOERROR,
- MAXPNAMELEN,
- WAVE_FORMAT_PCM,
- WAVE_MAPPER,
- WAVERR_STILLPLAYING,
- WHDR_DONE,
- WHDR_INQUEUE
-};
-
-typedef struct wavehdr_tag {
- LPSTR lpData;
- DWORD dwBufferLength;
- DWORD dwBytesRecorded;
- DWORD dwUser;
- DWORD dwFlags;
- DWORD dwLoops;
- struct wavehdr_tag *lpNext;
- DWORD reserved;
-} WAVEHDR,*PWAVEHDR,*LPWAVEHDR;
-
-typedef struct _WAVEFORMATEX {
- WORD wFormatTag;
- WORD nChannels;
- DWORD nSamplesPerSec;
- DWORD nAvgBytesPerSec;
- WORD nBlockAlign;
- WORD wBitsPerSample;
- WORD cbSize;
-} WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
-
-typedef struct tagWAVEINCAPSA {
- WORD wMid;
- WORD wPid;
- MMVERSION vDriverVersion;
- CHAR szPname[MAXPNAMELEN];
- DWORD dwFormats;
- WORD wChannels;
- WORD wReserved1;
-} WAVEINCAPSA,*PWAVEINCAPSA,*LPWAVEINCAPSA;
-
-typedef struct tagWAVEOUTCAPSA {
- WORD wMid;
- WORD wPid;
- MMVERSION vDriverVersion;
- CHAR szPname[MAXPNAMELEN];
- DWORD dwFormats;
- WORD wChannels;
- WORD wReserved1;
- DWORD dwSupport;
-} WAVEOUTCAPSA,*PWAVEOUTCAPSA,*LPWAVEOUTCAPSA;
-
-MMRESULT WINAPI waveInAddBuffer(HWAVEIN,LPWAVEHDR,UINT);
-MMRESULT WINAPI waveInClose(HWAVEIN);
-MMRESULT WINAPI waveInGetDevCapsA(UINT,LPWAVEINCAPSA,UINT);
-MMRESULT WINAPI waveInGetNumDevs(void);
-MMRESULT WINAPI waveInOpen(HWAVEIN*,UINT,WAVEFORMATEX*,DWORD*,DWORD*,DWORD);
-MMRESULT WINAPI waveInPrepareHeader(HWAVEIN,LPWAVEHDR,UINT);
-MMRESULT WINAPI waveInReset(HWAVEIN);
-MMRESULT WINAPI waveInStart(HWAVEIN);
-MMRESULT WINAPI waveOutClose(HWAVEOUT);
-MMRESULT WINAPI waveOutGetDevCapsA(UINT,LPWAVEOUTCAPSA,UINT);
-MMRESULT WINAPI waveOutGetNumDevs(void);
-MMRESULT WINAPI waveOutOpen(HWAVEOUT*,UINT,WAVEFORMATEX*,DWORD*,DWORD*,DWORD);
-MMRESULT WINAPI waveOutPrepareHeader(HWAVEOUT,LPWAVEHDR,UINT);
-MMRESULT WINAPI waveOutReset(HWAVEOUT);
-MMRESULT WINAPI waveOutWrite(HWAVEOUT,LPWAVEHDR,UINT);
--- a/src/sndio.h
+++ /dev/null
@@ -1,160 +1,0 @@
-#ifndef HAVE_SNDIO
-/*
- * SoX bit-rot detection file, obtained from:
- * http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libsndio/sndio.h
- */
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-/* $OpenBSD: sndio.h,v 1.7 2009/02/03 19:44:58 ratchov Exp $ */
-/*
- * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#ifndef SNDIO_H
-#define SNDIO_H
-
-#include <sys/param.h>
-
-/*
- * private ``handle'' structure
- */
-struct sio_hdl;
-
-/*
- * parameters of a full-duplex stream
- */
-struct sio_par {
- unsigned bits; /* bits per sample */
- unsigned bps; /* bytes per sample */
- unsigned sig; /* 1 = signed, 0 = unsigned */
- unsigned le; /* 1 = LE, 0 = BE byte order */
- unsigned msb; /* 1 = MSB, 0 = LSB aligned */
- unsigned rchan; /* number channels for recording direction */
- unsigned pchan; /* number channels for playback direction */
- unsigned rate; /* frames per second */
- unsigned bufsz; /* end-to-end buffer size */
-#define SIO_IGNORE 0 /* pause during xrun */
-#define SIO_SYNC 1 /* resync after xrun */
-#define SIO_ERROR 2 /* terminate on xrun */
- unsigned xrun; /* what to do on overruns/underruns */
- unsigned round; /* optimal bufsz divisor */
- unsigned appbufsz; /* minimum buffer size */
- int __pad[3]; /* for future use */
- int __magic; /* for internal/debug purposes only */
-};
-
-/*
- * capabilities of a stream
- */
-struct sio_cap {
-#define SIO_NENC 8
-#define SIO_NCHAN 8
-#define SIO_NRATE 16
-#define SIO_NCONF 4
- struct sio_enc { /* allowed sample encodings */
- unsigned bits;
- unsigned bps;
- unsigned sig;
- unsigned le;
- unsigned msb;
- } enc[SIO_NENC];
- unsigned rchan[SIO_NCHAN]; /* allowed values for rchan */
- unsigned pchan[SIO_NCHAN]; /* allowed values for pchan */
- unsigned rate[SIO_NRATE]; /* allowed rates */
- int __pad[7]; /* for future use */
- unsigned nconf; /* number of elements in confs[] */
- struct sio_conf {
- unsigned enc; /* mask of enc[] indexes */
- unsigned rchan; /* mask of chan[] indexes (rec) */
- unsigned pchan; /* mask of chan[] indexes (play) */
- unsigned rate; /* mask of rate[] indexes */
- } confs[SIO_NCONF];
-};
-
-#define SIO_XSTRINGS { "ignore", "sync", "error" }
-
-/*
- * mode bitmap
- */
-#define SIO_PLAY 1
-#define SIO_REC 2
-
-/*
- * maximum size of the encording string (the longest possible
- * encoding is ``s24le3msb'')
- */
-#define SIO_ENCMAX 10
-
-/*
- * default bytes per sample for the given bits per sample
- */
-#define SIO_BPS(bits) (((bits) <= 8) ? 1 : (((bits) <= 16) ? 2 : 4))
-
-/*
- * default value of "sio_par->le" flag
- */
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define SIO_LE_NATIVE 1
-#else
-#define SIO_LE_NATIVE 0
-#endif
-
-/*
- * default device for the sun audio(4) back-end
- */
-#define SIO_SUN_PATH "/dev/audio"
-
-/*
- * default socket name for the aucat(1) back-end
- */
-#define SIO_AUCAT_PATH "default"
-
-/*
- * maximum value of volume, eg. for sio_setvol()
- */
-#define SIO_MAXVOL 127
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int sio_strtoenc(struct sio_par *, char *);
-int sio_enctostr(struct sio_par *, char *);
-void sio_initpar(struct sio_par *);
-
-struct sio_hdl *sio_open(char *, unsigned, int);
-void sio_close(struct sio_hdl *);
-int sio_setpar(struct sio_hdl *, struct sio_par *);
-int sio_getpar(struct sio_hdl *, struct sio_par *);
-int sio_getcap(struct sio_hdl *, struct sio_cap *);
-void sio_onmove(struct sio_hdl *, void (*)(void *, int), void *);
-size_t sio_write(struct sio_hdl *, void *, size_t);
-size_t sio_read(struct sio_hdl *, void *, size_t);
-int sio_start(struct sio_hdl *);
-int sio_stop(struct sio_hdl *);
-int sio_nfds(struct sio_hdl *);
-int sio_pollfd(struct sio_hdl *, struct pollfd *, int);
-int sio_revents(struct sio_hdl *, struct pollfd *);
-int sio_eof(struct sio_hdl *);
-int sio_setvol(struct sio_hdl *, unsigned);
-void sio_onvol(struct sio_hdl *, void (*)(void *, unsigned), void *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !defined(SNDIO_H) */
-#endif
--- a/src/windows.h
+++ /dev/null
@@ -1,33 +1,0 @@
-/*
- * SoX bit-rot detection file; cobbled together
- */
-
-#define BYTE uint8_t
-#define CHAR char
-#define DWORD_PTR DWORD *
-#define DWORD uint32_t
-#define HANDLE void *
-#define LPCSTR char *
-#define LPCVOID void *
-#define LPDWORD DWORD *
-#define LPSTR char const *
-#define UINT DWORD
-#define WCHAR int16_t
-#define WINAPI
-#define WIN_BOOL int
-#define WORD uint16_t
-
-enum {
- FALSE,
- TRUE,
- FORMAT_MESSAGE_FROM_SYSTEM,
- FORMAT_MESSAGE_IGNORE_INSERTS,
- INFINITE,
- CALLBACK_EVENT
-};
-
-DWORD CloseHandle(HANDLE);
-DWORD FormatMessageA(DWORD,LPCVOID,DWORD,DWORD,LPSTR, DWORD,LPDWORD);
-DWORD GetLastError(void);
-DWORD WaitForSingleObject(HANDLE, DWORD);
-HANDLE CreateEventA(LPCVOID,WIN_BOOL,WIN_BOOL,LPCSTR);