diff --git a/.github/workflows/build-mpg123-mac-arm64.yml b/.github/workflows/build-mpg123-mac-arm64.yml index 44db485..ff0bc23 100644 --- a/.github/workflows/build-mpg123-mac-arm64.yml +++ b/.github/workflows/build-mpg123-mac-arm64.yml @@ -37,11 +37,6 @@ jobs: with: name: "MPG123 library - libout123" path: mpg123-1.32.6/src/libout123/.libs/libout123.0.dylib - - name: MPG123 artifacts - uses: actions/upload-artifact@v4 - with: - name: "MPG123 library - libsyn123" - path: mpg123-1.32.6/src/libsyn123/.libs/libsyn123.0.dylib - name: MPG123 artifacts uses: actions/upload-artifact@v4 with: diff --git a/BassBoom.Basolia/BasoliaSynException.cs b/BassBoom.Basolia/BasoliaSynException.cs deleted file mode 100644 index 530d1ff..0000000 --- a/BassBoom.Basolia/BasoliaSynException.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// BassBoom Copyright (C) 2023 Aptivi -// -// This file is part of BassBoom -// -// BassBoom is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// BassBoom 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -using BassBoom.Native.Interop.Synthesis; -using System; -using System.Runtime.InteropServices; - -namespace BassBoom.Basolia -{ - /// - /// Basolia synthesis exception - /// - public class BasoliaSynException : Exception - { - /// - /// Creates a new instance of Basolia synthesis error with the specific SYN123 error. - /// - /// An SYN123 error value to use. - public BasoliaSynException(syn123_error error) : - base($"General Basolia synthesis system error\n" + - $"SYN123 returned the following error: [{error} - {Marshal.PtrToStringAnsi(NativeSynthesis.syn123_strerror(error))}]") - { } - - /// - /// Creates a new instance of Basolia synthesis error with the specific SYN123 error. - /// - /// Custom message to use while creating this exception - /// An SYN123 error value to use. - public BasoliaSynException(string message, syn123_error error) : - base($"{message}\n" + - $"SYN123 returned the following error: [{error} - {Marshal.PtrToStringAnsi(NativeSynthesis.syn123_strerror(error))}]") - { } - - /// - /// Creates a new instance of Basolia synthesis error with the specific SYN123 error. - /// - /// Custom message to use while creating this exception - /// Inner exception - /// An SYN123 error value to use. - public BasoliaSynException(string message, Exception innerException, syn123_error error) : - base($"{message}\n" + - $"SYN123 returned the following error: [{error} - {Marshal.PtrToStringAnsi(NativeSynthesis.syn123_strerror(error))}]", innerException) - { } - } -} diff --git a/BassBoom.Basolia/InitBasolia.cs b/BassBoom.Basolia/InitBasolia.cs index 47b7199..7289c7b 100644 --- a/BassBoom.Basolia/InitBasolia.cs +++ b/BassBoom.Basolia/InitBasolia.cs @@ -20,7 +20,6 @@ using BassBoom.Native.Interop; using BassBoom.Native.Interop.Init; using BassBoom.Native.Interop.Output; -using BassBoom.Native.Interop.Synthesis; using BassBoom.Native.Runtime; using System; using System.Reflection; @@ -66,19 +65,6 @@ public static Version OutLibVersion } } - /// - /// Synthesis library version - /// - public static Version SynLibVersion - { - get - { - if (!BasoliaInitialized) - throw new BasoliaSynException("Can't get version until the library is initialized", syn123_error.SYN123_NO_DATA); - return LibraryTools.SynLibVersion; - } - } - /// /// BassBoom's Basolia version /// @@ -97,9 +83,8 @@ public static void Init(string root = "") { string mpg = Mpg123Instance.GetAppropriateMpg123LibraryPath(root); string @out = Mpg123Instance.GetAppropriateOut123LibraryPath(root); - string syn = Mpg123Instance.GetAppropriateSyn123LibraryPath(root); string pthreads = Mpg123Instance.GetAppropriateWinpthreadsLibraryPath(root); - Mpg123Instance.InitializeLibrary(mpg, @out, syn, pthreads); + Mpg123Instance.InitializeLibrary(mpg, @out, pthreads); } _basoliaInited = true; } diff --git a/BassBoom.Basolia/Synthesis/SynthesisTools.cs b/BassBoom.Basolia/Synthesis/SynthesisTools.cs deleted file mode 100644 index 8b0e23d..0000000 --- a/BassBoom.Basolia/Synthesis/SynthesisTools.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// BassBoom Copyright (C) 2023 Aptivi -// -// This file is part of BassBoom -// -// BassBoom is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// BassBoom 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -using BassBoom.Native.Interop.Analysis; -using BassBoom.Native.Interop.Synthesis; -using System; -using System.Collections.Generic; - -namespace BassBoom.Basolia.Synthesis -{ - /// - /// Synthesis tools for MPG123 - /// - public static class SynthesisTools - { - private static readonly Dictionary synths = []; - - public static void NewSynthesis(string synthName, out Guid synthId) - { - unsafe - { - int error = 0; - var synth = NativeSynthesis.syn123_new(44100, 2, (int)mpg123_enc_enum.MPG123_ENC_ANY, 0, ref error); - if (error == 0) - { - synthId = Guid.NewGuid(); - synths.Add(synthId, new SynthesizerInfo(synth, synthName)); - } - else - throw new BasoliaSynException($"Can't initialize synthesizer for synth {synthName}", (syn123_error)error); - } - } - - public static bool DoesSynthesizerExist(Guid synthId) => - synths.ContainsKey(synthId); - - public static void SynthSweep(Guid synthId, syn123_wave_id waveId, double phase, int backwards, syn123_sweep_id sweepId, double f1, double f2, int smooth, IntPtr duration, out double endphase, out IntPtr period, out IntPtr bufferPeriod) - { - if (!DoesSynthesizerExist(synthId)) - throw new BasoliaSynException($"Synthesizer {synthId} not found.", syn123_error.SYN123_BAD_HANDLE); - - unsafe - { - var synHandle = synths[synthId].synHandle; - endphase = 0; - int intPeriod = 0; - int intBufferPeriod = 0; - int result = NativeSynthesis.syn123_setup_sweep(synHandle, waveId, phase, backwards, sweepId, f1, f2, smooth, duration.ToInt32(), ref endphase, ref intPeriod, ref intBufferPeriod); - if (result < 0) - throw new BasoliaSynException("Failed to generate frequency sweep.", (syn123_error)result); - period = (IntPtr)intPeriod; - bufferPeriod = (IntPtr)intBufferPeriod; - } - } - } -} diff --git a/BassBoom.Cli/CliBase/Player.cs b/BassBoom.Cli/CliBase/Player.cs index 78f22ea..8b32844 100644 --- a/BassBoom.Cli/CliBase/Player.cs +++ b/BassBoom.Cli/CliBase/Player.cs @@ -65,7 +65,6 @@ internal static class Player internal static readonly List cachedInfos = []; internal static Version mpgVer; internal static Version outVer; - internal static Version synVer; public static void PlayerLoop() { @@ -78,7 +77,6 @@ public static void PlayerLoop() // Initialize versions mpgVer = InitBasolia.MpgLibVersion; outVer = InitBasolia.OutLibVersion; - synVer = InitBasolia.SynLibVersion; // Populate the screen Screen playerScreen = new(); diff --git a/BassBoom.Cli/CliBase/PlayerControls.cs b/BassBoom.Cli/CliBase/PlayerControls.cs index 7b37aa4..0d3fa5e 100644 --- a/BassBoom.Cli/CliBase/PlayerControls.cs +++ b/BassBoom.Cli/CliBase/PlayerControls.cs @@ -492,7 +492,6 @@ BassBoom specifications Basolia version: {{InitBasolia.BasoliaVersion}} MPG123 version: {{InitBasolia.MpgLibVersion}} OUT123 version: {{InitBasolia.OutLibVersion}} - SYN123 version: {{InitBasolia.SynLibVersion}} System specifications ===================== diff --git a/BassBoom.Native/Interop/LibraryTools.cs b/BassBoom.Native/Interop/LibraryTools.cs index 1a51bc9..a227a66 100644 --- a/BassBoom.Native/Interop/LibraryTools.cs +++ b/BassBoom.Native/Interop/LibraryTools.cs @@ -19,7 +19,6 @@ using BassBoom.Native.Interop.Init; using BassBoom.Native.Interop.Output; -using BassBoom.Native.Interop.Synthesis; using BassBoom.Native.Runtime; using System; using System.Diagnostics; @@ -44,12 +43,6 @@ public static unsafe class LibraryTools public static string LibraryPathOut => Mpg123Instance.out123LibPath; - /// - /// Absolute path to the syn123 library - /// - public static string LibraryPathSyn => - Mpg123Instance.syn123LibPath; - /// /// MPG library version /// @@ -80,21 +73,6 @@ public static Version OutLibVersion } } - /// - /// Synthesis library version - /// - public static Version SynLibVersion - { - get - { - uint major = 0, minor = 0, patch = 0; - var versionHandle = NativeSynthesis.syn123_distversion(ref major, ref minor, ref patch); - string version = Marshal.PtrToStringAnsi(versionHandle); - Debug.WriteLine($"syn123 version: {version}"); - return new((int)major, (int)minor, (int)patch, 0); - } - } - /// /// C library name (POSIX) /// @@ -110,11 +88,6 @@ public static Version SynLibVersion /// public const string LibraryNameOut = "out123"; - /// - /// Library name to search for upon invoking P/Invoke - /// - public const string LibraryNameSyn = "syn123"; - /// /// MPG123_EXPORT int mpg123_init (void) /// diff --git a/BassBoom.Native/Interop/Synthesis/NativeSynthesis.cs b/BassBoom.Native/Interop/Synthesis/NativeSynthesis.cs deleted file mode 100644 index 66036bc..0000000 --- a/BassBoom.Native/Interop/Synthesis/NativeSynthesis.cs +++ /dev/null @@ -1,405 +0,0 @@ -// -// BassBoom Copyright (C) 2023 Aptivi -// -// This file is part of BassBoom -// -// BassBoom is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// BassBoom 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -using BassBoom.Native.Interop.Analysis; -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace BassBoom.Native.Interop.Synthesis -{ - public enum syn123_error - { - SYN123_OK = 0, - SYN123_BAD_HANDLE, - SYN123_BAD_FMT, - SYN123_BAD_ENC, - SYN123_BAD_CONV, - SYN123_BAD_SIZE, - SYN123_BAD_BUF, - SYN123_BAD_CHOP, - SYN123_DOOM, - SYN123_WEIRD, - SYN123_BAD_FREQ, - SYN123_BAD_SWEEP, - SYN123_OVERFLOW, - SYN123_NO_DATA, - SYN123_BAD_DATA, - } - - public enum syn123_wave_id - { - SYN123_WAVE_INVALID = -1, - SYN123_WAVE_FLAT = 0, - SYN123_WAVE_SINE, - SYN123_WAVE_SQUARE, - SYN123_WAVE_TRIANGLE, - SYN123_WAVE_SAWTOOTH, - SYN123_WAVE_GAUSS, - SYN123_WAVE_PULSE, - SYN123_WAVE_SHOT, - SYN123_WAVE_LIMIT, - } - - public enum syn123_sweep_id - { - SYN123_SWEEP_LIN = 0, - SYN123_SWEEP_QUAD, - SYN123_SWEEP_EXP, - SYN123_SWEEP_LIMIT, - } - - public unsafe struct syn123_handle - { } - - /// - /// Synthesis group from syn123 - /// - public static unsafe class NativeSynthesis - { - /// - /// const char *syn123_distversion(unsigned int *major, unsigned int *minor, unsigned int *patch); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern IntPtr syn123_distversion(ref uint major, ref uint minor, ref uint patch); - - /// - /// unsigned int syn123_libversion(unsigned int *patch); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern uint syn123_libversion(ref uint patch); - - /// - /// const char* syn123_strerror(int errcode); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern IntPtr syn123_strerror(syn123_error errcode); - - /// - /// const char* syn123_strerror(int errcode); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi, EntryPoint = "syn123_strerror")] - public static extern IntPtr syn123_strerror2(int errcode); - - /// - /// syn123_handle* syn123_new(long rate, int channels, int encoding, size_t maxbuf, int* err); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern syn123_handle* syn123_new(int rate, int channels, int encoding, [MarshalAs(UnmanagedType.SysInt)] int maxbuf, ref int err); - - /// - /// syn123_handle* syn123_new(long rate, int channels, int encoding, size_t maxbuf, int* err); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern syn123_handle* syn123_new(int rate, int channels, mpg123_enc_enum encoding, [MarshalAs(UnmanagedType.SysInt)] int maxbuf, ref int err); - - /// - /// void syn123_del(syn123_handle *sh); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_del(syn123_handle* sh); - - /// - /// int syn123_dither(syn123_handle *sh, int dither, unsigned long *seed); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_dither(syn123_handle* sh, int dither, ref uint seed); - - /// - /// size_t syn123_read(syn123_handle *sh, void *dst, size_t dst_bytes); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_read(syn123_handle* sh, IntPtr dst, [MarshalAs(UnmanagedType.SysInt)] int dst_bytes); - - /// - /// int syn123_setup_waves(syn123_handle* sh, size_t count, int* id, double* freq, double* phase, int* backwards, size_t *period); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_waves(syn123_handle* sh, [MarshalAs(UnmanagedType.SysInt)] int count, ref int id, ref double freq, ref double phase, ref int backwards, ref int period); - - /// - /// int syn123_query_waves(syn123_handle* sh, size_t *count, int* id, double* freq, double* phase, int* backwards, size_t *period); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_query_waves(syn123_handle* sh, ref int count, ref int id, ref double freq, ref double phase, ref int backwards, ref int period); - - /// - /// const char* syn123_wave_name(int id); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern IntPtr syn123_wave_name(int id); - - /// - /// int syn123_wave_id(const char *name); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_wave_id([In()][MarshalAs(UnmanagedType.LPStr)] string name); - - /// - /// int syn123_setup_sweep(syn123_handle* sh, int wave_id, double phase, int backwards, int sweep_id, double* f1, double* f2, int smooth, size_t duration, double* endphase, size_t *period, size_t* buffer_period); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_sweep(syn123_handle* sh, int wave_id, double phase, int backwards, int sweep_id, [In] double f1, [In] double f2, int smooth, [MarshalAs(UnmanagedType.SysInt)] int duration, ref double endphase, [MarshalAs(UnmanagedType.SysInt)] ref int period, [MarshalAs(UnmanagedType.SysInt)] ref int buffer_period); - - /// - /// int syn123_setup_sweep(syn123_handle* sh, int wave_id, double phase, int backwards, int sweep_id, double* f1, double* f2, int smooth, size_t duration, double* endphase, size_t *period, size_t* buffer_period); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_sweep(syn123_handle* sh, syn123_wave_id wave_id, double phase, int backwards, syn123_sweep_id sweep_id, [In] double f1, [In] double f2, int smooth, [MarshalAs(UnmanagedType.SysInt)] int duration, ref double endphase, [MarshalAs(UnmanagedType.SysInt)] ref int period, [MarshalAs(UnmanagedType.SysInt)] ref int buffer_period); - - /// - /// int syn123_setup_pink(syn123_handle *sh, int rows, unsigned long seed, size_t* period); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_pink(syn123_handle* sh, int rows, uint seed, ref int period); - - /// - /// int syn123_setup_white(syn123_handle *sh, unsigned long seed, size_t *period); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_white(syn123_handle* sh, uint seed, ref int period); - - /// - /// int syn123_setup_geiger(syn123_handle *sh, double activity, unsigned long seed, size_t *period); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_geiger(syn123_handle* sh, double activity, uint seed, ref int period); - - /// - /// int syn123_setup_silence(syn123_handle *sh); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_silence(syn123_handle* sh); - - /// - /// int syn123_conv(void * dst, int dst_enc, size_t dst_size, void* src, int src_enc, size_t src_bytes, size_t* dst_bytes, size_t *clipped, syn123_handle* sh); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_conv(IntPtr dst, int dst_enc, [MarshalAs(UnmanagedType.SysInt)] int dst_size, IntPtr src, int src_enc, [MarshalAs(UnmanagedType.SysInt)] int src_bytes, ref int dst_bytes, ref int clipped, syn123_handle* sh); - - /// - /// double syn123_db2lin(double db); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern double syn123_db2lin(double db); - - /// - /// double syn123_lin2db(double volume); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern double syn123_lin2db(double volume); - - /// - /// int syn123_amp(void* buf, int encoding, size_t samples, double volume, double offset, size_t *clipped, syn123_handle* sh); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_amp(IntPtr buf, int encoding, [MarshalAs(UnmanagedType.SysInt)] int samples, double volume, double offset, ref int clipped, syn123_handle* sh); - - /// - /// size_t syn123_clip(void *buf, int encoding, size_t samples); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_clip(IntPtr buf, int encoding, [MarshalAs(UnmanagedType.SysInt)] int samples); - - /// - /// size_t syn123_soft_clip(void *buf, int encoding, size_t samples, double limit, double width, syn123_handle *sh); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_soft_clip(IntPtr buf, int encoding, [MarshalAs(UnmanagedType.SysInt)] int samples, double limit, double width, syn123_handle* sh); - - /// - /// void syn123_interleave(void * MPG123_RESTRICT dst, void** MPG123_RESTRICT src, int channels, size_t samplesize, size_t samplecount); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_interleave(IntPtr dst, ref IntPtr src, int channels, [MarshalAs(UnmanagedType.SysInt)] int samplesize, [MarshalAs(UnmanagedType.SysInt)] int samplecount); - - /// - /// void syn123_deinterleave(void ** MPG123_RESTRICT dst, void * MPG123_RESTRICT src, int channels, size_t samplesize, size_t samplecount); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_deinterleave(ref IntPtr dst, IntPtr src, int channels, [MarshalAs(UnmanagedType.SysInt)] int samplesize, [MarshalAs(UnmanagedType.SysInt)] int samplecount); - - /// - /// void syn123_mono2many(void * MPG123_RESTRICT dst, void * MPG123_RESTRICT src, int channels, size_t samplesize, size_t samplecount); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_mono2many(IntPtr dst, IntPtr src, int channels, [MarshalAs(UnmanagedType.SysInt)] int samplesize, [MarshalAs(UnmanagedType.SysInt)] int samplecount); - - /// - /// int syn123_mixenc(int src_enc, int dst_enc); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_mixenc(int src_enc, int dst_enc); - - /// - /// int syn123_mix(void * MPG123_RESTRICT dst, int dst_enc, int dst_channels, void* MPG123_RESTRICT src, int src_enc, int src_channels, const double* mixmatrix, size_t samples, int silence, size_t *clipped, syn123_handle* sh); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_mix(IntPtr dst, int dst_enc, int dst_channels, IntPtr src, int src_enc, int src_channels, ref double mixmatrix, [MarshalAs(UnmanagedType.SysInt)] int samples, int silence, ref int clipped, syn123_handle* sh); - - /// - /// int syn123_setup_filter(syn123_handle *sh, int append, unsigned int order, double* b, double* a, int mixenc, int channels, int init_firstval); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_filter(syn123_handle* sh, int append, uint order, ref double b, ref double a, int mixenc, int channels, int init_firstval); - - /// - /// int syn123_query_filter(syn123_handle *sh, size_t position, size_t* count, unsigned int* order, double* b, double* a, int* mixenc, int* channels, int* init_firstval); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_query_filter(syn123_handle* sh, [MarshalAs(UnmanagedType.SysInt)] int position, ref int count, ref uint order, ref double b, ref double a, ref int mixenc, ref int channels, ref int init_firstval); - - /// - /// void syn123_drop_filter(syn123_handle *sh, size_t count); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_drop_filter(syn123_handle* sh, [MarshalAs(UnmanagedType.SysInt)] int count); - - /// - /// int syn123_filter(syn123_handle *sh, void* buf, int encoding, size_t samples); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_filter(syn123_handle* sh, IntPtr buf, int encoding, [MarshalAs(UnmanagedType.SysInt)] int samples); - - /// - /// int syn123_setup_resample(syn123_handle *sh, long inrate, long outrate, int channels, int dirty, int smooth); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_setup_resample(syn123_handle* sh, int inrate, int outrate, int channels, int dirty, int smooth); - - /// - /// long syn123_resample_maxrate(void); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_resample_maxrate(); - - /// - /// size_t syn123_resample_count(long inrate, long outrate, size_t ins); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_resample_count(int inrate, int outrate, [MarshalAs(UnmanagedType.SysInt)] int ins); - - /// - /// size_t syn123_resample_history(long inrate, long outrate, int dirty); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_resample_history(int inrate, int outrate, int dirty); - - /// - /// size_t syn123_resample_incount(long input_rate, long output_rate, size_t outs); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_resample_incount(int input_rate, int output_rate, [MarshalAs(UnmanagedType.SysInt)] int outs); - - /// - /// size_t syn123_resample_fillcount(long input_rate, long output_rate, size_t outs); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_resample_fillcount(int input_rate, int output_rate, [MarshalAs(UnmanagedType.SysInt)] int outs); - - /// - /// size_t syn123_resample_maxincount(long input_rate, long output_rate); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_resample_maxincount(int input_rate, int output_rate); - - /// - /// size_t syn123_resample_out(syn123_handle *sh, size_t ins, int *err); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_resample_out(syn123_handle* sh, [MarshalAs(UnmanagedType.SysInt)] int ins, ref int err); - - /// - /// size_t syn123_resample_in(syn123_handle *sh, size_t outs, int *err); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_resample_in(syn123_handle* sh, [MarshalAs(UnmanagedType.SysInt)] int outs, ref int err); - - /// - /// int64_t syn123_resample_total64(long inrate, long outrate, int64_t ins); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_resample_total64(int inrate, int outrate, int ins); - - /// - /// int64_t syn123_resample_intotal64(long inrate, long outrate, int64_t outs); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_resample_intotal64(int inrate, int outrate, int outs); - - /// - /// size_t syn123_resample(syn123_handle *sh, float* MPG123_RESTRICT dst, float* MPG123_RESTRICT src, size_t samples); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - [return: MarshalAs(UnmanagedType.SysInt)] - public static extern int syn123_resample(syn123_handle* sh, ref float dst, ref float src, [MarshalAs(UnmanagedType.SysInt)] int samples); - - /// - /// void syn123_swap_bytes(void* buf, size_t samplesize, size_t samplecount); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_swap_bytes(IntPtr buf, [MarshalAs(UnmanagedType.SysInt)] int samplesize, [MarshalAs(UnmanagedType.SysInt)] int samplecount); - - /// - /// void syn123_host2le(void *buf, size_t samplesize, size_t samplecount); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_host2le(IntPtr buf, [MarshalAs(UnmanagedType.SysInt)] int samplesize, [MarshalAs(UnmanagedType.SysInt)] int samplecount); - - /// - /// void syn123_host2be(void *buf, size_t samplesize, size_t samplecount); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_host2be(IntPtr buf, [MarshalAs(UnmanagedType.SysInt)] int samplesize, [MarshalAs(UnmanagedType.SysInt)] int samplecount); - - /// - /// void syn123_le2host(void *buf, size_t samplesize, size_t samplecount); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_le2host(IntPtr buf, [MarshalAs(UnmanagedType.SysInt)] int samplesize, [MarshalAs(UnmanagedType.SysInt)] int samplecount); - - /// - /// void syn123_be2host(void *buf, size_t samplesize, size_t samplecount); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern void syn123_be2host(IntPtr buf, [MarshalAs(UnmanagedType.SysInt)] int samplesize, [MarshalAs(UnmanagedType.SysInt)] int samplecount); - - /// - /// off_t syn123_resample_total(long inrate, long outrate, off_t ins); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_resample_total(int inrate, int outrate, int ins); - - /// - /// off_t syn123_resample_intotal(long inrate, long outrate, off_t outs); - /// - [DllImport(LibraryTools.LibraryNameSyn, CharSet = CharSet.Ansi)] - public static extern int syn123_resample_intotal(int inrate, int outrate, int outs); - } -} diff --git a/BassBoom.Native/Interop/Synthesis/SynthesizerInfo.cs b/BassBoom.Native/Interop/Synthesis/SynthesizerInfo.cs deleted file mode 100644 index ccf983a..0000000 --- a/BassBoom.Native/Interop/Synthesis/SynthesizerInfo.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -// BassBoom Copyright (C) 2023 Aptivi -// -// This file is part of BassBoom -// -// BassBoom is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// BassBoom 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -namespace BassBoom.Native.Interop.Synthesis -{ - /// - /// Synthesizer info - /// - public unsafe class SynthesizerInfo - { - internal syn123_handle* synHandle; - private string synName; - - /// - /// Synthesizer name - /// - public string SynthesizerName => - synName; - - internal SynthesizerInfo(syn123_handle* synHandle, string synName) - { - this.synHandle = synHandle; - this.synName = synName; - } - } -} diff --git a/BassBoom.Native/Runtime/Mpg123Instance.cs b/BassBoom.Native/Runtime/Mpg123Instance.cs index b54cab6..a6b281d 100644 --- a/BassBoom.Native/Runtime/Mpg123Instance.cs +++ b/BassBoom.Native/Runtime/Mpg123Instance.cs @@ -21,7 +21,6 @@ using BassBoom.Native.Interop; using BassBoom.Native.Interop.Init; using BassBoom.Native.Interop.Output; -using BassBoom.Native.Interop.Synthesis; using System; using System.Diagnostics; using System.IO; @@ -29,7 +28,6 @@ using System.Runtime.InteropServices; using SpecProbe.Platform; - #if !NETCOREAPP using NativeLand; using NativeLand.Tools; @@ -44,12 +42,10 @@ public unsafe class Mpg123Instance { internal static string mpg123LibPath = GetAppropriateMpg123LibraryPath(); internal static string out123LibPath = GetAppropriateOut123LibraryPath(); - internal static string syn123LibPath = GetAppropriateSyn123LibraryPath(); internal static string winpthreadsLibPath = GetAppropriateWinpthreadsLibraryPath(); internal static mpg123_handle* _mpg123Handle; internal static out123_handle* _out123Handle; - internal static syn123_handle* _syn123Handle; /// /// Singleton of the mpg123 instance class @@ -60,34 +56,29 @@ public unsafe class Mpg123Instance /// Initializes the mpg123 library /// public static void InitializeLibrary() => - InitializeLibrary(mpg123LibPath, out123LibPath, syn123LibPath, winpthreadsLibPath); + InitializeLibrary(mpg123LibPath, out123LibPath, winpthreadsLibPath); /// /// Initializes the mpg123 library /// /// Absolute path to the mpg123 library /// Absolute path to the out123 library - /// Absolute path to the syn123 library /// Absolute path to the libwinpthreads library - public static void InitializeLibrary(string libPath, string libPathOut, string libPathSyn, string libPathWinpthreads) + public static void InitializeLibrary(string libPath, string libPathOut, string libPathWinpthreads) { // Check to see if we have this path if (!File.Exists(libPath)) throw new BasoliaNativeLibraryException($"mpg123 library path {libPath} doesn't exist."); if (!File.Exists(libPathOut)) throw new BasoliaNativeLibraryException($"out123 library path {libPath} doesn't exist."); - if (!File.Exists(libPathSyn)) - throw new BasoliaNativeLibraryException($"syn123 library path {libPath} doesn't exist."); if (PlatformHelper.IsOnWindows() && !File.Exists(libPathWinpthreads)) throw new BasoliaNativeLibraryException($"libwinpthreads library path {libPathWinpthreads} doesn't exist."); // Set the library path string oldLibPath = mpg123LibPath; string oldLibPathOut = out123LibPath; - string oldLibPathSyn = syn123LibPath; mpg123LibPath = libPath; out123LibPath = libPathOut; - syn123LibPath = libPathSyn; #if NETCOREAPP NativeLibrary.SetDllImportResolver(typeof(NativeInit).Assembly, ResolveLibrary); #else @@ -149,31 +140,8 @@ public static void InitializeLibrary(string libPath, string libPathOut, string l new LibraryFile("libwinpthread-1.dll", bytesWinpthread))); libManagerWinpthread.LoadNativeLibrary(); } - var bytesSyn = File.ReadAllBytes(syn123LibPath); - var libManagerSyn = new LibraryManager( - new LibraryItem(Platform.Windows, Architecture.X86, - new LibraryFile("syn123.dll", bytesSyn)), - new LibraryItem(Platform.Windows, Architecture.X64, - new LibraryFile("syn123.dll", bytesSyn)), - new LibraryItem(Platform.Windows, Architecture.Arm, - new LibraryFile("syn123.dll", bytesSyn)), - new LibraryItem(Platform.Windows, Architecture.Arm64, - new LibraryFile("syn123.dll", bytesSyn)), - new LibraryItem(Platform.MacOS, Architecture.X64, - new LibraryFile("libsyn123.dylib", bytesSyn)), - new LibraryItem(Platform.MacOS, Architecture.Arm64, - new LibraryFile("libsyn123.dylib", bytesSyn)), - new LibraryItem(Platform.Linux, Architecture.X64, - new LibraryFile("libsyn123.so", bytesSyn)), - new LibraryItem(Platform.Linux, Architecture.X86, - new LibraryFile("libsyn123.so", bytesSyn)), - new LibraryItem(Platform.Linux, Architecture.Arm, - new LibraryFile("libsyn123.so", bytesSyn)), - new LibraryItem(Platform.Linux, Architecture.Arm64, - new LibraryFile("libsyn123.so", bytesSyn))); libManagerMpg.LoadNativeLibrary(); libManagerOut.LoadNativeLibrary(); - libManagerSyn.LoadNativeLibrary(); #endif string libPluginsPath = Path.GetDirectoryName(mpg123LibPath) + "/plugins/"; if (PlatformHelper.IsOnWindows()) @@ -212,18 +180,6 @@ public static void InitializeLibrary(string libPath, string libPathOut, string l out123LibPath = oldLibPathOut; throw new BasoliaNativeLibraryException($"out123 library path {libPathOut} doesn't contain a valid out123 library. out123_distversion() was called. {ex.Message}"); } - - // Do the same for the syn123 library! - try - { - // We can't init handle here, because we need values. - Debug.WriteLine($"Verifying syn123 version: {LibraryTools.SynLibVersion}"); - } - catch (Exception ex) - { - syn123LibPath = oldLibPathSyn; - throw new BasoliaNativeLibraryException($"syn123 library path {libPathSyn} doesn't contain a valid syn123 library. syn123_distversion() was called. {ex.Message}"); - } } #if NETCOREAPP @@ -234,8 +190,6 @@ private static nint ResolveLibrary(string libraryName, Assembly assembly, DllImp libHandle = NativeLibrary.Load(mpg123LibPath); else if (libraryName == LibraryTools.LibraryNameOut) libHandle = NativeLibrary.Load(out123LibPath); - else if (libraryName == LibraryTools.LibraryNameSyn) - libHandle = NativeLibrary.Load(syn123LibPath); return libHandle; } #endif @@ -276,24 +230,6 @@ internal static string GetAppropriateOut123LibraryPath(string root) return runtimesPath; } - internal static string GetAppropriateSyn123LibraryPath() => - GetAppropriateSyn123LibraryPath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); - - internal static string GetAppropriateSyn123LibraryPath(string root) - { - string runtimesPath = root + "/"; - string lowerArch = RuntimeInformation.OSArchitecture.ToString().ToLower(); - if (PlatformHelper.IsOnWindows()) - runtimesPath += $"runtimes/win-{lowerArch}/native/syn123.dll"; - else if (PlatformHelper.IsOnMacOS()) - runtimesPath += $"runtimes/osx-{lowerArch}/native/libsyn123.dylib"; - else if (PlatformHelper.IsOnUnix()) - runtimesPath += $"runtimes/linux-{lowerArch}/native/libsyn123.so"; - else - runtimesPath += $"runtimes/freebsd-{lowerArch}/native/libsyn123.so"; - return runtimesPath; - } - internal static string GetAppropriateWinpthreadsLibraryPath() => GetAppropriateWinpthreadsLibraryPath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); diff --git a/BassBoom.Native/runtimes/linux-arm/native/libsyn123.so b/BassBoom.Native/runtimes/linux-arm/native/libsyn123.so deleted file mode 100644 index fbe7204..0000000 Binary files a/BassBoom.Native/runtimes/linux-arm/native/libsyn123.so and /dev/null differ diff --git a/BassBoom.Native/runtimes/linux-arm64/native/libsyn123.so b/BassBoom.Native/runtimes/linux-arm64/native/libsyn123.so deleted file mode 100644 index 65b01c7..0000000 Binary files a/BassBoom.Native/runtimes/linux-arm64/native/libsyn123.so and /dev/null differ diff --git a/BassBoom.Native/runtimes/linux-x64/native/libsyn123.so b/BassBoom.Native/runtimes/linux-x64/native/libsyn123.so deleted file mode 100644 index 187433c..0000000 Binary files a/BassBoom.Native/runtimes/linux-x64/native/libsyn123.so and /dev/null differ diff --git a/BassBoom.Native/runtimes/linux-x86/native/libsyn123.so b/BassBoom.Native/runtimes/linux-x86/native/libsyn123.so deleted file mode 100644 index bfecf8b..0000000 Binary files a/BassBoom.Native/runtimes/linux-x86/native/libsyn123.so and /dev/null differ diff --git a/BassBoom.Native/runtimes/osx-arm64/native/libsyn123.dylib b/BassBoom.Native/runtimes/osx-arm64/native/libsyn123.dylib deleted file mode 100644 index 155e210..0000000 Binary files a/BassBoom.Native/runtimes/osx-arm64/native/libsyn123.dylib and /dev/null differ diff --git a/BassBoom.Native/runtimes/osx-x64/native/libsyn123.dylib b/BassBoom.Native/runtimes/osx-x64/native/libsyn123.dylib deleted file mode 100644 index 8352898..0000000 Binary files a/BassBoom.Native/runtimes/osx-x64/native/libsyn123.dylib and /dev/null differ diff --git a/BassBoom.Native/runtimes/win-arm64/native/syn123.dll b/BassBoom.Native/runtimes/win-arm64/native/syn123.dll deleted file mode 100644 index 62cee16..0000000 Binary files a/BassBoom.Native/runtimes/win-arm64/native/syn123.dll and /dev/null differ diff --git a/BassBoom.Native/runtimes/win-x64/native/syn123.dll b/BassBoom.Native/runtimes/win-x64/native/syn123.dll deleted file mode 100644 index 36cffac..0000000 Binary files a/BassBoom.Native/runtimes/win-x64/native/syn123.dll and /dev/null differ diff --git a/BassBoom.Native/runtimes/win-x86/native/syn123.dll b/BassBoom.Native/runtimes/win-x86/native/syn123.dll deleted file mode 100644 index 7dff73a..0000000 Binary files a/BassBoom.Native/runtimes/win-x86/native/syn123.dll and /dev/null differ diff --git a/BassBoom.sln b/BassBoom.sln index 4ea8e54..e8cc331 100644 --- a/BassBoom.sln +++ b/BassBoom.sln @@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BassBoom.Basolia", "BassBoo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BassBoom.Cli", "BassBoom.Cli\BassBoom.Cli.csproj", "{7EBD3EB6-554E-46E1-B72E-8CF9F7E34F8B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BassBoom.Synthesis", "BassBoom.Synthesis\BassBoom.Synthesis.csproj", "{5B4D22A9-1764-4F92-9A7E-1C4CDBCA286F}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,10 +27,6 @@ Global {7EBD3EB6-554E-46E1-B72E-8CF9F7E34F8B}.Debug|Any CPU.Build.0 = Debug|Any CPU {7EBD3EB6-554E-46E1-B72E-8CF9F7E34F8B}.Release|Any CPU.ActiveCfg = Release|Any CPU {7EBD3EB6-554E-46E1-B72E-8CF9F7E34F8B}.Release|Any CPU.Build.0 = Release|Any CPU - {5B4D22A9-1764-4F92-9A7E-1C4CDBCA286F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5B4D22A9-1764-4F92-9A7E-1C4CDBCA286F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5B4D22A9-1764-4F92-9A7E-1C4CDBCA286F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5B4D22A9-1764-4F92-9A7E-1C4CDBCA286F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE