Compare commits

..

No commits in common. "3a1f81dd598bbf206b61613424eefb357ea22555" and "221ee718dc90d2c4f651c795b5a89dfcbc4ae3bf" have entirely different histories.

12 changed files with 2686 additions and 190 deletions

2
.gitignore vendored
View file

@ -1,4 +1,2 @@
libs/
.DS_Store
.build/
libaudio-test

View file

@ -1,34 +0,0 @@
SRCS := AudioLib/main.c
INCLUDES := -Iaudio/include
BUILDDIR = .build
TARGET := libaudio-test
OBJS := $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o, $(SRCS)))
CC = gcc
AR = ar
PKGCONFIG = pkg-config
CFLAGS = --std=gnu99 -Wall
all: $(TARGET)
$(TARGET): $(OBJS) | audiolib
$(CC) `$(PKGCONFIG) --libs ao` -Laudio/.build/ -Laudio/.build/libmad -Laudio/.build/speexdsp -o $(TARGET) $(OBJS) -laudio -lmad -lspeexresampler -lm
audiolib:
(cd audio; make)
$(BUILDDIR)/%.o: %.c
$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
$(OBJS): | $(BUILDDIR)
$(BUILDDIR):
mkdir -p $(BUILDDIR)/AudioLib
.PHONY: clean
clean:
-rm $(OBJS)
-rm $(TARGET)
(cd audio; make clean)

View file

@ -1,48 +0,0 @@
SRCS := \
audio.c \
audio_internal.c \
audio_source_file.c \
audio_source_testtone.c \
audio_demuxer_mp3.c \
audio_decoder_mp3.c \
audio_filter_param_eq.c \
audio_filter_resample.c \
audio_sink_file.c \
audio_sink_libao.c
INCLUDES := -Iinclude
BUILDDIR = .build
TARGET := $(BUILDDIR)/libaudio.a
OBJS := $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o, $(SRCS)))
CC = gcc
AR = ar
CFLAGS = --std=gnu99 -Wall
all: $(TARGET) $(BUILDDIR)/libmad/libmad.a $(BUILDDIR)/speexdsp/libspeexresampler.a
$(TARGET): $(OBJS)
$(AR) -cr $(TARGET) $(OBJS)
$(BUILDDIR)/libmad/libmad.a:
(cd deps/mp3; make BUILDDIR=$(abspath $(BUILDDIR)/libmad))
$(BUILDDIR)/speexdsp/libspeexresampler.a:
(cd deps/resampler; make BUILDDIR=$(abspath $(BUILDDIR)/speexdsp))
$(BUILDDIR)/%.o: %.c include/%.h
$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
$(OBJS): | $(BUILDDIR)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
.PHONY: clean
clean:
-rm $(OBJS)
-rm $(TARGET)
(cd deps/mp3; make BUILDDIR=$(abspath $(BUILDDIR)/libmad) clean)
(cd deps/resampler; make BUILDDIR=$(abspath $(BUILDDIR)/speexdsp) clean)

View file

@ -195,10 +195,10 @@ static BiQuad biquad_initialize(EQBand band, uint32_t sampleRate) {
#else
static BiQuad biquad_initialize(EQBand band, uint32_t sampleRate) {
BiQuad b;
double b0 = 0, b1 = 0, b2 = 0, a1 = 0, a2 = 0;
double b0, b1, b2, a1, a2;
double Fc = band.frequency / sampleRate;
double norm = 0;
double norm;
double V = pow(10, fabs(band.gain) / 20.0);
double K = tan(M_PI * Fc);

View file

@ -24,9 +24,7 @@ AudioPipelineStatus sink_file_link(AudioPipelineElement *self, AudioPipelineElem
if (context->fp != NULL) {
fseek(context->fp, 0, SEEK_SET);
if (ftruncate(fileno(context->fp), 0) != 0) {
fprintf(stderr, "WARN: ftruncate failed with %d\n", errno);
}
ftruncate(fileno(context->fp), 0);
}
source->next = self;

View file

@ -1,39 +0,0 @@
SRCS := \
bit.c \
fixed.c \
frame.c \
huffman.c \
layer3.c \
layer12.c \
stream.c \
synth.c \
timer.c \
version.c
BUILDDIR = .build
TARGET := $(BUILDDIR)/libmad.a
OBJS := $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o, $(SRCS)))
CC = gcc
AR = ar
CFLAGS = --std=gnu99 -Wall
all: $(TARGET)
$(TARGET): $(OBJS)
$(AR) -cr $(TARGET) $(OBJS)
$(BUILDDIR)/%.o: %.c %.h config.h
$(CC) $(CFLAGS) -c $< -o $@
$(OBJS): | $(BUILDDIR)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
.PHONY: clean
clean:
-rm $(OBJS)
-rm $(TARGET)

View file

@ -314,6 +314,7 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) {
stream->sync = 1;
}
sync:
/* synchronize */
if (stream->sync) {
if (end - ptr < MAD_BUFFER_GUARD) {
@ -380,6 +381,27 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) {
header->frame_size_bytes = N - 4;
stream->next_frame = stream->this_frame + N;
#if 0
/* verify there is enough data left in buffer to decode this frame */
if (N + MAD_BUFFER_GUARD > end - stream->this_frame) {
stream->next_frame = stream->this_frame;
stream->error = MAD_ERROR_BUFLEN;
goto fail;
}
if (!stream->sync) {
/* check that a valid frame header follows this frame */
ptr = stream->next_frame;
if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
ptr = stream->next_frame = stream->this_frame + 1;
goto sync;
}
stream->sync = 1;
}
#endif
header->flags |= MAD_FLAG_INCOMPLETE;
return 0;

View file

@ -1566,7 +1566,7 @@ static void III_aliasreduce(mad_fixed_t xr[576], int lines)
void III_imdct_l(mad_fixed_t const[18], mad_fixed_t[36], unsigned int);
#else
#if 1
static void fastsdct(mad_fixed_t const x[9], mad_fixed_t y[17]) {
static void fastsdct(mad_fixed_t const x[9], mad_fixed_t y[18]) {
mad_fixed_t a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12;
mad_fixed_t a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25;
mad_fixed_t m0, m1, m2, m3, m4, m5, m6, m7;

File diff suppressed because it is too large Load diff

View file

@ -1,28 +0,0 @@
SRCS := resample.c
BUILDDIR = .build
TARGET := $(BUILDDIR)/libspeexresampler.a
OBJS := $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o, $(SRCS)))
CC = gcc
AR = ar
CFLAGS = --std=gnu99 -Wall
all: $(TARGET)
$(TARGET): $(OBJS)
$(AR) -cr $(TARGET) $(OBJS)
$(BUILDDIR)/%.o: %.c config.h
$(CC) $(CFLAGS) -c $< -o $@
$(OBJS): | $(BUILDDIR)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
.PHONY: clean
clean:
-rm $(OBJS)
-rm $(TARGET)

View file

@ -1,25 +1,11 @@
#if defined(__x86_64__)
# undef ARM4_ASM
# undef ARM5E_ASM
# undef USE_NEON
#elif defined(__arm__)
# if defined(__ARM_NEON) || defined(__ARM_NEON__) || defined(__ARM_FEATURE_SIMD32)
/* Enable NEON support */
# undef ARM4_ASM
# undef ARM5E_ASM
# define USE_NEON /**/
# elif defined(__ARM_ARCH_4__)
/* Make use of ARM4 assembly optimizations */
# define ARM4_ASM /**/
# undef ARM5E_ASM
# undef USE_NEON
# elif defined(__ARM_ARCH_5E__)
/* Make use of ARM5E assembly optimizations */
#undef ARM4_ASM
# define ARM5E_ASM /**/
# undef USE_NEON
# endif
#endif
/* Make use of ARM5E assembly optimizations */
#undef ARM5E_ASM
/* Enable NEON support */
#define USE_NEON /**/
/* Symbol visibility prefix */
#define EXPORT __attribute__((visibility("default")))

View file

@ -1,11 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [
libao
pkg-config
gcc
file
];
shellHook = ''
'';
}