├── .gitattributes ├── examples ├── gui-qt │ ├── .gitignore │ ├── main.cpp │ ├── mainwindow.h │ └── CMakeLists.txt ├── cli │ ├── Makefile │ └── CMakeLists.txt └── gui │ ├── imgui │ ├── LICENSE.txt │ └── imgui_impl_glfw.h │ └── CMakeLists.txt ├── src ├── decoding │ ├── decoders │ │ ├── libs │ │ │ ├── libxmp │ │ │ │ └── src │ │ │ │ │ ├── mkstemp.c │ │ │ │ │ ├── tempfile.h │ │ │ │ │ ├── loaders │ │ │ │ │ ├── asif.h │ │ │ │ │ ├── prowizard │ │ │ │ │ │ ├── ptktable.c │ │ │ │ │ │ ├── LICENSE.txt │ │ │ │ │ │ ├── wn.c │ │ │ │ │ │ ├── prun1.c │ │ │ │ │ │ ├── hrt.c │ │ │ │ │ │ └── fc-m.c │ │ │ │ │ ├── iff.h │ │ │ │ │ ├── mod.h │ │ │ │ │ └── ftm_load.c │ │ │ │ │ ├── depackers │ │ │ │ │ ├── inflate.h │ │ │ │ │ ├── vorbis.h │ │ │ │ │ ├── crc32.h │ │ │ │ │ ├── readhuff.h │ │ │ │ │ ├── ptpopen.h │ │ │ │ │ ├── readrle.h │ │ │ │ │ ├── muse.c │ │ │ │ │ ├── depacker.h │ │ │ │ │ ├── readlzw.h │ │ │ │ │ ├── xz_stream.h │ │ │ │ │ ├── unxz.c │ │ │ │ │ ├── xfd_link.c │ │ │ │ │ ├── readrle.c │ │ │ │ │ ├── xfd.c │ │ │ │ │ ├── gunzip.c │ │ │ │ │ └── xfnmatch.h │ │ │ │ │ ├── lfo.h │ │ │ │ │ ├── memio.h │ │ │ │ │ ├── period.h │ │ │ │ │ ├── extras.h │ │ │ │ │ ├── paula.h │ │ │ │ │ ├── win32.c │ │ │ │ │ ├── md5.h │ │ │ │ │ ├── misc.c │ │ │ │ │ ├── hio.h │ │ │ │ │ ├── virtual.h │ │ │ │ │ ├── hmn_extras.h │ │ │ │ │ ├── mixer.h │ │ │ │ │ └── mdataio.h │ │ │ ├── libxmp-lite │ │ │ │ ├── test │ │ │ │ │ ├── test.it │ │ │ │ │ ├── Makefile │ │ │ │ │ └── test.c │ │ │ │ ├── src │ │ │ │ │ ├── os2 │ │ │ │ │ │ ├── unistd.h │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── tempfile.h │ │ │ │ │ ├── loaders │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ └── mod.h │ │ │ │ │ ├── lfo.h │ │ │ │ │ ├── memio.h │ │ │ │ │ ├── format.h │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── win32.c │ │ │ │ │ ├── period.h │ │ │ │ │ ├── md5.h │ │ │ │ │ ├── misc.c │ │ │ │ │ ├── hio.h │ │ │ │ │ ├── virtual.h │ │ │ │ │ ├── format.c │ │ │ │ │ ├── mixer.h │ │ │ │ │ └── mdataio.h │ │ │ │ ├── jni │ │ │ │ │ ├── Application.mk │ │ │ │ │ └── Android.mk │ │ │ │ ├── libxmp-lite.pc.in │ │ │ │ ├── include │ │ │ │ │ └── libxmp-lite │ │ │ │ │ │ └── Makefile │ │ │ │ ├── Makefile.w32 │ │ │ │ ├── Makefile.os2 │ │ │ │ ├── Makefile.vc │ │ │ │ ├── INSTALL │ │ │ │ ├── libxmp.map │ │ │ │ ├── README │ │ │ │ └── watcom.mif │ │ │ ├── pxtone │ │ │ │ ├── pxtn_version.txt │ │ │ │ ├── pxtnMem.h │ │ │ │ ├── pxtnMax.h │ │ │ │ ├── pxtnMem.cpp │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── pxtnPulse_Frequency.h │ │ │ │ ├── pxtn.h │ │ │ │ ├── pxtnPulse_Oscillator.h │ │ │ │ ├── pxtoneNoise.h │ │ │ │ ├── pxtnPulse_NoiseBuilder.h │ │ │ │ ├── pxtnPulse_Oggv.h │ │ │ │ ├── pxtnText.h │ │ │ │ ├── pxtnError.cpp │ │ │ │ ├── pxtnError.h │ │ │ │ ├── pxtnOverDrive.h │ │ │ │ ├── pxtnDescriptor.h │ │ │ │ ├── pxtnDelay.h │ │ │ │ ├── pxtnPulse_PCM.h │ │ │ │ ├── pxtnMaster.h │ │ │ │ ├── pxtoneNoise.cpp │ │ │ │ ├── pxtnPulse_Oscillator.cpp │ │ │ │ ├── pxtnPulse_Noise.h │ │ │ │ └── pxtnUnit.h │ │ │ └── snes_spc-0.9.0 │ │ │ │ ├── demo │ │ │ │ ├── wave_writer.h │ │ │ │ ├── demo_util.h │ │ │ │ ├── play_spc.c │ │ │ │ ├── benchmark.c │ │ │ │ ├── demo_util.c │ │ │ │ ├── comm.c │ │ │ │ └── trim_spc.c │ │ │ │ └── snes_spc │ │ │ │ ├── blargg_config.h │ │ │ │ ├── SPC_Filter.h │ │ │ │ ├── SPC_Filter.cpp │ │ │ │ ├── dsp.cpp │ │ │ │ └── dsp.h │ │ ├── clowncommon.h │ │ ├── oswrapper_audio.h │ │ ├── dr_mp3.h │ │ ├── dr_wav.h │ │ ├── libxmp.h │ │ ├── dr_flac.h │ │ ├── libflac.h │ │ ├── libopus.h │ │ ├── libsndfile.h │ │ ├── snes_spc.h │ │ ├── libvorbis.h │ │ ├── libopenmpt.h │ │ ├── stb_vorbis.h │ │ ├── common.h │ │ ├── pxtone.h │ │ ├── pxtone_noise.h │ │ ├── dr_flac.c │ │ ├── libopus.c │ │ ├── dr_wav.c │ │ ├── dr_mp3.c │ │ └── stb_vorbis.c │ ├── split_decoder.h │ ├── predecoder.h │ ├── resampled_decoder.h │ └── decoder_selector.h └── miniaudio.c ├── .gitignore ├── .gitmodules ├── clownaudio.pc.in ├── LICENCE.txt ├── clownaudioConfig.cmake.in ├── package ├── arch │ └── PKGBUILD └── msys2 │ └── PKGBUILD └── include └── clownaudio └── playback.h /.gitattributes: -------------------------------------------------------------------------------- 1 | PKGBUILD text eol=lf 2 | -------------------------------------------------------------------------------- /examples/gui-qt/.gitignore: -------------------------------------------------------------------------------- 1 | /build-debug 2 | /build-release 3 | /CMakeLists.txt.user 4 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/mkstemp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Clownacy/clownaudio/HEAD/src/decoding/decoders/libs/libxmp/src/mkstemp.c -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/test/test.it: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Clownacy/clownaudio/HEAD/src/decoding/decoders/libs/libxmp-lite/test/test.it -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/tempfile.h: -------------------------------------------------------------------------------- 1 | #ifndef XMP_PLATFORM_H 2 | #define XMP_PLATFORM_H 3 | 4 | FILE *make_temp_file(char **); 5 | void unlink_temp_file(char *); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/os2/unistd.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_OS2_UNISTD_H 2 | #define LIBXMP_OS2_UNISTD_H 3 | 4 | #include /* do not want Watcom unistd.h */ 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/tempfile.h: -------------------------------------------------------------------------------- 1 | #ifndef XMP_PLATFORM_H 2 | #define XMP_PLATFORM_H 3 | 4 | FILE *make_temp_file(char **); 5 | void unlink_temp_file(char *); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PROJECT_PATH := $(call my-dir) 2 | APP_MODULES := libxmp 3 | APP_ABI := armeabi armeabi-v7a x86 4 | APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk 5 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/os2/Makefile: -------------------------------------------------------------------------------- 1 | OS2_DFILES = Makefile unistd.h 2 | OS2_PATH = src/os2 3 | 4 | dist-os2: 5 | mkdir -p $(DIST)/$(OS2_PATH) 6 | cp -RPp $(addprefix $(OS2_PATH)/,$(OS2_DFILES)) $(DIST)/$(OS2_PATH) 7 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtn_version.txt: -------------------------------------------------------------------------------- 1 | pxtone release note. 2 | 3 | '17/02/05 修正 pxtnPulse_NoiseBuilder.cpp と pxtnPulse_Noise.cpp に解放し忘れたメモリ。 4 | 修正 pxtnPulse_PCM::Copy_() コーディングミス if( !create != pxtnOK )。 5 | '17/01/23 6 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/asif.h: -------------------------------------------------------------------------------- 1 | #ifndef XMP_ASIF_H 2 | #define XMP_ASIF_H 3 | 4 | #include "../common.h" 5 | #include "../hio.h" 6 | 7 | int asif_load(struct module_data *, HIO_HANDLE *, int); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /examples/cli/build 3 | /examples/cli/obj 4 | /examples/cli/test 5 | /examples/cli/test.exe 6 | /examples/gui/build 7 | /examples/gui/obj 8 | /examples/gui/test 9 | /examples/gui/test.exe 10 | 11 | # macOS junk files 12 | .DS_Store 13 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/inflate.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_INFLATE_H 2 | #define LIBXMP_INFLATE_H 3 | 4 | struct inflate_data { 5 | struct huffman_tree_t *huffman_tree_len_static; 6 | }; 7 | 8 | int libxmp_inflate (FILE *, FILE *, uint32 *, int); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/decoding/clownresampler"] 2 | path = src/decoding/clownresampler 3 | url = https://github.com/Clownacy/clownresampler 4 | [submodule "src/decoding/decoders/libs/OSWrapper"] 5 | path = src/decoding/decoders/libs/OSWrapper 6 | url = https://github.com/NeRdTheNed/OSWrapper.git 7 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/vorbis.h: -------------------------------------------------------------------------------- 1 | #define STB_VORBIS_NO_PUSHDATA_API 2 | #define STB_VORBIS_NO_STDIO 3 | #define STB_VORBIS_NO_COMMENTS 4 | #define STB_VORBIS_NO_FLOAT_CONVERSION 5 | 6 | #ifndef STB_VORBIS_C 7 | /* client: */ 8 | #define STB_VORBIS_HEADER_ONLY 9 | #include "vorbis.c" 10 | #endif 11 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnMem.h: -------------------------------------------------------------------------------- 1 | // '16/12/16 pxtnMem. 2 | 3 | #ifndef pxtnMem_H 4 | #define pxtnMem_H 5 | 6 | #include "./pxtn.h" 7 | 8 | bool pxtnMem_zero_alloc( void** pp, uint32_t byte_size ); 9 | bool pxtnMem_free ( void** pp ); 10 | bool pxtnMem_zero ( void* p , uint32_t byte_size ); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/libxmp-lite.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@/libxmp-lite 5 | 6 | Name: libxmp-lite 7 | Description: Xmp lite module player library 8 | Version: 4.5.0 9 | 10 | Requires: 11 | Libs: -L${libdir} -lxmp-lite 12 | Cflags: -I${includedir} 13 | Libs.private: -lm 14 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/include/libxmp-lite/Makefile: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DFILES = Makefile xmp.h 3 | 4 | INCLUDE_PATH = include/libxmp-lite 5 | 6 | install-include: 7 | $(INSTALL_DATA) xmp.h $(DESTDIR)$(INCLUDEDIR) 8 | 9 | dist-include: 10 | mkdir -p $(DIST)/$(INCLUDE_PATH) 11 | cp -RPp $(addprefix $(INCLUDE_PATH)/,$(INCLUDE_DFILES)) $(DIST)/$(INCLUDE_PATH) 12 | 13 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/crc32.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_CRC_H 2 | #define LIBXMP_CRC_H 3 | 4 | extern uint32 libxmp_crc32_table_A[256]; 5 | extern uint32 libxmp_crc32_table_B[256]; 6 | 7 | void libxmp_crc32_init_A (void); 8 | uint32 libxmp_crc32_A1 (const uint8 *, size_t, uint32); 9 | uint32 libxmp_crc32_A2 (const uint8 *, size_t, uint32); 10 | void libxmp_crc32_init_B (void); 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /clownaudio.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ 4 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 5 | 6 | Name: @PROJECT_NAME@ 7 | Description: @PROJECT_DESCRIPTION@ 8 | Version: @PROJECT_VERSION@ 9 | 10 | Requires.private: @PKG_CONFIG_REQUIRES@ 11 | Libs: -L${libdir} -lclownaudio 12 | Libs.private: @PKG_CONFIG_STATIC_LIBS@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /src/miniaudio.c: -------------------------------------------------------------------------------- 1 | #define MINIAUDIO_IMPLEMENTATION 2 | 3 | #define MA_NO_DECODING 4 | #define MA_NO_ENCODING 5 | #define MA_NO_WAV 6 | #define MA_NO_FLAC 7 | #define MA_NO_MP3 8 | #define MA_NO_VORBIS 9 | #define MA_NO_GENERATION 10 | #define MA_NO_ENGINE 11 | #define MA_NO_NODE_GRAPH 12 | 13 | #ifndef CLOWNAUDIO_MINIAUDIO_ENABLE_DEVICE_IO 14 | #define MA_NO_DEVICE_IO 15 | #define MA_NO_THREADING 16 | #endif 17 | 18 | #include "miniaudio.h" 19 | -------------------------------------------------------------------------------- /examples/cli/Makefile: -------------------------------------------------------------------------------- 1 | ALL_CFLAGS = $(CFLAGS) 2 | ALL_LIBS = $(LIBS) 3 | 4 | ifeq ($(STATIC), 1) 5 | ALL_CFLAGS += $(shell pkg-config clownaudio --cflags --static) -static -DCLOWNAUDIO_STATIC_DEFINE 6 | ALL_LIBS += $(shell pkg-config clownaudio --libs --static) 7 | else 8 | ALL_CFLAGS += $(shell pkg-config clownaudio --cflags) 9 | ALL_LIBS += $(shell pkg-config clownaudio --libs) 10 | endif 11 | 12 | test: test.c 13 | $(CC) $(ALL_CFLAGS) -o $@ $^ $(LDFLAGS) $(ALL_LIBS) 14 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/readhuff.h: -------------------------------------------------------------------------------- 1 | /* nomarch 1.0 - extract old `.arc' archives. 2 | * Copyright (C) 2001 Russell Marks. See main.c for license details. 3 | * 4 | * readhuff.h 5 | */ 6 | 7 | #ifndef LIBXMP_READHUFF_H 8 | #define LIBXMP_READHUFF_H 9 | 10 | unsigned char *libxmp_convert_huff(unsigned char *data_in, 11 | unsigned long in_len, 12 | unsigned long orig_len); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/loaders/Makefile: -------------------------------------------------------------------------------- 1 | 2 | LOADERS = xm_load.o mod_load.o s3m_load.o it_load.o 3 | 4 | LOADERS_OBJS = common.o itsex.o sample.o $(LOADERS) 5 | LOADERS_DFILES = Makefile $(LOADERS_OBJS:.o=.c) \ 6 | it.h loader.h mod.h s3m.h xm.h 7 | LOADERS_PATH = src/loaders 8 | 9 | OBJS += $(addprefix $(LOADERS_PATH)/,$(LOADERS_OBJS)) 10 | 11 | default: 12 | 13 | dist-loaders:: 14 | mkdir -p $(DIST)/$(LOADERS_PATH) 15 | cp -RPp $(addprefix $(LOADERS_PATH)/,$(LOADERS_DFILES)) $(DIST)/$(LOADERS_PATH) 16 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/lfo.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_LFO_H 2 | #define LIBXMP_LFO_H 3 | 4 | #include "common.h" 5 | 6 | struct lfo { 7 | int type; 8 | int rate; 9 | int depth; 10 | int phase; 11 | }; 12 | 13 | int libxmp_lfo_get(struct context_data *, struct lfo *, int); 14 | void libxmp_lfo_update(struct lfo *); 15 | void libxmp_lfo_set_phase(struct lfo *, int); 16 | void libxmp_lfo_set_depth(struct lfo *, int); 17 | void libxmp_lfo_set_rate(struct lfo *, int); 18 | void libxmp_lfo_set_waveform(struct lfo *, int); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/demo/wave_writer.h: -------------------------------------------------------------------------------- 1 | /* WAVE sound file writer for recording 16-bit output during program development */ 2 | 3 | #ifndef WAVE_WRITER_H 4 | #define WAVE_WRITER_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void wave_open( long sample_rate, const char* filename ); 11 | void wave_enable_stereo( void ); 12 | void wave_write( short const* in, long count ); 13 | long wave_sample_count( void ); 14 | void wave_close( void ); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/lfo.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_LFO_H 2 | #define LIBXMP_LFO_H 3 | 4 | #include "common.h" 5 | 6 | struct lfo { 7 | int type; 8 | int rate; 9 | int depth; 10 | int phase; 11 | }; 12 | 13 | int libxmp_lfo_get(struct context_data *, struct lfo *, int); 14 | void libxmp_lfo_update(struct lfo *); 15 | void libxmp_lfo_set_phase(struct lfo *, int); 16 | void libxmp_lfo_set_depth(struct lfo *, int); 17 | void libxmp_lfo_set_rate(struct lfo *, int); 18 | void libxmp_lfo_set_waveform(struct lfo *, int); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/memio.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_MEMIO_H 2 | #define LIBXMP_MEMIO_H 3 | 4 | #include 5 | #include "common.h" 6 | 7 | typedef struct { 8 | const unsigned char *start; 9 | ptrdiff_t pos; 10 | ptrdiff_t size; 11 | } MFILE; 12 | 13 | LIBXMP_BEGIN_DECLS 14 | 15 | MFILE *mopen(const void *, long); 16 | int mgetc(MFILE *stream); 17 | size_t mread(void *, size_t, size_t, MFILE *); 18 | int mseek(MFILE *, long, int); 19 | long mtell(MFILE *); 20 | int mclose(MFILE *); 21 | int meof(MFILE *); 22 | 23 | LIBXMP_END_DECLS 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnMax.h: -------------------------------------------------------------------------------- 1 | // '12/03/05 2 | 3 | #define pxtnMAX_CHANNEL 2 4 | 5 | #define pxtnMAX_TUNEUNITSTRUCT 50 // 32 6 | #define pxtnMAX_TUNEWOICESTRUCT 100 // 32 7 | #define pxtnMAX_EVENTNUM 500000 // 65536 8 | #define pxtnMAX_TUNEGROUPNUM 7 9 | #define pxtnMAX_TUNEDELAYSTRUCT 4 10 | #define pxtnMAX_TUNEOVERDRIVESTRUCT 2 11 | #define pxtnMAX_STREAMINGVOICE 10 12 | #define pxtnMAX_RELEASEPOINT 1 13 | 14 | #define CLOCK_ROUGH 10 15 | 16 | #define pxtnMAX_TUNEUNITNAME 16 //fixture 17 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/memio.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_MEMIO_H 2 | #define LIBXMP_MEMIO_H 3 | 4 | #include 5 | 6 | typedef struct { 7 | const unsigned char *start; 8 | ptrdiff_t pos; 9 | ptrdiff_t size; 10 | } MFILE; 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | MFILE *mopen(const void *, long); 17 | int mgetc(MFILE *stream); 18 | size_t mread(void *, size_t, size_t, MFILE *); 19 | int mseek(MFILE *, long, int); 20 | long mtell(MFILE *); 21 | int mclose(MFILE *); 22 | int meof(MFILE *); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir)/.. 2 | 3 | include $(CLEAR_VARS) 4 | 5 | include $(LOCAL_PATH)/src/Makefile 6 | include $(LOCAL_PATH)/src/loaders/Makefile 7 | 8 | SRC_SOURCES := $(addprefix src/,$(SRC_OBJS)) 9 | LOADERS_SOURCES := $(addprefix src/loaders/,$(LOADERS_OBJS)) 10 | 11 | LOCAL_MODULE := xmp 12 | LOCAL_CFLAGS := -O3 -DHAVE_MKSTEMP -DHAVE_FNMATCH -DHAVE_ROUND -DLIBXMP_CORE_PLAYER \ 13 | -I$(LOCAL_PATH)/include/libxmp-lite -I$(LOCAL_PATH)/src 14 | LOCAL_SRC_FILES := $(SRC_SOURCES:.o=.c.arm) \ 15 | $(LOADERS_SOURCES:.o=.c) 16 | 17 | include $(BUILD_STATIC_LIBRARY) 18 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnMem.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "./pxtnMem.h" 3 | 4 | bool pxtnMem_zero_alloc( void** pp, uint32_t byte_size ) 5 | { 6 | if( !( *pp = malloc( byte_size ) ) ) return false; 7 | memset( *pp, 0, byte_size ); 8 | return true; 9 | } 10 | 11 | bool pxtnMem_free( void** pp ) 12 | { 13 | if( !pp || !*pp ) return false; 14 | free( *pp ); *pp = NULL; 15 | return true; 16 | } 17 | 18 | bool pxtnMem_zero( void* p , uint32_t byte_size ) 19 | { 20 | if( !p ) return false; 21 | char* p_ = (char*)p; 22 | for( uint32_t i = 0; i < byte_size; i++, p_++ ) *p_ = 0; 23 | return true; 24 | } 25 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/ptpopen.h: -------------------------------------------------------------------------------- 1 | #ifndef _PT_POPEN_H 2 | #define _PT_POPEN_H 1 3 | 4 | #ifdef _WIN32 5 | 6 | #include 7 | 8 | #undef popen 9 | #define popen(cmd, mode) pt_popen(cmd, mode, NULL) 10 | #undef pclose 11 | #define pclose(f) pt_pclose(f, NULL) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | struct pt_popen_data; 18 | 19 | FILE * pt_popen(const char *cmd, const char *mode, struct pt_popen_data **data); 20 | int pt_pclose(FILE *fle, struct pt_popen_data **data); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /* _WIN32 */ 27 | 28 | #endif /* _PT_POPEN_H */ 29 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/LICENSE.txt: -------------------------------------------------------------------------------- 1 | <ライセンス的なこと> 2 | 3 | ・再生に必要な ソースコード(pxtoneフォルダ内)は無償で使えます。改変もOKです。 4 | ・特に許可をとる必要はありません。 5 | ・利用の明記についてはお任せします。 6 | ・利用が原因で何か問題があった場合の責任は負いかねます。 7 | 8 | (Ran through Google Translate) 9 | 10 | 11 | 12 | ・The source code required for playback (in the pxtone folder) can be used free of charge. Modification is also OK. 13 | ・No special permission is required. 14 | ・I will leave it to you regarding usage. [an earlier Google Translate translation was "We will leave about the usage statement."] 15 | ・We are not responsible for any problems caused by use. 16 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnPulse_Frequency.h: -------------------------------------------------------------------------------- 1 | #ifndef pxtnPulse_Frequency_H 2 | #define pxtnPulse_Frequency_H 3 | 4 | #include "./pxtn.h" 5 | 6 | class pxtnPulse_Frequency 7 | { 8 | private: 9 | void operator = (const pxtnPulse_Frequency& src); 10 | pxtnPulse_Frequency(const pxtnPulse_Frequency& src); 11 | 12 | float* _freq_table; 13 | double _GetDivideOctaveRate( int32_t divi ); 14 | 15 | public: 16 | 17 | pxtnPulse_Frequency(); 18 | ~pxtnPulse_Frequency(); 19 | 20 | bool Init(); 21 | 22 | float Get ( int32_t key ); 23 | float Get2 ( int32_t key ); 24 | const float* GetDirect( int32_t *p_size ); 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/format.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_FORMAT_H 2 | #define LIBXMP_FORMAT_H 3 | 4 | #include "common.h" 5 | #include "hio.h" 6 | 7 | struct format_loader { 8 | const char *name; 9 | int (*test)(HIO_HANDLE *, char *, const int); 10 | int (*loader)(struct module_data *, HIO_HANDLE *, const int); 11 | }; 12 | 13 | extern const struct format_loader *const format_loaders[]; 14 | 15 | const char *const *format_list(void); 16 | 17 | #ifndef LIBXMP_CORE_PLAYER 18 | 19 | #define NUM_FORMATS 53 20 | #define NUM_PW_FORMATS 43 21 | 22 | #ifndef LIBXMP_NO_PROWIZARD 23 | int pw_test_format(HIO_HANDLE *, char *, const int, struct xmp_test_info *); 24 | #endif 25 | #endif 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/Makefile.w32: -------------------------------------------------------------------------------- 1 | # Makefile for Win32 using Watcom compiler. 2 | # 3 | # wmake -f Makefile.w32 4 | # - builds libxmp.dll and its import lib (libxmp.lib) 5 | # 6 | # wmake -f Makefile.w32 target=static 7 | # - builds the static library xmp_static.lib 8 | # 9 | !ifndef target 10 | target = dll 11 | !endif 12 | 13 | CC = wcc386 14 | SYSTEM = nt 15 | SYSTEM_DLL = nt_dll 16 | 17 | CFLAGS = -zq -bt=nt -bm -fp5 -fpi87 -mf -oeatxh -w4 -ei -zp8 18 | # newer OpenWatcom versions enable W303 by default. 19 | CFLAGS += -wcd=303 20 | # -5s : Pentium stack calling conventions. 21 | # -5r : Pentium register calling conventions. 22 | CFLAGS += -5s 23 | CFLAGS += -I"src/win32" -I"$(%WATCOM)/h/nt" 24 | 25 | !include watcom.mif 26 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/Makefile: -------------------------------------------------------------------------------- 1 | 2 | SRC_OBJS = virtual.o format.o period.o player.o read_event.o \ 3 | misc.o dataio.o lfo.o scan.o control.o filter.o \ 4 | effects.o mixer.o mix_all.o load_helpers.o load.o \ 5 | hio.o smix.o memio.o win32.o 6 | 7 | SRC_DFILES = Makefile $(SRC_OBJS:.o=.c) md5.c md5.h common.h effects.h \ 8 | format.h lfo.h list.h mixer.h period.h player.h virtual.h \ 9 | precomp_lut.h hio.h callbackio.h memio.h mdataio.h tempfile.h 10 | 11 | SRC_PATH = src 12 | 13 | OBJS += $(addprefix $(SRC_PATH)/,$(SRC_OBJS)) 14 | 15 | default-src:: 16 | $(MAKE) -C .. 17 | 18 | dist-src:: 19 | mkdir -p $(DIST)/$(SRC_PATH) 20 | cp -RPp $(addprefix $(SRC_PATH)/,$(SRC_DFILES)) $(DIST)/$(SRC_PATH) 21 | 22 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/Makefile.os2: -------------------------------------------------------------------------------- 1 | # Makefile for OS/2 using Watcom compiler. 2 | # 3 | # wmake -f Makefile.os2 4 | # - builds libxmp.dll and its import lib (libxmp.lib) 5 | # 6 | # wmake -f Makefile.os2 target=static 7 | # - builds the static library xmp_static.lib 8 | # 9 | !ifndef target 10 | target = dll 11 | !endif 12 | 13 | CC = wcc386 14 | SYSTEM = os2v2 15 | SYSTEM_DLL = os2v2_dll 16 | 17 | CFLAGS = -zq -bt=os2 -bm -fp5 -fpi87 -mf -oeatxh -w4 -ei -zp8 18 | # newer OpenWatcom versions enable W303 by default. 19 | CFLAGS += -wcd=303 20 | # -5s : Pentium stack calling conventions. 21 | # -5r : Pentium register calling conventions. 22 | CFLAGS += -5s 23 | CFLAGS += -I"src/os2" -I"$(%WATCOM)/h/os2" 24 | 25 | !include watcom.mif 26 | -------------------------------------------------------------------------------- /src/decoding/decoders/clowncommon.h: -------------------------------------------------------------------------------- 1 | #ifndef CLOWNCOMMON_H 2 | #define CLOWNCOMMON_H 3 | 4 | /* Boolean. */ 5 | typedef unsigned char cc_bool; 6 | enum 7 | { 8 | cc_false = 0, 9 | cc_true = 1 10 | }; 11 | 12 | /* Common macros. */ 13 | #define CC_MIN(a, b) ((a) < (b) ? (a) : (b)) 14 | #define CC_MAX(a, b) ((a) > (b) ? (a) : (b)) 15 | #define CC_CLAMP(min, max, x) (CC_MAX((min), CC_MIN((max), (x)))) 16 | #define CC_COUNT_OF(array) (sizeof(array) / sizeof(*(array))) 17 | #define CC_DIVIDE_ROUND(a, b) (((a) + (b / 2)) / (b)) 18 | #define CC_DIVIDE_CEILING(a, b) (((a) + (b - 1)) / (b)) 19 | 20 | /* Common constants. */ 21 | #define CC_PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679 22 | 23 | #endif /* CLOWNCOMMON_H */ 24 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtn.h: -------------------------------------------------------------------------------- 1 | // '16/04/28 pxtn.h 2 | // '16/12/03 pxtnRESULT. 3 | // '16/12/15 pxtnRESULT -> pxtnERR/pxtnOK. 4 | 5 | #ifndef pxtn_H 6 | #define pxtn_H 7 | 8 | //#define pxINCLUDE_OGGVORBIS 1 9 | // $(SolutionDir)libogg\include;$(SolutionDir)libvorbis\include; 10 | 11 | #if defined(_WIN32) 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | typedef struct 23 | { 24 | int32_t x; 25 | int32_t y; 26 | } 27 | pxtnPOINT; 28 | 29 | #include "./pxtnError.h" 30 | 31 | #ifndef SAFE_DELETE 32 | #define SAFE_DELETE(p) { if( p ){ delete( p ); p = NULL; } } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/snes_spc/blargg_config.h: -------------------------------------------------------------------------------- 1 | // snes_spc 0.9.0 user configuration file. Don't replace when updating library. 2 | 3 | // snes_spc 0.9.0 4 | #ifndef BLARGG_CONFIG_H 5 | #define BLARGG_CONFIG_H 6 | 7 | // Uncomment to disable debugging checks 8 | //#define NDEBUG 1 9 | 10 | // Uncomment to enable platform-specific (and possibly non-portable) optimizations 11 | //#define BLARGG_NONPORTABLE 1 12 | 13 | // Uncomment if automatic byte-order determination doesn't work 14 | //#define BLARGG_BIG_ENDIAN 1 15 | 16 | // Uncomment if you get errors in the bool section of blargg_common.h 17 | //#define BLARGG_COMPILER_HAS_BOOL 1 18 | 19 | // Use standard config.h if present 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/win32.c: -------------------------------------------------------------------------------- 1 | /* _[v]snprintf() from msvcrt.dll might not nul terminate */ 2 | /* OpenWatcom-provided versions seem to behave the same... */ 3 | 4 | #include "common.h" 5 | 6 | #if defined(USE_LIBXMP_SNPRINTF) 7 | 8 | #undef snprintf 9 | #undef vsnprintf 10 | 11 | int libxmp_vsnprintf(char *str, size_t sz, const char *fmt, va_list ap) 12 | { 13 | int rc = _vsnprintf(str, sz, fmt, ap); 14 | if (sz != 0) { 15 | if (rc < 0) rc = (int)sz; 16 | if ((size_t)rc >= sz) str[sz - 1] = '\0'; 17 | } 18 | return rc; 19 | } 20 | 21 | int libxmp_snprintf (char *str, size_t sz, const char *fmt, ...) 22 | { 23 | va_list ap; 24 | int rc; 25 | 26 | va_start (ap, fmt); 27 | rc = _vsnprintf(str, sz, fmt, ap); 28 | va_end (ap); 29 | 30 | return rc; 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/readrle.h: -------------------------------------------------------------------------------- 1 | /* nomarch 1.0 - extract old `.arc' archives. 2 | * Copyright (C) 2001 Russell Marks. See main.c for license details. 3 | * 4 | * readrle.h 5 | */ 6 | 7 | #ifndef LIBXMP_READRLE_H 8 | #define LIBXMP_READRLE_H 9 | 10 | struct rledata { 11 | int lastchr,repeating; 12 | }; 13 | 14 | struct data_in_out { 15 | unsigned char *data_in_point,*data_in_max; 16 | unsigned char *data_out_point,*data_out_max; 17 | }; 18 | 19 | void libxmp_outputrle(int chr,void (*outputfunc)(int, struct data_in_out *), 20 | struct rledata *, struct data_in_out *); 21 | 22 | unsigned char *libxmp_convert_rle(unsigned char *data_in, 23 | unsigned long in_len, 24 | unsigned long orig_len); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnPulse_Oscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef pxtnPulse_Oscillator_H 2 | #define pxtnPulse_Oscillator_H 3 | 4 | #include "./pxtn.h" 5 | 6 | class pxtnPulse_Oscillator 7 | { 8 | private: 9 | void operator = (const pxtnPulse_Oscillator& src); 10 | pxtnPulse_Oscillator(const pxtnPulse_Oscillator& src); 11 | 12 | pxtnPOINT *_p_point ; 13 | int32_t _point_num ; 14 | int32_t _point_reso; 15 | int32_t _volume ; 16 | int32_t _sample_num; 17 | 18 | public: 19 | 20 | pxtnPulse_Oscillator(); 21 | 22 | void ReadyGetSample( pxtnPOINT *p_point, int32_t point_num, int32_t volume, int32_t sample_num, int32_t point_reso ); 23 | double GetOneSample_Overtone ( int32_t index ); 24 | double GetOneSample_Coodinate( int32_t index ); 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtoneNoise.h: -------------------------------------------------------------------------------- 1 | // 12/03/29 2 | 3 | #ifndef pxtoneNoise_H 4 | #define pxtoneNoise_H 5 | 6 | #include "./pxtn.h" 7 | 8 | #include "./pxtnDescriptor.h" 9 | 10 | class pxtoneNoise 11 | { 12 | private: 13 | void operator = (const pxtoneNoise& src); 14 | pxtoneNoise (const pxtoneNoise& src); 15 | 16 | void *_bldr ; 17 | int32_t _ch_num; 18 | int32_t _sps ; 19 | int32_t _bps ; 20 | 21 | public: 22 | pxtoneNoise(); 23 | ~pxtoneNoise(); 24 | 25 | bool init (); 26 | 27 | bool quality_set( int32_t ch_num, int32_t sps, int32_t bps ); 28 | void quality_get( int32_t *p_ch_num, int32_t *p_sps, int32_t *p_bps ) const; 29 | 30 | bool generate ( pxtnDescriptor *p_doc, void **pp_buf, int32_t *p_size ) const; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/period.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_PERIOD_H 2 | #define LIBXMP_PERIOD_H 3 | 4 | #define PERIOD_BASE 13696.0 /* C0 period */ 5 | 6 | /* Macros for period conversion */ 7 | #define NOTE_B0 11 8 | #define NOTE_Bb0 (NOTE_B0 + 1) 9 | #define MAX_NOTE (NOTE_B0 * 8) 10 | #define MAX_PERIOD 0x1c56 11 | #define MIN_PERIOD_A 0x0071 12 | #define MAX_PERIOD_A 0x0358 13 | #define MIN_PERIOD_L 0x0000 14 | #define MAX_PERIOD_L 0x1e00 15 | #define MIN_NOTE_MOD 48 16 | #define MAX_NOTE_MOD 83 17 | 18 | double libxmp_note_to_period (struct context_data *, int, int, double); 19 | double libxmp_note_to_period_mix (int, int); 20 | int libxmp_period_to_note (int); 21 | int libxmp_period_to_bend (struct context_data *, double, int, double); 22 | void libxmp_c2spd_to_note (int, int *, int *); 23 | 24 | #endif /* LIBXMP_PERIOD_H */ 25 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/period.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_PERIOD_H 2 | #define LIBXMP_PERIOD_H 3 | 4 | #define PERIOD_BASE 13696.0 /* C0 period */ 5 | 6 | /* Macros for period conversion */ 7 | #define NOTE_B0 11 8 | #define NOTE_Bb0 (NOTE_B0 + 1) 9 | #define MAX_NOTE (NOTE_B0 * 8) 10 | #define MAX_PERIOD 0x1c56 11 | #define MIN_PERIOD_A 0x0071 12 | #define MAX_PERIOD_A 0x0358 13 | #define MIN_PERIOD_L 0x0000 14 | #define MAX_PERIOD_L 0x1e00 15 | #define MIN_NOTE_MOD 48 16 | #define MAX_NOTE_MOD 83 17 | 18 | double libxmp_note_to_period (struct context_data *, int, int, double); 19 | double libxmp_note_to_period_mix (int, int); 20 | int libxmp_period_to_note (int); 21 | int libxmp_period_to_bend (struct context_data *, double, int, double); 22 | void libxmp_c2spd_to_note (int, int *, int *); 23 | 24 | #endif /* LIBXMP_PERIOD_H */ 25 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/test/Makefile: -------------------------------------------------------------------------------- 1 | 2 | TEST_OBJS = test.o 3 | TEST_DFILES = Makefile $(TEST_OBJS:.o=.c) test.it 4 | TEST_PATH = test 5 | 6 | MAIN_OBJS = md5.o 7 | MAIN_PATH = src 8 | 9 | T_OBJS = $(addprefix $(TEST_PATH)/,$(TEST_OBJS)) 10 | T_OBJS += $(addprefix $(MAIN_PATH)/,$(MAIN_OBJS)) 11 | 12 | default: 13 | $(MAKE) -C .. check 14 | 15 | dist-test: 16 | mkdir -p $(DIST)/$(TEST_PATH) 17 | cp -RPp $(addprefix $(TEST_PATH)/,$(TEST_DFILES)) $(DIST)/$(TEST_PATH) 18 | 19 | check: $(TEST_PATH)/libxmp-test 20 | cd $(TEST_PATH); LD_LIBRARY_PATH=../lib DYLD_LIBRARY_PATH=../lib LIBRARY_PATH=../lib:$$LIBRARY_PATH PATH=$$PATH:../lib ./libxmp-test 21 | 22 | $(TEST_PATH)/libxmp-test: $(T_OBJS) 23 | @CMD='$(LD) -o $@ $(T_OBJS) $(LIBS) -Llib -lxmp-lite'; \ 24 | if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo LD $@ ; fi; \ 25 | eval $$CMD 26 | 27 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnPulse_NoiseBuilder.h: -------------------------------------------------------------------------------- 1 | #ifndef pxtnPulse_NoiseBuilder_H 2 | #define pxtnPulse_NoiseBuilder_H 3 | 4 | #include "./pxtn.h" 5 | 6 | #include "./pxtnPulse_Noise.h" 7 | 8 | class pxtnPulse_NoiseBuilder 9 | { 10 | private: 11 | void operator = (const pxtnPulse_NoiseBuilder& src); 12 | pxtnPulse_NoiseBuilder(const pxtnPulse_NoiseBuilder& src); 13 | 14 | bool _b_init; 15 | short* _p_tables[ pxWAVETYPE_num ]; 16 | int32_t _rand_buf [ 2 ]; 17 | 18 | void _random_reset(); 19 | short _random_get (); 20 | 21 | pxtnPulse_Frequency* _freq; 22 | 23 | public : 24 | 25 | pxtnPulse_NoiseBuilder(); 26 | ~pxtnPulse_NoiseBuilder(); 27 | 28 | bool Init(); 29 | 30 | pxtnPulse_PCM *BuildNoise( pxtnPulse_Noise *p_noise, int32_t ch, int32_t sps, int32_t bps ) const; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/demo/demo_util.h: -------------------------------------------------------------------------------- 1 | /* General-purpose utilities used by demos */ 2 | 3 | /* snes_spc 0.9.0 */ 4 | #ifndef DEMO_UTIL_H 5 | #define DEMO_UTIL_H 6 | 7 | /* commonly used headers */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /* If str is not NULL, prints it and exits program, otherwise returns */ 18 | void error( const char* str ); 19 | 20 | /* Loads file and returns pointer to data in memory, allocated with malloc(). 21 | If size_out != NULL, sets *size_out to size of data. */ 22 | unsigned char* load_file( const char* path, long* size_out ); 23 | 24 | /* Writes data to file */ 25 | void write_file( const char* path, void const* in, long size ); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /LICENCE.txt: -------------------------------------------------------------------------------- 1 | zlib License 2 | 3 | Copyright (c) 2018-2021 Clownacy 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/extras.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_EXTRAS_H 2 | #define LIBXMP_EXTRAS_H 3 | 4 | void libxmp_release_module_extras(struct context_data *); 5 | int libxmp_new_channel_extras(struct context_data *, struct channel_data *); 6 | void libxmp_release_channel_extras(struct context_data *, struct channel_data *); 7 | void libxmp_reset_channel_extras(struct context_data *, struct channel_data *); 8 | void libxmp_play_extras(struct context_data *, struct channel_data *, int); 9 | int libxmp_extras_get_volume(struct context_data *, struct channel_data *); 10 | int libxmp_extras_get_period(struct context_data *, struct channel_data *); 11 | int libxmp_extras_get_linear_bend(struct context_data *, struct channel_data *); 12 | void libxmp_extras_process_fx(struct context_data *, struct channel_data *, int, uint8, uint8, uint8, int); 13 | 14 | 15 | /* FIXME */ 16 | void libxmp_med_hold_hack(struct context_data *ctx, int, int, int); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /examples/cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | 3 | option(COMPILE_AS_CPP "Compile the program as C++ instead of C, for compilers that don't support C99 but do support C++98" OFF) 4 | option(SUBDIRECTORY "Use clownaudio as a subdirectory, instead of an external package" ON) 5 | 6 | if(COMPILE_AS_CPP) 7 | set(LANGUAGES CXX) 8 | else() 9 | set(LANGUAGES C CXX) 10 | endif() 11 | 12 | project(clownaudio_test LANGUAGES ${LANGUAGES}) 13 | 14 | add_executable(test "test.c") 15 | 16 | if(COMPILE_AS_CPP) 17 | set_source_files_properties("test.c" PROPERTIES LANGUAGE CXX) 18 | endif() 19 | 20 | if(SUBDIRECTORY) 21 | add_subdirectory("../.." "clownaudio" EXCLUDE_FROM_ALL) 22 | else() 23 | find_package(clownaudio REQUIRED) 24 | endif() 25 | 26 | target_link_libraries(test PRIVATE clownaudio) 27 | 28 | set_target_properties(test PROPERTIES 29 | C_STANDARD 99 30 | C_EXTENSIONS OFF 31 | CXX_STANDARD 98 32 | CXX_EXTENSIONS OFF 33 | ) 34 | 35 | if(MSVC) 36 | target_compile_definitions(test PRIVATE _CRT_SECURE_NO_WARNINGS) # Shut up those stupid warnings 37 | endif() 38 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/muse.c: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * This file is part of the Extended Module Player and is distributed 5 | * under the terms of the GNU Lesser General Public License. See COPYING.LIB 6 | * for more information. 7 | */ 8 | 9 | #include "../common.h" 10 | #include "depacker.h" 11 | #include "inflate.h" 12 | 13 | static int test_muse(unsigned char *b) 14 | { 15 | if (memcmp(b, "MUSE", 4) == 0) { 16 | uint32 r = readmem32b(b + 4); 17 | /* MOD2J2B uses 0xdeadbabe */ 18 | if (r == 0xdeadbeaf || r == 0xdeadbabe) { 19 | return 1; 20 | } 21 | } 22 | 23 | return 0; 24 | } 25 | 26 | static int decrunch_muse(FILE *f, FILE *fo) 27 | { 28 | uint32 checksum; 29 | 30 | if (fseek(f, 24, SEEK_SET) < 0) { 31 | return -1; 32 | } 33 | 34 | return libxmp_inflate(f, fo, &checksum, 0); 35 | } 36 | 37 | struct depacker libxmp_depacker_muse = { 38 | test_muse, 39 | decrunch_muse 40 | }; 41 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/paula.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_PAULA_H 2 | #define LIBXMP_PAULA_H 3 | 4 | /* 131072 to 0, 2048 entries */ 5 | #define PAULA_HZ 3546895 6 | #define MINIMUM_INTERVAL 16 7 | #define BLEP_SCALE 17 8 | #define BLEP_SIZE 2048 9 | #define MAX_BLEPS (BLEP_SIZE / MINIMUM_INTERVAL) 10 | 11 | /* the structure that holds data of bleps */ 12 | struct blep_state { 13 | int16 level; 14 | int16 age; 15 | }; 16 | 17 | struct paula_state { 18 | /* the instantenous value of Paula output */ 19 | int16 global_output_level; 20 | 21 | /* count of simultaneous bleps to keep track of */ 22 | unsigned int active_bleps; 23 | 24 | /* place to keep our bleps in. MAX_BLEPS should be 25 | * defined as a BLEP_SIZE / MINIMUM_EVENT_INTERVAL. 26 | * For Paula, minimum event interval could be even 1, but it makes 27 | * sense to limit it to some higher value such as 16. */ 28 | struct blep_state blepstate[MAX_BLEPS]; 29 | 30 | double remainder; 31 | double fdiv; 32 | }; 33 | 34 | 35 | void libxmp_paula_init (struct context_data *, struct paula_state *); 36 | 37 | #endif /* !LIBXMP_PAULA_H */ 38 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/win32.c: -------------------------------------------------------------------------------- 1 | /* _[v]snprintf() from msvcrt.dll might not nul terminate */ 2 | /* OpenWatcom-provided versions seem to behave the same... */ 3 | 4 | #include "common.h" 5 | 6 | #if defined(USE_LIBXMP_SNPRINTF) 7 | 8 | #undef snprintf 9 | #undef vsnprintf 10 | 11 | int libxmp_vsnprintf(char *str, size_t sz, const char *fmt, va_list ap) 12 | { 13 | int rc = _vsnprintf(str, sz, fmt, ap); 14 | if (sz != 0) { 15 | if (rc < 0) rc = (int)sz; 16 | if ((size_t)rc >= sz) str[sz - 1] = '\0'; 17 | } 18 | return rc; 19 | } 20 | 21 | int libxmp_snprintf (char *str, size_t sz, const char *fmt, ...) 22 | { 23 | va_list ap; 24 | int rc; 25 | 26 | va_start (ap, fmt); 27 | rc = _vsnprintf(str, sz, fmt, ap); 28 | va_end (ap); 29 | 30 | return rc; 31 | } 32 | 33 | #endif 34 | 35 | /* 36 | * Win32 debug message helper by Mirko Buffoni 37 | */ 38 | #if defined(_MSC_VER) && defined(DEBUG) 39 | void D_(const char *format, ...) 40 | { 41 | va_list argptr; 42 | 43 | /* do the output */ 44 | va_start(argptr, format); 45 | vprintf(format, argptr); 46 | printf("\n"); 47 | va_end(argptr); 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /clownaudioConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | if(NOT @BUILD_SHARED_LIBS@) 4 | if(@CLOWNAUDIO_LIBVORBIS@) 5 | find_package(PkgConfig REQUIRED) 6 | pkg_check_modules(vorbisfile REQUIRED IMPORTED_TARGET vorbisfile) 7 | endif() 8 | 9 | if(@CLOWNAUDIO_LIBFLAC@) 10 | find_package(PkgConfig REQUIRED) 11 | pkg_check_modules(flac REQUIRED IMPORTED_TARGET flac) 12 | endif() 13 | 14 | if(@CLOWNAUDIO_LIBOPUS@) 15 | find_package(PkgConfig REQUIRED) 16 | pkg_check_modules(opusfile REQUIRED IMPORTED_TARGET opusfile) 17 | endif() 18 | 19 | if(@CLOWNAUDIO_LIBSNDFILE@) 20 | find_package(PkgConfig REQUIRED) 21 | pkg_check_modules(sndfile REQUIRED IMPORTED_TARGET sndfile) 22 | endif() 23 | 24 | if(@CLOWNAUDIO_LIBOPENMPT@) 25 | find_package(PkgConfig REQUIRED) 26 | pkg_check_modules(libopenmpt REQUIRED IMPORTED_TARGET libopenmpt) 27 | endif() 28 | 29 | if(@libxmp-lite_FOUND@) 30 | find_package(PkgConfig REQUIRED) 31 | pkg_check_modules(libxmp-lite REQUIRED IMPORTED_TARGET libxmp-lite) 32 | endif() 33 | endif() 34 | 35 | include("${CMAKE_CURRENT_LIST_DIR}/clownaudioTargets.cmake") 36 | check_required_components(clownaudio) 37 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnPulse_Oggv.h: -------------------------------------------------------------------------------- 1 | #ifndef pxtnPulse_Oggv_H 2 | #define pxtnPulse_Oggv_H 3 | 4 | #ifdef pxINCLUDE_OGGVORBIS 5 | 6 | #include "./pxtn.h" 7 | 8 | #include "./pxtnDescriptor.h" 9 | #include "./pxtnPulse_PCM.h" 10 | 11 | class pxtnPulse_Oggv 12 | { 13 | private: 14 | void operator = (const pxtnPulse_Oggv& src); 15 | pxtnPulse_Oggv (const pxtnPulse_Oggv& src); 16 | 17 | int32_t _ch ; 18 | int32_t _sps2 ; 19 | int32_t _smp_num; 20 | int32_t _size ; 21 | char* _p_data ; 22 | 23 | bool _SetInformation(); 24 | 25 | public : 26 | 27 | pxtnPulse_Oggv(); 28 | ~pxtnPulse_Oggv(); 29 | 30 | pxtnERR Decode ( pxtnPulse_PCM *p_pcm ) const; 31 | void Release(); 32 | bool GetInfo( int* p_ch, int* p_sps, int* p_smp_num ); 33 | int32_t GetSize() const; 34 | 35 | bool ogg_write ( pxtnDescriptor *p_doc ) const; 36 | pxtnERR ogg_read ( pxtnDescriptor *p_doc ); 37 | bool pxtn_write( pxtnDescriptor *p_doc ) const; 38 | bool pxtn_read ( pxtnDescriptor *p_doc ); 39 | 40 | bool Copy ( pxtnPulse_Oggv *p_dst ) const; 41 | }; 42 | #endif 43 | #endif 44 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnText.h: -------------------------------------------------------------------------------- 1 | // '12/03/03 2 | 3 | #ifndef pxtnText_H 4 | #define pxtnText_H 5 | 6 | #include "./pxtn.h" 7 | 8 | #include "./pxtnDescriptor.h" 9 | 10 | class pxtnText 11 | { 12 | private: 13 | void operator = (const pxtnText& src); 14 | pxtnText (const pxtnText& src); 15 | 16 | char* _p_comment_buf; 17 | int32_t _comment_size ; 18 | 19 | char* _p_name_buf ; 20 | int32_t _name_size ; 21 | 22 | public : 23 | pxtnText(); 24 | ~pxtnText(); 25 | 26 | bool set_comment_buf( const char *p_comment, int32_t buf_size ); 27 | const char* get_comment_buf( int32_t* p_buf_size ) const; 28 | bool is_comment_buf () const; 29 | 30 | bool set_name_buf ( const char *p_name , int32_t buf_size ); 31 | const char* get_name_buf ( int32_t* p_buf_size ) const; 32 | bool is_name_buf () const; 33 | 34 | bool Comment_r( pxtnDescriptor *p_doc ); 35 | bool Comment_w( pxtnDescriptor *p_doc ); 36 | bool Name_r ( pxtnDescriptor *p_doc ); 37 | bool Name_w ( pxtnDescriptor *p_doc ); 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /examples/gui/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2021 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/gui-qt/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #include "mainwindow.h" 20 | 21 | #include 22 | 23 | int main(int argc, char *argv[]) 24 | { 25 | QApplication a(argc, argv); 26 | MainWindow w; 27 | w.show(); 28 | return a.exec(); 29 | } 30 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnError.cpp: -------------------------------------------------------------------------------- 1 | #include "./pxtnError.h" 2 | 3 | static const char* _err_msg_tbl[ pxtnERR_num + 1 ] = 4 | { 5 | "OK" , 6 | "VOID" , 7 | "INIT" , 8 | "FATAL" , 9 | 10 | "anti operation" , 11 | 12 | "deny beatclock" , 13 | "desc w" , 14 | "desc r" , 15 | "desc broken " , 16 | 17 | "fmt new " , 18 | "fmt unknown " , 19 | 20 | "inv code" , 21 | "inv data" , 22 | 23 | "memory" , 24 | "moo init" , 25 | 26 | "ogg " , 27 | "ogg no supported", 28 | 29 | "param " , 30 | "pcm convert " , 31 | "pcm unknown " , 32 | "ptn build " , 33 | "ptn init" , 34 | "ptv no supported", 35 | 36 | "woice full" , 37 | 38 | "x1x ignore" , 39 | "x3x add tuning" , 40 | "x3x key " , 41 | 42 | "?", 43 | }; 44 | 45 | const char* pxtnError_get_string( pxtnERR err_code ) 46 | { 47 | if( err_code < 0 || err_code >= pxtnERR_num ) return _err_msg_tbl[ pxtnERR_num ]; 48 | return _err_msg_tbl[ err_code ]; 49 | } 50 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This code implements the MD5 message-digest algorithm. 3 | * The algorithm is due to Ron Rivest. This code was 4 | * written by Colin Plumb in 1993, no copyright is claimed. 5 | * This code is in the public domain; do with it what you wish. 6 | * 7 | * Equivalent code is available from RSA Data Security, Inc. 8 | * This code has been tested against that, and is equivalent, 9 | * except that you don't need to include two pages of legalese 10 | * with every copy. 11 | */ 12 | 13 | #ifndef LIBXMP_MD5_H 14 | #define LIBXMP_MD5_H 15 | 16 | #include "common.h" 17 | 18 | #define MD5_BLOCK_LENGTH 64 19 | #define MD5_DIGEST_LENGTH 16 20 | #define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1) 21 | 22 | typedef struct MD5Context { 23 | uint32 state[4]; /* state */ 24 | uint64 count; /* number of bits, mod 2^64 */ 25 | uint8 buffer[MD5_BLOCK_LENGTH]; /* input buffer */ 26 | } MD5_CTX; 27 | 28 | LIBXMP_BEGIN_DECLS 29 | 30 | void MD5Init(MD5_CTX *); 31 | void MD5Update(MD5_CTX *, const unsigned char *, size_t); 32 | void MD5Final(uint8[MD5_DIGEST_LENGTH], MD5_CTX *); 33 | 34 | LIBXMP_END_DECLS 35 | 36 | #endif /* LIBXMP_MD5_H */ 37 | 38 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/depacker.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_DEPACKER_H 2 | #define LIBXMP_DEPACKER_H 3 | 4 | #include "../common.h" 5 | #include "../hio.h" 6 | 7 | extern struct depacker libxmp_depacker_zip; 8 | extern struct depacker libxmp_depacker_lha; 9 | extern struct depacker libxmp_depacker_gzip; 10 | extern struct depacker libxmp_depacker_bzip2; 11 | extern struct depacker libxmp_depacker_xz; 12 | extern struct depacker libxmp_depacker_compress; 13 | extern struct depacker libxmp_depacker_pp; 14 | extern struct depacker libxmp_depacker_sqsh; 15 | extern struct depacker libxmp_depacker_arc; 16 | extern struct depacker libxmp_depacker_arcfs; 17 | extern struct depacker libxmp_depacker_mmcmp; 18 | extern struct depacker libxmp_depacker_muse; 19 | extern struct depacker libxmp_depacker_lzx; 20 | extern struct depacker libxmp_depacker_s404; 21 | extern struct depacker libxmp_depacker_xfd; 22 | extern struct depacker libxmp_depacker_oxm; 23 | 24 | struct depacker { 25 | int (*test)(unsigned char *); 26 | int (*depack)(FILE *, FILE *); 27 | }; 28 | 29 | int libxmp_decrunch (HIO_HANDLE **h, const char *filename, char **temp); 30 | int libxmp_exclude_match (const char *); 31 | 32 | #endif /* LIBXMP_DEPACKER_H */ 33 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/prowizard/ptktable.c: -------------------------------------------------------------------------------- 1 | 2 | #include "prowiz.h" 3 | 4 | const uint8 ptk_table[37][2] = { 5 | { 0x00, 0x00 }, 6 | 7 | { 0x03, 0x58 }, 8 | { 0x03, 0x28 }, 9 | { 0x02, 0xfa }, 10 | { 0x02, 0xd0 }, 11 | { 0x02, 0xa6 }, 12 | { 0x02, 0x80 }, /* 1 */ 13 | { 0x02, 0x5c }, 14 | { 0x02, 0x3a }, 15 | { 0x02, 0x1a }, 16 | { 0x01, 0xfc }, 17 | { 0x01, 0xe0 }, 18 | { 0x01, 0xc5 }, 19 | 20 | { 0x01, 0xac }, 21 | { 0x01, 0x94 }, 22 | { 0x01, 0x7d }, 23 | { 0x01, 0x68 }, 24 | { 0x01, 0x53 }, 25 | { 0x01, 0x40 }, /* 2 */ 26 | { 0x01, 0x2e }, 27 | { 0x01, 0x1d }, 28 | { 0x01, 0x0d }, 29 | { 0x00, 0xfe }, 30 | { 0x00, 0xf0 }, 31 | { 0x00, 0xe2 }, 32 | 33 | { 0x00, 0xd6 }, 34 | { 0x00, 0xca }, 35 | { 0x00, 0xbe }, 36 | { 0x00, 0xb4 }, 37 | { 0x00, 0xaa }, 38 | { 0x00, 0xa0 }, /* 3 */ 39 | { 0x00, 0x97 }, 40 | { 0x00, 0x8f }, 41 | { 0x00, 0x87 }, 42 | { 0x00, 0x7f }, 43 | { 0x00, 0x78 }, 44 | { 0x00, 0x71 } 45 | }; 46 | 47 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This code implements the MD5 message-digest algorithm. 3 | * The algorithm is due to Ron Rivest. This code was 4 | * written by Colin Plumb in 1993, no copyright is claimed. 5 | * This code is in the public domain; do with it what you wish. 6 | * 7 | * Equivalent code is available from RSA Data Security, Inc. 8 | * This code has been tested against that, and is equivalent, 9 | * except that you don't need to include two pages of legalese 10 | * with every copy. 11 | */ 12 | 13 | #ifndef LIBXMP_MD5_H 14 | #define LIBXMP_MD5_H 15 | 16 | #include "common.h" 17 | 18 | #define MD5_BLOCK_LENGTH 64 19 | #define MD5_DIGEST_LENGTH 16 20 | #define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1) 21 | 22 | typedef struct MD5Context { 23 | uint32 state[4]; /* state */ 24 | uint64 count; /* number of bits, mod 2^64 */ 25 | uint8 buffer[MD5_BLOCK_LENGTH]; /* input buffer */ 26 | } MD5_CTX; 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | void MD5Init(MD5_CTX *); 32 | void MD5Update(MD5_CTX *, const unsigned char *, size_t); 33 | void MD5Final(uint8[MD5_DIGEST_LENGTH], MD5_CTX *); 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* LIBXMP_MD5_H */ 39 | 40 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnError.h: -------------------------------------------------------------------------------- 1 | // '16/12/16 pxtnError. 2 | 3 | #ifndef pxtnError_H 4 | #define pxtnError_H 5 | 6 | enum pxtnERR 7 | { 8 | pxtnOK = 0, 9 | pxtnERR_VOID , 10 | pxtnERR_INIT , 11 | pxtnERR_FATAL , 12 | 13 | pxtnERR_anti_opreation , 14 | 15 | pxtnERR_deny_beatclock , 16 | 17 | pxtnERR_desc_w , 18 | pxtnERR_desc_r , 19 | pxtnERR_desc_broken , 20 | 21 | pxtnERR_fmt_new , 22 | pxtnERR_fmt_unknown , 23 | 24 | pxtnERR_inv_code , 25 | pxtnERR_inv_data , 26 | 27 | pxtnERR_memory , 28 | 29 | pxtnERR_moo_init , 30 | 31 | pxtnERR_ogg , 32 | pxtnERR_ogg_no_supported, 33 | 34 | pxtnERR_param , 35 | 36 | pxtnERR_pcm_convert , 37 | pxtnERR_pcm_unknown , 38 | 39 | pxtnERR_ptn_build , 40 | pxtnERR_ptn_init , 41 | 42 | pxtnERR_ptv_no_supported, 43 | 44 | pxtnERR_too_much_event , 45 | 46 | pxtnERR_woice_full , 47 | 48 | pxtnERR_x1x_ignore , 49 | 50 | pxtnERR_x3x_add_tuning , 51 | pxtnERR_x3x_key , 52 | 53 | pxtnERR_num 54 | }; 55 | 56 | const char* pxtnError_get_string( pxtnERR err_code ); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/Makefile.vc: -------------------------------------------------------------------------------- 1 | # Visual Studio makefile for Windows: 2 | # nmake -f Makefile.vc 3 | # 4 | 5 | CC = cl 6 | CFLAGS = /O2 /W3 /MD /Iinclude\libxmp-lite /Isrc /DBUILDING_DLL /DWIN32 \ 7 | /Dinline=__inline /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /DLIBXMP_CORE_PLAYER /DLIBXMP_NO_PROWIZARD /DLIBXMP_NO_DEPACKERS 8 | LD = link 9 | LDFLAGS = /DLL /RELEASE /OUT:$(DLL) 10 | DLL = libxmp-lite.dll 11 | 12 | OBJS = src\virtual.obj src\format.obj src\period.obj src\player.obj src\read_event.obj src\misc.obj src\dataio.obj src\lfo.obj src\scan.obj src\control.obj src\filter.obj src\effects.obj src\mixer.obj src\mix_all.obj src\load_helpers.obj src\load.obj src\hio.obj src\smix.obj src\memio.obj src\win32.obj src\loaders\common.obj src\loaders\itsex.obj src\loaders\sample.obj src\loaders\xm_load.obj src\loaders\mod_load.obj src\loaders\s3m_load.obj src\loaders\it_load.obj 13 | 14 | TEST = test\md5.obj test\test.obj 15 | 16 | .c.obj: 17 | $(CC) /c /nologo $(CFLAGS) /Fo$*.obj $< 18 | 19 | all: $(DLL) 20 | 21 | $(DLL): $(OBJS) 22 | $(LD) $(LDFLAGS) $(OBJS) 23 | 24 | clean: 25 | del $(OBJS) $(DLL) *.lib *.exp 26 | 27 | check: $(TEST) 28 | $(LD) /RELEASE /OUT:test\libxmp-lite-test.exe $(TEST) libxmp-lite.lib 29 | copy libxmp-lite.dll test 30 | cd test & libxmp-lite-test 31 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/prowizard/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Pro-Wizard support for Extended Module Player (libxmp) 2 | Copyright (C) 1997-1999 Sylvain "Asle" Chipaux 3 | Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a 6 | copy of this software and associated documentation files (the "Software"), 7 | to deal in the Software without restriction, including without limitation 8 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | and/or sell copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/snes_spc/SPC_Filter.h: -------------------------------------------------------------------------------- 1 | // Simple low-pass and high-pass filter to better match sound output of a SNES 2 | 3 | // snes_spc 0.9.0 4 | #ifndef SPC_FILTER_H 5 | #define SPC_FILTER_H 6 | 7 | #include "blargg_common.h" 8 | 9 | struct SPC_Filter { 10 | public: 11 | 12 | // Filters count samples of stereo sound in place. Count must be a multiple of 2. 13 | typedef short sample_t; 14 | void run( sample_t* io, int count ); 15 | 16 | // Optional features 17 | 18 | // Clears filter to silence 19 | void clear(); 20 | 21 | // Sets gain (volume), where gain_unit is normal. Gains greater than gain_unit 22 | // are fine, since output is clamped to 16-bit sample range. 23 | enum { gain_unit = 0x100 }; 24 | void set_gain( int gain ); 25 | 26 | // Sets amount of bass (logarithmic scale) 27 | enum { bass_none = 0 }; 28 | enum { bass_norm = 8 }; // normal amount 29 | enum { bass_max = 31 }; 30 | void set_bass( int bass ); 31 | 32 | public: 33 | SPC_Filter(); 34 | BLARGG_DISABLE_NOTHROW 35 | private: 36 | enum { gain_bits = 8 }; 37 | int gain; 38 | int bass; 39 | struct chan_t { int p1, pp1, sum; }; 40 | chan_t ch [2]; 41 | }; 42 | 43 | inline void SPC_Filter::set_gain( int g ) { gain = g; } 44 | 45 | inline void SPC_Filter::set_bass( int b ) { bass = b; } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnOverDrive.h: -------------------------------------------------------------------------------- 1 | // '12/03/03 2 | 3 | #ifndef pxtnOverDrive_H 4 | #define pxtnOverDrive_H 5 | 6 | #include "./pxtn.h" 7 | 8 | #include "./pxtnDescriptor.h" 9 | 10 | #define TUNEOVERDRIVE_CUT_MAX 99.9f 11 | #define TUNEOVERDRIVE_CUT_MIN 50.0f 12 | #define TUNEOVERDRIVE_AMP_MAX 8.0f 13 | #define TUNEOVERDRIVE_AMP_MIN 0.1f 14 | #define TUNEOVERDRIVE_DEFAULT_CUT 90.0f 15 | #define TUNEOVERDRIVE_DEFAULT_AMP 2.0f 16 | 17 | class pxtnOverDrive 18 | { 19 | private: 20 | void operator = (const pxtnOverDrive& src); 21 | pxtnOverDrive (const pxtnOverDrive& src); 22 | 23 | bool _b_played; 24 | 25 | int32_t _group ; 26 | float _cut_f ; 27 | float _amp_f ; 28 | 29 | int32_t _cut_16bit_top; 30 | public : 31 | 32 | pxtnOverDrive(); 33 | ~pxtnOverDrive(); 34 | 35 | void Tone_Ready(); 36 | void Tone_Supple( int32_t *group_smps ) const; 37 | 38 | bool Write( pxtnDescriptor *p_doc ) const; 39 | pxtnERR Read ( pxtnDescriptor *p_doc ); 40 | 41 | 42 | float get_cut ()const; 43 | float get_amp ()const; 44 | int32_t get_group()const; 45 | 46 | void Set( float cut, float amp, int32_t group ); 47 | 48 | bool get_played()const; 49 | void set_played( bool b ); 50 | bool switch_played(); 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/decoding/decoders/oswrapper_audio.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2023 Ned Loynd 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 9 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 11 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 12 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 13 | PERFORMANCE OF THIS SOFTWARE. 14 | */ 15 | 16 | #ifndef DECODER_OSWRAPPER_AUDIO_H 17 | #define DECODER_OSWRAPPER_AUDIO_H 18 | 19 | #ifndef __cplusplus 20 | #include 21 | #endif 22 | #include 23 | 24 | #include "common.h" 25 | 26 | extern bool is_oswrapper_audio_loaded; 27 | 28 | void* Decoder_OSWrapper_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 29 | void Decoder_OSWrapper_Destroy(void *decoder); 30 | void Decoder_OSWrapper_Rewind(void *decoder); 31 | size_t Decoder_OSWrapper_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 32 | 33 | #endif /* DECODER_OSWRAPPER_AUDIO_H */ 34 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnDescriptor.h: -------------------------------------------------------------------------------- 1 | // '11/08/12 pxFile.h 2 | // '16/01/22 pxFile.h 3 | // '16/04/27 pxtnFile. (int32_t) 4 | // '16/09/09 pxtnDescriptor. 5 | 6 | #ifndef pxtnDescriptor_H 7 | #define pxtnDescriptor_H 8 | 9 | #include "./pxtn.h" 10 | 11 | #include 12 | 13 | enum pxtnSEEK 14 | { 15 | pxtnSEEK_set = 0, 16 | pxtnSEEK_cur, 17 | pxtnSEEK_end, 18 | pxtnSEEK_num 19 | }; 20 | 21 | class pxtnDescriptor 22 | { 23 | private: 24 | 25 | void operator = (const pxtnDescriptor& src); 26 | pxtnDescriptor (const pxtnDescriptor& src); 27 | 28 | enum 29 | { 30 | _BUFSIZE_HEEP = 1024, 31 | _TAGLINE_NUM = 128 32 | }; 33 | 34 | void *_p_desc; 35 | bool _b_file ; 36 | bool _b_read ; 37 | int32_t _size ; 38 | int32_t _cur ; 39 | 40 | public: 41 | 42 | pxtnDescriptor(); 43 | 44 | bool set_file_r ( FILE *fp ); 45 | bool set_file_w ( FILE *fp ); 46 | bool set_memory_r( void *p_mem, int len ); 47 | bool seek ( pxtnSEEK mode, int val ); 48 | 49 | bool w_asfile( const void *p, int size, int num ); 50 | bool r ( void *p, int size, int num ); 51 | 52 | int v_w_asfile( int32_t val, int32_t *p_add ); 53 | bool v_r ( int32_t *p ); 54 | 55 | int get_size_bytes() const; 56 | }; 57 | 58 | int pxtnDescriptor_v_chk ( int val ); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/iff.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_IFF_H 2 | #define LIBXMP_IFF_H 3 | 4 | #include "../list.h" 5 | #include "../hio.h" 6 | 7 | #define IFF_NOBUFFER 0x0001 8 | 9 | #define IFF_LITTLE_ENDIAN 0x01 10 | #define IFF_FULL_CHUNK_SIZE 0x02 11 | #define IFF_CHUNK_ALIGN2 0x04 12 | #define IFF_CHUNK_ALIGN4 0x08 13 | #define IFF_SKIP_EMBEDDED 0x10 14 | #define IFF_CHUNK_TRUNC4 0x20 15 | 16 | #define IFF_MAX_CHUNK_SIZE 0x800000 17 | 18 | typedef void *iff_handle; 19 | 20 | struct iff_header { 21 | char form[4]; /* FORM */ 22 | int len; /* File length */ 23 | char id[4]; /* IFF type identifier */ 24 | }; 25 | 26 | struct iff_info { 27 | char id[4]; 28 | int (*loader)(struct module_data *, int, HIO_HANDLE *, void *); 29 | struct list_head list; 30 | }; 31 | 32 | iff_handle libxmp_iff_new(void); 33 | int libxmp_iff_load(iff_handle, struct module_data *, HIO_HANDLE *, void *); 34 | /* int libxmp_iff_chunk(iff_handle, struct module_data *, HIO_HANDLE *, void *); */ 35 | int libxmp_iff_register(iff_handle, const char *, 36 | int (*loader)(struct module_data *, int, HIO_HANDLE *, void *)); 37 | void libxmp_iff_id_size(iff_handle, int); 38 | void libxmp_iff_set_quirk(iff_handle, int); 39 | void libxmp_iff_release(iff_handle); 40 | /* int libxmp_iff_process(iff_handle, struct module_data *, char *, long, 41 | HIO_HANDLE *, void *); */ 42 | 43 | #endif /* LIBXMP_IFF_H */ 44 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/readlzw.h: -------------------------------------------------------------------------------- 1 | /* nomarch 1.3 - extract old `.arc' archives. 2 | * Copyright (C) 2001,2002 Russell Marks. See main.c for license details. 3 | * 4 | * Modified for xmp by Claudio Matsuoka, Aug 2007 5 | * 6 | * readlzw.h 7 | */ 8 | 9 | #ifndef LIBXMP_READLZW_H 10 | #define LIBXMP_READLZW_H 11 | 12 | #define ALIGN4(x) (((x) + 3) & ~3L) 13 | 14 | /* Digital Symphony LZW quirk */ 15 | #define XMP_LZW_QUIRK_DSYM (NOMARCH_QUIRK_END101|NOMARCH_QUIRK_NOCHK| \ 16 | NOMARCH_QUIRK_NOSYNC|NOMARCH_QUIRK_START101| \ 17 | NOMARCH_QUIRK_ALIGN4) 18 | 19 | #define NOMARCH_QUIRK_END101 (1L << 0) /* code 0x101 is end mark */ 20 | #define NOMARCH_QUIRK_NOCHK (1L << 1) /* don't check input size */ 21 | #define NOMARCH_QUIRK_NOSYNC (1L << 2) /* don't resync */ 22 | #define NOMARCH_QUIRK_START101 (1L << 3) /* start at 0x101 not 0x100 */ 23 | #define NOMARCH_QUIRK_ALIGN4 (1L << 4) /* input buffer size aligned */ 24 | #define NOMARCH_QUIRK_SKIPMAX (1L << 5) /* skip max code size */ 25 | 26 | struct local_data; 27 | 28 | uint8 *libxmp_convert_lzw_dynamic(unsigned char *data_in, 29 | int bits,int use_rle, 30 | unsigned long in_len, 31 | unsigned long orig_len, 32 | int q); 33 | 34 | uint8 *libxmp_read_lzw_dynamic(FILE *f, uint8 *buf, int max_bits,int use_rle, 35 | unsigned long in_len, unsigned long orig_len, int q); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/misc.c: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include "xmp.h" 25 | 26 | int xmp_syserrno (void) 27 | { 28 | return errno; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/misc.c: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include "xmp.h" 25 | 26 | int xmp_syserrno (void) 27 | { 28 | return errno; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/hio.h: -------------------------------------------------------------------------------- 1 | #ifndef XMP_HIO_H 2 | #define XMP_HIO_H 3 | 4 | #include "callbackio.h" 5 | #include "memio.h" 6 | 7 | #define HIO_HANDLE_TYPE(x) ((x)->type) 8 | 9 | enum hio_type { 10 | HIO_HANDLE_TYPE_FILE, 11 | HIO_HANDLE_TYPE_MEMORY, 12 | HIO_HANDLE_TYPE_CBFILE 13 | }; 14 | 15 | typedef struct { 16 | enum hio_type type; 17 | long size; 18 | union { 19 | FILE *file; 20 | MFILE *mem; 21 | CBFILE *cbfile; 22 | } handle; 23 | int error; 24 | int noclose; 25 | } HIO_HANDLE; 26 | 27 | int8 hio_read8s (HIO_HANDLE *); 28 | uint8 hio_read8 (HIO_HANDLE *); 29 | uint16 hio_read16l (HIO_HANDLE *); 30 | uint16 hio_read16b (HIO_HANDLE *); 31 | uint32 hio_read24l (HIO_HANDLE *); 32 | uint32 hio_read24b (HIO_HANDLE *); 33 | uint32 hio_read32l (HIO_HANDLE *); 34 | uint32 hio_read32b (HIO_HANDLE *); 35 | size_t hio_read (void *, size_t, size_t, HIO_HANDLE *); 36 | int hio_seek (HIO_HANDLE *, long, int); 37 | long hio_tell (HIO_HANDLE *); 38 | int hio_eof (HIO_HANDLE *); 39 | int hio_error (HIO_HANDLE *); 40 | HIO_HANDLE *hio_open (const char *, const char *); 41 | HIO_HANDLE *hio_open_mem (const void *, long); 42 | HIO_HANDLE *hio_open_file (FILE *); 43 | HIO_HANDLE *hio_open_file2 (FILE *);/* allows fclose()ing the file by libxmp */ 44 | HIO_HANDLE *hio_open_callbacks (void *, struct xmp_callbacks); 45 | int hio_close (HIO_HANDLE *); 46 | long hio_size (HIO_HANDLE *); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/hio.h: -------------------------------------------------------------------------------- 1 | #ifndef XMP_HIO_H 2 | #define XMP_HIO_H 3 | 4 | #include "callbackio.h" 5 | #include "memio.h" 6 | 7 | #define HIO_HANDLE_TYPE(x) ((x)->type) 8 | 9 | enum hio_type { 10 | HIO_HANDLE_TYPE_FILE, 11 | HIO_HANDLE_TYPE_MEMORY, 12 | HIO_HANDLE_TYPE_CBFILE 13 | }; 14 | 15 | typedef struct { 16 | enum hio_type type; 17 | long size; 18 | union { 19 | FILE *file; 20 | MFILE *mem; 21 | CBFILE *cbfile; 22 | } handle; 23 | int error; 24 | int noclose; 25 | } HIO_HANDLE; 26 | 27 | int8 hio_read8s (HIO_HANDLE *); 28 | uint8 hio_read8 (HIO_HANDLE *); 29 | uint16 hio_read16l (HIO_HANDLE *); 30 | uint16 hio_read16b (HIO_HANDLE *); 31 | uint32 hio_read24l (HIO_HANDLE *); 32 | uint32 hio_read24b (HIO_HANDLE *); 33 | uint32 hio_read32l (HIO_HANDLE *); 34 | uint32 hio_read32b (HIO_HANDLE *); 35 | size_t hio_read (void *, size_t, size_t, HIO_HANDLE *); 36 | int hio_seek (HIO_HANDLE *, long, int); 37 | long hio_tell (HIO_HANDLE *); 38 | int hio_eof (HIO_HANDLE *); 39 | int hio_error (HIO_HANDLE *); 40 | HIO_HANDLE *hio_open (const char *, const char *); 41 | HIO_HANDLE *hio_open_mem (const void *, long); 42 | HIO_HANDLE *hio_open_file (FILE *); 43 | HIO_HANDLE *hio_open_file2 (FILE *);/* allows fclose()ing the file by libxmp */ 44 | HIO_HANDLE *hio_open_callbacks (void *, struct xmp_callbacks); 45 | int hio_close (HIO_HANDLE *); 46 | long hio_size (HIO_HANDLE *); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/INSTALL: -------------------------------------------------------------------------------- 1 | Requirements 2 | ------------ 3 | 4 | - This package needs to be built using GNU make 5 | (https://www.gnu.org/software/make/). On BSD or SysV systems, you may 6 | need to use "gmake" instead of "make". 7 | 8 | 9 | Building the library 10 | -------------------- 11 | 12 | In most systems just execute: 13 | 14 | $ ./configure 15 | $ make 16 | 17 | We'll build the shared library by default. Use ./configure --enable-static 18 | to build the static library. To check if the library was correctly built, 19 | run: 20 | 21 | $ make check 22 | 23 | Use ./configure --help to see more options. 24 | 25 | 26 | To build for Windows using Visual Studio, use Makefile.vc: 27 | 28 | nmake -f Makefile.vc (read/edit Makefile.vc as necessary.) 29 | 30 | To build for Windows using OpenWatcom, use Makefile.w32: 31 | 32 | wmake -f Makefile.w32 (read/edit Makefile.w32 as necessary.) 33 | 34 | To build for OS/2 using OpenWatcom, use Makefile.os2: 35 | 36 | wmake -f Makefile.os2 (read/edit Makefile.os2 as necessary.) 37 | 38 | 39 | Installation 40 | ------------ 41 | 42 | To install the library and development components, just run: 43 | 44 | # make install 45 | 46 | as the superuser. This will install the shared and static libraries, 47 | header file and pkg-config file into directories under /usr/local or a 48 | different location selected with the --prefix option in configure. 49 | 50 | -------------------------------------------------------------------------------- /package/arch/PKGBUILD: -------------------------------------------------------------------------------- 1 | pkgname=clownaudio-git 2 | pkgver=r430.4a508d0 3 | pkgrel=1 4 | pkgdesc='Stereo audio engine supporting various formats' 5 | arch=('any') 6 | url='https://github.com/Clownacy/clownaudio' 7 | license=('zlib', 'MIT', 'LGPL2', 'custom') 8 | depends=( 9 | 'libvorbis' 10 | 'flac' 11 | 'opusfile' 12 | ) 13 | makedepends=('cmake') 14 | source=("git+https://github.com/Clownacy/clownaudio.git") 15 | sha256sums=('SKIP') 16 | 17 | pkgver() { 18 | cd "${srcdir}/clownaudio" 19 | printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" 20 | } 21 | 22 | prepare() { 23 | mkdir -p "${srcdir}/clownaudio/build" 24 | } 25 | 26 | build() { 27 | cd "${srcdir}/clownaudio/build" 28 | 29 | cmake .. \ 30 | -DCMAKE_INSTALL_PREFIX=/usr \ 31 | -DBUILD_SHARED_LIBS=ON \ 32 | -DCLOWNAUDIO_CPP=OFF \ 33 | -DCLOWNAUDIO_LIBVORBIS=ON \ 34 | -DCLOWNAUDIO_STB_VORBIS=OFF \ 35 | -DCLOWNAUDIO_DR_MP3=ON \ 36 | -DCLOWNAUDIO_LIBOPUS=ON \ 37 | -DCLOWNAUDIO_LIBFLAC=ON \ 38 | -DCLOWNAUDIO_DR_FLAC=OFF \ 39 | -DCLOWNAUDIO_DR_WAV=ON \ 40 | -DCLOWNAUDIO_LIBSNDFILE=OFF \ 41 | -DCLOWNAUDIO_LIBOPENMPT=OFF \ 42 | -DCLOWNAUDIO_LIBXMPLITE=ON \ 43 | -DCLOWNAUDIO_PXTONE=ON \ 44 | -DCLOWNAUDIO_SNES_SPC=ON \ 45 | -DCLOWNAUDIO_BACKEND=miniaudio \ 46 | -Wno-dev 47 | 48 | make 49 | } 50 | 51 | package() { 52 | make -C "${srcdir}/clownaudio/build" DESTDIR="$pkgdir" install 53 | } 54 | -------------------------------------------------------------------------------- /src/decoding/decoders/dr_mp3.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_DR_MP3_H 20 | #define DECODER_DR_MP3_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_DR_MP3_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_DR_MP3_Destroy(void *decoder); 31 | void Decoder_DR_MP3_Rewind(void *decoder); 32 | size_t Decoder_DR_MP3_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_DR_MP3_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/dr_wav.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_DR_WAV_H 20 | #define DECODER_DR_WAV_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_DR_WAV_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_DR_WAV_Destroy(void *decoder); 31 | void Decoder_DR_WAV_Rewind(void *decoder); 32 | size_t Decoder_DR_WAV_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_DR_WAV_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/libxmp.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_LIBXMP_H 20 | #define DECODER_LIBXMP_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_libXMP_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_libXMP_Destroy(void *decoder); 31 | void Decoder_libXMP_Rewind(void *decoder); 32 | size_t Decoder_libXMP_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_LIBXMP_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/dr_flac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_DR_FLAC_H 20 | #define DECODER_DR_FLAC_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_DR_FLAC_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_DR_FLAC_Destroy(void *decoder); 31 | void Decoder_DR_FLAC_Rewind(void *decoder); 32 | size_t Decoder_DR_FLAC_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_DR_FLAC_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/libflac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_LIBFLAC_H 20 | #define DECODER_LIBFLAC_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_libFLAC_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_libFLAC_Destroy(void *decoder); 31 | void Decoder_libFLAC_Rewind(void *decoder); 32 | size_t Decoder_libFLAC_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_LIBFLAC_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/libopus.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_LIBOPUS_H 20 | #define DECODER_LIBOPUS_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_libOpus_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_libOpus_Destroy(void *decoder); 31 | void Decoder_libOpus_Rewind(void *decoder); 32 | size_t Decoder_libOpus_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_LIBOPUS_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/libsndfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_LIBSNDFILE_H 20 | #define DECODER_LIBSNDFILE_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_libSndfile_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_libSndfile_Destroy(void *decoder); 31 | void Decoder_libSndfile_Rewind(void *decoder); 32 | size_t Decoder_libSndfile_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/xz_stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for handling the .xz file format 3 | * 4 | * Author: Lasse Collin 5 | * 6 | * This file has been put into the public domain. 7 | * You can do whatever you want with this file. 8 | */ 9 | 10 | #ifndef XZ_STREAM_H 11 | #define XZ_STREAM_H 12 | 13 | /* 14 | * See the .xz file format specification at 15 | * http://tukaani.org/xz/xz-file-format.txt 16 | * to understand the container format. 17 | */ 18 | 19 | #define STREAM_HEADER_SIZE 12 20 | 21 | #define HEADER_MAGIC "\3757zXZ" 22 | #define HEADER_MAGIC_SIZE 6 23 | 24 | #define FOOTER_MAGIC "YZ" 25 | #define FOOTER_MAGIC_SIZE 2 26 | 27 | /* 28 | * Variable-length integer can hold a 63-bit unsigned integer or a special 29 | * value indicating that the value is unknown. 30 | * 31 | * Experimental: vli_type can be defined to uint32 to save a few bytes 32 | * in code size (no effect on speed). Doing so limits the uncompressed and 33 | * compressed size of the file to less than 256 MiB and may also weaken 34 | * error detection slightly. 35 | */ 36 | typedef uint64 vli_type; 37 | 38 | #define VLI_MAX ((vli_type)-1 / 2) 39 | #define VLI_UNKNOWN ((vli_type)-1) 40 | 41 | /* Maximum encoded size of a VLI */ 42 | #define VLI_BYTES_MAX (sizeof(vli_type) * 8 / 7) 43 | 44 | /* Integrity Check types */ 45 | enum xz_check { 46 | XZ_CHECK_NONE = 0, 47 | XZ_CHECK_CRC32 = 1, 48 | XZ_CHECK_CRC64 = 4, 49 | XZ_CHECK_SHA256 = 10 50 | }; 51 | 52 | /* Maximum possible Check ID */ 53 | #define XZ_CHECK_MAX 15 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/decoding/decoders/snes_spc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_SNES_SPC_H 20 | #define DECODER_SNES_SPC_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_SNES_SPC_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_SNES_SPC_Destroy(void *decoder); 31 | void Decoder_SNES_SPC_Rewind(void *decoder); 32 | size_t Decoder_SNES_SPC_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_SNES_SPC_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/libvorbis.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_LIBVORBIS_H 20 | #define DECODER_LIBVORBIS_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_libVorbis_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_libVorbis_Destroy(void *decoder); 31 | void Decoder_libVorbis_Rewind(void *decoder); 32 | size_t Decoder_libVorbis_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_LIBVORBIS_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/libopenmpt.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_LIBOPENMPT_H 20 | #define DECODER_LIBOPENMPT_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_libOpenMPT_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_libOpenMPT_Destroy(void *decoder); 31 | void Decoder_libOpenMPT_Rewind(void *decoder); 32 | size_t Decoder_libOpenMPT_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_LIBOPENMPT_H 35 | -------------------------------------------------------------------------------- /src/decoding/decoders/stb_vorbis.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_STB_VORBIS_H 20 | #define DECODER_STB_VORBIS_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | void* Decoder_STB_Vorbis_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 30 | void Decoder_STB_Vorbis_Destroy(void *decoder); 31 | void Decoder_STB_Vorbis_Rewind(void *decoder); 32 | size_t Decoder_STB_Vorbis_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 33 | 34 | #endif // DECODER_STB_VORBIS_H 35 | -------------------------------------------------------------------------------- /examples/gui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | 3 | option(SUBDIRECTORY "Use clownaudio as a subdirectory, instead of an external package" ON) 4 | 5 | project(clownaudio_test LANGUAGES C CXX) 6 | 7 | add_executable(test WIN32 8 | "test.cpp" 9 | "glad/include/glad/glad.h" 10 | "glad/include/KHR/khrplatform.h" 11 | "glad/src/glad.c" 12 | "imgui/imconfig.h" 13 | "imgui/imgui.cpp" 14 | "imgui/imgui.h" 15 | "imgui/imgui_demo.cpp" 16 | "imgui/imgui_draw.cpp" 17 | "imgui/imgui_impl_glfw.cpp" 18 | "imgui/imgui_impl_glfw.h" 19 | "imgui/imgui_impl_opengl3.cpp" 20 | "imgui/imgui_impl_opengl3.h" 21 | "imgui/imgui_internal.h" 22 | "imgui/imgui_tables.cpp" 23 | "imgui/imgui_widgets.cpp" 24 | "imgui/imstb_rectpack.h" 25 | "imgui/imstb_textedit.h" 26 | "imgui/imstb_truetype.h" 27 | ) 28 | 29 | if(SUBDIRECTORY) 30 | add_subdirectory("../.." "clownaudio" EXCLUDE_FROM_ALL) 31 | else() 32 | find_package(clownaudio REQUIRED) 33 | endif() 34 | 35 | target_link_libraries(test PRIVATE clownaudio) 36 | 37 | set_target_properties(test PROPERTIES 38 | C_STANDARD 90 39 | C_STANDARD_REQUIRED ON 40 | C_EXTENSIONS OFF 41 | CXX_STANDARD 98 42 | CXX_STANDARD_REQUIRED ON 43 | CXX_EXTENSIONS OFF 44 | ) 45 | 46 | target_link_libraries(test PRIVATE ${CMAKE_DL_LIBS}) 47 | 48 | target_include_directories(test PRIVATE "glad/include") 49 | target_compile_definitions(test PRIVATE IMGUI_IMPL_OPENGL_LOADER_GLAD) 50 | 51 | if(MSVC) 52 | target_compile_definitions(test PRIVATE _CRT_SECURE_NO_WARNINGS) # Shut up those stupid warnings 53 | endif() 54 | 55 | find_package(glfw3 REQUIRED) 56 | target_link_libraries(test PRIVATE glfw) 57 | -------------------------------------------------------------------------------- /src/decoding/decoders/common.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef COMMON_H 20 | #define COMMON_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | typedef struct DecoderSpec 28 | { 29 | unsigned long sample_rate; 30 | unsigned int channel_count; 31 | bool is_complex; 32 | } DecoderSpec; 33 | 34 | typedef struct DecoderStage 35 | { 36 | void *decoder; 37 | 38 | void (*Destroy)(void *decoder); 39 | void (*Rewind)(void *decoder); 40 | size_t (*GetSamples)(void *decoder, short *buffer, size_t frames_to_do); 41 | void (*SetLoop)(void *decoder, bool loop); 42 | } DecoderStage; 43 | 44 | #endif // COMMON_H 45 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/demo/play_spc.c: -------------------------------------------------------------------------------- 1 | /* Records SPC into wave file. Uses dsp_filter to give more authentic sound. 2 | 3 | Usage: play_spc [test.spc] 4 | */ 5 | 6 | #include "snes_spc/spc.h" 7 | 8 | #include "wave_writer.h" 9 | #include "demo_util.h" /* error(), load_file() */ 10 | 11 | int main( int argc, char** argv ) 12 | { 13 | /* Create emulator and filter */ 14 | SNES_SPC* snes_spc = spc_new(); 15 | SPC_Filter* filter = spc_filter_new(); 16 | if ( !snes_spc || !filter ) error( "Out of memory" ); 17 | 18 | /* Load SPC */ 19 | { 20 | /* Load file into memory */ 21 | long spc_size; 22 | void* spc = load_file( (argc > 1) ? argv [1] : "test.spc", &spc_size ); 23 | 24 | /* Load SPC data into emulator */ 25 | error( spc_load_spc( snes_spc, spc, spc_size ) ); 26 | free( spc ); /* emulator makes copy of data */ 27 | 28 | /* Most SPC files have garbage data in the echo buffer, so clear that */ 29 | spc_clear_echo( snes_spc ); 30 | 31 | /* Clear filter before playing */ 32 | spc_filter_clear( filter ); 33 | } 34 | 35 | /* Record 20 seconds to wave file */ 36 | wave_open( spc_sample_rate, "out.wav" ); 37 | wave_enable_stereo(); 38 | while ( wave_sample_count() < 20 * spc_sample_rate * 2 ) 39 | { 40 | /* Play into buffer */ 41 | #define BUF_SIZE 2048 42 | short buf [BUF_SIZE]; 43 | error( spc_play( snes_spc, BUF_SIZE, buf ) ); 44 | 45 | /* Filter samples */ 46 | spc_filter_run( filter, buf, BUF_SIZE ); 47 | 48 | wave_write( buf, BUF_SIZE ); 49 | } 50 | 51 | /* Cleanup */ 52 | spc_filter_delete( filter ); 53 | spc_delete( snes_spc ); 54 | wave_close(); 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /src/decoding/decoders/pxtone.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_PXTONE_H 20 | #define DECODER_PXTONE_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | void* Decoder_PxTone_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 34 | void Decoder_PxTone_Destroy(void *decoder); 35 | void Decoder_PxTone_Rewind(void *decoder); 36 | size_t Decoder_PxTone_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif // DECODER_PXTONE_H 43 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnDelay.h: -------------------------------------------------------------------------------- 1 | // '12/03/03 2 | 3 | #ifndef pxtnDelay_H 4 | #define pxtnDelay_H 5 | 6 | #include "./pxtn.h" 7 | 8 | #include "./pxtnDescriptor.h" 9 | #include "./pxtnMax.h" 10 | 11 | enum DELAYUNIT 12 | { 13 | DELAYUNIT_Beat = 0, 14 | DELAYUNIT_Meas , 15 | DELAYUNIT_Second , 16 | DELAYUNIT_num 17 | }; 18 | 19 | class pxtnDelay 20 | { 21 | private: 22 | 23 | void operator = (const pxtnDelay& src); 24 | pxtnDelay (const pxtnDelay& src); 25 | 26 | bool _b_played ; 27 | DELAYUNIT _unit ; 28 | int32_t _group ; 29 | float _rate ; 30 | float _freq ; 31 | 32 | int32_t _smp_num ; 33 | int32_t _offset ; 34 | int32_t* _bufs[ pxtnMAX_CHANNEL ]; 35 | int32_t _rate_s32 ; 36 | 37 | public : 38 | 39 | pxtnDelay(); 40 | ~pxtnDelay(); 41 | 42 | pxtnERR Tone_Ready ( int32_t beat_num, float beat_tempo, int32_t sps ); 43 | void Tone_Supple ( int32_t ch_num , int32_t *group_smps ); 44 | void Tone_Increment(); 45 | void Tone_Release (); 46 | void Tone_Clear (); 47 | 48 | bool Add_New ( DELAYUNIT scale, float freq, float rate, int32_t group ); 49 | 50 | bool Write( pxtnDescriptor *p_doc ) const; 51 | pxtnERR Read ( pxtnDescriptor *p_doc ); 52 | 53 | 54 | DELAYUNIT get_unit ()const; 55 | float get_freq ()const; 56 | float get_rate ()const; 57 | int32_t get_group()const; 58 | 59 | void Set( DELAYUNIT unit, float freq, float rate, int32_t group ); 60 | 61 | bool get_played()const; 62 | void set_played( bool b ); 63 | bool switch_played(); 64 | }; 65 | 66 | 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/decoding/split_decoder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | 20 | #ifndef SPLIT_DECODER_H 21 | #define SPLIT_DECODER_H 22 | 23 | #ifndef __cplusplus 24 | #include 25 | #endif 26 | #include 27 | 28 | #include "decoders/common.h" 29 | 30 | void* SplitDecoder_Create(DecoderStage *next_stage_intro, DecoderStage *next_stage_loop, unsigned int channel_count); 31 | void SplitDecoder_Destroy(void *split_decoder); 32 | void SplitDecoder_Rewind(void *split_decoder); 33 | size_t SplitDecoder_GetSamples(void *split_decoder, short *buffer, size_t frames_to_do); 34 | void SplitDecoder_SetLoop(void *split_decoder, bool loop); 35 | void SplitDecoder_SetSampleRate(void *split_decoder, unsigned long sample_rate); 36 | 37 | #endif // SPLIT_DECODER_H 38 | -------------------------------------------------------------------------------- /src/decoding/decoders/pxtone_noise.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_PXTONE_NOISE_H 20 | #define DECODER_PXTONE_NOISE_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "common.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | void* Decoder_PxToneNoise_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 34 | void Decoder_PxToneNoise_Destroy(void *decoder); 35 | void Decoder_PxToneNoise_Rewind(void *decoder); 36 | size_t Decoder_PxToneNoise_GetSamples(void *decoder, short *buffer, size_t frames_to_do); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif // DECODER_PXTONE_NOISE_H 43 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/libxmp.map: -------------------------------------------------------------------------------- 1 | XMP_4.0 { 2 | global: 3 | xmp_version; 4 | xmp_vercode; 5 | xmp_get_format_list; 6 | xmp_create_context; 7 | xmp_free_context; 8 | xmp_test_module; 9 | xmp_load_module; 10 | xmp_release_module; 11 | xmp_scan_module; 12 | xmp_get_module_info; 13 | xmp_start_player; 14 | xmp_play_frame; 15 | xmp_get_frame_info; 16 | xmp_end_player; 17 | xmp_next_position; 18 | xmp_prev_position; 19 | xmp_set_position; 20 | xmp_stop_module; 21 | xmp_restart_module; 22 | xmp_seek_time; 23 | xmp_channel_mute; 24 | xmp_channel_vol; 25 | xmp_inject_event; 26 | xmp_set_player; 27 | xmp_get_player; 28 | xmp_set_instrument_path; 29 | local: 30 | *; 31 | }; 32 | 33 | XMP_4.1 { 34 | global: 35 | xmp_set_player; 36 | xmp_get_player; 37 | xmp_play_buffer; 38 | } XMP_4.0; 39 | 40 | XMP_4.2 { 41 | global: 42 | xmp_get_player; 43 | xmp_load_module_from_memory; 44 | xmp_start_smix; 45 | xmp_end_smix; 46 | xmp_smix_play_instrument; 47 | xmp_smix_play_sample; 48 | xmp_smix_channel_pan; 49 | xmp_smix_load_sample; 50 | xmp_smix_release_sample; 51 | } XMP_4.1; 52 | 53 | XMP_4.3 { 54 | global: 55 | xmp_set_player; 56 | xmp_get_player; 57 | xmp_load_module_from_file; 58 | } XMP_4.2; 59 | 60 | XMP_4.4 { 61 | global: 62 | xmp_set_player; 63 | xmp_get_player; 64 | } XMP_4.3; 65 | 66 | XMP_4.5 { 67 | global: 68 | xmp_set_row; 69 | xmp_set_tempo_factor; 70 | xmp_load_module_from_callbacks; 71 | xmp_test_module_from_file; 72 | xmp_test_module_from_memory; 73 | xmp_test_module_from_callbacks; 74 | xmp_syserrno; 75 | } XMP_4.4; 76 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/virtual.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_VIRTUAL_H 2 | #define LIBXMP_VIRTUAL_H 3 | 4 | #include "common.h" 5 | 6 | #define VIRT_ACTION_CUT XMP_INST_NNA_CUT 7 | #define VIRT_ACTION_CONT XMP_INST_NNA_CONT 8 | #define VIRT_ACTION_OFF XMP_INST_NNA_OFF 9 | #define VIRT_ACTION_FADE XMP_INST_NNA_FADE 10 | 11 | #define VIRT_ACTIVE 0x100 12 | #define VIRT_INVALID -1 13 | 14 | int libxmp_virt_on (struct context_data *, int); 15 | void libxmp_virt_off (struct context_data *); 16 | int libxmp_virt_mute (struct context_data *, int, int); 17 | int libxmp_virt_setpatch (struct context_data *, int, int, int, int, 18 | int, int, int); 19 | int libxmp_virt_cvt8bit (void); 20 | void libxmp_virt_setnote (struct context_data *, int, int); 21 | void libxmp_virt_setsmp (struct context_data *, int, int); 22 | void libxmp_virt_setnna (struct context_data *, int, int); 23 | void libxmp_virt_pastnote (struct context_data *, int, int); 24 | void libxmp_virt_setvol (struct context_data *, int, int); 25 | void libxmp_virt_voicepos (struct context_data *, int, double); 26 | double libxmp_virt_getvoicepos (struct context_data *, int); 27 | void libxmp_virt_setperiod (struct context_data *, int, double); 28 | void libxmp_virt_setpan (struct context_data *, int, int); 29 | void libxmp_virt_seteffect (struct context_data *, int, int, int); 30 | int libxmp_virt_cstat (struct context_data *, int); 31 | int libxmp_virt_mapchannel (struct context_data *, int); 32 | void libxmp_virt_resetchannel(struct context_data *, int); 33 | void libxmp_virt_resetvoice (struct context_data *, int, int); 34 | void libxmp_virt_reset (struct context_data *); 35 | void libxmp_virt_release (struct context_data *, int, int); 36 | int libxmp_virt_getroot (struct context_data *, int); 37 | 38 | #endif /* LIBXMP_VIRTUAL_H */ 39 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/virtual.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_VIRTUAL_H 2 | #define LIBXMP_VIRTUAL_H 3 | 4 | #include "common.h" 5 | 6 | #define VIRT_ACTION_CUT XMP_INST_NNA_CUT 7 | #define VIRT_ACTION_CONT XMP_INST_NNA_CONT 8 | #define VIRT_ACTION_OFF XMP_INST_NNA_OFF 9 | #define VIRT_ACTION_FADE XMP_INST_NNA_FADE 10 | 11 | #define VIRT_ACTIVE 0x100 12 | #define VIRT_INVALID -1 13 | 14 | int libxmp_virt_on (struct context_data *, int); 15 | void libxmp_virt_off (struct context_data *); 16 | int libxmp_virt_mute (struct context_data *, int, int); 17 | int libxmp_virt_setpatch (struct context_data *, int, int, int, int, 18 | int, int, int); 19 | int libxmp_virt_cvt8bit (void); 20 | void libxmp_virt_setnote (struct context_data *, int, int); 21 | void libxmp_virt_setsmp (struct context_data *, int, int); 22 | void libxmp_virt_setnna (struct context_data *, int, int); 23 | void libxmp_virt_pastnote (struct context_data *, int, int); 24 | void libxmp_virt_setvol (struct context_data *, int, int); 25 | void libxmp_virt_voicepos (struct context_data *, int, double); 26 | double libxmp_virt_getvoicepos (struct context_data *, int); 27 | void libxmp_virt_setperiod (struct context_data *, int, double); 28 | void libxmp_virt_setpan (struct context_data *, int, int); 29 | void libxmp_virt_seteffect (struct context_data *, int, int, int); 30 | int libxmp_virt_cstat (struct context_data *, int); 31 | int libxmp_virt_mapchannel (struct context_data *, int); 32 | void libxmp_virt_resetchannel(struct context_data *, int); 33 | void libxmp_virt_resetvoice (struct context_data *, int, int); 34 | void libxmp_virt_reset (struct context_data *); 35 | void libxmp_virt_release (struct context_data *, int, int); 36 | int libxmp_virt_getroot (struct context_data *, int); 37 | 38 | #endif /* LIBXMP_VIRTUAL_H */ 39 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnPulse_PCM.h: -------------------------------------------------------------------------------- 1 | #ifndef pxtnPulse_PCM_H 2 | #define pxtnPulse_PCM_H 3 | 4 | #include "./pxtn.h" 5 | 6 | #include "./pxtnDescriptor.h" 7 | 8 | class pxtnPulse_PCM 9 | { 10 | private: 11 | void operator = (const pxtnPulse_PCM& src); 12 | pxtnPulse_PCM (const pxtnPulse_PCM& src); 13 | 14 | int32_t _ch ; 15 | int32_t _sps ; 16 | int32_t _bps ; 17 | int32_t _smp_head; // no use. 0 18 | int32_t _smp_body; 19 | int32_t _smp_tail; // no use. 0 20 | uint8_t *_p_smp ; 21 | 22 | bool _Convert_ChannelNum ( int32_t new_ch ); 23 | bool _Convert_BitPerSample ( int32_t new_bps ); 24 | bool _Convert_SamplePerSecond( int32_t new_sps ); 25 | 26 | public: 27 | 28 | pxtnPulse_PCM(); 29 | ~pxtnPulse_PCM(); 30 | 31 | pxtnERR Create ( int32_t ch, int32_t sps, int32_t bps, int32_t sample_num ); 32 | void Release(); 33 | 34 | pxtnERR read ( pxtnDescriptor* doc ); 35 | bool write( pxtnDescriptor* doc, const char* pstrLIST ) const; 36 | 37 | 38 | bool Convert( int32_t new_ch, int32_t new_sps, int32_t new_bps ); 39 | bool Convert_Volume( float v ); 40 | pxtnERR Copy ( pxtnPulse_PCM *p_dst ) const; 41 | bool Copy_ ( pxtnPulse_PCM *p_dst, int32_t start, int32_t end ) const; 42 | 43 | void *Devolve_SamplingBuffer(); 44 | 45 | float get_sec () const; 46 | 47 | int32_t get_ch () const; 48 | int32_t get_bps () const; 49 | int32_t get_sps () const; 50 | int32_t get_smp_body() const; 51 | int32_t get_smp_head() const; 52 | int32_t get_smp_tail() const; 53 | 54 | int32_t get_buf_size() const; 55 | 56 | const void *get_p_buf () const; 57 | void *get_p_buf_variable() const; 58 | 59 | }; 60 | 61 | #endif 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/decoding/predecoder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef PREDECODER_H 20 | #define PREDECODER_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "decoders/common.h" 28 | 29 | typedef struct PredecoderData PredecoderData; 30 | 31 | PredecoderData* Predecoder_DecodeData(const DecoderSpec *in_spec, const DecoderSpec *out_spec, DecoderStage *stage); 32 | void Predecoder_UnloadData(PredecoderData *data); 33 | void* Predecoder_Create(PredecoderData *data, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 34 | void Predecoder_Destroy(void *predecoder); 35 | void Predecoder_Rewind(void *predecoder); 36 | size_t Predecoder_GetSamples(void *predecoder, short *buffer, size_t frames_to_do); 37 | void Predecoder_SetLoop(void *predecoder, bool loop); 38 | 39 | #endif // PREDECODER_H 40 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/unxz.c: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * This file is part of the Extended Module Player and is distributed 5 | * under the terms of the GNU Lesser General Public License. See COPYING.LIB 6 | * for more information. 7 | */ 8 | 9 | #include "depacker.h" 10 | #include "xz.h" 11 | #include "crc32.h" 12 | 13 | #define BUFFER_SIZE 4096 14 | 15 | static int test_xz(unsigned char *b) 16 | { 17 | return b[0] == 0xfd && b[3] == 'X' && b[4] == 'Z' && b[5] == 0x00; 18 | } 19 | 20 | static int decrunch_xz(FILE *in, FILE *out) 21 | { 22 | struct xz_buf b; 23 | struct xz_dec *state; 24 | unsigned char *membuf; 25 | int ret = 0; 26 | 27 | libxmp_crc32_init_A(); 28 | 29 | memset(&b, 0, sizeof(b)); 30 | if ((membuf = (unsigned char *)malloc(2 * BUFFER_SIZE)) == NULL) 31 | return -1; 32 | 33 | b.in = membuf; 34 | b.out = membuf + BUFFER_SIZE; 35 | b.out_size = BUFFER_SIZE; 36 | 37 | /* Limit memory usage to 16M */ 38 | state = xz_dec_init(XZ_DYNALLOC, 16 * 1024 * 1024); 39 | 40 | while (1) { 41 | enum xz_ret r; 42 | 43 | if (b.in_pos == b.in_size) { 44 | int rd = fread(membuf, 1, BUFFER_SIZE, in); 45 | if (rd < 0) { 46 | ret = -1; 47 | break; 48 | } 49 | b.in_size = rd; 50 | b.in_pos = 0; 51 | } 52 | 53 | r = xz_dec_run(state, &b); 54 | 55 | if (b.out_pos) { 56 | fwrite(b.out, 1, b.out_pos, out); 57 | b.out_pos = 0; 58 | } 59 | 60 | if (r == XZ_STREAM_END) { 61 | break; 62 | } 63 | 64 | if (r != XZ_OK && r != XZ_UNSUPPORTED_CHECK) { 65 | ret = -1; 66 | break; 67 | } 68 | } 69 | 70 | xz_dec_end(state); 71 | free(membuf); 72 | 73 | return ret; 74 | } 75 | 76 | struct depacker libxmp_depacker_xz = { 77 | test_xz, 78 | decrunch_xz 79 | }; 80 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/xfd_link.c: -------------------------------------------------------------------------------- 1 | #include "../common.h" 2 | 3 | #if defined(LIBXMP_AMIGA) && defined(HAVE_PROTO_XFDMASTER_H) 4 | 5 | #ifdef __amigaos4__ 6 | #define __USE_INLINE__ 7 | #endif 8 | #include 9 | #include 10 | #include 11 | 12 | #if defined(__amigaos4__) || defined(__MORPHOS__) 13 | struct Library *xfdMasterBase; 14 | #else 15 | struct xfdMasterBase *xfdMasterBase; 16 | #endif 17 | 18 | #ifdef __amigaos4__ 19 | struct xfdMasterIFace *IxfdMaster; 20 | /*struct ExecIFace *IExec;*/ 21 | #endif 22 | 23 | #ifdef __GNUC__ 24 | void INIT_8_open_xfd(void) __attribute__ ((constructor)); 25 | void EXIT_8_close_xfd(void) __attribute__ ((destructor)); 26 | #endif 27 | #ifdef __VBCC__ 28 | #define INIT_8_open_xfd _INIT_8_open_xfd 29 | #define EXIT_8_close_xfd _EXIT_8_close_xfd 30 | #endif 31 | 32 | void EXIT_8_close_xfd(void) { 33 | #ifdef __amigaos4__ 34 | if (IxfdMaster) { 35 | DropInterface((struct Interface *) IxfdMaster); 36 | IxfdMaster = NULL; 37 | } 38 | #endif 39 | if (xfdMasterBase) { 40 | CloseLibrary((struct Library *) xfdMasterBase); 41 | xfdMasterBase = NULL; 42 | } 43 | } 44 | 45 | void INIT_8_open_xfd(void) { 46 | #ifdef __amigaos4__ 47 | /*IExec = (struct ExecIFace *)(*(struct ExecBase **)4)->MainInterface;*/ 48 | #endif 49 | 50 | #if defined(__amigaos4__) || defined(__MORPHOS__) 51 | xfdMasterBase = OpenLibrary("xfdmaster.library",38); 52 | #else 53 | xfdMasterBase = (struct xfdMasterBase *) OpenLibrary("xfdmaster.library",38); 54 | #endif 55 | if (!xfdMasterBase) return; 56 | 57 | #ifdef __amigaos4__ 58 | IxfdMaster = (struct xfdMasterIFace *) GetInterface(xfdMasterBase,"main",1,NULL); 59 | if (!IxfdMaster) { 60 | CloseLibrary(xfdMasterBase); 61 | xfdMasterBase = NULL; 62 | } 63 | #endif 64 | } 65 | 66 | #endif /* AMIGA */ 67 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnMaster.h: -------------------------------------------------------------------------------- 1 | // '12/03/03 2 | 3 | #ifndef pxtnMaster_H 4 | #define pxtnMaster_H 5 | 6 | #include "./pxtn.h" 7 | 8 | #include "./pxtnDescriptor.h" 9 | 10 | class pxtnMaster 11 | { 12 | private: 13 | void operator = (const pxtnMaster& src); 14 | pxtnMaster (const pxtnMaster& src); 15 | 16 | int32_t _beat_num ; 17 | float _beat_tempo ; 18 | int32_t _beat_clock ; 19 | int32_t _meas_num ; 20 | int32_t _repeat_meas; 21 | int32_t _last_meas ; 22 | int32_t _volume_ ; 23 | 24 | public : 25 | pxtnMaster(); 26 | ~pxtnMaster(); 27 | 28 | void Reset(); 29 | 30 | void Set( int32_t beat_num, float beat_tempo, int32_t beat_clock ); 31 | void Get( int32_t *p_beat_num, float *p_beat_tempo, int32_t *p_beat_clock, int32_t* p_meas_num ) const; 32 | 33 | int32_t get_beat_num ()const; 34 | float get_beat_tempo ()const; 35 | int32_t get_beat_clock ()const; 36 | int32_t get_meas_num ()const; 37 | int32_t get_repeat_meas()const; 38 | int32_t get_last_meas ()const; 39 | int32_t get_last_clock ()const; 40 | int32_t get_play_meas ()const; 41 | 42 | void set_meas_num ( int32_t meas_num ) ; 43 | void set_repeat_meas( int32_t meas ); 44 | void set_last_meas ( int32_t meas ); 45 | void set_beat_clock ( int32_t beat_clock ); 46 | 47 | void AdjustMeasNum ( int32_t clock ); 48 | 49 | int32_t get_this_clock( int32_t meas, int32_t beat, int32_t clock ) const; 50 | 51 | bool io_w_v5 ( pxtnDescriptor *p_doc, int32_t rough ) const; 52 | pxtnERR io_r_v5 ( pxtnDescriptor *p_doc ); 53 | int32_t io_r_v5_EventNum ( pxtnDescriptor *p_doc ); 54 | 55 | pxtnERR io_r_x4x ( pxtnDescriptor *p_doc ); 56 | int32_t io_r_x4x_EventNum( pxtnDescriptor *p_doc ); 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/decoding/resampled_decoder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2021 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef RESAMPLED_DECODER_H 20 | #define RESAMPLED_DECODER_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "decoders/common.h" 28 | 29 | void* ResampledDecoder_Create(DecoderStage *next_stage, bool dynamic_sample_rate, const DecoderSpec *wanted_spec, const DecoderSpec *child_spec); 30 | void ResampledDecoder_Destroy(void *resampled_decoder); 31 | void ResampledDecoder_Rewind(void *resampled_decoder); 32 | size_t ResampledDecoder_GetSamples(void *resampled_decoder, short *buffer, size_t frames_to_do); 33 | void ResampledDecoder_SetLoop(void *resampled_decoder, bool loop); 34 | void ResampledDecoder_SetSpeed(void *resampled_decoder, unsigned long speed); 35 | void ResampledDecoder_SetLowPassFilter(void *resampled_decoder, unsigned long low_pass_filter_sample_rate); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/demo/benchmark.c: -------------------------------------------------------------------------------- 1 | /* Measures performance of SPC emulator. Takes about 4 seconds. 2 | NOTE: This assumes that the program is getting all processor time; you might need to 3 | arrange for this or else the performance will be reported lower than it really is. 4 | 5 | Usage: benchmark [test.spc] 6 | */ 7 | 8 | #include "snes_spc/spc.h" 9 | 10 | #include "demo_util.h" /* error(), load_file() */ 11 | #include 12 | 13 | clock_t start_timing( int seconds ); 14 | 15 | int main( int argc, char** argv ) 16 | { 17 | /* Load SPC */ 18 | long spc_size; 19 | void* spc = load_file( (argc > 1) ? argv [1] : "test.spc", &spc_size ); 20 | SNES_SPC* snes_spc = spc_new(); 21 | if ( !snes_spc ) error( "Out of memory" ); 22 | spc_load_spc( snes_spc, spc, spc_size ); 23 | free( spc ); 24 | 25 | { 26 | /* Repeatedly fill buffer for 4 seconds */ 27 | int const seconds = 4; 28 | #define BUF_SIZE 4096 29 | clock_t end = start_timing( seconds ); 30 | int count = 0; 31 | while ( clock() < end ) 32 | { 33 | static short buf [BUF_SIZE]; 34 | error( spc_play( snes_spc, BUF_SIZE, buf ) ); 35 | count++; 36 | } 37 | 38 | /* Report performance based on how many buffer fills were possible */ 39 | { 40 | double rate = (double) count * BUF_SIZE / (spc_sample_rate * 2 * seconds); 41 | printf( "Performance: %.3fx real-time, or %.0f%% CPU for normal rate\n", 42 | rate, 100.0 / rate ); 43 | } 44 | } 45 | 46 | return 0; 47 | } 48 | 49 | /* Synchronizes with host clock and returns clock() time that is duration seconds from now */ 50 | clock_t start_timing( int duration ) 51 | { 52 | clock_t clock_dur = duration * CLOCKS_PER_SEC; 53 | clock_t time = clock(); 54 | while ( clock() == time ) { } 55 | if ( clock() - time > clock_dur ) 56 | error( "Insufficient clock() time resolution" ); 57 | return clock() + clock_dur; 58 | } 59 | -------------------------------------------------------------------------------- /src/decoding/decoder_selector.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef DECODER_SELECTOR_H 20 | #define DECODER_SELECTOR_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #include "decoders/common.h" 28 | 29 | typedef struct DecoderSelectorData DecoderSelectorData; 30 | 31 | DecoderSelectorData* DecoderSelector_LoadData(const unsigned char *data, size_t data_size, bool predecode, bool must_predecode, const DecoderSpec *wanted_spec); 32 | void DecoderSelector_UnloadData(DecoderSelectorData *data); 33 | void* DecoderSelector_Create(DecoderSelectorData *data, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec); 34 | void DecoderSelector_Destroy(void *selector); 35 | void DecoderSelector_Rewind(void *selector); 36 | size_t DecoderSelector_GetSamples(void *selector, short *buffer, size_t frames_to_do); 37 | void DecoderSelector_SetLoop(void *selector, bool loop); 38 | 39 | #endif // DECODER_SELECTOR_H 40 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/hmn_extras.h: -------------------------------------------------------------------------------- 1 | #ifndef XMP_HMN_EXTRAS_H 2 | #define XMP_HMN_EXTRAS_H 3 | 4 | #define HMN_EXTRAS_MAGIC 0x041bc81a 5 | 6 | struct hmn_instrument_extras { 7 | uint32 magic; 8 | int dataloopstart; 9 | int dataloopend; 10 | uint8 data[64]; 11 | uint8 progvolume[64]; 12 | }; 13 | 14 | struct hmn_channel_extras { 15 | uint32 magic; 16 | int datapos; /* HMN waveform table pointer */ 17 | int volume; /* HMN synth volume */ 18 | }; 19 | 20 | struct hmn_module_extras { 21 | uint32 magic; 22 | }; 23 | 24 | #define HMN_INSTRUMENT_EXTRAS(x) ((struct hmn_instrument_extras *)(x).extra) 25 | #define HAS_HMN_INSTRUMENT_EXTRAS(x) \ 26 | (HMN_INSTRUMENT_EXTRAS(x) != NULL && \ 27 | HMN_INSTRUMENT_EXTRAS(x)->magic == HMN_EXTRAS_MAGIC) 28 | 29 | #define HMN_CHANNEL_EXTRAS(x) ((struct hmn_channel_extras *)(x).extra) 30 | #define HAS_HMN_CHANNEL_EXTRAS(x) \ 31 | (HMN_CHANNEL_EXTRAS(x) != NULL && \ 32 | HMN_CHANNEL_EXTRAS(x)->magic == HMN_EXTRAS_MAGIC) 33 | 34 | #define HMN_MODULE_EXTRAS(x) ((struct hmn_module_extras *)(x).extra) 35 | #define HAS_HMN_MODULE_EXTRAS(x) \ 36 | (HMN_MODULE_EXTRAS(x) != NULL && \ 37 | HMN_MODULE_EXTRAS(x)->magic == HMN_EXTRAS_MAGIC) 38 | 39 | void libxmp_hmn_play_extras(struct context_data *, struct channel_data *, int); 40 | void libxmp_hmn_set_arpeggio(struct channel_data *, int); 41 | int libxmp_hmn_linear_bend(struct context_data *, struct channel_data *); 42 | int libxmp_hmn_new_instrument_extras(struct xmp_instrument *); 43 | int libxmp_hmn_new_channel_extras(struct channel_data *); 44 | void libxmp_hmn_reset_channel_extras(struct channel_data *); 45 | void libxmp_hmn_release_channel_extras(struct channel_data *); 46 | int libxmp_hmn_new_module_extras(struct module_data *); 47 | void libxmp_hmn_release_module_extras(struct module_data *); 48 | void libxmp_hmn_extras_process_fx(struct context_data *, struct channel_data *, int, uint8, uint8, uint8, int); 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/readrle.c: -------------------------------------------------------------------------------- 1 | /* nomarch 1.0 - extract old `.arc' archives. 2 | * Copyright (C) 2001 Russell Marks. See unarc.c for license details. 3 | * 4 | * readrle.c - read RLE-compressed files. 5 | * 6 | * Also provides the generic outputrle() for the other RLE-using methods 7 | * to use. 8 | */ 9 | 10 | #include "../common.h" 11 | #include "readrle.h" 12 | 13 | 14 | #if 0 15 | static void rawoutput(int byte, struct data_in_out *io) 16 | { 17 | if(io->data_out_pointdata_out_max) 18 | *io->data_out_point++=byte; 19 | } 20 | #endif 21 | 22 | 23 | /* call with -1 before starting, to make sure state is initialised */ 24 | void libxmp_outputrle(int chr,void (*outputfunc)(int, struct data_in_out *), struct rledata *rd, struct data_in_out *io) 25 | { 26 | int f; 27 | 28 | if(chr==-1) 29 | { 30 | rd->lastchr=rd->repeating=0; 31 | return; 32 | } 33 | 34 | if(rd->repeating) 35 | { 36 | if(chr==0) 37 | (*outputfunc)(0x90, io); 38 | else 39 | for(f=1;flastchr, io); 41 | rd->repeating=0; 42 | } 43 | else 44 | { 45 | if(chr==0x90) 46 | rd->repeating=1; 47 | else 48 | { 49 | (*outputfunc)(chr, io); 50 | rd->lastchr=chr; 51 | } 52 | } 53 | } 54 | 55 | #if 0 56 | unsigned char *convert_rle(unsigned char *data_in, 57 | unsigned long in_len, 58 | unsigned long orig_len) 59 | { 60 | unsigned char *data_out; 61 | struct rledata rd; 62 | struct data_in_out io; 63 | 64 | if((data_out=malloc(orig_len))==NULL) 65 | fprintf(stderr,"nomarch: out of memory!\n"),exit(1); 66 | 67 | io.data_in_point=data_in; io.data_in_max=data_in+in_len; 68 | io.data_out_point=data_out; io.data_out_max=data_out+orig_len; 69 | outputrle(-1,NULL, &rd, &io); 70 | 71 | while(io.data_in_point 4 | #include 5 | #include 6 | #include 7 | 8 | /* Copyright (C) 2007 Shay Green. This module is free software; you 9 | can redistribute it and/or modify it under the terms of the GNU Lesser 10 | General Public License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. This 12 | module is distributed in the hope that it will be useful, but WITHOUT ANY 13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 15 | details. You should have received a copy of the GNU Lesser General Public 16 | License along with this module; if not, write to the Free Software Foundation, 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ 18 | 19 | unsigned char* load_file( const char* path, long* size_out ) 20 | { 21 | size_t size; 22 | unsigned char* data; 23 | 24 | FILE* in = fopen( path, "rb" ); 25 | if ( !in ) error( "Couldn't open file" ); 26 | 27 | fseek( in, 0, SEEK_END ); 28 | size = ftell( in ); 29 | if ( size_out ) 30 | *size_out = size; 31 | rewind( in ); 32 | 33 | data = (unsigned char*) malloc( size ); 34 | if ( !data ) error( "Out of memory" ); 35 | 36 | if ( fread( data, 1, size, in ) < size ) error( "Couldn't read file" ); 37 | fclose( in ); 38 | 39 | return data; 40 | } 41 | 42 | void write_file( const char* path, void const* in, long size ) 43 | { 44 | FILE* out = fopen( path, "wb" ); 45 | if ( !out ) error( "Couldn't create file" ); 46 | if ( (long) fwrite( in, 1, size, out ) < size ) error( "Couldn't write file" ); 47 | fclose( out ); 48 | } 49 | 50 | void error( const char* str ) 51 | { 52 | if ( str ) 53 | { 54 | fprintf( stderr, "Error: %s\n", str ); 55 | exit( EXIT_FAILURE ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /examples/gui-qt/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | QT_BEGIN_NAMESPACE 9 | namespace Ui { class MainWindow; } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | struct SoundMetadata 18 | { 19 | ClownAudio_SoundID id; 20 | ClownAudio_SoundData *data; 21 | unsigned short master_volume; 22 | unsigned short left_volume; 23 | unsigned short right_volume; 24 | unsigned long speed; 25 | unsigned long low_pass_filter_sample_rate; 26 | bool paused; 27 | }; 28 | 29 | MainWindow(QWidget *parent = nullptr); 30 | ~MainWindow(); 31 | 32 | private slots: 33 | void on_pushButton_File1Open_clicked(); 34 | 35 | void on_pushButton_File2Open_clicked(); 36 | 37 | void on_pushButton_LoadSoundData_clicked(); 38 | 39 | void on_pushButton_UnloadSoundData_clicked(); 40 | 41 | void on_pushButton_CreateSound_clicked(); 42 | 43 | void on_listWidget_SoundData_itemSelectionChanged(); 44 | 45 | void on_listWidget_Sounds_itemSelectionChanged(); 46 | 47 | void on_pushButton_DestroySound_clicked(); 48 | 49 | void on_pushButton_Pause_clicked(); 50 | 51 | void on_pushButton_Unpause_clicked(); 52 | 53 | void on_pushButton_Rewind_clicked(); 54 | 55 | void on_pushButton_FadeIn_clicked(); 56 | 57 | void on_pushButton_FadeOut_clicked(); 58 | 59 | void on_horizontalSlider_MasterVolume_valueChanged(int value); 60 | 61 | void on_horizontalSlider_LeftVolume_valueChanged(int value); 62 | 63 | void on_horizontalSlider_RightVolume_valueChanged(int value); 64 | 65 | void on_horizontalSlider_Speed_valueChanged(int value); 66 | 67 | void on_horizontalSlider_LowPassFilter_valueChanged(int value); 68 | 69 | private: 70 | Ui::MainWindow *ui; 71 | 72 | static void UpdateSoundVolume(SoundMetadata *sound_metadata); 73 | }; 74 | 75 | Q_DECLARE_METATYPE(MainWindow::SoundMetadata*) 76 | 77 | #endif // MAINWINDOW_H 78 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/README: -------------------------------------------------------------------------------- 1 | __ _ __ ___ __ 2 | / / (_) / __ __ __ _ ___ ____/ (_) /____ 3 | / /__/ / _ \\ \ // ' \/ _ \/___/ / / __/ -_) 4 | /____/_/_.__/_\_\/_/_/_/ .__/ /_/_/\__/\__/ 5 | /_/ 6 | 7 | Libxmp-lite is a lean and lightweight subset of Libxmp that plays MOD, S3M, 8 | XM, and IT modules and retains full compatibility with the original API. 9 | It's intended for games and small or embedded applications where module 10 | format diversity and file depacking are not required. 11 | 12 | Library size can be further reduced by disabling Impulse Tracker format 13 | support (configure with --disable-it). This option will also disable IT 14 | effects and lowpass filtering. 15 | 16 | Please refer to http://xmp.sf.net/libxmp.html for details on the current 17 | Libxmp API. 18 | 19 | 20 | LICENSE 21 | 22 | Extended Module Player Lite 23 | Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 24 | 25 | Permission is hereby granted, free of charge, to any person obtaining a 26 | copy of this software and associated documentation files (the "Software"), 27 | to deal in the Software without restriction, including without limitation 28 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 29 | and/or sell copies of the Software, and to permit persons to whom the 30 | Software is furnished to do so, subject to the following conditions: 31 | 32 | The above copyright notice and this permission notice shall be included in 33 | all copies or substantial portions of the Software. 34 | 35 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 36 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 37 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 38 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 39 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 40 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 41 | THE SOFTWARE. 42 | 43 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/demo/comm.c: -------------------------------------------------------------------------------- 1 | /* Communicates with SPC the way the SNES would. 2 | 3 | Note: You'll need an "spc_rom.h" file that contains the 64-byte IPL ROM contents */ 4 | 5 | #include "snes_spc/spc.h" 6 | 7 | #include "demo_util.h" 8 | #include 9 | #include 10 | 11 | static SNES_SPC* snes_spc; 12 | 13 | /* Make port access more convenient. Fakes time by simply incrementing it each call. */ 14 | static spc_time_t stime; 15 | static int pread ( int port ) { return spc_read_port( snes_spc, stime++, port ); } 16 | static void pwrite( int port, int data ) { spc_write_port( snes_spc, stime++, port, data ); } 17 | 18 | static unsigned char const spc_rom [spc_rom_size] = { 19 | /* ROM data not provided with emulator */ 20 | #include "spc_rom.h" 21 | }; 22 | 23 | int main() 24 | { 25 | int i; 26 | 27 | /* Data to upload */ 28 | static unsigned char const data [4] = "\xFA\xDE\xD1"; 29 | unsigned const data_addr = 0xF5; /* second I/O port */ 30 | 31 | snes_spc = spc_new(); 32 | if ( !snes_spc ) error( "Out of memory" ); 33 | spc_init_rom( snes_spc, spc_rom ); 34 | spc_reset( snes_spc ); 35 | 36 | /* Simulate reads and writes that SNES code would do */ 37 | 38 | /* Wait for SPC to be ready */ 39 | while ( pread( 0 ) != 0xAA || pread( 1 ) != 0xBB ) { } 40 | 41 | /* Start address */ 42 | pwrite( 2, data_addr & 0xFF ); 43 | pwrite( 3, data_addr >> 8 ); 44 | 45 | /* Tell SPC to start transfer and wait for acknowledgement */ 46 | pwrite( 0, 0xCC ); 47 | pwrite( 1, 0x01 ); 48 | while ( pread( 0 ) != 0xCC ) { } 49 | 50 | /* Send each byte and wait for acknowledgement */ 51 | for ( i = 0; i < 4; i++ ) 52 | { 53 | printf( "%02X ", data [i] ); 54 | pwrite( 1, data [i] ); 55 | pwrite( 0, i ); 56 | while ( pread( 0 ) != i ) { } 57 | } 58 | printf( "\n" ); 59 | 60 | /* Verify that data was transferred properly */ 61 | for ( i = 0; i < 3; i++ ) 62 | printf( "%02X ", pread( i + 1 ) ); 63 | printf( "\n" ); 64 | 65 | printf( "Cycles: %ld\n", (long) stime ); 66 | 67 | spc_delete( snes_spc ); 68 | 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/snes_spc/SPC_Filter.cpp: -------------------------------------------------------------------------------- 1 | // snes_spc 0.9.0. http://www.slack.net/~ant/ 2 | 3 | #include "SPC_Filter.h" 4 | 5 | #include 6 | 7 | /* Copyright (C) 2007 Shay Green. This module is free software; you 8 | can redistribute it and/or modify it under the terms of the GNU Lesser 9 | General Public License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. This 11 | module is distributed in the hope that it will be useful, but WITHOUT ANY 12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 14 | details. You should have received a copy of the GNU Lesser General Public 15 | License along with this module; if not, write to the Free Software Foundation, 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ 17 | 18 | #include "blargg_source.h" 19 | 20 | void SPC_Filter::clear() { memset( ch, 0, sizeof ch ); } 21 | 22 | SPC_Filter::SPC_Filter() 23 | { 24 | gain = gain_unit; 25 | bass = bass_norm; 26 | clear(); 27 | } 28 | 29 | void SPC_Filter::run( short* io, int count ) 30 | { 31 | require( (count & 1) == 0 ); // must be even 32 | 33 | int const gain = this->gain; 34 | int const bass = this->bass; 35 | chan_t* c = &ch [2]; 36 | do 37 | { 38 | // cache in registers 39 | int sum = (--c)->sum; 40 | int pp1 = c->pp1; 41 | int p1 = c->p1; 42 | 43 | for ( int i = 0; i < count; i += 2 ) 44 | { 45 | // Low-pass filter (two point FIR with coeffs 0.25, 0.75) 46 | int f = io [i] + p1; 47 | p1 = io [i] * 3; 48 | 49 | // High-pass filter ("leaky integrator") 50 | int delta = f - pp1; 51 | pp1 = f; 52 | int s = sum >> (gain_bits + 2); 53 | sum += (delta * gain) - (sum >> bass); 54 | 55 | // Clamp to 16 bits 56 | if ( (short) s != s ) 57 | s = (s >> 31) ^ 0x7FFF; 58 | 59 | io [i] = (short) s; 60 | } 61 | 62 | c->p1 = p1; 63 | c->pp1 = pp1; 64 | c->sum = sum; 65 | ++io; 66 | } 67 | while ( c != ch ); 68 | } 69 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/format.c: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "format.h" 24 | 25 | extern const struct format_loader libxmp_loader_xm; 26 | extern const struct format_loader libxmp_loader_mod; 27 | extern const struct format_loader libxmp_loader_it; 28 | extern const struct format_loader libxmp_loader_s3m; 29 | 30 | const struct format_loader *const format_loaders[5] = { 31 | &libxmp_loader_xm, 32 | &libxmp_loader_mod, 33 | #ifndef LIBXMP_CORE_DISABLE_IT 34 | &libxmp_loader_it, 35 | #endif 36 | &libxmp_loader_s3m, 37 | NULL 38 | }; 39 | 40 | static const char *_farray[5] = { NULL }; 41 | 42 | const char *const *format_list(void) 43 | { 44 | int count, i; 45 | 46 | if (_farray[0] == NULL) { 47 | for (count = i = 0; format_loaders[i] != NULL; i++) { 48 | _farray[count++] = format_loaders[i]->name; 49 | } 50 | 51 | _farray[count] = NULL; 52 | } 53 | 54 | return _farray; 55 | } 56 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtoneNoise.cpp: -------------------------------------------------------------------------------- 1 | // '12/03/29 2 | 3 | #include "./pxtn.h" 4 | 5 | #include "./pxtnService.h" 6 | 7 | #include "./pxtoneNoise.h" 8 | 9 | pxtoneNoise::pxtoneNoise() 10 | { 11 | _bldr = NULL ; 12 | _sps = 44100; 13 | _ch_num = 2; 14 | _bps = 16; 15 | } 16 | 17 | pxtoneNoise::~pxtoneNoise() 18 | { 19 | if( _bldr ){delete (pxtnPulse_NoiseBuilder*)_bldr; _bldr = NULL; } 20 | } 21 | 22 | bool pxtoneNoise::init() 23 | { 24 | pxtnPulse_NoiseBuilder *bldr = new pxtnPulse_NoiseBuilder(); 25 | if( !bldr->Init() ){ delete( bldr ); return false; } 26 | _bldr = bldr; 27 | return true; 28 | } 29 | 30 | bool pxtoneNoise::quality_set( int32_t ch_num, int32_t sps, int32_t bps ) 31 | { 32 | switch( ch_num ) 33 | { 34 | case 1: case 2: break; 35 | default: return false; 36 | } 37 | 38 | switch( sps ) 39 | { 40 | case 48000: case 44100: case 22050: case 11025: break; 41 | default: return false; 42 | } 43 | 44 | switch( bps ) 45 | { 46 | case 8: case 16: break; 47 | default: return false; 48 | } 49 | 50 | _ch_num = ch_num; 51 | _bps = bps ; 52 | _sps = sps ; 53 | 54 | return true; 55 | } 56 | 57 | void pxtoneNoise::quality_get( int32_t *p_ch_num, int32_t *p_sps, int32_t *p_bps ) const 58 | { 59 | if( p_ch_num ) *p_ch_num = _ch_num; 60 | if( p_sps ) *p_sps = _sps ; 61 | if( p_bps ) *p_bps = _bps ; 62 | } 63 | 64 | 65 | bool pxtoneNoise::generate( pxtnDescriptor *p_doc, void **pp_buf, int32_t *p_size ) const 66 | { 67 | bool b_ret = false; 68 | pxtnPulse_NoiseBuilder *bldr = (pxtnPulse_NoiseBuilder*)_bldr; 69 | pxtnPulse_Noise *noise = new pxtnPulse_Noise(); 70 | pxtnPulse_PCM *pcm = NULL; 71 | 72 | if( noise->read( p_doc ) != pxtnOK ) goto End; 73 | if( !( pcm = bldr->BuildNoise( noise, _ch_num, _sps, _bps ) ) ) goto End; 74 | 75 | *p_size = pcm->get_buf_size(); 76 | *pp_buf = pcm->Devolve_SamplingBuffer(); 77 | 78 | b_ret = true; 79 | End: 80 | if( noise ) delete noise; 81 | if( pcm ) delete pcm ; 82 | 83 | return b_ret; 84 | } 85 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/prowizard/wn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Wanton_Packer.c Copyright (C) 1997 Asle / ReDoX 3 | * 4 | * Converts MODs converted with Wanton packer 5 | * 6 | * Modified in 2006,2007,2014 by Claudio Matsuoka 7 | */ 8 | 9 | #include "prowiz.h" 10 | 11 | 12 | static int depack_wn(HIO_HANDLE *in, FILE * out) 13 | { 14 | uint8 c1, c2, c3, c4; 15 | uint8 npat, max; 16 | uint8 tmp[1024]; 17 | int ssize = 0; 18 | int i, j; 19 | 20 | /* read header */ 21 | pw_move_data(out, in, 950); 22 | 23 | /* get whole sample size */ 24 | for (i = 0; i < 31; i++) { 25 | hio_seek(in, 42 + i * 30, SEEK_SET); 26 | ssize += hio_read16b(in) * 2; 27 | } 28 | 29 | /* read size of pattern list */ 30 | hio_seek(in, 950, SEEK_SET); 31 | write8(out, npat = hio_read8(in)); 32 | 33 | hio_read(tmp, 129, 1, in); 34 | fwrite(tmp, 129, 1, out); 35 | 36 | /* write ptk's ID */ 37 | write32b(out, PW_MOD_MAGIC); 38 | 39 | /* get highest pattern number */ 40 | for (max = i = 0; i < 128; i++) { 41 | if (tmp[i + 1] > max) 42 | max = tmp[i + 1]; 43 | } 44 | max++; 45 | 46 | /* pattern data */ 47 | hio_seek(in, 1084, SEEK_SET); 48 | for (i = 0; i < max; i++) { 49 | for (j = 0; j < 256; j++) { 50 | c1 = hio_read8(in); 51 | c2 = hio_read8(in); 52 | c3 = hio_read8(in); 53 | c4 = hio_read8(in); 54 | 55 | if (hio_error(in) || !PTK_IS_VALID_NOTE(c1 / 2)) { 56 | return -1; 57 | } 58 | 59 | write8(out, (c2 & 0xf0) | ptk_table[c1 / 2][0]); 60 | write8(out, ptk_table[c1 / 2][1]); 61 | write8(out, ((c2 << 4) & 0xf0) | c3); 62 | write8(out, c4); 63 | } 64 | } 65 | 66 | /* sample data */ 67 | pw_move_data(out, in, ssize); 68 | 69 | return 0; 70 | } 71 | 72 | static int test_wn(const uint8 *data, char *t, int s) 73 | { 74 | PW_REQUEST_DATA(s, 1082); 75 | 76 | /* test 1 */ 77 | if (data[1080] != 'W' || data[1081] !='N') 78 | return -1; 79 | 80 | /* test 2 */ 81 | if (data[951] != 0x7f) 82 | return -1; 83 | 84 | /* test 3 */ 85 | if (data[950] > 0x7f) 86 | return -1; 87 | 88 | pw_read_title(data, t, 20); 89 | 90 | return 0; 91 | } 92 | 93 | const struct pw_format pw_wn = { 94 | "Wanton Packer", 95 | test_wn, 96 | depack_wn 97 | }; 98 | -------------------------------------------------------------------------------- /src/decoding/decoders/dr_flac.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #include "dr_flac.h" 20 | 21 | #ifndef __cplusplus 22 | #include 23 | #endif 24 | #include 25 | 26 | #define DR_FLAC_IMPLEMENTATION 27 | #define DR_FLAC_NO_STDIO 28 | #define DRFLAC_API static 29 | #define DRFLAC_PRIVATE static 30 | #include "libs/dr_flac.h" 31 | 32 | #include "common.h" 33 | 34 | void* Decoder_DR_FLAC_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec) 35 | { 36 | (void)loop; // This is ignored in simple decoders 37 | (void)wanted_spec; 38 | 39 | drflac *backend = drflac_open_memory(data, data_size, NULL); 40 | 41 | if (backend != NULL) 42 | { 43 | spec->sample_rate = backend->sampleRate; 44 | spec->channel_count = backend->channels; 45 | spec->is_complex = false; 46 | } 47 | 48 | return backend; 49 | } 50 | 51 | void Decoder_DR_FLAC_Destroy(void *decoder) 52 | { 53 | drflac_close((drflac*)decoder); 54 | } 55 | 56 | void Decoder_DR_FLAC_Rewind(void *decoder) 57 | { 58 | drflac_seek_to_pcm_frame((drflac*)decoder, 0); 59 | } 60 | 61 | size_t Decoder_DR_FLAC_GetSamples(void *decoder, short *buffer, size_t frames_to_do) 62 | { 63 | return (size_t)drflac_read_pcm_frames_s16((drflac*)decoder, frames_to_do, buffer); 64 | } 65 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnPulse_Oscillator.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "./pxtn.h" 3 | 4 | #include "./pxtnPulse_Oscillator.h" 5 | 6 | pxtnPulse_Oscillator::pxtnPulse_Oscillator() 7 | { 8 | _volume = 0; 9 | _p_point = NULL; 10 | _sample_num = 0; 11 | _point_num = 0; 12 | _point_reso = 0; 13 | } 14 | 15 | void pxtnPulse_Oscillator::ReadyGetSample( pxtnPOINT *p_point, int32_t point_num, int32_t volume, int32_t sample_num, int32_t point_reso ) 16 | { 17 | _volume = volume; 18 | _p_point = p_point; 19 | _sample_num = sample_num; 20 | _point_num = point_num; 21 | _point_reso = point_reso; 22 | } 23 | 24 | double pxtnPulse_Oscillator::GetOneSample_Overtone( int32_t index ) 25 | { 26 | int32_t o; 27 | double work_double; 28 | double pi = 3.1415926535897932; 29 | double sss; 30 | 31 | work_double = 0; 32 | for( o = 0; o < _point_num; o++ ) 33 | { 34 | sss = 2 * pi * ( _p_point[ o ].x ) * index / _sample_num; 35 | work_double += ( sin( sss ) * (double)_p_point[ o ].y / ( _p_point[ o ].x ) / 128 ); 36 | } 37 | work_double = work_double * _volume / 128; 38 | 39 | return work_double; 40 | } 41 | 42 | double pxtnPulse_Oscillator::GetOneSample_Coodinate( int32_t index ) 43 | { 44 | int32_t i; 45 | int32_t c; 46 | int32_t x1, y1, x2, y2; 47 | int32_t w, h; 48 | double work; 49 | 50 | i = _point_reso * index / _sample_num; 51 | 52 | // find target 2 ponits 53 | c = 0; while( c < _point_num ){ if( _p_point[ c ].x > i ) break; c++; } 54 | 55 | //末端 56 | if( c == _point_num ) 57 | { 58 | x1 = _p_point[ c - 1 ].x; 59 | y1 = _p_point[ c - 1 ].y; 60 | x2 = _point_reso; 61 | y2 = _p_point[ 0 ].y; 62 | } 63 | else 64 | { 65 | if( c ){ 66 | x1 = _p_point[ c - 1 ].x; 67 | y1 = _p_point[ c - 1 ].y; 68 | x2 = _p_point[ c ].x; 69 | y2 = _p_point[ c ].y; 70 | }else{ 71 | x1 = _p_point[ 0 ].x; 72 | y1 = _p_point[ 0 ].y; 73 | x2 = _p_point[ 0 ].x; 74 | y2 = _p_point[ 0 ].y; 75 | } 76 | } 77 | 78 | w = x2 - x1; 79 | i = i - x1; 80 | h = y2 - y1; 81 | 82 | if( i ) work = (double)y1 + (double)h * (double)i / (double)w; 83 | else work = y1; 84 | 85 | return work * _volume / 128 /128 ; 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/mod.h: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef LIBXMP_LOADERS_MOD_H 24 | #define LIBXMP_LOADERS_MOD_H 25 | 26 | struct mod_instrument { 27 | uint8 name[22]; /* Instrument name */ 28 | uint16 size; /* Sample length in 16-bit words */ 29 | int8 finetune; /* Finetune (signed nibble) */ 30 | int8 volume; /* Linear playback volume */ 31 | uint16 loop_start; /* Loop start in 16-bit words */ 32 | uint16 loop_size; /* Loop length in 16-bit words */ 33 | }; 34 | 35 | struct mod_header { 36 | uint8 name[20]; 37 | struct mod_instrument ins[31]; 38 | uint8 len; 39 | uint8 restart; /* Number of patterns in Soundtracker, 40 | * Restart in Noisetracker/Startrekker, 41 | * 0x7F in Protracker 42 | */ 43 | uint8 order[128]; 44 | uint8 magic[4]; 45 | }; 46 | 47 | #ifndef LIBXMP_CORE_PLAYER 48 | /* Soundtracker 15-instrument module header */ 49 | 50 | struct st_header { 51 | uint8 name[20]; 52 | struct mod_instrument ins[15]; 53 | uint8 len; 54 | uint8 restart; 55 | uint8 order[128]; 56 | }; 57 | #endif 58 | 59 | #endif /* LIBXMP_LOADERS_MOD_H */ 60 | -------------------------------------------------------------------------------- /include/clownaudio/playback.h: -------------------------------------------------------------------------------- 1 | // (C) 2018-2021 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #ifndef CLOWNAUDIO_PLAYBACK_H 20 | #define CLOWNAUDIO_PLAYBACK_H 21 | 22 | #ifndef __cplusplus 23 | #include 24 | #endif 25 | #include 26 | 27 | #ifndef CLOWNAUDIO_EXPORT 28 | #include "clownaudio_export.h" 29 | #endif 30 | 31 | #define CLOWNAUDIO_STREAM_CHANNEL_COUNT 2 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | typedef struct ClownAudio_Stream ClownAudio_Stream; 38 | 39 | CLOWNAUDIO_EXPORT bool ClownAudio_InitPlayback(void); 40 | CLOWNAUDIO_EXPORT void ClownAudio_DeinitPlayback(void); 41 | CLOWNAUDIO_EXPORT ClownAudio_Stream* ClownAudio_StreamCreate(unsigned long *sample_rate, void (*user_callback)(void *user_data, short *output_buffer, size_t frames_to_do)); 42 | CLOWNAUDIO_EXPORT bool ClownAudio_StreamDestroy(ClownAudio_Stream *stream); 43 | CLOWNAUDIO_EXPORT void ClownAudio_StreamSetCallbackData(ClownAudio_Stream *stream, void *user_data); 44 | CLOWNAUDIO_EXPORT bool ClownAudio_StreamPause(ClownAudio_Stream *stream); 45 | CLOWNAUDIO_EXPORT bool ClownAudio_StreamResume(ClownAudio_Stream *stream); 46 | CLOWNAUDIO_EXPORT void ClownAudio_StreamLock(ClownAudio_Stream *stream); 47 | CLOWNAUDIO_EXPORT void ClownAudio_StreamUnlock(ClownAudio_Stream *stream); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif // CLOWNAUDIO_PLAYBACK_H 54 | -------------------------------------------------------------------------------- /src/decoding/decoders/libopus.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #include "libopus.h" 20 | 21 | #ifndef __cplusplus 22 | #include 23 | #endif 24 | #include 25 | 26 | #include 27 | 28 | #include "common.h" 29 | 30 | void* Decoder_libOpus_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec) 31 | { 32 | (void)loop; // This is ignored in simple decoders 33 | (void)wanted_spec; 34 | 35 | OggOpusFile *backend = op_open_memory(data, data_size, NULL); 36 | 37 | if (backend != NULL) 38 | { 39 | spec->sample_rate = 48000; // libopusfile always outputs at 48kHz (https://opus-codec.org/docs/opusfile_api-0.7/structOpusHead.html#a73b80a913eca33d829f1667caee80d9e) 40 | spec->channel_count = 2; // We use op_read_float_stereo, so libopusfile will handle conversion if it needs to 41 | spec->is_complex = false; 42 | } 43 | 44 | return backend; 45 | } 46 | 47 | void Decoder_libOpus_Destroy(void *decoder) 48 | { 49 | op_free((OggOpusFile*)decoder); 50 | } 51 | 52 | void Decoder_libOpus_Rewind(void *decoder) 53 | { 54 | op_pcm_seek((OggOpusFile*)decoder, 0); 55 | } 56 | 57 | size_t Decoder_libOpus_GetSamples(void *decoder, short *buffer, size_t frames_to_do) 58 | { 59 | return op_read_stereo((OggOpusFile*)decoder, buffer, frames_to_do * 2); // You tell *me* why that last parameter is in samples and not frames 60 | } 61 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/loaders/mod.h: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef LIBXMP_LOADERS_MOD_H 24 | #define LIBXMP_LOADERS_MOD_H 25 | 26 | struct mod_instrument { 27 | uint8 name[22]; /* Instrument name */ 28 | uint16 size; /* Sample length in 16-bit words */ 29 | int8 finetune; /* Finetune (signed nibble) */ 30 | int8 volume; /* Linear playback volume */ 31 | uint16 loop_start; /* Loop start in 16-bit words */ 32 | uint16 loop_size; /* Loop length in 16-bit words */ 33 | }; 34 | 35 | struct mod_header { 36 | uint8 name[20]; 37 | struct mod_instrument ins[31]; 38 | uint8 len; 39 | uint8 restart; /* Number of patterns in Soundtracker, 40 | * Restart in Noisetracker/Startrekker, 41 | * 0x7F in Protracker 42 | */ 43 | uint8 order[128]; 44 | uint8 magic[4]; 45 | }; 46 | 47 | 48 | #ifndef LIBXMP_CORE_PLAYER 49 | /* Soundtracker 15-instrument module header */ 50 | 51 | struct st_header { 52 | uint8 name[20]; 53 | struct mod_instrument ins[15]; 54 | uint8 len; 55 | uint8 restart; 56 | uint8 order[128]; 57 | }; 58 | #endif 59 | 60 | extern const struct format_loader libxmp_loader_mod; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnPulse_Noise.h: -------------------------------------------------------------------------------- 1 | #ifndef pxtnPulse_Noise_H 2 | #define pxtnPulse_Noise_H 3 | 4 | #include "./pxtn.h" 5 | 6 | #include "./pxtnDescriptor.h" 7 | #include "./pxtnPulse_Frequency.h" 8 | #include "./pxtnPulse_Oscillator.h" 9 | #include "./pxtnPulse_PCM.h" 10 | 11 | enum pxWAVETYPE 12 | { 13 | pxWAVETYPE_None = 0, 14 | pxWAVETYPE_Sine, 15 | pxWAVETYPE_Saw, 16 | pxWAVETYPE_Rect, 17 | pxWAVETYPE_Random, 18 | pxWAVETYPE_Saw2, 19 | pxWAVETYPE_Rect2, 20 | 21 | pxWAVETYPE_Tri , 22 | pxWAVETYPE_Random2, 23 | pxWAVETYPE_Rect3 , 24 | pxWAVETYPE_Rect4 , 25 | pxWAVETYPE_Rect8 , 26 | pxWAVETYPE_Rect16 , 27 | pxWAVETYPE_Saw3 , 28 | pxWAVETYPE_Saw4 , 29 | pxWAVETYPE_Saw6 , 30 | pxWAVETYPE_Saw8 , 31 | 32 | pxWAVETYPE_num 33 | }; 34 | 35 | typedef struct 36 | { 37 | pxWAVETYPE type ; 38 | float freq ; 39 | float volume; 40 | float offset; 41 | bool b_rev ; 42 | } 43 | pxNOISEDESIGN_OSCILLATOR; 44 | 45 | typedef struct 46 | { 47 | bool bEnable ; 48 | int32_t enve_num; 49 | pxtnPOINT* enves ; 50 | int32_t pan ; 51 | pxNOISEDESIGN_OSCILLATOR main ; 52 | pxNOISEDESIGN_OSCILLATOR freq ; 53 | pxNOISEDESIGN_OSCILLATOR volu ; 54 | } 55 | pxNOISEDESIGN_UNIT; 56 | 57 | 58 | class pxtnPulse_Noise 59 | { 60 | private: 61 | void operator = (const pxtnPulse_Noise& src); 62 | pxtnPulse_Noise (const pxtnPulse_Noise& src); 63 | 64 | int32_t _smp_num_44k; 65 | int32_t _unit_num ; 66 | pxNOISEDESIGN_UNIT* _units ; 67 | 68 | public: 69 | pxtnPulse_Noise (); 70 | ~pxtnPulse_Noise (); 71 | 72 | bool write ( pxtnDescriptor *p_doc, int32_t *p_add ) const; 73 | pxtnERR read ( pxtnDescriptor *p_doc ); 74 | 75 | void Release ( ); 76 | bool Allocate ( int32_t unit_num, int32_t envelope_num ); 77 | bool Copy ( pxtnPulse_Noise *p_dst ) const; 78 | int32_t Compare ( const pxtnPulse_Noise *p_src ) const; 79 | void Fix(); 80 | 81 | void set_smp_num_44k( int32_t num ); 82 | 83 | int32_t get_unit_num () const; 84 | int32_t get_smp_num_44k() const; 85 | float get_sec () const; 86 | pxNOISEDESIGN_UNIT *get_unit( int32_t u ); 87 | }; 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /examples/gui-qt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | option(SUBDIRECTORY "Use clownaudio as a subdirectory, instead of an external package" ON) 4 | 5 | project(clownaudio_test VERSION 0.1 LANGUAGES CXX) 6 | 7 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 8 | 9 | set(CMAKE_AUTOUIC ON) 10 | set(CMAKE_AUTOMOC ON) 11 | set(CMAKE_AUTORCC ON) 12 | 13 | set(CMAKE_CXX_STANDARD 11) 14 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 15 | 16 | # QtCreator supports the following variables for Android, which are identical to qmake Android variables. 17 | # Check https://doc.qt.io/qt/deployment-android.html for more information. 18 | # They need to be set before the find_package( ...) calls below. 19 | 20 | #if(ANDROID) 21 | # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") 22 | # if (ANDROID_ABI STREQUAL "armeabi-v7a") 23 | # set(ANDROID_EXTRA_LIBS 24 | # ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so 25 | # ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) 26 | # endif() 27 | #endif() 28 | 29 | find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED) 30 | find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) 31 | 32 | set(PROJECT_SOURCES 33 | main.cpp 34 | mainwindow.cpp 35 | mainwindow.h 36 | mainwindow.ui 37 | ) 38 | 39 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) 40 | qt_add_executable(clownaudio_test 41 | MANUAL_FINALIZATION 42 | ${PROJECT_SOURCES} 43 | ) 44 | else() 45 | if(ANDROID) 46 | add_library(clownaudio_test SHARED 47 | ${PROJECT_SOURCES} 48 | ) 49 | else() 50 | add_executable(clownaudio_test WIN32 51 | ${PROJECT_SOURCES} 52 | ) 53 | endif() 54 | endif() 55 | 56 | target_link_libraries(clownaudio_test PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) 57 | 58 | set_target_properties(clownaudio_test PROPERTIES 59 | MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com 60 | MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} 61 | MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} 62 | ) 63 | 64 | if(QT_VERSION_MAJOR EQUAL 6) 65 | qt_finalize_executable(clownaudio_test) 66 | endif() 67 | 68 | if(SUBDIRECTORY) 69 | add_subdirectory("../.." "clownaudio" EXCLUDE_FROM_ALL) 70 | else() 71 | find_package(clownaudio REQUIRED) 72 | endif() 73 | 74 | target_link_libraries(clownaudio_test PRIVATE clownaudio) 75 | -------------------------------------------------------------------------------- /src/decoding/decoders/dr_wav.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #include "dr_wav.h" 20 | 21 | #ifndef __cplusplus 22 | #include 23 | #endif 24 | #include 25 | #include 26 | 27 | #define DR_WAV_IMPLEMENTATION 28 | #define DR_WAV_NO_STDIO 29 | #define DRWAV_API static 30 | #define DRWAV_PRIVATE static 31 | #include "libs/dr_wav.h" 32 | 33 | #include "common.h" 34 | 35 | void* Decoder_DR_WAV_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec) 36 | { 37 | (void)loop; // This is ignored in simple decoders 38 | (void)wanted_spec; 39 | 40 | drwav *instance = (drwav*)malloc(sizeof(drwav)); 41 | 42 | if (instance != NULL) 43 | { 44 | if (drwav_init_memory(instance, data, data_size, NULL)) 45 | { 46 | spec->sample_rate = instance->sampleRate; 47 | spec->channel_count = instance->channels; 48 | spec->is_complex = false; 49 | 50 | return instance; 51 | } 52 | 53 | free(instance); 54 | } 55 | 56 | return NULL; 57 | } 58 | 59 | void Decoder_DR_WAV_Destroy(void *decoder) 60 | { 61 | drwav *instance = (drwav*)decoder; 62 | 63 | drwav_uninit(instance); 64 | free(instance); 65 | } 66 | 67 | void Decoder_DR_WAV_Rewind(void *decoder) 68 | { 69 | drwav_seek_to_pcm_frame((drwav*)decoder, 0); 70 | } 71 | 72 | size_t Decoder_DR_WAV_GetSamples(void *decoder, short *buffer, size_t frames_to_do) 73 | { 74 | return (size_t)drwav_read_pcm_frames_s16((drwav*)decoder, frames_to_do, buffer); 75 | } 76 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/ftm_load.c: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * This file is part of the Extended Module Player and is distributed 5 | * under the terms of the GNU Lesser General Public License. See COPYING.LIB 6 | * for more information. 7 | */ 8 | 9 | /* 10 | * From http://amp.dascene.net/faq.php: 11 | * [Face The Music is an] Amiga tracker created by Jörg W. Schmidt in 1990 12 | * for Maxon Computer GmbH. Face the Music delivers: 8 channels, line-based 13 | * editor with S.E.L. (Sound Effect Language). 14 | */ 15 | #include "loader.h" 16 | 17 | struct ftm_instrument { 18 | uint8 name[30]; /* Instrument name */ 19 | uint8 unknown[2]; 20 | }; 21 | 22 | struct ftm_header { 23 | uint8 id[4]; /* "FTMN" ID string */ 24 | uint8 ver; /* Version ?!? (0x03) */ 25 | uint8 nos; /* Number of samples (?) */ 26 | uint8 unknown[10]; 27 | uint8 title[32]; /* Module title */ 28 | uint8 author[32]; /* Module author */ 29 | uint8 unknown2[2]; 30 | }; 31 | 32 | int ftm_load(HIO_HANDLE * f) 33 | { 34 | int i, j, k; 35 | struct xmp_event *event; 36 | struct ftm_header fh; 37 | struct ftm_instrument si; 38 | uint8 b1, b2, b3; 39 | 40 | LOAD_INIT(); 41 | 42 | hio_read(&fh.id, 4, 1, f); 43 | if (memcmp(fh.id, "FTMN", 4)) 44 | return -1; 45 | 46 | fh.ver = hio_read8(f); 47 | fh.nos = hio_read8(f); 48 | hio_read16b(f); 49 | hio_read32b(f); 50 | hio_read32b(f); 51 | hio_read(&fh.title, 32, 1, f); 52 | hio_read(&fh.author, 32, 1, f); 53 | hio_read16b(f); 54 | 55 | //mod->len = fh.len; 56 | //mod->pat = fh.pat; 57 | mod->ins = fh.nos; 58 | mod->smp = mod->ins; 59 | mod->trk = mod->pat * mod->chn; 60 | for (i = 0; i < mod->len; i++) 61 | mod->xxo[i] = fh.order[i]; 62 | 63 | libxmp_set_type(m, "Face The Music"); 64 | MODULE_INFO(); 65 | PATTERN_INIT(); 66 | 67 | /* Load and convert patterns */ 68 | if (V(0)) 69 | report("Stored patterns: %d ", mod->pat); 70 | for (i = 0; i < mod->pat; i++) { 71 | PATTERN_ALLOC(i); 72 | mod->xxp[i]->rows = 64; 73 | TRACK_ALLOC(i); 74 | for (j = 0; j < 4; j++) { 75 | } 76 | 77 | reportv(ctx, 0, "."); 78 | } 79 | 80 | INSTRUMENT_INIT(); 81 | reportv(ctx, 0, "\nStored samples : %d ", mod->smp); 82 | 83 | for (i = 0; i < mod->smp; i++) { 84 | reportv(ctx, 0, "."); 85 | } 86 | 87 | reportv(ctx, 0, "\n"); 88 | mod->flg |= XXM_FLG_MODRNG; 89 | 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/watcom.mif: -------------------------------------------------------------------------------- 1 | CFLAGS += -DHAVE_ALLOCA_H -DHAVE_FNMATCH -DHAVE_MKSTEMP -DHAVE_UMASK -DLIBXMP_CORE_PLAYER -DLIBXMP_NO_PROWIZARD -DLIBXMP_NO_DEPACKERS 2 | #CFLAGS += -DDEBUG 3 | CFLAGS += -I"include/libxmp-lite" -Isrc 4 | 5 | DLLFLAGS=-bd -DBUILDING_DLL 6 | STATICFLAGS=-DBUILDING_STATIC 7 | 8 | DLLNAME=libxmp.dll 9 | EXPNAME=libxmp.exp 10 | LIBNAME=libxmp.lib 11 | LIBSTATIC=xmp_static.lib 12 | TESTNAME=libxmp-test.exe 13 | 14 | !ifeq target static 15 | CFLAGS += $(STATICFLAGS) 16 | LIBFLAGS=$(CFLAGS) 17 | BLD_TARGET=$(LIBSTATIC) 18 | BLD_LIB=$(LIBSTATIC) 19 | !else 20 | LIBFLAGS=$(CFLAGS) $(DLLFLAGS) 21 | BLD_TARGET=$(DLLNAME) 22 | BLD_LIB=$(LIBNAME) 23 | !endif 24 | 25 | OBJS=src/virtual.obj src/format.obj src/period.obj src/player.obj src/read_event.obj src/misc.obj src/dataio.obj src/lfo.obj src/scan.obj src/control.obj src/filter.obj src/effects.obj src/mixer.obj src/mix_all.obj src/load_helpers.obj src/load.obj src/hio.obj src/smix.obj src/memio.obj src/win32.obj src/loaders/common.obj src/loaders/itsex.obj src/loaders/sample.obj src/loaders/xm_load.obj src/loaders/mod_load.obj src/loaders/s3m_load.obj src/loaders/it_load.obj 26 | TEST_OBJS=test/md5.obj test/test.obj 27 | 28 | all: $(BLD_TARGET) 29 | 30 | #.SUFFIXES: .obj .c 31 | 32 | .c: src;src/loaders;test 33 | .c.obj: 34 | $(CC) $(LIBFLAGS) -fo=$^@ $< 35 | 36 | test/md5.obj: src/md5.c 37 | $(CC) $(CFLAGS) -fo=$^@ $< 38 | 39 | test/test.obj: test/test.c 40 | $(CC) $(CFLAGS) -fo=$^@ $< 41 | 42 | # rely on symbol name, not ordinal: -irn switch of wlib is default, but -inn is not. 43 | $(DLLNAME) $(LIBNAME) $(EXPNAME): $(OBJS) 44 | wlink NAM $(DLLNAME) SYSTEM $(SYSTEM_DLL) INITINSTANCE TERMINSTANCE OP QUIET FIL {$(OBJS)} OPTION IMPF=$(EXPNAME) 45 | wlib -q -b -n -c -pa -s -t -zld -ii -io -inn $(LIBNAME) +$(DLLNAME) 46 | 47 | $(LIBSTATIC): $(OBJS) 48 | wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(OBJS) 49 | 50 | test/$(TESTNAME): $(BLD_LIB) $(TEST_OBJS) 51 | wlink NAM test/$(TESTNAME) SYSTEM $(SYSTEM) OP QUIET LIBR {$(BLD_LIB)} FIL {$(TEST_OBJS)} 52 | 53 | check-build: test/$(TESTNAME) .symbolic 54 | !ifneq target static 55 | $(CMD_CP) $(DLLNAME) test 56 | !endif 57 | 58 | check: check-build .symbolic 59 | cd test & $(TESTNAME) 60 | 61 | clean: .symbolic 62 | rm -f $(OBJS) 63 | rm -f $(TEST_OBJS) 64 | 65 | distclean: clean .symbolic 66 | rm -f $(DLLNAME) $(EXPNAME) $(LIBNAME) $(LIBSTATIC) test/$(DLLNAME) test/$(TESTNAME) 67 | 68 | !ifdef __UNIX__ 69 | CMD_CP=cp 70 | !else 71 | CMD_CP=copy 72 | !endif 73 | -------------------------------------------------------------------------------- /src/decoding/decoders/dr_mp3.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #include "dr_mp3.h" 20 | 21 | #ifndef __cplusplus 22 | #include 23 | #endif 24 | #include 25 | #include 26 | 27 | #define DR_MP3_IMPLEMENTATION 28 | #define DR_MP3_NO_STDIO 29 | #define DRMP3_API static 30 | #define DRMP3_PRIVATE static 31 | #include "libs/dr_mp3.h" 32 | 33 | #include "common.h" 34 | 35 | void* Decoder_DR_MP3_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec) 36 | { 37 | (void)loop; // This is ignored in simple decoders 38 | (void)wanted_spec; 39 | 40 | if ((data[0] == 0xFF && data[1] == 0xFB) || (data[0] == 0x49 && data[1] == 0x44 && data[2] == 0x33)) 41 | { 42 | drmp3 *instance = (drmp3*)malloc(sizeof(drmp3)); 43 | 44 | if (instance != NULL) 45 | { 46 | if (drmp3_init_memory(instance, data, data_size, NULL)) 47 | { 48 | spec->sample_rate = instance->sampleRate; 49 | spec->channel_count = instance->channels; 50 | spec->is_complex = false; 51 | 52 | return instance; 53 | } 54 | 55 | free(instance); 56 | } 57 | } 58 | 59 | return NULL; 60 | } 61 | 62 | void Decoder_DR_MP3_Destroy(void *decoder) 63 | { 64 | drmp3 *instance = (drmp3*)decoder; 65 | 66 | drmp3_uninit(instance); 67 | free(instance); 68 | } 69 | 70 | void Decoder_DR_MP3_Rewind(void *decoder) 71 | { 72 | drmp3_seek_to_pcm_frame((drmp3*)decoder, 0); 73 | } 74 | 75 | size_t Decoder_DR_MP3_GetSamples(void *decoder, short *buffer, size_t frames_to_do) 76 | { 77 | return (size_t)drmp3_read_pcm_frames_s16((drmp3*)decoder, frames_to_do, buffer); 78 | } 79 | -------------------------------------------------------------------------------- /examples/gui/imgui/imgui_impl_glfw.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for GLFW 2 | // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..) 3 | // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Clipboard support. 7 | // [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 8 | // [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW. 9 | // [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE). 10 | 11 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 13 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 14 | 15 | // About GLSL version: 16 | // The 'glsl_version' initialization parameter defaults to "#version 150" if NULL. 17 | // Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure! 18 | 19 | #pragma once 20 | #include "imgui.h" // IMGUI_IMPL_API 21 | 22 | struct GLFWwindow; 23 | 24 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); 25 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks); 26 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks); 27 | IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); 28 | IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); 29 | 30 | // GLFW callbacks 31 | // - When calling Init with 'install_callbacks=true': GLFW callbacks will be installed for you. They will call user's previously installed callbacks, if any. 32 | // - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call those function yourself from your own GLFW callbacks. 33 | IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 34 | IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 35 | IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 36 | IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); 37 | -------------------------------------------------------------------------------- /src/decoding/decoders/stb_vorbis.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020 Clownacy 2 | // 3 | // This software is provided 'as-is', without any express or implied 4 | // warranty. In no event will the authors be held liable for any damages 5 | // arising from the use of this software. 6 | // 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 11 | // 1. The origin of this software must not be misrepresented; you must not 12 | // claim that you wrote the original software. If you use this software 13 | // in a product, an acknowledgment in the product documentation would be 14 | // appreciated but is not required. 15 | // 2. Altered source versions must be plainly marked as such, and must not be 16 | // misrepresented as being the original software. 17 | // 3. This notice may not be removed or altered from any source distribution. 18 | 19 | #include "stb_vorbis.h" 20 | 21 | #ifndef __cplusplus 22 | #include 23 | #endif 24 | #include 25 | 26 | #define STB_VORBIS_NO_STDIO 27 | #define STB_VORBIS_NO_PUSHDATA_API 28 | 29 | #ifdef __GNUC__ 30 | #pragma GCC diagnostic push 31 | #pragma GCC diagnostic ignored "-Wunused-parameter" 32 | #endif 33 | #include "libs/stb_vorbis.c" 34 | #ifdef __GNUC__ 35 | #pragma GCC diagnostic pop 36 | #endif 37 | 38 | #include "common.h" 39 | 40 | void* Decoder_STB_Vorbis_Create(const unsigned char *data, size_t data_size, bool loop, const DecoderSpec *wanted_spec, DecoderSpec *spec) 41 | { 42 | (void)loop; // This is ignored in simple decoders 43 | (void)wanted_spec; 44 | 45 | stb_vorbis *instance = stb_vorbis_open_memory(data, data_size, NULL, NULL); 46 | 47 | if (instance != NULL) 48 | { 49 | const stb_vorbis_info vorbis_info = stb_vorbis_get_info(instance); 50 | 51 | spec->sample_rate = vorbis_info.sample_rate; 52 | spec->channel_count = vorbis_info.channels; 53 | spec->is_complex = false; 54 | } 55 | 56 | return instance; 57 | } 58 | 59 | void Decoder_STB_Vorbis_Destroy(void *decoder) 60 | { 61 | stb_vorbis_close((stb_vorbis*)decoder); 62 | } 63 | 64 | void Decoder_STB_Vorbis_Rewind(void *decoder) 65 | { 66 | stb_vorbis_seek_start((stb_vorbis*)decoder); 67 | } 68 | 69 | size_t Decoder_STB_Vorbis_GetSamples(void *decoder, short *buffer, size_t frames_to_do) 70 | { 71 | stb_vorbis *instance = (stb_vorbis*)decoder; 72 | 73 | return stb_vorbis_get_samples_short_interleaved(instance, instance->channels, buffer, frames_to_do * instance->channels); 74 | } 75 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/prowizard/prun1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ProRunner1.c Copyright (C) 1996 Asle / ReDoX 3 | * 4 | * Converts MODs packed with Prorunner v1.0 5 | * 6 | * Modified in 2006,2007,2014 by Claudio Matsuoka 7 | */ 8 | 9 | #include "prowiz.h" 10 | 11 | 12 | static int depack_pru1 (HIO_HANDLE *in, FILE *out) 13 | { 14 | uint8 header[2048]; 15 | uint8 c1, c2, c3, c4; 16 | uint8 npat, max; 17 | uint8 ptable[128]; 18 | int ssize = 0; 19 | int i, j; 20 | 21 | memset(header, 0, sizeof(header)); 22 | memset(ptable, 0, sizeof(ptable)); 23 | 24 | /* read and write whole header */ 25 | hio_read(header, 950, 1, in); 26 | fwrite(header, 950, 1, out); 27 | 28 | /* get whole sample size */ 29 | for (i = 0; i < 31; i++) { 30 | ssize += readmem16b(header + i * 30 + 42) * 2; 31 | } 32 | 33 | /* read and write size of pattern list */ 34 | write8(out, npat = hio_read8(in)); 35 | 36 | memset(header, 0, sizeof(header)); 37 | 38 | /* read and write ntk byte and pattern list */ 39 | hio_read(header, 129, 1, in); 40 | fwrite(header, 129, 1, out); 41 | 42 | /* write ID */ 43 | write32b(out, PW_MOD_MAGIC); 44 | 45 | /* get number of pattern */ 46 | max = 0; 47 | for (i = 1; i < 129; i++) { 48 | if (header[i] > max) 49 | max = header[i]; 50 | } 51 | 52 | /* pattern data */ 53 | hio_seek(in, 1084, SEEK_SET); 54 | for (i = 0; i <= max; i++) { 55 | for (j = 0; j < 256; j++) { 56 | header[0] = hio_read8(in); 57 | header[1] = hio_read8(in); 58 | header[2] = hio_read8(in); 59 | header[3] = hio_read8(in); 60 | 61 | /* Sanity check */ 62 | if (!PTK_IS_VALID_NOTE(header[1])) { 63 | return -1; 64 | } 65 | 66 | c1 = header[0] & 0xf0; 67 | c3 = (header[0] & 0x0f) << 4; 68 | c3 |= header[2]; 69 | c4 = header[3]; 70 | c1 |= ptk_table[header[1]][0]; 71 | c2 = ptk_table[header[1]][1]; 72 | write8(out, c1); 73 | write8(out, c2); 74 | write8(out, c3); 75 | write8(out, c4); 76 | } 77 | } 78 | 79 | /* sample data */ 80 | pw_move_data(out, in, ssize); 81 | 82 | return 0; 83 | } 84 | 85 | static int test_pru1(const uint8 *data, char *t, int s) 86 | { 87 | PW_REQUEST_DATA(s, 1084); 88 | 89 | if (readmem32b(data + 1080) != 0x534e542e) /* "SNT." */ 90 | return -1; 91 | 92 | /* test 2 */ 93 | if (data[951] != 0x7f) 94 | return -1; 95 | 96 | /* test 3 */ 97 | if (data[950] > 0x7f) 98 | return -1; 99 | 100 | pw_read_title(data, t, 20); 101 | 102 | return 0; 103 | } 104 | 105 | const struct pw_format pw_pru1 = { 106 | "Prorunner 1.0", 107 | test_pru1, 108 | depack_pru1 109 | }; 110 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/demo/trim_spc.c: -------------------------------------------------------------------------------- 1 | /* Trims silence off beginning of SPC file. 2 | Requires the accurate DSP; won't compile with the fast DSP. 3 | Please note that the algorithm could be improved; this is just 4 | a simple example showing the idea. 5 | 6 | Usage: trim_spc [test.spc [trimmed.spc]] 7 | */ 8 | 9 | #include "snes_spc/spc.h" 10 | 11 | #include "demo_util.h" /* error(), load_file() */ 12 | 13 | /* Change to 1 to have it trim to next key on event rather than trim silence */ 14 | enum { use_kon_check = 0 }; 15 | 16 | /* True if all count samples from in are silent (or very close to it) */ 17 | int is_silent( short const* in, int count ); 18 | 19 | int main( int argc, char** argv ) 20 | { 21 | /* Load file into memory */ 22 | long spc_size; 23 | void* spc = load_file( (argc > 1) ? argv [1] : "test.spc", &spc_size ); 24 | 25 | /* Load into emulator */ 26 | SNES_SPC* snes_spc = spc_new(); 27 | if ( !snes_spc ) error( "Out of memory" ); 28 | error( spc_load_spc( snes_spc, spc, spc_size ) ); 29 | 30 | /* Expand SPC data so there's enough room for emulator to save to. 31 | We simply overwrite the emulator data in the old SPC file rather 32 | than creating new SPC data. This preserves the text tags from 33 | the old file. */ 34 | if ( spc_size < spc_file_size ) 35 | { 36 | spc_size = spc_file_size; 37 | spc = realloc( spc, spc_size ); /* leaks memory if allocation fails */ 38 | if ( !spc ) error( "Out of memory" ); 39 | } 40 | 41 | /* Keep saving SPC, then playing a little more. Once SPC becomes non-silent, 42 | write the SPC data saved just before this. */ 43 | { 44 | long samples_trimmed = 0; 45 | while ( 1 ) 46 | { 47 | #define BUF_SIZE 1024 48 | short buf [BUF_SIZE]; 49 | 50 | if ( samples_trimmed > 10 * spc_sample_rate * 2 ) 51 | error( "Excess silence found" ); 52 | 53 | spc_clear_echo( snes_spc ); 54 | spc_save_spc( snes_spc, spc ); 55 | 56 | /* Fill buffer */ 57 | error( spc_play( snes_spc, BUF_SIZE, buf ) ); 58 | samples_trimmed += BUF_SIZE; 59 | 60 | /* See if SPC became non-silent */ 61 | if ( use_kon_check ? spc_check_kon( snes_spc ) : !is_silent( buf, BUF_SIZE ) ) 62 | break; 63 | } 64 | 65 | printf( "Trimmed %.1f seconds\n", (double) samples_trimmed / spc_sample_rate / 2 ); 66 | } 67 | 68 | spc_delete( snes_spc ); 69 | write_file( (argc > 2) ? argv [2] : "trimmed.spc", spc, spc_size ); 70 | 71 | return 0; 72 | } 73 | 74 | int is_silent( short const* in, int count ) 75 | { 76 | unsigned const threshold = 0x10; 77 | while ( count-- ) 78 | { 79 | if ( (unsigned) (*in++ + threshold / 2) > threshold ) 80 | return 0; 81 | } 82 | return 1; 83 | } 84 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/prowizard/hrt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Hornet_Packer.c Copyright (C) 1997 Asle / ReDoX 3 | * 4 | * Modified in 2009,2014 by Claudio Matsuoka 5 | */ 6 | 7 | #include "prowiz.h" 8 | 9 | 10 | static int depack_hrt(HIO_HANDLE *in, FILE *out) 11 | { 12 | uint8 buf[1024]; 13 | uint8 c1, c2, c3, c4; 14 | int len, npat; 15 | int ssize = 0; 16 | int i, j; 17 | 18 | memset(buf, 0, sizeof(buf)); 19 | 20 | hio_read(buf, 950, 1, in); /* read header */ 21 | for (i = 0; i < 31; i++) { /* erase addresses */ 22 | uint8 *pos = buf + 38 + 30 * i; 23 | pos[0] = pos[1] = pos[2] = pos[3] = 0; 24 | } 25 | fwrite(buf, 950, 1, out); /* write header */ 26 | 27 | for (i = 0; i < 31; i++) /* samples size */ 28 | ssize += readmem16b(buf + 42 + 30 * i) * 2; 29 | 30 | write8(out, len = hio_read8(in)); /* song length */ 31 | write8(out, hio_read8(in)); /* nst byte */ 32 | 33 | hio_read(buf, 1, 128, in); /* pattern list */ 34 | fwrite(buf, 128, 1, out); 35 | 36 | npat = 0; /* number of patterns */ 37 | for (i = 0; i < 128; i++) { 38 | if (buf[i] > npat) 39 | npat = buf[i]; 40 | } 41 | npat++; 42 | 43 | write32b(out, PW_MOD_MAGIC); /* write ptk ID */ 44 | 45 | /* pattern data */ 46 | hio_seek(in, 1084, SEEK_SET); 47 | for (i = 0; i < npat; i++) { 48 | for (j = 0; j < 256; j++) { 49 | buf[0] = hio_read8(in); 50 | buf[1] = hio_read8(in); 51 | buf[2] = hio_read8(in); 52 | buf[3] = hio_read8(in); 53 | 54 | buf[0] /= 2; 55 | c1 = buf[0] & 0xf0; 56 | 57 | if (buf[1] == 0 || !PTK_IS_VALID_NOTE(buf[1] / 2)) 58 | c2 = 0; 59 | else { 60 | c1 |= ptk_table[buf[1] / 2][0]; 61 | c2 = ptk_table[buf[1] / 2][1]; 62 | } 63 | 64 | c3 = ((buf[0] << 4) & 0xf0) | buf[2]; 65 | c4 = buf[3]; 66 | 67 | write8(out, c1); 68 | write8(out, c2); 69 | write8(out, c3); 70 | write8(out, c4); 71 | } 72 | } 73 | 74 | /* sample data */ 75 | pw_move_data(out, in, ssize); 76 | 77 | return 0; 78 | } 79 | 80 | static int test_hrt(const uint8 *data, char *t, int s) 81 | { 82 | int i; 83 | 84 | PW_REQUEST_DATA(s, 1084); 85 | 86 | if (readmem32b(data + 1080) != MAGIC4('H','R','T','!')) 87 | return -1; 88 | 89 | for (i = 0; i < 31; i++) { 90 | const uint8 *d = data + 20 + i * 30; 91 | 92 | /* test finetune */ 93 | if (d[24] > 0x0f) 94 | return -1; 95 | 96 | /* test volume */ 97 | if (d[25] > 0x40) 98 | return -1; 99 | } 100 | 101 | pw_read_title(data, t, 20); 102 | 103 | return 0; 104 | } 105 | 106 | const struct pw_format pw_hrt = { 107 | "Hornet Packer", 108 | test_hrt, 109 | depack_hrt 110 | }; 111 | -------------------------------------------------------------------------------- /package/msys2/PKGBUILD: -------------------------------------------------------------------------------- 1 | pkgbase=mingw-w64-clownaudio-git 2 | pkgname=${MINGW_PACKAGE_PREFIX}-clownaudio-git 3 | pkgver=r231.79004cd 4 | pkgrel=1 5 | pkgdesc='Stereo audio engine supporting various formats' 6 | arch=('any') 7 | url='https://github.com/Clownacy/clownaudio' 8 | license=('zlib', 'MIT', 'LGPL2', 'custom') 9 | depends=( 10 | "${MINGW_PACKAGE_PREFIX}-libvorbis" 11 | "${MINGW_PACKAGE_PREFIX}-flac" 12 | "${MINGW_PACKAGE_PREFIX}-opusfile" 13 | ) 14 | makedepends=("${MINGW_PACKAGE_PREFIX}-cmake") 15 | options=('strip' 'staticlibs') 16 | source=("git+https://github.com/Clownacy/clownaudio.git") 17 | sha256sums=('SKIP') 18 | 19 | pkgver() { 20 | cd "${srcdir}/clownaudio" 21 | printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" 22 | } 23 | 24 | prepare() { 25 | mkdir -p "${srcdir}/clownaudio/build-static-${MINGW_CHOST}" 26 | mkdir -p "${srcdir}/clownaudio/build-shared-${MINGW_CHOST}" 27 | } 28 | 29 | build() { 30 | cd "${srcdir}/clownaudio/build-static-${MINGW_CHOST}" 31 | 32 | MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ 33 | ${MINGW_PREFIX}/bin/cmake .. \ 34 | -G"MSYS Makefiles" \ 35 | -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ 36 | -DBUILD_SHARED_LIBS=OFF \ 37 | -DCLOWNAUDIO_CPP=OFF \ 38 | -DCLOWNAUDIO_LIBVORBIS=ON \ 39 | -DCLOWNAUDIO_STB_VORBIS=OFF \ 40 | -DCLOWNAUDIO_DR_MP3=ON \ 41 | -DCLOWNAUDIO_LIBOPUS=ON \ 42 | -DCLOWNAUDIO_LIBFLAC=ON \ 43 | -DCLOWNAUDIO_DR_FLAC=OFF \ 44 | -DCLOWNAUDIO_DR_WAV=ON \ 45 | -DCLOWNAUDIO_LIBSNDFILE=OFF \ 46 | -DCLOWNAUDIO_LIBOPENMPT=OFF \ 47 | -DCLOWNAUDIO_LIBXMPLITE=ON \ 48 | -DCLOWNAUDIO_PXTONE=ON \ 49 | -DCLOWNAUDIO_SNES_SPC=ON \ 50 | -DCLOWNAUDIO_BACKEND=miniaudio \ 51 | -Wno-dev 52 | 53 | make 54 | 55 | cd "${srcdir}/clownaudio/build-shared-${MINGW_CHOST}" 56 | 57 | MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ 58 | ${MINGW_PREFIX}/bin/cmake .. \ 59 | -G"MSYS Makefiles" \ 60 | -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ 61 | -DBUILD_SHARED_LIBS=ON \ 62 | -DCLOWNAUDIO_CPP=OFF \ 63 | -DCLOWNAUDIO_LIBVORBIS=ON \ 64 | -DCLOWNAUDIO_STB_VORBIS=OFF \ 65 | -DCLOWNAUDIO_DR_MP3=ON \ 66 | -DCLOWNAUDIO_LIBOPUS=ON \ 67 | -DCLOWNAUDIO_LIBFLAC=ON \ 68 | -DCLOWNAUDIO_DR_FLAC=OFF \ 69 | -DCLOWNAUDIO_DR_WAV=ON \ 70 | -DCLOWNAUDIO_LIBSNDFILE=OFF \ 71 | -DCLOWNAUDIO_LIBOPENMPT=OFF \ 72 | -DCLOWNAUDIO_LIBXMPLITE=ON \ 73 | -DCLOWNAUDIO_PXTONE=ON \ 74 | -DCLOWNAUDIO_SNES_SPC=ON \ 75 | -DCLOWNAUDIO_BACKEND=miniaudio \ 76 | -Wno-dev 77 | 78 | make 79 | } 80 | 81 | package() { 82 | make -C "${srcdir}/clownaudio/build-static-${MINGW_CHOST}" DESTDIR="$pkgdir" install 83 | make -C "${srcdir}/clownaudio/build-shared-${MINGW_CHOST}" DESTDIR="$pkgdir" install 84 | } 85 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/mixer.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_MIXER_H 2 | #define LIBXMP_MIXER_H 3 | 4 | #define C4_PERIOD 428.0 5 | 6 | #define SMIX_NUMVOC 128 /* default number of softmixer voices */ 7 | #define SMIX_SHIFT 16 8 | #define SMIX_MASK 0xffff 9 | 10 | #define FILTER_SHIFT 16 11 | #define ANTICLICK_SHIFT 3 12 | 13 | #ifdef LIBXMP_PAULA_SIMULATOR 14 | #include "paula.h" 15 | #endif 16 | 17 | #define MIXER(f) void libxmp_mix_##f(struct mixer_voice *vi, int *buffer, \ 18 | int count, int vl, int vr, int step, int ramp, int delta_l, int delta_r) 19 | 20 | struct mixer_voice { 21 | int chn; /* channel number */ 22 | int root; /* */ 23 | int note; /* */ 24 | #define PAN_SURROUND 0x8000 25 | int pan; /* */ 26 | int vol; /* */ 27 | double period; /* current period */ 28 | double pos; /* position in sample */ 29 | int pos0; /* position in sample before mixing */ 30 | int fidx; /* mixer function index */ 31 | int ins; /* instrument number */ 32 | int smp; /* sample number */ 33 | int end; /* loop end */ 34 | int act; /* nna info & status of voice */ 35 | int old_vl; /* previous volume, left channel */ 36 | int old_vr; /* previous volume, right channel */ 37 | int sleft; /* last left sample output, in 32bit */ 38 | int sright; /* last right sample output, in 32bit */ 39 | #define VOICE_RELEASE (1 << 0) 40 | #define ANTICLICK (1 << 1) 41 | #define SAMPLE_LOOP (1 << 2) 42 | int flags; /* flags */ 43 | void *sptr; /* sample pointer */ 44 | #ifdef LIBXMP_PAULA_SIMULATOR 45 | struct paula_state *paula; /* paula simulation state */ 46 | #endif 47 | 48 | #ifndef LIBXMP_CORE_DISABLE_IT 49 | struct { 50 | int r1; /* filter variables */ 51 | int r2; 52 | int l1; 53 | int l2; 54 | int a0; 55 | int b0; 56 | int b1; 57 | int cutoff; 58 | int resonance; 59 | } filter; 60 | #endif 61 | }; 62 | 63 | int libxmp_mixer_on (struct context_data *, int, int, int); 64 | void libxmp_mixer_off (struct context_data *); 65 | void libxmp_mixer_setvol (struct context_data *, int, int); 66 | void libxmp_mixer_seteffect (struct context_data *, int, int, int); 67 | void libxmp_mixer_setpan (struct context_data *, int, int); 68 | int libxmp_mixer_numvoices (struct context_data *, int); 69 | void libxmp_mixer_softmixer (struct context_data *); 70 | void libxmp_mixer_reset (struct context_data *); 71 | void libxmp_mixer_setpatch (struct context_data *, int, int, int); 72 | void libxmp_mixer_voicepos (struct context_data *, int, double, int); 73 | double libxmp_mixer_getvoicepos(struct context_data *, int); 74 | void libxmp_mixer_setnote (struct context_data *, int, int); 75 | void libxmp_mixer_setperiod (struct context_data *, int, double); 76 | void libxmp_mixer_release (struct context_data *, int, int); 77 | 78 | #endif /* LIBXMP_MIXER_H */ 79 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/mixer.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_MIXER_H 2 | #define LIBXMP_MIXER_H 3 | 4 | #define C4_PERIOD 428.0 5 | 6 | #define SMIX_NUMVOC 128 /* default number of softmixer voices */ 7 | #define SMIX_SHIFT 16 8 | #define SMIX_MASK 0xffff 9 | 10 | #define FILTER_SHIFT 16 11 | #define ANTICLICK_SHIFT 3 12 | 13 | #ifdef LIBXMP_PAULA_SIMULATOR 14 | #include "paula.h" 15 | #endif 16 | 17 | #define MIXER(f) void libxmp_mix_##f(struct mixer_voice *vi, int *buffer, \ 18 | int count, int vl, int vr, int step, int ramp, int delta_l, int delta_r) 19 | 20 | struct mixer_voice { 21 | int chn; /* channel number */ 22 | int root; /* */ 23 | int note; /* */ 24 | #define PAN_SURROUND 0x8000 25 | int pan; /* */ 26 | int vol; /* */ 27 | double period; /* current period */ 28 | double pos; /* position in sample */ 29 | int pos0; /* position in sample before mixing */ 30 | int fidx; /* mixer function index */ 31 | int ins; /* instrument number */ 32 | int smp; /* sample number */ 33 | int end; /* loop end */ 34 | int act; /* nna info & status of voice */ 35 | int old_vl; /* previous volume, left channel */ 36 | int old_vr; /* previous volume, right channel */ 37 | int sleft; /* last left sample output, in 32bit */ 38 | int sright; /* last right sample output, in 32bit */ 39 | #define VOICE_RELEASE (1 << 0) 40 | #define ANTICLICK (1 << 1) 41 | #define SAMPLE_LOOP (1 << 2) 42 | int flags; /* flags */ 43 | void *sptr; /* sample pointer */ 44 | #ifdef LIBXMP_PAULA_SIMULATOR 45 | struct paula_state *paula; /* paula simulation state */ 46 | #endif 47 | 48 | #ifndef LIBXMP_CORE_DISABLE_IT 49 | struct { 50 | int r1; /* filter variables */ 51 | int r2; 52 | int l1; 53 | int l2; 54 | int a0; 55 | int b0; 56 | int b1; 57 | int cutoff; 58 | int resonance; 59 | } filter; 60 | #endif 61 | }; 62 | 63 | int libxmp_mixer_on (struct context_data *, int, int, int); 64 | void libxmp_mixer_off (struct context_data *); 65 | void libxmp_mixer_setvol (struct context_data *, int, int); 66 | void libxmp_mixer_seteffect (struct context_data *, int, int, int); 67 | void libxmp_mixer_setpan (struct context_data *, int, int); 68 | int libxmp_mixer_numvoices (struct context_data *, int); 69 | void libxmp_mixer_softmixer (struct context_data *); 70 | void libxmp_mixer_reset (struct context_data *); 71 | void libxmp_mixer_setpatch (struct context_data *, int, int, int); 72 | void libxmp_mixer_voicepos (struct context_data *, int, double, int); 73 | double libxmp_mixer_getvoicepos(struct context_data *, int); 74 | void libxmp_mixer_setnote (struct context_data *, int, int); 75 | void libxmp_mixer_setperiod (struct context_data *, int, double); 76 | void libxmp_mixer_release (struct context_data *, int, int); 77 | 78 | #endif /* LIBXMP_MIXER_H */ 79 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/xfd.c: -------------------------------------------------------------------------------- 1 | /* xfdmaster.library decruncher for XMP 2 | * Copyright (C) 2007 Chris Young 3 | * 4 | * This file is part of the Extended Module Player and is distributed 5 | * under the terms of the GNU Lesser General Public License. See COPYING.LIB 6 | * for more information. 7 | */ 8 | 9 | #include "../common.h" 10 | 11 | #if defined(LIBXMP_AMIGA) && defined(HAVE_PROTO_XFDMASTER_H) 12 | 13 | #define __USE_INLINE__ 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "depacker.h" 19 | 20 | static int _test_xfd(unsigned char *buffer, int length) 21 | { 22 | int ret = 0; 23 | struct xfdBufferInfo *xfdobj; 24 | 25 | xfdobj = (struct xfdBufferInfo *) xfdAllocObject(XFDOBJ_BUFFERINFO); 26 | if(xfdobj) 27 | { 28 | xfdobj->xfdbi_SourceBuffer = buffer; 29 | xfdobj->xfdbi_SourceBufLen = length; 30 | xfdobj->xfdbi_Flags = XFDFB_RECOGTARGETLEN | XFDFB_RECOGEXTERN; 31 | 32 | if(xfdRecogBuffer(xfdobj)) 33 | { 34 | ret = (xfdobj->xfdbi_PackerName != NULL); 35 | } 36 | xfdFreeObject((APTR)xfdobj); 37 | } 38 | return(ret); 39 | } 40 | 41 | static int test_xfd(unsigned char *b) 42 | { 43 | if (!xfdMasterBase) return 0; 44 | return _test_xfd(b, 1024); 45 | } 46 | 47 | static int decrunch_xfd(FILE *f1, FILE *f2) 48 | { 49 | struct xfdBufferInfo *xfdobj; 50 | uint8 *packed; 51 | int plen,ret=-1; 52 | struct stat st; 53 | 54 | if (xfdMasterBase == NULL) 55 | return -1; 56 | 57 | if (f2 == NULL) 58 | return -1; 59 | 60 | fstat(fileno(f1), &st); 61 | plen = st.st_size; 62 | 63 | packed = (uint8 *) AllocVec(plen,MEMF_CLEAR); 64 | if (!packed) return -1; 65 | 66 | fread(packed,plen,1,f1); 67 | 68 | xfdobj = (struct xfdBufferInfo *) xfdAllocObject(XFDOBJ_BUFFERINFO); 69 | if(xfdobj) 70 | { 71 | xfdobj->xfdbi_SourceBufLen = plen; 72 | xfdobj->xfdbi_SourceBuffer = packed; 73 | xfdobj->xfdbi_Flags = XFDFF_RECOGEXTERN | XFDFF_RECOGTARGETLEN; 74 | /* xfdobj->xfdbi_PackerFlags = XFDPFF_RECOGLEN; */ 75 | if(xfdRecogBuffer(xfdobj)) 76 | { 77 | xfdobj->xfdbi_TargetBufMemType = MEMF_ANY; 78 | if(xfdDecrunchBuffer(xfdobj)) 79 | { 80 | if(fwrite(xfdobj->xfdbi_TargetBuffer,1,xfdobj->xfdbi_TargetBufSaveLen,f2) == xfdobj->xfdbi_TargetBufSaveLen) ret=0; 81 | FreeMem(xfdobj->xfdbi_TargetBuffer,xfdobj->xfdbi_TargetBufLen); 82 | } 83 | else 84 | { 85 | ret=-1; 86 | } 87 | } 88 | xfdFreeObject((APTR)xfdobj); 89 | } 90 | FreeVec(packed); 91 | return(ret); 92 | } 93 | 94 | struct depacker libxmp_depacker_xfd = { 95 | test_xfd, 96 | decrunch_xfd 97 | }; 98 | 99 | #endif /* AMIGA */ 100 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/gunzip.c: -------------------------------------------------------------------------------- 1 | /* Extended Module Player 2 | * Copyright (C) 1996-2021 Claudio Matsuoka and Hipolito Carraro Jr 3 | * 4 | * This file is part of the Extended Module Player and is distributed 5 | * under the terms of the GNU Lesser General Public License. See COPYING.LIB 6 | * for more information. 7 | */ 8 | 9 | #include "../common.h" 10 | #include "inflate.h" 11 | #include "depacker.h" 12 | #include "crc32.h" 13 | 14 | /* See RFC1952 for further information */ 15 | 16 | /* The flag byte is divided into individual bits as follows: 17 | 18 | bit 0 FTEXT 19 | bit 1 FHCRC 20 | bit 2 FEXTRA 21 | bit 3 FNAME 22 | bit 4 FCOMMENT 23 | bit 5 reserved 24 | bit 6 reserved 25 | bit 7 reserved 26 | */ 27 | 28 | #define FLAG_FTEXT (1 << 0) 29 | #define FLAG_FHCRC (1 << 1) 30 | #define FLAG_FEXTRA (1 << 2) 31 | #define FLAG_FNAME (1 << 3) 32 | #define FLAG_FCOMMENT (1 << 4) 33 | 34 | struct member { 35 | uint8 id1; 36 | uint8 id2; 37 | uint8 cm; 38 | uint8 flg; 39 | uint32 mtime; 40 | uint8 xfl; 41 | uint8 os; 42 | }; 43 | 44 | static int test_gzip(unsigned char *b) 45 | { 46 | return b[0] == 31 && b[1] == 139; 47 | } 48 | 49 | static int decrunch_gzip(FILE *in, FILE *out) 50 | { 51 | struct member member; 52 | int val, c, err; 53 | uint32 crc; 54 | 55 | libxmp_crc32_init_A(); 56 | 57 | member.id1 = read8(in, NULL); 58 | member.id2 = read8(in, NULL); 59 | member.cm = read8(in, NULL); 60 | member.flg = read8(in, NULL); 61 | member.mtime = read32l(in, NULL); 62 | member.xfl = read8(in, NULL); 63 | member.os = read8(in, NULL); 64 | 65 | if (member.cm != 0x08) { 66 | return -1; 67 | } 68 | 69 | if (member.flg & FLAG_FEXTRA) { 70 | int xlen = read16l(in, NULL); 71 | if (fseek(in, xlen, SEEK_CUR) < 0) { 72 | return -1; 73 | } 74 | } 75 | 76 | if (member.flg & FLAG_FNAME) { 77 | do { 78 | c = read8(in, &err); 79 | if (err) { 80 | return -1; 81 | } 82 | } while (c != 0); 83 | } 84 | 85 | if (member.flg & FLAG_FCOMMENT) { 86 | do { 87 | c = read8(in, &err); 88 | if (err) { 89 | return -1; 90 | } 91 | } while (c != 0); 92 | } 93 | 94 | if (member.flg & FLAG_FHCRC) { 95 | read16l(in, NULL); 96 | } 97 | 98 | val = libxmp_inflate(in, out, &crc, 1); 99 | if (val != 0) { 100 | return -1; 101 | } 102 | 103 | /* Check CRC32 */ 104 | val = read32l(in, NULL); 105 | if (val != crc) { 106 | return -1; 107 | } 108 | 109 | /* Check file size */ 110 | val = read32l(in, NULL); 111 | if (val != ftell(out)) { 112 | return -1; 113 | } 114 | 115 | return 0; 116 | } 117 | 118 | struct depacker libxmp_depacker_gzip = { 119 | test_gzip, 120 | decrunch_gzip 121 | }; 122 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/snes_spc/dsp.cpp: -------------------------------------------------------------------------------- 1 | // snes_spc 0.9.0. http://www.slack.net/~ant/ 2 | 3 | #include "dsp.h" 4 | 5 | #include "SPC_DSP.h" 6 | 7 | /* Copyright (C) 2007 Shay Green. This module is free software; you 8 | can redistribute it and/or modify it under the terms of the GNU Lesser 9 | General Public License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. This 11 | module is distributed in the hope that it will be useful, but WITHOUT ANY 12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 14 | details. You should have received a copy of the GNU Lesser General Public 15 | License along with this module; if not, write to the Free Software Foundation, 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ 17 | 18 | #include "blargg_source.h" 19 | 20 | SPC_DSP* spc_dsp_new( void ) 21 | { 22 | // be sure constants match 23 | assert( spc_dsp_voice_count == (int) SPC_DSP::voice_count ); 24 | assert( spc_dsp_register_count == (int) SPC_DSP::register_count ); 25 | #if !SPC_NO_COPY_STATE_FUNCS 26 | assert( spc_dsp_state_size == (int) SPC_DSP::state_size ); 27 | #endif 28 | 29 | return new SPC_DSP; 30 | } 31 | 32 | void spc_dsp_delete ( SPC_DSP* s ) { delete s; } 33 | void spc_dsp_init ( SPC_DSP* s, void* ram_64k ) { s->init( ram_64k ); } 34 | void spc_dsp_set_output ( SPC_DSP* s, spc_dsp_sample_t* p, int n ) { s->set_output( p, n ); } 35 | int spc_dsp_sample_count( SPC_DSP const* s ) { return s->sample_count(); } 36 | void spc_dsp_reset ( SPC_DSP* s ) { s->reset(); } 37 | void spc_dsp_soft_reset ( SPC_DSP* s ) { s->soft_reset(); } 38 | int spc_dsp_read ( SPC_DSP const* s, int addr ) { return s->read( addr ); } 39 | void spc_dsp_write ( SPC_DSP* s, int addr, int data ) { s->write( addr, data ); } 40 | void spc_dsp_run ( SPC_DSP* s, int clock_count ) { s->run( clock_count ); } 41 | void spc_dsp_mute_voices ( SPC_DSP* s, int mask ) { s->mute_voices( mask ); } 42 | void spc_dsp_disable_surround( SPC_DSP* s, int disable ) { s->disable_surround( disable ); } 43 | void spc_dsp_load ( SPC_DSP* s, unsigned char const regs [spc_dsp_register_count] ) { s->load( regs ); } 44 | 45 | #if !SPC_NO_COPY_STATE_FUNCS 46 | void spc_dsp_copy_state ( SPC_DSP* s, unsigned char** p, spc_dsp_copy_func_t f ) { s->copy_state( p, f ); } 47 | int spc_dsp_check_kon ( SPC_DSP* s ) { return s->check_kon(); } 48 | #endif 49 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/depackers/xfnmatch.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: fnmatch.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */ 2 | /* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */ 3 | 4 | #ifdef HAVE_FNMATCH 5 | #include 6 | #else 7 | 8 | /*- 9 | * Copyright (c) 1992, 1993 10 | * The Regents of the University of California. All rights reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 3. Neither the name of the University nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | * SUCH DAMAGE. 35 | * 36 | * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 37 | */ 38 | 39 | #ifndef _FNMATCH_H_ 40 | #define _FNMATCH_H_ 41 | 42 | #define FNM_NOMATCH 1 /* Match failed. */ 43 | #define FNM_NOSYS 2 /* Function not supported (unused). */ 44 | 45 | #define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ 46 | #define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ 47 | #define FNM_PERIOD 0x04 /* Period must be matched by period. */ 48 | #define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ 49 | #define FNM_CASEFOLD 0x10 /* Case insensitive search. */ 50 | #define FNM_IGNORECASE FNM_CASEFOLD 51 | #define FNM_FILE_NAME FNM_PATHNAME 52 | 53 | #if defined(__cplusplus) 54 | extern "C" { 55 | #endif 56 | 57 | int fnmatch(const char *, const char *, int); 58 | 59 | #if defined(__cplusplus) 60 | } 61 | #endif 62 | 63 | #endif /* !_FNMATCH_H_ */ 64 | 65 | #endif /* HAVE_FNMATCH */ 66 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/pxtone/pxtnUnit.h: -------------------------------------------------------------------------------- 1 | // '12/03/03 2 | 3 | #ifndef pxtnUnit_H 4 | #define pxtnUnit_H 5 | 6 | #include "./pxtn.h" 7 | 8 | #include "./pxtnDescriptor.h" 9 | #include "./pxtnMax.h" 10 | #include "./pxtnWoice.h" 11 | 12 | class pxtnUnit 13 | { 14 | private: 15 | void operator = (const pxtnUnit& src); 16 | pxtnUnit (const pxtnUnit& src); 17 | 18 | bool _bOperated; 19 | bool _bPlayed; 20 | char _name_buf[ pxtnMAX_TUNEUNITNAME + 1 ]; 21 | int32_t _name_size; 22 | 23 | // TUNEUNITTONESTRUCT 24 | int32_t _key_now; 25 | int32_t _key_start; 26 | int32_t _key_margin; 27 | int32_t _portament_sample_pos; 28 | int32_t _portament_sample_num; 29 | int32_t _pan_vols [ pxtnMAX_CHANNEL ]; 30 | int32_t _pan_times [ pxtnMAX_CHANNEL ]; 31 | int32_t _pan_time_bufs[ pxtnMAX_CHANNEL ][ pxtnBUFSIZE_TIMEPAN ]; 32 | int32_t _v_VOLUME ; 33 | int32_t _v_VELOCITY; 34 | int32_t _v_GROUPNO ; 35 | float _v_TUNING ; 36 | 37 | const pxtnWoice *_p_woice; 38 | 39 | pxtnVOICETONE _vts[ pxtnMAX_UNITCONTROLVOICE ]; 40 | 41 | public : 42 | pxtnUnit(); 43 | ~pxtnUnit(); 44 | 45 | void Tone_Init (); 46 | 47 | void Tone_Clear(); 48 | 49 | void Tone_Reset_and_2prm( int32_t voice_idx, int32_t env_rls_clock, float offset_freq ); 50 | void Tone_Envelope (); 51 | void Tone_KeyOn (); 52 | void Tone_ZeroLives (); 53 | void Tone_Key ( int32_t key ); 54 | void Tone_Pan_Volume( int32_t ch, int32_t pan ); 55 | void Tone_Pan_Time ( int32_t ch, int32_t pan, int32_t sps ); 56 | 57 | void Tone_Velocity ( int32_t val ); 58 | void Tone_Volume ( int32_t val ); 59 | void Tone_Portament ( int32_t val ); 60 | void Tone_GroupNo ( int32_t val ); 61 | void Tone_Tuning ( float val ); 62 | 63 | void Tone_Sample ( bool b_mute_by_unit, int32_t ch_num, int32_t time_pan_index, int32_t smooth_smp ); 64 | void Tone_Supple ( int32_t *group_smps, int32_t ch_num, int32_t time_pan_index ) const; 65 | int32_t Tone_Increment_Key (); 66 | void Tone_Increment_Sample( float freq ); 67 | 68 | bool set_woice( const pxtnWoice *p_woice ); 69 | const pxtnWoice* get_woice() const; 70 | 71 | bool set_name_buf( const char *name_buf, int32_t buf_size ); 72 | const char* get_name_buf( int32_t* p_buf_size ) const; 73 | bool is_name_buf () const; 74 | 75 | pxtnVOICETONE *get_tone( int32_t voice_idx ); 76 | 77 | void set_operated( bool b ); 78 | void set_played ( bool b ); 79 | bool get_operated() const; 80 | bool get_played () const; 81 | 82 | pxtnERR Read_v3x( pxtnDescriptor *p_doc, int32_t *p_group ); 83 | bool Read_v1x( pxtnDescriptor *p_doc, int32_t *p_group ); 84 | }; 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/loaders/prowizard/fc-m.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FC-M_Packer.c Copyright (C) 1997 Asle / ReDoX 3 | * 4 | * Converts back to ptk FC-M packed MODs 5 | * 6 | * Modified in 2006,2007,2014 by Claudio Matsuoka 7 | */ 8 | 9 | #include "prowiz.h" 10 | 11 | 12 | static int depack_fcm(HIO_HANDLE *in, FILE *out) 13 | { 14 | uint8 c1; 15 | uint8 ptable[128]; 16 | uint8 pat_pos; 17 | uint8 pat_max; 18 | int i; 19 | int size, ssize = 0; 20 | 21 | memset(ptable, 0, sizeof(ptable)); 22 | 23 | hio_read32b(in); /* bypass "FC-M" ID */ 24 | hio_read16b(in); /* version number? */ 25 | hio_read32b(in); /* bypass "NAME" chunk */ 26 | pw_move_data(out, in, 20); /* read and write title */ 27 | hio_read32b(in); /* bypass "INST" chunk */ 28 | 29 | /* read and write sample descriptions */ 30 | for (i = 0; i < 31; i++) { 31 | pw_write_zero(out, 22); /*sample name */ 32 | write16b(out, size = hio_read16b(in)); /* size */ 33 | ssize += size * 2; 34 | write8(out, hio_read8(in)); /* finetune */ 35 | write8(out, hio_read8(in)); /* volume */ 36 | write16b(out, hio_read16b(in)); /* loop start */ 37 | size = hio_read16b(in); /* loop size */ 38 | if (size == 0) 39 | size = 1; 40 | write16b(out, size); 41 | } 42 | 43 | hio_read32b(in); /* bypass "LONG" chunk */ 44 | write8(out, pat_pos = hio_read8(in)); /* pattern table lenght */ 45 | write8(out, hio_read8(in)); /* NoiseTracker byte */ 46 | hio_read32b(in); /* bypass "PATT" chunk */ 47 | 48 | /* read and write pattern list and get highest patt number */ 49 | for (pat_max = i = 0; i < pat_pos; i++) { 50 | write8(out, c1 = hio_read8(in)); 51 | if (c1 > pat_max) 52 | pat_max = c1; 53 | } 54 | for (; i < 128; i++) 55 | write8(out, 0); 56 | 57 | write32b(out, PW_MOD_MAGIC); /* write ptk ID */ 58 | hio_read32b(in); /* bypass "SONG" chunk */ 59 | 60 | for (i = 0; i <= pat_max; i++) /* pattern data */ 61 | pw_move_data(out, in, 1024); 62 | 63 | hio_read32b(in); /* bypass "SAMP" chunk */ 64 | pw_move_data(out, in, ssize); /* sample data */ 65 | 66 | return 0; 67 | } 68 | 69 | static int test_fcm(const uint8 *data, char *t, int s) 70 | { 71 | int j; 72 | 73 | PW_REQUEST_DATA(s, 37 + 8 * 31); 74 | 75 | /* "FC-M" : ID of FC-M packer */ 76 | if (data[0] != 'F' || data[1] != 'C' || data[2] != '-' || 77 | data[3] != 'M') 78 | return -1; 79 | 80 | /* test 1 */ 81 | if (data[4] != 0x01) 82 | return -1; 83 | 84 | /* test 2 */ 85 | if (data[5] != 0x00) 86 | return -1; 87 | 88 | /* test 3 */ 89 | for (j = 0; j < 31; j++) { 90 | if (data[37 + 8 * j] > 0x40) 91 | return -1; 92 | } 93 | 94 | pw_read_title(data + 10, t, 20); 95 | return 0; 96 | } 97 | 98 | const struct pw_format pw_fcm = { 99 | "FC-M Packer", 100 | test_fcm, 101 | depack_fcm 102 | }; 103 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp/src/mdataio.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_MDATAIO_H 2 | #define LIBXMP_MDATAIO_H 3 | 4 | #include 5 | #include 6 | #include "common.h" 7 | 8 | static inline ptrdiff_t CAN_READ(MFILE *m) 9 | { 10 | if (m->size >= 0) 11 | return m->pos >= 0 ? m->size - m->pos : 0; 12 | 13 | return INT_MAX; 14 | } 15 | 16 | static inline uint8 mread8(MFILE *m, int *err) 17 | { 18 | uint8 x = 0xff; 19 | size_t r = mread(&x, 1, 1, m); 20 | if (err) { 21 | *err = (r == 1) ? 0 : EOF; 22 | } 23 | return x; 24 | } 25 | 26 | static inline int8 mread8s(MFILE *m, int *err) 27 | { 28 | int r = mgetc(m); 29 | if (err) { 30 | *err = (r < 0) ? EOF : 0; 31 | } 32 | return (int8)r; 33 | } 34 | 35 | static inline uint16 mread16l(MFILE *m, int *err) 36 | { 37 | ptrdiff_t can_read = CAN_READ(m); 38 | if (can_read >= 2) { 39 | uint16 n = readmem16l(m->start + m->pos); 40 | m->pos += 2; 41 | if(err) *err = 0; 42 | return n; 43 | } else { 44 | m->pos += can_read; 45 | if(err) *err = EOF; 46 | return EOF; 47 | } 48 | } 49 | 50 | static inline uint16 mread16b(MFILE *m, int *err) 51 | { 52 | ptrdiff_t can_read = CAN_READ(m); 53 | if (can_read >= 2) { 54 | uint16 n = readmem16b(m->start + m->pos); 55 | m->pos += 2; 56 | if(err) *err = 0; 57 | return n; 58 | } else { 59 | m->pos += can_read; 60 | if(err) *err = EOF; 61 | return EOF; 62 | } 63 | } 64 | 65 | static inline uint32 mread24l(MFILE *m, int *err) 66 | { 67 | ptrdiff_t can_read = CAN_READ(m); 68 | if (can_read >= 3) { 69 | uint32 n = readmem24l(m->start + m->pos); 70 | m->pos += 3; 71 | if(err) *err = 0; 72 | return n; 73 | } else { 74 | m->pos += can_read; 75 | if(err) *err = EOF; 76 | return EOF; 77 | } 78 | } 79 | 80 | static inline uint32 mread24b(MFILE *m, int *err) 81 | { 82 | ptrdiff_t can_read = CAN_READ(m); 83 | if (can_read >= 3) { 84 | uint32 n = readmem24b(m->start + m->pos); 85 | m->pos += 3; 86 | if(err) *err = 0; 87 | return n; 88 | } else { 89 | m->pos += can_read; 90 | if(err) *err = EOF; 91 | return EOF; 92 | } 93 | } 94 | 95 | static inline uint32 mread32l(MFILE *m, int *err) 96 | { 97 | ptrdiff_t can_read = CAN_READ(m); 98 | if (can_read >= 4) { 99 | uint32 n = readmem32l(m->start + m->pos); 100 | m->pos += 4; 101 | if(err) *err = 0; 102 | return n; 103 | } else { 104 | m->pos += can_read; 105 | if(err) *err = EOF; 106 | return EOF; 107 | } 108 | } 109 | 110 | static inline uint32 mread32b(MFILE *m, int *err) 111 | { 112 | ptrdiff_t can_read = CAN_READ(m); 113 | if (can_read >= 4) { 114 | uint32 n = readmem32b(m->start + m->pos); 115 | m->pos += 4; 116 | if(err) *err = 0; 117 | return n; 118 | } else { 119 | m->pos += can_read; 120 | if(err) *err = EOF; 121 | return EOF; 122 | } 123 | } 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/snes_spc-0.9.0/snes_spc/dsp.h: -------------------------------------------------------------------------------- 1 | /* SNES SPC-700 DSP emulator C interface (also usable from C++) */ 2 | 3 | /* snes_spc 0.9.0 */ 4 | #ifndef DSP_H 5 | #define DSP_H 6 | 7 | #include 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | typedef struct SPC_DSP SPC_DSP; 14 | 15 | /* Creates new DSP emulator. NULL if out of memory. */ 16 | SPC_DSP* spc_dsp_new( void ); 17 | 18 | /* Frees DSP emulator */ 19 | void spc_dsp_delete( SPC_DSP* ); 20 | 21 | /* Initializes DSP and has it use the 64K RAM provided */ 22 | void spc_dsp_init( SPC_DSP*, void* ram_64k ); 23 | 24 | /* Sets destination for output samples. If out is NULL or out_size is 0, 25 | doesn't generate any. */ 26 | typedef short spc_dsp_sample_t; 27 | void spc_dsp_set_output( SPC_DSP*, spc_dsp_sample_t* out, int out_size ); 28 | 29 | /* Number of samples written to output since it was last set, always 30 | a multiple of 2. Undefined if more samples were generated than 31 | output buffer could hold. */ 32 | int spc_dsp_sample_count( SPC_DSP const* ); 33 | 34 | 35 | /**** Emulation *****/ 36 | 37 | /* Resets DSP to power-on state */ 38 | void spc_dsp_reset( SPC_DSP* ); 39 | 40 | /* Emulates pressing reset switch on SNES */ 41 | void spc_dsp_soft_reset( SPC_DSP* ); 42 | 43 | /* Reads/writes DSP registers. For accuracy, you must first call spc_dsp_run() */ 44 | /* to catch the DSP up to present. */ 45 | int spc_dsp_read ( SPC_DSP const*, int addr ); 46 | void spc_dsp_write( SPC_DSP*, int addr, int data ); 47 | 48 | /* Runs DSP for specified number of clocks (~1024000 per second). Every 32 clocks */ 49 | /* a pair of samples is be generated. */ 50 | void spc_dsp_run( SPC_DSP*, int clock_count ); 51 | 52 | 53 | /**** Sound control *****/ 54 | 55 | /* Mutes voices corresponding to non-zero bits in mask. Reduces emulation accuracy. */ 56 | enum { spc_dsp_voice_count = 8 }; 57 | void spc_dsp_mute_voices( SPC_DSP*, int mask ); 58 | 59 | /* If true, prevents channels and global volumes from being phase-negated. 60 | Only supported by fast DSP; has no effect on accurate DSP. */ 61 | void spc_dsp_disable_surround( SPC_DSP*, int disable ); 62 | 63 | 64 | /**** State save/load *****/ 65 | 66 | /* Resets DSP and uses supplied values to initialize registers */ 67 | enum { spc_dsp_register_count = 128 }; 68 | void spc_dsp_load( SPC_DSP*, unsigned char const regs [spc_dsp_register_count] ); 69 | 70 | /* Saves/loads exact emulator state (accurate DSP only) */ 71 | enum { spc_dsp_state_size = 640 }; /* maximum space needed when saving */ 72 | typedef void (*spc_dsp_copy_func_t)( unsigned char** io, void* state, size_t ); 73 | void spc_dsp_copy_state( SPC_DSP*, unsigned char** io, spc_dsp_copy_func_t ); 74 | 75 | /* Returns non-zero if new key-on events occurred since last call (accurate DSP only) */ 76 | int spc_dsp_check_kon( SPC_DSP* ); 77 | 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/src/mdataio.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBXMP_MDATAIO_H 2 | #define LIBXMP_MDATAIO_H 3 | 4 | #include 5 | #include 6 | #include "common.h" 7 | 8 | static inline ptrdiff_t CAN_READ(MFILE *m) 9 | { 10 | if (m->size >= 0) 11 | return m->pos >= 0 ? m->size - m->pos : 0; 12 | 13 | return INT_MAX; 14 | } 15 | 16 | static inline uint8 mread8(MFILE *m, int *err) 17 | { 18 | uint8 x = 0xff; 19 | size_t r = mread(&x, 1, 1, m); 20 | if (err) { 21 | *err = (r == 1) ? 0 : EOF; 22 | } 23 | return x; 24 | } 25 | 26 | static inline int8 mread8s(MFILE *m, int *err) 27 | { 28 | int r = mgetc(m); 29 | if (err) { 30 | *err = (r < 0) ? EOF : 0; 31 | } 32 | return (int8)r; 33 | } 34 | 35 | static inline uint16 mread16l(MFILE *m, int *err) 36 | { 37 | ptrdiff_t can_read = CAN_READ(m); 38 | if (can_read >= 2) { 39 | uint16 n = readmem16l(m->start + m->pos); 40 | m->pos += 2; 41 | if(err) *err = 0; 42 | return n; 43 | } else { 44 | m->pos += can_read; 45 | if(err) *err = EOF; 46 | return EOF; 47 | } 48 | } 49 | 50 | static inline uint16 mread16b(MFILE *m, int *err) 51 | { 52 | ptrdiff_t can_read = CAN_READ(m); 53 | if (can_read >= 2) { 54 | uint16 n = readmem16b(m->start + m->pos); 55 | m->pos += 2; 56 | if(err) *err = 0; 57 | return n; 58 | } else { 59 | m->pos += can_read; 60 | if(err) *err = EOF; 61 | return EOF; 62 | } 63 | } 64 | 65 | static inline uint32 mread24l(MFILE *m, int *err) 66 | { 67 | ptrdiff_t can_read = CAN_READ(m); 68 | if (can_read >= 3) { 69 | uint32 n = readmem24l(m->start + m->pos); 70 | m->pos += 3; 71 | if(err) *err = 0; 72 | return n; 73 | } else { 74 | m->pos += can_read; 75 | if(err) *err = EOF; 76 | return EOF; 77 | } 78 | } 79 | 80 | static inline uint32 mread24b(MFILE *m, int *err) 81 | { 82 | ptrdiff_t can_read = CAN_READ(m); 83 | if (can_read >= 3) { 84 | uint32 n = readmem24b(m->start + m->pos); 85 | m->pos += 3; 86 | if(err) *err = 0; 87 | return n; 88 | } else { 89 | m->pos += can_read; 90 | if(err) *err = EOF; 91 | return EOF; 92 | } 93 | } 94 | 95 | static inline uint32 mread32l(MFILE *m, int *err) 96 | { 97 | ptrdiff_t can_read = CAN_READ(m); 98 | if (can_read >= 4) { 99 | uint32 n = readmem32l(m->start + m->pos); 100 | m->pos += 4; 101 | if(err) *err = 0; 102 | return n; 103 | } else { 104 | m->pos += can_read; 105 | if(err) *err = EOF; 106 | return EOF; 107 | } 108 | } 109 | 110 | static inline uint32 mread32b(MFILE *m, int *err) 111 | { 112 | ptrdiff_t can_read = CAN_READ(m); 113 | if (can_read >= 4) { 114 | uint32 n = readmem32b(m->start + m->pos); 115 | m->pos += 4; 116 | if(err) *err = 0; 117 | return n; 118 | } else { 119 | m->pos += can_read; 120 | if(err) *err = EOF; 121 | return EOF; 122 | } 123 | } 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /src/decoding/decoders/libs/libxmp-lite/test/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "../src/md5.h" 5 | #include "xmp.h" 6 | 7 | #ifdef LIBXMP_NO_DEPACKERS 8 | #define TEST_IT_FILE "test.it" 9 | #else 10 | #define TEST_IT_FILE "test.itz" 11 | #endif 12 | 13 | static inline int is_big_endian() { 14 | unsigned short w = 0x00ff; 15 | return (*(char *)&w == 0x00); 16 | } 17 | 18 | /* Convert little-endian 16 bit samples to big-endian */ 19 | static void convert_endian(unsigned char *p, int l) 20 | { 21 | unsigned char b; 22 | int i; 23 | 24 | for (i = 0; i < l; i++) { 25 | b = p[0]; 26 | p[0] = p[1]; 27 | p[1] = b; 28 | p += 2; 29 | } 30 | } 31 | 32 | static int compare_md5(unsigned char *d, char *digest) 33 | { 34 | int i; 35 | 36 | /*for (i = 0; i < 16 ; i++) 37 | printf("%02x", d[i]); 38 | printf("\n");*/ 39 | 40 | for (i = 0; i < 16 && *digest; i++, digest += 2) { 41 | char hex[3]; 42 | hex[0] = digest[0]; 43 | hex[1] = digest[1]; 44 | hex[2] = 0; 45 | 46 | if (d[i] != strtoul(hex, NULL, 16)) 47 | return -1; 48 | } 49 | 50 | return 0; 51 | } 52 | 53 | int main() 54 | { 55 | int ret; 56 | xmp_context c; 57 | struct xmp_frame_info info; 58 | long time; 59 | unsigned char digest[16]; 60 | MD5_CTX ctx; 61 | 62 | c = xmp_create_context(); 63 | if (c == NULL) 64 | goto err; 65 | 66 | ret = xmp_load_module(c, TEST_IT_FILE); 67 | if (ret != 0) { 68 | printf("can't load module\n"); 69 | goto err; 70 | } 71 | 72 | xmp_get_frame_info(c, &info); 73 | if (info.total_time != 4800) { 74 | printf("estimated replay time error\n"); 75 | goto err; 76 | } 77 | 78 | xmp_start_player(c, 22050, 0); 79 | xmp_set_player(c, XMP_PLAYER_MIX, 100); 80 | xmp_set_player(c, XMP_PLAYER_INTERP, XMP_INTERP_SPLINE); 81 | 82 | printf("Testing "); 83 | fflush(stdout); 84 | time = 0; 85 | 86 | MD5Init(&ctx); 87 | 88 | while (1) { 89 | xmp_play_frame(c); 90 | xmp_get_frame_info(c, &info); 91 | if (info.loop_count > 0) 92 | break; 93 | 94 | time += info.frame_time; 95 | 96 | if (is_big_endian()) 97 | convert_endian(info.buffer, info.buffer_size >> 1); 98 | 99 | MD5Update(&ctx, info.buffer, info.buffer_size); 100 | 101 | printf("."); 102 | fflush(stdout); 103 | } 104 | 105 | MD5Final(digest, &ctx); 106 | 107 | if (compare_md5(digest, "769a03855bac202597a581a8628424d5") < 0) { 108 | printf("rendering error\n"); 109 | goto err; 110 | } 111 | 112 | if (time / 1000 != info.total_time) { 113 | printf("replay time error\n"); 114 | goto err; 115 | } 116 | 117 | printf(" pass\n"); 118 | 119 | xmp_release_module(c); 120 | xmp_free_context(c); 121 | exit(0); 122 | 123 | err: 124 | printf(" fail\n"); 125 | if (c) { 126 | xmp_release_module(c); 127 | xmp_free_context(c); 128 | } 129 | exit(1); 130 | } 131 | --------------------------------------------------------------------------------