Compare commits
8 commits
221ee718dc
...
3a1f81dd59
Author | SHA1 | Date | |
---|---|---|---|
3a1f81dd59 | |||
66373cc64e | |||
035c1c2c75 | |||
851a6f0e57 | |||
b86eb3c83e | |||
64b65f0ade | |||
516d087ee0 | |||
7a10c2e69f |
12 changed files with 190 additions and 2686 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
libs/
|
||||
.DS_Store
|
||||
.build/
|
||||
libaudio-test
|
||||
|
|
34
Makefile
Normal file
34
Makefile
Normal file
|
@ -0,0 +1,34 @@
|
|||
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)
|
48
audio/Makefile
Normal file
48
audio/Makefile
Normal file
|
@ -0,0 +1,48 @@
|
|||
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)
|
|
@ -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, b1, b2, a1, a2;
|
||||
double b0 = 0, b1 = 0, b2 = 0, a1 = 0, a2 = 0;
|
||||
double Fc = band.frequency / sampleRate;
|
||||
|
||||
double norm;
|
||||
double norm = 0;
|
||||
double V = pow(10, fabs(band.gain) / 20.0);
|
||||
double K = tan(M_PI * Fc);
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ AudioPipelineStatus sink_file_link(AudioPipelineElement *self, AudioPipelineElem
|
|||
|
||||
if (context->fp != NULL) {
|
||||
fseek(context->fp, 0, SEEK_SET);
|
||||
ftruncate(fileno(context->fp), 0);
|
||||
if (ftruncate(fileno(context->fp), 0) != 0) {
|
||||
fprintf(stderr, "WARN: ftruncate failed with %d\n", errno);
|
||||
}
|
||||
}
|
||||
|
||||
source->next = self;
|
||||
|
|
39
audio/deps/mp3/Makefile
Normal file
39
audio/deps/mp3/Makefile
Normal file
|
@ -0,0 +1,39 @@
|
|||
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)
|
|
@ -314,7 +314,6 @@ 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) {
|
||||
|
@ -381,27 +380,6 @@ sync:
|
|||
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;
|
||||
|
|
|
@ -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[18]) {
|
||||
static void fastsdct(mad_fixed_t const x[9], mad_fixed_t y[17]) {
|
||||
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
28
audio/deps/resampler/Makefile
Normal file
28
audio/deps/resampler/Makefile
Normal file
|
@ -0,0 +1,28 @@
|
|||
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)
|
|
@ -1,11 +1,25 @@
|
|||
/* Make use of ARM4 assembly optimizations */
|
||||
#if defined(__x86_64__)
|
||||
# undef ARM4_ASM
|
||||
|
||||
/* Make use of ARM5E assembly optimizations */
|
||||
# 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
|
||||
|
||||
/* Symbol visibility prefix */
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
|
|
11
shell.nix
Normal file
11
shell.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs.buildPackages; [
|
||||
libao
|
||||
pkg-config
|
||||
gcc
|
||||
file
|
||||
];
|
||||
shellHook = ''
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue