diff --git a/.gitignore b/.gitignore index 5c4003ce7..601df1a5d 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ Xcode-config/DEVELOPMENT_TEAM.xcconfig /ThirdParty/speex/libspeex.a /ThirdParty/vorbis/lib/libvorbisfile.3.dylib /ThirdParty/vorbis/lib/libvorbis.0.dylib +/ThirdParty/soxr/lib/libsoxr.0.dylib diff --git a/.gitmodules b/.gitmodules index ddd5739c6..0fc94912e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,6 +19,3 @@ [submodule "Frameworks/libsidplayfp/sidplayfp"] path = Frameworks/libsidplayfp/sidplayfp url = https://github.com/kode54/libsidplayfp.git -[submodule "Audio/ThirdParty/r8brain-free-src"] - path = Audio/ThirdParty/r8brain-free-src - url = https://github.com/kode54/r8brain-free-src diff --git a/Audio/CogAudio.xcodeproj/project.pbxproj b/Audio/CogAudio.xcodeproj/project.pbxproj index ee2d6d55e..78666f352 100644 --- a/Audio/CogAudio.xcodeproj/project.pbxproj +++ b/Audio/CogAudio.xcodeproj/project.pbxproj @@ -41,34 +41,9 @@ 17F94DD50B8D0F7000A34E87 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DD30B8D0F7000A34E87 /* PluginController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 17F94DD60B8D0F7000A34E87 /* PluginController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 17F94DD40B8D0F7000A34E87 /* PluginController.mm */; }; 17F94DDD0B8D101100A34E87 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DDC0B8D101100A34E87 /* Plugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 831A4FDC2865A7DC0049CFE4 /* CDSPProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4F9D2865A7DC0049CFE4 /* CDSPProcessor.h */; }; - 831A4FDD2865A7DC0049CFE4 /* CDSPRealFFT.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4F9E2865A7DC0049CFE4 /* CDSPRealFFT.h */; }; - 831A4FDE2865A7DC0049CFE4 /* pffft_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FA02865A7DC0049CFE4 /* pffft_double.h */; }; - 831A4FDF2865A7DC0049CFE4 /* pf_neon_double_from_avx.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FA22865A7DC0049CFE4 /* pf_neon_double_from_avx.h */; }; - 831A4FE02865A7DC0049CFE4 /* pf_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FA32865A7DC0049CFE4 /* pf_double.h */; }; - 831A4FE12865A7DC0049CFE4 /* pf_neon_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FA42865A7DC0049CFE4 /* pf_neon_double.h */; }; - 831A4FE22865A7DC0049CFE4 /* pf_sse2_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FA52865A7DC0049CFE4 /* pf_sse2_double.h */; }; - 831A4FE32865A7DC0049CFE4 /* pf_avx_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FA62865A7DC0049CFE4 /* pf_avx_double.h */; }; - 831A4FE42865A7DC0049CFE4 /* pf_scalar_double.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FA72865A7DC0049CFE4 /* pf_scalar_double.h */; }; - 831A4FE52865A7DC0049CFE4 /* pffft_priv_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FA82865A7DC0049CFE4 /* pffft_priv_impl.h */; }; - 831A4FE62865A7DC0049CFE4 /* pffft_double.c in Sources */ = {isa = PBXBuildFile; fileRef = 831A4FA92865A7DC0049CFE4 /* pffft_double.c */; }; - 831A4FF32865A7DC0049CFE4 /* r8butil.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FB82865A7DC0049CFE4 /* r8butil.h */; }; - 831A4FF52865A7DC0049CFE4 /* r8bbase.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FBA2865A7DC0049CFE4 /* r8bbase.h */; }; - 831A4FFE2865A7DC0049CFE4 /* CDSPSincFilterGen.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FC42865A7DC0049CFE4 /* CDSPSincFilterGen.h */; }; - 831A50072865A7DC0049CFE4 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 831A4FD02865A7DC0049CFE4 /* LICENSE */; }; - 831A50082865A7DC0049CFE4 /* CDSPResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FD12865A7DC0049CFE4 /* CDSPResampler.h */; }; - 831A50092865A7DC0049CFE4 /* CDSPHBUpsampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FD22865A7DC0049CFE4 /* CDSPHBUpsampler.h */; }; - 831A500B2865A7DC0049CFE4 /* CDSPBlockConvolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FD42865A7DC0049CFE4 /* CDSPBlockConvolver.h */; }; - 831A500C2865A7DC0049CFE4 /* fft4g.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FD52865A7DC0049CFE4 /* fft4g.h */; }; - 831A500D2865A7DC0049CFE4 /* CDSPHBDownsampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FD62865A7DC0049CFE4 /* CDSPHBDownsampler.h */; }; - 831A500E2865A7DC0049CFE4 /* r8bconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FD72865A7DC0049CFE4 /* r8bconf.h */; }; - 831A500F2865A7DC0049CFE4 /* CDSPFracInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FD82865A7DC0049CFE4 /* CDSPFracInterpolator.h */; }; - 831A50102865A7DC0049CFE4 /* CDSPFIRFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FD92865A7DC0049CFE4 /* CDSPFIRFilter.h */; }; - 831A50112865A7DC0049CFE4 /* r8bbase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831A4FDA2865A7DC0049CFE4 /* r8bbase.cpp */; }; - 831A50122865A7DC0049CFE4 /* pffft.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A4FDB2865A7DC0049CFE4 /* pffft.h */; }; - 831A50142865A7FD0049CFE4 /* r8bstate.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 831A50132865A7FD0049CFE4 /* r8bstate.hpp */; }; - 831A50162865A8800049CFE4 /* r8bstate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831A50152865A8800049CFE4 /* r8bstate.cpp */; }; - 831A50182865A8B30049CFE4 /* r8bstate.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A50172865A8B30049CFE4 /* r8bstate.h */; }; + 831A50142865A7FD0049CFE4 /* rsstate.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 831A50132865A7FD0049CFE4 /* rsstate.hpp */; }; + 831A50162865A8800049CFE4 /* rsstate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831A50152865A8800049CFE4 /* rsstate.cpp */; }; + 831A50182865A8B30049CFE4 /* rsstate.h in Headers */ = {isa = PBXBuildFile; fileRef = 831A50172865A8B30049CFE4 /* rsstate.h */; }; 8328995327CB511000D7F028 /* RedundantPlaylistDataStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 8328995127CB510F00D7F028 /* RedundantPlaylistDataStore.m */; }; 8328995427CB511000D7F028 /* RedundantPlaylistDataStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 8328995227CB511000D7F028 /* RedundantPlaylistDataStore.h */; }; 8328995727CB51B700D7F028 /* SHA256Digest.h in Headers */ = {isa = PBXBuildFile; fileRef = 8328995527CB51B700D7F028 /* SHA256Digest.h */; }; @@ -93,6 +68,7 @@ 835C88B2279811A500E28EAE /* hdcd_decode2.c in Sources */ = {isa = PBXBuildFile; fileRef = 835C88B0279811A500E28EAE /* hdcd_decode2.c */; }; 835FAC5E27BCA14D00BA8562 /* BadSampleCleaner.h in Headers */ = {isa = PBXBuildFile; fileRef = 835FAC5C27BCA14D00BA8562 /* BadSampleCleaner.h */; }; 835FAC5F27BCA14D00BA8562 /* BadSampleCleaner.m in Sources */ = {isa = PBXBuildFile; fileRef = 835FAC5D27BCA14D00BA8562 /* BadSampleCleaner.m */; }; + 836DF618298F6F5F00CD0580 /* libsoxr.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836DF615298F6E8900CD0580 /* libsoxr.0.dylib */; }; 83725A9027AA16C90003F694 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83725A7B27AA0D8A0003F694 /* Accelerate.framework */; }; 83725A9127AA16D50003F694 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83725A7C27AA0D8E0003F694 /* AVFoundation.framework */; }; 8377C64C27B8C51500E8BC0F /* fft_accelerate.c in Sources */ = {isa = PBXBuildFile; fileRef = 8377C64B27B8C51500E8BC0F /* fft_accelerate.c */; }; @@ -123,15 +99,6 @@ /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ - 17D21D2B0B8BE6A200D1EBDE /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 83725A8D27AA0DDB0003F694 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -182,35 +149,9 @@ 17F94DD40B8D0F7000A34E87 /* PluginController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginController.mm; sourceTree = ""; }; 17F94DDC0B8D101100A34E87 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = ""; }; 32DBCF5E0370ADEE00C91783 /* CogAudio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CogAudio_Prefix.pch; sourceTree = ""; }; - 831A4F9D2865A7DC0049CFE4 /* CDSPProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPProcessor.h; sourceTree = ""; }; - 831A4F9E2865A7DC0049CFE4 /* CDSPRealFFT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPRealFFT.h; sourceTree = ""; }; - 831A4FA02865A7DC0049CFE4 /* pffft_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pffft_double.h; sourceTree = ""; }; - 831A4FA22865A7DC0049CFE4 /* pf_neon_double_from_avx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_neon_double_from_avx.h; sourceTree = ""; }; - 831A4FA32865A7DC0049CFE4 /* pf_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_double.h; sourceTree = ""; }; - 831A4FA42865A7DC0049CFE4 /* pf_neon_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_neon_double.h; sourceTree = ""; }; - 831A4FA52865A7DC0049CFE4 /* pf_sse2_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_sse2_double.h; sourceTree = ""; }; - 831A4FA62865A7DC0049CFE4 /* pf_avx_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_avx_double.h; sourceTree = ""; }; - 831A4FA72865A7DC0049CFE4 /* pf_scalar_double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pf_scalar_double.h; sourceTree = ""; }; - 831A4FA82865A7DC0049CFE4 /* pffft_priv_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pffft_priv_impl.h; sourceTree = ""; }; - 831A4FA92865A7DC0049CFE4 /* pffft_double.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pffft_double.c; sourceTree = ""; }; - 831A4FB72865A7DC0049CFE4 /* CDSPHBUpsampler.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = CDSPHBUpsampler.inc; sourceTree = ""; }; - 831A4FB82865A7DC0049CFE4 /* r8butil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = r8butil.h; sourceTree = ""; }; - 831A4FBA2865A7DC0049CFE4 /* r8bbase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = r8bbase.h; sourceTree = ""; }; - 831A4FC42865A7DC0049CFE4 /* CDSPSincFilterGen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPSincFilterGen.h; sourceTree = ""; }; - 831A4FD02865A7DC0049CFE4 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; - 831A4FD12865A7DC0049CFE4 /* CDSPResampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPResampler.h; sourceTree = ""; }; - 831A4FD22865A7DC0049CFE4 /* CDSPHBUpsampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPHBUpsampler.h; sourceTree = ""; }; - 831A4FD42865A7DC0049CFE4 /* CDSPBlockConvolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPBlockConvolver.h; sourceTree = ""; }; - 831A4FD52865A7DC0049CFE4 /* fft4g.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fft4g.h; sourceTree = ""; }; - 831A4FD62865A7DC0049CFE4 /* CDSPHBDownsampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPHBDownsampler.h; sourceTree = ""; }; - 831A4FD72865A7DC0049CFE4 /* r8bconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = r8bconf.h; sourceTree = ""; }; - 831A4FD82865A7DC0049CFE4 /* CDSPFracInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPFracInterpolator.h; sourceTree = ""; }; - 831A4FD92865A7DC0049CFE4 /* CDSPFIRFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSPFIRFilter.h; sourceTree = ""; }; - 831A4FDA2865A7DC0049CFE4 /* r8bbase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = r8bbase.cpp; sourceTree = ""; }; - 831A4FDB2865A7DC0049CFE4 /* pffft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pffft.h; sourceTree = ""; }; - 831A50132865A7FD0049CFE4 /* r8bstate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = r8bstate.hpp; sourceTree = ""; }; - 831A50152865A8800049CFE4 /* r8bstate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = r8bstate.cpp; sourceTree = ""; }; - 831A50172865A8B30049CFE4 /* r8bstate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = r8bstate.h; sourceTree = ""; }; + 831A50132865A7FD0049CFE4 /* rsstate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = rsstate.hpp; sourceTree = ""; }; + 831A50152865A8800049CFE4 /* rsstate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = rsstate.cpp; sourceTree = ""; }; + 831A50172865A8B30049CFE4 /* rsstate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rsstate.h; sourceTree = ""; }; 8328995127CB510F00D7F028 /* RedundantPlaylistDataStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RedundantPlaylistDataStore.m; path = ../../Utils/RedundantPlaylistDataStore.m; sourceTree = ""; }; 8328995227CB511000D7F028 /* RedundantPlaylistDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RedundantPlaylistDataStore.h; path = ../../Utils/RedundantPlaylistDataStore.h; sourceTree = ""; }; 8328995527CB51B700D7F028 /* SHA256Digest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SHA256Digest.h; path = ../../Utils/SHA256Digest.h; sourceTree = ""; }; @@ -235,6 +176,7 @@ 835C88B0279811A500E28EAE /* hdcd_decode2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hdcd_decode2.c; sourceTree = ""; }; 835FAC5C27BCA14D00BA8562 /* BadSampleCleaner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = BadSampleCleaner.h; path = Utils/BadSampleCleaner.h; sourceTree = SOURCE_ROOT; }; 835FAC5D27BCA14D00BA8562 /* BadSampleCleaner.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = BadSampleCleaner.m; path = Utils/BadSampleCleaner.m; sourceTree = SOURCE_ROOT; }; + 836DF615298F6E8900CD0580 /* libsoxr.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsoxr.0.dylib; path = ../ThirdParty/soxr/lib/libsoxr.0.dylib; sourceTree = ""; }; 83725A7B27AA0D8A0003F694 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 83725A7C27AA0D8E0003F694 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 8377C64B27B8C51500E8BC0F /* fft_accelerate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fft_accelerate.c; sourceTree = ""; }; @@ -277,6 +219,7 @@ 8350416D28646149006B32CC /* CoreMedia.framework in Frameworks */, 83725A9027AA16C90003F694 /* Accelerate.framework in Frameworks */, 17D21DAD0B8BE76800D1EBDE /* AudioToolbox.framework in Frameworks */, + 836DF618298F6F5F00CD0580 /* libsoxr.0.dylib in Frameworks */, 17D21DAE0B8BE76800D1EBDE /* AudioUnit.framework in Frameworks */, 17D21DAF0B8BE76800D1EBDE /* CoreAudio.framework in Frameworks */, 17D21DB00B8BE76800D1EBDE /* CoreAudioKit.framework in Frameworks */, @@ -371,6 +314,7 @@ 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( + 836DF615298F6E8900CD0580 /* libsoxr.0.dylib */, 83725A7B27AA0D8A0003F694 /* Accelerate.framework */, 17D21DAA0B8BE76800D1EBDE /* AudioUnit.framework */, 17D21DA90B8BE76800D1EBDE /* AudioToolbox.framework */, @@ -425,10 +369,9 @@ children = ( 834A41A4287A90AB00EB9D9B /* fsurround */, 839E56E02879450300DFB5F4 /* hrtf */, - 831A50152865A8800049CFE4 /* r8bstate.cpp */, - 831A50172865A8B30049CFE4 /* r8bstate.h */, - 831A50132865A7FD0049CFE4 /* r8bstate.hpp */, - 831A4F9C2865A7DC0049CFE4 /* r8brain-free-src */, + 831A50152865A8800049CFE4 /* rsstate.cpp */, + 831A50172865A8B30049CFE4 /* rsstate.h */, + 831A50132865A7FD0049CFE4 /* rsstate.hpp */, 8377C64A27B8C51500E8BC0F /* deadbeef */, 835C88AE279811A500E28EAE /* hdcd */, 17D21DC40B8BE79700D1EBDE /* CoreAudioUtils */, @@ -474,55 +417,6 @@ name = "Other Sources"; sourceTree = ""; }; - 831A4F9C2865A7DC0049CFE4 /* r8brain-free-src */ = { - isa = PBXGroup; - children = ( - 831A4F9D2865A7DC0049CFE4 /* CDSPProcessor.h */, - 831A4F9E2865A7DC0049CFE4 /* CDSPRealFFT.h */, - 831A4F9F2865A7DC0049CFE4 /* pffft_double */, - 831A4FB72865A7DC0049CFE4 /* CDSPHBUpsampler.inc */, - 831A4FB82865A7DC0049CFE4 /* r8butil.h */, - 831A4FBA2865A7DC0049CFE4 /* r8bbase.h */, - 831A4FC42865A7DC0049CFE4 /* CDSPSincFilterGen.h */, - 831A4FD02865A7DC0049CFE4 /* LICENSE */, - 831A4FD12865A7DC0049CFE4 /* CDSPResampler.h */, - 831A4FD22865A7DC0049CFE4 /* CDSPHBUpsampler.h */, - 831A4FD42865A7DC0049CFE4 /* CDSPBlockConvolver.h */, - 831A4FD52865A7DC0049CFE4 /* fft4g.h */, - 831A4FD62865A7DC0049CFE4 /* CDSPHBDownsampler.h */, - 831A4FD72865A7DC0049CFE4 /* r8bconf.h */, - 831A4FD82865A7DC0049CFE4 /* CDSPFracInterpolator.h */, - 831A4FD92865A7DC0049CFE4 /* CDSPFIRFilter.h */, - 831A4FDA2865A7DC0049CFE4 /* r8bbase.cpp */, - 831A4FDB2865A7DC0049CFE4 /* pffft.h */, - ); - path = "r8brain-free-src"; - sourceTree = ""; - }; - 831A4F9F2865A7DC0049CFE4 /* pffft_double */ = { - isa = PBXGroup; - children = ( - 831A4FA02865A7DC0049CFE4 /* pffft_double.h */, - 831A4FA12865A7DC0049CFE4 /* simd */, - 831A4FA82865A7DC0049CFE4 /* pffft_priv_impl.h */, - 831A4FA92865A7DC0049CFE4 /* pffft_double.c */, - ); - path = pffft_double; - sourceTree = ""; - }; - 831A4FA12865A7DC0049CFE4 /* simd */ = { - isa = PBXGroup; - children = ( - 831A4FA22865A7DC0049CFE4 /* pf_neon_double_from_avx.h */, - 831A4FA32865A7DC0049CFE4 /* pf_double.h */, - 831A4FA42865A7DC0049CFE4 /* pf_neon_double.h */, - 831A4FA52865A7DC0049CFE4 /* pf_sse2_double.h */, - 831A4FA62865A7DC0049CFE4 /* pf_avx_double.h */, - 831A4FA72865A7DC0049CFE4 /* pf_scalar_double.h */, - ); - path = simd; - sourceTree = ""; - }; 834A41A4287A90AB00EB9D9B /* fsurround */ = { isa = PBXGroup; children = ( @@ -590,61 +484,39 @@ files = ( 839E56E82879450300DFB5F4 /* IHrtfData.h in Headers */, 17D21CA10B8BE4BA00D1EBDE /* BufferChain.h in Headers */, - 831A4FE02865A7DC0049CFE4 /* pf_double.h in Headers */, - 831A50142865A7FD0049CFE4 /* r8bstate.hpp in Headers */, + 831A50142865A7FD0049CFE4 /* rsstate.hpp in Headers */, 834A41AC287A90AB00EB9D9B /* channelmaps.h in Headers */, 17D21CA50B8BE4BA00D1EBDE /* InputNode.h in Headers */, 834A41A9287A90AB00EB9D9B /* freesurround_decoder.h in Headers */, 17D21CA70B8BE4BA00D1EBDE /* Node.h in Headers */, 8399CF2C27B5D1D5008751F1 /* NSDictionary+Merge.h in Headers */, - 831A4FF32865A7DC0049CFE4 /* r8butil.h in Headers */, 17D21CA90B8BE4BA00D1EBDE /* OutputNode.h in Headers */, 8328995427CB511000D7F028 /* RedundantPlaylistDataStore.h in Headers */, - 831A50102865A7DC0049CFE4 /* CDSPFIRFilter.h in Headers */, - 831A4FFE2865A7DC0049CFE4 /* CDSPSincFilterGen.h in Headers */, - 831A4FF52865A7DC0049CFE4 /* r8bbase.h in Headers */, - 831A50082865A7DC0049CFE4 /* CDSPResampler.h in Headers */, 17D21CC50B8BE4BA00D1EBDE /* OutputAVFoundation.h in Headers */, 83504165286447DA006B32CC /* Downmix.h in Headers */, - 831A4FDE2865A7DC0049CFE4 /* pffft_double.h in Headers */, 839E56E52879450300DFB5F4 /* HrtfData.h in Headers */, 83B74281289E027F005AAC28 /* CogAudio-Bridging-Header.h in Headers */, - 831A4FE12865A7DC0049CFE4 /* pf_neon_double.h in Headers */, 17D21CC70B8BE4BA00D1EBDE /* Status.h in Headers */, 17D21CF30B8BE5EF00D1EBDE /* CogSemaphore.h in Headers */, 839E56E62879450300DFB5F4 /* Endianness.h in Headers */, 17D21DC70B8BE79700D1EBDE /* CoreAudioUtils.h in Headers */, 839E56ED2879515D00DFB5F4 /* HeadphoneFilter.h in Headers */, 17D21EBD0B8BF44000D1EBDE /* AudioPlayer.h in Headers */, - 831A50182865A8B30049CFE4 /* r8bstate.h in Headers */, - 831A4FE52865A7DC0049CFE4 /* pffft_priv_impl.h in Headers */, - 831A4FE42865A7DC0049CFE4 /* pf_scalar_double.h in Headers */, - 831A500D2865A7DC0049CFE4 /* CDSPHBDownsampler.h in Headers */, - 831A500C2865A7DC0049CFE4 /* fft4g.h in Headers */, + 831A50182865A8B30049CFE4 /* rsstate.h in Headers */, 834FD4F027AF93680063BC83 /* ChunkList.h in Headers */, 17F94DD50B8D0F7000A34E87 /* PluginController.h in Headers */, - 831A50122865A7DC0049CFE4 /* pffft.h in Headers */, - 831A4FDC2865A7DC0049CFE4 /* CDSPProcessor.h in Headers */, - 831A4FDD2865A7DC0049CFE4 /* CDSPRealFFT.h in Headers */, 17F94DDD0B8D101100A34E87 /* Plugin.h in Headers */, 8328995727CB51B700D7F028 /* SHA256Digest.h in Headers */, 834FD4EB27AF8F380063BC83 /* AudioChunk.h in Headers */, 834A41AF287ABD6F00EB9D9B /* FSurroundFilter.h in Headers */, 17A2D3C50B8D1D37000778C4 /* AudioDecoder.h in Headers */, - 831A50092865A7DC0049CFE4 /* CDSPHBUpsampler.h in Headers */, - 831A500E2865A7DC0049CFE4 /* r8bconf.h in Headers */, 8347C7412796C58800FA8A7D /* NSFileHandle+CreateFile.h in Headers */, 17C940230B900909008627D6 /* AudioMetadataReader.h in Headers */, - 831A500F2865A7DC0049CFE4 /* CDSPFracInterpolator.h in Headers */, - 831A4FE22865A7DC0049CFE4 /* pf_sse2_double.h in Headers */, 839E56F7287974A100DFB5F4 /* SandboxBroker.h in Headers */, 839065F32853338700636FBB /* dsd2float.h in Headers */, 17B619300B909BC300BC003F /* AudioPropertiesReader.h in Headers */, - 831A4FDF2865A7DC0049CFE4 /* pf_neon_double_from_avx.h in Headers */, - 831A4FE32865A7DC0049CFE4 /* pf_avx_double.h in Headers */, 839366671815923C006DD712 /* CogPluginMulti.h in Headers */, 17ADB13C0B97926D00257CA2 /* AudioSource.h in Headers */, - 831A500B2865A7DC0049CFE4 /* CDSPBlockConvolver.h in Headers */, 835C88B1279811A500E28EAE /* hdcd_decode2.h in Headers */, 8EC1225F0B993BD500C5B3AD /* ConverterNode.h in Headers */, 8384912718080FF100E7332D /* Logging.h in Headers */, @@ -664,7 +536,6 @@ isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "CogAudio Framework" */; buildPhases = ( - 17D21D2B0B8BE6A200D1EBDE /* CopyFiles */, 8DC2EF500486A6940098B216 /* Headers */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, @@ -718,7 +589,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 831A50072865A7DC0049CFE4 /* LICENSE in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -732,11 +602,10 @@ 17D21CA20B8BE4BA00D1EBDE /* BufferChain.m in Sources */, 17D21CA60B8BE4BA00D1EBDE /* InputNode.m in Sources */, 839E56EE2879515D00DFB5F4 /* HeadphoneFilter.mm in Sources */, - 831A50112865A7DC0049CFE4 /* r8bbase.cpp in Sources */, 83504166286447DA006B32CC /* Downmix.m in Sources */, 8399CF2D27B5D1D5008751F1 /* NSDictionary+Merge.m in Sources */, 834A41AB287A90AB00EB9D9B /* channelmaps.cpp in Sources */, - 831A50162865A8800049CFE4 /* r8bstate.cpp in Sources */, + 831A50162865A8800049CFE4 /* rsstate.cpp in Sources */, 17D21CA80B8BE4BA00D1EBDE /* Node.m in Sources */, 17D21CAA0B8BE4BA00D1EBDE /* OutputNode.m in Sources */, 17D21CC60B8BE4BA00D1EBDE /* OutputAVFoundation.m in Sources */, @@ -753,7 +622,6 @@ 17D21EBE0B8BF44000D1EBDE /* AudioPlayer.m in Sources */, 17F94DD60B8D0F7000A34E87 /* PluginController.mm in Sources */, 839E56E72879450300DFB5F4 /* HrtfData.cpp in Sources */, - 831A4FE62865A7DC0049CFE4 /* pffft_double.c in Sources */, 17A2D3C60B8D1D37000778C4 /* AudioDecoder.m in Sources */, 8328995827CB51B700D7F028 /* SHA256Digest.m in Sources */, 17C940240B900909008627D6 /* AudioMetadataReader.m in Sources */, @@ -789,14 +657,12 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CogAudio_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "R8B_EXTFFT=1", - "R8B_PFFFT_DOUBLE=1", - ); + GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; + HEADER_SEARCH_PATHS = ../ThirdParty/soxr/include; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "@loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ../ThirdParty/soxr/lib; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = org.cogx.cogaudio; PRODUCT_NAME = CogAudio; @@ -823,13 +689,12 @@ GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CogAudio_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - "R8B_EXTFFT=1", - "R8B_PFFFT_DOUBLE=1", - ); + GCC_PREPROCESSOR_DEFINITIONS = ""; + HEADER_SEARCH_PATHS = ../ThirdParty/soxr/include; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "@loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ../ThirdParty/soxr/lib; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = org.cogx.cogaudio; PRODUCT_NAME = CogAudio; diff --git a/Audio/Output/HeadphoneFilter.mm b/Audio/Output/HeadphoneFilter.mm index 23efdafed..065a58255 100644 --- a/Audio/Output/HeadphoneFilter.mm +++ b/Audio/Output/HeadphoneFilter.mm @@ -14,7 +14,7 @@ #import -#import "r8bstate.h" +#import "rsstate.h" #import "HrtfData.h" @@ -205,24 +205,24 @@ static impulseCache *_sharedController = nil; double sampleRatio = sampleRate / sampleRateOfSource; int resampledCount = (int)ceil((double)sampleCount * sampleRatio); - void *r8bstate = r8bstate_new(channelCount * 2, 1024, sampleRateOfSource, sampleRate); + void *rsstate = rsstate_new(channelCount * 2, sampleRateOfSource, sampleRate); float *resampledImpulse = (float *)_memalign_malloc(resampledCount * sizeof(float) * channelCount * 2, 16); if(!resampledImpulse) { - r8bstate_delete(r8bstate); + rsstate_delete(rsstate); return nil; } size_t inputDone = 0; size_t outputDone = 0; - outputDone = r8bstate_resample(r8bstate, impulseData, sampleCount, &inputDone, resampledImpulse, resampledCount); + outputDone = rsstate_resample(rsstate, impulseData, sampleCount, &inputDone, resampledImpulse, resampledCount); while(outputDone < resampledCount) { - outputDone += r8bstate_flush(r8bstate, resampledImpulse + outputDone * channelCount * 2, resampledCount - outputDone); + outputDone += rsstate_flush(rsstate, resampledImpulse + outputDone * channelCount * 2, resampledCount - outputDone); } - r8bstate_delete(r8bstate); + rsstate_delete(rsstate); sampleCount = (int)outputDone; diff --git a/Audio/Output/OutputAVFoundation.h b/Audio/Output/OutputAVFoundation.h index a9f1bfad8..98f107a19 100644 --- a/Audio/Output/OutputAVFoundation.h +++ b/Audio/Output/OutputAVFoundation.h @@ -40,10 +40,10 @@ using std::atomic_long; @interface OutputAVFoundation : NSObject { OutputNode *outputController; - BOOL r8bDone; - void *r8bstate, *r8bold; + BOOL rsDone; + void *rsstate, *rsold; - void *r8bvis; + void *rsvis; double lastVisRate; BOOL stopInvoked; @@ -121,7 +121,7 @@ using std::atomic_long; float *samplePtr; float tempBuffer[512 * 32]; - float r8bTempBuffer[4096 * 32]; + float rsTempBuffer[4096 * 32]; float inputBuffer[4096 * 32]; // 4096 samples times maximum supported channel count float fsurroundBuffer[8192 * 6]; float hrtfBuffer[4096 * 2]; diff --git a/Audio/Output/OutputAVFoundation.m b/Audio/Output/OutputAVFoundation.m index 83c9c7c77..2dcd866e8 100644 --- a/Audio/Output/OutputAVFoundation.m +++ b/Audio/Output/OutputAVFoundation.m @@ -17,7 +17,7 @@ #import -#import "r8bstate.h" +#import "rsstate.h" #import "FSurroundFilter.h" @@ -90,14 +90,14 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA [currentPtsLock lock]; if(formatClipped) { ALog(@"Sample rate clipped to no more than %f Hz!", maxSampleRate); - if(r8bstate) { - r8bold = r8bstate; - r8bstate = NULL; + if(rsstate) { + rsold = rsstate; + rsstate = NULL; } - r8bstate = r8bstate_new(format.mChannelsPerFrame, 1024, srcRate, dstRate); - } else if(r8bstate) { - r8bold = r8bstate; - r8bstate = NULL; + rsstate = rsstate_new(format.mChannelsPerFrame, srcRate, dstRate); + } else if(rsstate) { + rsold = rsstate; + rsstate = NULL; } [currentPtsLock unlock]; newFormat = format; @@ -110,7 +110,7 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA visFormat.mBytesPerPacket = visFormat.mBytesPerFrame * visFormat.mFramesPerPacket; downmixerForVis = [[DownmixProcessor alloc] initWithInputFormat:format inputConfig:config andOutputFormat:visFormat outputConfig:AudioConfigMono]; - if(!r8bold) { + if(!rsold) { realStreamFormat = format; realStreamChannelConfig = config; streamFormatChanged = YES; @@ -140,14 +140,14 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA #endif // It should be fine to request up to double, we'll only get downsampled const float *outputPtr = (const float *)[samples bytes]; - if(r8bstate) { + if(rsstate) { size_t inDone = 0; [currentPtsLock lock]; - size_t framesDone = r8bstate_resample(r8bstate, outputPtr, frameCount, &inDone, &r8bTempBuffer[0], amountToRead); + size_t framesDone = rsstate_resample(rsstate, outputPtr, frameCount, &inDone, &rsTempBuffer[0], amountToRead); [currentPtsLock unlock]; if(!framesDone) return 0; frameCount = (int)framesDone; - outputPtr = &r8bTempBuffer[0]; + outputPtr = &rsTempBuffer[0]; chunkDuration = frameCount / newFormat.mSampleRate; } @@ -159,11 +159,11 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA if(newFormat.mSampleRate != 44100.0) { if(newFormat.mSampleRate != lastVisRate) { - if(r8bvis) { + if(rsvis) { for(;;) { int samplesFlushed; [currentPtsLock lock]; - samplesFlushed = (int)r8bstate_flush(r8bvis, &visTemp[0], 8192); + samplesFlushed = (int)rsstate_flush(rsvis, &visTemp[0], 8192); [currentPtsLock unlock]; if(samplesFlushed) { [visController postVisPCM:visTemp amount:samplesFlushed]; @@ -172,23 +172,23 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA } } [currentPtsLock lock]; - r8bstate_delete(r8bvis); - r8bvis = NULL; + rsstate_delete(rsvis); + rsvis = NULL; [currentPtsLock unlock]; } lastVisRate = newFormat.mSampleRate; [currentPtsLock lock]; - r8bvis = r8bstate_new(1, 1024, lastVisRate, 44100.0); + rsvis = rsstate_new(1, lastVisRate, 44100.0); [currentPtsLock unlock]; } - if(r8bvis) { + if(rsvis) { int samplesProcessed; size_t totalDone = 0; size_t inDone = 0; size_t visFrameCount = frameCount; { [currentPtsLock lock]; - samplesProcessed = (int)r8bstate_resample(r8bvis, &visAudio[totalDone], visFrameCount, &inDone, &visTemp[0], 8192); + samplesProcessed = (int)rsstate_resample(rsvis, &visAudio[totalDone], visFrameCount, &inDone, &visTemp[0], 8192); [currentPtsLock unlock]; if(samplesProcessed) { [visController postVisPCM:&visTemp[0] amount:samplesProcessed]; @@ -197,11 +197,11 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA visFrameCount -= inDone; } while(samplesProcessed && visFrameCount); } - } else if(r8bvis) { + } else if(rsvis) { for(;;) { int samplesFlushed; [currentPtsLock lock]; - samplesFlushed = (int)r8bstate_flush(r8bvis, &visTemp[0], 8192); + samplesFlushed = (int)rsstate_flush(rsvis, &visTemp[0], 8192); [currentPtsLock unlock]; if(samplesFlushed) { [visController postVisPCM:visTemp amount:samplesFlushed]; @@ -210,8 +210,8 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA } } [currentPtsLock lock]; - r8bstate_delete(r8bvis); - r8bvis = NULL; + rsstate_delete(rsvis); + rsvis = NULL; [currentPtsLock unlock]; [visController postVisPCM:&visAudio[0] amount:frameCount]; } else { @@ -795,26 +795,26 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons int samplesRendered; if(i == 0) { - if(!r8bold) { + if(!rsold) { ++i; continue; } [currentPtsLock lock]; - samplesRendered = r8bstate_flush(r8bold, &r8bTempBuffer[0], 4096); + samplesRendered = rsstate_flush(rsold, &rsTempBuffer[0], 4096); [currentPtsLock unlock]; if(!samplesRendered) { - r8bstate_delete(r8bold); - r8bold = NULL; - r8bDone = YES; + rsstate_delete(rsold); + rsold = NULL; + rsDone = YES; ++i; continue; } - samplePtr = &r8bTempBuffer[0]; + samplePtr = &rsTempBuffer[0]; } else { samplesRendered = inputRendered; samplePtr = &inputBuffer[0]; - if(r8bDone) { - r8bDone = NO; + if(rsDone) { + rsDone = NO; realStreamFormat = newFormat; realStreamChannelConfig = newChannelConfig; streamFormatChanged = YES; @@ -959,11 +959,11 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons downmixerForVis = nil; - r8bDone = NO; - r8bstate = NULL; - r8bold = NULL; + rsDone = NO; + rsstate = NULL; + rsold = NULL; - r8bvis = NULL; + rsvis = NULL; lastVisRate = 44100.0; AudioComponentDescription desc; @@ -1079,9 +1079,9 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons OutputNode *outputController = self->outputController; double *latencySecondsOut = &self->secondsLatency; VisualizationController *visController = self->visController; - void **r8bstate = &self->r8bstate; - void **r8bold = &self->r8bold; - void **r8bvis = &self->r8bvis; + void **rsstate = &self->rsstate; + void **rsold = &self->rsold; + void **rsvis = &self->rsvis; FSurroundFilter *const *fsurroundtest = &self->fsurround; currentPtsObserver = [renderSynchronizer addPeriodicTimeObserverForInterval:interval queue:NULL @@ -1101,14 +1101,14 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons double latencySeconds = CMTimeGetSeconds(latencyTime); double latencyVis = 0.0; [lock lock]; - if(*r8bstate) { - latencySeconds += r8bstate_latency(*r8bstate); + if(*rsstate) { + latencySeconds += rsstate_latency(*rsstate); } - if(*r8bold) { - latencySeconds += r8bstate_latency(*r8bold); + if(*rsold) { + latencySeconds += rsstate_latency(*rsold); } - if(*r8bvis) { - latencyVis = r8bstate_latency(*r8bvis); + if(*rsvis) { + latencyVis = rsstate_latency(*rsvis); } if(*fsurroundtest) { latencyVis += 2048.0 / [(*fsurroundtest) srate]; @@ -1268,17 +1268,17 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons #endif outputController = nil; visController = nil; - if(r8bstate) { - r8bstate_delete(r8bstate); - r8bstate = NULL; + if(rsstate) { + rsstate_delete(rsstate); + rsstate = NULL; } - if(r8bold) { - r8bstate_delete(r8bold); - r8bold = NULL; + if(rsold) { + rsstate_delete(rsold); + rsold = NULL; } - if(r8bvis) { - r8bstate_delete(r8bvis); - r8bvis = NULL; + if(rsvis) { + rsstate_delete(rsvis); + rsvis = NULL; } stopCompleted = YES; } diff --git a/Audio/ThirdParty/r8brain-free-src b/Audio/ThirdParty/r8brain-free-src deleted file mode 160000 index 8ce873a7e..000000000 --- a/Audio/ThirdParty/r8brain-free-src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8ce873a7e797c9dc39d5c2603eb4a900d71385cb diff --git a/Audio/ThirdParty/r8bstate.cpp b/Audio/ThirdParty/r8bstate.cpp deleted file mode 100644 index c238f6efb..000000000 --- a/Audio/ThirdParty/r8bstate.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -// r8bstate.cpp -// CogAudio Framework -// -// Created by Christopher Snowhill on 6/24/22. -// - -#include "r8bstate.h" -#include "r8bstate.hpp" - -void *r8bstate_new(int channelCount, int bufferCapacity, double srcRate, - double dstRate) { - return (void *)new r8bstate(channelCount, bufferCapacity, srcRate, dstRate); -} - -void r8bstate_delete(void *state) { - delete(r8bstate *)state; -} - -double r8bstate_latency(void *state) { - return ((r8bstate *)state)->latency(); -} - -int r8bstate_resample(void *state, const float *input, size_t inCount, size_t *inDone, - float *output, size_t outMax) { - return ((r8bstate *)state)->resample(input, inCount, inDone, output, outMax); -} - -int r8bstate_flush(void *state, float *output, size_t outMax) { - return ((r8bstate *)state)->flush(output, outMax); -} diff --git a/Audio/ThirdParty/r8bstate.h b/Audio/ThirdParty/r8bstate.h deleted file mode 100644 index b7f415d67..000000000 --- a/Audio/ThirdParty/r8bstate.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// r8bstate.h -// CogAudio Framework -// -// Created by Christopher Snowhill on 6/24/22. -// - -#include -#include - -#ifndef r8bstate_h -#define r8bstate_h - -#ifdef __cplusplus -extern "C" { -#endif - -void *r8bstate_new(int channelCount, int bufferCapacity, double srcRate, - double dstRate); -void r8bstate_delete(void *); - -double r8bstate_latency(void *); - -int r8bstate_resample(void *, const float *input, size_t inCount, size_t *inDone, - float *output, size_t outMax); - -int r8bstate_flush(void *, float *output, size_t outMax); - -#ifdef __cplusplus -} -#endif - -#endif /* r8bstate_h */ diff --git a/Audio/ThirdParty/r8bstate.hpp b/Audio/ThirdParty/r8bstate.hpp deleted file mode 100644 index a425698f7..000000000 --- a/Audio/ThirdParty/r8bstate.hpp +++ /dev/null @@ -1,165 +0,0 @@ -// -// r8bstate.hpp -// CogAudio Framework -// -// Created by Christopher Snowhill on 3/3/22. -// - -#ifndef r8bstate_hpp -#define r8bstate_hpp - -#include - -#include "r8bbase.h" - -#include "CDSPResampler.h" - -struct r8bstate { - int channelCount; - int bufferCapacity; - size_t remainder; - uint64_t inProcessed; - uint64_t outProcessed; - double sampleRatio; - double dstRate; - r8b::CFixedBuffer InBuf; - r8b::CFixedBuffer *OutBufs; - r8b::CDSPResampler24 **Resamps; - r8bstate(int _channelCount, int _bufferCapacity, double srcRate, double _dstRate) - : channelCount(_channelCount), bufferCapacity(_bufferCapacity), inProcessed(0), outProcessed(0), remainder(0), dstRate(_dstRate) { - InBuf.alloc(bufferCapacity); - OutBufs = new r8b::CFixedBuffer[channelCount]; - Resamps = new r8b::CDSPResampler24 *[channelCount]; - for(int i = 0; i < channelCount; ++i) { - Resamps[i] = new r8b::CDSPResampler24(srcRate, dstRate, bufferCapacity); - } - sampleRatio = dstRate / srcRate; - } - - ~r8bstate() { - delete[] OutBufs; - for(int i = 0; i < channelCount; ++i) { - delete Resamps[i]; - } - delete[] Resamps; - } - - double latency() { - return (((double)inProcessed * sampleRatio) - (double)outProcessed) / dstRate; - } - - int resample(const float *input, size_t inCount, size_t *inDone, float *output, size_t outMax) { - int ret = 0; - int i; - if(inDone) *inDone = 0; - while(remainder > 0) { - size_t blockCount = remainder; - if(blockCount > outMax) - blockCount = outMax; - for(i = 0; i < channelCount; ++i) { - vDSP_vdpsp(&OutBufs[i][0], 1, output + i, channelCount, blockCount); - } - remainder -= blockCount; - if(remainder > 0) { - for(i = 0; i < channelCount; ++i) { - memmove(&OutBufs[i][0], &OutBufs[i][blockCount], remainder * sizeof(double)); - } - } - output += channelCount * blockCount; - outProcessed += blockCount; - outMax -= blockCount; - ret += blockCount; - if(!outMax) - return ret; - } - while(inCount > 0) { - size_t blockCount = inCount; - if(blockCount > bufferCapacity) - blockCount = bufferCapacity; - int outputDone = 0; - for(i = 0; i < channelCount; ++i) { - double *outputPointer; - vDSP_vspdp(input + i, channelCount, &InBuf[0], 1, blockCount); - outputDone = Resamps[i]->process(InBuf, (int)blockCount, outputPointer); - if(outputDone) { - if(outputDone > outMax) { - vDSP_vdpsp(outputPointer, 1, output + i, channelCount, outMax); - remainder = outputDone - outMax; - OutBufs[i].alloc((int)remainder); - memcpy(&OutBufs[i][0], outputPointer + outMax, remainder); - } else { - vDSP_vdpsp(outputPointer, 1, output + i, channelCount, outputDone); - } - } - } - size_t outputActual = outputDone - remainder; - input += channelCount * blockCount; - output += channelCount * outputActual; - inCount -= blockCount; - if(inDone) *inDone += blockCount; - inProcessed += blockCount; - outProcessed += outputActual; - outMax -= outputActual; - ret += outputActual; - if(remainder) - break; - } - return ret; - } - - int flush(float *output, size_t outMax) { - int ret = 0; - int i; - if(remainder > 0) { - size_t blockCount = remainder; - if(blockCount > outMax) - blockCount = outMax; - for(i = 0; i < channelCount; ++i) { - vDSP_vdpsp(&OutBufs[i][0], 1, output + i, channelCount, blockCount); - } - remainder -= blockCount; - if(remainder > 0) { - for(i = 0; i < channelCount; ++i) { - memmove(&OutBufs[i][0], &OutBufs[i][blockCount], remainder * sizeof(double)); - } - } - output += channelCount * blockCount; - outProcessed += blockCount; - outMax -= blockCount; - ret += blockCount; - if(!outMax) - return ret; - } - uint64_t outputWanted = ceil(inProcessed * sampleRatio); - memset(&InBuf[0], 0, sizeof(double) * bufferCapacity); - while(outProcessed < outputWanted) { - int outputDone = 0; - for(int i = 0; i < channelCount; ++i) { - double *outputPointer; - outputDone = Resamps[i]->process(InBuf, bufferCapacity, outputPointer); - if(outputDone) { - if(outputDone > (outputWanted - outProcessed)) - outputDone = (int)(outputWanted - outProcessed); - if(outputDone > outMax) { - vDSP_vdpsp(outputPointer, 1, output + i, channelCount, outMax); - remainder = outputDone - outMax; - OutBufs[i].alloc((int)remainder); - memcpy(&OutBufs[i][0], outputPointer + outMax, remainder); - } else { - vDSP_vdpsp(outputPointer, 1, output + i, channelCount, outputDone); - } - } - } - size_t outputActual = outputDone - remainder; - outProcessed += outputActual; - output += channelCount * outputActual; - outMax -= outputActual; - ret += outputActual; - if(remainder) - break; - } - return ret; - } -}; - -#endif /* r8bstate_h */ diff --git a/Audio/ThirdParty/rsstate.cpp b/Audio/ThirdParty/rsstate.cpp new file mode 100644 index 000000000..286297b5a --- /dev/null +++ b/Audio/ThirdParty/rsstate.cpp @@ -0,0 +1,30 @@ +// +// rsstate.cpp +// CogAudio Framework +// +// Created by Christopher Snowhill on 2/4/23. +// + +#include "rsstate.h" +#include "rsstate.hpp" + +void *rsstate_new(int channelCount, double srcRate, double dstRate) { + return (void *)new rsstate(channelCount, srcRate, dstRate); +} + +void rsstate_delete(void *state) { + delete(rsstate *)state; +} + +double rsstate_latency(void *state) { + return ((rsstate *)state)->latency(); +} + +int rsstate_resample(void *state, const float *input, size_t inCount, size_t *inDone, + float *output, size_t outMax) { + return ((rsstate *)state)->resample(input, inCount, inDone, output, outMax); +} + +int rsstate_flush(void *state, float *output, size_t outMax) { + return ((rsstate *)state)->flush(output, outMax); +} diff --git a/Audio/ThirdParty/rsstate.h b/Audio/ThirdParty/rsstate.h new file mode 100644 index 000000000..d0500565d --- /dev/null +++ b/Audio/ThirdParty/rsstate.h @@ -0,0 +1,32 @@ +// +// rsstate.h +// CogAudio Framework +// +// Created by Christopher Snowhill on 2/4/23. +// + +#include +#include + +#ifndef rsstate_h +#define rsstate_h + +#ifdef __cplusplus +extern "C" { +#endif + +void *rsstate_new(int channelCount, double srcRate, double dstRate); +void rsstate_delete(void *); + +double rsstate_latency(void *); + +int rsstate_resample(void *, const float *input, size_t inCount, size_t *inDone, + float *output, size_t outMax); + +int rsstate_flush(void *, float *output, size_t outMax); + +#ifdef __cplusplus +} +#endif + +#endif /* rsstate_h */ diff --git a/Audio/ThirdParty/rsstate.hpp b/Audio/ThirdParty/rsstate.hpp new file mode 100644 index 000000000..74ab00ead --- /dev/null +++ b/Audio/ThirdParty/rsstate.hpp @@ -0,0 +1,80 @@ +// +// rsstate.hpp +// CogAudio Framework +// +// Created by Christopher Snowhill on 2/3/23. +// + +#ifndef rsstate_hpp +#define rsstate_hpp + +#include "soxr.h" + +#include +#include + +struct rsstate { + int channelCount; + int bufferCapacity; + size_t remainder; + uint64_t inProcessed; + uint64_t outProcessed; + double sampleRatio; + double dstRate; + std::vector SilenceBuf; + soxr_t Resampler; + rsstate(int _channelCount, double srcRate, double _dstRate) + : channelCount(_channelCount), inProcessed(0), outProcessed(0), remainder(0), dstRate(_dstRate) { + SilenceBuf.resize(1024 * channelCount); + memset(&SilenceBuf[0], 0, 1024 * channelCount * sizeof(float)); + Resampler = soxr_create(srcRate, dstRate, channelCount, NULL, NULL, NULL, NULL); + sampleRatio = dstRate / srcRate; + } + + ~rsstate() { + soxr_delete(Resampler); + } + + double latency() { + return (((double)inProcessed * sampleRatio) - (double)outProcessed) / dstRate; + } + + int resample(const float *input, size_t inCount, size_t *inDone, float *output, size_t outMax) { + size_t outDone = 0; + soxr_error_t errmsg = soxr_process(Resampler, (soxr_in_t)input, inCount, inDone, (soxr_out_t)output, outMax, &outDone); + if(!errmsg) { + inProcessed += *inDone; + outProcessed += outDone; + return (int)outDone; + } else { + return 0; + } + } + + int flush(float *output, size_t outMax) { + size_t outTotal = 0; + uint64_t outputWanted = std::ceil(inProcessed * sampleRatio); + while(outProcessed < outputWanted) { + size_t outWanted = outputWanted - outProcessed; + if(outWanted > outMax) { + outWanted = outMax; + } + size_t outDone = 0; + size_t inDone = 0; + soxr_error_t errmsg = soxr_process(Resampler, (soxr_in_t)(&SilenceBuf[0]), 1024, &inDone, (soxr_out_t)output, outWanted, &outDone); + if(!errmsg) { + outProcessed += outDone; + outTotal += outDone; + output += outDone * channelCount; + outMax -= outDone; + if(!outMax || outProcessed == outputWanted) { + return (int)outTotal; + } + } else { + return 0; + } + } + } +}; + +#endif /* r8bstate_h */ diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index a695ffcf8..27acf074b 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -132,6 +132,7 @@ 835FAC7F27BCDF5B00BA8562 /* libavif.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 835FAC7D27BCDF5B00BA8562 /* libavif.a */; }; 8360EF6D17F92E56005208A4 /* HighlyComplete.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8360EF0517F92B24005208A4 /* HighlyComplete.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836D28A818086386005B7299 /* MiniModeMenuTitleTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 836D28A718086386005B7299 /* MiniModeMenuTitleTransformer.m */; }; + 836DF617298F6F1700CD0580 /* libsoxr.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836DF616298F6EC400CD0580 /* libsoxr.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836EF0C827BB91E600BF35B2 /* libogg.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C427BB919300BF35B2 /* libogg.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836EF0C927BB91E900BF35B2 /* libvorbisfile.3.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C627BB91AB00BF35B2 /* libvorbisfile.3.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 836EF0CA27BB91EB00BF35B2 /* libvorbis.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C527BB91AB00BF35B2 /* libvorbis.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; @@ -743,6 +744,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + 836DF617298F6F1700CD0580 /* libsoxr.0.dylib in CopyFiles */, 836EF0E127BB98AB00BF35B2 /* libopusfile.0.dylib in CopyFiles */, 836EF0E027BB98A800BF35B2 /* libopus.0.dylib in CopyFiles */, 836EF0CB27BB91EE00BF35B2 /* libFLAC.12.dylib in CopyFiles */, @@ -992,6 +994,7 @@ 8360EF0017F92B23005208A4 /* HighlyComplete.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = HighlyComplete.xcodeproj; path = Plugins/HighlyComplete/HighlyComplete.xcodeproj; sourceTree = ""; }; 836D28A618086386005B7299 /* MiniModeMenuTitleTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MiniModeMenuTitleTransformer.h; path = Window/MiniModeMenuTitleTransformer.h; sourceTree = ""; }; 836D28A718086386005B7299 /* MiniModeMenuTitleTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MiniModeMenuTitleTransformer.m; path = Window/MiniModeMenuTitleTransformer.m; sourceTree = ""; }; + 836DF616298F6EC400CD0580 /* libsoxr.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsoxr.0.dylib; path = ThirdParty/soxr/lib/libsoxr.0.dylib; sourceTree = ""; }; 836EF0C427BB919300BF35B2 /* libogg.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libogg.0.dylib; path = ThirdParty/ogg/lib/libogg.0.dylib; sourceTree = ""; }; 836EF0C527BB91AB00BF35B2 /* libvorbis.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbis.0.dylib; path = ThirdParty/vorbis/lib/libvorbis.0.dylib; sourceTree = ""; }; 836EF0C627BB91AB00BF35B2 /* libvorbisfile.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbisfile.3.dylib; path = ThirdParty/vorbis/lib/libvorbisfile.3.dylib; sourceTree = ""; }; @@ -1211,6 +1214,7 @@ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( + 836DF616298F6EC400CD0580 /* libsoxr.0.dylib */, 83256B672866617F0036D9C0 /* libmpg123.0.dylib */, 835FAC7C27BCDF5B00BA8562 /* libaom.a */, 835FAC7D27BCDF5B00BA8562 /* libavif.a */, @@ -3095,6 +3099,7 @@ "$(inherited)", "$(PROJECT_DIR)/ThirdParty/avif/lib", "$(PROJECT_DIR)/ThirdParty/mpg123/lib", + "$(PROJECT_DIR)/ThirdParty/soxr/lib", ); MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = ( @@ -3151,6 +3156,7 @@ "$(inherited)", "$(PROJECT_DIR)/ThirdParty/avif/lib", "$(PROJECT_DIR)/ThirdParty/mpg123/lib", + "$(PROJECT_DIR)/ThirdParty/soxr/lib", ); MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = ( diff --git a/ThirdParty/libraries-debug-overlay.tar.xz b/ThirdParty/libraries-debug-overlay.tar.xz index af68ba4af..091248b76 100644 Binary files a/ThirdParty/libraries-debug-overlay.tar.xz and b/ThirdParty/libraries-debug-overlay.tar.xz differ diff --git a/ThirdParty/libraries.tar.xz b/ThirdParty/libraries.tar.xz index a6ffbe841..7d7640ded 100644 Binary files a/ThirdParty/libraries.tar.xz and b/ThirdParty/libraries.tar.xz differ diff --git a/ThirdParty/soxr/README.md b/ThirdParty/soxr/README.md new file mode 100644 index 000000000..27b326f36 --- /dev/null +++ b/ThirdParty/soxr/README.md @@ -0,0 +1,35 @@ +Build with CMake, using the following options for x86_64: + +``` +arch -x86_64 (x86_64 version of cmake) .. -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release|Debug +``` + +And these for ARM64: + +``` +cmake .. -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release|Debug +``` + +(Release|Debug) means one or the other for the separate release/debug builds + +And some minor tweaks with `install_name_tool -id` to make sure that the +resulting libsoxr.0.dylib imported libavutil properly, as it seems to want +to use that for CPU detection on ARM, even though the only feature being +detected is NEON, which is mandatory on the supported Apple Silicon platforms. + +Version 0.1.3 was retrieved from: + +https://downloads.sourceforge.net/project/soxr/soxr-0.1.3-Source.tar.xz + +With the following sha256 hash: + +b111c15fdc8c029989330ff559184198c161100a59312f5dc19ddeb9b5a15889 + + +And a patch from Homebrew was applied to fix ARM64 building: + +https://raw.githubusercontent.com/Homebrew/formula-patches/76868b36263be42440501d3692fd3a258f507d82/libsoxr/arm64_defines.patch + +With the following sha256 hash: + +9df5737a21b9ce70cc136c302e195fad9f9f6c14418566ad021f14bb34bb022c diff --git a/ThirdParty/soxr/include/soxr.h b/ThirdParty/soxr/include/soxr.h new file mode 100644 index 000000000..09ec7c466 --- /dev/null +++ b/ThirdParty/soxr/include/soxr.h @@ -0,0 +1,344 @@ +/* SoX Resampler Library Copyright (c) 2007-18 robs@users.sourceforge.net + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 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 Lesser + * General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + + +/* -------------------------------- Gubbins --------------------------------- */ + +#if !defined soxr_included +#define soxr_included + + +#if defined __cplusplus + #include + extern "C" { +#else + #include +#endif + +#if defined SOXR_DLL + #if defined soxr_EXPORTS + #define SOXR __declspec(dllexport) + #else + #define SOXR __declspec(dllimport) + #endif +#elif defined SOXR_VISIBILITY && defined __GNUC__ && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 1) + #define SOXR __attribute__ ((visibility("default"))) +#else + #define SOXR +#endif + +typedef struct soxr_io_spec soxr_io_spec_t; +typedef struct soxr_quality_spec soxr_quality_spec_t; +typedef struct soxr_runtime_spec soxr_runtime_spec_t; + + + +/* ---------------------------- API conventions -------------------------------- + +Buffer lengths (and occupancies) are expressed as the number of contained +samples per channel. + +Parameter names for buffer lengths have the suffix `len'. + +A single-character `i' or 'o' is often used in names to give context as +input or output (e.g. ilen, olen). */ + + + +/* --------------------------- Version management --------------------------- */ + +/* E.g. #if SOXR_THIS_VERSION >= SOXR_VERSION(0,1,1) ... */ + +#define SOXR_VERSION(x,y,z) (((x)<<16)|((y)<<8)|(z)) +#define SOXR_THIS_VERSION SOXR_VERSION(0,1,3) +#define SOXR_THIS_VERSION_STR "0.1.3" + + + +/* --------------------------- Type declarations ---------------------------- */ + +typedef struct soxr * soxr_t; /* A resampler for 1 or more channels. */ +typedef char const * soxr_error_t; /* 0:no-error; non-0:error. */ + +typedef void * soxr_buf_t; /* 1 buffer of channel-interleaved samples. */ +typedef void const * soxr_cbuf_t; /* Ditto; read-only. */ + +typedef soxr_buf_t const * soxr_bufs_t;/* Or, a separate buffer for each ch. */ +typedef soxr_cbuf_t const * soxr_cbufs_t; /* Ditto; read-only. */ + +typedef void const * soxr_in_t; /* Either a soxr_cbuf_t or soxr_cbufs_t, + depending on itype in soxr_io_spec_t. */ +typedef void * soxr_out_t; /* Either a soxr_buf_t or soxr_bufs_t, + depending on otype in soxr_io_spec_t. */ + + + +/* --------------------------- API main functions --------------------------- */ + +SOXR char const * soxr_version(void); /* Query library version: "libsoxr-x.y.z" */ + +#define soxr_strerror(e) /* Soxr counterpart to strerror. */ \ + ((e)?(e):"no error") + + +/* Create a stream resampler: */ + +SOXR soxr_t soxr_create( + double input_rate, /* Input sample-rate. */ + double output_rate, /* Output sample-rate. */ + unsigned num_channels, /* Number of channels to be used. */ + /* All following arguments are optional (may be set to NULL). */ + soxr_error_t *, /* To report any error during creation. */ + soxr_io_spec_t const *, /* To specify non-default I/O formats. */ + soxr_quality_spec_t const *, /* To specify non-default resampling quality.*/ + soxr_runtime_spec_t const *);/* To specify non-default runtime resources. + + Default io_spec is per soxr_io_spec(SOXR_FLOAT32_I, SOXR_FLOAT32_I) + Default quality_spec is per soxr_quality_spec(SOXR_HQ, 0) + Default runtime_spec is per soxr_runtime_spec(1) */ + + + +/* If not using an app-supplied input function, after creating a stream + * resampler, repeatedly call: */ + +SOXR soxr_error_t soxr_process( + soxr_t resampler, /* As returned by soxr_create. */ + /* Input (to be resampled): */ + soxr_in_t in, /* Input buffer(s); may be NULL (see below). */ + size_t ilen, /* Input buf. length (samples per channel). */ + size_t * idone, /* To return actual # samples used (<= ilen). */ + /* Output (resampled): */ + soxr_out_t out, /* Output buffer(s).*/ + size_t olen, /* Output buf. length (samples per channel). */ + size_t * odone); /* To return actual # samples out (<= olen). + + Note that no special meaning is associated with ilen or olen equal to + zero. End-of-input (i.e. no data is available nor shall be available) + may be indicated by seting `in' to NULL. */ + + + +/* If using an app-supplied input function, it must look and behave like this:*/ + +typedef size_t /* data_len */ + (* soxr_input_fn_t)( /* Supply data to be resampled. */ + void * input_fn_state, /* As given to soxr_set_input_fn (below). */ + soxr_in_t * data, /* Returned data; see below. N.B. ptr to ptr(s)*/ + size_t requested_len); /* Samples per channel, >= returned data_len. + + data_len *data Indicates Meaning + ------- ------- ------------ ------------------------- + !=0 !=0 Success *data contains data to be + input to the resampler. + 0 !=0 (or End-of-input No data is available nor + not set) shall be available. + 0 0 Failure An error occurred whilst trying to + source data to be input to the resampler. */ + +/* and be registered with a previously created stream resampler using: */ + +SOXR soxr_error_t soxr_set_input_fn(/* Set (or reset) an input function.*/ + soxr_t resampler, /* As returned by soxr_create. */ + soxr_input_fn_t, /* Function to supply data to be resampled.*/ + void * input_fn_state, /* If needed by the input function. */ + size_t max_ilen); /* Maximum value for input fn. requested_len.*/ + +/* then repeatedly call: */ + +SOXR size_t /*odone*/ soxr_output(/* Resample and output a block of data.*/ + soxr_t resampler, /* As returned by soxr_create. */ + soxr_out_t data, /* App-supplied buffer(s) for resampled data.*/ + size_t olen); /* Amount of data to output; >= odone. */ + + + +/* Common stream resampler operations: */ + +SOXR soxr_error_t soxr_error(soxr_t); /* Query error status. */ +SOXR size_t * soxr_num_clips(soxr_t); /* Query int. clip counter (for R/W). */ +SOXR double soxr_delay(soxr_t); /* Query current delay in output samples.*/ +SOXR char const * soxr_engine(soxr_t); /* Query resampling engine name. */ + +SOXR soxr_error_t soxr_clear(soxr_t); /* Ready for fresh signal, same config. */ +SOXR void soxr_delete(soxr_t); /* Free resources. */ + + + +/* `Short-cut', single call to resample a (probably short) signal held entirely + * in memory. See soxr_create and soxr_process above for parameter details. + * Note that unlike soxr_create however, the default quality spec. for + * soxr_oneshot is per soxr_quality_spec(SOXR_LQ, 0). */ + +SOXR soxr_error_t soxr_oneshot( + double input_rate, + double output_rate, + unsigned num_channels, + soxr_in_t in , size_t ilen, size_t * idone, + soxr_out_t out, size_t olen, size_t * odone, + soxr_io_spec_t const *, + soxr_quality_spec_t const *, + soxr_runtime_spec_t const *); + + + +/* For variable-rate resampling. See example # 5 for how to create a + * variable-rate resampler and how to use this function. */ + +SOXR soxr_error_t soxr_set_io_ratio(soxr_t, double io_ratio, size_t slew_len); + + + +/* -------------------------- API type definitions -------------------------- */ + +typedef enum { /* Datatypes supported for I/O to/from the resampler: */ + /* Internal; do not use: */ + SOXR_FLOAT32, SOXR_FLOAT64, SOXR_INT32, SOXR_INT16, SOXR_SPLIT = 4, + + /* Use for interleaved channels: */ + SOXR_FLOAT32_I = SOXR_FLOAT32, SOXR_FLOAT64_I, SOXR_INT32_I, SOXR_INT16_I, + + /* Use for split channels: */ + SOXR_FLOAT32_S = SOXR_SPLIT , SOXR_FLOAT64_S, SOXR_INT32_S, SOXR_INT16_S + +} soxr_datatype_t; + +#define soxr_datatype_size(x) /* Returns `sizeof' a soxr_datatype_t sample. */\ + ((unsigned char *)"\4\10\4\2")[(x)&3] + + + +struct soxr_io_spec { /* Typically */ + soxr_datatype_t itype; /* Input datatype. SOXR_FLOAT32_I */ + soxr_datatype_t otype; /* Output datatype. SOXR_FLOAT32_I */ + double scale; /* Linear gain to apply during resampling. 1 */ + void * e; /* Reserved for internal use 0 */ + unsigned long flags; /* Per the following #defines. 0 */ +}; + +#define SOXR_TPDF 0 /* Applicable only if otype is INT16. */ +#define SOXR_NO_DITHER 8u /* Disable the above. */ + + + +struct soxr_quality_spec { /* Typically */ + double precision; /* Conversion precision (in bits). 20 */ + double phase_response; /* 0=minimum, ... 50=linear, ... 100=maximum 50 */ + double passband_end; /* 0dB pt. bandwidth to preserve; nyquist=1 0.913*/ + double stopband_begin; /* Aliasing/imaging control; > passband_end 1 */ + void * e; /* Reserved for internal use. 0 */ + unsigned long flags; /* Per the following #defines. 0 */ +}; + +#define SOXR_ROLLOFF_SMALL 0u /* <= 0.01 dB */ +#define SOXR_ROLLOFF_MEDIUM 1u /* <= 0.35 dB */ +#define SOXR_ROLLOFF_NONE 2u /* For Chebyshev bandwidth. */ + +#define SOXR_HI_PREC_CLOCK 8u /* Increase `irrational' ratio accuracy. */ +#define SOXR_DOUBLE_PRECISION 16u /* Use D.P. calcs even if precision <= 20. */ +#define SOXR_VR 32u /* Variable-rate resampling. */ + + + +struct soxr_runtime_spec { /* Typically */ + unsigned log2_min_dft_size; /* For DFT efficiency. [8,15] 10 */ + unsigned log2_large_dft_size; /* For DFT efficiency. [8,20] 17 */ + unsigned coef_size_kbytes; /* For SOXR_COEF_INTERP_AUTO (below). 400 */ + unsigned num_threads; /* 0: per OMP_NUM_THREADS; 1: 1 thread. 1 */ + void * e; /* Reserved for internal use. 0 */ + unsigned long flags; /* Per the following #defines. 0 */ +}; + /* For `irrational' ratios only: */ +#define SOXR_COEF_INTERP_AUTO 0u /* Auto select coef. interpolation. */ +#define SOXR_COEF_INTERP_LOW 2u /* Man. select: less CPU, more memory. */ +#define SOXR_COEF_INTERP_HIGH 3u /* Man. select: more CPU, less memory. */ + + + +/* -------------------------- API type constructors ------------------------- */ + +/* These functions allow setting of the most commonly-used structure + * parameters, with other parameters being given default values. The default + * values may then be overridden, directly in the structure, if needed. */ + +SOXR soxr_quality_spec_t soxr_quality_spec( + unsigned long recipe, /* Per the #defines immediately below. */ + unsigned long flags); /* As soxr_quality_spec_t.flags. */ + + /* The 5 standard qualities found in SoX: */ +#define SOXR_QQ 0 /* 'Quick' cubic interpolation. */ +#define SOXR_LQ 1 /* 'Low' 16-bit with larger rolloff. */ +#define SOXR_MQ 2 /* 'Medium' 16-bit with medium rolloff. */ +#define SOXR_HQ SOXR_20_BITQ /* 'High quality'. */ +#define SOXR_VHQ SOXR_28_BITQ /* 'Very high quality'. */ + +#define SOXR_16_BITQ 3 +#define SOXR_20_BITQ 4 +#define SOXR_24_BITQ 5 +#define SOXR_28_BITQ 6 +#define SOXR_32_BITQ 7 + /* Reserved for internal use (to be removed): */ +#define SOXR_LSR0Q 8 /* 'Best sinc'. */ +#define SOXR_LSR1Q 9 /* 'Medium sinc'. */ +#define SOXR_LSR2Q 10 /* 'Fast sinc'. */ + +#define SOXR_LINEAR_PHASE 0x00 +#define SOXR_INTERMEDIATE_PHASE 0x10 +#define SOXR_MINIMUM_PHASE 0x30 + +#define SOXR_STEEP_FILTER 0x40 + + + +SOXR soxr_runtime_spec_t soxr_runtime_spec( + unsigned num_threads); + + + +SOXR soxr_io_spec_t soxr_io_spec( + soxr_datatype_t itype, + soxr_datatype_t otype); + + + +/* --------------------------- Advanced use only ---------------------------- */ + +/* For new designs, the following functions/usage will probably not be needed. + * They might be useful when adding soxr into an existing design where values + * for the resampling-rate and/or number-of-channels parameters to soxr_create + * are not available when that function will be called. In such cases, the + * relevant soxr_create parameter(s) can be given as 0, then one or both of the + * following (as appropriate) later invoked (but prior to calling soxr_process + * or soxr_output): + * + * soxr_set_error(soxr, soxr_set_io_ratio(soxr, io_ratio, 0)); + * soxr_set_error(soxr, soxr_set_num_channels(soxr, num_channels)); + */ + +SOXR soxr_error_t soxr_set_error(soxr_t, soxr_error_t); +SOXR soxr_error_t soxr_set_num_channels(soxr_t, unsigned); + + + +#undef SOXR + +#if defined __cplusplus +} +#endif + +#endif diff --git a/en.lproj/Credits.html b/en.lproj/Credits.html index 6952a3947..2934edb70 100644 --- a/en.lproj/Credits.html +++ b/en.lproj/Credits.html @@ -35,7 +35,6 @@

This program has been made possible through contributions from users like you.

All Cog code is copyrighted by me, and is licensed under the GPL. Cog contains bits of other code from third parties that are under their own licenses. -

Sample rate converter designed by Aleksey Vaneev of Voxengo. diff --git a/es.lproj/Credits.html b/es.lproj/Credits.html index 8012575e3..cc8037bd3 100644 --- a/es.lproj/Credits.html +++ b/es.lproj/Credits.html @@ -36,7 +36,6 @@

Este programa ha sido posible gracias a las contribuciones de usuarios y usuarias como tú.

Todo el código de Cog es de mi propiedad, y está licenciado bajo la GPL. Cog contiene código de terceros que están bajo sus propias licencias. -

Convertidor de frecuencia de muestreo diseñado por Aleksey Vaneev de Voxengo. diff --git a/pl.lproj/Credits.html b/pl.lproj/Credits.html index 6952a3947..2934edb70 100644 --- a/pl.lproj/Credits.html +++ b/pl.lproj/Credits.html @@ -35,7 +35,6 @@

This program has been made possible through contributions from users like you.

All Cog code is copyrighted by me, and is licensed under the GPL. Cog contains bits of other code from third parties that are under their own licenses. -

Sample rate converter designed by Aleksey Vaneev of Voxengo. diff --git a/ru.lproj/Credits.html b/ru.lproj/Credits.html index fad835b2a..e10393c78 100644 --- a/ru.lproj/Credits.html +++ b/ru.lproj/Credits.html @@ -35,7 +35,6 @@

Создние этой программы стало возможным благодаря вкладу таких пользователей, как вы.

Весь код Cog защищен моим авторским правом и распространяется под лицензией GPL. Cog содержит фрагменты другого кода от третьих сторон, который находятся под их собственными лицензиями. -

Преобразователь частоты дискретизации, разработан Aleksey Vaneev из Voxengo.