From 59ce2f441010a5d572fa5ca16fc28240cc2601fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kopy=C5=9Bci=C5=84ski?= Date: Tue, 27 Feb 2024 10:07:44 +0100 Subject: [PATCH] ext: add libsamplerate library Adds libsamplerate library that allows to resample audio streams to different samplerate. --- ext/libsamplerate/include/config.h | 44 +++++++++++++++++++++++ ext/libsamplerate/pkg.yml | 57 ++++++++++++++++++++++++++++++ ext/libsamplerate/syscfg.yml | 30 ++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 ext/libsamplerate/include/config.h create mode 100644 ext/libsamplerate/pkg.yml create mode 100644 ext/libsamplerate/syscfg.yml diff --git a/ext/libsamplerate/include/config.h b/ext/libsamplerate/include/config.h new file mode 100644 index 0000000000..756c57d18f --- /dev/null +++ b/ext/libsamplerate/include/config.h @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef H_LIBSAMPLERATE_CONFIG_ +#define H_LIBSAMPLERATE_CONFIG_ + +#include "syscfg/syscfg.h" + +#if MYNEWT_VAL(ENABLE_SINC_BEST_CONVERTER) +#define ENABLE_SINC_BEST_CONVERTER 1 +#endif + +#if MYNEWT_VAL(ENABLE_SINC_MEDIUM_CONVERTER) +#define ENABLE_SINC_MEDIUM_CONVERTER 1 +#endif + +#if MYNEWT_VAL(ENABLE_SINC_FAST_CONVERTER) +#define ENABLE_SINC_FAST_CONVERTER 1 +#endif + +#if MYNEWT_VAL(LIBSAMPLER_NDEBUG) +#define LIBSAMPLER_NDEBUG 1 +#endif + +#define PACKAGE "libsamplerate" +#define VERSION "0.2.2" + +#endif /* H_LIBSAMPLERATE_CONFIG_ */ diff --git a/ext/libsamplerate/pkg.yml b/ext/libsamplerate/pkg.yml new file mode 100644 index 0000000000..a42d0ea6c7 --- /dev/null +++ b/ext/libsamplerate/pkg.yml @@ -0,0 +1,57 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +pkg.name: ext/libsamplerate +pkg.description: samplerate library +pkg.author: "Apache Mynewt " +pkg.homepage: "http://mynewt.apache.org/" +pkg.keywords: + - samplerate + +pkg.type: sdk + +pkg.cflags: -DHAVE_STDBOOL_H -fsingle-precision-constant -DHAVE_CONFIG_H +pkg.cflags.ENABLE_SINC_BEST_CONVERTER: -DENABLE_SINC_BEST_CONVERTER +pkg.cflags.ENABLE_SINC_MEDIUM_CONVERTER: -DENABLE_SINC_MEDIUM_CONVERTER +pkg.cflags.ENABLE_SINC_FAST_CONVERTER: -DENABLE_SINC_FAST_CONVERTER +pkg.cflags.LIBSAMPLER_NDEBUG: -DNDEBUG +pkg.lflags: -lm + +pkg.ign_dirs: + - "@libsamplerate/Octave" + - "@libsamplerate/Win32" + - "@libsamplerate/cmake" + - "@libsamplerate/docs" + - "@libsamplerate/examples" + - "@libsamplerate/include" + - "@libsamplerate/m4" + - "@libsamplerate/tests" + +pkg.src_dirs: + - "@libsamplerate/src" + +pkg.include_dirs: + - "@libsamplerate/include" + +repository.libsamplerate: + type: github + vers: 0.2.2-commit + branch: release-0.2.2 + user: libsndfile + repo: libsamplerate diff --git a/ext/libsamplerate/syscfg.yml b/ext/libsamplerate/syscfg.yml new file mode 100644 index 0000000000..11232a69bb --- /dev/null +++ b/ext/libsamplerate/syscfg.yml @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +syscfg.defs: + ENABLE_SINC_BEST_CONVERTER: + description: Enable SINC best converter + value: 1 + ENABLE_SINC_MEDIUM_CONVERTER: + description: Enable SINC medium converter + value: 1 + ENABLE_SINC_FAST_CONVERTER: + description: Enable SINC fastest converter + value: 1 + LIBSAMPLER_NDEBUG: + description: Define NDEBUG for resampler code (turns off asserts) + value: 0