Skip to content

Commit

Permalink
convert all DOS line endings to Unix style (CRLF->LF)
Browse files Browse the repository at this point in the history
Curiously many files were already using Unix line endings, including main.{c,h}.
Mixing different line-endings in source files in the same project may lead to
issues, or at least very noisy patches, specially when dealing with Git.

This unifies all source files to use Unix line endings. MS Windows developers
can configure their Git settings to automatically convert EOL format back
and forth when commiting and checking out files using core.eol = native and
core.autocrlf = true, which is already the default on Windows Git installs.
  • Loading branch information
MestreLion committed Jul 4, 2020
1 parent ee5e0f9 commit 17033cc
Show file tree
Hide file tree
Showing 12 changed files with 4,190 additions and 4,190 deletions.
3,066 changes: 1,533 additions & 1,533 deletions audio.c

Large diffs are not rendered by default.

356 changes: 178 additions & 178 deletions audio.h
Original file line number Diff line number Diff line change
@@ -1,178 +1,178 @@
/* WaveGain - Filename: AUDIO.H
*
* Copyright (c) 2002 - 2005 John Edwards <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Portions Copyright 2000-2002, Michael Smith <[email protected]>
*
* AIFF/AIFC support from OggSquish, (c) 1994-1996 Monty <[email protected]>
*/


#ifndef AUDIO_H_INCLUDED
#define AUDIO_H_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include "misc.h"

/* In WIN32, the following bitmap can be found in sdk\inc\ksmedia.h and sdk\inc\mmreg.h: */

#ifndef SPEAKER_FRONT_LEFT
# define SPEAKER_FRONT_LEFT 0x1
# define SPEAKER_FRONT_RIGHT 0x2
#endif

#ifndef WAVE_FORMAT_PCM
# define WAVE_FORMAT_PCM 0x0001
#endif
#ifndef WAVE_FORMAT_IEEE_FLOAT
# define WAVE_FORMAT_IEEE_FLOAT 0x0003
#endif
#ifndef WAVE_FORMAT_EXTENSIBLE
# define WAVE_FORMAT_EXTENSIBLE 0xfffe
#endif

typedef long (*audio_read_func)(void *src,
double **buffer,
int samples,
int fast,
int chunk);

typedef struct
{
audio_read_func read_samples;

void *readdata;

unsigned long total_samples_per_channel;
int channels;
long rate;
int samplesize;
int endianness;
int format;
int gain_chunk;
double gain_scale;
int std_in;
int std_out;
int apply_gain;
int write_chunk;
int force;
int undo;
int header_size;
unsigned char *header;

FILE *out;
char *filename;
} wavegain_opt;

typedef struct
{
int (*id_func)(unsigned char *buf, int len); /* Returns true if can load file */
int id_data_len; /* Amount of data needed to id whether this can load the file */
int (*open_func)(FILE *in, wavegain_opt *opt, unsigned char *buf, int buflen);
void (*close_func)(void *);
char *format;
char *description;
} input_format;


typedef struct {
unsigned short format;
unsigned short channels;
unsigned int channel_mask;
unsigned int samplerate;
unsigned int bytespersec;
unsigned short align;
unsigned short samplesize;
} wav_fmt;

typedef struct {
short channels;
short samplesize;
unsigned long totalsamples;
unsigned long samplesread;
FILE *f;
short bigendian;
} wavfile;

typedef struct {
short channels;
unsigned long totalframes;
short samplesize;
int rate;
int offset;
int blocksize;
} aiff_fmt;

typedef wavfile aifffile; /* They're the same */

input_format *open_audio_file(FILE *in, wavegain_opt *opt);

int raw_open(FILE *in, wavegain_opt *opt);
int wav_open(FILE *in, wavegain_opt *opt, unsigned char *buf, int buflen);
int aiff_open(FILE *in, wavegain_opt *opt, unsigned char *buf, int buflen);
int wav_id(unsigned char *buf, int len);
int aiff_id(unsigned char *buf, int len);
void wav_close(void *);
void raw_close(void *);

long wav_read(void *, double **buffer, int samples, int fast, int chunk);
long wav_ieee_read(void *, double **buffer, int samples, int fast, int chunk);

enum file_formats {
WAV_NO_FMT = 0,
WAV_FMT_8BIT,
WAV_FMT_16BIT,
WAV_FMT_24BIT,
WAV_FMT_32BIT,
WAV_FMT_FLOAT,
WAV_FMT_AIFF,
WAV_FMT_AIFC8,
WAV_FMT_AIFC16
};

typedef struct
{
int outputFormat;
FILE *sndfile;
unsigned long samplerate;
unsigned long bits_per_sample;
unsigned long channels;
unsigned long samples;
int endianness;
int format;
} audio_file;

audio_file *open_output_audio_file(char *infile, wavegain_opt *opt);
int write_audio_file(audio_file *aufile, void *sample_buffer, int samples);
void close_audio_file(FILE *in, audio_file *aufile, wavegain_opt *opt);
int write_wav_header(audio_file *aufile, wavegain_opt *opt, Int64_t file_size);
int write_aiff_header(audio_file *aufile);
int write_audio_8bit(audio_file *aufile, void *sample_buffer, unsigned int samples);
int write_audio_16bit(audio_file *aufile, void *sample_buffer, unsigned int samples);
int write_audio_24bit(audio_file *aufile, void *sample_buffer, unsigned int samples);
int write_audio_32bit(audio_file *aufile, void *sample_buffer, unsigned int samples);
int write_audio_float(audio_file *aufile, void *sample_buffer, unsigned int samples);
void* output_to_PCM(double **input, void *samplebuffer, int channels, int samples, int format);

#ifdef __cplusplus
}
#endif
#endif /* AUDIO_H_INCLUDED */
/* WaveGain - Filename: AUDIO.H
*
* Copyright (c) 2002 - 2005 John Edwards <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Portions Copyright 2000-2002, Michael Smith <[email protected]>
*
* AIFF/AIFC support from OggSquish, (c) 1994-1996 Monty <[email protected]>
*/


#ifndef AUDIO_H_INCLUDED
#define AUDIO_H_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include "misc.h"

/* In WIN32, the following bitmap can be found in sdk\inc\ksmedia.h and sdk\inc\mmreg.h: */

#ifndef SPEAKER_FRONT_LEFT
# define SPEAKER_FRONT_LEFT 0x1
# define SPEAKER_FRONT_RIGHT 0x2
#endif

#ifndef WAVE_FORMAT_PCM
# define WAVE_FORMAT_PCM 0x0001
#endif
#ifndef WAVE_FORMAT_IEEE_FLOAT
# define WAVE_FORMAT_IEEE_FLOAT 0x0003
#endif
#ifndef WAVE_FORMAT_EXTENSIBLE
# define WAVE_FORMAT_EXTENSIBLE 0xfffe
#endif

typedef long (*audio_read_func)(void *src,
double **buffer,
int samples,
int fast,
int chunk);

typedef struct
{
audio_read_func read_samples;

void *readdata;

unsigned long total_samples_per_channel;
int channels;
long rate;
int samplesize;
int endianness;
int format;
int gain_chunk;
double gain_scale;
int std_in;
int std_out;
int apply_gain;
int write_chunk;
int force;
int undo;
int header_size;
unsigned char *header;

FILE *out;
char *filename;
} wavegain_opt;

typedef struct
{
int (*id_func)(unsigned char *buf, int len); /* Returns true if can load file */
int id_data_len; /* Amount of data needed to id whether this can load the file */
int (*open_func)(FILE *in, wavegain_opt *opt, unsigned char *buf, int buflen);
void (*close_func)(void *);
char *format;
char *description;
} input_format;


typedef struct {
unsigned short format;
unsigned short channels;
unsigned int channel_mask;
unsigned int samplerate;
unsigned int bytespersec;
unsigned short align;
unsigned short samplesize;
} wav_fmt;

typedef struct {
short channels;
short samplesize;
unsigned long totalsamples;
unsigned long samplesread;
FILE *f;
short bigendian;
} wavfile;

typedef struct {
short channels;
unsigned long totalframes;
short samplesize;
int rate;
int offset;
int blocksize;
} aiff_fmt;

typedef wavfile aifffile; /* They're the same */

input_format *open_audio_file(FILE *in, wavegain_opt *opt);

int raw_open(FILE *in, wavegain_opt *opt);
int wav_open(FILE *in, wavegain_opt *opt, unsigned char *buf, int buflen);
int aiff_open(FILE *in, wavegain_opt *opt, unsigned char *buf, int buflen);
int wav_id(unsigned char *buf, int len);
int aiff_id(unsigned char *buf, int len);
void wav_close(void *);
void raw_close(void *);

long wav_read(void *, double **buffer, int samples, int fast, int chunk);
long wav_ieee_read(void *, double **buffer, int samples, int fast, int chunk);

enum file_formats {
WAV_NO_FMT = 0,
WAV_FMT_8BIT,
WAV_FMT_16BIT,
WAV_FMT_24BIT,
WAV_FMT_32BIT,
WAV_FMT_FLOAT,
WAV_FMT_AIFF,
WAV_FMT_AIFC8,
WAV_FMT_AIFC16
};

typedef struct
{
int outputFormat;
FILE *sndfile;
unsigned long samplerate;
unsigned long bits_per_sample;
unsigned long channels;
unsigned long samples;
int endianness;
int format;
} audio_file;

audio_file *open_output_audio_file(char *infile, wavegain_opt *opt);
int write_audio_file(audio_file *aufile, void *sample_buffer, int samples);
void close_audio_file(FILE *in, audio_file *aufile, wavegain_opt *opt);
int write_wav_header(audio_file *aufile, wavegain_opt *opt, Int64_t file_size);
int write_aiff_header(audio_file *aufile);
int write_audio_8bit(audio_file *aufile, void *sample_buffer, unsigned int samples);
int write_audio_16bit(audio_file *aufile, void *sample_buffer, unsigned int samples);
int write_audio_24bit(audio_file *aufile, void *sample_buffer, unsigned int samples);
int write_audio_32bit(audio_file *aufile, void *sample_buffer, unsigned int samples);
int write_audio_float(audio_file *aufile, void *sample_buffer, unsigned int samples);
void* output_to_PCM(double **input, void *samplebuffer, int channels, int samples, int format);

#ifdef __cplusplus
}
#endif
#endif /* AUDIO_H_INCLUDED */
Loading

0 comments on commit 17033cc

Please sign in to comment.