mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 17:19:33 +02:00
* mad,modplug,dts
git-svn-id: trunk@9968 -
This commit is contained in:
parent
730418b99d
commit
26ce512061
12
.gitattributes
vendored
12
.gitattributes
vendored
@ -873,6 +873,10 @@ packages/dbus/src/dbus-threads.inc svneol=native#text/plain
|
||||
packages/dbus/src/dbus-types.inc svneol=native#text/plain
|
||||
packages/dbus/src/dbus.pas svneol=native#text/plain
|
||||
packages/dbus/src/dbus_arch_deps.inc svneol=native#text/plain
|
||||
packages/dts/Makefile svneol=native#text/plain
|
||||
packages/dts/Makefile.fpc svneol=native#text/plain
|
||||
packages/dts/fpmake.pp svneol=native#text/plain
|
||||
packages/dts/src/dts.pas svneol=native#text/plain
|
||||
packages/extra/Makefile svneol=native#text/plain
|
||||
packages/extra/Makefile.fpc svneol=native#text/plain
|
||||
packages/extra/a52/Makefile svneol=native#text/plain
|
||||
@ -4132,6 +4136,14 @@ packages/libpng/Makefile svneol=native#text/plain
|
||||
packages/libpng/Makefile.fpc svneol=native#text/plain
|
||||
packages/libpng/fpmake.pp svneol=native#text/plain
|
||||
packages/libpng/src/png.pp svneol=native#text/plain
|
||||
packages/mad/Makefile svneol=native#text/plain
|
||||
packages/mad/Makefile.fpc svneol=native#text/plain
|
||||
packages/mad/fpmake.pp svneol=native#text/plain
|
||||
packages/mad/src/mad.pas svneol=native#text/plain
|
||||
packages/modplug/Makefile svneol=native#text/plain
|
||||
packages/modplug/Makefile.fpc svneol=native#text/plain
|
||||
packages/modplug/fpmake.pp svneol=native#text/plain
|
||||
packages/modplug/src/modplug.pas svneol=native#text/plain
|
||||
packages/mysql/Makefile svneol=native#text/plain
|
||||
packages/mysql/Makefile.fpc svneol=native#text/plain
|
||||
packages/mysql/README svneol=native#text/plain
|
||||
|
@ -241,13 +241,13 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
|
||||
endif
|
||||
PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
|
||||
ifeq ($(FULL_TARGET),i386-linux)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap libc unixutil
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad libc unixutil
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-go32v2)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-win32)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr winunits-base winunits-jedi fcl-web ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr winunits-base winunits-jedi fcl-web ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng mad
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-os2)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr zlib libpng x11
|
||||
@ -298,7 +298,7 @@ ifeq ($(FULL_TARGET),i386-symbian)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-linux)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-freebsd)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
|
||||
@ -322,7 +322,7 @@ ifeq ($(FULL_TARGET),m68k-embedded)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-linux)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
|
||||
@ -343,7 +343,7 @@ ifeq ($(FULL_TARGET),powerpc-embedded)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),sparc-linux)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),sparc-netbsd)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
|
||||
@ -355,7 +355,7 @@ ifeq ($(FULL_TARGET),sparc-embedded)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),x86_64-linux)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
|
||||
@ -370,7 +370,7 @@ ifeq ($(FULL_TARGET),x86_64-embedded)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),arm-linux)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),arm-palmos)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
|
||||
@ -391,7 +391,7 @@ ifeq ($(FULL_TARGET),arm-symbian)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
||||
override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
|
||||
@ -1517,6 +1517,9 @@ TARGET_DIRS_LIBPNG=1
|
||||
TARGET_DIRS_X11=1
|
||||
TARGET_DIRS_UUID=1
|
||||
TARGET_DIRS_LDAP=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_LIBC=1
|
||||
TARGET_DIRS_UNIXUTIL=1
|
||||
endif
|
||||
@ -1574,6 +1577,7 @@ TARGET_DIRS_SQLITE=1
|
||||
TARGET_DIRS_IMAGEMAGICK=1
|
||||
TARGET_DIRS_GDBINT=1
|
||||
TARGET_DIRS_LIBPNG=1
|
||||
TARGET_DIRS_MAD=1
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-os2)
|
||||
TARGET_DIRS_BASE=1
|
||||
@ -2036,6 +2040,9 @@ TARGET_DIRS_LIBPNG=1
|
||||
TARGET_DIRS_X11=1
|
||||
TARGET_DIRS_UUID=1
|
||||
TARGET_DIRS_LDAP=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_MAD=1
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-freebsd)
|
||||
TARGET_DIRS_BASE=1
|
||||
@ -2268,6 +2275,9 @@ TARGET_DIRS_LIBPNG=1
|
||||
TARGET_DIRS_X11=1
|
||||
TARGET_DIRS_UUID=1
|
||||
TARGET_DIRS_LDAP=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_MAD=1
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
||||
TARGET_DIRS_BASE=1
|
||||
@ -2464,6 +2474,9 @@ TARGET_DIRS_LIBPNG=1
|
||||
TARGET_DIRS_X11=1
|
||||
TARGET_DIRS_UUID=1
|
||||
TARGET_DIRS_LDAP=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_MAD=1
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),sparc-netbsd)
|
||||
TARGET_DIRS_BASE=1
|
||||
@ -2597,6 +2610,9 @@ TARGET_DIRS_LIBPNG=1
|
||||
TARGET_DIRS_X11=1
|
||||
TARGET_DIRS_UUID=1
|
||||
TARGET_DIRS_LDAP=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_MAD=1
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
||||
TARGET_DIRS_BASE=1
|
||||
@ -2763,6 +2779,9 @@ TARGET_DIRS_LIBPNG=1
|
||||
TARGET_DIRS_X11=1
|
||||
TARGET_DIRS_UUID=1
|
||||
TARGET_DIRS_LDAP=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_MAD=1
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),arm-palmos)
|
||||
TARGET_DIRS_BASE=1
|
||||
@ -2932,6 +2951,9 @@ TARGET_DIRS_LIBPNG=1
|
||||
TARGET_DIRS_X11=1
|
||||
TARGET_DIRS_UUID=1
|
||||
TARGET_DIRS_LDAP=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_MAD=1
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
||||
TARGET_DIRS_BASE=1
|
||||
@ -4655,6 +4677,141 @@ ldap:
|
||||
$(MAKE) -C ldap all
|
||||
.PHONY: ldap_all ldap_debug ldap_smart ldap_release ldap_units ldap_examples ldap_shared ldap_install ldap_sourceinstall ldap_exampleinstall ldap_distinstall ldap_zipinstall ldap_zipsourceinstall ldap_zipexampleinstall ldap_zipdistinstall ldap_clean ldap_distclean ldap_cleanall ldap_info ldap_makefiles ldap
|
||||
endif
|
||||
ifdef TARGET_DIRS_MODPLUG
|
||||
modplug_all:
|
||||
$(MAKE) -C modplug all
|
||||
modplug_debug:
|
||||
$(MAKE) -C modplug debug
|
||||
modplug_smart:
|
||||
$(MAKE) -C modplug smart
|
||||
modplug_release:
|
||||
$(MAKE) -C modplug release
|
||||
modplug_units:
|
||||
$(MAKE) -C modplug units
|
||||
modplug_examples:
|
||||
$(MAKE) -C modplug examples
|
||||
modplug_shared:
|
||||
$(MAKE) -C modplug shared
|
||||
modplug_install:
|
||||
$(MAKE) -C modplug install
|
||||
modplug_sourceinstall:
|
||||
$(MAKE) -C modplug sourceinstall
|
||||
modplug_exampleinstall:
|
||||
$(MAKE) -C modplug exampleinstall
|
||||
modplug_distinstall:
|
||||
$(MAKE) -C modplug distinstall
|
||||
modplug_zipinstall:
|
||||
$(MAKE) -C modplug zipinstall
|
||||
modplug_zipsourceinstall:
|
||||
$(MAKE) -C modplug zipsourceinstall
|
||||
modplug_zipexampleinstall:
|
||||
$(MAKE) -C modplug zipexampleinstall
|
||||
modplug_zipdistinstall:
|
||||
$(MAKE) -C modplug zipdistinstall
|
||||
modplug_clean:
|
||||
$(MAKE) -C modplug clean
|
||||
modplug_distclean:
|
||||
$(MAKE) -C modplug distclean
|
||||
modplug_cleanall:
|
||||
$(MAKE) -C modplug cleanall
|
||||
modplug_info:
|
||||
$(MAKE) -C modplug info
|
||||
modplug_makefiles:
|
||||
$(MAKE) -C modplug makefiles
|
||||
modplug:
|
||||
$(MAKE) -C modplug all
|
||||
.PHONY: modplug_all modplug_debug modplug_smart modplug_release modplug_units modplug_examples modplug_shared modplug_install modplug_sourceinstall modplug_exampleinstall modplug_distinstall modplug_zipinstall modplug_zipsourceinstall modplug_zipexampleinstall modplug_zipdistinstall modplug_clean modplug_distclean modplug_cleanall modplug_info modplug_makefiles modplug
|
||||
endif
|
||||
ifdef TARGET_DIRS_DTS
|
||||
dts_all:
|
||||
$(MAKE) -C dts all
|
||||
dts_debug:
|
||||
$(MAKE) -C dts debug
|
||||
dts_smart:
|
||||
$(MAKE) -C dts smart
|
||||
dts_release:
|
||||
$(MAKE) -C dts release
|
||||
dts_units:
|
||||
$(MAKE) -C dts units
|
||||
dts_examples:
|
||||
$(MAKE) -C dts examples
|
||||
dts_shared:
|
||||
$(MAKE) -C dts shared
|
||||
dts_install:
|
||||
$(MAKE) -C dts install
|
||||
dts_sourceinstall:
|
||||
$(MAKE) -C dts sourceinstall
|
||||
dts_exampleinstall:
|
||||
$(MAKE) -C dts exampleinstall
|
||||
dts_distinstall:
|
||||
$(MAKE) -C dts distinstall
|
||||
dts_zipinstall:
|
||||
$(MAKE) -C dts zipinstall
|
||||
dts_zipsourceinstall:
|
||||
$(MAKE) -C dts zipsourceinstall
|
||||
dts_zipexampleinstall:
|
||||
$(MAKE) -C dts zipexampleinstall
|
||||
dts_zipdistinstall:
|
||||
$(MAKE) -C dts zipdistinstall
|
||||
dts_clean:
|
||||
$(MAKE) -C dts clean
|
||||
dts_distclean:
|
||||
$(MAKE) -C dts distclean
|
||||
dts_cleanall:
|
||||
$(MAKE) -C dts cleanall
|
||||
dts_info:
|
||||
$(MAKE) -C dts info
|
||||
dts_makefiles:
|
||||
$(MAKE) -C dts makefiles
|
||||
dts:
|
||||
$(MAKE) -C dts all
|
||||
.PHONY: dts_all dts_debug dts_smart dts_release dts_units dts_examples dts_shared dts_install dts_sourceinstall dts_exampleinstall dts_distinstall dts_zipinstall dts_zipsourceinstall dts_zipexampleinstall dts_zipdistinstall dts_clean dts_distclean dts_cleanall dts_info dts_makefiles dts
|
||||
endif
|
||||
ifdef TARGET_DIRS_MAD
|
||||
mad_all:
|
||||
$(MAKE) -C mad all
|
||||
mad_debug:
|
||||
$(MAKE) -C mad debug
|
||||
mad_smart:
|
||||
$(MAKE) -C mad smart
|
||||
mad_release:
|
||||
$(MAKE) -C mad release
|
||||
mad_units:
|
||||
$(MAKE) -C mad units
|
||||
mad_examples:
|
||||
$(MAKE) -C mad examples
|
||||
mad_shared:
|
||||
$(MAKE) -C mad shared
|
||||
mad_install:
|
||||
$(MAKE) -C mad install
|
||||
mad_sourceinstall:
|
||||
$(MAKE) -C mad sourceinstall
|
||||
mad_exampleinstall:
|
||||
$(MAKE) -C mad exampleinstall
|
||||
mad_distinstall:
|
||||
$(MAKE) -C mad distinstall
|
||||
mad_zipinstall:
|
||||
$(MAKE) -C mad zipinstall
|
||||
mad_zipsourceinstall:
|
||||
$(MAKE) -C mad zipsourceinstall
|
||||
mad_zipexampleinstall:
|
||||
$(MAKE) -C mad zipexampleinstall
|
||||
mad_zipdistinstall:
|
||||
$(MAKE) -C mad zipdistinstall
|
||||
mad_clean:
|
||||
$(MAKE) -C mad clean
|
||||
mad_distclean:
|
||||
$(MAKE) -C mad distclean
|
||||
mad_cleanall:
|
||||
$(MAKE) -C mad cleanall
|
||||
mad_info:
|
||||
$(MAKE) -C mad info
|
||||
mad_makefiles:
|
||||
$(MAKE) -C mad makefiles
|
||||
mad:
|
||||
$(MAKE) -C mad all
|
||||
.PHONY: mad_all mad_debug mad_smart mad_release mad_units mad_examples mad_shared mad_install mad_sourceinstall mad_exampleinstall mad_distinstall mad_zipinstall mad_zipsourceinstall mad_zipexampleinstall mad_zipdistinstall mad_clean mad_distclean mad_cleanall mad_info mad_makefiles mad
|
||||
endif
|
||||
ifdef TARGET_DIRS_LIBC
|
||||
libc_all:
|
||||
$(MAKE) -C libc all
|
||||
|
@ -16,9 +16,9 @@ dirs_netbsd=fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqli
|
||||
dirs_openbsd=fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
|
||||
gdbint libpng x11
|
||||
dirs_linux=fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick \
|
||||
gdbint libpng x11 uuid ldap
|
||||
gdbint libpng x11 uuid ldap modplug dts mad
|
||||
dirs_win32=winunits-base winunits-jedi fcl-web ibase mysql zlib oracle odbc postgres sqlite imagemagick \
|
||||
gdbint libpng
|
||||
gdbint libpng mad
|
||||
dirs_win64=winunits-base winunits-jedi fcl-web ibase mysql zlib oracle odbc postgres sqlite imagemagick \
|
||||
gdbint
|
||||
dirs_wince=fcl-web ibase mysql
|
||||
|
2249
packages/dts/Makefile
Normal file
2249
packages/dts/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
25
packages/dts/Makefile.fpc
Normal file
25
packages/dts/Makefile.fpc
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Makefile.fpc for A52DEC bindings
|
||||
#
|
||||
|
||||
[package]
|
||||
name=dts
|
||||
version=2.0.0
|
||||
|
||||
[target]
|
||||
units=dts
|
||||
|
||||
[require]
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../..
|
||||
|
||||
[compiler]
|
||||
includedir=src
|
||||
sourcedir=src tests
|
||||
|
||||
[rules]
|
||||
.NOTPARALLEL:
|
28
packages/dts/fpmake.pp
Normal file
28
packages/dts/fpmake.pp
Normal file
@ -0,0 +1,28 @@
|
||||
{$ifndef ALLPACKAGES}
|
||||
{$mode objfpc}{$H+}
|
||||
program fpmake;
|
||||
|
||||
uses fpmkunit;
|
||||
|
||||
Var
|
||||
P : TPackage;
|
||||
T : TTarget;
|
||||
begin
|
||||
With Installer do
|
||||
begin
|
||||
{$endif ALLPACKAGES}
|
||||
|
||||
P:=AddPackage('dts');
|
||||
{$ifdef ALLPACKAGES}
|
||||
P.Directory:='dts';
|
||||
{$endif ALLPACKAGES}
|
||||
P.Version:='2.0.0';
|
||||
P.SourcePath.Add('src');
|
||||
|
||||
T:=P.Targets.AddUnit('dts.pas');
|
||||
|
||||
{$ifndef ALLPACKAGES}
|
||||
Run;
|
||||
end;
|
||||
end.
|
||||
{$endif ALLPACKAGES}
|
529
packages/dts/src/dts.pas
Normal file
529
packages/dts/src/dts.pas
Normal file
@ -0,0 +1,529 @@
|
||||
{
|
||||
Translation of the DTS headers for FreePascal
|
||||
Copyright (C) 2006 by Ivo Steinmann
|
||||
}
|
||||
|
||||
(*
|
||||
* dts.h
|
||||
* Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
|
||||
*
|
||||
* This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
|
||||
* See http://www.videolan.org/dtsdec.html for updates.
|
||||
*
|
||||
* dtsdec is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* dtsdec is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*)
|
||||
|
||||
{
|
||||
Using the libdts API
|
||||
--------------------
|
||||
|
||||
libdts provides a low-level interface to decoding audio frames encoded
|
||||
using DTS Coherent Acoustics. libdts provides downmixing and
|
||||
dynamic range compression for the following output configurations:
|
||||
|
||||
DTS_CHANNEL : Dual mono. Two independant mono channels.
|
||||
DTS_CHANNEL1 : First of the two mono channels above.
|
||||
DTS_CHANNEL2 : Second of the two mono channels above.
|
||||
DTS_MONO : Mono.
|
||||
DTS_STEREO : Stereo.
|
||||
DTS_DOLBY : Dolby surround compatible stereo.
|
||||
DTS_3F : 3 front channels (left, center, right)
|
||||
DTS_2F1R : 2 front, 1 rear surround channel (L, R, S)
|
||||
DTS_3F1R : 3 front, 1 rear surround channel (L, C, R, S)
|
||||
DTS_2F2R : 2 front, 2 rear surround channels (L, R, LS, RS)
|
||||
DTS_3F2R : 3 front, 2 rear surround channels (L, C, R, LS, RS)
|
||||
|
||||
DTS_LFE : Low frequency effects channel. Normally used to connect a
|
||||
subwoofer. Can be combined with any of the above channels.
|
||||
For example: DTS_3F2R | DTS_LFE -> 3 front, 2 rear, 1 LFE (5.1)
|
||||
|
||||
|
||||
Initialization
|
||||
--------------
|
||||
|
||||
dts_state_t * dts_init (uint32_t mm_accel);
|
||||
|
||||
Initializes the DTS library. Takes as a parameter the acceptable
|
||||
optimizations which may be used, such as MMX. These are found in the
|
||||
included header file 'mm_accel', along with an autodetection function
|
||||
(mm_accel()). Currently, there is no accelleration implemented.
|
||||
|
||||
The return value is a pointer to a dts state object.
|
||||
|
||||
|
||||
Probing the bitstream
|
||||
---------------------
|
||||
|
||||
int dts_syncinfo (uint8_t * buf, int * flags,
|
||||
int * sample_rate, int * bit_rate, int * frame_length);
|
||||
|
||||
The DTS bitstream is composed of several dts frames concatenated one
|
||||
after each other. A dts frame is the smallest independantly decodable
|
||||
unit in the stream.
|
||||
|
||||
buf must contain at least 14 bytes from the input stream. If these look
|
||||
like the start of a valid dts frame, dts_syncinfo() returns the size
|
||||
of the coded frame in bytes, and fills flags, sample_rate, bit_rate and
|
||||
frame_length with the information encoded in the stream. The returned size
|
||||
is guaranteed to be an even number between 96 and 16384 for the 16 bits
|
||||
version of the bitstream and 109 and 18726 for the 14 bits version.
|
||||
sample_rate will be the sampling frequency in Hz, bit_rate is for the
|
||||
compressed stream and is in bits per second, and flags is a description of
|
||||
the coded channels: the DTS_LFE bit is set if there is an LFE channel coded
|
||||
in this stream, and by masking flags with DTS_CHANNEL_MASK you will get a
|
||||
value that describes the full-bandwidth channels, as one of the
|
||||
DTS_CHANNEL...DTS_3F2R flags.
|
||||
|
||||
If this can not possibly be a valid frame, then the function returns
|
||||
0. You should then try to re-synchronize with the dts stream - one way
|
||||
to try this would be to advance buf by one byte until its contents
|
||||
looks like a valid frame, but there might be better
|
||||
application-specific ways to synchronize.
|
||||
|
||||
You need to call this function for each frame, for several
|
||||
reasons: this function detects errors that the other functions will
|
||||
not double-check, consecutive frames might have different lengths, and
|
||||
it helps you re-sync with the stream if you get de-synchronized. It will as
|
||||
well detect the kind of bitstream it is dealing with (big/little endian,
|
||||
16/14 bits mode)
|
||||
|
||||
|
||||
Starting to decode a frame
|
||||
--------------------------
|
||||
|
||||
int dts_frame (dts_state_t * state, uint8_t * buf, int * flags,
|
||||
sample_t * level, sample_t bias);
|
||||
|
||||
This starts the work of decoding the DTS frame (to be completed using
|
||||
dts_block()). buf should point to the beginning of the complete frame
|
||||
of the full size returned by dts_syncinfo().
|
||||
|
||||
You should pass in the flags the speaker configuration that you
|
||||
support, and libdts will return the speaker configuration it will use
|
||||
for its output, based on what is coded in the stream and what you
|
||||
asked for. For example, if the stream contains 2+2 channels
|
||||
(dts_syncinfo() returned DTS_2F2R in the flags), and you have 3+1
|
||||
speakers (you passed DTS_3F1R), then libdts will choose do downmix to
|
||||
2+1 speakers, since there is no center channel to send to your center
|
||||
speaker. So in that case the left and right channels will be
|
||||
essentially unmodified by the downmix, and the two surround channels
|
||||
will be added together and sent to your surround speaker. libdts will
|
||||
return DTS_2F1R to indicate this.
|
||||
|
||||
The good news is that when you downmix to stereo you dont have to
|
||||
worry about this, you will ALWAYS get a stereo output no matter what
|
||||
was coded in the stream. For more complex output configurations you
|
||||
will have to handle the case where libdts couldnt give you what you
|
||||
wanted because some of the channels were not encoded in the stream
|
||||
though.
|
||||
|
||||
Level, bias, and DTS_ADJUST_LEVEL:
|
||||
|
||||
Before downmixing, samples are floating point values with a range of
|
||||
[-1,1]. Most types of downmixing will combine channels together, which
|
||||
will potentially result in a larger range for the output
|
||||
samples. libdts provides two methods of controlling the range of the
|
||||
output, either before or after the downmix stage.
|
||||
|
||||
If you do not set DTS_ADJUST_LEVEL, libdts will multiply the samples
|
||||
by your level value, so that they fit in the [-level,level]
|
||||
range. Then it will apply the standardized downmix equations,
|
||||
potentially making the samples go out of that interval again. The
|
||||
level parameter is not modified.
|
||||
|
||||
Setting the DTS_ADJUST_LEVEL flag will instruct libdts to treat your
|
||||
level value as the intended range interval after downmixing. It will
|
||||
then figure out what level to use before the downmix (what you should
|
||||
have passed if you hadnt used the DTS_ADJUST_LEVEL flag), and
|
||||
overwrite the level value you gave it with that new level value.
|
||||
|
||||
The bias represents a value which should be added to the result
|
||||
regardless:
|
||||
|
||||
output_sample = (input_sample * level) + bias;
|
||||
|
||||
For example, a bias of 384 and a level of 1 tells liba52 you want
|
||||
samples between 383 and 385 instead of -1 and 1. This is what the
|
||||
sample program dtsdec does, as it makes it faster to convert the
|
||||
samples to integer format, using a trick based on the IEEE
|
||||
floating-point format.
|
||||
|
||||
This function also initialises the state for that frame, which will be
|
||||
reused next when decoding blocks.
|
||||
|
||||
|
||||
Dynamic range compression
|
||||
-------------------------
|
||||
|
||||
void dts_dynrng (dts_state_t * state,
|
||||
sample_t (* call) (sample_t, void *), void * data);
|
||||
|
||||
This function is purely optional. If you dont call it, libdts will
|
||||
provide the default behaviour, which is to apply the full dynamic
|
||||
range compression as specified in the DTS stream. This basically
|
||||
makes the loud sounds softer, and the soft sounds louder, so you can
|
||||
more easily listen to the stream in a noisy environment without
|
||||
disturbing anyone.
|
||||
|
||||
If you do call this function and set a NULL callback, this will
|
||||
totally disable the dynamic range compression and provide a playback
|
||||
more adapted to a movie theater or a listening room.
|
||||
|
||||
If you call this function and specify a callback function, this
|
||||
callback might be called up to once for each block, with two
|
||||
arguments: the compression factor 'c' recommended by the bitstream,
|
||||
and the private data pointer you specified in dts_dynrng(). The
|
||||
callback will then return the amount of compression to actually use -
|
||||
typically pow(c,x) where x is somewhere between 0 and 1. More
|
||||
elaborate compression functions might want to use a different value
|
||||
for 'x' depending wether c>1 or c<1 - or even something more complex
|
||||
if this is what you want.
|
||||
|
||||
|
||||
Finding the number of blocks
|
||||
----------------------------
|
||||
|
||||
int dts_blocks_num (dts_state_t * state);
|
||||
|
||||
Every DTS frame is composed of a variable number of blocks. Calling
|
||||
dts_blocks_num() after dts_frame() will give you the number of blocks in the
|
||||
current frame.
|
||||
|
||||
Decoding blocks
|
||||
---------------
|
||||
|
||||
int dts_block (dts_state_t * state);
|
||||
|
||||
Every DTS frame is composed of a variable number of blocks, each with an
|
||||
output of 256 samples for each channel. The dts_block() function decodes
|
||||
the next block in the frame, and should be called dts_blocks_num() times to
|
||||
decode all of the audio in the frame.
|
||||
|
||||
Getting the decoded audio samples
|
||||
---------------------------------
|
||||
|
||||
sample_t * dts_samples (dts_state_t * state);
|
||||
|
||||
After each call to dts_block(), you should extract the audio data from the
|
||||
internal samples buffer.
|
||||
|
||||
This function returns a pointer to an internal buffer which will contain 256
|
||||
samples for the first channel, followed by 256 samples for the second
|
||||
channel, etc... the channel order is center, left, right, left
|
||||
surround, right surround, LFE. If one of the channels is not present in the
|
||||
libdts output, as indicated by the flags returned by dts_frame(), then
|
||||
this channel is skipped and the following channels are shifted so
|
||||
libdts does not leave an empty space between channels.
|
||||
|
||||
|
||||
Pseudocode example
|
||||
------------------
|
||||
|
||||
dts_state_t * state = dts_init (mm_accel());
|
||||
|
||||
loop on input bytes:
|
||||
if at least 14 bytes in the buffer:
|
||||
|
||||
bytes_to_get = dts_syncinfo (...)
|
||||
|
||||
if bytes_to_get == 0:
|
||||
goto loop to keep looking for sync point
|
||||
else
|
||||
get rest of bytes
|
||||
|
||||
dts_frame (state, buf, ...)
|
||||
[dts_dynrng (state, ...); this is only optional]
|
||||
for i = 1 ... dts_blocks_num():
|
||||
dts_block (state)
|
||||
dts_samples (state)
|
||||
convert samples to integer and queue to soundcard
|
||||
}
|
||||
|
||||
unit dts;
|
||||
|
||||
{$mode objfpc}
|
||||
{$MINENUMSIZE 4}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
ctypes;
|
||||
|
||||
{$UNDEF LIBA52_DOUBLE}
|
||||
|
||||
{$IFDEF WINDOWS}
|
||||
{$DEFINE DYNLINK}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF DYNLINK}
|
||||
const
|
||||
{$IF Defined(WINDOWS)}
|
||||
dtslib = 'dts.dll';
|
||||
{$ELSEIF Defined(UNIX)}
|
||||
dtslib = 'libdts.so';
|
||||
{$ELSE}
|
||||
{$MESSAGE ERROR 'DYNLINK not supported'}
|
||||
{$IFEND}
|
||||
{$ELSE}
|
||||
{$LINKLIB dts}
|
||||
{$ENDIF}
|
||||
|
||||
(* x86 accelerations *)
|
||||
const
|
||||
MM_ACCEL_X86_MMX = $80000000;
|
||||
MM_ACCEL_X86_3DNOW = $40000000;
|
||||
MM_ACCEL_X86_MMXEXT = $20000000;
|
||||
|
||||
function mm_accel: cuint32; cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
|
||||
|
||||
type
|
||||
pdts_sample_t = ^dts_sample_t;
|
||||
{$IF Defined(LIBDTS_FIXED)}
|
||||
dts_sample_t = cint32;
|
||||
{$ELSEIF Defined(LIBDTS_DOUBLE)}
|
||||
dts_sample_t = cdouble;
|
||||
{$ELSE}
|
||||
dts_sample_t = cfloat;
|
||||
{$IFEND}
|
||||
|
||||
pdts_level_t = ^dts_level_t;
|
||||
dts_level_t = dts_sample_t;
|
||||
|
||||
pdts_state_t = ^dts_state_t;
|
||||
dts_state_t = record
|
||||
end;
|
||||
|
||||
dts_dynrng_call = function(s: dts_sample_t; data: pointer): dts_level_t; cdecl;
|
||||
|
||||
const
|
||||
DTS_MONO = 0;
|
||||
DTS_CHANNEL = 1;
|
||||
DTS_STEREO = 2;
|
||||
DTS_STEREO_SUMDIFF = 3;
|
||||
DTS_STEREO_TOTAL = 4;
|
||||
DTS_3F = 5;
|
||||
DTS_2F1R = 6;
|
||||
DTS_3F1R = 7;
|
||||
DTS_2F2R = 8;
|
||||
DTS_3F2R = 9;
|
||||
DTS_4F2R = 10;
|
||||
|
||||
DTS_DOLBY = 101; (* FIXME *)
|
||||
|
||||
DTS_CHANNEL_MAX = DTS_3F2R; (* We don't handle anything above that *)
|
||||
DTS_CHANNEL_BITS = 6;
|
||||
DTS_CHANNEL_MASK = $3F;
|
||||
|
||||
DTS_LFE = $80;
|
||||
DTS_ADJUST_LEVEL = $100;
|
||||
|
||||
|
||||
function dts_init(mm_accel: cuint32): pdts_state_t; cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
function dts_syncinfo(state: pdts_state_t; buf: pcuint8; var flags: cint; var sample_rate: cint; var bit_rate: cint; var frame_length: cint): cint; cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
function dts_frame(state: pdts_state_t; buf: pcuint8; var flags: cint; var level: dts_level_t; bias: dts_sample_t): cint; cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
procedure dts_dynrng(state: pdts_state_t; call: dts_dynrng_call; data: pointer); cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
function dts_blocks_num(state: pdts_state_t): cint; cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
function dts_block(state: pdts_state_t): cint; cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
function dts_samples(state: pdts_state_t): pdts_sample_t; cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
procedure dts_free(state: pdts_state_t); cdecl; external {$IFDEF DYNLINK}dtslib{$ENDIF};
|
||||
|
||||
|
||||
|
||||
{
|
||||
Developer of the A52 helpers for FreePascal
|
||||
Copyright (C) 2006 by Ivo Steinmann
|
||||
}
|
||||
|
||||
type
|
||||
dts_read_func = function(user: pointer; ptr: pointer; size: cuint): cuint; cdecl;
|
||||
dts_seek_func = function(user: pointer; offset: clong; whence: cint): clong; cdecl;
|
||||
dts_close_func = function(user: pointer): cint; cdecl;
|
||||
dts_tell_func = function(user: pointer): clong; cdecl;
|
||||
|
||||
pdts_decoder = ^dts_decoder;
|
||||
dts_decoder = record
|
||||
inbuf : array[0..24576-1] of cuint8;
|
||||
inbuf_ptr : pcuint8;
|
||||
frame_size : cint;
|
||||
state : pdts_state_t;
|
||||
fsamples : pdts_sample_t; // internal samples buffer of dts (returned by dts_samples)
|
||||
|
||||
samples : array[0..1,0..6*256-1] of cint16;
|
||||
samplecnt : cint;
|
||||
sampleofs : cint;
|
||||
user : pointer;
|
||||
read : dts_read_func;
|
||||
seek : dts_seek_func;
|
||||
close : dts_close_func;
|
||||
tell : dts_tell_func;
|
||||
|
||||
// Userinfo
|
||||
flags : cint;
|
||||
channels : cint;
|
||||
sample_rate : cint;
|
||||
bit_rate : cint;
|
||||
end;
|
||||
|
||||
|
||||
function dts_decoder_init(mm_accel: cuint32; user: pointer; read: dts_read_func; seek: dts_seek_func; close: dts_close_func; tell: dts_tell_func): pdts_decoder;
|
||||
function dts_decoder_read(decoder: pdts_decoder; buffer: pointer; length: cint): cint;
|
||||
procedure dts_decoder_free(decoder: pdts_decoder);
|
||||
|
||||
implementation
|
||||
|
||||
function dts_decoder_init(mm_accel: cuint32; user: pointer; read: dts_read_func; seek: dts_seek_func; close: dts_close_func; tell: dts_tell_func): pdts_decoder;
|
||||
begin
|
||||
GetMem(Result, Sizeof(dts_decoder));
|
||||
FillChar(Result^, Sizeof(dts_decoder), 0);
|
||||
Result^.state := dts_init(mm_accel);
|
||||
Result^.fsamples := dts_samples(Result^.state);
|
||||
Result^.inbuf_ptr := @Result^.inbuf[0];
|
||||
Result^.user := user;
|
||||
Result^.read := read;
|
||||
Result^.seek := seek;
|
||||
Result^.close := close;
|
||||
Result^.tell := tell;
|
||||
end;
|
||||
|
||||
procedure dts_decoder_free(decoder: pdts_decoder);
|
||||
begin
|
||||
if not Assigned(decoder) then
|
||||
Exit;
|
||||
|
||||
dts_free(decoder^.state);
|
||||
decoder^.close(decoder^.user);
|
||||
FreeMem(decoder);
|
||||
end;
|
||||
|
||||
function dts_decoder_read(decoder: pdts_decoder; buffer: pointer; length: cint): cint;
|
||||
const
|
||||
HEADER_SIZE = 14;
|
||||
// ac3_channels: array[0..7] of cint = (2,1,2,3,3,4,4,5);
|
||||
var
|
||||
num, ofs: cint;
|
||||
flags, len, i, j: cint;
|
||||
sample_rate, bit_rate: cint;
|
||||
level: dts_sample_t;
|
||||
begin
|
||||
// check blocksize here!
|
||||
|
||||
ofs := 0;
|
||||
num := length;
|
||||
|
||||
while num > 0 do
|
||||
begin
|
||||
if decoder^.samplecnt = 0 then
|
||||
begin
|
||||
len := ptrint(decoder^.inbuf_ptr) - ptrint(@decoder^.inbuf);
|
||||
|
||||
if (len < HEADER_SIZE) or (len < decoder^.frame_size) then
|
||||
begin
|
||||
(* inbuf too small : enlarge *)
|
||||
len := Sizeof(dts_decoder.inbuf) - len;
|
||||
len := decoder^.read(decoder^.user, decoder^.inbuf_ptr, len);
|
||||
if len <= 0 then
|
||||
Exit(ofs);
|
||||
|
||||
Inc(decoder^.inbuf_ptr, len);
|
||||
end;
|
||||
|
||||
if decoder^.frame_size = 0 then
|
||||
begin
|
||||
(* no header seen : find one. We need at least 7 bytes to parse it *)
|
||||
|
||||
len := dts_syncinfo(decoder^.state, @decoder^.inbuf[0], decoder^.flags, sample_rate, bit_rate, i{dummy});
|
||||
if len = 0 then
|
||||
begin
|
||||
(* no sync found : move by one byte (inefficient, but simple!) *)
|
||||
Move(decoder^.inbuf[1], decoder^.inbuf[0], ptrint(decoder^.inbuf_ptr) - ptrint(@decoder^.inbuf) - 1);
|
||||
Dec(decoder^.inbuf_ptr, 1);
|
||||
end else begin
|
||||
decoder^.frame_size := len;
|
||||
|
||||
(* update codec info *)
|
||||
decoder^.sample_rate := sample_rate;
|
||||
decoder^.bit_rate := bit_rate;
|
||||
{decoder^.channels := ac3_channels[decoder^.flags and $7];
|
||||
if decoder^.flags and A52_LFE <> 0 then
|
||||
Inc(decoder^.channels);}
|
||||
|
||||
{WriteLn(' frame_size : ', decoder^.frame_size);
|
||||
WriteLn(' sample_rate : ', sample_rate);
|
||||
WriteLn(' bit_rate : ', bit_rate);
|
||||
WriteLn(' channels : ', decoder^.channels);}
|
||||
end;
|
||||
|
||||
Continue;
|
||||
end;
|
||||
|
||||
(* decode the frame *)
|
||||
flags := DTS_STEREO or DTS_ADJUST_LEVEL;//decoder^.flags;
|
||||
level := 0;//High(Smallint)-30;
|
||||
(* FIXME dts_frame dont care on level parameters, so I set it to zero and multiply with High(Smallint) later *)
|
||||
|
||||
if dts_frame(decoder^.state, @decoder^.inbuf[0], flags, level, 0) <> 0 then
|
||||
begin
|
||||
decoder^.inbuf_ptr := @decoder^.inbuf[0];
|
||||
decoder^.frame_size := 0;
|
||||
Continue;
|
||||
end;
|
||||
|
||||
len := dts_blocks_num(decoder^.state);
|
||||
for i := 0 to len - 1 do
|
||||
begin
|
||||
if dts_block(decoder^.state) <> 0 then
|
||||
begin
|
||||
decoder^.inbuf_ptr := @decoder^.inbuf[0];
|
||||
decoder^.frame_size := 0;
|
||||
Exit(-1);
|
||||
end;
|
||||
|
||||
for j := 0 to 255 do
|
||||
begin
|
||||
decoder^.samples[0, i*256+j] := Round(High(Smallint)*decoder^.fsamples[j + 000]);
|
||||
decoder^.samples[1, i*256+j] := Round(High(Smallint)*decoder^.fsamples[j + 256]);
|
||||
end;
|
||||
end;
|
||||
|
||||
(* skip decoded frame *)
|
||||
Move(decoder^.inbuf[decoder^.frame_size], decoder^.inbuf[0], ptrint(decoder^.inbuf_ptr) - ptrint(@decoder^.inbuf) - decoder^.frame_size);
|
||||
Dec(decoder^.inbuf_ptr, decoder^.frame_size);
|
||||
decoder^.frame_size := 0;
|
||||
|
||||
decoder^.sampleofs := 0;
|
||||
decoder^.samplecnt := len*256;
|
||||
end;
|
||||
|
||||
len := num div 4;
|
||||
if len > decoder^.samplecnt then
|
||||
len := decoder^.samplecnt;
|
||||
|
||||
for i := 0 to len - 1 do
|
||||
begin
|
||||
pcint16(ptrint(buffer) + ofs + 0)^ := decoder^.samples[0][decoder^.sampleofs];
|
||||
pcint16(ptrint(buffer) + ofs + 2)^ := decoder^.samples[1][decoder^.sampleofs];
|
||||
|
||||
Inc(decoder^.sampleofs);
|
||||
Dec(decoder^.samplecnt);
|
||||
ofs := ofs + 4;
|
||||
num := num - 4;
|
||||
end;
|
||||
end;
|
||||
|
||||
Result := ofs;
|
||||
end;
|
||||
|
||||
end.
|
@ -241,13 +241,13 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
|
||||
endif
|
||||
PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
|
||||
ifeq ($(FULL_TARGET),i386-linux)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell lua sdl graph
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal oggvorbis a52 openssl pcap libcurl cairo aspell lua sdl graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-go32v2)
|
||||
override TARGET_DIRS+=chm graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-win32)
|
||||
override TARGET_DIRS+=chm opengl gtk gtk2 tcl cdrom fpgtk fftw mad openal oggvorbis a52 openssl pcap sdl lua graph
|
||||
override TARGET_DIRS+=chm opengl gtk gtk2 tcl cdrom fpgtk fftw openal oggvorbis a52 openssl pcap sdl lua graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-os2)
|
||||
override TARGET_DIRS+=chm os2units rexx gtk tcl imlib fpgtk
|
||||
@ -298,7 +298,7 @@ ifeq ($(FULL_TARGET),i386-symbian)
|
||||
override TARGET_DIRS+=chm
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-linux)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal oggvorbis a52 openssl pcap libcurl cairo aspell graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-freebsd)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm fpgtk tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
|
||||
@ -322,7 +322,7 @@ ifeq ($(FULL_TARGET),m68k-embedded)
|
||||
override TARGET_DIRS+=chm
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-linux)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell sdl graph
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal oggvorbis a52 openssl pcap libcurl cairo aspell sdl graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
||||
override TARGET_DIRS+=chm opengl gtk syslog forms svgalib ggi libgd utmp bfd gdbm fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
|
||||
@ -343,7 +343,7 @@ ifeq ($(FULL_TARGET),powerpc-embedded)
|
||||
override TARGET_DIRS+=chm
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),sparc-linux)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal oggvorbis a52 openssl pcap libcurl cairo aspell graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),sparc-netbsd)
|
||||
override TARGET_DIRS+=chm opengl gtk syslog forms svgalib ggi libgd utmp bfd gdbm fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
|
||||
@ -355,7 +355,7 @@ ifeq ($(FULL_TARGET),sparc-embedded)
|
||||
override TARGET_DIRS+=chm
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),x86_64-linux)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell sdl graph
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal oggvorbis a52 openssl pcap libcurl cairo aspell sdl graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm fpgtk tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
|
||||
@ -370,7 +370,7 @@ ifeq ($(FULL_TARGET),x86_64-embedded)
|
||||
override TARGET_DIRS+=chm
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),arm-linux)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal oggvorbis a52 openssl pcap libcurl cairo aspell graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),arm-palmos)
|
||||
override TARGET_DIRS+=chm palmunits
|
||||
@ -391,7 +391,7 @@ ifeq ($(FULL_TARGET),arm-symbian)
|
||||
override TARGET_DIRS+=chm
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms svgalib ggi libgd utmp bfd gdbm tcl cdrom imlib gnome1 fpgtk newt openal oggvorbis a52 openssl pcap libcurl cairo aspell graph
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
||||
override TARGET_DIRS+=chm fftw opengl gtk gtk2 syslog forms libgd utmp bfd gdbm fpgtk tcl imlib gnome1 openssl libcurl cairo aspell
|
||||
@ -1499,11 +1499,8 @@ TARGET_DIRS_GNOME1=1
|
||||
TARGET_DIRS_FPGTK=1
|
||||
TARGET_DIRS_NEWT=1
|
||||
TARGET_DIRS_OPENAL=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_OGGVORBIS=1
|
||||
TARGET_DIRS_A52=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_OPENSSL=1
|
||||
TARGET_DIRS_PCAP=1
|
||||
TARGET_DIRS_LIBCURL=1
|
||||
@ -1526,7 +1523,6 @@ TARGET_DIRS_TCL=1
|
||||
TARGET_DIRS_CDROM=1
|
||||
TARGET_DIRS_FPGTK=1
|
||||
TARGET_DIRS_FFTW=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_OPENAL=1
|
||||
TARGET_DIRS_OGGVORBIS=1
|
||||
TARGET_DIRS_A52=1
|
||||
@ -1722,11 +1718,8 @@ TARGET_DIRS_GNOME1=1
|
||||
TARGET_DIRS_FPGTK=1
|
||||
TARGET_DIRS_NEWT=1
|
||||
TARGET_DIRS_OPENAL=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_OGGVORBIS=1
|
||||
TARGET_DIRS_A52=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_OPENSSL=1
|
||||
TARGET_DIRS_PCAP=1
|
||||
TARGET_DIRS_LIBCURL=1
|
||||
@ -1839,11 +1832,8 @@ TARGET_DIRS_GNOME1=1
|
||||
TARGET_DIRS_FPGTK=1
|
||||
TARGET_DIRS_NEWT=1
|
||||
TARGET_DIRS_OPENAL=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_OGGVORBIS=1
|
||||
TARGET_DIRS_A52=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_OPENSSL=1
|
||||
TARGET_DIRS_PCAP=1
|
||||
TARGET_DIRS_LIBCURL=1
|
||||
@ -1932,11 +1922,8 @@ TARGET_DIRS_GNOME1=1
|
||||
TARGET_DIRS_FPGTK=1
|
||||
TARGET_DIRS_NEWT=1
|
||||
TARGET_DIRS_OPENAL=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_OGGVORBIS=1
|
||||
TARGET_DIRS_A52=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_OPENSSL=1
|
||||
TARGET_DIRS_PCAP=1
|
||||
TARGET_DIRS_LIBCURL=1
|
||||
@ -2013,11 +2000,8 @@ TARGET_DIRS_GNOME1=1
|
||||
TARGET_DIRS_FPGTK=1
|
||||
TARGET_DIRS_NEWT=1
|
||||
TARGET_DIRS_OPENAL=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_OGGVORBIS=1
|
||||
TARGET_DIRS_A52=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_OPENSSL=1
|
||||
TARGET_DIRS_PCAP=1
|
||||
TARGET_DIRS_LIBCURL=1
|
||||
@ -2109,11 +2093,8 @@ TARGET_DIRS_GNOME1=1
|
||||
TARGET_DIRS_FPGTK=1
|
||||
TARGET_DIRS_NEWT=1
|
||||
TARGET_DIRS_OPENAL=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_OGGVORBIS=1
|
||||
TARGET_DIRS_A52=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_OPENSSL=1
|
||||
TARGET_DIRS_PCAP=1
|
||||
TARGET_DIRS_LIBCURL=1
|
||||
@ -2163,11 +2144,8 @@ TARGET_DIRS_GNOME1=1
|
||||
TARGET_DIRS_FPGTK=1
|
||||
TARGET_DIRS_NEWT=1
|
||||
TARGET_DIRS_OPENAL=1
|
||||
TARGET_DIRS_MAD=1
|
||||
TARGET_DIRS_OGGVORBIS=1
|
||||
TARGET_DIRS_A52=1
|
||||
TARGET_DIRS_MODPLUG=1
|
||||
TARGET_DIRS_DTS=1
|
||||
TARGET_DIRS_OPENSSL=1
|
||||
TARGET_DIRS_PCAP=1
|
||||
TARGET_DIRS_LIBCURL=1
|
||||
@ -3099,51 +3077,6 @@ openal:
|
||||
$(MAKE) -C openal all
|
||||
.PHONY: openal_all openal_debug openal_smart openal_release openal_units openal_examples openal_shared openal_install openal_sourceinstall openal_exampleinstall openal_distinstall openal_zipinstall openal_zipsourceinstall openal_zipexampleinstall openal_zipdistinstall openal_clean openal_distclean openal_cleanall openal_info openal_makefiles openal
|
||||
endif
|
||||
ifdef TARGET_DIRS_MAD
|
||||
mad_all:
|
||||
$(MAKE) -C mad all
|
||||
mad_debug:
|
||||
$(MAKE) -C mad debug
|
||||
mad_smart:
|
||||
$(MAKE) -C mad smart
|
||||
mad_release:
|
||||
$(MAKE) -C mad release
|
||||
mad_units:
|
||||
$(MAKE) -C mad units
|
||||
mad_examples:
|
||||
$(MAKE) -C mad examples
|
||||
mad_shared:
|
||||
$(MAKE) -C mad shared
|
||||
mad_install:
|
||||
$(MAKE) -C mad install
|
||||
mad_sourceinstall:
|
||||
$(MAKE) -C mad sourceinstall
|
||||
mad_exampleinstall:
|
||||
$(MAKE) -C mad exampleinstall
|
||||
mad_distinstall:
|
||||
$(MAKE) -C mad distinstall
|
||||
mad_zipinstall:
|
||||
$(MAKE) -C mad zipinstall
|
||||
mad_zipsourceinstall:
|
||||
$(MAKE) -C mad zipsourceinstall
|
||||
mad_zipexampleinstall:
|
||||
$(MAKE) -C mad zipexampleinstall
|
||||
mad_zipdistinstall:
|
||||
$(MAKE) -C mad zipdistinstall
|
||||
mad_clean:
|
||||
$(MAKE) -C mad clean
|
||||
mad_distclean:
|
||||
$(MAKE) -C mad distclean
|
||||
mad_cleanall:
|
||||
$(MAKE) -C mad cleanall
|
||||
mad_info:
|
||||
$(MAKE) -C mad info
|
||||
mad_makefiles:
|
||||
$(MAKE) -C mad makefiles
|
||||
mad:
|
||||
$(MAKE) -C mad all
|
||||
.PHONY: mad_all mad_debug mad_smart mad_release mad_units mad_examples mad_shared mad_install mad_sourceinstall mad_exampleinstall mad_distinstall mad_zipinstall mad_zipsourceinstall mad_zipexampleinstall mad_zipdistinstall mad_clean mad_distclean mad_cleanall mad_info mad_makefiles mad
|
||||
endif
|
||||
ifdef TARGET_DIRS_OGGVORBIS
|
||||
oggvorbis_all:
|
||||
$(MAKE) -C oggvorbis all
|
||||
@ -3234,96 +3167,6 @@ a52:
|
||||
$(MAKE) -C a52 all
|
||||
.PHONY: a52_all a52_debug a52_smart a52_release a52_units a52_examples a52_shared a52_install a52_sourceinstall a52_exampleinstall a52_distinstall a52_zipinstall a52_zipsourceinstall a52_zipexampleinstall a52_zipdistinstall a52_clean a52_distclean a52_cleanall a52_info a52_makefiles a52
|
||||
endif
|
||||
ifdef TARGET_DIRS_MODPLUG
|
||||
modplug_all:
|
||||
$(MAKE) -C modplug all
|
||||
modplug_debug:
|
||||
$(MAKE) -C modplug debug
|
||||
modplug_smart:
|
||||
$(MAKE) -C modplug smart
|
||||
modplug_release:
|
||||
$(MAKE) -C modplug release
|
||||
modplug_units:
|
||||
$(MAKE) -C modplug units
|
||||
modplug_examples:
|
||||
$(MAKE) -C modplug examples
|
||||
modplug_shared:
|
||||
$(MAKE) -C modplug shared
|
||||
modplug_install:
|
||||
$(MAKE) -C modplug install
|
||||
modplug_sourceinstall:
|
||||
$(MAKE) -C modplug sourceinstall
|
||||
modplug_exampleinstall:
|
||||
$(MAKE) -C modplug exampleinstall
|
||||
modplug_distinstall:
|
||||
$(MAKE) -C modplug distinstall
|
||||
modplug_zipinstall:
|
||||
$(MAKE) -C modplug zipinstall
|
||||
modplug_zipsourceinstall:
|
||||
$(MAKE) -C modplug zipsourceinstall
|
||||
modplug_zipexampleinstall:
|
||||
$(MAKE) -C modplug zipexampleinstall
|
||||
modplug_zipdistinstall:
|
||||
$(MAKE) -C modplug zipdistinstall
|
||||
modplug_clean:
|
||||
$(MAKE) -C modplug clean
|
||||
modplug_distclean:
|
||||
$(MAKE) -C modplug distclean
|
||||
modplug_cleanall:
|
||||
$(MAKE) -C modplug cleanall
|
||||
modplug_info:
|
||||
$(MAKE) -C modplug info
|
||||
modplug_makefiles:
|
||||
$(MAKE) -C modplug makefiles
|
||||
modplug:
|
||||
$(MAKE) -C modplug all
|
||||
.PHONY: modplug_all modplug_debug modplug_smart modplug_release modplug_units modplug_examples modplug_shared modplug_install modplug_sourceinstall modplug_exampleinstall modplug_distinstall modplug_zipinstall modplug_zipsourceinstall modplug_zipexampleinstall modplug_zipdistinstall modplug_clean modplug_distclean modplug_cleanall modplug_info modplug_makefiles modplug
|
||||
endif
|
||||
ifdef TARGET_DIRS_DTS
|
||||
dts_all:
|
||||
$(MAKE) -C dts all
|
||||
dts_debug:
|
||||
$(MAKE) -C dts debug
|
||||
dts_smart:
|
||||
$(MAKE) -C dts smart
|
||||
dts_release:
|
||||
$(MAKE) -C dts release
|
||||
dts_units:
|
||||
$(MAKE) -C dts units
|
||||
dts_examples:
|
||||
$(MAKE) -C dts examples
|
||||
dts_shared:
|
||||
$(MAKE) -C dts shared
|
||||
dts_install:
|
||||
$(MAKE) -C dts install
|
||||
dts_sourceinstall:
|
||||
$(MAKE) -C dts sourceinstall
|
||||
dts_exampleinstall:
|
||||
$(MAKE) -C dts exampleinstall
|
||||
dts_distinstall:
|
||||
$(MAKE) -C dts distinstall
|
||||
dts_zipinstall:
|
||||
$(MAKE) -C dts zipinstall
|
||||
dts_zipsourceinstall:
|
||||
$(MAKE) -C dts zipsourceinstall
|
||||
dts_zipexampleinstall:
|
||||
$(MAKE) -C dts zipexampleinstall
|
||||
dts_zipdistinstall:
|
||||
$(MAKE) -C dts zipdistinstall
|
||||
dts_clean:
|
||||
$(MAKE) -C dts clean
|
||||
dts_distclean:
|
||||
$(MAKE) -C dts distclean
|
||||
dts_cleanall:
|
||||
$(MAKE) -C dts cleanall
|
||||
dts_info:
|
||||
$(MAKE) -C dts info
|
||||
dts_makefiles:
|
||||
$(MAKE) -C dts makefiles
|
||||
dts:
|
||||
$(MAKE) -C dts all
|
||||
.PHONY: dts_all dts_debug dts_smart dts_release dts_units dts_examples dts_shared dts_install dts_sourceinstall dts_exampleinstall dts_distinstall dts_zipinstall dts_zipsourceinstall dts_zipexampleinstall dts_zipdistinstall dts_clean dts_distclean dts_cleanall dts_info dts_makefiles dts
|
||||
endif
|
||||
ifdef TARGET_DIRS_OPENSSL
|
||||
openssl_all:
|
||||
$(MAKE) -C openssl all
|
||||
|
@ -8,8 +8,8 @@ dirs_linux= fftw \
|
||||
forms svgalib ggi libgd \
|
||||
utmp bfd gdbm tcl cdrom \
|
||||
imlib gnome1 fpgtk newt \
|
||||
openal mad oggvorbis a52 \
|
||||
modplug dts openssl pcap libcurl cairo aspell
|
||||
openal oggvorbis a52 \
|
||||
openssl pcap libcurl cairo aspell
|
||||
dirs_i386_linux= lua sdl graph
|
||||
dirs_x86_64_linux=sdl graph
|
||||
dirs_powerpc_linux=sdl graph
|
||||
@ -34,7 +34,7 @@ dirs_openbsd= \
|
||||
tcl imlib gnome1 openssl pcap libcurl cairo aspell
|
||||
# libcurl should work on Win32 too, but I haven't tested this. Skip it for now. MVC.
|
||||
dirs_win32= opengl gtk gtk2 tcl cdrom fpgtk fftw \
|
||||
mad openal oggvorbis a52 openssl pcap sdl lua graph
|
||||
openal oggvorbis a52 openssl pcap sdl lua graph
|
||||
dirs_win64= opengl gtk gtk2 tcl cdrom fpgtk fftw openssl sdl
|
||||
dirs_wince= tcl fftw
|
||||
dirs_os2=os2units \
|
||||
|
2249
packages/mad/Makefile
Normal file
2249
packages/mad/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
25
packages/mad/Makefile.fpc
Normal file
25
packages/mad/Makefile.fpc
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Makefile.fpc for libmad bindings
|
||||
#
|
||||
|
||||
[package]
|
||||
name=mad
|
||||
version=2.0.0
|
||||
|
||||
[target]
|
||||
units=mad
|
||||
|
||||
[require]
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../..
|
||||
|
||||
[compiler]
|
||||
includedir=src
|
||||
sourcedir=src tests
|
||||
|
||||
[rules]
|
||||
.NOTPARALLEL:
|
29
packages/mad/fpmake.pp
Normal file
29
packages/mad/fpmake.pp
Normal file
@ -0,0 +1,29 @@
|
||||
{$ifndef ALLPACKAGES}
|
||||
{$mode objfpc}{$H+}
|
||||
program fpmake;
|
||||
|
||||
uses fpmkunit;
|
||||
|
||||
Var
|
||||
P : TPackage;
|
||||
T : TTarget;
|
||||
begin
|
||||
With Installer do
|
||||
begin
|
||||
{$endif ALLPACKAGES}
|
||||
|
||||
P:=AddPackage('mad');
|
||||
{$ifdef ALLPACKAGES}
|
||||
P.Directory:='mad';
|
||||
{$endif ALLPACKAGES}
|
||||
P.Version:='2.0.0';
|
||||
P.SourcePath.Add('src');
|
||||
|
||||
T:=P.Targets.AddUnit('mad.pas');
|
||||
|
||||
|
||||
{$ifndef ALLPACKAGES}
|
||||
Run;
|
||||
end;
|
||||
end.
|
||||
{$endif ALLPACKAGES}
|
717
packages/mad/src/mad.pas
Normal file
717
packages/mad/src/mad.pas
Normal file
@ -0,0 +1,717 @@
|
||||
{
|
||||
Translation of the libmad headers for FreePascal
|
||||
Copyright (C) 2006 by Ivo Steinmann
|
||||
}
|
||||
|
||||
(*
|
||||
* libmad - MPEG audio decoder library
|
||||
* Copyright (C) 2000-2003 Underbit Technologies, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* If you would like to negotiate alternate licensing terms, you may do
|
||||
* so by contacting: Underbit Technologies, Inc. <info@underbit.com>
|
||||
*)
|
||||
|
||||
unit mad;
|
||||
|
||||
{$mode objfpc}
|
||||
{$MINENUMSIZE 4}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
ctypes;
|
||||
|
||||
{$IFDEF WINDOWS}
|
||||
{$DEFINE DYNLINK}
|
||||
{$ENDIF}
|
||||
|
||||
{$DEFINE MAD_DISABLE_BUILTIN_DECODER}
|
||||
|
||||
{$IFDEF DYNLINK}
|
||||
const
|
||||
{$IF Defined(WINDOWS)}
|
||||
madlib = 'libmad.dll';
|
||||
{$ELSEIF Defined(UNIX)}
|
||||
madlib = 'libmad.so';
|
||||
{$ELSE}
|
||||
{$MESSAGE ERROR 'DYNLINK not supported'}
|
||||
{$IFEND}
|
||||
{$ELSE}
|
||||
{$LINKLIB mad}
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
(***********************************************************************)
|
||||
(* Header : version.h *)
|
||||
(***********************************************************************)
|
||||
|
||||
const
|
||||
MAD_VERSION_MAJOR = 0;
|
||||
MAD_VERSION_MINOR = 15;
|
||||
MAD_VERSION_PATCH = 1;
|
||||
MAD_VERSION_EXTRA = ' (beta)';
|
||||
|
||||
function MAD_VERSION_STRINGIZE(num: cint): String;
|
||||
function MAD_VERSION_STRING(num: cint): String;
|
||||
function MAD_VERSION: String;
|
||||
|
||||
const
|
||||
MAD_PUBLISHYEAR = '2000-2004';
|
||||
MAD_AUTHOR = 'Underbit Technologies, Inc.';
|
||||
MAD_EMAIL = 'info@underbit.com';
|
||||
|
||||
|
||||
(***********************************************************************)
|
||||
(* Header : fixed.h *)
|
||||
(***********************************************************************)
|
||||
|
||||
type
|
||||
mad_fixed_t = csint;
|
||||
mad_fixed64hi_t = csint;
|
||||
mad_fixed64lo_t = cuint;
|
||||
mad_fixed64_t = cslonglong;
|
||||
mad_sample_t = mad_fixed_t;
|
||||
|
||||
{*
|
||||
* Fixed-point format: 0xABBBBBBB
|
||||
* A == whole part (sign + 3 bits)
|
||||
* B == fractional part (28 bits)
|
||||
*
|
||||
* Values are signed two's complement, so the effective range is:
|
||||
* 0x80000000 to 0x7fffffff
|
||||
* -8.0 to +7.9999999962747097015380859375
|
||||
*
|
||||
* The smallest representable value is:
|
||||
* 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
|
||||
*
|
||||
* 28 bits of fractional accuracy represent about
|
||||
* 8.6 digits of decimal accuracy.
|
||||
*
|
||||
* Fixed-point numbers can be added or subtracted as normal
|
||||
* integers, but multiplication requires shifting the 64-bit result
|
||||
* from 56 fractional bits back to 28 (and rounding.)
|
||||
*
|
||||
* Changing the definition of MAD_F_FRACBITS is only partially
|
||||
* supported, and must be done with care.
|
||||
*}
|
||||
|
||||
const
|
||||
MAD_F_FRACBITS = 28;
|
||||
// MAD_F_MIN = mad_fixed_t(-$80000000);
|
||||
MAD_F_MAX = mad_fixed_t(+$7fffffff);
|
||||
MAD_F_ONE = mad_fixed_t( $10000000);
|
||||
MAD_F_SCALEBITS = MAD_F_FRACBITS;
|
||||
|
||||
//function mad_f_tofixed(x: double): mad_fixed_t;
|
||||
|
||||
|
||||
(***********************************************************************)
|
||||
(* Header : bit.h *)
|
||||
(***********************************************************************)
|
||||
|
||||
type
|
||||
mad_bitptr = record
|
||||
byte : ^cuchar;
|
||||
cache : cushort;
|
||||
left : cushort;
|
||||
end;
|
||||
|
||||
procedure mad_bit_init(var bitptr: mad_bitptr; byte: pcuchar); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_bit_finish(var bitptr: mad_bitptr);
|
||||
function mad_bit_length(var begin_, end_: mad_bitptr): cuint; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_bit_bitsleft(var bitptr: mad_bitptr): cushort;
|
||||
function mad_bit_nextbyte(var bitptr: mad_bitptr): pcuchar; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_bit_skip(var bitptr: mad_bitptr); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_bit_read(var bitptr: mad_bitptr; len: cuint): culong; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_bit_write(var bitptr: mad_bitptr; len: cuint; value: culong); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_bit_crc(bitptr: mad_bitptr; len: cuint; init: cushort): cushort; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
|
||||
|
||||
(***********************************************************************)
|
||||
(* Header : timer.h *)
|
||||
(***********************************************************************)
|
||||
|
||||
type
|
||||
mad_timer_t = record
|
||||
seconds : cslong; { whole seconds }
|
||||
fraction : culong; { 1/MAD_TIMER_RESOLUTION seconds }
|
||||
end;
|
||||
|
||||
const
|
||||
MAD_TIMER_RESOLUTION = 352800000;
|
||||
mad_timer_zero : mad_timer_t = (seconds:0; fraction:0);
|
||||
|
||||
type
|
||||
mad_units = (
|
||||
MAD_UNITS_HOURS = -2,
|
||||
MAD_UNITS_MINUTES = -1,
|
||||
MAD_UNITS_SECONDS = 0,
|
||||
|
||||
{ metric units }
|
||||
|
||||
MAD_UNITS_DECISECONDS = 10,
|
||||
MAD_UNITS_CENTISECONDS = 100,
|
||||
MAD_UNITS_MILLISECONDS = 1000,
|
||||
|
||||
{ audio sample units }
|
||||
|
||||
MAD_UNITS_8000_HZ = 8000,
|
||||
MAD_UNITS_11025_HZ = 11025,
|
||||
MAD_UNITS_12000_HZ = 12000,
|
||||
|
||||
MAD_UNITS_16000_HZ = 16000,
|
||||
MAD_UNITS_22050_HZ = 22050,
|
||||
MAD_UNITS_24000_HZ = 24000,
|
||||
|
||||
MAD_UNITS_32000_HZ = 32000,
|
||||
MAD_UNITS_44100_HZ = 44100,
|
||||
MAD_UNITS_48000_HZ = 48000,
|
||||
|
||||
{ video frame/field units }
|
||||
|
||||
MAD_UNITS_24_FPS = 24,
|
||||
MAD_UNITS_25_FPS = 25,
|
||||
MAD_UNITS_30_FPS = 30,
|
||||
MAD_UNITS_48_FPS = 48,
|
||||
MAD_UNITS_50_FPS = 50,
|
||||
MAD_UNITS_60_FPS = 60,
|
||||
|
||||
{ CD audio frames }
|
||||
|
||||
MAD_UNITS_75_FPS = 75,
|
||||
|
||||
{ video drop-frame units }
|
||||
|
||||
MAD_UNITS_23_976_FPS = -24,
|
||||
MAD_UNITS_24_975_FPS = -25,
|
||||
MAD_UNITS_29_97_FPS = -30,
|
||||
MAD_UNITS_47_952_FPS = -48,
|
||||
MAD_UNITS_49_95_FPS = -50,
|
||||
MAD_UNITS_59_94_FPS = -60
|
||||
);
|
||||
|
||||
|
||||
procedure mad_timer_reset(var timer: mad_timer_t);
|
||||
function mad_timer_compare(timer1: mad_timer_t; timer2: mad_timer_t): cint; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_timer_sign(timer: mad_timer_t): cint;
|
||||
procedure mad_timer_negate(var timer: mad_timer_t); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_timer_abs(timer: mad_timer_t): mad_timer_t; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_timer_set(var timer: mad_timer_t; seconds, numer, denom: culong); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_timer_add(var timer: mad_timer_t; incr: mad_timer_t); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_timer_multiply(var timer: mad_timer_t; scalar: cslong); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_timer_count(timer: mad_timer_t; units: mad_units): cslong; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_timer_fraction(timer: mad_timer_t; denom: culong): culong; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_timer_string(timer: mad_timer_t; dest, format: pcchar; units, fracunits: mad_units; subparts: culong); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
|
||||
|
||||
(***********************************************************************)
|
||||
(* Header : stream.h *)
|
||||
(***********************************************************************)
|
||||
|
||||
type
|
||||
mad_error = (
|
||||
MAD_ERROR_NONE = $0000, { no error }
|
||||
|
||||
MAD_ERROR_BUFLEN = $0001, { input buffer too small (or EOF) }
|
||||
MAD_ERROR_BUFPTR = $0002, { invalid (null) buffer pointer }
|
||||
|
||||
MAD_ERROR_NOMEM = $0031, { not enough memory }
|
||||
|
||||
MAD_ERROR_LOSTSYNC = $0101, { lost synchronization }
|
||||
MAD_ERROR_BADLAYER = $0102, { reserved header layer value }
|
||||
MAD_ERROR_BADBITRATE = $0103, { forbidden bitrate value }
|
||||
MAD_ERROR_BADSAMPLERATE = $0104, { reserved sample frequency value }
|
||||
MAD_ERROR_BADEMPHASIS = $0105, { reserved emphasis value }
|
||||
|
||||
MAD_ERROR_BADCRC = $0201, { CRC check failed }
|
||||
MAD_ERROR_BADBITALLOC = $0211, { forbidden bit allocation value }
|
||||
MAD_ERROR_BADSCALEFACTOR = $0221, { bad scalefactor index }
|
||||
MAD_ERROR_BADFRAMELEN = $0231, { bad frame length }
|
||||
MAD_ERROR_BADBIGVALUES = $0232, { bad big_values count }
|
||||
MAD_ERROR_BADBLOCKTYPE = $0233, { reserved block_type }
|
||||
MAD_ERROR_BADSCFSI = $0234, { bad scalefactor selection info }
|
||||
MAD_ERROR_BADDATAPTR = $0235, { bad main_data_begin pointer }
|
||||
MAD_ERROR_BADPART3LEN = $0236, { bad audio data length }
|
||||
MAD_ERROR_BADHUFFTABLE = $0237, { bad Huffman table select }
|
||||
MAD_ERROR_BADHUFFDATA = $0238, { Huffman data overrun }
|
||||
MAD_ERROR_BADSTEREO = $0239 { incompatible block_type for JS }
|
||||
);
|
||||
|
||||
function MAD_RECOVERABLE(error: mad_error) : Boolean;
|
||||
|
||||
type
|
||||
mad_stream = record
|
||||
buffer : pointer; { input bitstream buffer }
|
||||
bufend : pointer; { end of buffer }
|
||||
skiplen : culong; { bytes to skip before next frame }
|
||||
sync : cint; { stream sync found }
|
||||
freerate : culong; { free bitrate (fixed) }
|
||||
this_frame : pointer; { start of current frame }
|
||||
next_frame : pointer; { start of next frame }
|
||||
ptr : mad_bitptr; { current processing bit pointer }
|
||||
anc_ptr : mad_bitptr; { ancillary bits pointer }
|
||||
anc_bitlen : cuint; { number of ancillary bits }
|
||||
main_data : pointer; { Layer III main_data() }
|
||||
md_len : cuint; { bytes in main_data }
|
||||
options : cint; { decoding options (see below) }
|
||||
error : mad_error; { error code (see above) }
|
||||
end;
|
||||
|
||||
const
|
||||
MAD_BUFFER_GUARD = 8;
|
||||
MAD_BUFFER_MDLEN = 511 + 2048 + MAD_BUFFER_GUARD;
|
||||
|
||||
MAD_OPTION_IGNORECRC = $0001; { ignore CRC errors }
|
||||
MAD_OPTION_HALFSAMPLERATE = $0002; { generate PCM at 1/2 sample rate }
|
||||
{$if defined(false)} { not yet implemented }
|
||||
MAD_OPTION_LEFTCHANNEL = $0010; { decode left channel only }
|
||||
MAD_OPTION_RIGHTCHANNEL = $0020; { decode right channel only }
|
||||
MAD_OPTION_SINGLECHANNEL = $0030; { combine channels }
|
||||
{$ifend}
|
||||
|
||||
procedure mad_stream_init(var stream: mad_stream); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_stream_finish(var stream: mad_stream); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_stream_options(stream: mad_stream; opts: cint);
|
||||
procedure mad_stream_buffer(var stream: mad_stream; buffer: pcuchar; length: culong); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_stream_skip(var stream: mad_stream; length: culong); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_stream_sync(var stream: mad_stream): cint; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_stream_errorstr(var stream: mad_stream): pcchar; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
|
||||
|
||||
(***********************************************************************)
|
||||
(* Header : frame.h *)
|
||||
(***********************************************************************)
|
||||
|
||||
type
|
||||
mad_layer = (
|
||||
MAD_LAYER_I = 1, { Layer I }
|
||||
MAD_LAYER_II = 2, { Layer II }
|
||||
MAD_LAYER_III = 3 { Layer III }
|
||||
);
|
||||
|
||||
mad_mode = (
|
||||
MAD_MODE_SINGLE_CHANNEL = 0, { single channel }
|
||||
MAD_MODE_DUAL_CHANNEL = 1, { dual channel }
|
||||
MAD_MODE_JOINT_STEREO = 2, { joint (MS/intensity) stereo }
|
||||
MAD_MODE_STEREO = 3 { normal LR stereo }
|
||||
);
|
||||
|
||||
mad_emphasis = (
|
||||
MAD_EMPHASIS_NONE = 0, { no emphasis }
|
||||
MAD_EMPHASIS_50_15_US = 1, { 50/15 microseconds emphasis }
|
||||
MAD_EMPHASIS_CCITT_J_17 = 3, { CCITT J.17 emphasis }
|
||||
MAD_EMPHASIS_RESERVED = 2 { unknown emphasis }
|
||||
);
|
||||
|
||||
mad_header = record
|
||||
layer : mad_layer; { audio layer (1, 2, or 3) }
|
||||
mode : mad_mode; { channel mode (see above) }
|
||||
mode_extension : cint; { additional mode info }
|
||||
emphasis : mad_emphasis; { de-emphasis to use (see above) }
|
||||
bitrate : culong; { stream bitrate (bps) }
|
||||
samplerate : cuint; { sampling frequency (Hz) }
|
||||
crc_check : cushort; { frame CRC accumulator }
|
||||
crc_target : cushort; { final target CRC checksum }
|
||||
flags : cint; { flags (see below) }
|
||||
private_bits : cint; { private bits (see below) }
|
||||
duration : mad_timer_t; { audio playing time of frame }
|
||||
end;
|
||||
|
||||
mad_overlap = array[0..1, 0..31, 0..17] of mad_fixed_t;
|
||||
|
||||
mad_frame = record
|
||||
header : mad_header; { MPEG audio header }
|
||||
options : cint; { decoding options (from stream) }
|
||||
{ synthesis subband filter samples }
|
||||
sbsample : packed array[0..1, 0..35, 0..31] of mad_fixed_t;
|
||||
overlap : ^mad_overlap; { Layer III block overlap data }
|
||||
end;
|
||||
|
||||
const
|
||||
MAD_FLAG_NPRIVATE_III = $0007; { number of Layer III private bits }
|
||||
MAD_FLAG_INCOMPLETE = $0008; { header but not data is decoded }
|
||||
|
||||
MAD_FLAG_PROTECTION = $0010; { frame has CRC protection }
|
||||
MAD_FLAG_COPYRIGHT = $0020; { frame is copyright }
|
||||
MAD_FLAG_ORIGINAL = $0040; { frame is original (else copy) }
|
||||
MAD_FLAG_PADDING = $0080; { frame has additional slot }
|
||||
|
||||
MAD_FLAG_I_STEREO = $0100; { uses intensity joint stereo }
|
||||
MAD_FLAG_MS_STEREO = $0200; { uses middle/side joint stereo }
|
||||
MAD_FLAG_FREEFORMAT = $0400; { uses free format bitrate }
|
||||
|
||||
MAD_FLAG_LSF_EXT = $1000; { lower sampling freq. extension }
|
||||
MAD_FLAG_MC_EXT = $2000; { multichannel audio extension }
|
||||
MAD_FLAG_MPEG_2_5_EXT = $4000; { MPEG 2.5 (unofficial) extension }
|
||||
|
||||
MAD_PRIVATE_HEADER = $0100; { header private bit }
|
||||
MAD_PRIVATE_III = $001f; { Layer III private bits (up to 5) }
|
||||
|
||||
function mad_nchannels(header: mad_header): cint;
|
||||
function mad_nsbsamples(header: mad_header): cint;
|
||||
procedure mad_header_init(var header: mad_header); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_header_finish(var header: mad_header);
|
||||
function mad_header_decode(var header: mad_header; var stream: mad_stream): cint; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_frame_init(var frame: mad_frame); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_frame_finish(var frame: mad_frame); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_frame_decode(var frame: mad_frame; var stream: mad_stream): cint; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_frame_mute(var frame: mad_frame); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
|
||||
|
||||
(***********************************************************************)
|
||||
(* Header : synth.h *)
|
||||
(***********************************************************************)
|
||||
|
||||
type
|
||||
mad_pcm = record
|
||||
samplerate : cuint; { sampling frequency (Hz) }
|
||||
channels : cushort; { number of channels }
|
||||
length : cushort; { number of samples per channel }
|
||||
{ PCM output samples [ch][sample] }
|
||||
samples : packed array [0..1, 0..1151] of mad_fixed_t;
|
||||
end;
|
||||
|
||||
mad_synth = record
|
||||
{ polyphase filterbank outputs [ch][eo][peo][s][v] }
|
||||
filter : array[0..1, 0..1, 0..1, 0..15, 0..7] of mad_fixed_t;
|
||||
phase : cuint; { current processing phase }
|
||||
pcm : mad_pcm; { PCM output }
|
||||
end;
|
||||
|
||||
const
|
||||
{ single channel PCM selector }
|
||||
MAD_PCM_CHANNEL_SINGLE = 0;
|
||||
|
||||
{ dual channel PCM selector }
|
||||
MAD_PCM_CHANNEL_DUAL_1 = 0;
|
||||
MAD_PCM_CHANNEL_DUAL_2 = 1;
|
||||
|
||||
{ stereo PCM selector }
|
||||
MAD_PCM_CHANNEL_STEREO_LEFT = 0;
|
||||
MAD_PCM_CHANNEL_STEREO_RIGHT = 1;
|
||||
|
||||
procedure mad_synth_init(var synth: mad_synth); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_synth_finish(var synth: mad_synth);
|
||||
procedure mad_synth_mute(var synth: mad_synth); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
procedure mad_synth_frame(var synth: mad_synth; var frame: mad_frame); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
|
||||
|
||||
(***********************************************************************)
|
||||
(* Header : decoder.h *)
|
||||
(***********************************************************************)
|
||||
|
||||
{$IFNDEF MAD_DISABLE_BUILTIN_DECODER}
|
||||
type
|
||||
mad_decoder_mode = (
|
||||
MAD_DECODER_MODE_SYNC = 0,
|
||||
MAD_DECODER_MODE_ASYNC = 1
|
||||
);
|
||||
|
||||
mad_flow = (
|
||||
MAD_FLOW_CONTINUE = $0000, { continue normally }
|
||||
MAD_FLOW_STOP = $0010, { stop decoding normally }
|
||||
MAD_FLOW_BREAK = $0011, { stop decoding and signal an error }
|
||||
MAD_FLOW_IGNORE = $0020 { ignore the current frame }
|
||||
);
|
||||
|
||||
async_struct = record
|
||||
pid : clong;
|
||||
_in : cint;
|
||||
_out : cint;
|
||||
end;
|
||||
|
||||
sync_struct = record
|
||||
stream : mad_stream;
|
||||
frame : mad_frame;
|
||||
synth : mad_synth;
|
||||
end;
|
||||
|
||||
mad_input_func = function(user: Pointer; var stream: mad_stream): mad_flow; cdecl;
|
||||
mad_header_func = function(user: Pointer; var header: mad_header): mad_flow; cdecl;
|
||||
mad_filter_func = function(user: Pointer; var frame: mad_frame): mad_flow; cdecl;
|
||||
mad_output_func = function(user: Pointer; var header: mad_header; var pcm: mad_pcm): mad_flow; cdecl;
|
||||
mad_error_func = function(user: Pointer; var stream: mad_stream; var frame: mad_frame): mad_flow; cdecl;
|
||||
mad_message_func = function(user, msg: Pointer; var l: cuint): mad_flow; cdecl;
|
||||
|
||||
mad_decoder = record
|
||||
mode : mad_decoder_mode;
|
||||
options : cint;
|
||||
async : async_struct;
|
||||
sync : ^sync_struct;
|
||||
data : pointer;
|
||||
InputFunc : mad_input_func;
|
||||
HeaderFunc : mad_header_func;
|
||||
FilterFunc : mad_filter_func;
|
||||
OutputFunc : mad_output_func;
|
||||
ErrorFunc : mad_error_func;
|
||||
MessageFunc : mad_message_func;
|
||||
end;
|
||||
|
||||
procedure mad_decoder_init(var decoder: mad_decoder; user: pointer; Input: mad_input_func; Header: mad_header_func; Filter: mad_filter_func; Output: mad_output_func; Error: mad_error_func; Message: mad_message_func); cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_decoder_finish(var decoder: mad_decoder): cint; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_decoder_run(var decoder: mad_decoder; mode: mad_decoder_mode): cint; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
function mad_decoder_message(var decoder: mad_decoder; msg: Pointer; var l: cuint): cint; cdecl; external {$IFDEF DYNLINK}madlib{$ENDIF};
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
{
|
||||
Developer of the MAD helpers for FreePascal
|
||||
Copyright (C) 2006 by Ivo Steinmann
|
||||
}
|
||||
{$IFDEF MAD_DISABLE_BUILTIN_DECODER}
|
||||
const
|
||||
MAD_INPUT_BUFFER_SIZE = 5*8192;
|
||||
|
||||
type
|
||||
mad_read_func = function(user: pointer; ptr: pointer; size: cuint): cuint; cdecl;
|
||||
mad_seek_func = function(user: pointer; offset: clong; whence: cint): clong; cdecl;
|
||||
mad_close_func = function(user: pointer): cint; cdecl;
|
||||
mad_tell_func = function(user: pointer): clong; cdecl;
|
||||
|
||||
pmad_decoder = ^mad_decoder;
|
||||
mad_decoder = record
|
||||
inbuf : array[0..MAD_INPUT_BUFFER_SIZE-1] of cuint8;
|
||||
stream : mad_stream;
|
||||
frame : mad_frame;
|
||||
synth : mad_synth;
|
||||
samplecnt : cint;
|
||||
sampleofs : cint;
|
||||
user : pointer;
|
||||
read : mad_read_func;
|
||||
seek : mad_seek_func;
|
||||
close : mad_close_func;
|
||||
tell : mad_tell_func;
|
||||
|
||||
// Userinfo
|
||||
sample_rate : cint;
|
||||
end;
|
||||
|
||||
function mad_decoder_init(user: pointer; read: mad_read_func; seek: mad_seek_func; close: mad_close_func; tell: mad_tell_func): pmad_decoder;
|
||||
function mad_decoder_read(decoder: pmad_decoder; buffer: pointer; length: cint): cint;
|
||||
procedure mad_decoder_free(decoder: pmad_decoder);
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
function MAD_VERSION_STRINGIZE(num: cint): String;
|
||||
begin
|
||||
MAD_VERSION_STRINGIZE := '';
|
||||
Str(num, MAD_VERSION_STRINGIZE);
|
||||
end;
|
||||
|
||||
function MAD_VERSION_STRING(num: cint): String;
|
||||
begin
|
||||
MAD_VERSION_STRING := MAD_VERSION_STRINGIZE(num);
|
||||
end;
|
||||
|
||||
function MAD_VERSION: String;
|
||||
begin
|
||||
MAD_VERSION :=
|
||||
MAD_VERSION_STRING(MAD_VERSION_MAJOR) + '.' +
|
||||
MAD_VERSION_STRING(MAD_VERSION_MINOR) + '.' +
|
||||
MAD_VERSION_STRING(MAD_VERSION_PATCH) +
|
||||
MAD_VERSION_EXTRA;
|
||||
end;
|
||||
|
||||
{function mad_f_tofixed(x: double): mad_fixed_t;
|
||||
begin
|
||||
Result := mad_fixed_t(x * double(1 shl MAD_F_FRACBITS) + 0.5);
|
||||
end;}
|
||||
|
||||
procedure mad_bit_finish(var bitptr: mad_bitptr);
|
||||
begin
|
||||
end;
|
||||
|
||||
function mad_bit_bitsleft(var bitptr: mad_bitptr): cushort;
|
||||
begin
|
||||
mad_bit_bitsleft := bitptr.left;
|
||||
end;
|
||||
|
||||
procedure mad_timer_reset(var timer: mad_timer_t);
|
||||
begin
|
||||
timer := mad_timer_zero;
|
||||
end;
|
||||
|
||||
function mad_timer_sign(timer: mad_timer_t): cint;
|
||||
begin
|
||||
mad_timer_sign := mad_timer_compare(timer, mad_timer_zero);
|
||||
end;
|
||||
|
||||
function MAD_RECOVERABLE(error: mad_error): Boolean;
|
||||
begin
|
||||
MAD_RECOVERABLE := word(error) and $ff00 > 0;
|
||||
end;
|
||||
|
||||
procedure mad_stream_options(stream: mad_stream; opts: cint);
|
||||
begin
|
||||
stream.options := opts;
|
||||
end;
|
||||
|
||||
procedure mad_header_finish(var header: mad_header);
|
||||
begin
|
||||
FillChar(header, sizeof(mad_header), 0);
|
||||
end;
|
||||
|
||||
function mad_nchannels(header: mad_header): cint;
|
||||
begin
|
||||
if longword(header.mode) <> 0 then
|
||||
mad_nchannels := 2 else
|
||||
mad_nchannels := 1;
|
||||
end;
|
||||
|
||||
function mad_nsbsamples(header: mad_header): cint;
|
||||
begin
|
||||
if header.layer = MAD_LAYER_I then mad_nsbsamples := 12 else
|
||||
if (header.layer = MAD_LAYER_III) and (header.flags and MAD_FLAG_LSF_EXT > 0)
|
||||
then mad_nsbsamples := 18
|
||||
else mad_nsbsamples := 36;
|
||||
end;
|
||||
|
||||
procedure mad_synth_finish(var synth: mad_synth);
|
||||
begin
|
||||
FillChar(synth, sizeof(mad_synth), 0);
|
||||
end;
|
||||
|
||||
{$IFDEF MAD_DISABLE_BUILTIN_DECODER}
|
||||
function mad_decoder_init(user: pointer; read: mad_read_func; seek: mad_seek_func; close: mad_close_func; tell: mad_tell_func): pmad_decoder;
|
||||
begin
|
||||
GetMem(Result, Sizeof(mad_decoder));
|
||||
FillChar(Result^, Sizeof(mad_decoder), 0);
|
||||
mad_stream_init(Result^.stream);
|
||||
mad_frame_init(Result^.frame);
|
||||
mad_synth_init(Result^.synth);
|
||||
Result^.user := user;
|
||||
Result^.read := read;
|
||||
Result^.seek := seek;
|
||||
Result^.close := close;
|
||||
Result^.tell := tell;
|
||||
end;
|
||||
|
||||
procedure mad_decoder_free(decoder: pmad_decoder);
|
||||
begin
|
||||
if not Assigned(decoder) then
|
||||
Exit;
|
||||
|
||||
mad_synth_finish(decoder^.synth);
|
||||
mad_frame_finish(decoder^.frame);
|
||||
mad_stream_finish(decoder^.stream);
|
||||
decoder^.close(decoder^.user);
|
||||
FreeMem(decoder);
|
||||
end;
|
||||
|
||||
function mad_decoder_read(decoder: pmad_decoder; buffer: pointer; length: cint): cint;
|
||||
var
|
||||
ofs, num, i: cint;
|
||||
inbuf_ptr: pointer;
|
||||
len, remaining: cint;
|
||||
begin
|
||||
// check blocksize here!
|
||||
|
||||
ofs := 0;
|
||||
num := length;
|
||||
|
||||
while num > 0 do
|
||||
begin
|
||||
if decoder^.samplecnt = 0 then
|
||||
begin
|
||||
if (decoder^.stream.buffer = nil) or (decoder^.stream.error = MAD_ERROR_BUFLEN) then
|
||||
begin
|
||||
if Assigned(decoder^.stream.next_frame) then
|
||||
begin
|
||||
remaining := ptrint(decoder^.stream.bufend) - ptrint(decoder^.stream.next_frame);
|
||||
inbuf_ptr := pointer(ptrint(@decoder^.inbuf) + remaining);
|
||||
len := MAD_INPUT_BUFFER_SIZE - remaining;
|
||||
Move(decoder^.stream.next_frame^, decoder^.inbuf, remaining);
|
||||
end else begin
|
||||
remaining := 0;
|
||||
len := MAD_INPUT_BUFFER_SIZE;
|
||||
inbuf_ptr := @decoder^.inbuf;
|
||||
end;
|
||||
|
||||
len := decoder^.read(decoder^.user, inbuf_ptr, len);
|
||||
if len <= 0 then
|
||||
Exit(ofs);
|
||||
|
||||
mad_stream_buffer(decoder^.stream, decoder^.inbuf, len+remaining);
|
||||
decoder^.stream.error := MAD_ERROR_NONE;
|
||||
end;
|
||||
|
||||
if mad_frame_decode(decoder^.frame, decoder^.stream) <> 0 then
|
||||
begin
|
||||
if MAD_RECOVERABLE(decoder^.stream.error) or (decoder^.stream.error = MAD_ERROR_BUFLEN) then
|
||||
Continue;
|
||||
|
||||
Exit(ofs);
|
||||
end;
|
||||
|
||||
mad_synth_frame(decoder^.synth, decoder^.frame);
|
||||
|
||||
with decoder^.synth do
|
||||
if pcm.channels = 2 then
|
||||
begin
|
||||
for i := 0 to pcm.length -1 do
|
||||
begin
|
||||
if pcm.samples[0][i] >= MAD_F_ONE then
|
||||
pcm.samples[0][i] := MAD_F_ONE - 1;
|
||||
if pcm.samples[0][i] < -MAD_F_ONE then
|
||||
pcm.samples[0][i] := -MAD_F_ONE;
|
||||
pcm.samples[0][i] := pcm.samples[0][i] shr (MAD_F_FRACBITS + 1 - 16 + 1);
|
||||
|
||||
if pcm.samples[1][i] >= MAD_F_ONE then
|
||||
pcm.samples[1][i] := MAD_F_ONE - 1;
|
||||
if pcm.samples[1][i] < -MAD_F_ONE then
|
||||
pcm.samples[1][i] := -MAD_F_ONE;
|
||||
pcm.samples[1][i] := pcm.samples[1][i] shr (MAD_F_FRACBITS + 1 - 16 + 1);
|
||||
end;
|
||||
end else begin
|
||||
for i := 0 to pcm.length -1 do
|
||||
begin
|
||||
if pcm.samples[0][i] >= MAD_F_ONE then
|
||||
pcm.samples[0][i] := MAD_F_ONE - 1;
|
||||
if pcm.samples[0][i] < -MAD_F_ONE then
|
||||
pcm.samples[0][i] := -MAD_F_ONE;
|
||||
pcm.samples[0][i] := pcm.samples[0][i] shr (MAD_F_FRACBITS + 1 - 16 + 1);
|
||||
pcm.samples[1][i] := pcm.samples[0][i];
|
||||
end;
|
||||
end;
|
||||
|
||||
decoder^.sampleofs := 0;
|
||||
decoder^.samplecnt := decoder^.synth.pcm.length;
|
||||
decoder^.sample_rate := decoder^.synth.pcm.samplerate;
|
||||
end;
|
||||
|
||||
len := num div 4;
|
||||
if len > decoder^.samplecnt then
|
||||
len := decoder^.samplecnt;
|
||||
|
||||
for i := 0 to len - 1 do
|
||||
begin
|
||||
pcint16(ptrint(buffer) + ofs + 0)^ := decoder^.synth.pcm.samples[0][decoder^.sampleofs];
|
||||
pcint16(ptrint(buffer) + ofs + 2)^ := decoder^.synth.pcm.samples[1][decoder^.sampleofs];
|
||||
|
||||
Inc(decoder^.sampleofs);
|
||||
Dec(decoder^.samplecnt);
|
||||
ofs := ofs + 4;
|
||||
num := num - 4;
|
||||
end;
|
||||
end;
|
||||
|
||||
Result := ofs;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
end.
|
2249
packages/modplug/Makefile
Normal file
2249
packages/modplug/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
25
packages/modplug/Makefile.fpc
Normal file
25
packages/modplug/Makefile.fpc
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Makefile.fpc for libmodplug bindings
|
||||
#
|
||||
|
||||
[package]
|
||||
name=modplug
|
||||
version=2.0.0
|
||||
|
||||
[target]
|
||||
units=modplug
|
||||
|
||||
[require]
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../..
|
||||
|
||||
[compiler]
|
||||
includedir=src
|
||||
sourcedir=src tests
|
||||
|
||||
[rules]
|
||||
.NOTPARALLEL:
|
29
packages/modplug/fpmake.pp
Normal file
29
packages/modplug/fpmake.pp
Normal file
@ -0,0 +1,29 @@
|
||||
{$ifndef ALLPACKAGES}
|
||||
{$mode objfpc}{$H+}
|
||||
program fpmake;
|
||||
|
||||
uses fpmkunit;
|
||||
|
||||
Var
|
||||
P : TPackage;
|
||||
T : TTarget;
|
||||
begin
|
||||
With Installer do
|
||||
begin
|
||||
{$endif ALLPACKAGES}
|
||||
|
||||
P:=AddPackage('modplug');
|
||||
{$ifdef ALLPACKAGES}
|
||||
P.Directory:='modplug';
|
||||
{$endif ALLPACKAGES}
|
||||
P.Version:='2.0.0';
|
||||
P.SourcePath.Add('src');
|
||||
|
||||
T:=P.Targets.AddUnit('modplug.pas');
|
||||
|
||||
|
||||
{$ifndef ALLPACKAGES}
|
||||
Run;
|
||||
end;
|
||||
end.
|
||||
{$endif ALLPACKAGES}
|
130
packages/modplug/src/modplug.pas
Normal file
130
packages/modplug/src/modplug.pas
Normal file
@ -0,0 +1,130 @@
|
||||
{
|
||||
Translation of the libmodplug headers for FreePascal
|
||||
Copyright (C) 2006 by Ivo Steinmann
|
||||
}
|
||||
|
||||
(*
|
||||
* This source code is public domain.
|
||||
*
|
||||
* Authors: Kenton Varda <temporal@gauge3d.org> (C interface wrapper)
|
||||
*)
|
||||
|
||||
unit modplug;
|
||||
|
||||
{$mode objfpc}
|
||||
{$MINENUMSIZE 4}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
ctypes;
|
||||
|
||||
{$IFDEF WINDOWS}
|
||||
{$DEFINE DYNLINK}
|
||||
{$ENDIF}
|
||||
|
||||
//{$DEFINE DYNLINK}
|
||||
|
||||
{$IFDEF DYNLINK}
|
||||
const
|
||||
{$IF Defined(WINDOWS)}
|
||||
modpluglib = 'libmodplug.dll';
|
||||
{$ELSEIF Defined(UNIX)}
|
||||
modpluglib = 'libmodplug.so';
|
||||
{$ELSE}
|
||||
{$MESSAGE ERROR 'DYNLINK not supported'}
|
||||
{$IFEND}
|
||||
{$ELSE}
|
||||
//{$LINKLIB stdc++}
|
||||
{$LINKLIB modplug}
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
type
|
||||
PModPlugFile = ^ModPlugFile;
|
||||
ModPlugFile = record
|
||||
end;
|
||||
|
||||
(* Load a mod file. [data] should point to a block of memory containing the complete
|
||||
* file, and [size] should be the size of that block.
|
||||
* Return the loaded mod file on success, or NULL on failure. *)
|
||||
function ModPlug_Load(data: pointer; size: cint): PModPlugFile; cdecl; external {$IFDEF DYNLINK}modpluglib{$ENDIF};
|
||||
|
||||
(* Unload a mod file. *)
|
||||
procedure ModPlug_Unload(_file: PModPlugFile); cdecl; external {$IFDEF DYNLINK}modpluglib{$ENDIF};
|
||||
|
||||
(* Read sample data into the buffer. Returns the number of bytes read. If the end
|
||||
* of the mod has been reached, zero is returned. *)
|
||||
function ModPlug_Read(_file: PModPlugFile; buffer: pointer; size: cint): cint; cdecl; external {$IFDEF DYNLINK}modpluglib{$ENDIF};
|
||||
|
||||
(* Get the name of the mod. The returned buffer is stored within the ModPlugFile
|
||||
* structure and will remain valid until you unload the file. *)
|
||||
function ModPlug_GetName(_file: PModPlugFile): pcchar; cdecl; external {$IFDEF DYNLINK}modpluglib{$ENDIF};
|
||||
|
||||
(* Get the length of the mod, in milliseconds. Note that this result is not always
|
||||
* accurate, especially in the case of mods with loops. *)
|
||||
function ModPlug_GetLength(_file: PModPlugFile): cint; cdecl; external {$IFDEF DYNLINK}modpluglib{$ENDIF};
|
||||
|
||||
(* Seek to a particular position in the song. Note that seeking and MODs don't mix very
|
||||
* well. Some mods will be missing instruments for a short time after a seek, as ModPlug
|
||||
* does not scan the sequence backwards to find out which instruments were supposed to be
|
||||
* playing at that time. (Doing so would be difficult and not very reliable.) Also,
|
||||
* note that seeking is not very exact in some mods -- especially those for which
|
||||
* ModPlug_GetLength() does not report the full length. *)
|
||||
procedure ModPlug_Seek(_file: PModPlugFile; millisecond: cint); cdecl; external {$IFDEF DYNLINK}modpluglib{$ENDIF};
|
||||
|
||||
|
||||
const
|
||||
// _ModPlug_Flags
|
||||
MODPLUG_ENABLE_OVERSAMPLING = 1 shl 0; (* Enable oversampling (highly recommended) *)
|
||||
MODPLUG_ENABLE_NOISE_REDUCTION = 1 shl 1; (* Enable noise reduction *)
|
||||
MODPLUG_ENABLE_REVERB = 1 shl 2; (* Enable reverb *)
|
||||
MODPLUG_ENABLE_MEGABASS = 1 shl 3; (* Enable megabass *)
|
||||
MODPLUG_ENABLE_SURROUND = 1 shl 4; (* Enable surround sound. *)
|
||||
|
||||
// _ModPlug_ResamplingMode
|
||||
MODPLUG_RESAMPLE_NEAREST = 0; (* No interpolation (very fast, extremely bad sound quality) *)
|
||||
MODPLUG_RESAMPLE_LINEAR = 1; (* Linear interpolation (fast, good quality) *)
|
||||
MODPLUG_RESAMPLE_SPLINE = 2; (* Cubic spline interpolation (high quality) *)
|
||||
MODPLUG_RESAMPLE_FIR = 3; (* 8-tap fir filter (extremely high quality) *)
|
||||
|
||||
type
|
||||
PModPlug_Settings = ^ModPlug_Settings;
|
||||
ModPlug_Settings = record
|
||||
mFlags : cint; (* One or more of the MODPLUG_ENABLE_* flags above, bitwise-OR'ed *)
|
||||
|
||||
(* Note that ModPlug always decodes sound at 44100kHz, 32 bit, stereo and then
|
||||
* down-mixes to the settings you choose. *)
|
||||
mChannels : cint; (* Number of channels - 1 for mono or 2 for stereo *)
|
||||
mBits : cint; (* Bits per sample - 8, 16, or 32 *)
|
||||
mFrequency : cint; (* Sampling rate - 11025, 22050, or 44100 *)
|
||||
mResamplingMode : cint; (* One of MODPLUG_RESAMPLE_*, above *)
|
||||
|
||||
mReverbDepth : cint; (* Reverb level 0(quiet)-100(loud) *)
|
||||
mReverbDelay : cint; (* Reverb delay in ms, usually 40-200ms *)
|
||||
mBassAmount : cint; (* XBass level 0(quiet)-100(loud) *)
|
||||
mBassRange : cint; (* XBass cutoff in Hz 10-100 *)
|
||||
mSurroundDepth : cint; (* Surround level 0(quiet)-100(heavy) *)
|
||||
mSurroundDelay : cint; (* Surround delay in ms, usually 5-40ms *)
|
||||
mLoopCount : cint; (* Number of times to loop. Zero prevents looping. -1 loops forever. *)
|
||||
end;
|
||||
|
||||
(* Get and set the mod decoder settings. All options, except for channels, bits-per-sample,
|
||||
* sampling rate, and loop count, will take effect immediately. Those options which don't
|
||||
* take effect immediately will take effect the next time you load a mod. *)
|
||||
procedure ModPlug_GetSettings(settings: PModPlug_Settings); cdecl; external {$IFDEF DYNLINK}modpluglib{$ENDIF};
|
||||
procedure ModPlug_SetSettings(const settings: PModPlug_Settings); cdecl; external {$IFDEF DYNLINK}modpluglib{$ENDIF};
|
||||
|
||||
implementation
|
||||
|
||||
function cppNew(s: cint): pointer; cdecl; public; alias : '_Znaj'; alias : '_Znwj';
|
||||
begin
|
||||
GetMem(Result, s);
|
||||
end;
|
||||
|
||||
procedure cppDelete(p: pointer); cdecl; public; alias : '_ZdlPv'; alias : '_ZdaPv';
|
||||
begin
|
||||
FreeMem(p);
|
||||
end;
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user