mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Initial commit
added libraries: opus flac libsndfile updated: libvorbis libogg openal - Everything works as expected for now. Bare in mind libsndfile needed the check for whether or not it could find the xiph libraries removed in order for this to work.
This commit is contained in:
parent
05a083ca6f
commit
a745fc3757
1954 changed files with 431332 additions and 21037 deletions
16
Engine/lib/libsndfile/.editorconfig
Normal file
16
Engine/lib/libsndfile/.editorconfig
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{h,hpp,c,tpl,def}]
|
||||
indent_style = tab
|
||||
tab_width = 4
|
||||
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
235
Engine/lib/libsndfile/AUTHORS
Normal file
235
Engine/lib/libsndfile/AUTHORS
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
Original author:
|
||||
|
||||
The main author of libsndfile is Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
apart from code in the following directories:
|
||||
|
||||
- src/GSM610 : Written by Jutta Degener <jutta@cs.tu-berlin.de> and Carsten
|
||||
Bormann <cabo@cs.tu-berlin.de>. They should not be contacted in relation to
|
||||
libsndfile or the GSM 6.10 code that is part of libsndfile. Their original
|
||||
code can be found at:
|
||||
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
|
||||
- src/G72x : Released by Sun Microsystems, Inc. to the public domain. Minor
|
||||
modifications were required to integrate these files into libsndfile. The
|
||||
changes are listed in src/G72x/ChangeLog.
|
||||
|
||||
Current maintainers:
|
||||
|
||||
After the release of version 1.0.30, @erikd transferred the project to
|
||||
[the libsndfile team](https://github.com/libsndfile) consisting of:
|
||||
|
||||
* Erik de Castro Lopo aka @erikd
|
||||
* David Seifert aka @SoapGentoo
|
||||
* Arthur Taylor aka @arthurt
|
||||
* @evpobr
|
||||
|
||||
Current releaser is David Seifert:
|
||||
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v2
|
||||
|
||||
mQINBFppABgBEAC42ZiNvV7BTIgR6TQy0YnF54fx3mVRP1u8Mq00UZa7reAsNKh7
|
||||
1H60j0W4s6+4pVVIKGfpVGxLwUdJe+KVCYw1Cd3YW6uMf5zZrC/ZWqnJiH/n6S6o
|
||||
1l4INII2o6YbGBnzIWBPRo7PlOL+mvgKTLpBSJPnhD8XDGN5wRiV8rL2+6Dptg0F
|
||||
nJt7oxECGF3OD3gk6HMel0o82CVkIqMtNaX1L/bhcdF7K0Rp2MXPZMmpn1izW5sI
|
||||
asN1G9+w+Zwj7kMJzq1Aw3ac+rsX4SEYdvXjS2QhDHQUIr6LXri3D2WbcEqIZj2R
|
||||
JVoVwblsrG11dYXFDBbgrq4NhgTBsxHYDlkr/qF2W+kbPC/nhSqTVZeCYvTBZbOQ
|
||||
+RqyN/I0izukglnWmV1jGijFA8snyP8efx732hw/24zRYmtXOtnEITUpw8WOeZCq
|
||||
6uiHaQ+eopnY2ojBg9BI7WZm0AFn58xxT9soMsyFOUFgXTqaWFZWlJ3fhZE8/0v8
|
||||
JEu/kPGE5aJReT3b34B+Bojkj74XR+h2u7iJJBHMTE8RwGoUOZHer/XsL9xlcdks
|
||||
I+7TCjiq++ShaSSt2XsJmw2BhREohrjW/2KkwmvT3b44RMpKPB4WTH+++aqJQNeM
|
||||
IqmswOMoZvzEZezInj7WVY/r0WEei1Y6wt1tBrJ/cFf1oQBM1UmphxcrfQARAQAB
|
||||
tB9EYXZpZCBTZWlmZXJ0IDxzb2FwQGdlbnRvby5vcmc+iQJUBBMBCgA+BQsJCAcD
|
||||
BRUKCQgLBRYCAwEAAh4BAheAAhsBFiEEMdlcq22A0mIkShdQpHYg6AHkfpUFAl/V
|
||||
CvoFCQkuceIACgkQpHYg6AHkfpXYxA//aiJW1NwunpmzEc62id8lRMnoLHWVjISZ
|
||||
b+xSlm+hk4LYq+ZbthJDzKcT86/3DJOSE1zQw9wLuCao9IW2UfFJQBtR+TAfbagG
|
||||
0Yyk/kMcLoFJxnG1ywdJWypCAauuIhia52Z7PmmjsBbFwr6LygDwSQmZAyACMAs7
|
||||
TLQe+yERc2RNDsIEsquLSxxRF0Spk9gagWtKgrPc2XBjuNtQDwW7JgsOUoEeHyxC
|
||||
29fRUjC3o/pG2I6iAZp17OROZI5yl4TSORrSBDGIi2sayxyxP0x+IPKtrCUcBGNx
|
||||
wGp+56bP/V0hA6sgCPh/iwvqLoeibso6l/Kd4ltVAEQnHTd6fr8g+wLEUXfbJVTR
|
||||
7aeFUoaFmWjSPlQrNr6HlxSLV/kRx9kVJp1Pn16vkfVBF7fG7iDLiqphwEeQg5ND
|
||||
nmGeKAbRRNxFHyBHf0XRsaYiFZQckguO+71XSRtVx8/YP5nyNbtl9y1h/4JlT6Gy
|
||||
t7hb5twYFQyQrKss83E/Bo1sRdHpj0ibtqb4ZbYANbh482E6yFhAkuo8YjVTJipI
|
||||
1Ve8EBKnX3R+pDt147uyysNvtPVXML+sWpGSMVSm4NA8uT3F5nqxVwj+SeXy3Wq/
|
||||
CHQ2VBKGBC655G+wFD5C6O7cTx2MwH+2H8tzhWm+gFlI3MFKEXa/PC+YUC/diYcb
|
||||
BrApavriTRa5Ag0EWmkAZgEQAPXMD3mZI+ChvBysXZWksC88/uSEwFeb3XkcRm7v
|
||||
04GN7hcz+bfrmnUTB3tuE/ZQgv+u7ZjetvH1aEKieznn/GjnWoOBoJusOYvfAQeF
|
||||
0mQVi118QiOZRCnEZpkz+RY9TiXVgrZJg+AGqHZ3Ol4GkInEV2NWgH37Xal+HkFl
|
||||
rwI2U7mL0kZRG+LAVCQHKzqU0R0HE1XyJ4qf0awtG5Qi/TZvgXBdZPDXgr8i9Vlf
|
||||
UUu10c2XnXM0Av/YAlZmBFjVYrSOUCFenqSVqL+s9sTCVdWlJrGjrr3Ja4uT3kl2
|
||||
rLva0AR4oSQoxt8adKohmFz0vzOkQtCoRzhrCwoo3JvNjKdSNoOP1nSsxlO5ji8r
|
||||
ih5d+ajPgi580XyHLnrvG7vobR48qqscv1hizKuCgTacOTe6Db2Gqc8xF6v8HhJa
|
||||
KwWJtmFllIfN/tIvZ6BbbgHQn0IGf4CYnWf0SksPZqpBmTRpD2jfBxcj2UEg+AR3
|
||||
LARjuyUVpFJScyu6ExQG+6O+ByLL31iWP5MgUrza1rIpriPa3NT3rZ3DG2pvQrS3
|
||||
ySsrPzH7VRX8L1ThSMSzjwF96aMsd14s7XzR4EzNuWwZDukfs0yavZk6l4o1M0mb
|
||||
tbJi7hE4cz13KRHYvIkKMdZGYUnzRzZUDlsj2imakk3BR6GXnxZ1ST6062g+QxiL
|
||||
AJFLABEBAAGJBHIEGAEKACYCGwIWIQQx2VyrbYDSYiRKF1CkdiDoAeR+lQUCX9UL
|
||||
DQUJCS5xpwJAwXQgBBkBCgAdFiEEuNUxXaAAcsCoYIifzjbhFyAuOEIFAlppAGYA
|
||||
CgkQzjbhFyAuOELmrQ/9H9wrWsWa21STZdxUmyU2sh9VXAWEHl1Ey0fVTznDM0Fl
|
||||
zx5YSR/TmmnE36rpaz31Ttkx8SP914oV+mMgseecdya9Bf6uZL9Cv7V3KEsJBRL/
|
||||
ncrOWQBHP/Xy1X+mLD6A19xq7H4RihSLj0LeK2YVjrJzJ7wMf4mKXuBayQeAHImU
|
||||
WRCRTbmK3umh2nB5V0iPd/XZEIiYtiTPe+7E/va6+0bBvOumF3a+Z0iui7eU4hFC
|
||||
7Jk71D0dcg09SlIaNoMOrw7cMC3j2pMdKtsj8+0I6WBv14PhhqPAsnjdf7I/4NfK
|
||||
L7Jav8T/gDS01uA2Jxm72d+wr+eSjOBXa6x8CEbTqfkjAGxsWENThCp6zDkaXSDd
|
||||
JsV0va47vjzG8+wTDAvPy5IxIM/KZZdl4uWM+mF5K+q+eSTOHe7aLF2OdcussoBA
|
||||
A18zm994dAkG1COX/qpxanxx2bv/2IvCGPg+x6JtAN8ji2kncWu3dWGQdE5XbVjc
|
||||
fDwgsUPpp04G27Mr/x+HpEbgZ5SdA0dAqJktlNvCcHALhlblCWrsh/1QNjT/2iG8
|
||||
wsjcpEy/s4tWAuV4PTa4xvZ1JPS7Z7Eo5aBy9ZGOWG9SrHEiHnhkUsiswbHBOEjd
|
||||
pBSkmNElDcv9fRUahVCTPfvWBATFDrQyMjJBSm+cV8c/iFQM7isVSu8W7E0eetsJ
|
||||
EKR2IOgB5H6Vv9sP/1dxTvH0N0UoEoxIG/hnirEkbRpljdvqy4/uikYBKyQgSbo8
|
||||
VITTjea7gIhDztil9WZYt35jbOmoaGM2Z6TP2LEDOWgljYUNq9pl9Sc2GS8cNtEO
|
||||
WxExzGOc1Flo730dX3A85Ks3+0WPXZjLDcRRcPVkFd5WLQQDV1YVYopWkuQBC+Br
|
||||
4q3uv+sk+bw6gDa9+zFBbDuegdsYuTXrFHoxHz2GRv9Yb7ULCMgpFeNKDgtQq91u
|
||||
RqewoTwQp9tlp91LH/hh7R0Q4DRgeFDkLnVRXwSKjVvCrT5cBgImGwtFTGS4egoy
|
||||
MDKd/KKjZllp1ahRCln1XfmFQyQVMVvuF/JTtt31n6KwXwK2yxIlXB01xvRH+Ees
|
||||
AWeRYWKWXydaAY/9Ve0/PLFlgsr/XUGvt0GoEKe7odD3nZgg6015+/8JTroKw19L
|
||||
NZkhdfFMl11Zi0j5k3UbyzjYVpFSd8K2o0VoOG1LFsPp8tlRxNoVzpId0CX1au/p
|
||||
y1H7Wy/39mzriRG3rw+mJAQbBjN09putCltXFXpOEWk08n/N3vufCVQUoSu/2Bqw
|
||||
2HYj8VtToQp+O5dG3XxvDHINtInP1yr2Wcw2plna0KoXLwv/lZgDm3LN+eCWpG6d
|
||||
N/xk25DTSqTHArUQIEkhcHYK6GnyxUcvoKtG88hXtqEPYXiK08FZYAUPTnDYuQIN
|
||||
BFppAIkBEADDjvQZUs1NoqJpxkD2QDBudU1DBCaeI1D6CancMtb5FebPUxgFlDMd
|
||||
CBGOun48dY5i87gDhT/qS3gP/Mv9rjKJmcG9JHfhpXdW73owxrcsQ96nxxVJNEVl
|
||||
UHJw00z8C9eGWqr0SzSoE33K/PkzSkgtsaotF6+3uCerWulweulmGa5dpVfV0mbS
|
||||
aVw8VmrhZ5NmCeodyy/lR85rPik5pb32NT6v7xBkgkfS0VYtPB2E5gW1pXX/jEOi
|
||||
Mfq9idOEP9lxrNXV9j49Lr0JQCwAcrYbQ2+VPe6eacJEjzJ/6HiUqhPrYdnvydmb
|
||||
hU+xmv2NjGp2UnDZDEhzQfwm6fMx+8Nx2uPzCnXQGoyRBwiC/KcdW0F1ZPKdSXqH
|
||||
NKoOF62pLvIMSmfI3ZVOrTohArfr1kFEYVDv9Nl7oY+qg2rZEc2srOF74a9Z46bR
|
||||
TDPsEQzE2UMCvu3+rofhSD7aRotlKeDCvbe2s0yE4Man457Xc3LXh8Gva8CzCOLE
|
||||
2eMhNTsHIZk68WgXp3/uvE4Xy42myrk1AV8XXDdlWgx0Kc/I6tE59O5NVPSfuGvH
|
||||
1a15KKx0F6euEnYDKKpQ5PDR6dSn61po0tfbt96m044G/xQFjrfhHei4jji9Ogd9
|
||||
vlXVAi2vn3+NCSHFP5l3igLByBHy9iLIdmz7yQuus/1nwRmxOHOf2QARAQABiQI8
|
||||
BBgBCgAmAhsMFiEEMdlcq22A0mIkShdQpHYg6AHkfpUFAl/VCxkFCQkucZAACgkQ
|
||||
pHYg6AHkfpVPSRAAmheYkYJmtDbkzPBBnj5mbCIQN1/G5PI9eixc/TXWFOXtcjU1
|
||||
mJlJpSidHJyLRrx7r0c+N+s8vnY/JuUBsNoMJMER+Mv/CFW4iFi59V534SyAb2S0
|
||||
7NINJnFNkXBY62CDz9KsMuv/MdSv2yLhPH2Tfrm/eDRQesj1PanE4U1cgjWyJRc/
|
||||
IOlaRHvTasWDLgwbQi8ykt+4xUWzL/YKHzB+KyyzBK7vPBXqySX8ka4BOw7SDwG5
|
||||
lX2gtmhk4AGBwVChLXKflqVx1WXj4DPOt0kmOKVnKFyvUijK58M0A2FMgFMXDTIS
|
||||
DRtoZPdx/rkODXxgS+W+27NcYAnxJiM0cQqizEnQh7PQ1KzgdChPejYXMKe9lwdn
|
||||
ssMUxrBpbuAuagEf+pebNjD2eaNR4p8kfaDdGn53q55ysDvoyxKvnVQGSk1FAR9Q
|
||||
s4N5a4f02U7dzlyEhEfIcuUlRCfnlpn4n725YIhHheDig5zKWoEZCkNIfiRcGzDl
|
||||
8Drj+tlZiUR+gDkIoWSBaCkKbIQlc8qCYy6Hm7oZBaol6xKlUnTMK2rjK8fR4i8r
|
||||
bVDWBAaWj3jcDHJ0Jg3fS/qBpeya/JXMp89TR8NK5Ys7PZpWbor+puXBYyXDAVx3
|
||||
rXQ7JBA5klHPxrgjso1S/LqwscKLENtrVjdjhryLBmPifrmofJRnrpiHIEa5Ag0E
|
||||
WmkAswEQAL0hKwsRybQzkNGpJP+ElLSwFHd7XQhr+qIwLllpumWtnIK/DHmv8SpW
|
||||
FqAYajmRTXipFcBHH25x2jIIliZidn0a9826l+sMzrFadMC6/W4pitP71TeqZzwn
|
||||
pAuHs14YL7Wiy0aJQnfbCpRzPq3kYyOXmhmY7lPWO0WdUpR6W8wUbleK5XOVDDRx
|
||||
aIC/M3hhDOxZOMzQ+pdn4BaOFQQ0ygsRkqOudbuc0R1giYRt1i6gMeT8gfzL9jlw
|
||||
HcJ+aVnxdUQQ4uC47oKo/+lg7qh7LsiW79pQC1Bcdm8lhRmqtxe6ub60ecjax3XU
|
||||
1ILIEfIFCv6M7LRUAwz0bqk35spgkJqrGGKkdeWEKAFHg2QWR2F0zy+HdlPLfKxO
|
||||
uhaccpwc9EJtf744GS0SXa2AXr32j56n7CFcEjFcIQPBC6OJn6eA3hOVUYGZ7SrT
|
||||
4fsmZiFAdGEkvLKFuNhju1Hj2EJQUY1pm4GSBco7BR8x+QqoYrt5clU3WxRMNfTR
|
||||
0Rtuzsh4xskXNVMMgvKOahAtxENv2M2Cx6zJPVL5dmaysP7d6QRVeOQA5PwkcZ5Q
|
||||
qK6JtDZj2jpaKQH4Za715kiIcdqMDSkwxa6avc0kARHvfFcBR4hwDm1GAlaKG7eH
|
||||
8TOGGQIk8x2F3s4l8mTJVLWTP/uJYnkYBdqANYo5t1NIQLvwLFV3ABEBAAGJAjwE
|
||||
GAEKACYCGyAWIQQx2VyrbYDSYiRKF1CkdiDoAeR+lQUCX9ULIwUJCS5xcAAKCRCk
|
||||
diDoAeR+leekD/sF7aHH0W35ckWrXZlfSp0qHPWrBUaLBI9OAUHenRhgs4SbK0D4
|
||||
wqEiu0C5iDQojpXAeALQ8g/1pUsZ1yuFqYbGYWrHkA0Pm+P3tAGB4LMZ41YfvROP
|
||||
uaiW/+IMJbWllgRtaDt8/NtCgs30WI9I+az5M29HcGfvEwEUykrBx3dE9T+1ui3O
|
||||
capdd+GMvdAAsX5PyVkjWgZ7GrZeH8mG7UysYfT4qthxEtQfZ/u8ceSduKA46ugh
|
||||
C2eafIDNvluqn7BU4oKxME61u6C8BN2yHLI6LV0Tr4z5H8joVbM4BSFMwLVGlsXf
|
||||
HhB8kLiErN6bXolxsjARlmYiD9S9H2AcYidr6RYXf2EVFSpBG59xn1WTDN+DsHQf
|
||||
7btNPEPl/OPxa3OQjG+xn8USddiP0N0B4xsyzMNCCKDgvXXcIhX55KG9eh3Tc98S
|
||||
fEyhxu8ybZBIGmTJysPKxijfvSgQF+RPNTsz9lvXqkoK7RTgeYMschpjJEznCLbt
|
||||
M6eTDb5z0G5uLXh6+dYxtDOlPogI5OHd+G51LwCjvrQ+AtIUCgafuemwA9mpFT2b
|
||||
svb/qcxSVUb44bVaNHn1JHebX2YbokGtBOm1x2PI5fT8n6YIIYz3jKYOZAYdUT7x
|
||||
6qURyNjOfG4aPJIATwuh4GSNuxUG40+yuT+XfQF24mu1esS1J3wzRloJ7w==
|
||||
=K3x+
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
Previous releasers:
|
||||
|
||||
Version 1.0.29-1.0.30 - @evpobr.
|
||||
|
||||
The public GPG key:
|
||||
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
yMMwAnicrVJ7UFRVHF50SdiJ2AknHmYM19IhFrmPva91hnBKHMkcSyAyY7nn3nN3
|
||||
L7AP9qVoO5Lja1YUycgJ4iUFWYluTlE4Oi6PxdhpCkesIWiAQIbXqlSs1Ex1l7H/
|
||||
6r/OP2fOd77vm+/3za8nZqVCFVEfk/xkgPyrMiLgO+FUFIze8R5AgEUoR3QHkBK4
|
||||
fMFSAdod+hJJQHQIiqEYBzECYByBs4AnGBYDGIYDjqEYHMc4nKB5ntICkQSAxCke
|
||||
RTEaJ3AthWJaWccItIhyiAYRJbMB2qw2yeyQbVmA8aKAQxbHCZbXApxhIIqTIiug
|
||||
AiZiPA8IUhQZXhYaLfawQg4HODvcKFlkTH7ol+P9C/9/zu1cthMJlJG5NM+RFEUC
|
||||
nsIomiJIBhMIUmAwNky0Q5uZM0GZDV1WC7Ahbg0iYy6Jh+FaH/4ZJIfRCf6L7yi3
|
||||
hoG9EOgfSvVAMgtyd7LCBW12yWJGdJjM5B1SWItpWQwjtBjOahC4zyrZoF4KM0ia
|
||||
YlD5aBCrDbpkSxrwIkpwUO6YIHCUAjwOKEIUBFaAIsWKAJfrF7XyoJAGkIaUPD9g
|
||||
aSBwIkUIOIqEhykzWxAdKcfkDLKlXTKYOYfTBhF3l2+PUhGhUjwSuSK8UwpVtPqf
|
||||
TTv+gVoRyKt70PuZxj6oi7ZkZP481vcc2vJ6cV774dld3s3n3+3w+cXdW9YaVvc9
|
||||
ni8Nv6aOUqx5b/+Lexria1wn7c1DOxVnikYSV50eY0o7Lwatz3qqg6RHWVOVF3zm
|
||||
lai7u7ud7r7vh5Lrm+95j06OeWN+29SbkNVeW9X1Vs651NsF9K1jV7xzkRdz6N4f
|
||||
Vy+5B37qTr18Lclk9lx7o3cmP/+6Jbbl3qvj7w/PvTnVDyYiuxtSZlvtCZ2JT6yv
|
||||
21rw8tLXnDHhwv0/7kfnpgSNXxKLA/tyPRsunLxp8tw4e6zx6PGbwsxKsTopg9u1
|
||||
dkdzBxWf+VVb/tbUzZNtUzUpj0l1fiSUtu1UaHxwdOnj2JlI4fdfdyAh/5GqvbY5
|
||||
7YKy0hgabi89Ffen+qUNtZ+f90258OevKhf6S+p+qelSRh/64ZOihg87D857slVZ
|
||||
5wqttfExWb7LymH/oVjTpcWFt4u/uP3pC8YrwfY+ad2NpDuW5oqPZrKOFCoGzqgb
|
||||
t1jSF1Vph1c0qtZUds+PaAqpp/Mqhjo0yavKiid91emBiPaeb3s2uW8d9J6YXZiu
|
||||
T8p7tK+8yHp3ov4dcCk3lNY28s13ZePrW8ceVGc3zOT01/ibotLjdFZn9tmd67a3
|
||||
iCrDaJM7Y/9TY8XzHdPbTZ2wPG7bxFBg2LSx6WootqI1dF2fGutPzE0bzJzW/w3x
|
||||
usYz
|
||||
=XFTp
|
||||
-----END PGP MESSAGE-----
|
||||
|
||||
Versions before 1.0.29 - Erik de Castro Lopo.
|
||||
|
||||
The public GPG key:
|
||||
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEapGlzyLCTJmjXgE/z9z5H7JCrO0FAljgv0wACgkQz9z5H7JC
|
||||
rO2RhxAAnIuHquhkhaY8CVsIOGImMxEF8RKDyFoioV9RnckNzBb592EYxU9hS0MM
|
||||
cT6xPZU0bJa8CvmCxEABMlkk60JP4VmmOtWxD8EEyktbHGyao80mDR82yVKYv78L
|
||||
zTRzz/JoTncgwWz/QataMbkAfy3KpxkwDW87az0kzkqGuSm3Jg3medt+t/iBe0Wm
|
||||
jcxIexxEZCmIhty6VyaVEkGWax0zdJHe7aD9FK2C/R3DU5Byp4e9pcp/a8v74G1n
|
||||
dgD4S3YlqvJGuU9S6QD4PzsoWD1X8f6pHzxpRP/OkqHAe11sSRo6sSYYCjsYi9Ca
|
||||
IJSlVC1nMx9OUxxAA8ZqtnztOo7GZcJ5NAL5X3GNV6YfQ7Bqxvtr6QG26F06MB6i
|
||||
p08UC7NC0bxFsD3f07wY22QnbnM052rniTn5sqQZv+GVls6t1b3u1iHzEjAjlgvi
|
||||
eOjVVt/A8iaOzMbKC/3+SZ9/GYqbSAQOCIoWAXmhV9IaMQyQeLCIC1YD5NMGBXal
|
||||
HPfSHV0hSUDbKjAYXFigJRzFU125bXTgg+v13Kd0KklIEjoaZYZLAYs0BupXdjBf
|
||||
jSPv8pwUaXJkv9/bGH0Ot1fvwDqPDOlGFINQbGAWdxwsdhiYBeXMFeFNTEfiqEMz
|
||||
BhhMxKa+Mfd9fkrX4NNigGW5QgRBS+FHNLf6ZfiXSnBGjjxMcbI=
|
||||
=UUA0
|
||||
-----END PGP SIGNATURE-----
|
||||
|
||||
Others:
|
||||
|
||||
2013-03-07 Michael Pruett
|
||||
2013-02-11 Chris Roberts c.roberts@csrfm.com
|
||||
2012-03-17 IOhannes m zmoelnig
|
||||
2013-02-21 Jan Starry
|
||||
2012-01-20 Bodo
|
||||
2011-06-23 Tim van der Molen
|
||||
2010-12-01 Tim Blechmann
|
||||
2010-10-04 Matti Nykyri
|
||||
2010-09-17 Brian Lewis
|
||||
2010-02-22 Robin Gareus
|
||||
2010-01-07 Christian Weisgerber and Jacob Meuserto
|
||||
2009-10-18 Olivier Tristan
|
||||
2009-10-14, 2009-08-30 Uli Franke
|
||||
2009-06-24, 2008-11-19, 2004-09-22, 2004-06-17, 2003-05-03, 2003-05-02 Conrad Parker
|
||||
2009-05-22 Lennart Poettering
|
||||
2008-07-03, 2006-10-22, 2006-10-18 Fons Adriaensen
|
||||
2008-04-19 David Yeo
|
||||
2008-01-20 Yair K.
|
||||
2007-12-03 Robs
|
||||
2007-07-12 Ed Schouten
|
||||
2007-06-07 Trent Apted
|
||||
2007-04-14, 2003-12-12 André Pang
|
||||
2007-04-14 Reuben Thomas
|
||||
2006-11-09 Jonathan Woithe
|
||||
2006-03-26 Diego 'Flameeyes' Pettenò
|
||||
2006-03-17 Paul Davis
|
||||
2006-03-09 Jesse Chappell
|
||||
2006-01-09, 2005-12-28 John ffitch
|
||||
2005-09-21 David A. van Leeuwen
|
||||
2005-08-15 Mo DeJong
|
||||
2005-04-30 David Viens
|
||||
2004-12-29 Steve Baker
|
||||
2004-09-05 Denis Cote
|
||||
2004-06-28 Stanko Juzbasic
|
||||
2004-02-14 Frank Neumann
|
||||
2003-08-15 Axel Röbel
|
||||
2003-08-06 Peter Miller
|
||||
2003-07-21 Tero Pelander
|
||||
2003-02-10 Antoine Mathys
|
||||
2002-12-30 Marek Peteraj
|
||||
46
Engine/lib/libsndfile/Building-for-Android.md
Normal file
46
Engine/lib/libsndfile/Building-for-Android.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Building for Android
|
||||
|
||||
Assuming the Android Ndk is installed at location `/path/to/toolchain`, building
|
||||
libsndfile for Android (arm-linux-androideabi) should be as simple as:
|
||||
```
|
||||
autoreconf -vif
|
||||
export ANDROID_TOOLCHAIN_HOME=/path/to/android/toolchain
|
||||
./Scripts/android-configure.sh
|
||||
make
|
||||
```
|
||||
The `Scripts/android-configure.sh` contains four of variables; `ANDROID_NDK_VER`,
|
||||
`ANDROID_GCC_VER`, `ANDROID_API_VER` and `ANDROID_TARGET` that can be overridden
|
||||
by setting them before the script is run.
|
||||
|
||||
Since I (erikd), do almost zero Android development, I am happy accept patches
|
||||
for this documentation and script to improve its utility for real Android
|
||||
developers.
|
||||
|
||||
---
|
||||
|
||||
## Using CMake
|
||||
|
||||
(Tested on Linux)
|
||||
|
||||
For convenience, export the following variables:
|
||||
|
||||
```
|
||||
export ANDROID_ABI=arm64-v8a
|
||||
export ANDROID_PLATFORM_API_LEVEL=29
|
||||
export NDK_ROOT=/path/to/android/ndk
|
||||
```
|
||||
|
||||
Set `ANDROID_ABI`, `ANDROID_PLATFORM_API_LEVEL` according to your target system. Now cd into the libsndfile root directory, and run
|
||||
|
||||
```
|
||||
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$NDK_ROOT/build/cmake/android.toolchain.cmake -DANDROID_ABI=$ANDROID_ABI -DANDROID_PLATFORM=$ANDROID_PLATFORM_API_LEVEL
|
||||
```
|
||||
|
||||
cd into `build` and run make
|
||||
|
||||
```
|
||||
cd build
|
||||
make [-j <number of parallel jobs>]
|
||||
```
|
||||
|
||||
This will build libsndfile for android.
|
||||
190
Engine/lib/libsndfile/CHANGELOG.md
Normal file
190
Engine/lib/libsndfile/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.2.2] - 2023-08-13
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed invalid regex in src/create_symbols_file.py
|
||||
* Fixed passing null pointer to printf %s in tests
|
||||
|
||||
## [1.2.1] - 2023-08-12
|
||||
|
||||
### Added
|
||||
|
||||
* RISC OS support to `sndfile-play`, thanks @ccawley2011
|
||||
* Move semantics to `SndFileHandle` C++ class, thanks @haydaralaidrus
|
||||
|
||||
### Fixed
|
||||
|
||||
* Various typos, thanks @@uniontech-lilinjie
|
||||
* Handling of absolute `CMAKE_INSTALL_LIBDIR`/`CMAKE_INSTALL_INCLUDEDIR`, thanks
|
||||
@Staudey (issue #908)
|
||||
* Add `localtime_s` support to `sndfile-metadata-set`, thanks @neheb (issue #907)
|
||||
* Linking with CMake against `Ogg::ogg`, thanks @FtZPetruska
|
||||
* CMake `mpg123` module handling bugs, thanks @FtZPetruska
|
||||
* CMake dependencies handling, thanks @FtZPetruska
|
||||
* Various `Ogg` & `Opus` format fixes, thanks @weiliang (issue #888)
|
||||
* Redefining `ssize_t` when building with Autotools, thanks @ccawley2011
|
||||
(issue #934)
|
||||
* Bug related to incorrect `realloc` use, thanks @Halmoni100
|
||||
* Style errors, thanks to @arthurt
|
||||
* AIFF format related bugs, thanks to @arthurt
|
||||
* Reading of MP3 files without Xing or INFO headers, thanks @arthurt
|
||||
* Coding style of `src/mpeg_decode.c`, thanks @arthurt
|
||||
* Various documentation types, thanks @luzpaz
|
||||
* Intrinsics inclusion for MSVC and ARM64/ARM64EC, thanks @frysee
|
||||
* `sf_open_fd`() regression, thanks @brentr (PR #950)
|
||||
* WAV format related bug, thanks @magnus-nomono (issue #930)
|
||||
|
||||
### Removed
|
||||
|
||||
* Obsolete file `libsndfile.spec.in``, thanks @janstary
|
||||
|
||||
## [1.2.0] - 2022-12-25
|
||||
|
||||
### Fixed
|
||||
|
||||
* Searching for LAME dependency with CMake build system (issue #821).
|
||||
* CMake build from Autotools tarball (issue #816).
|
||||
* Build on UWP platform (issue #824).
|
||||
* Fix signed integer overflow (issue #785).
|
||||
* Skipping large wav chunks on stdin (PR #819).
|
||||
|
||||
### Removed
|
||||
|
||||
* Maximum samplerate limit, thanks @drmpeg, @justacec (issue #850).
|
||||
|
||||
In version 1.1.0, an artificial limit of 655350 Hz was created, but as it
|
||||
turned out, this is not enough for some scenarios.
|
||||
|
||||
## [1.1.0] - 2022-03-27
|
||||
|
||||
### Added
|
||||
|
||||
* MPEG Encode/Decode Support.
|
||||
|
||||
Uses libmpg123 for decode, liblame for encode. Encoding and decoding support
|
||||
is independent of each other and is split into separate files. MPEG support
|
||||
is generalized as subformats, `SF_FORMAT_MPEG_LAYER`(I,II,III) so that it
|
||||
might be used by other containers (`MPEG1WAVEFORMAT` for example), but also
|
||||
contains a major format `SF_FORMAT_MPEG` for 'mp3 files.'
|
||||
|
||||
Encoding Status:
|
||||
* Layer III encoding
|
||||
* ID3v1 writing
|
||||
* ID3v2 writing
|
||||
* Lame/Xing Tag writing
|
||||
* Bitrate selection command
|
||||
* VBR or CBR
|
||||
|
||||
Decoding Status:
|
||||
* Layers I/II/III decoding
|
||||
* ID3v1 reading
|
||||
* ID3v2 reading
|
||||
* Seeking
|
||||
* New fuzzer for OSS-Fuzz, thanks @DavidKorczynski.
|
||||
* This `CHANGELOG.md`. All notable changes to this project will be documented in
|
||||
this file. The old `NEWS` file has been renamed to `NEWS.OLD` and is no longer
|
||||
updated.
|
||||
* Add support for decoding MPEG III Audio in WAV files.
|
||||
* `SECURITY.md` file to give people instructions for reporting security
|
||||
vulnerabilities, thanks @zidingz.
|
||||
* Support for [Vcpkg manifest mode](https://vcpkg.readthedocs.io/en/latest/users/manifests/).
|
||||
|
||||
If you have problems with manifest mode, disable it with `VCPKG_MANIFEST_MODE`
|
||||
switch.
|
||||
* [Export CMake targets from the build tree (PR #802)](https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#exporting-targets-from-the-build-tree)
|
||||
* CIFuzz fuzzer, thanks to @AdamKorcz (PR #796)
|
||||
|
||||
### Changed
|
||||
|
||||
* `SFC_SET_DITHER_ON_READ` and `SFC_SET_DITHER_ON_WRITE` enums comments in
|
||||
public header, thanks @SmiVan (issue #677).
|
||||
* `ENABLE_SNDFILE_WINDOWS_PROTOTYPES` define is deprecated and not needed
|
||||
anymore.
|
||||
|
||||
Previously, in order for the [`sf_wchar_open`()](http://libsndfile.github.io/libsndfile/api.html#open)
|
||||
function to become available on the Windows platform, it was required to
|
||||
perform certain actions:
|
||||
|
||||
```c
|
||||
#include <windows.h>
|
||||
#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
|
||||
#including <sndfile.h>
|
||||
```
|
||||
|
||||
These steps are no longer required and the `sf_wchar_open`() function is
|
||||
always available on the Windows platform.
|
||||
* Use UTF-8 as internal path encoding on Windows platform.
|
||||
|
||||
This is an internal change to unify and simplify the handling of file paths.
|
||||
|
||||
On the Windows platform, the file path is always converted to UTF-8 and
|
||||
converted to UTF-16 only for calls to WinAPI functions.
|
||||
|
||||
The behavior of the functions for opening files on other platforms does not
|
||||
change.
|
||||
* Switch to .xz over .bz2 for release tarballs.
|
||||
* Disable static builds using Autotools by default. If you want static
|
||||
libraries, pass --enable-static to ./configure
|
||||
|
||||
### Fixed
|
||||
|
||||
* Typo in `docs/index.md`.
|
||||
* Typo in `programs/sndfile-convert.c`, thanks @fjl.
|
||||
* Memory leak in `caf_read_header`(), credit to OSS-Fuzz ([issue 30375](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30375)).
|
||||
* Stack overflow in `guess_file_type`(), thanks @bobsayshilol, credit to
|
||||
OSS-Fuzz ([issue 29339](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29339)).
|
||||
* Abort in fuzzer, thanks @bobsayshilol, credit to OSS-Fuzz
|
||||
([issue 26257](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26257)).
|
||||
* Infinite loop in `svx_read_header`(), thanks @bobsayshilol, credit to OSS-Fuzz
|
||||
([issue 25442](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25442)).
|
||||
* GCC and Clang pedantic warnings, thanks @bobsayshilol.
|
||||
* Normalisation issue when scaling floating point data to `int` in
|
||||
`replace_read_f2i`(), thanks @bobsayshilol, (issue #702).
|
||||
* Missing samples when doing a partial read of Ogg file from index till the end
|
||||
of file, thanks @arthurt (issue #643).
|
||||
* sndfile-salvage: Handle files > 4 GB on Windows OS
|
||||
* Undefined shift in `dyn_get_32bit`(), credit to OSS-Fuzz
|
||||
([issue 27366](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27366)).
|
||||
* Integer overflow in `nms_adpcm_update`(), credit to OSS-Fuzz
|
||||
([issue 25522](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25522)).
|
||||
* Integer overflow in `psf_log_printf`(), credit to OSS-Fuzz
|
||||
([issue 28441](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28441)),
|
||||
([issue 25624](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25624)).
|
||||
* ABI version incompatibility between Autotools and CMake build on Apple
|
||||
platforms.
|
||||
|
||||
Now ABI must be compatible with Autotools builds. Note that this change
|
||||
requires CMake >= 3.17 for building dylib on Apple platforms.
|
||||
|
||||
* Fix build with Autotools + MinGW toolchain on Windows platform.
|
||||
|
||||
See https://github.com/msys2/MINGW-packages/issues/5803 for details.
|
||||
|
||||
### Security
|
||||
|
||||
* Heap buffer overflow in `wavlike_ima_decode_block`(), thanks @bobsayshilol,
|
||||
credit to OSS-Fuzz ([issue 25530](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25530)).
|
||||
* Heap buffer overflow in `msadpcm_decode_block`(), thanks @bobsayshilol,
|
||||
credit to OSS-Fuzz ([issue 26803](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26803)).
|
||||
* Heap buffer overflow in `psf_binheader_readf`(), thanks @bobsayshilol,
|
||||
credit to OSS-Fuzz ([issue 26026](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26026)).
|
||||
* Index out of bounds in `psf_nms_adpcm_decode_block`(), credit to OSS-Fuzz
|
||||
([issue 25561](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25561)).
|
||||
* Heap buffer overflow in `flac_buffer_copy`(), thanks @yuawn, @bobsayshilol.
|
||||
* Heap buffer overflow in `copyPredictorTo24`(), thanks @bobsayshilol,
|
||||
credit to OSS-Fuzz ([issue 27503](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27503)).
|
||||
* Uninitialized variable in `psf_binheader_readf`(), thanks @shao-hua-li,
|
||||
credit to OSS-Fuzz ([issue 25364](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25364)).
|
||||
|
||||
[Unreleased]: https://github.com/libsndfile/libsndfile/compare/1.2.2...HEAD
|
||||
[1.2.2]: https://github.com/libsndfile/libsndfile/compare/1.2.1...1.2.2
|
||||
[1.2.1]: https://github.com/libsndfile/libsndfile/compare/1.2.0...1.2.1
|
||||
[1.2.0]: https://github.com/libsndfile/libsndfile/compare/1.1.0...1.2.0
|
||||
[1.1.0]: https://github.com/libsndfile/libsndfile/compare/1.0.31...1.1.0
|
||||
1604
Engine/lib/libsndfile/CMakeLists.txt
Normal file
1604
Engine/lib/libsndfile/CMakeLists.txt
Normal file
File diff suppressed because it is too large
Load diff
14
Engine/lib/libsndfile/CODEOWNERS
Normal file
14
Engine/lib/libsndfile/CODEOWNERS
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# The owners of this repository. In order of suggestions as reviewers.
|
||||
* @evpobr @SoapGentoo @arthurt @erikd
|
||||
|
||||
# Autotools
|
||||
configure.ac Makefile.am @SoapGentoo @erikd
|
||||
|
||||
# CMake
|
||||
CMakeLists.txt /cmake/ @evpobr
|
||||
|
||||
# Ogg Opus format
|
||||
/src/ogg_opus.c @arthurt
|
||||
|
||||
# Documentation
|
||||
/doc/ /man/ @evpobr
|
||||
49
Engine/lib/libsndfile/CONTRIBUTING.md
Normal file
49
Engine/lib/libsndfile/CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Contributing
|
||||
|
||||
## Submitting Issues
|
||||
|
||||
* If your issue is that libsndfile is not able to or is incorrectly reading one
|
||||
of your files, please include the output of the `sndfile-info` program run
|
||||
against the file.
|
||||
* If you are writing a program that uses libsndfile and you think there is a bug
|
||||
in libsndfile, reduce your program to the minimal example, make sure you compile
|
||||
it with warnings on (for GCC I would recommend at least `-Wall -Wextra`) and that
|
||||
your program is warning free, and that is is error free when run under Valgrind
|
||||
or compiled with AddressSanitizer.
|
||||
|
||||
## Submitting Patches
|
||||
|
||||
* Patches should pass all existing tests
|
||||
* Patches should pass all pre-commit hook tests.
|
||||
* Patches should always be submitted via a either Github "pull request" or a
|
||||
via emailed patches created using "git format-patch".
|
||||
* Patches for new features should include tests and documentation.
|
||||
* Commit messages should follow the ["How to Write a Git Commit Message"](https://chris.beams.io/posts/git-commit/) guide:
|
||||
1. Separate subject from body with a blank line
|
||||
2. Limit the subject line to 50 characters
|
||||
3. Capitalize the subject line
|
||||
4. Do not end the subject line with a period
|
||||
5. Use the imperative mood in the subject line
|
||||
6. Wrap the body at 72 characters
|
||||
7. Use the body to explain what and why vs. how
|
||||
|
||||
Additional rule: the commit message may contain a prefix. The prefix must
|
||||
contain the name of the feature or source file related to the commit and must
|
||||
end with a colon followed by the message body.
|
||||
|
||||
Examples of good commit messages:
|
||||
1. Fix typo
|
||||
2. Update CHANGELOG.md
|
||||
3. Add ACT file format support
|
||||
4. ogg_vorbis: Fix granule position when seeking Vorbis streams
|
||||
|
||||
Examples of bad commit messages:
|
||||
1. Fixed bug (rule 5)
|
||||
2. update docs (rule 3)
|
||||
3. Add very cool feature. (rule 4)
|
||||
|
||||
* Patches to fix bugs should either pass all tests, or modify the tests in some
|
||||
sane way.
|
||||
* When a new feature is added for a particular file format and that feature
|
||||
makes sense for other formats, then it should also be implemented for one
|
||||
or two of the other formats.
|
||||
503
Engine/lib/libsndfile/COPYING
Normal file
503
Engine/lib/libsndfile/COPYING
Normal file
|
|
@ -0,0 +1,503 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
3
Engine/lib/libsndfile/ChangeLog
Normal file
3
Engine/lib/libsndfile/ChangeLog
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
For changes, please see the git commit history on github:
|
||||
|
||||
https://github.com/libsndfile/libsndfile/commits/master
|
||||
546
Engine/lib/libsndfile/Makefile.am
Normal file
546
Engine/lib/libsndfile/Makefile.am
Normal file
|
|
@ -0,0 +1,546 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_builddir)/include $(OS_SPECIFIC_CFLAGS)
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-werror
|
||||
|
||||
CLEANFILES = programs/*.wav octave-workspace
|
||||
|
||||
if FULL_SUITE
|
||||
if BUILD_OCTAVE_MOD
|
||||
SUBDIRS = Octave
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_DIST = sndfile.pc.in Scripts/android-configure.sh \
|
||||
NEWS.OLD CHANGELOG.md Scripts/linux-to-win-cross-configure.sh \
|
||||
CMakeLists.txt $(cmake_files) Win32 SECURITY.md
|
||||
|
||||
cmake_files = cmake/ClipMode.cmake cmake/FindFLAC.cmake \
|
||||
cmake/CMakeAutoGen.cmake cmake/CMakeAutoGenScript.cmake \
|
||||
cmake/FindOgg.cmake cmake/FindVorbis.cmake cmake/FindSndio.cmake \
|
||||
cmake/FindSpeex.cmake cmake/sqlite/FindSQLite3.cmake \
|
||||
cmake/SndFileChecks.cmake cmake/TestInline.cmake \
|
||||
cmake/TestLargeFiles.cmake cmake/TestInline.c.in \
|
||||
cmake/FindOpus.cmake cmake/SndFileConfig.cmake.in \
|
||||
cmake/CheckCPUArch.cmake cmake/CheckCPUArch.c.in \
|
||||
cmake/Findmp3lame.cmake cmake/Findmpg123.cmake \
|
||||
cmake/SetupABIVersions.cmake
|
||||
|
||||
pkgconfig_DATA = sndfile.pc
|
||||
|
||||
noinst_PROGRAMS =
|
||||
|
||||
#===============================================================================
|
||||
|
||||
test: check
|
||||
|
||||
# Need this target to force building of test programs.
|
||||
checkprograms: $(check_PROGRAMS)
|
||||
|
||||
########
|
||||
# src/ #
|
||||
########
|
||||
|
||||
BUILT_SOURCES = src/test_endswap.c
|
||||
|
||||
SYMBOL_FILES = src/Symbols.gnu-binutils src/Symbols.darwin src/libsndfile-1.def src/Symbols.os2 src/Symbols.static
|
||||
|
||||
EXTRA_DIST += src/config.h.in src/test_endswap.tpl src/test_endswap.def \
|
||||
$(SYMBOL_FILES) src/create_symbols_file.py src/binheader_writef_check.py \
|
||||
src/GSM610/README src/GSM610/COPYRIGHT src/GSM610/ChangeLog \
|
||||
src/G72x/README src/G72x/README.original src/G72x/ChangeLog \
|
||||
src/make-static-lib-hidden-privates.sh \
|
||||
src/config.h.cmake
|
||||
|
||||
if USE_WIN_VERSION_FILE
|
||||
WIN_VERSION_FILE = src/version-metadata.rc
|
||||
else
|
||||
WIN_VERSION_FILE =
|
||||
endif
|
||||
|
||||
#===============================================================================
|
||||
|
||||
lib_LTLIBRARIES = src/libsndfile.la
|
||||
include_HEADERS = include/sndfile.h include/sndfile.hh
|
||||
src_libsndfile_la_CFLAGS = $(EXTERNAL_XIPH_CFLAGS) $(MPEG_CFLAGS)
|
||||
# MinGW requires -no-undefined if a DLL is to be built.
|
||||
src_libsndfile_la_LDFLAGS = -no-undefined -version-info $(SHARED_VERSION_INFO) $(SHLIB_VERSION_ARG)
|
||||
src_libsndfile_la_SOURCES = src/sndfile.c src/aiff.c src/au.c src/avr.c src/caf.c src/dwd.c src/flac.c src/g72x.c src/htk.c src/ircam.c \
|
||||
src/macos.c src/mat4.c src/mat5.c src/nist.c src/paf.c src/pvf.c src/raw.c src/rx2.c src/sd2.c \
|
||||
src/sds.c src/svx.c src/txw.c src/voc.c src/wve.c src/w64.c src/wavlike.c src/wav.c src/xi.c src/mpc2k.c src/rf64.c \
|
||||
src/ogg.c src/ogg.h src/ogg_vorbis.c src/ogg_speex.c src/ogg_pcm.c src/ogg_opus.c src/ogg_vcomment.c src/ogg_vcomment.h \
|
||||
src/common.h src/sfconfig.h src/sfendian.h src/wavlike.h src/sf_unistd.h src/chanmap.h src/mpeg.c
|
||||
nodist_src_libsndfile_la_SOURCES = $(nodist_include_HEADERS)
|
||||
src_libsndfile_la_LIBADD = src/GSM610/libgsm.la src/G72x/libg72x.la src/ALAC/libalac.la \
|
||||
src/libcommon.la $(EXTERNAL_XIPH_LIBS) -lm $(MPEG_LIBS)
|
||||
EXTRA_src_libsndfile_la_DEPENDENCIES = $(SYMBOL_FILES)
|
||||
|
||||
noinst_LTLIBRARIES = src/libcommon.la
|
||||
src_libcommon_la_CFLAGS = $(EXTERNAL_XIPH_CFLAGS) $(MPEG_CFLAGS)
|
||||
src_libcommon_la_SOURCES = src/common.c src/file_io.c src/command.c src/pcm.c src/ulaw.c src/alaw.c \
|
||||
src/float32.c src/double64.c src/ima_adpcm.c src/ms_adpcm.c src/gsm610.c src/dwvw.c src/vox_adpcm.c \
|
||||
src/interleave.c src/strings.c src/dither.c src/cart.c src/broadcast.c src/audio_detect.c \
|
||||
src/ima_oki_adpcm.c src/ima_oki_adpcm.h src/alac.c src/chunk.c src/chanmap.c \
|
||||
src/windows.c src/id3.c src/id3.h src/nms_adpcm.c src/mpeg_decode.c src/mpeg_l3_encode.c src/mpeg.h $(WIN_VERSION_FILE)
|
||||
|
||||
check_PROGRAMS = src/test_main
|
||||
src_test_main_SOURCES = src/test_main.c src/test_main.h src/test_conversions.c src/test_float.c src/test_endswap.c \
|
||||
src/test_audio_detect.c src/test_log_printf.c src/test_file_io.c src/test_ima_oki_adpcm.c \
|
||||
src/test_strncpy_crlf.c src/test_broadcast_var.c src/test_cart_var.c \
|
||||
src/test_binheader_writef.c src/test_nms_adpcm.c
|
||||
src_test_main_LDADD = src/libcommon.la
|
||||
|
||||
##############
|
||||
# src/GSM610 #
|
||||
##############
|
||||
|
||||
noinst_LTLIBRARIES += src/GSM610/libgsm.la
|
||||
src_GSM610_libgsm_la_SOURCES = src/GSM610/config.h src/GSM610/gsm.h src/GSM610/gsm610_priv.h \
|
||||
src/GSM610/add.c src/GSM610/code.c src/GSM610/decode.c src/GSM610/gsm_create.c \
|
||||
src/GSM610/gsm_decode.c src/GSM610/gsm_destroy.c src/GSM610/gsm_encode.c \
|
||||
src/GSM610/gsm_option.c src/GSM610/long_term.c src/GSM610/lpc.c src/GSM610/preprocess.c \
|
||||
src/GSM610/rpe.c src/GSM610/short_term.c src/GSM610/table.c
|
||||
|
||||
############
|
||||
# src/G72x #
|
||||
############
|
||||
|
||||
noinst_LTLIBRARIES += src/G72x/libg72x.la
|
||||
src_G72x_libg72x_la_SOURCES = src/G72x/g72x.h src/G72x/g72x_priv.h \
|
||||
src/G72x/g721.c src/G72x/g723_16.c src/G72x/g723_24.c src/G72x/g723_40.c src/G72x/g72x.c
|
||||
|
||||
check_PROGRAMS += src/G72x/g72x_test
|
||||
src_G72x_g72x_test_SOURCES = src/G72x/g72x_test.c
|
||||
src_G72x_g72x_test_LDADD = src/G72x/libg72x.la
|
||||
|
||||
############
|
||||
# src/ALAC #
|
||||
############
|
||||
|
||||
noinst_LTLIBRARIES += src/ALAC/libalac.la
|
||||
src_ALAC_libalac_la_SOURCES = src/ALAC/ALACAudioTypes.h src/ALAC/ALACBitUtilities.h \
|
||||
src/ALAC/EndianPortable.h src/ALAC/aglib.h src/ALAC/dplib.h src/ALAC/matrixlib.h \
|
||||
src/ALAC/alac_codec.h src/ALAC/shift.h \
|
||||
src/ALAC/ALACBitUtilities.c src/ALAC/ag_dec.c \
|
||||
src/ALAC/ag_enc.c src/ALAC/dp_dec.c src/ALAC/dp_enc.c src/ALAC/matrix_dec.c \
|
||||
src/ALAC/matrix_enc.c src/ALAC/alac_decoder.c src/ALAC/alac_encoder.c
|
||||
|
||||
#===============================================================================
|
||||
# Generate an OS specific Symbols files. This is done when the author
|
||||
# builds the distribution tarball. There should be not need for the
|
||||
# end user to create these files.
|
||||
|
||||
# "$<" cannot portably be used in the recipe across Make implementations
|
||||
# https://www.gnu.org/software/autoconf/manual/autoconf.html#g_t_0024_003c-in-Ordinary-Make-Rules
|
||||
SYMBOL_SCRIPT = $(top_srcdir)/src/create_symbols_file.py
|
||||
|
||||
src/Symbols.gnu-binutils: $(SYMBOL_SCRIPT)
|
||||
$(PYTHON) $(SYMBOL_SCRIPT) linux $(ABI_VERSION) > $(top_srcdir)/$@
|
||||
|
||||
src/Symbols.darwin: $(SYMBOL_SCRIPT)
|
||||
$(PYTHON) $(SYMBOL_SCRIPT) darwin $(ABI_VERSION) > $(top_srcdir)/$@
|
||||
|
||||
src/libsndfile-1.def: $(SYMBOL_SCRIPT)
|
||||
$(PYTHON) $(SYMBOL_SCRIPT) win32 $(ABI_VERSION) > $(top_srcdir)/$@
|
||||
|
||||
src/Symbols.os2: $(SYMBOL_SCRIPT)
|
||||
$(PYTHON) $(SYMBOL_SCRIPT) os2 $(ABI_VERSION) > $(top_srcdir)/$@
|
||||
|
||||
src/Symbols.static: $(SYMBOL_SCRIPT)
|
||||
$(PYTHON) $(SYMBOL_SCRIPT) static $(ABI_VERSION) > $(top_srcdir)/$@
|
||||
|
||||
#===============================================================================
|
||||
# Building windows resource files (if needed).
|
||||
|
||||
.rc.lo:
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) $< -o $@
|
||||
|
||||
#===============================================================================
|
||||
# Disable autoheader.
|
||||
AUTOHEADER=echo
|
||||
|
||||
########
|
||||
# docs/ #
|
||||
########
|
||||
|
||||
if FULL_SUITE
|
||||
dist_doc_DATA = docs/index.md docs/libsndfile.jpg docs/libsndfile.css docs/print.css docs/api.md \
|
||||
docs/command.md docs/bugs.md docs/formats.md docs/sndfile_info.md docs/new_file_type_howto.md \
|
||||
docs/win32.md docs/FAQ.md docs/lists.md docs/embedded_files.md docs/octave.md \
|
||||
docs/tutorial.md
|
||||
endif
|
||||
|
||||
#############
|
||||
# examples/ #
|
||||
#############
|
||||
|
||||
check_PROGRAMS += examples/make_sine examples/sfprocess examples/list_formats examples/generate examples/sndfilehandle \
|
||||
examples/sndfile-to-text examples/sndfile-loopify
|
||||
|
||||
examples_sndfile_to_text_SOURCES = examples/sndfile-to-text.c
|
||||
examples_sndfile_to_text_LDADD = src/libsndfile.la
|
||||
|
||||
examples_sndfile_loopify_SOURCES = examples/sndfile-loopify.c
|
||||
examples_sndfile_loopify_LDADD = src/libsndfile.la
|
||||
|
||||
examples_make_sine_SOURCES = examples/make_sine.c
|
||||
examples_make_sine_LDADD = src/libsndfile.la
|
||||
|
||||
examples_sfprocess_SOURCES = examples/sfprocess.c
|
||||
examples_sfprocess_LDADD = src/libsndfile.la
|
||||
|
||||
examples_list_formats_SOURCES = examples/list_formats.c
|
||||
examples_list_formats_LDADD = src/libsndfile.la
|
||||
|
||||
examples_generate_SOURCES = examples/generate.c
|
||||
examples_generate_LDADD = src/libsndfile.la
|
||||
|
||||
examples_sndfilehandle_SOURCES = examples/sndfilehandle.cc
|
||||
examples_sndfilehandle_LDADD = src/libsndfile.la
|
||||
|
||||
##########
|
||||
# tests/ #
|
||||
##########
|
||||
|
||||
TESTS_ENVIRONMENT = $(SHELL) tests/test_wrapper.sh
|
||||
|
||||
if ENABLE_TEST_COVERAGE
|
||||
CPP_TEST =
|
||||
else
|
||||
CPP_TEST = tests/cpp_test
|
||||
endif
|
||||
|
||||
TESTS = tests/pedantic-header-test.sh
|
||||
|
||||
check_PROGRAMS += tests/sfversion tests/floating_point_test tests/write_read_test \
|
||||
tests/lossy_comp_test tests/error_test tests/ulaw_test tests/alaw_test tests/dwvw_test \
|
||||
tests/peak_chunk_test tests/command_test tests/stdio_test \
|
||||
tests/pcm_test tests/headerless_test tests/pipe_test tests/header_test tests/misc_test \
|
||||
tests/raw_test tests/string_test tests/multi_file_test tests/chunk_test \
|
||||
tests/scale_clip_test tests/win32_test tests/aiff_rw_test tests/virtual_io_test \
|
||||
tests/locale_test tests/win32_ordinal_test tests/ogg_test tests/compression_size_test \
|
||||
tests/checksum_test tests/external_libs_test tests/rdwr_test tests/format_check_test $(CPP_TEST) \
|
||||
tests/channel_test tests/long_read_write_test tests/stdin_test tests/stdout_test \
|
||||
tests/dither_test tests/fix_this tests/largefile_test tests/benchmark tests/ogg_opus_test \
|
||||
tests/mpeg_test
|
||||
|
||||
BUILT_SOURCES += \
|
||||
tests/write_read_test.c \
|
||||
tests/pcm_test.c \
|
||||
tests/header_test.c \
|
||||
tests/utils.c \
|
||||
tests/scale_clip_test.c \
|
||||
tests/pipe_test.c \
|
||||
tests/rdwr_test.c \
|
||||
tests/floating_point_test.c \
|
||||
tests/benchmark.c
|
||||
|
||||
EXTRA_DIST += $(BUILT_SOURCES) \
|
||||
tests/write_read_test.tpl tests/write_read_test.def \
|
||||
tests/pcm_test.tpl tests/pcm_test.def \
|
||||
tests/header_test.tpl tests/header_test.def \
|
||||
tests/utils.tpl tests/utils.def \
|
||||
tests/scale_clip_test.tpl tests/scale_clip_test.def \
|
||||
tests/pipe_test.tpl tests/pipe_test.def \
|
||||
tests/rdwr_test.tpl tests/rdwr_test.def \
|
||||
tests/floating_point_test.tpl tests/floating_point_test.def \
|
||||
tests/benchmark.tpl tests/benchmark.def
|
||||
|
||||
# If we're cross compiling from Linux to Windows and running the test suite
|
||||
# under Wine, we need a symbolic link to the generated libsndfile DLL.
|
||||
|
||||
if LINUX_MINGW_CROSS_TEST
|
||||
|
||||
$(check_PROGRAMS) : libsndfile-1.dll
|
||||
|
||||
libsndfile-1.dll :
|
||||
$(LN_S) src/.libs/$@ $@
|
||||
|
||||
clean-local :
|
||||
-rm -f libsndfile-1.dll
|
||||
|
||||
endif
|
||||
|
||||
#===============================================================================
|
||||
|
||||
tests_sfversion_SOURCES = tests/sfversion.c
|
||||
tests_sfversion_LDADD = src/libsndfile.la
|
||||
|
||||
tests_write_read_test_SOURCES = tests/utils.c tests/generate.c tests/generate.h tests/write_read_test.c tests/utils.h
|
||||
tests_write_read_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_lossy_comp_test_SOURCES = tests/utils.c tests/lossy_comp_test.c tests/utils.h
|
||||
tests_lossy_comp_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_fix_this_SOURCES = tests/utils.c tests/fix_this.c tests/utils.h
|
||||
tests_fix_this_LDADD = src/libsndfile.la
|
||||
|
||||
tests_error_test_SOURCES = tests/error_test.c tests/utils.c tests/utils.h
|
||||
tests_error_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_ulaw_test_SOURCES = tests/utils.c tests/ulaw_test.c tests/utils.h
|
||||
tests_ulaw_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_alaw_test_SOURCES = tests/utils.c tests/alaw_test.c tests/utils.h
|
||||
tests_alaw_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_aiff_rw_test_SOURCES = tests/utils.c tests/aiff_rw_test.c tests/utils.h
|
||||
tests_aiff_rw_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_command_test_SOURCES = tests/command_test.c tests/utils.c tests/utils.h
|
||||
tests_command_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_locale_test_SOURCES = tests/locale_test.c tests/utils.c tests/utils.h
|
||||
tests_locale_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_largefile_test_SOURCES = tests/largefile_test.c tests/utils.c tests/utils.h
|
||||
tests_largefile_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_pcm_test_SOURCES = tests/pcm_test.c tests/utils.c tests/utils.h
|
||||
tests_pcm_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_headerless_test_SOURCES = tests/utils.c tests/headerless_test.c tests/utils.h
|
||||
tests_headerless_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_stdin_test_SOURCES = tests/stdin_test.c tests/utils.c tests/utils.h
|
||||
tests_stdin_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_stdout_test_SOURCES = tests/stdout_test.c tests/utils.h
|
||||
tests_stdout_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_stdio_test_SOURCES = tests/stdio_test.c tests/utils.c tests/utils.h
|
||||
tests_stdio_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_pipe_test_SOURCES = tests/pipe_test.c tests/utils.c tests/utils.h
|
||||
tests_pipe_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_benchmark_SOURCES = tests/benchmark.c tests/utils.h
|
||||
tests_benchmark_LDADD = src/libsndfile.la
|
||||
|
||||
tests_header_test_SOURCES = tests/header_test.c tests/utils.c tests/utils.h
|
||||
tests_header_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_misc_test_SOURCES = tests/misc_test.c tests/utils.c tests/utils.h
|
||||
tests_misc_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_raw_test_SOURCES = tests/raw_test.c tests/utils.c tests/utils.h
|
||||
tests_raw_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_string_test_SOURCES = tests/string_test.c tests/utils.c tests/utils.h
|
||||
tests_string_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_dither_test_SOURCES = tests/dither_test.c tests/utils.c tests/utils.h
|
||||
tests_dither_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_chunk_test_SOURCES = tests/chunk_test.c tests/utils.c tests/utils.h
|
||||
tests_chunk_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_multi_file_test_SOURCES = tests/multi_file_test.c tests/utils.c tests/utils.h
|
||||
tests_multi_file_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_virtual_io_test_SOURCES = tests/virtual_io_test.c tests/utils.c tests/utils.h
|
||||
tests_virtual_io_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_ogg_test_SOURCES = tests/ogg_test.c tests/utils.c tests/utils.h
|
||||
tests_ogg_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_ogg_opus_test_SOURCES = tests/ogg_opus_test.c tests/utils.c tests/utils.h
|
||||
tests_ogg_opus_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_compression_size_test_SOURCES = tests/compression_size_test.c tests/utils.c tests/utils.h tests/dft_cmp.h
|
||||
tests_compression_size_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_rdwr_test_SOURCES = tests/rdwr_test.c tests/utils.c tests/utils.h
|
||||
tests_rdwr_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_win32_test_SOURCES = tests/win32_test.c
|
||||
# Link lib here so that generating the testsuite tarball works correctly.
|
||||
tests_win32_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_win32_ordinal_test_SOURCES = tests/win32_ordinal_test.c tests/utils.c tests/utils.h
|
||||
tests_win32_ordinal_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_external_libs_test_SOURCES = tests/external_libs_test.c tests/utils.c tests/utils.h
|
||||
tests_external_libs_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_format_check_test_SOURCES = tests/format_check_test.c tests/utils.c tests/utils.h
|
||||
tests_format_check_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_channel_test_SOURCES = tests/channel_test.c tests/utils.c tests/utils.h
|
||||
tests_channel_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_long_read_write_test_SOURCES = tests/long_read_write_test.c tests/utils.c tests/utils.h tests/dft_cmp.h
|
||||
tests_long_read_write_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_cpp_test_SOURCES = tests/cpp_test.cc tests/utils.c tests/utils.h
|
||||
tests_cpp_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_checksum_test_SOURCES = tests/checksum_test.c tests/utils.c tests/utils.h
|
||||
tests_checksum_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_mpeg_test_SOURCES = tests/mpeg_test.c tests/utils.c tests/utils.h
|
||||
tests_mpeg_test_LDADD = src/libsndfile.la
|
||||
|
||||
# Lite remove start
|
||||
tests_dwvw_test_SOURCES = tests/dwvw_test.c tests/utils.c tests/utils.h
|
||||
tests_dwvw_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_floating_point_test_SOURCES = tests/utils.c tests/utils.h tests/dft_cmp.c tests/dft_cmp.h tests/floating_point_test.c
|
||||
tests_floating_point_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_peak_chunk_test_SOURCES = tests/peak_chunk_test.c tests/utils.c tests/utils.h
|
||||
tests_peak_chunk_test_LDADD = src/libsndfile.la
|
||||
|
||||
tests_scale_clip_test_SOURCES = tests/scale_clip_test.c tests/utils.c tests/utils.h
|
||||
tests_scale_clip_test_LDADD = src/libsndfile.la
|
||||
# Lite remove end
|
||||
|
||||
#===============================================================================
|
||||
# Autogen generated sources.
|
||||
# Coerce the multiple inputs -> multiple outputs problem
|
||||
# into suffix rules by "linearising" the dependency graph.
|
||||
# Yes, this sucks, but GNU make patterns aren't portable,
|
||||
# see also https://github.com/libsndfile/libsndfile/issues/369
|
||||
|
||||
SUFFIXES = .tpl .def
|
||||
|
||||
.tpl.def:
|
||||
touch $@
|
||||
|
||||
# unconditionally running touch on the .def
|
||||
# files is necessary to keep all timestamps
|
||||
# consistent, in order to prevent stale files
|
||||
# from calling autogen in tarball releases.
|
||||
.def.c:
|
||||
$(MAKE) $(AM_MAKEFLAGS) $<
|
||||
cd $(top_srcdir)/$(@D) && autogen --writable $(<F)
|
||||
|
||||
# recommended Automake way for multi-output targets:
|
||||
# https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html
|
||||
tests/utils.h : tests/utils.c
|
||||
@if test -f $@; then :; else \
|
||||
cd $(top_srcdir) && \
|
||||
rm -f tests/utils.c && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) tests/utils.c; \
|
||||
fi
|
||||
|
||||
########
|
||||
# man/ #
|
||||
########
|
||||
|
||||
if FULL_SUITE
|
||||
dist_man_MANS = man/sndfile-info.1 man/sndfile-play.1 man/sndfile-convert.1 man/sndfile-cmp.1 \
|
||||
man/sndfile-metadata-get.1 man/sndfile-metadata-set.1 man/sndfile-concat.1 \
|
||||
man/sndfile-interleave.1 man/sndfile-deinterleave.1 man/sndfile-salvage.1
|
||||
|
||||
# Same manpage for both programs.
|
||||
man/sndfile-metadata-set.1: man/sndfile-metadata-get.1
|
||||
-rm -f $@
|
||||
cd $(top_srcdir)/man && $(LN_S) sndfile-metadata-get.1 sndfile-metadata-set.1
|
||||
|
||||
man/sndfile-deinterleave.1: man/sndfile-interleave.1
|
||||
-rm -f $@
|
||||
cd $(top_srcdir)/man && $(LN_S) sndfile-interleave.1 sndfile-deinterleave.1
|
||||
|
||||
############
|
||||
# ossfuzz/ #
|
||||
############
|
||||
|
||||
if USE_OSSFUZZ_FLAG
|
||||
FUZZ_FLAG = $(LIB_FUZZING_ENGINE)
|
||||
FUZZ_LDADD =
|
||||
else
|
||||
if USE_OSSFUZZ_STATIC
|
||||
FUZZ_LDADD = $(LIB_FUZZING_ENGINE)
|
||||
FUZZ_FLAG =
|
||||
else
|
||||
FUZZ_LDADD = libstandaloneengine.la
|
||||
FUZZ_FLAG =
|
||||
endif
|
||||
endif
|
||||
|
||||
if USE_OSSFUZZERS
|
||||
noinst_PROGRAMS += \
|
||||
ossfuzz/sndfile_fuzzer \
|
||||
ossfuzz/sndfile_alt_fuzzer
|
||||
|
||||
noinst_LTLIBRARIES += \
|
||||
ossfuzz/libstandaloneengine.la
|
||||
endif
|
||||
|
||||
ossfuzz_sndfile_fuzzer_SOURCES = ossfuzz/sndfile_fuzzer.cc
|
||||
ossfuzz_sndfile_fuzzer_CXXFLAGS = $(AM_CXXFLAGS) $(FUZZ_FLAG)
|
||||
ossfuzz_sndfile_fuzzer_LDFLAGS = $(AM_LDFLAGS) -static
|
||||
ossfuzz_sndfile_fuzzer_LDADD = src/libsndfile.la $(FUZZ_LDADD)
|
||||
|
||||
ossfuzz_sndfile_alt_fuzzer_SOURCES = ossfuzz/sndfile_alt_fuzzer.cc
|
||||
ossfuzz_sndfile_alt_fuzzer_CXXFLAGS = $(AM_CXXFLAGS) $(FUZZ_FLAG)
|
||||
ossfuzz_sndfile_alt_fuzzer_LDFLAGS = $(AM_LDFLAGS) -static
|
||||
ossfuzz_sndfile_alt_fuzzer_LDADD = src/libsndfile.la $(FUZZ_LDADD)
|
||||
|
||||
ossfuzz_libstandaloneengine_la_SOURCES = ossfuzz/standaloneengine.cc ossfuzz/testinput.h
|
||||
ossfuzz_libstandaloneengine_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||
|
||||
#############
|
||||
# programs/ #
|
||||
#############
|
||||
|
||||
bin_PROGRAMS = programs/sndfile-info programs/sndfile-play programs/sndfile-convert programs/sndfile-cmp \
|
||||
programs/sndfile-metadata-set programs/sndfile-metadata-get programs/sndfile-interleave \
|
||||
programs/sndfile-deinterleave programs/sndfile-concat programs/sndfile-salvage
|
||||
endif
|
||||
|
||||
# required by test-sndfile-metadata-set.py
|
||||
check_PROGRAMS += programs/sndfile-metadata-set programs/sndfile-metadata-get
|
||||
|
||||
EXTRA_DIST += programs/test-sndfile-metadata-set.py
|
||||
|
||||
programs_sndfile_info_SOURCES = programs/sndfile-info.c programs/common.c programs/common.h
|
||||
programs_sndfile_info_LDADD = src/libsndfile.la
|
||||
|
||||
programs_sndfile_play_SOURCES = programs/sndfile-play.c programs/common.c programs/common.h
|
||||
programs_sndfile_play_LDADD = src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS) $(SNDIO_LIBS)
|
||||
|
||||
programs_sndfile_convert_SOURCES = programs/sndfile-convert.c programs/common.c programs/common.h
|
||||
programs_sndfile_convert_LDADD = src/libsndfile.la
|
||||
|
||||
programs_sndfile_cmp_SOURCES = programs/sndfile-cmp.c programs/common.c programs/common.h
|
||||
programs_sndfile_cmp_LDADD = src/libsndfile.la
|
||||
|
||||
programs_sndfile_metadata_set_SOURCES = programs/sndfile-metadata-set.c programs/common.c programs/common.h
|
||||
programs_sndfile_metadata_set_LDADD = src/libsndfile.la
|
||||
|
||||
programs_sndfile_metadata_get_SOURCES = programs/sndfile-metadata-get.c programs/common.c programs/common.h
|
||||
programs_sndfile_metadata_get_LDADD = src/libsndfile.la
|
||||
|
||||
programs_sndfile_interleave_SOURCES = programs/sndfile-interleave.c programs/common.c programs/common.h
|
||||
programs_sndfile_interleave_LDADD = src/libsndfile.la
|
||||
|
||||
programs_sndfile_deinterleave_SOURCES = programs/sndfile-deinterleave.c programs/common.c programs/common.h
|
||||
programs_sndfile_deinterleave_LDADD = src/libsndfile.la
|
||||
|
||||
programs_sndfile_concat_SOURCES = programs/sndfile-concat.c programs/common.c programs/common.h
|
||||
programs_sndfile_concat_LDADD = src/libsndfile.la
|
||||
|
||||
programs_sndfile_salvage_SOURCES = programs/sndfile-salvage.c programs/common.c programs/common.h
|
||||
programs_sndfile_salvage_LDADD = src/libsndfile.la
|
||||
|
||||
############
|
||||
# regtest/ #
|
||||
############
|
||||
|
||||
if HAVE_SQLITE3
|
||||
check_PROGRAMS += regtest/sndfile-regtest
|
||||
endif
|
||||
|
||||
regtest_sndfile_regtest_SOURCES = regtest/regtest.h regtest/sndfile-regtest.c regtest/database.c regtest/checksum.c
|
||||
regtest_sndfile_CPPFLAGS = -I$(top_srcdir)/src $(SQLITE3_CFLAGS) $(OS_SPECIFIC_CFLAGS)
|
||||
regtest_sndfile_regtest_LDADD = src/libsndfile.la $(SQLITE3_LIBS)
|
||||
|
||||
################
|
||||
# test-tarball #
|
||||
################
|
||||
test-tarball : Scripts/build-test-tarball.mk
|
||||
$(MAKE) $(bin_PROGRAMS) $(check_PROGRAMS)
|
||||
$(MAKE) -f Scripts/build-test-tarball.mk
|
||||
303
Engine/lib/libsndfile/NEWS.OLD
Normal file
303
Engine/lib/libsndfile/NEWS.OLD
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
Version 1.0.31 (2021-01-24)
|
||||
|
||||
* The releaser of libsndfile starting from this version is the libsndfile team
|
||||
member @SoapGentoo, see AUTHORS for details.
|
||||
* Implement fast SSE2 optimized psf_lrintf() and psf_lrintf() functions to
|
||||
improve perfomance when libsndfile is built using Visual C++ (especially)
|
||||
and other compilers on x86 and AMD64 platforms. See also description of
|
||||
ENABLE_SSE2 CMake option in README.md.
|
||||
* Documentation:
|
||||
* Move site to new URL: http://libsndfile.github.io/libsndfile/
|
||||
* Convert documentation pages from HTML to Markdown
|
||||
* Use GitHub's Jekyll static site generator to generate static HTML pages
|
||||
for site
|
||||
* Fix api.md table error, thanks to @zodf0055980
|
||||
* Other docuemntation fixes and updates
|
||||
* Change CMake's project name from sndfile to libsndfile as it should be.
|
||||
* Change behaviour of ENABLE_STATIC_RUNTIME option. In short:
|
||||
* You can use ENABLE_STATIC_RUNTIME for CMake >= 3.15 without error.
|
||||
* You can use your our method to set MSVC runtime library flags if none of
|
||||
ENABLE_STATIC_RUNTIME and CMAKE_MSVC_RUNTIME_LIBRARY were set.
|
||||
Advanced information:
|
||||
* If this option is defined (set to ON or OFF), set CMP0091 policy to OLD
|
||||
(we handle MSVC runtime library flags using compiler flags), set
|
||||
corresponding compiler flags for user.
|
||||
* NEW: If this option is not defined, set CMP0091 policy to OLD (we handle
|
||||
MSVC runtime library flags using compiler flags), don't touch compiler
|
||||
options, allow user to set it manually.
|
||||
* NEW: If new CMake option CMAKE_MSVC_RUNTIME_LIBRARY is set, change
|
||||
CMP0091 policy to NEW (we handle MSVC runtime library flags using that
|
||||
option), don't touch compiler flags.
|
||||
* NEW: If both ENABLE_STATIC_RUNTIME and CMAKE_MSVC_RUNTIME_LIBRARY are set,
|
||||
terminate configuration with fatal error.
|
||||
* For MinGW toolchain this option is experimental. If you enabled it and
|
||||
then disabled again, you need to clear CMake cache (delete
|
||||
CMakeCache.txt).
|
||||
* Make CMake clip test faster.
|
||||
* Fix CMake bug with sndio library dependency, thanks to @drhenault.
|
||||
* Fix memory leak in wav_read_smpl_chunk() function, credit to OSS-Fuzz.
|
||||
* Fix aiff_read_header() memory leak(), credit to OSS-Fuzz.
|
||||
* Fix leak in wav_read_header(), credit to OSS-Fuzz.
|
||||
* Fix leak in wavlike_read_cart_chunk(), credit to OSS-Fuzz.
|
||||
* Fix memory leak in wav_read_acid_chunk(), credit to OSS-Fuzz.
|
||||
* Fix memory leak in aiff_read_basc_chunk(), credit to OSS-Fuzz.
|
||||
* Fix memory leak in wavlike_read_peak_chunk(), credit to OSS-Fuzz.
|
||||
* Fix memory leak in aiff_read_header(), credit to OSS-Fuzz.
|
||||
* Fix use of uninitialized value in exif_subchunk_parse(), credit to OSS-Fuzz.
|
||||
* Fix use of uninitialized value in endswap_int64_t_array(), credit to
|
||||
OSS-Fuzz.
|
||||
* Fix up the fuzzer so that it can't under or overseek,
|
||||
thanks to Max Dymond <cmeister2@gmail.com>.
|
||||
* Fix Autotools configure on macOS, thanks to @tmcguire and @nwh.
|
||||
* Exclude repository-configuration from git-archive, thanks to @umlaeute.
|
||||
* Use version-script when compiling with clang on Unix with Autotools, thanks
|
||||
to @tstellar.
|
||||
* Improve handling of SMPL chunks in WAV files, thanks to @zodf0055980.
|
||||
|
||||
Version 1.0.30 (2020-09-18)
|
||||
|
||||
* Fix critical CMake bug with broken ABI of shared libsndfile library.
|
||||
* CMake build system considered to be stable.
|
||||
* Move sndfile.h.in from src/ to include/ directory. To avoid problems,
|
||||
delete old generated sndfile.h from $(top_builddir)/src.
|
||||
* Huge documentation update.
|
||||
* Fix opus test failures on BE platforms, thanks to
|
||||
Arthur Taylor <art@ified.ca>.
|
||||
* Fix bug when sf_open_fd() function sometimes leaves filehandle open, even
|
||||
if `close_desc` parameter is TRUE, thanks to @umläute.
|
||||
* Fix infinite loops on some pathological SD2 files, thanks to
|
||||
Jeremy Friesner <jaf@meyersound.com>.
|
||||
* Switch to GitHub Actions for continuous integration.
|
||||
* Add OSS-Fuzz tests to GitHub Actions workflow, thanks to
|
||||
Max Dymond <cmeister2@gmail.com>.
|
||||
* Fix memory leak in wavlike_read_bext_chunk() function, credit to OSS-Fuzz.
|
||||
* Fix undefined behavior in avr-read_header() function, credit to OSS-Fuzz.
|
||||
* Add INSTALL_PKGCONFIG_MODULE CMake option to control sndfile.pc file
|
||||
installation, see README.md for details.
|
||||
* Add INSTALL_MANPAGES CMake option, see README.md for details.
|
||||
* Fix ENABLE_COMPATIBLE_LIBSNDFILE_NAME CMake option, now it works on MinGW
|
||||
platform too.
|
||||
* Fix ENABLE_CPACK CMake option, see README.md for details.
|
||||
* Fix ENABLE_STATIC_RUNTIME and CMAKE_MSVC_RUNTIME_LIBRARY behavior, see
|
||||
README.md for details.
|
||||
* Fix CMake man pages installation bug when sndfile-deinterleave.1 and
|
||||
sndfile-metadata-set.1 were not installed.
|
||||
* Fix sndfile-regtest paths handling on Windows platform, thanks to
|
||||
Gisle Vanem <gvanem@yahoo.no>.
|
||||
|
||||
Version 1.0.29 (2020-08-15)
|
||||
* Add support for Opus files.
|
||||
* Autotool build system improvements.
|
||||
* CMake build system improvements.
|
||||
* Fixes for: CVE-2017-12562, CVE-2017-17456, CVE-2017-17457, CVE-2018-19661,
|
||||
CVE-2018-19662, CVE-2018-19758 and CVE-2019-3832.
|
||||
* Add BWF v2 loudness parameters.
|
||||
* Wave64: Permit and skip arbitrary chunks prior to the data chunk.
|
||||
* Fix ASAN crash in wavlike_ima_seek().
|
||||
* Fix IMA-ADPCM encoding for AIFF files.
|
||||
* sndfile-convert: Handle gsm, vox and opus extensions the same way.
|
||||
* Add SFC_SET_OGG_PAGE_LATENCY_MS command to get Ogg page latency for Ogg Opus
|
||||
files.
|
||||
* Fix parsing of some SD2 files.
|
||||
* Documentation updates.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.28 (2017-04-02)
|
||||
* Fix buffer overruns in FLAC and ID3 handling code.
|
||||
* Move to variable length header storage.
|
||||
* Fix detection of Large File Support for 32 bit systems.
|
||||
* Remove large stack allocations in ALAC handling code.
|
||||
* Remove all use of Variable Length Arrays.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.27 (2016-06-19)
|
||||
* Fix an SF_INFO seekable flag regression introduced in 1.0.26.
|
||||
* Fix potential infinite loops on malformed input files.
|
||||
* Add string metadata read/write for CAF and RF64.
|
||||
* Add handling of CUE chunks.
|
||||
* Fix endian-ness issues in PAF files.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.26 (2015-11-22)
|
||||
* Fix for CVE-2014-9496, SD2 buffer read overflow.
|
||||
* Fix for CVE-2014-9756, file_io.c divide by zero.
|
||||
* Fix for CVE-2015-7805, AIFF heap write overflow.
|
||||
* Add support for ALAC encoder in a CAF container.
|
||||
* Add support for Cart chunks in WAV files.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.25 (2011-07-13)
|
||||
* Fix for Secunia Advisory SA45125, heap overflow in PAF file handler.
|
||||
* Accept broken WAV files with blockalign == 0.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.24 (2011-03-23)
|
||||
* WAV files now have an 18 byte u-law and A-law fmt chunk.
|
||||
* Document virtual I/O functionality.
|
||||
* Two new methods rawHandle() and takeOwnership() in sndfile.hh.
|
||||
* AIFF fix for non-zero offset value in SSND chunk.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.23 (2010-10-10)
|
||||
* Add version metadata to Windows DLL.
|
||||
* Add a missing 'inline' to sndfile.hh.
|
||||
* Update docs.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.22 (2010-10-04)
|
||||
* Couple of fixes for SDS file writer.
|
||||
* Fixes arising from static analysis.
|
||||
* Handle FLAC files with ID3 meta data at start of file.
|
||||
* Handle FLAC files which report zero length.
|
||||
* Other minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.21 (2009-12-13)
|
||||
* Add a couple of new binary programs to programs/ dir.
|
||||
* Remove sndfile-jackplay (now in sndfile-tools package).
|
||||
* Add windows only function sf_wchar_open().
|
||||
* Bunch of minor bug fixes.
|
||||
|
||||
Version 1.0.20 (2009-05-14)
|
||||
* Fix potential heap overflow in VOC file parser (Tobias Klein, http://www.trapkit.de/).
|
||||
|
||||
Version 1.0.19 (2009-03-02)
|
||||
* Fix for CVE-2009-0186 (Alin Rad Pop, Secunia Research).
|
||||
* Huge number of minor bug fixes as a result of static analysis.
|
||||
|
||||
Version 1.0.18 (2009-02-07)
|
||||
* Add Ogg/Vorbis support (thanks to John ffitch).
|
||||
* Remove captive FLAC library.
|
||||
* Many new features and bug fixes.
|
||||
* Generate Win32 and Win64 pre-compiled binaries.
|
||||
|
||||
Version 1.0.17 (2006-08-31)
|
||||
* Add sndfile.hh C++ wrapper.
|
||||
* Update Win32 MinGW build instructions.
|
||||
* Minor bug fixes and cleanups.
|
||||
|
||||
Version 1.0.16 (2006-04-30)
|
||||
* Add support for Broadcast (BEXT) chunks in WAV files.
|
||||
* Implement new commands SFC_GET_SIGNAL_MAX and SFC_GET_MAX_ALL_CHANNELS.
|
||||
* Add support for RIFX (big endian WAV variant).
|
||||
* Fix configure script bugs.
|
||||
* Fix bug in INST and MARK chunk writing for AIFF files.
|
||||
|
||||
Version 1.0.15 (2006-03-16)
|
||||
* Fix some ia64 issues.
|
||||
* Fix precompiled DLL.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.14 (2006-02-19)
|
||||
* Really fix MinGW compile problems.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.13 (2006-01-21)
|
||||
* Fix for MinGW compiler problems.
|
||||
* Allow readin/write of instrument chunks from WAV and AIFF files.
|
||||
* Compile problem fix for Solaris compiler.
|
||||
* Minor cleanups and bug fixes.
|
||||
|
||||
Version 1.0.12 (2005-09-30)
|
||||
* Add support for FLAC and Apple's Core Audio Format (CAF).
|
||||
* Add virtual I/O interface (still needs docs).
|
||||
* Cygwin and other Win32 fixes.
|
||||
* Minor bug fixes and cleanups.
|
||||
|
||||
Version 1.0.11 (2004-11-15)
|
||||
* Add support for SD2 files.
|
||||
* Add read support for loop info in WAV and AIFF files.
|
||||
* Add more tests.
|
||||
* Improve type safety.
|
||||
* Minor optimisations and bug fixes.
|
||||
|
||||
Version 1.0.10 (2004-06-15)
|
||||
* Fix AIFF read/write mode bugs.
|
||||
* Add support for compiling Win32 DLLS using MinGW.
|
||||
* Fix problems resulting in failed compiles with gcc-2.95.
|
||||
* Improve test suite.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.9 (2004-03-30)
|
||||
* Add handling of AVR (Audio Visual Research) files.
|
||||
* Improve handling of WAVEFORMATEXTENSIBLE WAV files.
|
||||
* Fix for using pipes on Win32.
|
||||
|
||||
Version 1.0.8 (2004-03-14)
|
||||
* Correct peak chunk handing for files with > 16 tracks.
|
||||
* Fix for WAV files with huge number of CUE chunks.
|
||||
|
||||
Version 1.0.7 (2004-02-25)
|
||||
* Fix clip mode detection on ia64, MIPS and other CPUs.
|
||||
* Fix two MacOSX build problems.
|
||||
|
||||
Version 1.0.6 (2004-02-08)
|
||||
* Added support for native Win32 file access API (Ross Bencina).
|
||||
* New mode to add clippling then a converting from float/double to integer
|
||||
would otherwise wrap around.
|
||||
* Fixed a bug in reading/writing files > 2Gig on Linux, Solaris and others.
|
||||
* Many minor bug fixes.
|
||||
* Other random fixes for Win32.
|
||||
|
||||
Version 1.0.5 (2003-05-03)
|
||||
* Added support for HTK files.
|
||||
* Added new function sf_open_fd() to allow for secure opening of temporary
|
||||
files as well as reading/writing sound files embedded within larger
|
||||
container files.
|
||||
* Added string support for AIFF files.
|
||||
* Minor bug fixes and code cleanups.
|
||||
|
||||
Version 1.0.4 (2003-02-02)
|
||||
* Added suport of PVF and XI files.
|
||||
* Added functionality for setting and retreiving strings from sound files.
|
||||
* Minor code cleanups and bug fixes.
|
||||
|
||||
Version 1.0.3 (2002-12-09)
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.2 (2002-11-24)
|
||||
* Added support for VOX ADPCM.
|
||||
* Improved error reporting.
|
||||
* Added version scripting on Linux and Solaris.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.1 (2002-09-14)
|
||||
* Added MAT and MAT5 file formats.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.0 (2002-08-16)
|
||||
* Final release for 1.0.0.
|
||||
|
||||
Version 1.0.0rc6 (2002-08-14)
|
||||
* Release candidate 6 for the 1.0.0 series.
|
||||
* MacOS9 fixes.
|
||||
|
||||
Version 1.0.0rc5 (2002-08-10)
|
||||
* Release candidate 5 for the 1.0.0 series.
|
||||
* Changed the definition of sf_count_t which was causing problems when
|
||||
libsndfile was compiled with other libraries (ie WxWindows).
|
||||
* Minor bug fixes.
|
||||
* Documentation cleanup.
|
||||
|
||||
Version 1.0.0rc4 (2002-08-03)
|
||||
* Release candidate 4 for the 1.0.0 series.
|
||||
* Minor bug fixes.
|
||||
* Fix broken Win32 "make check".
|
||||
|
||||
Version 1.0.0rc3 (2002-08-02)
|
||||
* Release candidate 3 for the 1.0.0 series.
|
||||
* Fix bug where libsndfile was reading beyond the end of the data chunk.
|
||||
* Added on-the-fly header updates on write.
|
||||
* Fix a couple of documentation issues.
|
||||
|
||||
Version 1.0.0rc2 (2002-06-24)
|
||||
* Release candidate 2 for the 1.0.0 series.
|
||||
* Fix compile problem for Win32.
|
||||
|
||||
Version 1.0.0rc1 (2002-06-24)
|
||||
* Release candidate 1 for the 1.0.0 series.
|
||||
|
||||
Version 0.0.28 (2002-04-27)
|
||||
* Last official release of 0.0.X series of the library.
|
||||
|
||||
Version 0.0.8 (1999-02-16)
|
||||
* First official release.
|
||||
79
Engine/lib/libsndfile/Octave/Makefile.am
Normal file
79
Engine/lib/libsndfile/Octave/Makefile.am
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# Prevent any extension.
|
||||
EXEEXT =
|
||||
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
EXTRA_DIST = sndfile_load.m sndfile_save.m sndfile_play.m \
|
||||
octave_test.m octave_test.sh $(oct_module_srcs) PKG_ADD
|
||||
|
||||
octconfigdir = $(exec_prefix)/share/octave/site/m
|
||||
octconfig_DATA = sndfile_load.m sndfile_save.m sndfile_play.m
|
||||
|
||||
OCTAVE_DEST_MDIR = @OCTAVE_DEST_MDIR@
|
||||
OCTAVE_DEST_ODIR = @OCTAVE_DEST_ODIR@/sndfile
|
||||
|
||||
OCT_CXXFLAGS = @OCT_CXXFLAGS@
|
||||
OCT_LIB_DIR = @OCT_LIB_DIR@
|
||||
OCT_LIBS = @OCT_LIBS@
|
||||
|
||||
SNDFILEDIR = $(top_builddir)/src
|
||||
AM_CPPFLAGS = -I$(SNDFILEDIR)
|
||||
|
||||
oct_module_srcs = sndfile.cc
|
||||
oct_module_files = sndfile.oct PKG_ADD
|
||||
|
||||
# Make these noinst so they can be installed manually.
|
||||
noinst_DATA = $(oct_module_files)
|
||||
|
||||
|
||||
# Used by shave which cleans up automake generated Makefile output.
|
||||
V = @
|
||||
Q = $(V:1=)
|
||||
QUIET_GEN = $(Q:@=@echo ' GEN '$@;)
|
||||
|
||||
|
||||
# Use Octave's mkoctfile to do all the heavy lifting. Unfortunately, its
|
||||
# a little dumb so we need to guide it carefully.
|
||||
sndfile.oct : sndfile.o
|
||||
$(QUIET_GEN) $(MKOCTFILE) -v $(INCLUDES) $(top_builddir)/Octave/$+ -L$(SNDFILEDIR)/.libs -L$(SNDFILEDIR) -lsndfile -o $(top_builddir)/Octave/$@ > /dev/null
|
||||
|
||||
sndfile.o : sndfile.cc
|
||||
$(QUIET_GEN) $(MKOCTFILE) -v $(INCLUDES) -c $+ -o $(top_builddir)/Octave/$@ > /dev/null
|
||||
|
||||
# Allow for the test being run in the build dir, but the test script
|
||||
# being located in the source dir.
|
||||
check :
|
||||
octave_src_dir=$(srcdir) $(srcdir)/octave_test.sh
|
||||
|
||||
|
||||
# Since the octave modules are installed in a special location, a custom install
|
||||
# and uninstall routine must be specified.
|
||||
install-exec-local : $(oct_module_files)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(OCTAVE_DEST_ODIR)" || $(mkdir_p) "$(DESTDIR)$(OCTAVE_DEST_ODIR)"
|
||||
@list='$(oct_module_files)'; for p in $$list; do \
|
||||
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then \
|
||||
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL) '$$p' '$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL) "$$p" "$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f" || exit 1; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-local :
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(oct_module_files)'; for p in $$list; do \
|
||||
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " rm -f '$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f"; \
|
||||
done
|
||||
|
||||
clean-local :
|
||||
rm -f sndfile.o sndfile.oct
|
||||
@if test $(abs_builddir) != $(abs_srcdir) ; then rm -f PKG_ADD ; fi
|
||||
3
Engine/lib/libsndfile/Octave/PKG_ADD
Normal file
3
Engine/lib/libsndfile/Octave/PKG_ADD
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
autoload ("sfread", "sndfile.oct");
|
||||
autoload ("sfversion", "sndfile.oct");
|
||||
autoload ("sfwrite", "sndfile.oct");
|
||||
23
Engine/lib/libsndfile/Octave/Readme.txt
Normal file
23
Engine/lib/libsndfile/Octave/Readme.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
The libsndfile Modules for GNU Octave
|
||||
=====================================
|
||||
|
||||
These modules are currently known to work with version 3.0 of GNU Octave on
|
||||
Linux. They have not been tested elsewhere.
|
||||
|
||||
|
||||
Build Requirements
|
||||
------------------
|
||||
|
||||
In order to build these libsndfile related modules for GNU Octave on a Debian
|
||||
GNU/Linux (or Debian derived) system, you will need (on top of what is normally
|
||||
required to build libsndfile) the package:
|
||||
|
||||
octaveX.Y-headers
|
||||
|
||||
where X.Y matches the version number of your installation of GNU Octave.
|
||||
|
||||
The configure script in the top level libsndfile directory will detect the
|
||||
presence and correct versions of the Octave build tools. The building of these
|
||||
modules will only go ahead if everything is correct.
|
||||
|
||||
|
||||
21
Engine/lib/libsndfile/Octave/format.h
Normal file
21
Engine/lib/libsndfile/Octave/format.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
** Copyright (C) 2007-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This 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 Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser 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.
|
||||
*/
|
||||
|
||||
int format_of_str (const std::string & fmt) ;
|
||||
|
||||
void string_of_format (std::string & fmt, int format) ;
|
||||
52
Engine/lib/libsndfile/Octave/octave_test.m
Normal file
52
Engine/lib/libsndfile/Octave/octave_test.m
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# Copyright (C) 2007-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This 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 Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser 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.
|
||||
|
||||
# These tests are nowhere near comprehensive.
|
||||
|
||||
printf (" Running Octave tests : ") ;
|
||||
fflush (stdout) ;
|
||||
|
||||
filename = "whatever" ;
|
||||
srate_out = 32000 ;
|
||||
fmt_out = "wav-float" ;
|
||||
|
||||
t = (2 * pi / srate_out * (0:srate_out-1))' ;
|
||||
data_out = sin (440.0 * t) ;
|
||||
|
||||
# Write out a file.
|
||||
sfwrite (filename, data_out, srate_out, fmt_out) ;
|
||||
|
||||
# Read it back in again.
|
||||
[ data_in, srate_in, fmt_in ] = sfread (filename) ;
|
||||
|
||||
if (srate_in != srate_out)
|
||||
error ("\n\nSample rate mismatch : %d -> %d.\n\n", srate_out, srate_in) ;
|
||||
endif
|
||||
|
||||
# Octave strcmp return 1 for the same.
|
||||
if (strcmp (fmt_in, fmt_out) != 1)
|
||||
error ("\n\nFormat error : '%s' -> '%s'.\n\n", fmt_out, fmt_in) ;
|
||||
endif
|
||||
|
||||
err = max (abs (data_out - data_in)) ;
|
||||
|
||||
if (err > 1e-7)
|
||||
error ("err : %g\n", err) ;
|
||||
endif
|
||||
|
||||
printf ("ok") ;
|
||||
|
||||
unlink (filename) ;
|
||||
81
Engine/lib/libsndfile/Octave/octave_test.sh
Normal file
81
Engine/lib/libsndfile/Octave/octave_test.sh
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# Check where we're being run from.
|
||||
if test -d Octave ; then
|
||||
cd Octave
|
||||
octave_src_dir=$(pwd)
|
||||
elif test -z "$octave_src_dir" ; then
|
||||
echo
|
||||
echo "Error : \$octave_src_dir is undefined."
|
||||
echo
|
||||
exit 1
|
||||
else
|
||||
octave_src_dir=$(cd $octave_src_dir && pwd)
|
||||
fi
|
||||
|
||||
# Find libsndfile shared object.
|
||||
libsndfile_lib_location=""
|
||||
|
||||
if test -f "../src/.libs/libsndfile.so" ; then
|
||||
libsndfile_lib_location="../src/.libs/"
|
||||
elif test -f "../src/libsndfile.so" ; then
|
||||
libsndfile_lib_location="../src/"
|
||||
elif test -f "../src/.libs/libsndfile.dylib" ; then
|
||||
libsndfile_lib_location="../src/.libs/"
|
||||
elif test -f "../src/libsndfile.dylib" ; then
|
||||
libsndfile_lib_location="../src/"
|
||||
else
|
||||
echo
|
||||
echo "Not able to find the libsndfile shared lib we've just built."
|
||||
echo "This may cause the following test to fail."
|
||||
echo
|
||||
fi
|
||||
|
||||
libsndfile_lib_location=`(cd $libsndfile_lib_location && pwd)`
|
||||
|
||||
|
||||
# Find sndfile.oct
|
||||
sndfile_oct_location=""
|
||||
|
||||
if test -f .libs/sndfile.oct ; then
|
||||
sndfile_oct_location=".libs"
|
||||
elif test -f sndfile.oct ; then
|
||||
sndfile_oct_location="."
|
||||
else
|
||||
echo "Not able to find the sndfile.oct binaries we've just built."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case `file -b $sndfile_oct_location/sndfile.oct` in
|
||||
ELF*)
|
||||
;;
|
||||
Mach*)
|
||||
echo "Tests don't work on this platform."
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Not able to find the sndfile.oct binary we just built."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Make sure the TERM environment variable doesn't contain anything wrong.
|
||||
unset TERM
|
||||
# echo "octave_src_dir : $octave_src_dir"
|
||||
# echo "libsndfile_lib_location : $libsndfile_lib_location"
|
||||
# echo "sndfile_oct_location : $sndfile_oct_location"
|
||||
|
||||
if test ! -f PKG_ADD ; then
|
||||
cp $octave_src_dir/PKG_ADD .
|
||||
fi
|
||||
|
||||
export LD_LIBRARY_PATH="$libsndfile_lib_location:$LD_LIBRARY_PATH"
|
||||
|
||||
octave_script="$octave_src_dir/octave_test.m"
|
||||
|
||||
(cd $sndfile_oct_location && octave -qH $octave_script)
|
||||
res=$?
|
||||
echo
|
||||
exit $res
|
||||
405
Engine/lib/libsndfile/Octave/sndfile.cc
Normal file
405
Engine/lib/libsndfile/Octave/sndfile.cc
Normal file
|
|
@ -0,0 +1,405 @@
|
|||
/*
|
||||
** Copyright (C) 2007-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This 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 Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser 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.
|
||||
*/
|
||||
|
||||
#include <octave/oct.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
|
||||
#define FOUR_GIG (0x100000000LL)
|
||||
#define BUFFER_FRAMES 8192
|
||||
|
||||
|
||||
static int format_of_str (const std::string & fmt) ;
|
||||
static void string_of_format (std::string & fmt, int format) ;
|
||||
|
||||
|
||||
DEFUN_DLD (sfversion, args, nargout ,
|
||||
"-*- texinfo -*-\n\
|
||||
@deftypefn {Loadable Function} {@var{version} =} sfversion ()\n\
|
||||
@cindex Reading sound files\n\
|
||||
Return a string containing the libsndfile version.\n\
|
||||
@seealso{sfread, sfwrite}\n\
|
||||
@end deftypefn")
|
||||
{ char buffer [256] ;
|
||||
octave_value_list retval ;
|
||||
|
||||
/* Bail out if the input parameters are bad. */
|
||||
if (args.length () != 0 || nargout > 1)
|
||||
{ print_usage () ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
|
||||
|
||||
std::string version (buffer) ;
|
||||
|
||||
retval.append (version) ;
|
||||
return retval ;
|
||||
} /* sfversion */
|
||||
|
||||
|
||||
DEFUN_DLD (sfread, args, nargout ,
|
||||
"-*- texinfo -*-\n\
|
||||
@deftypefn {Loadable Function} {@var{data},@var{srate},@var{format} =} sfread (@var{filename})\n\
|
||||
@cindex Reading sound files\n\
|
||||
Read a sound file from disk using libsndfile.\n\
|
||||
@seealso{sfversion, sfwrite}\n\
|
||||
@end deftypefn")
|
||||
{ SNDFILE * file ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
octave_value_list retval ;
|
||||
|
||||
int nargin = args.length () ;
|
||||
|
||||
/* Bail out if the input parameters are bad. */
|
||||
if ((nargin != 1) || !args (0) .is_string () || nargout < 1 || nargout > 3)
|
||||
{ print_usage () ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
std::string filename = args (0).string_value () ;
|
||||
|
||||
if ((file = sf_open (filename.c_str (), SFM_READ, &sfinfo)) == NULL)
|
||||
{ error ("sfread: couldn't open file %s : %s", filename.c_str (), sf_strerror (NULL)) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > FOUR_GIG)
|
||||
printf ("This is a really huge file (%lld frames).\nYou may run out of memory trying to load it.\n", (long long) sfinfo.frames) ;
|
||||
|
||||
dim_vector dim = dim_vector () ;
|
||||
dim.resize (2) ;
|
||||
dim (0) = sfinfo.frames ;
|
||||
dim (1) = sfinfo.channels ;
|
||||
|
||||
/* Should I be using Matrix instead? */
|
||||
NDArray out (dim, 0.0) ;
|
||||
|
||||
float buffer [BUFFER_FRAMES * sfinfo.channels] ;
|
||||
int readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
do
|
||||
{ readcount = sf_readf_float (file, buffer, BUFFER_FRAMES) ;
|
||||
|
||||
/* Make sure we don't read more frames than we allocated. */
|
||||
if (total + readcount > sfinfo.frames)
|
||||
readcount = sfinfo.frames - total ;
|
||||
|
||||
for (int ch = 0 ; ch < sfinfo.channels ; ch++)
|
||||
{ for (int k = 0 ; k < readcount ; k++)
|
||||
out (total + k, ch) = buffer [k * sfinfo.channels + ch] ;
|
||||
} ;
|
||||
|
||||
total += readcount ;
|
||||
} while (readcount > 0 && total < sfinfo.frames) ;
|
||||
|
||||
retval.append (out.squeeze ()) ;
|
||||
|
||||
if (nargout >= 2)
|
||||
retval.append ((octave_uint32) sfinfo.samplerate) ;
|
||||
|
||||
if (nargout >= 3)
|
||||
{ std::string fmt ("") ;
|
||||
string_of_format (fmt, sfinfo.format) ;
|
||||
retval.append (fmt) ;
|
||||
} ;
|
||||
|
||||
/* Clean up. */
|
||||
sf_close (file) ;
|
||||
|
||||
return retval ;
|
||||
} /* sfread */
|
||||
|
||||
DEFUN_DLD (sfwrite, args, nargout ,
|
||||
"-*- texinfo -*-\n\
|
||||
@deftypefn {Function File} sfwrite (@var{filename},@var{data},@var{srate},@var{format})\n\
|
||||
Write a sound file to disk using libsndfile.\n\
|
||||
@seealso{sfread, sfversion}\n\
|
||||
@end deftypefn\n\
|
||||
")
|
||||
{ SNDFILE * file ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
octave_value_list retval ;
|
||||
|
||||
int nargin = args.length () ;
|
||||
|
||||
/* Bail out if the input parameters are bad. */
|
||||
if (nargin != 4 || !args (0).is_string () || !args (1).is_real_matrix ()
|
||||
|| !args (2).is_real_scalar () || !args (3).is_string ()
|
||||
|| nargout != 0)
|
||||
{ print_usage () ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
std::string filename = args (0).string_value () ;
|
||||
std::string format = args (3).string_value () ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
sfinfo.format = format_of_str (format) ;
|
||||
if (sfinfo.format == 0)
|
||||
{ error ("Bad format '%s'", format.c_str ()) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
sfinfo.samplerate = lrint (args (2).scalar_value ()) ;
|
||||
if (sfinfo.samplerate < 1)
|
||||
{ error ("Bad sample rate : %d.\n", sfinfo.samplerate) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
Matrix data = args (1).matrix_value () ;
|
||||
long rows = args (1).rows () ;
|
||||
long cols = args (1).columns () ;
|
||||
|
||||
if (cols > rows)
|
||||
{ error ("Audio data should have one column per channel, but supplied data "
|
||||
"has %ld rows and %ld columns.\n", rows, cols) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
sfinfo.channels = cols ;
|
||||
|
||||
if ((file = sf_open (filename.c_str (), SFM_WRITE, &sfinfo)) == NULL)
|
||||
{ error ("Couldn't open file %s : %s", filename.c_str (), sf_strerror (NULL)) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
float buffer [BUFFER_FRAMES * sfinfo.channels] ;
|
||||
int writecount ;
|
||||
long total = 0 ;
|
||||
|
||||
do
|
||||
{
|
||||
writecount = BUFFER_FRAMES ;
|
||||
|
||||
/* Make sure we don't read more frames than we allocated. */
|
||||
if (total + writecount > rows)
|
||||
writecount = rows - total ;
|
||||
|
||||
for (int ch = 0 ; ch < sfinfo.channels ; ch++)
|
||||
{ for (int k = 0 ; k < writecount ; k++)
|
||||
buffer [k * sfinfo.channels + ch] = data (total + k, ch) ;
|
||||
} ;
|
||||
|
||||
if (writecount > 0)
|
||||
sf_writef_float (file, buffer, writecount) ;
|
||||
|
||||
total += writecount ;
|
||||
} while (writecount > 0 && total < rows) ;
|
||||
|
||||
/* Clean up. */
|
||||
sf_close (file) ;
|
||||
|
||||
return retval ;
|
||||
} /* sfwrite */
|
||||
|
||||
|
||||
static void
|
||||
str_split (const std::string & str, const std::string & delim, std::vector <std::string> & output)
|
||||
{
|
||||
unsigned int offset = 0 ;
|
||||
size_t delim_index = 0 ;
|
||||
|
||||
delim_index = str.find (delim, offset) ;
|
||||
|
||||
while (delim_index != std::string::npos)
|
||||
{
|
||||
output.push_back (str.substr(offset, delim_index - offset)) ;
|
||||
offset += delim_index - offset + delim.length () ;
|
||||
delim_index = str.find (delim, offset) ;
|
||||
}
|
||||
|
||||
output.push_back (str.substr (offset)) ;
|
||||
} /* str_split */
|
||||
|
||||
static int
|
||||
hash_of_str (const std::string & str)
|
||||
{
|
||||
int hash = 0 ;
|
||||
|
||||
for (unsigned k = 0 ; k < str.length () ; k++)
|
||||
hash = (hash * 3) + tolower (str [k]) ;
|
||||
|
||||
return hash ;
|
||||
} /* hash_of_str */
|
||||
|
||||
static int
|
||||
major_format_of_hash (const std::string & str)
|
||||
{ int hash ;
|
||||
|
||||
hash = hash_of_str (str) ;
|
||||
|
||||
switch (hash)
|
||||
{
|
||||
case 0x5c8 : /* 'wav' */ return SF_FORMAT_WAV ;
|
||||
case 0xf84 : /* 'aiff' */ return SF_FORMAT_AIFF ;
|
||||
case 0x198 : /* 'au' */ return SF_FORMAT_AU ;
|
||||
case 0x579 : /* 'paf' */ return SF_FORMAT_PAF ;
|
||||
case 0x5e5 : /* 'svx' */ return SF_FORMAT_SVX ;
|
||||
case 0x1118 : /* 'nist' */ return SF_FORMAT_NIST ;
|
||||
case 0x5d6 : /* 'voc' */ return SF_FORMAT_VOC ;
|
||||
case 0x324a : /* 'ircam' */ return SF_FORMAT_IRCAM ;
|
||||
case 0x505 : /* 'w64' */ return SF_FORMAT_W64 ;
|
||||
case 0x1078 : /* 'mat4' */ return SF_FORMAT_MAT4 ;
|
||||
case 0x1079 : /* 'mat5' */ return SF_FORMAT_MAT5 ;
|
||||
case 0x5b8 : /* 'pvf' */ return SF_FORMAT_PVF ;
|
||||
case 0x1d1 : /* 'xi' */ return SF_FORMAT_XI ;
|
||||
case 0x56f : /* 'htk' */ return SF_FORMAT_HTK ;
|
||||
case 0x5aa : /* 'sds' */ return SF_FORMAT_SDS ;
|
||||
case 0x53d : /* 'avr' */ return SF_FORMAT_AVR ;
|
||||
case 0x11d0 : /* 'wavx' */ return SF_FORMAT_WAVEX ;
|
||||
case 0x569 : /* 'sd2' */ return SF_FORMAT_SD2 ;
|
||||
case 0x1014 : /* 'flac' */ return SF_FORMAT_FLAC ;
|
||||
case 0x504 : /* 'caf' */ return SF_FORMAT_CAF ;
|
||||
case 0x5f6 : /* 'wve' */ return SF_FORMAT_WVE ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
printf ("%s : hash '%s' -> 0x%x\n", __func__, str.c_str (), hash) ;
|
||||
|
||||
return 0 ;
|
||||
} /* major_format_of_hash */
|
||||
|
||||
static int
|
||||
minor_format_of_hash (const std::string & str)
|
||||
{ int hash ;
|
||||
|
||||
hash = hash_of_str (str) ;
|
||||
|
||||
switch (hash)
|
||||
{
|
||||
case 0x1085 : /* 'int8' */ return SF_FORMAT_PCM_S8 ;
|
||||
case 0x358a : /* 'uint8' */ return SF_FORMAT_PCM_U8 ;
|
||||
case 0x31b0 : /* 'int16' */ return SF_FORMAT_PCM_16 ;
|
||||
case 0x31b1 : /* 'int24' */ return SF_FORMAT_PCM_24 ;
|
||||
case 0x31b2 : /* 'int32' */ return SF_FORMAT_PCM_32 ;
|
||||
case 0x3128 : /* 'float' */ return SF_FORMAT_FLOAT ;
|
||||
case 0x937d : /* 'double' */ return SF_FORMAT_DOUBLE ;
|
||||
case 0x11bd : /* 'ulaw' */ return SF_FORMAT_ULAW ;
|
||||
case 0xfa1 : /* 'alaw' */ return SF_FORMAT_ALAW ;
|
||||
case 0xfc361 : /* 'ima_adpcm' */ return SF_FORMAT_IMA_ADPCM ;
|
||||
case 0x5739a : /* 'ms_adpcm' */ return SF_FORMAT_MS_ADPCM ;
|
||||
case 0x9450 : /* 'gsm610' */ return SF_FORMAT_GSM610 ;
|
||||
case 0x172a3 : /* 'g721_32' */ return SF_FORMAT_G721_32 ;
|
||||
case 0x172d8 : /* 'g723_24' */ return SF_FORMAT_G723_24 ;
|
||||
case 0x172da : /* 'g723_40' */ return SF_FORMAT_G723_40 ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
printf ("%s : hash '%s' -> 0x%x\n", __func__, str.c_str (), hash) ;
|
||||
|
||||
return 0 ;
|
||||
} /* minor_format_of_hash */
|
||||
|
||||
|
||||
static const char *
|
||||
string_of_major_format (int format)
|
||||
{
|
||||
switch (format & SF_FORMAT_TYPEMASK)
|
||||
{
|
||||
case SF_FORMAT_WAV : return "wav" ;
|
||||
case SF_FORMAT_AIFF : return "aiff" ;
|
||||
case SF_FORMAT_AU : return "au" ;
|
||||
case SF_FORMAT_PAF : return "paf" ;
|
||||
case SF_FORMAT_SVX : return "svx" ;
|
||||
case SF_FORMAT_NIST : return "nist" ;
|
||||
case SF_FORMAT_VOC : return "voc" ;
|
||||
case SF_FORMAT_IRCAM : return "ircam" ;
|
||||
case SF_FORMAT_W64 : return "w64" ;
|
||||
case SF_FORMAT_MAT4 : return "mat4" ;
|
||||
case SF_FORMAT_MAT5 : return "mat5" ;
|
||||
case SF_FORMAT_PVF : return "pvf" ;
|
||||
case SF_FORMAT_XI : return "xi" ;
|
||||
case SF_FORMAT_HTK : return "htk" ;
|
||||
case SF_FORMAT_SDS : return "sds" ;
|
||||
case SF_FORMAT_AVR : return "avr" ;
|
||||
case SF_FORMAT_WAVEX : return "wavx" ;
|
||||
case SF_FORMAT_SD2 : return "sd2" ;
|
||||
case SF_FORMAT_FLAC : return "flac" ;
|
||||
case SF_FORMAT_CAF : return "caf" ;
|
||||
case SF_FORMAT_WVE : return "wfe" ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
return "unknown" ;
|
||||
} /* string_of_major_format */
|
||||
|
||||
static const char *
|
||||
string_of_minor_format (int format)
|
||||
{
|
||||
switch (format & SF_FORMAT_SUBMASK)
|
||||
{
|
||||
case SF_FORMAT_PCM_S8 : return "int8" ;
|
||||
case SF_FORMAT_PCM_U8 : return "uint8" ;
|
||||
case SF_FORMAT_PCM_16 : return "int16" ;
|
||||
case SF_FORMAT_PCM_24 : return "int24" ;
|
||||
case SF_FORMAT_PCM_32 : return "int32" ;
|
||||
case SF_FORMAT_FLOAT : return "float" ;
|
||||
case SF_FORMAT_DOUBLE : return "double" ;
|
||||
case SF_FORMAT_ULAW : return "ulaw" ;
|
||||
case SF_FORMAT_ALAW : return "alaw" ;
|
||||
case SF_FORMAT_IMA_ADPCM : return "ima_adpcm" ;
|
||||
case SF_FORMAT_MS_ADPCM : return "ms_adpcm" ;
|
||||
case SF_FORMAT_GSM610 : return "gsm610" ;
|
||||
case SF_FORMAT_G721_32 : return "g721_32" ;
|
||||
case SF_FORMAT_G723_24 : return "g723_24" ;
|
||||
case SF_FORMAT_G723_40 : return "g723_40" ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
return "unknown" ;
|
||||
} /* string_of_minor_format */
|
||||
|
||||
static int
|
||||
format_of_str (const std::string & fmt)
|
||||
{
|
||||
std::vector <std::string> split ;
|
||||
|
||||
str_split (fmt, "-", split) ;
|
||||
|
||||
if (split.size () != 2)
|
||||
return 0 ;
|
||||
|
||||
int major_fmt = major_format_of_hash (split.at (0)) ;
|
||||
if (major_fmt == 0)
|
||||
return 0 ;
|
||||
|
||||
int minor_fmt = minor_format_of_hash (split.at (1)) ;
|
||||
if (minor_fmt == 0)
|
||||
return 0 ;
|
||||
|
||||
return major_fmt | minor_fmt ;
|
||||
} /* format_of_str */
|
||||
|
||||
static void
|
||||
string_of_format (std::string & fmt, int format)
|
||||
{
|
||||
char buffer [64] ;
|
||||
|
||||
snprintf (buffer, sizeof (buffer), "%s-%s", string_of_major_format (format), string_of_minor_format (format)) ;
|
||||
|
||||
fmt = buffer ;
|
||||
|
||||
return ;
|
||||
} /* string_of_format */
|
||||
52
Engine/lib/libsndfile/Octave/sndfile_load.m
Normal file
52
Engine/lib/libsndfile/Octave/sndfile_load.m
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
## Copyright (C) 2002-2011 Erik de Castro Lopo
|
||||
##
|
||||
## 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, 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 file. If not, write to the Free Software Foundation,
|
||||
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
## -*- texinfo -*-
|
||||
## @deftypefn {Function File} {} sndfile_load (@var{filename})
|
||||
## Load data from the file given by @var{filename}.
|
||||
## @end deftypefn
|
||||
|
||||
## Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
## Description: Load the sound data from the given file name
|
||||
|
||||
function [data fs] = sndfile_load (filename)
|
||||
|
||||
if (nargin != 1),
|
||||
error ("Need an input filename") ;
|
||||
endif
|
||||
|
||||
samplerate = -1 ;
|
||||
samplingrate = -1 ;
|
||||
wavedata = -1 ;
|
||||
|
||||
|
||||
eval (sprintf ('load -f %s', filename)) ;
|
||||
|
||||
if (samplerate > 0),
|
||||
fs = samplerate ;
|
||||
elseif (samplingrate > 0),
|
||||
fs = samplingrate ;
|
||||
else
|
||||
error ("Not able to find sample rate.") ;
|
||||
endif
|
||||
|
||||
if (max (size (wavedata)) > 1),
|
||||
data = wavedata ;
|
||||
else
|
||||
error ("Not able to find waveform data.") ;
|
||||
endif
|
||||
|
||||
endfunction
|
||||
59
Engine/lib/libsndfile/Octave/sndfile_play.m
Normal file
59
Engine/lib/libsndfile/Octave/sndfile_play.m
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
## Copyright (C) 2002-2011 Erik de Castro Lopo
|
||||
##
|
||||
## 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, 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 file. If not, write to the Free Software Foundation,
|
||||
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
## -*- texinfo -*-
|
||||
## @deftypefn {Function File} {} sndfile_play (@var{data, fs})
|
||||
## Play @var{data} at sample rate @var{fs} using the sndfile-play
|
||||
## program.
|
||||
## @end deftypefn
|
||||
|
||||
## Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
## Description: Play the given data as a sound file
|
||||
|
||||
function sndfile_play (data, fs)
|
||||
|
||||
if nargin != 2,
|
||||
error ("Need two input arguments: data and fs.") ;
|
||||
endif
|
||||
|
||||
if (max (size (fs)) > 1),
|
||||
error ("Second parameter fs must be a single value.") ;
|
||||
endif
|
||||
|
||||
[nr nc] = size (data) ;
|
||||
|
||||
if (nr > nc),
|
||||
data = data' ;
|
||||
endif
|
||||
|
||||
samplerate = fs ;
|
||||
wavedata = data ;
|
||||
|
||||
filename = tmpnam () ;
|
||||
|
||||
cmd = sprintf ("save -mat-binary %s fs data", filename) ;
|
||||
|
||||
eval (cmd) ;
|
||||
|
||||
cmd = sprintf ("sndfile-play %s", filename) ;
|
||||
|
||||
[output, status] = system (cmd) ;
|
||||
|
||||
if (status),
|
||||
disp (outout) ;
|
||||
endif
|
||||
|
||||
endfunction
|
||||
53
Engine/lib/libsndfile/Octave/sndfile_save.m
Normal file
53
Engine/lib/libsndfile/Octave/sndfile_save.m
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
## Copyright (C) 2002-2011 Erik de Castro Lopo
|
||||
##
|
||||
## 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, 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 file. If not, write to the Free Software Foundation,
|
||||
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
## -*- texinfo -*-
|
||||
## @deftypefn {Function File} {} sndfile_save (@var{filename, data, fs})
|
||||
## Save the given @var{data} as audio data to the given at @var{fs}. Set
|
||||
## the sample rate to @var{fs}.
|
||||
## @end deftypefn
|
||||
|
||||
## Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
## Description: Save data as a sound file
|
||||
|
||||
function sndfile_save (filename, data, fs)
|
||||
|
||||
if nargin != 3,
|
||||
error ("Need three input arguments: filename, data and fs.") ;
|
||||
endif
|
||||
|
||||
if (! isstr (filename)),
|
||||
error ("First parameter 'filename' is must be a string.") ;
|
||||
endif
|
||||
|
||||
if (max (size (fs)) > 1),
|
||||
error ("Second parameter 'fs' must be a single value, not an array or matrix.") ;
|
||||
endif
|
||||
|
||||
[nr nc] = size (data) ;
|
||||
|
||||
if (nr > nc),
|
||||
data = data' ;
|
||||
endif
|
||||
|
||||
samplerate = fs ;
|
||||
wavedata = data ;
|
||||
|
||||
str = sprintf ("save -mat-binary %s samplerate wavedata", filename) ;
|
||||
|
||||
eval (str) ;
|
||||
|
||||
endfunction
|
||||
74
Engine/lib/libsndfile/README
Normal file
74
Engine/lib/libsndfile/README
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
libsndfile is a library of C routines for reading and writing
|
||||
files containing sampled audio data.
|
||||
|
||||
The src/ directory contains the source code for library itself.
|
||||
|
||||
The doc/ directory contains the libsndfile documentation.
|
||||
|
||||
The examples/ directory contains examples of how to write code using
|
||||
libsndfile.
|
||||
|
||||
The tests/ directory contains programs which link against libsndfile
|
||||
and test its functionality.
|
||||
|
||||
The src/GSM610 directory contains code written by Jutta Degener and Carsten
|
||||
Bormann. Their original code can be found at :
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
|
||||
The src/G72x directory contains code written and released by Sun Microsystems
|
||||
under a suitably free license.
|
||||
|
||||
The src/ALAC directory contains code written and released by Apple Inc and
|
||||
released under the Apache license.
|
||||
|
||||
|
||||
LINUX
|
||||
-----
|
||||
Wherever possible, you should use the packages supplied by your Linux
|
||||
distribution.
|
||||
|
||||
If you really do need to compile from source it should be as easy as:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
Since libsndfile optionally links against libFLAC, libogg, libvorbis and
|
||||
libopus, you will need to install appropriate versions of these libraries
|
||||
before running configure as above.
|
||||
|
||||
You can use CMake now to build under Linux, also under Windows and MacOS, see
|
||||
README.md for details. CMake toolchain is usable, but still exterimental.
|
||||
|
||||
|
||||
UNIX
|
||||
----
|
||||
Compile as for Linux.
|
||||
|
||||
|
||||
Win32/Win64
|
||||
-----------
|
||||
|
||||
Official Windows binaries are compiled with Autotools and MinGW, but you can use
|
||||
CMake to generate solution for Visual Studio. Details are described in
|
||||
README.md.
|
||||
|
||||
It is still recommended to use the libsndfile binaries available on the
|
||||
libsndfile web site.
|
||||
|
||||
MacOSX
|
||||
------
|
||||
Building on MacOSX should be the same as building it on any other Unix.
|
||||
|
||||
|
||||
CONTACTS
|
||||
--------
|
||||
|
||||
libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
The libsndfile home page is at :
|
||||
|
||||
http://libsndfile.github.io/libsndfile/
|
||||
|
||||
Bugs and support questions can be raised at :
|
||||
|
||||
https://github.com/libsndfile/libsndfile/issues
|
||||
315
Engine/lib/libsndfile/README.md
Normal file
315
Engine/lib/libsndfile/README.md
Normal file
|
|
@ -0,0 +1,315 @@
|
|||
# libsndfile
|
||||
|
||||

|
||||
|
||||
libsndfile is a C library for reading and writing files containing sampled audio
|
||||
data.
|
||||
|
||||
## Authors
|
||||
|
||||
The libsndfile project was originally developed and maintained by
|
||||
Erik de Castro Lopo <erikd@mega-nerd.com> aka @erikd. The project was developed
|
||||
on Github at <https://github.com/erikd/libsndfile>.
|
||||
|
||||
After the release of version 1.0.30, @erikd transferred the project to
|
||||
[the libsndfile team](https://github.com/libsndfile), see [AUTHORS](AUTHORS)
|
||||
for details.
|
||||
|
||||
## Hacking
|
||||
|
||||
The canonical source code repository for libsndfile is at
|
||||
<https://github.com/libsndfile/libsndfile>.
|
||||
|
||||
You can grab the source code using:
|
||||
|
||||
git clone https://github.com/libsndfile/libsndfile.git
|
||||
|
||||
For building for Android see [BuildingForAndroid][BuildingForAndroid].
|
||||
|
||||
There are currently two build systems: the traditional GNU autotool based one and
|
||||
modern CMake based build system. Use of the CMake build system is documented
|
||||
below.
|
||||
|
||||
Setting up a build environment for libsndfile on Debian or Ubuntu is as simple as:
|
||||
|
||||
sudo apt install autoconf autogen automake build-essential libasound2-dev \
|
||||
libflac-dev libogg-dev libtool libvorbis-dev libopus-dev libmp3lame-dev \
|
||||
libmpg123-dev pkg-config python
|
||||
|
||||
For other Linux distributions or any of the *BSDs, the setup should be similar
|
||||
although the package install tools and package names may be slightly different.
|
||||
|
||||
Similarly on Mac OS X, assuming [brew] is already installed:
|
||||
|
||||
brew install autoconf autogen automake flac libogg libtool libvorbis opus mpg123 pkg-config
|
||||
|
||||
Once the build environment has been set up, building and testing libsndfile is
|
||||
as simple as:
|
||||
|
||||
autoreconf -vif
|
||||
./configure --enable-werror
|
||||
make
|
||||
make check
|
||||
|
||||
## The CMake build system
|
||||
|
||||
Although Autotools is the primary and recommended build toolchain, CMake meta
|
||||
build generator is also available. The build process with CMake takes
|
||||
place in two stages. First, standard build files are created from configuration
|
||||
scripts. Then the platform's native build tools are used for the actual
|
||||
building. CMake can produce Microsoft Visual Studio project and solution files,
|
||||
Unix Makefiles, Xcode projects and [many more](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
|
||||
|
||||
Some IDE support CMake natively or with plugins, check you IDE documentation
|
||||
for details.
|
||||
|
||||
### Requirements
|
||||
|
||||
1. C99-compliant compiler toolchain (tested with GCC, Clang and Visual
|
||||
Studio 2015)
|
||||
2. CMake 3.1.3 or newer
|
||||
|
||||
There are some recommended packages to enable all features of libsndfile:
|
||||
|
||||
1. Ogg, Vorbis and FLAC libraries and headers to enable these formats support
|
||||
2. ALSA development package under Linux to build sndfile-play utility
|
||||
3. Sndio development package under BSD to build sndfile-play utility
|
||||
|
||||
### Building from command line
|
||||
|
||||
CMake can handle out-of-place builds, enabling several builds from
|
||||
the same source tree, and cross-compilation. The ability to build a directory
|
||||
tree outside the source tree is a key feature, ensuring that if a build
|
||||
directory is removed, the source files remain unaffected.
|
||||
|
||||
mkdir CMakeBuild
|
||||
cd CMakeBuild
|
||||
|
||||
Then run `cmake` command with directory where CMakeLists.txt script is located
|
||||
as argument (relative paths are supported):
|
||||
|
||||
cmake ..
|
||||
|
||||
This command will configure and write build script or solution to CMakeBuild
|
||||
directory. CMake is smart enough to create Unix makefiles under Linux or Visual
|
||||
Studio solution if you have Visual Studio installed, but you can configure
|
||||
[generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
|
||||
with `-G` command line parameter:
|
||||
|
||||
cmake .. -G"Unix Makefiles"
|
||||
|
||||
The build procedure depends on the selected generator. With "Unix Makefiles" you
|
||||
can type:
|
||||
|
||||
make & make install
|
||||
|
||||
With "Visual Studio" and some other generators you can open solution or project
|
||||
from `CMakeBuild` directory and build using IDE.
|
||||
|
||||
Finally, you can use unified command:
|
||||
|
||||
cmake --build .
|
||||
|
||||
CMake also provides Qt-based cross platform GUI, cmake-gui. Using it is trivial
|
||||
and does not require detailed explanations.
|
||||
|
||||
### Configuring CMake
|
||||
|
||||
You can pass additional options with `/D<parameter>=<value>` when you run
|
||||
`cmake` command. Some useful system options:
|
||||
|
||||
* `CMAKE_C_FLAGS` - additional C compiler flags
|
||||
* `CMAKE_BUILD_TYPE` - configuration type, `DEBUG`, `RELEASE`, `RELWITHDEBINFO`
|
||||
or `MINSIZEREL`. `DEBUG` is default
|
||||
* `CMAKE_INSTALL_PREFIX` - build install location, the same as `--prefix` option
|
||||
of `configure` script
|
||||
|
||||
Useful libsndfile options:
|
||||
|
||||
* `BUILD_SHARED_LIBS` - build shared library (DLL under Windows) when `ON`,
|
||||
build static library othervise. This option is `OFF` by default.
|
||||
* `BUILD_PROGRAMS` - build libsndfile's utilities from `programs/` directory,
|
||||
`ON` by default.
|
||||
* `BUILD_EXAMPLES` - build examples, `ON` by default.
|
||||
* `BUILD_TESTING` - build tests. Then you can run tests with `ctest` command,
|
||||
`ON` by default. Setting `BUILD_SHARED_LIBS` to `ON` disables this option.
|
||||
* `ENABLE_EXTERNAL_LIBS` - enable Ogg, Vorbis, FLAC and Opus support. This
|
||||
option is available and set to `ON` if all dependency libraries were found.
|
||||
* `ENABLE_MPEG` - MP3 support. This option is available and set to `ON` if all
|
||||
dependency libraries were found.
|
||||
* `ENABLE_CPU_CLIP` - enable tricky cpu specific clipper. Enabled and set to
|
||||
`ON` when CPU clips negative\positive. Don't touch it if you are not sure
|
||||
* `ENABLE_BOW_DOCS` - enable black-on-white documentation theme, `OFF` by
|
||||
default.
|
||||
* `ENABLE_EXPERIMENTAL` - enable experimental code. Don't use it if you are
|
||||
not sure. This option is `OFF` by default.
|
||||
* `ENABLE_CPACK` - enable [CPack](https://cmake.org/cmake/help/latest/module/CPack.html) support.
|
||||
This option is `ON` by default.
|
||||
* `ENABLE_PACKAGE_CONFIG` - generate and install [package config file](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages).
|
||||
* `INSTALL_PKGCONFIG_MODULE` - generate and install [pkg-config module](https://people.freedesktop.org/~dbn/pkg-config-guide.html).
|
||||
* `INSTALL_MANPAGES` - install [man pages](https://en.wikipedia.org/wiki/Man_page) for programs. This option is `ON` by default
|
||||
* `ENABLE_STATIC_RUNTIME` - enable static runtime on Windows platform (MSVC and
|
||||
MinGW), `OFF` by default.
|
||||
|
||||
**Note**: For MSVC compiler this option is deprecated for CMake >= 3.15, see
|
||||
policy [CMP0091](https://cmake.org/cmake/help/latest/policy/CMP0091.html).
|
||||
Use `CMAKE_MSVC_RUNTIME_LIBRARY` option instead.
|
||||
|
||||
**Note**: For MinGW toolchain this option is experimental. If you enabled it
|
||||
and then disabled again, you need to clear CMake cache (delete CMakeCache.txt).
|
||||
* `ENABLE_COMPATIBLE_LIBSNDFILE_NAME` - set DLL name to `libsndfile-1.dll`
|
||||
(canonical name) on Windows platform, `sndfile.dll` otherwise, `OFF` by
|
||||
default. Library name can be different depending on platform. The well known
|
||||
DLL name on Windows platform is `libsndfile-1.dll`, because the only way to
|
||||
build Windows library before was MinGW toolchain with Autotools. This name
|
||||
is native for MinGW ecosystem, Autotools constructs it using MinGW platform
|
||||
rules from `sndfile` target. But when you build with CMake using native
|
||||
Windows compiler, the name is `sndfile.dll`. This is name for native Windows
|
||||
platform, because Windows has no library naming rules. It is preffered
|
||||
because you can search library using package manager or CMake's
|
||||
`find_library` command on any platform using the same `sndfile` name.
|
||||
|
||||
* `ENABLE_SSE2` - add compiler flag to enable SSE2 if required, `ON` by default.
|
||||
|
||||
This option is for X86 and GCC compatible compilers configurations only.
|
||||
|
||||
If you compile for other SIMD set, e.g. AVX2, you may want to set
|
||||
`ENABLE_SSE2` to `OFF`.
|
||||
|
||||
**Note**: This option is not active for X64 configuration, because SSE2 is
|
||||
always available in this mode and all optimizations are enabled by default.
|
||||
|
||||
Deprecated options:
|
||||
|
||||
* `DISABLE_EXTERNAL_LIBS` - disable Ogg, Vorbis and FLAC support. Replaced by
|
||||
`ENABLE_EXTERNAL_LIBS`
|
||||
* `DISABLE_CPU_CLIP` - disable tricky cpu specific clipper. Replaced by
|
||||
`ENABLE_CPU_CLIP`
|
||||
* `BUILD_STATIC_LIBS` - build static library. Use `BUILD_SHARED_LIBS` instead
|
||||
|
||||
### Linking from CMake projects
|
||||
|
||||
First you need to add `FindOgg.cmake`, `FindVorbis.cmake`, `FindFLAC.cmake` and
|
||||
`FindOpus.cmake` files to some directory inside your CMake project (usually
|
||||
`cmake`) and add it to `CMAKE_MODULE_PATH`:
|
||||
|
||||
project(SomeApplication)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
Now you can search `libsndfile` library from your `CMakeLists.txt`
|
||||
with this command:
|
||||
|
||||
find_package(SndFile)
|
||||
|
||||
`SndFile_FOUND` is set to `ON` when library is found.
|
||||
|
||||
If `libsndfile` dependency is critical, you can add `REQUIRED` to
|
||||
`find_package`:
|
||||
|
||||
find_package(SndFile REQUIRED)
|
||||
|
||||
With with option `find_package` will terminate configuration process
|
||||
if `libsndfile` is not found.
|
||||
|
||||
You can also add version check:
|
||||
|
||||
find_package(SndFile 1.0.29)
|
||||
|
||||
`find_package` will report error, if `libsndfile` version is < 1.0.29.
|
||||
|
||||
You can combine `REQUIRED` and version if you need.
|
||||
|
||||
To link `libsndfile` library use:
|
||||
|
||||
target_link_libraries(my_application PRIVATE SndFile::sndfile)
|
||||
|
||||
### Notes for Windows users
|
||||
|
||||
#### System CRT library
|
||||
|
||||
First advice about Visual Studio [system CRT libraries](https://docs.microsoft.com/en-us/cpp/c-runtime-library/c-run-time-library-reference?view=vs-2019),
|
||||
it is system code linked as static or dynamic library to every C application.
|
||||
|
||||
You can find related option in Visual Studio project properties:
|
||||
|
||||
C/C++ -> Code Generation -> Runtime Library
|
||||
|
||||
Dynamic version of system CRT library is default and it means that end user needs
|
||||
to have the same runtime library installed on his system. Most likely it is so,
|
||||
but if it is not, the user will see this error message using libsndfile DLL:
|
||||
|
||||
"The program can't start because <crt-dll-name>.dll is missing from your computer. Try reinstalling the program to fix this problem. "
|
||||
|
||||
To avoid this, you may want to enable static CRT library linking. In this case
|
||||
the size of your DLL will increase slightly the size will increase slightly, but
|
||||
you can redistribute the libsndfile DLL without having to install the correct
|
||||
version of the system CRT library.
|
||||
|
||||
CMake project will use dynamic system CRT libraries by default, just like
|
||||
Visual Studio does. But you can change it using `ENABLE_STATIC_RUNTIME` or
|
||||
`CMAKE_MSVC_RUNTIME_LIBRARY` options.
|
||||
|
||||
**Note**: You cannot use both options at the same time, it will lead to a
|
||||
configuration error.
|
||||
|
||||
If you have CMake >= 3.15 you should use
|
||||
[`CMAKE_MSVC_RUNTIME_LIBRARY`](https://cmake.org/cmake/help/v3.15/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html) option.
|
||||
|
||||
This will enable static linking:
|
||||
|
||||
cmake .. -D"MultiThreaded$<$<CONFIG:Debug>:Debug>"
|
||||
|
||||
You can use libsndfile `ENABLE_STATIC_RUNTIME` option to to control CRT library
|
||||
linking for CMake project: `OFF` or unset (default) for dynamic, and `ON` for
|
||||
static linking:
|
||||
|
||||
cmake .. -DENABLE_STATIC_RUNTIME=ON
|
||||
|
||||
**Note**: This option is deprecated and may be removed in far future because we
|
||||
have standard option `CMAKE_MSVC_RUNTIME_LIBRARY` now.
|
||||
|
||||
#### Using Vcpkg package manager
|
||||
|
||||
Second advice is about Ogg, Vorbis FLAC and Opus support. Searching external
|
||||
libraries under Windows is a little bit tricky. The best way is to use
|
||||
[Vcpkg](https://github.com/Microsoft/vcpkg).
|
||||
|
||||
Install Vcpkg and then add this parameter to cmake command line:
|
||||
|
||||
-DCMAKE_TOOLCHAIN_FILE=<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake
|
||||
|
||||
You also need to set `VCPKG_TARGET_TRIPLET` if you want to use static libraries:
|
||||
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows-static
|
||||
|
||||
Then you need to install static libogg, libvorbis, libflac, libopus, mpg123 and
|
||||
mp3lame Vcpkg packages.
|
||||
|
||||
After 1.1.0beta2 you don't need to install dependencies manually. Libsndfile
|
||||
now supports [Vcpkg manifest mode](https://vcpkg.readthedocs.io/en/latest/users/manifests/)
|
||||
and all dependencies are installed automatically.
|
||||
|
||||
However, you can turn off the manifest mode and return to the classic mode using
|
||||
the `VCPKG_MANIFEST_MODE` parameter from the command line:
|
||||
|
||||
-DVCPKG_MANIFEST_MODE=OFF
|
||||
|
||||
In classic mode, you need to install the required libraries manually:
|
||||
|
||||
vcpkg install libvorbis:x64-windows-static libflac:x64-windows-static
|
||||
opus:x64-windows-static mp3lame:x86-windows-static mpg123:x86-windows-static
|
||||
libvorbis:x86-windows-static libflac:x86-windows-static
|
||||
opus:x86-windows-static mp3lame:x86-windows-static mpg123:x86-windows-static
|
||||
|
||||
**Note**: Use must use the same CRT library for external libraries and the
|
||||
libsndfile library itself. For `*-static` triplets Vcpkg uses
|
||||
[static CRT](https://vcpkg.readthedocs.io/en/latest/users/triplets/).
|
||||
|
||||
## Submitting Patches
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
||||
|
||||
[brew]: http://brew.sh/
|
||||
[github]: http://libsndfile.github.io/libsndfile/
|
||||
[BuildingForAndroid]: https://github.com/libsndfile/libsndfile/blob/master/Building-for-Android.md
|
||||
11
Engine/lib/libsndfile/SECURITY.md
Normal file
11
Engine/lib/libsndfile/SECURITY.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.1.x | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please send report privately to evpobr@gmail.com, and include how would you like to be credited.
|
||||
96
Engine/lib/libsndfile/Scripts/android-configure.sh
Normal file
96
Engine/lib/libsndfile/Scripts/android-configure.sh
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# Copyright (C) 2013-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Neither the author nor the names of any contributors may be used
|
||||
# to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Android NDK version number; eg r10, r10b etc
|
||||
ANDROID_NDK_VER=${ANDROID_NDK_VER:-r10}
|
||||
|
||||
# Android NDK gcc version; eg 4.8, 4.9 etc.
|
||||
ANDROID_GCC_VER=${ANDROID_GCC_VER:-4.9}
|
||||
|
||||
# Android API version; eg 14 (Android 4.0), 21 (Android 5.0) etc.
|
||||
ANDROID_API_VER=${ANDROID_API_VER:-14}
|
||||
|
||||
ANDROID_TARGET=${ANDROID_TARGET:-arm-linux-androideabi}
|
||||
|
||||
if test -z ${ANDROID_TOOLCHAIN_HOME} ; then
|
||||
echo "Environment variable ANDROID_TOOLCHAIN_HOME not defined."
|
||||
echo "This should point to the directory containing the Android NDK."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# No more user config beyond here.
|
||||
|
||||
BUILD_MACHINE=$(uname -s | tr 'A-Z' 'a-z')-$(uname -m)
|
||||
|
||||
function die_with {
|
||||
echo $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
export CROSS_COMPILE=${ANDROID_TARGET}
|
||||
|
||||
# Don't forget to adjust this to your NDK path
|
||||
export ANDROID_NDK=${ANDROID_TOOLCHAIN_HOME}/android-ndk-${ANDROID_NDK_VER}
|
||||
test -d ${ANDROID_NDK} || die_with "Error : ANDROID_NDK '$ANDROID_NDK' does not exist."
|
||||
|
||||
export ANDROID_PREFIX=${ANDROID_NDK}/toolchains/arm-linux-androideabi-${ANDROID_GCC_VER}/prebuilt/${BUILD_MACHINE}
|
||||
test -d ${ANDROID_PREFIX} || die_with "Error : ANDROID_PREFIX '$ANDROID_PREFIX' does not exist."
|
||||
|
||||
export SYSROOT=${ANDROID_NDK}/platforms/android-${ANDROID_API_VER}/arch-arm
|
||||
test -d ${SYSROOT} || die_with "Error : SYSROOT '$SYSROOT' does not exist."
|
||||
|
||||
export CROSS_PREFIX=${ANDROID_PREFIX}/bin/${CROSS_COMPILE}
|
||||
test -f ${CROSS_PREFIX}-gcc || die_with "Error : CROSS_PREFIX compiler '${CROSS_PREFIX}-gcc' does not exist."
|
||||
|
||||
|
||||
# Non-exhaustive lists of compiler + binutils
|
||||
# Depending on what you compile, you might need more binutils than that
|
||||
export CPP=${CROSS_PREFIX}-cpp
|
||||
export AR=${CROSS_PREFIX}-ar
|
||||
export AS=${CROSS_PREFIX}-as
|
||||
export NM=${CROSS_PREFIX}-nm
|
||||
export CC=${CROSS_PREFIX}-gcc
|
||||
export CXX=${CROSS_PREFIX}-g++
|
||||
export LD=${CROSS_PREFIX}-ld
|
||||
export RANLIB=${CROSS_PREFIX}-ranlib
|
||||
|
||||
# Don't mix up .pc files from your host and build target
|
||||
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
|
||||
|
||||
# Set up the needed FLAGS.
|
||||
export CFLAGS="${CFLAGS} -gstabs --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include"
|
||||
export CXXFLAGS="${CXXFLAGS} -gstabs -fno-exceptions --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_GCC_VER}/include/ -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_GCC_VER}/libs/armeabi/include"
|
||||
|
||||
export CPPFLAGS="${CFLAGS}"
|
||||
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib"
|
||||
|
||||
# Create a symlink to the gdbclient.
|
||||
test -h gdbclient || ln -s ${ANDROID_PREFIX}/bin/arm-linux-androideabi-gdb gdbclient
|
||||
|
||||
./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} "$@"
|
||||
4
Engine/lib/libsndfile/Scripts/asan-configure.sh
Normal file
4
Engine/lib/libsndfile/Scripts/asan-configure.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash -eu
|
||||
|
||||
CFLAGS="-fsanitize=address -g" CXXFLAGS=${CFLAGS} ./configure
|
||||
|
||||
61
Engine/lib/libsndfile/Scripts/build-test-tarball.mk.in
Normal file
61
Engine/lib/libsndfile/Scripts/build-test-tarball.mk.in
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# This is probably only going to work with GNU Make.
|
||||
# This in a separate file instead of in Makefile.am because Automake complains
|
||||
# about the GNU Make-isms.
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
|
||||
HOST_TRIPLET = @HOST_TRIPLET@
|
||||
|
||||
SRC_BINDIR = @SRC_BINDIR@
|
||||
TEST_BINDIR = @TEST_BINDIR@
|
||||
|
||||
LIBRARY := $(SRC_BINDIR)libsndfile.so.$(LIB_VERSION)
|
||||
|
||||
LIB_VERSION := $(shell echo $(PACKAGE_VERSION) | sed -e 's/[a-z].*//')
|
||||
|
||||
TESTNAME = libsndfile-testsuite-$(HOST_TRIPLET)-$(PACKAGE_VERSION)
|
||||
|
||||
TARBALL = $(TESTNAME).tar.gz
|
||||
|
||||
# Find the test programs by grepping the script for the programs it executes.
|
||||
testprogs := $(shell grep '^\./' tests/test_wrapper.sh | sed -e "s|./||" -e "s/ .*//" | sort | uniq)
|
||||
# Also add the programs not found by the above.
|
||||
testprogs += tests/sfversion$(EXEEXT) tests/stdin_test$(EXEEXT) tests/stdout_test$(EXEEXT) \
|
||||
tests/cpp_test$(EXEEXT) tests/win32_test$(EXEEXT)
|
||||
|
||||
libfiles := $(shell if test ! -z $(EXEEXT) ; then echo "src/libsndfile-1.def src/.libs/libsndfile-1.dll" ; elif test -f $(LIBRARY) ; then echo $(LIBRARY) ; fi ; fi)
|
||||
|
||||
testbins := $(testprogs) $(libfiles)
|
||||
|
||||
all : $(TARBALL)
|
||||
|
||||
clean :
|
||||
rm -rf $(TARBALL) $(TESTNAME)/
|
||||
|
||||
check : $(TESTNAME)/test_wrapper.sh
|
||||
(cd ./$(TESTNAME)/ && ./test_wrapper.sh)
|
||||
|
||||
$(TARBALL) : $(TESTNAME)/test_wrapper.sh
|
||||
tar zcf $@ $(TESTNAME)
|
||||
rm -rf $(TESTNAME)
|
||||
@echo
|
||||
@echo "Created : $(TARBALL)"
|
||||
@echo
|
||||
|
||||
$(TESTNAME)/test_wrapper.sh : tests/test_wrapper.sh tests/pedantic-header-test.sh
|
||||
rm -rf $(TESTNAME)
|
||||
mkdir -p $(TESTNAME)/tests/
|
||||
echo
|
||||
echo $(testbins)
|
||||
echo
|
||||
cp $(testbins) $(TESTNAME)/tests/
|
||||
cp tests/test_wrapper.sh $(TESTNAME)/
|
||||
cp tests/pedantic-header-test.sh $(TESTNAME)/tests/
|
||||
chmod u+x $@
|
||||
|
||||
tests/test_wrapper.sh : tests/test_wrapper.sh.in
|
||||
make $@
|
||||
13
Engine/lib/libsndfile/Scripts/clang-sanitize.sh
Normal file
13
Engine/lib/libsndfile/Scripts/clang-sanitize.sh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This is known to work with clang-3.4 from Debian testing/unstable.
|
||||
# 2013/07/14
|
||||
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
export CFLAGS="-O3 -fsanitize=address,integer,undefined"
|
||||
export CXXFLAGS="-O3 -fsanitize=address,integer,undefined"
|
||||
|
||||
./configure --enable-gcc-werror
|
||||
|
||||
make clean all check
|
||||
9
Engine/lib/libsndfile/Scripts/cmake-build.sh
Normal file
9
Engine/lib/libsndfile/Scripts/cmake-build.sh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash -eu
|
||||
|
||||
rm -rf CMakeCache.txt CMakeFiles/ _Build
|
||||
|
||||
mkdir _Build
|
||||
cd _Build
|
||||
cmake ..
|
||||
cmake --build .
|
||||
ctest -V
|
||||
256
Engine/lib/libsndfile/Scripts/cstyle.py
Normal file
256
Engine/lib/libsndfile/Scripts/cstyle.py
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
#!/usr/bin/python -tt
|
||||
#
|
||||
# Copyright (C) 2005-2017 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
#
|
||||
# Released under the 2 clause BSD license.
|
||||
|
||||
"""
|
||||
This program checks C code for compliance to coding standards used in
|
||||
libsndfile and other projects I run.
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
class Preprocessor:
|
||||
"""
|
||||
Preprocess lines of C code to make it easier for the CStyleChecker class to
|
||||
test for correctness. Preprocessing works on a single line at a time but
|
||||
maintains state between consecutive lines so it can preprocessess multi-line
|
||||
comments.
|
||||
Preprocessing involves:
|
||||
- Strip C++ style comments from a line.
|
||||
- Strip C comments from a series of lines. When a C comment starts and
|
||||
ends on the same line it will be replaced with 'comment'.
|
||||
- Replace arbitrary C strings with the zero length string.
|
||||
- Replace '#define f(x)' with '#define f (c)' (The C #define requires that
|
||||
there be no space between defined macro name and the open paren of the
|
||||
argument list).
|
||||
Used by the CStyleChecker class.
|
||||
"""
|
||||
def __init__ (self):
|
||||
self.comment_nest = 0
|
||||
self.leading_space_re = re.compile ('^(\t+| )')
|
||||
self.trailing_space_re = re.compile ('(\t+| )$')
|
||||
self.define_hack_re = re.compile ("(#\s*define\s+[a-zA-Z0-9_]+)\(")
|
||||
|
||||
def comment_nesting (self):
|
||||
"""
|
||||
Return the currect comment nesting. At the start and end of the file,
|
||||
this value should be zero. Inside C comments it should be 1 or
|
||||
(possibly) more.
|
||||
"""
|
||||
return self.comment_nest
|
||||
|
||||
def __call__ (self, line):
|
||||
"""
|
||||
Strip the provided line of C and C++ comments. Stripping of multi-line
|
||||
C comments works as expected.
|
||||
"""
|
||||
|
||||
line = self.define_hack_re.sub (r'\1 (', line)
|
||||
|
||||
line = self.process_strings (line)
|
||||
|
||||
# Strip C++ style comments.
|
||||
if self.comment_nest == 0:
|
||||
line = re.sub ("( |\t*)//.*", '', line)
|
||||
|
||||
# Strip C style comments.
|
||||
open_comment = line.find ('/*')
|
||||
close_comment = line.find ('*/')
|
||||
|
||||
if self.comment_nest > 0 and close_comment < 0:
|
||||
# Inside a comment block that does not close on this line.
|
||||
return ""
|
||||
|
||||
if open_comment >= 0 and close_comment < 0:
|
||||
# A comment begins on this line but doesn't close on this line.
|
||||
self.comment_nest += 1
|
||||
return self.trailing_space_re.sub ('', line [:open_comment])
|
||||
|
||||
if open_comment < 0 and close_comment >= 0:
|
||||
# Currently open comment ends on this line.
|
||||
self.comment_nest -= 1
|
||||
return self.trailing_space_re.sub ('', line [close_comment + 2:])
|
||||
|
||||
if open_comment >= 0 and close_comment > 0 and self.comment_nest == 0:
|
||||
# Comment begins and ends on this line. Replace it with 'comment'
|
||||
# so we don't need to check whitespace before and after the comment
|
||||
# we're removing.
|
||||
newline = line [:open_comment] + "comment" + line [close_comment + 2:]
|
||||
return self.__call__ (newline)
|
||||
|
||||
return line
|
||||
|
||||
def process_strings (self, line):
|
||||
"""
|
||||
Given a line of C code, return a string where all literal C strings have
|
||||
been replaced with the empty string literal "".
|
||||
"""
|
||||
for k in range (0, len (line)):
|
||||
if line [k] == '"':
|
||||
start = k
|
||||
for k in range (start + 1, len (line)):
|
||||
if line [k] == '"' and line [k - 1] != '\\':
|
||||
return line [:start + 1] + '"' + self.process_strings (line [k + 1:])
|
||||
return line
|
||||
|
||||
|
||||
class CStyleChecker:
|
||||
"""
|
||||
A class for checking the whitespace and layout of a C code.
|
||||
"""
|
||||
def __init__ (self, debug):
|
||||
self.debug = debug
|
||||
self.filename = None
|
||||
self.error_count = 0
|
||||
self.line_num = 1
|
||||
self.orig_line = ''
|
||||
self.trailing_newline_re = re.compile ('[\r\n]+$')
|
||||
self.indent_re = re.compile ("^\s*")
|
||||
self.last_line_indent = ""
|
||||
self.last_line_indent_curly = False
|
||||
self.re_checks = \
|
||||
[ ( re.compile (" "), "multiple space instead of tab" )
|
||||
, ( re.compile ("\t "), "space after tab" )
|
||||
, ( re.compile ("[^ ];"), "missing space before semi-colon" )
|
||||
, ( re.compile ("{[^\s}]"), "missing space after open brace" )
|
||||
, ( re.compile ("[^{\s]}"), "missing space before close brace" )
|
||||
, ( re.compile ("[ \t]+$"), "contains trailing whitespace" )
|
||||
|
||||
, ( re.compile (",[^\s\n]"), "missing space after comma" )
|
||||
, ( re.compile (";[^\s]"), "missing space after semi-colon" )
|
||||
, ( re.compile ("=[^\s\"'=]"), "missing space after assignment" )
|
||||
|
||||
# Open and close parenthesis.
|
||||
, ( re.compile ("[^\s\(\[\*&']\("), "missing space before open parenthesis" )
|
||||
, ( re.compile ("\)(-[^>]|[^,'\s\n\)\]-])"), "missing space after close parenthesis" )
|
||||
, ( re.compile ("\s(do|for|if|when)\s.*{$"), "trailing open parenthesis at end of line" )
|
||||
, ( re.compile ("\( [^;]"), "space after open parenthesis" )
|
||||
, ( re.compile ("[^;] \)"), "space before close parenthesis" )
|
||||
|
||||
# Open and close square brace.
|
||||
, ( re.compile ("[^\s\(\]]\["), "missing space before open square brace" )
|
||||
, ( re.compile ("\][^,\)\]\[\s\.-]"), "missing space after close square brace" )
|
||||
, ( re.compile ("\[ "), "space after open square brace" )
|
||||
, ( re.compile (" \]"), "space before close square brace" )
|
||||
|
||||
# Space around operators.
|
||||
, ( re.compile ("[^\s][\*/%+-][=][^\s]"), "missing space around opassign" )
|
||||
, ( re.compile ("[^\s][<>!=^/][=]{1,2}[^\s]"), "missing space around comparison" )
|
||||
|
||||
# Parens around single argument to return.
|
||||
, ( re.compile ("\s+return\s+\([a-zA-Z0-9_]+\)\s+;"), "parens around return value" )
|
||||
|
||||
# Parens around single case argument.
|
||||
, ( re.compile ("\s+case\s+\([a-zA-Z0-9_]+\)\s+:"), "parens around single case argument" )
|
||||
|
||||
# Open curly at end of line.
|
||||
, ( re.compile ("\)\s*{\s*$"), "open curly brace at end of line" )
|
||||
|
||||
# Pre and post increment/decrment.
|
||||
, ( re.compile ("[^\(\[][+-]{2}[a-zA-Z0-9_]"), "space after pre increment/decrement" )
|
||||
, ( re.compile ("[a-zA-Z0-9_][+-]{2}[^\)\,]]"), "space before post increment/decrement" )
|
||||
]
|
||||
|
||||
def get_error_count (self):
|
||||
"""
|
||||
Return the current error count for this CStyleChecker object.
|
||||
"""
|
||||
return self.error_count
|
||||
|
||||
def check_files (self, files):
|
||||
"""
|
||||
Run the style checker on all the specified files.
|
||||
"""
|
||||
for filename in files:
|
||||
self.check_file (filename)
|
||||
|
||||
def check_file (self, filename):
|
||||
"""
|
||||
Run the style checker on the specified file.
|
||||
"""
|
||||
self.filename = filename
|
||||
cfile = open (filename, "r")
|
||||
|
||||
self.line_num = 1
|
||||
|
||||
preprocess = Preprocessor ()
|
||||
while 1:
|
||||
line = cfile.readline ()
|
||||
if not line:
|
||||
break
|
||||
|
||||
line = self.trailing_newline_re.sub ('', line)
|
||||
self.orig_line = line
|
||||
|
||||
self.line_checks (preprocess (line))
|
||||
|
||||
self.line_num += 1
|
||||
|
||||
cfile.close ()
|
||||
self.filename = None
|
||||
|
||||
# Check for errors finding comments.
|
||||
if preprocess.comment_nesting () != 0:
|
||||
print ("Weird, comments nested incorrectly.")
|
||||
sys.exit (1)
|
||||
|
||||
return
|
||||
|
||||
def line_checks (self, line):
|
||||
"""
|
||||
Run the style checker on provided line of text, but within the context
|
||||
of how the line fits within the file.
|
||||
"""
|
||||
|
||||
indent = len (self.indent_re.search (line).group ())
|
||||
if re.search ("^\s+}", line):
|
||||
if not self.last_line_indent_curly and indent != self.last_line_indent:
|
||||
None # self.error ("bad indent on close curly brace")
|
||||
self.last_line_indent_curly = True
|
||||
else:
|
||||
self.last_line_indent_curly = False
|
||||
|
||||
# Now all the regex checks.
|
||||
for (check_re, msg) in self.re_checks:
|
||||
if check_re.search (line):
|
||||
self.error (msg)
|
||||
|
||||
if re.search ("[a-zA-Z0-9][<>!=^/&\|]{1,2}[a-zA-Z0-9]", line):
|
||||
if not re.search (".*#include.*[a-zA-Z0-9]/[a-zA-Z]", line):
|
||||
self.error ("missing space around operator")
|
||||
|
||||
self.last_line_indent = indent
|
||||
return
|
||||
|
||||
def error (self, msg):
|
||||
"""
|
||||
Print an error message and increment the error count.
|
||||
"""
|
||||
print ("%s (%d) : %s" % (self.filename, self.line_num, msg))
|
||||
if self.debug:
|
||||
print ("'" + self.orig_line + "'")
|
||||
self.error_count += 1
|
||||
|
||||
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
if len (sys.argv) < 1:
|
||||
print ("Usage : yada yada")
|
||||
sys.exit (1)
|
||||
|
||||
# Create a new CStyleChecker object
|
||||
if sys.argv [1] == '-d' or sys.argv [1] == '--debug':
|
||||
cstyle = CStyleChecker (True)
|
||||
cstyle.check_files (sys.argv [2:])
|
||||
else:
|
||||
cstyle = CStyleChecker (False)
|
||||
cstyle.check_files (sys.argv [1:])
|
||||
|
||||
|
||||
if cstyle.get_error_count ():
|
||||
sys.exit (1)
|
||||
|
||||
sys.exit (0)
|
||||
84
Engine/lib/libsndfile/Scripts/git-pre-commit-hook
Normal file
84
Engine/lib/libsndfile/Scripts/git-pre-commit-hook
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
#!/bin/sh
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
|
||||
against=HEAD
|
||||
else
|
||||
# Initial commit: diff against an empty tree object
|
||||
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
fi
|
||||
|
||||
# Redirect output to stderr.
|
||||
exec 1>&2
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Prevent files with non-ascii filenames from being committed.
|
||||
|
||||
if test $(git diff --cached --name-only --diff-filter=A -z $against | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 ; then
|
||||
echo "Error: Attempt to add a non-ascii file name."
|
||||
echo
|
||||
echo "This can cause problems if you want to work"
|
||||
echo "with people on other platforms."
|
||||
echo
|
||||
echo "To be portable it is advisable to rename the file ..."
|
||||
echo
|
||||
echo "Commit aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Check the formatting of all C files.
|
||||
|
||||
# http://man.openbsd.org/sed#r
|
||||
# http://man.openbsd.org/sed#E
|
||||
# http://netbsd.gw.com/cgi-bin/man-cgi?sed++NetBSD-current
|
||||
# https://github.com/freebsd/freebsd/blob/master/usr.bin/sed/main.c
|
||||
# http://git.savannah.gnu.org/gitweb/?p=sed.git;a=blob;f=sed/sed.c
|
||||
# GNU has -r and -E (undocumented); MacOS has -E but not -r; Sunos has neither.
|
||||
files=$(git diff-index --name-status --cached HEAD | grep -v ^D | sed -E "s/^[A-Z]+[A-Z0-9]*[ \t]+/ /")
|
||||
|
||||
cfiles=""
|
||||
for f in $files ; do
|
||||
if test `dirname $f` = "src/ALAC" ; then
|
||||
echo "Skipping cstyle checking on $f"
|
||||
elif test `echo $f | grep -c "\.[ch]$"` -gt 0 ; then
|
||||
cfiles="$cfiles $f"
|
||||
fi
|
||||
done
|
||||
|
||||
if test -n "$cfiles" ; then
|
||||
Scripts/cstyle.py $cfiles
|
||||
if test $? -ne 0 ; then
|
||||
echo
|
||||
echo "Commit aborted. Fix the above error before trying again."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Check the copyright notice of all files to be commited.
|
||||
|
||||
user=`git config --global user.email`
|
||||
year=`date +"%Y"`
|
||||
|
||||
missing_copyright_year=""
|
||||
if test $user = "erikd@mega-nerd.com" ; then
|
||||
for f in $files ; do
|
||||
if test `head -5 $f | grep -i copyright | grep -c -i $user` -gt 0 ; then
|
||||
user_copyright=`grep -i copyright $f | grep $user | grep -c $year`
|
||||
if test $user_copyright -lt 1 ; then
|
||||
missing_copyright_year="$missing_copyright_year $f"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -n "$missing_copyright_year" ; then
|
||||
echo "Missing current year in the copyright notice of the following files:"
|
||||
for f in $missing_copyright_year ; do
|
||||
echo " $f"
|
||||
done
|
||||
echo "Commit aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
case "$1" in
|
||||
w32)
|
||||
compiler_name=i686-w64-mingw32
|
||||
;;
|
||||
w64)
|
||||
compiler_name=x86_64-w64-mingw32
|
||||
;;
|
||||
*)
|
||||
echo "$0 (w32|w64) <other args>"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
|
||||
build_cpu=$(dpkg-architecture -qDEB_BUILD_GNU_CPU)
|
||||
build_host=$build_cpu-linux
|
||||
|
||||
./configure --host=$compiler_name --target=$compiler_name --build=$build_host \
|
||||
--program-prefix='' --disable-sqlite --disable-static $@
|
||||
125
Engine/lib/libsndfile/Scripts/static-deps-build.mk
Normal file
125
Engine/lib/libsndfile/Scripts/static-deps-build.mk
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# If this is set to true (via the environment) then CRC checking will be
|
||||
# disabled in libogg giving fuzzers a better chance at finding something.
|
||||
disable_ogg_crc ?= false
|
||||
|
||||
# Build libsndfile as a dynamic/shared library, but statically link to
|
||||
# libFLAC, libogg, libopus and libvorbis
|
||||
|
||||
ogg_version = libogg-1.3.4
|
||||
ogg_sha256sum = c163bc12bc300c401b6aa35907ac682671ea376f13ae0969a220f7ddf71893fe
|
||||
|
||||
vorbis_version = libvorbis-1.3.7
|
||||
vorbis_sha256sum = b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b
|
||||
|
||||
flac_version = flac-1.3.3
|
||||
flac_sha256sum = 213e82bd716c9de6db2f98bcadbc4c24c7e2efe8c75939a1a84e28539c4e1748
|
||||
|
||||
opus_version = opus-1.3.1
|
||||
opus_sha256sum = 65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Code follows.
|
||||
|
||||
ogg_tarball = $(ogg_version).tar.xz
|
||||
vorbis_tarball = $(vorbis_version).tar.xz
|
||||
flac_tarball = $(flac_version).tar.xz
|
||||
opus_tarball = $(opus_version).tar.gz
|
||||
|
||||
download_url = http://downloads.xiph.org/releases/
|
||||
tarball_dir = Build/Tarballs
|
||||
stamp_dir = Build/Stamp
|
||||
|
||||
build_dir = $(shell pwd)/Build
|
||||
config_options = --prefix=$(build_dir) --disable-shared --enable-option-checking
|
||||
|
||||
pwd = $(shell pwd)
|
||||
|
||||
help :
|
||||
@echo
|
||||
@echo "This script will build libsndfile as a dynamic/shared library but statically linked"
|
||||
@echo "to libFLAC, libogg and libvorbis. It should work on Linux and Mac OS X. It might"
|
||||
@echo "work on Windows with a correctly set up MinGW."
|
||||
@echo
|
||||
@echo "It requires all the normal build tools require to build libsndfile plus wget."
|
||||
@echo
|
||||
|
||||
config : Build/Stamp/configure
|
||||
|
||||
build : Build/Stamp/build
|
||||
|
||||
clean :
|
||||
rm -rf Build/flac-* Build/libogg-* Build/libvorbis-* Build/opus-*
|
||||
rm -rf Build/bin Build/include Build/lib Build/share
|
||||
rm -f Build/Stamp/install Build/Stamp/extract Build/Stamp/sha256sum Build/Stamp/build-ogg
|
||||
|
||||
Build/Stamp/init :
|
||||
mkdir -p $(stamp_dir) $(tarball_dir)
|
||||
touch $@
|
||||
|
||||
Build/Tarballs/$(flac_tarball) : Build/Stamp/init
|
||||
(cd $(tarball_dir) && wget $(download_url)flac/$(flac_tarball) -O $(flac_tarball))
|
||||
touch $@
|
||||
|
||||
Build/Tarballs/$(ogg_tarball) : Build/Stamp/init
|
||||
(cd $(tarball_dir) && wget $(download_url)ogg/$(ogg_tarball) -O $(ogg_tarball))
|
||||
touch $@
|
||||
|
||||
Build/Tarballs/$(vorbis_tarball) : Build/Stamp/init
|
||||
(cd $(tarball_dir) && wget $(download_url)vorbis/$(vorbis_tarball) -O $(vorbis_tarball))
|
||||
touch $@
|
||||
|
||||
Build/Tarballs/$(opus_tarball) : Build/Stamp/init
|
||||
(cd $(tarball_dir) && wget https://archive.mozilla.org/pub/opus/$(opus_tarball) -O $(opus_tarball))
|
||||
touch $@
|
||||
|
||||
Build/Stamp/tarballs : Build/Tarballs/$(flac_tarball) Build/Tarballs/$(ogg_tarball) Build/Tarballs/$(vorbis_tarball) Build/Tarballs/$(opus_tarball)
|
||||
touch $@
|
||||
|
||||
Build/Stamp/sha256sum : Build/Stamp/tarballs
|
||||
test `sha256sum $(tarball_dir)/$(ogg_tarball) | sed "s/ .*//"` = $(ogg_sha256sum)
|
||||
test `sha256sum $(tarball_dir)/$(vorbis_tarball) | sed "s/ .*//"` = $(vorbis_sha256sum)
|
||||
test `sha256sum $(tarball_dir)/$(flac_tarball) | sed "s/ .*//"` = $(flac_sha256sum)
|
||||
test `sha256sum $(tarball_dir)/$(opus_tarball) | sed "s/ .*//"` = $(opus_sha256sum)
|
||||
touch $@
|
||||
|
||||
Build/Stamp/extract : Build/Stamp/sha256sum
|
||||
# (cd Build && tar xf Tarballs/$(ogg_tarball))
|
||||
(cd Build && tar xf Tarballs/$(flac_tarball))
|
||||
(cd Build && tar xf Tarballs/$(vorbis_tarball))
|
||||
(cd Build && tar xf Tarballs/$(opus_tarball))
|
||||
touch $@
|
||||
|
||||
Build/Stamp/build-ogg : Build/Stamp/sha256sum
|
||||
ifeq ($(disable_ogg_crc), true)
|
||||
echo "Ogg/CRC enabled"
|
||||
(cd Build && git clone https://github.com/xiph/ogg $(ogg_version))
|
||||
(cd Build/$(ogg_version) && autoreconf -vif && CFLAGS=-fPIC ./configure $(config_options) --disable-crc && make all install)
|
||||
else
|
||||
echo "Ogg/CRC disabled"
|
||||
(cd Build && tar xf Tarballs/$(ogg_tarball))
|
||||
(cd Build/$(ogg_version) && CFLAGS=-fPIC ./configure $(config_options) && make all install)
|
||||
endif
|
||||
touch $@
|
||||
|
||||
Build/Stamp/install-libs : Build/Stamp/extract Build/Stamp/build-ogg
|
||||
(cd Build/$(vorbis_version) && CFLAGS=-fPIC ./configure $(config_options) && make all install)
|
||||
(cd Build/$(flac_version) && CFLAGS=-fPIC ./configure $(config_options) && make all install)
|
||||
(cd Build/$(opus_version) && CFLAGS=-fPIC ./configure $(config_options) && make all install)
|
||||
touch $@
|
||||
|
||||
configure : configure.ac
|
||||
autoreconf -vif
|
||||
|
||||
Build/Stamp/configure : Build/Stamp/install-libs configure
|
||||
PKG_CONFIG_LIBDIR=Build/lib/pkgconfig ./configure
|
||||
sed -i 's#^EXTERNAL_XIPH_CFLAGS.*#EXTERNAL_XIPH_CFLAGS = -I$(pwd)/Build/include#' Makefile
|
||||
sed -i 's#^EXTERNAL_XIPH_LIBS.*#EXTERNAL_XIPH_LIBS = -static $(pwd)/Build/lib/libFLAC.la $(pwd)/Build/lib/libvorbis.la $(pwd)/Build/lib/libvorbisenc.la $(pwd)/Build/lib/libopus.la $(pwd)/Build/lib/libogg.la -dynamic #' Makefile
|
||||
make clean
|
||||
touch $@
|
||||
|
||||
Build/Stamp/build : Build/Stamp/configure
|
||||
make all check
|
||||
touch $@
|
||||
|
||||
40
Engine/lib/libsndfile/Win32/README-precompiled-dll.txt
Normal file
40
Engine/lib/libsndfile/Win32/README-precompiled-dll.txt
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
Notes on Using the Pre-compiled libsndfile DLL.
|
||||
===============================================
|
||||
|
||||
In order to use this pre-compiled DLL with Visual Studio, you will need to
|
||||
generate a .LIB file from the DLL.
|
||||
|
||||
This can be achieved as follows:
|
||||
|
||||
1) In a CMD window, change to the directory containing this file and
|
||||
run the command:
|
||||
|
||||
lib /machine:i386 /def:libsndfile-1.def
|
||||
|
||||
You now have two files:
|
||||
|
||||
libsndfile-1.dll
|
||||
libsndfile-1.lib
|
||||
|
||||
to be used with VisualStudio.
|
||||
|
||||
If the lib command fails with a command saying "'lib' is not recognized as
|
||||
an internal or external command, operable program or batch file", you need
|
||||
to find the location of "lib.exe" and add that directory to your PATH
|
||||
environment variable. Another alternative is to use the "Visual Studio 2005
|
||||
Command Prompt" Start menu item:
|
||||
|
||||
Start ->
|
||||
All Programs ->
|
||||
Visual Studio 2005 ->
|
||||
Visual Studio Tools ->
|
||||
Visual Studio 2005 Command Prompt
|
||||
|
||||
If for some reason these instructions don't work for you or you are still
|
||||
not able to use the libsndfile DLL with you project, please do not contact
|
||||
the main author of libsndfile. Instead, join the libsndfile-users mailing
|
||||
list :
|
||||
|
||||
http://www.mega-nerd.com/libsndfile/lists.html
|
||||
|
||||
and ask a question there.
|
||||
16
Engine/lib/libsndfile/Win32/testprog.c
Normal file
16
Engine/lib/libsndfile/Win32/testprog.c
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* Simple test program to make sure that Win32 linking to libsndfile is
|
||||
** working.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
|
||||
int
|
||||
main (void)
|
||||
{ static char strbuffer [256] ;
|
||||
sf_command (NULL, SFC_GET_LIB_VERSION, strbuffer, sizeof (strbuffer)) ;
|
||||
puts (strbuffer) ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
46
Engine/lib/libsndfile/cmake/CMakeAutoGen.cmake
Normal file
46
Engine/lib/libsndfile/cmake/CMakeAutoGen.cmake
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# CMake implementation of AutoGen
|
||||
# Copyright (C) 2017 Anonymous Maarten <anonymous.maarten@gmail.com>
|
||||
|
||||
set(AUTOGEN_SCRIPT "${CMAKE_MODULE_PATH}/CMakeAutoGenScript.cmake")
|
||||
|
||||
function(lsf_autogen DIR_REL NAME_WE)
|
||||
set(EXTS ${ARGN})
|
||||
set(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_REL}/${NAME_WE}.def")
|
||||
set(OUTPUTS)
|
||||
foreach(EXT ${EXTS})
|
||||
list(APPEND OUTPUTS "${NAME_WE}.${EXT}")
|
||||
endforeach()
|
||||
add_autogen_target("${INPUT}" "${CMAKE_CURRENT_BINARY_DIR}/${DIR_REL}" ${OUTPUTS})
|
||||
endfunction()
|
||||
|
||||
function(add_autogen_target INPUT OUTPUTDIR)
|
||||
set(OUTPUTFILES "${ARGN}")
|
||||
|
||||
if (OUTPUTDIR)
|
||||
set(PREFIX "${OUTPUTDIR}/")
|
||||
else()
|
||||
set(PREFIX "")
|
||||
endif()
|
||||
|
||||
set(ARTIFACTS)
|
||||
foreach(OUTPUTFILE ${OUTPUTFILES})
|
||||
list(APPEND ARTIFACTS "${PREFIX}${OUTPUTFILE}")
|
||||
endforeach()
|
||||
|
||||
set(EXTRA_ARGS)
|
||||
if (AUTOGEN_DEBUG)
|
||||
list(APPEND EXTRA_ARGS "-DDEBUG=1")
|
||||
endif()
|
||||
if (OUTPUTDIR)
|
||||
list(APPEND EXTRA_ARGS "-DOUTPUTDIR=${OUTPUTDIR}")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${ARTIFACTS}
|
||||
COMMAND ${CMAKE_COMMAND} "-DDEFINITION=${INPUT}" ${EXTRA_ARGS} -P "${AUTOGEN_SCRIPT}"
|
||||
MAIN_DEPENDENCY "${INPUT}"
|
||||
DEPENDS "${AUTOGEN_SCRIPT}"
|
||||
COMMENT "CMakeAutoGen: generating ${OUTPUTFILES}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
)
|
||||
endfunction()
|
||||
442
Engine/lib/libsndfile/cmake/CMakeAutoGenScript.cmake
Normal file
442
Engine/lib/libsndfile/cmake/CMakeAutoGenScript.cmake
Normal file
|
|
@ -0,0 +1,442 @@
|
|||
# CMake implementation of AutoGen
|
||||
# Copyright (C) 2017 Anonymous Maarten <anonymous.maarten@gmail.com>
|
||||
|
||||
set(WS " \t\r\n")
|
||||
|
||||
function(cutoff_first_occurrence TEXT OCCURRENCE RESULT)
|
||||
string(FIND "${TEXT}" "${OCCURRENCE}" OCCURRENCE_INDEX)
|
||||
if (OCCURRENCE_INDEX EQUAL -1)
|
||||
set(${TEXT} "" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(LENGTH "${OCCURRENCE}" OCCURRENCE_LENGTH)
|
||||
math(EXPR CUTOFF_INDEX "${OCCURRENCE_INDEX}+${OCCURRENCE_LENGTH}")
|
||||
string(SUBSTRING "${TEXT}" ${CUTOFF_INDEX} -1 TEXT_REMAINDER)
|
||||
set(${RESULT} "${TEXT_REMAINDER}" PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
function(read_definition DEFINITION_FILENAME TEMPLATE_FILENAME DATA)
|
||||
file(READ "${DEFINITION_FILENAME}" DEFINITION_CONTENTS)
|
||||
|
||||
string(REGEX MATCH "autogen definitions ([a-zA-Z\\._-]+);[${WS}]*" TEMPLATE_MATCH "${DEFINITION_CONTENTS}")
|
||||
if (NOT TEMPLATE_MATCH)
|
||||
message(FATAL_ERROR "${DEFINITION_FILENAME} doest not contain an AutoGen definition.")
|
||||
endif()
|
||||
|
||||
get_filename_component(DEFINITION_DIR "${DEFINITION_FILENAME}" PATH)
|
||||
set(${TEMPLATE_FILENAME} "${DEFINITION_DIR}/${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||
if (DEBUG)
|
||||
message("found: TEMPLATE_FILENAME=${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
|
||||
cutoff_first_occurrence("${DEFINITION_CONTENTS}" "${TEMPLATE_MATCH}" DEFINITION_CONTENTS)
|
||||
|
||||
set(DEFINITION "")
|
||||
|
||||
while (1)
|
||||
string(REGEX MATCH "([a-zA-Z_][a-zA-Z0-9_]*)[${WS}]*=[${WS}]*{[${WS}]*" GROUPSTART_MATCH "${DEFINITION_CONTENTS}")
|
||||
if (NOT GROUPSTART_MATCH)
|
||||
break()
|
||||
endif()
|
||||
set(GROUPNAME "${CMAKE_MATCH_1}")
|
||||
cutoff_first_occurrence("${DEFINITION_CONTENTS}" "${GROUPSTART_MATCH}" DEFINITION_CONTENTS)
|
||||
if (DEBUG)
|
||||
message("found: GROUPNAME=${GROUPNAME}")
|
||||
endif()
|
||||
set(NBKEYS 0)
|
||||
set(GROUP_KEY_VALUES "")
|
||||
while (1)
|
||||
string(REGEX MATCH "^([a-zA-Z_][a-zA-Z0-9_]*)[${WS}]*=[${WS}]*(([\"']([${WS}a-zA-Z0-9_%\\\"<>\(\)\\.*+/?:,\\-]+)[\"'])|([a-zA-Z0-9_%\\]+))[${WS}]*;[${WS}]*" KEY_VALUE_MATCH "${DEFINITION_CONTENTS}")
|
||||
if (NOT KEY_VALUE_MATCH)
|
||||
break()
|
||||
endif()
|
||||
set(KEY "${CMAKE_MATCH_1}")
|
||||
if ("${CMAKE_MATCH_4}" STREQUAL "")
|
||||
set(VALUE "${CMAKE_MATCH_5}")
|
||||
else()
|
||||
string(REPLACE "\\\"" "\"" VALUE "${CMAKE_MATCH_4}")
|
||||
#set(VALUE "${CMAKE_MATCH_4}")
|
||||
endif()
|
||||
|
||||
if (DEBUG)
|
||||
message("found: KEY=${KEY}, VALUE=${VALUE}")
|
||||
endif()
|
||||
math(EXPR NBKEYS "${NBKEYS}+1")
|
||||
list(APPEND GROUP_KEY_VALUES "${KEY}" "${VALUE}")
|
||||
cutoff_first_occurrence("${DEFINITION_CONTENTS}" "${KEY_VALUE_MATCH}" DEFINITION_CONTENTS)
|
||||
endwhile()
|
||||
string(REGEX MATCH "^[${WS}]*}[${WS}]*;[${WS}]*" GROUPEND_MATCH "${DEFINITION_CONTENTS}")
|
||||
if (NOT GROUPEND_MATCH)
|
||||
message(FATAL_ERROR "Group ${GROUPNAME} did not finish.")
|
||||
endif()
|
||||
cutoff_first_occurrence("${DEFINITION_CONTENTS}" "${GROUPEND_MATCH}" DEFINITION_CONTENTS)
|
||||
list(APPEND DEFINITION "${GROUPNAME}" ${NBKEYS} ${GROUP_KEY_VALUES})
|
||||
endwhile()
|
||||
set(${DATA} "${DEFINITION}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(match_autogen_group TEXT START POS0 POS1 MATCH FOUND)
|
||||
string(SUBSTRING "${TEXT}" "${START}" -1 TEXT)
|
||||
string(REGEX MATCH "\\[\\+[${WS}]*([ a-zA-Z0-9=_$%\\(\\)\"\\+\\-]+)[${WS}]*\\+\\]" MATCH_GROUP "${TEXT}")
|
||||
if ("${MATCH_GROUP}" STREQUAL "")
|
||||
set(${FOUND} 0 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
string(FIND "${TEXT}" "${MATCH_GROUP}" START_TEXT)
|
||||
math(EXPR POS0_var "${START}+${START_TEXT}")
|
||||
string(LENGTH "${MATCH_GROUP}" MATCH_LENGTH)
|
||||
math(EXPR POS1_var "${POS0_var}+${MATCH_LENGTH}")
|
||||
set(${POS0} "${POS0_var}" PARENT_SCOPE)
|
||||
set(${POS1} "${POS1_var}" PARENT_SCOPE)
|
||||
set(${FOUND} 1 PARENT_SCOPE)
|
||||
string(STRIP "${CMAKE_MATCH_1}" CONTENT)
|
||||
set("${MATCH}" "${CONTENT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(append_output SUFFICES_FILENAMES TEXT POS0 POS1 FILTER)
|
||||
math(EXPR POS_LENGTH "${POS1}-${POS0}")
|
||||
string(LENGTH "${TEXT}" TEXT_LENGTH)
|
||||
string(SUBSTRING "${TEXT}" "${POS0}" "${POS_LENGTH}" TEXT_APPEND)
|
||||
if (DEBUG)
|
||||
message("appending ${POS0}:${POS1}, length=${POS_LENGTH}")
|
||||
endif()
|
||||
append_output_text("${SUFFICES_FILENAMES}" "${TEXT_APPEND}" "${FILTER}")
|
||||
endfunction()
|
||||
|
||||
function(append_output_text SUFFICES_FILENAMES TEXT_APPEND FILTER)
|
||||
string(LENGTH "${TEXT_APPEND}" TEXT_LENGTH)
|
||||
list(LENGTH SUFFICES_FILENAMES NB)
|
||||
math(EXPR NB_END "${NB}-1")
|
||||
foreach(INDEX RANGE 0 ${NB_END} 3)
|
||||
math(EXPR INDEX_1 "${INDEX}+1")
|
||||
math(EXPR INDEX_2 "${INDEX}+2")
|
||||
list(GET SUFFICES_FILENAMES ${INDEX} SUFFIX)
|
||||
list(GET SUFFICES_FILENAMES ${INDEX_1} FILENAME)
|
||||
list(GET SUFFICES_FILENAMES ${INDEX_2} TEMPFILENAME)
|
||||
set(WRITE_OK 1)
|
||||
if (FILTER)
|
||||
if (NOT "${SUFFIX}" STREQUAL "${FILTER}")
|
||||
set(WRITE_OK 0)
|
||||
endif()
|
||||
endif()
|
||||
if (WRITE_OK)
|
||||
if (DEBUG)
|
||||
message("Write: ${TEXT_LENGTH} characters to ${FILENAME}")
|
||||
endif()
|
||||
file(APPEND "${TEMPFILENAME}" "${TEXT_APPEND}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(output_finish SUFFICES_FILENAMES)
|
||||
list(LENGTH SUFFICES_FILENAMES NB)
|
||||
math(EXPR NB_END "${NB}-1")
|
||||
foreach(INDEX RANGE 0 ${NB_END} 3)
|
||||
math(EXPR INDEX_1 "${INDEX}+1")
|
||||
math(EXPR INDEX_2 "${INDEX}+2")
|
||||
list(GET SUFFICES_FILENAMES ${INDEX_1} FILENAME)
|
||||
list(GET SUFFICES_FILENAMES ${INDEX_2} TEMPFILENAME)
|
||||
file(RENAME "${TEMPFILENAME}" "${FILENAME}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(stack_push STACK_ARG)
|
||||
set(STACK_LIST "${${STACK_ARG}}")
|
||||
string(REPLACE ";" " " NEWITEM "${ARGN}")
|
||||
if (DEBUG)
|
||||
list(LENGTH STACK_LIST STACK_LENGTH)
|
||||
message("Pushing \"${NEWITEM}\" onto stack (length=${STACK_LENGTH})")
|
||||
endif()
|
||||
list(APPEND STACK_LIST "${NEWITEM}")
|
||||
set(${STACK_ARG} "${STACK_LIST}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(stack_pop STACK_ARG ITEM)
|
||||
set(STACK_LIST "${${STACK_ARG}}")
|
||||
list(LENGTH STACK_LIST STACK_LENGTH)
|
||||
if (STACK_LENGTH EQUAL 0)
|
||||
message(FATAL_ERROR "ENDFOR: stack is empty")
|
||||
endif()
|
||||
math(EXPR LAST_ITEM_INDEX "${STACK_LENGTH}-1")
|
||||
list(GET STACK_LIST "${LAST_ITEM_INDEX}" LAST_ITEM)
|
||||
list(REMOVE_AT STACK_LIST "${LAST_ITEM_INDEX}")
|
||||
string(REPLACE " " ";" LAST_ITEM_LIST "${LAST_ITEM}")
|
||||
if (DEBUG)
|
||||
message("Popping \"${LAST_ITEM}\" from stack (length=${STACK_LENGTH})")
|
||||
endif()
|
||||
set(${ITEM} "${LAST_ITEM_LIST}" PARENT_SCOPE)
|
||||
set(${STACK_ARG} "${STACK_LIST}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(stack_top STACK_ARG ITEM)
|
||||
set(STACK_LIST "${${STACK_ARG}}")
|
||||
list(LENGTH STACK_LIST STACK_LENGTH)
|
||||
if (STACK_LENGTH EQUAL 0)
|
||||
message(FATAL_ERROR "ENDFOR: stack is empty")
|
||||
endif()
|
||||
math(EXPR LAST_ITEM_INDEX "${STACK_LENGTH}-1")
|
||||
list(GET STACK_LIST "${LAST_ITEM_INDEX}" LAST_ITEM)
|
||||
string(REPLACE " " ";" LAST_ITEM_LIST "${LAST_ITEM}")
|
||||
if (DEBUG)
|
||||
message("Top of stack: \"${LAST_ITEM}\" from stack (length=${STACK_LENGTH})")
|
||||
endif()
|
||||
set(${ITEM} "${LAST_ITEM_LIST}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(stack_find_key STACK_LIST TEMPLATE_PARAMETERS KEY VALUE)
|
||||
list(REVERSE STACK_LIST)
|
||||
foreach(STACK_ITEM ${STACK_LIST})
|
||||
string(REPLACE " " ";" STACK_ITEM_LIST "${STACK_ITEM}")
|
||||
list(GET STACK_ITEM_LIST 3 TP_INDEX)
|
||||
math(EXPR TP_SIZE_INDEX "${TP_INDEX}+1")
|
||||
list(GET TEMPLATE_PARAMETERS ${TP_SIZE_INDEX} TP_SIZE)
|
||||
math(EXPR TP_KV_INDEX_START "${TP_INDEX}+2")
|
||||
math(EXPR TP_KV_INDEX_END "${TP_KV_INDEX_START}+2*${TP_SIZE}-1")
|
||||
foreach(TP_KV_INDEX RANGE ${TP_KV_INDEX_START} ${TP_KV_INDEX_END} 2)
|
||||
list(GET TEMPLATE_PARAMETERS ${TP_KV_INDEX} TP_KEY)
|
||||
if("${TP_KEY}" STREQUAL "${KEY}")
|
||||
math(EXPR TP_VALUE_INDEX "${TP_KV_INDEX}+1")
|
||||
list(GET TEMPLATE_PARAMETERS ${TP_VALUE_INDEX} TP_VALUE)
|
||||
set(${VALUE} "${TP_VALUE}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
message(FATAL_ERROR "Unknown KEY=${KEY}")
|
||||
endfunction()
|
||||
|
||||
function(template_parameters_find_next_groupname_index TEMPLATE_PARAMETERS GROUPNAME INDEX_LAST INDEX_NEXT)
|
||||
if (${INDEX_LAST} LESS 0)
|
||||
set(INDEX 0)
|
||||
else ()
|
||||
math(EXPR INDEX_1 "1+(${INDEX_LAST})")
|
||||
list(GET TEMPLATE_PARAMETERS ${INDEX_1} GROUPNAME_INDEX_SIZE)
|
||||
math(EXPR INDEX "${INDEX_LAST}+1+2*${GROUPNAME_INDEX_SIZE}+1")
|
||||
endif()
|
||||
list(LENGTH TEMPLATE_PARAMETERS PARAMETERS_LENGTH)
|
||||
while (${INDEX} LESS ${PARAMETERS_LENGTH})
|
||||
list(GET TEMPLATE_PARAMETERS ${INDEX} GROUPNAME_AT_INDEX)
|
||||
if ("${GROUPNAME}" STREQUAL "${GROUPNAME_AT_INDEX}")
|
||||
set("${INDEX_NEXT}" ${INDEX} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
math(EXPR INDEX_1 "${INDEX}+1")
|
||||
list(GET TEMPLATE_PARAMETERS ${INDEX_1} GROUPNAME_INDEX_SIZE)
|
||||
math(EXPR INDEX "${INDEX}+1+2*${GROUPNAME_INDEX_SIZE}+1")
|
||||
endwhile()
|
||||
set("${INDEX_NEXT}" -1 PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(calculate_line_number TEXT POSITION LINENUMBER_ARG)
|
||||
#math(EXPR INDEX_MAX "${POSITION}-1")
|
||||
string(SUBSTRING "${TEXT}" 0 ${POSITION} SUBTEXT)
|
||||
string(REGEX MATCHALL "\n" MATCH_NEWLINES "${SUBTEXT}")
|
||||
list(LENGTH MATCH_NEWLINES NBLINES)
|
||||
math(EXPR NBLINES "${NBLINES}+1")
|
||||
set(${LINENUMBER_ARG} ${NBLINES} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(parse_template TEMPLATE_FILENAME OUTPUT_DIR TEMPLATE_PARAMETERS)
|
||||
file(READ ${TEMPLATE_FILENAME} TEMPLATE_CONTENTS)
|
||||
set(POSITION 0)
|
||||
match_autogen_group("${TEMPLATE_CONTENTS}" "${POSITION}" POS0 POS1 AUTOGEN FOUND)
|
||||
if (NOT FOUND)
|
||||
message(FATAL_ERROR "Header of template not found")
|
||||
endif()
|
||||
string(REGEX MATCH "AutoGen5 template ([ a-zA-Z0-9]*)" SUFFICES_MATCH "${AUTOGEN}")
|
||||
if (NOT SUFFICES_MATCH)
|
||||
message(FATAL_ERROR "No output suffices found")
|
||||
endif()
|
||||
string(STRIP "${CMAKE_MATCH_1}" SUFFICES)
|
||||
string(REPLACE " " ";" SUFFICES "${SUFFICES}")
|
||||
set(SUFFICES_FILENAMES "")
|
||||
get_filename_component(TEMPLATE_NAME_WE "${TEMPLATE_FILENAME}" NAME_WE)
|
||||
foreach(SUFFIX ${SUFFICES})
|
||||
if ("${OUTPUT_DIR}" STREQUAL "")
|
||||
set(DIR_PREFIX "")
|
||||
else()
|
||||
set(DIR_PREFIX "${OUTPUT_DIR}/")
|
||||
endif()
|
||||
string(RANDOM LENGTH 64 RANDOMSTRING)
|
||||
set(FILENAME "${DIR_PREFIX}${TEMPLATE_NAME_WE}.${SUFFIX}")
|
||||
set(TEMPFILENAME "${DIR_PREFIX}${TEMPLATE_NAME_WE}${RANDOMSTRING}.${SUFFIX}")
|
||||
list(APPEND SUFFICES_FILENAMES "${SUFFIX}" "${FILENAME}" "${TEMPFILENAME}")
|
||||
file(WRITE "${FILENAME}" "")
|
||||
endforeach()
|
||||
if (DEBUG)
|
||||
message("Output files: ${SUFFICES_FILENAMES}")
|
||||
endif()
|
||||
set(WRITE_FILTER "")
|
||||
append_output("${SUFFICES_FILENAMES}" "${TEMPLATE_CONTENTS}" 0 "${POS0}" "${WRITE_FILTER}")
|
||||
math(EXPR POS1 "${POS1}+1")
|
||||
set(POSITION "${POS1}")
|
||||
if (DEBUG)
|
||||
message("Output: ${SUFFICES_FILENAMES}")
|
||||
endif()
|
||||
|
||||
set(STACK "")
|
||||
while (1)
|
||||
match_autogen_group("${TEMPLATE_CONTENTS}" "${POSITION}" POS0 POS1 GROUP_MATCH FOUND)
|
||||
if (NOT FOUND)
|
||||
if (DEBUG)
|
||||
message("No group found. Dumping rest of file.")
|
||||
endif()
|
||||
if (NOT "${STACK}" STREQUAL "")
|
||||
message(FATAL_ERROR "Stack not empty at end of file")
|
||||
endif()
|
||||
string(LENGTH "${TEMPLATE_CONTENTS}" TEXT_LENGTH)
|
||||
append_output("${SUFFICES_FILENAMES}" "${TEMPLATE_CONTENTS}" ${POSITION} ${TEXT_LENGTH} "${WRITE_FILTER}")
|
||||
break()
|
||||
endif()
|
||||
append_output("${SUFFICES_FILENAMES}" "${TEMPLATE_CONTENTS}" ${POSITION} ${POS0} "${WRITE_FILTER}")
|
||||
set(POSITION "${POS1}")
|
||||
|
||||
if (GROUP_MATCH MATCHES "^FOR")
|
||||
string(REPLACE " " ";" GROUP_MATCH_LIST "${GROUP_MATCH}")
|
||||
list(GET GROUP_MATCH_LIST 1 FOR_KEY)
|
||||
template_parameters_find_next_groupname_index("${TEMPLATE_PARAMETERS}" "${FOR_KEY}" -1 FOR_INDEX)
|
||||
if (DEBUG)
|
||||
message("FOR_KEY: ${FOR_KEY}")
|
||||
message("FOR_INDEX: ${FOR_INDEX}")
|
||||
endif()
|
||||
if (${FOR_KEY} LESS 0)
|
||||
message(FATAL_ERROR "FOR has key with empty list. Not implemented yet..")
|
||||
endif()
|
||||
stack_push(STACK FOR ${POSITION} ${FOR_KEY} ${FOR_INDEX})
|
||||
elseif (GROUP_MATCH MATCHES "^ENDFOR")
|
||||
string(REPLACE " " ";" GROUP_MATCH_LIST "${GROUP_MATCH}")
|
||||
list(GET GROUP_MATCH_LIST 1 ENDFOR_KEY)
|
||||
stack_pop(STACK FOR_ITEM)
|
||||
list(GET FOR_ITEM 0 FOR_FOR)
|
||||
if (NOT "${FOR_FOR}" STREQUAL "FOR")
|
||||
message(FATAL_ERROR "ENDFOR does not match last item: ${FOR_FOR}")
|
||||
endif()
|
||||
list(GET FOR_ITEM 1 FOR_POSITION)
|
||||
list(GET FOR_ITEM 2 FOR_KEY)
|
||||
if (NOT "${FOR_KEY}" STREQUAL "${ENDFOR_KEY}")
|
||||
calculate_line_number("${TEMPLATE_CONTENTS}" "${POSITION}" LINENUMBER)
|
||||
message("FOR and ENDFOR do not match. (line number ${LINENUMBER}) (FOR:${FOR_KEY}, ENDFOR:${ENDFOR_KEY})")
|
||||
endif()
|
||||
list(GET FOR_ITEM 3 FOR_INDEX_PREV)
|
||||
template_parameters_find_next_groupname_index("${TEMPLATE_PARAMETERS}" "${FOR_KEY}" ${FOR_INDEX_PREV} FOR_INDEX)
|
||||
if (DEBUG)
|
||||
message("FOR_INDEX was ${FOR_INDEX_PREV}, is now ${FOR_INDEX}")
|
||||
endif()
|
||||
if (${FOR_INDEX} LESS 0)
|
||||
if (DEBUG)
|
||||
message("ENDFOR: FOR_INDEX < 0 (no more key) ==> Continue")
|
||||
endif()
|
||||
else()
|
||||
set(POSITION ${FOR_POSITION})
|
||||
stack_push(STACK FOR ${FOR_POSITION} ${FOR_KEY} ${FOR_INDEX})
|
||||
if (DEBUG)
|
||||
message("ENDFOR: FOR_INDEX >= 0 (more keys available) ==> Back to position=${FOR_POSITION}")
|
||||
endif()
|
||||
endif()
|
||||
elseif (GROUP_MATCH MATCHES "^CASE")
|
||||
string(REGEX MATCH "^CASE[${WS}]+\\(([a-zA-Z]+)\\)" CASE_MATCH "${GROUP_MATCH}")
|
||||
if ("${CASE_MATCH}" STREQUAL "")
|
||||
message(FATAL_ERROR "Wrong CASE syntax")
|
||||
endif()
|
||||
set(CASE_KEY "${CMAKE_MATCH_1}")
|
||||
if (DEBUG)
|
||||
message("CASE: KEY=${CASE_KEY}")
|
||||
endif()
|
||||
stack_push(STACK CASE "${CASE_KEY}" ${POSITION})
|
||||
elseif (GROUP_MATCH MATCHES "^==")
|
||||
math(EXPR POSITION "${POSITION}+1")
|
||||
string(REGEX MATCH "^==[${WS}]+([a-zA-Z_][a-zA-Z0-9_]*)" CASE_MATCH "${GROUP_MATCH}")
|
||||
if ("${CASE_MATCH}" STREQUAL "")
|
||||
message(FATAL_ERROR "Wrong == syntax")
|
||||
endif()
|
||||
stack_top(STACK CASE_ITEM)
|
||||
list(GET CASE_ITEM 0 CASE_CASE)
|
||||
if(NOT "${CASE_CASE}" STREQUAL "CASE")
|
||||
message(FATAL_ERROR "== block must be in CASE. Top of stack=${CASE_CASE}")
|
||||
endif()
|
||||
set(CASE_VALUE "${CMAKE_MATCH_1}")
|
||||
if (DEBUG)
|
||||
message("case: == VALUE=${CASE_VALUE}")
|
||||
endif()
|
||||
list(GET CASE_ITEM 1 CASE_KEY)
|
||||
if ("${CASE_KEY}" STREQUAL "suffix")
|
||||
if (DEBUG)
|
||||
message("Setting write filter to ${CASE_VALUE}")
|
||||
endif()
|
||||
set(WRITE_FILTER "${CASE_VALUE}")
|
||||
else()
|
||||
message(FATAL_ERROR "CASE: unsupported argument ${CASE_KEY}")
|
||||
endif()
|
||||
elseif (GROUP_MATCH MATCHES "^ESAC")
|
||||
stack_pop(STACK CASE_ITEM)
|
||||
if (DEBUG)
|
||||
message("ESAC")
|
||||
endif()
|
||||
list(GET CASE_ITEM 0 CASE_CASE)
|
||||
if (NOT "${CASE_CASE}" STREQUAL "CASE")
|
||||
message(FATAL_ERROR "ESAC does not match last item: ${CASE_CASE}")
|
||||
endif()
|
||||
if ("${CASE_KEY}" STREQUAL "suffix")
|
||||
if (DEBUG)
|
||||
message("Removing write filter")
|
||||
endif()
|
||||
set(WRITE_FILTER "")
|
||||
else()
|
||||
message(FATAL_ERROR "CASE: unsupported argument ${CASE_KEY}")
|
||||
endif()
|
||||
else()
|
||||
string(REGEX MATCH "\\(([a-zA-Z0-9_$%\"${WS}\\+\\-]+)\\)" PARENTHESE_MATCH "${GROUP_MATCH}")
|
||||
if (NOT "${PARENTHESE_MATCH}" STREQUAL "")
|
||||
set(PARENTHESE_CONTENT "${CMAKE_MATCH_1}")
|
||||
string(REPLACE " " ";" PARENTHESE_LIST "${PARENTHESE_CONTENT}")
|
||||
list(GET PARENTHESE_LIST 0 PARENTHESE_COMMAND)
|
||||
if ("${PARENTHESE_COMMAND}" STREQUAL "get")
|
||||
list(GET PARENTHESE_LIST 1 KEY_QUOTED)
|
||||
string(REGEX MATCH "\\\"([a-zA-Z_${WS}]+)\\\"" KEY_MATCH "${KEY_QUOTED}")
|
||||
if ("${KEY_MATCH}" STREQUAL "")
|
||||
message(FATAL_ERROR "get: empty key")
|
||||
endif()
|
||||
set(KEY "${CMAKE_MATCH_1}")
|
||||
if (DEBUG)
|
||||
message("Get: key=${KEY}")
|
||||
endif()
|
||||
stack_find_key("${STACK}" "${TEMPLATE_PARAMETERS}" "${KEY}" VALUE)
|
||||
if (DEBUG)
|
||||
message("Get key=${KEY} ==> value=${VALUE}")
|
||||
endif()
|
||||
append_output_text("${SUFFICES_FILENAMES}" "${VALUE}" "${WRITE_FILTER}")
|
||||
elseif("${PARENTHESE_COMMAND}" STREQUAL "tpl-file-line")
|
||||
list(GET PARENTHESE_LIST 1 FORMAT_LINE)
|
||||
calculate_line_number("${TEMPLATE_CONTENTS}" "${POSITION}" LINENUMBER)
|
||||
append_output_text("${SUFFICES_FILENAMES}" "${LINENUMBER}" "${WRITE_FILTER}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown parenthese command: ${PARENTHESE_COMMAND}")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown command: ${GROUP_MATCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endwhile()
|
||||
if (NOT "${STACK}" STREQUAL "")
|
||||
message(FATAL_ERROR "STACK was not empty at EOF")
|
||||
endif()
|
||||
output_finish("${SUFFICES_FILENAMES}")
|
||||
endfunction()
|
||||
|
||||
if ("${DEFINITION}" STREQUAL "")
|
||||
message(FATAL_ERROR "Need definition file")
|
||||
endif()
|
||||
if (NOT EXISTS "${DEFINITION}")
|
||||
message(FATAL_ERROR "Definition file does not exist (${DEFINITION})")
|
||||
endif()
|
||||
|
||||
read_definition("${DEFINITION}" TEMPLATE_FILENAME DATA)
|
||||
if (DEBUG)
|
||||
message("${TEMPLATE_FILENAME}")
|
||||
message("${DATA}")
|
||||
endif()
|
||||
|
||||
parse_template("${TEMPLATE_FILENAME}" "${OUTPUTDIR}" "${DATA}")
|
||||
7
Engine/lib/libsndfile/cmake/CheckCPUArch.c.in
Normal file
7
Engine/lib/libsndfile/cmake/CheckCPUArch.c.in
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
int main(void) {
|
||||
#if @CHECK_CPU_ARCH_DEFINES@
|
||||
return 0;
|
||||
#else
|
||||
fail
|
||||
#endif
|
||||
}
|
||||
23
Engine/lib/libsndfile/cmake/CheckCPUArch.cmake
Normal file
23
Engine/lib/libsndfile/cmake/CheckCPUArch.cmake
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
macro (_CHECK_CPU_ARCH ARCH ARCH_DEFINES VARIABLE)
|
||||
if (NOT DEFINED HAVE_${VARIABLE})
|
||||
message (STATUS "Check CPU architecture is ${ARCH}")
|
||||
set (CHECK_CPU_ARCH_DEFINES ${ARCH_DEFINES})
|
||||
configure_file (${PROJECT_SOURCE_DIR}/cmake/CheckCPUArch.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY)
|
||||
try_compile (HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c")
|
||||
if(HAVE_${VARIABLE})
|
||||
message (STATUS "Check CPU architecture is ${ARCH} - yes")
|
||||
set (${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_CPU_ARCH_X64" FORCE)
|
||||
else ()
|
||||
message (STATUS "Check CPU architecture is ${ARCH} - no")
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro (_CHECK_CPU_ARCH)
|
||||
|
||||
macro (CHECK_CPU_ARCH_X64 VARIABLE)
|
||||
_CHECK_CPU_ARCH (x64 "defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" ${VARIABLE})
|
||||
endmacro (CHECK_CPU_ARCH_X64)
|
||||
|
||||
macro (CHECK_CPU_ARCH_X86 VARIABLE)
|
||||
_CHECK_CPU_ARCH (x86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" ${VARIABLE})
|
||||
endmacro (CHECK_CPU_ARCH_X86)
|
||||
92
Engine/lib/libsndfile/cmake/ClipMode.cmake
Normal file
92
Engine/lib/libsndfile/cmake/ClipMode.cmake
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
include (CheckCSourceRuns)
|
||||
include (CMakePushCheckState)
|
||||
|
||||
macro (CLIP_MODE)
|
||||
if ((NOT DEFINED CPU_CLIPS_NEGATIVE) AND (NOT DEFINED CPU_CLIPS_POSITIVE))
|
||||
set (CLIP_MODE_POSITIVE_MESSAGE "Target processor clips on positive float to int conversion")
|
||||
set (CLIP_MODE_NEGATIVE_MESSAGE "Target processor clips on negative float to int conversion")
|
||||
|
||||
message (STATUS "Checking processor clipping capabilities...")
|
||||
|
||||
if (CMAKE_CROSSCOMPILING)
|
||||
|
||||
set (CLIP_MSG "disabled")
|
||||
set (CPU_CLIPS_POSITIVE FALSE CACHE BOOL ${CLIP_MODE_POSITIVE_MESSAGE})
|
||||
set (CPU_CLIPS_NEGATIVE FALSE CACHE BOOL ${CLIP_MODE_NEGATIVE_MESSAGE})
|
||||
|
||||
else (NOT CMAKE_CROSSCOMPILING)
|
||||
|
||||
cmake_push_check_state ()
|
||||
|
||||
set (CMAKE_REQUIRED_QUIET TRUE)
|
||||
if (LIBM_REQUIRED)
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${M_LIBRARY})
|
||||
endif ()
|
||||
|
||||
check_c_source_runs (
|
||||
"
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = 1.0 * 0x7FFFFFFF ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != 127)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
"
|
||||
CPU_CLIPS_POSITIVE)
|
||||
|
||||
check_c_source_runs (
|
||||
"
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = -8.0 * 0x10000000 ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != -128)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
"
|
||||
CPU_CLIPS_NEGATIVE)
|
||||
|
||||
cmake_pop_check_state ()
|
||||
|
||||
if (CPU_CLIPS_POSITIVE AND (NOT CPU_CLIPS_NEGATIVE))
|
||||
set (CLIP_MSG "positive")
|
||||
elseif (CPU_CLIPS_NEGATIVE AND (NOT CPU_CLIPS_POSITIVE))
|
||||
set (CLIP_MSG "negative")
|
||||
elseif (CPU_CLIPS_POSITIVE AND CPU_CLIPS_NEGATIVE)
|
||||
set (CLIP_MSG "both")
|
||||
else ()
|
||||
set (CLIP_MSG "none")
|
||||
endif ()
|
||||
|
||||
endif (CMAKE_CROSSCOMPILING)
|
||||
|
||||
message (STATUS "Checking processor clipping capabilities... ${CLIP_MSG}")
|
||||
endif ()
|
||||
endmacro (CLIP_MODE)
|
||||
67
Engine/lib/libsndfile/cmake/FindFLAC.cmake
Normal file
67
Engine/lib/libsndfile/cmake/FindFLAC.cmake
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# - Find FLAC
|
||||
# Find the native FLAC includes and libraries
|
||||
#
|
||||
# FLAC_INCLUDE_DIRS - where to find FLAC headers.
|
||||
# FLAC_LIBRARIES - List of libraries when using libFLAC.
|
||||
# FLAC_FOUND - True if libFLAC found.
|
||||
# FLAC_DEFINITIONS - FLAC compile definitons
|
||||
|
||||
if (FLAC_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (FLAC_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (Ogg QUIET)
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules(PC_FLAC QUIET flac)
|
||||
|
||||
set(FLAC_VERSION ${PC_FLAC_VERSION})
|
||||
|
||||
find_path (FLAC_INCLUDE_DIR FLAC/stream_decoder.h
|
||||
HINTS
|
||||
${PC_FLAC_INCLUDEDIR}
|
||||
${PC_FLAC_INCLUDE_DIRS}
|
||||
${FLAC_ROOT}
|
||||
)
|
||||
|
||||
# MSVC built libraries can name them *_static, which is good as it
|
||||
# distinguishes import libraries from static libraries with the same extension.
|
||||
find_library (FLAC_LIBRARY
|
||||
NAMES
|
||||
FLAC
|
||||
libFLAC
|
||||
libFLAC_dynamic
|
||||
libFLAC_static
|
||||
HINTS
|
||||
${PC_FLAC_LIBDIR}
|
||||
${PC_FLAC_LIBRARY_DIRS}
|
||||
${FLAC_ROOT}
|
||||
)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set FLAC_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (FLAC
|
||||
REQUIRED_VARS
|
||||
FLAC_LIBRARY
|
||||
FLAC_INCLUDE_DIR
|
||||
Ogg_FOUND
|
||||
VERSION_VAR
|
||||
FLAC_VERSION
|
||||
)
|
||||
|
||||
if (FLAC_FOUND)
|
||||
set (FLAC_INCLUDE_DIRS ${FLAC_INCLUDE_DIR})
|
||||
set (FLAC_LIBRARIES ${FLAC_LIBRARY} ${OGG_LIBRARIES})
|
||||
if (NOT TARGET FLAC::FLAC)
|
||||
add_library(FLAC::FLAC UNKNOWN IMPORTED)
|
||||
set_target_properties(FLAC::FLAC PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${FLAC_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Ogg::ogg
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(FLAC_INCLUDE_DIR FLAC_LIBRARY)
|
||||
61
Engine/lib/libsndfile/cmake/FindOgg.cmake
Normal file
61
Engine/lib/libsndfile/cmake/FindOgg.cmake
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# - Find ogg
|
||||
# Find the native ogg includes and libraries
|
||||
#
|
||||
# OGG_INCLUDE_DIRS - where to find ogg.h, etc.
|
||||
# OGG_LIBRARIES - List of libraries when using ogg.
|
||||
# OGG_FOUND - True if ogg found.
|
||||
|
||||
if (OGG_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(OGG_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_OGG QUIET ogg>=1.3.0)
|
||||
|
||||
set (OGG_VERSION ${PC_OGG_VERSION})
|
||||
|
||||
find_path (OGG_INCLUDE_DIR ogg/ogg.h
|
||||
HINTS
|
||||
${PC_OGG_INCLUDEDIR}
|
||||
${PC_OGG_INCLUDE_DIRS}
|
||||
${OGG_ROOT}
|
||||
)
|
||||
# MSVC built ogg may be named ogg_static.
|
||||
# The provided project files name the library with the lib prefix.
|
||||
find_library (OGG_LIBRARY
|
||||
NAMES
|
||||
ogg
|
||||
ogg_static
|
||||
libogg
|
||||
libogg_static
|
||||
HINTS
|
||||
${PC_OGG_LIBDIR}
|
||||
${PC_OGG_LIBRARY_DIRS}
|
||||
${OGG_ROOT}
|
||||
)
|
||||
# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Ogg
|
||||
REQUIRED_VARS
|
||||
OGG_LIBRARY
|
||||
OGG_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
OGG_VERSION
|
||||
)
|
||||
|
||||
if (OGG_FOUND)
|
||||
set (OGG_LIBRARIES ${OGG_LIBRARY})
|
||||
set (OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET Ogg::ogg)
|
||||
add_library(Ogg::ogg UNKNOWN IMPORTED)
|
||||
set_target_properties(Ogg::ogg PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${OGG_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (OGG_INCLUDE_DIR OGG_LIBRARY)
|
||||
67
Engine/lib/libsndfile/cmake/FindOpus.cmake
Normal file
67
Engine/lib/libsndfile/cmake/FindOpus.cmake
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# - Find opus
|
||||
# Find the native opus includes and libraries
|
||||
#
|
||||
# OPUS_INCLUDE_DIRS - where to find opus.h, etc.
|
||||
# OPUS_LIBRARIES - List of libraries when using opus.
|
||||
# OPUS_FOUND - True if Opus found.
|
||||
|
||||
if (OPUS_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(OPUS_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (Ogg QUIET)
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules(PC_OPUS QUIET opus>=1.1)
|
||||
|
||||
set (OPUS_VERSION ${PC_OPUS_VERSION})
|
||||
|
||||
find_path (OPUS_INCLUDE_DIR opus/opus.h
|
||||
HINTS
|
||||
${PC_OPUS_INCLUDEDIR}
|
||||
${PC_OPUS_INCLUDE_DIRS}
|
||||
${OPUS_ROOT}
|
||||
)
|
||||
|
||||
# MSVC built opus may be named opus_static.
|
||||
# The provided project files name the library with the lib prefix.
|
||||
|
||||
find_library (OPUS_LIBRARY
|
||||
NAMES
|
||||
opus
|
||||
opus_static
|
||||
libopus
|
||||
libopus_static
|
||||
HINTS
|
||||
${PC_OPUS_LIBDIR}
|
||||
${PC_OPUS_LIBRARY_DIRS}
|
||||
${OPUS_ROOT}
|
||||
)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set OPUS_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Opus
|
||||
REQUIRED_VARS
|
||||
OPUS_LIBRARY
|
||||
OPUS_INCLUDE_DIR
|
||||
OGG_FOUND
|
||||
VERSION_VAR
|
||||
OPUS_VERSION
|
||||
)
|
||||
|
||||
if (OPUS_FOUND)
|
||||
set (OPUS_LIBRARIES ${OPUS_LIBRARY})
|
||||
set (OPUS_INCLUDE_DIRS ${OPUS_INCLUDE_DIR})
|
||||
|
||||
if (NOT TARGET Opus::opus)
|
||||
add_library (Opus::opus UNKNOWN IMPORTED)
|
||||
set_target_properties (Opus::opus PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPUS_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${OPUS_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(OPUS_INCLUDE_DIR OPUS_LIBRARY)
|
||||
61
Engine/lib/libsndfile/cmake/FindSndio.cmake
Normal file
61
Engine/lib/libsndfile/cmake/FindSndio.cmake
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# - Find SoundIO (sndio) includes and libraries
|
||||
#
|
||||
# SNDIO_FOUND - True if SNDIO_INCLUDE_DIR & SNDIO_LIBRARY are
|
||||
# found
|
||||
# SNDIO_LIBRARIES - Set when SNDIO_LIBRARY is found
|
||||
# SNDIO_INCLUDE_DIRS - Set when SNDIO_INCLUDE_DIR is found
|
||||
#
|
||||
# SNDIO_INCLUDE_DIR - where to find sndio.h, etc.
|
||||
# SNDIO_LIBRARY - the sndio library
|
||||
#
|
||||
|
||||
if (SNDIO_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (SNDIO_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_SNDIO QUIET sndio)
|
||||
|
||||
set (SNDIO_VERSION ${PC_SNDIO_VERSION})
|
||||
|
||||
find_path (SNDIO_INCLUDE_DIR
|
||||
NAMES
|
||||
sndio.h
|
||||
HINTS
|
||||
${PC_SNDIO_INCLUDEDIR}
|
||||
${PC_SNDIO_INCLUDE_DIRS}
|
||||
${SNDIO_ROOT}
|
||||
)
|
||||
|
||||
find_library (SNDIO_LIBRARY
|
||||
NAMES
|
||||
sndio
|
||||
HINTS
|
||||
${PC_SNDIO_LIBDIR}
|
||||
${PC_SNDIO_LIBRARY_DIRS}
|
||||
${SNDIO_ROOT}
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Sndio
|
||||
REQUIRED_VARS
|
||||
SNDIO_LIBRARY
|
||||
SNDIO_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
SNDIO_VERSION
|
||||
)
|
||||
|
||||
if (SNDIO_FOUND)
|
||||
set (SNDIO_LIBRARIES ${SNDIO_LIBRARY})
|
||||
set (SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR})
|
||||
if (NOT TARGET Sndio::Sndio)
|
||||
add_library (Sndio::Sndio UNKNOWN IMPORTED)
|
||||
set_target_properties (Sndio::Sndio PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SNDIO_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${SNDIO_LIBRARIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (SNDIO_INCLUDE_DIR SNDIO_LIBRARY)
|
||||
55
Engine/lib/libsndfile/cmake/FindSpeex.cmake
Normal file
55
Engine/lib/libsndfile/cmake/FindSpeex.cmake
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# - Find Speex
|
||||
# Find the native Speex includes and libraries
|
||||
#
|
||||
# SPEEX_INCLUDE_DIRS - where to find speex.h, etc.
|
||||
# SPEEX_LIBRARIES - List of libraries when using Speex.
|
||||
# SPEEX_FOUND - True if Speex found.
|
||||
|
||||
if (SPEEX_INCLUDE_DIR)
|
||||
set (SPEEX_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_SPEEX QUIET speex)
|
||||
|
||||
set (SPEEX_VERSION ${PC_SPEEX_VERSION})
|
||||
|
||||
find_path (SPEEX_INCLUDE_DIR speex/speex.h
|
||||
HINTS
|
||||
${PC_SPEEX_INCLUDEDIR}
|
||||
${PC_SPEEX_INCLUDE_DIRS}
|
||||
${SPEEX_ROOT}
|
||||
)
|
||||
find_library (SPEEX_LIBRARY
|
||||
NAMES
|
||||
speex
|
||||
libspeex
|
||||
HINTS
|
||||
${PC_SPEEX_LIBDIR}
|
||||
${PC_SPEEX_LIBRARY_DIRS}
|
||||
${SPEEX_ROOT}
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Speex
|
||||
REQUIRED_VARS
|
||||
SPEEX_LIBRARY
|
||||
SPEEX_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
SPEEX_VERSION
|
||||
)
|
||||
|
||||
if (SPEEX_FOUND)
|
||||
set (SPEEX_LIBRARIES ${SPEEX_LIBRARY})
|
||||
set (SPEEX_INCLUDE_DIRS ${SPEEX_INCLUDE_DIR})
|
||||
|
||||
if (NOT TARGET Speex::Speex)
|
||||
add_library (Speex::Speex UNKNOWN IMPORTED)
|
||||
set_target_properties (Speex::Speex PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SPEEX_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${SPEEX_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (SPEEX_INCLUDE_DIR SPEEX_LIBRARY)
|
||||
210
Engine/lib/libsndfile/cmake/FindVorbis.cmake
Normal file
210
Engine/lib/libsndfile/cmake/FindVorbis.cmake
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
#[=======================================================================[.rst:
|
||||
FindVorbis
|
||||
----------
|
||||
|
||||
Finds the native vorbis, vorbisenc amd vorbisfile includes and libraries.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module provides the following imported targets, if found:
|
||||
|
||||
``Vorbis::vorbis``
|
||||
The Vorbis library
|
||||
``Vorbis::vorbisenc``
|
||||
The VorbisEnc library
|
||||
``Vorbis::vorbisfile``
|
||||
The VorbisFile library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables:
|
||||
|
||||
``Vorbis_Vorbis_INCLUDE_DIRS``
|
||||
List of include directories when using vorbis.
|
||||
``Vorbis_Enc_INCLUDE_DIRS``
|
||||
List of include directories when using vorbisenc.
|
||||
``Vorbis_File_INCLUDE_DIRS``
|
||||
List of include directories when using vorbisfile.
|
||||
``Vorbis_Vorbis_LIBRARIES``
|
||||
List of libraries when using vorbis.
|
||||
``Vorbis_Enc_LIBRARIES``
|
||||
List of libraries when using vorbisenc.
|
||||
``Vorbis_File_LIBRARIES``
|
||||
List of libraries when using vorbisfile.
|
||||
``Vorbis_FOUND``
|
||||
True if vorbis and requested components found.
|
||||
``Vorbis_Vorbis_FOUND``
|
||||
True if vorbis found.
|
||||
``Vorbis_Enc_FOUND``
|
||||
True if vorbisenc found.
|
||||
``Vorbis_Enc_FOUND``
|
||||
True if vorbisfile found.
|
||||
|
||||
Cache variables
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
The following cache variables may also be set:
|
||||
|
||||
``Vorbis_Vorbis_INCLUDE_DIR``
|
||||
The directory containing ``vorbis/vorbis.h``.
|
||||
``Vorbis_Enc_INCLUDE_DIR``
|
||||
The directory containing ``vorbis/vorbisenc.h``.
|
||||
``Vorbis_File_INCLUDE_DIR``
|
||||
The directory containing ``vorbis/vorbisenc.h``.
|
||||
``Vorbis_Vorbis_LIBRARY``
|
||||
The path to the vorbis library.
|
||||
``Vorbis_Enc_LIBRARY``
|
||||
The path to the vorbisenc library.
|
||||
``Vorbis_File_LIBRARY``
|
||||
The path to the vorbisfile library.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
A user may set ``Vorbis_ROOT`` to a vorbis installation root to tell this module where to look.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
if (Vorbis_Vorbis_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (Vorbis_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
set (Vorbis_Vorbis_FIND_QUIETLY TRUE)
|
||||
set (Vorbis_Enc_FIND_QUIETLY TRUE)
|
||||
set (Vorbis_File_FIND_QUIETLY TRUE)
|
||||
|
||||
find_package (Ogg QUIET)
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_Vorbis_Vorbis QUIET vorbis)
|
||||
pkg_check_modules (PC_Vorbis_Enc QUIET vorbisenc)
|
||||
pkg_check_modules (PC_Vorbis_File QUIET vorbisfile)
|
||||
|
||||
set (Vorbis_VERSION ${PC_Vorbis_Vorbis_VERSION})
|
||||
|
||||
find_path (Vorbis_Vorbis_INCLUDE_DIR vorbis/codec.h
|
||||
HINTS
|
||||
${PC_Vorbis_Vorbis_INCLUDEDIR}
|
||||
${PC_Vorbis_Vorbis_INCLUDE_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_path (Vorbis_Enc_INCLUDE_DIR vorbis/vorbisenc.h
|
||||
HINTS
|
||||
${PC_Vorbis_Enc_INCLUDEDIR}
|
||||
${PC_Vorbis_Enc_INCLUDE_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_path (Vorbis_File_INCLUDE_DIR vorbis/vorbisfile.h
|
||||
HINTS
|
||||
${PC_Vorbis_File_INCLUDEDIR}
|
||||
${PC_Vorbis_File_INCLUDE_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_library (Vorbis_Vorbis_LIBRARY
|
||||
NAMES
|
||||
vorbis
|
||||
vorbis_static
|
||||
libvorbis
|
||||
libvorbis_static
|
||||
HINTS
|
||||
${PC_Vorbis_Vorbis_LIBDIR}
|
||||
${PC_Vorbis_Vorbis_LIBRARY_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_library (Vorbis_Enc_LIBRARY
|
||||
NAMES
|
||||
vorbisenc
|
||||
vorbisenc_static
|
||||
libvorbisenc
|
||||
libvorbisenc_static
|
||||
HINTS
|
||||
${PC_Vorbis_Enc_LIBDIR}
|
||||
${PC_Vorbis_Enc_LIBRARY_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_library (Vorbis_File_LIBRARY
|
||||
NAMES
|
||||
vorbisfile
|
||||
vorbisfile_static
|
||||
libvorbisfile
|
||||
libvorbisfile_static
|
||||
HINTS
|
||||
${PC_Vorbis_File_LIBDIR}
|
||||
${PC_Vorbis_File_LIBRARY_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
if (Vorbis_Vorbis_LIBRARY AND Vorbis_Vorbis_INCLUDE_DIR AND Ogg_FOUND)
|
||||
set (Vorbis_Vorbis_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
if (Vorbis_Enc_LIBRARY AND Vorbis_Enc_INCLUDE_DIR AND Vorbis_Vorbis_FOUND)
|
||||
set (Vorbis_Enc_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
if (Vorbis_Vorbis_FOUND AND Vorbis_File_LIBRARY AND Vorbis_File_INCLUDE_DIR)
|
||||
set (Vorbis_File_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
find_package_handle_standard_args (Vorbis
|
||||
REQUIRED_VARS
|
||||
Vorbis_Vorbis_LIBRARY
|
||||
Vorbis_Vorbis_INCLUDE_DIR
|
||||
Ogg_FOUND
|
||||
HANDLE_COMPONENTS
|
||||
VERSION_VAR Vorbis_VERSION)
|
||||
|
||||
|
||||
if (Vorbis_Vorbis_FOUND)
|
||||
set (Vorbis_Vorbis_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
|
||||
set (Vorbis_Vorbis_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES})
|
||||
if (NOT TARGET Vorbis::vorbis)
|
||||
add_library (Vorbis::vorbis UNKNOWN IMPORTED)
|
||||
set_target_properties (Vorbis::vorbis PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Vorbis_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${Vorbis_Vorbis_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Ogg::ogg
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (Vorbis_Enc_FOUND)
|
||||
set (Vorbis_Enc_INCLUDE_DIRS ${Vorbis_Enc_INCLUDE_DIR})
|
||||
set (Vorbis_Enc_LIBRARIES ${Vorbis_Enc_LIBRARY} ${Vorbis_Enc_LIBRARIES})
|
||||
if (NOT TARGET Vorbis::vorbisenc)
|
||||
add_library (Vorbis::vorbisenc UNKNOWN IMPORTED)
|
||||
set_target_properties (Vorbis::vorbisenc PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Enc_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${Vorbis_Enc_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Vorbis::vorbis
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (Vorbis_File_FOUND)
|
||||
set (Vorbis_File_INCLUDE_DIRS ${Vorbis_File_INCLUDE_DIR})
|
||||
set (Vorbis_File_LIBRARIES ${Vorbis_File_LIBRARY} ${Vorbis_File_LIBRARIES})
|
||||
if (NOT TARGET Vorbis::vorbisfile)
|
||||
add_library (Vorbis::vorbisfile UNKNOWN IMPORTED)
|
||||
set_target_properties (Vorbis::vorbisfile PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_File_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${Vorbis_File_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Vorbis::vorbis
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (Vorbis_Vorbis_INCLUDE_DIR Vorbis_Vorbis_LIBRARY)
|
||||
mark_as_advanced (Vorbis_Enc_INCLUDE_DIR Vorbis_Enc_LIBRARY)
|
||||
mark_as_advanced (Vorbis_File_INCLUDE_DIR Vorbis_File_LIBRARY)
|
||||
67
Engine/lib/libsndfile/cmake/Findmp3lame.cmake
Normal file
67
Engine/lib/libsndfile/cmake/Findmp3lame.cmake
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# - Find lame
|
||||
# Find the native lame includes and libraries
|
||||
#
|
||||
# MP3LAME_INCLUDE_DIRS - where to find lame.h, etc.
|
||||
# MP3LAME_LIBRARIES - List of libraries when using lame.
|
||||
# MP3LAME_FOUND - True if Lame found.
|
||||
|
||||
if (MP3LAME_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(MP3LAME_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_path (MP3LAME_INCLUDE_DIR lame/lame.h
|
||||
HINTS
|
||||
${LAME_ROOT}
|
||||
)
|
||||
|
||||
# MSVC built lame may be named mp3lame_static.
|
||||
# The provided project files name the library with the lib prefix.
|
||||
|
||||
find_library (MP3LAME_LIBRARY
|
||||
NAMES
|
||||
mp3lame
|
||||
mp3lame_static
|
||||
libmp3lame
|
||||
libmp3lame_static
|
||||
libmp3lame-static
|
||||
HINTS
|
||||
${MP3LAME_ROOT}
|
||||
)
|
||||
|
||||
find_library (MP3LAME_HIP_LIBRARY
|
||||
NAMES
|
||||
mpghip-static
|
||||
libmpghip-static
|
||||
HINTS
|
||||
${MP3LAME_ROOT}
|
||||
)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set LAME_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (mp3lame
|
||||
REQUIRED_VARS
|
||||
MP3LAME_LIBRARY
|
||||
MP3LAME_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if (MP3LAME_FOUND)
|
||||
set (MP3LAME_LIBRARIES ${MP3LAME_LIBRARY} ${MP3LAME_HIP_LIBRARY})
|
||||
set (MP3LAME_INCLUDE_DIRS ${MP3LAME_INCLUDE_DIR})
|
||||
|
||||
if (NOT TARGET mp3lame::mp3lame)
|
||||
add_library (mp3lame::mp3lame UNKNOWN IMPORTED)
|
||||
set_target_properties (mp3lame::mp3lame PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MP3LAME_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${MP3LAME_LIBRARY}"
|
||||
)
|
||||
if (MP3LAME_HIP_LIBRARY AND (NOT TARGET mp3lame::mpghip))
|
||||
add_library (mp3lame::mpghip STATIC IMPORTED)
|
||||
set_property (mp3lame::mpghip PROPERTY IMPORTED_LOCATION "${MP3LAME_HIP_LIBRARY}")
|
||||
set_property (TARGET mp3lame::mp3lame PROPERTY INTERFACE_LINK_LIBRARIES "mp3lame::mpghip")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(MP3LAME_INCLUDE_DIR MP3LAME_LIBRARY MP3LAME_HIP_LIBRARY)
|
||||
95
Engine/lib/libsndfile/cmake/Findmpg123.cmake
Normal file
95
Engine/lib/libsndfile/cmake/Findmpg123.cmake
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#[=======================================================================[.rst:
|
||||
Findmpg123
|
||||
-------
|
||||
|
||||
Finds the mpg123 library.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module provides the following imported targets, if found:
|
||||
|
||||
``MPG123::libmpg123``
|
||||
The mpg123 library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables:
|
||||
|
||||
``mpg123_FOUND``
|
||||
True if the system has the mpg123 package.
|
||||
``mpg123_VERSION``
|
||||
The version of mpg123 that was found on the system.
|
||||
|
||||
Cache Variables
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
The following cache variables may also be set:
|
||||
|
||||
``mpg123_INCLUDE_DIR``
|
||||
The directory containing ``mpg123.h``.
|
||||
``mpg123_LIBRARY``
|
||||
The path to the mpg123 library.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
if (mpg123_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(mpg123_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules(PC_MPG123 QUIET libmpg123>=1.25.10)
|
||||
|
||||
find_path (mpg123_INCLUDE_DIR mpg123.h
|
||||
HINTS
|
||||
${PC_MPG123_INCLUDEDIR}
|
||||
${PC_MPG123_INCLUDE_DIRS}
|
||||
${mpg123_ROOT}
|
||||
)
|
||||
|
||||
# MSVC built mpg123 may be named mpg123_static.
|
||||
# The provided project files name the library with the lib prefix.
|
||||
|
||||
find_library (mpg123_LIBRARY
|
||||
NAMES
|
||||
mpg123
|
||||
mpg123_static
|
||||
libmpg123
|
||||
libmpg123_static
|
||||
HINTS
|
||||
${PC_MPG123_LIBDIR}
|
||||
${PC_MPG123_LIBRARY_DIRS}
|
||||
${mpg123_ROOT}
|
||||
)
|
||||
|
||||
if (PC_MPG123_FOUND)
|
||||
set (mpg123_VERSION ${PC_MPG123_VERSION})
|
||||
elseif (mpg123_INCLUDE_DIR)
|
||||
file (READ "${mpg123_INCLUDE_DIR}/mpg123.h" _mpg123_h)
|
||||
string (REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" _mpg123_version_re "${_mpg123_h}")
|
||||
set (mpg123_VERSION "${_mpg123_version_re}")
|
||||
endif ()
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set mpg123_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (mpg123
|
||||
REQUIRED_VARS
|
||||
mpg123_LIBRARY
|
||||
mpg123_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
mpg123_VERSION
|
||||
)
|
||||
|
||||
if (mpg123_FOUND AND NOT TARGET MPG123::libmpg123)
|
||||
add_library (MPG123::libmpg123 UNKNOWN IMPORTED)
|
||||
set_target_properties (MPG123::libmpg123
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${mpg123_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${mpg123_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(mpg123_INCLUDE_DIR mpg123_LIBRARY)
|
||||
56
Engine/lib/libsndfile/cmake/SetupABIVersions.cmake
Normal file
56
Engine/lib/libsndfile/cmake/SetupABIVersions.cmake
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# Inspiration: https://github.com/ros2-dotnet/Fast-RTPS
|
||||
|
||||
macro (SETUP_ABI_VERSIONS)
|
||||
|
||||
file (STRINGS ${PROJECT_SOURCE_DIR}/configure.ac CONFIGURE_AC_CONTENT)
|
||||
file (STRINGS
|
||||
configure.ac
|
||||
SNDFILE_LT_CURRENT_TMP
|
||||
REGEX "^m4_define\\(\\[?lt_current\\]?, *\\[?[0-9]+\\]?\\)"
|
||||
)
|
||||
string (REGEX REPLACE "m4_define\\(\\[?lt_current\\]?, *\\[?([0-9]+)\\]?\\)"
|
||||
"\\1"
|
||||
SNDFILE_LT_CURRENT
|
||||
${SNDFILE_LT_CURRENT_TMP}
|
||||
)
|
||||
|
||||
file (STRINGS
|
||||
configure.ac
|
||||
SNDFILE_LT_REVISION_TMP
|
||||
REGEX "^m4_define\\(\\[?lt_revision\\]?, *\\[?[0-9]+\\]?\\)"
|
||||
)
|
||||
string (REGEX REPLACE "m4_define\\(\\[?lt_revision\\]?, *\\[?([0-9]+)\\]?\\)"
|
||||
"\\1"
|
||||
SNDFILE_LT_REVISION
|
||||
${SNDFILE_LT_REVISION_TMP}
|
||||
)
|
||||
|
||||
file (STRINGS
|
||||
configure.ac
|
||||
SNDFILE_LT_AGE_TMP
|
||||
REGEX "^m4_define\\(\\[?lt_age\\]?, *\\[?[0-9]+\\]?\\)"
|
||||
)
|
||||
string (REGEX REPLACE "m4_define\\(\\[?lt_age\\]?, *\\[?([0-9]+)\\]?\\)"
|
||||
"\\1"
|
||||
SNDFILE_LT_AGE
|
||||
${SNDFILE_LT_AGE_TMP}
|
||||
)
|
||||
|
||||
#
|
||||
# Calculate CMake compatible ABI version from libtool version.
|
||||
#
|
||||
|
||||
math (EXPR SNDFILE_ABI_VERSION_MAJOR "${SNDFILE_LT_CURRENT} - ${SNDFILE_LT_AGE}")
|
||||
set (SNDFILE_ABI_VERSION_MINOR ${SNDFILE_LT_AGE})
|
||||
set (SNDFILE_ABI_VERSION_PATCH ${SNDFILE_LT_REVISION})
|
||||
set (SNDFILE_ABI_VERSION "${SNDFILE_ABI_VERSION_MAJOR}.${SNDFILE_ABI_VERSION_MINOR}.${SNDFILE_ABI_VERSION_PATCH}")
|
||||
|
||||
#
|
||||
# Apple platform current and compatibility versions.
|
||||
#
|
||||
|
||||
math (EXPR SNDFILE_MACHO_CURRENT_VERSION_MAJOR "${SNDFILE_ABI_VERSION_MAJOR} + ${SNDFILE_ABI_VERSION_MINOR} + 1")
|
||||
set (SNDFILE_MACHO_CURRENT_VERSION "${SNDFILE_MACHO_CURRENT_VERSION_MAJOR}.${SNDFILE_ABI_VERSION_PATCH}.0")
|
||||
set (SNDFILE_MACHO_COMPATIBILITY_VERSION "${SNDFILE_MACHO_CURRENT_VERSION_MAJOR}.0.0")
|
||||
|
||||
endmacro (SETUP_ABI_VERSIONS)
|
||||
256
Engine/lib/libsndfile/cmake/SndFileChecks.cmake
Normal file
256
Engine/lib/libsndfile/cmake/SndFileChecks.cmake
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
include (CheckFunctionExists)
|
||||
include (CheckIncludeFile)
|
||||
include (CheckLibraryExists)
|
||||
include (CheckSymbolExists)
|
||||
include (CheckTypeSize)
|
||||
include (TestBigEndian)
|
||||
|
||||
include (TestInline)
|
||||
include (ClipMode)
|
||||
include (TestLargeFiles)
|
||||
include (CheckCPUArch)
|
||||
|
||||
test_large_files (_LARGEFILES)
|
||||
|
||||
if (LARGE_FILES_DEFINITIONS)
|
||||
add_definitions(${LARGE_FILES_DEFINITIONS})
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
find_package (Sndio)
|
||||
elseif (NOT WIN32)
|
||||
find_package (ALSA)
|
||||
endif ()
|
||||
|
||||
if (VCPKG_TOOLCHAIN AND (NOT CMAKE_VERSION VERSION_LESS 3.15))
|
||||
set (CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_FIND_PACKAGE_PREFER_CONFIG)
|
||||
find_package (Ogg 1.3 CONFIG)
|
||||
find_package (Vorbis CONFIG COMPONENTS Enc)
|
||||
find_package (FLAC CONFIG)
|
||||
find_package (Opus CONFIG)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Ogg CONFIG_MODE)
|
||||
find_package_handle_standard_args (Vorbis CONFIG_MODE)
|
||||
find_package_handle_standard_args (FLAC CONFIG_MODE)
|
||||
find_package_handle_standard_args (Opus CONFIG_MODE)
|
||||
else ()
|
||||
find_package (Ogg 1.3)
|
||||
find_package (Vorbis COMPONENTS Enc)
|
||||
find_package (FLAC)
|
||||
find_package (Opus)
|
||||
endif ()
|
||||
if (Vorbis_FOUND AND FLAC_FOUND AND Opus_FOUND)
|
||||
set (HAVE_EXTERNAL_XIPH_LIBS 1)
|
||||
else ()
|
||||
set (HAVE_EXTERNAL_XIPH_LIBS 0)
|
||||
endif ()
|
||||
|
||||
find_package (mp3lame)
|
||||
find_package (mpg123 1.25.10)
|
||||
if (TARGET mp3lame::mp3lame AND (TARGET MPG123::libmpg123))
|
||||
set (HAVE_MPEG_LIBS 1)
|
||||
else ()
|
||||
set (HAVE_MPEG_LIBS 0)
|
||||
endif()
|
||||
|
||||
find_package (Speex)
|
||||
find_package (SQLite3)
|
||||
|
||||
check_include_file (byteswap.h HAVE_BYTESWAP_H)
|
||||
check_include_file (dlfcn.h HAVE_DLFCN_H)
|
||||
check_include_file (direct.h HAVE_DIRECT_H)
|
||||
check_include_file (endian.h HAVE_ENDIAN_H)
|
||||
check_include_file (inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_file (io.h HAVE_IO_H)
|
||||
check_include_file (stdint.h HAVE_STDINT_H)
|
||||
check_include_file (sys/time.h HAVE_SYS_TIME_H)
|
||||
check_include_file (sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file (unistd.h HAVE_UNISTD_H)
|
||||
check_include_file (immintrin.h HAVE_IMMINTRIN_H)
|
||||
check_include_file (stdbool.h HAVE_STDBOOL_H)
|
||||
|
||||
check_cpu_arch_x86 (CPU_IS_X86)
|
||||
check_cpu_arch_x64 (CPU_IS_X64)
|
||||
if ((CPU_IS_X86 OR CPU_IS_X64) AND HAVE_IMMINTRIN_H)
|
||||
set (HAVE_SSE2 1)
|
||||
endif ()
|
||||
|
||||
# Never checked
|
||||
# check_include_file (stdlib.h HAVE_STDLIB_H)
|
||||
# check_include_file (string.h HAVE_STRING_H)
|
||||
# check_include_file (strings.h HAVE_STRINGS_H)
|
||||
# check_include_file (sys/stat.h HAVE_SYS_STAT_H)
|
||||
# check_include_file (memory.h HAVE_MEMORY_H)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
check_include_file (locale.h HAVE_LOCALE_H)
|
||||
check_include_file (sys/wait.h HAVE_SYS_WAIT_H)
|
||||
endif ()
|
||||
|
||||
check_type_size (int64_t SIZEOF_INT64_T)
|
||||
check_type_size (long SIZEOF_LONG)
|
||||
check_type_size (long\ long SIZEOF_LONG_LONG)
|
||||
check_type_size (ssize_t SIZEOF_SSIZE_T)
|
||||
check_type_size (wchar_t SIZEOF_WCHAR_T)
|
||||
|
||||
# Never used
|
||||
# check_type_size (loff_t SIZEOF_LOFF_T)
|
||||
# check_type_size (offt64_t SIZEOF_OFF64_T)
|
||||
|
||||
# Never checked
|
||||
# check_type_size (size_t SIZEOF_SIZE_T)
|
||||
|
||||
# Used in configre.ac
|
||||
# check_type_size (double SIZEOF_DOUBLE)
|
||||
# check_type_size (float SIZEOF_FLOAT)
|
||||
# check_type_size (int SIZEOF_INT)
|
||||
# check_type_size (short SIZEOF_SHORT)
|
||||
|
||||
if (ENABLE_TESTING)
|
||||
check_type_size (void* SIZEOF_VOIDP)
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
check_library_exists (m floor "" LIBM_REQUIRED)
|
||||
if (LIBM_REQUIRED)
|
||||
list (APPEND CMAKE_REQUIRED_LIBRARIES m)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
check_library_exists (sqlite3 sqlite3_close "" HAVE_SQLITE3)
|
||||
|
||||
check_function_exists (fstat HAVE_FSTAT)
|
||||
check_function_exists (fstat64 HAVE_FSTAT64)
|
||||
check_function_exists (gettimeofday HAVE_GETTIMEOFDAY)
|
||||
check_function_exists (gmtime HAVE_GMTIME)
|
||||
check_function_exists (gmtime_r HAVE_GMTIME_R)
|
||||
check_function_exists (localtime HAVE_LOCALTIME)
|
||||
check_function_exists (localtime_r HAVE_LOCALTIME_R)
|
||||
check_function_exists (lseek HAVE_LSEEK)
|
||||
check_function_exists (open HAVE_OPEN)
|
||||
check_function_exists (read HAVE_READ)
|
||||
check_function_exists (write HAVE_WRITE)
|
||||
check_function_exists (lrint HAVE_LRINT)
|
||||
check_function_exists (lrintf HAVE_LRINTF)
|
||||
|
||||
if (NOT WIN32)
|
||||
check_function_exists (ftruncate HAVE_FTRUNCATE)
|
||||
check_function_exists (fsync HAVE_FSYNC)
|
||||
endif ()
|
||||
|
||||
if (BUILD_TESTING)
|
||||
check_function_exists (pipe HAVE_PIPE)
|
||||
check_function_exists (setlocale HAVE_SETLOCALE)
|
||||
check_function_exists (waitpid HAVE_WAITPID)
|
||||
endif ()
|
||||
|
||||
# Never checked
|
||||
# check_function_exists (calloc HAVE_CALLOC)
|
||||
# check_function_exists (free HAVE_FREE)
|
||||
# check_function_exists (getpagesize HAVE_GETPAGESIZE)
|
||||
# check_function_exists (malloc HAVE_MALLOC)
|
||||
# check_function_exists (realloc HAVE_REALLOC)
|
||||
# check_function_exists (snprintf HAVE_SNPRINTF)
|
||||
# check_function_exists (vsnprintf HAVE_VSNPRINTF)
|
||||
# check_function_exists (floor HAVE_FLOOR)
|
||||
# check_function_exists (fmod HAVE_FMOD)
|
||||
|
||||
# Never used
|
||||
# check_function_exists (mmap HAVE_MMAP)
|
||||
# check_function_exists (ceil HAVE_CEIL)
|
||||
# check_function_exists (lround HAVE_LROUND)
|
||||
# check_function_exists (lseek64 HAVE_LSEEK64)
|
||||
|
||||
|
||||
check_symbol_exists (S_IRGRP sys/stat.h HAVE_DECL_S_IRGRP)
|
||||
|
||||
test_big_endian (WORDS_BIGENDIAN)
|
||||
if (WORDS_BIGENDIAN)
|
||||
set (CPU_IS_BIG_ENDIAN 1)
|
||||
else ()
|
||||
set (CPU_IS_LITTLE_ENDIAN 1)
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
set (OS_IS_WIN32 1)
|
||||
set (USE_WINDOWS_API 1)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (WIN32_TARGET_DLL 1)
|
||||
endif ()
|
||||
if (MINGW)
|
||||
add_definitions (-D__USE_MINGW_ANSI_STDIO=1)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
set (OS_IS_OPENBSD 1)
|
||||
endif ()
|
||||
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
||||
set (COMPILER_IS_GCC 1)
|
||||
endif ()
|
||||
|
||||
test_inline ()
|
||||
clip_mode ()
|
||||
|
||||
if (MSVC)
|
||||
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif (MSVC)
|
||||
|
||||
if (DEFINED ENABLE_STATIC_RUNTIME)
|
||||
if (MSVC)
|
||||
if (ENABLE_STATIC_RUNTIME)
|
||||
foreach (flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
if (${flag_var} MATCHES "/MD")
|
||||
string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif ()
|
||||
endforeach (flag_var)
|
||||
else ()
|
||||
foreach (flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
if (${flag_var} MATCHES "/MT")
|
||||
string (REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
|
||||
endif (${flag_var} MATCHES "/MT")
|
||||
endforeach (flag_var)
|
||||
endif ( )
|
||||
elseif (MINGW)
|
||||
if (ENABLE_STATIC_RUNTIME)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL GNU)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s")
|
||||
endif ()
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL Clang)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static")
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static")
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
message (AUTHOR_WARNING "ENABLE_STATIC_RUNTIME option is for MSVC or MinGW only.")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
find_package (PythonInterp REQUIRED)
|
||||
endif()
|
||||
46
Engine/lib/libsndfile/cmake/SndFileConfig.cmake.in
Normal file
46
Engine/lib/libsndfile/cmake/SndFileConfig.cmake.in
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
set(SndFile_VERSION @PROJECT_VERSION@)
|
||||
set(SndFile_VERSION_MAJOR @PROJECT_VERSION_MAJOR@)
|
||||
set(SndFile_VERSION_MINOR @PROJECT_VERSION_MINOR@)
|
||||
set(SndFile_VERSION_PATCH @PROJECT_VERSION_PATCH@)
|
||||
|
||||
set (SndFile_WITH_EXTERNAL_LIBS @SndFile_WITH_EXTERNAL_LIBS@)
|
||||
set (SndFile_WITH_MPEG @SndFile_WITH_MPEG@)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include (CMakeFindDependencyMacro)
|
||||
|
||||
if (NOT @BUILD_SHARED_LIBS@)
|
||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif ()
|
||||
|
||||
if (SndFile_WITH_EXTERNAL_LIBS AND NOT @BUILD_SHARED_LIBS@)
|
||||
find_dependency (Ogg 1.3)
|
||||
find_dependency (Vorbis)
|
||||
find_dependency (FLAC)
|
||||
find_dependency (Opus)
|
||||
endif ()
|
||||
|
||||
if (SndFile_WITH_MPEG AND NOT @BUILD_SHARED_LIBS@)
|
||||
find_dependency (mp3lame)
|
||||
find_dependency (mpg123)
|
||||
endif ()
|
||||
|
||||
if (NOT @BUILD_SHARED_LIBS@)
|
||||
list (REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif ()
|
||||
|
||||
include (${CMAKE_CURRENT_LIST_DIR}/SndFileTargets.cmake)
|
||||
|
||||
set_and_check (SndFile_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
set (SNDFILE_INCLUDE_DIR ${SndFile_INCLUDE_DIR})
|
||||
|
||||
set (SndFile_LIBRARY SndFile::sndfile)
|
||||
set (SNDFILE_LIBRARY SndFile::sndfile)
|
||||
set (SndFile_LIBRARIES SndFile::sndfile)
|
||||
set (SNDFILE_LIBRARIES SndFile::sndfile)
|
||||
|
||||
|
||||
check_required_components(SndFile)
|
||||
|
||||
set (SNDFILE_FOUND 1)
|
||||
10
Engine/lib/libsndfile/cmake/TestInline.c.in
Normal file
10
Engine/lib/libsndfile/cmake/TestInline.c.in
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
static @INLINE_KEYWORD@ void test_inline(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
test_inline ();
|
||||
return 0;
|
||||
}
|
||||
54
Engine/lib/libsndfile/cmake/TestInline.cmake
Normal file
54
Engine/lib/libsndfile/cmake/TestInline.cmake
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
macro (TEST_INLINE)
|
||||
if (NOT DEFINED INLINE_CODE)
|
||||
message (STATUS "Checking for inline...")
|
||||
set (INLINE_KEYWORD "inline")
|
||||
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
|
||||
try_compile (HAVE_INLINE "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
|
||||
if (HAVE_INLINE)
|
||||
message (STATUS "Checking for inline... supported")
|
||||
else ()
|
||||
message (STATUS "Checking for inline... not supported")
|
||||
|
||||
message (STATUS "Checking for __inline...")
|
||||
set (INLINE_KEYWORD "__inline")
|
||||
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
|
||||
try_compile (HAVE___INLINE "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
|
||||
if (HAVE___INLINE)
|
||||
message (STATUS "Checking for __inline... supported")
|
||||
else ()
|
||||
message (STATUS "Checking for __inline... not supported")
|
||||
|
||||
message (STATUS "Checking for __inline__...")
|
||||
set (INLINE_KEYWORD "__inline__")
|
||||
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
|
||||
try_compile (HAVE___INLINE "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
|
||||
if (HAVE___INLINE)
|
||||
message (STATUS "Checking for __inline__... supported")
|
||||
|
||||
message (STATUS "Checking for __inline__...")
|
||||
set (INLINE_KEYWORD "__inline__")
|
||||
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/cmake/TestInline.c)
|
||||
try_compile (HAVE___INLINE__ "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
|
||||
else ()
|
||||
message (STATUS "Checking for __inline__... not supported")
|
||||
set (INLINE_KEYWORD "")
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (HAVE_INLINE)
|
||||
set (INLINE_CODE "/* #undef inline */" CACHE INTERNAL "")
|
||||
elseif (HAVE___INLINE)
|
||||
set (INLINE_CODE "#define inline __inline" CACHE INTERNAL "")
|
||||
elseif (HAVE___INLINE__)
|
||||
set (INLINE_CODE "#define inline __inline__" CACHE INTERNAL "")
|
||||
else ()
|
||||
set (INLINE_CODE "#define inline " CACHE INTERNAL "")
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro (TEST_INLINE)
|
||||
121
Engine/lib/libsndfile/cmake/TestLargeFiles.cmake
Normal file
121
Engine/lib/libsndfile/cmake/TestLargeFiles.cmake
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
include (CheckIncludeFile)
|
||||
include (CheckTypeSize)
|
||||
include (CMakePushCheckState)
|
||||
|
||||
macro (TEST_LARGE_FILES VARIABLE)
|
||||
|
||||
if (NOT DEFINED ${VARIABLE})
|
||||
|
||||
cmake_push_check_state()
|
||||
|
||||
message (STATUS "")
|
||||
message (STATUS "")
|
||||
message (STATUS "Checking large files support...")
|
||||
|
||||
if (WIN32)
|
||||
set (${VARIABLE} 1 CACHE INTERNAL "Result of tests for large file support" FORCE)
|
||||
message (STATUS "")
|
||||
message (STATUS "Result of checking large files support: supported with WinAPI")
|
||||
else ()
|
||||
|
||||
message (STATUS "")
|
||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(stddef.h HAVE_STDDEF_H)
|
||||
message (STATUS "")
|
||||
|
||||
message (STATUS "Checking size of off_t without any definitions:")
|
||||
check_type_size (off_t SIZEOF_OFF_T)
|
||||
message (STATUS "Checking of off_t without any definitions: ${SIZEOF_OFF_T}")
|
||||
if (SIZEOF_OFF_T EQUAL 8)
|
||||
set (LARGE_FILES_DEFINITIONS "" CACHE INTERNAL "64-bit off_t required definitions")
|
||||
set (FILE64 TRUE)
|
||||
else ()
|
||||
unset (HAVE_SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T_CODE CACHE)
|
||||
cmake_pop_check_state()
|
||||
set (FILE64 FALSE)
|
||||
endif ()
|
||||
|
||||
if (NOT FILE64)
|
||||
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_FILE_OFFSET_BITS=64)
|
||||
message (STATUS "")
|
||||
message (STATUS "Checking size of off_t with _FILE_OFFSET_BITS=64:")
|
||||
check_type_size (off_t SIZEOF_OFF_T)
|
||||
message (STATUS "Checking size of off_t with _FILE_OFFSET_BITS=64: ${SIZEOF_OFF_T}")
|
||||
if (SIZEOF_OFF_T EQUAL 8)
|
||||
set (_FILE_OFFSET_BITS 64 CACHE INTERNAL "")
|
||||
set (_FILE_OFFSET_BITS_CODE "#define _FILE_OFFSET_BITS 64" CACHE INTERNAL "")
|
||||
set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_FILE_OFFSET_BITS=64" CACHE INTERNAL "64-bit off_t required definitions")
|
||||
set (FILE64 TRUE)
|
||||
else ()
|
||||
set (_FILE_OFFSET_BITS_CODE "" CACHE INTERNAL "")
|
||||
unset (HAVE_SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T_CODE CACHE)
|
||||
cmake_pop_check_state()
|
||||
set (FILE64 FALSE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT FILE64)
|
||||
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_LARGE_FILES)
|
||||
message (STATUS "")
|
||||
message (STATUS "Checking size of off_t with _LARGE_FILES:")
|
||||
check_type_size (off_t SIZEOF_OFF_T)
|
||||
message (STATUS "Checking size of off_t with _LARGE_FILES: ${SIZEOF_OFF_T}")
|
||||
if (SIZEOF_OFF_T EQUAL 8)
|
||||
set (_LARGE_FILES 1 CACHE INTERNAL "")
|
||||
set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_LARGE_FILES" CACHE INTERNAL "64-bit off_t required definitions")
|
||||
set (FILE64 TRUE)
|
||||
else ()
|
||||
unset (HAVE_SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T_CODE CACHE)
|
||||
cmake_pop_check_state()
|
||||
set (FILE64 FALSE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT FILE64)
|
||||
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_LARGEFILE_SOURCE)
|
||||
unset (HAVE_SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T_CODE CACHE)
|
||||
message (STATUS "")
|
||||
message (STATUS "Checking size of off_t with _LARGEFILE_SOURCE:")
|
||||
check_type_size (off_t SIZEOF_OFF_T)
|
||||
message (STATUS "Checking size of off_t with _LARGEFILE_SOURCE: ${SIZEOF_OFF_T}")
|
||||
if (SIZEOF_OFF_T EQUAL 8)
|
||||
set (_LARGEFILE_SOURCE 1 CACHE INTERNAL "")
|
||||
set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_LARGEFILE_SOURCE" CACHE INTERNAL "64-bit off_t required definitions")
|
||||
set (FILE64 TRUE)
|
||||
else ()
|
||||
cmake_pop_check_state()
|
||||
set (FILE64 FALSE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
message (STATUS "")
|
||||
if (FILE64)
|
||||
set (${VARIABLE} 1 CACHE INTERNAL "Result of tests for large file support" FORCE)
|
||||
if (NOT SIZEOF_OFF_T_REQURED_DEFINITIONS)
|
||||
message (STATUS "Result of checking large files support: supported")
|
||||
else ()
|
||||
message (STATUS "Result of checking large files support: supported with ${LARGE_FILES_DEFINITIONS}")
|
||||
message (STATUS "Add LARGE_FILES_DEFINITIONS to your compiler definitions or configure with _FILE_OFFSET_BITS,")
|
||||
message (STATUS "_FILE_OFFSET_BITS_CODE, _LARGE_FILES and _LARGEFILE_SOURCE variables.")
|
||||
endif ()
|
||||
else ()
|
||||
message ("Result of checking large files support: not supported")
|
||||
set (${VARIABLE} 0 CACHE INTERNAL "Result of test for large file support" FORCE)
|
||||
endif ()
|
||||
message ("")
|
||||
message ("")
|
||||
|
||||
endif ()
|
||||
|
||||
endif (NOT DEFINED ${VARIABLE})
|
||||
|
||||
endmacro (TEST_LARGE_FILES VARIABLE)
|
||||
56
Engine/lib/libsndfile/cmake/sqlite/FindSQLite3.cmake
Normal file
56
Engine/lib/libsndfile/cmake/sqlite/FindSQLite3.cmake
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# - Find SQLite3
|
||||
# Find the native SQLite3 includes and libraries
|
||||
#
|
||||
# SQLite3_INCLUDE_DIRS - where to find sqlite3.h, etc.
|
||||
# SQLite3_LIBRARIES - List of libraries when using SQLite3.
|
||||
# SQLite3_FOUND - True if SQLite3 found.
|
||||
|
||||
if (SQLite3_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (SQLite3_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_SQLite3 QUIET sqlite3)
|
||||
|
||||
set (SQLite3_VERSION ${PC_SQLite3_VERSION})
|
||||
|
||||
find_path (SQLite3_INCLUDE_DIR sqlite3.h
|
||||
HINTS
|
||||
${PC_SQLite3_INCLUDEDIR}
|
||||
${PC_SQLite3_INCLUDE_DIRS}
|
||||
${SQLite3_ROOT}
|
||||
)
|
||||
|
||||
find_library (SQLite3_LIBRARY
|
||||
NAMES
|
||||
sqlite3
|
||||
HINTS
|
||||
${PC_SQLite3_LIBDIR}
|
||||
${PC_SQLite3_LIBRARY_DIRS}
|
||||
${SQLite3_ROOT}
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args (SQLite3
|
||||
REQUIRED_VARS
|
||||
SQLite3_LIBRARY
|
||||
SQLite3_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
SQLite3_VERSION
|
||||
)
|
||||
|
||||
if (SQLite3_FOUND)
|
||||
set (SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
|
||||
set (SQLite3_LIBRARIES ${SQLite3_LIBRARY})
|
||||
if (NOT TARGET SQLite::SQLite3)
|
||||
add_library (SQLite::SQLite3 UNKNOWN IMPORTED)
|
||||
set_target_properties (SQLite::SQLite3 PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${SQLite3_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (SQLite3_INCLUDE_DIR SQLite3_LIBRARY)
|
||||
761
Engine/lib/libsndfile/configure.ac
Normal file
761
Engine/lib/libsndfile/configure.ac
Normal file
|
|
@ -0,0 +1,761 @@
|
|||
dnl Copyright (C) 1999-2022 Erik de Castro Lopo <erikd@mega-nerd.com>.
|
||||
|
||||
dnl Require autoconf version >= 2.69
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
AC_INIT([libsndfile],[1.2.2],[sndfile@mega-nerd.com],
|
||||
[libsndfile],[http://libsndfile.github.io/libsndfile/])
|
||||
|
||||
dnl Check whether we want to set defaults for CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS
|
||||
AC_MSG_CHECKING([whether configure should try to set CFLAGS/CXXFLAGS/CPPFLAGS/LDFLAGS])
|
||||
AS_IF([test "x${CFLAGS+set}" = "xset" || test "x${CXXFLAGS+set}" = "xset" || test "x${CPPFLAGS+set}" = "xset" || test "x${LDFLAGS+set}" = "xset"], [
|
||||
enable_flags_setting=no
|
||||
: ${CFLAGS=""}
|
||||
: ${CXXFLAGS=""}
|
||||
], [
|
||||
enable_flags_setting=yes
|
||||
dnl Set to empty flags so AC_PROG_CC and
|
||||
dnl AC_PROG_CXX do not add -g -O2
|
||||
CFLAGS=""
|
||||
CXXFLAGS=""
|
||||
])
|
||||
AC_MSG_RESULT([${enable_flags_setting}])
|
||||
|
||||
dnl Put config stuff in 'build-aux'.
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
AC_CONFIG_SRCDIR([src/sndfile.c])
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS([src/config.h])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.14 foreign dist-xz no-dist-gzip serial-tests subdir-objects])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
dnl ====================================================================================
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C99
|
||||
|
||||
AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [
|
||||
AC_MSG_ERROR([libsndfile requires a C99 capable compiler!])
|
||||
])
|
||||
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AC_PROG_CXX
|
||||
|
||||
AC_LANG([C])
|
||||
AX_COMPILER_VENDOR
|
||||
AX_COMPILER_VERSION
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AX_COMPILER_VENDOR
|
||||
AX_COMPILER_VERSION
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
AC_PROG_SED
|
||||
AM_PROG_AR
|
||||
|
||||
LT_INIT([disable-static win32-dll])
|
||||
LT_PROG_RC
|
||||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
||||
AM_PATH_PYTHON
|
||||
|
||||
AC_CHECK_PROG([HAVE_AUTOGEN], [autogen], [yes], [no])
|
||||
AC_CHECK_PROG([HAVE_WINE], [wine], [yes], [no])
|
||||
AC_CHECK_PROG([HAVE_XCODE_SELECT], [xcode-select], [yes], [no])
|
||||
|
||||
dnl ------------------------------------------------------------------------------------
|
||||
dnl Rules for library version information:
|
||||
dnl
|
||||
dnl 1. Start with version information of `0:0:0' for each libtool library.
|
||||
dnl 2. Update the version information only immediately before a public release of
|
||||
dnl your software. More frequent updates are unnecessary, and only guarantee
|
||||
dnl that the current interface number gets larger faster.
|
||||
dnl 3. If the library source code has changed at all since the last update, then
|
||||
dnl increment revision (`c:r:a' becomes `c:r+1:a').
|
||||
dnl 4. If any interfaces have been added, removed, or changed since the last update,
|
||||
dnl increment current, and set revision to 0.
|
||||
dnl 5. If any interfaces have been added since the last public release, then increment
|
||||
dnl age.
|
||||
dnl 6. If any interfaces have been removed since the last public release, then set age
|
||||
dnl to 0.
|
||||
|
||||
dnl This is libtool version of library, we add it to `--version-info` property.
|
||||
|
||||
m4_define([lt_current], [1])
|
||||
m4_define([lt_revision], [37])
|
||||
m4_define([lt_age], [0])
|
||||
|
||||
dnl This is ABI version for linker scripts, CMake uses the same format for
|
||||
dnl VERSION property of shared library.
|
||||
dnl The formula is: c:r:a -> c-a:a:r
|
||||
|
||||
m4_define([abi_version_major], [m4_eval(lt_current - lt_age)])
|
||||
m4_define([abi_version_minor], [lt_age])
|
||||
m4_define([abi_version_patch], [lt_revision])
|
||||
|
||||
dnl ------------------------------------------------------------------------------------
|
||||
|
||||
AC_CHECK_HEADERS([endian.h])
|
||||
AC_CHECK_HEADERS([byteswap.h])
|
||||
AC_CHECK_HEADERS([locale.h])
|
||||
AC_CHECK_HEADERS([sys/time.h])
|
||||
AC_CHECK_HEADERS([immintrin.h])
|
||||
AC_CHECK_HEADERS([stdbool.h])
|
||||
|
||||
AC_HEADER_SYS_WAIT
|
||||
|
||||
AC_CHECK_DECLS([S_IRGRP])
|
||||
AS_IF([test "x$ac_cv_have_decl_S_IRGRP" = "xyes"], [
|
||||
AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP], [1], [Set to 1 if S_IRGRP is defined.])
|
||||
], [
|
||||
AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP], [0], [Set to 0 if S_IRGRP is not defined.])
|
||||
])
|
||||
|
||||
AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
|
||||
[test "x${build_os}:${host_os}:${HAVE_WINE}" = "xlinux-gnu:mingw32msvc:yes"])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Couple of initializations here. Fill in real values later.
|
||||
|
||||
SHLIB_VERSION_ARG=""
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Finished checking, handle options.
|
||||
|
||||
AC_ARG_ENABLE(experimental,
|
||||
AS_HELP_STRING([--enable-experimental], [enable experimental code]))
|
||||
|
||||
AS_IF([test "x$enable_experimental" = "xyes"], [
|
||||
EXPERIMENTAL_CODE=1
|
||||
], [
|
||||
EXPERIMENTAL_CODE=0
|
||||
])
|
||||
AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE], [${EXPERIMENTAL_CODE}], [Set to 1 to enable experimental code.])
|
||||
|
||||
AC_ARG_ENABLE([werror],
|
||||
[AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles])])
|
||||
|
||||
AC_ARG_ENABLE([cpu-clip],
|
||||
[AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper])])
|
||||
|
||||
AC_ARG_ENABLE([bow-docs],
|
||||
[AS_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs])])
|
||||
|
||||
AC_ARG_ENABLE([sqlite],
|
||||
[AS_HELP_STRING([--disable-sqlite], [disable use of sqlite])])
|
||||
|
||||
AC_ARG_ENABLE([alsa],
|
||||
[AS_HELP_STRING([--disable-alsa], [disable ALSA support (default=autodetect)])], [], [enable_alsa=auto])
|
||||
|
||||
AC_ARG_ENABLE([external-libs],
|
||||
[AS_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]])])
|
||||
|
||||
AC_ARG_ENABLE([mpeg],
|
||||
[AS_HELP_STRING([--disable-mpeg], [disable use of LAME/MPG123 for MPEG (MP3) [[defaults=no]]])])
|
||||
|
||||
AC_ARG_ENABLE(octave,
|
||||
[AS_HELP_STRING([--enable-octave], [enable building of GNU Octave module])])
|
||||
|
||||
AC_ARG_ENABLE([full-suite],
|
||||
[AS_HELP_STRING([--disable-full-suite], [disable building and installing programs, documentation, only build library [[default=no]]])])
|
||||
AM_CONDITIONAL([FULL_SUITE], [test "x$enable_full_suite" != "xno"])
|
||||
|
||||
AC_ARG_ENABLE([test-coverage],
|
||||
[AS_HELP_STRING([--enable-test-coverage], [enable test coverage])])
|
||||
AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "x$enable_test_coverage" = "xyes"])
|
||||
|
||||
AC_ARG_ENABLE([ossfuzzers],
|
||||
[AS_HELP_STRING([--enable-ossfuzzers], [Whether to generate the fuzzers for OSS-Fuzz])])
|
||||
AM_CONDITIONAL([USE_OSSFUZZERS], [test "x$enable_ossfuzzers" = "xyes"])
|
||||
|
||||
AC_SUBST([LIB_FUZZING_ENGINE])
|
||||
AM_CONDITIONAL([USE_OSSFUZZ_FLAG], [test "x$LIB_FUZZING_ENGINE" = "x-fsanitize=fuzzer"])
|
||||
AM_CONDITIONAL([USE_OSSFUZZ_STATIC], [test -f "$LIB_FUZZING_ENGINE"])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Check types and their sizes.
|
||||
|
||||
AC_CHECK_SIZEOF([wchar_t], [4])
|
||||
AC_CHECK_SIZEOF([short], [2])
|
||||
AC_CHECK_SIZEOF([int], [4])
|
||||
AC_CHECK_SIZEOF([long], [4])
|
||||
AC_CHECK_SIZEOF([float], [4])
|
||||
AC_CHECK_SIZEOF([double], [4])
|
||||
AC_CHECK_SIZEOF([void*], [8])
|
||||
AC_CHECK_SIZEOF([size_t], [4])
|
||||
AC_CHECK_SIZEOF([int64_t], [8])
|
||||
AC_CHECK_SIZEOF([long long], [8])
|
||||
|
||||
dnl Check for common 64 bit file offset types.
|
||||
AC_CHECK_SIZEOF([off_t], [1])
|
||||
|
||||
AS_IF([test "x$enable_largefile:$ac_cv_sizeof_off_t" = "xno:8"], [
|
||||
AC_MSG_ERROR(["Error : Cannot disable large file support because sizeof (off_t) == 8."])
|
||||
])
|
||||
|
||||
AS_CASE([$host_os],
|
||||
[mingw32*], [
|
||||
AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1], [Set to 1 to use C99 printf/snprintf in MinGW.])
|
||||
],
|
||||
|
||||
[
|
||||
AS_IF([test "x$ac_cv_sizeof_off_t" = "x8"], [
|
||||
dnl If sizeof (off_t) is 8, no further checking is needed.
|
||||
], [
|
||||
dnl Save the old sizeof (off_t) value and then unset it to see if it
|
||||
dnl changes when Large File Support is enabled.
|
||||
pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
|
||||
unset ac_cv_sizeof_off_t
|
||||
|
||||
AC_SYS_LARGEFILE
|
||||
AS_IF([test "x$ac_cv_sys_largefile_CFLAGS" = "xno"], [
|
||||
ac_cv_sys_largefile_CFLAGS=""
|
||||
])
|
||||
AS_IF([test "x$ac_cv_sys_largefile_LDFLAGS" = "xno"], [
|
||||
ac_cv_sys_largefile_LDFLAGS=""
|
||||
])
|
||||
AS_IF([test "x$ac_cv_sys_largefile_LIBS" = "xno"], [
|
||||
ac_cv_sys_largefile_LIBS=""
|
||||
])
|
||||
|
||||
AC_CHECK_SIZEOF(off_t,1)
|
||||
])
|
||||
])
|
||||
|
||||
AC_TYPE_SSIZE_T
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Determine endian-ness of host processor.
|
||||
|
||||
AC_C_BIGENDIAN([
|
||||
dnl big-endian
|
||||
ac_cv_c_big_endian=1
|
||||
ac_cv_c_little_endian=0
|
||||
], [
|
||||
dnl little-endian
|
||||
ac_cv_c_big_endian=0
|
||||
ac_cv_c_little_endian=1
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([CPU_IS_BIG_ENDIAN], [${ac_cv_c_big_endian}], [Host processor is big endian.])
|
||||
AC_DEFINE_UNQUOTED([CPU_IS_LITTLE_ENDIAN], [${ac_cv_c_little_endian}], [Host processor is little endian.])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Check for functions.
|
||||
|
||||
AC_CHECK_FUNCS([malloc calloc realloc free])
|
||||
AC_CHECK_FUNCS([open read write lseek lseek64])
|
||||
AC_CHECK_FUNCS([fstat fstat64 ftruncate fsync])
|
||||
AC_CHECK_FUNCS([snprintf vsnprintf])
|
||||
AC_CHECK_FUNCS([gmtime gmtime_r localtime localtime_r gettimeofday])
|
||||
AC_CHECK_FUNCS([mmap getpagesize])
|
||||
AC_CHECK_FUNCS([setlocale])
|
||||
AC_CHECK_FUNCS([pipe waitpid])
|
||||
|
||||
AC_SEARCH_LIBS([floor], [m], [], [
|
||||
AC_MSG_ERROR([unable to find the floor() function!])
|
||||
])
|
||||
AC_CHECK_FUNCS([floor ceil fmod lrint lrintf])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Check for requirements for building plugins for other languages/enviroments.
|
||||
|
||||
dnl Octave maths environment http://www.octave.org/
|
||||
AS_IF([test "x$cross_compiling" = "xno"], [
|
||||
AS_IF([test "x$enable_octave" = "xno"], [
|
||||
AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
|
||||
], [
|
||||
AC_OCTAVE_BUILD
|
||||
])
|
||||
], [
|
||||
AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
|
||||
])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Check for Ogg, Vorbis and FLAC.
|
||||
|
||||
HAVE_EXTERNAL_XIPH_LIBS=0
|
||||
EXTERNAL_XIPH_CFLAGS=""
|
||||
EXTERNAL_XIPH_LIBS=""
|
||||
EXTERNAL_XIPH_REQUIRE=""
|
||||
|
||||
dnl Check for pkg-config outside the if statement.
|
||||
PKG_PROG_PKG_CONFIG
|
||||
AX_REQUIRE_DEFINED([PKG_INSTALLDIR])
|
||||
PKG_INSTALLDIR
|
||||
|
||||
AS_IF([test -n "$PKG_CONFIG"], [
|
||||
AS_IF([test "x$enable_external_libs" = "xno"], [
|
||||
AC_MSG_WARN([[*** External libs (FLAC, Ogg, Vorbis) disabled. ***]])
|
||||
], [
|
||||
PKG_CHECK_MOD_VERSION(FLAC, flac >= 1.3.1, ac_cv_flac=yes, ac_cv_flac=no)
|
||||
|
||||
dnl Make sure the FLAC_CFLAGS value is sane.
|
||||
FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s|include/FLAC|include|"`
|
||||
|
||||
PKG_CHECK_MOD_VERSION(OGG, ogg >= 1.3.0, ac_cv_ogg=yes, ac_cv_ogg=no)
|
||||
|
||||
AS_IF([test "x$enable_experimental" = "xyes"], [
|
||||
PKG_CHECK_MOD_VERSION(SPEEX, speex >= 1.2, ac_cv_speex=yes, ac_cv_speex=no)
|
||||
], [
|
||||
SPEEX_CFLAGS=""
|
||||
SPEEX_LIBS=""
|
||||
])
|
||||
|
||||
dnl Vorbis versions earlier than 1.2.3 have bugs that cause the libsndfile
|
||||
dnl test suite to fail on MIPS, PowerPC and others.
|
||||
dnl See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549899
|
||||
PKG_CHECK_MOD_VERSION(VORBIS, vorbis >= 1.2.3, ac_cv_vorbis=yes, ac_cv_vorbis=no)
|
||||
PKG_CHECK_MOD_VERSION(VORBISENC, vorbisenc >= 1.2.3, ac_cv_vorbisenc=yes, ac_cv_vorbisenc=no)
|
||||
|
||||
PKG_CHECK_MOD_VERSION(OPUS, opus >= 1.1, ac_cv_opus=yes, ac_cv_opus=no)
|
||||
enable_external_libs=yes
|
||||
])
|
||||
|
||||
AS_IF([test "x$ac_cv_flac$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc$ac_cv_opus" = "xyesyesyesyesyes"], [
|
||||
HAVE_EXTERNAL_XIPH_LIBS=1
|
||||
enable_external_libs=yes
|
||||
|
||||
EXTERNAL_XIPH_CFLAGS="$FLAC_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS $SPEEX_CFLAGS $OPUS_CFLAGS $OGG_CFLAGS "
|
||||
EXTERNAL_XIPH_LIBS="$FLAC_LIBS $VORBIS_LIBS $VORBISENC_LIBS $SPEEX_LIBS $OPUS_LIBS $OGG_LIBS "
|
||||
EXTERNAL_XIPH_REQUIRE="flac ogg vorbis vorbisenc opus"
|
||||
|
||||
if test x$ac_cv_speex = "xyes" ; then
|
||||
EXTERNAL_XIPH_REQUIRE="$EXTERNAL_XIPH_REQUIRE speex"
|
||||
fi
|
||||
], [
|
||||
AS_ECHO([""])
|
||||
AC_MSG_WARN([[*** One or more of the external libraries (ie libflac, libogg,]])
|
||||
AC_MSG_WARN([[*** libvorbis and libopus) is either missing (possibly only the development]])
|
||||
AC_MSG_WARN([[*** headers) or is of an unsupported version.]])
|
||||
AC_MSG_WARN([[***]])
|
||||
AC_MSG_WARN([[*** Unfortunately, for ease of maintenance, the external libs]])
|
||||
AC_MSG_WARN([[*** are an all or nothing affair.]])
|
||||
AS_ECHO([""])
|
||||
enable_external_libs=no
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_XIPH_LIBS], [$HAVE_EXTERNAL_XIPH_LIBS], [Will be set to 1 if flac, ogg, vorbis, and opus are available.])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Check for MPEG libraris liblame
|
||||
|
||||
ac_cv_lame="no"
|
||||
ac_cv_mpg123="no"
|
||||
HAVE_MPEG=0
|
||||
EXTERNAL_MPEG_REQUIRE=""
|
||||
EXTERNAL_MPEG_LIBS=""
|
||||
|
||||
AS_IF([test -n "$PKG_CONFIG"], [
|
||||
AS_IF([test "x$enable_mpeg" = "xno"], [
|
||||
AC_MSG_WARN([[*** MPEG (Lame/MPG123) disabled. ***]])
|
||||
], [
|
||||
AC_CHECK_HEADER(lame/lame.h,
|
||||
lame_header_found="yes",
|
||||
lame_header_found="no")
|
||||
AC_SEARCH_LIBS(lame_set_VBR_q, [lame mp3lame], [lame_lib_found="yes"], [lame_lib_found="no"])
|
||||
AS_IF([test "x$lame_lib_found$lame_header_found" = "xyesyes"], [
|
||||
ac_cv_lame="yes"
|
||||
], [
|
||||
AC_MSG_WARN([["MPEG support selected but external Lame library cannot be found.]])
|
||||
])
|
||||
|
||||
PKG_CHECK_MOD_VERSION([MPG123], [libmpg123 >= 1.25.10], [
|
||||
ac_cv_mpg123="yes"
|
||||
], [
|
||||
AC_MSG_WARN([["MPEG support selected but external MPG123 library cannot be found.]])
|
||||
])
|
||||
|
||||
AS_IF([test "x$ac_cv_lame$ac_cv_mpg123" = "xyesyes"], [
|
||||
enable_mpeg="yes"
|
||||
HAVE_MPEG=1
|
||||
EXTERNAL_MPEG_REQUIRE="libmpg123"
|
||||
EXTERNAL_MPEG_LIBS="-lmp3lame"
|
||||
MPEG_CFLAGS="$MPG123_CFLAGS"
|
||||
MPEG_LIBS="$MPG123_LIBS"
|
||||
], [
|
||||
enable_mpeg="no"
|
||||
AS_ECHO([""])
|
||||
AC_MSG_WARN([[*** MPEG support disabled.]])
|
||||
AS_ECHO([""])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([HAVE_MPEG], [$HAVE_MPEG], [Will be set to 1 if lame, mpg123 mpeg support is available.])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Check for libsqlite3 (only used in regtest).
|
||||
|
||||
ac_cv_sqlite3=0
|
||||
AS_IF([test "x$enable_sqlite" != "xno"], [
|
||||
PKG_CHECK_MOD_VERSION([SQLITE3], [sqlite3 >= 3.2], [ac_cv_sqlite3=1], [ac_cv_sqlite3=0])
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([HAVE_SQLITE3], [${ac_cv_sqlite3}], [Set to 1 if you have libsqlite3.])
|
||||
AM_CONDITIONAL([HAVE_SQLITE3], [test "x$ac_cv_sqlite3" = "x1"])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Determine if the processor can do clipping on float to int conversions.
|
||||
|
||||
AS_IF([test "x$enable_cpu_clip" != "xno"], [
|
||||
MN_C_CLIP_MODE
|
||||
], [
|
||||
AS_ECHO(["checking processor clipping capabilities... disabled"])
|
||||
ac_cv_c_clip_positive=0
|
||||
ac_cv_c_clip_negative=0
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([CPU_CLIPS_POSITIVE], [${ac_cv_c_clip_positive}],
|
||||
[Host processor clips on positive float to int conversion.])
|
||||
AC_DEFINE_UNQUOTED([CPU_CLIPS_NEGATIVE], [${ac_cv_c_clip_negative}],
|
||||
[Host processor clips on negative float to int conversion.])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Host OS specific stuff.
|
||||
|
||||
OS_SPECIFIC_CFLAGS=""
|
||||
OS_SPECIFIC_LINKS=""
|
||||
os_is_win32=0
|
||||
os_is_openbsd=0
|
||||
use_windows_api=0
|
||||
AS_CASE([$host_os],
|
||||
[darwin* | rhapsody*], [
|
||||
AS_IF([test "x$HAVE_XCODE_SELECT" = "xyes"], [
|
||||
developer_path=`xcode-select --print-path`
|
||||
], [
|
||||
developer_path="/Developer"
|
||||
])
|
||||
OS_SPECIFIC_LINKS="-framework CoreAudio -framework AudioToolbox -framework CoreFoundation"],
|
||||
[mingw*], [
|
||||
os_is_win32=1
|
||||
use_windows_api=1
|
||||
OS_SPECIFIC_LINKS="-lwinmm"],
|
||||
[openbsd*], [
|
||||
os_is_openbsd=1
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([OS_IS_WIN32], [${os_is_win32}], [Set to 1 if compiling for Win32])
|
||||
AC_DEFINE_UNQUOTED([OS_IS_OPENBSD], [${os_is_openbsd}], [Set to 1 if compiling for OpenBSD])
|
||||
AC_DEFINE_UNQUOTED([USE_WINDOWS_API], [${use_windows_api}], [Set to 1 to use the native windows API])
|
||||
AM_CONDITIONAL(USE_WIN_VERSION_FILE, test ${use_windows_api} -eq 1)
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Check for ALSA.
|
||||
|
||||
AS_IF([test "x$enable_alsa" != "xno"], [
|
||||
PKG_CHECK_MODULES([ALSA], [alsa], [
|
||||
dnl actually test whether ALSA really works, in
|
||||
dnl order to dodge wrong cross-compilation pickups
|
||||
save_CFLAGS="${CFLAGS}"
|
||||
save_LIBS="${LIBS}"
|
||||
CFLAGS="${CFLAGS} ${ALSA_CFLAGS}"
|
||||
LIBS="${LIBS} ${ALSA_LIBS}"
|
||||
AC_CHECK_HEADERS([alsa/asoundlib.h])
|
||||
AS_IF([test "x$ac_cv_header_alsa_asoundlib_h" = "xyes"], [
|
||||
dnl ALSA definitely works
|
||||
AC_DEFINE([HAVE_ALSA], [1], [Set to 1 if you have alsa])
|
||||
alsa_works="yes"
|
||||
], [
|
||||
dnl picked up wrong ALSA
|
||||
alsa_works="no"
|
||||
|
||||
dnl reset flags
|
||||
ALSA_CFLAGS=""
|
||||
ALSA_LIBS=""
|
||||
])
|
||||
CFLAGS="${save_CFLAGS}"
|
||||
LIBS="${save_LIBS}"
|
||||
], [
|
||||
dnl could not find ALSA
|
||||
alsa_works="no"
|
||||
])
|
||||
|
||||
AS_IF([test "x$alsa_works" = "xno"], [
|
||||
AS_IF([test "x$enable_alsa" = "xyes"], [
|
||||
dnl explicitly passed --enable-alsa, hence error out loud and clearly
|
||||
AC_MSG_ERROR([You explicitly requested alsa support, but alsa could not be found!])
|
||||
], [
|
||||
dnl did not explicitly pass --enable-alsa, relying on default automagic on
|
||||
enable_alsa="no (auto)"
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Check for OpenBSD's sndio.
|
||||
|
||||
SNDIO_LIBS=""
|
||||
HAVE_SNDIO_H=0
|
||||
AS_CASE([$host_os],
|
||||
[openbsd*], [
|
||||
AC_CHECK_HEADERS(sndio.h)
|
||||
AS_IF([test "x$ac_cv_header_sndio_h" = "xyes"], [
|
||||
SNDIO_LIBS="-lsndio"
|
||||
HAVE_SNDIO_H=1
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([HAVE_SNDIO_H], [${HAVE_SNDIO_H}], [Set to 1 if <sndio.h> is available.])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Test for sanity when cross-compiling.
|
||||
|
||||
AS_IF([test "x$ac_cv_sizeof_short" != "x2"], [
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** sizeof (short) != 2. ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
])
|
||||
|
||||
AS_IF([test "x$ac_cv_sizeof_int" != "x4"], [
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** sizeof (int) != 4 ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
])
|
||||
|
||||
AS_IF([test "x$ac_cv_sizeof_float" != "x4"], [
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** sizeof (float) != 4. ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
])
|
||||
|
||||
AS_IF([test "x$ac_cv_sizeof_double" != "x8"], [
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** sizeof (double) != 8. ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
])
|
||||
|
||||
AS_IF([test "x$ac_cv_prog_HAVE_AUTOGEN" = "xno"], [
|
||||
AC_MSG_WARN([[Touching files in directory tests/.]])
|
||||
touch tests/*.c tests/*.h
|
||||
])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Settings for the HTML documentation.
|
||||
|
||||
AS_IF([test "x$enable_bow_docs" = "xyes"], [
|
||||
HTML_BGCOLOUR="white"
|
||||
HTML_FGCOLOUR="black"
|
||||
], [
|
||||
HTML_BGCOLOUR="black"
|
||||
HTML_FGCOLOUR="white"
|
||||
])
|
||||
|
||||
dnl ====================================================================================
|
||||
dnl Now use the information from the checking stage.
|
||||
|
||||
win32_target_dll=0
|
||||
COMPILER_IS_GCC=0
|
||||
|
||||
AS_IF([test "x$enable_flags_setting" = "xyes"], [
|
||||
AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CFLAGS])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CXXFLAGS])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
AS_CASE([${host_os}],
|
||||
[darwin*], [
|
||||
ldflags_test="-Wl,-dead_strip_dylibs"],
|
||||
[linux*], [
|
||||
ldflags_test="-Wl,-O1 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections"]
|
||||
)
|
||||
AX_APPEND_LINK_FLAGS([${ldflags_test}], [LDFLAGS])
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_werror" = "xyes"], [
|
||||
AX_APPEND_COMPILE_FLAGS([-Werror], [CFLAGS])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AX_APPEND_COMPILE_FLAGS([-Werror], [CXXFLAGS])
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
|
||||
common_flags="-Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wundef -Wuninitialized -Winit-self"
|
||||
common_cflags="${common_flags}"
|
||||
dnl Clang doesn't know about -Wno-format-truncation
|
||||
dnl and would spew tons of warnings otherwise.
|
||||
AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
|
||||
common_cflags+=" -Wno-format-truncation"
|
||||
])
|
||||
common_cxxflags="${common_flags}"
|
||||
AS_IF([test "x$ax_cv_cxx_compiler_vendor" = "xgnu"], [
|
||||
common_cxxflags+=" -Wno-format-truncation"
|
||||
])
|
||||
|
||||
AX_APPEND_COMPILE_FLAGS([${common_cflags} -Wvla -Wbad-function-cast -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return], [CFLAGS])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AX_APPEND_COMPILE_FLAGS([${common_cxxflags} -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo], [CXXFLAGS])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
AS_IF([test "x$enable_test_coverage" = "xyes"], [
|
||||
AX_APPEND_COMPILE_FLAGS([-coverage], [CFLAGS])
|
||||
])
|
||||
|
||||
dnl some distributions (such as Gentoo) have _FORTIFY_SOURCE always
|
||||
dnl enabled. We test for this situation in order to prevent polluting
|
||||
dnl the console with messages of macro redefinitions.
|
||||
AX_ADD_FORTIFY_SOURCE
|
||||
|
||||
AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
|
||||
dnl OS specific tweaks.
|
||||
AS_CASE([$host_os],
|
||||
[darwin* | rhapsody*], [
|
||||
dnl Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
|
||||
dnl System headers on these systems are broken.
|
||||
temp_CFLAGS=`echo $CFLAGS | $SED "s/-Wall -pedantic//" | $SED "s/-Wshadow//" | $SED "s/-Waggregate-return//"`
|
||||
CFLAGS=$temp_CFLAGS
|
||||
SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(top_srcdir)/src/Symbols.darwin"],
|
||||
[mingw*], [
|
||||
SHLIB_VERSION_ARG="-Wc,-static-libgcc -Wl,\$(top_srcdir)/src/libsndfile-1.def"
|
||||
win32_target_dll=1
|
||||
AS_IF([test "x$enable_shared" = "xno"], [
|
||||
win32_target_dll=0
|
||||
])
|
||||
AX_APPEND_COMPILE_FLAGS([-mstackrealign], [CFLAGS])
|
||||
],
|
||||
[os2*], [
|
||||
SHLIB_VERSION_ARG="-Wl,-export-symbols \$(top_srcdir)/src/Symbols.os2"
|
||||
])
|
||||
|
||||
COMPILER_IS_GCC=1
|
||||
])
|
||||
|
||||
AS_CASE([$host_os], [linux*|kfreebsd*-gnu*|gnu*], [SHLIB_VERSION_ARG="-Wl,--version-script=\$(top_srcdir)/src/Symbols.gnu-binutils"])
|
||||
|
||||
AC_DEFINE_UNQUOTED([WIN32_TARGET_DLL], [${win32_target_dll}], [Set to 1 if windows DLL is being built.])
|
||||
AC_DEFINE_UNQUOTED([COMPILER_IS_GCC], [${COMPILER_IS_GCC}], [Set to 1 if the compile is GNU GCC.])
|
||||
|
||||
CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
|
||||
|
||||
AS_IF([test "x$CFLAGS" = "x"], [
|
||||
AC_MSG_ERROR(["Error in configure script. CFLAGS has been screwed up."])
|
||||
])
|
||||
|
||||
HOST_TRIPLET="${host_cpu}-${host_vendor}-${host_os}"
|
||||
|
||||
AC_DEFINE_UNQUOTED([HOST_TRIPLET], [${HOST_TRIPLET}], [The host triplet of the compiled binary.])
|
||||
|
||||
AS_IF([test "$HOST_TRIPLET" = "x86_64-w64-mingw32"], [
|
||||
OS_SPECIFIC_LINKS=" -static-libgcc $OS_SPECIFIC_LINKS"
|
||||
])
|
||||
|
||||
WIN_RC_VERSION=`echo $PACKAGE_VERSION | $SED -e "s/pre.*//" -e "s/beta.*//" -e "s/\./,/g"`
|
||||
|
||||
|
||||
AS_IF([test "x$enable_static" = "xno"], [
|
||||
SRC_BINDIR=src/.libs/
|
||||
TEST_BINDIR=tests/.libs/
|
||||
], [
|
||||
SRC_BINDIR=src/
|
||||
TEST_BINDIR=tests/
|
||||
])
|
||||
|
||||
dnl -------------------------------------------------------------------------------
|
||||
|
||||
AC_SUBST(HOST_TRIPLET)
|
||||
|
||||
AC_SUBST(HTML_BGCOLOUR)
|
||||
AC_SUBST(HTML_FGCOLOUR)
|
||||
|
||||
AC_SUBST(SHLIB_VERSION_ARG)
|
||||
AC_SUBST([SHARED_VERSION_INFO], [lt_current:lt_revision:lt_age])
|
||||
AC_SUBST([ABI_VERSION], [abi_version_major.abi_version_minor.abi_version_patch])
|
||||
AC_SUBST(CLEAN_VERSION)
|
||||
AC_SUBST(VERSION_MAJOR)
|
||||
AC_SUBST(GEN_TOOL)
|
||||
|
||||
AC_SUBST(WIN_RC_VERSION)
|
||||
|
||||
AC_SUBST(HAVE_EXTERNAL_XIPH_LIBS)
|
||||
AC_SUBST(HAVE_MPEG)
|
||||
AC_SUBST(OS_SPECIFIC_CFLAGS)
|
||||
AC_SUBST(OS_SPECIFIC_LINKS)
|
||||
AC_SUBST(SNDIO_LIBS)
|
||||
|
||||
AC_SUBST(EXTERNAL_XIPH_CFLAGS)
|
||||
AC_SUBST(EXTERNAL_XIPH_LIBS)
|
||||
AC_SUBST(EXTERNAL_XIPH_REQUIRE)
|
||||
AC_SUBST(EXTERNAL_MPEG_LIBS)
|
||||
AC_SUBST(EXTERNAL_MPEG_REQUIRE)
|
||||
AC_SUBST(MPG123_CFLAGS)
|
||||
AC_SUBST(MPG123_LIBS)
|
||||
AC_SUBST(MPEG_CFLAGS)
|
||||
AC_SUBST(MPEG_LIBS)
|
||||
AC_SUBST(SRC_BINDIR)
|
||||
AC_SUBST(TEST_BINDIR)
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile Octave/Makefile
|
||||
src/version-metadata.rc
|
||||
tests/test_wrapper.sh tests/pedantic-header-test.sh
|
||||
sndfile.pc
|
||||
Scripts/build-test-tarball.mk
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
dnl ====================================================================================
|
||||
|
||||
AS_IF([test -z "$PKG_CONFIG"], [
|
||||
AS_ECHO([" *****************************************************************"])
|
||||
AS_ECHO([" *** The pkg-config program is missing. ***"])
|
||||
AS_ECHO([" *** External FLAC/Ogg/Vorbis libs cannot be found without it. ***"])
|
||||
AS_ECHO([" *** http://pkg-config.freedesktop.org/wiki/ ***"])
|
||||
AS_ECHO([" *****************************************************************"])
|
||||
])
|
||||
|
||||
AX_RECURSIVE_EVAL([$libdir], [full_absolute_libdir])
|
||||
AX_RECURSIVE_EVAL([$bindir], [full_absolute_bindir])
|
||||
AX_RECURSIVE_EVAL([$pkgconfigdir], [full_absolute_pkgconfigdir])
|
||||
AX_RECURSIVE_EVAL([$htmldir], [full_absolute_htmldir])
|
||||
AC_MSG_RESULT([
|
||||
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
Configuration summary :
|
||||
|
||||
libsndfile version : .................. ${VERSION}
|
||||
|
||||
Host CPU : ............................ ${host_cpu}
|
||||
Host Vendor : ......................... ${host_vendor}
|
||||
Host OS : ............................. ${host_os}
|
||||
|
||||
CFLAGS : .............................. ${CFLAGS}
|
||||
CXXFLAGS : ............................ ${CXXFLAGS}
|
||||
CPPFLAGS : ............................ ${CPPFLAGS}
|
||||
LDFLAGS : ............................. ${LDFLAGS}
|
||||
|
||||
Experimental code : ................... ${enable_experimental:-no}
|
||||
Using ALSA in example programs : ...... ${enable_alsa:-no}
|
||||
External FLAC/Ogg/Vorbis/Opus : ....... ${enable_external_libs:-no}
|
||||
External MPEG Lame/MPG123 : ........... ${enable_mpeg:-no}
|
||||
Building Octave interface : ........... ${OCTAVE_BUILD}
|
||||
|
||||
Tools :
|
||||
|
||||
C Compiler Vendor is : ................ ${ax_cv_c_compiler_vendor} (${ax_cv_c_compiler_version})
|
||||
CXX Compiler Vendor is : .............. ${ax_cv_cxx_compiler_vendor} (${ax_cv_cxx_compiler_version})
|
||||
|
||||
Sanitizer enabled : ................... ${enable_sanitizer:-no}
|
||||
|
||||
Installation directories :
|
||||
|
||||
Library directory : ................... ${full_absolute_libdir}
|
||||
Program directory : ................... ${full_absolute_bindir}
|
||||
Pkgconfig directory : ................. ${full_absolute_pkgconfigdir}
|
||||
HTML docs directory : ................. ${full_absolute_htmldir}
|
||||
|
||||
Compiling some other packages against libsndfile may require
|
||||
the addition of '$full_absolute_pkgconfigdir' to the
|
||||
PKG_CONFIG_PATH environment variable.
|
||||
])
|
||||
|
||||
dnl Remove symlink created by Scripts/android-configure.sh.
|
||||
rm -f gdbclient
|
||||
482
Engine/lib/libsndfile/docs/FAQ.md
Normal file
482
Engine/lib/libsndfile/docs/FAQ.md
Normal file
|
|
@ -0,0 +1,482 @@
|
|||
---
|
||||
layout: default
|
||||
title: libsndfile : Frequently Asked Questions.
|
||||
---
|
||||
|
||||
# libsndfile : Frequently Asked Questions
|
||||
|
||||
1. [Do you plan to support XYZ codec in libsndfile?](#Q001)
|
||||
2. [In version 0 the SF\_INFO struct had a pcmbitwidth field but version 1 does not. Why?](#Q002)
|
||||
3. [Compiling is really slow on MacOS X. Why?](#Q003)
|
||||
4. [When trying to compile libsndfile on Solaris I get a "bad substitution" error during linking. What can I do to fix this?](#Q004)
|
||||
5. [Why doesn't libsndfile do interleaving/de-interleaving?](#Q005)
|
||||
6. [What's the best format for storing temporary files?](#Q006)
|
||||
7. [On Linux/Unix/MacOS X, what's the best way of detecting the presence of libsndfile?](#Q007)
|
||||
8. [I have libsndfile installed and now I want to use it. I just want a simple Makefile\! What do I do?](#Q008)
|
||||
9. [How about adding the ability to write/read sound files to/from memory buffers?](#Q009)
|
||||
10. [Reading a 16 bit PCM file as normalised floats and then writing them back changes some sample values. Why?](#Q010)
|
||||
11. [I'm having problems with u-law encoded WAV files generated by libsndfile in Winamp. Why?](#Q011)
|
||||
12. [I'm looking at sf\_read\*. What are items? What are frames?](#Q012)
|
||||
13. [Why can't libsndfile open this Sound Designer II (SD2) file?](#Q013)
|
||||
14. [I'd like to statically link libsndfile to my closed source application. Can I buy a license so that this is possible?](#Q014)
|
||||
15. [My program is crashing during a call to a function in libsndfile. Is this a bug in libsndfile?](#Q015)
|
||||
16. [Will you accept a fix for compiling libsndfile with compiler X?](#Q016)
|
||||
17. [Can libsndfile read/write files from/to UNIX pipes?](#Q017)
|
||||
18. [Is it possible to build a Universal Binary on Mac OS X?](#Q018)
|
||||
19. [I have project files for Visual Studio / XCode / Whatever. Why don't you distribute them with libsndfile?](#Q019)
|
||||
20. [Why doesn't libsndfile support MP3?](#Q020)
|
||||
21. [How do I use libsndfile in a closed source or commercial program and comply with the license?](#Q021)
|
||||
22. [What versions of windows does libsndfile work on?](#Q022)
|
||||
23. [I'm cross compiling libsndfile for another platform. How can I run the test suite?](#Q023)
|
||||
|
||||
-----
|
||||
|
||||
## Q1 : Do you plan to support XYZ codec in libsndfile? {#Q001}
|
||||
|
||||
If source code for XYZ codec is available under a suitable license (LGPL, BSD,
|
||||
MIT etc) then yes, I'd like to add it.
|
||||
|
||||
If suitable documentation is available on how to decode and encode the format
|
||||
then maybe, depending on how much work is involved.
|
||||
|
||||
If XYZ is some proprietary codec where no source code or documentation is
|
||||
available then no.
|
||||
|
||||
So if you want support for XYZ codec, first find existing source code or
|
||||
documentation. If you can't find either then the answer is no.
|
||||
|
||||
## Q2 : In version 0 the SF\_INFO struct had a pcmbitwidth field but version 1 does not. Why? {#Q002}
|
||||
|
||||
This was dropped for a number of reasons:
|
||||
|
||||
- pcmbitwidth makes little sense on compressed or floating point formats
|
||||
- with the new API you really don't need to know it
|
||||
|
||||
As documented [here](api.md#note-1) there is now a well defined behaviour which
|
||||
ensures that no matter what the bit width of the source file, the scaling always
|
||||
does something sensible. This makes it safe to read 8, 16, 24 and 32 bit PCM
|
||||
files using `sf_read_short()` and always have the optimal behaviour.
|
||||
|
||||
## Q3 : Compiling is really slow on MacOS X. Why? {#Q003}
|
||||
|
||||
When you configure and compile libsndfile, it uses the /bin/sh shell for a
|
||||
number of tasks (ie configure script and libtool). Older versions of OS X
|
||||
(10.2?) shipped a really crappy Bourne shell as /bin/sh which resulted in
|
||||
**really** slow compiles. Newer version of OS X ship GNU Bash as /bin/sh and
|
||||
this answer doesn't apply in that case.
|
||||
|
||||
To fix this I suggest that you install the GNU Bash shell, rename /bin/sh to
|
||||
/bin/sh.old and make a symlink from /bin/sh to the bash shell. Bash is designed
|
||||
to behave as a Bourne shell when it is called as /bin/sh.
|
||||
|
||||
When I did this on my iBook running MacOS X, compile times dropped from 13
|
||||
minutes to 3 minutes.
|
||||
|
||||
## Q4 : When trying to compile libsndfile on Solaris I get a "bad substitution" error on linking. Why? {#Q004}
|
||||
|
||||
It seems that the Solaris Bourne shell disagrees with GNU libtool.
|
||||
|
||||
To fix this I suggest that you install the GNU Bash shell, rename /bin/sh to
|
||||
/bin/sh.old and make a symlink from /bin/sh to the bash shell. Bash is designed
|
||||
to behave as a Bourne shell when it is called as /bin/sh.
|
||||
|
||||
## Q5 : Why doesn't libsndfile do interleaving/de-interleaving? {#Q005}
|
||||
|
||||
This problem is bigger than it may seem at first.
|
||||
|
||||
For a stereo file, it is a pretty safe bet that a simple interleaving/
|
||||
de-interleaving could satisfy most users. However, for files with more than 2
|
||||
channels this is unlikely to be the case. If the user has a 4 channel file and
|
||||
want to play that file on a stereo output sound card they either want the first
|
||||
2 channels or they want some mixed combination of the 4 channels.
|
||||
|
||||
When you add more channels, the combinations grow exponentially and it becomes
|
||||
increasingly difficult to cover even a sensible subset of the possible
|
||||
combinations. On top of that, coding any one style of interleaver/de-interleaver
|
||||
is trivial, while coding one that can cover all combinations is far from
|
||||
trivial. This means that this feature will not be added any time soon.
|
||||
|
||||
## Q6 : What's the best format for storing temporary files? {#Q006}
|
||||
|
||||
When you want to store temporary data there are a number of requirements:
|
||||
|
||||
- A simple, easy to parse header.
|
||||
- The format must provide the fastest possible read and write rates (ie avoid
|
||||
conversions and encoding/decoding).
|
||||
- The file format must be reasonably common and playable by most players.
|
||||
- Able to store data in either endian-ness.
|
||||
|
||||
The format which best meets these requirements is AU, which allows data to be
|
||||
stored in any one of short, int, float and double (among others) formats.
|
||||
|
||||
For instance, if an application uses float data internally, its temporary files
|
||||
should use a format of (SF_ENDIAN_CPU | SF_FORMAT_AU | SF_FORMAT_FLOAT) which
|
||||
will store big endian float data in big endian CPUs and little endian float data
|
||||
on little endian CPUs. Reading and writing this format will not require any
|
||||
conversions or byte swapping regardless of the host CPU.
|
||||
|
||||
## Q7 : On Linux/Unix/MaxOS X, what's the best way of detecting the presence of libsndfile using autoconf? {#Q007}
|
||||
|
||||
libsndfile uses the pkg-config (man pkg-config) method of registering itself
|
||||
with the host system. The best way of detecting its presence is using something
|
||||
like this in configure.ac (or configure.in):
|
||||
|
||||
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, ac_cv_sndfile=1, ac_cv_sndfile=0)
|
||||
|
||||
AC_DEFINE_UNQUOTED([HAVE_SNDFILE],${ac_cv_sndfile},
|
||||
[Set to 1 if you have libsndfile.])
|
||||
|
||||
AC_SUBST(SNDFILE_CFLAGS)
|
||||
AC_SUBST(SNDFILE_LIBS)
|
||||
|
||||
This will automatically set the **SNDFILE_CFLAGS** and **SNDFILE_LIBS**
|
||||
variables which can be used in Makefile.am like this:
|
||||
|
||||
SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
|
||||
SNDFILE_LIBS = @SNDFILE_LIBS@
|
||||
|
||||
If you install libsndfile from source, you will probably need to set the
|
||||
**PKG_CONFIG_PATH** environment variable as suggested at the end of the
|
||||
libsndfile configure process. For instance on my system I get this:
|
||||
|
||||
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
Configuration summary :
|
||||
|
||||
Version : ..................... 1.0.5
|
||||
Experimental code : ........... no
|
||||
|
||||
Tools :
|
||||
|
||||
Compiler is GCC : ............. yes
|
||||
GCC major version : ........... 3
|
||||
|
||||
Installation directories :
|
||||
|
||||
Library directory : ........... /usr/local/lib
|
||||
Program directory : ........... /usr/local/bin
|
||||
Pkgconfig directory : ......... /usr/local/lib/pkgconfig
|
||||
|
||||
Compiling some other packages against libsndfile may require
|
||||
the addition of "/usr/local/lib/pkgconfig" to the
|
||||
PKG_CONFIG_PATH environment variable.
|
||||
|
||||
## Q8 : I have libsndfile installed and now I want to use it. I just want a simple Makefile\! What do I do? {#Q008}
|
||||
|
||||
The **pkg-config** program makes finding the correct compiler flag values and
|
||||
library location far easier. During the installation of libsndfile, a file named
|
||||
**sndfile.pc** is installed in the directory **${libdir}/pkgconfig** (ie if
|
||||
libsndfile is installed in **/usr/local/lib**, **sndfile.pc** will be installed
|
||||
in **/usr/local/lib/pkgconfig/**).
|
||||
|
||||
In order for pkg-config to find sndfile.pc it may be necessary to point the
|
||||
environment variable **PKG_CONFIG_PATH** in the right direction.
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
||||
|
||||
Then, to compile a C file into an object file, the command would be:
|
||||
|
||||
gcc `pkg-config --cflags sndfile` -c somefile.c
|
||||
|
||||
and to link a number of objects into an executable that links against
|
||||
libsndfile, the command would be:
|
||||
|
||||
gcc `pkg-config --libs sndfile` obj1.o obj2.o -o program
|
||||
|
||||
## Q9 : How about adding the ability to write/read sound files to/from memory buffers? {#Q009}
|
||||
|
||||
This has been [added](api.md#open_virtual) for version 1.0.12.
|
||||
|
||||
## Q10 : Reading a 16 bit PCM file as normalised floats and then writing them back changes some sample values. Why? {#Q010}
|
||||
|
||||
This is caused by the fact that the conversion from 16 bit short to float is
|
||||
done by dividing by 32768 (0x8000 in hexadecimal) while the conversion from
|
||||
float to 16 bit short is done by multiplying by 32767 (0x7FFF in hex). So for
|
||||
instance, a value in a 16 bit PCM file of 20000 gets read as a floating point
|
||||
number of 0.6103515625 (20000.0 / 0x8000). Converting that back to a 16 bit
|
||||
short results in a value of 19999.3896484375 (0.6103515625 \* 0x7FFF) which then
|
||||
gets rounded down to 19999.
|
||||
|
||||
You will notice that for this particular case, the error is 1 in 20000 or
|
||||
0.005%. Interestingly, for values of less than 16369, dividing by 0x8000
|
||||
followed by multiplying by 0x7FFF and then rounding the result, gives back the
|
||||
original value. It turns out that as long as the host operating system supplies
|
||||
the 1999 ISO C Standard functions **lrintf** and **lrint** (or a replacement has
|
||||
been supplied) then the maximum possible error is 1 in 16369 or about 0.006%.
|
||||
|
||||
Regardless of the size of the error, the reason why this is done is rather
|
||||
subtle.
|
||||
|
||||
In a file containing 16 bit PCM samples, the values are restricted to the range
|
||||
[-32768, 32767] while we want floating point values in the range [-1.0, 1.0].
|
||||
The only way to do this conversion is to do a floating point division by a value
|
||||
of 0x8000. Converting the other way, the only way to ensure that floating point
|
||||
values in the range [-1.0, 1.0] are within the valid range allowed by a 16 bit
|
||||
short is to multiply by 0x7FFF.
|
||||
|
||||
Some people would say that this is a severe short-coming of libsndfile. I would
|
||||
counter that anybody who is constantly converting back and forth between 16 bit
|
||||
shorts and normalised floats is going to suffer other losses in audio quality
|
||||
that they should also be concerned about.
|
||||
|
||||
Since this problem only occurs when converting between integer data on disk and
|
||||
normalized floats in the application, it can be avoided by using something other
|
||||
than normalized floats in the application. Alternatives to normalized floats are
|
||||
the **short** and **int** data types (ie using sf_read_short or sf_read_int) or
|
||||
using un-normalized floats (see
|
||||
[SFC_SET_NORM_FLOAT](command.html#sfc_set_norm_float)).
|
||||
|
||||
Another way to deal with this problem is to consider 16 bit short data as a
|
||||
final destination format only, not as an intermediate storage format. All
|
||||
intermediate data (ie which is going to be processed further) should be stored
|
||||
in floating point format which is supported by all of the most common file
|
||||
formats. If floating point files are considered too large (2 times the size of a
|
||||
16 bit PCM file), it would also be possible to use 24 bit PCM as an intermediate
|
||||
storage format (and which is also supported by most common file types).
|
||||
|
||||
## Q11 : I'm having problems with u-law encoded WAV files generated by libsndfile in Winamp. Why? {#Q011}
|
||||
|
||||
This is actually a Winamp problem. The official Microsoft spec suggests that the
|
||||
'fmt ' chunk should be 18 bytes. Unfortunately at least one of Microsoft's own
|
||||
applications (Sound Recorder on Win98 I believe) did not accept 18 bytes 'fmt '
|
||||
chunks.
|
||||
|
||||
Michael Lee did some experimenting and found that:
|
||||
|
||||
> I have checked that Windows Media Player 9, QuickTime Player 6.4, RealOne
|
||||
> Player 2.0 and GoldWave 5.06 can all play u-law files with 16-byte or 18-byte
|
||||
> 'fmt ' chunk. Only Winamp (2.91) and foobar2000 are unable to play u-law files
|
||||
> with 16-byte 'fmt ' chunk.
|
||||
|
||||
Even this is a very small sampling of all the players out there. For that reason
|
||||
it is probably not a good idea to change this now because there is the risk of
|
||||
breaking something that currently works.
|
||||
|
||||
## Q12 : I'm looking at sf_read*. What are items? What are frames? {#Q012}
|
||||
|
||||
An `item` is a single sample of the data type you are reading; ie a single
|
||||
`short` value for `sf_read_short` or a single `float` for `sf_read_float`.
|
||||
|
||||
For a sound file with only one channel, a frame is the same as a item (ie a
|
||||
single sample) while for multi channel sound files, a single frame contains a
|
||||
single item for each channel.
|
||||
|
||||
Here are two simple, correct examples, both of which are assumed to be working
|
||||
on a stereo file, first using items:
|
||||
|
||||
```c
|
||||
#define CHANNELS 2
|
||||
short data [CHANNELS * 100] ;
|
||||
sf_count items_read = sf_read_short (file, data, 200) ;
|
||||
assert (items_read == 200) ;
|
||||
```
|
||||
|
||||
and now reading the exact same amount of data using frames:
|
||||
|
||||
```c
|
||||
#define CHANNELS 2
|
||||
short data [CHANNELS * 100] ;
|
||||
sf_count frames_read = sf_readf_short (file, data, 100) ;
|
||||
assert (frames_read == 100) ;
|
||||
```
|
||||
|
||||
## Q13 : Why can't libsndfile open this Sound Designer II (SD2) file? {#Q013}
|
||||
|
||||
This is somewhat complicated. First some background.
|
||||
|
||||
SD2 files are native to the Apple Macintosh platform and use features of the Mac
|
||||
filesystem (file resource forks) to store the file's sample rate, number of
|
||||
channels, sample width and more. When you look at a file and its resource fork
|
||||
on Mac OS X it looks like this:
|
||||
|
||||
-rw-r--r-- 1 erikd erikd 46512 Oct 18 22:57 file.sd2
|
||||
-rw-r--r-- 1 erikd erikd 538 Oct 18 22:57 file.sd2/rsrc
|
||||
|
||||
Notice how the file itself looks like a directory containing a single file named
|
||||
**rsrc**. When libsndfile is compiled for MacOS X, it should open (for write and
|
||||
read) SD2 file with resource forks like this without any problems. It will also
|
||||
handle files with the resource fork in a separate file as described below.
|
||||
|
||||
When SD2 files are moved to other platforms, the resource fork of the file can
|
||||
sometimes be dropped altogether. All that remains is the raw audio data and no
|
||||
information about the number of channels, sample rate or bit width which makes
|
||||
it a little difficult for libsndfile to open the file.
|
||||
|
||||
However, it is possible to safely move an SD2 file to a Linux or Windows
|
||||
machine. For instance, when an SD2 file is copied from inside MacOS X to a
|
||||
windows shared directory or a Samba share (ie Linux), MacOS X is clever enough
|
||||
to store the resource fork of the file in a separate hidden file in the same
|
||||
directory like this:
|
||||
|
||||
-rw-r--r-- 1 erikd erikd 538 Oct 18 22:57 ._file.sd2
|
||||
-rw-r--r-- 1 erikd erikd 46512 Oct 18 22:57 file.sd2
|
||||
|
||||
Regardless of what platform it is running on, when libsndfile is asked to open a
|
||||
file named **"foo"** and it can't recognize the file type from the data in the
|
||||
file, it will attempt to open the resource fork and if that fails, it then tries
|
||||
to open a file named **"._foo"** to see if the file has a valid resource fork.
|
||||
This is the same regardless of whether the file is being opened for read or
|
||||
write.
|
||||
|
||||
In short, libsndfile should open SD2 files with a valid resource fork on all of
|
||||
the platforms that libsndfile supports. If a file has lost its resource fork,
|
||||
the only option is the open the file using the SF_FORMAT_RAW option and guessing
|
||||
its sample rate, channel count and bit width.
|
||||
|
||||
Occasionally, when SD2 files are moved to other systems, the file is
|
||||
[BinHexed](http://www.macdisk.com/binhexen.php3) which wraps the resource fork
|
||||
and the data fork together. For these files, it would be possible to write a
|
||||
BinHex parser but there is not a lot to gain considering how rare these BinHexed
|
||||
SD2 files are.
|
||||
|
||||
## Q14 : I'd like to statically link libsndfile to my closed source application. Can I buy a license so that this is possible? {#Q014}
|
||||
|
||||
Unfortunately no. libsndfile contains code written by other people who have
|
||||
agreed that their code be used under the GNU LGPL but no more. Even if they were
|
||||
to agree, there would be significant difficulties in dividing up the payments
|
||||
fairly.
|
||||
|
||||
The **only** way you can legally use libsndfile as a statically linked library
|
||||
is if your application is released under the GNU GPL or LGPL.
|
||||
|
||||
## Q15 : My program is crashing during a call to a function in libsndfile. Is this a bug in libsndfile? {#Q015}
|
||||
|
||||
libsndfile is being used by large numbers of people all over the world without
|
||||
any problems like this. That means that it is much more likely that your code
|
||||
has a bug than libsndfile. However, it is still possible that there is a bug in
|
||||
libsndfile.
|
||||
|
||||
To figure out whether it is your code or libsndfile you should do the following:
|
||||
|
||||
- Make sure you are compiling your code with warnings switched on and that you
|
||||
fix as many warnings as possible. With the GNU compiler (gcc) I would
|
||||
recommend at least **-W -Wall -Werror** which will force you to fix all
|
||||
warnings before you can run the code.
|
||||
- Try using a memory debugger. [Valgrind](http://valgrind.kde.org/) on x86 Linux
|
||||
is excellent. [Purify](http://www.ibm.com/software/awdtools/purify/) also has
|
||||
a good reputation.
|
||||
- If the code is clean after the above two steps and you still get a crash in
|
||||
libsndfile, then send me a small snippet of code (no more than 30-40 lines)
|
||||
which includes the call to sf_open() and also shows how all variables passed
|
||||
to/returned from sf_open() are defined.
|
||||
|
||||
## Q16 : Will you accept a fix for compiling libsndfile with compiler X? {#Q016}
|
||||
|
||||
If compiler X is a C++ compiler then no. C and C++ are different enough to make
|
||||
writing code that compiles as valid C and valid C++ too difficult. I would
|
||||
rather spend my time fixing bugs and adding features.
|
||||
|
||||
If compiler X is a C compiler then I will do what I can as long as that does not
|
||||
hamper the correctness, portability and maintainability of the existing code. It
|
||||
should be noted however that libsndfile uses features specified by the 1999 ISO
|
||||
C Standard. This can make compiling libsndfile with some older compilers
|
||||
difficult.
|
||||
|
||||
## Q17 : Can libsndfile read/write files from/to UNIX pipes? {#Q017}
|
||||
|
||||
Yes, libsndfile can read files from pipes. Unfortunately, the write case is much
|
||||
more complicated.
|
||||
|
||||
File formats like AIFF and WAV have information at the start of the file (the
|
||||
file header) which states the length of the file, the number of sample frames
|
||||
etc. This information must be filled in correctly when the file header is
|
||||
written, but this information is not reliably known until the file is closed.
|
||||
This means that libsndfile cannot write AIFF, WAV and many other file types to a
|
||||
pipe.
|
||||
|
||||
However, there is at least one file format (AU) which is specifically designed
|
||||
to be written to a pipe. Like AIFF and WAV, AU has a header with a sample frames
|
||||
field, but it is specifically allowable to set that frames field to 0x7FFFFFFF
|
||||
if the file length is not known when the header is written. The AU file format
|
||||
can also hold data in many of the standard formats (ie SF_FORMAT_PCM_16,
|
||||
SF_FORMAT_PCM_24, SF_FORMAT_FLOAT etc) as well as allowing data in both big and
|
||||
little endian format.
|
||||
|
||||
See also [FAQ Q6](#Q006).
|
||||
|
||||
## Q18 : Is it possible to build a Universal Binary on Mac OS X? {#Q018}
|
||||
|
||||
Yes, but you must do two separate configure/build/test runs; one on PowerPC and
|
||||
one on Intel. It is then possible to merge the binaries into a single universal
|
||||
binary using one of the programs in the Apple tool chain.
|
||||
|
||||
It is **not** possible to build a working universal binary via a single
|
||||
compile/build run on a single CPU.
|
||||
|
||||
The problem is that the libsndfile build process detects features of the CPU its
|
||||
being built for during the configure process and when building a universal
|
||||
binary, configure is only run once and that data is then used for both CPUs.
|
||||
That configure data will be wrong for one of those CPUs. You will still be able
|
||||
to compile libsndfile, and the test suite will pass on the machine you compiled
|
||||
it on. However, if you take the universal binary test suite programs compiled on
|
||||
one CPU and run them on the other, the test suite will fail.
|
||||
|
||||
Part of the problem is that the CPU endian-ness is detected at configure time.
|
||||
Yes, I know the Apple compiler defines one of the macros \_\_LITTLE\_ENDIAN\_\_
|
||||
and \_\_BIG\_ENDIAN\_\_, but those macros are not part of the 1999 ISO C
|
||||
Standard and they are not portable.
|
||||
|
||||
Endian issues are not the only reason why the cross compiled binary will fail.
|
||||
The configure script also detects other CPU specific idiosyncrasies to provide
|
||||
more optimized code.
|
||||
|
||||
Finally, the real show stopper problem with universal binaries is the problem
|
||||
with the test suite. libsndfile contains a huge, comprehensive test suite. When
|
||||
you compile a universal binary and run the test suite, you only test the native
|
||||
compile. The cross compiled binary (the one with the much higher chance of
|
||||
having problems) cannot be tested.
|
||||
|
||||
Now, if you have read this far you're probably thinking there must be a way to
|
||||
fix this and there probably is. The problem is that its a hell of a lot of work
|
||||
and would require significant changes to the configure process, the internal
|
||||
code and the test suite. In addition, these changes must not break compilation
|
||||
on any of the platforms libsndfile is currently working on.
|
||||
|
||||
## Q19 : I have project files for Visual Studio / XCode / Whatever. Why don't you distribute them with libsndfile? {#Q019}
|
||||
|
||||
Use CMake project.
|
||||
|
||||
## Q20 : Why doesn't libsndfile support MP3? {#Q020}
|
||||
|
||||
~~In the past, MP3 was not supported because the technology behind MP3 was
|
||||
patented. Those patents have now expired and there is an
|
||||
[open ticket](https://github.com/libsndfile/libsndfile/issues/258) to implement
|
||||
MP3 support.~~
|
||||
|
||||
**Update :** Starting from version 1.1.0 libsndfile supports MP3 format.
|
||||
|
||||
## Q21 : How do I use libsndfile in a closed source or commercial program and comply with the license? {#Q021}
|
||||
|
||||
Here is a checklist of things you need to do to make sure your use of libsndfile
|
||||
in a closed source or commercial project complies with the license libsndfile is
|
||||
released under, the GNU Lesser General Public License (LGPL):
|
||||
|
||||
- Make sure you are linking to libsndfile as a shared library (Linux and Unix
|
||||
systems), Dynamic Link Library (Microsoft Windows) or dynlib (Mac OS X). If
|
||||
you are using some other operating system that doesn't allow dynamically
|
||||
linked libraries, you will not be able to use libsndfile unless you release
|
||||
the source code to your program.
|
||||
- In the licensing documentation for your program, add a statement that your
|
||||
software depends on libsndfile and that libsndfile is released under the GNU
|
||||
Lesser General Public License, either
|
||||
[version 2.1](http://www.gnu.org/licenses/lgpl-2.1.txt) or optionally
|
||||
[version 3](http://www.gnu.org/licenses/lgpl.txt).
|
||||
- Include the text for both versions of the license, possibly as separate files
|
||||
named libsndfile_lgpl_v2_1.txt and libsndfile_lgpl_v3.txt.
|
||||
|
||||
## Q22 : What versions of Windows does libsndfile work on? {#Q022}
|
||||
|
||||
New versions of libsndfile binary releases require Wiindows Vista. If you need
|
||||
Windows XP support, you can build DLL from sources, we don't use specific WinXP
|
||||
features.
|
||||
|
||||
## Q23 : I'm cross compiling libsndfile for another platform. How can I run the test suite? {#Q023}
|
||||
|
||||
Since version 1.0.21 the top level Makefile has an extra make target,
|
||||
'test-tarball'. Building this target creates a tarball called called:
|
||||
|
||||
` libsndfile-testsuite-${host_triplet}-${version}.tar.gz`
|
||||
|
||||
in the top level directory. This tarball can then be copied to the target
|
||||
platform. Once untarred and test script `test_wrapper.sh` can be run from the
|
||||
top level of the extracted tarball.
|
||||
8
Engine/lib/libsndfile/docs/_config.yml
Normal file
8
Engine/lib/libsndfile/docs/_config.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
author: "The libsndfile team"
|
||||
version: "1.2.2"
|
||||
|
||||
markdown: kramdown
|
||||
plugins:
|
||||
- jekyll-default-layout
|
||||
---
|
||||
1
Engine/lib/libsndfile/docs/_includes/logo.html
Normal file
1
Engine/lib/libsndfile/docs/_includes/logo.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<img src="libsndfile.jpg" class="image-logo" height=98 width=367 alt="Logo">
|
||||
18
Engine/lib/libsndfile/docs/_layouts/default.html
Normal file
18
Engine/lib/libsndfile/docs/_layouts/default.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ page.title }}</title>
|
||||
<link rel="stylesheet" href="libsndfile.css" type="text/css" media="all">
|
||||
<link rel="stylesheet" href="print.css" type="text/css" media="print">
|
||||
</head>
|
||||
<body>
|
||||
{{ content }}
|
||||
<footer>
|
||||
<hr>
|
||||
<p>The libsndfile home page is <a href="http://libsndfile.github.io/libsndfile/">here</a>.</p>
|
||||
<p>The libsndfile version: {{ site.version }}.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
34
Engine/lib/libsndfile/docs/_layouts/home.html
Normal file
34
Engine/lib/libsndfile/docs/_layouts/home.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
layout: default
|
||||
keywords: WAV AIFF AU SVX PAF NIST W64 libsndfile sound audio dsp Linux
|
||||
robots: nofollow
|
||||
title: libsndfile home page
|
||||
---
|
||||
|
||||
<footer>
|
||||
{% include logo.html %}
|
||||
|
||||
<nav>
|
||||
<a href="#history">History</a> -+-
|
||||
<a href="#features">Features</a> -+-
|
||||
<a href="#similar-or-related-projects">Similar or related projects</a> -+-
|
||||
<a href="https://github.com/libsndfile/libsndfile/blob/master/CHANGELOG.md">News</a>
|
||||
<br>
|
||||
<a href="development.html">Development</a> -+-
|
||||
<a href="api.html">Programming interface</a> -+-
|
||||
<a href="bugs.html">Bug reporting</a> -+-
|
||||
<a href="#download">Download</a>
|
||||
<br>
|
||||
<a href="FAQ.html">FAQ</a> -+-
|
||||
<a href="lists.html">Mailing lists</a> -+-
|
||||
<a href="#licensing">Licensing information</a> -+-
|
||||
<a href="#see-also">See also</a>
|
||||
</nav>
|
||||
<br><br>
|
||||
</footer>
|
||||
|
||||
<main>
|
||||
<article>
|
||||
{{ content }}
|
||||
</article>
|
||||
</main>
|
||||
10
Engine/lib/libsndfile/docs/_layouts/page.html
Normal file
10
Engine/lib/libsndfile/docs/_layouts/page.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
|
||||
<main>
|
||||
<article>
|
||||
{{ content }}
|
||||
</article>
|
||||
</main>
|
||||
744
Engine/lib/libsndfile/docs/api.md
Normal file
744
Engine/lib/libsndfile/docs/api.md
Normal file
|
|
@ -0,0 +1,744 @@
|
|||
---
|
||||
layout: page
|
||||
title: The libsndfile API
|
||||
---
|
||||
|
||||
# libsndfile
|
||||
|
||||
Libsndfile is a library designed to allow the reading and writing of many different sampled sound file formats (such as
|
||||
MS Windows WAV and the Apple/SGI AIFF format) through one standard library interface.
|
||||
|
||||
During read and write operations, formats are seamlessly converted between the format the application program has
|
||||
requested or supplied and the file's data format. The application programmer can remain blissfully unaware of issues
|
||||
such as file endian-ness and data format. See [Note 1](#note-1) and [Note 2](#note-2).
|
||||
|
||||
Every effort is made to keep these documents up-to-date, error free and unambiguous. However, since maintaining the
|
||||
documentation is the least fun part of working on libsndfile, these docs can and do fall behind the behaviour of the
|
||||
library. If any errors, omissions or ambiguities are found, please notify me (erikd) at mega-nerd dot com.
|
||||
|
||||
To supplement this reference documentation, there are simple example programs included in the source code tarball. The
|
||||
test suite which is also part of the source code tarball is also a good place to look for the correct usage of the
|
||||
library functions.
|
||||
|
||||
**Finally, if you think there is some feature missing from libsndfile, check that it isn't already implemented (and
|
||||
documented) [here](command.md).**
|
||||
|
||||
## Synopsis
|
||||
|
||||
```c
|
||||
#include <stdio.h>;
|
||||
#include <sndfile.h>;
|
||||
```
|
||||
|
||||
| Name | Description |
|
||||
|:------------------------------------------------------------------------------------------------------------|:--------------------------------------- |
|
||||
| [sf_open, sf_wchar_open](#open) | File open functions. |
|
||||
| [sf_open_fd](#open_fd) | Open sound file using file descriptor. |
|
||||
| [sf_open_virtual](#open_virtual) | Open sound file using virtual API. |
|
||||
| [sf_format_check](#check) | Validate sound file info. |
|
||||
| [sf_seek](#seek) | Seek position in sound file. |
|
||||
| [sf_command](command.md) | Command interface. |
|
||||
| [sf_error, sf_strerror, sf_error_number, sf_perror, sf_error_str](#error) | Error functions. |
|
||||
| [sf_close](#close) | File close function. |
|
||||
| [sf_write_sync](#write_sync) | Write sync function. |
|
||||
| [sf_read_short, sf_read_int, sf_read_float, sf_read_double](#read) | File items read functions. |
|
||||
| [sf_readf_short, sf_readf_int, sf_readf_float, sf_readf_double](#readf) | File frames read functions. |
|
||||
| [sf_write_short, sf_write_int, sf_write_float, sf_write_double](#write) | File items write functions. |
|
||||
| [sf_writef_short, sf_writef_int, sf_writef_float, sf_writef_double](#writef) | File frames write functions. |
|
||||
| [sf_read_raw, sf_write_raw](#raw) | Raw read/write functions. |
|
||||
| [sf_get_string, sf_set_string](#string) | Functions for reading and writing string data. |
|
||||
| [sf_version_string](#version_string) | Retrieve library version string. |
|
||||
| [sf_current_byterate](#current_byterate) | Retrieve current byterate. |
|
||||
| [sf_set_chunk, sf_get_chunk_iterator, sf_next_chunk_iterator, sf_get_chunk_size, sf_get_chunk_data](#chunk) | RIFF chunks API. |
|
||||
|
||||
SNDFILE* is an anonymous pointer to data which is private to the library.
|
||||
|
||||
## File Open Function {#open}
|
||||
|
||||
```c
|
||||
SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ;
|
||||
```
|
||||
|
||||
The sf_open() function opens the sound file at the specified path. The filename is byte encoded, but may be utf-8 on
|
||||
Linux, while on Mac OS X it will use the filesystem character set. On Windows, there is also a Windows specific
|
||||
sf_wchar_open() that takes a UTF16_BE encoded filename.
|
||||
|
||||
```c
|
||||
SNDFILE* sf_wchar_open (LPCWSTR wpath, int mode, SF_INFO *sfinfo) ;
|
||||
```
|
||||
|
||||
The SF_INFO structure is for passing data between the calling function and the library when opening a file for reading
|
||||
or writing. It is defined in sndfile.h as follows:
|
||||
|
||||
```c
|
||||
typedef struct
|
||||
{ sf_count_t frames ; /* Used to be called samples. */
|
||||
int samplerate ;
|
||||
int channels ;
|
||||
int format ;
|
||||
int sections ;
|
||||
int seekable ;
|
||||
} SF_INFO ;
|
||||
```
|
||||
|
||||
The mode parameter for this function can be any one of the following three values:
|
||||
|
||||
SFM_READ
|
||||
: read only mode
|
||||
|
||||
SFM_WRITE
|
||||
: write only mode
|
||||
|
||||
SFM_RDWR
|
||||
: read/write mode
|
||||
|
||||
When opening a file for read, the **format** field should be set to zero before
|
||||
calling **sf_open**(). The only exception to this is the case of RAW files where
|
||||
the caller has to set the **samplerate**, **channels** and **format** fields to
|
||||
valid values. All other fields of the structure are filled in by the library.
|
||||
|
||||
**Note:** The libsndfile library will reject values for field **channels** that
|
||||
are greater than `1024`. These value represent the maximum theoretical limit
|
||||
and may be less for specific formats.
|
||||
|
||||
When opening a file for write, the caller must fill in structure members
|
||||
**samplerate**, **channels**, and **format**.
|
||||
|
||||
The **format** field in the above **SF_INFO** structure is made up of the
|
||||
bit-wise OR of a major format type (values between 0x10000 and 0x08000000), a
|
||||
minor format type (with values less than 0x10000) and an optional endian-ness
|
||||
value. The currently understood formats are listed in *sndfile.h* as follows and
|
||||
also include bitmasks for separating major and minor file types. Not all
|
||||
combinations of endian-ness and major and minor file types are valid.
|
||||
|
||||
| Name | Value | Description |
|
||||
|:-------------------------|:-----------|:-------------------------------------------|
|
||||
| **Major formats.** |
|
||||
| SF_FORMAT_WAV | 0x010000 | Microsoft WAV format (little endian). |
|
||||
| SF_FORMAT_AIFF | 0x020000 | Apple/SGI AIFF format (big endian). |
|
||||
| SF_FORMAT_AU | 0x030000 | Sun/NeXT AU format (big endian). |
|
||||
| SF_FORMAT_RAW | 0x040000 | RAW PCM data. |
|
||||
| SF_FORMAT_PAF | 0x050000 | Ensoniq PARIS file format. |
|
||||
| SF_FORMAT_SVX | 0x060000 | Amiga IFF / SVX8 / SV16 format. |
|
||||
| SF_FORMAT_NIST | 0x070000 | Sphere NIST format. |
|
||||
| SF_FORMAT_VOC | 0x080000 | VOC files. |
|
||||
| SF_FORMAT_IRCAM | 0x0A0000 | Berkeley/IRCAM/CARL |
|
||||
| SF_FORMAT_W64 | 0x0B0000 | Sonic Foundry's 64 bit RIFF/WAV |
|
||||
| SF_FORMAT_MAT4 | 0x0C0000 | Matlab (tm) V4.2 / GNU Octave 2.0 |
|
||||
| SF_FORMAT_MAT5 | 0x0D0000 | Matlab (tm) V5.0 / GNU Octave 2.1 |
|
||||
| SF_FORMAT_PVF | 0x0E0000 | Portable Voice Format |
|
||||
| SF_FORMAT_XI | 0x0F0000 | Fasttracker 2 Extended Instrument |
|
||||
| SF_FORMAT_HTK | 0x100000 | HMM Tool Kit format |
|
||||
| SF_FORMAT_SDS | 0x110000 | Midi Sample Dump Standard |
|
||||
| SF_FORMAT_AVR | 0x120000 | Audio Visual Research |
|
||||
| SF_FORMAT_WAVEX | 0x130000 | MS WAVE with WAVEFORMATEX |
|
||||
| SF_FORMAT_SD2 | 0x160000 | Sound Designer 2 |
|
||||
| SF_FORMAT_FLAC | 0x170000 | FLAC lossless file format |
|
||||
| SF_FORMAT_CAF | 0x180000 | Core Audio File format |
|
||||
| SF_FORMAT_WVE | 0x190000 | Psion WVE format |
|
||||
| SF_FORMAT_OGG | 0x200000 | Xiph OGG container |
|
||||
| SF_FORMAT_MPC2K | 0x210000 | Akai MPC 2000 sampler |
|
||||
| SF_FORMAT_RF64 | 0x220000 | RF64 WAV file |
|
||||
| SF_FORMAT_MPEG | 0x230000 | MPEG-1/2 audio stream |
|
||||
| **Subtypes.** |
|
||||
| SF_FORMAT_PCM_S8 | 0x0001 | Signed 8 bit data |
|
||||
| SF_FORMAT_PCM_16 | 0x0002 | Signed 16 bit data |
|
||||
| SF_FORMAT_PCM_24 | 0x0003 | Signed 24 bit data |
|
||||
| SF_FORMAT_PCM_32 | 0x0004 | Signed 32 bit data |
|
||||
| SF_FORMAT_PCM_U8 | 0x0005 | Unsigned 8 bit data (WAV and RAW only) |
|
||||
| SF_FORMAT_FLOAT | 0x0006 | 32 bit float data |
|
||||
| SF_FORMAT_DOUBLE | 0x0007 | 64 bit float data |
|
||||
| SF_FORMAT_ULAW | 0x0010 | U-Law encoded. |
|
||||
| SF_FORMAT_ALAW | 0x0011 | A-Law encoded. |
|
||||
| SF_FORMAT_IMA_ADPCM | 0x0012 | IMA ADPCM. |
|
||||
| SF_FORMAT_MS_ADPCM | 0x0013 | Microsoft ADPCM. |
|
||||
| SF_FORMAT_GSM610 | 0x0020 | GSM 6.10 encoding. |
|
||||
| SF_FORMAT_VOX_ADPCM | 0x0021 | OKI / Dialogix ADPCM |
|
||||
| SF_FORMAT_NMS_ADPCM_16 | 0x0022 | 16kbs NMS G721-variant encoding. |
|
||||
| SF_FORMAT_NMS_ADPCM_24 | 0x0023 | 24kbs NMS G721-variant encoding. |
|
||||
| SF_FORMAT_NMS_ADPCM_32 | 0x0024 | 32kbs NMS G721-variant encoding. |
|
||||
| SF_FORMAT_G721_32 | 0x0030 | 32kbs G721 ADPCM encoding. |
|
||||
| SF_FORMAT_G723_24 | 0x0031 | 24kbs G723 ADPCM encoding. |
|
||||
| SF_FORMAT_G723_40 | 0x0032 | 40kbs G723 ADPCM encoding. |
|
||||
| SF_FORMAT_DWVW_12 | 0x0040 | 12 bit Delta Width Variable Word encoding. |
|
||||
| SF_FORMAT_DWVW_16 | 0x0041 | 16 bit Delta Width Variable Word encoding. |
|
||||
| SF_FORMAT_DWVW_24 | 0x0042 | 24 bit Delta Width Variable Word encoding. |
|
||||
| SF_FORMAT_DWVW_N | 0x0043 | N bit Delta Width Variable Word encoding. |
|
||||
| SF_FORMAT_DPCM_8 | 0x0050 | 8 bit differential PCM (XI only) |
|
||||
| SF_FORMAT_DPCM_16 | 0x0051 | 16 bit differential PCM (XI only) |
|
||||
| SF_FORMAT_VORBIS | 0x0060 | Xiph Vorbis encoding. |
|
||||
| SF_FORMAT_OPUS | 0x0064 | Xiph/Skype Opus encoding. |
|
||||
| SF_FORMAT_ALAC_16 | 0x0070 | Apple Lossless Audio Codec (16 bit). |
|
||||
| SF_FORMAT_ALAC_20 | 0x0071 | Apple Lossless Audio Codec (20 bit). |
|
||||
| SF_FORMAT_ALAC_24 | 0x0072 | Apple Lossless Audio Codec (24 bit). |
|
||||
| SF_FORMAT_ALAC_32 | 0x0073 | Apple Lossless Audio Codec (32 bit). |
|
||||
| SF_FORMAT_MPEG_LAYER_I | 0x0080 | MPEG-1 Audio Layer I. |
|
||||
| SF_FORMAT_MPEG_LAYER_II | 0x0081 | MPEG-1 Audio Layer II. |
|
||||
| SF_FORMAT_MPEG_LAYER_III | 0x0082 | MPEG-2 Audio Layer III. |
|
||||
| **Endian-ness options.** |
|
||||
| SF_ENDIAN_FILE | 0x00000000 | Default file endian-ness. |
|
||||
| SF_ENDIAN_LITTLE | 0x10000000 | Force little endian-ness. |
|
||||
| SF_ENDIAN_BIG | 0x20000000 | Force big endian-ness. |
|
||||
| SF_ENDIAN_CPU | 0x30000000 | Force CPU endian-ness. |
|
||||
| SF_FORMAT_SUBMASK | 0x0000FFFF | |
|
||||
| SF_FORMAT_TYPEMASK | 0x0FFF0000 | |
|
||||
| SF_FORMAT_ENDMASK | 0x30000000 | |
|
||||
|
||||
Every call to **sf_open**() should be matched with a call to
|
||||
[**sf_close**()](#close) to free up memory allocated during the call to **sf_open**().
|
||||
|
||||
On success, the sf_open function returns a non-NULL pointer which should be passed as the first parameter to all
|
||||
subsequent libsndfile calls dealing with that audio file. On fail, the sf_open function returns a NULL pointer. An
|
||||
explanation of the error can obtained by passing NULL to [**sf_strerror**()](#error).
|
||||
|
||||
### File Descriptor Open {#open_fd}
|
||||
|
||||
```c
|
||||
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
|
||||
```
|
||||
|
||||
**Note:** On Microsoft Windows, this function does not work if the application
|
||||
and the libsndfile DLL are linked to different versions of the Microsoft C
|
||||
runtime DLL.
|
||||
|
||||
The second open function takes a file descriptor of a file that has already been
|
||||
opened. Care should be taken to ensure that the mode of the file represented by
|
||||
the descriptor matches the mode argument. This function is useful in the
|
||||
following circumstances:
|
||||
|
||||
* Opening temporary files securely (ie use the **tmpfile**() to return a FILE*
|
||||
pointer and then using fileno() to retrieve the file descriptor which is then
|
||||
passed to libsndfile).
|
||||
* Opening files with file names using OS specific character encodings and then
|
||||
passing the file descriptor to **sf_open_fd**().
|
||||
* Opening sound files embedded within larger files. [More info](embedded_files.md).
|
||||
|
||||
Every call to `sf_open_fd`() should be matched with a call to sf_close() to free
|
||||
up memory allocated during the call to sf_open_fd().
|
||||
|
||||
When sf_close() is called, the file descriptor is only closed if the
|
||||
**close_desc** parameter was TRUE when the sf_open_fd() function was called.
|
||||
|
||||
On success, the sf_open_fd() function returns a non-NULL pointer which should be
|
||||
passed as the first parameter to all subsequent libsndfile calls dealing with
|
||||
that audio file. On fail, the sf_open_fd() function returns a NULL pointer.
|
||||
|
||||
### Virtual File Open Function {#open_virtual}
|
||||
|
||||
```c
|
||||
SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ;
|
||||
```
|
||||
|
||||
Opens a soundfile from a virtual file I/O context which is provided by the
|
||||
caller. This is usually used to interface libsndfile to write/read from memory
|
||||
with a stream or buffer based system. Apart from the sfvirtual and the user_data
|
||||
parameters this function behaves like [sf_open()](#open).
|
||||
|
||||
```c
|
||||
typedef struct
|
||||
{ sf_vio_get_filelen get_filelen ;
|
||||
sf_vio_seek seek ;
|
||||
sf_vio_read read ;
|
||||
sf_vio_write write ;
|
||||
sf_vio_tell tell ;
|
||||
} SF_VIRTUAL_IO ;
|
||||
```
|
||||
|
||||
Libsndfile calls the callbacks provided by the SF_VIRTUAL_IO structure when
|
||||
opening, reading and writing to the virtual file context. The user_data pointer
|
||||
is a user defined context which will be available in the callbacks.
|
||||
|
||||
```c
|
||||
typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
|
||||
```
|
||||
|
||||
#### sf_vio_get_filelen
|
||||
|
||||
```c
|
||||
typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
|
||||
```
|
||||
|
||||
The virtual file context must return the length of the virtual file in bytes.
|
||||
|
||||
#### sf_vio_seek
|
||||
|
||||
```c
|
||||
typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
|
||||
```
|
||||
|
||||
The virtual file context must seek to offset using the seek mode provided by
|
||||
whence which is one of SEEK_CUR, SEEK_SET, SEEK_END.
|
||||
|
||||
The return value must contain the new offset in the file.
|
||||
|
||||
#### sf_vio_read
|
||||
|
||||
```c
|
||||
typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
|
||||
```
|
||||
|
||||
The virtual file context must copy ("read") "count" bytes into the buffer
|
||||
provided by ptr and return the count of actually copied bytes.
|
||||
|
||||
#### sf_vio_write
|
||||
|
||||
```c
|
||||
typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
|
||||
```
|
||||
|
||||
The virtual file context must process "count" bytes stored in the buffer passed
|
||||
with ptr and return the count of actually processed bytes.
|
||||
|
||||
#### sf_vio_tell
|
||||
|
||||
```c
|
||||
typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
|
||||
```
|
||||
|
||||
Return the current position of the virtual file context.
|
||||
|
||||
## Format Check Function {#chek}
|
||||
|
||||
```c
|
||||
int sf_format_check (const SF_INFO *info) ;
|
||||
```
|
||||
|
||||
This function allows the caller to check if a set of parameters in the SF_INFO
|
||||
struct is valid before calling [sf_open](#open) (SFM_WRITE).
|
||||
|
||||
sf_format_check() returns TRUE if the parameters are valid and FALSE otherwise.
|
||||
|
||||
## File Seek Functions
|
||||
|
||||
```c
|
||||
sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ;
|
||||
```
|
||||
|
||||
The file seek functions work much like lseek in unistd.h with the exception that
|
||||
the non-audio data is ignored and the seek only moves within the audio data
|
||||
section of the file. In addition, seeks are defined in number of (multichannel)
|
||||
frames. Therefore, a seek in a stereo file from the current position forward
|
||||
with an offset of 1 would skip forward by one sample of both channels.
|
||||
|
||||
like lseek(), the whence parameter can be any one of the following three values:
|
||||
|
||||
SEEK_SET
|
||||
: The offset is set to the start of the audio data plus offset (multichannel)
|
||||
frames.
|
||||
|
||||
SEEK_CUR
|
||||
: The offset is set to its current location plus offset (multichannel) frames.
|
||||
|
||||
SEEK_END
|
||||
: The offset is set to the end of the data plus offset (multichannel) frames.
|
||||
|
||||
Internally, libsndfile keeps track of the read and write locations using
|
||||
separate read and write pointers. If a file has been opened with a mode of
|
||||
SFM_RDWR, bitwise OR-ing the standard whence values above with either SFM_READ
|
||||
or SFM_WRITE allows the read and write pointers to be modified separately.
|
||||
If the SEEK_* values are used on their own, the read and write pointers are
|
||||
both modified.
|
||||
|
||||
Note that the frames offset can be negative and in fact should be when SEEK_END
|
||||
is used for the whence parameter.
|
||||
|
||||
sf_seek will return the offset in (multichannel) frames from the start of the
|
||||
audio data or -1 if an error occurred (ie an attempt is made to seek beyond the
|
||||
start or end of the file).
|
||||
|
||||
## Error Reporting Functions {#error}
|
||||
|
||||
```c
|
||||
int sf_error (SNDFILE *sndfile) ;
|
||||
```
|
||||
|
||||
This function returns the current error number for the given SNDFILE.
|
||||
|
||||
The error number may be one of the following:
|
||||
|
||||
| Name | Value |
|
||||
|:----------------------------|:------|
|
||||
| SF_ERR_NO_ERROR | 0 |
|
||||
| SF_ERR_UNRECOGNISED_FORMAT | 1 |
|
||||
| SF_ERR_SYSTEM | 2 |
|
||||
| SF_ERR_MALFORMED_FILE | 3 |
|
||||
| SF_ERR_UNSUPPORTED_ENCODING | 4 |
|
||||
|
||||
or any one of many other internal error values.
|
||||
Applications should only test the return value against error values defined in
|
||||
\<sndfile.h\>; as the internal error values are subject to change at any time.
|
||||
For errors not in the above list, the function sf_error_number() can be used to
|
||||
convert it to an error string.
|
||||
|
||||
```c
|
||||
const char* sf_strerror (SNDFILE *sndfile) ;
|
||||
const char* sf_error_number (int errnum) ;
|
||||
```
|
||||
|
||||
The error functions sf_strerror () and sf_error_number () convert the library's
|
||||
internal error enumerations into text strings.
|
||||
|
||||
```c
|
||||
int sf_perror (SNDFILE *sndfile) ;
|
||||
int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ;
|
||||
```
|
||||
|
||||
The functions sf_perror() and sf_error_str() are deprecated and will be dropped
|
||||
from the library at some later date.
|
||||
|
||||
## File Close Function {#close}
|
||||
|
||||
```c
|
||||
int sf_close (SNDFILE *sndfile) ;
|
||||
```
|
||||
|
||||
The close function closes the file, deallocates its internal buffers and returns
|
||||
0 on success or an error value otherwise.
|
||||
|
||||
## Write Sync Function {#write_sync}
|
||||
|
||||
```c
|
||||
void sf_write_sync (SNDFILE *sndfile) ;
|
||||
```
|
||||
|
||||
If the file is opened SFM_WRITE or SFM_RDWR, call the operating system's
|
||||
function to force the writing of all file cache buffers to disk. If the file is
|
||||
opened SFM_READ no action is taken.
|
||||
|
||||
## File Read Functions {#read}
|
||||
|
||||
```c
|
||||
sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
||||
```
|
||||
|
||||
{: #readf}
|
||||
```c
|
||||
sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
||||
```
|
||||
|
||||
The file read functions fill the array pointed to by ptr with the requested
|
||||
number of items or frames.
|
||||
|
||||
For the frames-count functions, the frames parameter specifies the number of
|
||||
frames. A frame is just a block of samples, one for each channel.
|
||||
|
||||
**Care must be taken to ensure that there is enough space in the array pointed
|
||||
to by ptr, to take (frames \* channels) number of items (shorts, ints, floats or
|
||||
doubles).**
|
||||
|
||||
For the items-count functions, the items parameter must be an integer product
|
||||
of the number of channels or an error will occur. Here, an item is just a
|
||||
sample.
|
||||
|
||||
Note: The only difference between the "items" and "frames" versions of each read
|
||||
function is the units in which the object count is specified - calling
|
||||
sf_readf_short() with a count argument of N, on a SNDFILE with C channels, is
|
||||
the same as calling sf_read_short with a count argument of N\*C. The buffer
|
||||
pointed to by "ptr" should be the same number of bytes in each case.
|
||||
|
||||
Note: The data type used by the calling program and the data format of the file
|
||||
do not need to be the same. For instance, it is possible to open a 16 bit PCM
|
||||
encoded WAV file and read the data using sf_read_float(). The library seamlessly
|
||||
converts between the two formats on-the-fly. See [Note 1](#note-1).
|
||||
|
||||
The sf_read_XXXX and sf_readf_XXXX functions return the number of items or
|
||||
frames read, respectively. Unless the end of the file was reached during the
|
||||
read, the return value should equal the number of objects requested. Attempts to
|
||||
read beyond the end of the file will not result in an error but will cause the
|
||||
read functions to return less than the number of objects requested or 0 if
|
||||
already at the end of the file. When the buffer is not is not completely filled,
|
||||
unused buffer space is filled by zeroes.
|
||||
|
||||
## File Write Functions {#write}
|
||||
|
||||
```c
|
||||
sf_count_t sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
||||
```
|
||||
|
||||
{: #writef}
|
||||
```c
|
||||
sf_count_t sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
||||
```
|
||||
|
||||
The file write functions write the data in the array pointed to by ptr to the
|
||||
file.
|
||||
|
||||
For items-count functions, the items parameter specifies the size of the array
|
||||
and must be an integer product of the number of channels or an error will occur.
|
||||
|
||||
For the frames-count functions, the array is expected to be large enough to hold
|
||||
a number of items equal to the product of frames and the number of channels.
|
||||
|
||||
As with the read functions [above](#read), the only difference in the items and
|
||||
frames version of each write function is the units in which the buffer size is
|
||||
specified. Again, the data type used by the calling program and the data format
|
||||
of the file do not need to be the same ([Note 1](#note-1)).
|
||||
|
||||
The sf_write_XXXX and sf_writef_XXXX functions respectively return the number of
|
||||
items or frames written (which should be the same as the items or frames
|
||||
parameter).
|
||||
|
||||
## Raw File Read and Write Functions {#raw}
|
||||
|
||||
```c
|
||||
sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
||||
sf_count_t sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
||||
```
|
||||
|
||||
**Note:** Unless you are writing an external decoder/encode that uses libsndfile
|
||||
to handle the file headers, you should not be using these functions.
|
||||
|
||||
The raw read and write functions read raw audio data from the audio file (not to
|
||||
be confused with reading RAW header-less PCM files). The number of bytes read or
|
||||
written must always be an integer multiple of the number of channels multiplied
|
||||
by the number of bytes required to represent one sample from one channel.
|
||||
|
||||
The raw read and write functions return the number of bytes read or written
|
||||
(which should be the same as the bytes parameter).
|
||||
|
||||
**Note : The result of using of both regular reads/writes and raw reads/writes
|
||||
on compressed file formats other than SF_FORMAT_ALAW and SF_FORMAT_ULAW is
|
||||
undefined.**
|
||||
|
||||
See also : [SFC_RAW_NEEDS_ENDSWAP](command.md#sfc_raw_needs_endswap).
|
||||
|
||||
## Functions for Reading and Writing String Data {#string}
|
||||
|
||||
```c
|
||||
const char* sf_get_string (SNDFILE *sndfile, int str_type) ;
|
||||
int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ;
|
||||
```
|
||||
|
||||
These functions allow strings to be set on files opened for write and to be
|
||||
retrieved from files opened for read where supported by the given file type. The
|
||||
**str_type** parameter can be any one of the following string types:
|
||||
|
||||
| Name | Value | Description |
|
||||
|:-------------------|:------|:--------------|
|
||||
| SF_STR_TITLE | 0x01 | Title. |
|
||||
| SF_STR_COPYRIGHT | 0x02 | Copyright. |
|
||||
| SF_STR_SOFTWARE | 0x03 | Software. |
|
||||
| SF_STR_ARTIST | 0x04 | Artist. |
|
||||
| SF_STR_COMMENT | 0x05 | Comment. |
|
||||
| SF_STR_DATE | 0x06 | Date. |
|
||||
| SF_STR_ALBUM | 0x07 | Album. |
|
||||
| SF_STR_LICENSE | 0x08 | License. |
|
||||
| SF_STR_TRACKNUMBER | 0x09 | Track number. |
|
||||
| SF_STR_GENRE | 0x10 | Genre. |
|
||||
|
||||
The sf_get_string() function returns the specified string if it exists and a
|
||||
NULL pointer otherwise. In addition to the string ids above, SF_STR_FIRST (==
|
||||
SF_STR_TITLE) and SF_STR_LAST (always the same as the highest numbers string id)
|
||||
are also available to allow iteration over all the available string ids.
|
||||
|
||||
The sf_set_string() function sets the string data. It returns zero on success
|
||||
and non-zero on error.The error code can be converted to a string using
|
||||
sf_error_number().
|
||||
|
||||
Strings passed to and retrieved from these two functions are assumed to be
|
||||
utf-8. However, while formats like Ogg/Vorbis and FLAC fully support utf-8,
|
||||
others like WAV and AIFF officially only support ASCII. Writing utf-8 strings to
|
||||
WAV and AIF files with libsndfile will work when read back with libsndfile, but
|
||||
may not work with other programs.
|
||||
|
||||
The suggested method of dealing with tags retrieved using sf_get_string() is to
|
||||
assume they are utf-8. Similarly if you have a string in some exotic format like
|
||||
utf-16, it should be encoded to utf-8 before being written using libsndfile.
|
||||
|
||||
## Function for retrieving library version {#version_string}
|
||||
|
||||
```c
|
||||
const char *sf_version_string (void) ;
|
||||
```
|
||||
|
||||
Return the library version string.
|
||||
|
||||
## Function for retrieving current byterate {#current_byterate}
|
||||
|
||||
```c
|
||||
int sf_current_byterate (SNDFILE *sndfile) ;
|
||||
```
|
||||
|
||||
Return the current byterate at this point in the file. The byte rate in this
|
||||
case is the number of bytes per second of audio data. For instance, for a
|
||||
stereo, 18 bit PCM encoded file with an 16kHz sample rate, the byte rate
|
||||
would be 2 (stereo) \* 2 (two bytes per sample) * 16000 => 64000 bytes/sec.
|
||||
|
||||
For some file formats the returned value will be accurate and exact, for some
|
||||
it will be a close approximation, for some it will be the average bitrate for
|
||||
the whole file and for some it will be a time varying value that was accurate
|
||||
when the file was most recently read or written.
|
||||
|
||||
To get the bitrate, multiple this value by 8.
|
||||
|
||||
`sf_current_byterate` returns byte per second or -1 if byterate is
|
||||
unknown.
|
||||
|
||||
## Functions to get and set chunks from within a sound file
|
||||
|
||||
These functions allow the getting and setting of chunks within a sound file (for
|
||||
those formats which allow it).
|
||||
|
||||
These functions fail safely. Specifically, they will not allow you to overwrite
|
||||
existing chunks or add extra versions of format specific reserved chunks but
|
||||
should allow you to retrieve any and all chunks (may not be implemented for all
|
||||
chunks or all file formats).
|
||||
|
||||
### sf_set_chunk
|
||||
|
||||
```c
|
||||
int sf_set_chunk (SNDFILE *sndfile, const SF_CHUNK_INFO *chunk_info) ;
|
||||
```
|
||||
|
||||
Set the specified chunk info (must be done before any audio data is written to
|
||||
the file). This will fail for format specific reserved chunks. The
|
||||
`chunk_info->data` pointer must be valid until the file is closed.
|
||||
|
||||
The `SF_CHUNK_INFO` struct is documented as follows:
|
||||
|
||||
```c
|
||||
struct SF_CHUNK_INFO
|
||||
{ char id [64] ; /* The chunk identifier. */
|
||||
unsigned id_size ; /* The size of the chunk identifier. */
|
||||
unsigned datalen ; /* The size of that data. */
|
||||
void *data ; /* Pointer to the data. */
|
||||
} ;
|
||||
typedef struct SF_CHUNK_INFO SF_CHUNK_INFO ;
|
||||
```
|
||||
|
||||
`sf_set_chunk` returns `SF_ERR_NO_ERROR` on success or non-zero on failure.
|
||||
|
||||
### sf_get_chunk_iterator
|
||||
|
||||
```c
|
||||
SF_CHUNK_ITERATOR *
|
||||
sf_get_chunk_iterator (SNDFILE *sndfile, const SF_CHUNK_INFO *chunk_info) ;
|
||||
```
|
||||
|
||||
Get an iterator for all chunks matching `chunk_info`.
|
||||
|
||||
`SF_CHUNK_ITERATOR` is an opaque structure to an iterator over the all chunks of
|
||||
a given id and defined as follows:
|
||||
|
||||
```c
|
||||
typedef struct SF_CHUNK_ITERATOR SF_CHUNK_ITERATOR ;
|
||||
```
|
||||
|
||||
The iterator will point to the first chunk matching `chunk_info`. Chunks are
|
||||
matching, if (`chunk_info->id`) matches the first (`chunk_info->id_size`) bytes
|
||||
of a chunk found in the `SNDFILE*` handle. If `chunk_info` is `NULL`, an
|
||||
iterator to all chunks in the `SNDFILE*` handle is returned. The values of
|
||||
`chunk_info->datalen` and `chunk_info->data` are ignored. If no matching chunks
|
||||
are found in the sndfile, `NULL` is returned.
|
||||
|
||||
The returned iterator will stay valid until one of the following occurs:
|
||||
|
||||
* The sndfile is closed.
|
||||
* A new chunk is added using [`sf_set_chunk()`](#sf_set_chunk).
|
||||
* Another chunk iterator function is called on the same `SNDFILE*`
|
||||
handle that causes the iterator to be modified.
|
||||
|
||||
The memory for the iterator belongs to the SNDFILE* handle and is freed when
|
||||
[sf_close](#close) is called.
|
||||
|
||||
### sf_next_chunk_iterator
|
||||
|
||||
```c
|
||||
sf_next_chunk_iterator (SF_CHUNK_ITERATOR * iterator) ;
|
||||
```
|
||||
|
||||
Iterate through chunks by incrementing the iterator.
|
||||
|
||||
Increments the iterator and returns a handle to the new one. After this call,
|
||||
iterator will no longer be valid, and you must use the newly returned handle
|
||||
from now on. The returned handle can be used to access the next chunk matching
|
||||
the criteria as defined in [sf_get_chunk_iterator](#sf_get_chunk_iterator).
|
||||
If iterator points to the last chunk, this will free all resources associated
|
||||
with iterator and return `NULL`. The returned iterator will stay valid until
|
||||
`sf_get_next_chunk_iterator` is called again, the sndfile is closed or a new
|
||||
chunk us added.
|
||||
|
||||
### sf_get_chunk_size
|
||||
|
||||
```c
|
||||
int
|
||||
sf_get_chunk_size (const SF_CHUNK_ITERATOR * it, SF_CHUNK_INFO * chunk_info) ;
|
||||
```
|
||||
|
||||
Get the size of the specified chunk.
|
||||
|
||||
If the specified chunk exists, the size will be returned in the `datalen` field
|
||||
of the `SF_CHUNK_INFO` struct. Additionally, the id of the chunk will be copied
|
||||
to the `id` field of the `SF_CHUNK_INFO` struct and it's `id_size` field will be
|
||||
updated accordingly.
|
||||
|
||||
If the chunk doesn't exist `chunk_info->datalen` will be zero, and the `id` and
|
||||
`id_size` fields will be undefined.
|
||||
|
||||
The function will return `SF_ERR_NO_ERROR` on success or non-zero on failure.
|
||||
|
||||
### sf_get_chunk_data
|
||||
|
||||
```c
|
||||
int
|
||||
sf_get_chunk_data (const SF_CHUNK_ITERATOR *it, SF_CHUNK_INFO *chunk_info) ;
|
||||
```
|
||||
|
||||
Get the specified chunk data.
|
||||
|
||||
If the specified chunk exists, up to `chunk_info->datalen` bytes of the chunk
|
||||
data will be copied into the `chunk_info->data` buffer (allocated by the caller)
|
||||
and the `chunk_info->datalen` field updated to reflect the size of the data. The
|
||||
`id` and `id_size` field will be updated according to the retrieved chunk. If
|
||||
the chunk doesn't exist `chunk_info->datalen` will be zero, and the `id` and
|
||||
`id_size` fields will be undefined.
|
||||
|
||||
The function will return `SF_ERR_NO_ERROR` on success or non-zero on failure.
|
||||
|
||||
## Note 1
|
||||
|
||||
When converting between integer PCM formats of differing size (e.g. using
|
||||
sf_read_int() to read a 16 bit PCM encoded WAV file) libsndfile obeys one simple
|
||||
rule:
|
||||
|
||||
Whenever integer data is moved from one sized container to another sized
|
||||
container, the most significant bit in the source container will become the most
|
||||
significant bit in the destination container.
|
||||
|
||||
When converting between integer data and floating point data, different rules
|
||||
apply. The default behaviour when reading floating point data (sf_read_float()
|
||||
or sf_read_double ()) from a file with integer data is normalisation. Regardless
|
||||
of whether data in the file is 8, 16, 24 or 32 bit wide, the data will be read
|
||||
as floating point data in the range [-1.0, 1.0]. Similarly, data in the range
|
||||
[-1.0, 1.0] will be written to an integer PCM file so that a data value of 1.0
|
||||
will be the largest allowable integer for the given bit width. This
|
||||
normalisation can be turned on or off using the [sf_command](command.md)
|
||||
interface.
|
||||
|
||||
## Note 2
|
||||
|
||||
Reading a file containing floating point data (allowable with WAV, AIFF, AU and
|
||||
other file formats) using integer read methods (sf_read_short() or
|
||||
sf_read_int()) can produce unexpected results. For instance the data in the file
|
||||
may have a maximum absolute value < 1.0 which would mean that all sample
|
||||
values read from the file will be zero. In order to read these files correctly
|
||||
using integer read methods, it is recommended that you use the
|
||||
[sf_command](command.md) interface, a command of
|
||||
[SFC_SET_SCALE_FLOAT_INT_READ](command.md#sfc_set_scale_float_int_read) and a
|
||||
parameter of SF_TRUE to force correct scaling.
|
||||
47
Engine/lib/libsndfile/docs/bugs.md
Normal file
47
Engine/lib/libsndfile/docs/bugs.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
layout: page
|
||||
---
|
||||
|
||||
# Reporting Bugs in libsndfile
|
||||
|
||||
Before even attempting to report a bug in libsndfile please make sure you have
|
||||
read the [Frequently Asked Questions](FAQ.md). If you are having a problem
|
||||
writing code using libsndfile make sure you read the
|
||||
[Application Programming Interface](api.md) documentation.
|
||||
|
||||
That said, I am interested in finding and fixing all genuine bugs in libsndfile.
|
||||
Bugs I want to fix include any of the following problems (and probably others):
|
||||
|
||||
- Compilation problems on new platforms.
|
||||
- Errors being detected during the `make check` process.
|
||||
- Segmentation faults occurring inside libsndfile.
|
||||
- libsndfile hanging when opening a file.
|
||||
- Supported sound file types being incorrectly read or written.
|
||||
- Omissions, errors or spelling mistakes in the documentation.
|
||||
|
||||
When submitting a bug report you must include:
|
||||
|
||||
- Your system (CPU and memory size should be enough).
|
||||
- The operating system you are using.
|
||||
- Whether you are using a package provided by your distribution or you compiled
|
||||
it yourself.
|
||||
- If you compiled it yourself, the compiler you are using. (Also make sure to
|
||||
run `make check`.)
|
||||
- A description of the problem.
|
||||
- Information generated by the sndfile-info program (see next paragraph).
|
||||
- If you are having problems with sndfile-play and ALSA on Linux, I will need
|
||||
information about your kernel, ALSA version, compiler version, whether you
|
||||
compiled the kernel/ALSA your self or installed from a package etc.
|
||||
|
||||
If libsndfile compiles and installs correctly but has difficulty reading a
|
||||
particular file or type of file you should run the **sndfile-info** program
|
||||
(from the examples directory of the libsndfile distribution) on the file. See
|
||||
[here](sndfile_info.md) for an example of the use of the **sndfile-info**
|
||||
program.
|
||||
|
||||
Please do not send me a sound file which fails to open under libsndfile unless
|
||||
I specifically ask you to. The above information should usually suffice for most
|
||||
problems.
|
||||
|
||||
Once you have the above information you should submit a ticket on the libsndfile
|
||||
[GitHub issue tracker](https://github.com/libsndfile/libsndfile/issues).
|
||||
2016
Engine/lib/libsndfile/docs/command.md
Normal file
2016
Engine/lib/libsndfile/docs/command.md
Normal file
File diff suppressed because it is too large
Load diff
18
Engine/lib/libsndfile/docs/development.md
Normal file
18
Engine/lib/libsndfile/docs/development.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
layout: page
|
||||
---
|
||||
|
||||
# libsndfile Development
|
||||
|
||||
libsndfile is being developed by a small community of users and hackers. People
|
||||
interested in helping can raise an issue on Github.
|
||||
|
||||
The main repository can be found on Github:
|
||||
|
||||
<https://github.com/libsndfile/libsndfile/>
|
||||
|
||||
and includes [instructions](https://github.com/libsndfile/libsndfile/blob/master/README.md)
|
||||
on how to build libsndfile from the Git repo.
|
||||
|
||||
If you are interested in how to add a new format to a libsndfile, you may find
|
||||
this [FAQ](new_file_type_howto.md) helpful.
|
||||
60
Engine/lib/libsndfile/docs/donate.md
Normal file
60
Engine/lib/libsndfile/docs/donate.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
layout: page
|
||||
title: libsndfile : donate.
|
||||
---
|
||||
|
||||
{% include logo.html %}
|
||||
|
||||
Dear libsndfile user,
|
||||
|
||||
This library was developed on Linux for Linux. I am not a Windows user and
|
||||
maintaining this library for Windows costs me significant amounts of time above
|
||||
and beyond the time taken to make it work on Linux and Unix-like systems.
|
||||
|
||||
I therefore ask Windows users of libsndfile to donate to ensure that
|
||||
libsndfile's support for Windows continues. As long as donations continue to
|
||||
flow in at a decentrate, I will continue to release precompiled Windows binaries
|
||||
in sync with the Linux/Unix version. If donations are poor, support for windows
|
||||
will fall behind.
|
||||
|
||||
You are free to donate any amount you chose. As a guideline:
|
||||
|
||||
* If you are simply a user of libsndfile that would like to ensure that the
|
||||
development of libsndfile continues, a donation of $10US would be more than
|
||||
adequate.
|
||||
* If you are shareware author that distributes libsndfile with your app and
|
||||
makes more than $1000 a year from your shareware, a one off donation of $50
|
||||
would be appropriate.
|
||||
* If your company is a commercial software house that distributes one or more
|
||||
products that ship with libsndfile, a donation of $100 every second or third
|
||||
year would be appropriate.
|
||||
|
||||
Donations can be made in Bitcoin to the Bitcoin address
|
||||
**15hVWemFiH6DLJ22SBYPk9b4fgWtxBEvfQ** which can be verified by checking the
|
||||
following GPG signature.
|
||||
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA256
|
||||
|
||||
libsndfile Bitcoin address : 15hVWemFiH6DLJ22SBYPk9b4fgWtxBEvfQ
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.12 (GNU/Linux)
|
||||
|
||||
iQIcBAEBCAAGBQJSK7MUAAoJEEXYQ7zIiotIgXEP/R8hy65tlV7TiPw9bY9BklXS
|
||||
/Vl8FU2RhDkBt61ZmxbfDTybyQ5Vce/3wWph15L4RvpoX1OyeintQFmwwuPjOGiq
|
||||
eIz0nT9vDorG37Xdo5NZNBu9Tp1Od9MNtxFaAsRWFrDfvKEKljBHrcfM972cYrAp
|
||||
DaFd0Ik+bHKom9iQXFB7TFd0w2V4uszVMQDUGqb/vRNeRURZS7ypeMNwc8tZyTKR
|
||||
waEGMTa5sxxRjs7MqGRxSovnFT7JV3TNfdkBInUliIR/XvrudFR9J4Fiv+8Dk9P8
|
||||
WNjm6uFxvgIqiu1G9bjrwwr+DsBju93ljGNcZoayAKw5vwbX6KTcCbc31k9dP8Hf
|
||||
p6YdmPlZVKZmva+P3nLSJBTlxNu24Jm+ha+ZM/svDXTaPFWC8l5FP17kK0Bj8wCq
|
||||
N7pDz6RchEn10u+HdhfT1XiUjxj0zNXrr0GGj9apjl0RlT0O49eBttV0oXIdBRLi
|
||||
nTEaOWITpCgu7ggw1kWXHIWEncuiaSuJy/iH8PgNepWVj/6PxQRMrTqG4ux2Snk8
|
||||
Ua4vO8YHLMZX/XvSUS7eMtgfM7AO6YjJ/ac9bQif9bh6LsYEVVklysMUin6ZRS7Z
|
||||
Cms23FnqeQKtJOzdvqSJiV06lK6fP+tYdM4WSYn+AfL4IfYl2v48xXVU8XOOK9BH
|
||||
bJPKMDcz1ZvfYtX5mSW1
|
||||
=WXGB
|
||||
-----END PGP SIGNATURE-----
|
||||
|
||||
Thanks and regards,
|
||||
Erik de Castro Lopo
|
||||
Main libsndfile author and maintainer
|
||||
21
Engine/lib/libsndfile/docs/embedded_files.md
Normal file
21
Engine/lib/libsndfile/docs/embedded_files.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
layout: page
|
||||
---
|
||||
|
||||
# Embedded Sound Files
|
||||
|
||||
By using the open SNDFILE with a file descriptor function:
|
||||
|
||||
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
|
||||
|
||||
it is possible to open sound files embedded within larger files. There are
|
||||
however a couple of caveats:
|
||||
|
||||
* Read/Write mode (SFM_RDWR) is not supported.
|
||||
* Writing of embedded files is only supported at the end of the file.
|
||||
* Reading of embedded files is only supported at file offsets greater than zero.
|
||||
* Not all file formats are supported (currently only WAV, AIFF and AU).
|
||||
|
||||
The test program **multi_file_test.c** in the **tests/** directory of the source
|
||||
code tarball shows how this functionality is used to read and write embedded
|
||||
files.
|
||||
53
Engine/lib/libsndfile/docs/formats.md
Normal file
53
Engine/lib/libsndfile/docs/formats.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
layout: page
|
||||
title: libsndfile: Supported formats
|
||||
---
|
||||
|
||||
# libsndfile : Supported formats
|
||||
|
||||
The following table lists the file formats and encodings that libsndfile can
|
||||
read and write. The file formats are arranged across the top and encodings along
|
||||
the left edge.
|
||||
|
||||
{:.formats-table}
|
||||
| | Microsoft WAV | SGI / Apple AIFF / AIFC |Sun / DEC / NeXT AU / SND | Headerless RAW | Paris Audio File PAF | Commodore Amiga IFF / SVX | Sphere Nist WAV | IRCAM SF | Creative VOC | Soundforge W64 | GNU Octave 2.0 MAT4 | GNU Octave 2.1 MAT5 | Portable Voice Format PVF | Fasttracker 2 XI | HMM Tool Kit HTK | Apple CAF | Sound Designer II SD2 | Free Lossless Audio Codec FLAC |
|
||||
|:-------------------|:-------------:|:-----------------------:|:------------------------:|:--------------:|:--------------------:|:-------------------------:|:---------------:|:--------:|:------------:|:--------------:|:-------------------:|:-------------------:|:-------------------------:|:----------------:|:----------------:|:---------:|:---------------------:|:------------------------------:|
|
||||
| Unsigned 8 bit PCM | R/W | R/W | | R/W | | | | | R/W | R/W | | R/W | | | | | | |
|
||||
| Signed 8 bit PCM | | R/W | R/W | R/W | R/W | R/W | R/W | | | | | | R/W | | | R/W | R/W | R/W |
|
||||
| Signed 16 bit PCM | R/W | R/W | R/W | R/W | R/W | R/W | R/W | R/W | R/W | R/W | R/W | R/W | R/W | | R/W | R/W | R/W | R/W |
|
||||
| Signed 24 bit PCM | R/W | R/W | R/W | R/W | R/W | | R/W | | | R/W | | | | | | R/W | R/W | R/W |
|
||||
| Signed 32 bit PCM | R/W | R/W | R/W | R/W | | | R/W | R/W | | R/W | R/W | R/W | R/W | | | R/W | | |
|
||||
| 32 bit float | R/W | R/W | R/W | R/W | | | | R/W | | R/W | R/W | R/W | | | | R/W | | |
|
||||
| 64 bit double | R/W | R/W | R/W | R/W | | | | | | R/W | R/W | R/W | | | | R/W | | |
|
||||
| u-law encoding | R/W | R/W | R/W | R/W | | | R/W | R/W | R/W | R/W | | | | | | R/W | | |
|
||||
| A-law encoding | R/W | R/W | R/W | R/W | | | R/W | R/W | R/W | R/W | | | | | | R/W | | |
|
||||
| IMA ADPCM | R/W | | | | | | | | | R/W | | | | | | | | |
|
||||
| MS ADPCM | R/W | | | | | | | | | R/W | | | | | | | | |
|
||||
| GSM 6.10 | R/W | R/W | | R/W | | | | | | R/W | | | | | | | | |
|
||||
| G721 ADPCM 32kbps | R/W | | R/W | | | | | | | | | | | | | | | |
|
||||
| G723 ADPCM 24kbps | | | R/W | | | | | | | | | | | | | | | |
|
||||
| G723 ADPCM 40kbps | | | R/W | | | | | | | | | | | | | | | |
|
||||
| 12 bit DWVW | | R/W | | R/W | | | | | | | | | | | | | | |
|
||||
| 16 bit DWVW | | R/W | | R/W | | | | | | | | | | | | | | |
|
||||
| 24 bit DWVW | | R/W | | R/W | | | | | | | | | | | | | | |
|
||||
| Ok Dialogic ADPCM | | | | R/W | | | | | | | | | | | | | | |
|
||||
| 8 bit DPCM | | | | | | | | | | | | | | R/W | | | | |
|
||||
| 16 bit DPCM | | | | | | | | | | | | | | R/W | | | | |
|
||||
|
||||
From version 1.0.18, libsndfile also reads and writes
|
||||
[FLAC](https://xiph.org/flac/) and [Ogg/Vorbis](https://xiph.org/vorbis/).
|
||||
|
||||
From version 1.0.29, libsndfile can read and write
|
||||
[Ogg/Opus](https://opus-codec.org/).
|
||||
|
||||
From version 1.1.0, libsndfile can read and write MP3.
|
||||
|
||||
Some of the file formats I am also interested in adding are:
|
||||
|
||||
- Kurzweil K2000 sampler files.
|
||||
- Ogg Speex.
|
||||
|
||||
Other file formats may also be added on request.
|
||||
|
||||
If you are interested in how to add a new format to a libsndfile, you may find
|
||||
this [FAQ](new_file_type_howto.md) helpful.
|
||||
322
Engine/lib/libsndfile/docs/index.md
Normal file
322
Engine/lib/libsndfile/docs/index.md
Normal file
|
|
@ -0,0 +1,322 @@
|
|||
---
|
||||
layout: home
|
||||
title: The libsndfile Home Page
|
||||
---
|
||||
|
||||
Libsndfile is a C library for reading and writing files containing sampled sound
|
||||
(such as MS Windows WAV and the Apple/SGI AIFF format) through one standard
|
||||
library interface. It is released in source code format under the
|
||||
[Gnu Lesser General Public License](http://www.gnu.org/copyleft/lesser.html).
|
||||
|
||||
The library was written to compile and run on a Linux system but should compile
|
||||
and run on just about any Unix (including MacOS X).
|
||||
There are also pre-compiled binaries available for 32 and 64 bit windows.
|
||||
|
||||
It was designed to handle both little-endian (such as WAV) and big-endian (such
|
||||
as AIFF) data, and to compile and run correctly on little-endian (such as Intel
|
||||
and DEC/Compaq Alpha) processor systems as well as big-endian processor systems
|
||||
such as Motorola 68k, Power PC, MIPS and Sparc. Hopefully the design of the
|
||||
library will also make it easy to extend for reading and writing new sound file
|
||||
formats.
|
||||
|
||||
It has been compiled and tested (at one time or another) on the following
|
||||
systems:
|
||||
|
||||
* Every platform supported by Debian GNU/Linux including x86_64-linux-gnu,
|
||||
i486-linux-gnu, powerpc-linux-gnu, sparc-linux-gnu, alpha-linux-gnu,
|
||||
mips-linux-gnu and armel-linux-gnu.
|
||||
* powerpc-apple-darwin7.0 (Mac OS X 10.3)
|
||||
* sparc-sun-solaris2.8 (using gcc)
|
||||
* mips-sgi-irix5.3 (using gcc)
|
||||
* QNX 6.0
|
||||
* i386-unknown-openbsd2.9
|
||||
* Microsoft Windows
|
||||
|
||||
At the moment, each new release is being tested on i386 Linux, x86_64 Linux,
|
||||
PowerPC Linux, Win32 and Win64.
|
||||
|
||||
## Features
|
||||
|
||||
libsndfile has the following main features :
|
||||
|
||||
* Ability to read and write a large number of [file formats](formats.html).
|
||||
* A simple, elegant and easy to use Applications Programming Interface.
|
||||
* Usable on Unix, Win32, MacOS and others.
|
||||
* On the fly format conversion, including endian-ness swapping, type conversion
|
||||
and bitwidth scaling.
|
||||
* Optional normalisation when reading floating point data from files containing
|
||||
integer data.
|
||||
* Ability to open files in read/write mode.
|
||||
* The ability to write the file header without closing the file (only on files
|
||||
open for write or read/write).
|
||||
* Ability to query the library about all supported formats and retrieve text
|
||||
strings describing each format.
|
||||
|
||||
libsndfile has a comprehensive test suite so that each release is as bug free
|
||||
as possible.
|
||||
When new bugs are found, new tests are added to the test suite to ensure that
|
||||
these bugs don't creep back into the code.
|
||||
When new features are added, tests are added to the test suite to make sure that
|
||||
these features continue to work correctly even when they are old features.
|
||||
|
||||
## History
|
||||
|
||||
My first attempt at reading and writing WAV files was in 1990 or so under
|
||||
Windows 3.1. I started using Linux in early 1995 and contributed some code to
|
||||
the [wavplay](http://www.vaxxine.com/ve3wwg/gnuwave.html) program. That
|
||||
contributed code would eventually mutate into this library. As one of my
|
||||
interests is Digital Signal Processing (DSP) I decided that as well as reading
|
||||
data from an audio file in the native format (typically 16 bit short integers)
|
||||
it would also be useful to be able to have the library do the conversion to
|
||||
floating point numbers for DSP applications. It then dawned on me that whatever
|
||||
file format (anything from 8 bit unsigned chars, to 32 bit floating point
|
||||
numbers) the library should be able to convert the data to whatever format the
|
||||
library user wishes to use it in. For example, in a sound playback program, the
|
||||
library caller typically wants the sound data in 16 bit short integers to dump
|
||||
into a sound card even though the data in the file may be 32 bit floating point
|
||||
numbers (ie Microsoft's WAVE_FORMAT_IEEE_FLOAT format). Another example would be
|
||||
someone doing speech recognition research who has recorded some speech as a 16
|
||||
bit WAV file but wants to process it as double precision floating point numbers.
|
||||
|
||||
Here is the release history for libsndfile:
|
||||
|
||||
* Version 0.0.8 (Feb 15 1999) First official release.
|
||||
* Version 0.0.28 (Apr 26 2002) Final release of version 0 of libsndfile.
|
||||
* Version 1.0.0rc1 (Jun 24 2002) Release candidate 1 of version 1 of libsndfile.
|
||||
* Version 1.0.0rc6 (Aug 14 2002) MacOS 9 fixes.
|
||||
* Version 1.0.0 (Aug 16 2002) First 1.0.X release.
|
||||
* Version 1.0.1 (Sep 14 2002) Added MAT4 and MAT5 file formats.
|
||||
* Version 1.0.2 (Nov 24 2002) Added VOX ADPCM format.
|
||||
* Version 1.0.3 (Dec 09 2002) Fixes for Linux on ia64 CPUs.
|
||||
* Version 1.0.4 (Feb 02 2003) New file formats and functionality.
|
||||
* Version 1.0.5 (May 03 2003) One new file format and new functionality.
|
||||
* Version 1.0.6 (Feb 08 2004) Large file fix for Linux/Solaris, new
|
||||
functionality and Win32 improvements.
|
||||
* Version 1.0.7 (Feb 24 2004) Fix build problems on MacOS X and fix ia64/MIPS
|
||||
etc clip mode detection.
|
||||
* Version 1.0.8 (Mar 14 2004) Minor bug fixes.
|
||||
* Version 1.0.9 (Mar 30 2004) Add AVR format. Improve handling of some WAV
|
||||
files.
|
||||
* Version 1.0.10 (Jun 15 2004) Minor bug fixes. Fix support for Win32 MinGW
|
||||
compiler.
|
||||
* Version 1.0.11 (Nov 15 2004) Add SD2 file support, reading of loop data in WAV
|
||||
and AIFF. Minor bug fixes.
|
||||
* Version 1.0.12 (Sep 30 2005) Add FLAC and CAF file support, virtual I/O
|
||||
interface. Minor bug fixes and cleanups.
|
||||
* Version 1.0.13 (Jan 21 2006) Add read/write of instrument chunks. Minor bug
|
||||
fixes.
|
||||
* Version 1.0.14 (Feb 19 2006) Minor bug fixes. Start shipping windows
|
||||
binary/source ZIP.
|
||||
* Version 1.0.15 (Mar 16 2006) Minor bug fixes.
|
||||
* Version 1.0.16 (Apr 30 2006) Add support for RIFX. Other minor feature
|
||||
enhancements and bug fixes.
|
||||
* Version 1.0.17 (Aug 31 2006) Add C++ wrapper sndfile.hh. Minor bug fixes and
|
||||
cleanups.
|
||||
* Version 1.0.18 (Feb 07 2009) Add Ogg/Vorbis support, remove captive
|
||||
libraries, many new features and bug fixes. Generate Win32 and Win64
|
||||
pre-compiled binaries.
|
||||
* Version 1.0.19 (Mar 02 2009) Fix for CVE-2009-0186. Huge number of minor fixes
|
||||
as a result of static analysis.
|
||||
* Version 1.0.20 (May 14 2009) Fix for potential heap overflow.
|
||||
* Version 1.0.21 (December 13 2009) Bunch of minor bug fixes.
|
||||
* Version 1.0.22 (October 04 2010) Bunch of minor bug fixes.
|
||||
* Version 1.0.23 (October 10 2010) Minor bug fixes.
|
||||
* Version 1.0.24 (March 23 2011) Minor bug fixes.
|
||||
* Version 1.0.25 (July 13 2011) Fix for Secunia Advisory SA45125. Minor bug
|
||||
fixes and improvements.
|
||||
* Version 1.0.26 (November 22 2015) Fix for CVE-2014-9496, CVE-2014-9756 and
|
||||
CVE-2015-7805. Add ALAC/CAF support. Minor bug fixes and improvements.
|
||||
* Version 1.0.27 (June 19 2016) Fix a seek regression in 1.0.26. Add metadata
|
||||
read/write for CAF and RF64. FIx PAF endian-ness issue.
|
||||
* Version 1.0.28 (April 2 2017) Fix buffer overruns in FLAC and ID3 handling
|
||||
code. Reduce default header memory requirements. Fix detection of Large File
|
||||
Support for 32 bit systems.
|
||||
* Version 1.0.29 (August 15 2020) Opus support, build system improvements and
|
||||
bug fixes.
|
||||
* Version 1.0.30 (September 19 2020) Bugfix release. Fix file descriptor leaks
|
||||
in sf_open_fd () function. Fix critical CMake bug leading to broken ABI on
|
||||
Linux platforms. Other numerous fixes to CMake build system, consider it
|
||||
stable now. Fix some memory leaks. Fix handling of some SD2 files. Update
|
||||
documentation. Integrate GitHub Actions for faster test builds and Oss-Fuzz
|
||||
for fuzzing tests. Move sndfile.h.in from src/ to include/ directory. To avoid
|
||||
problems, delete old generated sndfile.h from $(top_builddir)/src.
|
||||
* Version 1.0.31 (January 24 2021) Bugfix release. Fix multiple memory leaks
|
||||
reported by OSS-Fuzz. More SSE2-optimized functions for x86 and amd64.
|
||||
* Version 1.1.0 (March 27 2022) Minor release, backward compatible with previous
|
||||
releases. Added long-awaited MP3 support. Numerous improvements and bugfixes.
|
||||
* Version 1.2.0 (December 25 2022) Various bugfixes,
|
||||
removed artificial samplerate limit
|
||||
* Version 1.2.1 (August 12 2023) Patch release, various bugfixes.
|
||||
* Version 1.2.2 (August 13 2023) Patch release, various bugfixes.
|
||||
|
||||
## Similar or Related Projects
|
||||
|
||||
* [SoX](http://sox.sourceforge.net/) is a program for converting between sound
|
||||
file formats.
|
||||
* [Wavplay](http://www.hitsquad.com/smm/programs/WavPlay/) started out as a
|
||||
minimal WAV file player under Linux and has mutated into Gnuwave, a
|
||||
client/server application for more general multimedia and games sound
|
||||
playback.
|
||||
* [Audiofile](http://www.68k.org/~michael/audiofile/) (libaudiofile) is a
|
||||
library similar to libsndfile but with a different programming interface. The
|
||||
author Michael Pruett has set out to clone (and fix some bugs in) the
|
||||
libaudiofile library which ships with SGI's IRIX OS.
|
||||
* [sndlib.tar.gz](ftp://ccrma-ftp.stanford.edu/pub/Lisp/sndlib.tar.gz) is
|
||||
another library written by Bill Schottstaedt of CCRMA.
|
||||
|
||||
## Licensing
|
||||
|
||||
libsndfile is released under the terms of the GNU Lesser General Public License,
|
||||
of which there are two versions;
|
||||
[version 2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)
|
||||
and
|
||||
[version 3](http://www.gnu.org/copyleft/lesser.html).
|
||||
To maximise the compatibility of libsndfile, the user may choose to use
|
||||
libsndfile under either of the above two licenses.
|
||||
You can also read a simple explanation of the ideas behind the GPL and the LGPL
|
||||
[here](http://www.gnu.org/copyleft/lesser.html).
|
||||
|
||||
You can use libsndfile with
|
||||
[Free Software](http://www.gnu.org/),
|
||||
[Open Source](http://www.opensource.org/),
|
||||
proprietary, shareware or other closed source applications as long as libsndfile
|
||||
is used as a dynamically loaded library and you abide by a small number of other
|
||||
conditions (read the LGPL for more info).
|
||||
With applications released under the GNU GPL you can also use libsndfile
|
||||
statically linked to your application.
|
||||
|
||||
I would like to see libsndfile used as widely as possible but I would prefer it
|
||||
if you released software that uses libsndfile as
|
||||
[Free Software](http://www.gnu.org/)
|
||||
or
|
||||
[Open Source](http://www.opensource.org/).
|
||||
However, if you put in a great deal of effort building a significant application
|
||||
which simply uses libsndfile for file I/O, then I have no problem with you
|
||||
releasing that as closed source and charging as much money as you want for it as
|
||||
long as you abide by [the license](http://www.gnu.org/copyleft/lesser.html).
|
||||
|
||||
## Download
|
||||
|
||||
Check latest version on
|
||||
[GitHub Releases page](https://github.com/libsndfile/libsndfile/releases/).
|
||||
|
||||
Binaries and source packages are signed by current releaser David Seifert aka
|
||||
@SoapGentoo. You can verify signatures with his public GPG key:
|
||||
|
||||
```
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v2
|
||||
|
||||
mQINBFppABgBEAC42ZiNvV7BTIgR6TQy0YnF54fx3mVRP1u8Mq00UZa7reAsNKh7
|
||||
1H60j0W4s6+4pVVIKGfpVGxLwUdJe+KVCYw1Cd3YW6uMf5zZrC/ZWqnJiH/n6S6o
|
||||
1l4INII2o6YbGBnzIWBPRo7PlOL+mvgKTLpBSJPnhD8XDGN5wRiV8rL2+6Dptg0F
|
||||
nJt7oxECGF3OD3gk6HMel0o82CVkIqMtNaX1L/bhcdF7K0Rp2MXPZMmpn1izW5sI
|
||||
asN1G9+w+Zwj7kMJzq1Aw3ac+rsX4SEYdvXjS2QhDHQUIr6LXri3D2WbcEqIZj2R
|
||||
JVoVwblsrG11dYXFDBbgrq4NhgTBsxHYDlkr/qF2W+kbPC/nhSqTVZeCYvTBZbOQ
|
||||
+RqyN/I0izukglnWmV1jGijFA8snyP8efx732hw/24zRYmtXOtnEITUpw8WOeZCq
|
||||
6uiHaQ+eopnY2ojBg9BI7WZm0AFn58xxT9soMsyFOUFgXTqaWFZWlJ3fhZE8/0v8
|
||||
JEu/kPGE5aJReT3b34B+Bojkj74XR+h2u7iJJBHMTE8RwGoUOZHer/XsL9xlcdks
|
||||
I+7TCjiq++ShaSSt2XsJmw2BhREohrjW/2KkwmvT3b44RMpKPB4WTH+++aqJQNeM
|
||||
IqmswOMoZvzEZezInj7WVY/r0WEei1Y6wt1tBrJ/cFf1oQBM1UmphxcrfQARAQAB
|
||||
tB9EYXZpZCBTZWlmZXJ0IDxzb2FwQGdlbnRvby5vcmc+iQJUBBMBCgA+BQsJCAcD
|
||||
BRUKCQgLBRYCAwEAAh4BAheAAhsBFiEEMdlcq22A0mIkShdQpHYg6AHkfpUFAl/V
|
||||
CvoFCQkuceIACgkQpHYg6AHkfpXYxA//aiJW1NwunpmzEc62id8lRMnoLHWVjISZ
|
||||
b+xSlm+hk4LYq+ZbthJDzKcT86/3DJOSE1zQw9wLuCao9IW2UfFJQBtR+TAfbagG
|
||||
0Yyk/kMcLoFJxnG1ywdJWypCAauuIhia52Z7PmmjsBbFwr6LygDwSQmZAyACMAs7
|
||||
TLQe+yERc2RNDsIEsquLSxxRF0Spk9gagWtKgrPc2XBjuNtQDwW7JgsOUoEeHyxC
|
||||
29fRUjC3o/pG2I6iAZp17OROZI5yl4TSORrSBDGIi2sayxyxP0x+IPKtrCUcBGNx
|
||||
wGp+56bP/V0hA6sgCPh/iwvqLoeibso6l/Kd4ltVAEQnHTd6fr8g+wLEUXfbJVTR
|
||||
7aeFUoaFmWjSPlQrNr6HlxSLV/kRx9kVJp1Pn16vkfVBF7fG7iDLiqphwEeQg5ND
|
||||
nmGeKAbRRNxFHyBHf0XRsaYiFZQckguO+71XSRtVx8/YP5nyNbtl9y1h/4JlT6Gy
|
||||
t7hb5twYFQyQrKss83E/Bo1sRdHpj0ibtqb4ZbYANbh482E6yFhAkuo8YjVTJipI
|
||||
1Ve8EBKnX3R+pDt147uyysNvtPVXML+sWpGSMVSm4NA8uT3F5nqxVwj+SeXy3Wq/
|
||||
CHQ2VBKGBC655G+wFD5C6O7cTx2MwH+2H8tzhWm+gFlI3MFKEXa/PC+YUC/diYcb
|
||||
BrApavriTRa5Ag0EWmkAZgEQAPXMD3mZI+ChvBysXZWksC88/uSEwFeb3XkcRm7v
|
||||
04GN7hcz+bfrmnUTB3tuE/ZQgv+u7ZjetvH1aEKieznn/GjnWoOBoJusOYvfAQeF
|
||||
0mQVi118QiOZRCnEZpkz+RY9TiXVgrZJg+AGqHZ3Ol4GkInEV2NWgH37Xal+HkFl
|
||||
rwI2U7mL0kZRG+LAVCQHKzqU0R0HE1XyJ4qf0awtG5Qi/TZvgXBdZPDXgr8i9Vlf
|
||||
UUu10c2XnXM0Av/YAlZmBFjVYrSOUCFenqSVqL+s9sTCVdWlJrGjrr3Ja4uT3kl2
|
||||
rLva0AR4oSQoxt8adKohmFz0vzOkQtCoRzhrCwoo3JvNjKdSNoOP1nSsxlO5ji8r
|
||||
ih5d+ajPgi580XyHLnrvG7vobR48qqscv1hizKuCgTacOTe6Db2Gqc8xF6v8HhJa
|
||||
KwWJtmFllIfN/tIvZ6BbbgHQn0IGf4CYnWf0SksPZqpBmTRpD2jfBxcj2UEg+AR3
|
||||
LARjuyUVpFJScyu6ExQG+6O+ByLL31iWP5MgUrza1rIpriPa3NT3rZ3DG2pvQrS3
|
||||
ySsrPzH7VRX8L1ThSMSzjwF96aMsd14s7XzR4EzNuWwZDukfs0yavZk6l4o1M0mb
|
||||
tbJi7hE4cz13KRHYvIkKMdZGYUnzRzZUDlsj2imakk3BR6GXnxZ1ST6062g+QxiL
|
||||
AJFLABEBAAGJBHIEGAEKACYCGwIWIQQx2VyrbYDSYiRKF1CkdiDoAeR+lQUCX9UL
|
||||
DQUJCS5xpwJAwXQgBBkBCgAdFiEEuNUxXaAAcsCoYIifzjbhFyAuOEIFAlppAGYA
|
||||
CgkQzjbhFyAuOELmrQ/9H9wrWsWa21STZdxUmyU2sh9VXAWEHl1Ey0fVTznDM0Fl
|
||||
zx5YSR/TmmnE36rpaz31Ttkx8SP914oV+mMgseecdya9Bf6uZL9Cv7V3KEsJBRL/
|
||||
ncrOWQBHP/Xy1X+mLD6A19xq7H4RihSLj0LeK2YVjrJzJ7wMf4mKXuBayQeAHImU
|
||||
WRCRTbmK3umh2nB5V0iPd/XZEIiYtiTPe+7E/va6+0bBvOumF3a+Z0iui7eU4hFC
|
||||
7Jk71D0dcg09SlIaNoMOrw7cMC3j2pMdKtsj8+0I6WBv14PhhqPAsnjdf7I/4NfK
|
||||
L7Jav8T/gDS01uA2Jxm72d+wr+eSjOBXa6x8CEbTqfkjAGxsWENThCp6zDkaXSDd
|
||||
JsV0va47vjzG8+wTDAvPy5IxIM/KZZdl4uWM+mF5K+q+eSTOHe7aLF2OdcussoBA
|
||||
A18zm994dAkG1COX/qpxanxx2bv/2IvCGPg+x6JtAN8ji2kncWu3dWGQdE5XbVjc
|
||||
fDwgsUPpp04G27Mr/x+HpEbgZ5SdA0dAqJktlNvCcHALhlblCWrsh/1QNjT/2iG8
|
||||
wsjcpEy/s4tWAuV4PTa4xvZ1JPS7Z7Eo5aBy9ZGOWG9SrHEiHnhkUsiswbHBOEjd
|
||||
pBSkmNElDcv9fRUahVCTPfvWBATFDrQyMjJBSm+cV8c/iFQM7isVSu8W7E0eetsJ
|
||||
EKR2IOgB5H6Vv9sP/1dxTvH0N0UoEoxIG/hnirEkbRpljdvqy4/uikYBKyQgSbo8
|
||||
VITTjea7gIhDztil9WZYt35jbOmoaGM2Z6TP2LEDOWgljYUNq9pl9Sc2GS8cNtEO
|
||||
WxExzGOc1Flo730dX3A85Ks3+0WPXZjLDcRRcPVkFd5WLQQDV1YVYopWkuQBC+Br
|
||||
4q3uv+sk+bw6gDa9+zFBbDuegdsYuTXrFHoxHz2GRv9Yb7ULCMgpFeNKDgtQq91u
|
||||
RqewoTwQp9tlp91LH/hh7R0Q4DRgeFDkLnVRXwSKjVvCrT5cBgImGwtFTGS4egoy
|
||||
MDKd/KKjZllp1ahRCln1XfmFQyQVMVvuF/JTtt31n6KwXwK2yxIlXB01xvRH+Ees
|
||||
AWeRYWKWXydaAY/9Ve0/PLFlgsr/XUGvt0GoEKe7odD3nZgg6015+/8JTroKw19L
|
||||
NZkhdfFMl11Zi0j5k3UbyzjYVpFSd8K2o0VoOG1LFsPp8tlRxNoVzpId0CX1au/p
|
||||
y1H7Wy/39mzriRG3rw+mJAQbBjN09putCltXFXpOEWk08n/N3vufCVQUoSu/2Bqw
|
||||
2HYj8VtToQp+O5dG3XxvDHINtInP1yr2Wcw2plna0KoXLwv/lZgDm3LN+eCWpG6d
|
||||
N/xk25DTSqTHArUQIEkhcHYK6GnyxUcvoKtG88hXtqEPYXiK08FZYAUPTnDYuQIN
|
||||
BFppAIkBEADDjvQZUs1NoqJpxkD2QDBudU1DBCaeI1D6CancMtb5FebPUxgFlDMd
|
||||
CBGOun48dY5i87gDhT/qS3gP/Mv9rjKJmcG9JHfhpXdW73owxrcsQ96nxxVJNEVl
|
||||
UHJw00z8C9eGWqr0SzSoE33K/PkzSkgtsaotF6+3uCerWulweulmGa5dpVfV0mbS
|
||||
aVw8VmrhZ5NmCeodyy/lR85rPik5pb32NT6v7xBkgkfS0VYtPB2E5gW1pXX/jEOi
|
||||
Mfq9idOEP9lxrNXV9j49Lr0JQCwAcrYbQ2+VPe6eacJEjzJ/6HiUqhPrYdnvydmb
|
||||
hU+xmv2NjGp2UnDZDEhzQfwm6fMx+8Nx2uPzCnXQGoyRBwiC/KcdW0F1ZPKdSXqH
|
||||
NKoOF62pLvIMSmfI3ZVOrTohArfr1kFEYVDv9Nl7oY+qg2rZEc2srOF74a9Z46bR
|
||||
TDPsEQzE2UMCvu3+rofhSD7aRotlKeDCvbe2s0yE4Man457Xc3LXh8Gva8CzCOLE
|
||||
2eMhNTsHIZk68WgXp3/uvE4Xy42myrk1AV8XXDdlWgx0Kc/I6tE59O5NVPSfuGvH
|
||||
1a15KKx0F6euEnYDKKpQ5PDR6dSn61po0tfbt96m044G/xQFjrfhHei4jji9Ogd9
|
||||
vlXVAi2vn3+NCSHFP5l3igLByBHy9iLIdmz7yQuus/1nwRmxOHOf2QARAQABiQI8
|
||||
BBgBCgAmAhsMFiEEMdlcq22A0mIkShdQpHYg6AHkfpUFAl/VCxkFCQkucZAACgkQ
|
||||
pHYg6AHkfpVPSRAAmheYkYJmtDbkzPBBnj5mbCIQN1/G5PI9eixc/TXWFOXtcjU1
|
||||
mJlJpSidHJyLRrx7r0c+N+s8vnY/JuUBsNoMJMER+Mv/CFW4iFi59V534SyAb2S0
|
||||
7NINJnFNkXBY62CDz9KsMuv/MdSv2yLhPH2Tfrm/eDRQesj1PanE4U1cgjWyJRc/
|
||||
IOlaRHvTasWDLgwbQi8ykt+4xUWzL/YKHzB+KyyzBK7vPBXqySX8ka4BOw7SDwG5
|
||||
lX2gtmhk4AGBwVChLXKflqVx1WXj4DPOt0kmOKVnKFyvUijK58M0A2FMgFMXDTIS
|
||||
DRtoZPdx/rkODXxgS+W+27NcYAnxJiM0cQqizEnQh7PQ1KzgdChPejYXMKe9lwdn
|
||||
ssMUxrBpbuAuagEf+pebNjD2eaNR4p8kfaDdGn53q55ysDvoyxKvnVQGSk1FAR9Q
|
||||
s4N5a4f02U7dzlyEhEfIcuUlRCfnlpn4n725YIhHheDig5zKWoEZCkNIfiRcGzDl
|
||||
8Drj+tlZiUR+gDkIoWSBaCkKbIQlc8qCYy6Hm7oZBaol6xKlUnTMK2rjK8fR4i8r
|
||||
bVDWBAaWj3jcDHJ0Jg3fS/qBpeya/JXMp89TR8NK5Ys7PZpWbor+puXBYyXDAVx3
|
||||
rXQ7JBA5klHPxrgjso1S/LqwscKLENtrVjdjhryLBmPifrmofJRnrpiHIEa5Ag0E
|
||||
WmkAswEQAL0hKwsRybQzkNGpJP+ElLSwFHd7XQhr+qIwLllpumWtnIK/DHmv8SpW
|
||||
FqAYajmRTXipFcBHH25x2jIIliZidn0a9826l+sMzrFadMC6/W4pitP71TeqZzwn
|
||||
pAuHs14YL7Wiy0aJQnfbCpRzPq3kYyOXmhmY7lPWO0WdUpR6W8wUbleK5XOVDDRx
|
||||
aIC/M3hhDOxZOMzQ+pdn4BaOFQQ0ygsRkqOudbuc0R1giYRt1i6gMeT8gfzL9jlw
|
||||
HcJ+aVnxdUQQ4uC47oKo/+lg7qh7LsiW79pQC1Bcdm8lhRmqtxe6ub60ecjax3XU
|
||||
1ILIEfIFCv6M7LRUAwz0bqk35spgkJqrGGKkdeWEKAFHg2QWR2F0zy+HdlPLfKxO
|
||||
uhaccpwc9EJtf744GS0SXa2AXr32j56n7CFcEjFcIQPBC6OJn6eA3hOVUYGZ7SrT
|
||||
4fsmZiFAdGEkvLKFuNhju1Hj2EJQUY1pm4GSBco7BR8x+QqoYrt5clU3WxRMNfTR
|
||||
0Rtuzsh4xskXNVMMgvKOahAtxENv2M2Cx6zJPVL5dmaysP7d6QRVeOQA5PwkcZ5Q
|
||||
qK6JtDZj2jpaKQH4Za715kiIcdqMDSkwxa6avc0kARHvfFcBR4hwDm1GAlaKG7eH
|
||||
8TOGGQIk8x2F3s4l8mTJVLWTP/uJYnkYBdqANYo5t1NIQLvwLFV3ABEBAAGJAjwE
|
||||
GAEKACYCGyAWIQQx2VyrbYDSYiRKF1CkdiDoAeR+lQUCX9ULIwUJCS5xcAAKCRCk
|
||||
diDoAeR+leekD/sF7aHH0W35ckWrXZlfSp0qHPWrBUaLBI9OAUHenRhgs4SbK0D4
|
||||
wqEiu0C5iDQojpXAeALQ8g/1pUsZ1yuFqYbGYWrHkA0Pm+P3tAGB4LMZ41YfvROP
|
||||
uaiW/+IMJbWllgRtaDt8/NtCgs30WI9I+az5M29HcGfvEwEUykrBx3dE9T+1ui3O
|
||||
capdd+GMvdAAsX5PyVkjWgZ7GrZeH8mG7UysYfT4qthxEtQfZ/u8ceSduKA46ugh
|
||||
C2eafIDNvluqn7BU4oKxME61u6C8BN2yHLI6LV0Tr4z5H8joVbM4BSFMwLVGlsXf
|
||||
HhB8kLiErN6bXolxsjARlmYiD9S9H2AcYidr6RYXf2EVFSpBG59xn1WTDN+DsHQf
|
||||
7btNPEPl/OPxa3OQjG+xn8USddiP0N0B4xsyzMNCCKDgvXXcIhX55KG9eh3Tc98S
|
||||
fEyhxu8ybZBIGmTJysPKxijfvSgQF+RPNTsz9lvXqkoK7RTgeYMschpjJEznCLbt
|
||||
M6eTDb5z0G5uLXh6+dYxtDOlPogI5OHd+G51LwCjvrQ+AtIUCgafuemwA9mpFT2b
|
||||
svb/qcxSVUb44bVaNHn1JHebX2YbokGtBOm1x2PI5fT8n6YIIYz3jKYOZAYdUT7x
|
||||
6qURyNjOfG4aPJIATwuh4GSNuxUG40+yuT+XfQF24mu1esS1J3wzRloJ7w==
|
||||
=K3x+
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
* [sndfile-tools](https://github.com/libsndfile/sndfile-tools): a small
|
||||
collection of programs which use libsndfile.
|
||||
101
Engine/lib/libsndfile/docs/libsndfile.css
Normal file
101
Engine/lib/libsndfile/docs/libsndfile.css
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
body {
|
||||
background : black ;
|
||||
color : white ;
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
line-height: 1.5 ;
|
||||
margin-left: 6%;
|
||||
margin-right: 6%;
|
||||
}
|
||||
td {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
background : black ;
|
||||
color : white ;
|
||||
}
|
||||
center {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
}
|
||||
p {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
text-align : left ;
|
||||
}
|
||||
.indent_block {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
text-align : left ;
|
||||
}
|
||||
br {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
}
|
||||
form {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
}
|
||||
ul {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
text-align : left ;
|
||||
}
|
||||
ol {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
text-align : left ;
|
||||
}
|
||||
dl {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
text-align : left ;
|
||||
}
|
||||
h1 {
|
||||
font-size : xx-large ;
|
||||
background : black ;
|
||||
color : #5050FF ;
|
||||
text-align : left ;
|
||||
}
|
||||
h2 {
|
||||
font-size : x-large ;
|
||||
background : black ;
|
||||
color : #5050FF ;
|
||||
text-align : left ;
|
||||
}
|
||||
h3 {
|
||||
font-size : large ;
|
||||
background : black ;
|
||||
color : #5050FF ;
|
||||
text-align : left ;
|
||||
}
|
||||
h4 {
|
||||
font-size : medium ;
|
||||
background : black ;
|
||||
color : #5050FF ;
|
||||
text-align : left ;
|
||||
}
|
||||
pre {
|
||||
font-family : courier, monospace ;
|
||||
font-size : medium ;
|
||||
}
|
||||
code,
|
||||
kbd,
|
||||
samp,
|
||||
var {
|
||||
font-family: "Courier New", monospace, serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
a:link { color : #9090FF ; }
|
||||
a:visited { color : #5050FF ; }
|
||||
a:active { color : #FF00FF ; }
|
||||
a:hover { background-color : #202080 ; }
|
||||
|
||||
table.formats-table {
|
||||
text-align: center;
|
||||
font-size: small;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.formats-table, table.formats-table th, table.formats-table td {
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
.image-logo {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
nav {
|
||||
text-align: center;
|
||||
}
|
||||
BIN
Engine/lib/libsndfile/docs/libsndfile.jpg
Normal file
BIN
Engine/lib/libsndfile/docs/libsndfile.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
434
Engine/lib/libsndfile/docs/linux_games_programming.txt
Normal file
434
Engine/lib/libsndfile/docs/linux_games_programming.txt
Normal file
|
|
@ -0,0 +1,434 @@
|
|||
# Here are some some emails I exchanged with a guy trying to use
|
||||
# libsndfile version 1 with code from the book "Linux Games Programming"
|
||||
# by John Hall. The email addresses have been changed to foil the spam
|
||||
# bots.
|
||||
|
||||
Date: Tue, 20 Jul 2004 22:49:21 +0100
|
||||
From: Paul <paul@fake-domain-name.co.uk>
|
||||
To: erikd@fake-domain-name.com
|
||||
Subject: Can you help with a problem?
|
||||
Date: Tue, 20 Jul 2004 22:49:21 +0100
|
||||
|
||||
Hi,
|
||||
|
||||
I'm trying to get the source examples in the "Programming Linux Games"
|
||||
(NoStarch, Loki Software + John R. Hall) which use sndfile.h/libsndfile.
|
||||
|
||||
While I can guess some of the newer versions of function calls and
|
||||
enumerations, there are some which I cannot guess.
|
||||
|
||||
Would you be able to translate them to the current version of
|
||||
enumeration and function calls so that I can update the source?
|
||||
|
||||
These are the three currently failing me:
|
||||
|
||||
sf_open_read(filename, SF_INFO *sfinfo) (guess: sf_open(filename,SFM_READ, &sfinfo))
|
||||
SF_FORMAT_PCM (guess: either SF_FORMAT_PCM_U8 or _RAW)
|
||||
SF_INFO.pcmbitwidth (guess: no idea!)
|
||||
|
||||
There are probably more. I'm happy to send you the source files for
|
||||
sound calls, scan the pages or anything else. Failing that, is there
|
||||
somewhere with the changes listed so I can try and fix the code for myself?
|
||||
|
||||
Thanks
|
||||
|
||||
TTFN
|
||||
|
||||
Paul
|
||||
|
||||
================================================================================
|
||||
|
||||
Date: Wed, 21 Jul 2004 17:38:08 +1000
|
||||
From: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||
To: Paul <paul@fake-domain-name.co.uk>
|
||||
Subject: Re: Can you help with a problem?
|
||||
|
||||
On Tue, 20 Jul 2004 22:49:21 +0100
|
||||
Paul <paul@fake-domain-name.co.uk> wrote:
|
||||
|
||||
> Hi,
|
||||
>
|
||||
> I'm trying to get the source examples in the "Programming Linux Games"
|
||||
> (NoStarch, Loki Software + John R. Hall) which use sndfile.h/libsndfile.
|
||||
>
|
||||
> While I can guess some of the newer versions of function calls and
|
||||
> enumerations, there are some which I cannot guess.
|
||||
>
|
||||
> Would you be able to translate them to the current version of
|
||||
> enumeration and function calls so that I can update the source?
|
||||
>
|
||||
> These are the three currently failing me:
|
||||
>
|
||||
> sf_open_read(filename, SF_INFO *sfinfo) (guess: sf_open(filename,
|
||||
> SFM_READ, &sfinfo))
|
||||
|
||||
yes.
|
||||
|
||||
> SF_FORMAT_PCM (guess: either SF_FORMAT_PCM_U8 or _RAW)
|
||||
|
||||
Actually this list:
|
||||
|
||||
SF_FORMAT_PCM_U8
|
||||
SF_FORMAT_PCM_S8
|
||||
SF_FORMAT_PCM_16
|
||||
SF_FORMAT_PCM_24
|
||||
SF_FORMAT_PCM_32
|
||||
|
||||
> SF_INFO.pcmbitwidth (guess: no idea!)
|
||||
|
||||
WIth the above change, pcmbitwidth becomes redundant.
|
||||
|
||||
> There are probably more. I'm happy to send you the source files for
|
||||
> sound calls, scan the pages or anything else. Failing that, is there
|
||||
> somewhere with the changes listed so I can try and fix the code for
|
||||
> myself?
|
||||
|
||||
Version 1.0.0 came out some time ago, but I think this:
|
||||
|
||||
http://www.mega-nerd.com/libsndfile/version-1.html
|
||||
|
||||
lists most of the changes. You should also look at the API docs:
|
||||
|
||||
http://www.mega-nerd.com/libsndfile/api.html
|
||||
|
||||
HTH,
|
||||
Erik
|
||||
--
|
||||
+-----------------------------------------------------------+
|
||||
Erik de Castro Lopo nospam@fake-domain-name.com
|
||||
+-----------------------------------------------------------+
|
||||
"There is no reason why anyone would want a computer in their home"
|
||||
Ken Olson, DEC, 1977
|
||||
|
||||
================================================================================
|
||||
|
||||
From: PFJ <paul@fake-domain-name.co.uk>
|
||||
To: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||
Subject: Re: Can you help with a problem?
|
||||
Date: Wed, 21 Jul 2004 09:07:39 +0100
|
||||
|
||||
|
||||
Hi Erik,
|
||||
|
||||
Thanks for getting back to me.
|
||||
|
||||
> > sf_open_read(filename, SF_INFO *sfinfo) (guess: sf_open(filename, SFM_READ, &sfinfo))
|
||||
>
|
||||
> yes.
|
||||
|
||||
Yay!
|
||||
|
||||
> > SF_FORMAT_PCM (guess: either SF_FORMAT_PCM_U8 or _RAW)
|
||||
>
|
||||
> Actually this list:
|
||||
>
|
||||
> SF_FORMAT_PCM_U8
|
||||
> SF_FORMAT_PCM_S8
|
||||
> SF_FORMAT_PCM_16
|
||||
> SF_FORMAT_PCM_24
|
||||
> SF_FORMAT_PCM_32
|
||||
|
||||
I know, but the source code explicitly has SF_FORMAT_PCM which given the
|
||||
code afterwards would equate to one of the above, but given that PCM
|
||||
files can have a varied bitwidth the author probably wanted to cover all
|
||||
bases.
|
||||
|
||||
> Version 1.0.0 came out some time ago, but I think this:
|
||||
>
|
||||
> http://www.mega-nerd.com/libsndfile/version-1.html
|
||||
>
|
||||
> lists most of the changes. You should also look at the API docs:
|
||||
>
|
||||
> http://www.mega-nerd.com/libsndfile/api.html
|
||||
|
||||
I'll download them and see what I can gleen.
|
||||
|
||||
Thanks again for getting back to me
|
||||
|
||||
TTFN
|
||||
|
||||
Paul
|
||||
|
||||
================================================================================
|
||||
|
||||
Date: Wed, 21 Jul 2004 18:20:29 +1000
|
||||
From: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||
To: PFJ <paul@fake-domain-name.co.uk>
|
||||
Subject: Re: Can you help with a problem?
|
||||
|
||||
On Wed, 21 Jul 2004 09:07:39 +0100
|
||||
PFJ <paul@fake-domain-name.co.uk> wrote:
|
||||
|
||||
> I know, but the source code explicitly has SF_FORMAT_PCM which given the
|
||||
> code afterwards would equate to one of the above, but given that PCM
|
||||
> files can have a varied bitwidth the author probably wanted to cover all
|
||||
> bases.
|
||||
|
||||
But surely the existing code does something like:
|
||||
|
||||
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM;
|
||||
sfinfo.pcmbitwidth = 16;
|
||||
|
||||
which can be directly translated to:
|
||||
|
||||
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
|
||||
|
||||
and the same for pcmbitwitdhs of 24 and 32. For pcmbitwidth of 8
|
||||
you need to know that WAV files use SF_FORMAT_PCM_U8 and AIFF
|
||||
files use SF_FORMAT_PCM_S8. That's all there is to it.
|
||||
|
||||
Erik
|
||||
--
|
||||
+-----------------------------------------------------------+
|
||||
Erik de Castro Lopo nospam@fake-domain-name.com
|
||||
+-----------------------------------------------------------+
|
||||
"Python addresses true pseudocode's two major failings: that it
|
||||
isn't standardized, and it isn't executable."
|
||||
- Grant R. Griffin in comp.dsp
|
||||
|
||||
================================================================================
|
||||
|
||||
Subject: Re: Can you help with a problem?
|
||||
From: PFJ <paul@fake-domain-name.co.uk>
|
||||
To: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||
Date: Wed, 21 Jul 2004 09:50:55 +0100
|
||||
|
||||
Hi Erik,
|
||||
|
||||
> > I know, but the source code explicitly has SF_FORMAT_PCM which given the
|
||||
> > code afterwards would equate to one of the above, but given that PCM
|
||||
> > files can have a varied bitwidth the author probably wanted to cover all
|
||||
> > bases.
|
||||
>
|
||||
> But surely the existing code does something like:
|
||||
>
|
||||
> sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM;
|
||||
> sfinfo.pcmbitwidth = 16;
|
||||
|
||||
If only!
|
||||
|
||||
The actual code is this
|
||||
|
||||
int LoadSoundFile(char *filename, sound_p sound)
|
||||
{
|
||||
SNDFILE *file;
|
||||
SF_INFO file_info;
|
||||
short *buffer_short = NULL;
|
||||
u_int8_t *buffer_8 = NULL;
|
||||
int16_t *buffer_16 = NULL;
|
||||
unsigned int i;
|
||||
|
||||
/* Open the file and retrieve sample information. */
|
||||
file = sf_open_read(filename, &file_info);
|
||||
// I've sorted this one already - PFJ
|
||||
|
||||
/* Make sure the format is acceptable. */
|
||||
if ((file_info.format & 0x0F) != SF_FORMAT_PCM) {
|
||||
printf("'%s' is not a PCM-based audio file.\n", filename);
|
||||
sf_close(file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((file_info.pcmbitwidth == 8) && (file_info.channels == 1)) {
|
||||
sound->format = AL_FORMAT_MONO8;
|
||||
} else if ((file_info.pcmbitwidth == 8) && (file_info.channels == 2)) {
|
||||
sound->format = AL_FORMAT_STEREO8;
|
||||
} else if ((file_info.pcmbitwidth == 16) && (file_info.channels == 1)) {
|
||||
sound->format = AL_FORMAT_MONO16;
|
||||
} else if ((file_info.pcmbitwidth == 16) && (file_info.channels == 2)) {
|
||||
sound->format = AL_FORMAT_STEREO16;
|
||||
} else {
|
||||
printf("Unknown sample format in %s.\n", filename);
|
||||
sf_close(file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Allocate buffers. */
|
||||
buffer_short = (short *)malloc(file_info.samples * file_info.channels * sizeof (short));
|
||||
|
||||
buffer_8 = (u_int8_t *)malloc(file_info.samples * file_info.channels * file_info.pcmbitwidth / 8);
|
||||
|
||||
buffer_16 = (int16_t *)buffer_8;
|
||||
|
||||
if (buffer_short == NULL || buffer_8 == NULL) {
|
||||
printf("Unable to allocate enough memory for '%s'.\n", filename);
|
||||
goto error_cleanup;
|
||||
}
|
||||
|
||||
/* Read the entire sound file. */
|
||||
if (sf_readf_short(file,buffer_short,file_info.samples) == (size_t)-1) {
|
||||
printf("Error while reading samples from '%s'.\n", filename);
|
||||
goto error_cleanup;
|
||||
}
|
||||
|
||||
<minor snip>
|
||||
|
||||
/* Fill in the sound data structure. */
|
||||
sound->freq = file_info.samplerate;
|
||||
sound->size = file_info.samples * file_info.channels * file_info.pcmbitwidth / 8;
|
||||
|
||||
/* Give our sound data to OpenAL. */
|
||||
alGenBuffers(1, &sound->name);
|
||||
if (alGetError() != AL_NO_ERROR) {
|
||||
printf("Error creating an AL buffer name for %s.\n", filename);
|
||||
goto error_cleanup;
|
||||
}
|
||||
|
||||
alBufferData(sound->name, sound->format, buffer_8, sound->size,sound->freq);
|
||||
if (alGetError() != AL_NO_ERROR) {
|
||||
printf("Error sending buffer data to OpenAL for %s.\n", filename);
|
||||
goto error_cleanup;
|
||||
}
|
||||
|
||||
/* Close the file and return success. */
|
||||
sf_close(file);
|
||||
free(buffer_short);
|
||||
free(buffer_8);
|
||||
|
||||
return 0;
|
||||
|
||||
error_cleanup:
|
||||
if (file != NULL) fclose(file);
|
||||
free(buffer_short);
|
||||
free(buffer_8);
|
||||
return -1;
|
||||
}
|
||||
|
||||
As you can see, the PCM material in the listing will not currently
|
||||
compile and for the other sndfile material, it probably won't either.
|
||||
|
||||
Any help would be appreciated.
|
||||
|
||||
TTFN
|
||||
|
||||
Paul
|
||||
|
||||
================================================================================
|
||||
|
||||
From: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||
To: PFJ <paul@fake-domain-name.co.uk>
|
||||
Subject: Re: Can you help with a problem?
|
||||
Date: Wed, 21 Jul 2004 19:36:46 +1000
|
||||
|
||||
On Wed, 21 Jul 2004 09:50:55 +0100
|
||||
PFJ <paul@fake-domain-name.co.uk> wrote:
|
||||
|
||||
> Hi Erik,
|
||||
>
|
||||
> > > I know, but the source code explicitly has SF_FORMAT_PCM which given the
|
||||
> > > code afterwards would equate to one of the above, but given that PCM
|
||||
> > > files can have a varied bitwidth the author probably wanted to cover all
|
||||
> > > bases.
|
||||
> >
|
||||
> > But surely the existing code does something like:
|
||||
> >
|
||||
> > sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM;
|
||||
> > sfinfo.pcmbitwidth = 16;
|
||||
>
|
||||
> If only!
|
||||
|
||||
No, really.
|
||||
|
||||
Drop this completely:
|
||||
|
||||
> /* Make sure the format is acceptable. */
|
||||
> if ((file_info.format & 0x0F) != SF_FORMAT_PCM) {
|
||||
> printf("'%s' is not a PCM-based audio file.\n", filename);
|
||||
> sf_close(file);
|
||||
> return -1;
|
||||
> }
|
||||
|
||||
Replace this block:
|
||||
|
||||
> if ((file_info.pcmbitwidth == 8) && (file_info.channels == 1)) {
|
||||
> sound->format = AL_FORMAT_MONO8;
|
||||
> } else if ((file_info.pcmbitwidth == 8) && (file_info.channels == 2)) {
|
||||
> sound->format = AL_FORMAT_STEREO8;
|
||||
> } else if ((file_info.pcmbitwidth == 16) && (file_info.channels == 1)) {
|
||||
> sound->format = AL_FORMAT_MONO16;
|
||||
> } else if ((file_info.pcmbitwidth == 16) && (file_info.channels == 2)) {
|
||||
> sound->format = AL_FORMAT_STEREO16;
|
||||
> } else {
|
||||
> printf("Unknown sample format in %s.\n", filename);
|
||||
> sf_close(file);
|
||||
> return -1;
|
||||
> }
|
||||
|
||||
with:
|
||||
|
||||
int pcmbitwidth = 0;
|
||||
|
||||
if (file_info.format & SF_FORMAT_SUBMASK != SF_FORMAT_PCM_16)
|
||||
{ printf("'%s' is not a PCM-based audio file.\n", filename);
|
||||
sf_close(file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (file_info.channels < 1 || file_info.channels > 2)
|
||||
{ printf("'%s' bad channel count.\n", filename);
|
||||
sf_close(file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (file_info.format & SF_FORMAT_SUBMASK + file_info.channels << 16)
|
||||
{ case (SF_FORMAT_PCM_U8 + 1 << 16):
|
||||
sound->format = AL_FORMAT_MONO8;
|
||||
pcmbitwidth = 8;
|
||||
break;
|
||||
case (SF_FORMAT_PCM_U8 + 2 << 16):
|
||||
sound->format = AL_FORMAT_STEREO8;
|
||||
pcmbitwidth = 8;
|
||||
break;
|
||||
case (SF_FORMAT_PCM_16 + 1 << 16):
|
||||
sound->format = AL_FORMAT_MONO16;
|
||||
pcmbitwidth = 16;
|
||||
break;
|
||||
case (SF_FORMAT_PCM_16 + 2 << 16):
|
||||
sound->format = AL_FORMAT_STEREO16;
|
||||
pcmbitwidth = 16;
|
||||
break;
|
||||
default:
|
||||
printf("Unknown sample format in %s.\n", filename);
|
||||
sf_close(file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
> /* Allocate buffers. */
|
||||
> buffer_short = (short *)malloc(file_info.samples *
|
||||
> file_info.channels *
|
||||
> sizeof (short));
|
||||
>
|
||||
> buffer_8 = (u_int8_t *)malloc(file_info.samples *
|
||||
> file_info.channels *
|
||||
> file_info.pcmbitwidth / 8);
|
||||
|
||||
Use pcmbitwidth as calculated above.
|
||||
|
||||
> buffer_16 = (int16_t *)buffer_8;
|
||||
>
|
||||
> if (buffer_short == NULL || buffer_8 == NULL) {
|
||||
> printf("Unable to allocate enough memory for '%s'.\n", filename);
|
||||
> goto error_cleanup;
|
||||
> }
|
||||
>
|
||||
> /* Read the entire sound file. */
|
||||
> if (sf_readf_short(file,buffer_short,file_info.samples) == (size_t)- 1) {
|
||||
|
||||
Replace "(size_t) - 1" with " < 0".
|
||||
|
||||
> As you can see, the PCM material in the listing will not currently
|
||||
> compile and for the other sndfile material, it probably won't either.
|
||||
|
||||
None of the changes above should have been very difficult to figure
|
||||
out.
|
||||
|
||||
Erik
|
||||
--
|
||||
+-----------------------------------------------------------+
|
||||
Erik de Castro Lopo nospam@fake-domain-name.com
|
||||
+-----------------------------------------------------------+
|
||||
Microsoft is finally bringing all of its Windows operating system families
|
||||
under one roof. It will combine all of the features of CE, stability and
|
||||
support of ME and the speed of NT.
|
||||
It will be called Windows CEMENT...
|
||||
|
||||
27
Engine/lib/libsndfile/docs/lists.md
Normal file
27
Engine/lib/libsndfile/docs/lists.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
layout: page
|
||||
title: libsndfile Mailing Lists
|
||||
---
|
||||
|
||||
# libsndfile Mailing Lists
|
||||
|
||||
**Note**: These mailing lists are not maintained by the libsndfile team anymore.
|
||||
Use [GitHub issues and pull requests instead](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests).
|
||||
|
||||
There are three mailing lists for libsndfile:
|
||||
|
||||
- **libsndfile-announce@mega-nerd.com**
|
||||
[Subscribe](mailto:libsndfile-announce-request@mega-nerd.com?subject=subscribe)
|
||||
A list which will announce each new release of libsndfile. No one can
|
||||
post to this list except the author.
|
||||
- **libsndfile-devel@mega-nerd.com**
|
||||
[Subscribe](mailto:libsndfile-devel-request@mega-nerd.com?subject=subscribe)
|
||||
A list for discussing bugs, porting issues and feature requests.
|
||||
Posting is restricted to subscribers.
|
||||
- **libsndfile-users@mega-nerd.com**
|
||||
[Subscribe](mailto:libsndfile-users-request@mega-nerd.com?subject=subscribe)
|
||||
A list for discussing the use of libsndfile in other programs.
|
||||
Posting is restricted to subscribers.
|
||||
|
||||
The libsndfile-devel and libsndfile-users list will automatically receive a copy
|
||||
of all emails to the libsndfile-announce list.
|
||||
134
Engine/lib/libsndfile/docs/new_file_type_howto.md
Normal file
134
Engine/lib/libsndfile/docs/new_file_type_howto.md
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
---
|
||||
layout: page
|
||||
---
|
||||
|
||||
# How to add new file format
|
||||
|
||||
Original : Wed May 23 19:05:07 EST 2001
|
||||
Update 1 : Fri Jul 11 22:12:38 EST 2003
|
||||
|
||||
This document will attempt to explain as fully as possible how to add code to
|
||||
libsndfile to allow the reading and writing of new file types. By new file
|
||||
type I particularly mean a new header type rather than a new encoding method
|
||||
for an existing file type.
|
||||
|
||||
This HOWTO will take the form of a step by step guide. It will assume that you
|
||||
have all required tools including :
|
||||
|
||||
- gcc
|
||||
- make (should really be the GNU version)
|
||||
- autoconf
|
||||
- automake
|
||||
- libtool
|
||||
|
||||
These should all be available on the GNU ftp site: <ftp://ftp.gnu.org/pub/gnu/>.
|
||||
|
||||
To help make these steps clearer let's suppose we are adding support for the
|
||||
Whacky file format whose files contain 'W','A','C' and 'K' as the first four
|
||||
bytes of the file format. Lets also assume that Whacky files contain PCM encoded
|
||||
data.
|
||||
|
||||
## Step 1
|
||||
|
||||
Create a new .c file in the src/ directory of the libsndfile source tree. The
|
||||
file name should be reasonable descriptive so that is is obvious that files of
|
||||
the new type are handled by this file. In this particular case the file might
|
||||
be named 'whacky.c'.
|
||||
|
||||
## Step 2
|
||||
|
||||
Add your new source code file to the build process.
|
||||
|
||||
Edit the file src/Makefile.am and add the name of your file handler to the
|
||||
FILESPECIFIC list of handlers. This list looks something like this:
|
||||
|
||||
FILESPECIFIC = aiff.c au.c au_g72x.c nist.c paf.c raw.c samplitude.c \
|
||||
svx.c wav.c wav_float.c wav_gsm610.c wav_ima_adpcm.c \
|
||||
wav_ms_adpcm.c
|
||||
|
||||
Then, run the script named 'reconf' in the libsndfile top level directory,
|
||||
which will run autoconf and other associated tools. Finally run "./configure"
|
||||
in the top level directory. You may want to use the "--disable-gcc-opt" option
|
||||
to disable gcc optimisations and make debugging with gdb/ddd easier.
|
||||
|
||||
## Step 3
|
||||
|
||||
Add a unique identifier for the new file type.
|
||||
|
||||
Edit src/sndfile.h and find the enum containing the SF_FORMAT_XXX identifiers.
|
||||
Since you will be adding a major file type you should add your identifier to the
|
||||
top part of the list where the values are above 0x10000 in value. The easiest
|
||||
way to do this is to find the largest value in the list, add 0x10000 to it and
|
||||
make that your new identifier value. The identifier should be something like
|
||||
SF_FORMAT_WACK.
|
||||
|
||||
## Step 4
|
||||
|
||||
Add code to the file type recogniser function.
|
||||
|
||||
Edit src/sndfile.c and find the function guess_file_type (). This function
|
||||
reads the first 3 ints of the file and from that makes a guess at the file
|
||||
type. In our case we would add:
|
||||
|
||||
if (buffer [0] == MAKE_MARKER ('W','A','C','K'))
|
||||
return SF_FORMAT_WACK ;
|
||||
|
||||
The use of the MAKE_MARKER macro should be pretty obvious and it is defined at
|
||||
the top of file should you need to have a look at it.
|
||||
|
||||
## Step 5
|
||||
|
||||
Add a call to your open function from psf_open_file ().
|
||||
|
||||
Edit src/sndfile.c and find the switch statement in psf_open_file (). It starts
|
||||
like this:
|
||||
|
||||
switch (filetype)
|
||||
{ case SF_FORMAT_WAV :
|
||||
error = wav_open (psf) ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_AIFF :
|
||||
error = aiff_open (psf) ;
|
||||
break ;
|
||||
|
||||
Towards the bottom of this switch statement your should add one for the new file
|
||||
type. Something like:
|
||||
|
||||
case SF_FORMAT_WACK :
|
||||
sf_errno = whacky_open (psf) ;
|
||||
break ;
|
||||
|
||||
## Step 6
|
||||
|
||||
Add prototypes for new open read and open write functions.
|
||||
|
||||
Edit src/common.h, go to the bottom of the file and add something like
|
||||
|
||||
int whacky_open (SF_PRIVATE *psf) ;
|
||||
|
||||
## Step 7
|
||||
|
||||
Implement your open read function. The best way to do this is by coding
|
||||
something much like one of the other file formats. The file src/au.c might be a
|
||||
good place to start.
|
||||
|
||||
In src/whacky.c you should now implement the function whacky_open() which
|
||||
was prototyped in src/common.h. This function should return 0 on success and
|
||||
a non-zero number on error.
|
||||
|
||||
Error values are defined in src/common.h in a enum which starts at SFE_NO_ERROR.
|
||||
When adding a new error value, you also need to add an error string to the
|
||||
SndfileErrors array in src/sndfile.c.
|
||||
|
||||
To parse the header of your new file type you should avoid using standard read/
|
||||
write/seek functions (and the fread/fwrite/fseek etc) and instead use
|
||||
psf_binheader_readf () which is implemented and documented in src/common.h.
|
||||
|
||||
During the parsing process, you should also print logging information to
|
||||
libsndfile's internal log buffer using the psf_log_printf() function.
|
||||
|
||||
At the end of the open read process, you should have set a number of fields in
|
||||
the SF_PRIVATE structure pointed to by psf.
|
||||
|
||||
**THIS FILE IS INCOMPLETE**
|
||||
71
Engine/lib/libsndfile/docs/octave.md
Normal file
71
Engine/lib/libsndfile/docs/octave.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
layout: page
|
||||
---
|
||||
|
||||
# libsndfile and GNU Octave
|
||||
|
||||
[GNU Octave](http://www.octave.org/) is a high-level interactive language for
|
||||
numerical computations. There are currently two development streams, a stable
|
||||
2.0.X series and a development 2.1.X series. Octave reads and writes data in
|
||||
binary formats that were originally developed for
|
||||
[MATLAB](http://www.mathworks.com/). Version 2.0.X of Octave uses binary data
|
||||
files compatible with MATLAB version 4.2 while Octave 2.1.X uses binary data
|
||||
files compatible with MATLAB version 5.0 as well as being able to read the older
|
||||
MATLAB 4.2 format.
|
||||
|
||||
From version 1.0.1 of libsndfile onwards, libsndfile has the ability of reading
|
||||
and writing a small subset of the binary data files used by both versions of GNU
|
||||
Octave. This gives people using GNU Octave for audio based work an easy method
|
||||
of moving audio data between GNU Octave and other programs which use libsndfile.
|
||||
|
||||
For instance it is now possible to do the following:
|
||||
|
||||
* Load a WAV file into a sound file editor such as
|
||||
[Sweep](http://www.metadecks.org/software/sweep/).
|
||||
* Save it as a MAT4 file.
|
||||
* Load the data into Octave for manipulation.
|
||||
* Save the modified data.
|
||||
* Reload it in Sweep.
|
||||
|
||||
Another example would be using the MAT4 or MAT5 file formats as a format which
|
||||
can be easily loaded into Octave for viewing/analyzing as well as a format which
|
||||
can be played with command line players such as the one included with
|
||||
libsndfile.
|
||||
|
||||
## Details
|
||||
|
||||
Octave, like most programming languages, uses variables to store data, and
|
||||
Octave variables can contain both arrays and matrices. It is also able to store
|
||||
one or more of these variables in a file. When reading Octave files, libsndfile
|
||||
expects a file to contain two variables and their associated data. The first
|
||||
variable should contain a variable holding the file sample rate while the second
|
||||
variable contains the audio data.
|
||||
|
||||
For example, to generate a sine wave and store it as a binary file which is
|
||||
compatible with libsndfile, do the following:
|
||||
|
||||
octave:1 > samplerate = 44100 ;
|
||||
octave:2 > wavedata = sin ((0:1023)*2*pi/1024) ;
|
||||
octave:3 > save sine.mat samplerate wavedata
|
||||
|
||||
The process of reading and writing files compatible with libsndfile can be made
|
||||
easier by use of two Octave script files:
|
||||
|
||||
octave:4 > [data fs] = sndfile_load ("sine.mat") ;
|
||||
octave:5 > sndfile_save ("sine2.mat", data, fs) ;
|
||||
|
||||
In addition, libsndfile contains a command line program which which is able to
|
||||
play the correct types of Octave files. Using this command line player
|
||||
**sndfile-play** and a third Octave script file allows Octave data to be played
|
||||
from within Octave on any of the platforms which **sndfile-play** supports (at
|
||||
the moment: Linux, MacOS X, Solaris and Win32).
|
||||
|
||||
octave:6 > sndfile_play (data, fs) ;
|
||||
|
||||
These three Octave scripts are installed automatically in Octave's site script
|
||||
directory when libsndfile is installed (except on Win32) ie when libsndfile is
|
||||
being installed into /usr/local, the Octave scripts will be installed in
|
||||
/usr/local/share/octave/site/m/.
|
||||
|
||||
There are some other Octave scripts for audio to be found
|
||||
[here](http://octave.sourceforge.net/audio/index.html).
|
||||
14
Engine/lib/libsndfile/docs/print.css
Normal file
14
Engine/lib/libsndfile/docs/print.css
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
body {
|
||||
background:white;
|
||||
color:black;
|
||||
}
|
||||
|
||||
h1{
|
||||
background:white;
|
||||
color:black;
|
||||
}
|
||||
|
||||
h2 {
|
||||
background:white;
|
||||
color:#666;
|
||||
}
|
||||
36
Engine/lib/libsndfile/docs/sndfile_info.md
Normal file
36
Engine/lib/libsndfile/docs/sndfile_info.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
layout: page
|
||||
title: sndfile-info
|
||||
---
|
||||
|
||||
Here is an example of the output from the **sndfile-info** program
|
||||
distributed with libsndfile.
|
||||
|
||||
This file was opened and parsed correctly but had been truncated so that
|
||||
the values in the **FORM** and **SSND** chunks were incorrect.
|
||||
|
||||
```
|
||||
erikd@hendrix > examples/sndfile-info truncated.aiff
|
||||
truncated.aiff
|
||||
size : 200000
|
||||
FORM : 307474 (should be 199992)
|
||||
AIFF
|
||||
COMM : 18
|
||||
Sample Rate : 16000
|
||||
Samples : 76857
|
||||
Channels : 2
|
||||
Sample Size : 16
|
||||
SSND : 307436 (should be 199946)
|
||||
Offset : 0
|
||||
Block Size : 0
|
||||
|
||||
--------------------------------
|
||||
Sample Rate : 16000
|
||||
Frames : 76857
|
||||
Channels : 2
|
||||
Bit Width : 16
|
||||
Format : 0x00020001
|
||||
Sections : 1
|
||||
Seekable : TRUE
|
||||
Signal Max : 32766
|
||||
```
|
||||
10
Engine/lib/libsndfile/docs/tutorial.md
Normal file
10
Engine/lib/libsndfile/docs/tutorial.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
layout: page
|
||||
---
|
||||
|
||||
# libsndfile Tutorial
|
||||
|
||||
**More coming soon.**
|
||||
|
||||
For now, the best place to look for example code is the `examples/` directory of the source code distribution and the
|
||||
libsndfile test suite which is located in the `tests/` directory of the source code distribution.
|
||||
18
Engine/lib/libsndfile/docs/win32.md
Normal file
18
Engine/lib/libsndfile/docs/win32.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
layout: page
|
||||
---
|
||||
|
||||
# Building libsndfile on Win32
|
||||
|
||||
**Note : For pre-compiled binaries for windows, both for win32 and win64, see
|
||||
the main web page.**
|
||||
|
||||
There are currently two build systems; the official GNU autotool based one and
|
||||
a more limited and experimental CMake based build system.
|
||||
|
||||
libsndfile is written to be compiled by a compiler which supports large chunks
|
||||
of the 1999 ISO C Standard (tested with GCC, Clang and Visual Studio 2015).
|
||||
|
||||
It is recommended to use CMake and Visual Studio to build libsndfile on Windows
|
||||
but you can try the [MinGW](http://www.mingw.org/) compiler suite with Autotools
|
||||
or CMake buildsystem.
|
||||
131
Engine/lib/libsndfile/examples/generate.c
Normal file
131
Engine/lib/libsndfile/examples/generate.c
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define BUFFER_LEN 4096
|
||||
|
||||
static void encode_file (const char *infilename, const char *outfilename, int filetype) ;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
{ puts ("\nEncode a single input file into a number of different output ") ;
|
||||
puts ("encodings. These output encodings can then be moved to another ") ;
|
||||
puts ("OS for testing.\n") ;
|
||||
puts (" Usage : generate <filename>\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* A couple of standard WAV files. Make sure Win32 plays these. */
|
||||
encode_file (argv [1], "pcmu8.wav" , SF_FORMAT_WAV | SF_FORMAT_PCM_U8) ;
|
||||
encode_file (argv [1], "pcm16.wav" , SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
|
||||
encode_file (argv [1], "imaadpcm.wav", SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ;
|
||||
encode_file (argv [1], "msadpcm.wav", SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ;
|
||||
encode_file (argv [1], "gsm610.wav" , SF_FORMAT_WAV | SF_FORMAT_GSM610) ;
|
||||
|
||||
/* Soundforge W64. */
|
||||
encode_file (argv [1], "pcmu8.w64" , SF_FORMAT_W64 | SF_FORMAT_PCM_U8) ;
|
||||
encode_file (argv [1], "pcm16.w64" , SF_FORMAT_W64 | SF_FORMAT_PCM_16) ;
|
||||
encode_file (argv [1], "imaadpcm.w64", SF_FORMAT_W64 | SF_FORMAT_MS_ADPCM) ;
|
||||
encode_file (argv [1], "msadpcm.w64", SF_FORMAT_W64 | SF_FORMAT_IMA_ADPCM) ;
|
||||
encode_file (argv [1], "gsm610.w64" , SF_FORMAT_W64 | SF_FORMAT_GSM610) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*============================================================================================
|
||||
** Helper functions and macros.
|
||||
*/
|
||||
|
||||
#define PUT_DOTS(k) \
|
||||
{ while (k--) \
|
||||
putchar ('.') ; \
|
||||
putchar (' ') ; \
|
||||
}
|
||||
|
||||
/*========================================================================================
|
||||
*/
|
||||
|
||||
static void
|
||||
encode_file (const char *infilename, const char *outfilename, int filetype)
|
||||
{ static float buffer [BUFFER_LEN] ;
|
||||
|
||||
SNDFILE *infile, *outfile ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, readcount ;
|
||||
|
||||
printf (" %s -> %s ", infilename, outfilename) ;
|
||||
fflush (stdout) ;
|
||||
|
||||
k = 16 - strlen (outfilename) ;
|
||||
PUT_DOTS (k) ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
|
||||
{ printf ("Error : could not open file : %s\n", infilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
}
|
||||
|
||||
sfinfo.format = filetype ;
|
||||
|
||||
if (! sf_format_check (&sfinfo))
|
||||
{ sf_close (infile) ;
|
||||
printf ("Invalid encoding\n") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
|
||||
{ printf ("Error : could not open file : %s\n", outfilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
while ((readcount = (int) sf_read_float (infile, buffer, BUFFER_LEN)) > 0)
|
||||
sf_write_float (outfile, buffer, readcount) ;
|
||||
|
||||
sf_close (infile) ;
|
||||
sf_close (outfile) ;
|
||||
|
||||
printf ("ok\n") ;
|
||||
|
||||
return ;
|
||||
} /* encode_file */
|
||||
|
||||
250
Engine/lib/libsndfile/examples/generate.cs
Normal file
250
Engine/lib/libsndfile/examples/generate.cs
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
/* (c) 2004 James Robson, http://www.arbingersys.com
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** ****************************
|
||||
**
|
||||
** How to use:
|
||||
** - libsndfile.dll must have already been compiled and be in this
|
||||
** application's search path
|
||||
**
|
||||
** - You must edit this file to point to the file you want to convert. Set
|
||||
** the following line of code (found in the Main() function further below)
|
||||
** to the name of a .WAV file that exists on your system.
|
||||
** 186: string sfn = "input.wav";
|
||||
**
|
||||
** - From a command prompt type
|
||||
** csc generate.cs
|
||||
**
|
||||
** - Run the resulting executable 'generate.exe'
|
||||
**
|
||||
**
|
||||
** Note: You will obviously need the csc compiler and the .NET runtime. I think
|
||||
** these are freely available for download from Microsoft's website
|
||||
** (part of the .NET SDK?).
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using sf_count_t = System.Int64; //alias; see SF_INFO struct
|
||||
|
||||
#if PLATFORM_64
|
||||
using size_t = System.UInt64;
|
||||
#else
|
||||
using size_t = System.UInt32;
|
||||
#endif
|
||||
|
||||
|
||||
class lsndf_example {
|
||||
|
||||
|
||||
//sound file formats
|
||||
public enum lsndf_frmts {
|
||||
SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian). */
|
||||
SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */
|
||||
SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */
|
||||
SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */
|
||||
SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */
|
||||
SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */
|
||||
SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */
|
||||
SF_FORMAT_VOC = 0x080000, /* VOC files. */
|
||||
SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */
|
||||
SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */
|
||||
SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */
|
||||
SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */
|
||||
SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */
|
||||
SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */
|
||||
SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */
|
||||
SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */
|
||||
|
||||
/* Subtypes from here on. */
|
||||
|
||||
SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */
|
||||
SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */
|
||||
SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */
|
||||
SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */
|
||||
|
||||
SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */
|
||||
|
||||
SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */
|
||||
SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */
|
||||
|
||||
SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */
|
||||
SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */
|
||||
SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */
|
||||
SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */
|
||||
|
||||
SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */
|
||||
SF_FORMAT_VOX_ADPCM = 0x0021, /* OKI / Dialogix ADPCM */
|
||||
|
||||
SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */
|
||||
SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */
|
||||
SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */
|
||||
|
||||
SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */
|
||||
|
||||
SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */
|
||||
SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */
|
||||
|
||||
|
||||
/* Endian-ness options. */
|
||||
|
||||
SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */
|
||||
SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */
|
||||
SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */
|
||||
SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */
|
||||
|
||||
SF_FORMAT_SUBMASK = 0x0000FFFF,
|
||||
SF_FORMAT_TYPEMASK = 0x0FFF0000,
|
||||
SF_FORMAT_ENDMASK = 0x30000000
|
||||
}
|
||||
|
||||
|
||||
//modes and other
|
||||
public enum lsndf_tf
|
||||
{ /* True and false */
|
||||
SF_FALSE = 0,
|
||||
SF_TRUE = 1,
|
||||
|
||||
/* Modes for opening files. */
|
||||
SFM_READ = 0x10,
|
||||
SFM_WRITE = 0x20,
|
||||
SFM_RDWR = 0x30
|
||||
}
|
||||
|
||||
|
||||
//important SF_INFO structure
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct SF_INFO
|
||||
{
|
||||
public sf_count_t frames ; // Used to be called samples. Changed to avoid confusion.
|
||||
public int samplerate ;
|
||||
public int channels ;
|
||||
public int format ;
|
||||
public int sections ;
|
||||
public int seekable ;
|
||||
};
|
||||
|
||||
|
||||
//function declarations
|
||||
//Note: Not all functions have been prototyped here. Only the ones necessary to
|
||||
// make this application work. The below code should give some clues as to
|
||||
// how to add the rest since they have a lot of parameter and return type
|
||||
// similarities.
|
||||
[DllImport("libsndfile.dll")]
|
||||
public static extern IntPtr sf_open ([MarshalAs(UnmanagedType.LPStr)] string path, int mode, ref SF_INFO sfinfo);
|
||||
|
||||
[DllImport("libsndfile.dll")]
|
||||
static extern int sf_error (IntPtr sndfile);
|
||||
|
||||
[DllImport("libsndfile.dll")]
|
||||
static extern IntPtr sf_strerror (IntPtr sndfile);
|
||||
|
||||
[DllImport("libsndfile.dll")]
|
||||
static extern int sf_format_check (ref SF_INFO info);
|
||||
|
||||
[DllImport("libsndfile.dll")]
|
||||
static extern sf_count_t sf_read_float (IntPtr sndfile, float[] ptr, sf_count_t items);
|
||||
|
||||
[DllImport("libsndfile.dll")]
|
||||
static extern sf_count_t sf_write_float (IntPtr sndfile, float[] ptr, sf_count_t items);
|
||||
|
||||
[DllImport("libsndfile.dll")]
|
||||
static extern int sf_close (IntPtr sndfile);
|
||||
|
||||
|
||||
public const sf_count_t BUFFER_LEN = 4096;
|
||||
|
||||
|
||||
//program entry
|
||||
static void Main( ) {
|
||||
|
||||
|
||||
//declarations
|
||||
SF_INFO sfinfo = new SF_INFO();
|
||||
float[] buffer = new float[BUFFER_LEN];
|
||||
sf_count_t rcnt;
|
||||
|
||||
//set the input file
|
||||
string sfn = "input.wav"; //set to a file on YOUR system
|
||||
//string sfn = "noexist.wav"; //test with non-existent file
|
||||
|
||||
//set the output file
|
||||
string ofn = "output.wav";
|
||||
|
||||
//read in sound file to convert
|
||||
IntPtr infile = sf_open (sfn, (int)lsndf_tf.SFM_READ, ref sfinfo);
|
||||
|
||||
//exit if error was thrown
|
||||
if ( (int)infile == 0 ) {
|
||||
Console.WriteLine("Error opening " + sfn);
|
||||
Console.WriteLine("Error #" + sf_error(infile));
|
||||
return;
|
||||
}
|
||||
|
||||
//set the file type for the output file
|
||||
//uncomment one and only one of the statements below to change the output
|
||||
//file encoding.
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_PCM_U8);
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_PCM_16);
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_MS_ADPCM);
|
||||
sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_IMA_ADPCM);
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_GSM610);
|
||||
/* Soundforge W64. */
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_PCM_U8);
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_PCM_16);
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_MS_ADPCM);
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_IMA_ADPCM);
|
||||
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_GSM610);
|
||||
|
||||
|
||||
//check that SF_INFO is valid
|
||||
if ( sf_format_check(ref sfinfo) == 0 ) {
|
||||
Console.WriteLine("sf_format_check failed. Invalid encoding");
|
||||
return;
|
||||
}
|
||||
|
||||
//open output file
|
||||
IntPtr outfile = sf_open (ofn, (int)lsndf_tf.SFM_WRITE, ref sfinfo);
|
||||
|
||||
//exit if error was thrown
|
||||
if ( (int)outfile == 0 ) {
|
||||
Console.WriteLine("Error opening " + ofn);
|
||||
Console.WriteLine("Error #" + sf_error(outfile));
|
||||
return;
|
||||
}
|
||||
|
||||
//infile -> outfile
|
||||
Console.Write(sfn + " -> " + ofn);
|
||||
while ( (rcnt = sf_read_float (infile, buffer, BUFFER_LEN)) > 0) {
|
||||
Console.Write(".");
|
||||
sf_write_float (outfile, buffer, BUFFER_LEN);
|
||||
}
|
||||
Console.WriteLine("done.");
|
||||
|
||||
//close up shop
|
||||
sf_close(infile);
|
||||
sf_close(outfile);
|
||||
|
||||
|
||||
} //main()
|
||||
|
||||
|
||||
} //class lsndf_example {}
|
||||
|
||||
76
Engine/lib/libsndfile/examples/list_formats.c
Normal file
76
Engine/lib/libsndfile/examples/list_formats.c
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
** Copyright (C) 2001-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{ SF_FORMAT_INFO info ;
|
||||
SF_INFO sfinfo ;
|
||||
int format, major_count, subtype_count, m, s ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
printf ("Version : %s\n\n", sf_version_string ()) ;
|
||||
|
||||
sf_command (NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof (int)) ;
|
||||
sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)) ;
|
||||
|
||||
sfinfo.channels = 1 ;
|
||||
for (m = 0 ; m < major_count ; m++)
|
||||
{ info.format = m ;
|
||||
sf_command (NULL, SFC_GET_FORMAT_MAJOR, &info, sizeof (info)) ;
|
||||
printf ("%s (extension \"%s\")\n", info.name, info.extension) ;
|
||||
|
||||
format = info.format ;
|
||||
|
||||
for (s = 0 ; s < subtype_count ; s++)
|
||||
{ info.format = s ;
|
||||
sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &info, sizeof (info)) ;
|
||||
|
||||
format = (format & SF_FORMAT_TYPEMASK) | info.format ;
|
||||
|
||||
sfinfo.format = format ;
|
||||
if (sf_format_check (&sfinfo))
|
||||
printf (" %s\n", info.name) ;
|
||||
} ;
|
||||
puts ("") ;
|
||||
} ;
|
||||
puts ("") ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
100
Engine/lib/libsndfile/examples/make_sine.c
Normal file
100
Engine/lib/libsndfile/examples/make_sine.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846264338
|
||||
#endif
|
||||
|
||||
#define SAMPLE_RATE 44100
|
||||
#define SAMPLE_COUNT (SAMPLE_RATE * 4) /* 4 seconds */
|
||||
#define AMPLITUDE (1.0 * 0x7F000000)
|
||||
#define LEFT_FREQ (344.0 / SAMPLE_RATE)
|
||||
#define RIGHT_FREQ (466.0 / SAMPLE_RATE)
|
||||
|
||||
int
|
||||
main (void)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k ;
|
||||
int *buffer ;
|
||||
|
||||
if (! (buffer = malloc (2 * SAMPLE_COUNT * sizeof (int))))
|
||||
{ printf ("Error : Malloc failed.\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
sfinfo.samplerate = SAMPLE_RATE ;
|
||||
sfinfo.frames = SAMPLE_COUNT ;
|
||||
sfinfo.channels = 2 ;
|
||||
sfinfo.format = (SF_FORMAT_WAV | SF_FORMAT_PCM_24) ;
|
||||
|
||||
if (! (file = sf_open ("sine.wav", SFM_WRITE, &sfinfo)))
|
||||
{ printf ("Error : Not able to open output file.\n") ;
|
||||
free (buffer) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.channels == 1)
|
||||
{ for (k = 0 ; k < SAMPLE_COUNT ; k++)
|
||||
buffer [k] = (int) (AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI)) ;
|
||||
}
|
||||
else if (sfinfo.channels == 2)
|
||||
{ for (k = 0 ; k < SAMPLE_COUNT ; k++)
|
||||
{ buffer [2 * k] = (int) (AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI)) ;
|
||||
buffer [2 * k + 1] = (int) (AMPLITUDE * sin (RIGHT_FREQ * 2 * k * M_PI)) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
{ printf ("Error : make_sine can only generate mono or stereo files.\n") ;
|
||||
sf_close (file) ;
|
||||
free (buffer) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (sf_write_int (file, buffer, sfinfo.channels * SAMPLE_COUNT) !=
|
||||
sfinfo.channels * SAMPLE_COUNT)
|
||||
puts (sf_strerror (file)) ;
|
||||
|
||||
sf_close (file) ;
|
||||
free (buffer) ;
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
144
Engine/lib/libsndfile/examples/sfprocess.c
Normal file
144
Engine/lib/libsndfile/examples/sfprocess.c
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
** Copyright (C) 2001-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Include this header file to use functions from libsndfile. */
|
||||
#include <sndfile.h>
|
||||
|
||||
/* This will be the length of the buffer used to hold.frames while
|
||||
** we process them.
|
||||
*/
|
||||
#define BUFFER_LEN 1024
|
||||
|
||||
/* libsndfile can handle more than 6 channels but we'll restrict it to 6. */
|
||||
#define MAX_CHANNELS 6
|
||||
|
||||
/* Function prototype. */
|
||||
static void process_data (double *data, int count, int channels) ;
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{ /* This is a buffer of double precision floating point values
|
||||
** which will hold our data while we process it.
|
||||
*/
|
||||
static double data [BUFFER_LEN] ;
|
||||
|
||||
/* A SNDFILE is very much like a FILE in the Standard C library. The
|
||||
** sf_open function return an SNDFILE* pointer when they sucessfully
|
||||
** open the specified file.
|
||||
*/
|
||||
SNDFILE *infile, *outfile ;
|
||||
|
||||
/* A pointer to an SF_INFO struct is passed to sf_open.
|
||||
** On read, the library fills this struct with information about the file.
|
||||
** On write, the struct must be filled in before calling sf_open.
|
||||
*/
|
||||
SF_INFO sfinfo ;
|
||||
int readcount ;
|
||||
const char *infilename = "input.wav" ;
|
||||
const char *outfilename = "output.wav" ;
|
||||
|
||||
/* The SF_INFO struct must be initialized before using it.
|
||||
*/
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
/* Here's where we open the input file. We pass sf_open the file name and
|
||||
** a pointer to an SF_INFO struct.
|
||||
** On successful open, sf_open returns a SNDFILE* pointer which is used
|
||||
** for all subsequent operations on that file.
|
||||
** If an error occurs during sf_open, the function returns a NULL pointer.
|
||||
**
|
||||
** If you are trying to open a raw headerless file you will need to set the
|
||||
** format and channels fields of sfinfo before calling sf_open(). For
|
||||
** instance to open a raw 16 bit stereo PCM file you would need the following
|
||||
** two lines:
|
||||
**
|
||||
** sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16 ;
|
||||
** sfinfo.channels = 2 ;
|
||||
*/
|
||||
if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
|
||||
{ /* Open failed so print an error message. */
|
||||
printf ("Not able to open input file %s.\n", infilename) ;
|
||||
/* Print the error message from libsndfile. */
|
||||
puts (sf_strerror (NULL)) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.channels > MAX_CHANNELS)
|
||||
{ printf ("Not able to process more than %d channels\n", MAX_CHANNELS) ;
|
||||
sf_close (infile) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
/* Open the output file. */
|
||||
if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
|
||||
{ printf ("Not able to open output file %s.\n", outfilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
sf_close (infile) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
/* While there are.frames in the input file, read them, process
|
||||
** them and write them to the output file.
|
||||
*/
|
||||
while ((readcount = (int) sf_read_double (infile, data, BUFFER_LEN)))
|
||||
{ process_data (data, readcount, sfinfo.channels) ;
|
||||
sf_write_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
/* Close input and output files. */
|
||||
sf_close (infile) ;
|
||||
sf_close (outfile) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
static void
|
||||
process_data (double *data, int count, int channels)
|
||||
{ double channel_gain [MAX_CHANNELS] = { 0.5, 0.8, 0.1, 0.4, 0.4, 0.9 } ;
|
||||
int k, chan ;
|
||||
|
||||
/* Process the data here.
|
||||
** If the soundfile contains more then 1 channel you need to take care of
|
||||
** the data interleaving youself.
|
||||
** Current we just apply a channel dependant gain.
|
||||
*/
|
||||
|
||||
for (chan = 0 ; chan < channels ; chan ++)
|
||||
for (k = chan ; k < count ; k+= channels)
|
||||
data [k] *= channel_gain [chan] ;
|
||||
|
||||
return ;
|
||||
} /* process_data */
|
||||
|
||||
175
Engine/lib/libsndfile/examples/sndfile-loopify.c
Normal file
175
Engine/lib/libsndfile/examples/sndfile-loopify.c
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2015 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
** A quick/rough hack to add SF_INSTRUMENT data to a file. It compiles, but
|
||||
** no guarantees beyond that. Happy to receive patches to fix/improve it.
|
||||
**
|
||||
** Code for this was stolen from programs/sndfile-convert.c and related code.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define BUFFER_LEN (1 << 14)
|
||||
|
||||
const char * program_name (const char * argv0) ;
|
||||
static void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
||||
static void add_instrument_data (SNDFILE *outfile, const SF_INFO * in_info) ;
|
||||
|
||||
static void
|
||||
usage_exit (const char *progname)
|
||||
{
|
||||
printf ("\nUsage : %s <input file> <output file>\n", progname) ;
|
||||
puts ("") ;
|
||||
exit (1) ;
|
||||
} /* usage_exit */
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{ const char *progname, *infilename, *outfilename ;
|
||||
SNDFILE *infile = NULL, *outfile = NULL ;
|
||||
SF_INFO in_sfinfo, out_sfinfo ;
|
||||
|
||||
progname = program_name (argv [0]) ;
|
||||
|
||||
if (argc < 3 || argc > 5)
|
||||
usage_exit (progname) ;
|
||||
|
||||
infilename = argv [argc-2] ;
|
||||
outfilename = argv [argc-1] ;
|
||||
|
||||
if (strcmp (infilename, outfilename) == 0)
|
||||
{ printf ("Error : Input and output filenames are the same.\n\n") ;
|
||||
usage_exit (progname) ;
|
||||
} ;
|
||||
|
||||
if (strlen (infilename) > 1 && infilename [0] == '-')
|
||||
{ printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
|
||||
usage_exit (progname) ;
|
||||
} ;
|
||||
|
||||
if (outfilename [0] == '-')
|
||||
{ printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
|
||||
usage_exit (progname) ;
|
||||
} ;
|
||||
|
||||
memset (&in_sfinfo, 0, sizeof (in_sfinfo)) ;
|
||||
|
||||
if ((infile = sf_open (infilename, SFM_READ, &in_sfinfo)) == NULL)
|
||||
{ printf ("Not able to open input file %s.\n", infilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
memcpy (&out_sfinfo, &in_sfinfo, sizeof (out_sfinfo)) ;
|
||||
/* Open the output file. */
|
||||
if ((outfile = sf_open (outfilename, SFM_WRITE, &out_sfinfo)) == NULL)
|
||||
{ printf ("Not able to open output file %s : %s\n", outfilename, sf_strerror (NULL)) ;
|
||||
sf_close (infile) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
/* Add the loop data */
|
||||
add_instrument_data (outfile, &in_sfinfo) ;
|
||||
|
||||
/* Copy the audio data */
|
||||
sfe_copy_data_int (outfile, infile, in_sfinfo.channels) ;
|
||||
|
||||
sf_close (infile) ;
|
||||
sf_close (outfile) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
const char *
|
||||
program_name (const char * argv0)
|
||||
{ const char * tmp ;
|
||||
|
||||
tmp = strrchr (argv0, '/') ;
|
||||
argv0 = tmp ? tmp + 1 : argv0 ;
|
||||
|
||||
/* Remove leading libtool name mangling. */
|
||||
if (strstr (argv0, "lt-") == argv0)
|
||||
return argv0 + 3 ;
|
||||
|
||||
return argv0 ;
|
||||
} /* program_name */
|
||||
|
||||
static void
|
||||
sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
{ static int data [BUFFER_LEN] ;
|
||||
int frames, readcount ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = (int) sf_readf_int (infile, data, frames) ;
|
||||
sf_writef_int (outfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* sfe_copy_data_int */
|
||||
|
||||
static void
|
||||
add_instrument_data (SNDFILE *file, const SF_INFO *info)
|
||||
{ SF_INSTRUMENT instr ;
|
||||
|
||||
memset (&instr, 0, sizeof (instr)) ;
|
||||
|
||||
instr.gain = 1 ;
|
||||
instr.basenote = 0 ;
|
||||
instr.detune = 0 ;
|
||||
instr.velocity_lo = 0 ;
|
||||
instr.velocity_hi = 0 ;
|
||||
instr.key_lo = 0 ;
|
||||
instr.key_hi = 0 ;
|
||||
instr.loop_count = 1 ;
|
||||
|
||||
instr.loops [0].mode = SF_LOOP_FORWARD ;
|
||||
instr.loops [0].start = 0 ;
|
||||
instr.loops [0].end = info->frames ;
|
||||
instr.loops [0].count = 0 ;
|
||||
|
||||
if (sf_command (file, SFC_SET_INSTRUMENT, &instr, sizeof (instr)) == SF_FALSE)
|
||||
{ printf ("\n\nLine %d : sf_command (SFC_SET_INSTRUMENT) failed.\n\n", __LINE__) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* add_instrument_data */
|
||||
|
||||
168
Engine/lib/libsndfile/examples/sndfile-to-text.c
Normal file
168
Engine/lib/libsndfile/examples/sndfile-to-text.c
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
** Copyright (C) 2008-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <float.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define BLOCK_SIZE 4096
|
||||
|
||||
#ifdef DBL_DECIMAL_DIG
|
||||
#define OP_DBL_Digs (DBL_DECIMAL_DIG)
|
||||
#else
|
||||
#ifdef DECIMAL_DIG
|
||||
#define OP_DBL_Digs (DECIMAL_DIG)
|
||||
#else
|
||||
#define OP_DBL_Digs (DBL_DIG + 3)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void
|
||||
print_usage (char *progname)
|
||||
{ printf ("\nUsage : %s [--full-precision] <input file> <output file>\n", progname) ;
|
||||
puts ("\n"
|
||||
" Where the output file will contain a line for each frame\n"
|
||||
" and a column for each channel.\n"
|
||||
) ;
|
||||
|
||||
} /* print_usage */
|
||||
|
||||
static int
|
||||
convert_to_text (SNDFILE * infile, FILE * outfile, int channels, int full_precision)
|
||||
{ float *buf ;
|
||||
sf_count_t frames ;
|
||||
int k, m, readcount ;
|
||||
|
||||
buf = malloc (BLOCK_SIZE * sizeof (float)) ;
|
||||
if (buf == NULL)
|
||||
{ printf ("Error : Out of memory.\n\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
frames = BLOCK_SIZE / channels ;
|
||||
|
||||
while ((readcount = (int) sf_readf_float (infile, buf, frames)) > 0)
|
||||
{ for (k = 0 ; k < readcount ; k++)
|
||||
{ for (m = 0 ; m < channels ; m++)
|
||||
if (full_precision)
|
||||
fprintf (outfile, " %.*e", OP_DBL_Digs - 1, buf [k * channels + m]) ;
|
||||
else
|
||||
fprintf (outfile, " % 12.10f", buf [k * channels + m]) ;
|
||||
fprintf (outfile, "\n") ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
free (buf) ;
|
||||
|
||||
return 0 ;
|
||||
} /* convert_to_text */
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{ char *progname, *infilename, *outfilename ;
|
||||
SNDFILE *infile = NULL ;
|
||||
FILE *outfile = NULL ;
|
||||
SF_INFO sfinfo ;
|
||||
int full_precision = 0 ;
|
||||
int ret = 1 ;
|
||||
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
|
||||
switch (argc)
|
||||
{ case 4 :
|
||||
if (!strcmp ("--full-precision", argv [3]))
|
||||
{ print_usage (progname) ;
|
||||
goto cleanup ;
|
||||
} ;
|
||||
full_precision = 1 ;
|
||||
argv++ ;
|
||||
case 3 :
|
||||
break ;
|
||||
default:
|
||||
print_usage (progname) ;
|
||||
goto cleanup ;
|
||||
} ;
|
||||
|
||||
infilename = argv [1] ;
|
||||
outfilename = argv [2] ;
|
||||
|
||||
if (strcmp (infilename, outfilename) == 0)
|
||||
{ printf ("Error : Input and output filenames are the same.\n\n") ;
|
||||
print_usage (progname) ;
|
||||
goto cleanup ;
|
||||
} ;
|
||||
|
||||
if (infilename [0] == '-')
|
||||
{ printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
|
||||
print_usage (progname) ;
|
||||
goto cleanup ;
|
||||
} ;
|
||||
|
||||
if (outfilename [0] == '-')
|
||||
{ printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
|
||||
print_usage (progname) ;
|
||||
goto cleanup ;
|
||||
} ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("Not able to open input file %s.\n", infilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
goto cleanup ;
|
||||
} ;
|
||||
|
||||
/* Open the output file. */
|
||||
if ((outfile = fopen (outfilename, "w")) == NULL)
|
||||
{ printf ("Not able to open output file %s : %s\n", outfilename, sf_strerror (NULL)) ;
|
||||
goto cleanup ;
|
||||
} ;
|
||||
|
||||
fprintf (outfile, "# Converted from file %s.\n", infilename) ;
|
||||
fprintf (outfile, "# Channels %d, Sample rate %d\n", sfinfo.channels, sfinfo.samplerate) ;
|
||||
|
||||
ret = convert_to_text (infile, outfile, sfinfo.channels, full_precision) ;
|
||||
|
||||
cleanup :
|
||||
|
||||
sf_close (infile) ;
|
||||
if (outfile != NULL)
|
||||
fclose (outfile) ;
|
||||
|
||||
return ret ;
|
||||
} /* main */
|
||||
|
||||
84
Engine/lib/libsndfile/examples/sndfilehandle.cc
Normal file
84
Engine/lib/libsndfile/examples/sndfilehandle.cc
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
** Copyright (C) 2007-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** 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.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <sndfile.hh>
|
||||
|
||||
#define BUFFER_LEN 1024
|
||||
|
||||
static void
|
||||
create_file (const char * fname, int format)
|
||||
{ static short buffer [BUFFER_LEN] ;
|
||||
|
||||
SndfileHandle file ;
|
||||
int channels = 2 ;
|
||||
int srate = 48000 ;
|
||||
|
||||
printf ("Creating file named '%s'\n", fname) ;
|
||||
|
||||
file = SndfileHandle (fname, SFM_WRITE, format, channels, srate) ;
|
||||
|
||||
memset (buffer, 0, sizeof (buffer)) ;
|
||||
|
||||
file.write (buffer, BUFFER_LEN) ;
|
||||
|
||||
puts ("") ;
|
||||
/*
|
||||
** The SndfileHandle object will automatically close the file and
|
||||
** release all allocated memory when the object goes out of scope.
|
||||
** This is the Resource Acquisition Is Initailization idom.
|
||||
** See : http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
|
||||
*/
|
||||
} /* create_file */
|
||||
|
||||
static void
|
||||
read_file (const char * fname)
|
||||
{ static short buffer [BUFFER_LEN] ;
|
||||
|
||||
SndfileHandle file ;
|
||||
|
||||
file = SndfileHandle (fname) ;
|
||||
|
||||
printf ("Opened file '%s'\n", fname) ;
|
||||
printf (" Sample rate : %d\n", file.samplerate ()) ;
|
||||
printf (" Channels : %d\n", file.channels ()) ;
|
||||
|
||||
file.read (buffer, BUFFER_LEN) ;
|
||||
|
||||
puts ("") ;
|
||||
|
||||
/* RAII takes care of destroying SndfileHandle object. */
|
||||
} /* read_file */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{ const char * fname = "test.wav" ;
|
||||
|
||||
puts ("\nSimple example showing usage of the C++ SndfileHandle object.\n") ;
|
||||
|
||||
create_file (fname, SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
|
||||
|
||||
read_file (fname) ;
|
||||
|
||||
puts ("Done.\n") ;
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
|
||||
885
Engine/lib/libsndfile/include/sndfile.h
Normal file
885
Engine/lib/libsndfile/include/sndfile.h
Normal file
|
|
@ -0,0 +1,885 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This 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 Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
** sndfile.h -- system-wide definitions
|
||||
**
|
||||
** API documentation is in the doc/ directory of the source code tarball
|
||||
** and at http://libsndfile.github.io/libsndfile/api.html.
|
||||
*/
|
||||
|
||||
#ifndef SNDFILE_H
|
||||
#define SNDFILE_H
|
||||
|
||||
/* This is the version 1.0.X header file. */
|
||||
#define SNDFILE_1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* The following file types can be read and written.
|
||||
** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise
|
||||
** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and
|
||||
** SF_FORMAT_SUBMASK can be used to separate the major and minor file
|
||||
** types.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ /* Major formats. */
|
||||
SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian default). */
|
||||
SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */
|
||||
SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */
|
||||
SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */
|
||||
SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */
|
||||
SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */
|
||||
SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */
|
||||
SF_FORMAT_VOC = 0x080000, /* VOC files. */
|
||||
SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */
|
||||
SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */
|
||||
SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */
|
||||
SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */
|
||||
SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */
|
||||
SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */
|
||||
SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */
|
||||
SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */
|
||||
SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */
|
||||
SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */
|
||||
SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */
|
||||
SF_FORMAT_FLAC = 0x170000, /* FLAC lossless file format */
|
||||
SF_FORMAT_CAF = 0x180000, /* Core Audio File format */
|
||||
SF_FORMAT_WVE = 0x190000, /* Psion WVE format */
|
||||
SF_FORMAT_OGG = 0x200000, /* Xiph OGG container */
|
||||
SF_FORMAT_MPC2K = 0x210000, /* Akai MPC 2000 sampler */
|
||||
SF_FORMAT_RF64 = 0x220000, /* RF64 WAV file */
|
||||
SF_FORMAT_MPEG = 0x230000, /* MPEG-1/2 audio stream */
|
||||
|
||||
/* Subtypes from here on. */
|
||||
|
||||
SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */
|
||||
SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */
|
||||
SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */
|
||||
SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */
|
||||
|
||||
SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */
|
||||
|
||||
SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */
|
||||
SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */
|
||||
|
||||
SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */
|
||||
SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */
|
||||
SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */
|
||||
SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */
|
||||
|
||||
SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */
|
||||
SF_FORMAT_VOX_ADPCM = 0x0021, /* OKI / Dialogix ADPCM */
|
||||
|
||||
SF_FORMAT_NMS_ADPCM_16 = 0x0022, /* 16kbs NMS G721-variant encoding. */
|
||||
SF_FORMAT_NMS_ADPCM_24 = 0x0023, /* 24kbs NMS G721-variant encoding. */
|
||||
SF_FORMAT_NMS_ADPCM_32 = 0x0024, /* 32kbs NMS G721-variant encoding. */
|
||||
|
||||
SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */
|
||||
SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */
|
||||
SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */
|
||||
|
||||
SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */
|
||||
|
||||
SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */
|
||||
SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */
|
||||
|
||||
SF_FORMAT_VORBIS = 0x0060, /* Xiph Vorbis encoding. */
|
||||
SF_FORMAT_OPUS = 0x0064, /* Xiph/Skype Opus encoding. */
|
||||
|
||||
SF_FORMAT_ALAC_16 = 0x0070, /* Apple Lossless Audio Codec (16 bit). */
|
||||
SF_FORMAT_ALAC_20 = 0x0071, /* Apple Lossless Audio Codec (20 bit). */
|
||||
SF_FORMAT_ALAC_24 = 0x0072, /* Apple Lossless Audio Codec (24 bit). */
|
||||
SF_FORMAT_ALAC_32 = 0x0073, /* Apple Lossless Audio Codec (32 bit). */
|
||||
|
||||
SF_FORMAT_MPEG_LAYER_I = 0x0080, /* MPEG-1 Audio Layer I */
|
||||
SF_FORMAT_MPEG_LAYER_II = 0x0081, /* MPEG-1 Audio Layer II */
|
||||
SF_FORMAT_MPEG_LAYER_III = 0x0082, /* MPEG-2 Audio Layer III */
|
||||
|
||||
/* Endian-ness options. */
|
||||
|
||||
SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */
|
||||
SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */
|
||||
SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */
|
||||
SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */
|
||||
|
||||
SF_FORMAT_SUBMASK = 0x0000FFFF,
|
||||
SF_FORMAT_TYPEMASK = 0x0FFF0000,
|
||||
SF_FORMAT_ENDMASK = 0x30000000
|
||||
} ;
|
||||
|
||||
/*
|
||||
** The following are the valid command numbers for the sf_command()
|
||||
** interface. The use of these commands is documented in the file
|
||||
** command.html in the doc directory of the source code distribution.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SFC_GET_LIB_VERSION = 0x1000,
|
||||
SFC_GET_LOG_INFO = 0x1001,
|
||||
SFC_GET_CURRENT_SF_INFO = 0x1002,
|
||||
|
||||
|
||||
SFC_GET_NORM_DOUBLE = 0x1010,
|
||||
SFC_GET_NORM_FLOAT = 0x1011,
|
||||
SFC_SET_NORM_DOUBLE = 0x1012,
|
||||
SFC_SET_NORM_FLOAT = 0x1013,
|
||||
SFC_SET_SCALE_FLOAT_INT_READ = 0x1014,
|
||||
SFC_SET_SCALE_INT_FLOAT_WRITE = 0x1015,
|
||||
|
||||
SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020,
|
||||
SFC_GET_SIMPLE_FORMAT = 0x1021,
|
||||
|
||||
SFC_GET_FORMAT_INFO = 0x1028,
|
||||
|
||||
SFC_GET_FORMAT_MAJOR_COUNT = 0x1030,
|
||||
SFC_GET_FORMAT_MAJOR = 0x1031,
|
||||
SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032,
|
||||
SFC_GET_FORMAT_SUBTYPE = 0x1033,
|
||||
|
||||
SFC_CALC_SIGNAL_MAX = 0x1040,
|
||||
SFC_CALC_NORM_SIGNAL_MAX = 0x1041,
|
||||
SFC_CALC_MAX_ALL_CHANNELS = 0x1042,
|
||||
SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,
|
||||
SFC_GET_SIGNAL_MAX = 0x1044,
|
||||
SFC_GET_MAX_ALL_CHANNELS = 0x1045,
|
||||
|
||||
SFC_SET_ADD_PEAK_CHUNK = 0x1050,
|
||||
|
||||
SFC_UPDATE_HEADER_NOW = 0x1060,
|
||||
SFC_SET_UPDATE_HEADER_AUTO = 0x1061,
|
||||
|
||||
SFC_FILE_TRUNCATE = 0x1080,
|
||||
|
||||
SFC_SET_RAW_START_OFFSET = 0x1090,
|
||||
|
||||
/* Commands reserved for dithering, which is not implemented. */
|
||||
SFC_SET_DITHER_ON_WRITE = 0x10A0,
|
||||
SFC_SET_DITHER_ON_READ = 0x10A1,
|
||||
|
||||
SFC_GET_DITHER_INFO_COUNT = 0x10A2,
|
||||
SFC_GET_DITHER_INFO = 0x10A3,
|
||||
|
||||
SFC_GET_EMBED_FILE_INFO = 0x10B0,
|
||||
|
||||
SFC_SET_CLIPPING = 0x10C0,
|
||||
SFC_GET_CLIPPING = 0x10C1,
|
||||
|
||||
SFC_GET_CUE_COUNT = 0x10CD,
|
||||
SFC_GET_CUE = 0x10CE,
|
||||
SFC_SET_CUE = 0x10CF,
|
||||
|
||||
SFC_GET_INSTRUMENT = 0x10D0,
|
||||
SFC_SET_INSTRUMENT = 0x10D1,
|
||||
|
||||
SFC_GET_LOOP_INFO = 0x10E0,
|
||||
|
||||
SFC_GET_BROADCAST_INFO = 0x10F0,
|
||||
SFC_SET_BROADCAST_INFO = 0x10F1,
|
||||
|
||||
SFC_GET_CHANNEL_MAP_INFO = 0x1100,
|
||||
SFC_SET_CHANNEL_MAP_INFO = 0x1101,
|
||||
|
||||
SFC_RAW_DATA_NEEDS_ENDSWAP = 0x1110,
|
||||
|
||||
/* Support for Wavex Ambisonics Format */
|
||||
SFC_WAVEX_SET_AMBISONIC = 0x1200,
|
||||
SFC_WAVEX_GET_AMBISONIC = 0x1201,
|
||||
|
||||
/*
|
||||
** RF64 files can be set so that on-close, writable files that have less
|
||||
** than 4GB of data in them are converted to RIFF/WAV, as per EBU
|
||||
** recommendations.
|
||||
*/
|
||||
SFC_RF64_AUTO_DOWNGRADE = 0x1210,
|
||||
|
||||
SFC_SET_VBR_ENCODING_QUALITY = 0x1300,
|
||||
SFC_SET_COMPRESSION_LEVEL = 0x1301,
|
||||
|
||||
/* Ogg format commands */
|
||||
SFC_SET_OGG_PAGE_LATENCY_MS = 0x1302,
|
||||
SFC_SET_OGG_PAGE_LATENCY = 0x1303,
|
||||
SFC_GET_OGG_STREAM_SERIALNO = 0x1306,
|
||||
|
||||
SFC_GET_BITRATE_MODE = 0x1304,
|
||||
SFC_SET_BITRATE_MODE = 0x1305,
|
||||
|
||||
/* Cart Chunk support */
|
||||
SFC_SET_CART_INFO = 0x1400,
|
||||
SFC_GET_CART_INFO = 0x1401,
|
||||
|
||||
/* Opus files original samplerate metadata */
|
||||
SFC_SET_ORIGINAL_SAMPLERATE = 0x1500,
|
||||
SFC_GET_ORIGINAL_SAMPLERATE = 0x1501,
|
||||
|
||||
/* Following commands for testing only. */
|
||||
SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001,
|
||||
|
||||
/*
|
||||
** These SFC_SET_ADD_* values are deprecated and will disappear at some
|
||||
** time in the future. They are guaranteed to be here up to and
|
||||
** including version 1.0.8 to avoid breakage of existing software.
|
||||
** They currently do nothing and will continue to do nothing.
|
||||
*/
|
||||
SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051,
|
||||
|
||||
SFC_SET_ADD_DITHER_ON_WRITE = 0x1070,
|
||||
SFC_SET_ADD_DITHER_ON_READ = 0x1071
|
||||
} ;
|
||||
|
||||
|
||||
/*
|
||||
** String types that can be set and read from files. Not all file types
|
||||
** support this and even the file types which support one, may not support
|
||||
** all string types.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_STR_TITLE = 0x01,
|
||||
SF_STR_COPYRIGHT = 0x02,
|
||||
SF_STR_SOFTWARE = 0x03,
|
||||
SF_STR_ARTIST = 0x04,
|
||||
SF_STR_COMMENT = 0x05,
|
||||
SF_STR_DATE = 0x06,
|
||||
SF_STR_ALBUM = 0x07,
|
||||
SF_STR_LICENSE = 0x08,
|
||||
SF_STR_TRACKNUMBER = 0x09,
|
||||
SF_STR_GENRE = 0x10
|
||||
} ;
|
||||
|
||||
/*
|
||||
** Use the following as the start and end index when doing metadata
|
||||
** transcoding.
|
||||
*/
|
||||
|
||||
#define SF_STR_FIRST SF_STR_TITLE
|
||||
#define SF_STR_LAST SF_STR_GENRE
|
||||
|
||||
enum
|
||||
{ /* True and false */
|
||||
SF_FALSE = 0,
|
||||
SF_TRUE = 1,
|
||||
|
||||
/* Modes for opening files. */
|
||||
SFM_READ = 0x10,
|
||||
SFM_WRITE = 0x20,
|
||||
SFM_RDWR = 0x30,
|
||||
|
||||
SF_AMBISONIC_NONE = 0x40,
|
||||
SF_AMBISONIC_B_FORMAT = 0x41
|
||||
} ;
|
||||
|
||||
/* Public error values. These are guaranteed to remain unchanged for the duration
|
||||
** of the library major version number.
|
||||
** There are also a large number of private error numbers which are internal to
|
||||
** the library which can change at any time.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_ERR_NO_ERROR = 0,
|
||||
SF_ERR_UNRECOGNISED_FORMAT = 1,
|
||||
SF_ERR_SYSTEM = 2,
|
||||
SF_ERR_MALFORMED_FILE = 3,
|
||||
SF_ERR_UNSUPPORTED_ENCODING = 4
|
||||
} ;
|
||||
|
||||
|
||||
/* Channel map values (used with SFC_SET/GET_CHANNEL_MAP).
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_CHANNEL_MAP_INVALID = 0,
|
||||
SF_CHANNEL_MAP_MONO = 1,
|
||||
SF_CHANNEL_MAP_LEFT, /* Apple calls this 'Left' */
|
||||
SF_CHANNEL_MAP_RIGHT, /* Apple calls this 'Right' */
|
||||
SF_CHANNEL_MAP_CENTER, /* Apple calls this 'Center' */
|
||||
SF_CHANNEL_MAP_FRONT_LEFT,
|
||||
SF_CHANNEL_MAP_FRONT_RIGHT,
|
||||
SF_CHANNEL_MAP_FRONT_CENTER,
|
||||
SF_CHANNEL_MAP_REAR_CENTER, /* Apple calls this 'Center Surround', Msft calls this 'Back Center' */
|
||||
SF_CHANNEL_MAP_REAR_LEFT, /* Apple calls this 'Left Surround', Msft calls this 'Back Left' */
|
||||
SF_CHANNEL_MAP_REAR_RIGHT, /* Apple calls this 'Right Surround', Msft calls this 'Back Right' */
|
||||
SF_CHANNEL_MAP_LFE, /* Apple calls this 'LFEScreen', Msft calls this 'Low Frequency' */
|
||||
SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER, /* Apple calls this 'Left Center' */
|
||||
SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER, /* Apple calls this 'Right Center */
|
||||
SF_CHANNEL_MAP_SIDE_LEFT, /* Apple calls this 'Left Surround Direct' */
|
||||
SF_CHANNEL_MAP_SIDE_RIGHT, /* Apple calls this 'Right Surround Direct' */
|
||||
SF_CHANNEL_MAP_TOP_CENTER, /* Apple calls this 'Top Center Surround' */
|
||||
SF_CHANNEL_MAP_TOP_FRONT_LEFT, /* Apple calls this 'Vertical Height Left' */
|
||||
SF_CHANNEL_MAP_TOP_FRONT_RIGHT, /* Apple calls this 'Vertical Height Right' */
|
||||
SF_CHANNEL_MAP_TOP_FRONT_CENTER, /* Apple calls this 'Vertical Height Center' */
|
||||
SF_CHANNEL_MAP_TOP_REAR_LEFT, /* Apple and MS call this 'Top Back Left' */
|
||||
SF_CHANNEL_MAP_TOP_REAR_RIGHT, /* Apple and MS call this 'Top Back Right' */
|
||||
SF_CHANNEL_MAP_TOP_REAR_CENTER, /* Apple and MS call this 'Top Back Center' */
|
||||
|
||||
SF_CHANNEL_MAP_AMBISONIC_B_W,
|
||||
SF_CHANNEL_MAP_AMBISONIC_B_X,
|
||||
SF_CHANNEL_MAP_AMBISONIC_B_Y,
|
||||
SF_CHANNEL_MAP_AMBISONIC_B_Z,
|
||||
|
||||
SF_CHANNEL_MAP_MAX
|
||||
} ;
|
||||
|
||||
/* Bitrate mode values (for use with SFC_GET/SET_BITRATE_MODE)
|
||||
*/
|
||||
enum
|
||||
{ SF_BITRATE_MODE_CONSTANT = 0,
|
||||
SF_BITRATE_MODE_AVERAGE,
|
||||
SF_BITRATE_MODE_VARIABLE
|
||||
} ;
|
||||
|
||||
|
||||
/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
|
||||
|
||||
typedef struct sf_private_tag SNDFILE ;
|
||||
|
||||
/* The following typedef is system specific and is defined when libsndfile is
|
||||
** compiled. sf_count_t will be a 64 bit value when the underlying OS allows
|
||||
** 64 bit file offsets.
|
||||
** On windows, we need to allow the same header file to be compiler by both GCC
|
||||
** and the Microsoft compiler.
|
||||
*/
|
||||
|
||||
typedef int64_t sf_count_t ;
|
||||
#ifndef SF_COUNT_MAX
|
||||
#define SF_COUNT_MAX INT64_MAX
|
||||
#endif
|
||||
|
||||
|
||||
/* A pointer to a SF_INFO structure is passed to sf_open () and filled in.
|
||||
** On write, the SF_INFO structure is filled in by the user and passed into
|
||||
** sf_open ().
|
||||
*/
|
||||
|
||||
struct SF_INFO
|
||||
{ sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */
|
||||
int samplerate ;
|
||||
int channels ;
|
||||
int format ;
|
||||
int sections ;
|
||||
int seekable ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_INFO SF_INFO ;
|
||||
|
||||
/* The SF_FORMAT_INFO struct is used to retrieve information about the sound
|
||||
** file formats libsndfile supports using the sf_command () interface.
|
||||
**
|
||||
** Using this interface will allow applications to support new file formats
|
||||
** and encoding types when libsndfile is upgraded, without requiring
|
||||
** re-compilation of the application.
|
||||
**
|
||||
** Please consult the libsndfile documentation (particularly the information
|
||||
** on the sf_command () interface) for examples of its use.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ int format ;
|
||||
const char *name ;
|
||||
const char *extension ;
|
||||
} SF_FORMAT_INFO ;
|
||||
|
||||
/*
|
||||
** Enums and typedefs for adding dither on read and write.
|
||||
** Reserved for future implementation.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SFD_DEFAULT_LEVEL = 0,
|
||||
SFD_CUSTOM_LEVEL = 0x40000000,
|
||||
|
||||
SFD_NO_DITHER = 500,
|
||||
SFD_WHITE = 501,
|
||||
SFD_TRIANGULAR_PDF = 502
|
||||
} ;
|
||||
|
||||
typedef struct
|
||||
{ int type ;
|
||||
double level ;
|
||||
const char *name ;
|
||||
} SF_DITHER_INFO ;
|
||||
|
||||
/* Struct used to retrieve information about a file embedded within a
|
||||
** larger file. See SFC_GET_EMBED_FILE_INFO.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ sf_count_t offset ;
|
||||
sf_count_t length ;
|
||||
} SF_EMBED_FILE_INFO ;
|
||||
|
||||
/*
|
||||
** Struct used to retrieve cue marker information from a file
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ int32_t indx ;
|
||||
uint32_t position ;
|
||||
int32_t fcc_chunk ;
|
||||
int32_t chunk_start ;
|
||||
int32_t block_start ;
|
||||
uint32_t sample_offset ;
|
||||
char name [256] ;
|
||||
} SF_CUE_POINT ;
|
||||
|
||||
#define SF_CUES_VAR(count) \
|
||||
struct \
|
||||
{ uint32_t cue_count ; \
|
||||
SF_CUE_POINT cue_points [count] ; \
|
||||
}
|
||||
|
||||
typedef SF_CUES_VAR (100) SF_CUES ;
|
||||
|
||||
/*
|
||||
** Structs used to retrieve music sample information from a file.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ /*
|
||||
** The loop mode field in SF_INSTRUMENT will be one of the following.
|
||||
*/
|
||||
SF_LOOP_NONE = 800,
|
||||
SF_LOOP_FORWARD,
|
||||
SF_LOOP_BACKWARD,
|
||||
SF_LOOP_ALTERNATING
|
||||
} ;
|
||||
|
||||
typedef struct
|
||||
{ int gain ;
|
||||
char basenote, detune ;
|
||||
char velocity_lo, velocity_hi ;
|
||||
char key_lo, key_hi ;
|
||||
int loop_count ;
|
||||
|
||||
struct
|
||||
{ int mode ;
|
||||
uint32_t start ;
|
||||
uint32_t end ;
|
||||
uint32_t count ;
|
||||
} loops [16] ; /* make variable in a sensible way */
|
||||
} SF_INSTRUMENT ;
|
||||
|
||||
|
||||
|
||||
/* Struct used to retrieve loop information from a file.*/
|
||||
typedef struct
|
||||
{
|
||||
short time_sig_num ; /* any positive integer > 0 */
|
||||
short time_sig_den ; /* any positive power of 2 > 0 */
|
||||
int loop_mode ; /* see SF_LOOP enum */
|
||||
|
||||
int num_beats ; /* this is NOT the amount of quarter notes !!!*/
|
||||
/* a full bar of 4/4 is 4 beats */
|
||||
/* a full bar of 7/8 is 7 beats */
|
||||
|
||||
float bpm ; /* suggestion, as it can be calculated using other fields:*/
|
||||
/* file's length, file's sampleRate and our time_sig_den*/
|
||||
/* -> bpms are always the amount of _quarter notes_ per minute */
|
||||
|
||||
int root_key ; /* MIDI note, or -1 for None */
|
||||
int future [6] ;
|
||||
} SF_LOOP_INFO ;
|
||||
|
||||
|
||||
/* Struct used to retrieve broadcast (EBU) information from a file.
|
||||
** Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE.
|
||||
*/
|
||||
#define SF_BROADCAST_INFO_VAR(coding_hist_size) \
|
||||
struct \
|
||||
{ char description [256] ; \
|
||||
char originator [32] ; \
|
||||
char originator_reference [32] ; \
|
||||
char origination_date [10] ; \
|
||||
char origination_time [8] ; \
|
||||
uint32_t time_reference_low ; \
|
||||
uint32_t time_reference_high ; \
|
||||
short version ; \
|
||||
char umid [64] ; \
|
||||
int16_t loudness_value ; \
|
||||
int16_t loudness_range ; \
|
||||
int16_t max_true_peak_level ; \
|
||||
int16_t max_momentary_loudness ; \
|
||||
int16_t max_shortterm_loudness ; \
|
||||
char reserved [180] ; \
|
||||
uint32_t coding_history_size ; \
|
||||
char coding_history [coding_hist_size] ; \
|
||||
}
|
||||
|
||||
/* SF_BROADCAST_INFO is the above struct with coding_history field of 256 bytes. */
|
||||
typedef SF_BROADCAST_INFO_VAR (256) SF_BROADCAST_INFO ;
|
||||
|
||||
struct SF_CART_TIMER
|
||||
{ char usage [4] ;
|
||||
int32_t value ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_CART_TIMER SF_CART_TIMER ;
|
||||
|
||||
#define SF_CART_INFO_VAR(p_tag_text_size) \
|
||||
struct \
|
||||
{ char version [4] ; \
|
||||
char title [64] ; \
|
||||
char artist [64] ; \
|
||||
char cut_id [64] ; \
|
||||
char client_id [64] ; \
|
||||
char category [64] ; \
|
||||
char classification [64] ; \
|
||||
char out_cue [64] ; \
|
||||
char start_date [10] ; \
|
||||
char start_time [8] ; \
|
||||
char end_date [10] ; \
|
||||
char end_time [8] ; \
|
||||
char producer_app_id [64] ; \
|
||||
char producer_app_version [64] ; \
|
||||
char user_def [64] ; \
|
||||
int32_t level_reference ; \
|
||||
SF_CART_TIMER post_timers [8] ; \
|
||||
char reserved [276] ; \
|
||||
char url [1024] ; \
|
||||
uint32_t tag_text_size ; \
|
||||
char tag_text [p_tag_text_size] ; \
|
||||
}
|
||||
|
||||
typedef SF_CART_INFO_VAR (256) SF_CART_INFO ;
|
||||
|
||||
/* Virtual I/O functionality. */
|
||||
|
||||
typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
|
||||
|
||||
struct SF_VIRTUAL_IO
|
||||
{ sf_vio_get_filelen get_filelen ;
|
||||
sf_vio_seek seek ;
|
||||
sf_vio_read read ;
|
||||
sf_vio_write write ;
|
||||
sf_vio_tell tell ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ;
|
||||
|
||||
|
||||
/* Open the specified file for read, write or both. On error, this will
|
||||
** return a NULL pointer. To find the error number, pass a NULL SNDFILE
|
||||
** to sf_strerror ().
|
||||
** All calls to sf_open() should be matched with a call to sf_close().
|
||||
*/
|
||||
|
||||
SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ;
|
||||
|
||||
|
||||
/* Use the existing file descriptor to create a SNDFILE object. If close_desc
|
||||
** is TRUE, the file descriptor will be closed when sf_close() is called. If
|
||||
** it is FALSE, the descriptor will not be closed.
|
||||
** When passed a descriptor like this, the library will assume that the start
|
||||
** of file header is at the current file offset. This allows sound files within
|
||||
** larger container files to be read and/or written.
|
||||
** On error, this will return a NULL pointer. To find the error number, pass a
|
||||
** NULL SNDFILE to sf_strerror ().
|
||||
** All calls to sf_open_fd() should be matched with a call to sf_close().
|
||||
|
||||
*/
|
||||
|
||||
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
|
||||
|
||||
SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ;
|
||||
|
||||
|
||||
/* sf_error () returns a error number which can be translated to a text
|
||||
** string using sf_error_number().
|
||||
*/
|
||||
|
||||
int sf_error (SNDFILE *sndfile) ;
|
||||
|
||||
|
||||
/* sf_strerror () returns to the caller a pointer to the current error message for
|
||||
** the given SNDFILE.
|
||||
*/
|
||||
|
||||
const char* sf_strerror (SNDFILE *sndfile) ;
|
||||
|
||||
|
||||
/* sf_error_number () allows the retrieval of the error string for each internal
|
||||
** error number.
|
||||
**
|
||||
*/
|
||||
|
||||
const char* sf_error_number (int errnum) ;
|
||||
|
||||
|
||||
/* The following two error functions are deprecated but they will remain in the
|
||||
** library for the foreseeable future. The function sf_strerror() should be used
|
||||
** in their place.
|
||||
*/
|
||||
|
||||
int sf_perror (SNDFILE *sndfile) ;
|
||||
int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ;
|
||||
|
||||
|
||||
/* Allow the caller to retrieve information from or change aspects of the
|
||||
** library behaviour.
|
||||
*/
|
||||
|
||||
int sf_command (SNDFILE *sndfile, int command, void *data, int datasize) ;
|
||||
|
||||
|
||||
/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
|
||||
|
||||
int sf_format_check (const SF_INFO *info) ;
|
||||
|
||||
|
||||
/* Seek within the waveform data chunk of the SNDFILE. sf_seek () uses
|
||||
** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as
|
||||
** stdio.h function fseek ().
|
||||
** An offset of zero with whence set to SEEK_SET will position the
|
||||
** read / write pointer to the first data sample.
|
||||
** On success sf_seek returns the current position in (multi-channel)
|
||||
** samples from the start of the file.
|
||||
** Please see the libsndfile documentation for moving the read pointer
|
||||
** separately from the write pointer on files open in mode SFM_RDWR.
|
||||
** On error all of these functions return -1.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_SEEK_SET = SEEK_SET,
|
||||
SF_SEEK_CUR = SEEK_CUR,
|
||||
SF_SEEK_END = SEEK_END
|
||||
} ;
|
||||
|
||||
sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ;
|
||||
|
||||
|
||||
/* Functions for retrieving and setting string data within sound files.
|
||||
** Not all file types support this features; AIFF and WAV do. For both
|
||||
** functions, the str_type parameter must be one of the SF_STR_* values
|
||||
** defined above.
|
||||
** On error, sf_set_string() returns non-zero while sf_get_string()
|
||||
** returns NULL.
|
||||
*/
|
||||
|
||||
int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ;
|
||||
|
||||
const char* sf_get_string (SNDFILE *sndfile, int str_type) ;
|
||||
|
||||
|
||||
/* Return the library version string. */
|
||||
|
||||
const char * sf_version_string (void) ;
|
||||
|
||||
/* Return the current byterate at this point in the file. The byte rate in this
|
||||
** case is the number of bytes per second of audio data. For instance, for a
|
||||
** stereo, 18 bit PCM encoded file with an 16kHz sample rate, the byte rate
|
||||
** would be 2 (stereo) * 2 (two bytes per sample) * 16000 => 64000 bytes/sec.
|
||||
** For some file formats the returned value will be accurate and exact, for some
|
||||
** it will be a close approximation, for some it will be the average bitrate for
|
||||
** the whole file and for some it will be a time varying value that was accurate
|
||||
** when the file was most recently read or written.
|
||||
** To get the bitrate, multiple this value by 8.
|
||||
** Returns -1 for unknown.
|
||||
*/
|
||||
int sf_current_byterate (SNDFILE *sndfile) ;
|
||||
|
||||
/* Functions for reading/writing the waveform data of a sound file.
|
||||
*/
|
||||
|
||||
sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
||||
sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ;
|
||||
|
||||
|
||||
/* Functions for reading and writing the data chunk in terms of frames.
|
||||
** The number of items actually read/written = frames * number of channels.
|
||||
** sf_xxxx_raw read/writes the raw data bytes from/to the file
|
||||
** sf_xxxx_short passes data in the native short format
|
||||
** sf_xxxx_int passes data in the native int format
|
||||
** sf_xxxx_float passes data in the native float format
|
||||
** sf_xxxx_double passes data in the native double format
|
||||
** All of these read/write function return number of frames read/written.
|
||||
*/
|
||||
|
||||
sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ;
|
||||
|
||||
|
||||
/* Functions for reading and writing the data chunk in terms of items.
|
||||
** Otherwise similar to above.
|
||||
** All of these read/write function return number of items read/written.
|
||||
*/
|
||||
|
||||
sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ;
|
||||
|
||||
|
||||
/* Close the SNDFILE and clean up all memory allocations associated with this
|
||||
** file.
|
||||
** Returns 0 on success, or an error number.
|
||||
*/
|
||||
|
||||
int sf_close (SNDFILE *sndfile) ;
|
||||
|
||||
|
||||
/* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file
|
||||
** to force the writing of data to disk. If the file is opened SFM_READ
|
||||
** no action is taken.
|
||||
*/
|
||||
|
||||
void sf_write_sync (SNDFILE *sndfile) ;
|
||||
|
||||
|
||||
|
||||
/* The function sf_wchar_open() is Windows Only!
|
||||
** Open a file passing in a Windows Unicode filename. Otherwise, this is
|
||||
** the same as sf_open().
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
SNDFILE* sf_wchar_open (const wchar_t *wpath, int mode, SF_INFO *sfinfo) ;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Getting and setting of chunks from within a sound file.
|
||||
**
|
||||
** These functions allow the getting and setting of chunks within a sound file
|
||||
** (for those formats which allow it).
|
||||
**
|
||||
** These functions fail safely. Specifically, they will not allow you to overwrite
|
||||
** existing chunks or add extra versions of format specific reserved chunks but
|
||||
** should allow you to retrieve any and all chunks (may not be implemented for
|
||||
** all chunks or all file formats).
|
||||
*/
|
||||
|
||||
struct SF_CHUNK_INFO
|
||||
{ char id [64] ; /* The chunk identifier. */
|
||||
unsigned id_size ; /* The size of the chunk identifier. */
|
||||
unsigned datalen ; /* The size of that data. */
|
||||
void *data ; /* Pointer to the data. */
|
||||
} ;
|
||||
|
||||
typedef struct SF_CHUNK_INFO SF_CHUNK_INFO ;
|
||||
|
||||
/* Set the specified chunk info (must be done before any audio data is written
|
||||
** to the file). This will fail for format specific reserved chunks.
|
||||
** The chunk_info->data pointer must be valid until the file is closed.
|
||||
** Returns SF_ERR_NO_ERROR on success or non-zero on failure.
|
||||
*/
|
||||
int sf_set_chunk (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info) ;
|
||||
|
||||
/*
|
||||
** An opaque structure to an iterator over the all chunks of a given id
|
||||
*/
|
||||
typedef struct SF_CHUNK_ITERATOR SF_CHUNK_ITERATOR ;
|
||||
|
||||
/* Get an iterator for all chunks matching chunk_info.
|
||||
** The iterator will point to the first chunk matching chunk_info.
|
||||
** Chunks are matching, if (chunk_info->id) matches the first
|
||||
** (chunk_info->id_size) bytes of a chunk found in the SNDFILE* handle.
|
||||
** If chunk_info is NULL, an iterator to all chunks in the SNDFILE* handle
|
||||
** is returned.
|
||||
** The values of chunk_info->datalen and chunk_info->data are ignored.
|
||||
** If no matching chunks are found in the sndfile, NULL is returned.
|
||||
** The returned iterator will stay valid until one of the following occurs:
|
||||
** a) The sndfile is closed.
|
||||
** b) A new chunk is added using sf_set_chunk().
|
||||
** c) Another chunk iterator function is called on the same SNDFILE* handle
|
||||
** that causes the iterator to be modified.
|
||||
** The memory for the iterator belongs to the SNDFILE* handle and is freed when
|
||||
** sf_close() is called.
|
||||
*/
|
||||
SF_CHUNK_ITERATOR *
|
||||
sf_get_chunk_iterator (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info) ;
|
||||
|
||||
/* Iterate through chunks by incrementing the iterator.
|
||||
** Increments the iterator and returns a handle to the new one.
|
||||
** After this call, iterator will no longer be valid, and you must use the
|
||||
** newly returned handle from now on.
|
||||
** The returned handle can be used to access the next chunk matching
|
||||
** the criteria as defined in sf_get_chunk_iterator().
|
||||
** If iterator points to the last chunk, this will free all resources
|
||||
** associated with iterator and return NULL.
|
||||
** The returned iterator will stay valid until sf_get_chunk_iterator_next
|
||||
** is called again, the sndfile is closed or a new chunk us added.
|
||||
*/
|
||||
SF_CHUNK_ITERATOR *
|
||||
sf_next_chunk_iterator (SF_CHUNK_ITERATOR * iterator) ;
|
||||
|
||||
|
||||
/* Get the size of the specified chunk.
|
||||
** If the specified chunk exists, the size will be returned in the
|
||||
** datalen field of the SF_CHUNK_INFO struct.
|
||||
** Additionally, the id of the chunk will be copied to the id
|
||||
** field of the SF_CHUNK_INFO struct and it's id_size field will
|
||||
** be updated accordingly.
|
||||
** If the chunk doesn't exist chunk_info->datalen will be zero, and the
|
||||
** id and id_size fields will be undefined.
|
||||
** The function will return SF_ERR_NO_ERROR on success or non-zero on
|
||||
** failure.
|
||||
*/
|
||||
int
|
||||
sf_get_chunk_size (const SF_CHUNK_ITERATOR * it, SF_CHUNK_INFO * chunk_info) ;
|
||||
|
||||
/* Get the specified chunk data.
|
||||
** If the specified chunk exists, up to chunk_info->datalen bytes of
|
||||
** the chunk data will be copied into the chunk_info->data buffer
|
||||
** (allocated by the caller) and the chunk_info->datalen field
|
||||
** updated to reflect the size of the data. The id and id_size
|
||||
** field will be updated according to the retrieved chunk
|
||||
** If the chunk doesn't exist chunk_info->datalen will be zero, and the
|
||||
** id and id_size fields will be undefined.
|
||||
** The function will return SF_ERR_NO_ERROR on success or non-zero on
|
||||
** failure.
|
||||
*/
|
||||
int
|
||||
sf_get_chunk_data (const SF_CHUNK_ITERATOR * it, SF_CHUNK_INFO * chunk_info) ;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* SNDFILE_H */
|
||||
484
Engine/lib/libsndfile/include/sndfile.hh
Normal file
484
Engine/lib/libsndfile/include/sndfile.hh
Normal file
|
|
@ -0,0 +1,484 @@
|
|||
/*
|
||||
** Copyright (C) 2005-2017 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
** The above modified BSD style license (GPL and LGPL compatible) applies to
|
||||
** this file. It does not apply to libsndfile itself which is released under
|
||||
** the GNU LGPL or the libsndfile test suite which is released under the GNU
|
||||
** GPL.
|
||||
** This means that this header file can be used under this modified BSD style
|
||||
** license, but the LGPL still holds for the libsndfile library itself.
|
||||
*/
|
||||
|
||||
/*
|
||||
** sndfile.hh -- A lightweight C++ wrapper for the libsndfile API.
|
||||
**
|
||||
** All the methods are inlines and all functionality is contained in this
|
||||
** file. There is no separate implementation file.
|
||||
**
|
||||
** API documentation is in the doc/ directory of the source code tarball
|
||||
** and at http://libsndfile.github.io/libsndfile/api.html.
|
||||
**
|
||||
** This file is intended to compile with C++98 and newer.
|
||||
*/
|
||||
|
||||
#ifndef SNDFILE_HH
|
||||
#define SNDFILE_HH
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include <string>
|
||||
#include <new> // for std::nothrow
|
||||
|
||||
#if ((defined (_MSC_VER) && (_MSC_VER >= 1600)) || (__cplusplus >= 201100L))
|
||||
#define SF_NULL nullptr
|
||||
#else
|
||||
#define SF_NULL NULL
|
||||
#endif
|
||||
|
||||
class SndfileHandle
|
||||
{ private :
|
||||
struct SNDFILE_ref
|
||||
{ SNDFILE_ref (void) ;
|
||||
~SNDFILE_ref (void) ;
|
||||
|
||||
SNDFILE *sf ;
|
||||
SF_INFO sfinfo ;
|
||||
int ref ;
|
||||
} ;
|
||||
|
||||
SNDFILE_ref *p ;
|
||||
|
||||
public :
|
||||
/* Default constructor */
|
||||
SndfileHandle (void) : p (SF_NULL) {} ;
|
||||
SndfileHandle (const char *path, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
SndfileHandle (std::string const & path, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
SndfileHandle (int fd, bool close_desc, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
SndfileHandle (SF_VIRTUAL_IO &sfvirtual, void *user_data, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
|
||||
#ifdef _WIN32
|
||||
SndfileHandle (const wchar_t *wpath, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
#endif
|
||||
|
||||
~SndfileHandle (void) ;
|
||||
|
||||
SndfileHandle (const SndfileHandle &orig) ;
|
||||
SndfileHandle & operator = (const SndfileHandle &rhs) ;
|
||||
|
||||
#if (__cplusplus >= 201100L)
|
||||
SndfileHandle (SndfileHandle &&orig) noexcept ;
|
||||
SndfileHandle & operator = (SndfileHandle &&rhs) noexcept ;
|
||||
#endif
|
||||
|
||||
/* Mainly for debugging/testing. */
|
||||
int refCount (void) const { return (p == SF_NULL) ? 0 : p->ref ; }
|
||||
|
||||
operator bool () const { return (p != SF_NULL) ; }
|
||||
|
||||
bool operator == (const SndfileHandle &rhs) const { return (p == rhs.p) ; }
|
||||
|
||||
sf_count_t frames (void) const { return p ? p->sfinfo.frames : 0 ; }
|
||||
int format (void) const { return p ? p->sfinfo.format : 0 ; }
|
||||
int channels (void) const { return p ? p->sfinfo.channels : 0 ; }
|
||||
int samplerate (void) const { return p ? p->sfinfo.samplerate : 0 ; }
|
||||
|
||||
int error (void) const ;
|
||||
const char * strError (void) const ;
|
||||
|
||||
int command (int cmd, void *data, int datasize) ;
|
||||
|
||||
sf_count_t seek (sf_count_t frames, int whence) ;
|
||||
|
||||
void writeSync (void) ;
|
||||
|
||||
int setString (int str_type, const char* str) ;
|
||||
|
||||
const char* getString (int str_type) const ;
|
||||
|
||||
static int formatCheck (int format, int channels, int samplerate) ;
|
||||
|
||||
sf_count_t read (short *ptr, sf_count_t items) ;
|
||||
sf_count_t read (int *ptr, sf_count_t items) ;
|
||||
sf_count_t read (float *ptr, sf_count_t items) ;
|
||||
sf_count_t read (double *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t write (const short *ptr, sf_count_t items) ;
|
||||
sf_count_t write (const int *ptr, sf_count_t items) ;
|
||||
sf_count_t write (const float *ptr, sf_count_t items) ;
|
||||
sf_count_t write (const double *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t readf (short *ptr, sf_count_t frames) ;
|
||||
sf_count_t readf (int *ptr, sf_count_t frames) ;
|
||||
sf_count_t readf (float *ptr, sf_count_t frames) ;
|
||||
sf_count_t readf (double *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t writef (const short *ptr, sf_count_t frames) ;
|
||||
sf_count_t writef (const int *ptr, sf_count_t frames) ;
|
||||
sf_count_t writef (const float *ptr, sf_count_t frames) ;
|
||||
sf_count_t writef (const double *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t readRaw (void *ptr, sf_count_t bytes) ;
|
||||
sf_count_t writeRaw (const void *ptr, sf_count_t bytes) ;
|
||||
|
||||
/**< Raw access to the handle. SndfileHandle keeps ownership. */
|
||||
SNDFILE * rawHandle (void) ;
|
||||
|
||||
/**< Take ownership of handle, if reference count is 1. */
|
||||
SNDFILE * takeOwnership (void) ;
|
||||
} ;
|
||||
|
||||
/*==============================================================================
|
||||
** Nothing but implementation below.
|
||||
*/
|
||||
|
||||
inline
|
||||
SndfileHandle::SNDFILE_ref::SNDFILE_ref (void)
|
||||
: sf (SF_NULL), sfinfo (), ref (1)
|
||||
{}
|
||||
|
||||
inline
|
||||
SndfileHandle::SNDFILE_ref::~SNDFILE_ref (void)
|
||||
{ if (sf != SF_NULL) sf_close (sf) ; }
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (const char *path, int mode, int fmt, int chans, int srate)
|
||||
: p (SF_NULL)
|
||||
{
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != SF_NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_open (path, mode, &p->sfinfo) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle const char * constructor */
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (std::string const & path, int mode, int fmt, int chans, int srate)
|
||||
: p (SF_NULL)
|
||||
{
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != SF_NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_open (path.c_str (), mode, &p->sfinfo) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle std::string constructor */
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (int fd, bool close_desc, int mode, int fmt, int chans, int srate)
|
||||
: p (SF_NULL)
|
||||
{
|
||||
if (fd < 0)
|
||||
return ;
|
||||
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != SF_NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_open_fd (fd, mode, &p->sfinfo, close_desc) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle fd constructor */
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (SF_VIRTUAL_IO &sfvirtual, void *user_data, int mode, int fmt, int chans, int srate)
|
||||
: p (SF_NULL)
|
||||
{
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != SF_NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_open_virtual (&sfvirtual, mode, &p->sfinfo, user_data) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle std::string constructor */
|
||||
|
||||
inline
|
||||
SndfileHandle::~SndfileHandle (void)
|
||||
{ if (p != SF_NULL && -- p->ref == 0)
|
||||
delete p ;
|
||||
} /* SndfileHandle destructor */
|
||||
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (const SndfileHandle &orig)
|
||||
: p (orig.p)
|
||||
{ if (p != SF_NULL)
|
||||
++ p->ref ;
|
||||
} /* SndfileHandle copy constructor */
|
||||
|
||||
inline SndfileHandle &
|
||||
SndfileHandle::operator = (const SndfileHandle &rhs)
|
||||
{
|
||||
if (&rhs == this)
|
||||
return *this ;
|
||||
if (p != SF_NULL && -- p->ref == 0)
|
||||
delete p ;
|
||||
|
||||
p = rhs.p ;
|
||||
if (p != SF_NULL)
|
||||
++ p->ref ;
|
||||
|
||||
return *this ;
|
||||
} /* SndfileHandle copy assignment */
|
||||
|
||||
#if (__cplusplus >= 201100L)
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (SndfileHandle &&orig) noexcept
|
||||
: p (orig.p)
|
||||
{
|
||||
orig.p = SF_NULL ;
|
||||
} /* SndfileHandle move constructor */
|
||||
|
||||
inline SndfileHandle &
|
||||
SndfileHandle::operator = (SndfileHandle &&rhs) noexcept
|
||||
{
|
||||
if (&rhs == this)
|
||||
return *this ;
|
||||
if (p != SF_NULL && -- p->ref == 0)
|
||||
delete p ;
|
||||
|
||||
p = rhs.p ;
|
||||
rhs.p = SF_NULL ;
|
||||
|
||||
return *this ;
|
||||
} /* SndfileHandle move assignment */
|
||||
|
||||
#endif
|
||||
|
||||
inline int
|
||||
SndfileHandle::error (void) const
|
||||
{ return sf_error (p->sf) ; }
|
||||
|
||||
inline const char *
|
||||
SndfileHandle::strError (void) const
|
||||
{ return sf_strerror (p->sf) ; }
|
||||
|
||||
inline int
|
||||
SndfileHandle::command (int cmd, void *data, int datasize)
|
||||
{ return sf_command (p->sf, cmd, data, datasize) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::seek (sf_count_t frame_count, int whence)
|
||||
{ return sf_seek (p->sf, frame_count, whence) ; }
|
||||
|
||||
inline void
|
||||
SndfileHandle::writeSync (void)
|
||||
{ sf_write_sync (p->sf) ; }
|
||||
|
||||
inline int
|
||||
SndfileHandle::setString (int str_type, const char* str)
|
||||
{ return sf_set_string (p->sf, str_type, str) ; }
|
||||
|
||||
inline const char*
|
||||
SndfileHandle::getString (int str_type) const
|
||||
{ return sf_get_string (p->sf, str_type) ; }
|
||||
|
||||
inline int
|
||||
SndfileHandle::formatCheck (int fmt, int chans, int srate)
|
||||
{
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
sfinfo.frames = 0 ;
|
||||
sfinfo.channels = chans ;
|
||||
sfinfo.format = fmt ;
|
||||
sfinfo.samplerate = srate ;
|
||||
sfinfo.sections = 0 ;
|
||||
sfinfo.seekable = 0 ;
|
||||
|
||||
return sf_format_check (&sfinfo) ;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::read (short *ptr, sf_count_t items)
|
||||
{ return sf_read_short (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::read (int *ptr, sf_count_t items)
|
||||
{ return sf_read_int (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::read (float *ptr, sf_count_t items)
|
||||
{ return sf_read_float (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::read (double *ptr, sf_count_t items)
|
||||
{ return sf_read_double (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::write (const short *ptr, sf_count_t items)
|
||||
{ return sf_write_short (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::write (const int *ptr, sf_count_t items)
|
||||
{ return sf_write_int (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::write (const float *ptr, sf_count_t items)
|
||||
{ return sf_write_float (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::write (const double *ptr, sf_count_t items)
|
||||
{ return sf_write_double (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readf (short *ptr, sf_count_t frame_count)
|
||||
{ return sf_readf_short (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readf (int *ptr, sf_count_t frame_count)
|
||||
{ return sf_readf_int (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readf (float *ptr, sf_count_t frame_count)
|
||||
{ return sf_readf_float (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readf (double *ptr, sf_count_t frame_count)
|
||||
{ return sf_readf_double (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writef (const short *ptr, sf_count_t frame_count)
|
||||
{ return sf_writef_short (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writef (const int *ptr, sf_count_t frame_count)
|
||||
{ return sf_writef_int (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writef (const float *ptr, sf_count_t frame_count)
|
||||
{ return sf_writef_float (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writef (const double *ptr, sf_count_t frame_count)
|
||||
{ return sf_writef_double (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readRaw (void *ptr, sf_count_t bytes)
|
||||
{ return sf_read_raw (p->sf, ptr, bytes) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writeRaw (const void *ptr, sf_count_t bytes)
|
||||
{ return sf_write_raw (p->sf, ptr, bytes) ; }
|
||||
|
||||
inline SNDFILE *
|
||||
SndfileHandle::rawHandle (void)
|
||||
{ return (p ? p->sf : SF_NULL) ; }
|
||||
|
||||
inline SNDFILE *
|
||||
SndfileHandle::takeOwnership (void)
|
||||
{
|
||||
if (p == SF_NULL || (p->ref != 1))
|
||||
return SF_NULL ;
|
||||
|
||||
SNDFILE * sf = p->sf ;
|
||||
p->sf = SF_NULL ;
|
||||
delete p ;
|
||||
p = SF_NULL ;
|
||||
return sf ;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (const wchar_t *wpath, int mode, int fmt, int chans, int srate)
|
||||
: p (SF_NULL)
|
||||
{
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != SF_NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_wchar_open (wpath, mode, &p->sfinfo) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle const wchar_t * constructor */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* SNDFILE_HH */
|
||||
|
||||
80
Engine/lib/libsndfile/m4/ax_add_fortify_source.m4
Normal file
80
Engine/lib/libsndfile/m4/ax_add_fortify_source.m4
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_add_fortify_source.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_ADD_FORTIFY_SOURCE
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether -D_FORTIFY_SOURCE=2 can be added to CPPFLAGS without macro
|
||||
# redefinition warnings, other cpp warnings or linker. Some distributions
|
||||
# (such as Gentoo Linux) enable _FORTIFY_SOURCE globally in their
|
||||
# compilers, leading to unnecessary warnings in the form of
|
||||
#
|
||||
# <command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
|
||||
# <built-in>: note: this is the location of the previous definition
|
||||
#
|
||||
# which is a problem if -Werror is enabled. This macro checks whether
|
||||
# _FORTIFY_SOURCE is already defined, and if not, adds -D_FORTIFY_SOURCE=2
|
||||
# to CPPFLAGS.
|
||||
#
|
||||
# Newer mingw-w64 msys2 package comes with a bug in
|
||||
# headers-git-7.0.0.5546.d200317d-1. It broke -D_FORTIFY_SOURCE support,
|
||||
# and would need -lssp or -fstack-protector. See
|
||||
# https://github.com/msys2/MINGW-packages/issues/5803. Try to actually
|
||||
# link it.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2017 David Seifert <soap@gentoo.org>
|
||||
# Copyright (c) 2019 Reini Urban <rurban@cpan.org>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 4
|
||||
|
||||
AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[
|
||||
ac_save_cflags=$CFLAGS
|
||||
ac_cwerror_flag=yes
|
||||
AX_CHECK_COMPILE_FLAG([-Werror],[CFLAGS="$CFLAGS -Werror"])
|
||||
AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 to CPPFLAGS])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([],
|
||||
[[
|
||||
#ifndef _FORTIFY_SOURCE
|
||||
return 0;
|
||||
#else
|
||||
this_is_an_error;
|
||||
#endif
|
||||
]]
|
||||
)],
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_SOURCE([[
|
||||
#define _FORTIFY_SOURCE 2
|
||||
#include <string.h>
|
||||
int main() {
|
||||
char *s = " ";
|
||||
strcpy(s, "x");
|
||||
return strlen(s)-1;
|
||||
}
|
||||
]]
|
||||
)],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
CFLAGS=$ac_save_cflags
|
||||
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
CFLAGS=$ac_save_cflags
|
||||
],
|
||||
),
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
CFLAGS=$ac_save_cflags
|
||||
])
|
||||
])
|
||||
67
Engine/lib/libsndfile/m4/ax_append_compile_flags.m4
Normal file
67
Engine/lib/libsndfile/m4/ax_append_compile_flags.m4
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# ============================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
|
||||
# ============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# For every FLAG1, FLAG2 it is checked whether the compiler works with the
|
||||
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||
# CFLAGS) is used. During the check the flag is always added to the
|
||||
# current language's flags.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: This macro depends on the AX_APPEND_FLAG and
|
||||
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
|
||||
# AX_APPEND_LINK_FLAGS.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 6
|
||||
|
||||
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
|
||||
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
for flag in $1; do
|
||||
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
|
||||
done
|
||||
])dnl AX_APPEND_COMPILE_FLAGS
|
||||
71
Engine/lib/libsndfile/m4/ax_append_flag.m4
Normal file
71
Engine/lib/libsndfile/m4/ax_append_flag.m4
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
|
||||
# added in between.
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
|
||||
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
|
||||
# FLAG.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 7
|
||||
|
||||
AC_DEFUN([AX_APPEND_FLAG],
|
||||
[dnl
|
||||
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
|
||||
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
|
||||
AS_VAR_SET_IF(FLAGS,[
|
||||
AS_CASE([" AS_VAR_GET(FLAGS) "],
|
||||
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
|
||||
[
|
||||
AS_VAR_APPEND(FLAGS,[" $1"])
|
||||
AC_RUN_LOG([: FLAGS="$FLAGS"])
|
||||
])
|
||||
],
|
||||
[
|
||||
AS_VAR_SET(FLAGS,[$1])
|
||||
AC_RUN_LOG([: FLAGS="$FLAGS"])
|
||||
])
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])dnl AX_APPEND_FLAG
|
||||
65
Engine/lib/libsndfile/m4/ax_append_link_flags.m4
Normal file
65
Engine/lib/libsndfile/m4/ax_append_link_flags.m4
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# For every FLAG1, FLAG2 it is checked whether the linker works with the
|
||||
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
|
||||
# used. During the check the flag is always added to the linker's flags.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
|
||||
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
|
||||
# issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
|
||||
# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 6
|
||||
|
||||
AC_DEFUN([AX_APPEND_LINK_FLAGS],
|
||||
[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
for flag in $1; do
|
||||
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
|
||||
done
|
||||
])dnl AX_APPEND_LINK_FLAGS
|
||||
74
Engine/lib/libsndfile/m4/ax_check_compile_flag.m4
Normal file
74
Engine/lib/libsndfile/m4/ax_check_compile_flag.m4
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 5
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
||||
74
Engine/lib/libsndfile/m4/ax_check_link_flag.m4
Normal file
74
Engine/lib/libsndfile/m4/ax_check_link_flag.m4
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the linker or gives an error.
|
||||
# (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
|
||||
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
|
||||
# issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_LINK_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 5
|
||||
|
||||
AC_DEFUN([AX_CHECK_LINK_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS $4 $1"
|
||||
AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
LDFLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_LINK_FLAGS
|
||||
87
Engine/lib/libsndfile/m4/ax_compiler_vendor.m4
Normal file
87
Engine/lib/libsndfile/m4/ax_compiler_vendor.m4
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPILER_VENDOR
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun,
|
||||
# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft,
|
||||
# watcom, etc. The vendor is returned in the cache variable
|
||||
# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2008 Matteo Frigo
|
||||
#
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 16
|
||||
|
||||
AC_DEFUN([AX_COMPILER_VENDOR],
|
||||
[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
|
||||
dnl Please add if possible support to ax_compiler_version.m4
|
||||
[# note: don't check for gcc first since some other compilers define __GNUC__
|
||||
vendors="intel: __ICC,__ECC,__INTEL_COMPILER
|
||||
ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__
|
||||
pathscale: __PATHCC__,__PATHSCALE__
|
||||
clang: __clang__
|
||||
cray: _CRAYC
|
||||
fujitsu: __FUJITSU
|
||||
gnu: __GNUC__
|
||||
sun: __SUNPRO_C,__SUNPRO_CC
|
||||
hp: __HP_cc,__HP_aCC
|
||||
dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
|
||||
borland: __BORLANDC__,__CODEGEARC__,__TURBOC__
|
||||
comeau: __COMO__
|
||||
kai: __KCC
|
||||
lcc: __LCC__
|
||||
sgi: __sgi,sgi
|
||||
microsoft: _MSC_VER
|
||||
metrowerks: __MWERKS__
|
||||
watcom: __WATCOMC__
|
||||
portland: __PGI
|
||||
tcc: __TINYC__
|
||||
unknown: UNKNOWN"
|
||||
for ventest in $vendors; do
|
||||
case $ventest in
|
||||
*:) vendor=$ventest; continue ;;
|
||||
*) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;;
|
||||
esac
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
|
||||
#if !($vencpp)
|
||||
thisisanerror;
|
||||
#endif
|
||||
])], [break])
|
||||
done
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
|
||||
])
|
||||
])
|
||||
492
Engine/lib/libsndfile/m4/ax_compiler_version.m4
Normal file
492
Engine/lib/libsndfile/m4/ax_compiler_version.m4
Normal file
|
|
@ -0,0 +1,492 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_compiler_version.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPILER_VERSION
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro retrieves the compiler version and returns it in the cache
|
||||
# variable $ax_cv_c_compiler_version for C and $ax_cv_cxx_compiler_version
|
||||
# for C++.
|
||||
#
|
||||
# Version is returned as epoch:major.minor.patchversion
|
||||
#
|
||||
# Epoch is used in order to have an increasing version number in case of
|
||||
# marketing change.
|
||||
#
|
||||
# Epoch use: * borland compiler use chronologically 0turboc for turboc
|
||||
# era,
|
||||
#
|
||||
# 1borlanc BORLANDC++ before 5, 2cppbuilder for cppbuilder era,
|
||||
# 3borlancpp for return of BORLANDC++ (after version 5.5),
|
||||
# 4cppbuilder for cppbuilder with year version,
|
||||
# and 5xe for XE era.
|
||||
#
|
||||
# An empty string is returned otherwise.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 9
|
||||
|
||||
# for intel
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_INTEL],
|
||||
[ dnl
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
[__INTEL_COMPILER/100],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown intel compiler version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
[(__INTEL_COMPILER%100)/10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown intel compiler version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[(__INTEL_COMPILER%10)],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown intel compiler version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
# for IBM
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_IBM],
|
||||
[ dnl
|
||||
dnl check between z/OS C/C++ and XL C/C++
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([],
|
||||
[
|
||||
#if defined(__COMPILER_VER__)
|
||||
choke me;
|
||||
#endif
|
||||
])],
|
||||
[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
[__xlC__/100],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown IBM compiler major version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
[__xlC__%100],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown IBM compiler minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[__xlC_ver__/0x100],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown IBM compiler patch version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_build,
|
||||
[__xlC_ver__%0x100],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown IBM compiler build version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_build"
|
||||
],
|
||||
[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[__xlC__%1000],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown IBM compiler patch version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
[(__xlC__/10000)%10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown IBM compiler minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
[(__xlC__/100000)%10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown IBM compiler major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
])
|
||||
|
||||
# for pathscale
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_PATHSCALE],[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
__PATHCC__,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown pathscale major]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
__PATHCC_MINOR__,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown pathscale minor]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[__PATHCC_PATCHLEVEL__],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown pathscale patch level]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
# for clang
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_CLANG],[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
__clang_major__,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown clang major]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
__clang_minor__,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown clang minor]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[__clang_patchlevel__],,0)
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
# for crayc
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_CRAY],[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
_RELEASE,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown crayc release]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
_RELEASE_MINOR,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown crayc minor]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"
|
||||
])
|
||||
|
||||
# for fujitsu
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_FUJITSU],[
|
||||
AC_COMPUTE_INT(ax_cv_[]_AC_LANG_ABBREV[]_compiler_version,
|
||||
__FCC_VERSION,,
|
||||
AC_MSG_FAILURE([[[$0]]unknown fujitsu release]))
|
||||
])
|
||||
|
||||
# for GNU
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_GNU],[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
__GNUC__,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown gcc major]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
__GNUC_MINOR__,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown gcc minor]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[__GNUC_PATCHLEVEL__],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown gcc patch level]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
# For sun
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_SUN],[
|
||||
m4_define([_AX_COMPILER_VERSION_SUN_NUMBER],
|
||||
[
|
||||
#if defined(__SUNPRO_CC)
|
||||
__SUNPRO_CC
|
||||
#else
|
||||
__SUNPRO_C
|
||||
#endif
|
||||
])
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_until59,
|
||||
!!(_AX_COMPILER_VERSION_SUN_NUMBER < 0x1000),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown sun release version]))
|
||||
AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_until59" = X1],
|
||||
[dnl
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
_AX_COMPILER_VERSION_SUN_NUMBER % 0x10,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown sun patch version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
(_AX_COMPILER_VERSION_SUN_NUMBER / 0x10) % 0x10,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown sun minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
(_AX_COMPILER_VERSION_SUN_NUMBER / 0x100),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown sun major version]))
|
||||
],
|
||||
[dnl
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
_AX_COMPILER_VERSION_SUN_NUMBER % 0x10,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown sun patch version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
(_AX_COMPILER_VERSION_SUN_NUMBER / 0x100) % 0x100,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown sun minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
(_AX_COMPILER_VERSION_SUN_NUMBER / 0x1000),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown sun major version]))
|
||||
])
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_HP],[
|
||||
m4_define([_AX_COMPILER_VERSION_HP_NUMBER],
|
||||
[
|
||||
#if defined(__HP_cc)
|
||||
__HP_cc
|
||||
#else
|
||||
__HP_aCC
|
||||
#endif
|
||||
])
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_untilA0121,
|
||||
!!(_AX_COMPILER_VERSION_HP_NUMBER <= 1),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown hp release version]))
|
||||
AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_untilA0121" = X1],
|
||||
[dnl By default output last version with this behavior.
|
||||
dnl it is so old
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="01.21.00"
|
||||
],
|
||||
[dnl
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
(_AX_COMPILER_VERSION_HP_NUMBER % 100),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown hp release version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
((_AX_COMPILER_VERSION_HP_NUMBER / 100)%100),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown hp minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
((_AX_COMPILER_VERSION_HP_NUMBER / 10000)%100),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown hp major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_DEC],[dnl
|
||||
m4_define([_AX_COMPILER_VERSION_DEC_NUMBER],
|
||||
[
|
||||
#if defined(__DECC_VER)
|
||||
__DECC_VER
|
||||
#else
|
||||
__DECCXX_VER
|
||||
#endif
|
||||
])
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
(_AX_COMPILER_VERSION_DEC_NUMBER % 10000),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown dec release version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
((_AX_COMPILER_VERSION_DEC_NUMBER / 100000UL)%100),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown dec minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
((_AX_COMPILER_VERSION_DEC_NUMBER / 10000000UL)%100),,
|
||||
AC_MSG_FAILURE([[[$0]] unknown dec major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
# borland
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_BORLAND],[dnl
|
||||
m4_define([_AX_COMPILER_VERSION_TURBOC_NUMBER],
|
||||
[
|
||||
#if defined(__TURBOC__)
|
||||
__TURBOC__
|
||||
#else
|
||||
choke me
|
||||
#endif
|
||||
])
|
||||
m4_define([_AX_COMPILER_VERSION_BORLANDC_NUMBER],
|
||||
[
|
||||
#if defined(__BORLANDC__)
|
||||
__BORLANDC__
|
||||
#else
|
||||
__CODEGEARC__
|
||||
#endif
|
||||
])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(,
|
||||
_AX_COMPILER_VERSION_TURBOC_NUMBER)],
|
||||
[dnl TURBOC
|
||||
AC_COMPUTE_INT(
|
||||
_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw,
|
||||
_AX_COMPILER_VERSION_TURBOC_NUMBER,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown turboc version]))
|
||||
AS_IF(
|
||||
[test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw -lt 661 || test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw -gt 1023],
|
||||
[dnl compute normal version
|
||||
AC_COMPUTE_INT(
|
||||
_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
_AX_COMPILER_VERSION_TURBOC_NUMBER % 0x100,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown turboc minor version]))
|
||||
AC_COMPUTE_INT(
|
||||
_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
(_AX_COMPILER_VERSION_TURBOC_NUMBER/0x100)%0x100,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown turboc major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"],
|
||||
[dnl special version
|
||||
AS_CASE([$_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw],
|
||||
[661],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:1.00"],
|
||||
[662],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:1.01"],
|
||||
[663],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:2.00"],
|
||||
[
|
||||
AC_MSG_WARN([[[$0]] unknown turboc version between 0x295 and 0x400 please report bug])
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=""
|
||||
])
|
||||
])
|
||||
],
|
||||
# borlandc
|
||||
[
|
||||
AC_COMPUTE_INT(
|
||||
_ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw,
|
||||
_AX_COMPILER_VERSION_BORLANDC_NUMBER,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown borlandc version]))
|
||||
AS_CASE([$_ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw],
|
||||
dnl BORLANDC++ before 5.5
|
||||
[512] ,[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:2.00"],
|
||||
[1024],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.00"],
|
||||
[1024],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.00"],
|
||||
[1040],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.1"],
|
||||
[1106],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:4.0"],
|
||||
[1280],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:5.0"],
|
||||
[1312],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:5.02"],
|
||||
dnl C++ Builder era
|
||||
[1328],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="2cppbuilder:3.0"],
|
||||
[1344],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="2cppbuilder:4.0"],
|
||||
dnl BORLANDC++ after 5.5
|
||||
[1360],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.5"],
|
||||
[1361],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.51"],
|
||||
[1378],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.6.4"],
|
||||
dnl C++ Builder with year number
|
||||
[1392],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2006"],
|
||||
[1424],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2007"],
|
||||
[1555],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2009"],
|
||||
[1569],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2010"],
|
||||
dnl XE version
|
||||
[1584],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe"],
|
||||
[1600],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:2"],
|
||||
[1616],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:3"],
|
||||
[1632],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:4"],
|
||||
[
|
||||
AC_MSG_WARN([[[$0]] Unknown borlandc compiler version $_ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw please report bug])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
# COMO
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_COMEAU],
|
||||
[ dnl
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
[__COMO_VERSION__%100],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown comeau compiler minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
[(__COMO_VERSION__/100)%10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown comeau compiler major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"
|
||||
])
|
||||
|
||||
# KAI
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_KAI],[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[__KCC_VERSION%100],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown kay compiler patch version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
[(__KCC_VERSION/100)%10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown kay compiler minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
[(__KCC_VERSION/1000)%10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown kay compiler major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
dnl LCC
|
||||
dnl LCC does not output version...
|
||||
|
||||
# SGI
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_SGI],[
|
||||
m4_define([_AX_COMPILER_VERSION_SGI_NUMBER],
|
||||
[
|
||||
#if defined(_COMPILER_VERSION)
|
||||
_COMPILER_VERSION
|
||||
#else
|
||||
_SGI_COMPILER_VERSION
|
||||
#endif
|
||||
])
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[_AX_COMPILER_VERSION_SGI_NUMBER%10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown SGI compiler patch version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
[(_AX_COMPILER_VERSION_SGI_NUMBER/10)%10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown SGI compiler minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
[(_AX_COMPILER_VERSION_SGI_NUMBER/100)%10],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown SGI compiler major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
# microsoft
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_MICROSOFT],[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
_MSC_VER%100,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown microsoft compiler minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
(_MSC_VER/100)%100,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown microsoft compiler major version]))
|
||||
dnl could be overridden
|
||||
_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch=0
|
||||
_ax_[]_AC_LANG_ABBREV[]_compiler_version_build=0
|
||||
# special case for version 6
|
||||
AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major" = "X12"],
|
||||
[AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
_MSC_FULL_VER%1000,,
|
||||
_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch=0)])
|
||||
# for version 7
|
||||
AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major" = "X13"],
|
||||
[AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
_MSC_FULL_VER%1000,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown microsoft compiler patch version]))
|
||||
])
|
||||
# for version > 8
|
||||
AS_IF([test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_major -ge 14],
|
||||
[AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
_MSC_FULL_VER%10000,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown microsoft compiler patch version]))
|
||||
])
|
||||
AS_IF([test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_major -ge 15],
|
||||
[AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_build,
|
||||
_MSC_BUILD,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown microsoft compiler build version]))
|
||||
])
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_build"
|
||||
])
|
||||
|
||||
# for metrowerks
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_METROWERKS],[dnl
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
__MWERKS__%0x100,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown metrowerks compiler patch version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
(__MWERKS__/0x100)%0x10,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown metrowerks compiler minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
(__MWERKS__/0x1000)%0x10,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown metrowerks compiler major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
# for watcom
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_WATCOM],[dnl
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
__WATCOMC__%100,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown watcom compiler minor version]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
(__WATCOMC__/100)%100,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown watcom compiler major version]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"
|
||||
])
|
||||
|
||||
# for PGI
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_PORTLAND],[
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
|
||||
__PGIC__,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown pgi major]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
|
||||
__PGIC_MINOR__,,
|
||||
AC_MSG_FAILURE([[[$0]] unknown pgi minor]))
|
||||
AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
|
||||
[__PGIC_PATCHLEVEL__],,
|
||||
AC_MSG_FAILURE([[[$0]] unknown pgi patch level]))
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
|
||||
])
|
||||
|
||||
# tcc
|
||||
AC_DEFUN([_AX_COMPILER_VERSION_TCC],[
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=[`tcc -v | $SED 's/^[ ]*tcc[ ]\+version[ ]\+\([0-9.]\+\).*/\1/g'`]
|
||||
])
|
||||
# main entry point
|
||||
AC_DEFUN([AX_COMPILER_VERSION],[dnl
|
||||
AC_REQUIRE([AX_COMPILER_VENDOR])
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
AC_CACHE_CHECK([for _AC_LANG compiler version],
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_compiler_version,
|
||||
[ dnl
|
||||
AS_CASE([$ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor],
|
||||
[intel],[_AX_COMPILER_VERSION_INTEL],
|
||||
[ibm],[_AX_COMPILER_VERSION_IBM],
|
||||
[pathscale],[_AX_COMPILER_VERSION_PATHSCALE],
|
||||
[clang],[_AX_COMPILER_VERSION_CLANG],
|
||||
[cray],[_AX_COMPILER_VERSION_CRAY],
|
||||
[fujitsu],[_AX_COMPILER_VERSION_FUJITSU],
|
||||
[gnu],[_AX_COMPILER_VERSION_GNU],
|
||||
[sun],[_AX_COMPILER_VERSION_SUN],
|
||||
[hp],[_AX_COMPILER_VERSION_HP],
|
||||
[dec],[_AX_COMPILER_VERSION_DEC],
|
||||
[borland],[_AX_COMPILER_VERSION_BORLAND],
|
||||
[comeau],[_AX_COMPILER_VERSION_COMEAU],
|
||||
[kai],[_AX_COMPILER_VERSION_KAI],
|
||||
[sgi],[_AX_COMPILER_VERSION_SGI],
|
||||
[microsoft],[_AX_COMPILER_VERSION_MICROSOFT],
|
||||
[metrowerks],[_AX_COMPILER_VERSION_METROWERKS],
|
||||
[watcom],[_AX_COMPILER_VERSION_WATCOM],
|
||||
[portland],[_AX_COMPILER_VERSION_PORTLAND],
|
||||
[tcc],[_AX_COMPILER_VERSION_TCC],
|
||||
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=""])
|
||||
])
|
||||
])
|
||||
56
Engine/lib/libsndfile/m4/ax_recursive_eval.m4
Normal file
56
Engine/lib/libsndfile/m4/ax_recursive_eval.m4
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_recursive_eval.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_RECURSIVE_EVAL(VALUE, RESULT)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Interpolate the VALUE in loop until it doesn't change, and set the
|
||||
# result to $RESULT. WARNING: It's easy to get an infinite loop with some
|
||||
# unsane input.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Alexandre Duret-Lutz <adl@gnu.org>
|
||||
#
|
||||
# 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, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 1
|
||||
|
||||
AC_DEFUN([AX_RECURSIVE_EVAL],
|
||||
[_lcl_receval="$1"
|
||||
$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
|
||||
_lcl_receval_old=''
|
||||
while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
|
||||
_lcl_receval_old="[$]_lcl_receval"
|
||||
eval _lcl_receval="\"[$]_lcl_receval\""
|
||||
done
|
||||
echo "[$]_lcl_receval")`])
|
||||
37
Engine/lib/libsndfile/m4/ax_require_defined.m4
Normal file
37
Engine/lib/libsndfile/m4/ax_require_defined.m4
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_REQUIRE_DEFINED(MACRO)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
|
||||
# been defined and thus are available for use. This avoids random issues
|
||||
# where a macro isn't expanded. Instead the configure script emits a
|
||||
# non-fatal:
|
||||
#
|
||||
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
|
||||
#
|
||||
# It's like AC_REQUIRE except it doesn't expand the required macro.
|
||||
#
|
||||
# Here's an example:
|
||||
#
|
||||
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
|
||||
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
|
||||
])dnl AX_REQUIRE_DEFINED
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue