Compare commits

...

7219 Commits

Author SHA1 Message Date
Ivan Epifanov 27239f7844 Bump cmake version 2026-01-28 19:45:50 +03:00
Ivan Epifanov 75e5b00ef7 Allow setting thread affinity/priority and bump cmake version 2026-01-28 15:46:16 +03:00
Ivan Epifanov 430467664c Update openal 2021-02-28 23:04:23 +03:00
Ivan Epifanov ef45405eed Samplerate fixes 2021-01-28 23:36:19 +03:00
Ivan Epifanov 425e5b5615 Fixes 2021-01-27 18:48:35 +03:00
Ivan Epifanov cd9f8bd49d Building 2021-01-27 18:18:42 +03:00
Ivan Epifanov d9f5668968 Master is for patchsets 2021-01-27 18:16:01 +03:00
Chris Robinson 5ff5fd8ecc Use a standard bitset for bitfield flags 2021-01-22 00:00:10 -08:00
Chris Robinson 5729e1004d Make the endian test more C++-like 2021-01-21 23:21:18 -08:00
Chris Robinson 87dbeed853 Update apt before installing dependencies 2021-01-21 09:15:18 -08:00
Chris Robinson fb6585cf18 Fix handling paused devices with the wave writer backend 2021-01-21 06:51:29 -08:00
Chris Robinson 19adb622ef Simplify a division
The division opcode typically also generates the remainder, making the result
of x%y free with x/y.
2021-01-21 06:27:11 -08:00
Chris Robinson db4de2b56a Avoid declaring some variables multiple times 2021-01-21 06:25:50 -08:00
Chris Robinson 20f5e7c1fa Avoid global constexpr arrays 2021-01-21 04:03:30 -08:00
Chris Robinson 92c653e5f0 Update ChangeLog 2021-01-20 17:47:36 -08:00
Chris Robinson 1c649943f7 Revert "Print the build results after CI"
This reverts commit e1e0809253.
2021-01-20 06:33:11 -08:00
Chris Robinson e1e0809253 Print the build results after CI 2021-01-20 04:16:06 -08:00
Chris Robinson 32e0d92c51 Avoid extra copies/work when reading HRTF data 2021-01-20 01:26:55 -08:00
Chris Robinson 13698362f1 Avoid explicitly searching for the WindowsSDK
It's causing problems with various setups. So instead we'll have to assume some
things for Windows (namely that winmm exists, and if dsound isn't in DXSDK_DIR,
it needs to be in the compiler's default paths to be usable).
2021-01-19 17:19:44 -08:00
Chris Robinson c3380d4201 Remove constexpr from a function
Various versions of GCC have a problem with it, and it doesn't really add much
benefit anyway.
2021-01-17 23:39:33 -08:00
Chris Robinson 8ebf146c72 First try at using GitHub Actions 2021-01-17 23:09:42 -08:00
Chris Robinson 229bf45e24 Avoid calling readAdvance in a loop 2021-01-17 03:17:46 -08:00
Chris Robinson 855a8c0cd9 Don't assume the ring buffer's read vector is the next writable space
This is untrue since the ring buffer leaves one element unwritten, so there's
one extra element to be written once a readable element is read.
2021-01-15 18:18:07 -08:00
Chris Robinson 8c4adfd752 Use a span instead of passing a vector by reference 2021-01-11 17:39:57 -08:00
Chris Robinson 1f01311ee3 Make sure proper names are used for querying PulseAudio info 2021-01-10 13:34:05 -08:00
kcat 3348d3ce15 Merge pull request #515 from ilya-fedin/pulse-nullptr-default
Pass nullptr to pulse for default device
2021-01-10 11:25:05 -08:00
Ilya Fedin a30d3ad803 Pass nullptr to pulse for default device 2021-01-10 16:23:08 +04:00
Chris Robinson b99adb623d Remove the invalid noexcept specification 2021-01-08 19:23:17 -08:00
Chris Robinson 89906453ea Quickly fade out samples of a stopping voice
Rather than linearly fading out the mix over the mixing update, logarithmically
fade out the post-resampled samples by approx -60dB per millisecond.
2021-01-08 18:54:46 -08:00
Chris Robinson 537fd6d0a1 Avoid dereferencing the end iterator 2021-01-08 18:51:25 -08:00
Chris Robinson 1f24f5caa1 Ensure the endian test is constexpr 2021-01-06 18:04:04 -08:00
Chris Robinson 948ae3bc7e Avoid duplicating an inline template function 2021-01-06 17:52:50 -08:00
Chris Robinson a9ac165c39 Properly trace the new HRTF delay for the B-Format decoder 2021-01-06 17:19:10 -08:00
Chris Robinson 292de73c75 Use a template to read integers with endian awareness 2021-01-06 17:10:03 -08:00
Chris Robinson 04cd0bc576 Return non-const from the resampler function 2021-01-02 17:37:09 -08:00
Chris Robinson 1f51de9983 Make optional trivially destructible if the stored type is 2021-01-02 14:24:53 -08:00
Chris Robinson d6495b35df Fix comment typo 2021-01-01 15:35:46 -08:00
Chris Robinson 1327aca9d7 Don't use templates unnecessarily 2021-01-01 15:35:14 -08:00
Chris Robinson 87a862199d Make FPUCtl methods noexcept 2020-12-31 18:23:59 -08:00
Chris Robinson 20ef8bf390 Move cpu_caps and fpu_ctrl to core 2020-12-31 16:47:12 -08:00
Chris Robinson 002c506296 Remove an unnecessary include 2020-12-31 13:15:38 -08:00
Chris Robinson f2b7a063ef Add NEON-enhanced FIR loops for convolution and UHJ 2020-12-31 13:01:17 -08:00
Chris Robinson 9d354f721c Assume run-time NEON support if detected by cmake 2020-12-31 11:42:02 -08:00
Chris Robinson 78f3d8fcd8 Check for SSE and NEON earlier 2020-12-31 11:16:44 -08:00
Chris Robinson ec7e7c9174 Avoid ugly reinterpret_casts with offsetof 2020-12-29 09:57:08 -08:00
Chris Robinson 96942d7968 Combine multiple functions into one 2020-12-28 08:37:49 -08:00
Chris Robinson aae115c35a Return an intrusive_ptr from EffectStateFactory::create 2020-12-28 08:04:23 -08:00
Chris Robinson 15e05fcef8 Workaround a GCC 5 constexpr function bug 2020-12-28 03:36:26 -08:00
Chris Robinson 7fe9d8d20c Remove extraneous semicolor 2020-12-28 02:50:15 -08:00
Chris Robinson 62fa6a2277 Avoid including voice.h in alcontext.h 2020-12-27 16:14:11 -08:00
Chris Robinson ffa7d1b1a7 Reduce a few lines 2020-12-27 14:37:43 -08:00
Chris Robinson 43d053cb32 Reorder some device fields 2020-12-27 12:23:35 -08:00
Chris Robinson 04358890d9 Use a unique_ptr to hold DistanceComp data 2020-12-27 11:30:45 -08:00
Chris Robinson adb5467720 Use smaller types for enums 2020-12-27 10:28:59 -08:00
Chris Robinson 4c0f77c13e Remove some unnecessary constructors 2020-12-27 06:43:59 -08:00
Chris Robinson 7833cfa8de Make FlexArray trivially destructible when possible 2020-12-27 04:29:54 -08:00
Chris Robinson cf7f201c92 Reorder some context properties 2020-12-27 03:11:01 -08:00
Chris Robinson cd2ebb9c3a Use a uint for a bitfield 2020-12-27 01:05:16 -08:00
Chris Robinson e20143fcc4 Move the WetBuffer reference to EffectSlot 2020-12-27 00:14:58 -08:00
Chris Robinson 507cbfa027 Combine EffectState::deviceUpdate with setBuffer 2020-12-26 12:33:00 -08:00
Chris Robinson 54719de132 Avoid AL enums for the EffectSlot type 2020-12-26 09:21:30 -08:00
Chris Robinson 8850a3f730 Combine variable terms separate from the scaling weights 2020-12-26 06:27:49 -08:00
Chris Robinson 8a86ec8ac5 Add a crossover frequency field for the device
Used when upsampling low-order ambisonic signals to higher order. Rather than a
hardcoded 400hz, it ensures a consistent crossover point when an ambdec
configuration is used. It can also allow for an alsoft config option.
2020-12-26 05:23:08 -08:00
Chris Robinson 5f233a2c24 Use more constexpr variables instead of macros 2020-12-25 20:52:18 -08:00
Chris Robinson 223f93e13d Increase direct HRTF delay to 256
This should improve the error from the all-pass on the partial input.
2020-12-25 13:02:22 -08:00
Chris Robinson f6e29ce5bb Return an optional for an error 2020-12-25 09:26:24 -08:00
Chris Robinson 78f73a4277 Avoid dynamic vectors in AmbDecConf
Also add a bit more sanity checking
2020-12-25 08:31:02 -08:00
Chris Robinson eaf209d2f1 Update a comment and type used in the convolution effect 2020-12-25 07:00:57 -08:00
Chris Robinson 204f7d8811 Rename From2D to FromACN2D 2020-12-25 06:40:13 -08:00
Chris Robinson 20820fd01b Move the ambdec loader to core 2020-12-25 06:30:47 -08:00
Chris Robinson fe9ec157fd Use an import target for linking OpenSL 2020-12-24 22:49:55 -08:00
Chris Robinson 4bc686d89b Remove unnecessary includes 2020-12-24 22:49:55 -08:00
Chris Robinson 0d3b041aa2 Avoid AL types and enums in the effect processors 2020-12-24 22:49:55 -08:00
Chris Robinson eedc42890f Move alexcpt to core 2020-12-24 22:49:55 -08:00
Chris Robinson 63ea62bea1 Avoid some more AL types 2020-12-24 22:49:55 -08:00
David CARLIER 8c4c14ea73 fast_roundf implementations in asm for ARM64. (#511) 2020-12-24 22:48:57 -08:00
Chris Robinson 6ae0115bf7 Avoid AL/ALC types in the backends 2020-12-17 23:21:45 -08:00
Chris Robinson 5edd5a11fc Don't use ALC error enums for the backend error code 2020-12-17 21:07:53 -08:00
Chris Robinson 7d2e21334c Move the AL error enum out of base_exception 2020-12-17 16:46:21 -08:00
Chris Robinson 4d1ac95ae2 Don't return an enum from captureSamples
It's always no_error
2020-12-17 03:06:52 -08:00
Chris Robinson d578bc6cb1 Move logging to core 2020-12-17 02:47:03 -08:00
Chris Robinson f0fe57dc5a Don't link DistanceModel enums to AL values 2020-12-16 14:58:55 -08:00
Chris Robinson efc9c146c3 Move AsyncEvent to a separate header 2020-12-16 13:58:51 -08:00
Chris Robinson 9710a859fa Add missing include 2020-12-16 03:02:49 -08:00
Chris Robinson 41594a07bc Update changelog 2020-12-16 02:17:18 -08:00
Chris Robinson 02be0149f1 Send stop events when stopping paused voices 2020-12-16 02:12:18 -08:00
Chris Robinson c96b50fb65 Use a separate enum for the VoiceChange state 2020-12-16 01:40:15 -08:00
Chris Robinson 5ad28f8cba Move VoiceChange to a separate header 2020-12-16 00:50:50 -08:00
Chris Robinson f38919eecc Avoid using a hidden unnamed template parameter 2020-12-15 23:47:47 -08:00
Chris Robinson 5b51a58ff2 Fix some includes 2020-12-15 23:39:17 -08:00
Chris Robinson 304ab8d890 Avoid a generic event struct 2020-12-15 21:32:01 -08:00
Chris Robinson a08f68f213 Avoid some AL types 2020-12-15 20:48:21 -08:00
Chris Robinson daf9d46478 Use a separate structure for the context/listener params 2020-12-15 18:41:50 -08:00
Chris Robinson 03358a0d80 Avoid changing the global CPU flags in FillCPUCaps 2020-12-15 12:33:57 -08:00
Chris Robinson 9435641c0d Remove unneeded includes 2020-12-15 01:31:09 -08:00
Chris Robinson 56af137ba0 Move fmt_traits to core 2020-12-13 21:12:03 -08:00
Chris Robinson 783904e414 Avoid compiling different sources for different targets
Simplifies configuration and fixes a potential problem with inline functions.
Inline functions that fail to inline will have a callable body generated. If
such a body is generated with the SSE4 source, for example, it can generate
SSE4 instructions. Calls for that function in other sources can then end up
calling the SSE4-generated body outside of any CPU capability check.
2020-12-13 16:49:46 -08:00
Chris Robinson 225d42538d Be more consistent with size_t 2020-12-12 23:41:38 -08:00
Chris Robinson bb597546e1 Make sure to stop ALSA playback when the backend stops 2020-12-12 15:10:25 -08:00
Chris Robinson e179bf0a12 Move the mixer functions to core 2020-12-12 14:58:09 -08:00
Chris Robinson 14df534114 Use a separate list for core objects 2020-12-12 14:45:41 -08:00
Chris Robinson f57801102a Remove an unnecessary include and forward declaration 2020-12-12 14:21:45 -08:00
Chris Robinson 1ad944555c Move some HRTF definitions to a separate header 2020-12-12 14:15:17 -08:00
Chris Robinson 176bc8a835 Avoid passing DirectHrtfState to MixDirectHrtf 2020-12-12 13:52:14 -08:00
Chris Robinson 191fe888b4 Move ambidefs.h to core 2020-12-12 10:38:24 -08:00
Chris Robinson 1bb7f575f0 Don't modify the IR size of loaded HRTFs 2020-12-11 15:08:50 -08:00
Chris Robinson bd08b9a5b5 Use constexpr variables instead of macros 2020-12-06 08:49:20 -08:00
Chris Robinson 4ee95dc296 Use a smaller FFT for convolution 2020-12-05 14:18:19 -08:00
Chris Robinson 2fc10a2bc0 Avoid returning an array for initialization 2020-12-05 07:27:54 -08:00
Chris Robinson 1679ab937e Reorder definitions to keep them near each other 2020-12-05 06:40:06 -08:00
Chris Robinson 16c7d1816d Remove some unnecessary inlines and includes 2020-12-05 06:30:13 -08:00
Chris Robinson 7485e402c1 Avoid a REQUIRES macro for SFINAE 2020-12-05 05:57:18 -08:00
Chris Robinson 8a352d25f9 Move the ringbuffer to common 2020-12-05 03:28:19 -08:00
Chris Robinson 2b919eac78 Use an alias for the DevFmtType type 2020-12-05 02:44:19 -08:00
Chris Robinson 16ec07275f Remove an unneeded include 2020-12-04 14:45:55 -08:00
Chris Robinson 50e33ce8f4 Change some macros into constexpr variables 2020-12-04 13:53:56 -08:00
Chris Robinson c4132b80ed Move a couple more things to core 2020-12-04 13:13:52 -08:00
Chris Robinson 3a3094c887 Fix some tabs and missing cast 2020-12-04 11:19:59 -08:00
Chris Robinson 69d55d7e03 Move the filters to core 2020-12-04 11:15:50 -08:00
Chris Robinson 84d47f7d4c Move the bsinc tables to core 2020-12-04 11:15:50 -08:00
Chris Robinson 36c1589c11 Move mastering.cpp/h to core 2020-12-04 11:15:50 -08:00
Chris Robinson aa05feec4a Avoid a global MAX_PITCH macro 2020-12-04 11:15:50 -08:00
Chris Robinson b1c2671e9d Move the resampler declarations to a more appropriate header 2020-12-04 11:15:50 -08:00
Chris Robinson 75f469fa71 Remove some unnecessary includes 2020-12-04 11:15:50 -08:00
Chris Robinson 630a3b8cbd Move lerp/cubic to alnumeric.h 2020-12-04 11:15:50 -08:00
Eliot Miranda e3179aa058 Add a gain argument to altonegen (#502)
* Fix a speeling rorre in an error message.
Add a gain command-line argument to altonegen.c

* Fix some formatting issues and a copy/paste error.
2020-12-04 11:15:27 -08:00
Chris Robinson 8750810f5c Change a couple macros into constexpr variables 2020-11-28 03:38:20 -08:00
Chris Robinson eb9b9fb4e5 Avoid AL types in mastering.cpp/h 2020-11-28 02:06:56 -08:00
Chris Robinson dbfdd35545 Move some declarations to more appropriate headers 2020-11-27 22:27:45 -08:00
Chris Robinson 7e798df7b8 Avoid AL types in the converter 2020-11-27 21:40:02 -08:00
Chris Robinson b0919240ab Move some sources to a separate directory
To begin separating the ALC interfaces from internal ones.
2020-11-27 19:18:17 -08:00
Chris Robinson d86046d522 Update ChangeLog 2020-11-25 16:31:52 -08:00
Chris Robinson 32b9a46b39 Move AL EffectProp handling to separate sources 2020-11-25 13:55:29 -08:00
Chris Robinson 3970252da9 Don't limit the available converted sample count to BUFFERSIZE 2020-11-25 04:20:16 -08:00
Chris Robinson 28278a9c15 Fix a UInt32 variable type 2020-11-24 16:43:38 -08:00
Chris Robinson f16692ecf8 Fill all buffers for CoreAudio playback 2020-11-24 14:47:04 -08:00
Chris Robinson ba39c622ef Disable buffer allocation with CoreAudio capture 2020-11-24 14:44:13 -08:00
Chris Robinson a913aa6ba8 Make sure batched source updates are with the proper voice 2020-11-24 10:49:53 -08:00
Chris Robinson 7632dfb51a Use a type alias instead of decltype 2020-11-23 12:20:33 -08:00
Chris Robinson d08d6b18c4 Ceil the scaled buffer size instead of round
The result has to be large enough to get the original requested size from it.
2020-11-23 10:55:13 -08:00
Chris Robinson d062c16629 Fix buffer offset for the second conversion 2020-11-23 10:43:20 -08:00
Chris Robinson 31c7eb5c55 Fix capture buffer size scaling in CoreAudio 2020-11-23 10:40:20 -08:00
Chris Robinson 5d82058da7 Use kAudioUnitScope_Global to get the maximum frame size 2020-11-23 10:11:28 -08:00
Chris Robinson 534c487f14 Avoid AL types in hrtf.cpp/h 2020-11-22 17:27:22 -08:00
Chris Robinson 822224312d Use optionals for some attribute parameters 2020-11-22 04:31:02 -08:00
Chris Robinson 21174047df Make ALbuffer inherit from BufferStorage 2020-11-21 00:54:25 -08:00
Chris Robinson 54afcbe113 Use clearer variable names 2020-11-20 22:02:20 -08:00
Chris Robinson 2cb2ffef72 Disassociate internal buffer enums from AL enum values 2020-11-20 04:27:10 -08:00
Chris Robinson c3cb09aa0c Avoid AL types in the mixer 2020-11-20 03:59:14 -08:00
Chris Robinson f85e76285f Disassociate internal voice enums from AL enums 2020-11-20 01:37:19 -08:00
Chris Robinson bee9917598 Disassociate internal format enums from ALC enums 2020-11-20 00:55:51 -08:00
Chris Robinson 0024ea229b Don't try to override the CoreAudio maximum capture slice 2020-11-19 17:49:25 -08:00
Chris Robinson 03f9700071 Use BufferStorage for the buffer queue 2020-11-19 04:18:25 -08:00
Chris Robinson 537510afc8 Put the loop start/end in BufferStorage 2020-11-19 03:23:46 -08:00
Chris Robinson ee9f0fe306 Recognize ARM64 as a VS platform 2020-11-18 04:20:10 -08:00
Chris Robinson 645d354ffa Add a close method to the win32 ifstream 2020-11-16 14:51:50 -08:00
Chris Robinson 88cb398a83 Avoid direct initialization of float32x4_t 2020-11-16 13:42:20 -08:00
Chris Robinson 1869dc14d4 Use WinAPI functions to check for NEON support 2020-11-16 12:42:33 -08:00
Chris Robinson a494a89c5a Add some missing custom device config descriptions 2020-11-15 15:54:09 -08:00
Chris Robinson e64c52ce8c Use doubles to calculate the listener matrix translation
To help stablize sources near the listener, when away from origin. Also clean
up some related methods and move them to more appropriate places.
2020-11-13 23:33:40 -08:00
Chris Robinson 417d8da6f4 Avoid a deprecated function 2020-11-13 21:47:48 -08:00
Chris Robinson 1a05dda8db Avoid testing a bool against AL_FALSE 2020-11-12 12:46:15 -08:00
Chris Robinson 7e76770278 Avoid an unnecessary multiplier 2020-11-09 12:33:07 -08:00
Chris Robinson 3a58bac7bd Fix pitch shifter bin count 2020-11-09 08:10:43 -08:00
Chris Robinson 54e4346f50 Simplify some pitch shifter scaling calculations 2020-11-08 07:59:14 -08:00
Chris Robinson db6d6d68b4 Avoid bitshifts for loop counting 2020-11-08 07:46:10 -08:00
Chris Robinson 0498ca200d Use an array of auxslot pointers instead of IDs to lookup 2020-11-07 12:58:19 -08:00
Chris Robinson 4e760bbecc Use a separate structure for the active effect slot properties 2020-11-07 08:36:49 -08:00
Chris Robinson 120776bec5 Use a range-for loop instead of for_each 2020-11-06 15:44:49 -08:00
Chris Robinson 26b03f534c Use more efficient sorting for effect slots 2020-11-05 15:35:09 -08:00
Chris Robinson aeb7170a8b Add missing include for the CoreAudio backend 2020-11-05 05:42:02 -08:00
Chris Robinson 4e50ce9d30 Avoid declaring standard types 2020-11-05 04:57:50 -08:00
Chris Robinson 40c92c4643 Simplify the [u]int64_t typedef header check
And include the correct header
2020-11-05 04:41:17 -08:00
Chris Robinson c0cbe602ce Release 1.21.0 2020-11-04 02:00:35 -08:00
Chris Robinson ce52ecaa87 Update changelog 2020-11-02 18:06:10 -08:00
Chris Robinson 03389f390c Avoid a full wipe and reallocation of wet buffers 2020-11-02 05:19:17 -08:00
Chris Robinson 52d58a4023 Store the wet buffers in the context
This is rather ugly, but we need the wet buffers to remain allocated after its
effect slot is deleted, because a voice can still use it for its final fade-out
mix.
2020-11-02 04:24:36 -08:00
Chris Robinson 6e05adf955 Fix a typo in the changelog 2020-10-27 00:26:16 -07:00
Chris Robinson 267d9caac4 Check for the right extension string in alffplay 2020-10-26 12:21:42 -07:00
Chris Robinson dfb6d70902 Update Changelog 2020-10-26 11:18:08 -07:00
Chris Robinson be0798b56d Finalize AL_SOFT_events 2020-10-26 10:57:48 -07:00
Chris Robinson 9e7c816498 Fix copy-paste error 2020-10-26 10:47:31 -07:00
Chris Robinson 36ecea458a Clear /W3 on MSVC since we use /W4 2020-10-25 14:53:44 -07:00
Chris Robinson 0311f6431c Add a comment about building for static linking 2020-10-25 00:08:54 -07:00
Chris Robinson 88b9eb1560 Silence a couple more MSVC warnings 2020-10-23 21:03:13 -07:00
Chris Robinson 6de861a75c Remove a constexpr that needs C++17 2020-10-23 20:00:09 -07:00
Chris Robinson 966c4498d4 Don't use a template parameter as a variable
And try to silence an MSVC warning about a constant overflow.
2020-10-23 19:53:07 -07:00
Chris Robinson 556321f18d Some cleanup in alspan.h 2020-10-23 19:03:37 -07:00
Chris Robinson 7cb1cc8ab5 Add some constexpr 2020-10-23 18:40:54 -07:00
Chris Robinson 7bb37deb51 Replace the mixer fraction macros with constexpr variables 2020-10-21 17:16:27 -07:00
Chris Robinson 3e62600ecc Replace some more macros with constexpr variables 2020-10-21 16:39:21 -07:00
Chris Robinson b8f5e1f424 Change some more macros into constexpr variables 2020-10-21 10:39:00 -07:00
Chris Robinson a3ea46f773 Add some missing constexpr attributes 2020-10-20 11:40:27 -07:00
kcat 1acfd11635 Merge pull request #483 from jhasse/silence-nodiscard
Silence warning about unused return values
2020-10-20 11:31:32 -07:00
Jan Niklas Hasse bd9d5d7bf0 Silence warning about unused return values
warning C4834: discarding return value of function with 'nodiscard'
attribute
2020-10-20 18:33:53 +02:00
Chris Robinson 95ea5951b1 Try again to work around a GCC 5 issue 2020-10-19 08:29:50 -07:00
Chris Robinson a3903b84f9 Revert "Workaround a GCC 5 issue"
This reverts commit ada92b058a.

It didn't fix the problem.
2020-10-19 08:24:19 -07:00
Chris Robinson ada92b058a Workaround a GCC 5 issue 2020-10-19 08:01:38 -07:00
Chris Robinson cdc15a4783 Use constexpr variables in place of some macros 2020-10-19 07:55:25 -07:00
Chris Robinson d6686bceb0 Avoid an extra function to generate BSincHeaders 2020-10-18 16:49:36 -07:00
Chris Robinson 20cc3882b4 Do in-place initialization for the bsinc filters
Requires less dynamic allocations and less troublesome return values of large
arrays. Also reduces repetition with specified parameters.
2020-10-18 05:34:27 -07:00
Chris Robinson 24c7ddbac2 Update Changelog 2020-10-18 05:32:48 -07:00
Chris Robinson 3728f74e10 Utilize C++11's [u]int64_t in alext.h 2020-10-16 11:13:20 -07:00
Chris Robinson f8af992b2b Quick update to ALC_BFORMAT3D_SOFT's value 2020-10-16 07:49:59 -07:00
Chris Robinson 17e88bdef3 Add a missing enum to the enum list 2020-10-16 06:39:42 -07:00
Chris Robinson 8e09ae8ee6 Finalize AL_SOFT_effect_target 2020-10-16 06:36:43 -07:00
Chris Robinson 2beb095eb1 Finalize ALC_SOFT_loopback_bformat 2020-10-16 06:35:23 -07:00
Chris Robinson 5f8fe0e5bb Enable standard stdio methods with MinGW
This unfortunately doesn't fix the %z warnings for whatever reason, but it
should help guarantee correct function behavior by not relying on msvcrt's
stdio functions.
2020-10-13 05:59:35 -07:00
Chris Robinson 7b43cb8266 Declare variables closer to where they're used 2020-10-13 05:54:05 -07:00
Chris Robinson b0e025946e Don't check for the app path if one was already retrieved 2020-10-13 01:57:53 -07:00
Chris Robinson 303ca3af72 Use inline functions for popcnt and ctz instead of macros 2020-10-13 01:21:44 -07:00
Chris Robinson 45ff10fb4d Use a span instead of a pointer and count parameters 2020-10-12 23:58:54 -07:00
Chris Robinson 0dc9ae0998 Update event enum values
To keep them less spread out from other OpenAL Soft extensions.
2020-10-07 20:13:52 -07:00
Chris Robinson af9c990277 Print the number of used measurements in sofa-info 2020-10-07 01:04:42 -07:00
Chris Robinson 5fbd02e60e Update ChangeLog 2020-10-06 00:38:37 -07:00
Chris Robinson 7fb6d64ca8 Be more robust with to-mono channel conversions 2020-10-05 22:30:23 -07:00
Chris Robinson e7a44d3b70 Cast the ringbuffer size to the correct type 2020-10-05 00:43:06 -07:00
Chris Robinson 7361e108a3 Fix a variable name 2020-10-05 00:17:13 -07:00
Chris Robinson e0097c18b8 Simplify some DSound capture math 2020-10-03 16:17:34 -07:00
Chris Robinson b5eccf424b Remove the unused Ref logging level 2020-09-28 16:14:20 -07:00
Chris Robinson f02bc1354d Rework logging a little
Use OutputDebugStringW on Windows in addition to the log file

Avoid duplicate formatter parsing with Android
2020-09-28 11:34:24 -07:00
Chris Robinson da29489ead Use an enum class for the log level 2020-09-28 00:40:30 -07:00
Chris Robinson 39f4ea61c5 Add missing linear resampler to the option setting list 2020-09-24 14:21:57 -07:00
Chris Robinson cef82153b6 Use a smaller buffer for the phase-shift filter 2020-09-24 13:26:01 -07:00
Chris Robinson 04fd50bcdf Support B-Format sounds in the examples 2020-09-22 11:36:43 -07:00
Chris Robinson d2970443dd Recognize B-Format format names in the examples 2020-09-22 10:43:27 -07:00
Chris Robinson c993ade9bf Support B-Format amb file IRs in alconvolve
Be aware this requires proper header data (a WAVE_FORMAT_EXTENSIBLE format with
the proper integer or float B-Format sub-format GUID). A normal 4-channel wave
file will not be recognized, since it's indistinguishable from quadrophonic.
2020-09-22 10:18:43 -07:00
Chris Robinson 844e6c881b Add an alconvolve option to silence the dry signal 2020-09-22 08:30:04 -07:00
Chris Robinson d912b92a60 Support all buffer layouts for convolution 2020-09-22 08:09:42 -07:00
Chris Robinson 191150d9a8 Remove deprecated, performance, and error event types
These would be better served with a proper debug API, rather than a general
audio event API.
2020-09-20 04:11:52 -07:00
Chris Robinson 8ef242bce0 Don't use direct channels with convolution
It may come back as an effect property, but it's probably better to not try
forcing it by default.
2020-09-18 10:12:58 -07:00
Chris Robinson 07989a34dc Allow higher-order B-Format buffers for convolution
Only the first-order channels will be used, but higher-order buffers will be
allowed.
2020-09-18 00:06:10 -07:00
Chris Robinson e7d8e7eb3f Avoid extraneous buffers and buffer clears 2020-09-17 21:34:26 -07:00
Chris Robinson d86d882d8b Fix an invalid unicode character in a comment 2020-09-14 02:52:16 -07:00
Chris Robinson 0974b6b47c Use inline wrappers to clarify forward/inverse FFTs 2020-09-13 04:18:40 -07:00
Chris Robinson 9a883f5046 Partly simplify FFT bit-reversal
This can almost certainly be improved further, as less than half of the indices
really need their reversed bit-pattern calculated and elements swapped (any
symetrical bit pattern would just swap with itself, and indices whose reversed
bit-pattern has already been traversed is already swapped).

It may also prove beneficial to provide the base-2 log of the fft buffer size
(number of bits to represent the indices), as that could help make the reversal
more efficient with a known bit/loop count.
2020-09-13 03:33:52 -07:00
Chris Robinson 1d4b355622 Use standard sin and sqrt 2020-09-12 19:06:06 -07:00
Chris Robinson bb90bfd9b3 Accumulate delays as samples before calculating nanoseconds 2020-09-12 01:52:45 -07:00
Chris Robinson cf298075b5 Round (and clamp) the reftime instead of ceiling it 2020-09-12 00:47:04 -07:00
Chris Robinson 33d91ceeec Avoid repeating string literals 2020-09-11 01:40:36 -07:00
Chris Robinson a4bfba4cb5 Recognize GUID name strings with the DSound backend 2020-09-10 22:05:25 -07:00
Chris Robinson 21162cf5fc Allow JACK to enumerate custom devices
Each device being associated with a port name pattern it'll try connecting to.
2020-09-10 21:09:06 -07:00
Chris Robinson bb63d5aab3 Simplify clearing an array 2020-09-09 23:21:46 -07:00
Chris Robinson ce0a45cbc7 Don't assume iterators are pointers 2020-09-09 14:02:02 -07:00
Chris Robinson 68a099ba35 Apply the first convolution segment in the time domain
This avoids an inherent delay from the effect, at the cost of higher CPU use.
Having a customizable user-specified delay (with said user ensuring a properly
trimmed impulse response) could help alleviate the cost since once the delay
exceeds the segment size, the initial FIR filter could be skipped.
2020-09-09 02:23:38 -07:00
Chris Robinson f4a55cc8c2 Don't leave the negative frequencies as 0 for inverse FFT 2020-09-08 23:20:06 -07:00
Chris Robinson 29566b995c Avoid an extraneous ConvolutionFilter sub-object 2020-09-06 00:16:50 -07:00
Chris Robinson 7eb5dfb3f8 Allow querying the new enums and functions 2020-09-05 23:53:53 -07:00
Chris Robinson f5163ca988 Print the name and format for alconvole's impulse response 2020-09-05 23:48:19 -07:00
Chris Robinson 800e2b6125 Cleanup and fix alAuxiliaryEffectSlotPlayv/StopvSOFT 2020-09-05 21:39:31 -07:00
Chris Robinson 13710b474e Ensure effect slot properties are updated when playing 2020-09-05 21:04:41 -07:00
Chris Robinson c52bf8c401 Rework effect slot buffer setting
Rather than creating an effect-specific buffer that gets passed along as a
property, the buffer is set the effect state when the effect state is created,
the device is updated, or the buffer is changed. The buffer can only be set
while the effect slot isn't playing, so it won't be changed or updated while
the mixer is processing the effect state.
2020-09-05 20:48:56 -07:00
Chris Robinson 9975aeb37f Add methods to start and stop effect slot processing
A newly-created effect slot is in an AL_INITIAL state, in which processing is
stopped but will automatically become AL_PLAYING after successfully setting an
AL_EFFECTSLOT_EFFECT value (including AL_EFFECT_NULL or 0). Calling Play[v] or
Stop[v] will set the effect slot to AL_PLAYING or AL_STOPPED respectively.
While stopped, the effect won't produce audio and will not be processed.
2020-09-05 19:11:57 -07:00
Chris Robinson 7851f7d4ce Don't add effect slots to the active list until an effect is set 2020-09-05 18:13:08 -07:00
Chris Robinson c1ad5d6055 Avoid confusing */*...*/ syntax
MSVC warns about */ being outside of a comment.
2020-09-05 14:28:08 -07:00
Chris Robinson 7e3fed42ed Use a recursive_mutex for the router enumeration lock 2020-09-05 12:41:28 -07:00
Chris Robinson 73f5331305 Use an RAII wrapper to manage COM object references 2020-09-05 12:32:41 -07:00
Chris Robinson 88f7617807 Avoid duplicate WASAPI devices by matching GUIDs 2020-09-04 18:32:06 -07:00
Chris Robinson afdd1c67ad Update changelog 2020-09-03 13:25:51 -07:00
Chris Robinson 9e862900fe Update some UHJ comments 2020-09-02 15:50:11 -07:00
Chris Robinson fe329c2af2 Avoid class templates for the POPCNT64/CTZ64 macros 2020-09-01 15:55:48 -07:00
Chris Robinson 1968136c98 Add an in-progress extension string for convolution reverb 2020-09-01 07:37:07 -07:00
Chris Robinson eeba1a385c Don't use config.h to define RESTRICT 2020-09-01 06:22:50 -07:00
Chris Robinson a6aefeccd8 Use enum class for a couple enums 2020-09-01 05:46:19 -07:00
Chris Robinson 02e51c0525 Avoid using a deprecated function 2020-08-31 17:48:26 -07:00
Chris Robinson af97a92952 Move more processing to the ConvolutionFilter struct 2020-08-31 06:43:42 -07:00
Chris Robinson 88425becb2 Remove a couple unnecessary pointers 2020-08-30 04:41:19 -07:00
Chris Robinson 82873486b7 Dynamically allocate the convolution channel mixing data 2020-08-30 04:28:01 -07:00
Chris Robinson ebe0765ce3 Reorganize some convolution fields 2020-08-30 03:42:44 -07:00
Chris Robinson 8724c1ce4b Remove extraneous parenthesis 2020-08-28 23:28:20 -07:00
Chris Robinson 3fdee6c814 Calculate the correct number of convolution segments 2020-08-28 23:08:44 -07:00
Chris Robinson ecfb0d4f5b Limit convolution processing to the output ambisonic order 2020-08-28 06:47:21 -07:00
Chris Robinson 7266cd8b6c Don't dereference a null convolution filter 2020-08-28 06:44:05 -07:00
Chris Robinson 52531d8b72 Support B-Format impulse responses for convolution 2020-08-28 05:48:26 -07:00
Chris Robinson 986a58d5b4 Pass a BufferStorage to EffectState::createBuffer 2020-08-28 00:44:55 -07:00
Chris Robinson 1f486f820e Use a separate structure for buffer storage 2020-08-28 00:09:46 -07:00
Chris Robinson ecf30de36f Rename buffer_formats to buffer_storage 2020-08-27 23:02:17 -07:00
Chris Robinson a9ebcdcb7f Handle 0-length convolution buffers 2020-08-27 21:32:25 -07:00
Chris Robinson 0ad7bb577a Don't allow callback buffers for effect slots 2020-08-27 21:10:00 -07:00
Chris Robinson 3c09f17421 Blend panned B-Format source directivity given its radius 2020-08-27 08:44:29 -07:00
Chris Robinson 2a01940041 De-duplicate LoadSampleArray and FmtTypeTraits 2020-08-26 21:29:16 -07:00
Chris Robinson 97ecf5810f Base the convolution example on the simpler stream example 2020-08-26 17:23:50 -07:00
Chris Robinson 577a8234f2 Recognize float32 format names for the example healpers 2020-08-26 17:15:30 -07:00
Chris Robinson 9dab2db33b Avoid copying the convolution filter history to shift it
Instead, the current/head/newest segment is tracked, and decremented with each
process to overwrite the oldest.
2020-08-25 15:43:48 -07:00
Chris Robinson 309be1c6f6 Add an example using convolution reverb 2020-08-25 04:59:04 -07:00
Chris Robinson 801c7a9226 Initial implementation of the convolution effect
Currently limited to mono and stereo impulse responses, and stereo IRs try to
use direct/real output rather than panning.
2020-08-25 04:21:10 -07:00
Chris Robinson e98a058595 Fix handling doubles 2020-08-25 02:38:44 -07:00
Chris Robinson a6bd53c4e1 Store a reference to the effect buffer as an active property 2020-08-24 20:40:24 -07:00
Chris Robinson 1a9fbc1b2f Stub out a convolution effect state 2020-08-24 20:04:16 -07:00
Chris Robinson b955479e18 Recognize a convolution reverb effect type 2020-08-24 20:00:58 -07:00
Chris Robinson 9e5a388dfe Add a method for effects to create persistent buffer data 2020-08-24 19:13:46 -07:00
Chris Robinson 9d61484e4b Move storable buffer format info to a separate source 2020-08-24 17:59:07 -07:00
Chris Robinson 73ab9d46c8 Use an intrusive_ptr to hold the unapplied effect state 2020-08-24 16:34:53 -07:00
Chris Robinson f9d6aa2f48 Allow setting a buffer on an effect slot 2020-08-24 16:08:09 -07:00
Chris Robinson 54a0972bfe Clean up some comments 2020-08-24 14:26:47 -07:00
Chris Robinson ff5c9d1c15 Use an intrusive_ptr for ALeffectslotProps::State 2020-08-24 14:09:26 -07:00
Chris Robinson 01f76f2b67 Allow intrusive_ptr::reset to take a new pointer 2020-08-24 14:09:26 -07:00
HALX99 de060ce09a macOS osx/ios dynamic framework support (#466)
* OSX bundle support

* Disable framework by default, and fix domain name typo

* Remove info.plist, add efx.h for framework public header

* Fix osx/ios framework PUBLIC_HEADER doesn't work

* Refine comment message

* Auto set CFBundleShortVersionString by var LIB_VERSION

* Set CFBundleVersion from git commit count

* Use space to separate elements in a list

* Specific framework name to variable 'IMPL_TARGET'

* Solve cmake try_compile failed with code sign, and disable framework code sign

* Make ios travis to build dynamic framework bundle by default

* Update ios.toolchain.cmake

Since we solve code sign issue for cmake to generate dynamic framework xcode project, enable strict try_compile by default

* Remove MAKE_CXX_EXTENSIONS from travis-ci

* Combined flat lib armv7;arm64 support

* Remvoe ios.toolchain.cmake since we don't need
[skip appveyor] [skip travis]

* Sets framework name to soft_oal,
avoid ambiguous with system OpenAL.framework

* Fix missing BUNDLE, FRAMEWORK's DESTINATION
Build osx/ios dynamic framework required them.

* Use @rpath instead fullPath to mac local disk
see also:
https://github.com/libjpeg-turbo/libjpeg-turbo/commit/c80ddef7a4ce21ace9e3ca0fd190d320cc8cdaeb

* CMake, use TRUE for bool value

* Don't disable examples, utils, install

* Make ALSOFT_OSX_FRAMEWORK for APPLE spec

* Remove unused flag and more clearly comment

* More clearly comment for solve armv7 target issue

Co-authored-by: deal <deal@dealdeMac.local>
Co-authored-by: bel <bel@beldeMac.local>
2020-08-24 14:09:02 -07:00
Chris Robinson 4eba5c34e9 Use CMAKE_DLLTOOL instead of looking for dlltool manually 2020-08-20 16:46:51 -07:00
Chris Robinson 34b29a48a4 Ensure enough space is allocated for structs with a FlexArray 2020-08-15 23:53:43 -07:00
Chris Robinson 23259b48dd Avoid a zero-length array for the FlexArray definition
Newer GCCs are warning about FlexArray being used at the end of another struct.
Though not the most ideal to always allocate space for at least 1 element,
actual 0-sized uses are rare and for smaller element types.
2020-08-15 23:22:10 -07:00
Chris Robinson 2fa842a04c Avoid allocating for each HRIR reconstruction 2020-08-14 18:22:20 -07:00
Chris Robinson 3796e407b5 Rename ALSOFT_INSTALL_HRTF_DEFS to ALSOFT_INSTALL_HRTF_DATA 2020-08-13 18:04:09 -07:00
Chris Robinson aafcb1f6fc Simplify StrSubst in makemhr 2020-08-13 16:02:13 -07:00
Chris Robinson 8e7199cbb6 Avoid a cmake check for determining the size of long 2020-08-13 14:04:29 -07:00
Chris Robinson fd52c828a9 Improve handling main() with UTF-8 args on Windows 2020-08-12 17:40:00 -07:00
Chris Robinson 476e9d7522 Cleanup some warnings with ffmpeg/alffplay 2020-08-12 17:39:08 -07:00
Chris Robinson b12cd77d32 Use a wait predicate instead of a while loop 2020-08-12 10:00:43 -07:00
Chris Robinson ed1135f7ae Fix configure-time ffmpeg version detection 2020-08-12 09:48:17 -07:00
Chris Robinson 57d6df29b4 Update .gitignore for QtCreator files 2020-08-11 10:11:20 -07:00
Chris Robinson 529049dc59 Remove an unused variable 2020-08-11 10:06:12 -07:00
Chris Robinson 475ed0f039 Use a FlexArray instead of a vector for distance compensation 2020-08-11 05:59:20 -07:00
Chris Robinson c549797af0 Make osme things constexpr 2020-08-10 15:11:52 -07:00
Chris Robinson e8b3e82f96 Change a couple functions into member functions 2020-08-07 06:22:39 -07:00
Chris Robinson 84354c792e Cleanup OSS enumeration and fix duplicate names 2020-08-07 00:11:29 -07:00
Chris Robinson 02f8419663 Fix DIAGNOSTIC_POP for GCC and Clang 2020-08-06 23:20:20 -07:00
Chris Robinson 58a2a5e2e3 Add a comment about 32-bit GCC stack aligning with SSE codegen 2020-08-05 17:43:51 -07:00
Chris Robinson 816510fee7 Update changelog 2020-08-05 07:18:13 -07:00
Luis Cáceres 064710cdf7 Force stack alignment on 32-bit gcc for proper SSE use (#462)
Fixes crashes due to misaligned stack variables in SSE instructions (#460).
2020-08-05 07:16:56 -07:00
Chris Robinson 7ddd49e16a Add the jack/connect-ports option to alsoft-config 2020-08-05 00:43:08 -07:00
Chris Robinson f138369808 Add an option to auto-connect JACK ports 2020-08-05 00:27:12 -07:00
Chris Robinson 516de157d8 Use std::array instead of some C-style arrays 2020-08-05 00:10:10 -07:00
Chris Robinson 2e1645f32a Print the error from pthread_setschedparam 2020-08-04 12:46:27 -07:00
HALX99 7cac5304c8 Add ios build for travis (#452)
* Add ios build for travis

* fix cmake command and set osx_image: xcode11

* print cmake version

* print cmake version before config

* [iOS] By default use iphoneos for sysroot

* Use ios.toolchain.cmake to build ios

* By default, don't require gnu extension

* Update CMakeLists.txt

Co-authored-by: deal <deal@dealdeMac.local>
2020-08-01 02:52:36 -07:00
Chris Robinson 76c57990be Cleanup and fix a typo in the changelog 2020-07-23 19:20:55 -07:00
Chris Robinson 39a2f0626a Use a predicate instead of a while loop 2020-07-23 09:03:47 -07:00
Chris Robinson ac1fc1b60a Don't include headers in a namespace definition 2020-07-23 09:03:47 -07:00
Chris Robinson 91df03f7eb Simplify mixer buffer size saturation handling 2020-07-23 09:03:47 -07:00
kcat 4817d82185 Merge pull request #453 from devnexen/haiku_support_completion
GetProcBinary implementation for Haiku.
2020-07-21 10:27:43 -07:00
David Carlier d3ffaeb8d7 GetProcBinary implementation for Haiku. 2020-07-21 17:22:38 +00:00
Chris Robinson f409cb4039 Revert "Don't call find_package(WindowsSDK) if the platform ver is already set"
This reverts commit c1383e3a48.
2020-07-09 00:07:33 -07:00
Chris Robinson c1383e3a48 Don't call find_package(WindowsSDK) if the platform ver is already set 2020-07-08 23:32:24 -07:00
Chris Robinson da25557ed6 Remove dead code 2020-06-30 16:44:14 -07:00
Chris Robinson b0e72266b6 Don't round up the dst size when the src size was saturated 2020-06-29 19:41:08 -07:00
Chris Robinson 775187788a Fix SrcBufferSize calculation when downsampling 2020-06-29 12:34:12 -07:00
Chris Robinson 88ad84edf6 Reduce the MAX_PITCH to 10
255 is insanely overkill. The bsinc resamplers fade to silence after a few
octaves, and the others would be a mess.
2020-06-29 11:32:15 -07:00
Chris Robinson f81558c948 Avoid including windows.h in threads.h 2020-06-28 12:55:55 -07:00
Chris Robinson 31791c9997 Workaround a MinGW quirk
Sometimes MinGW defines strncasecmp to _strnicmp in string.h, which can cause
problems with al::strncasecmp if it's not consistently replaced.
2020-06-26 05:39:26 -07:00
Chris Robinson c4cf84c549 Update default HRTF 2020-06-21 19:41:07 -07:00
Chris Robinson a0eb532100 Apply simulated HRIR occlusion in the frequency domain 2020-06-21 19:28:37 -07:00
Chris Robinson 967ea42359 Update the default HRTF 2020-06-21 05:01:35 -07:00
Chris Robinson 24393ab192 Synthesize missing elevations in the frequency domain
This should help avoid destructive phase interference. The occlusion low-pass
filter is still applied in the time domain due to no clear topology (cutoff
frequency, slope, bandwidth, etc).
2020-06-21 00:29:57 -07:00
Chris Robinson a01dbeb09f Use multiple threads for magnitude calculations
Also allow user-declarable thread count.
2020-06-19 16:43:09 -07:00
Chris Robinson bc91e4d302 Update the default HRTF 2020-06-19 15:44:20 -07:00
Chris Robinson 8780976979 Avoid blending multiple IRs for the -90 elevation IR 2020-06-19 15:28:22 -07:00
Chris Robinson 4cd0e333c8 Calculate the HRIR onsets and magnitudes separately from loading
This should help improve memory use a bit since the SOFA file can be unloaded
before allocating some temp buffers for onset detection and FFT calculation.
2020-06-17 17:15:26 -07:00
Chris Robinson 3f26ce4a82 Add a makemhr option to use the farthest field only
All fields are used for equalization, but only the farthest field is resampled,
reconstructed, normalized, and written to the mhr.
2020-06-17 16:25:40 -07:00
Chris Robinson beba71a6f9 Resample HRIRs after equalization 2020-06-17 13:03:26 -07:00
Chris Robinson 4cfd63a1c7 Avoid reinitializing the resampler with each HRIR 2020-06-17 01:50:11 -07:00
Chris Robinson cd6bb65d49 Resample HRTFs in the frequency domain in makemhr
This should produce far better results given it works directly on the frequency
response magnitudes prior to phase reconstruction, as it doesn't deal with a
linear phase filter on a truncated time-domain response (with the result also
getting truncated in both direction).

The in-library on-load HRTF resampler still uses the linear filter due to its
relative performance and simplicity benefits. It's good enough as a backup,
though users with custom HRTFs would benefit from resampling when creating the
mhr (adjusting its window size as appropriate/desired).
2020-06-17 01:15:01 -07:00
Chris Robinson 8ea7d5183b Print the synthesized elevations' azimuth counts 2020-06-16 17:33:26 -07:00
Chris Robinson b0b720c609 Avoid an unnecessary local variable 2020-06-16 14:01:39 -07:00
Chris Robinson bd0144065a Set channel labels from WFX channel masks 2020-06-15 20:21:54 -07:00
Chris Robinson c142b49981 Print the name of unhandled PulseAudio channels 2020-06-15 14:07:21 -07:00
Chris Robinson 6db6d1510a Remove the Lower channel labels and rename the Upper labels 2020-06-15 13:49:45 -07:00
Chris Robinson 401a9bacd1 Don't bother with otherwise unused Aux channels 2020-06-15 02:27:29 -07:00
Chris Robinson 540315b07c Handle the front stablizer with the B-Format decoder 2020-06-15 02:13:14 -07:00
Chris Robinson c951190d3a Fix a typo 2020-06-12 12:54:05 -07:00
Chris Robinson 6ce9bf6c94 Move a couple related functions to the backend base 2020-06-12 12:53:47 -07:00
Chris Robinson 26eccd159f Link with the CoreFoundation framework on iOS 2020-06-11 08:55:52 -07:00
Chris Robinson ad9fc31bfd More capitalization fixes 2020-06-11 08:55:24 -07:00
Chris Robinson df1bdc7bc4 Fix some capitalization 2020-06-11 07:56:45 -07:00
kcat 8fee1da426 Merge pull request #439 from halx99/patch-1
Enable to detect Windows SDK v2004
2020-06-11 07:55:53 -07:00
HALX99 3702dcb1d3 Enable to detect Windows SDK v2004 2020-06-11 22:39:47 +08:00
Chris Robinson 15437e3140 Don't export functions when static linking 2020-06-10 21:03:04 -07:00
Chris Robinson c50250c978 Use a range-for loop instead of for_each 2020-06-09 21:28:09 -07:00
Chris Robinson b2b3ad570b Use better types for array lengths 2020-06-09 11:52:48 -07:00
Chris Robinson 46eb353b84 Update changelog 2020-06-07 18:59:49 -07:00
Chris Robinson b7b52ec28b Simplify the aligned over-allocation strategy 2020-06-07 15:40:04 -07:00
Chris Robinson 9322c86e2f Avoid explicit checks for _BitScanForward[64] 2020-06-07 14:15:48 -07:00
Chris Robinson ab3ccb513a Check the returned sample endianess with sndio 2020-06-07 11:50:16 -07:00
Chris Robinson 2a324d34be Fix a return value 2020-06-07 11:47:39 -07:00
Chris Robinson b4a52321c4 Use a safer layout if sndio changes the channel count 2020-06-07 11:45:06 -07:00
Chris Robinson c8f67cffc5 Use a more appropriate size value for copying 2020-06-07 11:00:19 -07:00
Chris Robinson 03eb6a01b9 Use a better type for array access 2020-06-07 11:00:19 -07:00
kcat 4acfbfc37a Merge pull request #435 from DanielGibson/sndio-more-channels
sndio: Support more than 2 channels
2020-06-07 10:59:54 -07:00
Daniel Gibson 5cffe7e50a sndio: Support more than 2 channels
So far the sndio backend only supports Mono and Stereo, but sndio
supports up to 16 channels (64 in their current git code).
This adds support for all the openal-soft formats (DevFmt*).
I tested this on Linux with 5.1 surround speakers.
2020-06-07 17:22:51 +02:00
Chris Robinson 70d345bbf2 Avoid convolving an always-0 sample 2020-05-30 16:29:23 -07:00
Chris Robinson 7a95a870be Clarify some changelog entries 2020-05-27 15:46:25 -07:00
Chris Robinson f1612ce228 Use dual-biquad processing for the equalizer effect 2020-05-26 18:08:57 -07:00
Chris Robinson 9b63e2460c Update the Changelog 2020-05-26 14:13:02 -07:00
Chris Robinson 7b642330c5 Simplify UHJ delay handling 2020-05-26 12:19:19 -07:00
Chris Robinson 8d77c59da4 Fade over more of the update with HRTF 2020-05-25 16:57:38 -07:00
Chris Robinson 4e82feffef Only apply non-silent inputs for blended HRIR 2020-05-25 16:37:31 -07:00
Chris Robinson 5eb1ae5a14 Simplify the HRTF blending fade out gain scaling 2020-05-25 13:18:10 -07:00
Chris Robinson 4d9d406966 Clarify an error message 2020-05-25 02:02:50 -07:00
kcat 070ed0d5ac Merge pull request #429 from jbeich/ci
Add FreeBSD to CI
2020-05-24 11:31:06 -07:00
Jan Beich c262d0146e CI: add FreeBSD job 2020-05-24 13:12:18 +00:00
Chris Robinson 1a287f434a Round the pitch shifter frequency bin targets 2020-05-22 16:36:41 -07:00
Chris Robinson 978f32acf7 Round the scaled HRTF delays 2020-05-21 17:59:15 -07:00
Chris Robinson 109875942c Slightly increase the HRTF direct delay
To help improve the phase-corrected HF scaler.
2020-05-21 15:25:03 -07:00
Chris Robinson 94105409f8 Print why a sofa file couldn't be opened 2020-05-21 13:51:48 -07:00
Chris Robinson da3dfa2fb0 Simplify handling the stablizer side channel delay 2020-05-21 13:48:50 -07:00
Chris Robinson e98017b475 Avoid a log10 constant call 2020-05-21 09:46:39 -07:00
Chris Robinson 5bbbe8341e Use an enum class for SpatializeMode 2020-05-21 09:10:32 -07:00
Chris Robinson e880c04f32 Clarify a comment about the band-splitter 2020-05-20 11:22:53 -07:00
Chris Robinson 200c164d78 Improve HRTF delay handling
Ensures source-level HRTF, the dry mix, and direct output all align properly,
and simplifies adding the delay in the direct mix output.
2020-05-20 11:13:06 -07:00
Chris Robinson f38b813ba8 Fix some comments 2020-05-19 18:22:38 -07:00
Chris Robinson 19baf646d2 Rename applyHfScale to processHfScale 2020-05-19 13:58:55 -07:00
Chris Robinson c5e90ed6c7 Use an enum for FamCount 2020-05-19 12:15:57 -07:00
Chris Robinson 825206bfa2 Apply the ambisonic HF scaling in real-time with HRTF
Rather than applying the HF scale to the IRs necessitating them to be truncated
along with increasing the IR size, it can be applied to the input signal for
the same results. Consequently, the IR size can be notably shortened while
avoiding the extra truncation. In its place, the delayed reversed all-pass
technique can still be used on the input for maintaining phase when applying
the bandsplit/hfscalar filter to the input signal.
2020-05-19 10:27:52 -07:00
Chris Robinson a512eae7bb Move BUFFERSIZE and FloatBufferLine to a separate header 2020-05-19 10:21:19 -07:00
Chris Robinson 463591663c Check that aligned_alloc is available with cmake
Some compilers support C++17 even on targets that lack required functions.
Projects that want to force C++17 will then run into a problem with
std::aligned_alloc not existing on those targets, so it needs to be explicitly
checked for. The alternative is to simply never use it even when it would be
available.
2020-05-19 08:13:13 -07:00
Chris Robinson 400a108ead Also search for asimd for Neon 2020-05-17 16:23:24 -07:00
Chris Robinson c75c96ce2d Assume Neon support if cpu_caps.cpp is compiled with it 2020-05-17 14:14:29 -07:00
Chris Robinson 36aebbb6ae Include the existing direct signal in the UHJ delay
So any direct_channels sources and normal panned sources remain aligned, and
the reported latency is accurate.
2020-05-16 11:35:55 -07:00
Chris Robinson 0f81fafc62 Fix some standard calls 2020-05-16 01:21:09 -07:00
Chris Robinson d086e78a38 Fix the all-pass's shuffle order 2020-05-14 21:16:21 -07:00
Chris Robinson 91b8387c0a Give names to parameter value constants 2020-05-13 00:57:03 -07:00
Chris Robinson f5bf7dc76e Do two samples at once with the SSE UHJ all-pass 2020-05-12 05:51:48 -07:00
Chris Robinson ad95cb6312 Clear the whole buffer 2020-05-12 04:46:15 -07:00
Chris Robinson 2f8f829772 Properly count the last number of samples to mix 2020-05-12 04:45:25 -07:00
Chris Robinson 3ce8a9914c Fix applying the UHJ phase-shift filter 2020-05-11 23:49:39 -07:00
Chris Robinson 2574b98f8a Move the bsinc tables out of common 2020-05-11 02:24:08 -07:00
Chris Robinson 0406e3bef7 Change a couple functions into member functions 2020-05-10 20:16:43 -07:00
Chris Robinson 2fb4ac1621 Revert "Fix the FFT half point for the shifter effects"
This reverts commit 12bb5a47cd.
2020-05-09 16:44:29 -07:00
Chris Robinson 52a5dc23a3 Fix the UHJ filter generator
The half point needs to be included in the frequency response.
2020-05-09 16:42:43 -07:00
Chris Robinson 73569dfeca Avoid a reference on a constexpr variable 2020-05-08 20:11:30 -07:00
Chris Robinson 1c320c3532 Use a FIR filter for the UHJ all-pass 2020-05-08 15:38:14 -07:00
Chris Robinson 12bb5a47cd Fix the FFT half point for the shifter effects 2020-05-08 01:39:48 -07:00
Chris Robinson 48fbad9836 Slightly improve the Hann windows
There's no need to include the 0 terms on the ends since they'll never
contribute a sample. So extend the width to have the 0 terms just outside the
window where it wouldn't contribute anyway.
2020-05-08 01:25:32 -07:00
Chris Robinson 301f8f5db5 Use std::arrays for the UHJ filters 2020-05-08 01:24:14 -07:00
Chris Robinson 0cfb8fee44 Combine multiple UHJ encoder all-pass loops 2020-05-07 21:01:37 -07:00
Chris Robinson 7ed37a8282 Use dual-band for the internal quad and 7.1 decoders 2020-05-07 03:15:46 -07:00
Chris Robinson faec0c78eb Allow declaring internal dual-band decoders 2020-05-07 02:13:11 -07:00
Chris Robinson 4630a535b2 Re-add an option for installing the main lib 2020-05-07 00:02:23 -07:00
Chris Robinson ca851298ad Update the quad and 7.1 decoders 2020-05-06 22:36:29 -07:00
Chris Robinson bef25361f1 Make the built-in decoders more flexible 2020-05-06 19:31:31 -07:00
Chris Robinson f82fca2c6a Fix the dual-band decoder 2020-05-05 16:56:25 -07:00
Chris Robinson ee82db3966 Use a flexible array for the front stablizer delay buffers 2020-05-05 01:34:14 -07:00
Chris Robinson deac36a1eb Improve the front stablizer
Apply the all-pass+band-split only once, after generating the mid and side
signals separately.
2020-05-05 01:05:38 -07:00
Chris Robinson fcec76663f Move some sin/cos constants out of a loop 2020-05-04 16:16:55 -07:00
Chris Robinson 58d953f6aa Clear buffers right before use 2020-05-03 19:13:20 -07:00
Chris Robinson 15fd3da870 Don't put the LFO on the stack 2020-05-03 19:04:43 -07:00
Chris Robinson fe7a74b09a Use a helper to set an identity ambisonic pan 2020-05-03 18:47:49 -07:00
Chris Robinson b52fde7c0e Simplify SIMD linear resampler loop count 2020-05-02 20:27:05 -07:00
Chris Robinson b051f2e33d Use a matching type given the initializer 2020-05-02 19:24:21 -07:00
Chris Robinson 6823fa2de2 Improve the leftover and realignment mixing loops
Using a mask helps the compiler recognize that the leftover (any remaining non-
multiple-of-4) and realignment loops will only have 3 iterations at most, which
it can unroll or otherwise make more meaningful optimizations for. Previously
it would try to vectorize and partially unroll the loops, which is wasteful
when there would never be enough to vectorize.
2020-05-02 16:42:24 -07:00
Chris Robinson 3898b77dd6 Avoid iterators for the main mixer 2020-05-01 21:14:41 -07:00
Chris Robinson 8acf16fc82 Make BuildBFormatHrtf a member of DirectHrtfState 2020-05-01 10:28:16 -07:00
Chris Robinson ae09e1f60c Don't truncate odd IR sizes with SSE 2020-04-30 20:33:35 -07:00
Chris Robinson 6bc3ae178e Use a more efficient type for holding the IrSize 2020-04-30 17:03:56 -07:00
Chris Robinson 972869f76f Dump the ffmpeg file info on the main thread 2020-04-29 21:32:09 -07:00
Chris Robinson 054071998c Correctly handle unicode paths on Windows for ALSOFT_LOGFILE 2020-04-29 15:41:11 -07:00
Chris Robinson a25dea6cd9 Rename effect_chain to effect_target 2020-04-29 14:39:28 -07:00
Chris Robinson 047f1666d5 Fix subspan extent calculation 2020-04-28 19:58:17 -07:00
Chris Robinson 4094135ed7 Don't return a bool from the backend start method 2020-04-28 19:25:58 -07:00
Chris Robinson 065775d814 Limit the maximum settable sample rate 2020-04-28 16:30:11 -07:00
Chris Robinson 45cb3e4956 Remove a couple redundant comments 2020-04-28 14:59:45 -07:00
Chris Robinson cf64dc1103 Fix up some more uses of [AL[C]]void 2020-04-28 14:48:12 -07:00
Chris Robinson 2520d492a5 Clean up al.h a bit 2020-04-28 14:27:52 -07:00
Chris Robinson c47f4822dc Move standard ALC function's annotations to the header 2020-04-28 13:36:43 -07:00
Chris Robinson 1120f52556 Clean up some function comments 2020-04-28 08:29:42 -07:00
Chris Robinson b828cf81a9 Shorten the name of format types 2020-04-28 07:56:36 -07:00
Chris Robinson 5441fba419 Don't maintain a global backend list end 2020-04-28 07:28:22 -07:00
Chris Robinson 187477db03 Properly return on error 2020-04-28 07:01:30 -07:00
Chris Robinson b4435cd053 Avoid using some extraneous ALC types 2020-04-28 06:51:21 -07:00
Chris Robinson 0a69adf845 Avoid unnecessary PATH_SUFFIXES 2020-04-26 07:59:08 -07:00
Chris Robinson 950e4f3cc4 Avoid duplicate env var declarations 2020-04-26 07:36:50 -07:00
Chris Robinson ff1562c916 Don't delete non-existent files in AppVeyor 2020-04-26 07:19:27 -07:00
Chris Robinson e3f6afafde Remove some hopefully unneeded macros 2020-04-25 02:12:43 -07:00
Chris Robinson be476c7935 Use global placement new for AsyncEvent 2020-04-24 07:04:32 -07:00
Chris Robinson f49238c792 Minor cleanup of reverb code 2020-04-24 02:51:23 -07:00
Chris Robinson 8739833770 Add a method to process two biquads at once 2020-04-23 22:13:52 -07:00
Chris Robinson e89978195f Clean up some scaling math 2020-04-23 06:18:54 -07:00
Chris Robinson aff410fa6d Avoid using some more AL types 2020-04-23 04:57:04 -07:00
Chris Robinson 2deb5e47d1 Avoid an unnecessary out parameter 2020-04-21 23:58:53 -07:00
Chris Robinson a97e6e6a12 Fix the source ID for a source voice stopped from deletion 2020-04-21 01:01:18 -07:00
Chris Robinson 552d2b1918 Set the device name in the Oboe backend 2020-04-20 04:39:36 -07:00
Chris Robinson 947826af1c Get rid of an unnecessary variable 2020-04-20 04:30:14 -07:00
Chris Robinson b692440725 Trace the opened Oboe stream properties 2020-04-19 15:19:28 -07:00
Chris Robinson 3ef6f22760 More gracefully relax the Oboe format request 2020-04-19 15:10:22 -07:00
Chris Robinson 61cf6d3bb6 Simplify some install statements 2020-04-19 04:38:44 -07:00
Chris Robinson 9b9a65a0bf Use an import target for libsndfile 2020-04-19 04:00:01 -07:00
Chris Robinson 3902337e01 Fix some message formatting 2020-04-19 03:37:32 -07:00
Chris Robinson 07726ad63a Make sure HAVE_OBOE is cleared before checking 2020-04-19 03:35:31 -07:00
Chris Robinson 1ca7f22145 Correctly test for SSE switches 2020-04-19 02:47:11 -07:00
Chris Robinson 0a0478f670 Rename install options for consistency 2020-04-19 00:58:01 -07:00
Chris Robinson 12d71a0ad1 Don't explicitly link libpthread
Compiling and linking with -pthread is apparently enough.
2020-04-19 00:37:03 -07:00
Chris Robinson 253773b316 Build Oboe with hidden visibility 2020-04-18 23:03:50 -07:00
Chris Robinson 643b192fd5 Try to be more robust with the Oboe format 2020-04-18 22:43:20 -07:00
Chris Robinson a387a610f8 Add missing backslash 2020-04-18 20:46:20 -07:00
Chris Robinson 0390828de0 Initial implementation for Oboe-based playback 2020-04-18 19:21:13 -07:00
Chris Robinson bd9eae8edd Attempt to build with Oboe on Android with Travis 2020-04-18 19:20:38 -07:00
Chris Robinson 67e54a2669 Add an Oboe backend stub 2020-04-18 15:17:53 -07:00
Chris Robinson a1e5f4eb83 Use cmake --build with Travis to build
Instead of assuming makefiles
2020-04-17 23:33:09 -07:00
Chris Robinson cd87b9c66b Update Travis to use Android NDK r21, API 16 2020-04-17 23:21:04 -07:00
Chris Robinson 93e677edb3 Precalculate some values
MSVC isn't as willing to precompute sqrt and log10 results from known input
values.
2020-04-16 23:17:07 -07:00
Chris Robinson 3824b92704 Simplify some reverb update code 2020-04-16 20:52:20 -07:00
Chris Robinson 27ac637a66 Remove another unnecessary return value 2020-04-16 17:29:32 -07:00
Chris Robinson cf4a848fd0 Remove an always-true return value 2020-04-16 16:00:26 -07:00
Chris Robinson 3cb12da765 Move a type to where it's used 2020-04-16 02:05:07 -07:00
Chris Robinson dc41f276d8 Get rid of the specialized MixRow_ methods 2020-04-16 01:47:33 -07:00
Chris Robinson 5214a7210a Combine multiple target installs 2020-04-15 00:21:36 -07:00
Chris Robinson 3a5a9e90d0 Fix installing alsoft-config 2020-04-15 00:09:45 -07:00
Chris Robinson 8ef8b5e215 Combine utility target installs 2020-04-14 23:37:48 -07:00
Chris Robinson cd6908fd19 Always define install targets for the main library
Examples and utilities now have separate install options.
2020-04-14 23:25:47 -07:00
Chris Robinson 930cda39cd Simplify some indentation 2020-04-14 22:02:59 -07:00
Chris Robinson ac54ab8a3e Remove some unnecessary cmake checks 2020-04-14 18:25:22 -07:00
Chris Robinson 78e789bf7b Silence a type conversion warning with GCC 2020-04-14 12:05:54 -07:00
Chris Robinson 6ac5816354 Avoid inlining some potentially costly calls 2020-04-14 11:50:59 -07:00
Chris Robinson 7f81eec1a6 Avoid a function call to get the frame step 2020-04-13 23:36:05 -07:00
Chris Robinson 02d7fbfa0c Use standard attribute declarations 2020-04-13 23:27:56 -07:00
Chris Robinson 1d8ac4d61f Throw exceptions for errors in the effect getters/setters 2020-04-10 20:23:20 -07:00
Chris Robinson 13153bab60 Add an effect_exception for handling effect properties 2020-04-10 18:26:08 -07:00
Chris Robinson f7380a44d4 Use a common base for a couple exceptions 2020-04-10 15:12:57 -07:00
Chris Robinson 611a0155cd Ignore "attribute '...' is not recognized" MSVC warning 2020-04-10 15:12:57 -07:00
kcat fc140db781 Merge pull request #414 from ArthurSonzogni/master
Add missing <cstdarg>
2020-04-10 15:01:38 -07:00
ArthurSonzogni 7548c235bd Add missing <cstdarg>
OpenAL-Soft fails to compile on some GCC version:
https://travis-ci.com/github/ArthurSonzogni/smk/jobs/318304162

It has regressed likely after:
https://github.com/kcat/openal-soft/commit/c83609277bed4be4ef40ed306bf2c57fefa19519

va_start is defined in:
- <stdarg.h>
- <cstdarg>

The repository is using it from:
- al/error.cpp
- al/filter.cpp
- alc/alu.cpp
- alc/helpers.cpp
- common/alexcpt.cpp
- utils/makemhr/loaddef.cpp
- utils/openal-info.c

This patch is adding its definition in the files missing it:
- common/alexcpt.cpp
- utils/makemhr/loaddef.cpp
- utils/openal-info.c

Bug: https://travis-ci.com/github/ArthurSonzogni/smk/jobs/318304162
2020-04-10 23:36:19 +02:00
Chris Robinson e123fa0ec3 Apply some alloc and alignment attributes 2020-04-10 11:05:25 -07:00
Chris Robinson 8bddf3e6ab Report invalid filter values 2020-04-10 09:16:08 -07:00
Chris Robinson 8713bb8afb Add missing include 2020-04-10 09:04:40 -07:00
Chris Robinson ae173ba863 Remove an unused cmake variable 2020-04-10 08:59:22 -07:00
Chris Robinson 0dc9b0392d Apply static-link flags directly to the target 2020-04-10 08:43:59 -07:00
Chris Robinson 35a2b0e5f8 Simplify generating chorus delays a bit 2020-04-09 21:00:37 -07:00
Chris Robinson c83609277b Use exceptions for filter errors 2020-04-09 19:36:37 -07:00
Chris Robinson 97c11577cd Make a default/empty constructor noexcept 2020-04-09 19:32:02 -07:00
Chris Robinson d67cba99bd Clean up some more unnecessary uses of AL types 2020-04-08 10:15:43 -07:00
Chris Robinson 8a5153ce0d Avoid ALfloat and ALint in the effects 2020-04-08 07:28:07 -07:00
Chris Robinson 55539787fb Avoid ALfloat in some places 2020-04-08 06:17:04 -07:00
Chris Robinson 024112a53a Use acquire-release semantics for changing deferred updates 2020-04-07 12:46:35 -07:00
Chris Robinson 0077a01667 Don't yield the CPU when waiting for updates to finish 2020-04-07 12:36:44 -07:00
Chris Robinson f628ab2151 Use better values for a couple in-progress enums 2020-04-07 12:24:20 -07:00
Chris Robinson efed431237 Use a unique_ptr for constructing the bsinc table coefficients 2020-04-07 08:30:37 -07:00
Chris Robinson 2fcc3f3887 Dynamically allocate the temporary bsinc filter table 2020-04-06 17:12:39 -07:00
Chris Robinson 7a324231a3 Combine the late reverb feedback and modulator delay lines 2020-04-06 16:14:13 -07:00
Chris Robinson 6ff5339112 Include the average modulation delay for the late reverb feedback 2020-04-06 15:46:14 -07:00
Chris Robinson baf14aad2a Pass the BSincHeader by reference instead of value 2020-04-05 23:08:02 -07:00
Chris Robinson ab6afd6fa0 Reimplement the modulation stage for reverb
This seems to be quite close recordings from real hardware, so it's probably
good enough.
2020-04-05 12:00:45 -07:00
Chris Robinson 192b1a1f65 Require Qt5 for alsoft-config 2020-04-05 01:41:36 -07:00
kcat de2599b70b Merge pull request #167 from aaronmjacobs/build-version-option
Add option to disable "build_version" cmake target
2020-04-05 00:02:54 -07:00
Chris Robinson 25464b2210 Avoid storing the bsinc coefficient deltas before output
This cuts the majority of stack use when generating the coefficients.
2020-04-04 22:04:59 -07:00
Chris Robinson 8084d08cf9 Get rid of the Android cross-compile toolchain
It has problems, and the Android NDK provides one that works fine.
2020-04-04 10:58:43 -07:00
Chris Robinson 9b11029af9 Remove the now-unused native tools 2020-04-04 08:58:06 -07:00
Chris Robinson 431d01cc7f Use a cmake script to convert a binary file to a header file 2020-04-04 08:46:18 -07:00
Chris Robinson a0b7638d63 Add an extension to change a buffer's unpack ambisonic order 2020-04-04 03:10:01 -07:00
Chris Robinson fc906c97f5 Track a buffer's ambisonic order 2020-04-04 01:52:29 -07:00
Chris Robinson 902f5a0dd2 Add an ambisonic order parameter to the buffer channel count 2020-04-03 21:43:57 -07:00
Chris Robinson bd50601f15 Remove a couple outdated comments 2020-04-03 10:07:43 -07:00
Chris Robinson 8f47013e43 Some more ALfloat->float cleanup 2020-04-03 08:49:15 -07:00
Chris Robinson 1130597562 Use structs for the mixer and resampler tags 2020-04-03 03:52:23 -07:00
Chris Robinson d9225083b4 Avoid using ALfloat in the mixer functions 2020-04-03 03:11:32 -07:00
Chris Robinson 236564b54a Another small cleanup 2020-04-03 02:57:51 -07:00
Chris Robinson 8adbde90f5 Jump to the target gain if the fade amount is small 2020-04-03 02:48:35 -07:00
Chris Robinson 367d4af07c Avoid unnecessary duplication in the resamplers 2020-04-03 02:39:23 -07:00
Chris Robinson ebe30fb0bd Remove the now-unused bsincgen 2020-04-02 04:34:28 -07:00
Chris Robinson ee89ca1bdd Fix bsinc filter alignment and offsets 2020-04-02 02:13:18 -07:00
Chris Robinson 57109902cd Avoid std::abs in a constexpr function 2020-04-02 01:52:07 -07:00
Chris Robinson 8853519d89 Generate the bsinc tables using constexpr methods
All the methods used should be compliant with C++14 constexpr rules. However,
the number of scales and phases cause GenerateBSincCoeffs to reach the allowed
step limit, preventing full compile-time generation. It's not a terribly big
deal, it'll generate them very quickly when loading, but it does prevent using
shared read-only memory pages.
2020-04-02 00:49:19 -07:00
Chris Robinson 6fb59f1182 Avoid using M_PI 2020-04-01 22:22:50 -07:00
Chris Robinson bf48dcd375 Report better latency when PulseAudio has no timing info 2020-03-30 20:06:24 -07:00
Chris Robinson b9f19c6ca2 Inline a small helper method 2020-03-30 16:06:34 -07:00
Chris Robinson 662d77159b Get rid of a redundant enum 2020-03-30 16:00:02 -07:00
Chris Robinson f2ddf971df Return the enumerated device names from the backend
Rather than using an out parameter.
2020-03-30 15:37:41 -07:00
Chris Robinson 167bdce48d Hold the ListLock while opening a device
Since it may rely on the enumerated device list that could be updated
asynchronously.
2020-03-30 13:50:50 -07:00
Chris Robinson 75479b58e3 Remove use of unnecessary type aliases 2020-03-30 13:43:49 -07:00
Chris Robinson cc009b8aa0 Move the FrontStablizer definition to its own header 2020-03-30 01:16:15 -07:00
Chris Robinson f8a5ea2d74 Inline a couple BackendBase methods 2020-03-30 00:07:35 -07:00
Chris Robinson 9b237790b2 Remove the mutex from the backend base 2020-03-29 23:57:37 -07:00
Chris Robinson d70912c034 Remove the QSA backend
It's been broken for who knows how long, and could really do with a rewrite for
the new interface anyway.
2020-03-29 20:37:58 -07:00
Chris Robinson fed80e0c10 Reset real-time priority on fork 2020-03-29 19:39:00 -07:00
Chris Robinson fb433cd918 Protect the call to pa_mainloop_quit with the mutex 2020-03-29 03:44:34 -07:00
Chris Robinson 5dfa24d5e2 Stop updating effects when one fails 2020-03-29 03:10:35 -07:00
Chris Robinson a5b8167280 Make some functions private methods 2020-03-28 18:15:05 -07:00
Chris Robinson 963d9b761b Rename ALvoice and related structs to Voice 2020-03-28 18:15:05 -07:00
Chris Robinson fb07612545 Get rid of MAX_INPUT_CHANNELS 2020-03-28 18:15:05 -07:00
Chris Robinson f1f9a14172 Avoid AL[C]boolean for internal use 2020-03-28 18:15:05 -07:00
Chris Robinson 504745abec Use a standard bool instead of ALboolean 2020-03-28 18:15:05 -07:00
Chris Robinson e78cb9b77f Avoid using more unnecessary type aliases 2020-03-28 18:15:04 -07:00
kcat 3fce1c4217 Merge pull request #405 from aaronmjacobs/cmake-fixes
Fix find_package_handle_standard_args name mismatch warnings
2020-03-28 18:14:34 -07:00
Aaron Jacobs a3a2305d7a Fix find_package_handle_standard_args name mismatch warnings 2020-03-28 17:43:17 -07:00
kcat 6cfb4ec462 Merge pull request #404 from jhasse/cmake-no-cxx-compiler
Don't require a C++ compiler for native-tools
2020-03-27 12:35:23 -07:00
Jan Niklas Hasse 2a3c7ccd81 Don't require a C++ compiler for native-tools
"By default C and CXX are enabled if no language options are given."
https://cmake.org/cmake/help/v3.17/command/project.html
2020-03-27 20:14:25 +01:00
Chris Robinson 8731accd3f Make sure prebuf is filled when starting pulseaudio playback 2020-03-27 01:03:01 -07:00
Chris Robinson e73c0979a1 Use "zero-copy" writes with pulseaudio playback 2020-03-26 22:50:54 -07:00
Chris Robinson d344c5a228 Avoid some extraneous uses of AL type aliases 2020-03-25 22:39:45 -07:00
Chris Robinson e8149ec509 Move some setup to a more logical place 2020-03-25 22:24:09 -07:00
Chris Robinson a27096dd63 Dynamically allocate voice channel data
Rather than allocating for a full 8 channels for each voice, when the vast
majority will only need 1 or 2. The voice channel data is relatively big since
it needs to hold HRTF coefficients and history, and this will allow increasing
the maximum number of buffer channels without an obscene memory increase.
2020-03-25 21:06:24 -07:00
Chris Robinson cae78e79e8 Convert the examples from SDL_sound to libsndfile 2020-03-24 15:46:47 -07:00
Chris Robinson 586bc94d51 Use libsndfile for the alplay example 2020-03-24 13:36:49 -07:00
Chris Robinson c24d127229 Avoid non-namespace template specialization 2020-03-24 12:03:07 -07:00
Chris Robinson cc27bbb680 Clear the WASAPI device list when enumerating 2020-03-24 11:48:25 -07:00
Chris Robinson 62f17d8763 Don't send close messages for unopened WASAPI devices 2020-03-24 11:40:34 -07:00
Chris Robinson eed8407599 Remove some unused functions 2020-03-23 17:18:11 -07:00
Chris Robinson 7effad45c2 Clean up ALfilter some
Use inline methods instead of macros
Fix indentation
Add some consts
2020-03-23 16:31:08 -07:00
Chris Robinson 6a3b3b180b Add a macro to disable class-specific new/delete 2020-03-23 16:00:50 -07:00
Chris Robinson b53294e291 Use inline initialization more for sources 2020-03-23 15:04:26 -07:00
Chris Robinson 5d0f90fed0 Avoid ## in a macro
Cppcheck thinks it's an invalid use of it
2020-03-23 14:26:00 -07:00
Chris Robinson 41b4c06697 Simplify clamping the voice mix size 2020-03-23 11:35:08 -07:00
Chris Robinson 132a69c03d Use more appropriate types for bitfields 2020-03-22 21:34:50 -07:00
Chris Robinson 46234171d1 Clean up some C++11-isms 2020-03-22 21:15:12 -07:00
Chris Robinson dc8ccc06ce More cleanup for the pitch shifter 2020-03-22 20:48:02 -07:00
Chris Robinson 813d4ed566 Use make_unique instead of new'ing into a unique_ptr 2020-03-22 18:48:33 -07:00
Chris Robinson 49b2d703e7 Properly define the new[] and delete[] operators 2020-03-22 13:28:45 -07:00
Chris Robinson 3c631149e3 Update AppVeyor to VS 2017 for 32-bit 2020-03-22 11:41:57 -07:00
Chris Robinson be1584ab47 Avoid assigning in a conditional expression 2020-03-22 11:35:08 -07:00
Chris Robinson ef663f13c0 Properly allocate voices 2020-03-22 11:34:37 -07:00
Chris Robinson 3d09898d40 Use the correct include for al::fstream 2020-03-22 11:09:19 -07:00
Chris Robinson 2acdcba8d1 Silence a potential type truncation warning 2020-03-22 10:41:23 -07:00
Chris Robinson f3ff28fb2a Some type cleanup 2020-03-22 10:41:02 -07:00
Chris Robinson d30d9a2c9f Clean up the pitch and frequency shifter some 2020-03-22 10:06:23 -07:00
Chris Robinson 002d0eb6a0 Fix the frequency shifter channel panning 2020-03-22 08:51:59 -07:00
Chris Robinson 9ce182228d Avoid some pre-C++14 workarounds 2020-03-22 08:51:06 -07:00
Chris Robinson 040309b9f4 Add missing semicolon 2020-03-22 08:22:25 -07:00
Chris Robinson f6a0b004e0 Update to C++14 2020-03-22 08:05:22 -07:00
Chris Robinson adf28d87aa Remove the check for stat()
It's POSIX-2001 standard
2020-03-21 08:39:45 -07:00
Chris Robinson 12775513ae Cleanup some helper code 2020-03-20 15:48:27 -07:00
Chris Robinson 0d11de3e8d Move CPUCapFlags and FillCPUCaps to their own source 2020-03-20 15:30:41 -07:00
Chris Robinson f56ef433d8 Move the FPUCtl methods to its own source 2020-03-20 15:01:45 -07:00
Chris Robinson ad98895876 Avoid a function call to get the channel count 2020-03-18 04:08:26 -07:00
Chris Robinson 7805179313 Rename a method to be clearer 2020-03-18 03:17:14 -07:00
Chris Robinson 54e2eafcc9 Make the pulseaudio enumeration functions class methods 2020-03-18 03:07:54 -07:00
Chris Robinson 9f077d5f41 Remove a couple unused methods 2020-03-18 02:35:31 -07:00
Chris Robinson bf50f227b9 Use a busy-wait when synchronizing against the mixer
The mixer should have higher priority than any thread that can make AL calls,
so even on single-core systems, it shouldn't stall the mix. It will, however,
return back to the caller as soon as it can, while yielding will give up the
timeslice if there's any other thread waiting to process even if the mix is
almost done.
2020-03-16 01:05:14 -07:00
Chris Robinson 78251fd7e6 Fix voices being forced to update without valid properties
When starting a voice, the source ID was set before its first update struct was
provided, creating a small window where a listener or effect slot update could
force a voice to update without it having any valid properties to update with.
Supplying the update struct first would create a different race, where the
mixer could see a voice without a source but with an update struct, causing the
update struct to be 'freed' without being applied.

The fix here is to provide the update struct before setting the source ID, and
change the mixer to ignore update structs for voices without a source ID. This
can pseudo-orphan the updates that get set on a voice just as it stops, leaving
the struct unusable until the voice is used again, or the voice gets deleted
which will clear it. But it allows the update struct to stay in place and get
applied once the voice gets a source ID.
2020-03-04 23:18:05 -08:00
Chris Robinson 48b9b541ec Avoid redundantly setting voice members 2020-03-04 13:40:21 -08:00
Chris Robinson 971862a80c Don't change flags after InitVoice 2020-03-04 11:01:35 -08:00
Chris Robinson e7405f7801 Use a new voice state to indicate a pending source offset change 2020-03-04 10:16:59 -08:00
Chris Robinson 08dc831e0e Avoid unnecessarily reclearing some variables 2020-03-03 20:44:19 -08:00
Chris Robinson accc1ec1c8 Add a helper to wait for the device mix 2020-03-03 20:32:44 -08:00
Chris Robinson 3e1a2c0f77 Use an intrusive_ptr for the device's HrtfStore 2020-03-01 17:16:09 -08:00
Chris Robinson a01617904c Simplify getting a voice for a new source offset 2020-02-28 20:07:43 -08:00
Chris Robinson b42d241da5 Use real-time priority by default 2020-02-26 09:53:06 -08:00
Chris Robinson eb49290dab Remove unnecessary locks now that the mixer doesn't require one 2020-02-26 04:58:02 -08:00
Chris Robinson 4555b74bd7 Use a VoiceChange object to change the offset of a playing source 2020-02-26 03:52:40 -08:00
Chris Robinson 872096958b Rename the voice's PendingStop to PendingChange 2020-02-26 01:48:59 -08:00
Chris Robinson 814f80ec59 Move voice initialization to a separate function 2020-02-26 01:39:30 -08:00
Chris Robinson 8618571866 Avoid storing the source offset when it's just read and reset 2020-02-26 01:03:23 -08:00
Chris Robinson 795c4fcecc Make the source's send array static instead of dynamic 2020-02-25 06:39:03 -08:00
Chris Robinson 9ddfcd6a1b Update an comment about the default HRTF filters 2020-02-25 05:00:26 -08:00
Chris Robinson af6584b8fc Reduce the maximum number of source sends to 6 2020-02-25 04:52:39 -08:00
Chris Robinson 7144cf405a Handle playing voices after disconnection 2020-02-24 22:21:44 -08:00
Chris Robinson fd0ed9f33f Improve searching for the next voice when playing multiple sources
Instead of searching from the beginning of the voice list for each source, just
continue searching from the last source's voice.
2020-02-24 21:40:54 -08:00
Chris Robinson 52d86ad51f Ignore VoiceChange objects while disconnected
And try to improve ALvoice/VoiceChange handling when attempting to recover a
lost device.
2020-02-24 11:01:45 -08:00
Chris Robinson 90d45984dc Simplify replaying a source 2020-02-23 21:40:54 -08:00
Chris Robinson 8554e6cde2 Remove AL_SOFT_map_buffer from alffplay and add AL_SOFT_callback_buffer
The former doesn't really help too much since buffers still need to be
(re)filled and (de)queued individually. A callback buffer, on the other hand,
allows for greater efficiency since it just needs to write into a ring buffer
that the mixer will directly read from.
2020-02-23 06:28:39 -08:00
Chris Robinson a37932a0d0 Fix voice allocation increase amount 2020-02-22 18:01:34 -08:00
Chris Robinson 6044e0d7ca Remove a couple unnecessary type aliases 2020-02-22 00:08:55 -08:00
Chris Robinson 4660819f6a Avoid a single function call in a loop 2020-02-21 22:17:29 -08:00
Chris Robinson a8162a77c2 Use an array of ALvoice pointers for the active voices
This allows growing the array atomically with the mixer since the ALvoice
objects themselves don't move, and a new larger array of them can be swapped in
without blocking the mixer.
2020-02-21 20:14:28 -08:00
Chris Robinson 6e6a30679e Set the voice's property update after the source ID
Otherwise the mixer has a chance to throw it out before realizing it's needed.
2020-02-21 04:55:04 -08:00
Chris Robinson 0694df9014 Handle playing and pausing with VoiceChanges 2020-02-21 04:29:32 -08:00
Chris Robinson 9887c6971d Prepare VoiceChange objects one at a time 2020-02-21 03:23:22 -08:00
Chris Robinson 9b801227d5 Don't unnecessarily count all voices when playing sources 2020-02-21 00:54:05 -08:00
Chris Robinson 9b43327f56 Asynchronously stop and rewind voices 2020-02-20 23:53:56 -08:00
Chris Robinson bdb8ef22b0 Asynchronously stop voices if its source is being deleted 2020-02-20 22:50:37 -08:00
Chris Robinson acf7f6f74e Add a voice flag to indicate a voice has a pending stop
Pending/asynchronous stops to be implemented soon.
2020-02-20 19:18:07 -08:00
Chris Robinson 642ef4edc9 Add a streaming example using a callback buffer 2020-02-20 17:53:09 -08:00
Chris Robinson 3aad01d3ba Add AL_SOFTX_callback_buffer to the extension list 2020-02-19 17:32:32 -08:00
Chris Robinson 4277c05b0c Workaround a 32-bit GCC/MinGW TLS bug 2020-02-18 18:14:59 -08:00
Chris Robinson d4e01a1818 Flag the voice as callback-based when given a callback buffer 2020-02-17 17:34:17 -08:00
Chris Robinson 04e5b23286 Don't bother looping the calculated source offset
The offset shouldn't be in a non-wrapped state when playing, and when not
playing it's always 0 anyway.
2020-02-17 17:30:47 -08:00
Chris Robinson d6e49b503b Don't allow setting a source offset for a callback 2020-02-17 17:20:01 -08:00
Chris Robinson 3122c3b4a1 Handle running the buffer callback in the voice 2020-02-17 17:13:25 -08:00
Chris Robinson c8dfd24818 Add a callback flag for voices 2020-02-17 04:50:00 -08:00
Chris Robinson a221f8671e Prevent queueing a callback buffer
Also prevent setting it on multiple sources
2020-02-17 00:32:22 -08:00
Chris Robinson ccc6da0a5b Set and retrieve a buffer's callback 2020-02-17 00:22:51 -08:00
Chris Robinson 3156b17057 Stub out an interface for a callback-driven buffer 2020-02-16 23:49:29 -08:00
Chris Robinson 8665f404a5 Always start streaming sources from the start of the queue
For sources that don't start with an offset, at least. This is necessary so the
completed buffer event will give the correct count if it starts with null or
empty buffers that become processed.
2020-02-15 22:37:19 -08:00
Chris Robinson be89684f3c Update the makemhr utility and default HRTF 2020-02-11 01:01:10 -08:00
Chris Robinson 1d91e282c8 Update the MHR format
This update removes the 16/24-bit sample type enum, now always being 24-bit
(other than a very small size saving, there's no practical benefit to storing
16-bit samples). This also reverses the field storage, so no on-load fixup is
needed, and stores the IR delays with 2 bits of sub-sample precision, allowing
for slightly better timing (after resampling, blending, etc).
2020-02-11 00:37:21 -08:00
Chris Robinson 3acc667c28 Scale delays when exceeding the max for generated mhr files 2020-02-10 22:25:07 -08:00
Chris Robinson 6ebdf3ab62 Use a triplet struct array instead of separate arrays 2020-02-09 14:25:20 -08:00
Chris Robinson f2bc24f761 Consistently use distant wavefronts for 0 distance 2020-02-08 22:39:32 -08:00
Chris Robinson 85395b23a4 Clear voice target gains earlier 2020-02-08 18:10:59 -08:00
Chris Robinson 3ee0906c81 Use std::array and span for the HRTF delays 2020-02-08 15:00:58 -08:00
kcat e72a02c5e2 Merge pull request #393 from Etwus/patch-1
Fix unreachable code warning
2020-02-08 15:00:26 -08:00
Aleš Gajdacz 7e319ad99b Fix unreachable code warning 2020-02-08 23:34:09 +01:00
Chris Robinson ebb1aaa06d Make sure stereo angles are kept in-range. 2020-01-31 11:11:06 -08:00
Chris Robinson e960276a47 Try harder to find the closest HRIR for the B-Format decoder 2020-01-26 01:23:39 -08:00
Chris Robinson bd7937e5b5 Update the default HRTF 2020-01-25 16:59:07 -08:00
Chris Robinson f63880c2ff Use the peak IR magnitude to get the onset
While maybe not technically correct, we actually only care about the difference
between onsets (any base constant is removed). This should work better since it
determines when the IR is most audible, whereas previously it used a variable
threshold of when it reached 15% of the max amplitude.

An even better method may be to check where the IR amplitude exceeds a fixed
threshold (i.e. the same threshold applied to all IRs), but that would need
tweaking to find a level that doesn't catch random noise and doesn't
potentially miss the more occluded IRs.
2020-01-25 16:59:07 -08:00
kcat 3cd4af1b8e Merge pull request #385 from sergeyext/fix_msvc_runtime
Set static MSVC runtime for cpp files when FORCE_STATIC_VCRT is ON.
2020-01-25 15:44:30 -08:00
Sergey Karchevsky 3001d56d4b Set static MSVC runtim for cpp files when FORCE_STATIC_VCRT is ON.
Fixes #384
2020-01-26 05:38:37 +07:00
Chris Robinson f5e0eef34d Release 1.20.1 2020-01-23 23:28:45 -08:00
Chris Robinson 43780913cd Fix the output channel count for the B-Format decoder 2020-01-19 13:40:39 -08:00
Chris Robinson 3904289af7 Only sort active effect slots as needed 2020-01-18 18:53:58 -08:00
Chris Robinson 8a9eef70af Use struct methods to get a buffer's format info 2020-01-18 13:23:59 -08:00
Chris Robinson 32c9dbd7ff Avoid an extraneous index map 2020-01-15 10:45:08 -08:00
Chris Robinson 6a8c6eae6f Make a couple helper methods to create BFormatDec 2020-01-15 10:33:56 -08:00
Chris Robinson fcfcb88b28 Repack B-Format decoder fields
This should better provide sequential access.
2020-01-15 10:09:41 -08:00
Chris Robinson c112acadaf Transpose BFormatDec's matrices
This allows the band-split and output mix to happen together, rather than
splitting all input channels first and then mixing them to output.
2020-01-14 23:08:04 -08:00
Chris Robinson 030d428aec Clean up some formating 2020-01-14 13:10:01 -08:00
Chris Robinson 75a58ae333 Simplify appending delayed samples 2020-01-14 12:13:00 -08:00
Chris Robinson 5324bdb908 Signal the event handler only once per update 2020-01-14 10:39:41 -08:00
Chris Robinson 400c768e2f Inline a couple ring buffer methods 2020-01-14 10:17:57 -08:00
Chris Robinson e889282131 Get rid of an unnecessary struct 2020-01-13 19:45:13 -08:00
Chris Robinson a1a107f576 Return immediately on error when loading HRTFs 2020-01-13 18:13:05 -08:00
Chris Robinson aca1d02024 Get the audio sync once per update in alffplay 2020-01-13 17:31:35 -08:00
Chris Robinson a56a6116c0 Make a separate function for duplicate code 2020-01-13 15:55:31 -08:00
Chris Robinson 174e48fe8f Use the Field and Elevation structs directly when loading 2020-01-13 14:23:11 -08:00
Chris Robinson bc946b004e Don't assume the total length of certain arrays 2020-01-13 10:59:15 -08:00
Chris Robinson 7551242143 Use a span for a fixed-size array reference 2020-01-13 08:55:10 -08:00
Chris Robinson a866aece46 Add missing include 2020-01-12 19:28:12 -08:00
Chris Robinson 2f1a2ce242 Scale the resampled HRTF delays if they exceed the max 2020-01-12 14:49:11 -08:00
Chris Robinson 00d80497d8 Warn when resampled HRIR delays get clamped 2020-01-12 11:24:30 -08:00
Chris Robinson c182a3376a Blend the whole IR for the interpolated HRIR
The SIMD mixers may use a few more elements beyond the irSize, so not limiting
the blend to that size can slightly improve the quality for resampled HRIRs.
2020-01-12 11:08:05 -08:00
Chris Robinson 711c05613e Update changelog 2020-01-12 10:52:55 -08:00
Chris Robinson af08f68448 Fix JACK process callback handling
The callback apparently can't be set after activation, but we can't allocate
the ring buffer until after activation when the callback is already getting
called. An ugly flag it is, then, I guess.
2020-01-12 07:48:11 -08:00
Chris Robinson 6f1c853397 Don't allocate the ring buffer for JACK before activation
It seems the JACK server can send buffer size change events during device reset
and wait on it, which causes a failure since the change event can't be
processed during a reset. It's otherwise impossible to safely disable the
change event callback during a reset since the lock is already held and the
callback can be waiting to acquire it. The only guarantee we seem to have is
the event callback won't be invoked after jack_activate succeeds.

So instead, the buffer size can be queried after jack_activate and the ring
buffer allocated then, instead of using an event callback. This does mean the
buffer size can change with a start() call, but it's better than a failure to
start.
2020-01-11 15:10:54 -08:00
Chris Robinson e6e2f509f8 Make CreateRingBuffer a static RingBuffer method 2020-01-10 07:56:43 -08:00
Chris Robinson b31886ad73 Fix blending for the right IR delay 2020-01-08 17:00:48 -08:00
Chris Robinson 82720a4b11 Update changelog 2020-01-08 09:10:06 -08:00
Chris Robinson 6608e5dd9f Make sure unassociated voices give back their update structs 2020-01-08 07:31:01 -08:00
Chris Robinson 45e82379a4 Make sure an unmixable source is properly stopped 2020-01-08 06:40:58 -08:00
Chris Robinson 84f65c1883 Avoid auto-releasing containers for the global device list
If any are left open at process shutdown, it may try to clean them up, and
subsequently close the device. This is dangerous to do at process exit, so
don't. The app should have closed the device(s) prior to exiting anyway
2020-01-07 03:12:49 -08:00
Chris Robinson 1a2438b09c Don't blend the B-Format decoder HRIRs
Though fine in theory, an issue arises with extra phase interference since the
frequency phases aren't aligned for each response. It would be better to do the
blending before minimum phase reconstruction, where it can blend just the
frequency magnitudes, essentially allowing makemhr to increase the resolution
of the dataset.
2020-01-07 00:40:38 -08:00
Chris Robinson 819763a6c2 Fix some 'ambiguous' calls for newer MSVC 2020-01-06 01:40:21 -08:00
Chris Robinson e9ee6dd239 Ensure a pointer is provided for a templated iterator type 2020-01-05 23:17:26 -08:00
Chris Robinson 8338d9e197 Use a loop instead of a series of lambda calls 2020-01-05 18:25:50 -08:00
Chris Robinson 54b49594e6 Simplify post-mix HRTF gain storage 2020-01-05 17:12:48 -08:00
Chris Robinson 05abcbc600 Update changelog wording 2020-01-05 15:44:50 -08:00
Chris Robinson ae780e22c1 Update the changelog 2020-01-05 04:02:18 -08:00
Chris Robinson 6ed8061cbf Finalize AL_SOFT_bformat_ex 2020-01-05 03:45:35 -08:00
Chris Robinson 0d0ea586b6 Use temporaries for repeated values 2020-01-05 03:38:19 -08:00
Chris Robinson cc9fa266e7 Avoid more duplicate arrays 2020-01-04 16:50:35 -08:00
Chris Robinson cdd24c7d01 Combine identical arrays 2020-01-04 00:59:49 -08:00
Chris Robinson 462bcd4ab7 Use a span instead of an array+size 2020-01-04 00:37:59 -08:00
Chris Robinson a42a586f0f Avoid a duplicate array 2020-01-04 00:04:55 -08:00
Chris Robinson 8b3a1ed9e4 Use an array type for the HRIR delay pair 2019-12-30 21:04:10 -08:00
Chris Robinson cfc8a82951 Load the HRIRs directly into HrirArrays 2019-12-30 20:49:19 -08:00
Chris Robinson d9e3f0edf6 Avoid declaring a variable early 2019-12-30 19:17:33 -08:00
Chris Robinson 28d2294b07 Workaround for MSVC 2015 2019-12-29 21:49:29 -08:00
Chris Robinson 9fc2f8541b Don't hardcode the system paths for searching frameworks 2019-12-29 21:03:28 -08:00
Chris Robinson c1cf10f508 Handle downmixing for mono output 2019-12-29 20:35:47 -08:00
Chris Robinson 9ac8f25a05 Ignore direct channels for mono and B-Format buffers 2019-12-29 19:17:29 -08:00
Chris Robinson 137394c2cf Make the new direct channel remix extension public 2019-12-28 16:40:10 -08:00
Chris Robinson 701d43b41e Start a new extension for a new direct_channels state
So existing behavior remains consistent for anything that needs it, and new
behavior is opt-in.
2019-12-28 11:33:19 -08:00
Chris Robinson 3b3d3d3a03 Use a span for the band-splitter input 2019-12-25 21:48:58 -08:00
Chris Robinson 06b7c63cef Fix reverse iterators for spans 2019-12-25 21:48:40 -08:00
Chris Robinson f153def941 Pass a span for the biquad filter input 2019-12-25 18:39:22 -08:00
Chris Robinson 36c745a514 Fix parameter order 2019-12-25 18:32:53 -08:00
Chris Robinson 0897927419 Make a couple more functions private 2019-12-25 17:09:14 -08:00
Chris Robinson de2c64c06f Pass a span to the NFC filters 2019-12-24 23:41:26 -08:00
Chris Robinson 04b8f2a042 Reorganize some function parameters 2019-12-24 23:36:08 -08:00
Chris Robinson 28e68d03d3 Fix a shadowed parameter warning 2019-12-23 23:13:45 -08:00
Chris Robinson bff6696814 Avoid reading a struct field twice 2019-12-23 23:00:59 -08:00
Chris Robinson 16220be86e Make a duration type to handle WASAPI reference times 2019-12-22 22:05:47 -08:00
Chris Robinson 8807d373b0 Print the unhandled subformat 2019-12-22 16:38:52 -08:00
Chris Robinson a671c02b0b Try harder to find a matching WASAPI configuration
As long as the lowest channel bits match the enabled bits for a given
configuration, higher bits from any extra channels can be ignored since they
can be skipped.
2019-12-22 02:52:50 -08:00
Chris Robinson 2e6a55a87c Handle padding between device sample frames
The padding must be constant and sample type aligned (e.g. some fixed multiple
of two bytes between the start of two consecutive frames for 16-bit output).
The intent is to always have the ability for stereo output with WASAPI even if
the device has some other unsupported configuration, as long as front-left and
front-right exist.
2019-12-21 20:43:46 -08:00
Chris Robinson c2ca617ed6 Use size_t for the compressor channel count
And general cleanup of the compressor
2019-12-21 03:21:13 -08:00
Chris Robinson 54e7f48df9 Use unique setters for biquad filter parameters
One for whether a slope parameter is used, and one for bandwidth.
2019-12-21 02:02:57 -08:00
Chris Robinson 274fd36edd Improve gain/hf/lf packing when processing voice updates 2019-12-21 00:48:58 -08:00
Chris Robinson 22bbb14a65 Use a standard bool type 2019-12-19 05:16:56 -08:00
Chris Robinson 4634002104 Remix missing channels with direct channels enabled
Instead of dropping them.
2019-12-19 04:38:34 -08:00
Chris Robinson 6480c2c854 Don't apply direct channels with mono output 2019-12-18 23:29:52 -08:00
Chris Robinson 5e35f73cad Don't process direct channel sources with attenuation 2019-12-17 22:40:49 -08:00
Chris Robinson a8de1570e9 Update a comment since B-Format input isn't always FuMa 2019-12-17 22:25:00 -08:00
Chris Robinson 466c6faeb5 Correctly scale spatialized B-Format sources 2019-12-17 22:20:38 -08:00
Chris Robinson 0a65ed2190 Use normal panning for B-Format output
It can never work since it only uses auxiliary channel labels.
2019-12-17 22:12:47 -08:00
Chris Robinson 2215a4072c Don't apply stereo panning with direct channels enabled 2019-12-17 21:49:58 -08:00
Chris Robinson ad9584acc3 Avoid sscanf for parsing config lines 2019-12-14 17:26:58 -08:00
Chris Robinson ac7a5dcbfa Use size_t for array indices 2019-12-11 02:44:05 -08:00
Chris Robinson 053de62398 Don't force the HRIR length to a rounded value
The coefficient and accumulation buffers are guaranteed large enough for the
full size, and the SIMD handlers will behave the same either way.
2019-12-11 02:24:44 -08:00
Chris Robinson 7d0c01050a Fix MHR limits 2019-12-11 01:20:00 -08:00
Chris Robinson 4867f93a34 Move duplicate SOFA-related functions to a reusable library 2019-12-11 00:49:57 -08:00
Chris Robinson ae916929c9 Simplify a status-checking loop 2019-12-10 20:11:11 -08:00
Chris Robinson 47f416efaf Simplify a couple assignments 2019-12-09 23:11:16 -08:00
Chris Robinson d6bc56d7c1 Use proper array types instead of C-style arrays 2019-12-09 20:55:54 -08:00
Chris Robinson a1de05fed7 Avoid global macros for format-secific types 2019-12-09 20:45:11 -08:00
Chris Robinson e43c2bba61 Don't re-sort the enumerated HRTF list 2019-12-08 22:09:21 -08:00
Chris Robinson 0afb5a2ab9 Update the default HRTF 2019-12-08 19:29:50 -08:00
Chris Robinson f4b3c3b4da Simplify a check 2019-12-08 19:23:16 -08:00
Chris Robinson 7ded42cb94 Load SOFA HRIRs in a background thread 2019-12-08 19:17:58 -08:00
Chris Robinson 5942974d47 Report the non-uniform elevations in sofa-info 2019-12-08 17:56:56 -08:00
Chris Robinson 8076fd8aa9 Report the number of IRs used from SOFA files 2019-12-08 17:01:34 -08:00
Chris Robinson a280373dc1 Improve blended IR delay precision for the B-Format decoder 2019-12-08 16:46:11 -08:00
Chris Robinson 8cb0e0a58b Simplify some parameters 2019-12-08 13:37:42 -08:00
Chris Robinson 1dc26f305a Improve detection of compatible layouts in SOFA files 2019-12-08 03:36:27 -08:00
Chris Robinson 3f559e7e60 Rename a couple structs for clarity 2019-12-06 23:11:26 -08:00
Chris Robinson c9a6527121 Use doubles for blending the B-Format decoder HRIRs 2019-12-06 22:31:30 -08:00
Chris Robinson 200b07b288 Fully reset the voice when updating the device 2019-12-05 00:18:59 -08:00
Chris Robinson 863171efc9 Check the voice's ambisonic order when starting 2019-12-05 00:18:01 -08:00
Chris Robinson bbe1c4c64e Test the B-Format buffer extension in alffplay 2019-12-02 13:04:44 -08:00
Chris Robinson 38037e29ba Handle the buffer's ambisonic properties 2019-12-02 12:50:18 -08:00
Chris Robinson 799c60f3bb Add an interface to set a B-Format buffer's layout and scaling 2019-12-02 11:51:27 -08:00
Chris Robinson 58e4d643d3 Make B-Format rotation more robust
This should now handle higher orders, and can be easily extended to non-FuMa
layouts and scalings.
2019-12-01 22:33:41 -08:00
Chris Robinson 1a51e3a9d1 Add an index map for 2D FuMa channels 2019-12-01 17:52:36 -08:00
Chris Robinson b79aa32308 Store the ambisonic order for the voice
Currently only first-order B-Format is possible for a buffer/source, but this
will begin to allow for higher orders with an appropriate extension.
2019-12-01 15:36:25 -08:00
Chris Robinson 9559f7bfc2 Update the second-order decoder for HRTF
This uses fewer virtual speakers to help with clarity. The fewer speakers used
for the response, the less destructive phase interference there should be.
2019-11-30 18:42:04 -08:00
Chris Robinson fcf03705e6 Clear the resampler after use 2019-11-29 18:19:01 -08:00
Chris Robinson 1a4a3764d1 Update built-in HRTF name for alsoft-config 2019-11-29 14:54:29 -08:00
Chris Robinson a8d06c0731 Store HRTF delays with some fractional precision
Since the delays get bilinearly filtered before use, maintaining a bit of extra
precision can help accuracy even if it ultimately gets rounded to the nearest
integer before use. This should help with resampled HRTFs, which need to scale
the delays that are already rounded, and can also be leveraged by an updated
MHR format.
2019-11-29 14:01:39 -08:00
Chris Robinson 2453f4ec14 Avoid a shadow declaration warning 2019-11-29 08:41:20 -08:00
Chris Robinson 7ff165b095 Use unsigned for array indices 2019-11-29 08:33:46 -08:00
Chris Robinson 34edd3a914 Fix sorting of loaded HRTFs 2019-11-29 06:19:06 -08:00
Chris Robinson 7b3f88c430 Avoid extraneous looping 2019-11-29 05:52:33 -08:00
Chris Robinson e80256e394 Remove an unnecessary alias 2019-11-28 16:17:00 -08:00
Chris Robinson b310e09f59 Rename the default HRTF 2019-11-28 15:48:07 -08:00
Chris Robinson 6069eef94d Also scale the HRTF delays for different rates 2019-11-28 14:53:13 -08:00
Chris Robinson 846a997956 Add an option to limit the HRTF's IR size 2019-11-28 14:51:45 -08:00
Chris Robinson 4eb9a0b835 Don't keep a resampled default HRTF 2019-11-28 12:57:42 -08:00
Chris Robinson f6105cbff0 Resample HRIRs when loading 2019-11-28 12:33:26 -08:00
Chris Robinson c093728ced Move the polyphase resampler to the common lib 2019-11-28 10:54:47 -08:00
Chris Robinson 576adf06b1 Store HRIR coefficients using HrirArray 2019-11-28 09:46:16 -08:00
Chris Robinson 925e6e979c Rework HRTF enuemration so the loaded HRTFs are separate 2019-11-28 08:24:29 -08:00
Chris Robinson 1e93fba6d0 Rename HrtfEntry to HrtfStore 2019-11-28 06:10:36 -08:00
Chris Robinson c0cf323e1d Release 1.20.0 2019-11-28 00:45:08 -08:00
Chris Robinson 39e3484dbe Update ChangeLog 2019-11-22 22:47:36 -08:00
Chris Robinson eb8922596a Apply the full HRIR length for the B-Format decoder 2019-11-21 23:55:10 -08:00
Chris Robinson 2fd8c619b3 Rename a couple struct fields 2019-11-21 02:58:35 -08:00
Chris Robinson 7bc4a27900 Allocate storage for full HRTF coefficient lengths 2019-11-21 02:43:34 -08:00
Chris Robinson f2eab3e919 Properly get the AppData path on Windows in alsoft-config 2019-11-20 14:22:04 -08:00
Chris Robinson 6159b837cf Add a first-order ambisonic decoder for HRTF 2019-11-18 00:32:01 -08:00
Chris Robinson c86a28af5c Simplify some pi statements 2019-11-16 14:33:09 -08:00
Chris Robinson 6ad252efda Use wrappers to distinguish elevation and azimuth values 2019-11-16 14:07:31 -08:00
Chris Robinson d120e1464f Improve precision of the HRTF ambisonic decoder matrix 2019-11-13 08:39:27 -08:00
Chris Robinson 0ad512dd51 Clear the whole response HRIR before blending 2019-11-10 21:56:19 -08:00
Chris Robinson 74cbba511d Limit HRTF ambisonic decoding to second-order
The generated third-order matrix has incorrect first-order coefficients,
indicating a wonky decoder. The generated second-order matrix looks more
stable.
2019-11-09 13:04:44 -08:00
kcat 89938b95cf Merge pull request #356 from Raulshc/modulator_fix
EFX: Modulator fix
2019-11-09 06:58:29 -08:00
Raulshc c5f88ab59f EFX: Add explicit cast to a square function
MSVC 2015 and above returns the expression according to its datatype.
In this case, returns 4294967295 instead of -1.
2019-11-09 12:12:53 +01:00
Chris Robinson d2608e4bde Avoid holding HRTF accumulation samples per-source
It notably simplifies things to mix HRTF sources into an accumulation buffer
together, which the Dry buffer's Ambisonic-to-HRTF decode is then added to,
before being mixed to the Real output.
2019-11-03 00:30:33 -07:00
Chris Robinson 2741a94e58 Use rotate to reorder the default list entry 2019-10-28 23:47:30 -07:00
Chris Robinson d37a294d4c Add a config option for custom ALSA capture devices 2019-10-27 19:20:26 -07:00
Chris Robinson 205ff0080e Adjust padding in alsoft-config and remove an invalid signal 2019-10-27 18:02:25 -07:00
Chris Robinson 101afb1ee4 Convert HRTF field distances to meters when creating storage 2019-10-27 15:50:59 -07:00
Chris Robinson 697da8724f Avoid an extraneous macro and use a simplified type alias 2019-10-27 00:47:33 -07:00
Chris Robinson cac4072781 Change a few more really small gain values to 0 2019-10-26 19:57:17 -07:00
Chris Robinson 0cba99ed1b Avoid static constexpr for arrays iterated over at run-time 2019-10-25 01:43:23 -07:00
Chris Robinson 5ac1f19241 Don't dereference the end iterator 2019-10-24 21:58:35 -07:00
Chris Robinson 48347f62b5 Don't trace twice for a new HRTF data file 2019-10-24 15:28:28 -07:00
Chris Robinson f0977e5cc9 Print the found file entries after sorting 2019-10-24 15:10:37 -07:00
Chris Robinson 7bed2fe7cc Report the real ambisonic order set for HRTF rendering 2019-10-24 14:33:43 -07:00
Chris Robinson f40e69f9e3 Use a 26-point Lebedev grid for the HRTF ambisonic decode 2019-10-23 23:36:02 -07:00
Chris Robinson 0dfdebdf6d Limit the number of azimuths and elevations used in SOFA files 2019-10-22 16:30:07 -07:00
Chris Robinson 4733fc6f1e Fix azimuth limit 2019-10-22 15:23:17 -07:00
Chris Robinson a8a3acb6f6 More consistently use doubles in makemhr and loadsofa 2019-10-22 15:22:37 -07:00
Chris Robinson fcde56e1fc Increase the max elevation and azimuth count for HRTFs 2019-10-21 11:30:39 -07:00
Chris Robinson f58167e72d More sanely handle the voice state when mixing 2019-10-14 20:45:23 -07:00
Chris Robinson 33fd1f9efd Use better types for some specific sizes 2019-10-13 09:37:07 -07:00
Chris Robinson e70f98c95a Wrap the cycle amount when passing to sin() 2019-10-12 16:41:13 -07:00
Chris Robinson 630d4d573d Gracefully drain the OpenSL capture buffer on disconnect 2019-10-10 13:33:27 -07:00
Chris Robinson d2053e6784 Use one PulseAudio mainloop per device
To help avoid devices blocking on each other when handling asynchronous
messages.
2019-10-09 23:25:56 -07:00
Chris Robinson 8bf3da0cd2 Remove a useless prebuf check with PulseAudio 2019-10-09 09:45:02 -07:00
Chris Robinson 57cdac3368 Create the initial PulseAudio stream corked 2019-10-09 09:42:35 -07:00
Chris Robinson 404f3e2d08 Don't track the PulseAudio context state in devices 2019-10-09 05:01:30 -07:00
Chris Robinson b687e952ef Make C callbacks noexcept
No telling what would happen if exceptions managed to get back into presumably
C-based callers.
2019-10-09 03:29:25 -07:00
Chris Robinson a7c1245360 Use smart pointers for ALSA param handles
And simplify some related error handling
2019-10-09 02:16:08 -07:00
Chris Robinson 2842df5a02 Catch exceptions from backend start calls 2019-10-09 00:11:19 -07:00
Chris Robinson 963580c2d5 Never return null from CreateRingBuffer
Allocation failure would already throw a bad_alloc anyway, now a size overflow
throws an exception too.
2019-10-08 21:55:03 -07:00
Chris Robinson 7726a06d26 Clean up some exception messages and avoid duplicate log messages 2019-10-08 05:44:38 -07:00
Chris Robinson 360330b2ad Define some simple wrapper methods inline 2019-10-08 03:41:49 -07:00
Chris Robinson f4bc3d7ab2 Improve logging for Windows 2019-10-08 00:21:21 -07:00
Chris Robinson 52a003e9bb Avoid raw lock/unlock calls 2019-10-07 23:22:06 -07:00
Chris Robinson f0fa6c6baf Fix BackendVase typo 2019-10-07 22:42:54 -07:00
Chris Robinson 9b411cfcbe Reduce some indentation 2019-10-07 22:25:45 -07:00
Chris Robinson 02d80cd74d Use exceptions for backend open failures 2019-10-07 21:37:56 -07:00
Chris Robinson f8ff4e269b Put the pragma defines in a separate header 2019-10-07 15:26:35 -07:00
Chris Robinson f52eed0607 Update some wording in the changelog 2019-10-07 05:01:05 -07:00
Chris Robinson acb6baad90 Use std::array instead of plain arrays in a couple places 2019-10-05 21:23:31 -07:00
Chris Robinson eb89faf963 Use a span instead of a reference-to-array 2019-10-05 20:00:22 -07:00
Chris Robinson 267b79f337 Avoid duplicate structs 2019-10-05 16:11:38 -07:00
Chris Robinson 1bb93f4fc2 Avoid direct function template and alias types
It's somewhat ambiguous what they mean. Sometimes acting as a pointer, other
times having weird behavior. Pointer-to-function types are explicitly defined
as such, whereas uses of these tend to be as references (never null and not
changeable).
2019-10-03 04:22:39 -07:00
Chris Robinson b350ae3766 Remove the Offset parameter from ApplyCoeffs 2019-10-02 22:38:19 -07:00
Chris Robinson bce6889173 Remove an unnecessary struct specifier 2019-10-02 22:20:34 -07:00
Chris Robinson 324fb8d0b7 Fix a comment 2019-10-02 19:22:14 -07:00
Chris Robinson 58085f1c7b Clean up some unnecessary includes 2019-10-02 19:13:07 -07:00
Chris Robinson 50198ee30c Clean up some ALfloat -> float 2019-10-02 17:07:23 -07:00
Chris Robinson 64e2c377d8 Move ALvoice from alu.h to a separate header 2019-10-02 16:53:23 -07:00
Chris Robinson d639935e19 Move a couple types to the source they're used in 2019-10-02 15:37:33 -07:00
Chris Robinson a35cac7ce0 Rename mixvoice.cpp to voice.cpp 2019-10-02 15:29:01 -07:00
Chris Robinson 4620912f0f Don't inline the utf8 converters 2019-10-01 23:33:00 -07:00
Chris Robinson 2980adb8c0 Make sure the temporary HRIRs are properly aligned 2019-10-01 22:50:28 -07:00
Chris Robinson 69eb685dbc Check for librt earlier 2019-10-01 22:35:33 -07:00
Chris Robinson accac7950c Silence some warnings from GCC in the router 2019-10-01 22:22:46 -07:00
Chris Robinson 28d54efe72 Use al::getenv to get the router env vars 2019-10-01 22:15:40 -07:00
Chris Robinson a0a55d300f Remove an unnecessary function 2019-10-01 21:45:44 -07:00
Chris Robinson e2c1602ede Link the examples with librt if it exists 2019-10-01 19:56:39 -07:00
Chris Robinson 0063f4bfac Add some allocator fields GCC 6.3 seems to want 2019-10-01 01:49:21 -07:00
Chris Robinson 8f6fafd19a Update the changelog 2019-09-30 22:23:14 -07:00
Chris Robinson 5d7a1fa6da Clear the HRTF state values on allocation 2019-09-30 19:29:01 -07:00
Chris Robinson 4d127a2f98 Avoid infs/nans in the crest detector
It needs to be investigated why the rendered mix sometimes has such large
sample values when starting, but the compressor/limiter shouldn't generate NaNs
because of it.
2019-09-30 17:29:04 -07:00
Chris Robinson cf617760b6 Separate a couple assignments from conditionals 2019-09-30 03:03:27 -07:00
Chris Robinson 0139d8a04f Remove noexcept from a function that explicitly throws 2019-09-30 02:57:19 -07:00
Chris Robinson c833af9ecd Repack the bsinc resamplers coefficients
This puts the base coefficients and the phase deltas next to each other. This
improves caching, as the base and phase deltas are always used together while
the scales are only used for the non-fast versions.
2019-09-29 23:39:04 -07:00
Chris Robinson fb56b02041 Modify the bsinc resampler
Readjusted the bsinc12 cutoff back to -60dB. Also increased the filter's phase
count.
2019-09-29 22:43:46 -07:00
Chris Robinson 94ff2daafc Use using to avoid extraneous template instantiations 2019-09-29 16:02:25 -07:00
Chris Robinson fabb9add9b Silence an MSVC warning 2019-09-28 23:31:49 -07:00
Chris Robinson 00250042c8 Check MAX_RESAMPLER_PADDING properly to ensure it's large enough 2019-09-28 19:14:27 -07:00
Chris Robinson 7783fa738c Make the BSincTables constexpr in an anonymous namespace 2019-09-28 16:40:38 -07:00
Chris Robinson 4b746b8d37 Make MAX_RESAMPLER_PADDING specify the total padding 2019-09-28 14:35:42 -07:00
Chris Robinson 31ffb0887c Don't let a function end without a return 2019-09-28 13:56:51 -07:00
Chris Robinson 2d2e5539c0 Use FastBSinc24 for WASAPI and CoreAudio capture
Given a fixed rate, there's no downside to the fast version.
2019-09-28 03:44:13 -07:00
Chris Robinson cbc00bcffe Combine two function calls into one 2019-09-28 03:42:17 -07:00
Chris Robinson f7b574c8f2 Redo resampler strings to be safer
Now the name is guaranteed to match the type, and to be ordered as the enum
declares.
2019-09-28 03:15:48 -07:00
Chris Robinson 882b4acae8 Add "fast" variants for the bsinc resamplers
This simply omits the scale factor from the filter, similar to how up-sampling
does. The consequence of this is less smooth transitions when ramping the
pitch while down-sampling, but otherwise behaves fine.
2019-09-28 01:58:29 -07:00
Chris Robinson 00d5356b96 Remove the unnecessary FRACTIONONE from bsincgen 2019-09-28 00:01:21 -07:00
Chris Robinson 9b64e5e0db Implement a "fast" bsinc path
This takes advantage of the fact than when increment <= 1 (when not down-
sampling), the scale factor is always 0. As a result, the scale and scale-phase
deltas never contribute to the filtered output. Removing those multiply+add
operations cuts half of the work done by the inner loop.

Sounds that do need to down-sample (when played with a high pitch, or is 48khz
on 44.1khz output, for example), still go through the normal bsinc process.
2019-09-26 19:24:29 -07:00
Chris Robinson d50ca464cd Use a span for holding the source handles 2019-09-25 03:01:58 -07:00
Chris Robinson f009219523 Avoid extraneous parameters 2019-09-25 02:11:37 -07:00
Chris Robinson 5bb91b858f Use blended HRIRs for the B-Format decode 2019-09-24 22:27:12 -07:00
Chris Robinson 16a715a2b5 Fix unsigned 8-bit buffers 2019-09-24 21:49:12 -07:00
Chris Robinson 6963712d46 Use an array to match the HRTF rendering method 2019-09-24 13:51:40 -07:00
Chris Robinson 96865d6b99 Only build ex-common as needed 2019-09-24 01:16:57 -07:00
Chris Robinson bf31ce688a Add a missing header for Android 2019-09-23 19:23:33 -07:00
Chris Robinson e01b32f8e0 Use istream for makemhr input 2019-09-23 18:37:36 -07:00
Chris Robinson 34a0fad6cd Use a unique_ptr to auto-free MYSOFA_HRTF 2019-09-23 17:38:43 -07:00
Chris Robinson 4a111f7671 Update changelog 2019-09-22 21:27:59 -07:00
Chris Robinson 61ffa23e44 Fix a couple more conversion warnings 2019-09-22 21:27:10 -07:00
Chris Robinson 24db8a3f4b Make the resampler type an enum class 2019-09-22 21:19:19 -07:00
Chris Robinson 95996effaf Move the ifstream wrapper to common 2019-09-22 12:23:41 -07:00
Chris Robinson 9c95f62e95 Remove large file macros
Large file offsets aren't being utilized, and C++ seems to use to 64-bit
offsets anyway.
2019-09-22 11:17:31 -07:00
Chris Robinson 5f6a35c960 Avoid storing an integer in a pointer
C++ does not guarantee that, given an int of sufficient size, converting
int->ptr->int will result in the original value. A pointer may have more than
one integer representation. Only ptr->int->ptr round trips are well-defined.
2019-09-21 23:35:24 -07:00
Chris Robinson 9325f1d507 Split some code into separate functions 2019-09-21 21:14:11 -07:00
Chris Robinson 9993ea818c Restructure the changelog updates 2019-09-21 19:46:19 -07:00
Chris Robinson 564c953e94 Make the buffer frequency unsigned 2019-09-21 16:47:33 -07:00
Chris Robinson 146afcbd70 Explicitly mark a couple functions as inline 2019-09-21 16:12:48 -07:00
Chris Robinson c83055ff53 Initial update for the changelog 2019-09-21 15:49:18 -07:00
Chris Robinson 28e62456ac Use an array and loop instead of individual tests 2019-09-21 12:08:45 -07:00
Chris Robinson 8907a4fb04 Cleanup some router warnings 2019-09-20 15:45:59 -07:00
Chris Robinson a0a8af47ae Include VS2017 in AppVeyor builds 2019-09-20 14:56:21 -07:00
Chris Robinson 2ae1f8b8b6 Revert "Silence some unreachable code warnings on MSVC"
This reverts commit 2ab4883439.

It apparently didn't work at silencing anything.
2019-09-20 14:40:12 -07:00
Chris Robinson 2ab4883439 Silence some unreachable code warnings on MSVC 2019-09-20 14:25:06 -07:00
Chris Robinson 65eb0987e2 Remove and simplify some functions 2019-09-20 13:35:29 -07:00
Chris Robinson 79a621ac47 Simplify some REQUIRES uses 2019-09-20 10:59:12 -07:00
Chris Robinson b9daffe159 Don't clean up more than necessary on destruction 2019-09-20 10:58:29 -07:00
Chris Robinson 057b253adb Use an anonymous namespace instead of static 2019-09-19 21:01:10 -07:00
Chris Robinson c0678816fc Remove deprecated CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 2019-09-19 18:50:45 -07:00
Chris Robinson ffb5623ead Fix a couple more annoying conversion warnings 2019-09-18 20:13:58 -07:00
Chris Robinson a092624ed3 Fix some Windows warnings 2019-09-18 18:20:11 -07:00
Chris Robinson 9a0a5c79d8 Avoid hiding a class member function 2019-09-18 17:02:33 -07:00
Chris Robinson 24a1058952 Work around MSVC's lack of standard _Pragma support 2019-09-18 13:58:04 -07:00
Chris Robinson b8f64155e9 Silence a couple specific warning instances 2019-09-18 13:24:16 -07:00
Chris Robinson 66565ca7a3 Enable and fix some more warnings 2019-09-18 10:09:04 -07:00
Chris Robinson da80a7c2b2 Disable warnings 4268 and 4324 on MSVC
warning C4268: 'const' static/global data initialized with compiler generated
default constructor fills the object with zeros

warning C4324: structure was padded due to alignment specifier
2019-09-18 09:31:32 -07:00
Chris Robinson ab87e56b22 Enable some more MSVC warnings 2019-09-18 09:01:46 -07:00
Chris Robinson dffb874478 Some cleanup for CMakeLists.txt 2019-09-18 08:58:36 -07:00
Chris Robinson aca9f4e095 Make the bsinc l and m coefficients unsigned 2019-09-17 18:38:46 -07:00
Chris Robinson 1da7512628 Avoid an unnecessary multiply 2019-09-16 21:49:06 -07:00
Chris Robinson 62972babea Remove unnecessary long long checks 2019-09-16 18:10:01 -07:00
Chris Robinson 6398bd8373 Add preprocessor defines for the common lib 2019-09-16 15:57:05 -07:00
Chris Robinson b00128411f Add a missing include directory for the common lib 2019-09-16 15:45:20 -07:00
Chris Robinson 899a414591 Remove the last uses of the system's str[n]casecmp 2019-09-16 15:10:36 -07:00
Chris Robinson 6d93b2ba81 Use our case-insensitive compare functions in makemhr 2019-09-16 14:55:52 -07:00
Chris Robinson 7a9463f863 Make the common code a separate static library 2019-09-16 14:46:41 -07:00
Chris Robinson 10a841cd7e Avoid an unused variable 2019-09-16 14:10:48 -07:00
Chris Robinson 2c5c5a5397 Add and use custom string types and functions 2019-09-16 13:45:14 -07:00
Chris Robinson 650764775f Fix typo 2019-09-16 07:50:39 -07:00
Chris Robinson fcf850c1dd Clean up some more conversion warnings 2019-09-16 07:32:13 -07:00
Chris Robinson bf2c865d39 Clean up some more shadowing warnings 2019-09-16 07:16:31 -07:00
Chris Robinson e16e2269b6 Add a fallback if SLAndroidDataFormat_PCM_EX isn't available 2019-09-15 20:46:37 -07:00
Chris Robinson 35129d66b7 Clean up the spaghetti mess in alcCaptureSamples 2019-09-15 13:42:56 -07:00
Chris Robinson a999df8ce5 Rename ALautowah* for consistency 2019-09-15 12:58:58 -07:00
Chris Robinson 47f0d301dc Make the BackendFactory base destructor protected 2019-09-15 10:22:56 -07:00
Chris Robinson c5a3c52822 Return and pass more appropriate types for backends 2019-09-15 09:50:28 -07:00
Chris Robinson e4cc77ea23 Fix a few warnings from MSVC 2019-09-14 20:19:59 -07:00
Chris Robinson 4b8f78a8d6 Fix a few more GCC warnings 2019-09-14 19:42:54 -07:00
Chris Robinson e82c43fb38 Fix a copy-paste error 2019-09-14 19:07:30 -07:00
Chris Robinson b43cd047ba Build with -Wunused 2019-09-14 18:54:16 -07:00
Chris Robinson b212ab9ea2 Add a note about clearing complex_hilbert's imaginary input 2019-09-14 18:37:00 -07:00
Chris Robinson 807d3b64ca Enable and fix more warnings 2019-09-14 18:35:23 -07:00
Chris Robinson 2cc0600476 Avoid recalculations in the formant filter process 2019-09-14 18:35:23 -07:00
Chris Robinson d75de6ee4d Don't hold the pulse lock while not necessary 2019-09-14 18:35:23 -07:00
Chris Robinson 2c348cecb6 Fix some more implicit conversions noted by GCC 2019-09-14 18:35:23 -07:00
kcat 1c45b1791b Merge pull request #344 from Lopuska/patch-3
removed unnecessary loop
2019-09-14 18:34:53 -07:00
kcat 6644a660e8 Merge pull request #342 from Lopuska/patch-1
pass proper effects slot number to AddActiveEffectSlots
2019-09-14 18:29:48 -07:00
Lopuska 925894fb8b removed unnecessary loop
the caller in fshifter is already doing the same job by putting 0 for the imaginary part
2019-09-15 02:58:53 +02:00
Lopuska 0023614da5 pass proper effects slot number to AddActiveEffectSlots
It resolves wrong logic when creating more than 1 aux slot at time in a batch
2019-09-15 02:09:05 +02:00
Chris Robinson 4e8caea97e Enable -Wconversion warnings
This is now clean with Clang 7, let's see what other compilers give.
2019-09-14 12:50:44 -07:00
Chris Robinson 532197a650 Clean up (most) implicit conversions in the backends 2019-09-14 12:44:35 -07:00
Chris Robinson fa64b1fd6d Fix implicit conversions in the effects 2019-09-14 12:16:51 -07:00
Chris Robinson 3675dfcfef Use an unsigned index value 2019-09-14 08:50:07 -07:00
Chris Robinson 88364dcbc7 Fix more implicit conversions 2019-09-14 08:29:02 -07:00
Chris Robinson 2646f509ee Store the ambisonic order as unsigned 2019-09-13 20:04:22 -07:00
Chris Robinson 42ae95b8fa Remove a couple no-op statements 2019-09-13 14:44:52 -07:00
Chris Robinson a250b6a986 Return unsigned values from the FromDevFmt functions 2019-09-13 14:29:25 -07:00
Chris Robinson fcd3bed0c0 Clean up more implicit conversions 2019-09-13 12:51:16 -07:00
Chris Robinson f09734b707 Pass IrSize to the HRTF mixers as unsigned 2019-09-13 11:19:11 -07:00
Chris Robinson 4254888576 Make IrSize unsigned 2019-09-13 09:38:35 -07:00
Chris Robinson df306b5524 Make NumAuxSends unsigned 2019-09-13 04:15:05 -07:00
Chris Robinson 5b763e1437 Clean up implicit conversions in alu.cpp 2019-09-13 03:47:23 -07:00
Chris Robinson c1690178ec Make the resampler increment unsigned 2019-09-13 03:25:13 -07:00
Chris Robinson 5f862a5b49 Clean up sample converter implicit conversions 2019-09-12 17:45:06 -07:00
Chris Robinson 5ca8796d6a Clean up some lambda definitions 2019-09-12 17:10:33 -07:00
Chris Robinson 70b58d79fe Fix source limit check 2019-09-12 12:19:07 -07:00
Chris Robinson 6ca8fadd58 Fix counting free objects 2019-09-12 12:14:23 -07:00
Chris Robinson ac48569c69 Avoid a macro call and mark unlikely paths as unlikely 2019-09-12 11:59:36 -07:00
Chris Robinson 2e010d29cb Clean up implicit conversions in source.cpp 2019-09-12 11:33:04 -07:00
Chris Robinson c0ce03d8b9 Get rid of more implicit conversions 2019-09-12 06:29:32 -07:00
Chris Robinson b71eb4dafd Don't use [[nodiscard]] in C++11
To silence some warnings in older compilers, and fix an error with newer MSVC.
2019-09-12 04:30:52 -07:00
Chris Robinson 6699f3cf1c Use unsigned channel indices 2019-09-12 04:17:21 -07:00
Chris Robinson 4c76f32dda Avoid implicit conversions with the examples and utils 2019-09-12 03:22:34 -07:00
Chris Robinson 474d478854 Only pass -Wold-style-cast for C++ 2019-09-11 15:55:37 -07:00
Chris Robinson 07e2aa3bc0 Clean up some more implicit conversions 2019-09-11 14:33:26 -07:00
Chris Robinson 681c78d348 Allocate buffer batches separately from buffers 2019-09-11 12:28:33 -07:00
Chris Robinson 1a9f1e0869 Fix a few more C-style casts 2019-09-11 08:08:23 -07:00
Chris Robinson 14c76ca244 Fix allocator comparison operators 2019-09-11 07:32:14 -07:00
Chris Robinson a895709b6f Fix function declaration 2019-09-11 06:58:27 -07:00
Chris Robinson be0442c620 Avoid C-style casts in C++ 2019-09-11 06:47:56 -07:00
Chris Robinson 388928f3aa Fix some more implicit casts 2019-09-11 05:53:10 -07:00
Chris Robinson e4b15aeefc Fix some implicit casts 2019-09-11 04:55:54 -07:00
Chris Robinson 5b37e2339b Simplify flexible array member usage 2019-09-11 03:59:53 -07:00
Chris Robinson c6c5048416 Don't inherit for the allocator 2019-09-11 03:22:10 -07:00
Chris Robinson 65374dc5d0 Avoid dynamically allocating ChannelConverter 2019-09-10 23:01:33 -07:00
Chris Robinson 19e1cd7430 Make hq-mode the default and update ambisonics.txt 2019-09-08 01:38:20 -07:00
Chris Robinson 449c09bf03 Remove mention of an unsupported env var 2019-09-08 00:59:56 -07:00
Chris Robinson ec8b56ef3b Remove unneeded TRACEREF logging 2019-09-08 00:59:10 -07:00
Chris Robinson fcb496bb5c Avoid unnecessary explicit copy methods 2019-09-08 00:31:55 -07:00
Chris Robinson 987fd13796 Use a new voice when restarting a playing source 2019-09-06 21:20:20 -07:00
Chris Robinson e5c9643dd5 Combine two functions into one 2019-09-05 15:08:22 -07:00
Chris Robinson 97c043da07 Don't set voice properties in ApplyOffset 2019-09-05 04:00:49 -07:00
Chris Robinson ef2769af03 Use a normal vector for the voices array 2019-09-04 23:04:55 -07:00
Chris Robinson c47a6d2279 Increment the mix count during disconnect
So attempts to get the current playback offset behave correctly while
disconnecting.
2019-09-04 20:31:55 -07:00
Chris Robinson e873165019 Only ASSUME values where a variable is used 2019-09-04 19:31:30 -07:00
Chris Robinson 8940bbd034 Only use one accumulation buffer for B-Format HRTF mixing
It's all getting added together anyway and all channels are continuous inputs,
so this is fewer passes over various buffers.
2019-09-03 23:19:24 -07:00
Chris Robinson e1ee1bcde9 Clean up some formatting 2019-09-03 21:34:58 -07:00
Chris Robinson 3d7ce5a860 Use global placement new for AL object batches 2019-09-01 18:07:16 -07:00
Chris Robinson bb35e24c9b Avoid unnecessary placement new definitions 2019-09-01 17:54:17 -07:00
Chris Robinson 727217ce0a Ensure AL_STOPPED state change events are sent
With explicit calls to alSourceStop on a playing or paused source
2019-09-01 15:28:33 -07:00
Chris Robinson d15950f383 Avoid accumulating a temporary 2019-09-01 15:03:22 -07:00
Chris Robinson aee10ef606 Hold the source lock in UpdateAllSourceProps 2019-09-01 00:29:26 -07:00
Chris Robinson a15f25b07a Return a QString from GetVersionString 2019-08-31 22:28:26 -07:00
Chris Robinson 5becf4bb73 Don't include version.h in mainwindow.cpp
Should help with post-commit compile times
2019-08-31 21:47:58 -07:00
Chris Robinson 96af306b3c Update the language for travis 2019-08-31 20:24:34 -07:00
Chris Robinson 3973334a64 Store the voice fraction offset as unsigned 2019-08-31 15:49:34 -07:00
Chris Robinson a546343148 Make MixVoice a member function 2019-08-31 14:53:28 -07:00
Chris Robinson 5b6772440a Remove a couple unnecessary variables 2019-08-27 12:31:19 -07:00
Chris Robinson 3223b6a906 Update mainwindow.cpp
Use the less-error-prone pointer-to-member syntax for connect calls, and use
uniform initialization more often.
2019-08-26 19:13:31 -07:00
Chris Robinson b5a6dcc14f Remove some unnecessary local spans 2019-08-26 11:02:09 -07:00
Chris Robinson 7dbf69afa2 Use a span for effect state input 2019-08-26 09:16:20 -07:00
Chris Robinson 12e6dc0cce Fix a function's sample count type 2019-08-25 21:30:32 -07:00
Chris Robinson 4e72d7b3ec Use al::byte for a couple more buffers 2019-08-25 18:09:14 -07:00
Chris Robinson 164626a7be Pass unsigned sample count to aluMixData 2019-08-25 17:54:36 -07:00
Chris Robinson b93098f7df Use unsigned sample counts for the compressor/limiter 2019-08-25 17:24:53 -07:00
Chris Robinson 88a8bf903b Use size_t for the post-process sample length 2019-08-25 15:36:40 -07:00
Chris Robinson e165cae3cd Fade reverb over the whole update
Since the early and late panning gains fade over the course of the update, it
should match the fading done by the feedback loops to avoid percussive "blasts"
when transitioning to a long-decay low-gain environment from a short-decay
high-gain environment.
2019-08-24 16:25:56 -07:00
Chris Robinson 02d38091c8 Make a couple functions into member functions 2019-08-23 15:34:45 -07:00
Chris Robinson b7ab8b6896 Fix a variable declaration 2019-08-22 18:53:09 -07:00
Chris Robinson 7ad2ed965c Avoid reading from pointers to __m128 values 2019-08-21 07:43:28 -07:00
Chris Robinson 024d5d900a Dereference the correct buffer when destructing a source 2019-08-21 03:00:19 -07:00
Chris Robinson bb46cec0b1 Pass samplesToDo as size_t to effects 2019-08-20 14:30:04 -07:00
Chris Robinson 3e499e70fd Try to improve non-dynamic-extent span construction 2019-08-20 12:31:46 -07:00
Chris Robinson 3a6676b61e Fix NEON store call 2019-08-20 12:19:38 -07:00
Chris Robinson 80710c146a Use size_t for the mixers' fade counter and outpos 2019-08-20 12:00:24 -07:00
Chris Robinson 3fa83547e9 Use size_t for HrtfMixer functions' buffer size 2019-08-20 11:39:39 -07:00
Chris Robinson a19f65f2c8 Use size_t for reverb offsets and masks 2019-08-20 11:13:19 -07:00
Chris Robinson 9e326846f6 Simplify passing some span parameters 2019-08-20 10:36:17 -07:00
Chris Robinson a3a295f6dc Try to fix span construction for MSVC 2019-08-20 09:31:08 -07:00
Chris Robinson a7f078927d Fix MixRow definition for NEON 2019-08-20 09:20:18 -07:00
Chris Robinson 0961f4eb00 Pass a span to the Resample function 2019-08-20 08:46:12 -07:00
Chris Robinson ce76cc1441 Use unsigned for the sample and channel converters 2019-08-20 07:57:37 -07:00
Chris Robinson 2ab52968f4 Track the MixVoice sample count and fade counter as unsigned 2019-08-20 06:03:31 -07:00
Chris Robinson 7a8f81259c Use size_t for the NFC and biquad filters' sample count 2019-08-20 05:26:51 -07:00
Chris Robinson 102ef6cb33 Pass a span for the Mix function's input 2019-08-20 04:16:44 -07:00
Chris Robinson 4883091f5d Rename the Mix function input for clarity 2019-08-20 01:24:02 -07:00
Chris Robinson 8fd90334a1 Pass the MixRow buffer size as a span 2019-08-20 00:27:28 -07:00
Chris Robinson 34a61122f6 Change NUM_LINES to a size_t for MSVC 2019-08-19 09:49:01 -07:00
Chris Robinson 34331c0dfa Fix for GCC5 decaying an array to a pointer 2019-08-19 09:14:54 -07:00
Chris Robinson c0cd43d100 More logically separate temp reverb buffers 2019-08-19 08:46:57 -07:00
Chris Robinson 2d0568c048 Allow using a variable channel stride for MixRowSamples 2019-08-19 08:02:08 -07:00
Chris Robinson a9223ae601 Improve subspan default template argument 2019-08-18 23:26:49 -07:00
Chris Robinson 2bbdd329cd Use the appropriate type 2019-08-18 15:37:39 -07:00
Chris Robinson 6629b65ab9 Formatting cleanup 2019-08-18 15:25:18 -07:00
Chris Robinson 4f4ef3a410 Don't require MixRow's output to be a FloatBufferLine 2019-08-18 15:15:56 -07:00
kcat 6750907bdd Merge pull request #329 from Raulshc/fshifter
EFX: Update Frequency shifter
2019-08-18 15:15:19 -07:00
kcat 71ddb86047 Merge pull request #328 from Raulshc/double2int
Move double2int function
2019-08-18 15:15:09 -07:00
kcat c89fb550b6 Merge pull request #327 from Raulshc/alsoft_config_vmorpher
Alsoft-config: Add vocal morpher effect
2019-08-18 15:15:01 -07:00
Raulshc eaaa194163 EFX: Update Frequency shifter
Add f. shifter processing for L and R channels.
2019-08-18 19:28:00 +02:00
Raulshc 550f1dce1f Move double2int function
Move inline double2int function to alnumeric.h from pshifter.cpp
2019-08-18 19:12:38 +02:00
Raulshc 42602b9ede Alsoft-config: Add vocal morpher effect 2019-08-18 18:49:52 +02:00
Chris Robinson ff66061091 Reduce the size of reverb's temporary buffer storage
The size of ReverbState is now almost half of what it was.
2019-08-18 03:19:19 -07:00
Chris Robinson 16886bd259 Avoid an out parameter for VectorPartialScatter 2019-08-17 23:00:46 -07:00
Chris Robinson ddf7e0f07c Use a std::array for the reverb sample buffer 2019-08-17 21:23:30 -07:00
Chris Robinson 351ccf2e11 Use new/delete for context and effectslot properties 2019-08-13 22:25:59 -07:00
Chris Robinson ecab99bce9 Move update pointers to the containers they update 2019-08-13 22:06:14 -07:00
Chris Robinson 0806a003e2 Use new/delete for listener properties 2019-08-13 20:33:44 -07:00
Chris Robinson 91ff01d1ad Don't explicitly inline a particular function 2019-08-13 20:33:26 -07:00
Chris Robinson bc9f39b5ac Environment variables should override config settings 2019-08-12 17:10:04 -07:00
Chris Robinson 38a565bdf8 Move UID definitions to a separate source 2019-08-12 14:56:17 -07:00
Chris Robinson dff906c13b Remove always-true assumption 2019-08-12 14:32:04 -07:00
Chris Robinson 81d17bb80f Fix some return types 2019-08-12 14:30:47 -07:00
Chris Robinson 1aaf65abfe Add methods to get env vars as an optional 2019-08-12 03:59:52 -07:00
Chris Robinson 50d16d2422 Don't use INT_MAX for unknown span lengths
32-bit doesn't like it, for some reason. Use the largest possible length it
could be.
2019-08-11 22:48:18 -07:00
Chris Robinson f290bf2751 Move vector.h to common 2019-08-11 20:54:21 -07:00
Chris Robinson e200569cd3 Move the wstr converters to a separate header 2019-08-11 18:50:07 -07:00
Chris Robinson 7118733458 Remove multiple buffers per queue item
And simplify related code
2019-08-11 14:01:57 -07:00
Chris Robinson 70058a8a84 Move the dynload decls and defs to common 2019-08-10 21:54:30 -07:00
Chris Robinson dca2365051 Fix array access index 2019-08-10 20:31:08 -07:00
Chris Robinson e3f5bd37e6 Avoid __popcnt[64] on MSVC
It requires SSE4, and provides no fallback mechanism for CPU targets lacking
the opcode it maps to.
2019-08-10 16:35:29 -07:00
Chris Robinson 98029d64b9 Fix and clarify the peaking biquad filter 2019-08-10 14:41:55 -07:00
kcat 8f93656f53 Merge pull request #323 from Raulshc/vmorpher_decls
Add parameter DECLs for vocal morpher
2019-08-10 14:41:25 -07:00
Raulshc c4f1c95a45 Add parameter DECLs for vocal morpher 2019-08-10 18:42:02 +02:00
kcat 926b515edf Merge pull request #322 from gongminmin/SDK1903
Enable to detect Windows SDK v1903
2019-08-10 03:18:01 -07:00
Minmin Gong becd1cf1bd Enable to detect Windows SDK v1903 2019-08-09 23:04:37 -07:00
Chris Robinson f900efa7f2 Simplify and fix vocal morpher pitch calculations 2019-08-08 15:22:22 -07:00
Chris Robinson fb1fde9fb0 Simplify the weighted decay time calculation 2019-08-08 12:44:53 -07:00
Chris Robinson a4391a213d Turn a couple methods into member functions 2019-08-08 12:40:34 -07:00
Chris Robinson e22dc27218 Improve log formatting for file searches 2019-08-07 15:56:38 -07:00
Chris Robinson 0eb5e80f67 Don't store options that are set to blank/default 2019-08-07 15:43:37 -07:00
Chris Robinson 5b33b4aa97 Make the post-process methods member functions 2019-08-07 11:43:53 -07:00
Chris Robinson 7c069e29ee Update some more includes 2019-08-06 23:13:05 -07:00
kcat 50c59dab8f Merge pull request #321 from Frozen-Tofu/master
no AudioObjectPropertyAddress  on iOS
2019-08-06 23:11:55 -07:00
Li Keqing ad059fb62e no AudioObjectPropertyAddress on iOS 2019-08-07 13:29:26 +08:00
Chris Robinson 80a85febcf Update some includes 2019-08-05 18:36:39 -07:00
Chris Robinson d06afa7ca1 Move a struct definition to where it's used 2019-08-05 15:11:47 -07:00
Chris Robinson e286ec8d09 Move some declarations out of alcmain.h 2019-08-05 15:03:18 -07:00
Chris Robinson d24401c3f3 Move the meters per unit property to the listener 2019-08-05 12:15:14 -07:00
Chris Robinson 3154a915b1 Remove the ReverbSpeedOfSound hack
No other effect depends on context or listener properties, so reverb being the
only exception for speed of sound and meters per unit was putting extra work on
the effect engine for no real reason. Especially since the reverb decay time
should be the time actual time to decay irrespective of other settings.
2019-08-05 11:37:05 -07:00
Chris Robinson 3bc9490fd2 Move some structs to where they're used 2019-08-04 17:45:46 -07:00
Chris Robinson 082622951d Don't allow numeric values for the resampler option 2019-08-04 17:29:55 -07:00
Chris Robinson 2fa2c35bdc Modify LIKELY and UNLIKELY to not need extra parenthesis 2019-08-04 11:59:14 -07:00
Chris Robinson 7897de31d0 Pass spans to the source get-property methods 2019-08-03 19:36:19 -07:00
Chris Robinson 7baa07e3ad Pass spans to the source set-property methods
This avoids an extra property check to get the size since the number of values
can be checked when accessed.
2019-08-03 18:57:38 -07:00
Chris Robinson 559d1666b8 Add a Create method to FlexArray for "raw" arrays 2019-08-03 14:59:01 -07:00
Chris Robinson 13222d719d Make a couple counts size_t 2019-08-03 13:05:42 -07:00
Chris Robinson 3417436804 Avoid manually incrementing a reference count 2019-08-03 12:14:50 -07:00
Chris Robinson a7a9c00275 Turn a couple more functions into methods 2019-08-02 18:30:22 -07:00
Chris Robinson 9f223898f2 Use an unsigned voice index 2019-08-02 12:38:20 -07:00
Chris Robinson ce7c86b217 Avoid reloading the voices array when processing 2019-08-02 11:07:48 -07:00
Chris Robinson 61bb079036 Add operator* to intrusive_ptr 2019-08-01 20:15:47 -07:00
Chris Robinson 33bcced82a Use a smart pointer for holding the context's device 2019-08-01 19:44:09 -07:00
Chris Robinson 4917024c94 Reduce the AsyncEvent struct size
The "user" message length is significantly reduced to fit the struct in 256
bytes, rather than 1KB.
2019-08-01 15:54:17 -07:00
Chris Robinson 0be823320d Add and use an intrusive_ptr type 2019-08-01 15:19:37 -07:00
Chris Robinson 57e7fff6f6 Remove an unnecessary variable 2019-08-01 14:29:02 -07:00
Chris Robinson 65f7fc610e Add a common base for auto-deleting ref-counted objects
Which will also work as the basis for a future intrusive_ptr
2019-08-01 13:43:32 -07:00
Chris Robinson 380f3dc11d Cleanup alcontext.h includes 2019-08-01 09:21:56 -07:00
Chris Robinson 62534f424a Use float2 where appropriate 2019-07-31 11:05:53 -07:00
Chris Robinson 151ff51e7d Don't templatize HrirArray 2019-07-31 10:46:33 -07:00
Chris Robinson d1f72624a7 Fix a couple ASSUME statements 2019-07-31 10:28:04 -07:00
Chris Robinson 471f905fbd Use enums for the resampler and mixer template tags 2019-07-31 10:09:43 -07:00
Chris Robinson a0aa5bc80a Add iterators to ALbufferlistitem
And change some types to ALuint
2019-07-31 09:20:53 -07:00
Chris Robinson 4cd7eee01c Remove improper include 2019-07-30 21:50:47 -07:00
Chris Robinson f286c3fa38 Move another function to a ALCcontext method 2019-07-30 21:32:05 -07:00
Chris Robinson ac554de67d Turn some functions into methods 2019-07-30 14:13:05 -07:00
Chris Robinson ea76e003e7 Properly prefix ALCcontext members 2019-07-30 09:05:54 -07:00
Chris Robinson 488d1de944 More include cleanup 2019-07-29 19:59:48 -07:00
Chris Robinson 06e5454eb9 Use Transposed Direct Form II for the BS2B filters 2019-07-29 19:40:03 -07:00
Chris Robinson 4c9e18c5a0 Rename al/* sources to avoid camel-case 2019-07-29 17:54:07 -07:00
Chris Robinson c2de0782cf Minor formatting fixes 2019-07-29 16:49:56 -07:00
Chris Robinson 76d87330ec Move the event declarations to a separate header 2019-07-29 15:58:26 -07:00
Chris Robinson 0a26bab14e Rename the OpenAL32 directory to al 2019-07-29 15:40:17 -07:00
Chris Robinson 8ccb7604d3 Remove some unnecessary cmake checks 2019-07-29 13:46:25 -07:00
Chris Robinson f0408809d6 Cleanup common sources' includes 2019-07-29 09:29:35 -07:00
Chris Robinson 40e937c63a Cleanup the examples' includes 2019-07-29 08:21:38 -07:00
Chris Robinson d38d255364 More include cleanups 2019-07-28 21:29:59 -07:00
Chris Robinson 83432a7e5c Move some headers out of the Include subdirectory 2019-07-28 19:09:07 -07:00
Chris Robinson cb3e96e756 Rename Alc to alc 2019-07-28 18:56:04 -07:00
Chris Robinson 93e60919c8 Rename alMain.h to alcmain.h
And move it and alu.h to Alc/.
2019-07-28 18:33:29 -07:00
Chris Robinson bb0062625f Move the ADPCM decoders to alBuffer.cpp 2019-07-28 17:22:00 -07:00
Chris Robinson b4d56d3fdf Remove the UNUSED macro 2019-07-28 17:15:34 -07:00
Chris Robinson c8bbd75bf9 Remove a couple more cmake checks 2019-07-28 15:37:12 -07:00
Chris Robinson 12e179d539 Remove some unnecessary header checks 2019-07-28 15:22:58 -07:00
Chris Robinson 585d965c92 Remove a couple unnecessary includes 2019-07-28 15:16:13 -07:00
Chris Robinson e0a795d9d2 Clean up some more headers 2019-07-28 14:55:02 -07:00
Chris Robinson 5428d6acc3 Clean up includes a bit
Trying out the IWYU tool to only include what's necessary in a given file.
Seems to work decently (it'll miss some headers, suggest unnecessary ones, and
make nonsense suggestions for some things, but overall gives a good starting
point), and helps clean out some headers.
2019-07-28 11:28:36 -07:00
Chris Robinson 659b6d4245 Use more proper cmake to set the C/C++ standard version 2019-07-27 18:58:19 -07:00
Chris Robinson 7cfb353334 Don't explicitly check for standard functions 2019-07-26 14:02:14 -07:00
Chris Robinson b22ecc45c9 Increase the video picture queue size to 24 2019-07-26 03:44:46 -07:00
Chris Robinson 18f1139de8 Only redraw the image when necessary 2019-07-23 12:51:14 -07:00
Chris Robinson b8ac4b79e4 Only send packets as needed 2019-07-23 02:38:07 -07:00
Chris Robinson 8a9434c623 Use a local variable to track the decoded pts 2019-07-20 18:46:43 -07:00
Chris Robinson f0ed35d3d0 Set the initial clock time closer to starting playback 2019-07-20 01:10:14 -07:00
Chris Robinson 9959d661a0 Restructure codec send/receive calls
In particular, after an initial fill of the codec's internal buffer, each
receive_frame call is followed by one or more send_packet calls. For
asynchronous codecs, this has the effect of letting the codec work while the
handler thread is waiting for an AVFrame structure to become available or
waiting for more decoded data to be needed. For synchronous codecs, this
makes the send_packet calls use up time that would be spent waiting.
2019-07-19 22:55:20 -07:00
Chris Robinson 29cf87f34d Combine duplicate code into a function 2019-07-18 16:04:45 -07:00
kcat ec855215db Merge pull request #318 from Lopuska/pitchshift_for_vmorpher
pitch shift for formant filters
2019-07-18 15:42:45 -07:00
Anis 31055f48d6 pitch shift for formant filters 2019-07-18 21:42:59 +02:00
Chris Robinson 2b21a08f89 Receive video frames in a loop 2019-07-16 20:20:25 -07:00
Chris Robinson 101e641288 Fix an unused parameter warning 2019-07-16 16:19:51 -07:00
Chris Robinson ffc7258cbc Remove an unused lambda capture 2019-07-16 16:04:56 -07:00
kcat 8a9e72109e Merge pull request #317 from Lopuska/vocal_morpher_improvements
misc fixes and improvements for Vocal Morpher
2019-07-16 16:04:27 -07:00
Anis ee013521ee misc fixes and improvements for Vocal Morpher 2019-07-16 17:40:18 +02:00
Philip Muzzall 28f07d2d5e Misc fixes (#315)
* Added rc scripts for dll

* Reverted numbering scheme in CMakeLists

* Misc fixes
2019-07-14 17:39:45 -07:00
Chris Robinson b728cf7bd6 Properly include getopt.h 2019-07-14 04:05:08 -07:00
Chris Robinson 4ff7bfd2d8 Use atomics for the picture queue 2019-07-14 03:59:57 -07:00
Chris Robinson ac7eeeae79 Don't use the same mutex for the video clock 2019-07-14 03:59:57 -07:00
Chris Robinson 93c53e33f0 Receive frames directly into the picture's AVFrame 2019-07-14 03:59:57 -07:00
Chris Robinson e7e734f8b9 Don't use one texture per picture in alffplay 2019-07-14 03:59:56 -07:00
kcat d2f71ae42a Merge pull request #314 from PenguinDOOM/pr-master
Fixed makemhr and sofa-info errors
2019-07-14 03:58:38 -07:00
Penguin 4027664fc2 Fixed MSVC error. 2019-07-14 18:03:49 +09:00
Penguin 313549c76d Add missing header. 2019-07-14 18:03:32 +09:00
Chris Robinson 363e2fb73a MSVC doesn't like parenthesized type initialization 2019-07-13 16:51:19 -07:00
Chris Robinson f99474c913 Handle alffplay video using continuous rendering 2019-07-12 23:34:21 -07:00
Chris Robinson 79d572cf72 Properly comment out the sample config's options 2019-07-12 22:13:19 -07:00
Chris Robinson 2e6c7808b0 Try to improve alffplay timing again 2019-07-11 03:54:26 -07:00
Chris Robinson 99b55bc230 Add the Windows SDK for the winmm library path 2019-07-10 20:06:50 -07:00
Chris Robinson 93d0c8993d Fix OpenSL library name 2019-07-10 19:55:14 -07:00
Chris Robinson e2f2b74d6a Get rid of the custom CHECK_SHARED_FUNCTION_EXISTS function 2019-07-10 19:32:26 -07:00
Chris Robinson ac28b7d0f2 Use a find module for OpenSL 2019-07-10 18:54:43 -07:00
Chris Robinson 426c4587cc Some clean up to use uniform initialization 2019-07-10 02:13:28 -07:00
Chris Robinson 159024acc9 Improve alffplay video clock timing 2019-07-09 22:15:05 -07:00
Lopuska 4a33bbb14d vocal morpher implementation (#312)
* vocal morpher implementation

* compile fix for GCC
2019-07-09 22:14:31 -07:00
Chris Robinson 3ffb6867a3 Rework packet handling in alffplay
Turns out avcodec_send_packet is what can invoke the decode for serialized
codecs, so don't call that in the parse handler thread. The packet queue is
used to get the compressed data from the parse handler to the audio/video
threads.

Additionally, don't serialize the video frame preparation with the decode
thread.
2019-07-08 13:18:10 -07:00
Chris Robinson 2783b4c04b Somewhat simplify alffplay playback timing 2019-07-06 22:18:52 -07:00
Chris Robinson c230554851 Clamp NFC reference distance between 0.1m and 10m 2019-07-06 19:09:26 -07:00
Chris Robinson b95bf8d7c1 Update a comment about the speaker distance 2019-07-06 18:39:26 -07:00
Chris Robinson c9f6f9652a Avoid looking up source IDs multiple times 2019-07-06 14:59:26 -07:00
Chris Robinson 47246e5205 Don't stop the device before going over the attributes 2019-07-06 13:20:21 -07:00
Chris Robinson aeb7fe52f1 Use unsigned more consistently for source counts 2019-07-06 00:19:48 -07:00
Chris Robinson fa032368ae Rename HRTF Quality title to HRTF Render Method 2019-07-05 12:27:58 -07:00
Chris Robinson 3edbeefdb7 Add a setting for hrtf-mode to alsoft-config 2019-07-04 22:59:12 -07:00
Chris Robinson 474073955b Pass a span to ApplyStablizer 2019-07-04 17:00:01 -07:00
Chris Robinson 3fe5ef272f Use a span for MixParams 2019-07-04 15:02:12 -07:00
Chris Robinson 729ffe02d6 Reorder some methods for better placement 2019-07-04 14:03:27 -07:00
Chris Robinson 949507c891 Use a span for RealMixParams 2019-07-03 23:26:33 -07:00
Chris Robinson 9a51ca0a78 Pass a span to BFormatDec::process 2019-07-03 22:59:29 -07:00
Chris Robinson 0a0704071a Allocate device buffer when setting the channel counts 2019-07-03 22:32:39 -07:00
Chris Robinson 61ba455edd Don't warn about non-multiple-of-4 update sizes
It's not always possible to do anything about it, especially for backends that
aren't restricted to the period size, and it's not really a problem anyway
(still getting SIMD benefits for the vast majority of samples).
2019-07-02 01:56:59 -07:00
Minmin Gong cee8100f19 Remove noexcept from sampler functions to match the signature of SamplerT (#309)
This change fixes compilation problems on gcc 9.1 with -std=c++17.
2019-07-01 22:42:20 -07:00
Chris Robinson bc1d058d2d Add a helper to construct the optional value 2019-07-01 17:55:56 -07:00
Chris Robinson 6bb0edf0a5 Create and use a make_optional method 2019-07-01 17:25:58 -07:00
Chris Robinson 53c13de5ce Simplify some optional usage 2019-07-01 16:28:51 -07:00
Chris Robinson eb70171433 Add a few more constructor and assignment operators for optional 2019-07-01 16:27:49 -07:00
Chris Robinson 143ad16051 Use uninitialized_copy/move for optionals 2019-07-01 12:34:24 -07:00
Chris Robinson c9ffa9d466 Add C++17-like uninitialized_move methods 2019-07-01 12:33:39 -07:00
Chris Robinson e9b41d9b90 Don't unnecessarily force the output limiter on 2019-07-01 11:13:23 -07:00
Chris Robinson 871257b69e Some cleanup for optional 2019-07-01 10:44:55 -07:00
Chris Robinson 0066ac26f0 Add a missing return 2019-07-01 10:44:55 -07:00
kcat 22311169d8 Merge pull request #307 from Lopuska/patch-2
Corrected old naming
2019-07-01 10:41:20 -07:00
Lopuska a5197177be Corrected old naming 2019-07-01 14:58:32 +02:00
Chris Robinson 0c2edd10dd Remove BOM markers and set UTF-8 codepage for rc files 2019-07-01 00:28:06 -07:00
Chris Robinson 90b1bc7b7a Make sure a variable is set before use 2019-06-30 23:32:09 -07:00
Chris Robinson 01300d9735 Convert rc files to UTF-8
MinGW chokes on them being UTF-16
2019-06-30 22:29:21 -07:00
Chris Robinson 0aeaf06173 Properly set DisableVideo to true 2019-06-30 22:02:40 -07:00
Philip Muzzall 7affe3d78d Added rc scripts for dll (#306)
* Added rc scripts for dll

* Reverted numbering scheme in CMakeLists
2019-06-30 22:01:04 -07:00
Chris Robinson e9bf7e4b15 Add an option to disable video in alffplay 2019-06-30 18:17:23 -07:00
Chris Robinson c21b7e2461 Use explicit storage types for some enums 2019-06-30 17:41:43 -07:00
Chris Robinson f458642237 Use optionals where methods may not return a valid value 2019-06-30 16:57:10 -07:00
Chris Robinson 49ceae681b Return optionals from the remaining ConfigValue* methods 2019-06-30 16:40:08 -07:00
Chris Robinson 3658dafdcb Use an optional for ConfigValueStr 2019-06-30 16:40:08 -07:00
Chris Robinson db026454f2 Fix Y channel offset for the UHJ encoder 2019-06-30 16:40:08 -07:00
Chris Robinson 0fc30151f2 Use an optional for ConfigValueUInt 2019-06-30 16:40:08 -07:00
Chris Robinson 51f53afe12 Use an optional for ConfigValueInt 2019-06-30 16:40:08 -07:00
Chris Robinson 689f70ce6d Add a simple optional<> implementation 2019-06-30 16:40:08 -07:00
kcat 15ac839054 Merge pull request #305 from Lopuska/patch-1
avoid extra local member declaration
2019-06-30 16:39:36 -07:00
Lopuska 541a9383a7 avoid extra local member declaration 2019-06-30 23:17:13 +02:00
Chris Robinson ada86d2fcf Hold references in the global device and context lists 2019-06-29 22:38:38 -07:00
Chris Robinson 7303e22d89 Use a FlexArray for a device's contexts 2019-06-29 21:32:36 -07:00
Chris Robinson cbcee69ed1 Add an empty() method to FlexArray 2019-06-29 18:53:20 -07:00
Chris Robinson c7797fa10f Declare variables closer to their use 2019-06-29 15:04:20 -07:00
Chris Robinson 811d0738fa Put some static functions in an anonymous namespace 2019-06-29 12:16:38 -07:00
Chris Robinson b905a224ee Avoid a generic function for specialized behavior 2019-06-29 11:45:55 -07:00
Chris Robinson 6790a9b44f Use a bool for the TrapALError flag 2019-06-29 11:22:29 -07:00
Chris Robinson 12911cc533 Use a range-for loop to concatenate available backends 2019-06-29 10:23:29 -07:00
Chris Robinson 3ede66ae45 Don't keep retrieving the backend factories 2019-06-28 18:54:31 -07:00
kcat c238619a8b Merge pull request #301 from gongminmin/FixGcc9
Fix the error "a reinterpret_cast is not a constant expression" in GCC 9
2019-06-27 23:29:48 -07:00
Minmin Gong 9326b98e2d Fix the error "a reinterpret_cast is not a constant expression" on GCC 9 2019-06-27 22:29:42 -07:00
Chris Robinson 2598ee6f0a Properly set extra fields in MakeExtensible 2019-06-27 09:47:31 -07:00
Chris Robinson 341c68c9a1 Trace the requested and required formats for WASAPI 2019-06-27 09:41:52 -07:00
Chris Robinson 360869f23b Use a span for some post-mixing processing 2019-06-27 08:49:04 -07:00
Chris Robinson 48191cbf0a Use a span instead of explicit current and end pointers 2019-06-25 17:10:46 -07:00
Chris Robinson edd75b3b4e Don't return a blank span when offset==size() 2019-06-25 14:40:25 -07:00
Chris Robinson ab3c2ea777 Don't bother with a passthru filter method
There's not really a case where it'll process less than 2 samples, and it was
wrong anyway.
2019-06-24 21:18:25 -07:00
Chris Robinson f5cb6ac20e Use a reference instead of the same array index 2019-06-24 13:33:09 -07:00
Chris Robinson eb5ff42d15 Correctly index the send params 2019-06-24 13:21:06 -07:00
Chris Robinson e8cef0cdae Clean up all unused HRTFs when going through them 2019-06-24 12:55:36 -07:00
Chris Robinson b46fc572f5 Use spans to handle pulseaudio capture buffers 2019-06-23 17:08:52 -07:00
Chris Robinson ee983bda75 Document the hrtf-mode config option 2019-06-21 12:43:33 -07:00
kcat 281e61e4cc Merge pull request #298 from TeamHypersomnia/master
Fix ambiguous calls to destroy_at
2019-06-21 12:42:55 -07:00
geneotech 499aa65a4b Fix ambiguous calls to destroy_at 2019-06-21 18:25:09 +02:00
Chris Robinson 723ab7f15a Don't inline ifstream destructor 2019-06-18 23:04:24 -07:00
Chris Robinson 0fa984027c Simplify al_print 2019-06-18 22:57:48 -07:00
Chris Robinson 706df72d18 Rename HrtfParams to HrtfFilter 2019-06-18 06:20:35 -07:00
Chris Robinson 2b19c53ece Use al::byte instead of ALbyte for raw bytes 2019-06-17 20:26:00 -07:00
Chris Robinson 55785c0a16 Use al::make_unique for ChannelConverter 2019-06-17 20:15:37 -07:00
Chris Robinson 5a884572f0 Use a span instead of pointer+size parameters 2019-06-17 20:05:38 -07:00
Chris Robinson 21b8571f50 Avoid an implied else if check 2019-06-16 22:45:07 -07:00
Chris Robinson a009b9502a Avoid manually looping to destroy orphaned async events 2019-06-16 18:58:56 -07:00
Chris Robinson 0a532729ba Reorganize how some device fields are set and reset 2019-06-15 23:10:11 -07:00
Chris Robinson 8670fca3dc Fix BS2B output 2019-06-12 22:51:09 -07:00
Chris Robinson a2ba230e05 Combine two macros into one 2019-06-11 22:29:39 -07:00
Chris Robinson a478fd4b25 Fix unsigned short/int sample converters
And add const/noexcept in some places
2019-06-11 14:59:06 -07:00
Chris Robinson 97d56dd424 Use C++ I/O to check for NEON support 2019-06-10 22:29:58 -07:00
Chris Robinson 1a14946306 Get rid of an unnecessary constructor 2019-06-10 21:56:09 -07:00
Chris Robinson c22d537d93 Remove some extern "C" blocks 2019-06-10 21:45:33 -07:00
Chris Robinson 8bb42c2f98 Don't inline some file IO methods 2019-06-10 01:51:14 -07:00
Chris Robinson ec6fdff0c6 Make the voice count unsigned 2019-06-09 19:27:15 -07:00
Chris Robinson bc8f206ee1 Use a FlexArray for the context's voices 2019-06-09 18:13:54 -07:00
Chris Robinson 90d25e5187 Make sure the bitfield indices are constants 2019-06-09 02:20:30 -07:00
Chris Robinson 2e154069c6 Use a bitfield for the device flags 2019-06-08 23:49:15 -07:00
Chris Robinson c9ba7ba193 Add a bitfield class for indexed, auto-sized flags 2019-06-08 23:33:59 -07:00
Chris Robinson b6ce793f84 Use a span for the complex_fft/hilbert functions 2019-06-08 16:05:18 -07:00
Chris Robinson 1569b79c5d Fix for GCC 5.4 2019-06-08 02:17:08 -07:00
Chris Robinson 91b7e8142c Simplify DistanceComp somewhat 2019-06-08 01:39:28 -07:00
Chris Robinson 7988bc6e91 Add and use proper types for FlexArray 2019-06-07 23:42:31 -07:00
Chris Robinson 7537bb3492 Don't warn about standard functions with MSVC 2019-06-06 15:57:15 -07:00
Chris Robinson 87ccdf02a7 Avoid strcpy 2019-06-06 04:39:30 -07:00
Chris Robinson 56faf66887 Disable MSVC warning 4200 again 2019-06-06 03:32:28 -07:00
Chris Robinson 39c2b18cd4 Remove a couple unused functions 2019-06-06 00:42:59 -07:00
Chris Robinson 585b0cf3be Remove the DEF_ALIGN macro 2019-06-06 00:37:00 -07:00
Chris Robinson a7be531049 Remove the unused ALIGN macro 2019-06-06 00:24:13 -07:00
Chris Robinson d9d9e70ed8 Don't disable some MSVC warnings 2019-06-06 00:18:25 -07:00
Chris Robinson 5acae56ecd Use a FlexArray for ringbuffer storage 2019-06-05 23:29:13 -07:00
Chris Robinson 24df52c042 Remove the per-voice ChannelsPerOrder field 2019-06-05 23:00:28 -07:00
Chris Robinson f9da06fc6a Use a span for the effect state's output target 2019-06-05 19:58:58 -07:00
Chris Robinson 1ce310c6d1 Make some more channel counts unsigned 2019-06-05 19:26:54 -07:00
Chris Robinson 410a5ca621 Make RealMixParams channel count unsigned 2019-06-05 18:54:17 -07:00
Chris Robinson 5f26205f8f Properly destroy other objects 2019-06-05 17:25:08 -07:00
Chris Robinson f27e73989c Properly destroy the limiter's extra fields 2019-06-05 17:09:15 -07:00
Chris Robinson 142721df17 Add methods to construct and destruct objects in-place 2019-06-05 16:38:53 -07:00
Chris Robinson b2735331c0 Use a 16-sample base delay for the B-Format decoder IRs 2019-06-04 20:27:32 -07:00
Chris Robinson 9d861406c0 Avoid a separate struct for the bandsplitter all-pass 2019-06-04 17:50:36 -07:00
Chris Robinson 4522a51ea2 Don't log the function or prefix
It's ultimately unnecessary since the message is an indicator about where it
was logged from. The message itself is generally more important than where it
was from, too.
2019-06-04 01:37:36 -07:00
Chris Robinson f0bc9d8a9b Improve alignment handling for the alignment allocator 2019-06-03 22:58:56 -07:00
Chris Robinson c76fb714cc Restructure voice data members
This should improve access patters by packing each buffer channel's data
together, which is more inline with its use.
2019-06-03 22:24:26 -07:00
Chris Robinson 53e1415a67 Allow selecting the ambisonic order for basic HRTF rendering 2019-06-02 20:38:43 -07:00
Chris Robinson 8c4a9a5a32 Properly search for prebuilt native-tools 2019-06-01 11:21:43 -07:00
Chris Robinson 20ce461096 Make sure the T60 filter gains are properly clamped 2019-05-31 11:58:48 -07:00
Chris Robinson 6ee49cad52 Once more for MSVC 2019-05-30 18:55:24 -07:00
Chris Robinson 4bae4cbafb Another attempt to fix MSVC 2015 2019-05-30 18:39:51 -07:00
Chris Robinson a123c87ba5 Avoid some MSVC workarounds that didn't seem to work 2019-05-30 14:38:06 -07:00
Chris Robinson 1c8dfb55d8 Improve span constructor requirements
Particularly, properly account for the const-ness of the data returned by it.
2019-05-30 11:46:48 -07:00
Chris Robinson 76e7c8b244 Try to work around some MSVC short-comings 2019-05-30 10:52:28 -07:00
Chris Robinson 1961828d0b Avoid potentially ambiguous span copy constructor 2019-05-30 10:06:12 -07:00
Chris Robinson 153f133435 Try to fix "ambiguous" initializations with older compilers 2019-05-29 23:41:09 -07:00
Chris Robinson dbdf516dbf Use a span for the voice's buffer references 2019-05-29 23:06:24 -07:00
Chris Robinson 2909f263fd Use span<FloatBufferLine> for EffectState::process output 2019-05-29 22:31:36 -07:00
Chris Robinson 893ffe9a84 Use span<FloatBufferLine> for MixSamples 2019-05-29 21:58:37 -07:00
Chris Robinson 8af7b4c6e0 Use FloatBufferLine and span<> for MixRowSamples 2019-05-29 20:45:33 -07:00
Chris Robinson 7e6b6d7ad9 Use FloatBufferLine and span<> in the reverb effect 2019-05-29 19:36:06 -07:00
Chris Robinson ba449d2b08 Pass a span to MixDirectHrtf instead of a pointer+size 2019-05-29 17:32:16 -07:00
Chris Robinson d0f0a5fdca Separate two HRTF passes into two loops 2019-05-29 11:13:35 -07:00
Chris Robinson ec3a6f8cde Use FloatBufferLine for the effect process method 2019-05-29 09:37:25 -07:00
Chris Robinson b923eb1879 Use FloatBufferLine with the HRTF mixer functions 2019-05-28 22:44:50 -07:00
Chris Robinson 838e2bae80 Improve a couple algorithms 2019-05-28 17:18:22 -07:00
Chris Robinson c80ee5b701 Use std::array for most mixing buffer arrays 2019-05-28 16:22:36 -07:00
Chris Robinson 7ce2b632f5 Simplify template type requirement checking 2019-05-28 08:49:53 -07:00
Chris Robinson aa4b6afad6 Small cleanup for is_span and is_std_array 2019-05-27 22:01:59 -07:00
Chris Robinson bac52e9537 Fix default constructor for static-sized spans 2019-05-27 17:48:19 -07:00
Chris Robinson 28fbb5178a Remove unnecessary assignment operators 2019-05-27 15:56:50 -07:00
Chris Robinson aad49d666a Implement static-sized spans, and handle overload requirements
Note that span is specialized such that a static-sized span only has a single
data member, making it a suitable replacement for  Type (&arg)[Size]  style
variables/parameters.
2019-05-27 15:36:10 -07:00
Chris Robinson f57fedec7f Get rid of the COUNTOF macro 2019-05-26 21:28:51 -07:00
Chris Robinson f6f220025b Fix subspan 2019-05-26 21:00:17 -07:00
Chris Robinson 3007fbf5e5 Use a span for loading source samples 2019-05-26 20:05:12 -07:00
Chris Robinson b0e12ccf71 Ensure a couple calls are constexpr 2019-05-26 15:57:17 -07:00
Chris Robinson 01f717ae59 Use SL_ANDROID_DATAFORMAT_PCM_EX for extended PCM info 2019-05-26 14:45:53 -07:00
Chris Robinson 20e3c78aef Use al::byte instead of char for generic data storage 2019-05-26 12:54:54 -07:00
Chris Robinson 63a130204c Add a few more methods to the span class 2019-05-26 12:05:43 -07:00
Chris Robinson 7cbf82afe4 Avoid a few more NUM_LINES assumptions 2019-05-26 11:34:17 -07:00
Chris Robinson 8ca97a7d9a Move a couple functions into its related class 2019-05-25 11:54:51 -07:00
Chris Robinson 5b5dee07b4 Remove a couple unused functions 2019-05-25 11:36:13 -07:00
Chris Robinson ebf33b7c6b Avoid some uses of RESTRICT 2019-05-25 08:17:37 -07:00
Chris Robinson 219f818b16 Use al::byte for ADPCM decoders 2019-05-24 13:32:20 -07:00
Chris Robinson b4fbc271d2 Add byte ops that take an integer-based rhs parameter 2019-05-24 13:30:40 -07:00
Chris Robinson 674ca3cf24 Move a couple table definitions to where they're used 2019-05-24 12:06:52 -07:00
Chris Robinson 1f45cc051a Fix some truncation warnings with MSVC 2019-05-24 06:47:24 -07:00
Chris Robinson e90a6beaa2 Remove an unnecessary struct member 2019-05-24 06:25:18 -07:00
Chris Robinson 9c63bbd6ce Use raw bytes for the buffer data 2019-05-24 06:12:20 -07:00
Chris Robinson 1945b50834 Add a unique byte type for dealing with raw bytes 2019-05-24 06:11:21 -07:00
Chris Robinson 857473b6b0 Store the span extents as a pair of pointers 2019-05-24 04:55:38 -07:00
Chris Robinson 3a9caec72f Use a span for referencing the channel map to initialize 2019-05-23 13:30:16 -07:00
Chris Robinson 517b8158a7 Add a missing include 2019-05-23 08:30:02 -07:00
Chris Robinson b46eca97a6 Use a span for resource data 2019-05-23 08:17:05 -07:00
Chris Robinson a4af617532 Add a span class to act as a view to contiguous data 2019-05-23 08:15:02 -07:00
Chris Robinson e3d6f3d988 Use a function to mark a source for updating 2019-05-23 05:06:26 -07:00
Chris Robinson 6708504026 Properly reverse the HRTF field order when loading it
And combine a couple arrays into an array structure
2019-05-22 11:07:12 -07:00
Chris Robinson b48bab3394 Allow initializing splitter filters with constructors 2019-05-22 03:03:24 -07:00
Chris Robinson 657978c732 Don't change the format tag in MakeExtensible 2019-05-21 09:01:51 -07:00
Chris Robinson d502397b37 Simplify the echo feedback loop 2019-05-20 22:07:41 -07:00
Chris Robinson 55845f316d Don't use coverage spread for the echo spread 2019-05-20 21:30:56 -07:00
Chris Robinson 6dbd488d13 Avoid unnecessary use of CalcAngleCoeffs 2019-05-20 21:16:13 -07:00
Chris Robinson 136caf0cb0 Don't attenuate the repeated sample
The mixing gain stepping will handle it
2019-05-19 00:53:39 -07:00
Chris Robinson 515a201e30 Restructure some voice fields 2019-05-17 20:39:28 -07:00
Chris Robinson 5ac19673db Fix a couple type truncation warnings with MSVC 2019-05-12 19:41:34 -07:00
Chris Robinson 8d437a5135 Use available buffer samples when pausing a source 2019-05-05 01:51:46 -07:00
Chris Robinson 0759ed7213 Properly mark a likely branch 2019-05-05 00:05:41 -07:00
Chris Robinson 0c09c8378b Set the device channel order from PulseAudio's channel map 2019-05-04 23:45:27 -07:00
Chris Robinson 42dfefbb0e Fix when PulseAudio channel configuration changes 2019-05-04 22:11:29 -07:00
Chris Robinson 1b11ca48dc Avoid unnecessary parsing for channel maps 2019-05-04 20:54:49 -07:00
Chris Robinson 31c29f1ea8 Use exceptions when opening and reseting the PulseAudio backend 2019-05-04 20:35:24 -07:00
Chris Robinson 95d19be36b Catch exceptions from backend reset 2019-05-04 20:34:33 -07:00
Chris Robinson b9592bddbc Add the printf format attribute to backend_exception's constructor 2019-05-04 18:25:59 -07:00
Chris Robinson 5ff8d5ae32 Add an exception class to cover backend creation and opening 2019-05-04 18:03:25 -07:00
Chris Robinson 1607f9c525 Report the threshold limit for the output limiter 2019-05-04 13:53:11 -07:00
Chris Robinson 9eea2e4c73 Use BUFFERSIZE for the reverb loop limit
At 44/48khz, the main delay line comes out to 20k to 22k samples, which gets
rounded up to 32k as the next power of two. This leaves plenty of room for the
full 1k BUFFERSIZE without having to increase the delay line beyond what it
already is.
2019-05-03 12:59:04 -07:00
Chris Robinson 2f2ec2b6e3 Add some assumes and consts 2019-05-03 00:50:47 -07:00
Chris Robinson a72c47164c Avoid a few more array length assumptions 2019-05-01 11:15:17 -07:00
Chris Robinson 6281f6e85a Avoid masking offsets in the inner reverb loops 2019-04-30 23:28:57 -07:00
Chris Robinson 85439cbd87 Add some missing include directories 2019-04-29 20:03:51 -07:00
Chris Robinson fb52413a6e Make a number of settings tristate 2019-04-29 19:47:14 -07:00
Chris Robinson cef7eebed6 Disable NFC by default 2019-04-29 19:47:14 -07:00
Chris Robinson b42694ea31 Allow NFC filters without HQ decoding
It still requires a proper custom decoder configuration for speakers, so that
proper distances can be specified. Ambisonic output still relies on the
nfc-ref-delay option, and HRTF uses the dataset's distance.
2019-04-29 19:47:14 -07:00
kcat 1ab783c7ac Merge pull request #285 from ArthurSonzogni/master
Update CMakeLists.txt. Simplify examples build and export PUBLIC headers.
2019-04-29 19:46:39 -07:00
ArthurSonzogni 2eb657f2df CMAKE: export PUBLIC headers of OpenAL.
Remove the cmake function:
  INCLUDE_DIRECTORIES(..)
Replace it by:
  TARGET_INCLUDE_DIRECTORIES(...)

It gives us the opportunity to define whether or not OpenAL dependencies
should be exported or not (using PUBLIC or PRIVATE keywoard).

[user visible changes]
The OpenAL PUBLIC headers are exported. When a target depends on OpenAL,
it will have access to its public headers.

Some small refactor along the way.
2019-04-30 04:17:43 +02:00
Chris Robinson c7e388873c Increase the period size slider and don't use steps of 64 2019-04-28 22:21:23 -07:00
Chris Robinson 8ca849655f Properly replace sinc4 with cubic in alsoft-config 2019-04-28 21:51:47 -07:00
Chris Robinson ace7481b8e Only enable NFC with HRTF when hq-mode is enabled 2019-04-28 21:49:10 -07:00
Chris Robinson 9d6619efdc Combine some reverb processing loops
Specifically, the A2B and output mixing, as well as applying the band-pass with
B2A mixing (the latter of which hiding a bug that was overwriting the early
buffer storage).
2019-04-28 08:56:41 -07:00
Chris Robinson ec869234f7 Remove restrict from in+out parameters 2019-04-28 08:51:50 -07:00
Chris Robinson 014936ceff Be more robust with PulseAudio capture
Particularly, handle "holes" in the record stream and premature end-of-buffer.
Also don't bail out when capturing while disconnected (the extension says it
should provide anything it previously reported available, going to silence for
anything no longer readable).
2019-04-27 21:25:42 -07:00
Chris Robinson 0577028b65 Add missing function pointers 2019-04-27 18:01:26 -07:00
Chris Robinson c135629eae Remove some ancient PulseAudio KDE/Phonon/Qt hacks
Unfortuantely, the relevant KDE bug still seems to exist (streams are forced to
KDE's default device after opening, even when they're created with a specific
device at user request). I do not know why KDE thinks this is in any way good
behavior (the user doesn't get their desired device, nor does the stream get
the appropriate format for the device its ultimately put on), but making
streams non-movable as a workaround has been a thorn in the side of non-KDE
users for too long. C'mon KDE, it's been nearly (if not more than) 7 years now.
2019-04-27 14:13:07 -07:00
Chris Robinson 150dc92f68 Remove unused pa_threaded* functions 2019-04-27 13:06:39 -07:00
Chris Robinson f9f34def82 Use a custom PulseAudio mainloop
This allows using RT priority again with the mixer. It also consolidates all
mainloop instances into one.
2019-04-27 12:25:49 -07:00
Chris Robinson c724798c85 Don't round WASAPI updates to the update size 2019-04-27 08:48:14 -07:00
Chris Robinson dd2c43be42 Update the period size placeholder text 2019-04-26 19:02:18 -07:00
Chris Robinson b502bbaf5c Change the default period size to 20ms 2019-04-26 18:56:54 -07:00
Chris Robinson 9e4ee500b6 Scale the update size with sample rate changes 2019-04-26 18:04:22 -07:00
Chris Robinson b29be3b39e Set the ALSA period size first 2019-04-26 16:20:27 -07:00
Chris Robinson f23ff0394d Specify the buffer size as itself instead of the period count
Certain backends don't need a buffer size to be a strict multiple of the period
count, which allows a little more flexibility. The period/update size simply
acts as the minimum request, which helps control CPU load by determining how
often parameter and other pre-mixing updates are processed.
2019-04-26 15:58:25 -07:00
Chris Robinson 348e01dc4b Work around a 32-bit GCC compiler bug 2019-04-26 07:11:09 -07:00
Chris Robinson 725ceb128e Open the playback device earlier
So we actually have a device name to get the initial settings for. Be aware
that some backends set a format when opening instead of on reset, so such
devices will only set the default format (it can't get a desired format without
the device name, but the format will already be set once that's known). The
affected backends are WinMM, SDL2, and PortAudio (none of which are generally
used). This could be fixed by reopening the device during reset, but it would
need to be done carefully.
2019-04-20 19:29:33 -07:00
Chris Robinson 87e279082f Don't round the PulseAudio write size to the period multiple 2019-04-17 05:51:40 -07:00
Chris Robinson 09dbc4c2da Fix PulseAudio backend initialization 2019-04-16 17:23:28 -07:00
Chris Robinson 61f7e7716c Remove the backend factory deinit method
It was never actually called anywhere, and there's no safe place where it can
be called. It's probably better to let the individual backends worry about
cleaning themselves up anyway.
2019-04-14 04:05:07 -07:00
Chris Robinson 7f52678099 Use a custom message queue for the WASAPI backend 2019-04-14 01:03:36 -07:00
Chris Robinson 629cfa04a3 Fix some integer truncation warnings in MSVC 2019-04-12 19:19:24 -07:00
Chris Robinson 6761fe137f Load buffer data using the current and end pointer 2019-04-12 16:24:11 -07:00
Chris Robinson 4b95d310ae Remove the SZFMT macro
C++11 mandates the %zu/d formatter
2019-04-11 16:01:11 -07:00
Chris Robinson 8215251571 Simplify sorting and initializing the backends 2019-04-11 02:49:13 -07:00
Chris Robinson abcca1acd1 Add exception protection to the last of the API functions 2019-04-10 17:47:13 -07:00
Chris Robinson 1d214dba1e Add exception protection to effect, filter, and buffer functions 2019-04-10 17:33:21 -07:00
Chris Robinson b4a8615ea9 Add exception protection to the listener functions 2019-04-10 14:16:15 -07:00
Chris Robinson 5ad50e4f8e Add exception protection to context state functions 2019-04-10 13:44:46 -07:00
Chris Robinson f39d4598b7 Add exception protection to some AL functions 2019-04-10 13:05:21 -07:00
Chris Robinson d6f72b777a Fix usage of the voice's HRTF accumulation buffer when blending 2019-04-09 22:42:45 -07:00
Chris Robinson 55a3f38405 Don't use a fixed size buffer for printed messages 2019-04-09 22:13:21 -07:00
Chris Robinson 460a01443c Add macros to stop exceptions from leaving API functions
Effectively makes the functions act as noexcept, since there's no meaningful
reason to propogate exceptions from "C" functions. Currently only applied to
ALC functions, but can incrementally be applied to AL functions too. In the
future, this could also handle ALC and AL errors with unique exception types
(functions that utilize this behavior would need to ensure proper cleanup).
2019-04-09 20:48:01 -07:00
Chris Robinson e6daab51e8 Make sure the all-pass filter is cleared before use 2019-04-04 22:57:29 -07:00
Chris Robinson dc5759f80c Fix MSVC error about parenthesized explicit type conversion 2019-04-03 10:32:48 -07:00
Chris Robinson e66632b301 Avoid directly using CalcAmbiCoeffs 2019-04-02 20:23:19 -07:00
Chris Robinson d04f9326c9 Change RealMixParams::ChannelName to better reflect its use 2019-04-02 16:06:45 -07:00
Chris Robinson 9ac3524521 Spread out the ALC extensions like the AL extensions 2019-04-01 21:41:11 -07:00
Chris Robinson 86683264c9 Avoid multiple using statements for the same things 2019-04-01 21:35:52 -07:00
Chris Robinson 8781a32df5 Copy the voice's ambisonic upsampler state when reallocating 2019-04-01 17:27:31 -07:00
Chris Robinson da8494dd8a Use the existing function to get the ambisonic channel count 2019-03-31 22:50:30 -07:00
Chris Robinson 0e0e85af72 Don't bother with a separate reset method for BFormatDec 2019-03-31 22:27:56 -07:00
Chris Robinson 423333c594 Fix use of reverse_copy 2019-03-31 19:09:21 -07:00
Chris Robinson c88b09170c Use phase correction for the front stablizer 2019-03-31 18:54:43 -07:00
Chris Robinson d8c76ba0c0 Remove a couple unused member variables 2019-03-30 23:41:47 -07:00
Chris Robinson 89210cddb7 Don't stop the backend if it's not running 2019-03-30 23:30:15 -07:00
Chris Robinson cc91490b61 Use a temporary buffer for HRTF filter accumulation
Similar to the history buffer, to avoid using the state buffer as a ring
buffer.
2019-03-29 11:33:04 -07:00
Chris Robinson fe7918465e Use a function reference for a template parameter 2019-03-28 10:00:35 -07:00
Chris Robinson dfb81ff42d Avoid using the HRTF history buffer as a ring buffer
The HRTF mixers now get a full input buffer with the history prepended, so the
delay offsets just need to account for the start point and read forward for
each sample.
2019-03-28 09:34:31 -07:00
Chris Robinson e7bfe1ebd0 Simplify applying the field magnitude factor 2019-03-27 11:52:35 -07:00
Chris Robinson 095a0b9beb Set the EARLY_REQUESTS flag for PulseAudio when possible 2019-03-26 17:03:31 -07:00
Chris Robinson 608e4e916e Avoid recreating temporary buffers all the time 2019-03-26 17:01:45 -07:00
Chris Robinson 2960d729ef Fix a return type for accumulation 2019-03-26 13:47:24 -07:00
Chris Robinson 8b0c9fcf30 Require IR dimensions from a SOFA file 2019-03-26 13:45:25 -07:00
Chris Robinson 2446ee0cca Avoid some explicit loops 2019-03-26 12:37:52 -07:00
Chris Robinson a5b442b1a4 Add a missing include for varargs 2019-03-26 11:37:28 -07:00
Chris Robinson bcbe7c493c Remove another unnecessary distance check 2019-03-26 11:04:52 -07:00
Chris Robinson 525b5e65b2 Remove a couple unnecessary duration_casts 2019-03-26 10:20:32 -07:00
Chris Robinson 2c37d4fae1 Move an enum to a more appropriate header 2019-03-26 10:08:26 -07:00
Chris Robinson 4c32e55ac2 Don't mention which rendering methods aren't used 2019-03-25 23:17:34 -07:00
Chris Robinson a57116f788 Scale floats directly to 32-bit integer values
Rather than scaling to a 25-bit integer and shifting for the extra 7 bits. This
should improve precision for values closer to 0.
2019-03-25 22:52:15 -07:00
Chris Robinson 0a4d1c858e Support loading SOFA files directly with makemhr
This extracts the definition info it can from the SOFA, and uses the same logic
as sofa-info to automatically detect an appropriate layout. There is a bit of
code duplication from loaddef.cpp and sofa-info.cpp, though there are slight
modifications.
2019-03-25 20:16:02 -07:00
Chris Robinson cb02bb00be Detect SOFA files for makemhr input 2019-03-25 13:01:44 -07:00
Chris Robinson a3687db015 Use only a single function to load the HrirDataT 2019-03-25 00:21:45 -07:00
Chris Robinson 78aeca10c9 Add a command-line option to force mono input with makemhr 2019-03-24 22:43:43 -07:00
Chris Robinson 6edfa6e6e0 Cleanup some unnecessary parameters 2019-03-24 22:06:01 -07:00
Chris Robinson f392d9c138 Move makemhr's .def loading code to a separate source 2019-03-24 19:00:58 -07:00
Chris Robinson 5e6e738681 Change references of makehrtf to makemhr 2019-03-24 17:35:32 -07:00
Chris Robinson 7c16b1e02f Rename makehrtf to makemhr and move it to a subdirectory 2019-03-24 17:31:10 -07:00
Chris Robinson c8e8ac42ab Use false instead of 0 for a boolean 2019-03-24 14:02:06 -07:00
Chris Robinson f7ab7b45f7 Mark the device and context deletes as unlikely 2019-03-24 13:54:49 -07:00
Chris Robinson 12d4953a5f Remove a couple redundant distance checks 2019-03-23 13:55:07 -07:00
Chris Robinson 6df673e01c Don't redundantly set the voice's direct output buffer 2019-03-23 13:30:15 -07:00
Chris Robinson 819ec8a653 Rename and move ALeffectProps 2019-03-22 22:48:12 -07:00
Chris Robinson 3a6e741e90 Use MixParams for the wet buffers 2019-03-22 19:25:55 -07:00
Chris Robinson 92adfaebce Fix a comment typo 2019-03-22 18:37:47 -07:00
Chris Robinson edc32b40a5 Slightly improve casting in the modulator effect 2019-03-22 17:47:19 -07:00
Chris Robinson ea8b02dead Pass ALeffectProps directly to the get/setParam* methods 2019-03-22 16:04:13 -07:00
Chris Robinson e7e585f65c Use the effect state factory to set the default effect props 2019-03-22 15:00:37 -07:00
Chris Robinson f951f4a66b Implement getDefaultProps for effect state factories 2019-03-22 12:58:24 -07:00
Chris Robinson 935f386982 Use a separate EffectStateFactory for standard reverb 2019-03-22 11:57:32 -07:00
Chris Robinson 9790135127 Add a new EffectStateFactory method to get the default properties 2019-03-22 11:52:55 -07:00
Chris Robinson 8a1b1f4204 Make sure the file is rewound before writing the wave header 2019-03-19 22:10:49 -07:00
Chris Robinson 7880540407 Use a sorted vector for looking up contexts
Note that the device still holds and uses a linked list of its contexts. The
sorted vector is used to verify handles given by callers.
2019-03-19 18:53:32 -07:00
Chris Robinson 90465e9124 Use a sorted vector for devices instead of a linked list 2019-03-19 15:56:30 -07:00
Chris Robinson cf6545ebb2 Avoid AL types in the common alnumeric.h header 2019-03-19 14:34:44 -07:00
Chris Robinson 813976e58d Add some enum casts for the WASAPI backend 2019-03-19 01:33:36 -07:00
Chris Robinson 9695952c8d Rename DevProbe enum names 2019-03-19 00:24:54 -07:00
Chris Robinson d31514f8be Move some inline functions from alMain.h to alnumeric.h 2019-03-18 22:06:01 -07:00
Chris Robinson 3e816de4fb Use SSE intrinsics in a few more places 2019-03-18 20:58:48 -07:00
Chris Robinson 73a43fb19c Don't bother trying _controlfp or __control87_2 2019-03-18 20:27:25 -07:00
Chris Robinson 2de1d17bc6 Use SSE intrinsics to set FTZ and DAZ 2019-03-18 20:14:40 -07:00
Chris Robinson 6a0b2ed0ca Check compile-time support for SSE intrinsics 2019-03-18 20:05:15 -07:00
Chris Robinson 821c7565cf Don't bother checking for SSE1 alone
SSE2 support is now the minimum required for SSE. Run-time can still disable
SSE2-specific functions separately from SSE1, but build-time support can't be
separated.
2019-03-18 17:38:02 -07:00
Chris Robinson e61cec8f17 Don't bother checking for C99 inline semantics
Should be unneeded with C++
2019-03-18 14:31:12 -07:00
Chris Robinson d802a5785e Fix indexing for basic B-Format decoding 2019-03-17 14:03:21 -07:00
Chris Robinson f96c37120b Always reset all voices on disconnect 2019-03-16 17:01:04 -07:00
Chris Robinson 339a37b034 Include std::placeholders once in an anonymouse namespace 2019-03-16 15:15:59 -07:00
Chris Robinson 12999f9efe Simplify calculating azimuth and elevation indices for HRTF 2019-03-14 22:26:19 -07:00
Chris Robinson 9f5a7a7a50 Fix wrapping for the upper HRIR index 2019-03-14 13:17:07 -07:00
Chris Robinson 3a19b94503 Mirror a couple HRIR elevations from the top for the bottom
Because the ears are offset from center, linear interpolation from the lowest
defined elevation to the -90 degree bottom misses this slight deviation.
Mirroring one or two more elevations from the top helps catch it, and bilinear
interpolation is used to transition back to the lowest known measurements.
2019-03-13 12:27:44 -07:00
Chris Robinson 3a39a2c790 Set the correct target gain after a fade-out HRTF mix 2019-03-12 16:45:34 -07:00
Chris Robinson 24ae12f58e Check a value where its used 2019-03-12 09:56:02 -07:00
Chris Robinson 098c7ca6ea Fix not looping when the source offset is beyond the loop end 2019-03-11 22:09:30 -07:00
Chris Robinson 24b43fe852 Remove a couple redundant local variables 2019-03-11 22:00:28 -07:00
Chris Robinson 30a7c6d86f Pass the voice state as a parameter instead of reloading it 2019-03-11 20:00:14 -07:00
Chris Robinson e0daad6a16 Update comment for SynthesizeOnsets 2019-03-11 14:28:13 -07:00
Chris Robinson d2b4099024 Process minimum phase reconstruction in parallel 2019-03-11 13:41:26 -07:00
Chris Robinson 0689333da8 Mirror the +90 degree elevation delays for -90 degrees 2019-03-10 21:47:05 -07:00
Chris Robinson 2c67ab0d2c Rename ALvoice fields for consistency 2019-03-10 16:29:06 -07:00
Chris Robinson 030b24a40d Improve handling of voice's AmbiScales for upsampling 2019-03-10 15:46:46 -07:00
Chris Robinson 663a6ce4e7 Use the correct value for MAX_AMBI2D_CHANNELS 2019-03-10 15:39:31 -07:00
Chris Robinson d99d2a400a Don't copy old coeffs in MixHrtfBlendBase 2019-03-10 14:31:46 -07:00
Chris Robinson 80e55b87ed Avoid an extra level of indentation 2019-03-10 12:50:38 -07:00
Chris Robinson 0d295cf811 Don't directly use a buffer for updating source parameters 2019-03-10 11:52:39 -07:00
Chris Robinson e5651c15dd Avoid excessive transformations of the source position 2019-03-10 11:33:08 -07:00
Chris Robinson 12721f94a7 Add a method to apply an HF scale without band-splitting 2019-03-10 10:30:33 -07:00
Chris Robinson 6a95189ef6 Fix for MSVC decaying arrays to pointers with ?: 2019-03-09 21:54:15 -08:00
Chris Robinson 106671d451 Fade out voices that end normally
Sometimes a sound may end with non-0 amplitude, particularly if a buffer queue
underruns. This helps avoid clicks and pops for sources that don't already end
in silence.
2019-03-09 21:32:14 -08:00
Chris Robinson 87479b4b32 Play dummy samples and force a fade out on stopping voices 2019-03-09 18:34:00 -08:00
Chris Robinson ef0f335132 Add a Stopping state for voices
This currently doesn't do much, except have the mixer progress it to Stopped.
It's valid to have without a source or buffers, and in the future will allow
fading out when a source is paused or stopped.
2019-03-09 16:48:07 -08:00
Chris Robinson cde4500e24 Increment the active voice count ahead of playing the sources 2019-03-09 15:04:51 -08:00
Chris Robinson d39cfcc7bb Clear the voice's buffer when detaching from source 2019-03-09 13:20:10 -08:00
Chris Robinson 972a5c0f1d Exclude far-ear IRs for the synthesized -90 degree elevation 2019-03-09 13:00:08 -08:00
Chris Robinson 0e4402b2e1 Avoid some explicit loops 2019-03-05 06:21:09 -08:00
Chris Robinson da9ec374d8 Normalize HRIRs using their maximum RMS 2019-03-04 08:00:04 -08:00
Chris Robinson 90d1e1212b Pass a reference to function for a template parameter 2019-03-03 00:24:33 -08:00
Chris Robinson 2d14de3fb0 Use more specific names for temp buffer storage 2019-03-02 23:41:26 -08:00
Chris Robinson 0aa0f24dd7 Use a proper flag to indicate audio is prepared in alffplay 2019-03-01 22:46:56 -08:00
Chris Robinson e4b76d2627 Reverse the HRTF field array
Most often a sound's distance will be beyond the farthest field measurement, so
It's more efficient to have the farthest field first and avoid looping through
the whole field array for them.
2019-02-27 23:13:40 -08:00
Chris Robinson 86926f0998 Combine the reverb output mixes into a single call 2019-02-25 05:52:37 -08:00
Chris Robinson 8a34bd59b0 Unlock the audio decoder mutex before disabling events in alffplay
The callback may be waiting on the mutex, but disabling the callback needs any
current invocation to finish first.
2019-02-25 02:03:43 -08:00
Chris Robinson 81aa5af3b9 Make sure the reverb fading completes
The processing loop doesn't depend on being aligned anymore, so it won't get
stuck when only less than 4 samples can be done in a non-final update.
2019-02-25 01:08:11 -08:00
Chris Robinson 4d6b66163c Convert the device frequency to float just once 2019-02-24 19:07:21 -08:00
Chris Robinson d6fb4d5f52 Make sure the voice's direct buffer is always set 2019-02-24 19:02:49 -08:00
Chris Robinson d2664e2192 Remove a duplicate index array 2019-02-24 18:00:49 -08:00
Chris Robinson cadff0f6c1 Reduce BUFFERSIZE to match the default period size
Also adds a bit more space to the temp source data buffer, to avoid needing to
loop on matching sample rates.
2019-02-24 16:13:51 -08:00
Chris Robinson a2ba550ebf Rework reverb A/B-Format conversion mixing
This should help improve performance using the optimized mixers, and fewer
passes on the transforms, though at the cost of more memory.
2019-02-24 15:43:56 -08:00
Chris Robinson 4ec0aed286 Change some functions to proper methods 2019-02-23 03:18:12 -08:00
Chris Robinson 42934b09e5 Avoid multiple int-to-float conversions 2019-02-23 01:43:55 -08:00
Chris Robinson 3683e31662 Constify some parameters and remove an explicit loop 2019-02-23 00:01:38 -08:00
Chris Robinson 317206e8f3 Remove the FOAOut mixing buffer and associated post-processes 2019-02-22 22:35:37 -08:00
Chris Robinson 45378fe687 Remove the unused FOAOut EffectTarget 2019-02-22 22:03:04 -08:00
Chris Robinson 5b35e60a98 Apply ambisonic upsampling on reverb output as needed
This isn't the greatest thing since it splits the A-to-B-Format transform from
the panning transform. The A-to-B and HF scale mixes are also not as optimal as
they could be, since they can't use the main mixer functions (wrong buffer line
length).

It does, however, get rid of the final use of the FOAOut buffer, so the
upsampling post-process is no longer needed.
2019-02-22 21:53:45 -08:00
Chris Robinson 6a3c10d850 Ensure reverb fading doesn't end with less than 4 samples 2019-02-22 02:15:22 -08:00
Chris Robinson 6a2cf96448 Avoid some unnecessary local variables 2019-02-22 01:00:57 -08:00
Chris Robinson 01ac6e2e56 Combine reverb transform matrices one column at a time 2019-02-21 19:05:20 -08:00
Chris Robinson 7a9d67934f Mix B-Format sources directly to the dry buffer
Now the only thing that utilizes FOAOut is reverb output.
2019-02-21 17:48:08 -08:00
Chris Robinson 1eea3cb2d1 Remove RESTRICT from the bandsplitter process method
The compiler can see there's no aliasing with the local variables, and the
input/output buffers are handled sequentially one element at a time anyway.
2019-02-21 17:37:02 -08:00
Chris Robinson 169a11dffc Add some preliminary fields for mix-time ambisonic upsampling 2019-02-21 04:57:56 -08:00
Chris Robinson 8ac2d34706 Allow processing some effects in higher order ambisonics
Reverb notably is still only first-order (any higher order channels are
dropped, and it writes to FOAOut). But others, like the equalizer, work on all
available channels.
2019-02-21 04:23:01 -08:00
Chris Robinson a964890537 Add helpers to get the channel count from an ambisonic order 2019-02-21 04:05:49 -08:00
Chris Robinson a35255291f Fix unused parameter warning 2019-02-21 03:54:12 -08:00
Chris Robinson 8d2d7c63da Get rid of the MAX_EFFECT_CHANNELS macro 2019-02-21 03:52:54 -08:00
Chris Robinson 462e320847 Make sure the B2A matrix has enough values for the input count 2019-02-21 03:31:24 -08:00
Chris Robinson d95e144c48 Remove some now-unnecessary ReverbState fields 2019-02-21 03:07:36 -08:00
Chris Robinson 4b4041319d Pass the number of input channels to EffectState::process 2019-02-21 02:57:39 -08:00
Chris Robinson 7e00f646d9 Add a method to get the row of an ambisonic identity transform 2019-02-21 02:13:30 -08:00
Chris Robinson 615446d6d5 Ensure the device's mAmbiOrder is always set appropriately
The Dry target is always ambisonic, so set its order correctly.
2019-02-21 01:23:11 -08:00
Chris Robinson 3966665ca3 Store effect slots in groups of 64
Now that their wet buffers are allocated dynamically, the ALeffectslot object
itself is rather small.
2019-02-20 22:00:26 -08:00
Chris Robinson c43381d811 Allocate the effect slot wet buffer dynamically 2019-02-20 21:01:08 -08:00
Chris Robinson 77ba61ecb3 Partially handle non-periphonic reverb input 2019-02-19 22:55:43 -08:00
Chris Robinson 87902fa3b2 Use the right macro for the number of reverb panning gains 2019-02-19 20:51:10 -08:00
Chris Robinson 194fcb6bb7 Rename MAX_AMBI_COEFFS and MAX_AMBI2D_COEFFS 2019-02-19 15:39:33 -08:00
Chris Robinson a75bc26173 Reduce some indenting 2019-02-19 02:30:01 -08:00
Chris Robinson 2c04095d22 Apply the upsampler's all-pass when mixing the band-split samples 2019-02-19 02:05:35 -08:00
Chris Robinson d713f5f828 Clean up some AmbiUpsampler initialization 2019-02-19 01:59:30 -08:00
Chris Robinson 69ab36cc14 Avoid a temp buffer for the distance compensation delay 2019-02-17 00:43:10 -08:00
Chris Robinson c95d6a5d8c Apply phase correction to the ambisonic decoder HRIRs
This preserves the original phase of the HRIR frequencies for decoding the
ambisonic signal. This should help prevent extra coloration from the band-
splitter used to scale the HF response.
2019-02-16 22:57:38 -08:00
Chris Robinson 69f6f56160 Avoid using internal AL[u]int64 types 2019-02-11 12:16:58 -08:00
Chris Robinson 2fc8461c14 Don't check for __int64 2019-02-11 11:44:35 -08:00
Chris Robinson dac609b29a Move some more functions to alnumeric.h 2019-02-11 11:31:31 -08:00
Chris Robinson 21aaa18c50 Get rid of the FAM_SIZE macro 2019-02-11 11:14:34 -08:00
Chris Robinson 995c9649cb Move some number-related stuff to a separate header 2019-02-11 11:07:06 -08:00
Chris Robinson 69d8c6546d Use std::arrays for HRIR coeffs and values 2019-02-07 08:38:49 -08:00
Chris Robinson b371862fb2 Simply setting a couple indices 2019-02-04 22:17:28 -08:00
Chris Robinson 05cdc2cb30 Use relaxed memory ordering for initializing atomic_flags 2019-02-04 21:28:37 -08:00
Chris Robinson e104f580b3 Use a unique_ptr to store the loaded HrtfEntry 2019-02-04 21:22:43 -08:00
Chris Robinson b7b4cfae2b Fixed alffplay underrun recovery timing 2019-02-04 21:22:43 -08:00
kcat 367191cbfb Merge pull request #269 from gongminmin/FixForVS2019
Fix compiling problems on VS2019 with vc142 toolset
2019-02-04 21:22:16 -08:00
Minmin Gong 41b9d473a2 Fix compiling problems on VS2019 with vc142 toolset
Msvc142 in VS2019 preview 2 doesn't allow std::atomic_flag to be initialized by a bool. Call test_and_set in the constructors instead.
2019-02-04 20:03:18 -08:00
Chris Robinson c25433986a Add missing include 2019-01-29 14:14:52 -08:00
Chris Robinson 613145e900 Calculate the correct evidx for the HRTF B-Format decoder 2019-01-29 03:52:28 -08:00
Chris Robinson 44d72942fb Load and use all available HRTF fields 2019-01-29 00:42:18 -08:00
Chris Robinson 4c740636c2 Pass the distance to GetHrtfCoeffs 2019-01-28 22:22:34 -08:00
Chris Robinson 2d93a9cdb1 Collect HRTF field info into a struct 2019-01-28 20:43:34 -08:00
Chris Robinson df5d238e3d Clean up calculating HRIR indices to blend 2019-01-28 19:39:45 -08:00
Chris Robinson b3fe540c49 Don't normalize HRIRs per-field 2019-01-27 15:50:02 -08:00
Chris Robinson e55f9b42e9 Partially handle ambisonics in alffplay
This is currently really only applicable to Opus-encoded files. It assumes
AmbiX (SN3D normalization, ACN ordering) and only comes into play when the
channel layout is blank. FFmpeg/libavcodec doesn't have a way to detect
B-Format input or what normalization and ordering it uses. Note in particular
.amb files do not play correctly (libavcodec seems to apply a default channel
layout for 4-channel wav-type files, regardless of its channel mask value).
2019-01-27 14:53:46 -08:00
Chris Robinson d7af17ab87 Round the calculated field distance in makehrtf 2019-01-27 14:35:58 -08:00
Chris Robinson f98a24fb8a Don't try to clean up the async ringbuffer if it isn't allocated 2019-01-26 19:29:26 -08:00
Chris Robinson f5e17bafea Fix applied scalars for B-Format source mixing 2019-01-26 17:33:57 -08:00
Chris Robinson 8eab75f312 Update a function comment 2019-01-24 17:05:13 -08:00
Chris Robinson b5569d8455 Slight cleanup for NfcFilterCreate4 2019-01-24 10:22:38 -08:00
Chris Robinson 98be1d1bf5 Make IncRef and DecRef member functions 2019-01-24 10:05:37 -08:00
Chris Robinson 7757789590 Clean up the NFC filters a bit 2019-01-23 16:32:53 -08:00
Chris Robinson ebb46cf4cf Rename a header
To workaround an apparent MSVC error
2019-01-23 15:09:11 -08:00
Chris Robinson 1ec8686407 Add missing includes 2019-01-23 13:46:43 -08:00
Chris Robinson ce3acf4d1b Make hrtf_inc.cpp a proper header 2019-01-23 12:33:18 -08:00
Chris Robinson 8429770c3f Use template declarations for the HRTF mixers 2019-01-23 12:23:05 -08:00
Chris Robinson d3842a632d Use template declarations for the normal mixing functions 2019-01-23 11:21:03 -08:00
Chris Robinson 23179d0bcd Use a template declaration for the resampler functions 2019-01-23 11:11:41 -08:00
Chris Robinson e332ac8528 Use the farthest of multi-field HRTFs 2019-01-22 21:36:40 -08:00
Chris Robinson 3ab4bc5186 Don't install utilities that aren't built 2019-01-22 17:34:45 -08:00
Chris Robinson 5c0dcd1f24 Fix building makehrtf and sofa-info on Windows 2019-01-22 13:17:21 -08:00
Chris Robinson ecafa19bcf Support loading sofa files in makehrtf
The makehrtf utility now requires libmysofa to build. This isn't necessay for
the OpenAL Soft library itself.
2019-01-22 11:24:57 -08:00
Chris Robinson b4a2532ffc Partially allow loading of multi-field HRTFs
Only the first field actually gets used, but all the data is processed when
loading.
2019-01-22 10:27:04 -08:00
Chris Robinson 1565d7e276 Add a sofa-info utility to check sofa files 2019-01-21 10:23:17 -08:00
Chris Robinson c239ae44f8 Add a FindMySOFA cmake module 2019-01-21 10:21:13 -08:00
Chris Robinson d1a8607515 Handle a missing default WASAPI device ID 2019-01-18 17:23:46 -08:00
Chris Robinson 40c6f74bb7 Add front and back methods to FlexArray 2019-01-17 02:23:57 -08:00
Chris Robinson 101be788e1 Replace a couple more C math calls 2019-01-14 22:30:18 -08:00
Chris Robinson 867161d55f Constify some parameters 2019-01-12 21:08:34 -08:00
Chris Robinson 5b382a69b6 Avoid implicit conversions from signed to unsigned 2019-01-12 18:08:43 -08:00
Chris Robinson d64eaba322 Use a flexible array for DirectHrtfState and ALvoice 2019-01-12 01:25:33 -08:00
Chris Robinson ab16671466 Use a flexible array for HrtfHandle and SampleConverter 2019-01-11 22:09:57 -08:00
Chris Robinson f8c2e54b47 Make the min/max/clamp functions constexpr 2019-01-11 21:04:50 -08:00
Chris Robinson 77447fcd54 Add placement operator delete 2019-01-11 20:06:23 -08:00
Chris Robinson 852c5005ab Add a missing include 2019-01-11 08:07:25 -08:00
Chris Robinson 81e7222633 Use a flexible array for the active effect slots 2019-01-11 07:28:44 -08:00
Chris Robinson 8aedaea5fb Add a flexible array template container 2019-01-11 06:00:41 -08:00
Chris Robinson e7d77f5caa Use a vector for ALeffectslotArray 2019-01-09 18:29:22 -08:00
kcat 30184613a5 Merge pull request #264 from ShFil119/impr/cleanup
Cleanup continuation
2019-01-09 17:16:28 -08:00
Filip Gawin f7fe15e1ce Use = default to define trivial dtor/ctor 2019-01-09 19:57:35 +01:00
Filip Gawin 6ddb2c36fc Remove redundant void argument list in function def 2019-01-09 19:43:54 +01:00
Filip Gawin 4169c6f37d Use c++ headers 2019-01-09 19:42:40 +01:00
Chris Robinson 8f35f464a1 Change a true/false ALenum atomic into a bool 2019-01-09 01:06:19 -08:00
Chris Robinson b49c45d3a4 Add prefixes for ALCdevice and ALCcontext 2019-01-09 00:31:57 -08:00
Chris Robinson 673983dc5d Make Create methods for structs with flexible array members ...
... that are used with unique_ptr.
2019-01-08 23:44:08 -08:00
Chris Robinson bc1eeb5df0 Avoid calling unique_ptr::reset with a raw pointer 2019-01-08 23:15:58 -08:00
Chris Robinson 173c97c2db Remove an unused macro 2019-01-08 21:51:56 -08:00
Chris Robinson a46f1f810d Rename ALC_SOFT_loopback2 and renumber its enums 2019-01-08 20:02:36 -08:00
Chris Robinson d7eee03272 Replace a couple more C-style casts 2019-01-08 19:08:03 -08:00
Chris Robinson 0763dfa954 Apply the all-pass separately from the upsampling mix 2019-01-08 18:34:45 -08:00
Chris Robinson edba7da8ab Avoid macros for indexing HF and LF fequency bands 2019-01-08 17:21:22 -08:00
Chris Robinson 0c3662d8b2 Fix some comments and reduce indentation 2019-01-08 17:21:22 -08:00
kcat 009d738c1e Merge pull request #261 from ShFil119/avoid_old_style_casts
Avoid using old style casts
2019-01-08 17:19:15 -08:00
Filip Gawin 0d3a0635d9 Avoid using old style casts
To think about:
examples/alffplay.cpp:600
OpenAL32/Include/alMain.h:295
2019-01-08 19:42:44 +01:00
kcat 2a7f27ca58 Merge pull request #260 from ShFil119/impr/nullptr
Use nullptr in cpp files
2019-01-07 04:36:50 -08:00
Chris Robinson 4d047e2bc1 Use user-defined literals for 64-bit literals 2019-01-07 04:06:40 -08:00
Filip Gawin 0537414baf Use nullptr in cpp files 2019-01-07 12:37:13 +01:00
Chris Robinson 67c9cf8174 Define logging calls to be unlikely 2019-01-07 01:13:06 -08:00
Chris Robinson 648b76ed65 Move some macros to a common header 2019-01-07 01:12:09 -08:00
Chris Robinson 20a5306bdf Clean up some initializers and use of C methods 2019-01-06 21:16:08 -08:00
Chris Robinson fababe76c4 Don't use the dual-band upsampler for basic ambisonic decoding 2019-01-06 17:45:44 -08:00
Chris Robinson f5b6d761ff Apply an all-pass on the existing output when upsampling ambisonics 2019-01-06 06:50:58 -08:00
Chris Robinson 13056b45b0 Revert back to using a band-splitter to increase the HF response
Unfortunately the shelf filter causes issues due to the shelf gain magnitude
creating a varying phase offset. The splitter also creates phase offsets, but
it's consistent regardless of gain.
2019-01-06 05:15:11 -08:00
Chris Robinson d2e34e509b Make the band-splitter and splitter-allpass filters templated
With float and double explicit instantiations
2019-01-06 04:45:35 -08:00
Chris Robinson da3a916042 Replace macros with constexpr inline functions 2019-01-06 04:16:51 -08:00
Chris Robinson 98f3e6a162 Remove an unnecessary undef 2019-01-06 02:49:24 -08:00
Chris Robinson e645d25b62 Use double-precision biquads for the HRTF shelf filters 2019-01-06 00:54:39 -08:00
Chris Robinson 607e778344 Make BiquadFilter a templated class
With explicit instantiations for float and double
2019-01-06 00:53:02 -08:00
Chris Robinson 03aeb7edf6 Use a shelf filter for the HRTF B-Format decoder HF scale 2019-01-06 00:23:15 -08:00
Chris Robinson 3b91010e21 Pass the normalized crossover frequency to the reset method 2019-01-05 22:31:13 -08:00
Chris Robinson aa29bf5933 Remove unnecessary structs and buffers 2019-01-05 22:24:38 -08:00
Chris Robinson 3f35fcc4b5 Simplify MixParams and AmbiUpsampler
Since the dry buffer is always an ambisonic target now
2019-01-05 21:59:04 -08:00
Chris Robinson cff20c2fe8 Use BFormatDec for custom and built-in ambisonic decoding 2019-01-05 19:21:25 -08:00
Chris Robinson 641bbf075d Enable simplified upsampling for AmbiUpsampler 2019-01-05 00:23:06 -08:00
Chris Robinson 6d7e8cf8b0 Simplify the BFormatDec upsampler
Since the only difference applied is a scalar on the high-frequency response, a
B-Format-to-B-Format transcode can be accomplished with a high-shelf filter. A
similar thing can be done with AmbiUpsampler, but only when outputing to
periphonic B-Format.
2019-01-04 22:17:30 -08:00
Chris Robinson 0a6748156d Make sure the OpenSL capture buffer queue has the correct size
The ring buffer size may round up and have more queueable elements than OpenSL
was allocated with, leading to errors when queueing those extra elements. Now
OpenSL allocates the same number of elements that can be written to the ring
buffer.
2019-01-03 18:16:46 -08:00
Chris Robinson 21a17620e3 Fix the ringbuffer write limit
Previously it just limited the returned write space, irrespective of how much
had already been written. The buffer could still be filled up by doing multiple
writes. Now the size is limited by adjusting the read pointer by the real vs
limited difference when calculating the writable space.
2019-01-03 15:54:18 -08:00
Chris Robinson 88c2f11dcf Use DeviceRef and ContextRef when creating a new device and context 2019-01-01 22:44:46 -08:00
Chris Robinson 399dfca1e3 Rename ALCdevice_struct and ALCcontext_struct
A (possibly contentious?) change in the public headers. Those names were never
part of any specification, and I don't know why the struct names differed from
the actual type name. But with C++, which takes the original struct declaration
as the original name, it was affecting the type's internal symbols.

This shouldn't affect user code since ALCdevice_struct and ALCcontext_struct
were never part of the spec. If issues arise from this change, it should be
reported.
2019-01-01 18:13:33 -08:00
Chris Robinson 1630a33567 Use standard unique_lock and lock_guard for the backend lock 2019-01-01 16:42:54 -08:00
Chris Robinson 2f1566e0b4 Add and use a make_unique function 2019-01-01 14:33:01 -08:00
Chris Robinson c36798fd07 Avoid unnecessary extra buffers for filter chains 2019-01-01 02:41:27 -08:00
Chris Robinson e930c70eaa Don't make BiquadFilter's src and dst restrict
There's no technical reason they can't be the same since IIR filters can't be
auto-vectorized anyway.
2019-01-01 00:04:46 -08:00
Chris Robinson a9e71c2668 Handle all input channels in MixDirectHrtf 2018-12-31 23:33:04 -08:00
Chris Robinson 0452c9201d Add a missing include 2018-12-31 20:51:51 -08:00
Chris Robinson 87143b6645 Remove some C-isms from makehrtf
Remove unnecessary typedefs, use C++11 stamndard types and values, avoid
explicit allocations.
2018-12-31 19:54:34 -08:00
Chris Robinson 4c4572ae8a Compile makehrtf as C++ 2018-12-31 18:23:30 -08:00
Chris Robinson d8eecc89e0 Pass a reference to an array instead of a pointer 2018-12-31 18:07:00 -08:00
Chris Robinson 5a9a1c8d7d Further improve HRTF methods to avoid masking in the inner loops 2018-12-31 04:12:20 -08:00
Chris Robinson 5e03941701 Use an atomic bool on things that only take true or false 2018-12-30 21:58:14 -08:00
Chris Robinson 9f5c9a2260 Rename BackendLock to StateLock 2018-12-30 21:38:42 -08:00
Chris Robinson 3df1d185f8 Don't make the backend's lock/unlock methods noexcept 2018-12-29 17:29:52 -08:00
Chris Robinson 24e763f2a1 Get rid of ALCdevice_Lock/Unlock 2018-12-29 14:00:34 -08:00
Chris Robinson bdf7c16cfb Clean up a member name 2018-12-29 13:21:47 -08:00
Chris Robinson 8a84e7b662 Use member functions for the sample and channel converters 2018-12-29 12:26:45 -08:00
Chris Robinson 9b0b722d72 Add missing includes for mem_fn 2018-12-29 03:11:06 -08:00
Chris Robinson 63fc74beaa Don't bother with an explicit Loopback backend type 2018-12-29 02:21:53 -08:00
Chris Robinson 71a4d6db6f Return a unique_ptr for the backend 2018-12-29 02:16:16 -08:00
Chris Robinson 3c637d5fd7 Make the backend type an enum class 2018-12-29 01:38:26 -08:00
Chris Robinson 8fd4477215 Get CoreAudio capture samples in one call 2018-12-28 23:19:49 -08:00
Chris Robinson 3d92e8c4df Convert the backends to use proper inheritence 2018-12-28 22:56:20 -08:00
Chris Robinson 67b874328d Use static_cast instead of reinterpret_cast where possible 2018-12-28 16:13:28 -08:00
Chris Robinson 01ed98c99b Finish turning ancillary backend methods into member functions 2018-12-28 15:09:51 -08:00
Chris Robinson b7f5166d59 Turn even more methods into member functions 2018-12-28 14:06:15 -08:00
Chris Robinson 200e267b81 Turn some more methods into member functions 2018-12-28 12:58:01 -08:00
Chris Robinson 983904bbdc Add a method to prefix logged function names 2018-12-28 12:29:05 -08:00
Chris Robinson aff58265cb Make more methods into member functions 2018-12-27 23:37:24 -08:00
Chris Robinson 28308226e7 Turn more methods into member functions 2018-12-27 21:50:54 -08:00
Chris Robinson 885f68268f Turn more methods into member functions 2018-12-27 20:24:35 -08:00
Chris Robinson 015a4b060b Make some ancillary methods into member functions 2018-12-27 19:38:02 -08:00
Chris Robinson 0f36459028 Use vectors instead of malloc'd buffers 2018-12-27 18:33:49 -08:00
Chris Robinson 465ab11748 Finish renaming backend struct fields 2018-12-27 17:48:02 -08:00
Chris Robinson e48b8c4cda Rename some more struct members for consistency 2018-12-27 17:09:14 -08:00
Chris Robinson 515edc3dee Fix ring buffer vector methods 2018-12-27 15:05:12 -08:00
Chris Robinson f2c2b7c538 Get rid of the unnecessary STATIC_(UP)CAST macros 2018-12-27 14:27:35 -08:00
Chris Robinson 4782d6107d Use a proper constructor/destructor for the ALCbackend base 2018-12-27 13:40:43 -08:00
Chris Robinson 7880f27054 Rename DSound class members for consistency 2018-12-27 13:07:14 -08:00
Chris Robinson 1a4387d137 Return unique_ptrs instead of raw pointers
For the ring buffer, channel converter, and sample converter.
2018-12-27 12:55:43 -08:00
Chris Robinson 323cf58f02 Simplify resampling with CoreAudio capture
The ringbuffer holds the samples from the device, and we use our own converter
for resampling, calling it on demand with data from the ring buffer.
2018-12-27 12:04:18 -08:00
Chris Robinson 4dca2f2ee5 Use a unique_ptr for the AsyncEvents ringbuffer 2018-12-27 10:44:02 -08:00
Chris Robinson be85ab6f82 Rename some ALSA class members for consistency 2018-12-27 10:34:22 -08:00
Chris Robinson c3f370fa41 Constify and reorder a couple device fields 2018-12-27 10:25:09 -08:00
Chris Robinson 7d821551ac Recognize ambix as an alias for acn+sn3d 2018-12-27 01:18:10 -08:00
Chris Robinson d367093c06 Use std::array for appropriate source and listener properties 2018-12-26 22:27:34 -08:00
Chris Robinson a4ac43b602 Avoid a lambda to find a not-null entry in an array 2018-12-26 21:55:39 -08:00
Chris Robinson 8a0295503d Clean up the ring buffer struct and use member functions 2018-12-26 21:22:17 -08:00
Chris Robinson 4f253a935a Handle HRTF coefficients and values by reference where possible 2018-12-26 15:35:05 -08:00
Chris Robinson c5be03b51e Avoid masking in ApplyCoeffs's inner loop
This unfortunately does not apply to NEON, which would need a bit more
reworking of its method.
2018-12-26 14:59:21 -08:00
Chris Robinson 5c449de73f Improve UHJ2 encoding 2018-12-26 13:20:59 -08:00
Chris Robinson 3b9defa4af Improve some post-process handlers 2018-12-26 12:46:01 -08:00
Chris Robinson 5cc545f157 More aggressively try to decrement an effect's refcount in-place 2018-12-26 12:25:34 -08:00
Chris Robinson 38537a35cc Avoid using a local for a temporary 2018-12-25 22:32:30 -08:00
Chris Robinson b2665a503f Do some pre-mixing fading checks once before preparing to mix 2018-12-25 19:54:14 -08:00
Chris Robinson a7c58decfb Add a couple more ASSUMEs for number of channels and sends 2018-12-25 18:49:12 -08:00
Chris Robinson 497226f11e Add an adjust-latency config option for PulseAudio 2018-12-25 17:04:54 -08:00
Chris Robinson 6a8c791e3c Rework the pulseaudio backend to avoid an explicit mixer thread 2018-12-25 16:31:31 -08:00
Chris Robinson 0314370eb5 Cache the process binary path and name 2018-12-25 11:27:22 -08:00
Chris Robinson 208ea76922 Cleanup some includes 2018-12-25 11:09:41 -08:00
Chris Robinson 8336de6653 Rename a couple filter files for consistency 2018-12-25 10:28:02 -08:00
Chris Robinson 9e19acd9e1 Avoid making static local copies of constexpr values 2018-12-25 10:06:17 -08:00
Chris Robinson 63df7cd537 Construct AsyncEvent objects directly in the ringbuffer 2018-12-25 09:32:38 -08:00
Chris Robinson 3b7f668b28 Avoid an intermediate mixing buffer 2018-12-24 20:44:55 -08:00
Chris Robinson fbae41020d Remove extraneous typedef, struct, and enum keywords 2018-12-24 19:29:01 -08:00
Chris Robinson 194e7ff815 Add an in-progress extension to set the effect slot target 2018-12-24 15:52:37 -08:00
Chris Robinson bbf9e6931c Propagate an effectslot target property 2018-12-24 15:17:38 -08:00
Chris Robinson ae86aef4db Provide effect target parameters through a common struct 2018-12-24 13:29:36 -08:00
Chris Robinson cd213fe6b7 Avoid using select() 2018-12-24 09:58:48 -08:00
Chris Robinson 95631aa358 Make the Compressor more class-like 2018-12-24 09:17:00 -08:00
Chris Robinson d49eeb576c Only check ambisonic attributes with B-Format output 2018-12-24 07:33:38 -08:00
Chris Robinson 68352d3188 Apply the limiter before distance compensation 2018-12-24 07:30:01 -08:00
Chris Robinson ef10152361 Assume alignment for some buffers 2018-12-23 20:56:27 -08:00
Chris Robinson 1f966c11ef Add some more ASSUMEs 2018-12-23 17:56:01 -08:00
Chris Robinson 11d815cfd3 Repack some AmbiUpsampler fields for better access patterns 2018-12-23 15:55:12 -08:00
Chris Robinson ba9aba699d Properly rebalance the HF scale with ambisonic upsampling 2018-12-23 10:37:07 -08:00
Chris Robinson 3fe38fed7c Mix effect slot output to the effect target if it's set 2018-12-23 08:51:28 -08:00
Chris Robinson e218999b4f Dynamically sort the effect slots when mixing
This is to be able to support effects that output to other effects. When an
effect outputs to another effect, the former needs to process first, so the
former mixes to the latter's buffer before the latter is processed.

This sorting needs to happen in the mixer because the effect slot's "Target"
property changes asynchronously.
2018-12-22 22:31:26 -08:00
Chris Robinson ebfe818d2e Fix narrowing conversion from double to float 2018-12-22 20:32:00 -08:00
Chris Robinson bfa98be48a Cleanup definitions and declarations in reverb.cpp 2018-12-22 19:31:12 -08:00
Chris Robinson 86caf2683e Constify a parameter 2018-12-22 18:43:34 -08:00
Chris Robinson 334b3a905a Clean up some math stuff 2018-12-22 16:01:14 -08:00
Chris Robinson d4d98e2fe9 Fix for C++11 compatibility
std::array::operator[] isn't constexpr until C++14.
2018-12-22 11:41:03 -08:00
Chris Robinson 10ce121dbd Use a normal delete instead of ll_ringbuffer_free
And use RingBufferPtr in more places
2018-12-22 11:38:38 -08:00
Chris Robinson b955c5cf5d A bit of cleanup for CalcPanningAndFilters 2018-12-22 10:00:06 -08:00
Chris Robinson 87724db6e3 Rename a couple HRTF structs 2018-12-22 09:20:50 -08:00
Chris Robinson 985d03d13d Try to help GetHrtfCoeffs vectorize 2018-12-21 21:07:42 -08:00
Chris Robinson 5e4378f30a Small cleanup for BuildBFormatHrtf 2018-12-21 18:17:59 -08:00
Chris Robinson 3553ce1f67 Don't convert the HRTF decoder virtual speaker positions to radians 2018-12-21 08:55:22 -08:00
Chris Robinson b785d80526 Use a dodecahedron for the ambisonic HRTF decode
Also uses full second-order for "basic" HRTF rendering. Note that the supplied
matrix is full third-order, but only the first- and second-order coefficients
are used. The base matrices are the identical, only differing by the high-
frequency scalars.
2018-12-21 06:32:18 -08:00
Chris Robinson 7744e4ff72 Pass RealMixParams by reference instead of pointer 2018-12-20 13:26:39 -08:00
Chris Robinson 9fde260df9 Fix the type used for another subtraction 2018-12-20 12:29:46 -08:00
Chris Robinson 768ed3cfbb Silence some MSVC warnings 2018-12-20 12:04:34 -08:00
Chris Robinson 837881eb79 Fix the type used for subtraction 2018-12-20 12:03:32 -08:00
Chris Robinson 7dc553350b Clean up most of the compressor loops 2018-12-20 11:46:57 -08:00
Chris Robinson 08b79b9bbf Add an assume_aligned helper 2018-12-20 11:46:40 -08:00
Chris Robinson 10f87c5d26 Use std::accumulate to get the max composited buffer length loaded 2018-12-20 07:10:09 -08:00
Chris Robinson 49ac268334 Add index maps from 2D and 3D 2018-12-20 04:19:35 -08:00
Chris Robinson 8d3f7651c9 Use std::array in place of some C-style arrays 2018-12-20 03:26:46 -08:00
Chris Robinson d18140391a Rename some conversion arrays 2018-12-20 02:46:59 -08:00
Chris Robinson 0214a11024 Use inline methods for the device format sizes 2018-12-19 05:57:36 -08:00
Chris Robinson b49e8985a4 Don't hardcode the channel count from the device ambisonic order 2018-12-19 03:13:15 -08:00
Chris Robinson fbd47961d5 Don't allow FuMa ordering or normalization above third-order 2018-12-19 02:55:21 -08:00
Chris Robinson e2896dc839 Combine handling of attribute processing 2018-12-18 09:27:00 -08:00
Chris Robinson 5243516149 Use the AmbiUpsampler with higher order basic and custom panning
Also allocate the BFormatDec and AmbiUpsampler where they're (re)set.
2018-12-17 07:29:55 -08:00
Chris Robinson 59013b5cb5 Avoid hard-coded scale factors in BFormatDec's upsampler 2018-12-17 07:12:37 -08:00
Chris Robinson a359cb85e6 Mix each frequency band individually for ambisonic upsampling 2018-12-16 22:37:29 -08:00
Chris Robinson 3b0fd20bee Always use the transcode method with the AmbiUpsampler 2018-12-16 21:03:24 -08:00
Chris Robinson 064f4f500a Avoid extraneous alignment requirements 2018-12-16 01:27:52 -08:00
Chris Robinson 741861eaa6 Put the ACN index map in a header
Also put it and the Ambisonic scales in a more appropriate header.
2018-12-15 23:28:49 -08:00
Chris Robinson a6a5634adb Reorder some math terms to help optimizations
Because floating-point math is not associative ((a*b)*c does not necessarily
give the same result as a*(b*c)), the ordering of terms can inhibit reuse of
temporary values. For example, both

coeffs[9]  =  2.091650066f * y * (3.0f*x*x - y*y);
and
coeffs[15] =  2.091650066f * x * (x*x - 3.0f*y*y);

contain x*x and y*y terms that could be calculated once, stored in temporary
registers, and reused to multiply with 3. But since 3.0f*(x*x) would produce
different results, the compiler is not allowed to make that optimization. If,
however, the multiply with 3 is moved to the right side:

coeffs[9]  =  2.091650066f * y * (x*x*3.0f - y*y);
and
coeffs[15] =  2.091650066f * x * (x*x - y*y*3.0f);

in both cases x*x and y*y are calculated first in their respective groups,
guaranteeing the same results for both instances prior to the multiply with 3
and allowing the compiler to reuse those intermediate values.
2018-12-15 20:28:52 -08:00
Chris Robinson dea077cbae Add encoding calculations for fourth-order ambisonics 2018-12-15 19:23:42 -08:00
Chris Robinson e0f635b20d Move some ambisonic-related macros to a separate header 2018-12-15 03:30:47 -08:00
Chris Robinson 0dd13a9dfe Make the AmbDec speaker and matrix arrays dynamic 2018-12-15 02:56:19 -08:00
Chris Robinson 640c06c292 Avoid some explicit loop counts 2018-12-15 01:48:54 -08:00
Chris Robinson 4d36730baa Clean up panning.cpp a bit 2018-12-15 00:38:38 -08:00
Chris Robinson 2d13e0af29 Add macros for the ambisonic order masks 2018-12-14 23:26:44 -08:00
Chris Robinson 0882728dec Cleanup bformatdec.cpp a bit 2018-12-13 22:48:02 -08:00
Chris Robinson d18ae81e9c Add POPCNT32 and CTZ32 macros 2018-12-13 22:05:47 -08:00
Chris Robinson 0d73b13f59 Add more casts for MSVC 2018-12-12 21:58:41 -08:00
Chris Robinson b779ebb512 Fix some MSVC conversion warnings 2018-12-12 21:18:31 -08:00
Chris Robinson b37bc9f8b7 Fix an MSVC warning 2018-12-12 19:24:06 -08:00
Chris Robinson 43f6a7c626 Remove an unused source 2018-12-12 04:34:09 -08:00
Chris Robinson 5a283c66ee Use proper classes for Vector and Matrix types 2018-12-12 04:22:11 -08:00
Chris Robinson 19c5c41c70 Cleanup alu.cpp some 2018-12-12 01:09:04 -08:00
Chris Robinson 0d36ba0fbb Use helpers to get the Ambisonic scales and layout maps 2018-12-10 22:35:32 -08:00
Chris Robinson e87eb07db4 A bit more cleanup 2018-12-10 21:30:22 -08:00
Chris Robinson ed18fd76c5 Clean up a few more loops 2018-12-10 14:49:57 -08:00
Chris Robinson d91ada2e02 Add missing header 2018-12-10 02:13:57 -08:00
Chris Robinson 9bb7ed0129 Put static methods into an anonymous namespace 2018-12-10 02:08:54 -08:00
Chris Robinson 0d56c59f14 Avoid some more explicit loops 2018-12-10 00:01:13 -08:00
Chris Robinson 0a805727db Use std::accumulate to find the max channel count 2018-12-09 18:16:00 -08:00
Chris Robinson b1beb7dfdc Avoid some more explicit loops 2018-12-09 17:24:00 -08:00
Chris Robinson efb8e076c7 Pass a reference to an array for a function parameter 2018-12-09 15:21:24 -08:00
Chris Robinson 6c8f45b5f6 Rename a couple global variables
Avoid clashing with an enum name
2018-12-09 15:07:44 -08:00
Chris Robinson d7d9870839 Add default construction to HrtfEntry 2018-12-09 13:36:13 -08:00
Chris Robinson 621f0dfe73 Use a vector for LoadedHrtfs 2018-12-09 03:04:18 -08:00
Chris Robinson e5db9b2378 Avoid static global initialization functions 2018-12-08 21:58:44 -08:00
Chris Robinson a4009c47e7 Add a cmake option to specify prebuilt native tools
This should only be used with automated build systems that guarantee the native
tools' binaries are up-to-date. Otherwise it's best to leave it alone so it can
automatically rebuild them as needed.
2018-12-08 17:22:10 -08:00
Chris Robinson 30a3a19574 Rename a member variable and inline a function 2018-12-08 16:30:19 -08:00
Chris Robinson c9f5617f06 Avoid several uses of memset 2018-12-08 14:22:20 -08:00
Chris Robinson fc8da0c16b Add missing include 2018-12-08 13:06:31 -08:00
Chris Robinson 5a9a2cb1ed Increase GAIN_MIX_MAX 2018-12-08 04:10:59 -08:00
Chris Robinson 9e9b771e8a A bit more cleanup 2018-12-08 04:10:45 -08:00
Chris Robinson 5ea3c8fb60 Use member functions for BFormatDec and AmbiUpsampler 2018-12-08 02:50:34 -08:00
Chris Robinson 7695afe0cb Clean up some more loops 2018-12-08 02:15:00 -08:00
Chris Robinson a603cc906f Inline a simple method 2018-12-08 00:08:39 -08:00
Chris Robinson ab5a11d5f3 Avoid using the deprecated mem_fun_ref method 2018-12-07 21:46:22 -08:00
Chris Robinson 6e4c856257 Add fourth-order methods to the NFC filter
Unused, but it finishes out the currently possible implementations.
2018-12-07 18:38:56 -08:00
Chris Robinson 0f24139b57 Use a constructor instead of a macro to initialize AsyncEvent 2018-12-06 22:24:20 -08:00
Chris Robinson 42d26472eb Remove some more explicit loops 2018-12-05 17:11:33 -08:00
Chris Robinson e60d0886d0 Use class methods for BandSplitter and SplitterAllpass filters 2018-12-05 15:38:05 -08:00
Chris Robinson 10b39d57d5 Use class methods for the NFC filters 2018-12-05 15:20:52 -08:00
Chris Robinson 164a86a381 Use class methods for the biquad filter 2018-12-04 22:31:08 -08:00
Chris Robinson 36a8b615c8 Avoid using AL types with the filters 2018-12-04 20:55:10 -08:00
Chris Robinson 2a30ae3807 Avoid some more explicit loops in the filters 2018-12-04 20:35:23 -08:00
Chris Robinson 3866c9f941 Avoid more explicit loops 2018-12-04 19:45:11 -08:00
Chris Robinson a94bfd3ec9 Increase the async event queue size 2018-12-04 16:38:22 -08:00
Chris Robinson 6409910543 Handle EventType_BufferCompleted uniquely 2018-12-04 16:33:26 -08:00
Chris Robinson f79b0e24d4 Avoid a few more explicit loops 2018-12-04 15:30:39 -08:00
Chris Robinson a0967967de Read atomic variables in the reverse order they're set 2018-12-04 14:48:08 -08:00
Chris Robinson 31b54eb86a Avoid a few more explicit loops 2018-12-03 01:41:52 -08:00
Chris Robinson 85e83bbdff Use a std::string for the source state change message 2018-12-02 19:34:09 -08:00
Chris Robinson 45b65366bb Improve some checks for compiler analysis 2018-12-02 15:29:26 -08:00
Chris Robinson 60254488e9 Add a couple missing source lock guards 2018-12-02 14:36:53 -08:00
Chris Robinson 4e17ad3ec0 Avoid a few more explicit loops 2018-12-02 13:35:07 -08:00
Chris Robinson 607fb3e632 Use a lambda to apply the NFC mixes 2018-12-01 23:25:34 -08:00
Chris Robinson e1af866a3d Rework source sample counting for mixing a bit 2018-12-01 13:47:56 -08:00
Chris Robinson 255c07def9 Try to pacify MSVC's missing a suitable default constructor 2018-12-01 11:28:11 -08:00
Chris Robinson cc161fe7c1 Add a missing include 2018-12-01 01:12:05 -08:00
Chris Robinson 7b1548af3c Handle source state changed events uniquely in the event loop
To avoid the need of constructing the string in the mixer thread, which is
commonly formatted anyway.
2018-11-30 21:39:59 -08:00
Chris Robinson 1e6e84374b Use std::array for the voice's PrevSamples 2018-11-30 21:23:43 -08:00
Chris Robinson c7569c31ad Improve construction and destruction of ALvoices 2018-11-30 19:04:38 -08:00
Chris Robinson 4b7ac4a6ed Don't bother making ALvoiceProps dynamically sized 2018-11-30 16:56:23 -08:00
Chris Robinson 364850e8f9 Move a variable declaration to a more appropriate place 2018-11-30 10:08:18 -08:00
Chris Robinson b582f1346a Avoid hard-coding a couple sizes 2018-11-29 22:56:33 -08:00
Chris Robinson 8ca8da30bd Store the source ID with the voice instead of the source pointer 2018-11-29 22:49:01 -08:00
Chris Robinson 0d2bbe17f2 Rename a function for consistency 2018-11-29 13:34:06 -08:00
Chris Robinson c5d5d574e6 Reorganize some device members 2018-11-29 13:10:46 -08:00
Chris Robinson 57bb467072 Pass the desired resampler to CreateSampleConverter 2018-11-28 23:19:25 -08:00
Chris Robinson e017d9e40f Clean up the converter a bit 2018-11-28 22:42:46 -08:00
Chris Robinson 5df89c504e Remove an improper Connected check 2018-11-28 19:29:20 -08:00
Chris Robinson 38f4a0cf2c Avoid the update size going to 0 with a relatively large device period 2018-11-28 18:45:35 -08:00
Chris Robinson c3c0a5022a Don't bother with (really) old pulseaudio headers 2018-11-28 15:09:19 -08:00
Chris Robinson 14d746e7c2 Don't sever a paused source from its voice on disconnect 2018-11-28 14:38:26 -08:00
Chris Robinson 598851fed7 Attempt to reconnect lost devices with alcResetDeviceSOFT
Be aware there's currently possible race conditions with PulseAudio's callbacks
(the state callbacks need to be cleared while not playing).

Also paused sources will assert/crash if attempted to play again without being
explicitly stopped or rewound first.

Both of these will eventually be fixed (though a paused source's offset will be
lost regardless).
2018-11-28 12:24:12 -08:00
Chris Robinson 16aa3ab196 Reduce some indentation 2018-11-28 11:55:43 -08:00
Chris Robinson ed2e456dfb Avoid some explicit loops 2018-11-28 11:30:44 -08:00
Chris Robinson 8d95b6a0f2 Avoid an unnecessary lambda 2018-11-28 08:42:30 -08:00
Chris Robinson ec2927cd32 Small cleanup for ~ALCcontext_struct 2018-11-27 21:19:30 -08:00
Chris Robinson ff8c694957 Clean up the JACK backend 2018-11-27 20:29:54 -08:00
Chris Robinson 0116e763ea Add a unique_ptr alias for the ringbuffer 2018-11-27 19:49:45 -08:00
Chris Robinson 2179388430 Remove unneeded mutex checks 2018-11-27 15:23:18 -08:00
Chris Robinson c2da83dea8 Avoid alsem* wrappers for al::semaphore 2018-11-27 14:52:04 -08:00
Chris Robinson 89abbe8d94 Replace last uses of alsem_t with al::semaphore 2018-11-27 14:05:56 -08:00
Chris Robinson f26083e9ed Make and use a semaphore class 2018-11-27 13:41:30 -08:00
Chris Robinson 3f745be1dc Return a signed integer from altime_get 2018-11-27 12:11:11 -08:00
Chris Robinson ff6dda06ad Add the appropriate include for the _POSIX_TIMERS macro 2018-11-27 10:35:00 -08:00
Chris Robinson 07670ed36a Swap context references in the move assignment 2018-11-27 10:08:25 -08:00
Chris Robinson ee2d756d94 Disable MSVC warning C4065
"switch statement contains 'default' but no 'case' labels"
2018-11-27 00:04:55 -08:00
Chris Robinson 9b2b83f99c Fix use of clock_gettime 2018-11-27 00:02:31 -08:00
Chris Robinson 2530370ff2 Avoid relying on struct timespec 2018-11-26 23:45:04 -08:00
Chris Robinson d7d99adc91 Avoid including threads.h in the example helpers 2018-11-26 23:18:51 -08:00
Chris Robinson d06f76957c Remove althrd_yield 2018-11-26 23:06:49 -08:00
Chris Robinson 4c1fc3ae00 Remove unused almtx stuff 2018-11-26 22:36:55 -08:00
Chris Robinson 2d45ec8dc3 Use a standard mutex for the remaining locks 2018-11-26 22:06:53 -08:00
Chris Robinson 68eef6abb4 Use a standard mutex for the source and effect slot locks 2018-11-26 21:50:48 -08:00
Chris Robinson 2e73c2ca92 Use a standard mutex for the proplock 2018-11-26 21:39:31 -08:00
Chris Robinson d8b9230ee4 Use a standard mutex for the backend lock 2018-11-26 21:39:31 -08:00
Chris Robinson b108d0acfd Remove the last remaining uses of althrd_t 2018-11-26 21:39:31 -08:00
kcat 7860a11ae2 Merge pull request #249 from wangwenx190/patch-win10-sdk
Support build with latest Win10 SDK
2018-11-26 21:39:05 -08:00
wangwenx190 00ad4a2f5d Update FindWindowsSDK.cmake 2018-11-27 13:20:04 +08:00
wangwenx190 9070426ece Update FindWindowsSDK.cmake
Support latest Win10 SDK.
2018-11-27 13:18:30 +08:00
Chris Robinson 9ac76c0a7f Simplify some binary search lookups 2018-11-26 20:55:00 -08:00
Chris Robinson bf9db1fe3d Remove althrd_t from Windows 2018-11-26 20:34:16 -08:00
Chris Robinson ecab90802a Replace some uses of althrd_t with std::thread 2018-11-26 20:06:22 -08:00
Chris Robinson 05390fa827 Add a missing std::begin 2018-11-26 19:01:14 -08:00
Chris Robinson 75b39cafc8 Get rid of some unnecessary functions 2018-11-26 18:25:29 -08:00
Chris Robinson df3dcc879f Get rid of the last ATOMIC macro uses 2018-11-26 18:19:58 -08:00
Chris Robinson 461ef4196e Avoid using ATOMIC_LOAD on ALCdevice::Connected 2018-11-26 18:07:52 -08:00
Chris Robinson 1a9edd4e35 Use a unique_ptr for the QSA backend data 2018-11-26 17:53:56 -08:00
Chris Robinson 04c2802a82 Rename some struct members 2018-11-26 17:31:04 -08:00
Chris Robinson 04cbdbd569 Remove some unused macros 2018-11-26 14:53:20 -08:00
Chris Robinson 053599b243 Avoid using the ATOMIC() macro 2018-11-26 14:48:26 -08:00
Chris Robinson a6923790fa Avoid using ATOMIC_INIT 2018-11-26 14:31:54 -08:00
Chris Robinson 5b2b96b245 Don't explicitly clear vector objects in the destructor 2018-11-25 17:51:39 -08:00
Chris Robinson 127ec026e7 Automatically clean up filters and effects with their sublists 2018-11-25 16:16:40 -08:00
Chris Robinson 8ae07ad1ae Automatically clean up buffers with ther sublist 2018-11-25 15:30:32 -08:00
Chris Robinson 05845b53e8 Clean up MixSource 2018-11-25 13:20:26 -08:00
Chris Robinson ad2639248a Avoid another DECL_TEMPLATE macro 2018-11-25 10:52:17 -08:00
Chris Robinson adcdb8ce64 Fix an incorrect function call 2018-11-25 09:27:50 -08:00
Chris Robinson ec97360352 Avoid a separate function to clean up effect slots 2018-11-25 09:23:01 -08:00
Chris Robinson bf4518fe5c Atuomatically clean up sources with its sublist's destruction 2018-11-25 08:42:43 -08:00
Chris Robinson 7c0605f09e Properly initialize the sublists' freemask 2018-11-25 07:40:15 -08:00
Chris Robinson f5f2cdaaf3 Add a POPCNT64 macro
To count the number of 1/on bits in a 64-bit value
2018-11-24 21:16:53 -08:00
Chris Robinson 71660df5e5 Move bs2b.h to a more appropriate place 2018-11-24 19:54:30 -08:00
Chris Robinson 377325e794 Use C++ methods a bit more 2018-11-24 19:16:21 -08:00
Chris Robinson 9e10f632c7 Replace remaining uses of std::vector with al::vector
Which uses a custom allocator that uses our allocation functions.
2018-11-24 16:58:49 -08:00
Chris Robinson 16a60dc371 Avoid an extraneous boolean 2018-11-24 15:30:28 -08:00
Chris Robinson bd8db0d27b Make GetContextRef return a ContextRef 2018-11-24 14:07:32 -08:00
Chris Robinson 62d38b1187 Use RAII in alEffect.cpp 2018-11-24 13:23:27 -08:00
Chris Robinson 6a84a2ca61 Fix a couple comments 2018-11-24 12:09:37 -08:00
Chris Robinson d83cff02e5 Ensure an enum is the appropriate size/type 2018-11-24 11:41:50 -08:00
Chris Robinson b508a760c8 Use a normal vector to store buffer data 2018-11-24 10:07:48 -08:00
Chris Robinson 505e535655 Use RAII more with alFilter.cpp 2018-11-24 09:40:13 -08:00
Chris Robinson 48154c94d7 Use a unique_ptr while opening a device 2018-11-23 20:16:34 -08:00
Chris Robinson a7c556f814 Use RAII for device references 2018-11-23 17:54:12 -08:00
Chris Robinson df057d4118 Make the context VoiceCount atomic 2018-11-23 16:16:31 -08:00
Chris Robinson 73528c9f55 Fix an incorrect check 2018-11-23 14:42:02 -08:00
Chris Robinson fb94cdcfd3 Restructure and clean up alu.cpp a bit 2018-11-23 13:12:48 -08:00
Chris Robinson 438e626993 Avoid a couple explicit loops 2018-11-22 22:53:22 -08:00
Chris Robinson 976e49711b Add noexcept to a bunch of inline functions 2018-11-22 19:47:41 -08:00
Chris Robinson 30ee6e1b3f Make a DirectHrtfState constructor to try appeasing MSVC 2018-11-22 14:36:37 -08:00
Chris Robinson d26b5d9467 Use proper time types for the device clock time and latency 2018-11-22 14:32:48 -08:00
Chris Robinson 84f0f74d07 Use standard types for the device clock times 2018-11-22 12:53:16 -08:00
Chris Robinson bb9d8db73c Clean up alSource.cpp some 2018-11-22 12:02:02 -08:00
Chris Robinson cc938c34b2 Clean up the Chorus a little 2018-11-22 08:08:46 -08:00
Chris Robinson 9c155a57fb Use unique_ptr for DirectHrtfState 2018-11-22 07:54:29 -08:00
Chris Robinson ba8c865513 Add and use a macro to define placement-new-only allocators
This is for structs that utilize over-allocation, either flexible array
members, or which store optional additional objects in the same allocation
block.
2018-11-22 07:06:42 -08:00
Chris Robinson ab6db9a589 Clean up some unnecessary specifiers 2018-11-22 06:59:32 -08:00
Chris Robinson 9d73e03aaa Use unique_ptr for bs2b 2018-11-22 06:49:37 -08:00
Chris Robinson b3b4220182 Use unique_ptr for BFormatDec and AmbiUpsampler 2018-11-22 05:37:35 -08:00
Chris Robinson 671ed1abf8 Use a unique_ptr for the FrontStablizer 2018-11-22 04:53:29 -08:00
Chris Robinson cc3e2a838f Use a unique_ptr for the Compressor 2018-11-21 16:46:52 -08:00
Chris Robinson eefc379a23 Use a unique_ptr for Uhj2Encoder 2018-11-21 15:31:32 -08:00
Chris Robinson dfcc98afbf Fix deleting the same buffer ID multiple times in one call 2018-11-21 11:51:34 -08:00
Chris Robinson d20522166e Use RAII more in alSource.cpp 2018-11-21 11:11:25 -08:00
Chris Robinson 9f2a77f788 Use RAII when handling the mixer's FPU state 2018-11-21 09:07:02 -08:00
Chris Robinson 8f43f737ba Avoid using ATOMIC macros 2018-11-21 07:52:17 -08:00
Chris Robinson de4bb7aca1 Replace a couple more almtx_lock/unlock calls 2018-11-21 06:41:49 -08:00
Chris Robinson 75213ee6f9 Always use RAII with EffectSlotLock 2018-11-21 05:35:47 -08:00
Chris Robinson 757c42c74b Use a normal vector for the distance buffer storage 2018-11-21 05:06:31 -08:00
Chris Robinson 4c64fa1e4e Make VerifyContext return a context reference 2018-11-21 02:02:53 -08:00
Chris Robinson 8ec25da12e Rename a method to be clearer about its behavior 2018-11-21 00:40:41 -08:00
Chris Robinson ed06169569 Use RAII locks with the BackendLock 2018-11-20 23:42:21 -08:00
Chris Robinson d64d64d4a5 Use an enum class for AmbiLayout/Norm settings 2018-11-20 22:47:24 -08:00
Chris Robinson dc8ef8264a Try to improve alffplay underrun device time adjustment 2018-11-20 12:32:42 -08:00
Chris Robinson f3e01ae9d4 Use a normal vector for the source send properties 2018-11-20 12:25:15 -08:00
Chris Robinson a111254c26 Use C++ more in alListener.cpp 2018-11-20 11:17:54 -08:00
Chris Robinson f9e969a339 Use a standard mutex for the event callback lock 2018-11-20 10:55:57 -08:00
Chris Robinson 191ea90de3 Use atomic_flags and atomic<bools>s where appropriate 2018-11-20 10:45:01 -08:00
Chris Robinson 1e31ac469e Store effect slots as unique_ptrs 2018-11-20 10:01:20 -08:00
Chris Robinson 29558c091b Use C++ more in alAuxEffectSlot.cpp 2018-11-20 09:47:49 -08:00
Chris Robinson 1df42c4a0f Use a unique_ptr for the default effect slot 2018-11-20 05:01:08 -08:00
Chris Robinson 66fdd027d0 Use more C++ templates instead of DECL_TEMPLATE tricks 2018-11-20 03:35:41 -08:00
Chris Robinson c7472f8642 Use C++ templates instead of macro definitions more 2018-11-20 02:59:02 -08:00
Chris Robinson 16d0e79db7 Add compile-time traits for FmtType enum values 2018-11-20 02:42:49 -08:00
Chris Robinson 457d484872 Use C++ templates instead of macro-defined variations 2018-11-20 02:12:04 -08:00
Chris Robinson 5881cd2183 Add compile-time traits for DevFmtType enum values 2018-11-20 02:01:03 -08:00
Chris Robinson eb2937de84 Avoid another case of a variable named the same as a type 2018-11-19 23:48:45 -08:00
Chris Robinson 288dbbe886 Use default initialization for the reverb effect state 2018-11-19 22:48:56 -08:00
Chris Robinson 8995306203 Use proper templating for the modulator's Modulate function 2018-11-19 22:43:28 -08:00
Chris Robinson 8472a9d916 Use proper inheritence for the effect state objects 2018-11-19 22:34:26 -08:00
Chris Robinson 6ac84c7a5f Clean up the remaining effect struct member names 2018-11-19 21:04:50 -08:00
Chris Robinson 67da3850cb Use a normal vector for the echo buffer 2018-11-19 20:15:40 -08:00
Chris Robinson a346380e2b Clean up more effects' struct members 2018-11-19 19:57:30 -08:00
Chris Robinson 7f3584ec4c Fix the reverb buffer size calculation 2018-11-19 19:13:44 -08:00
Chris Robinson 4810def613 Use a normal vector for the chorus sample buffer 2018-11-19 19:08:30 -08:00
Chris Robinson ba33f6a7a4 Clean up the chorus/flanger struct members 2018-11-19 18:51:01 -08:00
Chris Robinson 3ae1c78d1a Use std::isfinite instead of isfinite 2018-11-19 09:51:29 -08:00
Chris Robinson ddfed7187f Use a regular vector for the reverb sample buffer 2018-11-19 09:36:59 -08:00
Chris Robinson 55637ff1fc Rename reverb struct members 2018-11-19 09:29:22 -08:00
Chris Robinson 387a34ca00 Clean up the biquad filter a bit 2018-11-19 09:10:36 -08:00
Chris Robinson 07386e79de Fix up the struct member names in the autowah effect 2018-11-19 09:06:17 -08:00
Chris Robinson f51f6703d8 Add a missing include 2018-11-19 06:50:37 -08:00
Chris Robinson c5c537cc5f Use proper inheritence for EffectStateFactory 2018-11-19 06:43:37 -08:00
Chris Robinson f0cc34a60e Use a vector to handle mixing buffer storage 2018-11-19 06:22:09 -08:00
Chris Robinson f766437569 Fix a couple incorrect uses of ringbuffer pointer data 2018-11-19 05:07:09 -08:00
Chris Robinson ac2a420351 Remove the ATOMIC_THREAD_FENCE macro 2018-11-19 05:04:17 -08:00
Chris Robinson ad5f9d9b22 Return the ringbuffer data pointers as a pair 2018-11-19 04:46:49 -08:00
Chris Robinson a14f39ea06 Make ll_ringbuffer_write/read take void*/const void* 2018-11-19 04:11:21 -08:00
Chris Robinson c01743fe5d Remove the CONST_CAST hack 2018-11-19 03:53:31 -08:00
Chris Robinson e6c2c1f3b6 Remove unnecessary using statements 2018-11-19 03:32:16 -08:00
Chris Robinson e24435ef58 Remove the atomic exchange macros 2018-11-19 03:21:58 -08:00
Chris Robinson c5142530d6 Simplify the RefCount type 2018-11-19 02:17:06 -08:00
Chris Robinson 6e114a7a70 Replace ATOMIC_REPLACE_HEAD with an inline function 2018-11-19 01:20:03 -08:00
Chris Robinson 190de1452e Remove the unused vector macros 2018-11-18 23:37:56 -08:00
Chris Robinson dbf2381a3b Use a normal vector in the QSA backend 2018-11-18 23:23:12 -08:00
Chris Robinson e0d0faaa63 Use a normal vector for filter sublists 2018-11-18 23:02:31 -08:00
Chris Robinson 362979cefb Use a normal vector for effect sublists 2018-11-18 22:50:04 -08:00
Chris Robinson 81aed2ea01 Use a normal vector for buffer sublists 2018-11-18 22:31:51 -08:00
Chris Robinson becbaab2dc Remove some unnecessary static specifiers 2018-11-18 22:14:44 -08:00
Chris Robinson e23796aabe Use a standard string for the enumerated HRTF names 2018-11-18 21:18:19 -08:00
Chris Robinson 140c139852 Use a standard string for the device's HRTF name 2018-11-18 19:28:01 -08:00
Chris Robinson 2c06ec7093 Use a regular vector for the enumerated HRTF list 2018-11-18 19:19:35 -08:00
Chris Robinson bafcba7194 Use a std::string for the device name 2018-11-18 18:45:45 -08:00
Chris Robinson b10e7d08c3 Use a std::thread for the event thread 2018-11-18 18:04:27 -08:00
Chris Robinson ef7995cfd0 Fix the initial device refcount 2018-11-18 08:14:23 -08:00
Chris Robinson aef52be432 Fix a float constant type 2018-11-18 08:03:22 -08:00
Chris Robinson 8b8f01e25d Avoid more cases of an enum variable and type name clash 2018-11-18 08:01:50 -08:00
Chris Robinson 336b7b7799 Use constructors/destructors with ALCdevice
As with ALCcontext, this is really ALCdevice_struct because of the way it's
declared in the public header.
2018-11-18 07:33:42 -08:00
Chris Robinson 1bc88ed751 Avoid a fixed-size string buffer 2018-11-18 07:00:43 -08:00
Chris Robinson 5bbddff2f3 Separate class and variable definitions 2018-11-18 06:46:50 -08:00
Chris Robinson e194d896de Use constructors/destructors for ALeffectslot 2018-11-18 06:35:45 -08:00
Chris Robinson ad82a70a65 Use cleaner constructor/destructor calls for ALCcontext
Note that the actual type name is ALCcontext_struct, because of how it's
defined in AL/alc.h (ALCcontext is just an alias to struct ALCcontext_struct).
2018-11-18 05:40:00 -08:00
Chris Robinson de13f30e28 Improve audio underrun recordery in alffplay
Now it has a better idea to skip samples during refill instead of after
restarting.
2018-11-18 05:38:03 -08:00
Chris Robinson 0851dc12b4 Remove an unused typedef 2018-11-18 04:26:28 -08:00
Chris Robinson f48be9d73b Remove the pointer-specific atomic exchange macros 2018-11-18 03:59:39 -08:00
Chris Robinson 7433cb5f4c Avoid naming a struct member the same as an enum type 2018-11-18 03:39:32 -08:00
Chris Robinson bf30eb0391 Use std::isfinite instead of the global isfinite 2018-11-18 03:25:32 -08:00
Chris Robinson 310770c531 Add and use new/delete operators to ALeffectslot 2018-11-18 02:52:46 -08:00
Chris Robinson 3eededf5d6 Use a normal vector for auxiliary effect slots 2018-11-18 02:39:27 -08:00
Chris Robinson 7b95712f38 Use a proper vector for the source sublists 2018-11-18 02:15:31 -08:00
Chris Robinson 4dc8f44d00 Move the alignment-aware allocator and vector to headers 2018-11-18 01:33:26 -08:00
Chris Robinson d7cc9b912b Use new/delete for ALCcontext objects 2018-11-18 00:38:31 -08:00
Chris Robinson 38d6df9c1d Store the listener directly in the context 2018-11-17 23:41:11 -08:00
Chris Robinson e79d9bdd1a Move the vector and matrix declarations to a separate header 2018-11-17 23:21:37 -08:00
Chris Robinson fa3c34268d Move the ALCcontext definition to its own header 2018-11-17 23:02:27 -08:00
Chris Robinson 8f6e0f97ec Try to clear up an MSVC warning 2018-11-17 21:48:54 -08:00
Chris Robinson 20e62aa959 Avoid an explicit static_cast to bool 2018-11-17 20:39:45 -08:00
Chris Robinson d10301c209 Remove unused headers and checks 2018-11-17 19:52:54 -08:00
Chris Robinson 1ac41d3ea0 Convert almalloc.c to C++ 2018-11-17 19:01:10 -08:00
Chris Robinson 8c69fb046c Always use C++11 atomics 2018-11-17 18:56:00 -08:00
Chris Robinson 1468dee831 Convert bs2b.c to C++ 2018-11-17 18:54:10 -08:00
Chris Robinson 9992cef915 Remove now unneeded inldefs.c
All code using inline functions is now C++, so will generate callable functions
as-needed.
2018-11-17 17:52:23 -08:00
Chris Robinson 7f69dbb517 Convert the mixers to C++ 2018-11-17 17:49:55 -08:00
Chris Robinson 2d4ff77410 Remove ASSUME_ALIGNED
It's become a liability with C++ since it returns void* instead of the input
pointer type, and it doesn't seem to help optimizations anyway (auto-
vectorization still produces unaligned loads and stores).
2018-11-17 17:35:52 -08:00
Chris Robinson e5442db803 Convert the filters to C++ 2018-11-17 17:22:32 -08:00
Chris Robinson ed5d222eed Remove the old unused bsincgen.c 2018-11-17 07:50:46 -08:00
Chris Robinson 057b1411f9 Convert ringbuffer.c to C++ 2018-11-17 07:45:10 -08:00
Chris Robinson ff4219e54e Convert mastering.c to C++ 2018-11-17 07:40:10 -08:00
Chris Robinson 6e6a024058 Convert converter.c to C++ 2018-11-17 07:35:11 -08:00
Chris Robinson 13478126cb Convert the remaining effects to C++ 2018-11-17 07:08:41 -08:00
Chris Robinson 93d96ced9c Convert the dedicated, distortion, echo, and equalizer to C++ 2018-11-17 06:53:20 -08:00
Chris Robinson ad34855a2b Add a couple missing includes 2018-11-17 06:11:55 -08:00
Chris Robinson 7b537c795b Don't pass the current thread to althrd_setname 2018-11-17 06:07:04 -08:00
Chris Robinson 1fae8c16a8 Convert threads.c to C++
Also vastly simplify and remove related code.
2018-11-17 05:31:29 -08:00
Chris Robinson ccdaca80c9 Use standard complex types instead of custom 2018-11-17 04:14:57 -08:00
Chris Robinson 09943683b5 Remove some more unused stuff 2018-11-17 02:41:21 -08:00
Chris Robinson b485cbe53a Make the Hann windows const 2018-11-17 02:30:41 -08:00
Chris Robinson b69b3bd89f Convert fshifter.c to C++ 2018-11-17 01:58:38 -08:00
Chris Robinson aa66ed0ea5 Convert modulator.c to C++ 2018-11-17 01:53:39 -08:00
Chris Robinson a7d3c24b51 Convert null.c to C++ 2018-11-17 01:49:26 -08:00
Chris Robinson 557048afa2 Convert pshifter.c to C++ 2018-11-17 01:36:47 -08:00
Chris Robinson f1731af282 Remove unneeded declarations and definitions 2018-11-17 01:29:35 -08:00
Chris Robinson 3bbfd0c099 Fix compilation with MSVC 2018-11-16 23:01:40 -08:00
Chris Robinson 1bd40d9434 Put a lambda in the call_once call
This optimizes better and avoids a visible symbol (templating to an anonymous
lambda type will generate a unique anonymous instantiation, making inlining
more likely, whereas passing a general function pointer/reference type will
likely use or generate a publically available instance).
2018-11-16 22:41:04 -08:00
Chris Robinson de8d8b5216 Remove unused altss types and methods 2018-11-16 22:12:35 -08:00
Chris Robinson ee8e6733e1 Avoid using C-style TLS 2018-11-16 21:55:11 -08:00
Chris Robinson 8410e71a34 Convert the reverb effect to C++ 2018-11-16 21:31:52 -08:00
Chris Robinson a68d0b68d7 Convert mixvoice.c to C++ 2018-11-16 20:46:50 -08:00
Chris Robinson 53373a43b8 Convert ALu.c to C++
Required changes to bsincgen to generate C++-friendly structures.
2018-11-16 20:32:19 -08:00
Chris Robinson 317acd6ae2 Convert alEffect.c and alFilter.c to C++ 2018-11-16 18:44:43 -08:00
Chris Robinson a15a678da6 Convert alListener.c to C++ 2018-11-16 18:37:55 -08:00
Chris Robinson 0e0fe15b98 Convert alAuxEffectSlot.c to C++ 2018-11-16 18:28:39 -08:00
Chris Robinson ce370be52b Remove some unneeded includes 2018-11-16 08:09:56 -08:00
Chris Robinson 50f36d39f7 Use lock_guard instead of manual lock/unlock calls 2018-11-16 07:11:27 -08:00
Chris Robinson 165c162d01 Convert alState.c to C++ 2018-11-16 06:48:33 -08:00
Chris Robinson 436db28a3f Convert alError.c to C++ 2018-11-16 06:24:24 -08:00
Chris Robinson 8be45fe8a5 Convert alExtension.c to C++ 2018-11-16 06:08:25 -08:00
Chris Robinson fedd5ebbea Convert event.c to C++ 2018-11-16 06:00:28 -08:00
Chris Robinson 5cdd28c736 Convert sample_cvt.c to C++ 2018-11-16 05:24:15 -08:00
Chris Robinson 02eae1123f Use iterators instead of indexed loops 2018-11-16 05:23:42 -08:00
Chris Robinson fc8191012a Cleanup some syntax in alc.cpp 2018-11-16 00:06:54 -08:00
Chris Robinson 7a06a54af7 Simplify a couple checks 2018-11-15 23:58:34 -08:00
Chris Robinson a727978eb9 Remove unused declarations and definitions 2018-11-15 23:55:23 -08:00
Chris Robinson 7ef7477a13 Convert the PortAudio backend factory 2018-11-15 23:50:15 -08:00
Chris Robinson 78eb68a89f Convert the WinMM backend factory 2018-11-15 23:41:09 -08:00
Chris Robinson 2ca6119e0e Convert the DSound backend factory 2018-11-15 23:32:28 -08:00
Chris Robinson 5dc1956e18 Convert the QSA backend factory 2018-11-15 23:10:06 -08:00
Chris Robinson c78b42fb4e Convert the OSS backend factory 2018-11-15 23:02:26 -08:00
Chris Robinson 7884cec02b Convert the SndIO backend factory 2018-11-15 22:36:49 -08:00
Chris Robinson 271cfcf8e3 Convert the Solaris backend factory 2018-11-15 22:23:29 -08:00
Chris Robinson d73d01548d Convert the SDL2 backend factory 2018-11-15 22:15:10 -08:00
Chris Robinson 2a839e5762 Convert the JACK backend factory 2018-11-15 22:03:20 -08:00
Chris Robinson d4928d4e7d Convert the Wave Writer backend factory 2018-11-15 21:53:14 -08:00
Chris Robinson cc113ce6ab Convert the OpenSL backend factory 2018-11-15 21:42:17 -08:00
Chris Robinson 9d43b548cc Convert the ALSA backend factory 2018-11-15 21:33:44 -08:00
Chris Robinson ead830814b Convert the CoreAudio backend factory 2018-11-15 21:24:09 -08:00
Chris Robinson b1fb2e9e14 Convert the WASAPI backend factory 2018-11-15 21:14:20 -08:00
Chris Robinson e716c7b988 Convert the PulseAudio backend factory 2018-11-15 19:57:21 -08:00
Chris Robinson 4311c609e4 Update the loopback backend 2018-11-15 19:42:13 -08:00
Chris Robinson 49d8ac2537 Start a new backend factory API
Using proper class inheritance. Be aware this breaks all backends except null
(and loopback). They will be restored individually in due time.
2018-11-15 19:15:14 -08:00
Chris Robinson 7c93308771 Remove checks for functions that always exist
They're part of C++11 and available on the testing systems. If some system has
trouble, switching to proper C++ calls should fix it.
2018-11-15 17:53:05 -08:00
Chris Robinson dc622b3182 Use std::isfinite from the cmath header 2018-11-15 06:48:52 -08:00
Chris Robinson a3b644374b Add a missing cast for MSVC 2018-11-15 06:48:00 -08:00
Chris Robinson 245b7ff0b4 Remove the unused al_string API 2018-11-15 06:32:01 -08:00
Chris Robinson 7b3a2085aa Use a regular char* for the device's name 2018-11-15 06:23:01 -08:00
Chris Robinson ab9f8162b8 Pass a normal const char* to EnumerateHrtf 2018-11-15 05:38:27 -08:00
Chris Robinson 9d9d626d99 Avoid some more uses of al_string 2018-11-15 05:33:02 -08:00
Chris Robinson 08bee7cb58 Search the right list for WASAPI name duplicates 2018-11-15 04:35:35 -08:00
Chris Robinson 17161131e5 Remove an unused extern inline 2018-11-15 04:28:47 -08:00
Chris Robinson 1971d0f5c6 Use std::string instead of al_string for enumerating 2018-11-15 04:24:33 -08:00
Chris Robinson d4f64b9e29 Use a C++ mutex with the device backend base 2018-11-15 03:49:59 -08:00
Chris Robinson b7daddb564 Try to clean up compat.h's macro block spaghetti a bit 2018-11-15 03:29:56 -08:00
Chris Robinson 8f771a0387 Convert alSource.c to C++ 2018-11-15 03:13:54 -08:00
Chris Robinson 27e7168ad4 Only declare the device backend stuff with C++ 2018-11-15 02:36:05 -08:00
Chris Robinson 1d2cc90175 Use C++ more in the OSS backend 2018-11-14 20:49:08 -08:00
Chris Robinson 83dec6b975 Use a C++ vector for enumerated OSS devices 2018-11-14 19:16:50 -08:00
Chris Robinson 3b1b029a75 Remove some now-unused function checks 2018-11-14 17:08:14 -08:00
Chris Robinson c4d3444a6d Use std::pow and std::log2 2018-11-14 17:03:04 -08:00
Chris Robinson 46301a087c Use C++ a bit more with alc.cpp 2018-11-14 06:17:47 -08:00
Chris Robinson 3021a426c0 Convert ALc.c to C++ 2018-11-14 04:15:44 -08:00
Chris Robinson dfcb6d3e6d More clearly check if the buffer is not empty 2018-11-14 02:41:21 -08:00
Chris Robinson b15dcea4bb Move extern inline declarations to their own C source 2018-11-14 00:07:50 -08:00
Chris Robinson 6ae217d005 Fix some comment indentation 2018-11-13 23:26:42 -08:00
Chris Robinson c3ee206129 Use an anonymous namespace in the OSS backend 2018-11-13 23:23:46 -08:00
Chris Robinson 6510a44dba Use C++ more with the ALSA backend 2018-11-13 23:07:23 -08:00
Chris Robinson a5f68c2121 Avoid using ATOMIC_FLAG
Although it cant potentially be better than a regular atomic, it presents
compatibility issues when non-C11 atomics are mixed with C++
2018-11-13 20:26:32 -08:00
Chris Robinson 5867c7b8c2 Don't bother inlining some functions 2018-11-13 19:45:26 -08:00
Chris Robinson 7088f4e34a Avoid calling through the vtable in the backends 2018-11-13 18:41:24 -08:00
Chris Robinson 0dfb805fa2 Use utf8_to_wstr to convert UTF-8 to wstring 2018-11-13 06:29:02 -08:00
Chris Robinson 6f635d3b1a Make ReadALConfig noexcept in C++ 2018-11-13 02:15:10 -08:00
Chris Robinson 2445bfd578 Convert the CoreAudio backend to C++ 2018-11-13 02:09:21 -08:00
Chris Robinson 0ff349a714 Convert the QSA backend to C++
This may very well not work, since there's no testing and my IDE is not able to
show real problems over the incompatibilities with ALSA headers.
2018-11-13 01:56:34 -08:00
Chris Robinson 09ea1d58f6 Convert the backend base to C++ 2018-11-13 01:39:42 -08:00
Chris Robinson 74d1337cc7 Convert the ALSA backend to C++ 2018-11-13 01:36:17 -08:00
Chris Robinson 1f34af4718 Convert the JACK backend to C++ 2018-11-13 01:20:15 -08:00
Chris Robinson 51a1310902 Convert the OpenSL backend to C++ 2018-11-13 00:33:25 -08:00
Chris Robinson c93b7ca0da Convert the OSS backend to C++ 2018-11-12 23:49:11 -08:00
Chris Robinson d9a47ab63c Convert the PortAudio backend to C++ 2018-11-12 23:32:11 -08:00
Chris Robinson dd9ccde055 Convert the SoundIO backend to C++ 2018-11-12 23:17:27 -08:00
Chris Robinson efae7bfb72 Convert the Solaris backend to C++ 2018-11-12 23:06:31 -08:00
Chris Robinson e7ab5053e4 Convert the SDL2 backend to C++ 2018-11-12 22:57:39 -08:00
Chris Robinson a6d780574d Make the enumerated HRTF entry name a char*
Would ideally be a std::string with the HRTF name itself, but they're still
seen in C code.
2018-11-12 22:26:12 -08:00
Chris Robinson d4d0b1fdd4 Use a regular char* for the HRTF string name 2018-11-12 19:02:38 -08:00
Chris Robinson c0f2858f3d Split Windows-specific SetRTPriority 2018-11-12 18:05:16 -08:00
Chris Robinson 4def2a60f2 Clean up helpers.cpp some 2018-11-11 23:13:11 -08:00
Chris Robinson c66db3cdf6 Use the correct type for __control87_2 2018-11-11 22:27:37 -08:00
Chris Robinson c23ea494ea Fix getting the process binary for FreeBSD or macOS 2018-11-11 22:19:32 -08:00
Chris Robinson 5848dab92d Make AmbDecConf::load noexcept
To ease the ovewrhead of destructors that call C (non-noexcept) functions.
2018-11-11 20:40:37 -08:00
Chris Robinson f8bda31c72 Remove unused wstr functions 2018-11-11 20:40:02 -08:00
Chris Robinson 51ed335833 Use C++ more with helpers.cpp 2018-11-11 19:17:40 -08:00
Chris Robinson 4793e5c4ae Use C++ for GetProcBinary 2018-11-11 16:09:24 -08:00
Chris Robinson 58a71a1a00 Convert helpers.c to C++ 2018-11-11 14:56:25 -08:00
Chris Robinson d3c4bab7bb Use a vector in the wave backend 2018-11-11 03:29:43 -08:00
Chris Robinson 2db82bea6f Define the examples' common library earlier 2018-11-11 00:47:57 -08:00
Chris Robinson f99b16daa9 Use C++ threads in the null and wave backends 2018-11-11 00:33:04 -08:00
Chris Robinson 5bc2918e16 Remove the unused condition variable APIs 2018-11-10 22:53:03 -08:00
Chris Robinson f3ce7bc7dc Move altimespec_get and al_nssleep to examples' common code 2018-11-10 21:09:54 -08:00
Chris Robinson 2f42f74418 Ensure ambdec parsing stops at unexpected EOF 2018-11-10 19:38:52 -08:00
Chris Robinson 3939878cc0 Use standard timing methods for the null and wave backends 2018-11-10 19:31:23 -08:00
Chris Robinson dc31969b04 Get rid of the last few al_fopen calls 2018-11-10 04:27:10 -08:00
Chris Robinson 58eb0e754d Load config files using C++
Specifically, avoid al_fopen
2018-11-10 03:42:18 -08:00
Chris Robinson 5ec644f859 Convert alconfig to C++ 2018-11-10 00:13:35 -08:00
Chris Robinson 981205de36 Remove unused strdupW 2018-11-10 00:01:34 -08:00
Chris Robinson 68bcf81756 Remove the unused file mapping calls 2018-11-09 23:51:29 -08:00
Chris Robinson d8163a416a Use C++ more in hrtf.cpp 2018-11-09 23:47:42 -08:00
Chris Robinson add776ddbb Handle the open mode in al::ifstream 2018-11-09 21:56:05 -08:00
Chris Robinson db56fd5e3d Convert hrtf.c to C++ 2018-11-09 18:08:42 -08:00
Chris Robinson e8679e7214 Convert the null backend to C++ 2018-11-09 03:46:30 -08:00
Chris Robinson 781ca7c58b Convert the loopback backend to C++ 2018-11-09 03:15:57 -08:00
Chris Robinson b327a50a15 Add missing consttructor and destructor calls for the wave backend 2018-11-09 02:55:28 -08:00
Chris Robinson b2cdfe58eb Convert the wave backend to C++ 2018-11-09 01:55:54 -08:00
Chris Robinson 55c860deec Use C++ with the winmm backend 2018-11-09 01:34:59 -08:00
Chris Robinson 75eeb6ba4b Convert the WinMM backend to C++ 2018-11-08 20:32:31 -08:00
Chris Robinson 34c836c490 Disambiguate operation order 2018-11-08 14:25:05 -08:00
Chris Robinson d71e50f7f7 Avoid using out parameters 2018-11-08 14:09:13 -08:00
Chris Robinson b27ccb8aa6 Fix a macro typo 2018-11-08 12:21:25 -08:00
Chris Robinson 29435ad966 Prevent MSVC's dumb min/max macros 2018-11-08 04:15:16 -08:00
kcat 22c8330200 Merge pull request #246 from john-preston/fix_macro
Fix Resample_bsinc_SSE pointer casts.
2018-11-08 03:50:37 -08:00
Chris Robinson 4eed3e9236 Move static functions to an anonymous namespace 2018-11-08 03:31:42 -08:00
John Preston c354ba2d2e Fix Resample_bsinc_SSE pointer casts.
Regression was introduced in 5ec11a017c.
2018-11-08 14:18:34 +04:00
Chris Robinson 41aa9845c4 Hide function pointer wrapper macros for IDE parsing 2018-11-07 18:26:33 -08:00
Chris Robinson 5e5e2f654e Disable MSVC warning C4200
"nonstandard extension used: zero-sized array in struct/union"
2018-11-06 21:45:40 -08:00
Chris Robinson 3cb0999a23 Use the proper enum values for atomic ops 2018-11-06 21:33:08 -08:00
Chris Robinson aeb3849904 Also extract the Android support includes 2018-11-06 20:04:28 -08:00
Chris Robinson 620ae6491b Handle CMake policy CMP0075 2018-11-06 19:43:14 -08:00
Chris Robinson 8954d3a438 Fix Android extraction paths 2018-11-06 19:34:19 -08:00
Chris Robinson 9d4af941b9 Update Travis build images
GCC 4.x is too problematic with C++11. Ubuntu Xenial has GCC 5 which has more
complete C++11 conformance. For Android, NDK r16 includes libc++ as an
alternative to the deprecated GCC 4.9's libstdc++.
2018-11-06 19:23:00 -08:00
Chris Robinson bf63c3d3d8 Don't set _FILE_OFFSET_BITS on Android 2018-11-06 19:15:09 -08:00
Chris Robinson 27fbccfb23 Don't directly declare standard function names 2018-11-06 19:14:17 -08:00
Chris Robinson d76e9800da Use a more appropriate type for the result of tellg 2018-11-06 18:55:00 -08:00
Chris Robinson 3b664041ba Convert the DSound backend to C++ 2018-11-06 02:17:20 -08:00
Chris Robinson 9fa31fcd07 Avoid moving istringstreams
Doesn't work with GCC 4.x. Hopefully swapping does.
2018-11-04 19:11:07 -08:00
Chris Robinson 4dafb7dab1 Use C++ to read and parse ambdec files 2018-11-04 15:24:24 -08:00
Chris Robinson 26f7007507 Allocate the appropriate amount in the aligned allocator 2018-11-04 15:21:03 -08:00
Chris Robinson 087fdd3ca9 Properly mark arrays constexpr and/or static 2018-11-04 15:19:48 -08:00
Chris Robinson 96819237d6 Convert ambdec.c to C++ 2018-11-03 19:51:23 -07:00
Chris Robinson 4bfaa173c4 Convert panning.c to C++ 2018-11-03 19:05:23 -07:00
Chris Robinson ba5ec8b074 Be more C++-friendly with the B-Format decoder 2018-11-03 18:00:05 -07:00
Chris Robinson 67f9efdad4 Convert the BFormat decoder to C++ 2018-11-03 15:32:09 -07:00
Chris Robinson 12d5b638f2 Convert the band-split filter to C++ 2018-11-03 15:23:15 -07:00
Chris Robinson 18e1d10338 Convert the UHJ encoder to C++ 2018-11-03 14:40:40 -07:00
Chris Robinson e9d17c5191 Move wstr_to_utf8 to compat.h 2018-11-03 12:55:02 -07:00
Chris Robinson 5482efc921 Make the polymorphic allocators allocate cleared memory 2018-11-02 18:48:08 -07:00
Chris Robinson a7dcc1c6d1 Expand the anonymous namespaces 2018-11-02 14:56:10 -07:00
Chris Robinson b54c4b02c7 Add a wrapper to manage PROPVARIANT objects 2018-11-02 13:32:42 -07:00
Chris Robinson 9e8e3c146f Workaround lack of roundf with early MSVC 2018-11-02 09:39:57 -07:00
Chris Robinson e20d2cdbce Use HUGE_VALF instead of INFINITY
Older MSVC lacks INFINITY, and we define a HUGE_VALF fallback when needed.
2018-11-02 09:25:19 -07:00
Chris Robinson 4ec757c1de Specify the correct array size for casting 2018-11-02 09:22:12 -07:00
Chris Robinson aaa31d987f Check the correct propvariant object 2018-11-02 00:42:50 -07:00
Chris Robinson d66664122a Try another fix to declare GUIDs in C++ 2018-11-02 00:13:07 -07:00
Chris Robinson 66df771d96 Make the polymorphism macros less hacky in C++
In particular, it relies on derived structs using C++-style inheritence. Any
implementation's source that's converted to C++ will consequently need to make
that change.
2018-11-01 23:52:53 -07:00
Chris Robinson 7307c2d5aa Workaround some issue with DEFINE_GUID in C++ 2018-11-01 21:42:26 -07:00
Chris Robinson a90b17113a Use more C++ types where possible 2018-11-01 21:39:34 -07:00
Chris Robinson 434582b8e3 Use an anonymous namespace instead of static for some things 2018-11-01 20:18:51 -07:00
Chris Robinson 1ca4e268f6 Preliminary conversion of the WASAPI backend to C++
A very sparse conversion. Will clean up more later after seeing what MSVC does.
2018-11-01 16:26:42 -07:00
Chris Robinson dee2905f4a Remove unused CXX_FLAGS variable
The Visual Studio generators apparently don't like the $<COMPILE_LANGUAGE:...>
expression. Since it's not actually used for anything at the moment, remove it.
2018-11-01 16:10:46 -07:00
Chris Robinson c0ce71a175 Fix a macro check 2018-11-01 16:00:38 -07:00
Chris Robinson 11967dc2da Use a wrapper function to simplify a check 2018-11-01 16:00:16 -07:00
Chris Robinson 69162cf9c6 Use perfect forwarding to initialize DevMap entries 2018-11-01 13:12:42 -07:00
Chris Robinson cd68530ab4 Simplify a couple loops 2018-11-01 11:44:11 -07:00
Chris Robinson 5d092a1c58 Use the appropriate enums for standard atomics 2018-11-01 08:43:31 -07:00
Chris Robinson d28c0eb556 Avoid uniform initialization with references
Also doesn't work with GCC 4.x
2018-11-01 08:41:23 -07:00
Chris Robinson 48f877e859 Remove unused header 2018-11-01 08:19:51 -07:00
Chris Robinson ccf356a03d Include a missing header for atomic 2018-11-01 08:17:23 -07:00
Chris Robinson 95966c4d92 Fix another use of auto uniform initialization 2018-11-01 08:15:47 -07:00
Chris Robinson 759c3a996c Avoid all uniform initialization with auto
Because of early C++11 (GCC 4.x) deficiencies, it's not interpreted correctly.
Either declare the type name explicitly with uniform initization, or use auto
with = initialization. It'll be fine when updating to GCC 5 or Clang 3.6.
2018-11-01 08:04:21 -07:00
Chris Robinson 353bb1ed17 Avoid uniform initialization on auto for integer types
To work around a deficiency with early C++11 compilers (GCC 4.x).
2018-10-31 22:10:26 -07:00
Chris Robinson d41fbd5c2d Convert the PulseAudio backend to C++ 2018-10-31 20:09:14 -07:00
Chris Robinson de275408fa Make a const array constexpr 2018-10-31 13:31:14 -07:00
Chris Robinson 0e7986eaa8 Move some extern inline declarations to C 2018-10-31 13:21:05 -07:00
Chris Robinson 9dba90fa20 Avoid assigning in an if statement 2018-10-31 13:00:08 -07:00
Chris Robinson 77bac8eeaa Add a missing <array> include 2018-10-31 12:01:07 -07:00
Chris Robinson 4d422dfb24 Fix some backup atomic macros 2018-10-31 12:00:02 -07:00
Chris Robinson 624bc1c839 Convert alBuffer.c to C++
A test to ensure everything works.
2018-10-31 10:37:16 -07:00
Chris Robinson 4b7af24ed5 Add specializations for lock_guard and unique_lock to take almtx_t 2018-10-31 10:35:12 -07:00
Chris Robinson 1e8c6df7b9 Add a C++ ContextRef helper to manage a ALCcontext reference 2018-10-31 10:05:15 -07:00
Chris Robinson da150572f9 Clean up the DriverIface in its destructor 2018-10-30 17:03:21 -07:00
Chris Robinson 615c025b67 Add a missing include for array 2018-10-30 16:35:14 -07:00
Chris Robinson 08aa9d898b Remove an unnecessary include 2018-10-30 16:32:25 -07:00
Chris Robinson 6a8f5e5950 Build the router with AppVeyor 2018-10-30 15:38:11 -07:00
Chris Robinson f747ac8882 Clean up the router's PtrIntMap 2018-10-30 14:28:19 -07:00
Chris Robinson 44f91760b5 Use std::array instead of raw arrays 2018-10-30 10:01:49 -07:00
Chris Robinson e2a1dd4503 Use std::wstring in place of some fixed WCHAR arrays 2018-10-30 09:31:52 -07:00
Chris Robinson ce212c911c Add a cmake option to static-link winpthread 2018-10-30 09:24:39 -07:00
Chris Robinson c17e59f63a Use std::vector instead of custom dynamic arrays 2018-10-30 08:33:40 -07:00
Chris Robinson e75e0a342e Use C++ atomics and mutexes in the router 2018-10-30 07:30:46 -07:00
Chris Robinson a0d03e50e8 Convert the router to C++ 2018-10-30 07:06:03 -07:00
Chris Robinson f17b930638 Add extern "C" for router.h 2018-10-30 06:45:44 -07:00
Chris Robinson 71303b73a4 Add a cmake option to static-link libstdc++ 2018-10-29 20:55:45 -07:00
Chris Robinson 3deb7c6ed5 Workaround C++ compatiility issues for atomic.h
This isn't wholly correct since neither C11 or C++11 guarantee compatibility
between atomic implementations. It's desired behavior and mostly works, see:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0943r1.html

Alignment issues can be fixed with manual alignas() specifications, should the
need arise.
2018-10-29 20:50:57 -07:00
Chris Robinson 5fea511cce Fix some more headers for C++ 2018-10-29 11:51:41 -07:00
Chris Robinson 662e1c5cc2 Fix some uses of RESTRICT 2018-10-29 11:50:41 -07:00
Chris Robinson ea3789d985 Update version for AppVeyor 2018-10-29 11:35:43 -07:00
Chris Robinson 903d878460 Replace restrict with RESTRICT 2018-10-29 11:32:50 -07:00
Chris Robinson 184241f2ef Simplify a couple more checks 2018-10-29 10:17:30 -07:00
Chris Robinson e876b50113 Remove unnecessary uses of IN_IDE_PARSER 2018-10-29 10:10:37 -07:00
Chris Robinson 7d5a288e83 Add a couple casts for compiling with C++
Also avoid using __builtin_types_compatible_p, which seems broken with C++?
2018-10-29 10:10:37 -07:00
Chris Robinson 1d7b0f54be Add another missing extern "C" 2018-10-29 10:10:37 -07:00
Chris Robinson 8a8ab68f1c Add a more C++-friendly VECTOR_RESIZE 2018-10-29 10:10:37 -07:00
Chris Robinson fd1361c198 Add a RESTRICT macro to help with C++ compatibility 2018-10-29 10:10:37 -07:00
Chris Robinson 5148a73a7b Add missing extern "C" 2018-10-29 10:10:37 -07:00
Chris Robinson f1058c635f Handle C++-only compile flags in cmake 2018-10-29 10:10:37 -07:00
Chris Robinson 7f8ef092aa Fix a couple internal headers to compile with C++ 2018-10-29 10:10:37 -07:00
kcat 44a4602508 Merge pull request #240 from ShFil119/impr/simplify_statements
Simplify some statements
2018-10-29 10:10:06 -07:00
Filip Gawin 08226bc6b0 Simplify some statements 2018-10-29 13:38:58 +01:00
kcat 56b8b97642 Merge pull request #236 from alexey-lysiuk/macos_semaphore
Use GCD semaphore on macOS
2018-10-15 14:16:49 -07:00
alexey.lysiuk c8d866a25a Use GCD semaphore on macOS
Unnamed POSIX semaphore doesn't work on macOS
2018-10-15 19:41:22 +03:00
Chris Robinson 6761218e51 Release 1.19.1 2018-10-11 15:05:31 -07:00
Chris Robinson 31b9c50721 Use the common init/close functions for alffplay 2018-10-10 16:16:00 -07:00
Chris Robinson f589244fb6 Allow building alffplay without experimental extensions 2018-10-08 15:03:49 -07:00
Chris Robinson 7a79f09a31 Add a comment about waiting to kill the event thread 2018-10-07 17:18:50 -07:00
Chris Robinson db65113c5f Use a 24-bit dither depth limit 2018-10-03 13:51:21 -07:00
Chris Robinson f3f94e478b Don't limit output for ALC_DONT_CARE_SOFT and float samples 2018-10-03 13:48:04 -07:00
Chris Robinson c39eeb9638 Don't try to get the JNIEnv on Android
It's currently not used. More stuff is needed anyway which may need a different
approach.
2018-10-02 12:40:26 -07:00
Chris Robinson 493c8bbc83 Add back an inadvertently removed static 2018-10-02 12:25:26 -07:00
Chris Robinson 052fdd67cd Use < instead of != for some loop checks 2018-10-01 15:59:05 -07:00
Chris Robinson ed8f44d102 Don't scale the reverb fade counter so much 2018-09-30 16:34:00 -07:00
Chris Robinson 1d1acc0c34 Ensure BUFFERSIZE is a power of 2 2018-09-30 12:12:27 -07:00
Chris Robinson 1860b2ec8a Make the Compressor struct opaque 2018-09-30 12:08:01 -07:00
Chris Robinson 7ad4f753a4 Fix some length ranges 2018-09-29 19:39:49 -07:00
Chris Robinson d5a78f0843 Improve a couple loops
Avoid masking the index with each iteration, and instead do up to when the mask
would apply. This allows for better optimizations, in particular fewer
instructions and better chances for vectorization.
2018-09-29 18:48:28 -07:00
Chris Robinson 32494e72a5 Don't use a ringbuffer design for the limiter's side chain
Rather than continuously wrapping when used, each update uses it from the front
and copies the tail to the front at the end. This allows for more effficient
accesses in loops.
2018-09-29 11:54:45 -07:00
Chris Robinson 0396c0ecd2 Add some assumes for the limiter 2018-09-29 09:47:05 -07:00
Chris Robinson 51a447852f Simplify a lower-bound clamp 2018-09-28 18:34:21 -07:00
Chris Robinson 1684b2cc5f Constify a couple more variables 2018-09-28 16:42:22 -07:00
Chris Robinson 1dee902a5f Update changelog 2018-09-26 08:23:48 -07:00
Chris Robinson 79314c4461 Include the limiter's lookAhead delay in the device latency 2018-09-25 23:05:27 -07:00
Chris Robinson 2d6309d6fc Don't hardcode the limiter threshold
It's now calculated from the output sample type and dither depth.
2018-09-25 10:33:20 -07:00
Chris Robinson c69338bc0d Update the output limiter/compressor
This provides better characteristics for an amplitude limiter. In particular,
it utilizes the peak amplitude instead of the RMS, and the used parameters
basically guarantee no output samples exceed the given threshold... almost, due
to floating-point errors as the threshold is converted from dB to log-e for the
envelope, then is negated and converted to linear amplitude to apply to the
signal. It's quite possible for some rounding errors to creep in and not
perfectly saturate the result.
2018-09-25 10:04:14 -07:00
Chris Robinson 39c3314d00 Only compare the reverb params that induce a need for fading
The offsets and coefficients are controlled by a relatively small set of input
parameters, just with different base constants or different calculations. This
lead to numerous redundant checks since if one value didn't change, others that
use the same inputs wouldn't have either.
2018-09-23 22:59:16 -07:00
Chris Robinson db6905bf57 Clear reverb gain coefficients when doing a device update 2018-09-23 02:22:23 -07:00
Chris Robinson 800326d37a Rename ALreverbState to ReverbState 2018-09-23 01:11:58 -07:00
Chris Robinson c708f871ec Update changelog 2018-09-22 20:13:31 -07:00
Chris Robinson 77a53594ba Improve the gain stepping difference check
Given the more stable stepping now in use, check that the total difference is
enough for perceptible transition, instead of the step itself.
2018-09-22 08:26:52 -07:00
Chris Robinson 36a6b9d42a Adjust comment spacing 2018-09-21 06:06:29 -07:00
Chris Robinson b6d0ff02c2 Use an internal event to more timely release old effect states 2018-09-21 04:14:15 -07:00
Chris Robinson f21e2df4cf Remove an unnecessary mutex 2018-09-20 22:53:16 -07:00
Chris Robinson 84a90b7cc3 Stop the event thread when releasing the context
To ensure no user callback gets called after alcDestroyContext.
2018-09-20 22:44:58 -07:00
Chris Robinson ebbbeb0d66 Put user events in a union structure 2018-09-20 21:59:38 -07:00
Chris Robinson cb8545346d Always start the event thread with the context 2018-09-20 19:58:01 -07:00
Chris Robinson 5c6b8eda4f Remove another duplicate function 2018-09-19 22:18:46 -07:00
Chris Robinson ea95a8adef Combine nearly-duplicate structures 2018-09-19 21:31:46 -07:00
Chris Robinson 6eb980d1b2 Remove a couple duplicate functions 2018-09-19 21:09:19 -07:00
Chris Robinson 48b7745a49 Add macros for commonly used square roots 2018-09-19 19:53:25 -07:00
Chris Robinson 9ef4dd4247 Use ALsizei for the source resample position 2018-09-18 19:08:13 -07:00
Chris Robinson 952ff84b99 Properly queue buffers for OpenSL capture 2018-09-17 23:43:23 -07:00
Chris Robinson b77e6096b8 Fix some potential race conditions with OpenSL
For playback, increment the ring buffer's write pointer before queueing audio,
to handle cases where the callback is invoked, advancing the read pointer,
before the write pointer is advanced.

For capture, limit the number of re-queued chunks to the number of fully read
chunks.
2018-09-17 22:49:52 -07:00
Chris Robinson 7f4441ffbe Handle the bsinc C resampler like the others 2018-09-17 04:07:56 -07:00
Chris Robinson 8bacb5dfb8 Fix buffer queue mixing logic
In particular, the source sample position was reduced by the size of the
next buffer list item when one is completed, rather than the size of the
one it just completed.
2018-09-16 17:38:55 -07:00
Chris Robinson a6734c7a91 Check the effect slot list size only when there's no free entries
The list can contain (reuable) NULL entries, so the max - current_size doesn't
indicate how many can be allocated.
2018-09-14 14:53:35 -07:00
Chris Robinson db452a19da The last reverb loop update doesn't need an aligned count. 2018-09-11 19:05:49 -07:00
Chris Robinson 99737469e2 Ensure the max reverb update size is a multiple of 4
It's not an issue for the final mix, but if one loop has an unaligned count,
the next loop will have unaligned input and output buffer targets which can
crash the SSE mixers.
2018-09-11 18:39:50 -07:00
Chris Robinson b13396cce2 Separate the delay line feeding from reading
Since it feeds a different line than it reads, the feeding could overwrite
what's subsequently read.
2018-09-10 13:30:20 -07:00
Chris Robinson d1f8b78dd4 Avoid a couple line count assumptions 2018-09-10 03:19:41 -07:00
Chris Robinson 4bdab0051f Combine identical loops into a separate function 2018-09-10 03:17:14 -07:00
Chris Robinson 634b13a630 Handle the early reflection delay separate from late refeed 2018-09-10 02:10:35 -07:00
Chris Robinson 275658b6db Some suggested changes for iOS 2018-09-07 23:01:17 -07:00
Chris Robinson 9054f41434 PATH_MAX not MAX_PATH 2018-09-07 22:52:34 -07:00
Chris Robinson fa7993fe3e Load .alsoftrc from the app bundle root on macOS
Not sure what priority this should have. Currently it loads after system-level
configs, and before user-level configs.
2018-09-07 22:32:48 -07:00
Chris Robinson 46cfedb117 Pass the device name list to the backend probe method 2018-09-07 22:02:37 -07:00
Chris Robinson 212cb8e298 Implement capture support for SoundIO 2018-09-07 20:08:24 -07:00
Chris Robinson 7394dd512d Rename ALCsndioBackend 2018-09-07 18:45:24 -07:00
Chris Robinson 96aacac10c Release 1.19.0 2018-09-06 14:35:18 -07:00
Chris Robinson 4c32a0aba7 Update changelog about 32-bit using SSE2 by default 2018-09-03 21:09:31 -07:00
Chris Robinson 0f243b927c Slightly restructure some loops 2018-09-03 17:07:43 -07:00
Chris Robinson fce86815f4 Extract SIMD values right before using them 2018-09-03 12:42:31 -07:00
Chris Robinson 3b4f28d173 Avoid double-resizing when appending a char to a string 2018-09-02 21:15:21 -07:00
Chris Robinson b854f4037f Read the whole Features string for neon support 2018-09-02 18:15:56 -07:00
Chris Robinson 30bd84a935 Fix a typo in the changelog 2018-08-31 17:45:59 -07:00
Chris Robinson 0a8398dd99 Update a comment 2018-08-31 17:36:50 -07:00
Chris Robinson 01cc0cd787 Pass the appropriate /arch switch for x86 MSVC 2018-08-31 13:22:21 -07:00
Chris Robinson 0d4b68239a Include the mid-band decay with the density gain 2018-08-31 08:30:57 -07:00
Chris Robinson 68a8c42176 Calcualte and use the maximum reverb update size
Instead of requiring it to be at least as big as MAX_UPDATE_SAMPLES, which may
not be true in some situations.
2018-08-31 07:20:46 -07:00
Chris Robinson 8b733728af Apply the decay gain when reading from the late line 2018-08-31 06:31:58 -07:00
Chris Robinson 1fa464ec3e Don't modify the late reverb density with the echo parameters 2018-08-30 18:40:53 -07:00
Chris Robinson 3368bd75c7 Enable HRTF data set embedding by default 2018-08-29 15:31:04 -07:00
Chris Robinson 827c66f4f6 Widen the plain stereo width
Now full right and left is +-60 degrees instead of +-30. This should help
create a smoother panning for a sound moving in front for plain stereo output
(surround sound and HRTF are not changed).

Multi-channel sources are also not affected by this change. The stereo channel
defaults of +-pi/6 (30 degrees) still correspond to full left/right panning.
This is an unfortuante discrepancy, but is necessary for AL_EXT_STEREO_ANGLES
to work.
2018-08-29 07:13:54 -07:00
Chris Robinson 21dc2c761d Check for and use copysignf 2018-08-29 03:53:09 -07:00
Chris Robinson 529f387695 Use a separate method to warp the azimuth for plain stereo output 2018-08-29 01:45:27 -07:00
Chris Robinson dacd08dc5d Use shuffle+cvt to extract SIMD values instead of storing to memory 2018-08-26 22:36:30 -07:00
Chris Robinson 072ca731e2 Avoid making extraneous calls 2018-08-26 19:14:17 -07:00
Chris Robinson a3010f50be Pack two arrays into one 2018-08-26 19:08:50 -07:00
Chris Robinson 4be6584850 Further limit the upper frequency range for autowah 2018-08-26 19:04:49 -07:00
Chris Robinson 24b646dec0 Append the OpenSL capture device to the appropriate list 2018-08-23 18:20:09 -07:00
Chris Robinson 7d76cbddd6 Use second-order biquad filters for the reverb's T60 decay 2018-08-12 18:02:39 -07:00
Chris Robinson 90ca9b9ff4 Store the reverb state offset locally while processing 2018-08-11 01:29:15 -07:00
Chris Robinson 2b9c213f89 Correctly apply reverb coefficient fading over the entire fade length 2018-08-09 21:10:17 -07:00
Chris Robinson adfbe0d6cd Crossfade the early reflections delay coefficients 2018-08-08 22:47:07 -07:00
Chris Robinson 125ac166d1 Apply late reverb density gain on late reverb input
This also uses gain stepping for changes in density or decay, so that the
late reverb tap fades smoothly between delay offsets and density gain levels
simultaneously. Now with these changes, it's preferrable to apply density gain
adjustments on late reverb input instead of output so that samples currently in
the feedback loop won't see a sudden increase or decrease in amplitude.

A similar change can probably be made for the early reflection delays to
further smooth out delay changes.
2018-08-08 19:30:58 -07:00
Chris Robinson 1e33c4a922 Specify both scale values to FadedDelayLineOut 2018-08-08 06:24:12 -07:00
Chris Robinson a8250db2bb Use the correct input channel for the compressor effect 2018-08-08 04:05:07 -07:00
Chris Robinson 04921dd727 Properly set early reflection all-pass coefficient 2018-08-06 23:45:32 -07:00
Chris Robinson 06da60c555 Make the all-pass coefficient part of the all-pass structure 2018-08-06 21:57:08 -07:00
Chris Robinson 32edc7f33f Prevent the autowah filter frequency from reaching nyquist 2018-08-06 14:14:31 -07:00
Chris Robinson 4f92bd5938 Apply the vector all-pass separate on uninterleaved samples
With the vector all-pass applied in a self-contained function, the individual
steps of the early and late reverb stages can be better optimized with tighter
loops. That allows for more data to be held local, resulting in less thrashing
from reloading the same values multiple times.

There is room for further improvement, depending on the length of the early
delay lines and all-pass delay lines allowing for bulk reads.
2018-08-05 20:29:03 -07:00
Chris Robinson 4aa029183b Apply the reverb's T60 filter in groups of samples
The late reverb line lengths are long enough to ensure a single process loop
won't rely on reading samples it wrote in the same call. So we can safely read
in all samples we need from the feedback buffer up front, then more efficiently
filter them.
2018-08-05 00:45:13 -07:00
Chris Robinson 3f165040e2 Mix reverb samples right after generating them
Instead of generating both the early and late reverb samples first, then mixing
them both to output, this now generates and mixes the early reflections then
generates and mixes the late reverb. There's no reason to hold both at the same
time so this reduces the amount of temporary storage needed.
2018-08-04 22:52:36 -07:00
Chris Robinson 754a32fa16 Scale the reverb decay weights to cover up to 20khz
Otherwise, using the device's maximum frequency will cause the weighting
factors to shift for different sample rates, irrespective of the content being
processed. 20khz is the maximum allowed reference frequency, and also acts as
the upper limit of human hearing.
2018-08-03 20:04:08 -07:00
Chris Robinson 57b860d8ca Trace the NFC reference distance when set 2018-08-03 00:07:08 -07:00
Chris Robinson 0c67429a38 Apply late reverb density gain adjustment on output
Because density/late line length changes start affecting late reverb output
right away, with samples that are still going through feedback decay and not
just new input samples, it makes more sense to correct for it on output instead
of input. This has the additional benefit of working with the output mixer's
gain fading, avoiding discontinuities from significant density gain changes.
2018-08-01 16:08:27 -07:00
Chris Robinson aa58a5d208 Fix late reverb density gain blend weights
Now it only accounts for the representable frequency range (0.5 normalized, or
 0...pi radians instead of tau). Previously, the bulk of the weighting factors
was given to the HF decay (nearly 90%, given a 44.1khz sample rate and the
default 5khz reference), with low- and mid-frequency decays splitting the
remaining 10%. Now it's closer to 75%, matching the range of representable
frequencies above the reference.

This could probably be improved further due to human hearing being less
sensitive to higher frequencies, but that is much more complicated.
2018-08-01 02:48:31 -07:00
Chris Robinson 3894c580bf Use just the omnidirectional response for the compressor effect
This is not the output compressor/limiter, but the EFX effect. Consequently, it
simply compresses the dynamic range around 1.0 (boosting samples below it by up
to double, reducing samples above it by as much as half). This is not intended
to prevent clipping on the output, but to instead reduce the range between
quiet sounds and loud sounds.
2018-07-29 00:18:46 -07:00
Chris Robinson f1bf932a84 Update ChangeLog 2018-07-28 14:11:12 -07:00
Chris Robinson 8ab448b119 Inline the autowah peaking filter processing 2018-07-28 14:03:28 -07:00
Chris Robinson 39a5d0cb94 Mark a couple parameters as unused 2018-07-25 13:15:47 -07:00
Raulshc 7d68eeac88 EFX: Enable 3D processing
Use channel 0 envelope for calculate the frequency in all channels.
2018-07-25 12:51:09 -07:00
Raulshc 92fd59fe6a EFX: Add 3D processing for autowah
Add 3D processing code. It can be activated at compilation time.
2018-07-25 12:51:09 -07:00
Raulshc f79683d459 Alsoft-config: Add autowah effect 2018-07-25 12:51:09 -07:00
Raulshc 83dba26ea6 EFX: Autowah implementation
Add autowah effect using biquad peaking filter and envelope follower
2018-07-25 12:51:09 -07:00
Chris Robinson 809f709ba6 Limit the normalized filter frequency to under half
Nearing half, weird things can start happening with the filters' generated sine
and cosine values.
2018-07-21 14:22:52 -07:00
Chris Robinson 6fe1ffa3bb Improve handling of 0hz ring modulator frequency 2018-07-21 14:21:00 -07:00
Chris Robinson d117a5209f On 32-bit targets with SSE, enable SSE/SSE2 codegen by default
Two new CMake options are available for 32-bit targets that accept -msse:
ALSOFT_ENABLE_SSE_CODEGEN and ALSOFT_ENABLE_SSE2_CODEGEN, which default to
TRUE. This should not affect MSVC, which already defaults to SSE2 codegen.
2018-07-16 08:41:56 -07:00
Chris Robinson ed1f1d2bf3 Start an extension to allow source filter gains greater than 1 2018-07-15 21:01:26 -07:00
kcat fd3f52ea36 Merge pull request #210 from qwertychouskie/patch-1
Fix COPYING
2018-07-02 18:38:57 -07:00
QwertyChouskie 4c61103e34 Fix COPYING
Remove bad chars, remove section that shouldn't be there.
2018-07-02 17:09:53 -07:00
kcat dc3fa3e51f Merge pull request #207 from t6/patch-sndio-oss
Prefer sndio backend over OSS when both are enabled
2018-06-22 11:49:00 -07:00
Tobias Kortkamp e2d7c5dfb3 Prefer sndio over OSS when both are enabled
Signed-off-by: Tobias Kortkamp <tobik@FreeBSD.org>
2018-06-22 14:36:33 +02:00
kcat 7e2cac5292 Merge pull request #204 from jhasse/android-byte-order
Correctly check byte order for newer Android compiler, fix #203
2018-06-20 12:53:22 -07:00
Jan Niklas Hasse a80ab01227 Correctly check byte order for newer Android compiler, fix #203 2018-06-20 21:36:33 +02:00
Chris Robinson 73e08e51ba Properly get the full executable and pathname on FreeBSD 2018-06-08 19:49:13 -07:00
Chris Robinson fd1458ce1b Always prepare the ALSA PCM handle before starting capture
Draining the ALSA device via stopping puts it into a setup state, which
requires re-preparing before playback can start again. Preparing it prior to
the first start seems to cause no harm, so just always do it before starting.
2018-06-08 05:02:47 -07:00
kcat 9c643f0356 Merge pull request #200 from kdhp/fix-199
Stop capture devices while closing
2018-06-07 19:30:34 -07:00
kdhp 35b78d55a4 Stop capture devices while closing
In 'alcCaptureCloseDevice', check if the capture device is
running and stop it if necessary.
This fixes the case where the device data is deallocated while
a background thread is still running (Issue #199)
2018-06-08 01:42:13 +00:00
Chris Robinson bd9c6989c2 Clear the TLS pointer after running its destructor callback 2018-06-06 23:10:37 -07:00
Chris Robinson 72e4b60374 Clamp the maximum normalized reference frequency too 2018-06-03 01:52:05 -07:00
Chris Robinson 48b265e136 Use a higher normalized frequency limit for the ring modulator 2018-06-02 00:02:14 -07:00
Chris Robinson 7865ebb6d5 Use the biquad high-pass in the ring modulator 2018-05-31 22:21:00 -07:00
Chris Robinson f765099503 Slightly simplify the modulator square wave generator 2018-05-31 19:43:02 -07:00
kcat d5dd4937eb Merge pull request #197 from Raulshc/Modulator
EFX: Modulator fixes
2018-05-31 19:38:42 -07:00
Raulshc 1bba276aaf EFX: Ring modulator fixes
Change from unipolar to bipolar carrier signal in the Ring modulator effect.
2018-05-31 15:47:47 +02:00
Raulshc 5233c4aa21 Merge from kcat/master
Update git repository
2018-05-31 14:17:20 +02:00
Chris Robinson 0b7f35b289 Avoid extra sample copies and storage in the modulator effect 2018-05-29 22:55:21 -07:00
Chris Robinson 46c59f382f Use fastf2i instead of manual rounding in another place 2018-05-29 22:49:45 -07:00
Chris Robinson 8854720e8a Avoid separate in/out parameters when they're always the same 2018-05-29 22:15:49 -07:00
kcat 42d3235a66 Merge pull request #196 from rindeal/cmake-sse2-typo-fix
CMake: fix SSE3 typo
2018-05-29 16:24:42 -07:00
Jan Chren (rindeal) 5cba81cf35 CMake: fix SSE3 typo
Closes: https://github.com/kcat/openal-soft/issues/195
2018-05-29 18:32:30 +02:00
Chris Robinson a5edf487dd Use a macro to handle common case formatting 2018-05-27 01:03:18 -07:00
Chris Robinson 728dd5a4e0 Avoid setting unnecessary variables 2018-05-26 20:43:05 -07:00
Chris Robinson ac4061b9d2 Better sort the effect list in alsoft-config 2018-05-26 18:17:17 -07:00
Chris Robinson ec84a107a4 Don't hardcode the max channels for HRTF B-Format decoding 2018-05-26 00:26:11 -07:00
Chris Robinson 803d331711 Improve formatting of the hilbert function 2018-05-24 00:16:50 -07:00
Chris Robinson 422cf429e6 Clamp the dither depth between 2 and 20 bits 2018-05-23 19:49:49 -07:00
Chris Robinson 93de5350b9 Add some LIKELY and ASSUME statements 2018-05-23 19:22:21 -07:00
Chris Robinson 9bf3ee722c Fix a function comment about a return value 2018-05-23 06:10:09 -07:00
Chris Robinson 1782208fde Remove unused function 2018-05-23 05:58:06 -07:00
Chris Robinson 84a94a6109 Update ChangeLog 2018-05-23 01:04:52 -07:00
Chris Robinson c2a4a35c2e Use a tighter loop to handle the frequency shifter's fifo 2018-05-22 07:28:53 -07:00
Chris Robinson f3d4220cab Use fixed point for the frequency shifter's phase 2018-05-22 07:02:14 -07:00
Chris Robinson 8219bb374d Fix a couple property variable names 2018-05-22 06:19:59 -07:00
Chris Robinson 80df89d0db Improve the frequency shifter output accum handling 2018-05-22 06:12:55 -07:00
Chris Robinson ecdc58c1c9 Fix formatting and line endings 2018-05-22 05:59:03 -07:00
kcat da63b4a596 Merge pull request #193 from Raulshc/Frequency-shifter
EFX: Frequency shifter
2018-05-22 04:44:50 -07:00
Chris Robinson 4e315353c8 Add a method to queue multiple buffer layers onto a source 2018-05-21 23:25:56 -07:00
Chris Robinson 720ec2beea Use the __BYTE_ORDER__ macro when available 2018-05-21 17:51:57 -07:00
Chris Robinson a235259b5e Further clarify a comment about float precision 2018-05-21 06:16:03 -07:00
Raulshc 97c165b951 Add correct cast 2018-05-20 18:44:24 +02:00
Raulshc da6f32a1c0 Alsoft-config: Add frequency shifter effect 2018-05-20 17:27:37 +02:00
Raulshc d3a81f4f28 EFX: Frequency Shifter implementation
Add frequency shifter effect using discrete Hilbert transform. Only mono signal processing by now (LEFT_DIRECTION).
2018-05-20 17:23:03 +02:00
Raulshc dd51ba396b Common: Implement discrete Hilbert transform 2018-05-20 17:21:50 +02:00
Chris Robinson 7501c8b483 Simplify counting for the bsinc FIR loop 2018-05-19 08:18:08 -07:00
Chris Robinson 5e7513d0a0 Accumulate ambisonic upsampler gains using double-precision 2018-05-18 18:59:27 -07:00
Chris Robinson cd2fd126c4 Add an alffplay option to play stereo streams with wide angles 2018-05-17 03:54:32 -07:00
Chris Robinson 0cd375f03c Add a function to calculate coefficients from X, Y, Z components 2018-05-17 03:52:40 -07:00
Chris Robinson 588a6bcb4f Simplify counting for SIMD MixRow functions 2018-05-15 23:14:23 -07:00
Chris Robinson 72e39ba1c9 Fix a function comment 2018-05-15 22:11:10 -07:00
Chris Robinson 6534aa0c27 Undefine the correct macros 2018-05-15 21:46:22 -07:00
Chris Robinson e42489b3e9 Include math_defs.h to ensure M_PI is defined 2018-05-15 18:50:32 -07:00
Chris Robinson 2b9064cb6e Move the ALcomplex and FFT functions to a separate file 2018-05-15 18:31:41 -07:00
Chris Robinson 197e88cdcc Avoid using unsigned values for signed 2018-05-15 01:20:39 -07:00
Chris Robinson 4ac4889912 Avoid unnecessary function-like macros 2018-05-15 00:53:12 -07:00
Chris Robinson 4ee04cd444 Use a step counter for gain stepping
This should provide more stable stepping, preventing floating-point errors from
accumulating on each step/sample.
2018-05-14 23:41:29 -07:00
Chris Robinson 43dccc8807 Add a faster double-to-int converter for x87 builds 2018-05-14 18:00:43 -07:00
Chris Robinson df9faba689 Use more accurate elevations for virtual HRTF speaker positions 2018-05-14 05:28:06 -07:00
Chris Robinson 5272caf7f4 More accurately convert between degrees and radians 2018-05-14 00:20:31 -07:00
Chris Robinson 1e04c4c689 Make a faster float2int method for x87 targets 2018-05-12 22:34:15 -07:00
Chris Robinson dd055fc858 Use fastf2i instead of manually rounding with float2int 2018-05-12 21:36:23 -07:00
Chris Robinson 5c0673049c Fix MSVC 2018-05-12 03:31:58 -07:00
Chris Robinson f240952bcc Fix non-SEE (32-bit) GCC builds 2018-05-12 00:58:27 -07:00
Chris Robinson e787a241c0 Add and use a method for fast float rounding
Unlike fastf2i, this keeps the result as a float instead of converting to
integer.
2018-05-12 00:52:09 -07:00
Chris Robinson 3867cad94d Simplify calculating the HRTF B-Format IR length 2018-05-04 06:48:20 -07:00
Chris Robinson be30e6bf8f Don't assume the FPU is round-to-zero in the pitch shifter 2018-05-04 04:53:50 -07:00
Chris Robinson 1fb6428ffa Another fix attempt for 32-bit MSVC 2018-05-04 04:02:57 -07:00
Chris Robinson b31a54e972 Try to fix 32-bit MSVC builds 2018-05-04 02:56:01 -07:00
Chris Robinson 75e2cb97f7 Don't assume round-to-zero for fastf2i 2018-05-04 02:09:32 -07:00
Chris Robinson ac8dbd7a56 Add a specific function for truncating float-to-int conversions 2018-05-03 22:02:32 -07:00
Chris Robinson d8a659c6f2 Avoid fastf2i in the converter init 2018-05-03 17:27:30 -07:00
Chris Robinson af90d89b6b Use a fixed-point scale for the pitch shifter frequency index 2018-05-03 17:06:55 -07:00
Chris Robinson a19296e3cf Avoid excessive if block depths 2018-05-02 21:06:57 -07:00
Chris Robinson 85c03925fb Avoid duplication for getting the cpuid 2018-05-02 20:59:53 -07:00
Chris Robinson 22413b82ca Pass in the number of channels per order to InitNearFieldCtrl 2018-05-01 20:21:24 -07:00
Chris Robinson e8aaa9cb13 An output device buffer is likely 2018-04-29 18:03:33 -07:00
Chris Robinson 2385ab700c Avoid potentially calling log10f(0) 2018-04-29 14:02:33 -07:00
Chris Robinson 242ed45f65 Rename some struct members for clarity 2018-04-28 22:10:22 -07:00
Chris Robinson e420752e82 Fix a comment about a float's mantissa 2018-04-28 18:52:40 -07:00
Chris Robinson 54109043b8 Remove some unnecessary floor calls 2018-04-28 01:14:17 -07:00
Chris Robinson ddd4751f87 Increase the band-split IR for decoding ambisonics to HRTF 2018-04-27 18:42:26 -07:00
Chris Robinson 492c75cb7b Rename some variables for clarity 2018-04-27 00:41:02 -07:00
Chris Robinson 1e0728af64 Transpose the band-splitter all-pass section 2018-04-26 23:26:11 -07:00
Chris Robinson 1cc6983b96 Use doubles for the pitch shifter's FFTs and processing 2018-04-24 21:40:41 -07:00
Chris Robinson 8311b57ca6 Update ChangeLog 2018-04-24 00:18:02 -07:00
Chris Robinson 510efae066 Don't specialize biquad processing for a single sample 2018-04-24 00:17:07 -07:00
Chris Robinson b3ba90f5fa Use transposed direct form 2 for the UHJ all-pass filters
This has one extra multiply, but avoids two moves and uses almost half as much
memory for the encoder state.
2018-04-22 03:34:29 -07:00
Chris Robinson e10595df31 Pre-calculate the squares of the UHJ filter coefficients 2018-04-22 02:39:14 -07:00
Chris Robinson b51d30f84d Change some if checks to asserts since they must be true 2018-04-22 02:38:09 -07:00
Chris Robinson ea8b52ee2c Include header files in CMake's source lists 2018-04-21 23:42:04 -07:00
Chris Robinson 9575eebac4 Move the bnad-splitter filters to a separate source 2018-04-21 23:23:46 -07:00
Chris Robinson ace8e64850 Only use fast float-to-int workarounds for x87
At least SSE and ARM have opcodes that handle float-to-int conversions well
enough. Also, Clang doesn't inline lrintf, incurring function call overhead for
what should be a single opcode.
2018-04-21 21:07:20 -07:00
Chris Robinson 4ee26f4ca3 Add some more ASSUME statements 2018-04-21 02:44:01 -07:00
Chris Robinson a55c93e1f5 Improve ASSUME for Clang
For some reason, the { if(!x)__builtin_unreachable(); } construct does not
provide the same optimization opportunity for Clang (even though the condition
being false would trigger undefined behavior by reaching unreachable code, it
still performs checks and such for the condition potentially being false).
Using __builtin_assume seems to work better.
2018-04-21 01:54:43 -07:00
Chris Robinson 400ab8766c Adjust the stereo panning front gain
This gives it a (more) precise -4.5dB gain drop for front-center panned sounds.
2018-04-19 21:55:20 -07:00
Chris Robinson 90b8d639f1 Remove unnecessary undefs 2018-04-19 18:24:27 -07:00
Chris Robinson 525b6fe168 Clear ALSA's PCM handle after closing it 2018-04-19 12:22:39 -07:00
Chris Robinson f96a8fe369 Add some ASSUME statements that ensure mixing at least 1 sample 2018-04-18 20:39:52 -07:00
Chris Robinson 150586d7fe Add an ASSUME macro that requires a true condition 2018-04-17 22:50:50 -07:00
Chris Robinson 09194fd488 Accumulate the B-Format HRTF responses using doubles
The final result is still truncated to single-precision float, but this should
keep the responses more stable as it accumulates the various inputs.
2018-04-17 21:27:47 -07:00
Chris Robinson e619b64175 Don't minimize the HRTF per-response delay
The reverts both fa9ab9af7c and
79604c3c0e. As helpful as it was for the high
frequencies, the overall response's gain suffered.
2018-04-16 18:54:41 -07:00
Chris Robinson 795ed65797 Preliminary ChangeLog update 2018-04-15 19:01:38 -07:00
Chris Robinson 5b82dd8733 Update .gitignore 2018-04-14 13:02:21 -07:00
Chris Robinson 9c5307a48a Rename BiquadState to BiquadFilter 2018-04-04 18:07:46 -07:00
Chris Robinson b1fe405861 Improve ordering of channel processing in makehrtf 2018-04-03 11:21:15 -07:00
Chris Robinson 869637af2e Apply biquad and T60 filters using transposed direct form II 2018-04-03 10:15:35 -07:00
Chris Robinson 414b56edec Initialize COM using the multithreaded apartment
I honestly have no idea which is the correct (or better) mode to use given the
confusing mess COM is, but CoInitialize uses single-threaded apartments which
seems to be a problem for with at least a couple games in the STALKER series
(the call fails, which causes us to drop back to the DSound backend).
2018-04-01 16:39:20 -07:00
Chris Robinson 334bc4f551 Limit the near-field control distance to 10m. 2018-03-31 23:11:48 -07:00
Chris Robinson e288c3b44a Fix HRTF HOA coefficients
ACN8 was accidentally put on ACN7. However, rather than adding the missing
channel of silence, set up the coefficient map to only use the ambisonic
channels that can contribute to output.
2018-03-31 20:44:14 -07:00
Chris Robinson 91900b0599 Fix misspellings of quadraphonic
AL_LOKI_quadriphonic is left alone since that is what the extension is called
and what code expects. All other instances have been fixed for consistency.
2018-03-30 09:18:17 -07:00
Chris Robinson 29ae74d4bb Fix lower elevation synthesis for stereo HRTFs 2018-03-29 20:44:44 -07:00
Chris Robinson a2c24ff946 Specify Libs.private for the pkg-config file
Only used when building the static lib for its dependencies, since the shared
lib automatically handles its own dependencies.
2018-03-29 18:57:48 -07:00
Chris Robinson 61de399806 Don't cache SDL2_LIBRARY_TEMP with CMake
Otherwise it keeps prepending and appending the same extra libs and flags with
each invocation.
2018-03-29 18:10:58 -07:00
Chris Robinson f48a1e3a31 Add simple descriptions to some extension formats in alext.h 2018-03-29 17:18:24 -07:00
Chris Robinson 4a8c3b50b6 Apply the initial decay and air absorption after gain clamping 2018-03-29 16:11:46 -07:00
Chris Robinson 852ad41176 Pass the azimuth and elevation to CalcPanningAndFilters 2018-03-29 16:11:46 -07:00
Chris Robinson 880d555060 Combine two loops 2018-03-29 16:11:46 -07:00
kcat 5523913a81 Merge pull request #184 from hhyyrylainen/master
Added missing string include to alffplay
2018-03-29 16:11:13 -07:00
Henri Hyyryläinen a7da29804d Added missing string include to alffplay 2018-03-30 01:53:55 +03:00
Chris Robinson cae4b1a062 Don't specify macros as arguments to CHECK_INCLUDE_FILE(S) 2018-03-28 14:34:58 -07:00
Chris Robinson 2b16ff3ca8 Check all buffers to update a source with 2018-03-28 06:28:46 -07:00
Chris Robinson 5aecce5a0d Store the ALbufferlistitem's composited/max sample length 2018-03-27 18:09:28 -07:00
Chris Robinson d85ddf8aae Rename NfcFilterUpdate* to NfcFilterProcess* for consistency 2018-03-27 05:58:58 -07:00
Chris Robinson 788f5398b0 Slightly relax the memory order for ref counters 2018-03-26 10:14:27 -07:00
Chris Robinson 964723691a Condense an if check 2018-03-26 06:04:11 -07:00
Chris Robinson 2475d4652c Clear mixing target parameters before setting them 2018-03-25 18:02:07 -07:00
Chris Robinson 79eb2ea26e Reduce the gain of front-panned sounds with plain stereo
Now front-center sounds are attenuated by roughly -4.5dB instead of -3dB. This
will help keep rear-panned sounds from attenuating too much while not making
front-panned also attenuate too much.
2018-03-25 12:24:43 -07:00
Chris Robinson f3672ab26b Annotate the B-Format rotation/conversion matrix 2018-03-25 08:24:53 -07:00
Chris Robinson f757fbce4d Fix Hanning -> Hann window name 2018-03-24 14:18:29 -07:00
Chris Robinson e5e3b05015 Fix capture device closing in the CoreAudio backend 2018-03-24 09:25:49 -07:00
kcat eccf679ca9 Merge pull request #181 from jhasse/sdl2-include
Also add SDL2's include path
2018-03-24 09:25:13 -07:00
Jan Niklas Hasse 3fc9d3a1be Also add SDL2's include path 2018-03-24 16:45:13 +01:00
Chris Robinson 3f071a90a4 Use proc_pidpath to get the process path on macOS when available 2018-03-24 08:25:58 -07:00
Chris Robinson 413d55aaa5 Fix a couple comments about coordinate handedness 2018-03-24 07:02:27 -07:00
Raulshc 6d8062a2a7 EFX: Align some arrays used in intrinsics (#180) 2018-03-24 05:43:56 -07:00
Chris Robinson 6990478369 Rename ALfilterState/Type to BiquadState/Type 2018-03-23 14:52:59 -07:00
Chris Robinson e37634e908 Remove an unused struct and move some functions to where they're used 2018-03-23 11:58:11 -07:00
Chris Robinson 63c9d95b84 Combine multiple allocations into one 2018-03-23 11:39:07 -07:00
Chris Robinson 63c35248be Some formatting cleanup 2018-03-22 11:32:23 -07:00
Chris Robinson 6685e0a078 Don't use an ALsizei for a potentially negative value 2018-03-22 11:11:45 -07:00
Chris Robinson 7789cc8e32 Define the Hanning window globally once for the pitch shifter 2018-03-22 09:55:15 -07:00
Chris Robinson 1d6622aa2b Fix a delta phase offset calculation in the pitch shifter
tmp can be negative, and &1 is not the same as %2 in that case.
2018-03-22 08:56:48 -07:00
Chris Robinson eeff730034 Hold some immediate values on the stack 2018-03-22 08:49:35 -07:00
Chris Robinson 23fd7451d0 Avoid some memset calls in the pitch shifter process loop 2018-03-22 08:49:22 -07:00
Chris Robinson bc3a96308e Use appropriately-sized buffers for the pitch shifter 2018-03-22 08:05:48 -07:00
Chris Robinson 8e976a92f7 Move NFC filters to the filter directory 2018-03-22 07:17:48 -07:00
Chris Robinson 7a23330ffe Move the filter implementation to a separate directory 2018-03-22 07:05:40 -07:00
Chris Robinson 6ea3b5445f Rename mixer_inc.c to hrtf_inc.c 2018-03-22 05:41:42 -07:00
Chris Robinson 091e676db3 Move mixer sources into a sub-directory 2018-03-22 05:06:15 -07:00
Chris Robinson 6ad171781a Use the global MixSamples for the pitch shifter output 2018-03-22 03:13:09 -07:00
Chris Robinson d157d66678 Change a parameter type to float since that's what it's used as 2018-03-22 02:13:40 -07:00
Chris Robinson 4da6364fc2 Slightly restructure the pitch-shifter process loop 2018-03-22 02:10:51 -07:00
Chris Robinson 7b95753cf7 Fix typo (Substraction -> Subtraction) and rename related function 2018-03-21 23:10:12 -07:00
Chris Robinson 8f3d496541 Avoid duplicate path searches in the router
And avoid inadvertently increasing the priority of the system path over the
executable's path, or either of them over the current working directory.
2018-03-21 20:39:04 -07:00
Chris Robinson 0a6c17c544 Don't auto-attenuate the pitch shifter output 2018-03-21 09:32:04 -07:00
Chris Robinson f11d7eeadf Don't use mutable fields for constant values 2018-03-21 09:23:58 -07:00
Chris Robinson 22a7bcd5ad Avoid placing a 2K sample buffer on the stack 2018-03-21 09:01:32 -07:00
Chris Robinson ecc51c8c55 Clean up some code formatting in the pitch shifter source
Clean up excessive newlines and extra-long comments, move static inline
definitions to their declarations.
2018-03-21 08:56:26 -07:00
Chris Robinson 55a73b8df9 Fix for older MSVC lacking strtof 2018-03-21 08:35:37 -07:00
kcat c40b4ce3f2 Merge pull request #177 from Raulshc/Pitch-shifter
EFX:Pitch shifter
2018-03-21 08:35:09 -07:00
Chris Robinson 47260fc70b Update the multi-reverb example with improved transitions
This better calculates the environment coverage by correctly calculating the
portal's extents, improves the panning direction when close to the portal, and
applies attenuation based on contribution. Movement has changed to make the
listener move back and forth between environments with a stationary source,
rather than continually looping environments with a position-relative source.
2018-03-20 23:58:32 -07:00
Raulshc c38854fe3d EFX:Own size for pitch shifter buffers 2018-03-19 16:48:00 +01:00
Chris Robinson df6e4617e4 Fix the reverb panning behavior to better fit the spec
Previously it would attenuate the response from direction opposite to the
vector, whereas the property descriptions say it should simply move all
reflections toward the given direction.
2018-03-19 06:41:38 -07:00
Raulshc 56423b9ef1 Alsoft-config: Add pitch shifter effect 2018-03-18 17:53:07 +01:00
Raulshc 6fd23f0984 EFX:Pitch Shifter implementation
Add pitch shifter effect using standard phase vocoder, based on work of Stephan Bernsee. Only mono signal processing by now.
2018-03-18 17:47:17 +01:00
Chris Robinson 325fca5215 Change the presets for the multireverb example 2018-03-16 05:01:00 -07:00
Chris Robinson 3fde27d890 Use a macro template to define similar functions 2018-03-15 00:28:49 -07:00
Chris Robinson 445f63f350 Remove an extraneous + 2018-03-14 23:59:20 -07:00
Chris Robinson 603e3e23ac Remove an outdated comment 2018-03-14 23:51:13 -07:00
Chris Robinson 2011421e18 Release the PulseAudio mainloop lock sooner 2018-03-14 23:48:46 -07:00
Chris Robinson 7c0e68a33e Store the filter history in local variables
Despite being marked as restrict (and const for src) to mark the pointers as
being non-aliased, it seems the compiler optimizes better this way.
2018-03-14 17:27:41 -07:00
Chris Robinson f65e83c349 Avoid using pa_stream_begin_write with PulseAudio
It seems to actually have a negative performance impact when the system is
under load. Without having actual measurements for any potential benefits,
simply go with the recommended (and previous fallback) method of allocating
space for the write and passing the free method.

Ideally some kind of ring buffer could be used, so rather than constantly
allocating and freeing blocks of memory, it uses the same memory over again
with the callback marking each one as reusable. Unfortunately the callback
isn't given much information to work with, and the update size (minreq) can
potentially change during playback, which complicates things.
2018-03-14 03:21:26 -07:00
Chris Robinson 942abab8f9 Move a loop into a function 2018-03-13 03:45:24 -07:00
Chris Robinson 8eb7a94e1c Apply a distance decay on the source send for the reverb's DecayLFRatio 2018-03-11 22:40:08 -07:00
Chris Robinson 6b35a4534f Comment and clarify some code 2018-03-11 22:18:11 -07:00
Chris Robinson dac9379449 Add methods to clean up althrd and altss data 2018-03-10 12:10:58 -08:00
Chris Robinson a6ddeaf5f1 Rename the mmdevapi backend to wasapi 2018-03-09 18:56:24 -08:00
Chris Robinson 30821e978b Add extern "C" to some headers 2018-03-09 17:24:03 -08:00
Chris Robinson c0e7a5b8b0 Prefix SDL2 device names on Windows 2018-03-09 11:41:28 -08:00
Chris Robinson 8b24255557 Request the device's sample type for SDL2 2018-03-09 10:53:03 -08:00
Chris Robinson 46e7e96eb3 Store the frame size for the SDL2 backend 2018-03-08 22:23:36 -08:00
Chris Robinson 41cc82e84b Print the unsupported values from SDL2 2018-03-08 22:09:30 -08:00
Chris Robinson 2866c6cf28 Init and quit the SDL2 audio subsystem with the factory 2018-03-08 18:59:22 -08:00
Chris Robinson 0c7fa1b955 Avoid deinitializing backends that never initialized 2018-03-08 18:53:49 -08:00
Chris Robinson aa7df8183f Also save the update size with SDL2 2018-03-08 18:22:03 -08:00
Chris Robinson 58760e6184 Use the audio device lock for the SDL2 backend 2018-03-08 18:16:10 -08:00
Chris Robinson 52ca70d98e Properly close the SDL2 audio device 2018-03-08 18:12:14 -08:00
Chris Robinson d4fc87fc9c Avoid calling SDL_GetNumAudioDevices multiple times 2018-03-08 18:07:49 -08:00
Chris Robinson 2187316bce Use function-like macros to call filter and effect vtable methods 2018-03-08 17:48:22 -08:00
Chris Robinson 52dee31270 Only calculate the modulation samples once for all 4 channels 2018-03-08 17:48:22 -08:00
Chris Robinson 22d3e3b563 Simplify modulator effect index updating 2018-03-08 17:48:21 -08:00
Chris Robinson 4e613c5d4b Rename UpdateContextSources for clarity 2018-03-08 17:48:21 -08:00
Chris Robinson 07c8857558 Fix struct forward declaration typo 2018-03-08 17:48:21 -08:00
Chris Robinson 9bd1678299 Fix adding to and removing from the active effect slots
It wasn't properly removing all duplicates on insertion, and didn't remove the
first effect slot when removing them.
2018-03-08 17:48:21 -08:00
Chris Robinson 19281868dc Properly limit the max number of effect slots to 2^31 - 1 2018-03-08 17:48:21 -08:00
kcat 5133fe5115 Merge pull request #175 from jhasse/sdl2-backend
Add SDL2 backend for playback, fix #173
2018-03-08 17:47:32 -08:00
Jan Niklas Hasse 2eb29d538b SDL2 backend: Reset device parameters 2018-03-08 20:42:47 +01:00
Jan Niklas Hasse 0af075b5ff SDL2 backend: Allow changes to channels and format 2018-03-08 20:27:02 +01:00
Jan Niklas Hasse ef2b813776 SDL2 backend: Allow frequency changes 2018-03-08 10:17:02 +01:00
Jan Niklas Hasse a6f93a501a Handle passing NULL to SDL_OpenAudioDevice as a special device
https://discourse.libsdl.org/t/changing-audio-output-when-the-default-audio-playback-device-changes/22399/2
2018-03-08 10:07:22 +01:00
Jan Niklas Hasse 767807cd22 SDL2 backend: Use callback instead of a timing loop
The system clock and audio clock aren't necessarily synchronized.
2018-03-08 09:51:44 +01:00
Jan Niklas Hasse 86319127e3 Add SDL2 backend for playback, fix #173 2018-03-07 20:57:53 +01:00
Chris Robinson 179e1c4dbc Don't check for space in the ringbuffer before trying to write
The write method already checks and returns how much it managed to fit in.
2018-03-03 21:57:42 -08:00
Chris Robinson 945d74cbc9 Avoid some code duplication 2018-03-03 14:04:10 -08:00
Chris Robinson b8636a3dbf Add some missing locks to protect reading state 2018-03-03 13:54:21 -08:00
Chris Robinson 4e6c758daf Use a plain mutex for the property lock 2018-03-03 13:42:37 -08:00
Chris Robinson 4bd02eada6 Init more stuff in InitDevice 2018-03-03 09:00:14 -08:00
Chris Robinson bd32a682f7 Use atomic variables instead of volatile 2018-03-02 19:16:55 -08:00
Chris Robinson 03274a5b95 Ensure at least the specified ringbuffer size is writable
Previously, all but one of the specified size could be written (so for a size
of n, only n-1 was guaranteed writable). All users pretty much compensated for
this, but it makes more sense to fix it at the source.
2018-03-02 13:01:11 -08:00
Chris Robinson 6f62fed65c Add an option to limit the write size of the ringbuffer 2018-03-01 21:23:13 -08:00
Chris Robinson cba37819d1 Add missing include 2018-03-01 21:19:49 -08:00
Chris Robinson 4b85104c4f Apply the limiter, distance comp, and others even with no output buffer 2018-03-01 16:16:37 -08:00
Chris Robinson 0d91d63cf3 Fix use of argv[0] as the program name after incrementing 2018-02-28 21:04:45 -08:00
Chris Robinson abc6e37e6e Apply distance attenuation to reverb zones in almultireverb 2018-02-28 20:59:41 -08:00
Chris Robinson 812cb62617 Fix a comment regarding the effect slot channel scaling 2018-02-28 20:39:53 -08:00
Chris Robinson a211c2f5e4 Avoid AL prefix on internal effect state factory types
Also avoid using the generic V/V0 macros for them
2018-02-28 19:37:12 -08:00
Chris Robinson d25398d2c7 Avoid using static inline in headers 2018-02-25 13:14:14 -08:00
Chris Robinson 654a45833a Only send one buffer completed event per update
The 'param' callback parameter indicates the number of buffers that were
completed.
2018-02-25 10:05:25 -08:00
Chris Robinson 455763aa9a Count all buffers in a list item for processed and queued 2018-02-25 09:51:07 -08:00
Chris Robinson c7456affd5 Don't make the source state atomic 2018-02-24 09:44:52 -08:00
Chris Robinson a1ef5e38b6 Handle source state change events 2018-02-24 09:24:18 -08:00
Chris Robinson 14bdc6c2ef Use separate functions to add and remove active effect slots 2018-02-23 23:02:31 -08:00
Chris Robinson bf886444d2 Avoid multiple GetChannelIdxByName calls 2018-02-21 19:53:18 -08:00
Chris Robinson 9fc2dbe063 Update the multi-zone reverb example for clarity 2018-02-20 08:08:18 -08:00
Chris Robinson 51c6d13c0f Add almultireverb to the install target 2018-02-20 08:08:18 -08:00
kcat e7ac63be4d Merge pull request #171 from digitalist/patch-1
fix building on freebsd (clang), maybe osx too
2018-02-20 07:46:38 -08:00
Alexey Elymanov d7d043a5ef fix building on freebsd (clang)
fixes error: 'pow' is not a member of 'std'
2018-02-20 11:53:55 +03:00
Chris Robinson 1002bc36e0 Add an example for multi-zone reverb 2018-02-18 23:56:51 -08:00
Chris Robinson 6ff50558a0 Use a proper struct for specifying angular points 2018-02-18 23:56:51 -08:00
Chris Robinson fa9ab9af7c Minimize each response delay for the ambisonic HRTF decode 2018-02-18 23:56:51 -08:00
Chris Robinson b5aa0c0759 Remove the unnecessary ComputeAmbientGains 2018-02-18 23:56:51 -08:00
Chris Robinson 79604c3c0e Preserve RMS for the high-frequency HRTF ambisonic coefficients 2018-02-18 23:56:51 -08:00
Chris Robinson 7a974b2460 Combine the vector reverse and partial scatter where they're together 2018-02-18 23:56:51 -08:00
Chris Robinson 7f3d69fdbc Remove an unnecessary comment about if meters_per_unit is > 0 2018-02-18 23:56:51 -08:00
Chris Robinson 7dafac0c34 Avoid duplicating some scale tables 2018-02-18 23:56:51 -08:00
kcat c24aea712b Merge pull request #170 from digitalist/patch-1
freebsd fix: typo
2018-02-18 23:56:02 -08:00
Alexey Elymanov 063ad490a2 freebsd fix: typo
Alc/helpers.c:738:30: error: use of undeclared identifier 'KERN_PROCARGS'
    int mib[4] = { CTL_KERN, KERN_PROCARGS, getpid() };

/usr/include/sys/sysctl.h:
`#define	KERN_PROC_ARGS		7	/* get/set arguments/proctitle */`
there's no KERN_PROCARGS
2018-02-18 20:55:31 +03:00
Chris Robinson 59768674f1 Use an alternate ambisonic HRTF decode layout
Similar to the previous, but includes the top and bottom HRTF responses. The
higher-order decode (for the "basic" HRTF output) also now uses 2H1P mixed-
order instead of 2H1V, which seems more stable.
2018-02-13 03:03:26 -08:00
Chris Robinson 2cb49e51a0 Fix NULL pointer dereference 2018-02-12 22:20:43 -08:00
Chris Robinson 6b76eddbe3 Supply HF coefficient scales with a single-band ambisonic matrix 2018-02-12 21:24:58 -08:00
Chris Robinson 59934b47de Avoid using an enum for array indices 2018-02-12 20:58:39 -08:00
Chris Robinson 4d417f3dd4 Make bformatdec_free and ambiup_free clear the freed pointer 2018-02-12 20:48:28 -08:00
Chris Robinson dce497fbca Use a bitfield for enabled bformatdec channels 2018-02-12 20:33:31 -08:00
Chris Robinson e63e0ee596 Combine multiple functions called sequentially 2018-02-11 22:23:03 -08:00
Chris Robinson 494e9fd61d Don't asynchronously modify the source on disconnect 2018-02-11 16:58:34 -08:00
Chris Robinson b11e31fbfd Clear stale 'post's on the event semphaphore 2018-02-11 06:14:18 -08:00
Chris Robinson 1e93122470 Remove unused reverb modulation code
Still unsure how to handle reverb modulation without some kind of reference
output, so remove the related functions to not waste CPU time. It'll remain in
the Git history should it ever need to be resurrected.
2018-02-10 19:50:42 -08:00
Chris Robinson 5b11129eaa Use a function pointer for applying the dry mix post-process 2018-02-10 15:50:05 -08:00
Chris Robinson ee3d53a673 Use an alternate virtual layout for Ambisonic HRTF decoding
This uses 16 channels, an 8-channel octagon + 8-channel cube, which should
improve horizontal resolution without affecting vertical too much.
2018-02-10 05:16:28 -08:00
Chris Robinson c346baff5b Clarify some macro names using ambisonic mixed-mode notation 2018-02-09 18:43:34 -08:00
Chris Robinson 20bee69955 Attempt to improve the reverb panning vectors
This should now retain the original orientation of the soundfield and merely
focus on the panning vector direction, as intended.
2018-02-08 01:18:40 -08:00
Chris Robinson 4cd04f192d Alter tha curve of the density-related delay scale
The delay scale is roughly linear with respect to room size, however the
density is not linear with room size. The density is calculated by taking the
room size cubed, then normalized by some factor. Unnormalizing the density and
taking the cube root restores the original room size to use as a delay scale.

The patch also alters the delay and all-pass line lengths to be based on a 1
meter room size, so the the room size recovered from the density acts as a
direct multiple for the desired target length.

Note that the room scale range is unchanged (5m to 50m), so the minimum and
maximum delays are the same. It should also be noted that 50m may not be the
correct room size for a density value of 1. A density value of 1 corresponds to
an environment size of roughly 2.52m when converted from EAX (DENSITY_SCALE
should be 16 rather than 125000), but sizes that low result in undesirable
resonance in the feedback, indicating other changes are necessary for that to
work.
2018-02-08 00:05:29 -08:00
Chris Robinson f5f996c14a Check for a cbrtf function 2018-02-06 02:35:08 -08:00
Chris Robinson da1ee3baba Revert "Don't fade the all-pass delay changes"
This reverts commit 799dfb732b.
2018-02-04 19:57:22 -08:00
Chris Robinson 1d7a5dbede Remove unsupported source queries 2018-02-04 15:01:04 -08:00
Chris Robinson 9b878c64f9 Make the Connected state atomic
Also don't send the Disconnected event more than once.
2018-02-04 00:01:12 -08:00
Chris Robinson 1f61472e77 Avoid potentially writing partial samples 2018-02-03 14:02:47 -08:00
Chris Robinson b99e64a0e3 Provide more descriptive messages to disconnection events 2018-02-03 13:54:42 -08:00
Chris Robinson e49607078e Handle disconnected events in alffplay 2018-02-03 11:27:03 -08:00
Chris Robinson 4ef60d7214 Add a couple missing lock calls 2018-02-03 01:26:04 -08:00
Chris Robinson 40bda4d93f Add a disconnected event type 2018-02-03 01:07:06 -08:00
Chris Robinson 8f4c078fb5 Add missing header for UINT_MAX 2018-02-02 23:08:29 -08:00
Chris Robinson 80cc32d77b Remove the unused thunk code 2018-02-02 22:59:06 -08:00
Chris Robinson 28fa82378b Remove the individual source queue and buffer locks
They're inherently protected by the mutex for their respective lists. Should
those mutexes be replaced by rwlocks the individual locks should also be
reinstated, but they're unlikely to be unless a lot of contention starts
happening in the read-only case.
2018-02-02 22:24:33 -08:00
Chris Robinson 6a4a88f8f5 Store an index to a given source's voice
For more efficient voice lookups when needed.
2018-02-01 23:56:35 -08:00
Chris Robinson a114d6cbb5 Remove unused _timed methods
They're not reliably implemented anyway, as some systems will just flat out
fail when trying to use them.
2018-02-01 22:24:17 -08:00
Chris Robinson 3acd2a55ad Don't generate Buffer Completed events for static sources 2018-02-01 21:07:55 -08:00
Chris Robinson 3a90fd5751 Avoid an unnecessary temp variable 2018-02-01 19:11:23 -08:00
Chris Robinson ec14c98f2d Use an atomic instead of volatile to tell a thread to quit 2018-02-01 18:59:32 -08:00
Chris Robinson 975c682ec3 Use semaphores to signal for more samples with JACK and OpenSL 2018-02-01 18:54:13 -08:00
Chris Robinson e240351d81 Use a semaphore to signal the event handler
Semaphores allow for semi-persistent signals, compared to a condition variable
which requires a mutex for proper detection. A semaphore can be 'post'ed after
writing some data on one thread, and another thread will be able to recognize
it quickly even if the post occured in between checking for data and waiting.

This more correctly fixes a race condition with events since the mixer
shouldn't be using mutexes, and arbitrary wake-ups just to make sure an event
wasn't missed was quite inefficient.
2018-02-01 18:20:14 -08:00
Chris Robinson 4ec31291c0 Add semaphore functions to the thread API wrapper 2018-02-01 17:37:31 -08:00
Chris Robinson 7a538141c9 Signal a condition variable when a buffer completes in alffplay 2018-02-01 02:24:44 -08:00
Chris Robinson bcdc399029 Send buffer completed events when enabled 2018-02-01 01:36:03 -08:00
Chris Robinson 8652ae046b Fix check for matching event type 2018-02-01 00:50:06 -08:00
Chris Robinson 833eface38 Don't print buffer completed events in alffplay 2018-01-31 20:27:14 -08:00
Chris Robinson 7256bc92fa Add a thread to marshal events from the mixer
To avoid having unknown user code running in the mixer thread that could
significantly delay the mixed output, a lockless ringbuffer is used for the
mixer to provide events that a secondary thread will pop off and process.
2018-01-31 20:21:54 -08:00
Chris Robinson 0394d5a44f Rename EventLock to make it more clear it's protecting the callback 2018-01-30 12:34:25 -08:00
Chris Robinson e7217760f3 Don't bother with an explicit stop backend method 2018-01-29 01:00:53 -08:00
Chris Robinson a042dbf305 Call the backend close method in the destructor 2018-01-28 23:32:28 -08:00
Chris Robinson 328fd7329d Combine common initialization code into a function 2018-01-28 18:03:54 -08:00
Chris Robinson a24a22c39a Fix the effect slot limit check 2018-01-28 17:56:47 -08:00
Chris Robinson c2710ffe87 Make EnabledEvts atomic 2018-01-28 16:58:41 -08:00
Chris Robinson 782eb650c7 Use std::array instead of a plain array in alffplay 2018-01-28 13:18:33 -08:00
Chris Robinson 38a3ba74d4 Report the problem value for global state errors 2018-01-28 13:13:40 -08:00
Chris Robinson d1da9f1f67 Remove some now-unused NoLock function variants 2018-01-28 00:53:21 -08:00
Chris Robinson dcc5a10c7b Use a fixed array for the effect state factory list 2018-01-28 00:10:12 -08:00
Aaron Jacobs 79bce84900 Add option to disable "build_version" cmake target 2018-01-28 00:03:02 -08:00
Chris Robinson 0051ebace0 Don't bother with a return value that's never used 2018-01-27 23:50:04 -08:00
Chris Robinson 0cd61fd197 Don't allocate more effect slots than allowed 2018-01-27 23:07:29 -08:00
Chris Robinson f16ece6048 Move some inline functions into a header instead of copying them
Unfortunately does not include the Lookup* functions, which need the full type
declaration to offset the pointer.
2018-01-27 21:16:24 -08:00
Chris Robinson e12059a311 Fix error reporting for resource generation 2018-01-27 20:04:21 -08:00
Chris Robinson cb9fb31214 Store filters in an array of lists 2018-01-27 19:40:47 -08:00
Chris Robinson e8c268ef09 Store effects in an array of lists 2018-01-27 19:04:32 -08:00
Chris Robinson 6a839600b9 Use a vector to store the effect slot pointers
And make the ID a simple index into it (1-base, to avoid ID 0).
2018-01-27 19:04:32 -08:00
Chris Robinson 4d1795e90b Remove an unused function 2018-01-27 19:04:32 -08:00
kcat 277127829a Merge pull request #166 from Ybalrid/betterReadme
Better readme
2018-01-27 19:03:50 -08:00
Arthur Brainville 58fd9d70d2 Additional corrections as mentionned in the PR 2018-01-28 03:26:02 +01:00
Arthur Brainville d2cf61c99a Added AppVeyor badge 2018-01-28 02:29:54 +01:00
Arthur Brainville 6562a939ea Add project overview and travis build badge
Signed-off-by: Arthur Brainville (Ybalrid) <ybalrid@ybalrid.info>
2018-01-28 01:37:00 +01:00
Chris Robinson 031cf24880 Use an array lookup for source IDs
This is now similar to buffers, being stored in groups of 64 in a vector with
the ID providing the array indices.
2018-01-27 14:34:05 -08:00
Chris Robinson 38261a0f2a Make some more functions static where they're used 2018-01-27 14:34:05 -08:00
Chris Robinson c4a76af397 Add some casts to pacify MSVC 2018-01-27 14:34:05 -08:00
Chris Robinson f76ab02bd4 Add a ctz64 fallback using _BitScanForward when available 2018-01-27 14:34:05 -08:00
kcat 4d392a8b87 Merge pull request #165 from Ybalrid/Ybalrid-readme-patch
Reformat README for a nicer display on github
2018-01-27 14:33:38 -08:00
Arthur Brainville c969dad6c2 Reformat README for a nicer display on github 2018-01-27 23:16:36 +01:00
Chris Robinson 9718502e5d Check for _BitScanForward64 before using it 2018-01-27 11:11:39 -08:00
Chris Robinson 9613b4bfe2 Use a different method for storing and looking up buffers
Rather than each buffer being individually allocated with a generated 'thunk'
ID that's used with a uint:ptr map, buffers are allocated in arrays of 64
within a vector. Each group of 64 has an associated 64-bit mask indicating
which are free to use, and the buffer ID is comprised of the two array indices
which directly locate the buffer (no searching, binary or otherwise).

Currently no buffers are actually deallocated after being allocated, though
they are reused. So an app that creates a ton of buffers once, then deletes
them all and uses only a couple from then on, will have a bit of waste, while
an app that's more consistent with the number of used buffers won't be a
problem. This can be improved by removing elements of the containing vector
that contain all-free buffers while there are plenty of other free buffers.

Also, this method can easily be applied to other resources, like sources.
2018-01-27 01:51:01 -08:00
Chris Robinson 5d2196c119 Don't rely on alMain.h in alBuffer.h 2018-01-26 21:32:43 -08:00
Chris Robinson a885fd6d0e Make some functions static that are only used in one source 2018-01-26 21:11:12 -08:00
Chris Robinson 3ba4746ff8 Allow preserving converted samples 2018-01-26 16:41:14 -08:00
Chris Robinson e1e1c73ae6 Read the buffer unpack alignment under the buffer lock 2018-01-26 15:58:38 -08:00
Chris Robinson fbafbe6272 Improve error reporting for buffers 2018-01-26 00:13:03 -08:00
Chris Robinson 6ae7fc5df1 Add the printf-format attribute to alSetError 2018-01-25 23:52:09 -08:00
Chris Robinson 99f0377ae3 Construct error messages using parameterized values 2018-01-25 15:59:59 -08:00
Chris Robinson 932939c5a8 Enable events in alffplay 2018-01-24 20:04:57 -08:00
Chris Robinson 0c9c846522 Report AL_SOFTX_events as an in-progress extension 2018-01-24 19:59:22 -08:00
Chris Robinson f5236ab186 Use more appropriate enum values for events 2018-01-24 19:25:15 -08:00
Chris Robinson 2a7f5aa569 Add a deprecated event type for alDopplerVelocity 2018-01-24 18:47:19 -08:00
Chris Robinson 1d86aea61c Fix ordering of alGetPointervSOFT 2018-01-24 18:30:32 -08:00
Chris Robinson 2ded5547ba Provide messages for the remaining AL errors 2018-01-24 17:07:01 -08:00
Chris Robinson 395278fcdb Set the buffer load error in LoadData 2018-01-24 12:45:56 -08:00
Chris Robinson 786a05876e Call the event callback when an error is generated
Most errors don't yet provide correct object IDs or text messages for the AL
error.
2018-01-24 12:10:48 -08:00
Chris Robinson caa3b4f7f8 Handle event properties
This just implements the event methods insofar as tracked state. No events are
generated/reported yet.
2018-01-23 18:25:59 -08:00
Chris Robinson 2266a9e01e Declare the beginnings of an event extension 2018-01-23 17:42:39 -08:00
Chris Robinson def2547e40 Fix some 'may be used initialized' warnings 2018-01-23 16:03:06 -08:00
Chris Robinson 2ac0adaebb Use a new proper buffer function with a flags parameter
Rather than hackily combining bit flags with the format, to increase the number
of potential flags. alBufferData now behaves as if calling alBufferStorageSOFT
with a flags value of 0.
2018-01-23 14:33:30 -08:00
Chris Robinson 4ebb97bf73 Test mapped buffers in alffplay 2018-01-23 11:15:25 -08:00
Chris Robinson b05592b0ab Ensure read or write flags are specified with persistent mappings 2018-01-23 10:59:51 -08:00
Chris Robinson 9ee58fd454 Track the buffer's mapped section 2018-01-23 10:51:23 -08:00
Chris Robinson 4f9a0460c4 Add a flag for persistent mapping
And a function to "flush" a mapped buffer
2018-01-23 10:38:27 -08:00
Chris Robinson ad61392318 Slightly simplify alBufferSubDataSOFT 2018-01-22 16:17:45 -08:00
Chris Robinson a852ecf8ce Ensure proper alignment when preserving data too 2018-01-22 15:52:53 -08:00
Chris Robinson d6d6ec03f1 Don't bother allocating cleared memory for buffer storage 2018-01-22 15:46:46 -08:00
Chris Robinson fce72610bb Add a flag for alBufferData to non-destructively resize the data
Requires having the same format as the last call to alBufferData. Also only
makes sense when given a NULL data pointer, as otherwise the internal data will
be overwritten anyway.
2018-01-22 11:34:16 -08:00
Chris Robinson 4a368ab905 Fix the return type of the al_fwrite wrapper 2018-01-22 10:48:55 -08:00
Chris Robinson f1f7fba3b9 Don't convert/copy samples with a NULL dest buffer
Only happens with a 0 size, so there's nothing to copy or convert anyway.
2018-01-22 00:31:27 -08:00
Chris Robinson ca07e210a7 Remove now-unused alloca and VLA checks 2018-01-21 23:50:47 -08:00
Chris Robinson 5f3ae527c9 More cleanup for buffer loading
Don't bother with unnecessary and unused converters, and remove some
unsupported queries.
2018-01-21 23:35:28 -08:00
Chris Robinson db13af1935 Handle double-precision buffers in the mixer 2018-01-21 18:34:03 -08:00
Chris Robinson efd11f32a2 Remove support for (signed) byte and ushort sample storage
Also not used without buffer_samples
2018-01-21 18:16:27 -08:00
Chris Robinson 6489fb586b Remove (u)int32 sample storage conversion
Unused without the buffer_samples extension
2018-01-21 17:55:35 -08:00
Chris Robinson 427212705f Remove the old buffer_samples functions
The symbols are still there and exported to retain ABI compatibility, but they
no longer do anything except set an AL_INVALID_OPERATION error. They're also
removed from the function and enum tables, since they're not part of any
supported extension.
2018-01-21 17:19:57 -08:00
Chris Robinson f6276164f3 Fix the return type of the LPALUNMAPBUFFERSOFT typedef 2018-01-21 16:32:37 -08:00
Chris Robinson dcb934fc2e Avoid repeating some code 2018-01-21 10:32:48 -08:00
Chris Robinson c2c3846930 Expose a preliminary AL_SOFT_map_buffer extension for testing 2018-01-20 13:37:43 -08:00
Chris Robinson 03d4e4acc4 Add methods to "map" a buffer's storage
Requires the MAP_READ_BIT or MAP_WRITE_BIT flags to be OR'd with the format
upon a call to alBufferData, to enable mappable storage for the given access
types. This will fail if the format requires internal conversion and doesn't
resemble the original input data, so the app can be guaranteed the size, type,
and layout of the original data is the same as what's in storage.

Then alMapBufferSOFT may be called with appropriate bit flags to get a readable
and/or writable pointer to the buffer's sample storage. alUnmapBufferSOFT must
be called when access is finished. It is currently invalid to map a buffer that
is attached to a source, or to attach a buffer to a source that is currently
mapped. This restriction may be eased in the future, at least to allow read-
only access while in use (perhaps also to allow writing, if coherency can be
achieved).

Currently the access flags occupy the upper 8 bits of a 32-bit bitfield to
avoid clashing with format enum values, which don't use more than 16 or 17
bits. This means any future formats are limited to 24-bit enum values, and also
means only 8 flags are possible when declaring storage. The alternative would
be to add a new function (alBufferStorage?) with a separate flags parameter.
2018-01-20 11:49:01 -08:00
Chris Robinson 4e647bda07 Return the effective alignment from SanitizeAlignment 2018-01-19 21:00:53 -08:00
Chris Robinson ab2295b68f Store 8-bit sample types directly as unsigned byte 2018-01-19 20:10:31 -08:00
Chris Robinson 940c6146e8 Remove unnecessary private AL_SOFT_buffer_samples2 definitions 2018-01-19 19:28:23 -08:00
Chris Robinson b56673bbce Make a function static that's only used in one source file 2018-01-17 18:43:23 -08:00
Chris Robinson 2102625021 Reformat the format array 2018-01-17 18:03:31 -08:00
Chris Robinson 884fe40fd1 Store mulaw and alaw samples directly in the buffer
They're now decompressed on the fly in the mixer. This is not a significant
performance issue given that it only needs a 512-byte lookup table, and the
buffer stores half as much data (it may actually be faster, requiring less
overall memory).
2018-01-17 08:49:49 -08:00
Chris Robinson 3baf9d0e81 Add a method to get the system's page size 2018-01-16 19:28:10 -08:00
Chris Robinson 248832b266 Use a voice flag to indicate it being static 2018-01-16 18:07:59 -08:00
Chris Robinson bf8c889631 Define DECL_VLA where it's used 2018-01-16 12:57:06 -08:00
Chris Robinson 273dca2fa0 Avoid using alloca in the CoreAudio backend 2018-01-16 12:54:20 -08:00
Chris Robinson e80b016cbe Use a global RowMixerFunc 2018-01-16 12:18:59 -08:00
Chris Robinson 8c19497340 Properly cast some parameters for MSVC 2018-01-16 09:40:34 -08:00
Chris Robinson 5deb1df8db Add min/max/clamp functions for size_t 2018-01-16 09:39:28 -08:00
Chris Robinson 14a0df03e8 Do more samples at once with the distortion effect 2018-01-16 08:49:15 -08:00
Chris Robinson bc44efb91d Use ALsizei for some count/length variables 2018-01-15 18:31:43 -08:00
Chris Robinson 799dfb732b Don't fade the all-pass delay changes 2018-01-15 18:02:11 -08:00
Chris Robinson 813b06a3a4 Fix a comment regarding the T60 filter coefficients 2018-01-15 09:22:28 -08:00
Chris Robinson 47c9b0a17e Simplify preparing the T60 filters 2018-01-15 09:17:15 -08:00
Chris Robinson 44795b8614 Assign the HRTF storage pointers separately 2018-01-15 08:38:25 -08:00
Chris Robinson 5acb2e5165 Remove alffplay's duplicate ALC_SOFT_device_clock declarations 2018-01-15 07:14:35 -08:00
Chris Robinson 682205a3d4 Finalize ALC_SOFT_device_clock 2018-01-15 06:45:53 -08:00
Chris Robinson 7441311e3d Use separate input and outputs for the T60 and allpass processing 2018-01-15 05:37:00 -08:00
Chris Robinson 6f48dac4cc Use a proper type for the T60 decay filter 2018-01-15 05:23:35 -08:00
Chris Robinson bc078e5158 Separate some anonymous structs into defined structs 2018-01-14 15:42:25 -08:00
Chris Robinson 63416bf28f Avoid unnecessarily using type aliases 2018-01-14 09:02:59 -08:00
Chris Robinson 0152bc0d10 Remove the SAFE_CONST macro
Seems compilers are now allowing a pointer-to-type-array to implicitly convert
to pointer-to-const-type-array.
2018-01-14 08:51:03 -08:00
Chris Robinson 7e491ef2b2 Remove a redundant lower value clamp 2018-01-14 08:25:36 -08:00
Chris Robinson 6f532fa0e5 Don't check the modulation depth for changes multiple times 2018-01-14 07:33:53 -08:00
Chris Robinson 25b3ed3532 Use separate arrays for the T60 filter states 2018-01-14 07:29:18 -08:00
Chris Robinson 7a77a20a67 Use a macro for the number of reverb lines 2018-01-14 07:25:02 -08:00
Chris Robinson 2957d85924 Only pass the needed parameters to LateT60Filter 2018-01-14 05:24:23 -08:00
Chris Robinson 2b968766b9 Pre-apply the T60 filter midgain to the HF filter coeffs 2018-01-13 09:58:47 -08:00
Chris Robinson 78cb70a5f9 Replace some freq_mult variable names with f0norm
The latter is a bit more descriptive as f0 is often used to denote the
reference frequency of a filter, so f0norm indicates the normalized reference
frequency (ref_freq / sample_rate).
2018-01-13 09:14:46 -08:00
Chris Robinson 16e4e0fa7c Use a more normal vtable setup for filter methods 2018-01-13 08:07:03 -08:00
Chris Robinson c031b3cc6a Avoid fixed-PATH_MAX-size buffers
Windows still needs to use MAX_PATH in a couple places, but that macro's
guaranteed there.
2018-01-13 04:40:20 -08:00
Chris Robinson bbc4ebecab Use GetProcBinary to get the executable name for PulseAudio 2018-01-13 03:41:56 -08:00
Chris Robinson 71ad3b1715 Use KERN_PROCARGS to get the process path+filename on FreeBSD 2018-01-13 03:38:10 -08:00
Chris Robinson af8bbefcab Support procfs on *BSD to get the process binary 2018-01-13 03:22:41 -08:00
Chris Robinson 26043269e4 Allow GetProcPath to return the filename also 2018-01-13 02:59:21 -08:00
Chris Robinson c9edf7cf78 Add a string function to copy a wide-char range 2018-01-13 02:03:13 -08:00
Chris Robinson 77910afe57 Make NumAttrsForDevice do similar type checks as alcGetIntegerv 2018-01-12 11:34:23 -08:00
Chris Robinson 4db1328bc5 Move the FORCE_ALIGN macro to threads.h 2018-01-12 03:55:33 -08:00
Chris Robinson e634564b26 Make a couple functions inline 2018-01-12 02:37:48 -08:00
Chris Robinson dae5faedb0 Use atomic variables in place of volatile 2018-01-11 23:28:15 -08:00
Chris Robinson 1f236d8f20 Define a function where it's used 2018-01-11 22:42:25 -08:00
Chris Robinson 370817ba60 Move logging declarations to a separate header 2018-01-11 20:17:02 -08:00
Chris Robinson 2873abcbc0 Fix up some types for MSVC 2018-01-11 10:55:35 -08:00
Chris Robinson e89c183231 Avoid including alMain.h in ringbuffer.c 2018-01-11 10:03:26 -08:00
Chris Robinson ca9e6a4f94 Ensure NextPowerOf2 is being used correctly 2018-01-11 09:53:52 -08:00
Chris Robinson b11131ce0c Move a forward declaration to the others 2018-01-11 09:43:45 -08:00
Chris Robinson 2d2ca1d791 Remove SET_VTABLE1 2018-01-11 09:39:52 -08:00
Chris Robinson 85a8f965e5 Clean up the EffectList members and make the list size known 2018-01-11 09:34:01 -08:00
Chris Robinson 88545ccae5 Move the EffectList array to alEffect.c/h 2018-01-11 09:25:17 -08:00
Chris Robinson 3832b25f30 Move the ringbuffer declarations to a separate header
And rename alcRing.c to ringbuffer.c for consistency.
2018-01-11 09:16:28 -08:00
Chris Robinson 15ad5245bf Move the FPU mode declarations to a separate header
Also don't use inheritance with FPUCtl.
2018-01-11 08:44:52 -08:00
Chris Robinson 8aa9e35f8c Move the config function declarations to their own header
And rename alcConfig.c to alconfig.c for consistency.
2018-01-11 07:56:54 -08:00
Chris Robinson 81b13f78ea Move the CPU capability flags to a separate header 2018-01-11 07:19:19 -08:00
Chris Robinson 9b9ec2c21a Move the compressor/limiter declarations to their own header 2018-01-11 06:50:53 -08:00
Chris Robinson f3c9bc114c Move the polymorphic/inheritance macros to a separate header 2018-01-11 06:32:45 -08:00
Chris Robinson ff231b42ff Reorder some loops in the equalizer and use MixSamples 2018-01-11 05:03:00 -08:00
Chris Robinson 9c33f4aea8 Use MixSamples for the dedicated and ring modulator effect output 2018-01-11 04:48:18 -08:00
Chris Robinson f55583330b Apply the distortion gain to the mixing gains 2018-01-11 04:34:51 -08:00
Chris Robinson 2c8e4467c3 Move some HRTF structures to hrtf.h 2018-01-11 03:53:25 -08:00
Chris Robinson 15f9d15ba0 Avoid using macros to access anonymous structures 2018-01-11 03:45:23 -08:00
Chris Robinson 279799ad70 Don't return whether the bsinc filter cuts or not 2018-01-10 19:20:58 -08:00
Chris Robinson ea6b384980 Make a function pointer static 2018-01-10 19:13:41 -08:00
Chris Robinson ef63ec3fe9 Use one macro to handle both resample padding sizes 2018-01-09 23:55:59 -08:00
Chris Robinson de8c5b1824 Combine the chorus and flanger processing functions
Given that they're nearly identical, it should be relatively simple to use the
same effect state to process either of them, similar to the reverbs. The big
differences seem to be the delay range (much shorter with flanger) and the
defaults.
2018-01-09 23:21:16 -08:00
Chris Robinson 9e2eb5dc23 Rename the device's temp buffer storage to be more generic 2018-01-09 22:01:46 -08:00
Chris Robinson 5d1207104a Remove standard reverb specific processing functions 2018-01-07 22:48:03 -08:00
Chris Robinson d547f52d8f Move the UNEXPECTED macro to the main header and rename it 2018-01-07 22:20:08 -08:00
Chris Robinson 56e9cb69d3 Ensure the chorus delay and depth leave enough padding for resampling
Also use cubic resampling for the modulated tap. Applies to flanger too.
2018-01-07 21:15:18 -08:00
Chris Robinson 70973035de Use a separate function to get the cubic value 2018-01-07 17:24:29 -08:00
Chris Robinson c8a30592e8 Only print the time in alffplay when it changes 2018-01-07 17:23:51 -08:00
Chris Robinson d8258984b4 Use a -40dB drop for bsinc12
This improves the transition width at the cost of slightly more audible high-
frequency noise (nothing compared to linear or cubic, but still some). The
previous transition band caused a noticeable loss in higher frequencies, making
lower sample rate sources sound exceptionally dull or muffled.
2018-01-07 06:43:35 -08:00
Chris Robinson c423b6c8b7 Remove the sinc4 table 2018-01-07 05:58:52 -08:00
Chris Robinson 4cc1c64646 Replace the sinc4 resampler with cubic
Turns out the C version of the cubic resampler is just slightly faster than
even the SSE3 version of the FIR4 resampler. This is likely due to not using a
64KB random-access lookup table along with unaligned loads, both offseting the
gains from SSE.
2018-01-07 05:32:07 -08:00
Chris Robinson 0e1fd34c89 Fix a temp buffer leak in alffplay 2018-01-05 20:41:55 -08:00
Chris Robinson 10f2531b6c Handle the audio clock diff as nanoseconds in alffplay 2018-01-05 05:41:57 -08:00
Chris Robinson ecd327e5e1 Test the correct offset for the loop start range 2018-01-04 21:21:48 -08:00
Chris Robinson 510bccb6ac Use the correct start point when looping 2018-01-04 20:21:46 -08:00
Chris Robinson 32330c5eef Use separate outputs for the vector reverse and scatter functions 2018-01-04 20:04:39 -08:00
Chris Robinson e00ef16893 Avoid the modulated output tap for late reverb
And fix the output filtering. The modulation code is still there since it's
(probably) technically correct, but the interaction with the feedback loop and
filtering on the output caused improper behavior which needs to be sorted out.
2018-01-04 19:17:16 -08:00
Chris Robinson fd8143fea0 Use a non-recursive mutex for alffplay's source lock 2018-01-03 19:05:25 -08:00
Chris Robinson 08a4840298 Don't offset the reverb modulation sinus 2018-01-02 19:52:57 -08:00
Chris Robinson a16f933e3a Use a float literal for float math 2018-01-02 19:44:31 -08:00
Chris Robinson 9d61f429a5 Use ALC_SOFT_device_clock in alffplay 2018-01-02 19:32:28 -08:00
Chris Robinson b8de63d608 Reset CompLen when loading loop repeats in the mixer 2018-01-02 19:29:58 -08:00
Chris Robinson dcc0f6e25d Improve starting synchronization in alffplay
It waits until the internal buffers are filled before starting playback, then
triggering the audio and video to start as close together as possible.
2018-01-02 03:31:12 -08:00
Chris Robinson 21684fac69 Inline and simplify some code 2018-01-01 22:28:28 -08:00
Chris Robinson 329333ca8b Don't leak the AVIOContext 2018-01-01 19:16:05 -08:00
Chris Robinson 91e20dc12e Fix a couple alffplay comments still referencing Alure 2018-01-01 18:54:15 -08:00
Chris Robinson aecfa0b426 Make smart pointer wrappers for some ffmpeg types 2018-01-01 18:47:48 -08:00
Chris Robinson 9675068706 Print the running time and duration in alffplay 2018-01-01 16:15:32 -08:00
Chris Robinson cbd55ad31e Use aliases to simplify some time type names 2018-01-01 02:26:39 -08:00
Chris Robinson 5eb1753d31 Wrap av_gettime to ensure it's interpreted as microseconds 2018-01-01 01:39:28 -08:00
Chris Robinson e277f5e268 Rename the do_direct_out variable 2018-01-01 01:14:53 -08:00
Chris Robinson 145bf52b7a Use a less-intense memory order to check for quitting 2018-01-01 01:13:32 -08:00
Chris Robinson fe7bdc93eb Check for AL_SOFT_direct_channels once when initializing 2018-01-01 01:07:29 -08:00
Chris Robinson d889435334 Declare the total buffer time instead of buffer count 2018-01-01 01:04:47 -08:00
Chris Robinson dad17a7d91 Use a std::array for the buffers in alffplay 2018-01-01 00:32:27 -08:00
Chris Robinson 830adf6ae8 Use inline member initialization where possible 2018-01-01 00:17:40 -08:00
Chris Robinson babfa70cab Make more values global const 2018-01-01 00:02:51 -08:00
Chris Robinson 258eadd003 Use a global to specify alffplay's audio sync threshold 2017-12-31 23:44:33 -08:00
Chris Robinson 6dd1643a70 Avoid dereferencing a NULL pointer
Even though it's taking the address of a member, it's still technically a
derefernce and thus undefined behavior. sizeof doesn't "execute" the
expression, so derefering in it instead is fine.
2017-12-31 23:19:41 -08:00
Chris Robinson 48916ebd76 Clear the buffer queue when underrun 2017-12-31 16:29:52 -08:00
Chris Robinson 506d316f55 Wake up the packet send loop when more frames are needed 2017-12-31 16:11:00 -08:00
Chris Robinson 490b71378e Readd AL_SOFT_source_latency support to alffplay 2017-12-30 23:12:19 -08:00
Chris Robinson 0e8b0c520e Use standard duration types for stream clocks 2017-12-30 22:46:09 -08:00
Chris Robinson 0136df1e62 Improve the alffplay queue for FFmpeg's send/receive API
The packet handling thread now calls avcodec_send_packet to give compressed
data to libavcodec, while the audio/video threads call avcodec_receive_frame to
handle decoded frames. The packet thread still maintains local queues for each
stream to avoid starving an A/V thread when the other doesn't want another
frame yet.
2017-12-30 20:34:33 -08:00
Chris Robinson 98731bb574 Update resampler padding checks 2017-12-29 16:28:49 -08:00
Chris Robinson 27dfb7fd11 Fix up a comment 2017-12-24 20:41:20 -08:00
Chris Robinson 6457df54bb Don't make a pass-through macro for FadedDelayLineOut 2017-12-24 20:41:20 -08:00
Chris Robinson 07f3ed0419 Use linear interpolation for reverb modulation
The core LateReverb_* functions are explicitly written out now, since the
tapping and blending done by the Faded version is a bit more complex and it's
not so easy to ensure proper optimizing on the Unfaded version.
2017-12-24 20:40:53 -08:00
Chris Robinson dabb99de8d Don't offset the chorus/flanger delay and LFO
The delay being added to the scaled LFO will ensure a proper positive result
regardless.
2017-12-24 20:40:33 -08:00
Chris Robinson 254ebe5f96 Fade between depths in the reverb modulator 2017-12-24 16:23:30 -08:00
Chris Robinson b32a366137 Use a separate unmodulated feedback tap for reverb 2017-12-24 14:21:13 -08:00
Chris Robinson 3633b65e04 Only link to the common lib when building as shared 2017-12-23 21:23:32 -08:00
Chris Robinson ce74098b40 Clarify some reverb values 2017-12-23 21:13:57 -08:00
Chris Robinson 5769efe48e Reorder some global variables 2017-12-23 18:50:38 -08:00
Chris Robinson 02051ab51a Cleanup reverb modulation scaling 2017-12-23 14:18:14 -08:00
Chris Robinson 02c0620141 Add missing integer queries 2017-12-21 11:46:01 -08:00
Chris Robinson d7895db166 Fix the lfo_offset for a 0-rate flanger 2017-12-19 19:15:34 -08:00
Chris Robinson 0f84e32520 Use MixSamples for the echo output 2017-12-19 15:13:11 -08:00
Chris Robinson 1a911be617 Update the chorus and flanger state struct less often 2017-12-19 15:12:06 -08:00
Chris Robinson a0565dc9bb Make the echo effect only apply feedback to repeated samples 2017-12-19 14:11:37 -08:00
Chris Robinson 52569ef562 Fade gains in the chorus and flanger output 2017-12-19 13:52:05 -08:00
Chris Robinson 661bd054aa Use a single delay line for chorus feedback on a fixed tap
The outputs themselves use a variale-delay tap, but using a separate fixed-
delay tap on the feedback helps improve the perceived "wobble" with sustained
notes. This also applies to the flanger effect.
2017-12-18 13:41:12 -08:00
Chris Robinson eee4aca40b Apply chorus and flanger feedback on the tapped re-feed 2017-12-17 22:14:20 -08:00
Chris Robinson 04cf832fe6 Use the selected mixer for chorus and flanger output 2017-12-17 22:10:58 -08:00
Chris Robinson 2346426b6e Make MixSamples non-static global 2017-12-17 21:48:07 -08:00
Chris Robinson 8253014fe9 Fix some types to make MSVC happy 2017-12-17 15:56:30 -08:00
Chris Robinson 57e516720e Avoid a potential calloc of 0 2017-12-17 14:30:51 -08:00
Chris Robinson d229afb83d Build common code once 2017-12-16 15:53:24 -08:00
Chris Robinson 3cd1f30577 Use the right path for android's cmake toolchain 2017-12-16 15:15:11 -08:00
Chris Robinson 94347d4e64 Update travis for android-ndk-r15, required for its newer cmake 2017-12-16 15:10:20 -08:00
Chris Robinson 6fe6c370c2 Include the fpu=neon switch when testing for arm_neon.h 2017-12-16 15:01:05 -08:00
Chris Robinson 42acafcbc3 Don't cache the Android NDK in Travis 2017-12-16 14:05:13 -08:00
Chris Robinson ebd42ab619 Mix multiple buffers in each buffer list item
Basically now this just relies on being able to specify composited buffers.
2017-12-16 11:34:52 -08:00
Chris Robinson b10780f119 Pre-clear the source temp buffer and accumulate into it 2017-12-16 09:41:27 -08:00
Chris Robinson d657c51be8 Rename SrcDataSize to be less confusing 2017-12-16 08:58:46 -08:00
Chris Robinson 30007263e5 Allow storing multiple buffers in a ALbufferlistitem
This will be to allow buffer layering, multiple buffers of the same format and
sample rate that are mixed together prior to resampling, filtering, and
panning. This will allow composing sounds from individual components that can
be swapped around on different invocations (e.g. layer SoundA and SoundB on one
instance and SoundA and SoundC on a different instance for a slightly different
sound, then just SoundA for a third instance, and so on). The longest buffer
within the list item determines the length of the list item.

More work needs to be done to fully support it, namely the ability to specity
multiple buffers to layer for static and streaming sources. Also the behavior
of loop points for layered static sources should be worked out. Should also
consider allowing each layer to have a sample offset.
2017-12-15 22:59:51 -08:00
Chris Robinson ff3d31e17f Update flanger with the same changes as chorus 2017-12-15 17:35:46 -08:00
Chris Robinson d281b25723 Use a separate LFO offset in the chorus effect
Given that the LFO range is not a power-of-two, it won't correctly wrap on
overflow.
2017-12-15 17:26:03 -08:00
Chris Robinson 2a3b5ab9e9 Use linear interpolation for the chorus delay output 2017-12-15 16:50:06 -08:00
Chris Robinson d9f57c099b Use the correct functions set to the compiler switches 2017-12-15 12:25:50 -08:00
Chris Robinson 32f72c7471 Add queries to get the source offset with the device clock 2017-12-03 14:45:19 -08:00
Chris Robinson 5993ef0baa It's getFactory that may be NULL, not its return value... 2017-11-26 09:59:55 -08:00
Chris Robinson d96be76875 Don't probe a NULL backend factory 2017-11-26 09:53:26 -08:00
Chris Robinson 0e2e9e9a29 Add a simple non-streaming play example 2017-11-07 23:12:12 -08:00
Chris Robinson 7c88e4a16b Properly initialize with the default distance model 2017-10-29 18:25:04 -07:00
Chris Robinson eac0539ea0 Enable NFC filters for HRTF
Only applies to the Ambisonic mix (basic HRTF rendering, or B-Format buffers).
2017-10-23 13:30:01 -07:00
Chris Robinson b82d2cf055 Store the HRTF distance in the Hrtf handle 2017-10-23 13:26:35 -07:00
Chris Robinson 7d4028b2df Update default HRTFs for 24-bit samples
This is still using the (mono) KEMAR set, although perhaps the IRCAM 1005 set
could be made the default (stereo and smaller).
2017-10-22 15:45:30 -07:00
Chris Robinson 0349bcc500 Update mhr format for 24-bit, multi-field, stereo measurements
Currently only single field HRTFs are supported, but the format now allows up
to 16.
2017-10-22 15:36:42 -07:00
Chris Robinson 2f5b86dd38 Add an "un-exposed" method to get the library version
This reports the same ALSOFT version as alGetString(AL_VERSION), but doesn't
require a current context (which requires a ALCdevice) to call. Do *NOT* use
this version to determine feature support, use the standard interfaces. If you
think you need to use this, you probably don't, and shouldn't.
2017-10-16 05:47:12 -07:00
Chris Robinson 5ec11a017c Add casts for assigning the SSE bsinc filter pointers 2017-10-07 15:28:35 -07:00
Chris Robinson b3f7df6f5b Use a typedef to declare extern atomic variables
Some systems use anonymous structs for atomic storage, and extern declarations
need to have the same type as their non-extern definition.
2017-10-07 14:58:35 -07:00
Chris Robinson d57eca57a9 Use _wfopen_s to silence MSVC security warnings 2017-10-07 14:48:07 -07:00
Chris Robinson 71ce90d083 Don't hide the log2 macro behind an Android-only macro 2017-10-07 14:39:41 -07:00
Chris Robinson 296abf03de Avoid a separate function to query ambisonic mode support
Now FuMa and ACN channel orders are required, as are FuMa, SN3D, and N3D
normalization schemes. An integer query (alcGetIntegerv) is added for the
maximum ambisonic order.
2017-09-27 11:58:36 -07:00
Chris Robinson 1ab8902621 Re-update effect slots when context properties change
Also keep all free property update structs together in the context instead of
per-object.
2017-09-27 11:13:18 -07:00
Chris Robinson fd70b0bca6 Don't update context and listener props unnecessarily 2017-09-27 09:36:34 -07:00
Chris Robinson 101d284a18 Update the context state properties separately
The context state properties are less likely to change compared to the listener
state, and future changes may prefer more infrequent updates to the context
state.

Note that this puts the MetersPerUnit in as a context state, even though it's
handled through the listener functions. Considering the infrequency that it's
updated at (generally set just once for the context's lifetime), it makes more
sense to put it there than with the more frequently updated listener
properties. The aforementioned future changes would also prefer MetersPerUnit
to not be updated unnecessarily.
2017-09-27 08:55:42 -07:00
Chris Robinson 2f66139053 Update version for 1.18.2 release
Note the real release is in the v1.18 branch! This is just for numbering
consistency.
2017-09-24 07:06:50 -07:00
Chris Robinson 8e64adb2d3 Update ChangeLog with JACK fix 2017-09-23 15:11:07 -07:00
Chris Robinson c5a917b401 Restore the original JACK message callback when possible 2017-09-23 03:56:45 -07:00
Chris Robinson 27ab921e5b Update ChangeLog 2017-09-22 05:52:27 -07:00
Chris Robinson 369f52a0d7 Add an option to ignore the app's speed of sound for reverb decay 2017-09-22 05:42:04 -07:00
kcat 9007b77355 Merge pull request #149 from dscharrer/master
Fix build on Gentoo FreeBSD with freebsd-lib 9.1
2017-09-21 10:28:04 -07:00
Chris Robinson fc9cb2fbd8 Use the app-specified speed of sound for reverb decay
Specifically, the initial reverb decay as determined by the source distance,
and the reverb decayhf limit from air absorption.
2017-09-21 10:20:59 -07:00
Daniel Scharrer 46b9efc5a2 Fix build on Gentoo FreeBSD with freebsd-lib 9.1 2017-09-21 17:37:10 +02:00
Chris Robinson 90cedbea49 Pass the context to the auxiliary effect update method 2017-09-21 05:42:35 -07:00
Chris Robinson 0b243f1aaf Update ChangeLog 2017-09-19 10:47:22 -07:00
Chris Robinson bc386af5c5 Manually save and restore the FPU rounding mode on Windows
Apparently there is a bug with at least MinGW-W64 where fegetenv and fesetenv
do not properly save and restore the FPU rounding mode, resulting in the
rounding mode remaining as round-to-zero after certain function calls. I do not
know if this also affects MSVC, but better safe than sorry for now.
2017-09-19 03:42:00 -07:00
Chris Robinson 4ca8b4080a Always link to ossaudio when found 2017-09-15 22:40:51 -07:00
Chris Robinson c7273ada8e Handle libossaudio as an optional OSS library 2017-09-15 22:22:45 -07:00
Chris Robinson 724d6267c8 Add a check for pthread_setname_np with three parameters
As found in NetBSD.
2017-09-15 22:09:37 -07:00
Chris Robinson 653edd4b02 Don't hide -msse and -mfpu=neon checks behind a not-msvc check
Apparently Clang gets reported as being MSVC on Windows, but still needs the
GCC switches to enable SSE code generation.
2017-08-30 19:14:59 -07:00
Chris Robinson 0b0ae75ccf I guess -1 isn't allowed for the output 2017-08-30 18:04:04 -07:00
Chris Robinson 226efffd21 Free the args returned by CommandLineToArgvW 2017-08-30 17:08:38 -07:00
Chris Robinson 88d76bf069 Depend on native-tools sources using IMPLICIT_DEPENDS 2017-08-30 16:38:07 -07:00
Chris Robinson 67f183f206 Avoid using wmain on Windows 2017-08-30 16:33:44 -07:00
Chris Robinson 0408f9b7df Pass the current cmake generator to the native-tools build 2017-08-30 14:47:13 -07:00
Chris Robinson e3d99412a2 Include limits.h where INT_MAX is used 2017-08-30 12:01:49 -07:00
Chris Robinson cd15b1775e Avoid some extraneous load calls
This likely doesn't change anything given a working optimizer, but it cleans up
the code some.
2017-08-30 11:30:19 -07:00
Chris Robinson 2916efee21 Automatically generate the bsinc table when building
This makes bsincgen a native tool like bin2h, so it can run automatically when
compiling.
2017-08-28 10:31:23 -07:00
Chris Robinson 6c367cad6e Ensure some macros have the correct size 2017-08-28 05:56:57 -07:00
Chris Robinson fde02abc35 Rename resampler labels 2017-08-27 10:47:04 -07:00
Chris Robinson fdce192aab Add bsinc24 to alsoft-config 2017-08-27 10:38:33 -07:00
Chris Robinson a4d357de06 Add a higher quality bsinc resampler using 24 sample points
This improves the transition width, allowing more of the higher frequencies
remain audible. It would be preferrable to have an upper limit of 32 points
instead of 48, to reduce the overall table size and the CPU cost for down-
sampling.
2017-08-27 10:16:36 -07:00
Chris Robinson 773d4664ff Properly open the output file for writing 2017-08-27 06:40:39 -07:00
Chris Robinson 72e3398baf Avoid including AL headers in makehrtf 2017-08-27 06:23:31 -07:00
Chris Robinson f1bbf2e48a Use a common header for Unicode-awareness on Windows 2017-08-27 06:01:31 -07:00
Chris Robinson bfcde9ae8a Allow specifying the output filename with bsincgen 2017-08-26 04:43:16 -07:00
Chris Robinson b1ff2a05af Always declare a native-tools build target 2017-08-26 02:21:50 -07:00
Chris Robinson 561e95528f Rename the bsinc resampler to bsinc12 2017-08-25 05:52:19 -07:00
Chris Robinson 9ea32713b5 Constify some pointers 2017-08-23 23:01:11 -07:00
Chris Robinson 3d76e1c514 Parameterize the filter order and rejection in bsincgen 2017-08-23 03:32:47 -07:00
Chris Robinson 61097d467c Parameterize the bsinc table name 2017-08-22 00:52:17 -07:00
Chris Robinson 46f18ba114 Install the itu5.1-nocenter.ambdec preset 2017-08-21 06:03:49 -07:00
Chris Robinson ef7ce82828 Properly postfix the filter order number 2017-08-21 04:54:49 -07:00
Chris Robinson 921a820867 Meters per unit can't be 0 2017-08-21 00:30:14 -07:00
Chris Robinson e7c4681e9a 0 meters per unit is invalid 2017-08-21 00:27:52 -07:00
Chris Robinson 877ecda14d Properly check if a pointer is different when cleaning it up 2017-08-20 21:23:25 -07:00
Chris Robinson 079e4b1edb Fix -l switch 2017-08-20 18:39:26 -07:00
Chris Robinson 65bcbe0dc8 Clarify argument errors in makehrtf 2017-08-20 18:38:22 -07:00
Chris Robinson bbabc9705e Ensure the arglist is properly terminated 2017-08-20 18:16:52 -07:00
Chris Robinson 520938da57 Print the input and output filenames in makehrtf 2017-08-20 18:00:52 -07:00
Chris Robinson 97d09b4cee Remove the -m command from makehrtf
It only ever outputs mhr files, so there's no need to have a command for it. If
another output format is ever made, it can be a normal option flag.
2017-08-20 16:54:08 -07:00
Chris Robinson 0a147693e8 Properly add getopt.c to makehrtf 2017-08-20 04:46:45 -07:00
Chris Robinson 55643d6370 Use getopt to handle options in makehrtf 2017-08-20 04:30:53 -07:00
Chris Robinson 051828344e Improve unicode handling for makehrtf
Command line parameters and filenames are now unicode-aware (the .def files
should be UTF-8 encoded, if they contain any non-ASCII-7 characters). Unicode
characters might not display correctly in the console, but it should process
them correctly.
2017-08-20 01:50:27 -07:00
Chris Robinson 3e56e7f562 Properly clear the extra ChannelsPerOrder entries 2017-08-19 23:52:24 -07:00
Chris Robinson e8e1a05f38 Add a function to multiply a complex with a scalar 2017-08-18 20:58:58 -07:00
Chris Robinson 5f50d085ad Pass the filter entry to apply to resample_fir4 2017-08-18 19:20:30 -07:00
Chris Robinson f75020da5a Show progress when processing HRTFs 2017-08-18 19:00:42 -07:00
Chris Robinson 75bf45376c Use a proper complex number types in makehrtf 2017-08-18 04:32:55 -07:00
Chris Robinson d2e485cc6d Simplify bsincgen's Kaiser function 2017-08-18 03:09:36 -07:00
Chris Robinson fdd5070c3b "Unfix" the filter length calculation
Partially reverts 3f3a3ac4f1. The l*2 + 1 is
correct when you want an odd number of sample points, which avoids an
unnecessary phase offset in the fitler. However, the rounding is still needed
to calculating the left offset (l), or else the transition width can increase
with an odd-numbered order.
2017-08-18 02:48:32 -07:00
Chris Robinson 5048956ff0 Keep bsinc filter quality more consistent between scales
This generates the filters using the proper size and scale. The 'a' divisor
should represent the +/- sample range (and thus be a whole number), with the
number of sample points being double that. Increasing the filter size to a
multiple of 4 (for SIMD) can be done by padding in 0s afterward.
2017-08-17 23:21:41 -07:00
Chris Robinson 080c076643 Workaround Android not having log2 2017-08-17 15:51:42 -07:00
Chris Robinson 3f3a3ac4f1 Properly calculate the filter size 2017-08-17 05:53:16 -07:00
Chris Robinson 9fd3e5f529 Correct the bsinc filter order
Despite the claim that it was an 11th order filter, the transition width was
generated by specifying 12th order. A 12th order filter would need 14 sample
points rather than the 12 it had.
2017-08-17 05:51:18 -07:00
Chris Robinson e0408d8edf Make the sinc4 table static 2017-08-16 18:19:04 -07:00
Chris Robinson 5008024e73 Store the sinc4 table in the filter state
Also rename the resampler functions to remove the unnecessary '32' token.
2017-08-16 18:09:53 -07:00
Chris Robinson f9c09cc845 Simplify bsinc filter storage in the filter state
Rather than storing individual pointers to filter, scale delta, phase delta,
and scale  phase delta entries, per phase index, the new table layout makes it
trivial to access the per-phase filter and delta entries given the base offset
and coefficient count.
2017-08-16 02:45:25 -07:00
Chris Robinson 520dd5c779 Make the bsinc table layout more efficient
The old layout separated filters, scale deltas, phase deltas, and scale phase
deltas into separate segments that each contained a numbers of scale and phase
entries, Since processing a sample needed a filter and one of each delta entry
relating to a particular scale and phase, the memory needed would be spread
across the whole table. And since subsequent samples would use a different
phase, it would jump around the table a whole lot as well.

The new layout packs the data in a way more consistent with its use. The
filters, scale deltas, phase deltas, and scale phase deltas are interleaved,
such that for a particular scale and phase, the filter and delta entries used
are contiguous. And the phase entries for a particular scale are kept together,
so the ~500 to ~1000 samples processed per source update stay within the same
3KB to 6KB area of the 70+KB table, which is much more cache friendly.
2017-08-16 02:05:10 -07:00
Chris Robinson 4dd53ab942 Keep bsinc info together in a struct 2017-08-15 04:15:50 -07:00
Chris Robinson 0604b00360 Check the source type once when mixing 2017-08-14 22:58:24 -07:00
Chris Robinson a931314d3f Add restrict to a few more parameters 2017-08-10 00:14:55 -07:00
Chris Robinson 2987c87645 Check the right size for the in-progress mhr update 2017-08-09 20:42:22 -07:00
Chris Robinson 649bf575e2 Declare that a couple arrays are aligned 2017-08-09 14:57:01 -07:00
Chris Robinson ad3c4b81e2 Add experimental support for 24-bit, dual-ear HRTFs
Currently makehrtf only handles 24-bit output, not dual-ear, and only when
given the --experimental switch. Files produced this way will not be guaranteed
future compatibility. When the mhr format is also updated with multi-distance
measurements, the experimental switch can go away.
2017-08-08 20:30:26 -07:00
Chris Robinson 530002e168 Avoid re-selecting the direct HRTF mix function 2017-08-07 01:38:26 -07:00
Chris Robinson 6eadccc99d Replace makehrtf's dither
This uses a custom RNG instead of relying on the system-dependent rand(). It
also removes the high-pass/noise-shaping, to flatten the noise floor.
2017-08-01 23:43:25 -07:00
Chris Robinson 8a735d0ba9 Add a front-stablizer config option for surround sound modes
This improves a stereo (front-left + front-right) sound "image" by generating a
front-center channel signal. Done correctly, it helps reduce the comb effects
and phase errors associated with using only two speakers to simulate center
sounds.

Note that it shouldn't be used if the front-center channel is already included
in the positional audio mix (the dialog effect is okay). In general, it may
actually be better to exclude the front-center channel from the positional
audio mix and use this to generate front-center output.
2017-07-31 23:49:48 -07:00
Chris Robinson 88c0d22e7c Don't bother returning the IR length for B-Format decoding 2017-07-31 01:20:42 -07:00
Chris Robinson e5431bbef7 Print an error if the input channel isn't in the device
Rather than the other way around, if a device channel isn't in the channel map.
2017-07-31 01:11:36 -07:00
Chris Robinson de51ba088e Update default 5.1 and 6.1 coefficients to exclude front-center
Not all speaker kits have a front-center speaker capable of outputing full-
range content. It's best to err on the side of caution and not include front-
center for normal positional sound by default, leaving it instead for the
dedicated dialog effect.
2017-07-30 23:39:06 -07:00
Chris Robinson bf9c36408a Release 1.18.1 2017-07-29 22:09:21 -07:00
Chris Robinson 12db67f548 Cleanup output write functions 2017-07-27 19:07:02 -07:00
Chris Robinson e25ba747e6 Remove unused macros 2017-07-25 17:42:16 -07:00
Chris Robinson 11b44d29e6 Update default HRTFs 2017-07-25 17:11:44 -07:00
Chris Robinson 75841642bf Update makehrtf to use a larger FFT by default
Also fixes DC offset removal and increases the max IR size.
2017-07-25 16:17:46 -07:00
Chris Robinson 1ab082caaf Update ChangeLog with OSS enumeration fix 2017-07-23 22:10:13 -07:00
Chris Robinson 82a990e08e Downgrade some ERRs to TRACEs
These don't exist outside OSSv4, e.g. with OSS/Free, padsp, or aoss, so no need
to be concerned.
2017-07-23 16:43:39 -07:00
Chris Robinson 5ab4e584ee Make sure OSS device files exist before adding them 2017-07-23 16:38:54 -07:00
Chris Robinson 4ec67e6226 Add missing include for std::array 2017-07-23 00:18:32 -07:00
Chris Robinson 21b71b2fd2 Update ChangeLog 2017-07-19 18:54:12 -07:00
Chris Robinson f91445029d Fix default effect initialization 2017-07-19 18:26:46 -07:00
Chris Robinson fea74124c8 Add an all-pass filter that replicates the band splitter's phase shift 2017-07-19 02:48:01 -07:00
Chris Robinson 0135ddc2e5 Scale the source volume by +3dB for a full spread
This effectively turns a full spread source into an ambient response,
preventing such sources from being unexpectedly quiet.
2017-07-18 22:15:32 -07:00
Chris Robinson 5f7268c0cc Add a 5.1 preset that excludes the front-center speaker
On some speaker setups, the front-center speaker is not designed for full-range
content and should be used exclusively for dialog. Consequently it should not
be used for positional sounds, only the dedicated dialog effect.
2017-07-18 20:30:45 -07:00
Chris Robinson c484935542 Apply the output buffer offset before writing to it 2017-07-15 23:13:08 -07:00
Chris Robinson ff696bc1fe Set the float PCM GUID for wave files only when outputting float 2017-07-15 01:45:48 -07:00
Chris Robinson 8fa3f6da64 Add the default auxiliary slot to the active slot array 2017-07-13 23:13:02 -07:00
Chris Robinson 249afde5f9 Initialize the default effect after device update 2017-07-13 22:35:37 -07:00
Chris Robinson a535169bbd Use macros to set and restore the mixer FPU mode 2017-07-13 22:30:39 -07:00
Chris Robinson 22d77b87a3 Store the default effect slot in the context 2017-07-13 21:44:25 -07:00
Chris Robinson 67ab9ec466 Don't trace for every GetDriverIndexForName call 2017-07-11 22:43:22 -07:00
Chris Robinson 0da55fd912 Trace a version for the router 2017-07-11 00:43:15 -07:00
Chris Robinson 5048322fff Update alffplay's command line message 2017-07-11 00:38:52 -07:00
Chris Robinson f313f9c117 Rename the OpenAL target if also building the router
This is rather ugly, but it's necessary to get a proper export configuration.
The issue was that the main OpenAL target library name is set to soft_oal when
the router is being built, which is incorrect for the exported config library.
Exporting the router would have the incorrect name of OpenAL::Router.

So this change has the router use the OpenAL target name when it's built, which
is good since it will have the standard OpenAL lib name for apps to link to and
get the OpenAL::OpenAL export name. The main library's target name is changed
in this case to avoid conflicts.
2017-07-10 01:57:22 -07:00
Chris Robinson d6326c1791 Generate the def and lib files from the router when built 2017-07-09 23:14:31 -07:00
Chris Robinson d050af7eeb Reorganize some Windows-only CMake commands 2017-07-09 22:19:34 -07:00
Chris Robinson 2be4c93f9f Use a macro to add backend include dirs 2017-07-08 22:58:16 -07:00
Chris Robinson 09826cc684 Set the proper ldflags for the router 2017-07-07 18:48:19 -07:00
Chris Robinson e4e240fa9b Support ALC_EXT_thread_local_context in the router
Note that a given context's device must also support the extension to work. The
router's support simply lets a driver's capabilities through.
2017-07-07 18:41:03 -07:00
Chris Robinson 6be752a9b1 Add methods for thread-local contexts to the router 2017-07-07 18:33:54 -07:00
Chris Robinson faefa1d554 Revert "Try all drivers for an unknown device name"
This reverts commit dadf7a4cf2.
2017-07-05 14:18:16 -07:00
Chris Robinson 56a33ef955 Print the opened device in alffplay 2017-07-05 12:32:19 -07:00
Chris Robinson dadf7a4cf2 Try all drivers for an unknown device name 2017-07-05 12:23:08 -07:00
Chris Robinson 3af2ff7b25 Trace if a driver was found for a device name 2017-07-05 12:16:28 -07:00
Chris Robinson 72ce0d1e9c Open a device only when a driver index is found 2017-07-03 22:14:15 -07:00
Chris Robinson 3cd4cfe73d Don't add --output-def to EXTRA_LDFLAGS 2017-07-01 20:48:17 -07:00
Chris Robinson 74139c914d Skip past the -device switch even if the device doesn't open 2017-07-01 20:44:56 -07:00
Chris Robinson cb83f48105 Add an option to enable direct channels for alffplay 2017-07-01 19:18:57 -07:00
Chris Robinson a14f651034 Flush the log file after writing 2017-07-01 15:34:42 -07:00
Chris Robinson 958fa34272 Use a weaker memory order for the current context iface 2017-07-01 15:25:39 -07:00
Chris Robinson af626fdded Initialize ALC resources in the file they're used in 2017-07-01 15:25:11 -07:00
Chris Robinson 7daefd4e77 Use the al alloc functions instead of standard 2017-07-01 12:22:25 -07:00
Chris Robinson 32bda7b94c Add tracing capabilities to the router 2017-06-30 17:22:15 -07:00
Chris Robinson 77e317609b Add special handling for alGerError in the router 2017-06-30 17:21:26 -07:00
Chris Robinson ce9222b686 Clear initial ALC version vars before querying it 2017-06-29 23:21:07 -07:00
Chris Robinson 8a0d1e5191 Store the QSA backend's ExtraData in the wrapper struct 2017-06-29 17:38:38 -07:00
Chris Robinson d874b6bb27 Don't assume the first driver has the default device 2017-06-29 15:59:16 -07:00
Chris Robinson 00694826ef Protect context switches with a lock in the router 2017-06-29 10:56:32 -07:00
Chris Robinson 058d57ef03 Protect device enumeration in the router with a mutex 2017-06-29 10:39:27 -07:00
Chris Robinson e8ce8924d1 Use sqrtf for single-precision square roots 2017-06-29 10:28:37 -07:00
Chris Robinson ec13cf6c9c Add casts to silence MSVC 2017-06-29 10:28:22 -07:00
Chris Robinson a69d608a1e Define a backup log2f if the compiler doesn't have it 2017-06-29 10:11:31 -07:00
Chris Robinson aefa11b6ad Workaround for MSVC not liking 1.0f/0.0f for float infinity 2017-06-29 09:57:19 -07:00
Chris Robinson cee2d226d2 Return the extension list in the router 2017-06-29 08:55:44 -07:00
Chris Robinson f08a7b341f Prepare the new driver in a local variable 2017-06-29 08:46:06 -07:00
Chris Robinson 15e6821147 Avoid unnecessary reenumeration in the router 2017-06-29 08:35:21 -07:00
Chris Robinson 3a16fed279 Handle the ALC version for some extension capabilities
Also fix some improper parenthesis.
2017-06-28 23:18:39 -07:00
Chris Robinson ef7eced7a7 Properly clean up allocated memory at exit 2017-06-28 22:39:11 -07:00
Chris Robinson a729007887 Implement setting a context current in the router 2017-06-28 21:54:44 -07:00
Chris Robinson 323162c49f Implement creating and destroying contexts 2017-06-28 21:15:30 -07:00
Chris Robinson ea4379c5b7 Implement opening and closing devices in the router 2017-06-28 21:10:02 -07:00
Chris Robinson 6124f447cd Implement enumeration in the router 2017-06-28 20:45:23 -07:00
Chris Robinson 47f1db36a7 Partially implement ALC functions in the router 2017-06-28 20:03:36 -07:00
Chris Robinson b88b57868a Add a ptr-to-int map 2017-06-28 19:09:38 -07:00
Chris Robinson 9fd7349220 Add forwarding for the AL functions 2017-06-28 17:02:43 -07:00
Chris Robinson cfec20830b Load driver dlls in the router 2017-06-28 16:41:38 -07:00
Chris Robinson ebee8da05c Start a router DLL
Experimental, Windows only. This is intended as an alternative to Creative's
router DLL, fixing a few issues with it (falsely reporting extensions that
aren't supported, not being able to query the ALC version without a device, and
not being able to use ALC extension functions).

When enabled OpenAL Soft's DLL is built as soft_oal.dll, while the router is
OpenAL32.dll.
2017-06-28 12:42:20 -07:00
Chris Robinson 7cadbebe9f Calculate the converter stepping value using floating point 2017-06-28 10:17:36 -07:00
Chris Robinson e9a7218a06 Remove the fastf2u conversion function 2017-06-27 07:25:08 -07:00
Chris Robinson 8f2bbc434c Use a macro to apply NFC filtered mixes instead of a loop 2017-06-26 11:19:27 -07:00
Chris Robinson b13fead555 Round the converter's stepping value 2017-06-26 11:04:23 -07:00
Chris Robinson 2f2d941edb Trace the message name in the message handler loop 2017-06-26 08:57:29 -07:00
Chris Robinson 740e7d979c Convert all input samples in the loop
Instead of potentially leaving 1 sample that requires another loop iteration.
2017-06-26 08:55:22 -07:00
Chris Robinson 464a7c0545 Update ChangeLog for mmdevapi fix 2017-06-26 07:09:17 -07:00
Chris Robinson 55c329b462 Clean up some messy rounding code 2017-06-26 06:54:45 -07:00
Chris Robinson 5d5eff7502 Ensure the mmdevapi capture buffer is at least 100ms 2017-06-26 06:14:11 -07:00
Chris Robinson 4b7cbb50ab Add a whitenoise generator to altonegen 2017-06-25 08:00:55 -07:00
Chris Robinson be552a35e6 Support 32-bit float with the recording example 2017-06-25 06:10:20 -07:00
Chris Robinson 1deb8b6160 Clean up some loop variables 2017-06-25 05:42:35 -07:00
Chris Robinson c465718ddd Use the bsinc resampler for the converter 2017-06-25 04:07:06 -07:00
Chris Robinson d1bb04d588 Improve traces for the mmdevapi capture conversions 2017-06-23 09:54:26 -07:00
Chris Robinson d70a98fe03 Use the correct destination channel offset 2017-06-23 08:25:47 -07:00
Chris Robinson 9d01ac440d Don't report any output samples for no input samples 2017-06-23 08:13:42 -07:00
Chris Robinson 44a940d8d6 Forward Sample_ALuint to Sample_ALint 2017-06-23 05:34:43 -07:00
Chris Robinson e07166e93c Add a recording example app 2017-06-23 05:19:24 -07:00
Chris Robinson d1077795de Stop conversion when no more source samples are available 2017-06-22 15:07:24 -07:00
Chris Robinson 31b02e044f Trace the capture converter formats for mmdevapi 2017-06-22 13:58:32 -07:00
Chris Robinson 552d3a85af Workaround log2f missing on Android 2017-06-21 23:05:11 -07:00
Chris Robinson 6fcbb7c738 Remove an unnecessary variable 2017-06-21 11:34:26 -07:00
Chris Robinson e09468cdca Trace if dithering is enabled 2017-06-19 00:17:11 -07:00
Chris Robinson 36edd80073 Update ChangeLog for the dither-depth config option 2017-06-18 04:14:56 -07:00
Chris Robinson 0a361fa9e2 "Convert" the QSA backend to the new API
I say "convert" because it takes the lazy way and essentially just embeds the
wrappers into the backend. It's done this way because I lack the means to check
any changes, even syntactically. This also means the device's ExtraData field
is still needed.

However, this does mean all the backends are now using the new API. Code
related to the old interface can now be removed.
2017-06-18 03:07:02 -07:00
Chris Robinson 2b013fc54e Make the dithering depth configurable 2017-06-17 23:09:51 -07:00
Chris Robinson e3a825b37c Apply dither separately from output 2017-06-17 02:42:01 -07:00
Chris Robinson 9fc01934c2 Use helpers to get data from byte streams 2017-06-16 22:58:13 -07:00
Chris Robinson 879b79740f Round the B-Format HRTF response where the multiple is defined 2017-06-16 19:00:00 -07:00
Chris Robinson e18f7ca3e4 Update ChangeLog with the PulseAudio fix 2017-06-15 23:13:25 -07:00
Chris Robinson d4f3490a88 Limit device buffer based on PulseAudio's tlength
Unfortunately PulseAudio has a habit of limiting tlength, and trying to
calculate the device's buffer length to write regardless of tlength could
result in some amount always being writable.
2017-06-15 21:39:09 -07:00
Chris Robinson 1e8feeff03 Update ChangeLog with recent fixes 2017-06-11 16:38:51 -07:00
Chris Robinson a35b9bbd3e Don't force a fade-in when resuming a paused source
This needs to be handled more automatically by the mixer to work correctly.
Otherwise, requiring a property update on resume can put the source into a
playing state with the mixer never playing it, due to not having valid mixing
parameters and the mixing parameters not getting calculated because no updates
are specified by the app (and forcing an update can break deferred updates).
2017-06-09 13:32:34 -07:00
kcat ba0644254c Merge pull request #123 from rdb/master
Implement GetProcPath for FreeBSD
2017-06-09 12:14:56 -07:00
rdb 39e4756b37 Implement GetProcPath for FreeBSD 2017-06-09 15:19:03 +02:00
Chris Robinson b4aea294c3 Calculate chorus and flanger mod delays separately from feedback 2017-06-07 12:42:54 -07:00
Chris Robinson 10ff6cba9c Make the late lines' delay the delay average for modulation
Similar to the recent chorus and flanger changes, the modulation delay now
swings between -n to +n, where n is less than the delay length. This brings up
a slight issue with the linear interpolation, as modff doesn't produce the
correct fraction value for interpolation (it's inverted, with 0 being closer to
the next sample and 1 being closer to the base). So it's using nearest
interpolation for now.
2017-06-07 10:39:19 -07:00
Chris Robinson 61e43d4039 Release 1.18.0 2017-06-04 07:31:22 -07:00
Chris Robinson 9222d89de2 Update ChangeLog about OpenSL capture support 2017-06-04 05:44:08 -07:00
Chris Robinson e1dcfa4b9b Update default 48khz HRTF dataset 2017-06-01 04:09:08 -07:00
Chris Robinson 1c04cbad04 Resample HRIRs prior to minimum phase reconstruction 2017-06-01 04:06:08 -07:00
Chris Robinson f54946f9cb Remove unused HIDDEN_DECL macro 2017-05-30 09:58:06 -07:00
Chris Robinson e893211b65 Restrict ClampedDist to RefDistance for invalid distance attenuation 2017-05-30 05:13:54 -07:00
Chris Robinson 6d4adc6ad6 Use an RMS limit of -3dB for the output limiter 2017-05-29 03:38:27 -07:00
Chris Robinson 07bb5f1322 Add a missing include 2017-05-28 00:53:33 -07:00
Chris Robinson a79e8f3d95 Use peak limiting rather than RMS detection 2017-05-27 22:47:40 -07:00
Chris Robinson e9505b164e Fix source sends' initial HF absorption and decay calculation
The HF absorption is applied given the source distance, as relative to the
source's immediate environment, with additional absorption being applied given
the room/reverb environment. This does double up the amount of absorption
compared to the dry path, but it can be assumed the initial reflections travel
a longer distance.
2017-05-27 22:33:40 -07:00
Chris Robinson c51df897db Use normal air absorption for the sends
Applies just for the normal air absorption which uses the air absorption
factor, not the automated decay applied when WetGainAuto is enabled.
2017-05-27 03:40:52 -07:00
Chris Robinson c4ef7399f8 Add a new compressor/limiter
This is just for the output limiter right now, but in the future can be used
for the compressor EFX effect. The parameters are also hardcoded, but can be
made configurable after 1.18.
2017-05-27 03:36:34 -07:00
Chris Robinson 653f0a1405 Fix handling chorus and flanger LFO displacement offset
The phase offset is modulo-wrapped rather than masked, so it's best to avoid
negative offsets.
2017-05-26 09:09:35 -07:00
Chris Robinson 2b14c1d623 Properly handle the chorus and flanger LFOs
The effects' specified delay is the average delay time, meaning the delay
offset should move between -n and +n relative to the delay, where n <= delay.
2017-05-26 08:52:07 -07:00
Chris Robinson 59d016dfcd Update ChangeLog about ALC_SOFT_output_limiter 2017-05-25 04:17:09 -07:00
Chris Robinson db90dbe9f2 Finalize ALC_SOFT_output_limiter 2017-05-25 04:16:07 -07:00
Chris Robinson 9d4f601a8a Apply distance compensation separately 2017-05-25 03:24:35 -07:00
Chris Robinson c68a537ae8 Update ChangeLog for the limiter and dithering 2017-05-24 04:22:03 -07:00
Chris Robinson 2266fb76b9 Add a config option to specify custom ALSA devices 2017-05-23 18:12:45 -07:00
Chris Robinson dd6c5270b6 Add a dithering option to alsoft-config 2017-05-23 01:12:49 -07:00
Chris Robinson e6be113903 Add an option to dither 8- and 16-bit output 2017-05-23 00:35:22 -07:00
Chris Robinson 49e5c53591 Reduce the amount of variables that hold the same value 2017-05-21 03:47:52 -07:00
Chris Robinson 95ea3fdd05 Avoid calculating the filter coefficients multiple times 2017-05-21 03:38:19 -07:00
Chris Robinson 5691dceb38 Add a method to copy a filter's coefficients 2017-05-21 03:31:44 -07:00
Chris Robinson edcdc1dae8 Avoid unnecessary doubles 2017-05-21 02:42:44 -07:00
Chris Robinson 0b2467ed54 Use a macro to specify the decay target gain 2017-05-21 00:01:39 -07:00
Chris Robinson c234b25ac7 Use more correct doppler shift calculations 2017-05-20 03:28:40 -07:00
Chris Robinson 492050b816 Restore spec-defined cone behavior for auxiliary sends 2017-05-20 02:22:11 -07:00
Chris Robinson a306407b67 Apply more proper air absorption to the wet path
This properly accounts for the room rolloff factor for normal air absorption
(which makes it none by default, like distance attenuation), and uses the
reverb's decay time, decay hf ratio, decay hf limit, and room air absorption
properties to calculate an initial hf decay with the WetGainAuto flag. This
mirrors the behavior of the initial distance decay.
2017-05-19 23:13:39 -07:00
Chris Robinson efd797a6f6 Reorganize some code to have fewer temporaries 2017-05-17 22:49:34 -07:00
Chris Robinson a49e2ebbc5 Add an env var to specify a default pulse device
Some apps don't allow selecting an audio device, and due to problems with KDE,
PulseAudio isn't allowed to move the stream after being created by default.
2017-05-16 16:50:43 -07:00
Chris Robinson 154e53b911 Reduce the main reverb filter gain limit to match the rest 2017-05-16 13:23:16 -07:00
Chris Robinson 98392fbe90 Limit the dry and wet path filter gains to -60dB 2017-05-15 17:20:09 -07:00
Chris Robinson fecf26318a Improve distance-related absorption and decay attenuation 2017-05-15 17:13:05 -07:00
Chris Robinson 2aa620e58f Make reverb delay line structs use interleaved floats 2017-05-15 00:30:47 -07:00
Chris Robinson b2760baa64 Make the reverb's early and late feedback lines interleaved 2017-05-14 23:28:22 -07:00
Chris Robinson cc1b774837 Don't enable NFC for a 0 reference delay 2017-05-14 18:50:22 -07:00
Chris Robinson 232f05be93 Update ChangeLog for AL_SOFT_source_spatialize 2017-05-13 19:52:37 -07:00
Chris Robinson 7cbce6806b Update a couple comments about the reverb modulation 2017-05-13 16:08:45 -07:00
Chris Robinson 0b66b2bbe7 Replace 4 separate all-passes with one vector all-pass
Each 4 related all-passes now share a structure with one delay line, which uses
an interleaved sample history. Also fixes some potential rounding problems for
delay lines with interleaved samples.
2017-05-13 15:45:05 -07:00
Chris Robinson 87d4710bc4 Apply reverb modulation to the late feedback lines
This seems to be more in-line with the intended behavior, to allow build-up and
overlap within the reverb decay, rather than a pitch-shift on input.
Unfortunately there's no readily available implementation of this reverb model
that includes modulation to compare with, so a low depth coefficient is used to
keep it very subtle.
2017-05-12 20:53:14 -07:00
Chris Robinson d456c799fd Remove the 0.5 gain on the reverb output
Turns out to be unnecessary, as it reduced the volume below what other reverb
implementations provide with the same presets.
2017-05-11 23:26:29 -07:00
Chris Robinson 685dc24299 Restore the previous reverb B2A and A2B matrices
Also, untranspose the A2B matrix.
2017-05-11 21:48:47 -07:00
Chris Robinson ef58a8f205 Log whether the output limiter is enabled or disabled 2017-05-11 16:29:05 -07:00
Chris Robinson 748dfb1526 Finalize AL_SOFT_source_spatialize 2017-05-11 14:38:04 -07:00
Chris Robinson a6f6533a28 Update ALC_OUTPUT_LIMITER_SOFT to handle ALC_DONT_CARE_SOFT
Essentially just adding a comment about it. Since we default to on, the
behavior already fit.
2017-05-11 11:04:25 -07:00
Chris Robinson a2c25378a9 Reduce LIMITER_VALUE_MAX
The previous value couldn't actually be expressed as a float and got rounded up
to the next whole number value, leaving the potential for an overrun in the
squared sum.
2017-05-09 11:56:03 -07:00
Chris Robinson 4a4442ad91 Store the output limiter values as fixed-point integers
This helps keep the squared sum stable over larger updates, also avoiding the
need to keep recalculating it.
2017-05-08 16:23:16 -07:00
Chris Robinson f880f67049 Update reverb conversion matrices and output gain 2017-05-08 13:57:31 -07:00
Chris Robinson 0dabe6398f Apply attenuation when downmixing multi-channel sounds for panning 2017-05-07 18:28:43 -07:00
Chris Robinson 5308ea7e2a Put the app name after filename in the window title 2017-05-07 04:29:18 -07:00
Chris Robinson d9d2e73228 Update AL_SOURCE_SPATIALIZE_SOFT value
Though it didn't strictly clash since it was for a different component (global
state vs source property), 0x1213 was used by AL_RESAMPLER_NAME_SOFT. Probably
best to avoid duplicate property values regardless.
2017-05-06 10:10:10 -07:00
Chris Robinson e1bc4c0730 Include the Built-In HRTF names in alsoft-config when enabled 2017-05-05 07:49:56 -07:00
Chris Robinson 074e4496ba Calculate the output limiter gain using the RMS 2017-05-05 07:38:26 -07:00
Chris Robinson 64f0630fef Move native-tools to the root directory 2017-05-05 05:03:50 -07:00
Chris Robinson 47f843632f Make the generated data array static const 2017-05-05 04:59:07 -07:00
Chris Robinson db6f14748c Rename RollOff to Rolloff 2017-05-05 04:54:07 -07:00
Chris Robinson d82e3be8f7 Increase the HRTF transition to 128 samples 2017-05-05 04:54:07 -07:00
kcat af997bf853 Merge pull request #112 from alexey-lysiuk/embed_hrtf_pr
Cross-platform embedding of HRTF data
2017-05-05 04:53:11 -07:00
alexey.lysiuk 24bc8070c8 Enable embedding of HRTF data in CI config files 2017-05-05 14:30:06 +03:00
alexey.lysiuk 17dfaca43d Implement cross-platform embedding of HRTF data 2017-05-05 14:30:06 +03:00
Chris Robinson 9c9ad2f60a Start an extension to change the source's spatialize property 2017-05-05 02:41:34 -07:00
Chris Robinson b639bc9913 Add a property to force source spatialization on or off 2017-05-04 12:27:10 -07:00
Chris Robinson 7829ad8fc9 Handle attenuated sources in CalcPanningAndFilters 2017-05-04 11:09:45 -07:00
Chris Robinson 23bf3d3959 Calculate the multi-channel panning in a separate function 2017-05-04 04:35:53 -07:00
Chris Robinson 14b23c2502 Print available resamplers in openal-info 2017-05-03 04:53:22 -07:00
Chris Robinson e0ae3c7cb6 Update changelog 2017-05-03 04:41:09 -07:00
Chris Robinson ab1cca729f Finalize AL_SOFT_source_resampler 2017-05-03 04:33:38 -07:00
Chris Robinson 732dee5375 Rename Zero-Order Hold to Nearest
A bit of a misnomer now since "Nearest" implies rounding (i.e. when the sample
offset is >= .5, it should pick the next sample being closer in time), but that
adds unnecessary complications.
2017-05-03 03:34:44 -07:00
Chris Robinson 444e9563b3 Add a mixing function to blend HRIRs
This is a bit more efficient than calling the normal HRTF mixing function
twice, and helps solve the problem of the values generated from convolution not
being consistent with the new HRIR.
2017-05-03 03:29:21 -07:00
Chris Robinson 4e5c4b8e01 Add a slight bit of attenuation to the reverb output 2017-05-02 15:55:58 -07:00
Chris Robinson 66f9640787 Remove a duplicate check 2017-05-02 07:34:28 -07:00
Chris Robinson 53c3d48fe0 Change some ALuint parameters to ALsizei 2017-05-02 04:54:59 -07:00
Chris Robinson 1e5334176e Rename VOICE_IS_HRTF to VOICE_HAS_HRTF 2017-05-02 04:25:08 -07:00
Chris Robinson 2f8d597f4e Rename 'moving' flag to 'fading' 2017-05-02 04:09:01 -07:00
Chris Robinson afe2065d60 Set a voice as 'moving' if it starts/resumes at an offset 2017-05-02 03:58:18 -07:00
Chris Robinson f1a249b47a Reimplement bilinear interpolation between HRIRs
Some data sets are just too sparse, having noticeably few measurements to
properly handle slowly panning sources. Although not perfect, bilinearly
interpolating the HRIR measurements improves the positional accuracy.
2017-05-01 15:46:25 -07:00
Chris Robinson 8d50b72d8f Allow querying the output limiter state 2017-04-30 08:54:49 -07:00
Chris Robinson fc2afa1eaa Start an extension to toggle the output limiter 2017-04-30 04:21:48 -07:00
Chris Robinson 9767f4f9c3 Don't do more reverb samples than there are to fade.
This avoids having to clamp the fade value when incrementing it.
2017-04-28 10:25:22 -07:00
Chris Robinson dc25370063 Fade HRTF coefficients over 64 samples at most
This greatly improves HRTF performance since the dual-mix only applies to the
64-sample coefficient transition. So rather than doubling the full mix, it only
doubles 64 samples out of the full mix.
2017-04-28 10:05:57 -07:00
Chris Robinson bf138fb4ea Combine mostly duplicate functions 2017-04-27 19:23:42 -07:00
Chris Robinson 5dc7265ad3 Properly update the delay line offsets when fading is done 2017-04-27 18:54:33 -07:00
Chris Robinson 55d9988f3f Write directly to the output for HRTF 2017-04-27 06:35:53 -07:00
Chris Robinson 8f56c9522e Document the output-limiter config option
Expose it in alsoft-config as well.
2017-04-26 19:27:50 -07:00
Chris Robinson ca5c732261 Implement a limiter on the device output
This reduces the output volume when the mixed samples extend outside of -1,+1,
to prevent excessive clipping. It can reduce the volume by -80dB in 50ms, and
increase it by +80dB in 1s (it will not go below -80dB or above 0dB).
2017-04-26 18:38:09 -07:00
Chris Robinson 1754d54c18 Compile with -fno-math-errno when available
Helps GCC to inline some fp functions, e.g. lrintf
2017-04-26 18:35:05 -07:00
Chris Robinson 12fb0404c1 Reverb code update
This update modifies the reverb in numerous ways. The 3-series, 4-parallel
all-pass is replaced with a Gerzon vector all-pass. The vector all-pass is also
applied to the early reflections, to help with the initial diffusion in the
late reverb. The late reverb filter and feedback attenuation has been replaced
with a dual first-order equalization filter, which controls the low and high
frequencies with individual low-pass/high-shelf and high-pass/low-shelf filters
with gain control.

Additionally, delay lines now have the ability to blend the output between two
offsets, to help smooth out the transition for when the delay changes (without
such, it could result in undesirable clicks and pops).
2017-04-26 02:07:51 -07:00
Chris Robinson ad782c0000 Skip mixing the fade out step when starting silent
Unfortunately it can't skip mixing the fade in when going to silence because
the history needs to be up to date.
2017-04-25 22:10:27 -07:00
Chris Robinson a0a41921fc Remove const from _Atomic vars to make Clang happy
Clang does not allow using C11's atomic_load on const _Atomic variables.
Previously it just disabled use of C11 atomics if atomic_load didn't work on a
const _Atomic variable, but I think I'd prefer to have Clang use C11 atomics
for the added features (more explicit memory ordering) even if it means a few
instances of breaking const.
2017-04-21 16:58:55 -07:00
Chris Robinson d85177cd3e Use more sensible values for the source resampler enums 2017-04-21 16:26:22 -07:00
Chris Robinson d2d5f1d7bd Add the ability to change the source resampler 2017-04-21 15:48:39 -07:00
Chris Robinson 44f026220f Correctly enable the ambisonic upsampler for HOA output 2017-04-21 13:26:29 -07:00
Chris Robinson b59359f80f Add a method to enumerate resamplers 2017-04-21 04:15:08 -07:00
Chris Robinson 26b49c54af Store the resampler as part of the source 2017-04-21 00:06:40 -07:00
Chris Robinson 1e8ea59564 Make the default resampler a variable 2017-04-20 23:21:46 -07:00
Chris Robinson 7776ebcedc Try NEON mixers before SSE 2017-04-20 20:58:32 -07:00
Chris Robinson 63baa3b1c7 Missed a raw atomic variable access 2017-04-20 03:14:49 -07:00
Chris Robinson 5dcbb8db38 Make the buffer list next pointer atomic 2017-04-19 19:54:17 -07:00
Chris Robinson fbb5295f13 Fix a mixed-sign-comparison warning on MSVC 2017-04-19 15:17:55 -07:00
Chris Robinson 0407285c53 Allocate a new context's voices after updating the device params 2017-04-19 12:34:45 -07:00
Chris Robinson f1be335486 Check for the upsampler to determine if HRTF uses HOA 2017-04-18 17:39:10 -07:00
Chris Robinson 55011d4bfd Use a different way to get the size of structs with flexible array members 2017-04-18 14:11:15 -07:00
Chris Robinson de62ab97e9 Store the source queue head in the voice to signify looping
This removes the need to access a couple more source fields in the mixer, and
also makes the looping and queue fields non-atomic.
2017-04-18 00:58:33 -07:00
Chris Robinson 45d52f7124 Remove unnecessary functions in the JACK backend 2017-04-17 21:31:20 -07:00
Chris Robinson 14bc7baeb7 Store the source prop updates with the mixer voice
Also move its declaration and rename it for consistency.
2017-04-17 21:16:01 -07:00
Chris Robinson 660971d0b7 Close some gaps in enum values 2017-04-16 23:22:30 -07:00
Chris Robinson 6d3973f965 Trace unhandled device reset attributes 2017-04-16 16:21:11 -07:00
Chris Robinson 064176d03d Remove some unnecessary parenthesis 2017-04-16 15:05:57 -07:00
Chris Robinson 8f1a968d79 Correctly handle the attribute array size for alcGetInteger64vSOFT 2017-04-15 20:10:32 -07:00
Chris Robinson fca83263f4 Implement capture support in the OpenSL backend 2017-04-15 18:08:52 -07:00
Chris Robinson d9bf4f7620 Allow increasing the maximum source limit
If the requested number of mono and stereo sources exceeds 256, the source
limit will be expanded. Any config file setting overrides this. If the device
is reset to have fewer sources than are currently allocated, excess sources
will remain and be usable as normal, but no more can be generated until enough
are delated to go back below the limit.
2017-04-14 23:50:49 -07:00
Chris Robinson afb59e7f98 Move internal headers out of the include directory 2017-04-14 18:15:56 -07:00
Chris Robinson c5310d2e95 Avoid unnecessary macro parameters 2017-04-14 17:55:23 -07:00
Chris Robinson f94fa5d5cf Use separate atomic macros for pointers 2017-04-14 17:47:55 -07:00
Chris Robinson 9e60eea93b Use atomic flags for the thunk array 2017-04-14 16:14:05 -07:00
Chris Robinson 6476f3277a Mark some pointers with restrict 2017-04-13 11:48:43 -07:00
Chris Robinson 24c172bb96 Use ALsizei for the fir4 resampler fraction 2017-04-12 22:45:54 -07:00
Chris Robinson 684823ebc4 Select NEON when available before SSE 2017-04-12 22:44:16 -07:00
Chris Robinson 901804d724 Store the ambisonic order separate from the channel enum 2017-04-12 18:26:07 -07:00
Chris Robinson 46046f9caa Remove an unnecessary variable 2017-04-11 12:06:57 -07:00
Chris Robinson 05531fbee4 Use the correct channel conversion functions 2017-04-11 11:47:23 -07:00
Chris Robinson 78d5492d2c Use the converters to enable mmdevapi capture 2017-04-11 09:41:23 -07:00
Chris Robinson bcdd1cee10 Add a mono<->stereo converter
This converter always outputs floats, and uses energy-preserving scaling.
2017-04-11 07:25:55 -07:00
Chris Robinson caae349fdc Update the given source pointer in the sample converter 2017-04-10 13:40:45 -07:00
Chris Robinson cc79cb803a Reduce the size of the temp input buffer 2017-04-10 09:31:25 -07:00
Chris Robinson 8a7bc9ab4f Trace the capture device format 2017-04-10 09:28:25 -07:00
Chris Robinson 6cc69c8d94 Add a sample converter
This is intended to do conversions for interleaved samples, and supports
changing from one DevFmtType to another as well as resampling. It does not
handle remixing channels.

The mixer is more optimized to use the resampling functions directly. However,
this should prove useful for recording with certain backends that won't do the
conversion themselves.
2017-04-10 09:26:06 -07:00
Chris Robinson 81527cdbdd Convert the CoreAudio backend to the updated backend API 2017-04-09 11:21:02 -07:00
Chris Robinson aef774a7a0 Handle the source offset fraction as an ALsizei 2017-04-08 14:29:08 -07:00
Chris Robinson 319d097198 Pre-compute the sinc4 resampler coefficient table 2017-04-08 13:43:19 -07:00
Chris Robinson 5ef7d8fe62 Clean up some formatting 2017-04-08 12:27:30 -07:00
Chris Robinson 1f64f9d016 Try to write the full configured buffer length with PulseAudio
This basically ignores tlength even if it's smaller than what was requested. It
keeps up-to-date with minreq changes too now, in case that happens.
2017-04-08 10:01:04 -07:00
Chris Robinson f1a5b6b668 Overwrite the old search path with the new one 2017-04-08 03:00:53 -07:00
Chris Robinson 5e9f5693a4 Combine a couple loops 2017-04-07 14:56:23 -07:00
Chris Robinson 7fd88086f6 Make sure malloc succeeded for 'delays' 2017-04-07 09:49:06 -07:00
Chris Robinson 8f2e4d46ec Store the HRTF coeffs as a stereo pair
This will make it easier to handle HRTF data sets that have separate left and
right ear responses. Will need an mhr version update to take advantage of that.
2017-04-07 08:46:50 -07:00
Chris Robinson e267f6b88e Don't explicitly restore the old HRTF when initializing panning
Otherwise it won't store the name in the device.
2017-04-07 08:02:13 -07:00
Chris Robinson b551291840 Allocate temp storage for delays when loading HRTFs 2017-04-07 06:40:42 -07:00
Chris Robinson 36f7dda1ca Remove another reference to the sinc8 resampler 2017-04-07 03:57:40 -07:00
Chris Robinson 710bbde09c Ensure SDL_AUDIO_BITSIZE is defined for older SDL2 versions 2017-04-07 03:33:03 -07:00
Chris Robinson 70a097bf59 Clean up a comment 2017-04-07 03:21:40 -07:00
Chris Robinson 338d61f907 Reference count HRTFs and unload them when unused 2017-04-06 13:00:29 -07:00
Chris Robinson 94f514ae5a Load embedded HRTF entries as-needed 2017-04-06 01:35:09 -07:00
Chris Robinson 37f666fbab Fix an incorrect message 2017-04-05 12:46:02 -07:00
Chris Robinson 2eaa10fc21 Load HRTF files as needed
Currently only applies to external files, rather than embedded datasets. Also,
HRTFs aren't unloaded after being loaded, until library shutdown.
2017-04-05 12:27:30 -07:00
Chris Robinson f76dea0c03 Store the loaded hrtf entry container in the enumerated hrtf entry 2017-04-05 11:29:58 -07:00
Chris Robinson e7ca61e8b5 Store the HRTF's filename separate from the entry storage 2017-04-05 07:09:16 -07:00
Chris Robinson 26144ca9df Rename al_string_* functions to alstr_* 2017-04-04 06:58:53 -07:00
Chris Robinson b78ddc7ef7 Make sure the mix is done after setting the looping property 2017-04-02 06:40:56 -07:00
Chris Robinson d52752a3fe Recognize %-encoded characters for config section names 2017-04-01 06:07:14 -07:00
Chris Robinson 497d078f50 Remove a couple unused macros 2017-04-01 03:04:15 -07:00
Chris Robinson 13d7d6fe95 Don't rely on sizeof being the offset to a struct's unsized array 2017-04-01 03:00:24 -07:00
Chris Robinson 52112b0b8d Constify a variable 2017-04-01 02:38:44 -07:00
Chris Robinson 1ef916a54b Make a pointer restrict and assume aligned 2017-04-01 01:08:18 -07:00
Chris Robinson 5f245d5950 Avoid some unnecessary string reallocation 2017-03-31 23:22:06 -07:00
Chris Robinson af833c8554 Remove a couple more uses of BYTE3 2017-03-31 09:21:31 -07:00
Chris Robinson 90c005bbec Convert float samples to integer using a power-of-2 multiple 2017-03-31 09:11:28 -07:00
Chris Robinson 355a8898cf Remove the (u)byte3 sample formats
They're not accessible since the removal of the buffer_samples extension, and
were kind of clunky to work with as 24-bit packed values.
2017-03-31 08:15:20 -07:00
Chris Robinson ac8b4aa5f6 Convert integer samples to float using a power-of-2 divisor
This should cut down on unnecessary quantization noise (however minor) for 8-
and 16-bit samples. Unfortunately a power-of-2 multiple can't be used as easily
for converting float samples to integer, due to integer types having a non-
power-of-2 maximum amplitude (it'd require more per-sample clamping).
2017-03-31 06:54:46 -07:00
Chris Robinson 9fb07101dc Load HRTF coefficients as pre-normalized floats 2017-03-31 04:59:09 -07:00
Chris Robinson 2a8970368f Combine some HRTF loading code 2017-03-31 03:45:26 -07:00
Chris Robinson 7dc3fb98ab Use the correct types' sizes for HRTF storage 2017-03-31 02:15:24 -07:00
Chris Robinson c68dac879c Update the ambisonic docs to mention the near-field effect 2017-03-29 00:11:38 -07:00
Chris Robinson facd8ab109 Make ReleaseContext return if any contexts still remain 2017-03-28 05:33:43 -07:00
Chris Robinson 70aefa75e2 Use an array of pointers for effects instead of a linked list 2017-03-27 23:16:23 -07:00
Chris Robinson b49a79a15f Require CMake 3.0.2
Seems it's necessary for the INCLUDES install property with the cmake config
export.
2017-03-26 21:24:20 -07:00
Chris Robinson 7f55d34a7d Add include/AL to the exported includes destination 2017-03-26 15:11:15 -07:00
Chris Robinson 9f4e47d7be Fix HRTF interpolated gain calculation 2017-03-26 02:44:34 -07:00
Chris Robinson 56428cdb74 Use a loop to apply NFC filters 2017-03-25 23:55:44 -07:00
Chris Robinson 1d559ec703 Properly update the resampler label in the UI 2017-03-24 15:34:36 -07:00
Chris Robinson 5c37eca2c5 Use ALsizei for more index lookups 2017-03-24 14:35:25 -07:00
Chris Robinson 9ca92be0b8 Properly calculate the echo damping 2017-03-24 14:08:04 -07:00
Chris Robinson 1aca344688 Fix handling of the PropsClean flags 2017-03-23 19:32:53 -07:00
Chris Robinson 1c49d0542d Use an atomic flag to mark auxiliary effect slot updates 2017-03-23 19:16:32 -07:00
Chris Robinson 5404b2225a Add some comments for ALsource functions 2017-03-23 01:16:13 -07:00
Chris Robinson 85042a74ee Update ChangeLog 2017-03-22 03:13:36 -07:00
Chris Robinson b062d50bf1 Fix setting Ambi formats for loopback devices 2017-03-21 16:40:23 -07:00
Chris Robinson cdfe0d8f5a Use an atomic flag to test if a source needs to update 2017-03-20 21:25:39 -07:00
Chris Robinson 42bcf0870d Make DataPosInt an ALsizei 2017-03-20 19:22:41 -07:00
Chris Robinson d7d9ad806a Use proper bools for boolean states 2017-03-20 16:53:41 -07:00
Chris Robinson e06cf07ab0 Break up a function and move the code to where it's called 2017-03-19 16:49:23 -07:00
Chris Robinson ecfa1dcb6f Don't defer source state or offset changes 2017-03-19 13:48:40 -07:00
Chris Robinson 9e1aa50518 Fix the lib name for the .pc file 2017-03-18 20:24:19 -07:00
Chris Robinson 66b86d43be Fix alcGetInteger64vSOFT to handle ambisonic attributes 2017-03-18 14:33:40 -07:00
Chris Robinson 7bf7cda467 Replace a couple ALuint with ALsizei 2017-03-17 15:45:39 -07:00
Chris Robinson a209edb5ee Fix NFC filter to set the correct center frequency 2017-03-16 19:58:21 -07:00
Chris Robinson 8f5cab5608 Increase the filter slope to -12dB/octave 2017-03-16 11:25:28 -07:00
Chris Robinson 32d521d79c Check usability of MixHrtf_Neon before MixHrtf_SSE 2017-03-14 19:16:59 -07:00
Chris Robinson 6d565ff1fd Remove a couple unneeded typedefs 2017-03-14 13:10:34 -07:00
Chris Robinson cdf63b553f Avoid doing sequential load for the source state 2017-03-12 19:27:51 -07:00
Chris Robinson 1e7c0b4646 Fix the height of some GUI widgets 2017-03-12 16:25:13 -07:00
Chris Robinson dc17f287fe Use a spinbox for the nfc-ref-delay value 2017-03-12 16:10:49 -07:00
Chris Robinson d9e2a0cbf0 Use QString's arg method to format the float value 2017-03-12 15:27:50 -07:00
Chris Robinson 948ce36fa9 Increase _XOPEN_SOURCE to 600 for Solaris 2017-03-12 14:42:02 -07:00
Chris Robinson 097ed84a87 Handle the nfc-ref-delay config option 2017-03-12 13:24:16 -07:00
Chris Robinson f276e83c8d Document the nfc config option and expose it in alsoft-config 2017-03-12 08:56:19 -07:00
Chris Robinson 7b4645f5f8 Store the HRIR coeff pointer and delays directly in MixHrtfParams 2017-03-12 06:58:27 -07:00
Chris Robinson 96aaab9366 Rework HRTF coefficient fading
This improves fading between HRIRs as sources pan around. In particular, it
improves the issue with individual coefficients having various rounding errors
in the stepping values, as well as issues with interpolating delay values.

It does this by doing two mixing passes for each source. First using the last
coefficients that fade to silence, and then again using the new coefficients
that fade from silence. When added together, it creates a linear fade from one
to the other. Additionally, the gain is applied separately so the individual
coefficients don't step with rounding errors. Although this does increase CPU
cost since it's doing two mixes per source, each mix is a bit cheaper now since
the stepping is simplified to a single gain value, and the overall quality is
improved.
2017-03-11 18:04:06 -08:00
Chris Robinson feffe1e81a Make the voice's 'moving' state a bitflag 2017-03-11 06:26:05 -08:00
Chris Robinson 98e8f941b7 Allocate as many channels for DirectHrtfState as needed 2017-03-11 06:20:04 -08:00
Chris Robinson 6b4b00e462 Dynamically allocate the device's HRTF state 2017-03-10 10:47:43 -08:00
Chris Robinson 51cb969446 Fix building on MSVC 2017-03-10 05:05:25 -08:00
Chris Robinson b878769ee0 Fix building without C11 2017-03-10 04:59:22 -08:00
Chris Robinson 583d431947 Implement NFC filters for Ambisonic rendering
NFC filters currently only work when rendering to ambisonic buffers, which
includes HQ rendering and ambisonic output. There are two new config options:
'decoder/nfc' (default on) enables or disables use of NFC filters globally, and
'decoder/nfc-ref-delay' (default 0) specifies the reference delay parameter for
NFC-HOA rendering with ambisonic output (a value of 0 disables NFC).

Currently, NFC filters rely on having an appropriate value set for
AL_METERS_PER_UNIT to get the correct scaling. HQ rendering uses the averaged
speaker distances as a control/reference, and currently doesn't correct for
individual speaker distances (if the speakers are all equidistant, this is
fine, otherwise per-speaker correction should be done as well).
2017-03-10 04:35:32 -08:00
Chris Robinson d9b1995e95 Add an NFC filter implementation 2017-03-09 15:41:20 -08:00
Chris Robinson 9454d3e776 Move ALvoice declaration to alu.h 2017-03-09 07:23:12 -08:00
Chris Robinson ae22d742dc Remove an unnecessary variable 2017-03-09 07:15:06 -08:00
Chris Robinson 5ffb0842ac Remove unnecessary atomic members 2017-03-08 04:59:22 -08:00
Chris Robinson b1b3a369ef Remove an unnecessary variable 2017-03-07 09:38:33 -08:00
Chris Robinson b64da108a9 Check that a source is actually playing before setting paused
Also slightly refactor setting playing state when the device is disconnected or
there's no buffers to play.
2017-03-07 04:50:09 -08:00
Chris Robinson 190120dfd7 Store the channel count and sample size in the voice 2017-03-07 00:19:40 -08:00
Chris Robinson bc0096365e Don't modify the source state in the mixer 2017-03-07 00:19:40 -08:00
Chris Robinson 1b3100ab9a Remove an unused function 2017-03-07 00:19:40 -08:00
kcat 0b591844b1 Merge pull request #97 from adrianbroher/ci-backends
Enable and enforce dependencies on CI services.
2017-03-07 00:19:13 -08:00
Marcel Metz 099b0a1f7c Only download and strip Android NDK when not cached 2017-03-06 11:39:39 +01:00
Marcel Metz 6a067d9f7e Use TravisCI cache to store stripped Android NDK toolchain 2017-03-06 11:21:51 +01:00
Marcel Metz 25de358c9a Unpack only required files from Android NDK 2017-03-06 11:21:51 +01:00
Marcel Metz a2d0bf8d3a Configure CMake to require available backends on CI services
Configure CMake to require the installed backend libraries.  This should
help to find build system regressions.

On TravisCI with Linux this requires the ALSA, PulseAudio, PortAudio, OSS
and JACK backend.

On TravisCI with Android cross compile Linux this requires the OpenSL
backend.

On TravisCI with MacOSX this requires the CoreAudio backend.

ON AppVeyor with Windows this requires the WinMM, DSound and MMDevAPI
backend.
2017-03-06 10:26:03 +01:00
Marcel Metz 1d208c49b5 Add Android cross-compile to TravisCI test matrix
The test entry adds the ability to test the OpenSLES backend.
2017-03-06 10:24:26 +01:00
Marcel Metz adf6fee6d1 Explicit declare test matrix for TravisCI 2017-03-06 10:23:11 +01:00
Marcel Metz 2a08871fba Delete Xamarin.Common.targets on AppVeyor
This is a workaround for a Xamarin build script bug specific to
AppVeyor.  For more details see:

http://help.appveyor.com/discussions/problems/4569
2017-03-06 10:23:11 +01:00
Marcel Metz 441180a08a Install dependencies on TravisCI to enable more features
Install Ubuntu development packages for PulseAudio, PortAudio, ALSA and
JACK to enable the building of most Linux backends on TravisCI.

Intall Ubuntu development packages for Qt5 to enable `alsoft-config`.
2017-03-05 16:14:18 +01:00
Chris Robinson 073829f26a Make the voice's source pointer atomic 2017-03-05 04:50:27 -08:00
Chris Robinson c040491615 Update alffplay for newer ffmpeg and convert to C++ 2017-03-05 01:20:19 -08:00
Chris Robinson 40c5fe4c33 Remove ex-common and test-common static libs 2017-03-04 23:02:52 -08:00
Chris Robinson 87fd288359 Remove unnecessary wrappers around SDL_sound
Also remove wrappers for the now-unsupported buffer_samples extension.
2017-03-04 22:30:57 -08:00
Chris Robinson c013068003 Use the LINK_FLAGS property instead of abusing libs for flags 2017-03-04 18:20:43 -08:00
kcat 9f9faff90a Merge pull request #95 from adrianbroher/export-config
Enable exporting of CMake import targets
2017-03-04 17:47:13 -08:00
Marcel Metz a11a13bdd1 Use Ubuntu 14.04 in TravisCI to get a less antique CMake version 2017-03-05 00:14:49 +01:00
Marcel Metz ad640245d8 Export cmake import targets for project build tree 2017-03-05 00:14:49 +01:00
Marcel Metz df87cf8002 Export cmake import targets for project install tree 2017-03-05 00:14:49 +01:00
Marcel Metz 27be429ca4 Rename logical CMake target openal to OpenAL 2017-03-05 00:14:49 +01:00
Marcel Metz 9d0bf065ee Compile common library within dependent targets 2017-03-04 22:20:56 +01:00
Marcel Metz 952fb94ff7 Make logical target name openal uniform accross all platforms 2017-03-04 21:08:07 +01:00
Chris Robinson 6d7a790183 Add a boolean to specify if a voice should be playing 2017-03-02 01:02:40 -08:00
Chris Robinson 0e8ca50d7a Stretch out some GUI elements for the decoder configurations 2017-03-01 20:53:52 -08:00
Chris Robinson d1833c7b94 Increment MixCount in UpdateClockBase
This is to protect clocktime reads since the backend lock won't protect it.
2017-02-28 23:18:51 -08:00
Chris Robinson 521abf2e07 Dynamically allocate the channel delay buffers 2017-02-28 21:01:13 -08:00
Chris Robinson 51092a6315 Remove unused function declarations 2017-02-28 19:58:20 -08:00
Chris Robinson 6f2a30dea2 Remove an unneeded function 2017-02-28 19:48:44 -08:00
Chris Robinson d3365f1b5b Start a ALC_SOFT_loopback2 extension
This extends the base ALC_SOFT_loopback extension with support for B-Format.
When ALC_FORMAT_CHANNELS_SOFT is set to ALC_BFORMAT3D_SOFT, then additional
attributes must be specified. ALC_AMBISONIC_LAYOUT_SOFT must be set to
ALC_ACN_SOFT or ALC_FUMA_SOFT for the desired channel layout,
ALC_AMBISONIC_SCALING_SOFT must be set to ALC_N3D_SOFT, ALC_SN3D_SOFT, or
ALC_FUMA_SOFT for the desired channel scaling/normalization scheme, and
ALC_AMBISONIC_ORDER_SOFT must be set to an integer value greater than 0 for the
ambisonic order (maximum allowed is implementation-dependent).

Note that the number of channels required for ALC_BFORMAT3D_SOFT is dependent
on the ambisonic order. The number of channels can be calculated by:
num_channels = (order+1) * (order+1); /* or pow(order+1, 2); */

In addition, a new alcIsAmbisonicFormatSupportedSOFT function allows apps to
determine which layout/scaling/order combinations are supported by the loopback
device. For example,
alcIsAmbisonicFormatSupported(device, ALC_ACN_SOFT, ALC_SN3D_SOFT, 2) will
check if 2nd order AmbiX (ACN layout and SN3D scaling) rendering is supported
for ALC_BFORMAT3D_SOFT output.
2017-02-28 19:01:48 -08:00
Chris Robinson f8558ed2b7 Use a variable counter for an array size limit 2017-02-28 04:21:16 -08:00
Chris Robinson 1cd6617ff6 Don't use the mutex in the base getClockLatency implementation 2017-02-28 03:50:42 -08:00
Chris Robinson 52d1f7883b Print WARNs when a device or context error is generated 2017-02-27 20:59:52 -08:00
Chris Robinson 45d6c34015 Avoid standard malloc for buffer queue entries 2017-02-27 20:43:16 -08:00
Chris Robinson a9610b3607 Use separate enums for the ambisonic channel order and normalization 2017-02-27 16:11:45 -08:00
Chris Robinson 5c859af24e Move the current buffer queue entry and play position to the voice
This has a couple behavioral changes. First and biggest is that querying
AL_BUFFERS_PROCESSED from a source will always return all buffers processed
when in an AL_STOPPED state. Previously all buffers would be set as processed
when first becoming stopped, but newly queued buffers would *not* be indicated
as processed. That old behavior was not compliant with the spec, which
unequivocally states "On a source in the AL_STOPPED state, all buffers are
processed."

Secondly, querying AL_BUFFER on an AL_STREAMING source will now always return
0. Previously it would return the current "active" buffer in the queue, but
there's no basis for that in the spec.
2017-02-27 15:35:15 -08:00
Chris Robinson 513c18fdc4 Ensure a non-playing or -paused source does not use a mixing voice 2017-02-25 18:10:09 -08:00
Chris Robinson 9539ccc18b Set CMP0020 for Qt 2017-02-25 16:29:27 -08:00
Chris Robinson eceeabaf2f Improve handling of source state reads
This avoids using seq_cst for loading the source state when either inside the
mixer, or otherwise protected from inconsistencies with async updates. It also
fixes potential race conditions with getting the source offset just as a source
stops.
2017-02-24 01:47:34 -08:00
Chris Robinson 652ef2b7fd Remove an unused function 2017-02-23 20:40:16 -08:00
Chris Robinson c2a79f0f7b Remove CalcXYZCoeffs and inline CalcAngleCoeffs 2017-02-23 16:44:59 -08:00
Chris Robinson 08948079e9 Alter how panpot/pair-wise panning works
This change allows pair-wise panning to mostly go through the normal ambisonic
panning methods, with one special-case. First, a term is added to the stereo
decoder matrix's X coefficient so that a centered sound is reduced by -3dB on
each output channel. Panning in front creates a similar gain response to the
typical
L = sqrt(1-pan)
R = sqrt(pan)
for pan = [0,1]. Panning behind the listener can reduce (up to) an additional
-10dB, creating a audible difference between front and back sounds as if
simulating head obstruction.

Secondly, as a special-case, the source positions are warped when calculating
the ambisonic coefficients so that full left panning is reached at -30 degrees
and full right at +30 degrees. This is to retain the expected 60-degree stereo
width. This warping does not apply to B-Format buffer input, although it
otherwise has the same gain responses.
2017-02-23 01:32:44 -08:00
Chris Robinson 0ce4c9b8fa Rename stereo-panning option to stereo-encoding
Also rename the 'paired' value to 'panpot', and make it the default.
2017-02-22 19:18:01 -08:00
Chris Robinson d04cc28f33 Limit filter gains to -24dB 2017-02-22 18:07:41 -08:00
Chris Robinson 629980d15e Update ChangeLog 2017-02-22 16:31:24 -08:00
Chris Robinson 55e3b840b3 Reduce the default period count to 3 2017-02-22 15:56:09 -08:00
Chris Robinson 2e1f1449bc Don't remove a period from the OSS buffer
Since we're now waiting for space to be available before mixing, the mixing
buffer isn't adding another period.
2017-02-22 15:44:47 -08:00
Chris Robinson e720faf2d4 Fix OpenSL latency calculation 2017-02-22 15:00:41 -08:00
Chris Robinson 5181e78c1e Reduce some code 2017-02-21 18:28:09 -08:00
Chris Robinson 2dd142fed0 Make the "sends" config option act as a limit
Instead of forcing the device to always use the specified send count, it simply
limits requests to it.
2017-02-21 17:23:54 -08:00
Chris Robinson d3cc867bd4 Increase the default effect slot and send count
The default number of auxiliary effect slots is now 64. This can still be
raised by the config file without a hard maximum, but incurs processing cost
for each effect slot generated by the app.

The default number of source sends is now actually 2, as per the EFX docs.
However, it can be raised up to 16 via ALC_MAX_AUXILIARY_SENDS attribute
requests, rather than the previous 4.
2017-02-21 16:54:55 -08:00
Chris Robinson 864d5387dd Dynamically allocate the ALsource Send[] array 2017-02-21 16:31:59 -08:00
Chris Robinson 29994aa2de Interleave the voice and source property objects 2017-02-21 12:29:25 -08:00
Chris Robinson cd24e42b3f Make the voices' Send[] array dynamically sized
The voices are still all allocated in one chunk to avoid memory fragmentation.
But they're accessed as an array of pointers since the size isn't static.
2017-02-21 11:17:47 -08:00
Chris Robinson e0e6efbfea Print warnings about missing libraries and functions 2017-02-21 10:17:48 -08:00
Chris Robinson bb4726d520 Avoid duplicating device buffer layout logic 2017-02-20 16:57:25 -08:00
Chris Robinson f5e8a8c75e Remove an unused flag enum 2017-02-20 09:25:09 -08:00
Chris Robinson 23a34f732b Remove mention of the sinc8 resampler 2017-02-20 09:13:08 -08:00
Chris Robinson 5a2ef2590f Allow distance compensation for non-HQ rendering as well
It still requires a custom configuration to specify appropriate speaker
distances.
2017-02-20 09:08:57 -08:00
Chris Robinson b23f81b686 Remove the separate surround51rear decoder option
Both 5.1 Side and Rear configurations use 'surround51' to look up the
appropriate decoder file. The decoder loader already handles mapping between
rear and side channels, so there's no need for separate options.
2017-02-19 22:59:55 -08:00
Chris Robinson 3761336e6c Apply distance compensation when writing to the output 2017-02-19 22:47:59 -08:00
Chris Robinson 9da152a9c8 Don't use periphonic FOA when the HOA decoder is not periphonic 2017-02-19 17:45:27 -08:00
Chris Robinson d45dd9c668 Remove the sinc8 resampler option
Perf shows less than 1 percent CPU difference from the higher quality bsinc
resampler, but uses almost twice as much memory (a 128KB lookup table).
2017-02-19 16:45:17 -08:00
Chris Robinson 247f56249a Always lock the device backend before calling aluMixData 2017-02-18 17:32:07 -08:00
Chris Robinson 2448f88e70 Return some device latency by default
A device will never have 0 latency. OpenAL Soft itself uses a sample buffer
length of UpdateSize*NumUpdates, and during playback will have about
(NumUpdates-1) periods filled, more or less. Without a more accurate
measurement from the playback system, this is better than reporting 0.
2017-02-18 16:55:48 -08:00
Chris Robinson d8c42918f4 Use select() to wait for audio with OSS and Solaris 2017-02-18 15:58:15 -08:00
Chris Robinson 909193a345 Reorganize ALvoice members
This places the Send[] array at the end of the struct, making it easier to
handle dynamically.
2017-02-15 17:40:26 -08:00
Chris Robinson 5a50c46c22 Make ALsourceProps' Send array dynamically sized
ALsourceProps' Send[] array is placed at the end of the struct, and given an
indeterminate size. Extra space is allocated at the end of each struct given
the number of auxiliary sends set for the device.
2017-02-14 19:59:39 -08:00
Chris Robinson 69dd570961 Fix build with non-C11 atomics 2017-02-13 21:30:20 -08:00
Chris Robinson 0d19a20901 Make the source state atomic
Since it's modified by the mixer when playback is ended, a plain struct member
isn't safe.
2017-02-13 21:18:18 -08:00
Chris Robinson 0324712540 Put BsincState in a generic union 2017-02-13 11:29:32 -08:00
Chris Robinson 841d0bb893 Porperly check for and use __builtin_assume_aligned 2017-02-13 07:36:49 -08:00
Chris Robinson 65f9b2792c Clean up the bsinc mixer a bit 2017-02-12 21:35:08 -08:00
Chris Robinson 27695e2b24 Add NEON-enhanced resamplers 2017-02-12 21:03:30 -08:00
Chris Robinson 427f484e01 Print separate messages for building sdl_sound and ffmpeg examples 2017-02-12 08:37:42 -08:00
Chris Robinson 6b030999cb Don't require SDL_sound for alffplay
Also explicitly link with libz for alffplay, since static ffmpeg libs need it.
2017-02-11 12:56:13 -08:00
Chris Robinson e92229f839 Fix more uses of unsigned sizes and offsets 2017-02-10 06:20:16 -08:00
Chris Robinson 5bd63ff03d Remove a couple context lock wrapper functions 2017-02-07 19:32:49 -08:00
Chris Robinson 7cc8ba99f0 Properly capitalize NEON 2017-02-07 18:33:12 -08:00
Chris Robinson 317d135b96 Clear trailing whitespace from the cpu features string 2017-02-07 11:19:41 -08:00
Chris Robinson c771b82a39 Use the correct IID for the opensl buffer queue 2017-02-07 10:55:36 -08:00
Chris Robinson 9f10ae466c Convert the OpenSL backend to the new backend API
This also removes the buffer queue callback's call to aluMixData, which could
potentially block on a mutex.
2017-02-07 07:06:41 -08:00
Chris Robinson af362c2d05 Fix for NULL JNIEnv
Which can happen with native-only apps
2017-02-05 14:25:17 -08:00
Chris Robinson 428cde5dc2 Call getSystemService as a non-static function 2017-02-03 09:41:21 -08:00
Chris Robinson 2c1791752a Android's AudioManager.getProperty(String) returns a String 2017-02-02 06:14:01 -08:00
Chris Robinson 071b83ba52 Replace more ALuint with ALsizei 2017-01-29 16:42:02 -08:00
Chris Robinson 55a2474d7e Fix late reverb low-pass filtering 2017-01-29 13:06:40 -08:00
Chris Robinson 3cc88b0aab Use an all-pass series on each late reverb line
This attempts to improve the smoothness of the late reverb decay by passing
each line through multiple all-pass filters. Some work is still needed to work
better in high-density and not-so-high-diffusion environments.

This also removes the decay from the early reflections, since it's no longer
continuous feedback.
2017-01-28 17:15:47 -08:00
Chris Robinson 6b2297b508 Add more traces for the Java calls being made 2017-01-27 15:42:06 -08:00
Chris Robinson 9c019126d4 Remove __android_log_print calls for TRACEREF
TRACEREFs aren't normally important, and for as often as it happens, the added
function calls are wasteful even if they end up doing nothing.
2017-01-27 15:17:11 -08:00
Chris Robinson 19e96c6fef Round and clamp the scaled update count with opensl 2017-01-27 01:46:44 -08:00
Chris Robinson 67ffdf7a78 Try to use the system sample rate with Android 2017-01-26 18:23:29 -08:00
Chris Robinson 3ba03c5a29 Also log to __android_log_print on Android 2017-01-26 18:15:19 -08:00
Chris Robinson f0c8b7f255 Get the JavaVM handle on Android targets 2017-01-26 14:33:03 -08:00
Chris Robinson 1ebfce4cac Improve the ambisonic upscaling methods
This now takes advantage of the differences seen in generated decoder matrices
for first-order compared to second- and third-order, such that with the
appropriate frequency-dependent scaling applied to first-order content, the
result is identical with a higher-order decoder matrix compared to a first-
order matrix for the same layout.
2017-01-24 19:03:51 -08:00
Chris Robinson f4d52f43d8 Fix coefficient counts for the built-in B-Format decoders 2017-01-21 12:28:54 -08:00
Chris Robinson 7025660e8b Use a flat sqrt(2) scale for non-directional ambient gains 2017-01-21 11:54:22 -08:00
Chris Robinson 371fda1803 Update the default basic B-Format decoders
This also converts them to ACN/N3D format.
2017-01-21 11:05:05 -08:00
Chris Robinson aa56af1ecb Move the B-Format HRTF virtual speaker stuff to InitHrtfPanning
This keeps the decoder matrices and coefficient mapping together for if it
changes in the future.
2017-01-18 19:16:24 -08:00
Chris Robinson e8ac0e5bfd Replace some ALvoid with void 2017-01-18 07:19:43 -08:00
Chris Robinson d2e5aa79dd Use ALsizei in more places 2017-01-18 07:13:23 -08:00
Chris Robinson ba0944af9b Pass the left and right buffers to the hrtf mixers directly 2017-01-17 16:49:26 -08:00
Chris Robinson bfb7a6e4c8 Small update for the "virtual" Ambi2DDecoder coefficients 2017-01-17 11:35:19 -08:00
Chris Robinson e9009968fb More ALsizei, with the B-Format decoder 2017-01-16 09:37:55 -08:00
Chris Robinson f1f93a593a Fix a couple hard-coded array sizes 2017-01-16 09:04:58 -08:00
Chris Robinson 959812ee13 Use ALsizei in a few more places 2017-01-16 08:59:08 -08:00
Chris Robinson 325a49975a Use ALsizei and ALint for sizes and offsets with resamplers and filters 2017-01-16 08:54:30 -08:00
Chris Robinson cbb796bf31 Use ALsizei for sizes and offsets with the mixer
Unsigned 32-bit offsets actually have some potential overhead on 64-bit targets
for pointer/array accesses due to rules on integer wrapping. No idea how much
impact it has in practice, but it's nice to be correct about it.
2017-01-16 08:06:25 -08:00
Chris Robinson 9f23d17333 Use second-order ambisonics for basic HRTF rendering
This should improve positional quality for relatively low cost. Full HRTF
rendering still only uses first-order since the only use of the dry buffer
there is for first-order content (B-Format buffers, effects).
2017-01-15 13:57:22 -08:00
Chris Robinson 8e868823fd Replace range-based for loops with QList iterators
Less than ideal, but some targets can't rely on C++11
2017-01-13 00:46:49 -08:00
Chris Robinson e254a3f0c2 Search for and use Qt5 for alsoft-config
An option is provided to instead use Qt4.8 still if desired.
2017-01-12 23:53:27 -08:00
Chris Robinson 6e806848eb Use C++11 for alsoft-config 2017-01-12 13:38:21 -08:00
Chris Robinson 24de5127b1 Update binary search algorithm for uintmaps 2017-01-12 10:09:39 -08:00
Chris Robinson 58f84170b6 Avoid using some LP types 2017-01-10 05:12:54 -08:00
Chris Robinson 43ab6075f9 Use proper atomics in the OSS backend 2017-01-10 03:17:23 -08:00
Chris Robinson e20f0ae5a3 Hold Pulse's mainloop lock while calling capture functions
Since commit c837484015, the backend's lock is no longer implicitly held when
calling capture functions. A separate mutex is used to ensure serial access,
and its up to the backend to protect against races and reentrancy with the
audio API.
2017-01-10 03:02:26 -08:00
Chris Robinson 987b6e069b One more update for the HRTF B-Format coefficients
These should better represent the pseudo-inverse matrices with N3D scaling.
2017-01-09 06:36:02 -08:00
Chris Robinson 18bb46163a Add missing AL_EFFECTSLOT_ properties for al(c)GetEnumValue 2017-01-05 20:06:24 -08:00
Chris Robinson da4f0c65c3 Update the B-Format HRTF coefficients to use the pseudo-inverse matrix
It's hard to tell which is ultimately better, although this way does make the
FOA output somewhat louder which will help when it's combined with direct HRTF
rendering.
2017-01-04 21:53:28 -08:00
Chris Robinson fcdf1cea70 Avoid writing to the same buffer that's read from
Also clean up comment formatting a bit.
2016-12-23 12:37:48 -08:00
Chris Robinson 40f359d159 Rename the version target for systems that have a version lib 2016-12-21 21:56:51 -08:00
Chris Robinson 080b0cea8b Reorder filter coefficients 2016-12-21 21:35:50 -08:00
Chris Robinson 4c33818dde Avoid duplicating code using a macro 2016-12-21 19:58:03 -08:00
Chris Robinson 315bd556ac Convert the SndIO backend to the updated API 2016-12-21 17:28:22 -08:00
Chris Robinson dedc782222 Avoid duplicate HRTF entries in the UI
Similar to how the library handles it, duplicate entries of the same file are
ignored. This could happen if, for example, XDG_DATA_DIRS contains the same
path multiple times.
2016-12-21 12:05:26 -08:00
Chris Robinson 1b104dd77b More robustly generate the git commit ID and branch 2016-12-21 11:41:45 -08:00
Chris Robinson e270a9784b Add missing macros for OSS3/Free compatibility 2016-12-21 10:54:19 -08:00
Chris Robinson bcb6dfee71 Trace the commit ID and branch the library was built from 2016-12-21 01:12:47 -08:00
Chris Robinson 8f581c0e66 Use separate macros for atomics that don't take a memory order 2016-12-20 20:49:37 -08:00
kcat 19ba71e767 Merge pull request #89 from rdb/patch-1
Explicitly disable use of GNU89 inline semantics
2016-12-20 13:43:59 -08:00
rdb f0c2c23ad1 Explicitly disable use of GNU89 inline semantics 2016-12-20 22:34:00 +01:00
Chris Robinson 70378925b0 Warn when a given device name isn't found for OSS 2016-12-01 18:34:29 -08:00
Chris Robinson 66569295e5 Minor cleanup for ALCossListPopulate 2016-12-01 18:26:18 -08:00
Chris Robinson 338e0d72b4 Ensure OSS devices are enumerated when a name is requested. 2016-12-01 18:11:52 -08:00
Chris Robinson 02a6031d03 Use atomic flags for boolean atomic locks 2016-11-25 23:25:16 -08:00
Chris Robinson ea82a6d19e Use a function to generate the up-sampler transcode matrix 2016-11-24 21:29:53 -08:00
Chris Robinson 10473285ba Fix an infinite loop 2016-11-23 01:32:14 -08:00
Chris Robinson 6886f77cbc Only send source updates for sources that have updated 2016-11-23 01:31:13 -08:00
Chris Robinson fcb669f803 Set the windows subsystem for DLLs on MSVC and GCC on Windows 2016-11-22 15:47:46 -08:00
Chris Robinson 49fd154829 Update cmake scripts to handle policy 0054 2016-11-22 14:50:55 -08:00
Chris Robinson 8492c2845d Avoid some unnecessary seq_cst memory ordering 2016-11-22 03:40:15 -08:00
Chris Robinson c618971758 Remove the non-atomic COMPARE_EXCHANGE macro 2016-11-22 03:00:16 -08:00
Chris Robinson 01babb69d2 Clean up finding a source's voice 2016-11-22 02:59:54 -08:00
Chris Robinson 616adea4cc Improve seqlock behavior 2016-11-21 23:58:28 -08:00
Chris Robinson 8bf4fe2eea Update some atomic memory ordering 2016-11-21 21:38:49 -08:00
Chris Robinson a502a41be3 Stop using almemory_order_consume 2016-11-17 00:46:46 -08:00
Chris Robinson caead294f2 Update a function comment about its input 2016-11-16 22:04:16 -08:00
Chris Robinson b743bc1c1b Remove the temporary stub files after the output object is made 2016-11-11 13:19:45 -08:00
Chris Robinson e69af7ab92 Fixes for embedded HRTFs on OSX
Use an empty source file to build a stub object file, instead of /dev/null. Use
_mh_dylib_header to retrieve the data on 10.7+, instead of _mh_execute_header.
And shorten the names to fit in the 16-character limit.

Thanks to Anna Cheremnykh for the fixes!
2016-11-11 13:14:02 -08:00
Chris Robinson 9ef7719734 Try to make embedded HRTF data sets work on OSX 2016-11-10 21:51:45 -08:00
Chris Robinson 0532acdf94 Don't use 0 for a resource ID 2016-11-10 12:37:07 -08:00
Chris Robinson 6a91d6a10a Add support for 8-byte types on inline assembly ATOMIC_ADD/SUB 2016-11-03 23:47:50 -07:00
Chris Robinson 939d16d57c Include the full JACK ringbuffer size for the device period count 2016-11-03 23:29:33 -07:00
Chris Robinson acc9f66baf Clean up some ringbuffer atomic calls 2016-11-03 21:04:24 -07:00
Chris Robinson 82e8dd0525 Fix win32 atomic fallbacks 2016-11-03 15:32:31 -07:00
Chris Robinson 815947492c Remove the explicit type from ATOMIC_ADD and ATOMIC_SUB 2016-11-03 01:22:29 -07:00
Chris Robinson 9682a62743 Use proper atomics for the lockless ringbuffer 2016-11-03 00:47:22 -07:00
Chris Robinson 118cc0907d Remove an unnecessary intermediate variable 2016-11-02 16:10:02 -07:00
Chris Robinson 2d5efe424f Be clearer about whether full or basic HRTF rendering is used 2016-11-02 16:10:02 -07:00
kcat c8ce33d5bd Merge pull request #78 from septag/cmake-dsound
Added cmake support for dsound and windows 8/10 SDKs
2016-11-02 16:09:23 -07:00
septag ac26b209a6 fixed minor check in FindDSound.cmake 2016-11-03 01:52:40 +03:30
septag d142ba1ab4 Added cmake FindWindowsSDK for FindDSound module and fixed FindDSound.cmake 2016-11-03 00:37:09 +03:30
Chris Robinson 43e7323adb Rebalance the frequencies for B-Format HRTF coefficients
The original pseudo-inverse method that generated the LF matrix expects the
high frequencies to be scaled up by ~2.645751 over the low frequencies (or
sqrt(7), ~8.45dB). However, the AllRAD method used to generate the HF matrix
produced a matrix that was only scaled up by 1.46551981258 (based on the
average of the W coefficients).

Previously, the LF matrix was scaled down by sqrt(7), as the difference
specified in the pseudo-inverse results. This failed to account for the
increase already present in the HF matrix, so now the LF matrix is scaled down
by the remaining difference between the expected scaling and the scaling
already present in the HF matrix (sqrt(7) / 1.46551981258 = 1.80533302205, or
roughly 5.13dB, where the reciprocal is 0.553914423 for -5.13 dB).
2016-11-01 02:20:19 -07:00
Chris Robinson a44f4c2fcb Initial ChangeLog update for 1.18 changes 2016-10-30 11:09:34 -07:00
Chris Robinson e46a92c220 Workaround some systems having an ECHO macro 2016-10-30 08:45:09 -07:00
septag d01d30ad5e Added cmake support for dsound and windows 8/10 SDKs 2016-10-30 14:18:45 +03:30
Chris Robinson 9120e7987e Cleanup and clarify a bit of the ambisonic docs 2016-10-28 06:27:01 -07:00
Chris Robinson 2668da696c Round the early and late delay tap sample offsets 2016-10-26 22:12:48 -07:00
Chris Robinson 16ed117d71 Restore a comment that was accidentally deleted 2016-10-10 01:33:33 -07:00
Chris Robinson 4bb6b9589f Don't interpolate between nearest HRIRs
It still fades between HRIRs when it changes, but now it selects the nearest
one instead of blending the nearest four. Due to the minimum-phase nature of
the HRIRs, interpolating between delays lead to some oddities which are
exasperated by the fading (and the fading is needed to avoid clicks and pops,
and smooth out changes).
2016-10-09 00:37:47 -07:00
Chris Robinson 698eddbb0c Better sort the main delay line taps 2016-10-06 20:05:16 -07:00
Chris Robinson f826f86842 Decorrelate the early reflection inputs 2016-10-06 19:45:48 -07:00
Chris Robinson 76cd6797b7 Add some more 'restrict' keywords 2016-10-06 01:39:18 -07:00
Chris Robinson 965e91c702 Remove an unused struct 2016-10-05 20:35:14 -07:00
Chris Robinson 9b8f36b758 Pass current and target gains directly for mixing 2016-10-05 20:33:45 -07:00
Chris Robinson 1e1a8837f8 Update a comment about using row mixers 2016-10-05 15:09:14 -07:00
Chris Robinson 06639b8250 Better pack the late reverb low- and all-pass variables 2016-10-05 13:31:53 -07:00
Chris Robinson bb6fba2183 Properly check for struct timespec 2016-10-04 17:19:47 -07:00
Chris Robinson 422f065809 Use the row mixer functions for the B-to-A-Format conversion 2016-10-04 16:42:28 -07:00
Chris Robinson 9349ee9002 Make some pointer-to-array parameters const 2016-10-04 16:25:43 -07:00
Chris Robinson a0e4696f55 Include wtypes.h for defining Windows' property keys 2016-10-04 11:20:01 -07:00
Chris Robinson 1e4d9cfa7e Enhance reverb using B-Format processing
Technically it uses A-Format processing from the B-Format input and output. But
this attempts to provide better spatial definition to the reverberation so that
it can be used in a more generic fashion, allowing it to be decoded as any
other B-Format signal to whatever output is needed, and also allowing for a bit
of height information when the output is capable of such.

There may still be some kinks to work out, such as properly decorrelating the
early reflection taps and tweaking the late reverb density. But it seems to be
a good enough start.
2016-10-03 12:20:13 -07:00
Chris Robinson 67c74e858b Finalize AL_SOFT_gain_clamp_ex 2016-10-03 12:11:50 -07:00
Chris Robinson a258790539 Update the ambisonic coefficients for HRTF
This uses an AllRAD-derived decoder matrix for the high frequencies, which
seems to improve positioning response. It also switches back to dual-band.
The low frequencies appear to be unexpectedly quiet by comparison, but it's not
that bad and can be tweaked later.
2016-09-26 11:18:26 -07:00
Chris Robinson f5e4a3ed85 Add a volume-adjust config option to adjust the source output volume
Designed for apps that either don't change the listener's AL_GAIN, or don't
allow the listener's AL_GAIN to go above 1. This allows the volume to still be
increased further than such apps may allow, if users find it too quiet.

Be aware that increasing this can easily cause clipping. The gain limit
reported by AL_GAIN_LIMIT_SOFT is also affected by this.
2016-09-24 18:46:41 -07:00
Chris Robinson 24f9a0f2ae Remove some more unnecessary volatiles 2016-09-24 14:29:27 -07:00
Chris Robinson d89624b03c Recognize Headset formfactors as headphones 2016-09-21 15:16:09 -07:00
Chris Robinson 4486043ae5 Skip audio packets that fail to decode in alffplay 2016-09-14 13:37:20 -07:00
kcat 2f1f7f4c6a Merge pull request #63 from adrianbroher/gnuinstalldir
Use GNUInstallDirs to place the build artifacts properly
2016-09-14 09:48:03 -07:00
Chris Robinson bb48a7e520 Fix EAX reverb effect output for HRTF and UHJ 2016-09-13 16:55:39 -07:00
Chris Robinson af5fb3d6e7 Fix the libatomic check 2016-09-13 12:11:52 -07:00
kcat a56bbbcf36 Merge pull request #70 from snikulov/appveyor_win_ci
build: added appveyor-ci script to verify windows build
2016-09-13 10:44:24 -07:00
Sergei Nikulov 1ff24c7171 build: added appveyour-ci script to verify windows build 2016-09-13 15:08:47 +03:00
Chris Robinson a004ccfa1a Check for libatomic, in case C11 atomics need it 2016-09-12 12:42:11 -07:00
Chris Robinson 53d8a49673 Call ALfilterState_processC directly
It's the only implementation currently, so there's no point to having it stored
as a function pointer in the filter struct. Even if there were SIMD versions,
it'd be a global selection, not per-instance.
2016-09-12 11:48:15 -07:00
Chris Robinson 46b3e1d08c Check if -mfpu=neon is available for compiling the NEON mixer 2016-09-12 11:31:59 -07:00
Chris Robinson efaa09dc23 Write to the correct outputs for extra reverb channels 2016-09-11 17:11:19 -07:00
Chris Robinson 651715abc9 Combine the reverb decorrelator delay line with the main delay line
Since it was merely acting as an extension of it anyway, with the second delay
line tap (for late reverb) copying attenuated samples to the decorrelator line
that was being tapped off of. Just extend the delay line and offset the
decorrelator taps to be relative to the late reverb tap.
2016-09-11 12:25:06 -07:00
Chris Robinson 4fcf9279fe Mark a global variable declaration as extern 2016-09-11 07:20:02 -07:00
Chris Robinson f993fd0cef Don't warn if the desired default HRTF is already first 2016-09-10 07:55:33 -07:00
Chris Robinson ba449ccce5 Handle UTF-8 output on Windows in openal-info 2016-09-09 09:52:01 -07:00
Chris Robinson 45dfdca6f9 Reduce the volume for the HRTF ambisonic decoder
Since it's accumulating multiple HRIRs for two output speakers, it seems to be
a better option to preserve the amplitude of the high-frequency decoder instead
of increasing it, and reduce the amplitude of the low-frequency decoder to
compensate.
2016-09-08 16:22:46 -07:00
Chris Robinson 0f24f49a44 Allow specifying the device to open for the examples 2016-09-08 12:14:28 -07:00
Chris Robinson b21e481827 Only WARN if GetProcPath fails to find the binary 2016-09-08 11:56:25 -07:00
Chris Robinson 958301d880 Try increasing the stack size if thread creation fails
Also increase the default stack size to 2MB.
2016-09-08 06:30:25 -07:00
kcat 4d91afb203 Merge pull request #64 from tpetazzoni/arm-neon-fix
Build NEON code with -mfpu=neon
2016-09-08 02:09:55 -07:00
Chris Robinson c3c283a0b5 Properly check if /proc/cpuinfo opened 2016-09-08 02:02:09 -07:00
Chris Robinson 742f181595 Use a few more HRIRs for the HRTF B-Format decoder
14 in total, an 8-point cube and a 6-point diamond shape, to help improve sound
localization a bit. Incurs no real extra CPU cost once the IRs are built.
2016-09-07 16:26:13 -07:00
Chris Robinson a52cfc8048 Check for run-time NEON support by reading /proc/cpuinfo
Less than ideal since documentations warn it may not list 'neon' even if it's
really supported. However, the "proper" APIs to check for NEON extensions don't
seem to exist in my toolchain.
2016-09-07 09:57:40 -07:00
Chris Robinson ef67d17a84 Simplify mmdevapi's device name search
Avoids converting each enumerated devid from WSTR to UTF-8, and instead just
converts the device name from UTF-8 to WSTR once if needed.
2016-09-07 09:22:34 -07:00
kcat 64a8ad9711 Merge pull request #65 from Dmytry/dmytry_github_master
mmdevapi: Allow specifying output device by it's audio endpoint GUID …
2016-09-07 08:32:31 -07:00
Chris Robinson 3af1d5b722 Properly align 16-bit fields in the Hrtf struct 2016-09-07 05:38:22 -07:00
Chris Robinson 7973c5abf8 Use unsigned int shifts for device flags 2016-09-07 05:18:42 -07:00
Dmytry Lavrov 6b7e14f11f mmdevapi: Allow specifying output device by it's audio endpoint GUID or by the device id string (Oculus VR api requires you to play back on a specific device). 2016-09-06 19:25:44 -05:00
Chris Robinson 1d9d1958db Make the SelectMixer function sharable 2016-09-06 13:21:11 -07:00
Thomas Petazzoni 27916ce3db Build NEON code with -mfpu=neon
The ARM-specific NEON code needs to be built with -mfpu=neon to avoid
build failures when a difference FPU is used by default by the
compiler.

Fixes issue #54.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-09-06 22:19:14 +02:00
Marcel Metz 3481cf6fba Use GNUInstallDirs for generated pkg-config file
Continuation of 6387933
2016-09-06 21:52:05 +02:00
Marcel Metz 6387933f8b Use GNUInstallDirs to place the build artifacts properly
CMake 2.8.5 added the GNUInstallDirs module, which provides various
variables following the CMAKE_INSTALL_*DIR pattern to allow users a more
flexible installation setup and to provide sensible defaults while
respecting distribution specific install locations like lib64 for RPM
based linux distributions or debian multiarch tuples.
2016-09-06 21:43:01 +02:00
Chris Robinson 9cbe02fd85 Use the optimized mixing functions for reverb output 2016-09-06 12:16:49 -07:00
Chris Robinson 0558869d94 Use deinterlaced buffers for the intermediate reverb storage 2016-09-06 11:07:45 -07:00
Chris Robinson a758cc8243 Remove use of DECL_CONST
No idea if it was really gaining us anything, but removing it fixes a crash I
was getting with libs built with Clang.
2016-09-06 09:09:25 -07:00
Chris Robinson 1541ff24b8 Do reverb modulation before band-pass filtering
Ideally the band-pass should probably happen closer to output, like gain is.
However, doing that would require 16 filters (4 early + 4 late channels, each
with a low-pass and high-pass filter), compared to the two needed to do it on
input.
2016-09-06 07:02:17 -07:00
Chris Robinson b1f70b5b78 Rename some variables for clarity 2016-09-06 03:10:38 -07:00
Chris Robinson 564030ffa4 Use more correct cube decoder matrices 2016-09-05 10:33:52 -07:00
Chris Robinson a20576bbd7 Do multiple samples at once for reverb modulation 2016-09-05 06:08:01 -07:00
Chris Robinson 8a64f07121 Use a predefined identity matrix 2016-09-05 02:02:14 -07:00
Chris Robinson 42452b7f79 Correct a comment about B-Format conversion 2016-09-05 00:38:41 -07:00
Chris Robinson cf0ef500ec Rename MatrixMixerFunc to RowMixerFunc 2016-09-02 00:29:46 -07:00
Chris Robinson 17636a0c1c Calculate a variable closer to where it's used 2016-09-01 21:05:24 -07:00
Chris Robinson 7428636071 Use MixMatrixRow to upsample the split frequency bands to the output 2016-09-01 07:08:52 -07:00
Chris Robinson 6fb634c3e1 Remove unnecessary consts
They were causing GCC's built-in atomic cmpxchg to complain.
2016-08-31 09:26:57 -07:00
Chris Robinson 7a140b6912 Reorganize sample type conversion functions
To help avoid redundant manual definitions.
2016-08-31 08:30:52 -07:00
Chris Robinson 566d449e53 Always load HRTF files through memory pointers 2016-08-31 08:16:49 -07:00
Chris Robinson e01c337921 Add some helper wrappers to mmap files 2016-08-31 08:14:50 -07:00
Chris Robinson ccf90df072 Initialize some enums to dummy values 2016-08-31 04:56:10 -07:00
Chris Robinson f791b8c517 Add a compile-time macro to use dual-band ambisonic HRTF processing
Use single-band processing for now, to see if dual-band is causing a drop in
quality at all.
2016-08-30 22:33:33 -07:00
Chris Robinson 8d3a286577 Simplify the ambisonic up-sampler
It still behaves the same, although now combines the separate decode+encode
matrices into a transcode matrix (one per frequency band).
2016-08-30 04:21:57 -07:00
Chris Robinson 6d7f9aacd6 Print whether direct channels are off or on to stdout in alffplay 2016-08-29 22:18:44 -07:00
Chris Robinson 4859984e33 Add an option to alffplay to toggle AL_DIRECT_CHANNELS_SOFT
Using the 'd' key will toggle the playback source's AL_DIRECT_CHANNELS_SOFT
property. Although there is no visual feedback showing when it's on or off.
2016-08-29 01:55:44 -07:00
Chris Robinson 54649851fa Remove the upper limit from AL_MIN_GAIN and AL_MAX_GAIN
As per the current AL_SOFT_gain_clamp_ex proposal.
2016-08-29 01:53:52 -07:00
Chris Robinson 5bf0c64258 Add a query for the maximum source gain limit 2016-08-28 18:21:09 -07:00
Chris Robinson 3d59021702 Clamp the maximum mixing gain boost to 16
The combined source and listener gains now can't exceed a multiplier of 16
(~24dB). This is to avoid mixes getting out of control with large volume
boosts, which reduces the effective precision given by floating-point.
2016-08-27 06:28:04 -07:00
Chris Robinson 4b153dade8 Allow sources to play while alcSuspendContext is in effect
This appears to be how Creative's Windows drivers handle it, and is necessary
for at least the Windows version of UT2k4 (otherwise it tries to play a source
while suspended, checks and sees it's stopped, then kills it before it's given
a chance to start playing).

Consequently, the internal properties it gets mixed with are determined by what
the source properties are at the time of the play call, and the listener
properties at the time of the suspend call.

This does not change alDeferUpdatesSOFT, which will still hold the play state
change until alProcessUpdatesSOFT.
2016-08-26 21:19:38 -07:00
Chris Robinson ef03de3981 Avoid directly replacing the effect slot Update pointer 2016-08-25 18:19:13 -07:00
Chris Robinson a16739f765 Properly defer effect slot changes
Note that this now also causes all playing sources to update when an effect
slot is updated. This is a bit wasteful, as it should only need to re-update
sources that are using the effect slot (and only when a relevant property is
changed), but it's good enough. Especially with deferring since all playing
sources are going to get updated on the process call anyway.
2016-08-25 06:17:36 -07:00
Chris Robinson 4e4e597fa5 Track all references for effect states
This allows us to not have to play around with trying to avoid duplicate state
pointers, since the reference count will ensure they're deleted as appropriate.
The only caveat is that the mixer is not allowed to decrement references, since
that can cause the object to be freed (which the mixer code is not allowed to
do).
2016-08-25 04:57:58 -07:00
Chris Robinson 0fbf34fb45 Add a ref count to ALeffectState
This is mostly just reorganizing the effects to call the Construct method which
initializes the ref count.
2016-08-25 03:49:57 -07:00
Chris Robinson d8e9b3c621 Also rotate stereo sounds in the alhrtf example 2016-08-24 03:49:45 -07:00
Chris Robinson 849f85549d Consolidate duplicate code 2016-08-24 02:17:55 -07:00
Chris Robinson 8bf4a22876 Combine related members into a struct 2016-08-24 00:25:28 -07:00
Chris Robinson e77de8b12a Make a function definition static 2016-08-23 23:57:55 -07:00
Chris Robinson ea2fb38627 Hold updates for both listener and source updates 2016-08-23 19:37:26 -07:00
Chris Robinson c7eb0b7393 Don't pass the context's distance model as the source's 2016-08-23 19:17:17 -07:00
Chris Robinson dc8b7814c7 Avoid resupplying unneeded source updates
The source's voice holds a copy of the last properties it received, so listener
updates can make sources recalculate internal properties from that stored copy.
2016-08-23 18:56:01 -07:00
Chris Robinson bd054632e0 Remove an unneeded typedef 2016-08-21 23:59:11 -07:00
Chris Robinson 846cdd472d Band-split the HRIRs when building the ambisonic decoder filters
This allows each HRIR to contribute a frequency-dependent response, essentially
acting like a dual-band decoder playing over the cube speaker array.
2016-08-21 03:05:42 -07:00
Chris Robinson d16954c34e Fix HRTF index calculations for B-Format coefficients
The CalcEvIndices and CalcAzIndices methods were dependent on the FPU being in
round-to-zero mode, which is not the case for panning initialization. And since
we just need the closest index and don't need to lerp between them, it's better
to just directly calculate the index with rounding.
2016-08-18 23:33:08 -07:00
Chris Robinson e13c6bca20 Only use the cube points for generating the ambisonic HRTF coefficients
Using all the HRIRs seems to have problems with volume balancing, due in part
to HRTF data sets not having uniform enough measurements for a simple decoder
matrix to work (and generating a proper one that would work better is not that
easy). This still maintains the benefits of decoding ambisonics directly to
HRTF, namely that it only needs to filter the 4 ambisonic channels and can use
more optimized HRTF filtering methods on those channels. It can also be
improved further with frequency-dependent processing baked into the generated
coefficients, incurring no extra run-time cost for it.
2016-08-17 05:34:09 -07:00
Chris Robinson 770e2ff7ed Use a more specialized mixer function for B-Format to HRTF 2016-08-12 05:26:36 -07:00
Chris Robinson c6c6e3324d Decode directly from B-Format to HRTF instead of a cube
Last time this attempted to average the HRIRs according to their contribution
to a given B-Format channel as if they were loudspeakers, as well as averaging
the HRIR delays. The latter part resulted in the loss of the ITD (inter-aural
time delay), a key component of HRTF.

This time, the HRIRs are averaged similar to above, except instead of averaging
the delays, they're applied to the resulting coefficients (for example, a delay
of 8 would apply the HRIR starting at the 8th sample of the target HRIR). This
does roughly double the IR length, as the largest delay is about 35 samples
while the filter is normally 32 samples. However, this is still smaller the
original data set IR (which was 256 samples), it also only needs to be applied
to 4 channels for first-order ambisonics, rather than the 8-channel cube. So
it's doing twice as much work per sample, but only working on half the number
of samples.

Additionally, since the resulting HRIRs no longer rely on an extra delay line,
a more efficient HRTF mixing function can be made that doesn't use one. Such a
function can also avoid the per-sample stepping parameters the original uses.
2016-08-11 23:20:35 -07:00
Chris Robinson 9a60184bf6 Set a JACK error message handler when initializing the backend
JACK2 will print error messages to stderr if it fails to connect to a server.
Users who don't normally use JACK but have the client lib installed will get
those messages even though OpenAL Soft will continue on to find a working
backend without trouble. So to avoid it, set an error message handler that'll
log them as warnings.

This isn't that great because there's no way to tell whether the error messages
are due to the server not running, or some other problem. And it resets the
callback to the default afterward even if it may have been set to something
else before. JACK2, which is what needs this workaround in the first place,
doesn't export the jack_error_callback pointer to properly save and restore it.
2016-08-11 20:43:54 -07:00
Chris Robinson 56d3598020 Avoid checking DeferUpdates for each source state change 2016-08-08 22:31:08 -07:00
Chris Robinson 6117cb2377 Mix gain steps using SIMD with Neon 2016-08-05 18:47:26 -07:00
Chris Robinson f775f25379 Modify NumUpdates for different sample rates instead of UpdateSize
Not that this really changes anything since the CoreAudio backend doesn't honor
the ALCdevice's buffer metrics, nor accurately report the device's actual
metrics. But it clears up warnings from a non-multiple-of-four update size if
the sample rate causes it to change.
2016-08-04 21:19:04 -07:00
Chris Robinson 232293792d Constify some variables 2016-08-04 20:42:25 -07:00
Chris Robinson 48b954160e Look for the correct DLL for JACK on Windows 2016-08-03 19:07:35 -07:00
Chris Robinson 3b2d8d3949 Use al_calloc/al_free in more places 2016-08-03 17:36:42 -07:00
Chris Robinson 2b3c7f211c Add 'restrict' to another parameter 2016-08-03 08:34:25 -07:00
Chris Robinson f1e3f0762b Use the ACN and N3D map and scale lookup tables in SetChannelMap 2016-08-02 09:16:12 -07:00
Chris Robinson 0fcd39c4c0 Don't store the looping state in the voice
Certain operations on the buffer queue depend on the loop state to behave
properly, so it should not be deferred until the async voice update occurs.
2016-07-31 23:42:30 -07:00
Chris Robinson 48ff5d4ce8 Rename Ambisonics to Ambisonic in a couple places 2016-07-31 08:17:08 -07:00
Chris Robinson bff5268ed4 Remove DevFmtBFormat3D, which is covered by DevFmtAmbi1 2016-07-31 08:13:41 -07:00
Chris Robinson 2dd2756890 Handle ambi-format with alsoft-config 2016-07-31 08:03:26 -07:00
Chris Robinson 4bcd2fbb2e Add an option to specify the ambisonic output configuration 2016-07-31 07:46:38 -07:00
Chris Robinson 01af7b432d Update alsoft-config for the ambisonic output configurations 2016-07-30 16:32:26 -07:00
Chris Robinson af258efda4 Update alsoftrc.sample with the new channel configurations 2016-07-30 16:24:46 -07:00
Chris Robinson e4380ece5e Update alsoftrc.sample for proper txt filenames 2016-07-30 15:56:22 -07:00
Chris Robinson 0c5985374a Simplify a format check 2016-07-30 10:16:29 -07:00
Chris Robinson d253719ead Rename ambisonic channel config values to be shorter 2016-07-30 09:35:54 -07:00
Chris Robinson 33a84f17ac Add a stand-alone upsampler for higher-order ambisonic oputput 2016-07-30 09:29:21 -07:00
Chris Robinson b5b3ea95f8 Add a config to output first-, second-, or third-order ambisonics
Currently incomplete, as second- and third-order output will not correctly
handle B-Format input buffers. A standalone up-sampler will be needed, similar
to the high-quality decoder.

Also, output is ACN ordering with SN3D normalization. A config option will
eventually be provided to change this if desired.
2016-07-29 21:55:43 -07:00
Chris Robinson 96e83f95ee Don't try freeing the context in ReleaseThreadCtx
Unfortunately on certain systems, the TLS callback is called in a restricted
context, and isn't allowed to access certain messaging sub-systems. Such sub-
systems may be used if the thread's context is freed, in turn freeing the
device, which it tries to close.

Ideally, the app shouldn't have tried to destroy a context while it was still
current on a thread, or even leave a context current on a thread that's being
destroyed,. So for now, release the context ref and print an ERR that it might
be leaked.
2016-07-29 08:02:02 -07:00
Chris Robinson 5e11a738c6 Combine VECTOR_RESIZE and VECTOR_RESERVE 2016-07-26 12:02:03 -07:00
Chris Robinson d2eb866abe Avoid a NULL deref when creating 0 auxiliary effect slots 2016-07-26 04:54:27 -07:00
Chris Robinson b047eda1cb Avoid passing NULL to a parameter that must not be NULL 2016-07-26 04:53:25 -07:00
Chris Robinson a6f41e4cb0 Remove the last use of ALfilterState_processSingle 2016-07-26 04:09:01 -07:00
Chris Robinson 25d1b7bdba Remove broken autowah effect code
It's been disabled forever, and I have no idea how to make it work properly.
Better to just redo it when making something that works.
2016-07-26 03:45:25 -07:00
Chris Robinson 45514ee32f Add some more restrict keywords 2016-07-26 00:07:39 -07:00
Chris Robinson 11b38e1190 Rename input_gain to b0 2016-07-26 00:03:44 -07:00
Chris Robinson 0a693d039a Avoid more uses of ALfilterState_processSingle
It's a horriobly inefficient way to process multiple samples through the
filter.
2016-07-25 23:51:37 -07:00
Chris Robinson 8fcc4afd2d Fix use of a loop var 2016-07-25 22:20:47 -07:00
Chris Robinson e4bbbe06fa Avoid manual loops for ALfilterState processing 2016-07-25 19:04:54 -07:00
Chris Robinson 94dd34fb4b Increase the default thunk array size
This value should be enough to hold IDs for most apps without needing to
reallocate it, while not being unnecessarily large (4KB).
2016-07-25 06:29:08 -07:00
Chris Robinson c0e7aab823 Properly skip loading of already-loaded HRTF data sets
Previously, if an HRTF file was loaded it would not only skip loading it, but
it would also skip adding it to the output enumeration list. Now it properly
skips loading it when it's already loaded, but still adds it to the enumeration
list if it's not already in it.
2016-07-24 21:59:02 -07:00
kcat 9f2e416bbd Merge pull request #49 from ryanpcmcquen/patch-1
Fix for ffmpeg.
2016-07-21 16:42:21 -07:00
Ryan P.C. McQuen 69af50cadb Fix for ffmpeg.
Closes https://github.com/kcat/openal-soft/issues/48.
2016-07-21 08:09:31 -07:00
Chris Robinson fbba2828cd Update the default quad decoder matrix 2016-07-18 19:42:11 -07:00
Chris Robinson dc8bbca7f1 Constify and use the correct size for an array 2016-07-17 15:38:39 -07:00
Chris Robinson 84ca38ba95 Make a MAX_AMBI2D_COEFFS macro instead of a magic number 2016-07-17 00:46:18 -07:00
Chris Robinson 35cbecabf9 Repack the ambisonic dual-band decoder matrices
The decoders use a row of the HF decoder matrix followed by a row of the LF
decoder matrix, for each given output channel in turn. Packing the two matrices
accordingly results in less memory hopping.
2016-07-17 00:29:43 -07:00
Chris Robinson 2f3cffa517 Improve the UHJ encoder's allpass processing loops 2016-07-14 01:42:02 -07:00
Chris Robinson 470f454c53 Modify bs2b_cross_feed to do multiple samples at once 2016-07-13 23:08:11 -07:00
Chris Robinson 5106f035df Move the input channel array out of the DirectParams and SendParams 2016-07-13 01:39:44 -07:00
Chris Robinson e8202b915d Fix indentation 2016-07-12 19:05:56 -07:00
Chris Robinson b4cb0e9bf5 Fix a copy-paste message error 2016-07-12 19:05:21 -07:00
Chris Robinson ee929a2eea Enumerate the embedded HRTF resources when available 2016-07-12 19:02:19 -07:00
Chris Robinson 4898234da8 Add a cmake option to embed the HRTF data 2016-07-12 14:22:17 -07:00
Chris Robinson 14166264d6 Store the voice output buffers separate from the params 2016-07-11 23:30:32 -07:00
Chris Robinson e4039cb9ae Update comment about the source radius calculations 2016-07-10 22:11:11 -07:00
Chris Robinson fe2fb81047 Fix a direct access to a UIntMap 2016-07-09 16:42:36 -07:00
Chris Robinson 0aae992f94 Reorder some source fields 2016-07-07 19:48:21 -07:00
Chris Robinson 745cad5231 Avoid standard malloc/free for Hrtf allocation 2016-07-07 10:31:43 -07:00
Chris Robinson 7ec89b4b6e Avoid function calls to get the HRTF sample rate and IR size 2016-07-07 10:26:42 -07:00
Chris Robinson b495d80f56 Avoid using memcpy to copy a single struct 2016-07-06 13:33:40 -07:00
Chris Robinson d096e183a8 Remove a slightly outdated comment 2016-07-06 09:52:42 -07:00
Chris Robinson d340d50d49 Remove the VirtOut buffer alias 2016-07-05 14:18:17 -07:00
Chris Robinson 8f4d6c48ce Use separate arrays for UIntMap keys and values 2016-07-04 20:35:32 -07:00
Chris Robinson f0cbcdc928 Use al_malloc/al_free for the UIntMap array 2016-07-04 10:26:46 -07:00
Chris Robinson 80da138d7f Ensure voices has been updated once before mixing them
Sometimes the mixer is temporarily prevented from applying updates, when
multiple sources need to be updated simultaneously for example, but does not
prevent mixing. If the mixer runs during that time and a voice was just
started, it would've mixed the voice without any internal properties being set
for it.
2016-06-16 18:29:18 -07:00
Chris Robinson 697ee19f71 Rename MaxNoOfSources for consistency 2016-06-08 11:19:33 -07:00
Chris Robinson a49db89d7a Remove an IN_IDE_PARSER hack
Not all IDE parsers necessarily choke on restrict, and even those that do can
probably have their own configuration to define macros that can hide the
parsing errors caused by it.
2016-06-07 16:11:50 -07:00
Chris Robinson 0477d61599 Look in the executable's dir for another config file
On Windows it'll look for alsoft.ini, and elsewhere is alsoft.conf. This
applies after the user-local settings and before ALSOFT_CONF.
2016-06-04 10:45:44 -07:00
Chris Robinson b2041a5ddf Only define 8 HRTF filter states and params for the device
It will only be used with a cube channel setup, so there's no need to have one
for every possible output channel.
2016-06-04 08:40:06 -07:00
Chris Robinson 2c402e1ab5 Add property queries to get the device latency with the clock 2016-06-03 09:40:30 -07:00
Chris Robinson e38a81c5b6 Improve the filter processing function 2016-06-03 06:55:54 -07:00
Chris Robinson ce676ab70a Remove some unnecessary volatile keywords 2016-06-03 05:46:29 -07:00
Chris Robinson b7da69510c Implement a Neon-enhanced MixRow 2016-06-01 23:39:13 -07:00
Chris Robinson a16d0b192e Make a function static 2016-06-01 10:21:16 -07:00
Chris Robinson c63d468d4c Use a macro to specify the ambisonic periphonic channel mask 2016-06-01 05:30:06 -07:00
Chris Robinson 5e64882be9 Use SSE for applying the HQ B-Format decoder matrices 2016-05-31 10:18:34 -07:00
Chris Robinson 72d2febccb Don't access the band splitter fields in the processing loops
perf shows a 5% drop in relative execution time on the alffplay example with an
audio-only file (20% to 15%). Kinda figured the optimizer would handle it
better, but I guess not.
2016-05-31 07:50:23 -07:00
Chris Robinson d1c4fb6364 Don't try to emulate almtx_timedlock 2016-05-30 05:04:49 -07:00
Chris Robinson 612b24fa91 Clean up a couple variable names and declarations 2016-05-30 02:10:06 -07:00
Chris Robinson 70a105c22c Remove unnecessary VECTOR_INSERT 2016-05-30 00:05:10 -07:00
Chris Robinson 4802465f1a Hold the effectslot map lock while handling it 2016-05-29 02:47:54 -07:00
Chris Robinson 8aa4a74a7b Use a linked list for active effect slots 2016-05-29 01:40:16 -07:00
Chris Robinson 4b8aa9caf1 Avoid the mixer lock when getting the plain source offset
i.e. without the latency
2016-05-28 06:23:55 -07:00
Chris Robinson 9025e42afd Avoid an explicit mixer lock for getting the source offset and latency
The only mixer locking involved is with the backend, as determined by it's
ability to get the device clock and latency atomically.
2016-05-28 04:11:57 -07:00
Chris Robinson 6d4380a48c Change the backend getLatency method to return the clock time too
This will also allow backends to better synchronize the tracked clock time with
the device output latency, without necessarily needing to lock if the backend
API can allow for it.
2016-05-28 00:43:14 -07:00
Chris Robinson 800e38bac6 Use the backend lock for the effectstate's deviceUpdate call 2016-05-27 19:40:54 -07:00
Chris Robinson c837484015 Use a specific lock for the backend's stop/reset/play calls
This helps protect against the device changing unexpectedly from multiple
threads, instead of using the global list/library lock.
2016-05-27 19:23:39 -07:00
Chris Robinson 01f3e33df9 Remove a couple unneeded functions 2016-05-25 06:45:56 -07:00
Chris Robinson ea83c959ca Increment the device's mix count closer to the mixing loops 2016-05-23 01:03:37 -07:00
Chris Robinson e8b274d349 Properly pluralize some messages 2016-05-22 21:03:16 -07:00
Chris Robinson ea3fa06bc5 Improve locking for device attribute queries
Avoids the backend device lock, instead using the list lock to prevent the
device from changing while being queried, and adds some missing locks.
2016-05-22 20:42:00 -07:00
Chris Robinson 2e7ec3979a Avoid using realloc in a number of places 2016-05-21 03:27:51 -07:00
Chris Robinson 7bf64eaee0 Make the source position calues atomic 2016-05-19 20:50:55 -07:00
Chris Robinson d80f00173f Copy the source's Looping property into the voice 2016-05-18 12:15:19 -07:00
Chris Robinson aff725cba3 Avoid redundantly storing distance model settings 2016-05-17 20:02:46 -07:00
Chris Robinson 82675c018d Update the right effect state when the device is reset 2016-05-17 18:23:41 -07:00
Chris Robinson 82720c4759 Don't assume the "real" output buffer follows the dry buffer 2016-05-17 15:03:56 -07:00
Chris Robinson 2172f974e7 Improve reverb panning gains for "3D" output. 2016-05-17 14:28:30 -07:00
Chris Robinson 51e4aa7fc6 Ignore the listening angle for the wet path sound cones
Since the wet path is essentially the room response to a sound, the direction
of the sound to the listener doesn't change the amount of energy the room
receives. Instead, the surface area defined by the cones dictate the volume the
room gets for the sound.
2016-05-16 22:42:41 -07:00
Chris Robinson aea7c85daa Use floats for the listener transforms 2016-05-16 18:28:46 -07:00
Chris Robinson 56c6b3f56c Don't store the source's update method with the voice 2016-05-16 14:46:06 -07:00
Chris Robinson 945fd022d6 Avoid separate updates to sources that should apply together 2016-05-15 22:16:27 -07:00
Chris Robinson 63e98481ee Allocate context storage before starting/resetting the device
In case allocation fails, we don't have to worry about the playing status of
the backend.
2016-05-15 14:12:56 -07:00
Chris Robinson c522658d19 Avoid duplicate effect state objects in the freelist
If an unapplied update was superceded, it would be placed in the freelist with
its effect state object intact. This would cause another update with the same
effect state object to be placed into the freelist as well, or worse, cause it
to get deleted while in use when the container had its effect state cleared.
2016-05-15 13:50:56 -07:00
Chris Robinson 576c1116a6 Avoid using a flag to specify if the effect state needs to be updated
This fixes a potential missed state change if an update with a new state got
replaced with one that doesn't.
2016-05-15 01:19:05 -07:00
Chris Robinson b3338d25f6 Provide asynchronous property updates for sources
This necessitates a change in how source updates are handled. Rather than just
being able to update sources when a dependent object state is changed (e.g. a
listener gain change), now all source updates must be proactively provided.
Consequently, apps that do not utilize any deferring (AL_SOFT_defer_updates or
alcSuspendContext/alcProcessContext) may utilize more CPU since it'll be
filling out more update containers for the mixer thread to use.

The upside is that there's less blocking between the app's calling thread and
the mixer thread, particularly for vectors and other multi-value properties
(filters and sends). Deferring behavior when used is also improved, since
updates that shouldn't be applied yet are simply not provided. And when they
are provided, the mixer doesn't have to ignore them, meaning the actual
deferring of a context doesn't have to synchrnously force an update -- the
process call will send any pending updates, which the mixer will apply even if
another deferral occurs before the mixer runs, because it'll still be there
waiting on the next mixer invocation.

There is one slight bug introduced by this commit. When a listener change is
made, or changes to multiple sources while updates are being deferred, it is
possible for the mixer to run while the sources are prepping their updates,
causing some of the source updates to be seen before the other. This will be
fixed in short order.
2016-05-14 23:43:40 -07:00
kcat 0f7e499323 Merge pull request #41 from ColdPie1/source_limit
alsoft-config: Raise source limit to 4096
2016-05-14 12:44:58 -07:00
Chris Robinson f751f5e25e Store the remaining context properties with the listener properties 2016-05-13 20:21:20 -07:00
Chris Robinson 93a94d177c Get rid of an unnecessary copy of ALeffectProps 2016-05-13 18:28:01 -07:00
Andrew Eikum d89043b88e alsoft-config: Raise source limit to 4096 2016-05-13 09:04:26 -05:00
Chris Robinson 59cd6230a6 Properly load the effect state pointer from the property container 2016-05-13 00:24:26 -07:00
Chris Robinson 770bdcc108 Recognize AUX0...AUX15 for decoder speaker labels 2016-05-12 23:41:23 -07:00
Chris Robinson 9e6d8342de Hold the effect and filter maps while handling effects and filters 2016-05-12 23:12:11 -07:00
Chris Robinson 8d14824c65 Call the effect state update method after "returning" the container object. 2016-05-12 19:17:08 -07:00
Chris Robinson 210e150601 Avoid updating the effect state object if it's not changed 2016-05-12 19:05:06 -07:00
Chris Robinson ef0d4f8210 Provide (mostly) lockless updates for effect slots
Similar to the listener, separate containers are provided atomically for the
mixer thread to apply updates without needing to block, and a free-list is used
to reuse container objects.

A couple things to note. First, the lock is still used when the effect state's
deviceUpdate method is called to prevent asynchronous calls to reset the device
from interfering. This can be fixed by using the list lock in ALc.c instead.

Secondly, old effect states aren't immediately deleted when the effect type
changes (the actual type, not just its properties). This is because the mixer
thread is intended to be real-time safe, and so can't be freeing anything. They
are cleared away when updates reuse the container they were kept in, and they
don't incur any extra processing cost, but there may be cases where the memory
is kept around until the effect slot is deleted.
2016-05-12 18:41:33 -07:00
Chris Robinson 186b54aa3d Use a lockless method for updating listener and context properties
This uses a separate container to provide the relevant properties to the
internal update method, using atomic pointer swaps. A free-list is used to
avoid having too many individual containers.

This allows the mixer to update the internal listener properties without
requiring the lock to protect against async updates. It also allows concurrent
read access to the user-facing property values, even the multi-value ones (e.g.
the vectors).
2016-05-11 21:02:11 -07:00
Chris Robinson 21bc0f5ef8 Hold the buffer map lock while handling the buffer 2016-05-10 23:42:44 -07:00
Chris Robinson 906a4bb22d Hold the source map lock while handling it 2016-05-10 22:49:24 -07:00
Chris Robinson c026f44a09 Add a comment about CoeffCount being 0 2016-05-10 17:07:44 -07:00
Chris Robinson 7dac02148b Use the source's offset type to determine if there's an offset 2016-05-09 17:01:18 -07:00
Chris Robinson 182c0cb61a Find a valid source buffer before updating the voice 2016-05-09 14:22:26 -07:00
Chris Robinson c2611f10ab Store more "active" listener and context properties separately
This helps ensure async listener/context property changes affect all playing
sources at the same time.
2016-05-09 11:26:49 -07:00
kcat dcdeb8d1a6 Merge pull request #40 from rdb/master
Fix placement of alignas - fixes Mac OS X build
2016-05-03 03:03:51 -07:00
rdb b0224485aa Fix placement of alignas - fixes Mac OS X build 2016-05-03 05:38:36 -04:00
Chris Robinson d1e98c36d3 Don't crash when there's no backend to probe 2016-04-30 17:20:25 -07:00
Chris Robinson 3556da0d02 Start AL_SOFT_buffer_samples2 as a replacement for AL_SOFT_buffer_samples 2016-04-25 18:56:59 -07:00
Chris Robinson b9eacf4641 Remove unnecessary code for the now-unused write offset 2016-04-25 02:22:54 -07:00
Chris Robinson 0ed6791a58 Add support for AL_EXT_SOURCE_RADIUS 2016-04-25 00:30:47 -07:00
Chris Robinson 7555c86e7d Drop support for AL_SOFT_buffer_samples and AL_SOFT_buffer_sub_data
Unfortunately they conflict with AL_EXT_SOURCE_RADIUS, as AL_SOURCE_RADIUS and
AL_BYTE_RW_OFFSETS_SOFT share the same source property value. A replacement for
AL_SOFT_buffer_samples will eventually be made.
2016-04-24 23:58:11 -07:00
Chris Robinson 574ec13e5b Avoid an unnecessary aluVector 2016-04-24 23:35:11 -07:00
Chris Robinson f0871c8cfc Improve radius behavior with scaling of ambisonic coefficients 2016-04-24 21:42:59 -07:00
Chris Robinson fdee577940 Provide a decoder preset for 5.1 Surround output 2016-04-24 21:11:24 -07:00
Chris Robinson c796f99d36 Open the file selector to an existing path for presets 2016-04-23 17:31:34 -07:00
Chris Robinson c2dec5008b Install the ambdec preset files 2016-04-23 17:29:51 -07:00
Chris Robinson c6a11770c5 Add some general info about how ambdec works to ambdec.txt 2016-04-23 15:01:44 -07:00
Chris Robinson be7938ed38 Move some docs to the docs directory 2016-04-23 14:54:37 -07:00
Chris Robinson 80c9008798 Add docs for OpenAL Soft and standard decoder presets 2016-04-23 14:12:43 -07:00
kcat 1c736f4eb9 Merge pull request #38 from geron-cn/patch-1
fix audio play error in sample alffplay
2016-04-22 02:57:50 -07:00
gero cec03f39ae fix audio play error in sample
fix audio play error in sample
2016-04-22 17:33:00 +08:00
Chris Robinson 3387f23074 Update a config option comment 2016-04-22 02:19:43 -07:00
Chris Robinson 42531703cc Increase max output channels to 16
This also enables fully periphonic 3rd order HQ decoding.
2016-04-19 18:58:19 -07:00
Chris Robinson a59332f622 Combine two if checks into one 2016-04-19 13:58:33 -07:00
Chris Robinson cd2e9114e8 Remove unneeded ChannelMaps for BFormat formats 2016-04-17 22:11:15 -07:00
Chris Robinson 894c7d0f7e Trace the requested attribute values 2016-04-17 17:22:03 -07:00
Chris Robinson 3b571e03ab Avoid storing channel names for the dry buffer 2016-04-16 17:21:31 -07:00
Chris Robinson d2e8fae005 Don't look up the dry buffer's FrontCenter in the Dedicated effect
The real FrontCenter output is used if it exists, and if it doesn't, it's
unlikely the dry buffer will have it (and even if it does, it won't be any
better than panning).
2016-04-16 14:11:10 -07:00
Chris Robinson d1f3a15470 Reorganize a bit of aluInitRenderer code 2016-04-16 14:00:22 -07:00
Chris Robinson 325245f4b8 Silence possible out-of-bounds warning again 2016-04-16 01:24:37 -07:00
Chris Robinson a6c70992b0 More directly map coefficients for ambisonic mixing buffers
Instead of looping over all the coefficients for each channel with multiplies,
when we know only one will have a non-0 factor for ambisonic mixing buffers,
just index the one with a non-0 factor.
2016-04-15 22:05:47 -07:00
Chris Robinson e16032e1f0 Update some comments 2016-04-15 18:14:19 -07:00
Chris Robinson bd65f64d05 Avoid mixing all coefficients together when only some are used 2016-04-15 17:31:04 -07:00
Chris Robinson e27fad90de Fix possible out-of-bounds warning 2016-04-15 12:33:42 -07:00
Chris Robinson f4ff5fc106 Shorten VECTOR_ITER_ macros to VECTOR_ 2016-04-15 12:22:54 -07:00
Chris Robinson d5e624391b Update a comment 2016-04-15 10:50:46 -07:00
Chris Robinson fb97822d8c Avoid unnecessary loops for setting up effect slot b-format buffer mixing 2016-04-14 21:50:36 -07:00
Chris Robinson 21921cdaff Prepare the custom decoder in aluInitRenderer 2016-04-14 16:42:32 -07:00
Chris Robinson 65a9b97e46 Move the InitRenderer method to panning.c 2016-04-14 15:27:19 -07:00
Chris Robinson 221281688f Separate some long if-else blocks into a separate function 2016-04-14 14:24:52 -07:00
Chris Robinson d924e3d6c4 Split aluInitPanning into separate functions for HRTF or UHJ 2016-04-14 10:44:57 -07:00
Chris Robinson 38247e021a Put the decoder options in a group box 2016-04-10 13:48:26 -07:00
Chris Robinson 695cfa50b2 Improve error trace for bad matrix definitions 2016-04-10 13:06:36 -07:00
Chris Robinson 1faa7b536d Fix xover_freq type in the ambdec doc 2016-04-10 13:03:00 -07:00
Chris Robinson 7bdd68ddbe Use frequency-dependent processing for the ambisonic up-sampler 2016-04-09 13:10:52 -07:00
Chris Robinson a8101da956 Use the correct slot callback for the 6.1 and 7.1 decoder buttons 2016-04-08 00:52:08 -07:00
Chris Robinson f7efa0aff7 Avoid double slashes when constructing paths 2016-04-07 02:59:26 -07:00
Chris Robinson e127072b41 Use al_malloc/al_free for allocations 2016-04-05 20:51:38 -07:00
Chris Robinson 071f8a7b18 Also disable ALSA's resampler when not requesting a sample rate 2016-04-05 19:35:03 -07:00
Chris Robinson 8145a26d07 Add a hack to workaround erroneous prebuf values from pulse 2016-03-31 16:21:49 -07:00
Chris Robinson 93047e2a7a Use the 3D panned output for reverb with HQ decoding
This is less than ideal, but matching each reverb line to a speaker with
surround sound output is way too loud without the ambient volume scaling
offered by the "direct" panning.
2016-03-31 02:14:13 -07:00
Chris Robinson 2cd73a8d97 Allow dual-band decoders for basic rendering
Since the basic renderer does not do frequency-dependent processing, the high-
frequency matrix is used for panning.
2016-03-30 02:25:59 -07:00
Chris Robinson df0d225dbf Properly make hq-mode default to off 2016-03-30 01:49:58 -07:00
Chris Robinson b3e500be32 Remove the old ringbuffer implementation 2016-03-30 01:12:02 -07:00
Chris Robinson d6163fe570 Convert remaining ringbuffers to the lockless variant 2016-03-29 23:48:36 -07:00
Chris Robinson 2ccc1d1d8a Move the aligned malloc functions to the common lib 2016-03-29 00:44:58 -07:00
Chris Robinson ca309e685e Add a config dialog tab for decoder options 2016-03-28 16:35:42 -07:00
Chris Robinson 34539bc973 Skip unused output channels for the HQ decode 2016-03-28 14:50:18 -07:00
Chris Robinson 33cd3834ac Align the ChannelMix buffer and use it for up-sampling 2016-03-27 13:23:37 -07:00
Chris Robinson 91d53560d6 Add a text file describing AmbDec config file support. 2016-03-27 01:57:28 -07:00
Chris Robinson 764d580100 Document the ambisonic decoder options 2016-03-26 21:39:12 -07:00
Chris Robinson 6aaa11df30 Use the same option for decoder configs 2016-03-26 21:02:10 -07:00
Chris Robinson ad7ad48bd1 Don't use custom decoder configurations with mono or stereo
By default, stereo outputs using UHJ, which renders to a B-Format buffer that
gets run through a UHJ encoder for output. It may also output using pair-wise
panning, which pans between -30 and +30 degrees with the speakers at the two
ends. In both cases, the stereo coefficients are ignored.

Mono, having only one output channel, can realistically only attenuate its
channel. Turning the volume up and down accomplishes the same result.
2016-03-26 20:23:20 -07:00
Chris Robinson b4a1ba9d3f Include the distance gain compensation in the decoder matrix 2016-03-26 18:06:36 -07:00
Chris Robinson 1dcb04157c Add a config option for distance compensation 2016-03-26 17:52:42 -07:00
Chris Robinson 67db77452f Add distance compensation to the HQ decoder
This only compensates for timing and gain differences caused by differences in
the physical speaker distances. It's not near-field compensation. This also
relies on having proper distance values defined in the ambdec definition file.
2016-03-26 17:33:49 -07:00
Chris Robinson 7f4bd13f60 Allow up to third-order for horizontal-only rendering 2016-03-26 01:50:19 -07:00
Chris Robinson e0466766d7 Include any first-order scaling in the FOAOut coefficients 2016-03-25 23:25:13 -07:00
Chris Robinson e23da7a1de Skip height-related ambisonic channels for 2D rendering 2016-03-25 19:57:25 -07:00
Chris Robinson 05dace6525 Mix Dedicated effects to the real output if possible 2016-03-25 14:47:30 -07:00
Chris Robinson 3148986184 Implement AL_EXT_STEREO_ANGLES support 2016-03-25 14:40:44 -07:00
Chris Robinson 19b130c45d Use the "decoder" config section instead of "ambisonics" 2016-03-25 13:55:23 -07:00
Chris Robinson b0acfa1763 Add a cast and a couple float type fixes 2016-03-24 11:11:17 -07:00
Chris Robinson 3646cf817c Trace the HQ decoder order 2016-03-23 16:00:07 -07:00
Chris Robinson 2847590d45 Simplify setting a custom channel map configuration 2016-03-23 15:11:33 -07:00
Chris Robinson 147274f165 Up-sample first-order content when using a higher order HQ decoder 2016-03-23 15:10:59 -07:00
Chris Robinson 0dc35784db Allow second-order HQ decoding
Could really do with some optimizations to the mixing gain calculations. For
ambisonic targets, the coefficients will only have 1 non-0 entry for each
output, so the double loop in unnecessarily wasteful. Similarly, most uses
won't need a full height encoding either, so a horizontal-only or mixed-order
target could reduce the number of channels.
2016-03-23 10:39:14 -07:00
Chris Robinson 713ac9e679 Add a specific output for first-order sources 2016-03-22 17:52:20 -07:00
Chris Robinson 0a03596af1 Simplify setting the matrix coeffs 2016-03-22 14:42:53 -07:00
Chris Robinson 3877545d8c Add a workaround for a buggy modff 2016-03-18 14:05:45 -07:00
Chris Robinson ce575718ef Store the effect's output buffer in the effect state 2016-03-17 10:10:26 -07:00
Chris Robinson 606402fff0 Make sure enough reverb panning gains are defined 2016-03-16 08:51:12 -07:00
Chris Robinson 55ff0c143e Rename the BFormat channels to Aux 2016-03-16 06:49:35 -07:00
Chris Robinson a3863d5834 Add config options to enable the hq ambisonic decoder 2016-03-16 01:36:57 -07:00
Chris Robinson 8ff4a54356 Properly handle negative matrix values and fix decoder initialization 2016-03-15 09:07:03 -07:00
Chris Robinson 3a26d853ba Replace the custom layout options with an ambdec loader
The ambisonic layout options were never very good for clarity or flexibility.
Hopefully using ambdec files will prove to be better.
2016-03-15 08:00:03 -07:00
Chris Robinson 23bce59c66 Rename a couple functions for more informative logging 2016-03-15 07:07:09 -07:00
Chris Robinson 53fadf5497 Add a dual-band ambisonic decoder
This uses a virtual B-Format buffer for mixing, and then uses a dual-band
decoder for improved positional quality. This currently only works with first-
order output since first-order input (from the AL_EXT_BFROMAT extension) would
not sound correct when fed through a second- or third-order decoder.

This also does not currently implement near-field compensation since near-field
rendering effects are not implemented.
2016-03-15 05:08:05 -07:00
Chris Robinson 64cb21cb9f Downgrade some ERRs to WARNs or TRACEs 2016-03-15 04:02:25 -07:00
Chris Robinson 066df88a2c Always mix to the real output for DirectChannels 2016-03-14 20:25:36 -07:00
Chris Robinson 919b35295e Add a loader for ambdec files 2016-03-14 20:13:50 -07:00
Chris Robinson 0220404a91 Use second-order coefficients for 5.1
Since the panning only drives 5 speakers, it shouldn't use more than 5
ambisonic channels (9 total in second order, minus 4 for unused height).
2016-03-13 03:32:32 -07:00
Chris Robinson 0c4653085c Don't request a specific HRTF when one isn't specified 2016-03-11 21:01:32 -08:00
Chris Robinson 22abaa287d Use the real output's left and right channels with HRTF 2016-03-11 20:59:12 -08:00
Chris Robinson 5328972193 Separate writing to the output buffer from HRTF filtering 2016-03-11 20:44:05 -08:00
Chris Robinson bb03fe227b Update the current HRTF delays if the stepping is not finished 2016-03-11 19:59:14 -08:00
Chris Robinson 859cc703e7 Use the proper left and right channels for UHJ output 2016-03-10 22:56:44 -08:00
Chris Robinson d648486bcd Generalize GetChannelIdxByName 2016-03-10 14:29:44 -08:00
Chris Robinson da5f75615b Allocate enough reverb panning gains 2016-03-10 01:45:30 -08:00
Chris Robinson effb9d1e35 Keep track of the real output's channel names 2016-03-10 01:04:28 -08:00
Chris Robinson a457157516 Organize the dry buffer properties into a struct 2016-03-09 23:43:57 -08:00
Chris Robinson 3e2672ec9f Track the virtual and real output buffers ecplicitly 2016-03-09 22:57:38 -08:00
Chris Robinson 3b9fe27cbe Browse with the current or default device already selected 2016-03-06 12:03:36 -08:00
Chris Robinson 6971e86847 Add a simple About page that shows the library build version 2016-03-06 02:02:37 -08:00
Chris Robinson 101ae7644e Add a couple helpers for dealing with name-pair lists 2016-03-06 01:50:49 -08:00
Chris Robinson 58aa1751c3 Handle the stereo panning option dynamically 2016-03-05 19:20:38 -08:00
Chris Robinson 1ca45fa3eb Use the correct index for finding an empty string 2016-03-05 16:45:10 -08:00
Chris Robinson 4e3fdf9f5d Fix reverb with UHJ encoding 2016-03-03 01:41:42 -08:00
Chris Robinson 457c34c189 Add a backend tab page for JACK options 2016-03-02 23:18:07 -08:00
Chris Robinson d169fd859d Use the clicked() signal for the Browse buttons 2016-03-02 15:43:51 -08:00
Chris Robinson 773e2846e7 Add a Wave Writer backend config page 2016-03-02 15:31:14 -08:00
Chris Robinson 71d927333f Add OSS and Solaris config pages 2016-03-02 12:08:22 -08:00
Chris Robinson 9fdca9e29f Remove the extra scaling on W for UHJ encoding
There seems to be some inconsistent info about whether W should be scaled by
sqrt(2) for encoding. Not applying the scaling results in a wider stereo image,
which seems more appropriate.
2016-03-01 15:48:23 -08:00
Chris Robinson c89511b95e Properly remove empty config values 2016-02-28 21:55:58 -08:00
Chris Robinson abf6a9260a Add an option to select between UHJ and pair-wise mixing. 2016-02-28 20:55:41 -08:00
Chris Robinson 81384949e2 Properly check for preexisting HRTF names 2016-02-28 18:30:12 -08:00
Chris Robinson 9e3a1942a3 Add an ALSA backend tab 2016-02-28 09:27:52 -08:00
Chris Robinson 11acbfebf7 Hide backend list items for backends that aren't available 2016-02-27 22:12:53 -08:00
Chris Robinson 96520520be Show the full name in the backend lists 2016-02-27 21:52:36 -08:00
Chris Robinson 6d664367bc Generalize the backend list 2016-02-27 19:37:42 -08:00
Chris Robinson a12c420c59 Reorganize the Backends tab and add a PulseAudio section 2016-02-27 19:18:57 -08:00
Chris Robinson 0e1edc151d Move the Backends tab over 2016-02-27 12:39:25 -08:00
Chris Robinson adce176a35 Separate the left and right output writes with UHJ encoding 2016-02-27 11:38:40 -08:00
Chris Robinson 99f685d20d Add an option for pair-wise stereo panning 2016-02-26 21:48:03 -08:00
Chris Robinson ac91083ceb Use 2-channel UHJ for stereo output 2016-02-26 16:09:06 -08:00
Chris Robinson 67f086d1d4 Add a function to encode 2-channel UHJ from B-Format 2016-02-26 14:51:56 -08:00
Chris Robinson 3c127dc422 Update and add some tooltips 2016-02-24 05:37:48 -08:00
Chris Robinson 99a49122b8 Sort HRTFs in alsoft-config like in the lib 2016-02-24 05:08:39 -08:00
Chris Robinson b6824ca716 Add and use a copy-range string function 2016-02-24 04:53:32 -08:00
Chris Robinson d04970e568 Exclude the file extension from the HRTF name 2016-02-24 04:21:03 -08:00
Chris Robinson 93d73aae4d Add speed and quality labels for the resampler slider
And space out the buffer metric sliders from the edit boxes
2016-02-23 11:12:57 -08:00
Chris Robinson c9b2a0ae26 Collect HRTF names from the paths list for alsoft-config 2016-02-23 11:03:58 -08:00
Chris Robinson 68a2ae4024 Replace the hrtf_tables option with hrtf-paths 2016-02-23 10:56:06 -08:00
Chris Robinson e7ed3e2f72 Remove an unused function 2016-02-23 07:41:17 -08:00
Chris Robinson dea880dbf4 Better handle duplicate HRTF names in alsoft-config 2016-02-23 07:29:07 -08:00
Chris Robinson ae1a2fa9c0 Allow selecting a preferred HRTF in alsoft-config
This currently only checks the default paths when they're being used.
2016-02-23 06:52:13 -08:00
Chris Robinson 6512dcb233 Don't bother with a maximum size for the window 2016-02-23 01:46:38 -08:00
Chris Robinson 2c6e59c4ca Fix when ESTRPIPE and EPIPE are the same 2016-02-22 08:12:09 -08:00
Chris Robinson 840fa1b5e8 Add a warning if closing alsoft-config with unsaved changes 2016-02-22 07:56:05 -08:00
Chris Robinson 9d94f792de Restructure alsoft-config UI
The HRTF stuff is moved to its own tab, and a Preferred HRTF combo box is added
for future use. The resampler option is moved to the main Playback tab, and
some options are moved to an Advanced Settings section on the tab.
2016-02-22 03:05:13 -08:00
Chris Robinson bd233c8cdb Avoid enumerating the same HRTF file twice 2016-02-21 04:46:14 -08:00
Chris Robinson e6f120df23 Add a config option to specify the preferred HRTF 2016-02-21 02:44:02 -08:00
Chris Robinson c2dd681940 Remove an unused declaration 2016-02-20 21:01:24 -08:00
Chris Robinson e2bbee653e Include the HRTF filename in the HRTF memory chunk 2016-02-20 05:32:42 -08:00
Chris Robinson e1ce7f9180 Use an 8-channel cube for HRTF's virtual format.
There were phase issues caused by applying HRTF directly to the B-Format
channels, since the HRIR delays were all averaged which removed the inter-aural
time-delay, which in turn removed significant spatial information.
2016-02-20 00:53:01 -08:00
Chris Robinson e90cdbcf98 Reorganize makehrtf's File I/O functions 2016-02-19 22:23:37 -08:00
Chris Robinson e1c653b571 Reorganize and reformat makehrtf code 2016-02-18 22:55:03 -08:00
Chris Robinson 8575ecf3cb Cleanup makehrtf type definitions 2016-02-18 16:40:57 -08:00
Chris Robinson 670aeec59a Fix default makehrtf output name
And clean up the parameter processing.
2016-02-18 06:11:54 -08:00
Chris Robinson 7ff5cf7820 Allocate each HRTF as a single chunk 2016-02-16 19:56:44 -08:00
Chris Robinson ee9917fe96 Remove a dead assignment 2016-02-16 02:42:43 -08:00
Chris Robinson 6b1f322220 Only calculate steps for the used coefficients 2016-02-14 13:30:03 -08:00
Chris Robinson ecdc93f3ca Calculate HRTF stepping params right before mixing
This means we track the current params and the target params, rather than the
target params and the stepping. This closer matches the non-HRTF mixers.
2016-02-14 03:23:06 -08:00
Chris Robinson 25732d0895 Calculate channel gain stepping just before mixing 2016-02-14 01:22:01 -08:00
Chris Robinson a9135ec39d Don't pass the channel count to GetBFormatHrtfCoeffs
Since it's hard-coded anyway, there's no need to specify it.
2016-02-09 21:42:24 -08:00
Chris Robinson 000ced3795 Avoid underflow in alcnd_timedwait if the time point is already passed 2016-02-07 17:47:52 -08:00
Chris Robinson f4fa41487c Replace some CreateEvent calls with CreateEventW 2016-02-07 16:14:27 -08:00
Chris Robinson 6105d36fd7 Add special HRTF handling for reverb
This is pretty hacky. Since HRTF normally renders to B-Format with two "extra"
channels for the real stereo output, the panning interpolates between a panned
reverb channel on B-Format, and two non-panned reverb channels on stereo
output, given the panning vector length.
2016-02-06 23:00:07 -08:00
Chris Robinson fd54f4f03d Only apply the +3dB reverb gain boost to the ambient response. 2016-02-06 18:05:27 -08:00
Chris Robinson 3ee42d9826 Avoid an extra sample of delay in the reverb modulator 2016-02-05 15:39:31 -08:00
Chris Robinson c533060875 Remove an unnecessary variable and move duplicate code to a common spot 2016-02-05 14:21:02 -08:00
Chris Robinson 127c7e3b8c Don't explicitly check for LFE
It's going to be set to 0 gain anyway
2016-02-05 11:06:10 -08:00
Chris Robinson 3cac4dff95 Boost the direct-pan reverb to better match the expected volume
Hopefully. Would be nice to have a reference implementation for this style of
reverb to compare with.
2016-02-05 09:55:08 -08:00
Chris Robinson 301d4c158b Update a couple outdated comments 2016-02-05 09:42:43 -08:00
Chris Robinson 538f2839d1 Apply the early and late reverb gains with the panning gains 2016-02-05 08:43:51 -08:00
Chris Robinson 8627a92ea8 Better organize the reverb code into separate labeled sections 2016-02-05 08:14:41 -08:00
Chris Robinson b8e74c88cf Separate early and late reverb output for standard reverb too 2016-02-05 07:46:33 -08:00
Chris Robinson 305ef3215d Modify how the four output reverb points are calculated
For HRTF and B-Format output, the points no longer move but instead scale based
on the desired panning direction.
2016-02-05 07:34:31 -08:00
Chris Robinson d315ca4139 Try to map reverb outputs directly to output channels
HRTF and B-Format output still need to use virtual panning directions, but the
reverb works better when it outputs directly to an output channel. Ambient and
directional panning is used to properly mask and attenuate each output channel.

Note that currently the "direct panning" output is quieter than it should be.
Work is underway to attenuate the early reflections and late reverb better.
2016-02-01 22:24:40 -08:00
Chris Robinson b4a9b40d68 Apply the main reverb gain with the panning 2016-02-01 01:45:16 -08:00
Chris Robinson 46cae36ef9 Fix an out of date comment 2016-01-31 09:39:07 -08:00
Chris Robinson 7f908d90af Rename ComputeBFormatGains to ComputeFirstOrderGains 2016-01-31 09:00:23 -08:00
Chris Robinson d69dd6dc7a Make the source's buffer queue a singly-linked list 2016-01-31 00:42:58 -08:00
Chris Robinson 063ef9c2fc Properly silence the LFE input channel gain on the source sends 2016-01-30 07:13:07 -08:00
Chris Robinson 729f213c09 Fix scaling for effect sends of B-Format sources 2016-01-30 07:10:36 -08:00
Chris Robinson 7111322526 Make the modulator effect multichannel 2016-01-29 23:44:43 -08:00
Chris Robinson a046a951e9 Use separate modulator functions only for the waveform 2016-01-29 23:28:38 -08:00
Chris Robinson 3ac786c6af Convert the equalizer effect to multichannel 2016-01-29 07:26:19 -08:00
Chris Robinson 210b4c1fcd Make the compressor effect multichannel 2016-01-28 02:49:40 -08:00
Chris Robinson c1f87414c5 Mix to multichannel for effects
This mixes to a 4-channel first-order ambisonics buffer. With ACN ordering and
N3D scaling, this makes it easy to remain compatible with effects that only
care about mono input since channel 0 is an unattenuated mono signal.
2016-01-28 00:02:46 -08:00
Chris Robinson 2fa3ae85c9 Pass a pointer to the input samples array for effect processing 2016-01-27 08:16:47 -08:00
Chris Robinson fd387beda1 Avoid passing the device to SetChannelMap 2016-01-27 04:44:21 -08:00
Chris Robinson f547ef6d39 Separate calculating ambisonic coefficients from the panning gains 2016-01-25 06:11:51 -08:00
Chris Robinson 79e0f3e747 Don't write one byte at a time for the wave writer on big endian 2016-01-25 01:49:28 -08:00
Chris Robinson 0189b923a2 Release 1.17.2 2016-01-24 19:12:39 -08:00
Chris Robinson 4fb2526779 Fix "signed and unsigned type in conditional expression" warning 2016-01-24 02:29:26 -08:00
Chris Robinson 5761aa9400 Remove unneeded check for io.h 2016-01-24 01:51:43 -08:00
Chris Robinson ddc885604d Clear SSE3 switch before testing if one's recognized 2016-01-24 01:35:09 -08:00
Chris Robinson 7de8db2960 Replace multiple fputc calls with one fwrite 2016-01-23 21:47:43 -08:00
Chris Robinson 5d552980a4 Move a couple extern inline declarations to the others 2016-01-23 18:19:19 -08:00
Chris Robinson 94816d0073 Reorder filterstate properties 2016-01-23 03:38:15 -08:00
Chris Robinson 352d9afd64 Inline a couple filterstate methods 2016-01-23 01:22:08 -08:00
Chris Robinson 87b6c30932 Reorder some cmake checks 2016-01-21 21:51:20 -08:00
Chris Robinson fb599b5b83 Lower the _POSIX_C_SOURCE and _XOPEN_SOURCE version requirements 2016-01-21 17:18:08 -08:00
Chris Robinson 26f5d385d5 Only set cmake policy CMP0042 if it's valid 2016-01-21 06:18:54 -08:00
Chris Robinson 0a9e9858f9 Always define _XOPEN_SOURCE if _POSIX_C_SOURCE is too 2016-01-21 06:08:18 -08:00
Chris Robinson 8f26ad4ba2 Avoid using scandir/alphasort
They require POSIX 2008, which is a bit too "new" for my current liking. We can
do well enough with opendir/readdir/closedir and qsort.
2016-01-21 04:42:22 -08:00
Chris Robinson bb0ac26ce1 Explicit check if pthread_setname_np accepts only one parameter 2016-01-21 02:33:45 -08:00
Chris Robinson 9c05a16c9a Fix for systems that don't have strnlen 2016-01-21 02:09:32 -08:00
Chris Robinson bbd2876afb Improve the OSS enumeration code 2016-01-21 01:05:29 -08:00
Chris Robinson 3395b361fa Silence a CMake warning on OSX about MACOSX_RPATH 2016-01-20 18:42:23 -08:00
Chris Robinson 0eb18e9711 Update ChangeLog 2016-01-17 22:38:27 -08:00
Chris Robinson 0bb838bbaf Add an option to static-link libgcc
Mainly just for MinGW to make OpenAL32.dll not rely on libgcc_s_sjlj-1.dll.
2016-01-17 15:45:42 -08:00
kcat 1930ee3e5f Merge pull request #29 from olesalscheider/master
Allow to override the share install dir
2015-12-20 03:26:20 -08:00
Chris Robinson 3dc5f0bf76 Merge branch 'master' of github.com:/kcat/openal-soft 2015-12-19 14:26:00 -08:00
kcat 78ca33a0c7 Merge pull request #27 from kdhp/master
Added device enumeration support for OSSv4
2015-12-19 14:22:36 -08:00
Niels Ole Salscheider d93398a361 Allow to override the share install dir
This is needed for multiarch layouts where the prefix is /usr/${host} but
where arch-independet files are installed to /usr/share.
2015-12-19 17:54:47 +01:00
Keegan Drake H.P 5a73aa2502 Added a check for an empty path 2015-12-17 20:05:21 -06:00
Keegan Drake H.P df2ee7ba87 Add device enumeration support for OSSv4 2015-12-17 19:20:08 -06:00
Chris Robinson bce20d1f6b Don't overwrite the output with the dedicated effect 2015-12-12 13:53:17 -08:00
Chris Robinson abd568f9d8 Build on Linux and OSX with Travis 2015-12-11 10:34:38 -08:00
Chris Robinson 2850719ea2 Add a .travis.yml for travis-ci 2015-12-11 10:13:02 -08:00
Chris Robinson e034afe107 Check if _XOPEN_SOURCE needs to be set 2015-12-11 09:41:46 -08:00
Chris Robinson 01e43e5d4d Add includes to work around broken GNU headers and POSIX-2001 2015-12-11 09:24:40 -08:00
Chris Robinson d7b2bba2e6 Add missing closing parenthesis 2015-12-11 07:35:39 -08:00
Chris Robinson 13bf636a34 Use Apple's pthread_setname_np before GNU's 2015-12-11 07:26:27 -08:00
Chris Robinson 14df326876 Release 1.17.1 2015-12-10 04:45:30 -08:00
Chris Robinson e3d2df58b3 Update changelog 2015-12-10 04:01:15 -08:00
Chris Robinson 4612378593 Update alsoft-config tooltip for HRTF tables 2015-12-10 01:58:08 -08:00
Chris Robinson 26f8676b9b Fix slashes on the local path on Windows 2015-12-08 19:43:00 -08:00
Chris Robinson f8a4ef6f51 Use the ALSOFT_LOCAL_PATH env var instead of the CWD 2015-12-08 19:17:59 -08:00
Chris Robinson c08e975aa5 Update changelog 2015-12-06 06:36:00 -08:00
Chris Robinson 455d5f48c0 Use %s.mhr for the default hrtf table list 2015-12-05 17:49:05 -08:00
Chris Robinson 21998924d8 Support %s as a string matching marker 2015-12-05 17:45:56 -08:00
Chris Robinson 48447e2864 Also install the HRTF example 2015-12-04 19:51:48 -08:00
Chris Robinson 482372577e Avoid using usleep in the examples
We already have an al_nssleep wrapper in the common lib we can use.
2015-12-04 19:09:48 -08:00
Chris Robinson 4e6acfa0d5 Only set _POSIX_C_SOURCE if needed 2015-12-04 18:52:46 -08:00
Chris Robinson 675ec99d33 Update changelog 2015-12-04 16:00:53 -08:00
Chris Robinson e45ff47361 Reformat Windows device name dressing 2015-12-04 15:52:43 -08:00
Chris Robinson 63567526b0 Better handle inexact ALSA period counts 2015-11-23 16:50:31 -08:00
Chris Robinson c8a3e51296 Fix the allow-resampler check for ALSA 2015-11-23 16:29:32 -08:00
kcat 6bb4bdfa4c Merge pull request #25 from v4hn/fix-jack-libraries
fix-jack-libraries
2015-11-20 12:39:41 -08:00
v4hn 8ac8830478 include correct libraries in case jack support is requested and found
It just doesn't make sense to add pulseaudio libraries here...
Also it breaks in case jack is requested, but pulseaudio is disabled :)
2015-11-20 14:33:44 +01:00
kcat b2b7be6561 Merge pull request #24 from slime73/master
CoreAudio: replace deprecated Carbon API calls with AudioComponent APIs
2015-11-13 17:05:12 -08:00
Alex Szpakowski 21c84bcd96 Replace deprecated Carbon API calls with modern AudioComponent APIs in the CoreAudio backend.
This prevents a deprecation notice from being output to stdout when alcOpenDevice is called in Mac OS X 10.11.

The new API calls require Mac OS X 10.6 or newer.
2015-11-13 20:11:12 -04:00
Chris Robinson f903a7aa64 Release 1.17.0 2015-11-12 07:40:17 -08:00
Chris Robinson 5d039309b3 Use doubles for the constructed listener matrix
This helps the stability of transforms to local space for sources that are at
or near the listener. With a single-precision matrix, even FLT_EPSILON might
not be enough to detect matching positions.
2015-11-11 08:19:33 -08:00
Chris Robinson ff62d22d31 Move the bsincTable to a separate file 2015-11-10 18:48:30 -08:00
Chris Robinson ffcdcbd5fa Update the bsinc table
Precision is increased to cover the full 32-bit float range.
2015-11-10 18:40:33 -08:00
Chris Robinson a37cda0214 Add a tool to generate the bsinc tables 2015-11-10 18:40:11 -08:00
Chris Robinson 10bcda27a9 Remove autowah from the excludefx list
The autowah effect hasn't been enabled for some time due to issues with it
breaking output, and doesn't seem likely to get fixed any time soon.
2015-11-09 14:25:20 -08:00
Chris Robinson 062d7e3487 Update the fix-rate config option description 2015-11-09 11:47:56 -08:00
Chris Robinson de53ff4aff Build with -std=c11 if possible 2015-11-09 11:36:02 -08:00
Chris Robinson ceee5c8ffb Remove some unused function checks 2015-11-08 00:19:55 -08:00
Chris Robinson 9891d61206 Add options to disable Pulse's and ALSA's resamplers 2015-11-07 23:05:45 -08:00
Chris Robinson fe00b65d9a Correct a comment about the new bsinc resampler
It always performs anti-aliasing, even when up-sampling.
2015-11-07 06:16:54 -08:00
Chris Robinson 91258cc192 Simplify reverb panning rotations 2015-11-07 06:15:29 -08:00
Chris Robinson ec7b21cd14 Remove a const to silence some warnings 2015-11-06 22:17:15 -08:00
Chris Robinson de74498cd9 Use more accurate floating point literals 2015-11-06 10:27:28 -08:00
Chris Robinson 858230f452 Include float.h if present before defining math stuff 2015-11-06 02:38:34 -08:00
Chris Robinson d6f4e5139f Add another cast for MSVC 2015-11-06 02:23:42 -08:00
Chris Robinson 368f2d6907 Use ALuint instead of size_t for a loop iterator 2015-11-06 02:21:24 -08:00
Chris Robinson 16a6e010fd Add a cast to silence an MSVC warning 2015-11-06 02:18:42 -08:00
Chris Robinson 3e992309a5 Use a more appropriate type in MatchFilter 2015-11-06 02:13:28 -08:00
Chris Robinson b6682ede61 Cast a double->float return to silence MSVC 2015-11-06 02:05:22 -08:00
Chris Robinson 203c249bf7 Add missing math.h include for sin() 2015-11-06 00:13:02 -08:00
Chris Robinson 8c6d891694 Pan each early/late delay line separately 2015-11-05 23:46:39 -08:00
Chris Robinson 431c89ece9 Manually inline and condense the bsinc resampler 2015-11-05 21:57:12 -08:00
Chris Robinson 46e72a48ad Remove an unneeded memset that was overwriting memory 2015-11-05 19:45:04 -08:00
Chris Robinson b9e192b78a Implement a band-limited sinc resampler
This is essentially a 12-point sinc resampler, unless it's resampling to a rate
higher than the output, at which point it will vary between 12 and 24 points
and do anti-aliasing to avoid/reduce frequencies going over nyquist.

Code provided by Christopher Fitzgerald.
2015-11-05 09:42:08 -08:00
Chris Robinson dce3d0c7bf Change the Kaiser rippling limit to -60dB
This improves the transition cutoff, shortening its width and reducing the
amount of error.
2015-11-04 19:13:25 -08:00
Chris Robinson bd0acf2843 Replace the Lanczos window with Kaiser for the sinc resampler 2015-11-04 06:40:54 -08:00
Chris Robinson c57f571920 Pass in the Q parameter for setting the filter parameters
Also better handle the peaking filter gain.
2015-11-01 05:41:06 -08:00
Chris Robinson f094d94608 Remove an unused struct field 2015-11-01 01:01:27 -07:00
Chris Robinson 3121c30396 Fix a comment 2015-11-01 00:13:02 -07:00
Chris Robinson 4a9dd6576f Add an impulse "waveform" to altonegen 2015-10-31 05:15:13 -07:00
Chris Robinson 0644ebbaa2 Use modff to split the modulation delay components 2015-10-31 01:35:01 -07:00
Chris Robinson 19c437de6d Add missing config.h entry for modff 2015-10-30 01:37:39 -07:00
Chris Robinson 0713b8c322 Check for modff 2015-10-29 16:38:58 -07:00
Chris Robinson c3d58947c3 Mix reverb to output in the inner loop 2015-10-29 03:23:50 -07:00
Chris Robinson 79ad54f0c3 Include the echo's attenuation of the late reverb in the late reverb gain 2015-10-29 02:10:07 -07:00
Chris Robinson 62f1df77d7 Do up to 256 samples per reverb inner loop iteration 2015-10-29 01:40:23 -07:00
Chris Robinson f4a53cf609 Add an HRTF example
Doubles as a psuedo-test to play a sound with HRTF.
2015-10-28 18:52:49 -07:00
Chris Robinson bd73cdab0d Pass the appropriate BackendInfo explicitly to ProbeDevices 2015-10-28 18:10:12 -07:00
Chris Robinson 59c6fc966d Print enumerated HRTFs in openal-info 2015-10-28 14:47:58 -07:00
Chris Robinson 35c4aae3d6 Finalize ALC_SOFT_HRTF 2015-10-28 13:38:30 -07:00
Chris Robinson b7a6a7da6a Right-align the HRTF Mode label 2015-10-28 03:15:01 -07:00
Chris Robinson 63259872d1 Remove the Reverb Bost option from alsoft-config
It's not really an appropriate setting for most users to play with. The option
still exists, but it's no longer editable in the GUI.
2015-10-28 03:09:15 -07:00
Chris Robinson 9ce2b8f9a7 Always update all reverb properties
The EAX-only effect properties will be set to compatible defaults when standard
reverb is set, and the EAX-only effects will be skipped during sample
processing.
2015-10-28 02:36:48 -07:00
Chris Robinson 8f8bf1f605 Do multiple samples at once in each reverb component 2015-10-28 01:57:51 -07:00
Chris Robinson e472cfcc53 Rename ALC_NUM_HRTF_SPECIFIER_SOFT to ALC_NUM_HRTF_SPECIFIERS_SOFT 2015-10-26 22:34:02 -07:00
Chris Robinson 6b627caf52 Add a comment about fegetenv possibly saving the SSE register for us 2015-10-26 01:49:56 -07:00
Chris Robinson 45f11d7b64 Set the current gain immediately if the target is close enough 2015-10-26 01:48:12 -07:00
Chris Robinson 90349b384f Use the correct position in the SSE resamplers for left-over processing 2015-10-25 14:07:58 -07:00
Chris Robinson fc03a955e9 Fix the SSE4.1 resamplers
Apparently the given _mm_extract_epi32 index obeys memory order, rather than
component order.
2015-10-24 17:37:53 -07:00
Chris Robinson 8d89c8be9e Remove a couple unused parameters 2015-10-24 16:57:32 -07:00
Chris Robinson a57fe89050 Lock the source queue for writing when updating the playback offset 2015-10-24 16:31:28 -07:00
Chris Robinson 298fdb220d Fix usage of modf 2015-10-24 15:13:56 -07:00
Chris Robinson 2a62b38530 Update filter histories even when they're not used
If the filter properties are continually updated, and the HF or LF gain goes
from <1, to 1, and later back to <1, the history shouldn't hold stale values
from before it was at 1.
2015-10-24 00:47:58 -07:00
Chris Robinson 714354caee Set XYZ channel gains for source sends to 0
It's cleaner to just set the gains to 0 rather than to special-case B-Format in
the mixer.
2015-10-23 20:16:11 -07:00
Chris Robinson bca854baac Use one send gain per buffer channel 2015-10-23 15:11:34 -07:00
Chris Robinson 4813125d31 Return the new vector result from aluMatrixVector 2015-10-22 23:39:56 -07:00
Chris Robinson 6fc8cd3b29 Convert the PortAudio backend to the new backend API 2015-10-22 10:46:36 -07:00
Chris Robinson 6689c61ff4 Remove the MIDI code
The extension's not going anywhere, and it can't do anything fluidsynth can't.
The code maintenance and bloat is not worth keeping around, and ideally the AL
API would be able to facilitate MIDI-like behavior anyway (envelopes, start-at-
time, etc).
2015-10-20 18:01:27 -07:00
Chris Robinson d9a77a7edc Use NEW_OBJ in a few more places 2015-10-20 11:20:15 -07:00
Chris Robinson acb37edc4f Make VerifyDevice and VerifyContext modify its parameter 2015-10-19 18:48:33 -07:00
Chris Robinson 9b6b084d60 Use the correct realignment size for post-stepping mixing 2015-10-18 13:46:52 -07:00
Chris Robinson fa32093906 Remove unused channel labels 2015-10-18 10:25:56 -07:00
Chris Robinson c4ba9d21dc Use the correct array indices for SSE register components
SSE uses reverse ordering, such that component 0 is the last in memory.
_mm_load_* and _mm_loadu_*, and the corresponding stores, do not change the
memory ordering.
2015-10-17 09:59:26 -07:00
Chris Robinson d9e9a7b05f Include the fractional part with the source sample/sec offset 2015-10-16 10:52:10 -07:00
Chris Robinson 83b41a7676 Update changelog 2015-10-16 08:22:17 -07:00
Chris Robinson 2730d8e76f Round the calculated stepping value 2015-10-15 15:38:07 -07:00
Chris Robinson 2ff3bf5ab0 Use a constant value for the post-position padding 2015-10-15 15:13:19 -07:00
Chris Robinson 97f53d941c Store the source's previous samples with the voice
This helps avoid different results when looping is toggled within a couple
samples of the loop point, or when a processed buffer is removed while the
source is only a couple samples into the next buffer.
2015-10-15 07:29:25 -07:00
Chris Robinson 3c54ba3901 Fix absolute path detection on Windows 2015-10-14 05:01:34 -07:00
Chris Robinson f654767395 Silence implicit double-to-float cast MSVC warning 2015-10-14 05:00:11 -07:00
Chris Robinson 98eda6b35b Properly limit the calculated source offset components 2015-10-14 03:23:19 -07:00
Chris Robinson d386675efe Print the wave type being played 2015-10-14 02:41:39 -07:00
Chris Robinson 9012bcf327 Make the tonegen sampling rate match the device rate by default 2015-10-14 01:54:50 -07:00
Chris Robinson c18e23477c Add a tone generator test program
Currently used to test the general output, particularly the resampler, by
checking the results with a spectrum analyzer and/or oscilloscope (for example
using PulseAudio's "Monitor of ..." devices feeding an external app).
2015-10-13 11:43:25 -07:00
Chris Robinson d7ec9d355f Shut GCC up 2015-10-13 11:38:53 -07:00
Chris Robinson 0498a4d35e Rename a couple HRTF Mode combo box entries 2015-10-13 03:21:00 -07:00
Chris Robinson 2fba5c1f5e Properly apply fractional source offsets when a user offset is set 2015-10-13 03:01:34 -07:00
Chris Robinson be2028ba4a Fix HRTF group box size 2015-10-12 06:42:28 -07:00
Chris Robinson 67455c66a1 Replace the resample_fir6 declaration with resample_fir8 2015-10-12 06:34:55 -07:00
Chris Robinson db4253d3bd Remove 96khz from the combo box
It can still be entered in manually, as can any value between 8khz and 192khz,
but having it selectable can create the mistaken idea that selecting it is
better than picking 44.1khz or 48khz.
2015-10-12 06:23:50 -07:00
Chris Robinson b4bc36c4a0 Reorganize the HRTF group box
The three radio buttons are moved to a combo box, which gives a bit more width
for the file list contents.
2015-10-12 05:52:34 -07:00
Chris Robinson ed0f3bc1b1 Only show certain options that are available at build-time 2015-10-11 23:56:45 -07:00
Chris Robinson f33d6a5211 Reformat the CPU Extensions' checkboxes 2015-10-11 12:03:50 -07:00
Chris Robinson b859f1bdc3 Avoid multiple sin, cos, and sqrt calls for filter calculations 2015-10-11 10:21:37 -07:00
Chris Robinson db22465c1d Update changelog 2015-10-11 07:40:09 -07:00
Chris Robinson 00e419e948 Replace the sinc6 resampler with sinc8, and make SSE versions 2015-10-11 07:37:22 -07:00
Chris Robinson 0211831858 Move the FIR4 from SSE2 to SSE3
SSE3 can avoid the slow _MM_TRANSPOSE_PS4 call thanks to the inclusion of
horizontal adds.
2015-10-11 06:38:00 -07:00
Chris Robinson 75d8e5989f Slightly improve the FIR4 SSE resamplers 2015-10-11 05:31:14 -07:00
Chris Robinson 0149dded34 Use doubles to calculate the Lanczos coefficients 2015-10-09 08:30:33 -07:00
Chris Robinson 34e55c0034 Update changelog 2015-10-08 00:41:40 -07:00
Chris Robinson 4f4cadd756 Allow apps to request a specific HRTF 2015-10-07 03:29:53 -07:00
Chris Robinson 0eef6d9d51 Use the enumerated HRTF list for selecting an HRTF
Also report the proper specifier of the one currently in use.
2015-10-06 06:48:53 -07:00
Chris Robinson 1b51ee8b87 Store the Hrtf struct with the corresponding HrtfEntry
Also store the filename with the Hrtf struct so it can be reused for multiple
HrtfEntry objects.
2015-10-06 04:01:53 -07:00
Chris Robinson 946b3d5746 Try to use the full path for the CWD instead of . 2015-10-06 01:26:15 -07:00
Chris Robinson a4c378dd00 Enumerate and list HRTFs per-device 2015-10-06 00:23:11 -07:00
Chris Robinson f590af510d Skip empty data directory entries 2015-10-04 17:24:12 -07:00
Chris Robinson 074983b19c Implement SearchDataFiles for Windows 2015-10-04 16:41:54 -07:00
Chris Robinson 70fbc2b1ff Add a function to get a list of data files
The method takes a marked-up filename (e.g. may include %r for a sample rate,
%% for %, etc), and returns a vector of strings of found filenames that match.
It will search the CWD, the local, and global data directories, in that order.
2015-10-03 20:41:18 -07:00
Chris Robinson aa10068ca2 Add methods to enumerate and query device HRTFs
Currently just returns a dummy entry.
2015-10-03 19:59:21 -07:00
Chris Robinson 0fcd497796 Combine two arrays 2015-10-01 01:05:08 -07:00
Chris Robinson 07f80eb4e1 Move the resampler stuff to mixer.c where it's used 2015-10-01 00:34:13 -07:00
Chris Robinson d5675d5395 Search more aggressively for libs needed by SDL_sound 2015-09-30 21:34:30 -07:00
Chris Robinson da3b9568dd Revert "Only use SDL1 with SDL_sound"
This reverts commit 8883ce1cef.
2015-09-30 18:45:19 -07:00
Chris Robinson 904cdfda32 Avoid double-checks for the stepping mixer loops 2015-09-30 17:25:28 -07:00
Chris Robinson b68fbe3628 Replace separate vaddq_f32/vmulq_f32 calls with a vmlaq_f32 2015-09-30 13:34:09 -07:00
Chris Robinson 6d53ffdbf3 Remove the --make-tab option from makehrtf
We haven't used a built-in HRTF table for a while now.
2015-09-29 23:09:45 -07:00
Chris Robinson dc10e56bab Implement a 6-point sinc-lanczos filter 2015-09-29 20:39:12 -07:00
kcat e13d553aef Merge pull request #21 from aaronmjacobs/master
Fix resample_fir4 link error
2015-09-29 12:39:48 -07:00
Aaron Jacobs a7084b1051 Fix resample_fir4 link error 2015-09-29 12:34:03 -07:00
Chris Robinson 8883ce1cef Only use SDL1 with SDL_sound 2015-09-28 23:29:52 -07:00
Chris Robinson 848a4a0fcc Auto-replace the "cubic" resampler with "sinc4" 2015-09-28 12:59:52 -07:00
Chris Robinson 9992c4da99 Update changelog 2015-09-27 23:57:50 -07:00
Chris Robinson ab6622a8d6 Replace the cubic resampler with a 4-point sinc/lanczos filter 2015-09-27 23:57:25 -07:00
Chris Robinson 3e60b18989 Don't keep selecting the mixer to use 2015-09-27 20:55:39 -07:00
Chris Robinson 86ff35bf71 Increase the max pitch to 255
Note that this is the multiple above the device sample rate, rather than the
source property limit. It could theoretically be increased to 511 by testing
against UINT_MAX instead of INT_MAX, since the increment and positions are
using unsigned integers. I'm just being paranoid about overflows.
2015-09-26 11:18:30 -07:00
Chris Robinson 30d88cf547 Use the macros to allocate the wrapper backends 2015-09-24 15:54:32 -07:00
Chris Robinson 17e2b4b3a5 Remove unneeded clamping 2015-09-24 13:44:28 -07:00
Chris Robinson d8e2308adb Loop over the gain values only once 2015-09-24 12:36:02 -07:00
Chris Robinson 83659db996 Return the number of properties written 2015-09-24 10:45:34 -07:00
Chris Robinson ef43370927 Use a local var instead of multiple double-dereferencing 2015-09-24 10:18:29 -07:00
Chris Robinson 64858e3e94 Fix B-Format HRTF decoding 2015-09-23 16:02:46 -07:00
Chris Robinson 4bdd58bc83 Use N3D scaling instead of FuMa 2015-09-23 15:03:53 -07:00
Chris Robinson ba43582278 Use a single enum list for source properties 2015-09-22 08:48:26 -07:00
Chris Robinson 07d0bddb4f Avoid a potential race condition with NewThunkEntry
It's possible for another invocation to increase the array size in between the
ReadUnlock and WriteLock calls, causing the 'i' index to refer to a taken
entry.
2015-09-21 13:51:56 -07:00
Chris Robinson 33ac3095dd Handle up to 6 values with alSourcedvSOFT and alGetSourcefv 2015-09-21 09:43:51 -07:00
Chris Robinson a774408753 Get rid of ALCdevice_GetLatency 2015-09-21 05:52:01 -07:00
Chris Robinson 5f5eebc4df Allow the hrtf_tables option to be device-specific 2015-09-20 08:28:34 -07:00
Chris Robinson 46bbf95bae Disable mmdevapi capture and update changelog
Unfortunately mmdevapi does not do channel remixing or resampling, even for
capture, so the device can only be opened in the mode it's configured for.
For now, fallback to dsound or winmm to get the conversion until we can do it
ourselves.
2015-09-18 03:19:16 -07:00
Chris Robinson db0f29f6d8 Fix updating listener params when forcing updates 2015-09-18 00:48:43 -07:00
Chris Robinson 2f1bfb5945 Add missing enum values
Spotted by Xavier Bouchoux.
2015-09-17 04:01:46 -07:00
Chris Robinson 4570345534 Return the data file handle on Windows if it was opened 2015-09-16 18:20:28 -07:00
Chris Robinson 3c72865775 Use sizeof T for the size of the object type 2015-09-15 19:23:32 -07:00
Chris Robinson b348abf5c3 Rename F_2PI to F_TAU 2015-09-13 08:46:48 -07:00
Chris Robinson 2763f4096c Update properties and clear wet buffers before mixing/processing 2015-09-13 06:51:55 -07:00
Chris Robinson 87f3babe2c Append "on OpenAL Soft" to mmdevapi, dsound, and winmm device names
Would be nicer to have a more backend-agnostic method of doing this, Perhaps
even also only when the router is being used.
2015-09-10 22:15:40 -07:00
Chris Robinson 9469c4c79b Slight changelog update 2015-09-08 15:12:13 -07:00
Chris Robinson 483352f32b Set both BS2B parameters at once 2015-09-08 15:04:42 -07:00
Chris Robinson 475a566e35 Play a 1khz sine wave for 4 seconds in the loopback example 2015-09-07 21:17:26 -07:00
Chris Robinson d240077bc5 Explicitly convert to int in the aluF2I/S/B functions 2015-09-07 03:27:25 -07:00
Chris Robinson 5d8a1c11b5 Avoid setting an HRTF-compatible format when it's disabled 2015-09-05 14:33:21 -07:00
Chris Robinson 365a010732 Don't store the HRTF request mode in the device flags 2015-09-05 01:32:12 -07:00
Chris Robinson 804909e1d7 Set a proper HRTF status when non-stereo output is used 2015-09-05 00:42:44 -07:00
Chris Robinson d6290482cc Add word wrapping to the changelog 2015-09-05 00:07:05 -07:00
Chris Robinson 703f1fdec2 Specify the pa_channel_map directly instead of through a string 2015-09-04 23:59:24 -07:00
Chris Robinson 28a516e8a5 Change the hrtf config option to expect auto/true/false instead of a bool 2015-09-04 20:16:48 -07:00
Chris Robinson 6fc567f1ab Reorganize some HRTF config options 2015-09-04 17:06:23 -07:00
Chris Robinson 0eb83fe462 Make option and block names case-sensitive
This is to avoid any issues with device names that can be case-sensitive, and
strcasecmp not working properly for non-ASCII-7 uppercase characters.
2015-09-04 16:09:09 -07:00
Chris Robinson 5f40daabc2 Reverse the device and block names for device-specific options 2015-09-04 15:47:48 -07:00
Chris Robinson 30398083f4 Update the changelog for initial 1.17 changes 2015-09-04 14:53:38 -07:00
Chris Robinson 9d6bb05ac6 Reposition the JACK backend entry 2015-09-04 14:52:23 -07:00
Chris Robinson ce487d1e43 Use the correct device name for PulseAudio too
Like mmdevapi. duplicate device names will have a '#2' or such appended, so the
device's reported name may be incorrect.
2015-09-03 14:59:59 -07:00
Chris Robinson 23729c2083 Replace another vector loop with VECTOR_FIND_IF 2015-09-03 14:53:46 -07:00
Chris Robinson 87e4ec6620 Use the correct device name when opening a device by name
Duplicate device names will have a '#2' or such appended, so the device's
reported name may be incorrect.
2015-09-03 11:56:46 -07:00
Chris Robinson 7b4f1cfb4a Handle the stereo-mode config option with alsoft-config 2015-08-28 22:09:07 -07:00
Chris Robinson 2cb974df40 Document the bformat config option 2015-08-28 15:53:17 -07:00
Chris Robinson 70c63dd576 Allow '#' in config block names
Since some devices may have it appended.
2015-08-28 14:59:45 -07:00
Chris Robinson 8fe421cba1 Document device-specific config options 2015-08-28 14:48:33 -07:00
Chris Robinson e5fa4ee25d Allow for device-specific config values 2015-08-28 14:10:39 -07:00
Chris Robinson bbc16e2c15 Use ACN ordering for ambisonics coefficients arrays
Note that it still uses FuMa scalings internally. Coefficients loaded from
config files specify if they're FuMa (in both ordering and scaling) or N3D,
and will get reordered or rescaled as needed.
2015-08-28 10:58:30 -07:00
Chris Robinson d17534332f Update README acknowledgements 2015-08-26 13:06:19 -07:00
Chris Robinson 762cb00327 Update the hrtf.txt about the 48khz default dataset. 2015-08-26 12:52:18 -07:00
Chris Robinson 01f9cb4072 Update the default value for JACK's spawn-server option 2015-08-26 12:50:54 -07:00
Chris Robinson baf1bd5b54 Avoid temporary vector objects 2015-08-24 03:02:58 -07:00
Chris Robinson c292b9e4ff Revert "Fix B-Format rotation"
This reverts commit 7ffb9b3056.

It was behaving as appropriate before (orienting left did pan it left for the
listener), I was apparently just misinterpreting the matrix.
2015-08-24 00:19:47 -07:00
Chris Robinson 7ffb9b3056 Fix B-Format rotation
The rotation erroneously specified the orientation of the source relative to
the sound field, whereas it should be the orientation of the sound field *and*
source relative to the listener. So now when the source is oriented left, the
front of the sound field is to the left of the listener.
2015-08-23 22:01:29 -07:00
Chris Robinson 8559af5d48 Minor reformating 2015-08-22 07:23:43 -07:00
Chris Robinson 6f59ebab27 Don't explicitly store first-order coefficients
It seems a simple scaling on the coefficients will allow first-order content to
work with second- and third-order coefficients, although obviously not with any
improved locality. That may be something to look into for the future, but this
is good enough for now.
2015-08-18 07:44:17 -07:00
Chris Robinson 53f6590b17 Set the WAVEFORMATEX cbSize field for mmdevapi capture 2015-08-18 00:19:22 -07:00
Chris Robinson d5ab883da2 Define MixHrtf directly instead of through a SUFFIX macro 2015-08-15 01:37:46 -07:00
Chris Robinson f6e52debb5 Fix handling of PulseAudio devices that have the same description 2015-08-14 19:05:16 -07:00
Chris Robinson c1146d27c6 Also recognize "DirectSound" and "MMSYSTEM" on Windows 2015-08-14 17:02:11 -07:00
Chris Robinson a5aaa3c9aa Recognize "DirectSound3D" as a device name on Windows 2015-08-13 21:18:39 -07:00
Chris Robinson 7d4e3688e1 Wait for the OpenSL buffer queue to empty when stopping 2015-08-13 16:01:31 -07:00
Chris Robinson f134fbac5c Check for pthread_*_np functions in pthread_np.h when it exists 2015-08-13 15:20:34 -07:00
kcat c2f88ffad6 Merge pull request #15 from aaronmjacobs/master
Make installation of headers and libraries optional
2015-08-12 15:23:30 -07:00
Aaron Jacobs 11e6e07a72 Make installation of headers and libraries optional 2015-08-12 15:08:14 -07:00
Chris Robinson 8fa4f276f8 Allow specifying ALC_DONT_CARE_SOFT for ALC_HRTF_SOFT
ALC_FALSE now indicates explicitly no HRTF mixing, while ALC_DONT_CARE_SOFT
is autodetect.
2015-07-06 12:37:21 -07:00
Chris Robinson f58d985789 Change source radius behavior
For sources with a non-0 radius:
When distance <= radius, factor = distance/radius*0.5
When distance > radius, factor = 1 - asinf(radius/distance)/PI

Also, avoid using Position after calculating the localized direction and
distance.
2015-07-05 08:54:29 -07:00
Chris Robinson 4efe0d8696 Update a couple comments 2015-07-04 10:12:57 -07:00
Chris Robinson d90dfc8d1f Check for duplicate device names in the mmdevapi backend 2015-06-30 07:44:56 -07:00
Chris Robinson c24f4f230f Use the lockless ringbuffer for mmdevapi capture
The backend's capture funcs are already called while under a lock, so multiple
threads shouldn't be able to read from it at once.
2015-06-30 07:42:09 -07:00
Chris Robinson e5964d6dc4 Double check the mmdevapi capture format
This isn't a real solution, but it should get IAudioClient_IsFormatSupported to
stop failing.
2015-06-07 13:05:07 -07:00
Chris Robinson ed3f32b087 Don't define struct timespec with VS2015 2015-06-07 12:01:15 -07:00
Chris Robinson 5543000c5b Check for snprintf in stdio.h
This works better for VS2015, which adds support for the function.
2015-06-07 11:16:11 -07:00
Chris Robinson 9f49ac0fda Add a macro to simplify allocating and constructing an object 2015-05-18 16:39:44 -07:00
Chris Robinson 9479ea656b Convert the solaris backend to the new API 2015-05-17 04:18:38 -07:00
Chris Robinson 3058205963 Add a method to reset the device
This basically acts as if the app created a new context with the specified
attributes (causing the device to reset with new parameters), then immediately
delete it. Existing contexts remain undisturbed, except for a temporary pause
while the device output is reconfigured.
2015-05-16 02:18:09 -07:00
Chris Robinson 80f0b5e736 Add a few more HRTF status values
DISABLED - Generic disabled status
ENABLED - Generic enabled status
DENIED - Not allowed (user has configured HRTF to be off)
REQUIRED - Forced (user has forced HRTF to be used)
HEADPHONES_DETECTED - Enabled because headphones were detected
UNSUPPORTED_FORMAT - Device format is not compatible with available filters
2015-05-16 01:06:26 -07:00
Chris Robinson 0f51b6df4b Add an HRTF status query
This can report the status of HRTF, specifying if it's enabled or not and why
(currently only reports unsupported formats, but this may be extended).
2015-05-15 23:28:03 -07:00
kcat c6dc1376e4 Merge pull request #11 from alexxvk/master
Fix mingw build
2015-05-03 16:08:33 -07:00
alexxvk 8846ad967f Fix mingw64 build 2015-05-02 17:44:06 +06:00
Chris Robinson 8dfb1bc9db Fix EFX_REVERB_PRESET_DRIVING_COMMENTATOR 2015-04-04 03:29:57 -07:00
Chris Robinson 19f79be57b Fix static_assert when __COUNTER__ isn't available 2015-03-02 23:05:25 -08:00
Chris Robinson 6fcaccc964 Don't assert the increment value in the copy32 resampler 2015-02-15 13:15:49 -08:00
Chris Robinson b4c9744d6a Fix the HRTF B-Format decoder's W coefficient
And limit it to first-order again, since there will likely need to be extra
scalings applied.
2015-02-14 12:11:50 -08:00
Chris Robinson 18fed4e79a Cheange some more unnecessarily small coefficients to 0 2015-02-11 22:23:33 -08:00
Chris Robinson 71b6e9bfe0 Add an option for "basic" HRTF rendering
This method is intended to help development by easily testing the quality of
the B-Format encode and B-Format-to-HRTF decode. When used with HRTF, all
sources are renderer using the virtual B-Format output, rather than just
B-Format sources.

Despite the CPU cost savings (only four channels need to be filtered with HRTF,
while sources all render normally), the spatial acuity offered by the B-Format
output is pretty poor since it's only first-order ambisonics, so "full" HRTF
rendering is definitely preferred.

It's /possible/ for some systems to be edge cases that prefer the CPU cost
savings provided by basic over the sharper localization provided by full, and
you do still get 3D positional cues, but this is unlikely to be an actual use-
case in practice.
2015-02-11 09:32:05 -08:00
Chris Robinson a6e574ba9e Calculate HRTF coefficients for all B-Format channels at once
It's possible to calculate HRTF coefficients for full third-order ambisonics
now, but it's still not possible to use them here without upmixing first-order
content.
2015-02-10 11:22:28 -08:00
Chris Robinson 3ed79cc229 Use a single statement to declare the buffer format channel maps 2015-02-10 10:04:59 -08:00
Chris Robinson b9e81794e4 Pass the (FuMa) channel number to GetBFormatHrtfCoeffs 2015-02-10 06:46:02 -08:00
Chris Robinson cf5856ed48 Correct conversion from polar to cartesian coords for HRTF
A functional no-op (cos(a) == cos(-a), -sin(a) == sin(-a)), but Ambisonics
expects the azimuth angle to go counter-clockwise.
2015-02-10 05:38:16 -08:00
Chris Robinson a1d4847d07 Use B-Format for HRTF's virtual output format
This adds the ability to directly decode B-Format with HRTF, though only first-
order (WXYZ) for now. Second- and third-order would be easilly doable, however
we'd need to be able to up-mix first-order content (from the BFORMAT2D and
BFORMAT3D buffer formats) since it would be inappropriate to decode lower-order
content with a higher-order decoder.
2015-02-09 15:59:29 -08:00
Chris Robinson 8933e21ef2 Properly handle a mono output buffer with the MIDI synths 2015-02-09 08:47:48 -08:00
Chris Robinson 1393af4f9f Add a comment detailing how the HRTF channel buffer is set up 2015-02-09 08:11:07 -08:00
Chris Robinson a925fb8111 Make sure the BS2B filter is freed if HRTF is enabled 2015-02-09 05:56:37 -08:00
Chris Robinson 61755f35c1 Move HRTF params and state closer together 2015-02-09 05:54:14 -08:00
Chris Robinson c297b51a6e Add a note to the JACK backend about a (minor) race condition 2015-02-07 10:09:01 -08:00
Chris Robinson f5dd5c1330 Fix some ringbuffer function comments 2015-02-07 10:08:27 -08:00
Chris Robinson 4a5daa2e91 Clean up another vector iterator loop 2015-02-07 04:47:02 -08:00
Chris Robinson 50cdc0ac1e Avoid tracing wide-char strings
Because on Windows, traced strings are written to a char string, which causes
UTF-16 strings to be converted to a narrow (non-UTF-8) encoding, potentially
losing characters.
2015-02-07 04:19:50 -08:00
Chris Robinson 61743a3a00 Avoid unnecessary uses of ExchangeInt/Ptr 2015-02-04 23:39:51 -08:00
Chris Robinson efb7b11d7f Avoid unnecessary ExchangeInt uses 2015-02-04 05:57:54 -08:00
Chris Robinson 33ced1a7c2 Try the JACK backend before PulseAudio
The backend will not spawn a server by default, so PulseAudio will still be
preferred as long as a JACK server isn't already running.
2015-02-03 05:11:46 -08:00
Chris Robinson e6f4648924 Signal the mixer thread outside of the mutex lock 2015-02-03 02:40:22 -08:00
Chris Robinson 12e443d61d Don't try to spawn a JACK server by default
And don't print an error if one couldn't be started when not requested.
2015-02-03 01:23:19 -08:00
Chris Robinson e53861bfb9 Always use the JACK server buffer size as the update size
The buffer-size config option now only specifies an additional mix ahead to
keep ready for audio requests, rather than a pretend period size.
2015-02-03 01:08:38 -08:00
Chris Robinson 290badea95 Ensure PulseAudio's mixing loop is signaled when stopping 2015-01-21 22:02:02 -08:00
Chris Robinson 5cbafaa014 Remove a couple unused variables 2015-01-20 16:44:47 -08:00
Chris Robinson 0b6bb76259 Fix variable check 2015-01-20 16:42:23 -08:00
Chris Robinson 199646ac2b Fix X7DOT1_NARROW name to X7DOT1_WIDE 2015-01-15 09:27:37 -08:00
Chris Robinson c1607300bb Accept a "narrow" layout for 7.1 with mmdevapi 2015-01-15 01:56:04 -08:00
Chris Robinson 205e258d1a Fix high-pass coefficients 2015-01-13 09:38:13 -08:00
Chris Robinson f9a9235333 Add missing alignas to CubicLUT declaration 2015-01-13 09:29:03 -08:00
Chris Robinson ed05c83ee7 Fix the flags type 2015-01-11 15:02:26 -08:00
Chris Robinson 4dc9956a12 Remove some IN_IDE_PARSER uses 2014-12-24 17:15:50 -08:00
Chris Robinson bc17d6fc45 Remove some unnecessary restrict uses 2014-12-24 17:14:45 -08:00
Chris Robinson ca28d81b36 Update some function comments (bytes -> elements) 2014-12-24 16:42:57 -08:00
Chris Robinson c71d8c0fc5 Update a comment 2014-12-24 01:17:55 -08:00
Chris Robinson ad11a90720 Don't update the channel format if all JACK ports were allocated 2014-12-23 22:02:56 -08:00
Chris Robinson 93b69583d3 Try the device-specified channel configuration first
This does basically no checking that the channel config is correct, but should
be good enough for when non-stereo modes are requested.
2014-12-23 21:06:10 -08:00
Chris Robinson 2f162f0fc3 Use the custom ringbuffer instead of JACK's 2014-12-23 20:24:10 -08:00
Chris Robinson a9cce5de3e Add a lockless ringbuffer
Largely copied from JACK, it's extended to work with user-specified element
sizes instead of bytes. This is necessary to be able to work with 6- and 7-
channel output modes.
2014-12-23 20:17:34 -08:00
Chris Robinson 6ccf10bbde Don't set unused pointers to NULL, don't try to write 0 samples 2014-12-23 11:56:55 -08:00
Chris Robinson e84b3f4707 At least measure the ringbuffer size for JACK's latency
We should also add the port latency, but there's currently no way to ensure
it's synchronized with the ringbuffer (the ringbuffer will update before the
port latency gets updated).
2014-12-23 11:42:57 -08:00
Chris Robinson beb670a939 Add an option to prevent spawning a JACK server 2014-12-22 19:29:55 -08:00
Chris Robinson 5e189624b7 Add JACK to the config utility 2014-12-22 18:56:15 -08:00
Chris Robinson b8d98dd6d0 Add an option for an increased ringbuffer size with JACK 2014-12-22 18:48:54 -08:00
Chris Robinson 7e6d0d6b4f Fill out the JACK playback backend
A few notes about it:

The OpenAL device's requested buffer metrics are ignored, and instead the
device will keep one JACK-sized buffer's worth of audio prepared for JACK's
next process request.

Output is restricted to 32-bit float stereo. Part of this is because JACK
requires a buffer size that's a power of 2 (measured in samples), and the
ringbuffer requires a buffer size that's a power of 2 (measured in bytes). A
channel count of 6 (5.1) or 7 (6.1) will not work without causing a sample to
split over the edge of the ringbuffer. Additioanlly, JACK doesn't provide
information about what channel configuration a device or set of ports has, so
there's no way to know what ports 3 and up map to (even the first two ports are
unknown, but assuming stereo seems to work well enough).

There is no device latency measurement (for AL_SOFT_source_latency) due to the
non-atomicity between the ringbuffer's read size and port latency. A method is
needed to ensure the ringbuffer's read size and port latency can both be
measured between the end of a JACK update cycle (when the port latency has been
updated with the newly-retrieved audio) and the following ringbuffer read
update.
2014-12-22 13:30:35 -08:00
Chris Robinson 23197ddbc3 Add a skeleton backend for JACK 2014-12-21 15:51:16 -08:00
Chris Robinson f2d59671b2 Add a cmake module to find JACK 2014-12-21 15:48:40 -08:00
Chris Robinson b56d50912e Set error if capture device fails to start 2014-12-21 12:46:04 -08:00
Chris Robinson c2975b5f44 Trace lparam and wparam message values 2014-12-21 12:37:02 -08:00
Chris Robinson a91bca64f8 Check the PROPVARIANT type before use 2014-12-21 12:20:31 -08:00
Chris Robinson 13092d94b7 Use VECTOR_FOR_EACH instead of a manual loop 2014-12-21 10:45:10 -08:00
Chris Robinson 28a9f0826c Use a macro for the record thread name 2014-12-21 10:38:40 -08:00
Chris Robinson 6574fa4863 Cast to the pointer-to-type to increment the buffer 2014-12-21 09:48:36 -08:00
Chris Robinson aa4cf99e63 Fix logging on Windows 2014-12-20 06:24:55 -08:00
Chris Robinson abf0bd13ca Support capture with mmdevapi 2014-12-19 15:49:37 -08:00
Chris Robinson f300be00ae Handle logging Unicode strings on Windows 2014-12-19 10:14:02 -08:00
Chris Robinson 7f696edf13 Set the right variable when assuming CPU extensions 2014-12-19 08:50:30 -08:00
Chris Robinson c3a36d9b19 Do up to 256 samples at a time with multi-step loops 2014-12-18 09:23:55 -08:00
Chris Robinson 9897fca794 Inline a couple functions 2014-12-18 08:52:04 -08:00
Chris Robinson 13c2dd7115 Offset to the buffer's channel start first 2014-12-18 08:42:03 -08:00
Chris Robinson 94ad5b289f Avoid duplicate calculations 2014-12-18 07:42:14 -08:00
Chris Robinson 6086c344dc Assert that there's a buffer for mixing
For Clang's static analysis.
2014-12-17 10:57:35 -08:00
Chris Robinson 4b91d34d58 Set a couple pulse callbacks to NULL during reset, and minor cleanups 2014-12-17 10:10:28 -08:00
Chris Robinson af193e9fb3 Don't kill pulseaudio's mixer thread if it's already killed 2014-12-17 09:47:58 -08:00
Chris Robinson c37275efdc Use aluVector and aluMatrix in a couple more places 2014-12-16 10:36:44 -08:00
Chris Robinson c48a6196ad Constify some variables 2014-12-16 09:20:35 -08:00
Chris Robinson d2adefe063 Pass a vectory to aluMatrixVector 2014-12-16 07:42:17 -08:00
Chris Robinson 3b8f54d572 Use aluVector in some more places 2014-12-16 07:20:27 -08:00
Chris Robinson 97f6d302fe Add explicit matrix and vector types to operate with 2014-12-16 06:29:31 -08:00
Chris Robinson 1b7c554068 Multiply samples with the cubic coeffs before transposing
This avoids having to transpose the cubic coefficients.
2014-12-15 17:13:31 -08:00
Chris Robinson a0e7ad493b Load samples with _mm_loadu_ps in the cubic SSE resamplers 2014-12-15 15:27:31 -08:00
Chris Robinson 177dd95686 Add SSE2 and SSE4.1 cubic resamplers 2014-12-15 13:58:41 -08:00
Chris Robinson a606bbc7f1 Use a lookup table to do cubic resampling 2014-12-15 12:23:28 -08:00
Chris Robinson 4b77f4ef07 Transpose the cubic matrix op 2014-12-15 11:06:44 -08:00
Chris Robinson e60e0761f5 Use the default channel layout in alffplay if one isn't specified 2014-12-12 06:10:23 -08:00
Chris Robinson 05529d66ae Don't pass float literals for unsigned ints 2014-12-06 18:58:16 -08:00
Chris Robinson 3d1f1ffd7f Fix a potential leak when opening a data file on Windows 2014-12-01 19:27:09 -08:00
Chris Robinson 0c74a14543 Remove IrSize from DirectParams 2014-11-29 03:32:25 -08:00
Chris Robinson cf50f44f4d Remove an unnecessary maxf() 2014-11-29 02:06:08 -08:00
Chris Robinson 6883619b14 Check mmdevice endpoint for being headphones 2014-11-27 17:43:37 -08:00
Chris Robinson 8d6d2e9a2b Avoid unnecessary uses of ALCdevice_Lock and ALCdevice_Unlock 2014-11-27 15:27:43 -08:00
Chris Robinson 82780a703b Set headphones when dsound reports headphones 2014-11-27 02:30:52 -08:00
Chris Robinson 1db8392344 Improve ambient gain calculations 2014-11-25 22:24:29 -08:00
Chris Robinson bdbf6613ef Support B-Format output with the wave file writer 2014-11-25 22:20:00 -08:00
Chris Robinson be476b3729 Halve the gain of the Cube8 coefficients 2014-11-25 18:11:45 -08:00
Chris Robinson 0a3e11b75e Fix reverb panning direction 2014-11-25 17:55:17 -08:00
Chris Robinson aa231d25a7 Shorten a couple lines 2014-11-25 16:47:39 -08:00
Chris Robinson efb5c5eecd Use linear gain stepping 2014-11-25 02:08:48 -08:00
Chris Robinson 42ef85d3f6 Pass the step count to the Update*Stepping methods 2014-11-25 01:38:27 -08:00
Chris Robinson 70ddca33ba Fix __ALSOFT_REVERSE_Z with non-HRTF output 2014-11-25 01:15:26 -08:00
Chris Robinson 8e6c131b36 Use a separate method to set initial HRTF coefficients 2014-11-24 22:26:42 -08:00
Chris Robinson cbe22763ee Require at least pulse client 0.9.16 2014-11-24 13:15:04 -08:00
Chris Robinson fc00c1c009 Trace PulseAudio's active port 2014-11-24 12:45:51 -08:00
Chris Robinson d6ebf5d1b6 Make CalcHrtfDelta more generic 2014-11-24 01:53:45 -08:00
Chris Robinson 13608d4d61 Move the voice's last position and gain out of the Hrtf container 2014-11-24 01:31:38 -08:00
Chris Robinson c37a971947 Rename step to steps 2014-11-24 00:24:12 -08:00
Chris Robinson 2111fad92f Use a macro to reduce code duplication 2014-11-23 23:45:30 -08:00
Chris Robinson 391ab19b02 Avoid using ALCdevice_Lock and ALCdevice_Unlock unnecessarily 2014-11-23 21:05:42 -08:00
Chris Robinson 65620e0ae5 Update a comment 2014-11-23 20:43:17 -08:00
Chris Robinson 2c533fdc36 Set headphones when pulse reports using the headphones port 2014-11-23 20:41:29 -08:00
Chris Robinson 033cf3dca9 Add a boolean to specify if a device is headphones 2014-11-23 18:23:24 -08:00
Chris Robinson 837b38b166 Swap delta and step, remove double semicolons 2014-11-23 18:07:19 -08:00
Chris Robinson 5464a5c630 Remove unused channel enums 2014-11-23 14:50:31 -08:00
Chris Robinson e5601a062e Remove the cube+diamond virtual layout 2014-11-23 14:43:29 -08:00
Chris Robinson 5796e7eae5 Add an option for a simpler virtual channel setup
With HRTF mixing, certain things are mixed to virtual channels to be filtered
with HRTF later. This allows for using an 8-channel cube instead of a 14-
channel cube+diamond.
2014-11-23 13:49:19 -08:00
Chris Robinson 45d6bb58a4 Partially revert "Use a different method for HRTF mixing"
The sound localization with virtual channel mixing was just too poor, so while
it's more costly to do per-source HRTF mixing, it's unavoidable if you want
good localization.

This is only partially reverted because having the virtual channel is still
beneficial, particularly with B-Format rendering and effect mixing which
otherwise skip HRTF processing. As before, the number of virtual channels can
potentially be customized, specifying more or less channels depending on the
system's needs.
2014-11-23 10:49:54 -08:00
Chris Robinson fc3608b381 Handle loopback devices when deciding to use HRTF 2014-11-23 08:38:33 -08:00
Chris Robinson 7e716bfc4a Remove a couple unnecessary traces 2014-11-22 22:33:19 -08:00
Chris Robinson 4f279557a6 Attempt to use BS2B when using headphones without HRTF 2014-11-22 22:28:36 -08:00
Chris Robinson ccbb3f069f Update some config descriptions 2014-11-22 22:00:44 -08:00
Chris Robinson d77c6153e7 Document the stereo-mode config option 2014-11-22 21:02:25 -08:00
Chris Robinson 312330dbaa Rework HRTF decision logic
This way takes into account a new stereo-mode config option, which when set to
"headphones" will default to using HRTF. Eventually the device will also be
able to specify if headphones are being used.
2014-11-22 20:52:08 -08:00
Chris Robinson f7d7afb7c1 Remove an unused macro 2014-11-22 16:39:08 -08:00
Chris Robinson a217be1539 Rename Voice's NumChannels to OutChannels 2014-11-22 16:23:08 -08:00
Chris Robinson 637993a793 Only update the necessary channels 2014-11-22 13:16:24 -08:00
Chris Robinson 4ebf0ad717 Mix DirectChannel sources to the non-virtual channel buffers 2014-11-22 13:10:32 -08:00
Chris Robinson dece86f61f Store the number of output channels in the voice 2014-11-22 13:08:19 -08:00
Chris Robinson fb511351df Remove an unnecessary union container 2014-11-22 12:58:54 -08:00
Chris Robinson e41cfeca84 Move a warning check earlier 2014-11-22 04:51:34 -08:00
Chris Robinson a27e5e1652 Use a different method for HRTF mixing
This new method mixes sources normally into a 14-channel buffer with the
channels placed all around the listener. HRTF is then applied to the channels
given their positions and written to a 2-channel buffer, which gets written out
to the device.

This method has the benefit that HRTF processing becomes more scalable. The
costly HRTF filters are applied to the 14-channel buffer after the mix is done,
turning it into a post-process with a fixed overhead. Mixing sources is done
with normal non-HRTF methods, so increasing the number of playing sources only
incurs normal mixing costs.

Another benefit is that it improves B-Format playback since the soundfield gets
mixed into speakers covering all three dimensions, which then get filtered
based on their locations.

The main downside to this is that the spatial resolution of the HRTF dataset
does not play a big role anymore. However, the hope is that with ambisonics-
based panning, the perceptual position of panned sounds will still be good. It
is also an option to increase the number of virtual channels for systems that
can handle it, or maybe even decrease it for weaker systems.
2014-11-22 04:20:17 -08:00
Chris Robinson 38383671d7 Balance the left and right channels for quad output 2014-11-21 14:41:02 -08:00
Chris Robinson c8d82712da Reformat a couple lines 2014-11-21 14:40:10 -08:00
Chris Robinson ccba33169b Initialize panning after setting up HRTF 2014-11-21 14:35:19 -08:00
Chris Robinson 4ad6905c13 Allocate the DryBuffer dynamically 2014-11-21 13:45:57 -08:00
Chris Robinson d608f0e9f0 Only warn when no data file could be opened 2014-11-19 13:07:37 -08:00
Chris Robinson 6e198b3476 Align UpdateSize for Neon, too 2014-11-17 21:33:09 -08:00
Chris Robinson 1dcc54c986 Don't force UpdateSize to a multiple of 4 after buffer metrics were set 2014-11-17 21:23:29 -08:00
Chris Robinson 40a08bed4f Always get the pulseaudio sink info on device reset 2014-11-17 17:57:52 -08:00
Chris Robinson d4e52b64d8 Mark a function as const 2014-11-15 23:20:38 -08:00
Chris Robinson 308e6b697a Remove the unused angle and elevation from the device channel config 2014-11-15 04:26:11 -08:00
Chris Robinson b10085cc63 Slightly increase the ambient gain volume 2014-11-15 04:11:22 -08:00
Chris Robinson 9681c5a2bb Interpolate directional reverb gains with ambient based on vector length 2014-11-15 00:21:26 -08:00
Chris Robinson 55a13456d4 Add a method to convert channel enums to a label string 2014-11-15 00:19:56 -08:00
Chris Robinson a095645970 Don't bother with LFE in the channel setup, set the values explicitly 2014-11-12 19:26:53 -08:00
Chris Robinson 283c2b20d4 Add a toolchain for Android cross-compiling 2014-11-10 17:56:48 -08:00
Chris Robinson e036cca1c9 Add the ability to use custom output channel coefficients
I'm not sure exactly how I want to do this yet, but this is a good starting
point.
2014-11-10 17:53:42 -08:00
Chris Robinson 1c4055419e Don't use the device lock/unlock wrappers needlessly 2014-11-08 18:04:01 -08:00
Chris Robinson 3eab44001d Remove the unused layout config options 2014-11-08 15:44:07 -08:00
Chris Robinson a50ba603ab Remove the unused wide-stereo option 2014-11-08 06:36:45 -08:00
Chris Robinson c053617066 Reorder some options in the config sample 2014-11-08 05:59:08 -08:00
Chris Robinson 3904a3f033 Allow selecting the 5.1-rear channel config from the config file 2014-11-08 05:53:17 -08:00
Chris Robinson 74994e9d11 Remove the long-deprecated 'format' config option 2014-11-08 05:41:55 -08:00
Chris Robinson 907cd3dd01 Add a workaround for compilers without __COUNTER__
This can make GCC pretty noisey, complaining "declaration does not declare
anything" for each static_assert, but it should still function on such older
compilers.
2014-11-07 19:43:14 -08:00
Chris Robinson b34a374fa7 Only enable the BS2B filter with stereo output 2014-11-07 16:11:47 -08:00
Chris Robinson 35eacf058e Go to the next voice when a source is stopped 2014-11-07 16:05:06 -08:00
Chris Robinson 1a326c758b Rename a couple parameters 2014-11-07 16:00:07 -08:00
Chris Robinson 57387505d8 Move a declaration 2014-11-07 15:47:41 -08:00
Chris Robinson 01a1e6f102 Fallback to 16-bit samples in alffmpeg if a float32 format isn't supported 2014-11-07 04:50:16 -08:00
Chris Robinson 3f7cb8392e Pas the output device channel count to ALeffectState::process 2014-11-07 03:43:33 -08:00
Chris Robinson 713e9dd4cc Rename speakers to channels, and remove an old incorrect comment 2014-11-07 03:12:32 -08:00
Chris Robinson 4c3f27193f Use a separate macro for the max output channel count 2014-11-07 02:18:24 -08:00
Chris Robinson 6c954e71db Use shorter display names for the surround sound config options 2014-11-07 01:13:20 -08:00
Chris Robinson 0051a96376 Fix 5.1 surround sound
Apparently, 5.1 surround sound is supposed to use the "side" channels, not the
back channels, and we've been wrong this whole time. That means the "5.1 Side"
is actually the correct 5.1 setup, and using the back channels is anomalous.

Additionally, this means the 5.1 buffer format should also use the the side
channels instead of the back channels.

A final note: the 5.1 mixing coefficients are changed so both use the original
5.1 surround sound set (with the surround channels at +/-110 degrees). So the
only difference now between 5.1 "side" and 5.1 "back" is the channel labels.
2014-11-07 00:54:16 -08:00
Chris Robinson 7a98e92117 Update cross-compiler toolchain to work better with Qt 2014-11-06 23:18:42 -08:00
Chris Robinson ad247fe5cd Initialize a couple variables mingw complains about 2014-11-06 23:05:21 -08:00
Chris Robinson 4126ccf744 Use SZFMT for printing size_t 2014-11-06 23:02:39 -08:00
Chris Robinson 61a56ce120 Play zero-distance/zero-radius sources from the front 2014-11-05 04:48:48 -08:00
Chris Robinson 6aed34cfb5 Don't use FrontLeft and FrontRight to reference the dry buffer 2014-11-05 04:11:18 -08:00
Chris Robinson 59a2858239 Don't increment the output buffer in the Write_ methods 2014-11-05 04:07:06 -08:00
Chris Robinson 0185bdd8ca Support 5.1 and 7.1 in alffplay 2014-11-05 03:55:36 -08:00
Chris Robinson da765ec53b Remove the channel name from ChannelConfig 2014-11-05 03:46:00 -08:00
Chris Robinson e39117467c Fix panning of multi-channel sources 2014-11-05 03:06:32 -08:00
Chris Robinson c834c3fae5 Set gains using the device channel index 2014-11-05 02:54:11 -08:00
Chris Robinson e5016f814a Add LFE to the speaker arrays 2014-11-04 04:33:35 -08:00
Chris Robinson 6083a684d1 Use a method to set omni-directional channel gains 2014-11-04 03:33:35 -08:00
Chris Robinson d8cfdb3f34 Use COUNTOF to set the number of speakers 2014-11-04 03:00:15 -08:00
Chris Robinson deba996769 Add some missing breaks 2014-11-02 02:30:45 -08:00
Chris Robinson 857d68b0ce Minor update for ambisonics coefficients
Small tweaks to balance the left and right speakers, and change
unreasonably small values to 0.
2014-11-02 00:58:48 -07:00
Chris Robinson 9d82ab9d1f Use the copy resampler only when there's no sub-sample offset 2014-11-02 00:27:26 -07:00
Chris Robinson c82f39decd Avoid the ALCdevice_Lock/Unlock wrapper in some places 2014-11-01 15:55:18 -07:00
Chris Robinson 28c1ec830e Support AL_EXT_MULAW_BFORMAT 2014-10-31 22:52:30 -07:00
Chris Robinson dd6e622206 Add AL_EXT_MULAW_BFORMAT to alext.h 2014-10-31 22:46:34 -07:00
Chris Robinson 3d2853274d Support B-Format source rotation with AL_ORIENTATION 2014-10-31 22:43:13 -07:00
Chris Robinson 336aba6f1f Rename the source's Orientation to Direction 2014-10-31 17:24:46 -07:00
Chris Robinson ac51c9cce6 Add preliminary AL_EXT_BFORMAT support
Currently missing the AL_ORIENTATION source property. Gain stepping also does
not work.
2014-10-31 17:18:45 -07:00
Chris Robinson 1c0596c233 Check the absolute gain value for silence
Future B-Format support will be using negative gains, which still need to be
applied.
2014-10-31 16:55:19 -07:00
Chris Robinson 0e09e779f9 Use %zu (C99) for printing size_t 2014-10-30 12:27:59 -07:00
Chris Robinson 3585021a18 Minor clarification for __ALSOFT_SUSPEND_CONTEXT 2014-10-13 10:48:54 -07:00
Chris Robinson 87dcf65013 Use the minimum of the two string lengths for comparison 2014-10-13 07:04:36 -07:00
Chris Robinson 84582ceb03 Use more appropriate size types 2014-10-13 07:00:43 -07:00
Chris Robinson f05a2b86cd Don't attempt to match a channel input to output
I don't like this, but it's currently necessary. The problem is that the
ambisonics-based panning does not maintain consistent energy output, which
causes sounds mapped directly to an output channel to be louder compared to
when being panned. The inconcistent energy output is partly by design, as it's
trying to render a full 3D sound field and at least attempts to correct for
imbalanced speaker layouts.
2014-10-12 12:39:27 -07:00
Chris Robinson 4320a1483b Make alcSuspendContext and alcProcessContext batch updates
This behavior better matches Creative's hardware drivers and Rapture3D's OpenAL
driver. A compatibility environment variable is provided to restore the old
no-op behavior for any app that behaves badly from this change (set
__ALSOFT_SUSPEND_CONTEXT to "ignore").

If too many apps have a problem with this, the default behavior may need to be
changed to ignore, with the env var providing an option to defer/batch instead.
2014-10-12 09:17:13 -07:00
Chris Robinson a77387b549 Avoid taking the square-root of the ambient gain
Although it is more correct for preserving the apparent volume, the ambisonics-
based panning does not work on the same power scale, making it louder by
comparison.
2014-10-11 09:35:32 -07:00
Chris Robinson 79163b0755 Fix stereo device configuration 2014-10-11 04:07:33 -07:00
Chris Robinson 70b23ab77f Add a helper to search for a channel index by name 2014-10-02 21:19:34 -07:00
Chris Robinson 79fb86d8f7 Store default speaker configurations in a struct 2014-10-02 20:25:30 -07:00
Chris Robinson 95ba18cf4e Make ComputeAngleGains use ComputeDirectionalGains 2014-10-02 18:05:42 -07:00
Chris Robinson 9377d0f237 Don't use ComputeAngleGains for SetGains 2014-10-02 01:02:25 -07:00
Chris Robinson 918c773a59 Use helpers to set the gain step values 2014-10-02 00:56:29 -07:00
Chris Robinson 3aa63e3e9b Use VECTOR_FIND_IF instead of manual loops 2014-09-30 22:42:07 -07:00
Chris Robinson 2d89d33dd1 Add a cast for MSVC 2014-09-30 21:50:29 -07:00
Chris Robinson af7330de88 Copy the null terminator from the string instead of appending it 2014-09-30 21:49:29 -07:00
Chris Robinson d82d6c701d Use size_t for the vector size and capacity 2014-09-30 21:47:22 -07:00
Chris Robinson 4d36ef65b2 Use an ambisonics-based panning method
For mono sources, third-order ambisonics is utilized to generate panning gains.
The general idea is that a panned mono sound can be encoded into b-format
ambisonics as:

w[i] = sample[i] * 0.7071;
x[i] = sample[i] * dir[0];
y[i] = sample[i] * dir[1];
...

and subsequently rendered using:

output[chan][i] = w[i] * w_coeffs[chan] +
                  x[i] * x_coeffs[chan] +
                  y[i] * y_coeffs[chan] +
                  ...;

By reordering the math, channel gains can be generated by doing:

gain[chan] = 0.7071 * w_coeffs[chan] +
             dir[0] * x_coeffs[chan] +
             dir[1] * y_coeffs[chan] +
             ...;

which then get applied as normal:

output[chan][i] = sample[i] * gain[chan];

One of the reasons to use ambisonics for panning is that it provides arguably
better reproduction for sounds emanating from between two speakers. As well,
this makes it easier to pan in all 3 dimensions, with for instance a "3D7.1" or
8-channel cube speaker configuration by simply providing the necessary
coefficients (this will need some work since some methods still use angle-based
panpot, particularly multi-channel sources).

Unfortunately, the math to reliably generate the coefficients for a given
speaker configuration is too costly to do at run-time. They have to be pre-
generated based on a pre-specified speaker arangement, which means the config
options for tweaking speaker angles are no longer supportable. Eventually I
hope to provide config options for custom coefficients, which can either be
generated and written in manually, or via alsoft-config from user-specified
speaker positions.

The current default set of coefficients were generated using the MATLAB scripts
(compatible with GNU Octave) from the excellent Ambisonic Decoder Toolbox, at
https://bitbucket.org/ambidecodertoolbox/adt/
2014-09-30 07:33:13 -07:00
Chris Robinson 4955824c2d Use better GUI item names for the resampler option 2014-09-26 20:45:46 -07:00
Chris Robinson 57623741f6 Show prettier names in the alsoft-config sample format combo boxes 2014-09-13 23:12:40 -07:00
Chris Robinson 4e66224d6c Combine some fields into a struct 2014-09-10 17:53:01 -07:00
Chris Robinson 01adfde199 Invert the ChannelOffsets array 2014-09-10 16:52:54 -07:00
Chris Robinson 49cb2421c7 Use a wave file channel mask based on the actual format 2014-09-10 08:30:07 -07:00
Chris Robinson d714b90962 Add AL_EXT_BFORMAT to alext.h 2014-09-09 21:40:06 -07:00
Chris Robinson 4a712dc612 Remove some unnecessary config options 2014-09-08 15:29:07 -07:00
Chris Robinson 7a31847f7d Use a vector instead of a manual dynamic array 2014-09-08 15:24:27 -07:00
Chris Robinson 5ff1730e02 Don't modify a capture device's format
OpenAL's capture API guarantees the application gets the format requested, or
else the device will fail to open. The only valid change is that the capture
buffer can be larger than requested.
2014-09-08 14:29:59 -07:00
Chris Robinson a234fc11e5 Remove the GetLatency method from the old BackendFuncs 2014-09-08 06:59:58 -07:00
Chris Robinson 9dacd89a02 Convert the winmm backend to the new backend API 2014-09-08 06:46:20 -07:00
Chris Robinson 2be33d8a77 Only pass nano seconds to al_nssleep 2014-09-08 04:37:52 -07:00
Chris Robinson f38e88bc29 Allow optional memory ordering to atomic methods
Currently only C11 atomics make use of the memory order. If not
specified, it defaults to almemory_order_seq_cst.
2014-09-07 00:42:50 -07:00
Chris Robinson 4d19d4f416 Check that atomic_load works with a const _Atomic
The original C11 spec does not allow atomic_load to work on const _Atomic
variables, which we sometimes do in alGet* methods, despite the fact that it
does not modify the variable. An update to the C spec corrects this oversight,
and GCC 4.9 has allowed it anyway, while Clang 3.4 does not.
2014-09-05 17:47:32 -07:00
Chris Robinson ab829fd906 Fix the __get_cpuid cmake check 2014-09-05 02:57:24 -07:00
Chris Robinson 0b250b246d Use a standard pointer-sized integer type 2014-09-04 23:23:48 -07:00
Chris Robinson 4b53d0e90c Make ExchangeInt and ExchangePtr non-atomic 2014-09-03 17:37:07 -07:00
Chris Robinson 2f2768e7c3 Make the fontsound's buffer and link fields atomic 2014-09-03 16:29:17 -07:00
Chris Robinson 30e01a7dba Protect alProcessUpdatesSOFT with a lock 2014-09-03 16:02:00 -07:00
Chris Robinson 7f5497b863 Use proper atomics for the thunk array 2014-09-03 15:49:31 -07:00
Chris Robinson 5840f5e76f Make the buffer's pack and unpack properties atomic 2014-09-03 15:40:15 -07:00
Chris Robinson ba827cdfff Fix Neon mixer definition 2014-08-31 23:46:43 -07:00
Chris Robinson 705c60d924 Use al_calloc/al_free to allocate contexts and voices 2014-08-30 20:59:46 -07:00
Chris Robinson f04b15692e Setup the HRTF format before tracing the pre-reset format 2014-08-29 19:34:20 -07:00
Chris Robinson f18d2f2445 Check mmdevapi device ids to match the default device
Seems Windows can return different IMMDevice object pointers for the same
endpoint.
2014-08-28 18:22:17 -07:00
Chris Robinson 2b87ffece5 Return the correct default capture device name 2014-08-26 14:52:36 -07:00
Chris Robinson 368bf037dd Check the given CoreAudio capture device name 2014-08-26 14:50:14 -07:00
Chris Robinson 99b71278db Remove a couple unnecessary typedefs 2014-08-24 23:48:42 -07:00
Chris Robinson a3bba200c0 Convert the wave writer backend to the new API 2014-08-24 22:20:02 -07:00
Chris Robinson 4f7b3f0c38 Use al_malloc/al_free for default allocators 2014-08-24 20:16:28 -07:00
Chris Robinson 0d0222e91b Include the common sources when building statically 2014-08-23 13:37:14 -07:00
Chris Robinson 259e265920 Rename activesource to voice 2014-08-21 03:41:13 -07:00
Chris Robinson 65d2e0eb8d Use an array of objects for active sources instead of pointers 2014-08-21 02:27:56 -07:00
Chris Robinson b92e643e97 Use a NULL source for inactive activesources
Also only access the activesource's source field once per update.
2014-08-21 00:29:42 -07:00
Chris Robinson 3a6baab495 Use the current binary dir for shared function checks too 2014-08-20 13:47:56 -07:00
Jesper Särnesjö ba9995a8de Use directories relative to current project in CheckFileOffsetBits.cmake
Enables building OpenAL Soft in a subdirectory of another project.
2014-08-20 13:31:24 -07:00
Chris Robinson e3d72ccd15 Support brace-enclosed environment variable names
This makes it possible to append alpha-numeric characters directly to an
environment variable value, e.g. ${FOO}bar will use "FOO" as the variable name
and keep the "bar" as-is, whereas $FOObar will take "FOObar" as the variable
name.
2014-08-19 16:54:53 -07:00
François Cami 3c13e1e333 Update COPYING to the latest https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt to fix the FSF' address Fix the FSF' address in the source 2014-08-18 11:34:29 -07:00
Chris Robinson 864528bb7b Use the POSITION_INDEPENDENT_CODE target property when available 2014-08-16 20:46:55 -07:00
Chris Robinson 4a7e04add3 Don't force specific compile flags for the different build types 2014-08-16 19:57:56 -07:00
Chris Robinson 8630e8c7fc Don't try to include stdalign.h if C11 _Alignas isn't available
Some compilers will allow including stdalign.h, and even define alignas to
_Alignas, even if that C11 feature is unavailable (e.g. because it requires a
suitable -std= setting).
2014-08-16 10:17:30 -07:00
Chris Robinson dd1df64537 Search for the correct include and lib directories for the DX SDK
And only set them when needed.
2014-08-15 14:26:06 -07:00
Chris Robinson d60ce35846 Add a changelog, detailing notable changes for each release 2014-08-15 00:06:59 -07:00
Chris Robinson b907c21f48 Release 1.16.0 2014-08-14 17:30:11 -07:00
Chris Robinson 8364aa5f6f ALC_SOFT_pause_device is finished 2014-08-12 08:45:11 -07:00
Chris Robinson ba3f1e7468 Assume SSE is available if building with support and no run-time checking 2014-08-11 14:45:28 -07:00
Chris Robinson 74c8de6372 Try the __cpuid intrinsic if GCC's __get_cpuid isn't available 2014-08-11 14:19:15 -07:00
Chris Robinson e3ee534c39 Check for GCC's __get_cpuid before using it 2014-08-11 13:38:43 -07:00
Chris Robinson 8ecbeb4945 Only support dsound and mmdevapi on Windows 2014-08-11 09:13:08 -07:00
Chris Robinson 960cdec0b5 Remove a couple unnecessary HAVE_*_H header defines
The xmmintrin.h and arm_neon.h headers are always available with SSE and Neon
support, respectively.
2014-08-11 09:09:00 -07:00
Chris Robinson 4a9545affa Don't try to generate .def or .lib files when building statically 2014-08-10 19:48:53 -07:00
Chris Robinson 6273a18de5 Add an option to build an import .lib with dlltool on mingw
Also make sure the ordinals are stripped from the .def file (using sed), so
that the generated .lib will link apps to the DLL using function names instead
of ordinals.
2014-08-10 19:40:29 -07:00
Chris Robinson a3c236598a Simplify some vector size range checks 2014-08-10 10:52:08 -07:00
Chris Robinson 936a79da7d Give NULL for null-vector iterators 2014-08-10 09:12:08 -07:00
Chris Robinson 94013216b6 Pass pointer-to-vector types as char* instead of void*
C aliasing rules only allow char* to alias an otherwise-incompatible type,
rather than void*.
2014-08-10 08:46:55 -07:00
Chris Robinson 22856844c6 Properly set FluidSynth's include dir for older cmake versions 2014-08-10 05:50:19 -07:00
Chris Robinson 357beb0570 Create a .def file when building with MinGW
Preferably we'd tell CMake to make it itself instead of specifiying compiler-
specific flags, but there doesn't seem to be a way to.
2014-08-10 05:10:11 -07:00
Chris Robinson f173a67870 Use VECTOR_FIND_IF and VECTOR_FOR_EACH instead of manual loops 2014-08-09 06:15:11 -07:00
Chris Robinson 1692dda4b9 Use the default input device for portaudio's default capture device 2014-08-08 19:48:45 -07:00
Chris Robinson 10c01110f3 Modify CPU extensions and effect options to be enabled when checked
It looks nicer and more featured for options to be checked when they're
allowed, rather than when disallowed.
2014-08-07 05:16:05 -07:00
Chris Robinson 6048d70232 Add a 48khz HRTF data set
Made by simply using makehrtf's resampling option with the 44.1hz KEMAR data
set.
2014-08-07 04:26:06 -07:00
Chris Robinson e64d0f83cd Disable the autowah effect
There's apparently some issues with it causing noise or killing the output. It
might be due to the per-sample changes being too harsh for the filter to keep
up with, but it's not something I can take care of in time for release.

This commit should be reverted after release when work on fixing it can resume.
2014-08-06 23:38:05 -07:00
Chris Robinson 23441be474 Make the DYNLOAD LoadFSynth function non-inline 2014-08-05 19:38:33 -07:00
Chris Robinson 951870b189 Enable large file support 2014-08-05 05:05:05 -07:00
Chris Robinson bda39c5038 Filter for relative HRTF data paths and add Add/Remove label texts 2014-08-05 04:56:51 -07:00
Chris Robinson 066a48c5fb Update alsoft-config
Adds Compressor effect and SSE 4.1 for exclusion, and alters the HRTF tables
tooltip to refer the the default data sets instead of the built-in set.
2014-08-05 02:43:04 -07:00
Chris Robinson 7b4a2335eb Load fluidsynth dynamically when possible 2014-08-05 01:48:30 -07:00
Chris Robinson 451b780e08 Fix some lock ordering to avoid potential deadlocks 2014-08-03 00:56:58 -07:00
Chris Robinson f5194a9d8e Use an ATOMIC_INIT macro instead of ATOMIC_LOAD_UNSAFE 2014-08-03 00:26:21 -07:00
Chris Robinson 659b340716 Use the right type for atomic compare-exchange 2014-08-01 02:47:46 -07:00
Chris Robinson 1c1e878be7 Add some casts for inline assembly atomics
And remove an unnecessary void cast
2014-08-01 02:40:25 -07:00
Chris Robinson 87423f046e Use atomics for the device and context list heads 2014-08-01 02:04:40 -07:00
Chris Robinson 15a58eb383 Make the source's buffer queue head and current queue item atomic 2014-07-31 07:20:36 -07:00
Chris Robinson cdfc5a4d31 Remove an unused function 2014-07-31 04:44:39 -07:00
Chris Robinson ce046d2f03 Rename ATOMIC_COMPARE_EXCHANGE to ATOMIC_COMPARE_EXCHANGE_STRONG 2014-07-31 04:34:46 -07:00
Chris Robinson 6ce464aed8 Avoid a CPU memory fence, and better order memory barriers to accesses
Code produced by GCC 4.9's C11 atomic implementation does not seem to add a
CPU memory fence even with memory_order_seq_cst. Unnecessary memory fences
will be a detriment to performance, so they should only be added if needed.
2014-07-31 04:19:33 -07:00
Chris Robinson 7c847e62c3 Change Windows-based atomics for non-C99 compilers 2014-07-27 19:34:32 -07:00
Chris Robinson 38e8dc8540 Use a full memory barrier for Windows 2014-07-27 18:31:10 -07:00
Chris Robinson 6864053eee Use pulseaudio's write callback to signal a mixer proc wakeup 2014-07-26 22:04:26 -07:00
Chris Robinson 0ad3f61351 Don't try to use internal visibility
A number of functions are passed as callbacks to external libraries, which
internal visiiblity doesn't allow.
2014-07-26 17:48:36 -07:00
Chris Robinson d3980bdebc Always set the active source's update method
If the source is stopped, changes its buffer, then played again quickly, the
source will never be removed from the active source list causing the update
method to remain as it was. If the buffer was changed between mono and multi-
channel, this causes it to use the wrong method.
2014-07-26 16:41:39 -07:00
Chris Robinson 531c0d8e6b Explicitly pass the address of atomics and parameters that can be modified 2014-07-26 03:00:49 -07:00
Chris Robinson a3dbe08c8b Support C11 atomics 2014-07-23 06:36:34 -07:00
Chris Robinson e4b779c492 Use generic atomics in more places 2014-07-22 18:57:51 -07:00
Chris Robinson a3b1d4a5e2 Implement RefCount as a generic atomic type 2014-07-22 18:18:14 -07:00
Chris Robinson 5a339a2a5b Add macros for generic atomic functionality 2014-07-22 00:20:28 -07:00
Chris Robinson 7b41ed7ec4 Check the current directory first for data files 2014-07-21 04:42:45 -07:00
Chris Robinson 0ff4a91442 Make some functions static 2014-07-20 01:27:33 -07:00
Chris Robinson 8592b9371a Use the UNUSED macro instead of a void cast 2014-07-19 20:46:41 -07:00
Chris Robinson 0c31ccd456 Stop trying to read samples if there was an error 2014-07-19 20:46:12 -07:00
Chris Robinson 9370fea359 Trace when a soundfont buffer goes unused 2014-07-19 14:18:52 -07:00
Chris Robinson 36381f3164 Load the default soundfont as a comma-separate list of filename
This allows multiple soundfont files to be "patched" together to create a
single soundfont. For instance a GM soundfont with a separate soundfont for
GS-only additions.
2014-07-19 13:44:02 -07:00
Chris Robinson 994c3f00e5 Keep existing presets when loading in a new soundfont
Note that alLoadSoundfontSOFT doesn't currently allow using a soundfont with
existing presets. This is for being able to load and stack multiple soundfonts
for the default soundfont.
2014-07-19 12:42:52 -07:00
Chris Robinson 85e135beea Use a macro to specify the fourcc formatters 2014-07-18 18:56:26 -07:00
Chris Robinson 17682cb0ce Explicitly include libavutil/channel_layout.h for the channel layout stuff 2014-07-18 01:21:42 -07:00
Chris Robinson 23cae7783d Properly scale the first HRTF pass-through coefficient
Coefficients are scaled by 32767. For pass-through, this is attenuated by
sqrt(0.5) to maintain a consistent perceived volume.
2014-07-17 18:02:23 -07:00
Chris Robinson 8635733d59 Fix typo (overriden -> overridden) 2014-07-17 10:22:58 -07:00
Chris Robinson 15d7ed2f0d Cleanup some HRTF code
Use loops instead of duplicating code, rewrite some lines to be clearer.
2014-07-16 13:26:47 -07:00
Chris Robinson 0d3b18b17d Fix omni-directional moving HRTF coeffs 2014-07-14 09:15:12 -07:00
Chris Robinson f4cdecebcf Add a source radius property that determines the directionality of a sound
At 0 distance from the listener, the sound is omni-directional. As the source
and listener become 'radius' units apart, the sound becomes more directional.

With HRTF, an omni-directional sound is handled using 0-delay, pass-through
filter coefficients, which is blended with the real delay and coefficients as
needed to become more directional.
2014-07-11 00:03:13 -07:00
Chris Robinson c5af088b5f Access the result macro parameter only once 2014-07-06 22:11:29 -07:00
Chris Robinson f4f1c1eeed Rename some functions 2014-07-06 09:21:38 -07:00
Chris Robinson 8dec92531b Store 4 modulators per map entry 2014-07-06 09:06:35 -07:00
Chris Robinson dc76013126 Regroup and reorganize some macros 2014-07-06 08:05:35 -07:00
Chris Robinson 23979ac648 Use VECTOR_FIND_IF instead of a manual loop 2014-07-06 05:16:44 -07:00
Chris Robinson f809d3c81a Allow ALsoundfont_deleteSoundfont to handle multiple buffers 2014-07-06 05:00:05 -07:00
Chris Robinson d0a64fe191 Don't require pre-declaring vector types 2014-07-06 03:27:39 -07:00
Chris Robinson 5de7271bcd AL_SOFT_source_length is complete 2014-07-05 04:25:37 -07:00
Chris Robinson ad92181a26 Don't set modulators that have no destination 2014-07-05 03:55:45 -07:00
Chris Robinson ff915534cd Avoid aliasing an int array 2014-07-05 02:01:36 -07:00
Chris Robinson b88aaaf1bc Fix a couple checks 2014-07-05 01:47:08 -07:00
Chris Robinson 47f5e710c2 Make some more functions static 2014-07-05 01:23:06 -07:00
Chris Robinson 5afc29f65d Use a helper function to check valid MIDI controller inputs 2014-07-04 22:08:24 -07:00
Chris Robinson f667782df2 Set the 'valid' field when we have a valid buffer pointer 2014-07-04 06:57:58 -07:00
Chris Robinson 3f45c00779 Move an inline definition to a more appropriate source 2014-07-04 00:22:27 -07:00
Chris Robinson 17f79ea43e Make a function static 2014-07-04 00:00:39 -07:00
Chris Robinson fda5bc2bd2 AL_SOFT_MSADPCM is functionally complete 2014-07-03 20:59:44 -07:00
Chris Robinson 5303ee2588 Avoid an undefined allocation of 0 bytes 2014-07-01 23:32:06 -07:00
Chris Robinson cb726d87ce Simplify setting a fontsound link 2014-07-01 23:24:11 -07:00
Chris Robinson fec1fec373 Check that a fontsound is NOT null before deleting it 2014-07-01 22:52:29 -07:00
Chris Robinson 347d8f94e8 Remove an unused variable 2014-07-01 22:52:06 -07:00
Chris Robinson 8b1b52a687 Remove an unnecessary cast 2014-07-01 22:27:53 -07:00
Chris Robinson 56bb8689d4 Fix preset zone instrument header check 2014-07-01 19:43:20 -07:00
Chris Robinson 3c6752e765 Print SF2 text INFO chunks 2014-07-01 00:36:44 -07:00
Chris Robinson c06bb88756 Warn about all unhandled soundfont generators 2014-06-30 04:03:50 -07:00
Chris Robinson 8577df76c4 Check the last preset and instrument properties within the loop 2014-06-30 03:52:10 -07:00
Chris Robinson 22982948cf Standardize some New/Delete methods 2014-06-30 00:10:40 -07:00
Chris Robinson 8f8898b7b0 Remove an unused macro 2014-06-29 04:35:35 -07:00
Chris Robinson 8176d2c058 Load soundfont samples into an ALbuffer
Also remove ALsoundfont's now-unneeded sample storage functions and struct
fields.
2014-06-29 02:04:05 -07:00
Chris Robinson 389a2f7b4b Store and use an ALbuffer for samples in an ALfontsound
The fontsound still maintains its own start, end, and loop offsets, so that the
same buffer may be shared between multiple/all fontsounds. Ideally a single
buffer should be used for all fontsounds to avoid memory fragmentation and help
CPU caching, although higher quality soundfonts may need more memory than a
single buffer can hold.
2014-06-29 00:47:29 -07:00
Chris Robinson d19e42a723 Don't require MIDI sysex data to have the high bit clear 2014-06-26 04:35:51 -07:00
Chris Robinson b9462bbe3c Only set the needed HRTF coefficients 2014-06-21 19:17:39 -07:00
Chris Robinson 81b3395b41 Avoid negating 'negative' variable names 2014-06-20 23:48:58 -07:00
Chris Robinson be903d67b8 Don't pass the device to HRTF methods 2014-06-20 16:43:14 -07:00
Chris Robinson fb25a70f95 Don't overwrite the loopback device format with the HRTF format 2014-06-20 15:48:09 -07:00
Chris Robinson 0fd215cb84 Remove unused variables 2014-06-13 22:50:14 -07:00
Chris Robinson 57c683f822 Get the mixer and resampler functions when needed 2014-06-13 16:07:25 -07:00
Chris Robinson a8deaf12f4 Combine the direct and send mixers 2014-06-13 13:34:19 -07:00
Chris Robinson c29eb63489 Combine some dry and wet path types 2014-06-13 11:42:04 -07:00
Chris Robinson 19ec7b2ad2 Pre-apply the crossfeed filter gain to the input sample coefficients 2014-06-12 09:40:30 -07:00
Chris Robinson 4c706f59d9 Use floats for the BS2B filter 2014-06-11 09:57:48 -07:00
Chris Robinson dfded9595c Make bs2b_cross_feed inline 2014-06-10 12:46:58 -07:00
Chris Robinson d0fac3fe1d Don't try to set fp precision with __control87_2 or _controlfp 2014-06-08 23:39:52 -07:00
Chris Robinson c07fb7b45c Print CPU extensions that are unavailable but requested 2014-06-08 06:31:36 -07:00
Chris Robinson 8ca1f4f371 Open and close the file in the main thread in alffplay
This avoid problems with the file being closed while a video refresh is still
scheduled.
2014-06-08 03:26:34 -07:00
Chris Robinson be66692f94 Require SSE for SSE2, and SSE2 for SSE4.1 2014-06-07 23:28:32 -07:00
Chris Robinson 09d5475aa6 Update the disable-cpu-exts config option description 2014-06-07 06:08:22 -07:00
Chris Robinson 2ff266ca83 Update a couple sources with the proper author 2014-06-06 07:15:22 -07:00
Chris Robinson 6d1622dc68 Move InitiatePositionArrays to mixer_defs.h 2014-06-06 07:15:22 -07:00
Timothy Arceri fc0be88c0f Add SSE2 and SSE4.1 linear resamplers
Currently the only way SSE 4.1 is detected is by using __get_cpuid, i.e. with
GCC. Windows' IsProcessorFeaturePresent does not report SSE4.1 capabilities.
2014-06-06 07:15:00 -07:00
Chris Robinson 3b2fcb3ef6 Avoid a loop when updating the source position variables 2014-06-02 19:19:22 -07:00
Chris Robinson d2c0a43498 Add an ffmpeg-based example player
This example shows proper timing and A/V synchronization with an OpenAL stream.
Requires the in-progress AL_SOFTX_source_length extension to avoid manually
keeping track of the buffer queue length.
2014-06-02 17:33:11 -07:00
Chris Robinson 933f51a8bf Only define struct timespec if _TIMESPEC_DEFINED isn't set
This matches what the mingw-w64 headers define with the struct.
2014-05-31 17:41:10 -07:00
Chris Robinson 1d45c439b8 Add extern "C" to common headers. 2014-05-29 04:22:30 -07:00
Chris Robinson 73614f228e Add methods to exchange and compare-exchange RefCount values 2014-05-27 15:48:15 -07:00
Chris Robinson fd62868c17 Avoid unnecessary local variables 2014-05-27 15:32:38 -07:00
Chris Robinson f0b65aa6b7 Implement condition variables for Windows 2014-05-27 05:22:53 -07:00
Chris Robinson 2d2bc25fd0 Add an extension string for the in-progress source length extension
This is the extension that allows you to get the full length of the source's
buffer queue.
2014-05-26 04:07:50 -07:00
Chris Robinson b6e1042e8c Implement condition variables (POSIX only!)
Windows requires Vista or newer to get the CONDITION_VARIABNLE API, but we
currently only require XP.
2014-05-26 03:52:55 -07:00
Chris Robinson fd5e7f1466 Don't print an ERR if pulse fails to get latency info due to no data
It just means it was called too quickly after starting.
2014-05-26 03:41:33 -07:00
Chris Robinson 0ec0f7561c Add an option to get the length of a source's full queue
This simplifies keeping track how much a source has buffered in its queue,
which reduces a bunch of unnecessary book keeping the app would have to do.
2014-05-25 16:16:55 -07:00
Chris Robinson 3d6ffa282d Don't resume the backend if there's no contexts 2014-05-24 17:19:52 -07:00
Chris Robinson 4ca561acd3 Move the active source's offset out of the direct params 2014-05-24 16:55:10 -07:00
Chris Robinson 13eac2552e Update the examples to use SDL2
This should make it easier to build the examples on 64-bit, where there are no
premade dev libs for SDL1 on 64-bit mingw. FindSDL_sound.cmake has been
updated to accept SDL or SDL2.
2014-05-23 12:14:51 -07:00
Chris Robinson 5ef5d218c4 Mark a few more functions as const 2014-05-23 10:00:58 -07:00
Chris Robinson 3fc9791747 Rename CONST_FUNC and PRINTF_STYLE, and fix non-GNU AL_PRINT 2014-05-23 08:30:33 -07:00
Chris Robinson 7d997277a0 AL_SOFT_block_alignment is now considered done 2014-05-22 12:27:07 -07:00
Chris Robinson a48f5d26fd Ensure a proper amount of new elements are being reserved when inserting 2014-05-22 12:16:22 -07:00
Chris Robinson 9008bcbe54 Include strings.h if it exists for strncasecmp 2014-05-22 11:33:09 -07:00
Chris Robinson 2729a1549b Add a needed header for the CoreAudio backend 2014-05-22 11:29:26 -07:00
Chris Robinson e32e3df3aa Use the first non-0-length buffer when starting a source 2014-05-22 11:08:21 -07:00
Chris Robinson 85e990e915 Don't try to use the non-standard alloca.h
Variable-length arrays are C99 standard and are preferred over alloca. The only
compiler that needs alloca (MSVC) has it in malloc.h.
2014-05-22 08:46:13 -07:00
Chris Robinson 2b3550b61c Use an unsigned type for the win32 size_t formatter 2014-05-22 08:02:39 -07:00
Chris Robinson 100c059157 Mark some functions as const 2014-05-22 07:40:22 -07:00
Chris Robinson ecdfcdbfa5 The lower value of the gain vector contains the closest target value 2014-05-21 21:20:44 -07:00
Chris Robinson 2e38de349c Don't clear the current and step gain values when updating a source 2014-05-21 16:32:24 -07:00
Chris Robinson 6ea050cc6c Use the current buffer item for static sources too 2014-05-21 15:37:22 -07:00
Chris Robinson 4b433c900e Copy samples if needed in the 'copy' resampler 2014-05-21 15:24:40 -07:00
Chris Robinson dd2e6b7902 Properly process all samples with a bandpass filter 2014-05-21 14:59:21 -07:00
Chris Robinson e650db98f7 Use the correct input for HRTF mixing 2014-05-21 14:48:46 -07:00
Chris Robinson 4a8d38c19a Update the active source's direct and send properties after each mix 2014-05-21 14:47:25 -07:00
Chris Robinson f313ce2a96 Add some asserts to verify block alignment for conversion 2014-05-20 09:16:54 -07:00
Chris Robinson cd983245f1 Return a sample pointer from resamplers
Both resampling and filtering now avoid copying samples when they no-op.
2014-05-19 05:46:01 -07:00
Chris Robinson 8e04a8a022 Put per-channel filter properties together 2014-05-19 02:24:31 -07:00
Chris Robinson 7b782f6afa Return a sample pointer from DoFilters
This allows us to avoid copying samples when no filtering is needed. Doing the
same for resampling would require another temporary buffer in the device.
2014-05-19 01:54:52 -07:00
Chris Robinson ef9dfe3772 Move an HRTF mixer parameter and shorten a couple variable names 2014-05-18 11:05:38 -07:00
Chris Robinson 9317ec59b9 Don't pass the SendParams to the wet-path mixer 2014-05-18 10:35:11 -07:00
Chris Robinson c9083d04fa Don't pass the DirectParams to the dry-path mixer 2014-05-18 10:24:07 -07:00
Chris Robinson 5a1abf6918 Use different parameters for HRTF mixers 2014-05-18 09:31:08 -07:00
Chris Robinson 29b5dae6aa Pass some DirectParams as function parameters 2014-05-18 08:59:10 -07:00
Chris Robinson bd2721dc7a Use _mm_setr_ps instead of _mm_set_ps
Apparently _mm_set_ps loads in reverse order compared to _mm_load_ps, so
_mm_setr_ps should give what we really want.
2014-05-18 06:35:33 -07:00
Chris Robinson a5631e05cc Add a ALfilterState method to process multiple samples at once 2014-05-18 06:23:20 -07:00
Chris Robinson cd53a4b74c Reset filter properties when setting a null filter type 2014-05-17 08:05:49 -07:00
Chris Robinson 190ab90c0d Support the band-pass filter 2014-05-17 08:04:14 -07:00
Chris Robinson 82dd2d875e Apply high-pass source filters as needed 2014-05-17 07:54:25 -07:00
Chris Robinson 3a26ebef0b Implementing handling high-pass filter properties 2014-05-17 07:29:50 -07:00
Chris Robinson 0b5b39d5e6 Add a flag to specify when the low-pass filter needs to apply 2014-05-17 07:17:48 -07:00
Chris Robinson 70f1e54068 Use logarithmic adjustment for the gain in the autowah effect 2014-05-17 03:08:04 -07:00
Chris Robinson 1efddac3db Document the different filter types, and combine some split lines 2014-05-17 02:09:43 -07:00
Chris Robinson c5b25ba2a7 Rename freq_scale parameter to freq_mult 2014-05-17 01:32:55 -07:00
Chris Robinson a11e1c0858 Ensure that LoopEnd > LoopStart
For the benefit of Clang's static analysis, which doesn't know that a
static source will always have a valid buffer and a buffer must have a
non-0 loop range.
2014-05-15 01:44:29 -07:00
Chris Robinson fdcdda2ed3 Initialize a pointer to NULL instead of a string 2014-05-15 01:39:42 -07:00
Chris Robinson 028bd9767c Don't bother stripping whitespace from comments 2014-05-15 01:37:01 -07:00
Chris Robinson 042003896f Early-out when outN is 0 2014-05-15 01:32:32 -07:00
Chris Robinson 6dcd4fec7d Remove some unnecessary casts 2014-05-15 01:21:22 -07:00
Chris Robinson ef1b34dcd2 Initialize some variables when declaring them 2014-05-15 01:14:31 -07:00
Chris Robinson f0797e27f3 Initialize newformat to AL_NONE instead of a valid format 2014-05-15 01:11:38 -07:00
Chris Robinson 16d3316f70 Use an enum for the chorus and flanger waveforms 2014-05-14 23:51:24 -07:00
Chris Robinson a6974a6c83 Don't try to read the internal capture buffer into itself 2014-05-14 21:20:28 -07:00
Chris Robinson a1fbb434e8 Remove a dead assignment 2014-05-14 05:27:16 -07:00
Chris Robinson debd5346fb Add a couple asserts to ensure a proper buffer
It should not be possible for a playing or paused source to not have a
valid buffer, but Clang's static analyzer doesn't know that. Hopefully
an assert will convince it.
2014-05-14 03:40:01 -07:00
Chris Robinson f311f74001 Avoid freeing an in-use capture buffer
When stopping, ALSA may capture into its own storage buffer. Do not free
the storage buffer if it first reads from it.
2014-05-14 03:22:42 -07:00
Chris Robinson 1d2504d12e Make RefCount a non-integer type
It should only be accessed through the appropriate functions to ensure proper
atomicity.
2014-05-14 02:47:07 -07:00
Chris Robinson 4454ae25c7 Add HF Reference as a filter property 2014-05-14 01:24:18 -07:00
Chris Robinson 3582a44dff Make LOWPASSFREQREF a float value 2014-05-11 10:09:52 -07:00
Chris Robinson 343200d229 Store the filter reference frequency in the source 2014-05-11 10:07:17 -07:00
Chris Robinson 58235bec17 Update the source send target gains properly 2014-05-11 09:45:07 -07:00
Chris Robinson b89cc3417b Avoid locking the mixer when unqueueing buffers 2014-05-11 03:52:22 -07:00
Chris Robinson 9f8615c670 Avoid accessing the source's buffer queue head multiple times 2014-05-11 03:11:35 -07:00
Chris Robinson 851a917b03 Use a struct to store the source's direct gain/gainhf properties 2014-05-11 01:40:44 -07:00
Chris Robinson e78acce652 Don't mix old- and new-style FIND_PACKAGE_HANDLE_STANDARD_ARGS calls
Some (all?) versions of cmake seem to get a bit confused when an old-style
FIND_PACKAGE_HANDLE_STANDARD_ARGS call fails, and the scripts attempt a new-
style call later on. It continues to think it's using old-style, acting as if
REQUIRED_VARS is the message and looks for a VERSION_VAR variable.
2014-05-10 09:34:16 -07:00
Chris Robinson ddd1550a8b Avoid locking the mixer while queueing buffers onto a source. 2014-05-10 08:55:28 -07:00
Chris Robinson e9297d9744 Mark the buffer queue pointers volatile 2014-05-10 08:03:53 -07:00
Chris Robinson 3e28fb33a3 Add a missing pointer init 2014-05-10 07:57:35 -07:00
Chris Robinson 9e25ea8666 Update the output buffer pointer in the Write_* methods 2014-05-10 07:52:02 -07:00
Chris Robinson 67b4bd1031 Add a couple consts 2014-05-10 07:25:05 -07:00
Chris Robinson 9642bf637d Explicit init the source queue and current_buffer pointers 2014-05-10 06:32:39 -07:00
Chris Robinson a455704148 Use a RWLock to help protect the source's buffer queue
In some instances this allows to to remove the device/mixer lock, or reduce how
long it's held.
2014-05-10 05:07:13 -07:00
Chris Robinson eebde08e65 Don't explicitly store the BuffersInQueue 2014-05-10 03:33:41 -07:00
Chris Robinson c4383b65e2 Store the current buffer queue item, rather than played buffer count 2014-05-10 03:21:40 -07:00
Chris Robinson eea46f268d Avoid checking the previous buffer multiple times 2014-05-10 02:01:38 -07:00
Chris Robinson bf97f58edb Append the number of bits, not bytes, to types
Also use ALuint64SOFT from alext.h for uint64
2014-05-08 00:28:34 -07:00
Chris Robinson 8b7c71e20e Always use unsigned int for RefCount 2014-05-07 23:49:06 -07:00
Chris Robinson bd88e1743a Build a common static lib for reusable code 2014-05-07 19:51:42 -07:00
Chris Robinson a2bddb7b40 Move RWLock and UIntMap implementations to common
This should make the code in common completely self-reliant.
2014-05-07 19:16:49 -07:00
Chris Robinson 3e274c3a57 Make sure FILETIME and ULARGE_INTEGER sizes match 2014-05-07 16:12:34 -07:00
Chris Robinson 1c01e94237 Move the static_assert definition to its own header 2014-05-07 02:28:25 -07:00
Chris Robinson d8d609b940 Use standard types for the RWLock 2014-05-07 01:03:06 -07:00
Chris Robinson 38b98de78e Check for C99 _Bool support 2014-05-06 23:10:50 -07:00
Chris Robinson 1aff37114a Move atomic method definitions to a separate common source 2014-05-06 19:07:40 -07:00
Chris Robinson fa12855d19 Move threads.c to a separate source dir
This will eventually serve to build a static lib of common wrapper methods,
such as threads, mutexes, atomics, etc.
2014-05-06 18:57:42 -07:00
Chris Robinson 0ea979a262 Move some headers to include/
Note, these are not installed. Only headers in include/AL/ are installed.
2014-05-06 18:29:53 -07:00
Chris Robinson 1a76a3238c Use gettimeofday if clock_gettime isn't available 2014-05-06 17:46:17 -07:00
Chris Robinson cbb94405db Test _Alignas with 16 instead of 4 2014-05-05 14:21:09 -07:00
Chris Robinson 2edd047178 C11's alignas is also sufficient for SSE aligning 2014-05-05 13:53:07 -07:00
Chris Robinson 2bc16e9947 Add a cast to silence an MSVC warning 2014-05-04 11:50:58 -07:00
Chris Robinson a48d235ef4 Trace skipped info sub-chunks 2014-05-04 01:19:09 -07:00
Chris Robinson bca7c682f1 Use ALuint for the amount to skip 2014-05-04 01:00:21 -07:00
Chris Robinson 2a7f3c015e Don't use the next power of two when duplicating config values
Speed isn't terribly important here, and reallocs should be extremely rare.
2014-05-04 00:37:25 -07:00
Chris Robinson db90985f6a Remove unnecessary ifdefs
mixer_sse.c and mixer_neon.c are only compiled when the relavent headers are
found anyway.
2014-05-04 00:19:55 -07:00
Chris Robinson a2bb4c3f13 Always use the current gains when mixing
The current gain gets explicitly set to the target when the stepping is
finished to ensure the target is still used. This way, however, will allow for
asynchronously 'canceling' a fade by setting the counter to 0.
2014-05-04 00:13:19 -07:00
Chris Robinson d066c7b124 Better pack HRTF mixing properties 2014-05-03 18:59:26 -07:00
Chris Robinson b2e533fbfc Clamp the current and target gain lower bound to epsilon
Should give a bit more wiggle room for the gain stepping to get lower than the
silence threshold.
2014-05-03 17:51:06 -07:00
Chris Robinson 34e96aef60 Make sure all gain steps are applied with the SSE and Neon mixers 2014-05-03 17:24:46 -07:00
Chris Robinson 2660ecfd4a Revert e9aee578a7
The vector iterator needs to be the start of the Data array even if the vector
itself is NULL, or else insertion can have a negative insert position.
2014-05-02 11:48:55 -07:00
Chris Robinson 3bdb3f9db7 Iniitialize some mmdevapi backend fields in the constructor 2014-05-02 10:47:31 -07:00
Chris Robinson d90f684f16 Use a backup in case pthread_mutex_timedlock isn't available 2014-05-01 14:15:31 -07:00
Chris Robinson 804b08e0ca Use ALboolean for al_string_empty's return type 2014-04-30 12:53:52 -07:00
Chris Robinson f150676873 Add a helper VECTOR_FOR_EACH macro 2014-04-30 12:30:02 -07:00
Chris Robinson f9d70aa9ef Use _mm_set_ps() to set an __m128 instead of {} 2014-04-26 06:31:31 -07:00
Chris Robinson 149df6d4db Convert the mmdevapi backend to the new backend API 2014-04-25 09:26:53 -07:00
Chris Robinson 28e9f0db8c Use a vector for mmdevapi device lists 2014-04-24 04:02:05 -07:00
Chris Robinson 83970369e0 More device list cleanup cleanup 2014-04-24 02:33:54 -07:00
Chris Robinson 7dd4a2348f Use a helper function to clear PulseAudio device lists 2014-04-24 01:38:24 -07:00
Chris Robinson a4cf378af8 Use a helper method to clear winmm device lists 2014-04-24 01:25:26 -07:00
Chris Robinson 9af8e10c20 Avoid using superfluous LP* types 2014-04-23 10:08:33 -07:00
Chris Robinson 0b527621a5 Use a RefCount for counting committed winmm buffers 2014-04-23 05:08:17 -07:00
Chris Robinson 8fd224f841 Avoid forward-declaring backend vtables 2014-04-23 03:52:05 -07:00
Chris Robinson 420599f8e3 Avoid using assert() in createBackend 2014-04-23 02:18:07 -07:00
Chris Robinson 7fed6383c0 Include FindALSA.cmake
Older versions of CMake don't seem to have it.
2014-04-23 02:12:34 -07:00
Chris Robinson ada4868d86 Properly handle HAVE_DYNLOAD in the dsound backend 2014-04-22 08:55:17 -07:00
Chris Robinson a4fbe158d4 Avoid some superfluous types 2014-04-22 08:44:06 -07:00
Chris Robinson 84afe4fb40 Simplify the cmake backend handling a bit 2014-04-22 07:58:25 -07:00
Chris Robinson d5ac11c87f Fix adding backend include directories 2014-04-22 07:21:19 -07:00
Chris Robinson f6ad3ef221 Use a helper to return mmdevapi message thread responses 2014-04-22 06:13:49 -07:00
Chris Robinson e9aee578a7 Avoid dereferencing a NULL pointer 2014-04-21 23:10:09 -07:00
Chris Robinson 0d2521e30e Use a vector to store the ALSA device lists 2014-04-21 23:01:50 -07:00
Chris Robinson df3c54a4bf Use al_string for ALSA's device map 2014-04-21 20:53:27 -07:00
Chris Robinson ad71565e45 Trace the device name being opened in ALSA and PulseAudio 2014-04-21 20:26:29 -07:00
Chris Robinson ca1008571e Use the althrd methods in winmm 2014-04-21 09:35:17 -07:00
Chris Robinson d856183c4b Only declare backend options when the backend is available 2014-04-20 22:42:53 -07:00
Chris Robinson dbe0897c7f Use the stored format block align instead of calculating it 2014-04-20 22:29:54 -07:00
Chris Robinson 5215b9cad2 Use a vector for the PulseAudio DevMaps 2014-04-20 06:29:36 -07:00
Chris Robinson b435a8e01b Use an al_string in the PulseAudio backend instead of char* 2014-04-20 05:55:52 -07:00
Chris Robinson 32a2f95885 Convert the DSound backend to the new API 2014-04-19 22:54:21 -07:00
Chris Robinson bb969c3ccc Add a SZFMT macro for a size_t string formatter 2014-04-19 09:42:03 -07:00
Chris Robinson 043e25b602 Don't link with libwinmm unless WinMM is enabled
We don't use timeGetTime for timing anymore, so winmm only needs to be linked
when the winmm backend is enabled.
2014-04-19 08:50:41 -07:00
Chris Robinson 96c559fbef Use a find module to look for DirectSound 2014-04-19 07:49:27 -07:00
Chris Robinson 887763e41c Use find cmake modules for more backends 2014-04-19 06:35:14 -07:00
Chris Robinson 1d266aa834 Add a GCC-specific STATIC_UPCAST macro that checks the object type
The check is compile time, and is functionally identical to the old/alternate
version.
2014-04-19 03:11:23 -07:00
Chris Robinson 59fc9aac0e Use C11 alignas when available 2014-04-19 02:11:04 -07:00
Chris Robinson 8badd3740e Dont bother trying _alloca
We prefer C99 variable-length arrays, and other systems (including MSVC9) don't
have an issue with alloca.
2014-04-19 01:10:12 -07:00
Chris Robinson 1d69ec9ce1 Set -D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 earlier 2014-04-19 01:02:36 -07:00
Chris Robinson 9b685bace5 Use FindALSA.cmake to look for ALSA
Also, only provide the ALSA_BACKEND_ALSA option if it's available
2014-04-19 00:52:19 -07:00
Chris Robinson 2eda15fc77 Only define SSE, Neon, and FluidSynth options if they're available 2014-04-18 23:20:27 -07:00
Chris Robinson c041a99f72 Simplify some error checking 2014-04-18 06:54:18 -07:00
Chris Robinson b8d56190d1 Check pthread_mutex_unlock for errors 2014-04-18 06:39:46 -07:00
Chris Robinson cb3315f9d3 Remove unnecessary includes 2014-04-18 02:35:16 -07:00
Chris Robinson b979a8005f Alter the al_fopen macro to not directly take parameters 2014-04-18 02:25:07 -07:00
Chris Robinson 1353cb0d88 Rename AL_ONCE_INIT to AL_ONCE_FLAG_INIT 2014-04-18 02:21:58 -07:00
Chris Robinson 579e7c10c2 Check TlsSetValue for error 2014-04-17 22:57:16 -07:00
Chris Robinson 6c8bf9ec42 Rename althread_once to be more C11-like 2014-04-17 21:39:51 -07:00
Chris Robinson 20e5ec18e1 Handle the lib name as UTF-8 2014-04-17 21:17:48 -07:00
Chris Robinson 5abefaed0a Use the thread ID for althrd_t on Windows 2014-04-17 21:01:54 -07:00
Chris Robinson 36df67f546 Rename SetThreadName to althrd_setname 2014-04-17 20:41:32 -07:00
Chris Robinson 528c8c5e77 Check explicitly for pthread_mutexattr_setkind_np before use 2014-04-17 19:01:12 -07:00
Chris Robinson 8a00c24012 Fix SetThreadName for 64-bit MSVC builds 2014-04-17 09:22:57 -07:00
Chris Robinson 4b5e8b8c40 Don't inline al_nssleep 2014-04-17 09:14:03 -07:00
Chris Robinson d1f1a1d056 Make and use a C11-like altimespec_get wrapper function 2014-04-17 09:03:57 -07:00
Chris Robinson 47f5c436c8 Fix a signed-unsigned comparison warning and clarify a comment 2014-04-17 01:24:03 -07:00
Chris Robinson fbb4cbbe01 Keep TlsDestructors within threads.c
This basically makes the threads implementation self-contained in threads.c and
threads.h, except for the UIntMap/RWLock implementations.
2014-04-17 01:09:25 -07:00
Chris Robinson e5d39a5f4c Don't use DllMain to call altss destructors 2014-04-17 00:56:02 -07:00
Chris Robinson c3b1c31d9b Rename althread_key_ wrappers to altss_ and move it to threads.h/c 2014-04-17 00:11:12 -07:00
Chris Robinson 8cc3d05949 Fix some almtx_ return values 2014-04-16 08:21:45 -07:00
Chris Robinson 2149ccd985 Remove almtx_normal and almtx_errorcheck 2014-04-16 08:00:54 -07:00
Chris Robinson c6dd479229 Make sure the duration given to althrd_sleep is valid 2014-04-16 07:52:43 -07:00
Chris Robinson 8a51995cfa Bump _WIN32_WINNT to 0x0502 (XP SP2) for GetThreadId 2014-04-16 07:30:18 -07:00
Chris Robinson 959d75edc8 Fix althrd_sleep return value 2014-04-16 07:18:28 -07:00
Chris Robinson b020dd13fd Avoid using a Sleep() wrapper 2014-04-16 06:59:44 -07:00
Chris Robinson 184cf30cf7 Use althrd_yield instead of alsched_yield 2014-04-16 06:18:24 -07:00
Chris Robinson d124aee4d7 Remove the old thread wrappers for the new ones 2014-04-16 06:11:40 -07:00
Chris Robinson 505ef82246 Move the threads and mutex wrappers to threads.c 2014-04-16 05:40:40 -07:00
Chris Robinson e8517d8600 Fix Windows' almtx_timedlock 2014-04-16 05:32:55 -07:00
Chris Robinson 18ab9cbbdd Implement a C11-like thread wrapper and use it in mmdevapi and pulseaudio 2014-04-16 05:19:34 -07:00
Chris Robinson 29cb5058c0 Use a C11-like mutex wrapper instead of CRITICAL_SECTIONs 2014-04-16 01:39:11 -07:00
Chris Robinson 9c70ca9da6 Avoid memory leak if preset ID lookup fails 2014-04-14 01:33:31 -07:00
Chris Robinson 7bc08bb08c Ensure VECTOR_ITER_BEGIN gives a pointer-to-type instead of an array-of-type 2014-04-14 00:58:45 -07:00
Chris Robinson e0d24f9da4 Use a helper to detect a path slash on Windows 2014-04-13 21:44:13 -07:00
Chris Robinson e615ea3cf9 Use VECTOR_INSERT to copy and append strings 2014-04-13 20:54:12 -07:00
Chris Robinson 219a0e6352 Add a GCC-specific VECTOR_INSERT
This version is capable of doing a compile-time type checks, to ensure the
objects being inserted are compatible with the vector data type. It should
otherwise be functionally identical.
2014-04-13 20:26:04 -07:00
Chris Robinson 0ef87227c1 Pass in the vector insertion point as a pointer 2014-04-13 18:42:41 -07:00
Chris Robinson cce9609b9e Avoid referencing the start iterator twice for vector insertion 2014-04-13 17:06:18 -07:00
Chris Robinson e76bc53d37 Insert all new effect slots into the active effect slots at once 2014-04-10 20:49:01 -07:00
Chris Robinson 90ae4b7c0f Add a VECTOR_INSERT method to insert a range of elements at once 2014-04-09 22:50:28 -07:00
Chris Robinson 023981acb9 Fix a NULL deref when cloning a 0-sized vector 2014-04-09 20:14:45 -07:00
Chris Robinson 1290f37750 Silence an MSVC warning about -1u 2014-04-07 13:55:22 -07:00
Chris Robinson add3013234 Fix the default XDG_DATA_DIRS paths 2014-04-07 13:24:51 -07:00
Chris Robinson 4f1104125b Use an al_string vector for winmm device names
Also now gets wchar device names, to properly convert to UTF-8
2014-04-07 12:43:19 -07:00
Chris Robinson c6821e5dd1 Use C11's static_assert when available 2014-04-07 11:48:28 -07:00
Chris Robinson f1a4b95b8c Use FIND_LIBRARY to look for the CoreAudio framework 2014-04-05 17:43:35 -07:00
Chris Robinson 5e0fc84f49 Make HRTF stepping values per-channel 2014-04-05 10:24:13 -07:00
Chris Robinson 569374da2c Properly compare al_strings 2014-04-03 13:46:09 -07:00
Chris Robinson 482fb37b68 Recognize NULL as an empty vector/string 2014-04-03 11:13:12 -07:00
Chris Robinson 570eb4e1a7 Don't pass the vector's capacity as a parameter to vector_reserve 2014-03-31 06:13:56 -07:00
Chris Robinson 48b472abb7 Use vectors for the dsound device lists 2014-03-31 02:48:01 -07:00
Chris Robinson 7b93e10f7a Use an al_string for the device name 2014-03-28 22:11:34 -07:00
Chris Robinson 7570195b09 strlen returns size_t 2014-03-28 08:19:45 -07:00
Chris Robinson d997be67fd Use al_string to handle mmdevapi and dsound device names 2014-03-28 07:59:47 -07:00
Chris Robinson af8fda8a4a Add an al_string type and use it for the device lists 2014-03-28 05:44:19 -07:00
Chris Robinson 2ca673cca2 Properly handle special folder names with extended characters 2014-03-28 01:21:05 -07:00
Chris Robinson 20886059fd Wrap fopen calls under Windows
The idea is that all filenames we deal with are encoded as UTF-8, but the
Windows functions that take a char string interpret it using the ANSI codepage.
So instead, we convert the UTF-8 string to a wchar string, and then use the
wchar functions for proper extended character filename support.
2014-03-28 00:37:42 -07:00
Chris Robinson 18620ab5e0 Check for ftw and _wfindfirst 2014-03-27 22:21:37 -07:00
Chris Robinson d11d061b2c Don't have VECTOR_INIT "return" anything 2014-03-27 17:21:23 -07:00
Chris Robinson 4f3e71e5b7 Reactivate the mmdevapi audio client and set the event handle on reset 2014-03-27 17:17:35 -07:00
Chris Robinson 045959e9c0 Use C99 VLA instead of alloca when available 2014-03-25 18:16:03 -07:00
Chris Robinson 03fd2b8266 Remove setState from the MidiSynth vtable 2014-03-23 18:34:49 -07:00
Chris Robinson de5c54db09 Remove an unused method 2014-03-23 17:47:58 -07:00
Chris Robinson cbb82647fb Remove an unnecessary conditional 2014-03-23 17:44:26 -07:00
Chris Robinson e2cb41dc61 Remove the last bits of the predictive sample processing 2014-03-23 17:33:57 -07:00
Chris Robinson 72986882f5 Remove the click removal buffers for auxiliary effect slots 2014-03-23 16:28:55 -07:00
Chris Robinson a25260ea8a Identity gain step is 1, not 0 2014-03-23 16:13:46 -07:00
Chris Robinson f5e10b9945 Fix Neon gain step loops 2014-03-23 16:13:13 -07:00
Chris Robinson 52deb557d5 Add gain stepping to the send mixers 2014-03-23 16:11:21 -07:00
Chris Robinson 83038c0dab Add some integer casts, and a range check 2014-03-23 15:22:37 -07:00
Chris Robinson 55f851093f Remove the now-unneeded click removal buffers for the device
They are still there for auxiliary sends. However, they should go away soon
enough too, and then we won't have to mess around with calculating extra
"predictive" samples in the mixer.
2014-03-23 07:31:33 -07:00
Chris Robinson 92433532fe Don't feed the HRTF mix to the click removal and pending click buffers
The coefficients (which control the volume and panning) already use stepping to
non-abruptly fade the mix.
2014-03-23 07:18:49 -07:00
Chris Robinson 81e049bd47 Step mixing gains per-sample for non-HRTF mixing
This fades the dry mixing gains using a logarithmic curve, which should produce
a smoother transition than a linear one. It functions similarly to a linear
fade except that

step = (target - current) / numsteps;
...
gain += step;

becomes

step = powf(target / current, 1.0f / numsteps);
...
gain *= step;

where 'target' and 'current' are clamped to a lower bound that is greater than
0 (which makes no sense on a logarithmic scale).

Consequently, the non-HRTF direct mixers do not do not feed into the click
removal and pending click buffers, as this per-sample fading would do an
adequate job of stopping clicks and pops caused by extreme gain changes. These
buffers should be removed shortly.
2014-03-23 06:57:00 -07:00
Chris Robinson 0ce0a88fd6 Move the step counter and moving flag to DirectParams 2014-03-23 03:03:03 -07:00
Chris Robinson b0d511a860 Store the HrtfState directly in the DirectParams 2014-03-23 02:45:50 -07:00
Chris Robinson cc599333a8 Don't try to use __restrict as a replacement for restrict
The compiler it's intended for, MSVC, can't use it anyway because of problems
it causes with __declspec(restrict).
2014-03-23 01:35:15 -07:00
Chris Robinson 9959972c7e Add a stub 'soft' MIDI synth handler
Eventually this one will be used to handle MIDI internally, using our own
mixers and resamplers.
2014-03-22 21:53:00 -07:00
Chris Robinson 842aeb888b Move some HRTF and mixer structs to alu.h 2014-03-22 02:39:57 -07:00
Chris Robinson 22f6eb18a2 Use a void* for the MidiSynth Delete method param 2014-03-22 01:49:03 -07:00
Chris Robinson d8bfd12d31 Use a void* for the backend Delete method param 2014-03-22 00:28:55 -07:00
Chris Robinson 0a030c2bd9 Use a void* for the effect state Delete method param 2014-03-21 23:56:18 -07:00
Chris Robinson f5ce73646c Avoid a size_t-to-ALuint conversion warning 2014-03-21 17:29:20 -07:00
Chris Robinson 8c33b4d742 Increase the vector reserve as needed when pushing in new items 2014-03-21 16:35:38 -07:00
Chris Robinson 983fa4630a Rename the vector's Max field to Capacity 2014-03-21 14:03:26 -07:00
Chris Robinson 40a0692a1c Use vectors for the GenModList 2014-03-21 02:41:46 -07:00
Chris Robinson ff63188cc2 Add a generic vector interface and use it for the active effect slots 2014-03-21 01:23:01 -07:00
Chris Robinson e6e3937fa9 Use flexible array members to pad the device and context structs
This helps avoid the convoluted math otherwise required to ensure the default
slot and listener, respectively, are aligned.
2014-03-20 14:49:46 -07:00
Chris Robinson 168149ce9d Keep track of the mix count
The purpose of this is to provide a safe way to be able to "swap" resources
used by the mixer from other threads without the need to block the mixer, as
well as a way to track when mixes have occurred. The idea is two-fold:

It provides a way to safely swap resources. If the mixer were to (atomically)
get a reference to an object to access it from, another thread would be able
allocate and prepare a new object then swap the reference to it with the stored
one. The other thread would then be able to wait until (count&1) is clear,
indicating the mixer is not running, before safely freeing the old object for
the mixer to use the new one.

It also provides a way to tell if the mixer has run. With this, a thread would
be able to read multiple values, which could be altered by the mixer, without
requiring a mixer lock. Comparing the before and after counts for inequality
would signify if the mixer has (started to) run, indicating the values may be
out of sync and should try getting them again. Of course, it will still need
something like a RWLock to ensure another (non-mixer) thread doesn't try to
write to the values at the same time.

Note that because of the possibility of overflow, the counter is not reliable
as an absolute count.
2014-03-19 19:00:54 -07:00
Chris Robinson 0c5cbafcd8 Use a union to combine HRTF and non-HRTF mixer params 2014-03-19 17:55:09 -07:00
Chris Robinson 213e3ba4af Select the mixer when setting the mixer-specific parameters 2014-03-19 16:10:09 -07:00
Chris Robinson 6ee54fb1f3 Store some source mixing parameters in the active source struct 2014-03-19 13:14:11 -07:00
Chris Robinson d6f7aac1bb Use a separate struct for tracking active sources 2014-03-18 19:56:25 -07:00
Chris Robinson 71b177918d Add another directory to .gitignore 2014-03-17 15:20:32 -07:00
Chris Robinson be2aeeb2fb Remove some unneeded code and unnecessary macros in the OpenSL backend 2014-03-17 15:17:56 -07:00
Chris Robinson dc74473025 Store the old-style backend funcs in the wrapper 2014-03-17 10:54:27 -07:00
Chris Robinson d346038102 Don't define HAVE_DYNLOAD with the IDE parser 2014-03-17 09:46:07 -07:00
Chris Robinson cf066fd306 Don't assume the default mmdevapi device is in the collection 2014-03-17 09:40:56 -07:00
Chris Robinson bb787ba8ee Avoid GCC's macro arg concat extension with IDE parsing 2014-03-17 09:16:33 -07:00
Chris Robinson 308d87b12a Return the original value from CompExchange* 2014-03-09 03:49:40 -07:00
Chris Robinson 372f3178f8 Remove the Apple-specific atomic function implementations.
I'm not sure if they're even used, but they were rather ugly and are set to get
even uglier since they don't follow normal conventions (missing exchange, and
cas not returning the original value).
2014-03-09 03:28:00 -07:00
Chris Robinson 74f2864c74 Update config file comments 2014-03-09 00:32:57 -08:00
Chris Robinson cde2f825d5 Use the correct array size 2014-03-08 22:48:36 -08:00
Chris Robinson 14a04020ff Improve int-to-float and uint-to-float conversions 2014-03-08 22:34:07 -08:00
Chris Robinson 2e279684d7 Only require MSADPCM block alignment to be a multiple of 2 2014-03-06 21:42:03 -08:00
Chris Robinson 7657fbb296 Only sign-expand the nibble when needed 2014-03-06 19:14:19 -08:00
Chris Robinson 143f786d1a Move the sample conversion routines to a separate file 2014-03-05 16:38:02 -08:00
Chris Robinson bf4ddfef6d Implement a simplistic MSADPCM encoder
It's not particularly good, but it's better than silence.
2014-03-05 07:27:22 -08:00
Chris Robinson 61569e09ed Allocate enough temp space for the ADPCM decoders and encoders 2014-03-05 06:18:55 -08:00
Chris Robinson a4126b66d4 Use specialized methods for converting ALshort to IMA4 and MSADPCM
As before, to avoid unnecessary direct copies
2014-03-05 06:13:00 -08:00
Chris Robinson f82f3f10ab Use specialized methods for converting IMA4 and MSADPCM to ALshort
Since the decoder methods already convert to ALshort, there's no need to use a
temp buffer that's just going to copy directly to the destination.
2014-03-05 04:59:24 -08:00
Chris Robinson 15b68fe694 Use maxi to clamp an int to a lower-bound 2014-03-05 04:37:55 -08:00
Chris Robinson fb1f9aad6e Expand the sign bit on the initial MSADPCM delta value 2014-03-05 00:30:23 -08:00
Chris Robinson a1c440bd09 Add an extension to support MSADPCM buffer formats 2014-03-04 22:44:30 -08:00
Chris Robinson f3a87d72b2 Add an extension to alter the block alignment for buffer unpack/pack ops
This is for unpacking (reading, e.g. alBufferData) and packing (writing, e.g.
alGetBufferSamplesSOFT) operations. The alignments are specified in sample
frames, with 0 meaning the default (65 for IMA4, 1 otherwise). IMA4 alignment
must be a multiple of 8, plus 1 (e.g. alignment = n*8 + 1), otherwise an error
will occur during (un)packing. Chenging the block alignment does not affect
already-loaded sample data, only future unpack/pack operations... so for
example, this is perfectly valid:

// Load mono IMA4 data with a block alignment of 1024 bytes, or 2041 sample
// frames.
alBufferi(buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, 2041);
alBufferData(buffer, AL_FORMAT_MONO_IMA4, data, data_len, srate);
alBufferi(buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, 0);
2014-03-04 05:53:35 -08:00
Chris Robinson b0a6b6427c Parameterize the block alignment 2014-03-04 04:29:35 -08:00
Chris Robinson a6eb38ea7f Use alloca for temp space decoding/encoding IMA4 blocks 2014-03-03 20:02:15 -08:00
Chris Robinson a2d9133ffc Reduce explicit template declarations and ignore IMA4-to-IMA4 conversions
Since we never store IMA4 data in buffers, we should only ever convert from
(user input) or to (user output) IMA4. Once we allow user-specified pack/unpack
block alignment, this wouldn't be a simple memcpy anyway.
2014-03-03 17:25:46 -08:00
Chris Robinson c442c93a93 Store the original frame size alignment in the buffer 2014-03-03 17:05:08 -08:00
Chris Robinson ea8a85b19c Move PATH_MAX fallback definitions to alMain.h 2014-02-27 18:17:20 -08:00
Chris Robinson 3867e3857d Add back the missing PATH_MAX fallback 2014-02-27 02:55:43 -08:00
Chris Robinson 6e7c0e15eb Use OpenDataFile to load soundfonts relative to data directories 2014-02-27 02:20:51 -08:00
Chris Robinson fd3acf19fe Add a note that absolute paths may be used for hrtf_tables 2014-02-27 01:54:45 -08:00
Chris Robinson a8249c3469 Move OpenDataFile to helpers.c so other sources can use it 2014-02-27 01:49:23 -08:00
Chris Robinson 3145bac8c6 Add an explicit cast to make Windows happy 2014-02-26 17:45:18 -08:00
Chris Robinson 99d82690ef Don't fallback to relative filename handling if opening as absolute fails 2014-02-26 17:38:19 -08:00
Chris Robinson 1b9a722601 Expand environment variables for all config option values when loading 2014-02-26 17:25:05 -08:00
Chris Robinson 89506435fa Support environment variables in the hrtf_tables config value 2014-02-25 19:18:59 -08:00
Chris Robinson 0ddb9888fe Fix a config option comment 2014-02-23 21:46:11 -08:00
Chris Robinson 9dd16f8b9c Attempt to restore the Neon-enhanced ApplyCoeffsStep method
Unable to test, but it hopefully works.
2014-02-23 21:28:34 -08:00
Chris Robinson 9a4ded2491 Revert "Apply HRTF coefficient stepping separately"
This reverts commit 25b9c3d0c1.

Conflicts:
	Alc/mixer_neon.c

Unfortunately this also undoes the Neon-enhanced ApplyCoeffsStep method.
2014-02-23 21:17:09 -08:00
Chris Robinson c68ce288d0 Move HRTF macros and function declarations to a separate header 2014-02-23 21:11:01 -08:00
Chris Robinson 5731534e8d Move the default hrtf table to an external file 2014-02-23 21:02:11 -08:00
Chris Robinson 9f43de62ab Add a return value to FindHrtfFormat 2014-02-23 20:14:07 -08:00
Chris Robinson ef8002a832 Check the hrtf config option earlier
This is to make sure it tries to find an HRTF-compatible format before reseting
the device, just like when using ALC_HRTF_SOFT.
2014-02-23 20:00:52 -08:00
Chris Robinson e6e3bdee83 Avoid checking the hrtf config option twice 2014-02-23 19:18:54 -08:00
Chris Robinson 0e51becd58 Search system-dependant data paths for relative hrtf table filenames 2014-02-23 17:58:34 -08:00
Chris Robinson 46b2115bfb Avoid using a global static buffer for config loading 2014-02-23 14:07:09 -08:00
Chris Robinson 0626a44eb1 Fix indentation 2014-02-23 09:54:26 -08:00
Chris Robinson 29e0af5ef0 Fix a race condition in the mmdevapi message queue thread 2014-02-09 18:55:51 -08:00
Chris Robinson 09d1319e82 Add some extra traces to the mmdevapi backend
Trying to track down the cause of some reported errors.
2014-02-09 10:52:12 -08:00
Chris Robinson ea0aea6508 Change the autowah to have a cutoff range of 20Hz to 20KHz
This is the same as allowed in the SF2 spec for its filter cutoff generator,
which can be used for a wah effect in MIDI. It makes sense to use a similar
range here.
2014-02-07 03:23:49 -08:00
Chris Robinson 6f711c32ba Fix some types 2014-02-07 03:20:27 -08:00
Chris Robinson 926ecc2dbe Slightly shorten a long line 2014-02-02 16:11:53 -08:00
Chris Robinson 7c4339c195 Rework MIDI clock timing
It's best to avoid using doubles in the mixer since the FPU's set to single-
precision mode. The new clock timing is similar to the device clock timing, and
should hopefully be less prone to drift caused by fp rounding errors.
2014-02-02 02:39:56 -08:00
Chris Robinson 755f161fc5 Use nanosecond resolution for MIDI
This makes the MIDI clock use the same resolution as the device clock and
source latency and the device clock.
2014-02-01 23:01:06 -08:00
Chris Robinson 7bfea9087e Remove an unnecessary special-case for the click removal 2014-02-01 19:31:05 -08:00
Chris Robinson 11a7b3e8f8 Avoid duplicating code in alcGetIntegerv 2014-02-01 18:40:36 -08:00
Chris Robinson 112b0f166f Add an alcGetInteger64vSOFT method and a way to get the device clock 2014-02-01 17:55:42 -08:00
Chris Robinson 69f3a7da6d Keep track of a device clock time, based on the number of samples processed 2014-02-01 16:37:11 -08:00
Chris Robinson 9e2a8843a8 Properly fill the SF2 sample buffer on big endian 2014-02-01 14:33:57 -08:00
Chris Robinson 68a32a3486 Fix an infinite loop when loading SF2 samples on big endian machines 2014-02-01 14:29:47 -08:00
Chris Robinson a4bc0a46e9 Implement dry and wet mixers for Neon
Code provided by Philippe Simons <simons.philippe@gmail.com>.
2014-01-26 01:34:39 -08:00
Chris Robinson 49baa9128d bufferQueue's Clear method doesn't take any parameters 2014-01-19 17:26:51 -08:00
Chris Robinson f193b539ce Clear the OpenSL buffer queue when stopping 2014-01-19 02:45:51 -08:00
Chris Robinson 35fd4dcf77 Check and trace INFO properties when reading them 2014-01-19 02:44:55 -08:00
Chris Robinson 748be9a97d Include sys/sysconf.h if available for sysconf() 2014-01-18 19:16:46 -08:00
Chris Robinson 1a90c7f498 Check for 0-sized sf2 structure arrays 2014-01-17 06:48:40 -08:00
Chris Robinson be883131a7 Remove redundancy in a couple error messages 2014-01-17 06:33:23 -08:00
Chris Robinson 658d35a1b0 Put the version and irom storage into the Soundfont struct 2014-01-17 06:20:39 -08:00
Chris Robinson d387deb3e8 Fix a couple warning messages to show the correct instrument ID 2014-01-17 06:10:29 -08:00
Chris Robinson 7206f5873c Partially handle the irom sub-chunk
Reject soundfonts that have ROM sample types without a valid irom sub-chunk.
2014-01-17 06:03:53 -08:00
Chris Robinson 05e9c824d5 Better handle original key and overriding root key 2014-01-17 05:14:58 -08:00
Chris Robinson 65a5311449 Rename aftertouch to keypressure 2014-01-17 04:18:49 -08:00
Chris Robinson d65279ac2a Update MIDI config option texts 2014-01-17 01:24:18 -08:00
Chris Robinson 50c8d9181a Add a config option to specify the extra MIDI volume scaling
The value specified is in decibels.
2014-01-17 00:58:47 -08:00
Chris Robinson 08ba5d9dba Use a proper struct for envelope properties 2014-01-17 00:36:33 -08:00
Chris Robinson e118ac93a0 Handle fontsound sample types using explicit enum values
Uses AL_MONO_SOFT, AL_RIGHT_SOFT, and AL_LEFT_SOFT. "Linked" samples types
aren't explicitly supported due to being under-defined in the SF2 spec, nor are
ROM samples currently.
2014-01-15 22:18:07 -08:00
Chris Robinson 9ebeae6228 Use ALfontsound_setPropi to set fontsound sample properties
And make sure the loop mode is properly translated for FluidSynth.
2014-01-15 21:17:46 -08:00
Chris Robinson 50b74629dd Add a flag to specify the device being paused
Used to prevent UpdateDeviceParams from restarting the device, if a new context
is created while paused.
2014-01-15 16:44:12 -08:00
Chris Robinson 8d7559d9d0 Stop the device when updating parameters, don't close it 2014-01-15 16:30:23 -08:00
Chris Robinson 56899716d6 Add an extension to pause audio processing 2014-01-15 16:27:17 -08:00
Chris Robinson 443e6b73b2 Use the 64-bit clamp method when getting the MIDI clock time 2014-01-15 15:38:54 -08:00
Chris Robinson 5fdc3c093e Don't use the same buffer segment for enqueueing in OpenSL 2014-01-15 15:27:38 -08:00
Chris Robinson 1739998045 Stop the OpenSL buffer queue when stopping the device 2014-01-15 15:14:25 -08:00
Chris Robinson bdc5850120 Don't reset presets when loading/unloading soundfonts 2014-01-13 16:57:56 -08:00
Chris Robinson 24ffb5b464 Be more thorough when converting sf2 modulator properties 2014-01-13 16:50:12 -08:00
Chris Robinson 90fd92628d Use FluidSynth enums when handling generators 2014-01-13 16:15:56 -08:00
Chris Robinson 0c80f62de7 Add a method to get soundfont samples 2014-01-13 00:20:14 -08:00
Chris Robinson 6f3dac6f58 Allow getting preset properties even when referenced 2014-01-12 23:57:44 -08:00
Chris Robinson e252a100f7 Minor non-functional cleanup 2014-01-12 16:27:21 -08:00
Chris Robinson a5bfc1e30b Add a method to get the current MIDI state 2014-01-12 12:27:46 -08:00
Chris Robinson 9a57aca8d4 Add an option to make HRTFs with a custom head radius 2014-01-11 02:24:20 -08:00
Rupert Steel 2aa95db5b9 Fixed compile error in Visual Studio 2013 by not redefining symbols that are now defined in the VS2013 math.h file. 2014-01-09 10:49:31 -08:00
Chris Robinson da2c9732da Don't break with an override root key generator value of -1
An accidental hold-over from when it was using a switch.
2014-01-06 13:21:08 -08:00
Chris Robinson cf66516a27 Load soundfont modulators into FluidSynth 2014-01-06 13:07:12 -08:00
Chris Robinson 4079ee2200 Add methods to get and set modulator properties on fontsounds 2014-01-05 17:21:34 -08:00
Chris Robinson 5f961a392e Move some soundfont methods to ALsoundfont 2014-01-05 05:11:07 -08:00
Chris Robinson 540a99e71f Allow "deleting" the default soundfont
The ID remains valid and the soundfont will be reloaded as needed, but this
provides a way for the application to clear up the soundfont memory.
2014-01-04 05:30:57 -08:00
Chris Robinson bb54743425 Allow querying default soundfont properties
Any attempts to modify it or its held objects will result in an
AL_INVALID_OPERATION error.
2014-01-04 04:49:10 -08:00
Chris Robinson 86f250a3f5 Trace preset, instrument, and sample names with invalid key and velocity ranges 2014-01-04 04:34:32 -08:00
Chris Robinson 4834f56779 Don't create presets that don't have any usable sounds 2014-01-04 03:20:17 -08:00
Chris Robinson 2dd87946fd Update some trace messages to be more useful 2014-01-03 23:19:52 -08:00
Chris Robinson 355b8db915 Don't allow min key/vel ranges to exceed max range 2014-01-03 23:19:14 -08:00
Chris Robinson 13066bbf87 Allow selecting the default soundfont using ID 0 2014-01-03 22:58:51 -08:00
Chris Robinson 42a67731c4 Add storage for a default soundfont object 2014-01-03 20:21:12 -08:00
Chris Robinson 3a31402b1e Remove an unused method 2014-01-03 19:35:55 -08:00
Chris Robinson d9846f3219 Move ALsoundfont methods to the right source file 2014-01-03 19:18:06 -08:00
Chris Robinson e6e7e461c0 Avoid using alFontsoundiSOFT when loading a soundfont
This should now make the soundfont loader thread-safe.
2014-01-03 18:52:17 -08:00
Chris Robinson 5dc4ea15bb Don't handle the list type in the RiffHdr struct 2014-01-03 18:09:51 -08:00
Chris Robinson f790d0e91f Use a uint map for modulators 2014-01-02 14:43:44 -08:00
Chris Robinson 49c17ad520 Mostly load into fontsound objects directly
This leaves only one unsafe alFontsoundiSOFT call.
2014-01-02 13:53:16 -08:00
Chris Robinson fcf9e72202 Load presets directly into objects 2014-01-02 11:40:30 -08:00
Chris Robinson 5f85a1dcf0 Move some error macros to alError.h 2014-01-02 10:42:00 -08:00
Chris Robinson 01f547b93e Move some preset alloc/dealloc code to separate functions 2014-01-02 10:39:21 -08:00
Chris Robinson 3ff33e2f79 Update the soundfont preset count after loading a soundfont 2014-01-02 09:09:57 -08:00
Chris Robinson e74e3e2b23 Move alLoadSoundfontSOFT to alSoundfont.c 2014-01-02 09:06:28 -08:00
Chris Robinson 7d94e9c52f Don't allow soundfonts with existing presets in alLoadSoundfontSOFT 2014-01-01 07:33:48 -08:00
Chris Robinson 0a5a08c0fb Pass the ALsoundfont object to loadSf2, rather than its ID 2014-01-01 07:25:23 -08:00
Chris Robinson e699ab8614 Force all FluidSynth sounds off when changing soundfonts
Selecting soundfonts should only happen when the MIDI engine is stopped or
reset. When stopped some notes may be left in a release phase, but we need to
ensure all fluid_sample_t objects are finished before unloading since the
soundfont (and associated sample memory) may be deleted at any time afterward.
2013-12-31 00:49:43 -08:00
Chris Robinson 6b2d3c3cfa Remove some unused MIDI backend methods 2013-12-29 06:02:48 -08:00
Chris Robinson 396a2f1595 Don't destroy the fluid_sfont_t if any of its samples are still playing
FluidSynth apparently doesn't check for this itself before calling the free
callback.
2013-12-29 05:58:40 -08:00
Chris Robinson 7640c658ee Remove explicit locking from alMidiSoundfontvSOFT.
The MIDI backend can lock as it needs.
2013-12-29 05:48:30 -08:00
Chris Robinson 37d183efc0 Update soundfont selection functions
A filename is no longer specified, and alMidiSoundfontsSOFT is renamed to
alMidiSoundfontvSOFT.
2013-12-29 05:44:18 -08:00
Chris Robinson 06dd9f9b8c Lock the device while selecting soundfonts 2013-12-29 05:36:05 -08:00
Chris Robinson 4e73b95fc0 Add the last remaining "real-time" properties 2013-12-29 05:09:50 -08:00
Chris Robinson 4c35f7c632 Add chorus and reverb send properties 2013-12-29 04:36:01 -08:00
Chris Robinson 15aa12847d Check for negative soundfont indices getting passed to the loader 2013-12-29 04:25:28 -08:00
Chris Robinson 699d84491f Add pan and attenuation properties 2013-12-29 04:24:32 -08:00
Chris Robinson d030e07879 Add tuning properties 2013-12-29 03:43:00 -08:00
Chris Robinson 1d41122372 Add filter properties 2013-12-29 03:18:31 -08:00
Chris Robinson deecbbc55d Add modulation envelope properties 2013-12-29 02:40:12 -08:00
Chris Robinson d9aedc1416 Add a few more pitch properties 2013-12-29 02:25:40 -08:00
Chris Robinson fc928bb75a Add volume envelope properties 2013-12-29 02:14:10 -08:00
Chris Robinson 4659669a74 Fix copy-paste errors in error messages 2013-12-29 00:56:01 -08:00
Chris Robinson 5aa274999c Accumulate with default modulator amounts 2013-12-29 00:52:03 -08:00
Chris Robinson 09665715ed Add support for the fontsound loop mode 2013-12-29 00:34:58 -08:00
Chris Robinson 0d7996409e Ensure the soundfont version is 2.x 2013-12-28 10:34:26 -08:00
Chris Robinson fe55cd6de8 Add alLoadSoundfontSOFT to load a soundfont via callback
Some hefty caveats:
This function is not thread-safe. In particular, the current context affecting
the thread must not be changed, and the provided soundfont must not be
altered while the function is executing. Ideally, this will be fixed.

Error handling is poor. Some RIFF structure errors may not be caught (e.g. sub-
chunks with sizes greater than the parent chunk allows for), and generated AL
errors are ignored, possibly leading to resource leaks in certain situations.
These should be fixed in time.

There is minimal error checking on the provided soundfont ID. It does not
ensure a valid ID has been provided, nor does it ensure the provided soundfont
can be modified. These short-comings should be fixed eventually.

Proper cleanup is the responsibility of the caller. The caller must get the
preset objects from the soundfont before deleting it, and the fontsound objects
from each preset before deleting them, to make sure all resources are properly
deleted.
2013-12-28 09:58:55 -08:00
Chris Robinson 7156f4439c Allow loading multiple soundfonts with FluidSynth 2013-12-27 06:41:57 -08:00
Chris Robinson 0678e3fc2b Create a custom fluid_sfloader_t loader
This allows us to load and use soundfont objects the app specifies (the first
one, at least), rather than having to load from a file. It doesn't sound that
good since modulators and most generators aren't yet available, but this will
steadily improve.
2013-12-27 06:23:07 -08:00
Chris Robinson f85d733f9d Add a method to set and get soundfonts
The main purpose of this is to select soundfonts for playback, eventually,
instead of the existing method that takes a filename.
2013-12-27 02:59:50 -08:00
Chris Robinson 2b772a5607 Allow specifying all 4 sample types
ROM-based types will be specified with a separate property
2013-12-27 01:08:48 -08:00
Chris Robinson 307ac564ca Allow specifying some fontsound sample properties 2013-12-26 23:37:22 -08:00
Chris Robinson cc30c5754f Remove the generator list 2013-12-26 22:10:41 -08:00
Chris Robinson d5f687b2fa Allow specifying key and velocity ranges on fontsounds 2013-12-26 21:45:16 -08:00
Chris Robinson 35f9e35aa3 Add methods to set and get sounds on a preset 2013-12-25 22:39:38 -08:00
Chris Robinson b5ae424dbd Store a list of sounds in the preset 2013-12-25 19:50:46 -08:00
Chris Robinson 677b864565 Remove the zone, sample, and instrument object types 2013-12-25 19:35:43 -08:00
Chris Robinson b650ecbc23 Add methods to add generators and modulators to fontsounds 2013-12-25 19:23:34 -08:00
Chris Robinson 94ddc5cb18 Add a new fontsound object type
This is basically a combined preset and intrument zone with sample header.
2013-12-25 19:13:59 -08:00
Chris Robinson cb3f82a4bf Do not allow deleting preset or instrument ID 0 2013-12-24 21:23:51 -08:00
Chris Robinson f7556b827a Allow querying the soundfont sample length and format type 2013-12-24 02:55:11 -08:00
Chris Robinson b0878fe609 Do not accept preset or instrument ID 0 as valid 2013-12-23 23:42:21 -08:00
Chris Robinson c911ca89a3 Unlock the soundfont earlier after switching preset lists 2013-12-23 23:31:47 -08:00
Chris Robinson a43b296c60 Add methods to get and set presets on a soundfont 2013-12-23 04:07:53 -08:00
Chris Robinson d7de86966d Add methods to get and set a preset object's preset and bank numbers 2013-12-23 03:23:42 -08:00
Chris Robinson 0df5eb90ea Make sure key and velocity ranges are the first two generators 2013-12-21 15:28:46 -08:00
Chris Robinson ede3c20880 Free thunk entry in the object destructor 2013-12-20 01:04:38 -08:00
Chris Robinson 5dc3f3626d Better protect against improper alSoundfontSamplesSOFT calls 2013-12-20 00:50:43 -08:00
Chris Robinson d596cf9cf3 Use a different autowah filter range
Still just guesses, but this seems to avoid math problems with low peak gains.
2013-12-20 00:16:23 -08:00
Chris Robinson 1bd828603e Add functions to set a soundfont's sample data 2013-12-19 04:19:03 -08:00
Chris Robinson 03a6bf22a5 Fix compiling without FluidSynth 2013-12-19 02:12:01 -08:00
Chris Robinson 99933fac49 Allow creating instrument objects 2013-12-19 00:57:07 -08:00
Chris Robinson 57491bf14c Call the right delete method when generating presets fails 2013-12-19 00:56:12 -08:00
Chris Robinson 666acb314b Rename some ALsoundfont fields 2013-12-19 00:37:56 -08:00
Chris Robinson 4288d3cd01 Move the soundfont and preset extension functions to separate sources 2013-12-19 00:27:11 -08:00
Chris Robinson 1b5c3495c9 Add methods to create and destroy presets 2013-12-19 00:09:55 -08:00
Chris Robinson 1e536cf7ca Properly initialize and cleanup the soundfont map 2013-12-18 23:21:59 -08:00
Chris Robinson 73fc4592ab Make alIsSoundfontSOFT check soundfont IDs 2013-12-18 23:12:44 -08:00
Chris Robinson 8083fb5be7 Add a new ALsoundfont object type
Includes a basic hierarchy for presets, instruments, samples, zones,
generators, and modulators.
2013-12-18 22:51:53 -08:00
Chris Robinson b9468dc917 Fix header guard and remove duplicate code 2013-12-18 19:17:03 -08:00
Chris Robinson cd90bdd9bd Add an option to use the HRTF time delay measured from the dataset 2013-12-18 12:43:59 -08:00
Chris Robinson 0653680690 Move the base MidiSynth to a separate file 2013-12-17 23:03:34 -08:00
Chris Robinson 0095a59fc9 Move the dummy MIDI handler to a separate file 2013-12-17 22:43:10 -08:00
Chris Robinson ee92b3142d Move FluidSynth to its own file 2013-12-17 22:36:25 -08:00
Chris Robinson ef0341c180 Make MidiSynth's methods non-static 2013-12-17 21:56:28 -08:00
Chris Robinson 7f51569186 Update the midi soundfont config option 2013-12-16 15:05:53 -08:00
Chris Robinson 189d73dd87 Render some MIDI samples even when stopped
Because stopping MIDI playback puts any playing notes into release phase, they
should be rendered. Ideally it could stop rendering once output goes silent.
2013-12-15 21:03:23 -08:00
Chris Robinson f244ef6f82 Use macros for MIDI controller values 2013-12-15 20:15:30 -08:00
Chris Robinson bcc2b9a490 Don't explicitly set reverb or chorus 2013-12-13 16:14:50 -08:00
Chris Robinson 1dd05bac5c Add a alMidiResetSOFT method to reset the synth
Playback is stopped, the queue is flushed, the clock is reset to 0, and the
MIDI system is reset to power-up status.
2013-12-13 14:15:01 -08:00
Chris Robinson a343d78724 Update behavior for alMidiStopSOFT
alMidiStopSOFT now has the following behavior:
* All pending MIDI events up to the current time are processed first, before
the queue is flushed.
* All channels then receive an All Notes Off event so that notes go through
their release phase. Controllers are *NOT* reset.
* Clock time is reset to 0, like before.
2013-12-13 13:40:53 -08:00
Chris Robinson 57eef756c3 Fix retrieving source properties 2013-12-09 13:04:16 -08:00
Chris Robinson 5349b90a48 Fix leak if inserting a sysex event fails 2013-12-08 06:20:44 -08:00
Chris Robinson ac525db845 Fix numeric constant type (double->float) 2013-12-08 05:01:06 -08:00
Chris Robinson a846418964 Rename pthread wrappers used for Windows to althread 2013-12-06 02:12:45 -08:00
Chris Robinson 3f5914e094 Simplify dummy synth processing loop 2013-12-01 01:03:55 -08:00
Chris Robinson 517be463ae Minor comment update 2013-12-01 00:31:39 -08:00
Chris Robinson dc13ce7a0a Use a method to get the default soundfont filename 2013-12-01 00:22:20 -08:00
Chris Robinson c834713526 Add methods to set and get the MIDI gain 2013-11-30 23:47:42 -08:00
Chris Robinson 2633fbfc4b Add a method to check if a file is a soundfont 2013-11-30 20:37:37 -08:00
Chris Robinson e0babed29b Add a workaround for allowing GM2 bank selection with a GM2 On SysEx 2013-11-29 23:57:32 -08:00
Chris Robinson be446366fb Add a method to specifying MIDI SysEx messages 2013-11-29 05:37:45 -08:00
Chris Robinson ea1d7d56d3 Add infrastructure for handling SysEx MIDI events 2013-11-29 04:56:33 -08:00
Chris Robinson 82d4e69da1 Don't force MMA bank selection mode 2013-11-29 00:42:27 -08:00
Chris Robinson f4cf84e72d Combine duplicate soundfont loading code 2013-11-28 05:30:48 -08:00
Chris Robinson 8615a109ce Remove an unneeded MidiSynth field 2013-11-28 05:06:40 -08:00
Chris Robinson f8c68291d3 Add a method to stop MIDI playback
Unlike pausing, this resets the MIDI clock time to 0, clears the existing event
queue, stops all MIDI sounds, and resets MIDI controllers.
2013-11-28 04:52:53 -08:00
Chris Robinson 29a4ac329a Move MidiSynth locking out of the setState method 2013-11-28 04:29:38 -08:00
Chris Robinson 5dad1688d4 Fix building without FluidSynth 2013-11-28 04:21:39 -08:00
Chris Robinson 98b0a3187e Add a config option for specifying the default MIDI soundfont 2013-11-28 04:16:46 -08:00
Chris Robinson 7794e53667 Be a bit safer with MIDI state changes 2013-11-28 03:57:45 -08:00
Chris Robinson bb0207d784 Add a method to load a soundfont 2013-11-28 03:38:17 -08:00
Chris Robinson a3c76c3274 Add an option for FLuidSynth to handle MIDI 2013-11-28 03:08:28 -08:00
Chris Robinson a48f362d28 Start a MIDI interface extension 2013-11-28 01:53:05 -08:00
Chris Robinson 489723723c Cleanups for MidiSynth
Remove an unneeded field, make MidiSynth_getTime public, and properly return a
64-bit time from it.
2013-11-27 19:41:52 -08:00
Chris Robinson 182b08d8bc Create and use a MidiSynth on playback devices 2013-11-27 18:52:56 -08:00
Chris Robinson 5554b8cfc9 Add a MidiSynth interface for devices 2013-11-27 18:45:02 -08:00
Chris Robinson 3a1613253b Add a base MidiSynth struct 2013-11-27 05:12:11 -08:00
Chris Robinson 6a76f50fa3 Ensure UINT64_MAX is defined 2013-11-27 05:09:33 -08:00
Chris Robinson 37fa82f138 Use a 64-bit uint for MIDI event times 2013-11-27 04:33:33 -08:00
Chris Robinson d315feae40 Add a MIDI event queue
In preparation for a MIDI extension.
2013-11-27 03:49:26 -08:00
Chris Robinson 08dfbcfd5c Add min/max/clamp methods for doubles 2013-11-27 00:30:13 -08:00
Chris Robinson d339120145 Move ALfloatBUFFERSIZE to a common location 2013-11-27 00:16:30 -08:00
Chris Robinson 80ea801204 Add a macro for GCC to ensure stack alignment 2013-11-25 17:29:39 -08:00
Chris Robinson 191e8172f0 Use a macro to help condense some repeated code 2013-11-24 18:11:45 -08:00
Chris Robinson b029b77784 Add some missing 'static's 2013-11-24 17:43:20 -08:00
Chris Robinson 4830b1afe7 Try to make sure GCC is providing C99 inline semantics 2013-11-24 17:37:48 -08:00
Chris Robinson 25b9c3d0c1 Apply HRTF coefficient stepping separately 2013-11-10 05:52:22 -08:00
Chris Robinson 4386ee32ce Use one long buffer for the chorus and flanger delay lines 2013-11-10 02:48:03 -08:00
Chris Robinson a603dd55ff Rename lfo_coeff to lfo_scale 2013-11-08 16:54:45 -08:00
Chris Robinson 9228d13333 Use integer modulo for chorus and flanger
Also simplify LFO coefficient calculations.
2013-11-08 16:33:42 -08:00
Chris Robinson bca959f372 Only use the inner loop for the chorus/flanger template method 2013-11-08 05:26:43 -08:00
Chris Robinson d6eff654be Redo the autowah effect
It's now a low-pass filter with a cutoff that varies according to the input
signal amplitude.

There remains issues with apparent feedback in the resonant frequency with high
resonance values. The actual cutoff range for the filter is also a guess.
2013-11-07 17:46:14 -08:00
Chris Robinson e0fecdcaaa Reimplement the compressor to work per-sample 2013-11-06 23:39:41 -08:00
Chris Robinson 414a9edc6e Explicitly define _POSIX_C_SOURCE and _XOPEN_SOURCE
Set them to 200809L and 700 respectively, instead of assuming _GNU_SOURCE will
do it.
2013-11-06 01:41:12 -08:00
Chris Robinson b84f6d100f Set -D_GNU_SOURCE=1 earlier 2013-11-05 22:49:16 -08:00
Chris Robinson 801b7cb059 Include strings.h when available 2013-11-05 13:07:46 -08:00
Chris Robinson 10dbb1bc9b Remove the Lock and Unlock methods from BackendFuncs
All backends that still use the old interface use the default locking methods,
which is also used by the ALCbackend base.
2013-11-04 23:34:18 -08:00
Chris Robinson ca83629e4e Forward some wrapper functions to the base method 2013-11-04 23:19:30 -08:00
Chris Robinson 5874e387a8 Move some inline methods to their appropriate headers 2013-11-04 13:51:19 -08:00
Chris Robinson d3c70e63b4 Use C99 inline in more places 2013-11-04 13:44:46 -08:00
Chris Robinson 551f893ae9 Use C99 inline semantics 2013-11-04 12:12:31 -08:00
Chris Robinson 692ab1085d Only set device functions when needed 2013-11-04 10:52:03 -08:00
Chris Robinson 94aeb5f52e Use a unique backend type for loopback 2013-11-04 10:51:22 -08:00
Chris Robinson 9760a592b2 Rename VCALL and VCALL0 to V and V0 2013-11-02 17:30:28 -07:00
Chris Robinson f868d881d9 Constify some function pointers 2013-11-02 16:58:26 -07:00
Chris Robinson 3d921e0e6f Make backend factory methods static as needed 2013-11-02 16:35:05 -07:00
Chris Robinson a1a3f51be2 Convert the OSS backend to the new interface 2013-11-02 15:42:45 -07:00
Chris Robinson c851e2c611 Set vtables in the constructor 2013-11-02 13:23:20 -07:00
Chris Robinson ddf521eddc Make LockContext and UnlockContext inline again 2013-11-02 12:05:02 -07:00
Chris Robinson 7142e3828f Rename alcGetLatency to ALCdevice_GetLatency 2013-11-02 12:01:58 -07:00
Chris Robinson 426429279b Use the existing ALint64SOFT/ALuint64SOFT types for ALint64/ALuint64 2013-11-01 16:49:05 -07:00
Chris Robinson 7460dd1b08 Prefer long as a 64-bit type instead of long long 2013-10-30 12:29:53 -07:00
Chris Robinson 90a51d7897 Move a macro definition up nearer to where it's used 2013-10-29 23:54:10 -07:00
Chris Robinson bc9c3de969 Use a helper macro for making vtable thunks 2013-10-29 20:13:42 -07:00
Chris Robinson 9f0e49917d Add default handlers for reset, captureSamples, and availableSamples 2013-10-29 15:07:13 -07:00
Chris Robinson 779eb4b82b Convert the PulseAudio backend to the new interface 2013-10-29 14:44:07 -07:00
Chris Robinson 6e43757fed Remove the cmake option to use wine headers 2013-10-29 11:38:37 -07:00
Chris Robinson a507d0aa75 Disable MSVC warning 4098
a.k.a. "'void' function returning a value", caused by returning a void in a
function that returns void. Such as:

void foo() { }
void bar()
{
    return foo();
}

Which can happen due to some generalized macros that generate wrappers.
2013-10-29 11:27:06 -07:00
Chris Robinson d4aa4e16a0 Add a macro to forward methods to a base type 2013-10-29 11:22:18 -07:00
Chris Robinson d2b3615943 Convert the loopback backend to the new interface 2013-10-29 10:38:55 -07:00
Chris Robinson 3437769ba0 Remove a couple unnecessary (and incorrect) parameter names 2013-10-28 22:29:59 -07:00
Chris Robinson 3c65c946d4 Fix capture with the new backend interface 2013-10-28 22:03:54 -07:00
Chris Robinson 16d5d5760c Convert ALSA to the new backend interface 2013-10-28 21:56:14 -07:00
Chris Robinson 7a424ab4bf Don't return a void 2013-10-28 20:23:41 -07:00
Chris Robinson 823782a33f Declare LoadLib functions in one place 2013-10-28 17:48:48 -07:00
Chris Robinson 321644de7c Add a missing compat.h include for portaudio 2013-10-28 17:48:03 -07:00
Chris Robinson a407d57639 Rename the support method to querySupport 2013-10-28 17:23:19 -07:00
Chris Robinson 0a6eff6a89 Add a GNU-specific AL_PRINT
This one makes use of the ', ## __VA_ARGS__' construct to avoid
splitting the output into two *printf calls.
2013-10-28 17:09:52 -07:00
Chris Robinson 6fd857739c Support capture backends with the new interface 2013-10-28 17:04:44 -07:00
Chris Robinson 21f1e54cb9 Create and use a backend wrapper for capture 2013-10-28 14:38:55 -07:00
Chris Robinson f8c95f1e90 Add audio capture methods to ALCbackend 2013-10-28 13:51:55 -07:00
Chris Robinson 8d9fb5109b Move some stuff out of alMain.h 2013-10-28 12:48:13 -07:00
Chris Robinson 20bcb68ad6 Move ALCbackend base stuff to a separate file 2013-10-28 12:30:57 -07:00
Chris Robinson 0617df9b5f Fix a couple casts 2013-10-28 12:12:26 -07:00
Chris Robinson f24cb44781 Move the device mutex to the backend 2013-10-28 12:05:33 -07:00
Chris Robinson 2912d130c2 Separate compatibility declarations 2013-10-28 11:26:26 -07:00
Chris Robinson 034935b2e1 Modify how VCALL is handled
Now instead of specifying the arguments as a third argument to the macro, like
VCALL(object,function,(arg1, arg2));
they are specified separately after the macro, like
VCALL(object,function)(arg1, arg2);

Also, VCALL_NOARGS has been removed in favor of VCALL0, which behaves like
above but expects an empty argument list (a separate macro is needed to work
around preprocessor limitations).
2013-10-28 11:06:04 -07:00
Chris Robinson c1cdd3095b Convert the Null backend to the ALCbackend style 2013-10-28 08:29:19 -07:00
Chris Robinson dc7ed39fa7 Add a backend factory base type 2013-10-28 07:27:35 -07:00
Chris Robinson c8603092d3 Add a default getLatency to ALCbackend
And make sure the backend is properly deleted.
2013-10-28 05:57:07 -07:00
Chris Robinson f065700ef9 Move the lock/unlock methods to the backend 2013-10-28 05:10:28 -07:00
Chris Robinson e54983694b Add missing header to git 2013-10-27 16:37:40 -07:00
Chris Robinson 3ed425d7ef Move the ALCdevice handle to the ALCbackend base 2013-10-27 16:20:47 -07:00
Chris Robinson af8be56f17 Use an ALCbackend object to access playback backends
This is the start of a backend redesign. Currently, a wrapper object is used to
avoid having to redo all the backends at once, but they should slowly be
converted to derive from ALCbackend instead. The ALCbackend interface can
change as needed.
2013-10-27 14:24:55 -07:00
Chris Robinson bf465eb2eb Move SetThreadName to threads.c 2013-10-27 08:32:58 -07:00
Chris Robinson 8ceb800def Rework threading functions 2013-10-27 08:14:13 -07:00
Chris Robinson b9e30f7604 Add a cmake option to disable building only alsoft-config 2013-10-27 07:03:58 -07:00
Chris Robinson f93bfab824 Set a name for the mixer and recording threads 2013-10-27 07:00:44 -07:00
Chris Robinson ff5277f4d7 Add a method to set the running thread's name 2013-10-26 12:39:19 -07:00
Chris Robinson 6617985a4e Link to the correct sdl library for the loopback example 2013-10-26 08:52:07 -07:00
Chris Robinson 54b8690781 Fix a comment 2013-10-26 08:49:37 -07:00
Chris Robinson 959b768911 Use SET_VTABLE1 to set the ALeffect vtables 2013-10-08 18:58:44 -07:00
Chris Robinson a421e515be Use a helper macro for pi*2 2013-10-08 16:31:23 -07:00
Chris Robinson 11365b42c7 Use helper macros to convert between degrees and radians 2013-10-08 12:39:22 -07:00
Chris Robinson b42fcce014 Use inline initialization for effect state factory vtables 2013-10-07 14:49:36 -07:00
Chris Robinson fc31a41473 Constify the effect parameter of effect getters 2013-10-07 12:56:41 -07:00
Chris Robinson b3841653c6 Remove the last of the al_try code 2013-10-07 12:05:39 -07:00
Chris Robinson 32d3bde261 Use inline functions to lookup and remove objects 2013-10-07 11:39:32 -07:00
Chris Robinson c787a9bf74 Remove al_try from alAuxEffectSlot.c 2013-10-07 11:30:11 -07:00
Chris Robinson 4f72da0005 Return only true or false from the source getters and setters 2013-10-07 11:10:49 -07:00
Chris Robinson 69d373db78 Remove al_try from alSource.c 2013-10-07 09:24:50 -07:00
Chris Robinson 0803f1b2f1 Remove al_try from alListener.c 2013-10-07 09:04:52 -07:00
Chris Robinson c080dcae8d Remove al_try from alState.c 2013-10-07 08:50:17 -07:00
Chris Robinson 997f6228de Use the UNUSED macro in the effects 2013-10-07 08:34:54 -07:00
Chris Robinson 32e85d469b Use the UNUSED macro in the backends 2013-10-07 08:00:18 -07:00
Chris Robinson 1518895e15 Use an UNUSED macro instead of void-tagging unused parameters 2013-10-07 07:44:09 -07:00
Chris Robinson 44172f701c Remove a duplicate and unused macro 2013-10-07 07:32:45 -07:00
Chris Robinson e1d5be570e Remove al_try usage from alBuffer.c 2013-10-07 07:06:01 -07:00
Chris Robinson b5fece0381 Add a CMake option to not define the IDs used on Windows
This includes the GUIDs, IIDs, CLSID, and PropertyKeys. It is up to the user
to ensure the appropriate IDs are defined when linked.
2013-10-07 06:36:58 -07:00
Chris Robinson 1461903e0d Add a workaround for KDevelop not recognizing the ALIGN macro 2013-10-07 06:05:42 -07:00
Chris Robinson 8aa237ac23 Fix effect slot struct declarations so KDevelop doesn't barf on them 2013-10-07 05:41:41 -07:00
Chris Robinson 5d014ba85f Start using a simpler method for error handling
This helps avoid the al_try/al_throwerr/al_endtry stuff.
2013-10-06 18:01:01 -07:00
Chris Robinson 79edd2cf3b Use a macro for the silence threshold 2013-10-06 17:25:47 -07:00
Chris Robinson 6425480d40 Don't store the effect slot in SendParams
This makes it much more like DirectParams.
2013-10-06 10:11:01 -07:00
Chris Robinson 8448b94c0b Rename Filter param member to LpFilter 2013-10-06 09:33:02 -07:00
Chris Robinson 9ee3d01f6e Use a simpler U64 macro to make 64-bit constants 2013-10-06 04:21:03 -07:00
Chris Robinson 69e64e1ed2 Add a workaround for KDevelop not recognizing 'restrict' 2013-10-06 03:53:20 -07:00
Chris Robinson ba52ac9bcd Finalize AL_SOFT_deferred_updates 2013-10-05 06:14:04 -07:00
Chris Robinson 43c375716a Only rest as long as needed in the Null renderer 2013-10-05 00:33:56 -07:00
Chris Robinson ead8573aaf Add some more missing enums 2013-10-03 07:57:54 -07:00
Chris Robinson 41175ec84c Implement the Compressor effect 2013-10-03 07:55:12 -07:00
Chris Robinson b9fd3f9eb4 Add missing enum to the list 2013-10-03 07:32:01 -07:00
Chris Robinson 01a5946a2e Compile using -std=c99 when available 2013-10-03 05:45:12 -07:00
Chris Robinson 2e605590a2 Convert autowah.c line-endings 2013-10-03 05:04:39 -07:00
Chris Robinson 764ea95781 Use helpers to set channel gain arrays
Also avoid unnecessary clearing.
2013-10-03 05:02:16 -07:00
Chris Robinson 99fa5911bc Implement the Autowah effect. 2013-10-03 03:37:03 -07:00
Chris Robinson 2f676832bc Avoid a divide-by-0 when distortion edge is 1 2013-09-04 15:46:05 -07:00
Chris Robinson 94884ed04b Use a separate value for the maximum buffer channels
Unlike the device, input buffers are accessed based on channel numbers
instead of enums. This means the maximum number of channels they hold
depends on the number of channels any one format can have, rather than
the total number of recognized channels. Currently, this is 8 for 7.1.
2013-07-23 00:13:15 -07:00
Chris Robinson 2219ce2475 Implement master high-pass filter for EAXREVERB 2013-07-21 22:12:50 -07:00
Chris Robinson 393d0eb138 Limit lower filter gain to -100dB 2013-07-21 18:42:14 -07:00
Chris Robinson 51791e6a54 Remove an unused function 2013-07-21 03:22:14 -07:00
Chris Robinson d85f0c0bb2 Improve the source's low-pass filter response 2013-07-20 22:18:44 -07:00
Chris Robinson 0a95c470b0 Some .ui changes that Qt Designer insists on 2013-07-10 10:53:01 -07:00
Chris Robinson 7ebc1bb69e Use OpenAL_SOURCE_DIR for the CMake module path and declare the project earlier
The minimum CMake version required is also bumped to 2.6. Patch by Andrew West,
allows OpenAL Soft to be properly built as a sub-project.
2013-07-10 10:46:07 -07:00
Chris Robinson 52096234e1 Limit the source step to 10
This means the combination of the buffer frequency, source pitch, and
doppler shift can't exceed 10x the device playback frequency.

This is needed to keep the mixer from starving with a really high
increment, causing small DstBufferSize values that require a lot of
iterations.
2013-07-02 06:57:27 -07:00
Chris Robinson 61c6a38f04 Don't have ../../ as part of the target name 2013-07-02 02:02:57 -07:00
Chris Robinson f23a28e8f3 Disable HRTF remove button when no files selected 2013-06-28 00:08:57 -07:00
Chris Robinson 314f9e2686 Update the period size/count sliders when loading 2013-06-27 23:31:51 -07:00
Chris Robinson 2c7f94e285 Remove the unused menu bar and status bar from alsoft-config 2013-06-27 21:42:38 -07:00
Chris Robinson a375104826 Make sure SDL_sound was found before setting the includes 2013-06-25 03:53:48 -07:00
Chris Robinson 62dd5f33b2 Better handle the INCLUDE_DIRECTORIES property
Older cmake verions (prior to 2.8.8) don't have a per-target
INCLUDE_DIRECTORIES property, so the directories have to be
added using the INCLUDE_DIRECTORIES command.
2013-06-25 03:14:04 -07:00
Chris Robinson 77a2c8bcf0 Check for Qt4 earlier 2013-06-24 18:38:26 -07:00
Chris Robinson d984cec3a1 Properly check that Qt4 4.8+ was found 2013-06-24 17:40:41 -07:00
Chris Robinson 5c7680ec84 Use the COMPILE_DEFINITIONS property instead of DEFINE_SYMBOL 2013-06-24 17:40:03 -07:00
Chris Robinson 18157bc331 Better specify include directories and defines needed for various targets 2013-06-24 16:30:04 -07:00
Chris Robinson 27b66b2008 Specify the required Qt4 version to find_package 2013-06-24 16:28:19 -07:00
Chris Robinson f48c0c9e0a Make sure QtCore and QtGui were found and link with the appropriate libs 2013-06-24 05:02:45 -07:00
Chris Robinson b3f54124bd Require Qt 4.8 or newer for alsoft-config 2013-06-24 04:47:36 -07:00
Chris Robinson eebc6c0419 Move alsoft-config to a separate project file
This to help avoid FindQt4.cmake from polluting the current project with
defines and include directories, applying them to targets that don't use Qt.
2013-06-24 04:27:35 -07:00
Chris Robinson 144059b062 Add a configuration UI application
Not complete, but it's a decent start. Some problems:

* Only some otions are handled (backend-specific options in particular aren't
  handled).

* Does not warn when quitting with unsaved changes.

* Some options are missing tooltips.
2013-06-23 22:47:51 -07:00
Chris Robinson 4017e4a96a Check for MinGW in CMakeLists.txt instead of config.h 2013-06-20 17:17:17 -07:00
Chris Robinson ed0568bb24 Fix a potential infinite loop.
If the first XDG_CONFIG_DIRS entry isn't a proper relative path,
it would never break the loop.
2013-06-19 23:24:06 -07:00
Chris Robinson 160e901381 Handle non-native endian formats with SDL_sound 2013-06-19 22:47:17 -07:00
Chris Robinson a9fac12969 Work around some problems with KDevelop's parser 2013-06-18 14:33:39 -07:00
Chris Robinson 3c90ed95af Look for alsoft.conf in the XDG_CONFIG_DIRS and XDG_CONFIG_HOME directories
This follows the XDG Base Directory Specification. The old files/locations are
still supported, but configs found in XDG_CONFIG_DIRS take precedence over
/etc/openal/alsoft.conf, and a config found in XDG_CONFIG_HOME takes precedence
over $HOME/.alsoftrc.
2013-06-16 22:55:11 -07:00
Chris Robinson 48d5002190 Trace config file names being loaded 2013-06-16 20:43:31 -07:00
Chris Robinson 784e396cc7 Don't split config sections into separate blocks 2013-06-16 19:52:56 -07:00
Chris Robinson 8bd77be522 Improve parsing of the config files
This will also now recognize (and strip) quotation marks from around values.
2013-06-16 18:42:27 -07:00
Chris Robinson ff44ebfd5b Add a loopback extension example 2013-06-16 16:10:21 -07:00
Chris Robinson a5471ce0a4 Better handle spaces between string list entries 2013-06-16 15:44:41 -07:00
Chris Robinson 817ca82e4b Fix input and feedback in the echo effect 2013-06-10 05:57:27 -07:00
Chris Robinson 68898dad1e Don't open the log file with both 'truncate' and 'append' flags 2013-06-07 03:38:09 -07:00
Chris Robinson 024374e0ce Use explicit bit offsets when checking for SSE and SSE2
Clang's cpuid.h doesn't contain the bit_* macros.
2013-06-06 19:30:55 -07:00
Chris Robinson 647398d7c6 Use ALfilterState for the distortion effect filters 2013-06-06 03:24:44 -07:00
Chris Robinson dcefeac6e6 Use a static lib for the common example code 2013-06-05 23:07:33 -07:00
Chris Robinson 9fd8731480 Use SDL_sound for the other examples 2013-06-05 20:12:13 -07:00
Chris Robinson 056fa2a474 Use SDL_sound for the alstream example 2013-06-05 19:50:18 -07:00
Chris Robinson fe5428dc49 Add a custom FindSDL_sound cmake module
The one that comes with CMake is broken, incorrectly setting
SDL_SOUND_LIBRARIES, causing warnings, and not even working if the
project is C only.
2013-06-05 19:21:09 -07:00
Chris Robinson a371de080b Silence some clang warnings 2013-06-05 01:52:49 -07:00
Chris Robinson 0e0f70b288 Avoid a NULL dereference 2013-06-04 17:36:54 -07:00
Chris Robinson 7257aa3ed2 Allow enabling HRTF through a context creation attribute 2013-05-31 19:29:32 -07:00
Chris Robinson 69e0c19767 Start an extension that can query the status of HRTF rendering 2013-05-31 16:03:59 -07:00
Chris Robinson 8f14902290 Add ALC_EXT_DEFAULT_FILTER_ORDER to alext.h 2013-05-31 15:40:02 -07:00
Chris Robinson 2290e08053 Make some example function pointers static 2013-05-30 13:29:50 -07:00
Chris Robinson a7a3d1e194 Avoid an unnecessary loop 2013-05-29 22:34:57 -07:00
Chris Robinson 9c3f1d11f0 Check the right flag for tracing SSE2 support 2013-05-29 21:28:27 -07:00
Chris Robinson 764e3aa496 Fix up the naming convention of effect methods 2013-05-29 11:17:45 -07:00
Chris Robinson e96cc656e9 Use C99's inline instead of __inline 2013-05-28 22:27:07 -07:00
Chris Robinson 48aa1e10d6 Use the high-shelf filter in place of low-pass
They effectively both work to lower (or raise) high frequencies. However, the
high-shelf performs better when gain=1.
2013-05-28 10:57:38 -07:00
Chris Robinson 6556626055 Simplify and fix some filter gain calculations 2013-05-27 21:57:22 -07:00
Chris Robinson 59a38442ac Use ALfilterState for the modulator high pass filter 2013-05-27 21:24:28 -07:00
Chris Robinson 0c7c5327c9 Use ALfilterState for the master echo and reverb filters 2013-05-27 19:55:00 -07:00
Chris Robinson 3e663d7307 Remove an unused method 2013-05-27 19:33:12 -07:00
Chris Robinson feeec34333 Use ALfilterState for the source direct and send filters 2013-05-27 19:14:02 -07:00
Chris Robinson bcf4842eb3 Fix filter coefficient pre-calc
a[0] was getting set to 1 before a[1] and a[2] were normalized. a[0] needs to
be done last.
2013-05-27 17:47:13 -07:00
Chris Robinson b1ae44206f Move ALEQFilter to alFilter.c/h and rename it to ALfilterState 2013-05-27 15:32:02 -07:00
Chris Robinson 0ad71a67d4 Store pointers to the getFactory funcs in the map 2013-05-27 13:41:16 -07:00
Chris Robinson 334a7c1d59 Cleanup the ALeffectStateFactory_create methods
Get rid of the ALeffectStateFactory_create macro, and use the VCALL_NOARGS
helper (requires adding the 'this' factory parameter).
2013-05-27 13:16:17 -07:00
Chris Robinson 8d874512b6 No-op if DELETE_OBJ is given a NULL pointer 2013-05-27 12:07:54 -07:00
Chris Robinson 9e84f38a46 Use generic VCALL[_NOARGS] macros instead of type-specific wrappers 2013-05-27 11:48:29 -07:00
Chris Robinson 06c8442af6 Rename a variable 2013-05-26 17:10:57 -07:00
Chris Robinson 0a4be3470e Pre-apply the a[0] EQ filter coefficient
Saves 20 fp divisions per sample
2013-05-26 17:04:45 -07:00
Chris Robinson 4bf5466f64 Use SET_ERROR_AND_RETURN in a few more places 2013-05-26 16:34:08 -07:00
Chris Robinson 82caba6bbe Use the helper macros in more places 2013-05-26 08:54:34 -07:00
Chris Robinson 8808159d55 Add helper macros to set an error and return, and use it in a few places 2013-05-26 00:01:07 -07:00
Chris Robinson 2759239754 Define the ALeffect typedef with the struct 2013-05-25 22:31:24 -07:00
Chris Robinson d1c5599c8e Use an ALeffectProps union to store the effect properties 2013-05-25 22:07:31 -07:00
Chris Robinson 6571d80540 Use a Delete method for deletable objects 2013-05-25 21:04:00 -07:00
Chris Robinson 2da6caeaa6 Update the Null effect so it can act as a guide to new effects 2013-05-25 17:42:34 -07:00
Chris Robinson e157238ce7 Use vtables for setting effect properties 2013-05-24 23:26:59 -07:00
Chris Robinson 49446c7b32 Set cmake policy CMP0005 and avoid unnecessary escape sequences 2013-05-24 23:25:35 -07:00
Chris Robinson f105a8bb4b Add quotes around an ADD_DEFINITIONS parameter 2013-05-24 10:36:55 -07:00
Chris Robinson 18807e06fe Check for __restrict in a way to make MSVC happy, hopefully 2013-05-24 00:45:25 -07:00
Chris Robinson 357cf72ab3 Move remaining effects to the effects subdir 2013-05-23 21:33:16 -07:00
Chris Robinson 2376683128 Move reverb to the effects subdir 2013-05-23 19:48:24 -07:00
Chris Robinson f667c028e6 Move the AL_EFFECT_NULL state into a separate file 2013-05-23 18:50:07 -07:00
Chris Robinson dbb6da8c47 Reword a couple cmake option names 2013-05-23 17:27:57 -07:00
Chris Robinson 4f068b51e5 Don't explicitly check for fesetround
It's C99 standard with fenv.h, which we already check for.
2013-05-22 23:23:45 -07:00
Chris Robinson be4a4d7468 Use fegetenv/fesetenv to backup and restore the FPU state 2013-05-22 23:05:26 -07:00
Chris Robinson eb15b13ca1 Merge the fesetround FPU handler with the assembly one
The assembly is only needed for SSE since we can't access the intrinsics
without the -msse switch, which itself would cause SSE code to be generated
elsewhere automtically.
2013-05-22 22:21:00 -07:00
Chris Robinson 38a9e642df Check for SSE2 and set the denormals-are-zero bit for mixing if available 2013-05-22 17:04:37 -07:00
Chris Robinson b80efeb87d Set the correct SSE bits for round-to-zero 2013-05-22 16:31:43 -07:00
Chris Robinson 52efb8d7f4 Use restrict instead of RESTRICT 2013-05-22 15:11:39 -07:00
Chris Robinson a6fa4a8bc2 Recognize DSSPEAKER_5POINT1_SURROUND (and 7POINT1) with DSound 2013-05-22 14:25:33 -07:00
Chris Robinson 1bed3cff21 Remove an unnecessary check for vsnprintf 2013-05-22 14:24:30 -07:00
Chris Robinson cdbb0722f6 Avoid using a temp buffer for al_print
It's now using two *printf calls, which unfortuantely means there could be a
race between the two and cause the message to break up if something else tries
to print to the same file. This shouldn't really be a big deal since al_print
isn't used that often, and it now allows for lines of practically unlimited
length.
2013-05-22 03:02:39 -07:00
Chris Robinson 2eb8a520d4 Add casts to silence MSVC 2013-05-22 00:07:23 -07:00
Chris Robinson 0a07ed14c2 Rename DELETE to DELETE_OBJ
Because Windows.
2013-05-21 23:42:40 -07:00
Chris Robinson 604726c639 Add a DELETE macro to help destroy objects 2013-05-21 13:27:27 -07:00
Chris Robinson eaccaa5028 Rename the effect state's Destroy method to Destruct 2013-05-21 13:02:56 -07:00
Chris Robinson a5d94f5d09 Use factories to create and destroy effect states 2013-05-21 12:47:18 -07:00
Chris Robinson af1936be5d Remove some unused code 2013-05-21 07:24:53 -07:00
Chris Robinson e4186f4903 Use a properly-defined history for the FILTER struct 2013-05-21 07:10:24 -07:00
Chris Robinson 3ee0f8feb9 Avoid storing the device frequency in the equalizer 2013-05-21 05:33:54 -07:00
Chris Robinson 5c8c40afef Auto-generate wrappers to upcast objects before calling user methods 2013-05-21 05:02:25 -07:00
Chris Robinson 5516d8df0b Use macros to help define vtables for effect states 2013-05-21 04:18:02 -07:00
Chris Robinson fba9ac6db1 Avoid storing the device frequency in the distortion state 2013-05-21 02:43:59 -07:00
Chris Robinson de387c853f The effect state being destroyed can't be NULL 2013-05-21 02:37:27 -07:00
Chris Robinson 44da54ec7f Rename some inheritance macros 2013-05-21 02:30:11 -07:00
Chris Robinson b6da74b6e2 Pre-scale the chorus and flanger delays to be in samples 2013-05-21 01:59:44 -07:00
Chris Robinson 7e9960f7f1 Avoid storing some chorus and flanger properties in the effect state 2013-05-21 01:38:43 -07:00
Chris Robinson c6872d4d86 Process 64 samples at a time for chorus and flanger effects 2013-05-20 04:41:03 -07:00
Chris Robinson 5b706f3bdc Process 64 samples at a time for some effects
This should help with the non-interleaved samples of the output, and
allow skipping channels that don't contribute to the output.
2013-05-20 04:16:48 -07:00
Chris Robinson 80459b13e4 Split flanger delay calculation into separate methods 2013-05-20 03:41:32 -07:00
Chris Robinson 012fbc36b9 Split chorus delay calculation into separate methods 2013-05-20 02:38:06 -07:00
Chris Robinson 9dae98071f Fix possible overflow when converting float to int
Same as with the mixer, we can only use 25 bits of precision from
floats.
2013-05-20 01:34:14 -07:00
Chris Robinson 4c436b106d Use some macros to help with deriving types 2013-05-20 01:32:02 -07:00
Chris Robinson 1c523df160 Remove an unused macro 2013-05-20 00:14:36 -07:00
Chris Robinson 6aa722808e Clear all the old channel gains to 0 before setting them 2013-05-20 00:02:47 -07:00
Chris Robinson c693e649e6 Fix a potential leak when mmdevapi fails to open 2013-05-19 03:19:19 -07:00
Chris Robinson 1976d64814 Avoid recalculating the same coefficient 2013-05-19 03:18:21 -07:00
Chris Robinson 78e7c1c27b Implement distortion and equalizer effects
Code provided by Mike Gorchak
2013-05-18 01:33:01 -07:00
Chris Robinson a7ad6080f0 Modulator fixes
Modulator functions return 0..1 instead of -1..+1
Apply high-pass filter before modulation
Increase fractional precision to 24 bits from 16

Thanks to Mike Gorchak
2013-05-18 00:43:09 -07:00
Chris Robinson 563f16dc2a Fix overflow issues when converting float to int
32-bit floats can only reach between -16777215...+16777215 (25 bits) before it
starts losing whole-number accuracy. Some compiler optimizations may break
trying to multiply a float by 2147483647.0 when the result is given right to a
float parameter, causing it instead to multiply by the nearest representable
float value, 2147483648.0.
2013-04-22 00:52:50 -07:00
Chris Robinson 43b406ad9b Simplify al_try code 2013-03-24 13:55:41 -07:00
Chris Robinson dd48375bd6 QSA is always build-time linked 2013-03-24 12:45:05 -07:00
Chris Robinson 678ce4109c Reorder some switch cases 2013-03-24 12:43:53 -07:00
Chris Robinson b313c881c0 Add a missing cast to silence MSVC 2013-03-22 11:21:21 -07:00
Chris Robinson 2c501f3b28 Document QSA backend options, and move PulseAudio's up 2013-03-22 11:19:50 -07:00
Chris Robinson e725db4480 Add win64build to .gitignore 2013-03-19 08:36:06 -07:00
Chris Robinson 23703ff40f Avoid an unnecessary size variable 2013-03-19 07:38:42 -07:00
Chris Robinson fb11eb1190 Avoid explicitly checking each effect to create 2013-03-19 05:39:34 -07:00
Chris Robinson 061b75b343 Fix MMDevApi backend option text 2013-03-19 05:05:00 -07:00
Chris Robinson 6bf8f01af5 Report the actual ALSA error if setting the buffer metrics fails 2013-03-18 05:21:41 -07:00
Chris Robinson bf54de4984 Use less math to clamp floats to -1...+1
The previous code could have issues as precision lowers. This should hopefully
work better while only using one if check instead of two.
2013-03-17 09:07:55 -07:00
Chris Robinson eb1080910e Use force_align_arg_pointer for QSA 2013-03-15 04:32:46 -07:00
Chris Robinson d237410d1d Add a QSA backend for QNX 2013-03-14 01:29:20 -07:00
Chris Robinson 2486f13dae Remove unnecessary NULL checks 2013-03-13 23:36:45 -07:00
Chris Robinson 3fd0f23e48 Add Chorus and Flanger effects
Code provided by Mike Gorchak
2013-03-13 23:31:12 -07:00
Chris Robinson 991aba286f Move the effect-specific get/set methods to where the effect is implemented 2013-03-13 21:53:42 -07:00
Chris Robinson a3846ba53b Don't use a custom CheckCCompilerFlag.cmake 2013-03-13 21:29:47 -07:00
Chris Robinson 0423caeb8c Use CHECK_SYMBOL_EXISTS to check for pthread_setschedparam 2013-03-13 21:20:00 -07:00
Chris Robinson f1b0f67553 Build an appropriate channel map for PulseAudio 2013-02-08 18:59:48 -08:00
Chris Robinson 89fae876a4 Only print the filename in alstream, without the path 2013-02-03 04:55:44 -08:00
Chris Robinson ac4930e233 Check the correct CMake CoreAudio option 2013-02-03 04:43:49 -08:00
Chris Robinson e358882f14 Destroy the ring buffer when closing down a portaudio device 2013-02-01 18:38:44 -08:00
Chris Robinson 564a182259 Avoid an underflow in the SSE mixers if BufferSize is less than 4 2012-12-24 05:49:44 -08:00
Chris Robinson 9cd086a707 Filter unneeded thread messages with MMDevApi 2012-12-24 05:37:53 -08:00
Chris Robinson c2adea1999 Make the context's LastError volatile 2012-12-24 05:32:15 -08:00
Chris Robinson 7d81d6b24e Look for /arch:SSE with MSVC for SSE 2012-12-24 05:26:33 -08:00
Chris Robinson 84944af142 Rename cmake options so GUIs order them better 2012-12-24 05:20:04 -08:00
Chris Robinson be25e6802d Add support for OpenSL ES 1.0.1 on Android 2012-12-12 14:36:58 -08:00
Chris Robinson 9b6a226da5 Release 1.15.1 2012-12-11 12:35:55 -08:00
Chris Robinson eb5073a8a7 Properly convert uint values when getting them as int64 2012-12-07 18:43:13 -08:00
Chris Robinson beb84bdc21 SetSourceiv should never get AL_SAMPLE_OFFSET_LATENCY_SOFT 2012-12-06 09:03:48 -08:00
Chris Robinson a20f1fa779 Use a helper to count the number of float/double values for a property 2012-12-05 20:51:25 -08:00
Chris Robinson 7445ffe1a6 Use a helper to count the number of int(64) values for a property 2012-12-05 19:58:01 -08:00
Chris Robinson c225c59b0a Remove 'v' from the source enum names 2012-12-05 18:27:05 -08:00
Chris Robinson 37a6705556 Add a comment to note the extension for sfvDistanceModel 2012-12-05 13:48:33 -08:00
Chris Robinson ed5738bfa4 Use an enum to handle int source properties 2012-12-05 09:55:05 -08:00
Chris Robinson 5e14a83030 Use an enum to handle float source properties 2012-12-05 09:22:38 -08:00
Chris Robinson 3b9b176f14 Print an error if trying to handle a missed source property 2012-12-05 08:29:38 -08:00
Chris Robinson 838f0fd71b Fix retrieving source gain 2012-12-05 08:27:02 -08:00
Chris Robinson fd83e006ec Release 1.15 2012-12-04 13:49:16 -08:00
Chris Robinson e51574c764 Trace the list of supported backends 2012-12-04 13:46:51 -08:00
Chris Robinson 893a1bedbc Use +/-90 degrees for stereo sources with non-HRTF stereo output. 2012-12-04 05:30:06 -08:00
Chris Robinson 4621a7b426 Add support for float32 output to CoreAudio 2012-12-03 11:50:02 -08:00
Chris Robinson 4808313e70 Use the correct multiplier for int32 output with CoreAudio 2012-12-03 10:44:02 -08:00
Chris Robinson 1fb9311d82 Lock the device before calling aluHandleDisconnect
PulseAudio causes an assert if being relocked inside a callback on the worker
thread, where aluHandleDisconnect is called. We can assume it's already locked
there, so just make sure the device is locked before being calling it.
2012-12-02 11:30:23 -08:00
Chris Robinson dd34daed42 Trace the opened device name in alcCaptureOpenDevice 2012-12-02 06:37:34 -08:00
Chris Robinson 830428fb06 Use WARN when implicitly deleting resources with the context 2012-12-02 01:17:26 -08:00
Chris Robinson 0ca7ab2cf8 Explicitly check for malloc.h 2012-11-25 19:20:35 -08:00
Chris Robinson a0c39989f5 malloc.h isn't standard, and is only needed for _aligned_malloc 2012-11-25 02:33:20 -08:00
Chris Robinson 209d09ae13 Avoid locking PulseAudio's mainloop when starting and stopping capture
The mainloop is already locked by the caller, and double-locking interferes
with the subsequent wait.
2012-11-19 16:50:03 -08:00
Chris Robinson 0c030f7d9c Fix a comment describing the sinc function 2012-11-18 19:02:50 -08:00
Chris Robinson 2d800e99e2 Fix off-by-one error in the makehrtf dither and add a resample option
Also fixes some size_t type warnings
2012-11-18 09:29:58 -08:00
Chris Robinson 0518ecca14 Avoid storing the SSE state if it's not supported 2012-11-13 15:20:36 -08:00
Chris Robinson 43b9027611 Return the integer from fastf2i with MSVC 2012-11-13 15:12:46 -08:00
Chris Robinson 40ea4f4b46 Use int instead of long for the IMA4 tables 2012-11-10 03:40:36 -08:00
Chris Robinson 4f624cb734 Load Int and UInt samples as float with alBufferData
This shouldn't really ever happen, as there's no 32-bit (u)int formats
alBufferData can take.
2012-11-10 03:36:37 -08:00
Chris Robinson b03013d6a7 Specify that the config file being installed is a sample 2012-11-06 03:52:41 -08:00
Chris Robinson 9e79d144de Install the config sample by default 2012-11-05 04:20:15 -08:00
Chris Robinson 40b3f60cde Install the config example into share/openal instead of /etc/openal
/etc/openal/alsoft.conf is still used for configuration, only the sample's
install placement is changed.
2012-11-05 04:14:05 -08:00
Chris Robinson 2b27d243ca Use stdout to print alstream information 2012-11-04 22:37:10 -08:00
Chris Robinson 2f07c46e20 Include standard headers before conditional ones 2012-11-04 22:36:34 -08:00
Chris Robinson 3da1b540fd Use the stored buffer metrics for the mmdevapi buffer size 2012-11-04 22:35:35 -08:00
Chris Robinson 92dde81296 Add rudimentary latency tracking for mmdevapi
This won't be as granular as it could be, since it only updates when the wakeup
event trips (which may or may not happen more often than OpenAL's mix updates).
A more correct method would be to query GetCurrentPadding directly, but that
would require sending a message to the processing thread and waiting for a
reply, since we can't guarantee COM on the calling thread.
2012-11-04 08:35:39 -08:00
Chris Robinson e2368eb960 Use an array to specify the offset for each channel of the device buffer
This effectively inverts the DevChannels array
2012-11-04 04:41:11 -08:00
Chris Robinson 3e71a7cb94 Rename some struct fields for DirectSound 2012-11-04 01:18:39 -08:00
Chris Robinson b92ad830ef Avoid recreating the DSound primary buffer 2012-11-04 00:37:31 -07:00
Chris Robinson fc7adccd6f Fix retrieving the source's write offset 2012-11-01 23:41:18 -07:00
Chris Robinson 97bf718d0e Pass the offset latency properties to the set handler 2012-11-01 18:35:20 -07:00
Chris Robinson eb6360e1f8 Set the proper error when trying to set AL_SAMPLE_OFFSET_LATENCY_SOFT or AL_SEC_OFFSET_LATENCY_SOFT 2012-11-01 00:16:44 -07:00
Chris Robinson 41b1ba146a Add an example to get and show the source latency 2012-10-31 23:53:10 -07:00
Chris Robinson 6450d0cbca Avoid prefixing function pointers in the streaming example 2012-10-31 22:38:27 -07:00
Chris Robinson 4e281350a0 Print the name of the device when opening it in the example apps 2012-10-31 17:16:56 -07:00
Chris Robinson e868dad61c Make a decimal value a float type 2012-10-31 06:58:16 -07:00
Chris Robinson 4a3d36a176 Finalize AL_SOFT_source_latency 2012-10-31 05:09:42 -07:00
Chris Robinson f3dddb6e63 Add an example program showing how to apply reverb to a source 2012-10-31 04:04:49 -07:00
Chris Robinson 3c3e3b123b Add a couple comments to the code 2012-10-26 20:11:59 -07:00
Chris Robinson f02a9935c6 Avoid branching when clamping and converting float samples to integer 2012-10-26 15:31:14 -07:00
Chris Robinson 3711735ed9 Add the AL subdir to the list of include flags in the pkg-config file
This allows apps to include "al.h", "alc.h", etc, like with Creative's SDK and
CMake's FindOpenAL module, or as "AL/al.h" and "AL/alc.h" like before.
2012-10-26 00:02:39 -07:00
Chris Robinson 2c802cc10a Reorder and comment some function in alhelpers.c 2012-10-25 23:53:46 -07:00
Chris Robinson e2e502970c Move some math functions to where they're used 2012-10-25 17:24:22 -07:00
Chris Robinson 404d601666 Add a couple missing RESTRICTs 2012-10-25 17:02:21 -07:00
Chris Robinson 252fc40f78 Fix some types 2012-10-25 15:37:52 -07:00
Chris Robinson fb21a73b4e Add the RESTRICT keyword to a function pointer definition's parameters 2012-10-25 14:52:09 -07:00
Chris Robinson 138a4c6d92 Add explicit casts for MSVC 2012-10-25 14:46:27 -07:00
Chris Robinson c802bfccef Remove the float math wrapper functions 2012-10-25 14:16:35 -07:00
Chris Robinson fae4959db3 Add retrieval of missing source properties 2012-10-21 11:36:27 -07:00
Chris Robinson 8a67e5cfa2 Use an asterisk to denote a requested format option in the trace 2012-10-16 07:46:04 -07:00
Chris Robinson 617def3ef0 Require an alignment declaration for SSE support 2012-10-15 02:23:08 -07:00
Chris Robinson 4f5aafe59f Put the HRTF DirectParams into an anonymous struct 2012-10-15 01:37:37 -07:00
Chris Robinson a14383d6cc Constify the direct and send parameters given to the mixer 2012-10-15 01:31:58 -07:00
Chris Robinson fe1903fb56 Use a separate step to deinterlace reverb samples 2012-10-14 11:55:03 -07:00
Chris Robinson f0d27e5f91 Remove the unused Device parameter 2012-10-14 11:29:28 -07:00
Chris Robinson a852669dce Store the output buffers in the DirectParams struct 2012-10-14 11:21:52 -07:00
Chris Robinson 3240894cd5 Remove the now-unused Source parameter from the DryMix methods 2012-10-14 11:04:36 -07:00
Chris Robinson 0b679167c9 Store some more HRTF info in the DirectParams struct 2012-10-14 10:57:11 -07:00
Chris Robinson 5ac0a93fba Mark some parameters as const and/or RESTRICT 2012-10-14 10:27:15 -07:00
Chris Robinson f7655d44a2 Move alhelpers and alffmpeg code to a common sub-directory 2012-10-14 01:55:39 -07:00
Chris Robinson 38e6bfb702 Use a helper method to convert i64 values to the proper types 2012-10-14 01:41:49 -07:00
Chris Robinson 20ede6de59 Check i64 property ranges before passing them to the int handlers
Note that some properties (e.g. AL_BUFFER, AL_DIRECT_FILTER) actually take
unsigned int values, and so are checked against the unsigned range even though
they eventually get casted to an int. The int handler casts them back as
needed.
2012-10-14 00:55:46 -07:00
Chris Robinson 5c70e6b9ab Don't add the dry gain to the mixing matrix 2012-10-13 11:10:58 -07:00
Chris Robinson 9bd3b88a58 Silence an implicit int-to-float conversion warning on MSVC 2012-10-13 11:00:43 -07:00
Chris Robinson e60281c927 Don't use a loop to determine the next power of 2 2012-10-13 08:58:48 -07:00
Chris Robinson 01136ecd51 List the in-progress AL_SOFT_source_latency extension 2012-10-13 00:59:46 -07:00
Chris Robinson 1212523470 Implement the double and int64 source setters
Note that currently the int64 setters do not range check before being passed to
the int setters, erroneously chopping off the upper bits.
2012-10-13 00:56:39 -07:00
Chris Robinson 73105b2d4b Fix copying the listener Up vector 2012-10-12 23:35:00 -07:00
Chris Robinson 06ab9cf70e Use the enum to set the default distance model 2012-10-12 23:28:51 -07:00
Chris Robinson a3d4868ef4 Initialize the listener velocity parameter 2012-10-12 08:01:02 -07:00
Chris Robinson 815b03855b Apply the listener matrix to the listener velocity once 2012-10-12 07:56:37 -07:00
Chris Robinson 6750bbb1d7 Avoid needlessly copying the listener matrix 2012-10-12 07:45:20 -07:00
Chris Robinson 43c8c4fa29 Apply the listener position to the transformation matrix 2012-10-12 07:38:29 -07:00
Chris Robinson 25b8a95987 Check the distance against epsilon to determine if it matches 2012-10-12 07:10:51 -07:00
Chris Robinson 99fcd6f816 Properly scale wide-stereo sources 2012-10-10 04:08:35 -07:00
Chris Robinson 513c6db0d5 Avoid mixing to a send slot if the gain is too low 2012-10-10 03:52:45 -07:00
Chris Robinson 1b7f01b7cc The max step is no longer dependent on the channel count 2012-10-10 03:40:01 -07:00
Chris Robinson a4f21aaa64 Set Hrtf.Moving after setting the source params instead of after mixing 2012-10-09 06:54:21 -07:00
Chris Robinson 39bc2ba65c Build the listener matrix separately 2012-10-09 06:19:36 -07:00
Chris Robinson d598f82722 Don't include alListener.h from alMain.h 2012-10-09 04:48:12 -07:00
Chris Robinson c22408cb2a Store a pointer to the listener in the context 2012-10-09 04:44:27 -07:00
Chris Robinson 8c3419ed48 Define RESTRICT in config.h instead of alMain.h 2012-10-09 01:46:02 -07:00
Chris Robinson a98361ebbe Don't assume x86 or x64 to use IsProcessorFeaturePresent 2012-10-08 00:43:51 -07:00
Chris Robinson 999f0783c5 Fix a type conversion warning 2012-10-08 00:32:35 -07:00
Chris Robinson 2a6dd2f243 Fix a type mismatch 2012-10-07 08:19:09 -07:00
Chris Robinson f3349221c6 Add missing include 2012-10-07 08:18:53 -07:00
Chris Robinson 65c7c468cc Use IsProcessorFeaturePresent to detect SSE on Windows 2012-10-07 08:18:22 -07:00
Chris Robinson ebdf636759 Revert "Use __cpuid from intrin.h in Windows when available"
This reverts commit 6b870714a9.
2012-10-07 08:08:11 -07:00
Chris Robinson 6b870714a9 Use __cpuid from intrin.h in Windows when available 2012-10-07 05:36:25 -07:00
Chris Robinson 708f3ccc3d Add trace, warn, and error markers to logged output 2012-10-07 04:31:31 -07:00
Chris Robinson 84f4afa5f2 Lock the device using the pulseaudio main loop 2012-10-07 02:25:59 -07:00
Chris Robinson 991e21a712 Avoid unnecessarily locking the list lock 2012-10-07 00:13:23 -07:00
Chris Robinson 1a9cf7ab80 Shorten format trace messages 2012-10-06 23:32:36 -07:00
Chris Robinson 9501f1cb9e Define WIN32_LEAN_AND_MEAN when including windows.h in alMain.h 2012-10-06 21:36:15 -07:00
Chris Robinson d52cb3708b Include windows.h before cpuid.h to avoid __cpuid clashes 2012-10-06 21:30:03 -07:00
Chris Robinson fa8d374613 Rename a couple functions
Since they don't use the stack anymore.
2012-10-05 06:44:55 -07:00
Chris Robinson 0d26b0dcc2 Put temporary storage in the device instead of on the stack 2012-10-05 06:42:26 -07:00
Chris Robinson a6287fd407 Add a special resampler for matching sample rates 2012-10-05 06:03:19 -07:00
Chris Robinson 16bdf79d4c Round up the device's default slot alignment 2012-10-05 00:32:41 -07:00
Chris Robinson 0b47844606 Fix potential buffer overflow with temp sample space 2012-10-05 00:27:29 -07:00
Chris Robinson 468759e6ab Scale and round NumUpdates when PulseAudio changes the sample rate 2012-10-04 23:36:59 -07:00
Chris Robinson f138774d78 Avoid void* arithmetic 2012-10-04 06:16:16 -07:00
Chris Robinson 068da3fe83 Make sure the output buffer pointer is updated in case multiple iterations are needed 2012-10-03 02:35:43 -07:00
Chris Robinson 29b11db13f Update the example to use avcodec_decode_audio4 2012-10-03 02:01:52 -07:00
Chris Robinson dca6254b35 Update some ffmpeg functions 2012-10-03 00:29:08 -07:00
Chris Robinson cccec40e87 Fix some signed/unsigned comparisons 2012-10-02 18:55:39 -07:00
Chris Robinson b5d9d8e005 Reset maxlength if PulseAudio updates the playback rate 2012-10-02 17:01:35 -07:00
Chris Robinson 825c5b5282 Use lrintf to fast convert floats to ints when possible 2012-09-28 04:20:55 -07:00
Chris Robinson 25ca179389 Decrease the default BUFFERSIZE to 2048 2012-09-28 03:30:57 -07:00
Chris Robinson 8bd0592e3f Combine early reflections and late reverb in VerbPass 2012-09-27 17:30:35 -07:00
Chris Robinson 06a0d1b86e Use an unsigned type for the sample position fraction 2012-09-27 13:52:45 -07:00
Chris Robinson 41b2c2f3bb Remove an unneeded parameter from the resampler 2012-09-27 02:46:15 -07:00
Chris Robinson 68faef5b84 Ensure the device's default effect slot is properly aligned 2012-09-26 18:21:03 -07:00
Chris Robinson abf1309fb6 Update a comment 2012-09-26 18:04:22 -07:00
Chris Robinson d3891af36e Ensure effect slots are aligned 2012-09-26 18:00:38 -07:00
Chris Robinson ed82194260 Deinterlace audio when loading it into the stack.
It may be better to deinterlace it on load into the buffer, though I don't
imagine this will affect much. It could be nice for consistency's sake, though
it would also complicate things if we ever want to support direct access to
buffer data.
2012-09-26 17:16:25 -07:00
Chris Robinson 012e61b105 Round when calculating NumUpdates from PulseAudio's minreq 2012-09-25 11:32:49 -07:00
Chris Robinson d19d7321d9 Remove an unnecessary include 2012-09-24 20:39:12 -07:00
Chris Robinson d4e82d441e Combine multiple loops into one 2012-09-24 19:07:07 -07:00
Chris Robinson 2ceea21f76 Avoid mixing silence to output
"Silence" being less than -100dB.
2012-09-24 15:33:44 -07:00
Chris Robinson 12327da4fe Remove SSE resamplers. They aren't gaining us much this way. 2012-09-24 14:47:06 -07:00
Chris Robinson 52d403b0d1 Make sure PulseAudio sets an update size that's a multiple of 4 samples with SSE 2012-09-20 15:01:49 -07:00
Chris Robinson ccd35bffe7 Help ensure the update size is a multiple of 4 with SSE 2012-09-20 14:54:28 -07:00
Chris Robinson d1c93525ed Fix matrix multiply used by the SSE cubic resampler
Also remove the 4-sample loop. It's not terribly effective.
2012-09-18 18:09:43 -07:00
Chris Robinson f0732426f2 Precision control bits don't exist with SSE 2012-09-18 15:08:36 -07:00
Chris Robinson eedbd1e81c Improve a couple error traces with the HRTF loader 2012-09-18 12:15:43 -07:00
Chris Robinson 6005e7f27f fpu_control.h is no longer used 2012-09-18 11:28:47 -07:00
Chris Robinson e779e64c95 Win64 doesn't allow _controlfp or __control87_2 to set the precision control bits 2012-09-18 11:20:48 -07:00
Chris Robinson 3baaf99a6e Fix a typo in a comment 2012-09-17 07:48:57 -07:00
Chris Robinson 4a86983a6f Avoid correcting for more non-existing clicks 2012-09-16 09:04:37 -07:00
Chris Robinson c19d9d3452 Don't try to correct for non-existing clicks. 2012-09-16 08:42:36 -07:00
Chris Robinson 79b6d89b3f Explicitly give the wet buffer 1 channel 2012-09-16 08:27:50 -07:00
Chris Robinson 535e8fd0f7 Check the proper value for setting WetPendingClicks 2012-09-16 08:15:03 -07:00
Chris Robinson a240abb6c8 Avoid building redundant mixers 2012-09-16 08:14:26 -07:00
Chris Robinson dd9d30e248 Implement an SSE MixSend method 2012-09-16 06:19:39 -07:00
Chris Robinson 95535ce99e Properly restore the SSE control word with __control87_2 2012-09-16 06:01:48 -07:00
Chris Robinson df2e82da78 Properly handle the SSE control word 2012-09-16 05:35:38 -07:00
Chris Robinson a1daec66e2 Use __control87_2 when available 2012-09-16 01:44:45 -07:00
Chris Robinson 657ee85136 Use a struct to store the FPU mode 2012-09-16 01:35:16 -07:00
Chris Robinson 965306b296 Add missing source property retrievals 2012-09-14 09:02:36 -07:00
Chris Robinson 28086f6cb7 Implement an SSE cubic resampler 2012-09-14 07:01:58 -07:00
Chris Robinson 45bb010b28 Shorten a warning 2012-09-14 05:05:20 -07:00
Chris Robinson 90e0c74721 Implement an SSE linear resampler 2012-09-14 04:48:53 -07:00
Chris Robinson a20341ac2a Ensure the ResampledBuffer is aligned 2012-09-14 04:16:49 -07:00
Chris Robinson 7635afcb52 Use a source param for the resampler and move them to the mixer source 2012-09-14 04:13:18 -07:00
Chris Robinson 74aee374a6 Remove an unused header 2012-09-14 03:10:12 -07:00
Chris Robinson 4f70766b95 Move a couple macros to more appropriate headers 2012-09-14 02:52:37 -07:00
Chris Robinson 9f58edd7a8 Fix up some more header includes 2012-09-14 02:42:36 -07:00
Chris Robinson 0f3a575a09 Don't include alu.h in alMain.h 2012-09-14 02:14:29 -07:00
Chris Robinson ec74fb9ba2 Enable flush-to-zero mode when possible 2012-09-14 01:10:19 -07:00
Chris Robinson ff809f2271 Move a couple methods to where they're used 2012-09-12 07:57:50 -07:00
Chris Robinson 41f52fdd6a Restore support for the previous mhr format 2012-09-12 07:25:05 -07:00
Chris Robinson aa827790bd Add a note about the hrtf_tables filename markers 2012-09-12 05:34:42 -07:00
Chris Robinson 38e7bd5359 Properly scale the HRTF delays when writing them 2012-09-12 05:11:53 -07:00
Chris Robinson 613ce3f976 Update fnamelist after handling % markers 2012-09-12 04:55:03 -07:00
Chris Robinson ce8a0a9fd5 Use PATH_MAX for the fname length 2012-09-12 03:45:26 -07:00
Chris Robinson f59e4ba7c2 Improve parsing hrtf_tables filenames 2012-09-12 03:41:41 -07:00
Chris Robinson df469bfdea Fix HRTF data format description 2012-09-11 19:55:45 -07:00
Chris Robinson f4642953d4 Warn about SSE performance with non-multiple-of-4 update sizes 2012-09-11 11:17:41 -07:00
Chris Robinson 88b0c30152 Use the correct size for defaultCoeffs 2012-09-11 10:43:53 -07:00
Chris Robinson 01183ad93b Minor cleanups for variable declarations 2012-09-11 09:40:08 -07:00
Chris Robinson 3f97af4c8c Don't use count-specific functions to write to the output buffer 2012-09-11 06:41:24 -07:00
Chris Robinson 4c5cb2189b Use a non-interleaved DryBuffer 2012-09-11 06:32:42 -07:00
Chris Robinson 98ff6f990a Do the filtering separately from the mixing 2012-09-11 05:56:19 -07:00
Chris Robinson aaa81e00b7 Use HUGE_VAL instead of dividing by 0 for infinity, where possible 2012-09-11 04:45:43 -07:00
Chris Robinson 1c44a96768 Silence a couple MSVC warnings 2012-09-11 03:29:00 -07:00
Chris Robinson 34fef456c8 Add example HRTF definition files for makehrtf 2012-09-11 03:19:03 -07:00
Chris Robinson 7e81918f7b Update HRTF code
This update allows for much more flexibility in the HRTF data. It also allows
for HRTF table file names to include "%r" to represent the device's playback
rate (e.g. if you set hrtf-%r.mhr, then it will try to use hrtf-44100.mhr or
hrtf-48000.mhr depending if the device's output rate is 44100 or 48000,
respectively).

The makehrtf utility has also been updated to support more options and input
file formats, as well as the new mhr format.
2012-09-11 02:11:51 -07:00
Chris Robinson 1b840a3db8 Again try to get _WIN32_IE to behave right with MinGW 2012-09-11 01:39:05 -07:00
Chris Robinson 4e440fff62 Remove a hack for MinGW 2012-09-10 00:19:13 -07:00
Chris Robinson 81208acd6e Add missing returns 2012-09-09 21:27:54 -07:00
Chris Robinson af3b5c23c8 Try to ensure mixing samples in multiples of 4 2012-09-09 04:27:47 -07:00
Chris Robinson 9f208417df Use the right method to clear a __m128 to 0 2012-09-09 04:09:31 -07:00
Chris Robinson f1ce139997 Use SSE to do 4 samples at once (non-HRTF direct mix), instead of to apply a matrix row
MaxCHannels no longer needs to be a multiple of 4 now, either.
2012-09-09 04:02:54 -07:00
Chris Robinson f56dddfa73 Implement MixDirect_SSE separately from the C and Neon versions 2012-09-09 00:53:54 -07:00
Chris Robinson 2bf1979d4a Move the target effect slot to the SendParams struct 2012-09-08 22:32:30 -07:00
Chris Robinson 89cab3cd39 Remove STACK_DATA_SIZE in favor of BUFFERSIZE 2012-09-08 22:09:34 -07:00
Chris Robinson 6723d27e06 Remove some unused code 2012-09-08 21:53:04 -07:00
Chris Robinson 1c03025090 Separate the resampling and mixing steps 2012-09-08 21:34:36 -07:00
Chris Robinson 7a37a63b8e Workaround MinGW __declspec(align(x)) bug 2012-09-08 19:24:07 -07:00
Chris Robinson 2b5fdad2c8 Free the global ALSA config after opening capture devices too 2012-09-02 14:26:46 -07:00
Lauri Kasanen a6f9ede849 alsa: Free the global config cache to remove a lot of reported leaks
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
2012-09-02 14:16:23 -07:00
Chris Robinson 78dac1bf4a Set the error if setting a new integer source offset fails 2012-09-01 19:31:43 -07:00
Chris Robinson 795909c39e Minor cleanups for mixer_inc 2012-08-29 02:43:19 -07:00
Chris Robinson 3c042a054d Add an SSE-enhanced path for applying the mixer matrix 2012-08-29 01:56:04 -07:00
Chris Robinson 332d66c183 Make sure device buffers are 16-byte aligned 2012-08-29 01:40:42 -07:00
Chris Robinson de006947ac Increase MaxChannels to be a multiple of 4 2012-08-29 01:11:55 -07:00
Chris Robinson 8a128e5d25 Set an error closer to where it occurs for setting source properties 2012-08-29 00:25:01 -07:00
Chris Robinson 34cbacf424 Add helpers to set source properties 2012-08-28 22:16:55 -07:00
Chris Robinson f2fa5e7c88 Print the error when reporting snd_pcm_delay failure 2012-08-27 22:52:37 -07:00
Chris Robinson 3b735cc34a Use _aligned_free for pointers returned by _aligned_malloc 2012-08-24 17:45:16 -07:00
Chris Robinson 238caa1492 Constify some parameters 2012-08-21 16:01:11 -07:00
Chris Robinson e5ebe345ad Add the option to retrieve the source offset and latency in seconds 2012-08-20 15:57:27 -07:00
Chris Robinson 965608356f Fix getting the RW offsets with alGetSourcei64vSOFT 2012-08-20 15:33:28 -07:00
Chris Robinson bc1ce7b3ac Add methods to get source properties as doubles 2012-08-20 15:26:35 -07:00
Chris Robinson 6a3619c40f Fix a parameter name 2012-08-20 14:50:43 -07:00
Chris Robinson 50fa9a44be Properly export alGetSource3i64SOFT 2012-08-20 14:48:08 -07:00
Chris Robinson 4937a48bd9 Use helper functions to read source properties
And make sure the 64-bit int getters to get 32-bit int values
2012-08-20 14:16:58 -07:00
Chris Robinson 987a81c4de Use the correct 64-bit int type for the extension functions 2012-08-20 12:22:00 -07:00
Chris Robinson f5e0500df4 Add a macro to help make a 64-bit value 2012-08-19 22:31:55 -07:00
Chris Robinson 37924887e8 Use a default method to provide a dummy latency 2012-08-19 12:31:59 -07:00
Chris Robinson 0db7c4131b Hold the device lock with PulseAudio between mixing and writing 2012-08-18 17:20:20 -07:00
Chris Robinson a56a974149 Hold the device lock with ALSA between mixing and writing 2012-08-18 17:18:53 -07:00
Chris Robinson af7f3768fa Use non-blocking access for ALSA playback 2012-08-18 17:01:56 -07:00
Chris Robinson 0865db564f Move the device lock into the backend function table
For backend-specific implementations: this should hold the audio mixer loop for
playback devices, and provide recursive mutex behavior.
2012-08-18 15:58:04 -07:00
Chris Robinson 2b020040b4 Keep the backend device open until the last reference is released
This should generally happen with the next ALCdevice_DecRef call unless the
device is in the middle of being used in another thread, in which case it's
probably best to not remove the resources.
2012-08-18 14:49:42 -07:00
Chris Robinson 3ae5fcbd7e Add the start of AL_SOFT_source_latency
This extension will provide a way for apps to get accurate latency and playback
position information
2012-08-18 11:06:39 -07:00
Chris Robinson ac4fc4026c Add a device method to retrieve the active latency
This is effectively the time until the next update will be heard by the user,
or the closest approximation thereof, in nanoseconds.
2012-08-17 13:38:52 -07:00
Chris Robinson 9737f68315 Place the alignment attribute before the variable declaration 2012-08-16 10:42:48 -07:00
Chris Robinson 2a8c26e390 Remove extra parenthesis used in the aligned attribute declaration 2012-08-16 10:33:37 -07:00
Chris Robinson 3c395a82db Fix aligned allocator fallback 2012-08-16 10:30:13 -07:00
Chris Robinson 15c6b9b165 MSVC wants __declspec(align), not __declspec(aligned) 2012-08-16 10:23:25 -07:00
Chris Robinson 147fd9de4e Avoid dynamic handling of libsndio
This makes it safer and easier to handle as OpenBSD updates it
2012-08-16 10:12:50 -07:00
Chris Robinson 0bca771a88 Apply HRTF mixer coefficients with stepping using SSE 2012-08-15 08:19:04 -07:00
Chris Robinson f4ff63e271 Check the max CPUID functions before calling them 2012-08-15 06:28:45 -07:00
Chris Robinson bbcf4e8c1d Make sure sources are 16-byte aligned
They contain fields that require 16-byte alignment for SSE (and Neon?)
acceleration.
2012-08-15 05:54:13 -07:00
Chris Robinson 2859357939 Add wrapper methods to ensure aligned allocations 2012-08-15 05:50:40 -07:00
Chris Robinson 2cbb565d09 Ensure some HRTF-related parameters are aligned 2012-08-15 04:10:41 -07:00
Chris Robinson 4d157d2849 Make sure the working coefficients are aligned for the SSE mixer 2012-08-15 03:43:36 -07:00
Chris Robinson 64cd763e19 Remove unused filter functions 2012-08-15 01:48:47 -07:00
Chris Robinson c3f387da70 Check for and use the -msse switch when dealing with SSE intrinsics 2012-08-15 01:46:42 -07:00
Chris Robinson 6ebeb3b4f7 Check the correct macro for ARM Neon support 2012-08-15 01:32:17 -07:00
Chris Robinson 2e18baa3c8 Don't bother handling MMX since we don't use it 2012-08-15 01:29:19 -07:00
Chris Robinson c9e87a19a9 Add cmake options to disable or require support for CPU extensions 2012-08-15 01:24:50 -07:00
Chris Robinson 3b87e29e63 Move mixers into separate source files 2012-08-15 01:01:55 -07:00
Chris Robinson e9a20cb985 Add an SSE-enhanced HRTF mixer using intrinsics
Not as good as it could be, but it's something
2012-08-14 03:53:07 -07:00
Chris Robinson cfc5205569 Fix a typo 2012-08-13 22:31:58 -07:00
Chris Robinson 17dfaa3aae Add a config option to disable use of CPU extensions 2012-08-13 10:37:49 -07:00
Chris Robinson 0a3eba08d8 Allow building multiple types of mixers, selecting based on CPU caps 2012-08-13 09:18:46 -07:00
Chris Robinson add53e28c2 Check for some CPU extensions 2012-08-13 09:07:01 -07:00
Chris Robinson f42f655ea9 Don't unlock the pulseaudio mainloop when mixing
Lock contention could cause a lengthy delay between mixing and writing the
audio. There shouldn't be any risk of dead-locking as the device lock should
never be held when the mainloop gets locked.
2012-08-12 03:52:38 -07:00
Chris Robinson 8304fc1bef Handle the scalar values a bit better 2012-08-11 06:20:24 -07:00
Chris Robinson ea84fee952 Use a more efficient method to blend HRTF delays and coefficients 2012-08-11 02:16:34 -07:00
Chris Robinson d6fd52a0e5 Add an option for wide stereo sources
Replaces the old stereodup option
2012-08-09 05:38:07 -07:00
Chris Robinson 0dde7dd88a Use a more efficient method to offset the speaker angles when computing gains 2012-08-09 02:31:19 -07:00
Chris Robinson 1323e11701 Interpolate between HRTF delay samples using the delay fraction 2012-07-20 15:08:11 -07:00
Chris Robinson 7ac9944bb3 Increase the directional change sensitivity for the HRTF delta 2012-07-20 14:38:49 -07:00
Chris Robinson e32e2fd6b8 Fix an inadvertent change in the HRTF coefficient stepping value array size 2012-07-19 11:49:43 -07:00
Chris Robinson 6bd535bed0 Use wrappers for float-typed math functions 2012-06-29 02:12:36 -07:00
Chris Robinson 524c88c402 Test the squared length of a vector before normalizing 2012-06-28 20:54:10 -07:00
Chris Robinson 1c096b101d Minor typo fixes 2012-06-28 19:57:23 -07:00
Chris Robinson 583dc8dbca Don't use all caps for enum value names 2012-06-28 18:49:49 -07:00
Chris Robinson befa4e7528 Don't try to set FE_TOWARDZERO when it's not available 2012-06-28 18:27:45 -07:00
Chris Robinson bc6751237c Clamp the Y position before trying to get the elevation 2012-06-28 17:26:00 -07:00
Chris Robinson 6f3be31b60 Add some includes 2012-06-20 03:01:19 -07:00
Chris Robinson 8001d86751 Add missing include 2012-06-19 22:15:19 -07:00
Chris Robinson acca3e5a21 Use a proper method to wait for a PulseAudio operation 2012-06-19 10:37:09 -07:00
Chris Robinson d17f835e74 Remove an unused include 2012-06-19 04:02:55 -07:00
Chris Robinson ef1f8aa9a0 Don't needlessly verify a device 2012-06-19 00:25:45 -07:00
Chris Robinson a5ac6eb524 Remove an outdated comment about _REENTRANT 2012-06-18 02:04:10 -07:00
Chris Robinson ac84d95c6e Silence some GCC warnings 2012-06-17 22:17:03 -07:00
Chris Robinson 785f52aa29 Only try float32 with DSound when specifically requested
Some hardware drivers seem to have a bug where a buffer descriptor with a
32-bit float sample type ends up creating a non-float32 buffer.
2012-06-17 04:13:01 -07:00
Chris Robinson 051195a991 Avoid failing if ALSA can't set a buffer or period time near to our request
These functions should not fail, but there seem to be bugs that cause them to
sometimes. We're flexible enough to handle almost anything it throws back at us
though, so anything is better than nothing here.
2012-06-16 23:02:59 -07:00
Chris Robinson 90ca6675c2 Allow PulseAudio to spawn a server by default
Since only one backend is used at a time now, the issues with device ownership
aren't really prevelant anymore. An application that tries to open all
enumerated devices won't run into the problem of spawning a server and end up
preventing other backend devices from working.
2012-06-16 22:37:45 -07:00
Chris Robinson 0db9730a50 Add an option to allow PulseAudio to move streams
This could be made the default, if there's a safe way to update the AL device
specifier.
2012-06-16 22:32:19 -07:00
Chris Robinson ad2643d8af Clarify some comments, fix some definition ordering, and add some includes 2012-06-15 23:46:09 -07:00
Chris Robinson 46840ee787 Add DEVPKEY_Device_FriendlyName declaration for mingw-w64 compatibility 2012-06-14 18:10:10 -07:00
Chris Robinson 1e0282a238 Add some more entries to .gitignore 2012-05-09 16:30:22 -07:00
Chris Robinson 259e4f5b38 Rename AllDevice -> AllDevices 2012-05-09 16:28:16 -07:00
Chris Robinson e44229c74e Clamp the ALSA period time between min and max if setting near fails 2012-05-08 01:23:53 -07:00
Chris Robinson 92827cc467 Clamp the ALSA buffer time between min and max if setting near fails
It seems there's some bugs with snd_pcm_hw_params_set_buffer_time_near that
cause it to return "invalid argument" despite a valid nearby buffer time being
available. Clamping the buffer time seems to mitigate the issue a bit.
2012-05-07 11:42:59 -07:00
Chris Robinson dd3d5bc2d4 Look for libsndio.so.2 instead of libsndio.so 2012-05-05 16:19:51 -07:00
Chris Robinson b4c7b3309a Only use _FPU_GETCW and _FPU_SETCW for x86 targets 2012-05-03 12:15:51 -07:00
Chris Robinson 010a66487d Use 2 chained one-pole filters for the wet path 2012-04-30 09:33:00 -07:00
Chris Robinson aed35fd811 Use ComputeAngleGains for multi-channel sources and remove the unused lookup table stuff 2012-04-29 05:04:46 -07:00
Chris Robinson 8d9838012d Remove the stereodup option
There's better ways to do it now with "wide" sound sources.
2012-04-29 04:44:53 -07:00
Chris Robinson 57d36ec582 Fix a couple comment typos, and a minor cleanup 2012-04-29 03:39:08 -07:00
Chris Robinson febc2a50cb Use ComputeAngleGains for 3D sounds 2012-04-28 13:06:16 -07:00
Chris Robinson 74e128bd0f Fix ComputeAngleGains
The old code would improperly handle speakers just inside or outside the
coverage area if it had to be inverted. It also didn't properly handle when
only one speaker was outside of the covered area.
2012-04-28 12:12:02 -07:00
Chris Robinson c34d78f417 Use ComputeAngleGains for the echo and dedicated effects 2012-04-28 08:24:09 -07:00
Chris Robinson 611bd0b2d3 Add a method to calculate gains given a sound point and its half-width, and use it for reverb
The half-width ranges from 0 to pi, and essentially specifies the coverage area
around the listener. At 0, it's an infinitely small point sound and behaves
like a usual panning sound. At pi/2 it covers half the area, and at pi it
covers the whole area.
2012-04-28 08:21:53 -07:00
Chris Robinson 267d38cf20 Flip the parameters to aluCart2LUTpos, so it behaves a bit more like atan2 2012-04-28 03:58:58 -07:00
Chris Robinson 26456f13e1 Pass the direct/send params to the mixer instead of accessing through the source 2012-04-28 03:31:13 -07:00
Chris Robinson 2484c44db0 Apply the listener gain with the filter 2012-04-28 03:13:37 -07:00
Chris Robinson a8a13fcbd8 Move the HrtfParams into the DirectParams 2012-04-28 02:23:53 -07:00
Chris Robinson 0a193c5645 Move the direct and send params into separate different types 2012-04-28 01:32:52 -07:00
Chris Robinson 2450ee1723 Use separate methods for the dry and wet mixing loops 2012-04-27 23:46:51 -07:00
Chris Robinson 67f1cdfcbe Store the speaker angles in the device 2012-04-27 07:38:17 -07:00
Chris Robinson 549d542a31 Reorganize some ALsource fields 2012-04-27 01:36:13 -07:00
Chris Robinson 2cdb58fb85 The mixer always uses floats 2012-04-26 07:50:17 -07:00
Chris Robinson 68ab232364 Use a separate loop to actually update DataPosFrac and DataPosInt 2012-04-26 06:44:37 -07:00
Chris Robinson 871d61f3f9 Add and fixup some ALsource comments 2012-04-26 03:26:22 -07:00
Chris Robinson b08bd3746e Add AL_EXT_SOURCE_RADIUS to alext.h 2012-04-26 02:05:49 -07:00
Chris Robinson 39ab0b0aa3 Add AL_EXT_STEREO_ANGLES to alext.h 2012-04-26 01:19:25 -07:00
Chris Robinson 5c70cacc13 Fixup some comments in ALu.c 2012-04-26 00:59:17 -07:00
Chris Robinson 8c2cd057b2 Fix a minor typo 2012-04-25 19:37:12 -07:00
Chris Robinson fdc4133ac9 Partially convert alEffect.c and alFilter.c to the new error handling 2012-04-25 00:24:02 -07:00
Chris Robinson 3833c021c0 Move a comment 2012-04-25 00:03:01 -07:00
Chris Robinson cafbd9461e Fix up alEffect.c and alFilter.c a bit 2012-04-24 23:06:10 -07:00
Chris Robinson 6995ac1ed2 Change alAuxEffectSlot.c to the new error handling 2012-04-24 22:57:23 -07:00
Chris Robinson 58e3dc3d52 Add a SIGTRAP for when alGetError is called without a context 2012-04-24 21:41:01 -07:00
Chris Robinson 3e49e79140 Couple small error handling fixups 2012-04-24 03:52:21 -07:00
Chris Robinson dec8e81211 Change alState.c to the new error handling 2012-04-24 03:09:28 -07:00
Chris Robinson 4188a5f3f3 Fix compiling al.h with C++ 2012-04-24 02:51:23 -07:00
Chris Robinson 31d124582b Switch alBuffer.c to the new error handling scheme, and get rid of more hungarian notation 2012-04-24 00:17:05 -07:00
Chris Robinson 248e079301 Switch alListener.c to the new error handling scheme, and get rid of more hungarian notation 2012-04-23 21:35:05 -07:00
Chris Robinson 5ce850570f Add try/catch-like macros to handle errors, and convert alSource.c to use them 2012-04-23 19:46:05 -07:00
Chris Robinson 648464a2da Check the right playback device file with OSS 2012-04-22 05:06:44 -07:00
Chris Robinson 29f77003c0 Some alSource.c cleanups 2012-04-21 05:56:03 -07:00
Chris Robinson dfa38ed7a5 Reformat alc/h and al.h, and redo the comments 2012-04-21 04:34:08 -07:00
Chris Robinson 66c918c84b Remove export pragmas from headers
Available information suggests it's only useful for Mac OS9 and earlier (not
OSX).
2012-04-20 22:53:47 -07:00
Chris Robinson 77f55da6c7 Use a macro to declare the function and enum list members 2012-04-20 22:38:03 -07:00
Chris Robinson d6af7cdcb2 Rename another variable to avoid hungarian notation 2012-04-20 22:37:36 -07:00
Chris Robinson 0ad8047820 Combine ALCenum and ALenum lists 2012-04-20 01:24:58 -07:00
Chris Robinson 2115f578e9 Reorganize ALC functions and fixup some comments 2012-04-20 01:18:38 -07:00
Chris Robinson 511b4790d0 Remove hungarian notation from dsound and mmdevapi 2012-04-19 23:42:02 -07:00
Chris Robinson d6491e21f9 Remove some more hungarian notation 2012-04-19 23:28:34 -07:00
Chris Robinson cff0f938e5 Remove hungarian notation from the winmm backend 2012-04-19 23:22:11 -07:00
Chris Robinson 5418519637 Remove some more hungarian notation 2012-04-19 23:00:58 -07:00
Chris Robinson b023dbe7b8 Remove hungarian notation from the device and context structs 2012-04-19 22:50:11 -07:00
Chris Robinson 8092cd9205 Remove hungarian notation from some function parameters 2012-04-19 22:40:40 -07:00
Chris Robinson 60da5bd338 Remove an unused field 2012-04-19 22:32:04 -07:00
Chris Robinson c9e64596a4 Use a consistent name for the self-id field 2012-04-19 22:28:01 -07:00
Chris Robinson 08bd5e8b37 Fix comment and rename the buffer's self-id 2012-04-19 22:14:02 -07:00
Chris Robinson 125b743e5c Remove hungarian notation from sources 2012-04-19 21:46:29 -07:00
Chris Robinson 9a3eb397f4 Print the device name in printALCInfo 2012-04-16 23:27:13 -07:00
Chris Robinson 84c1f2bfd0 Avoid shadowing a couple variables 2012-04-16 23:09:36 -07:00
Chris Robinson d7ba49ea62 Clear the position fraction when setting a new source offset 2012-04-16 22:13:39 -07:00
Chris Robinson e47557630e Use a double to store the source offset and don't use milliseconds for seconds 2012-04-16 22:11:03 -07:00
Chris Robinson f6a1e53f19 Read ALSOFT_TRAP_*ERROR when reading the config 2012-04-16 20:13:50 -07:00
Chris Robinson a0a015f19f Set a 1MB stack size for created threads 2012-04-16 19:15:48 -07:00
Chris Robinson e3bea63f94 Check for a recent libavutil for the example, too 2012-04-07 12:35:59 -07:00
Chris Robinson 6b154025ab Release 1.14 2012-03-28 08:55:17 -07:00
Chris Robinson b9b2bdb37a Make sure we have a recent-enough ffmpeg 2012-03-27 08:52:21 -07:00
Chris Robinson 7b35c77062 Add a missing round() for MSVC 2012-03-27 08:44:08 -07:00
Chris Robinson c23cfdcfa1 Make sure M_PI is defined for makehrtf 2012-03-27 08:20:04 -07:00
Chris Robinson 929e9bfac1 Avoid DOS-style line-endings and stdint types for the makehrtf utility 2012-03-25 19:57:40 -07:00
Chris Robinson b51afb74da Add a utility to generate OpenAL Soft's HRTF data from the MIT KEMAR data 2012-03-22 22:45:03 -07:00
Chris Robinson 5a43cd3b64 Use avformat_free_context to free a format context that failed to open 2012-03-21 13:54:13 -07:00
Chris Robinson 5d08563975 Handle very small speed of sound values 2012-03-18 08:20:08 -07:00
Chris Robinson adb83ad3c0 Avoid converting positions to meters 2012-03-18 08:09:59 -07:00
Chris Robinson 2d0e028993 Base the initial reverb decay on the source's dry path attenuation 2012-03-18 08:06:21 -07:00
Chris Robinson 703d72f20e Use the correct loop count for reading the elevation offsets from external HRTF files 2012-03-17 03:42:07 -07:00
Chris Robinson b7d67d8bcc Don't error when querying unknown enums for the channel config and sample format 2012-03-15 15:22:58 -07:00
Chris Robinson 7e5b13aabd Finalize ALC_SOFT_loopback 2012-03-15 15:21:15 -07:00
Chris Robinson 7fbcb4b9e6 Use the actual distance from the ref distance for air absorption and initial reverb decay 2012-03-14 22:45:52 -07:00
Chris Robinson 767a5b3c73 Mark the GlobalContext pointer as volatile 2012-03-14 00:13:16 -07:00
Chris Robinson a08080bd82 Avoid modifying the ALCdevice in portaudio's open method 2012-03-13 22:18:51 -07:00
Chris Robinson 415bf58a06 Store the portaudio stream parameters with the device 2012-03-13 21:52:47 -07:00
Chris Robinson 3b517bfa59 Initialize the default effect after opening the device 2012-03-13 19:02:26 -07:00
Chris Robinson e356527a88 Rename GetReverbEffect to LoadReverbPreset 2012-03-13 15:48:51 -07:00
Chris Robinson 07e34cc3cf Use enums to specify the default channel configuration and sample type 2012-03-13 15:32:44 -07:00
Chris Robinson f7f1dd1346 Initialize the default effect when opening the device and update it with the other effect slots 2012-03-13 15:07:38 -07:00
Chris Robinson 92ccacdc77 Pass the device to InitializeEffect and return the error enum from it 2012-03-13 14:58:34 -07:00
Chris Robinson b5ed2a5351 Pass a device to the effect update functions 2012-03-13 14:49:58 -07:00
Chris Robinson 55c5e4fe92 Rename ForcedEffect to DefaultEffect 2012-03-13 14:38:09 -07:00
Chris Robinson 3b165809cc Minor coreaudio fix, and make sure to set the device name 2012-03-13 13:48:42 -07:00
Chris Robinson 5c59e6e704 Try to ensure the full mmdevapi buffer is used 2012-03-13 01:39:57 -07:00
Chris Robinson ef2f237276 Try to ensure at least 2 mmdevapi updates 2012-03-13 01:35:31 -07:00
Chris Robinson 0af14c7a11 Try to find a multiple of mmdevapi's period size nearest to the wanted update size 2012-03-13 01:32:15 -07:00
Chris Robinson 8ef777ebbe Restore the FPU mode in an error path 2012-03-12 23:58:12 -07:00
Chris Robinson 305d790a19 Revert the default stereo layout back to -90 and +90 degrees
For the time being, until better stereo spatialization can be implemented and
headphones can be better detected.
2012-03-12 22:49:10 -07:00
Chris Robinson 1f3c1091d3 Finalize AL_SOFT_direct_channels 2012-03-12 22:46:13 -07:00
Chris Robinson 663b43f4f1 Attempted fix for the coreaudio backend 2012-03-12 21:58:40 -07:00
Chris Robinson 3e0cf0f239 Simply (hopefuly) the explanation about the HRIR set ordering 2012-03-12 18:42:21 -07:00
Chris Robinson 560f34e3df Channel angle is already in radians, not degrees 2012-03-12 18:29:46 -07:00
Chris Robinson 335232207d With DirectChannels enabled, don't try to mix channels that have no matching output 2012-03-12 18:27:25 -07:00
Chris Robinson 93e71f0554 Some HRTF clarifications 2012-03-12 17:54:16 -07:00
Chris Robinson 0efbf7bc9e Fix typo 2012-03-12 17:15:44 -07:00
Chris Robinson 3daaa078fb Add a note about the HRTF data being minimum-phase reconstructed 2012-03-12 17:14:42 -07:00
Chris Robinson 647448a32b Reset HAVE_MMDEVAPI before checking the backends 2012-03-12 15:33:56 -07:00
Chris Robinson f7a8e3db35 Don't assume the calculated HRTF delta for the gain difference is less than 1 2012-03-12 13:31:19 -07:00
Chris Robinson 7747c320a8 Remove an unused property key definition 2012-03-12 12:56:52 -07:00
Chris Robinson ebc69bc870 Minor corrections to the hrtf.txt 2012-03-12 00:58:14 -07:00
Chris Robinson 10e2b7ecbf Document the hrtf_tables config option 2012-03-11 19:29:19 -07:00
Chris Robinson 842a698f2b Add a text file explaining OpenAL Soft's HRTF support and data file format 2012-03-11 19:27:40 -07:00
Chris Robinson f5f519aa80 Properly make the source velocity relative to the listener velocity 2012-03-09 23:53:45 -08:00
Chris Robinson 7db29a2332 Clamp the upper and lower bound of the doppler velocity scale more like the original 2012-03-09 22:38:26 -08:00
Chris Robinson 6e70ae9958 The listener velocity is specified in world coordinates, too 2012-03-08 18:27:05 -08:00
Chris Robinson e190fc9416 Refactor the doppler shift calculations 2012-03-08 18:19:15 -08:00
Chris Robinson 1a4a0abd1a Pin the DLL for Windows
The mmdevapi backend does not react well to being unloaded dynamically. It has
a message-handling thread running in the background which can't quit before
DllMain is called with DLL_PROCESS_DETACH, at which point it's too late to
safely message and wait for it shutddown, thus it can continue running after
the DLL is unloaded from memory.
2012-03-08 17:42:16 -08:00
Chris Robinson dddacc25a5 Store a duplicate of the mmdevapi device ID 2012-03-06 13:15:55 -08:00
Chris Robinson 2ba2da467c Add a comment explaining the pulseaudio prop_filter 2012-03-06 12:01:15 -08:00
Chris Robinson f2b64fd111 Update the ALCdevice in winmm's reset method instead of open 2012-03-06 10:14:05 -08:00
Chris Robinson 6623f69476 Mark the device as running for capture, too 2012-03-05 15:10:02 -08:00
Chris Robinson db36574667 Hold the list lock while calling the backend
Pretty ugly, but we mustn't hold the device lock
2012-03-05 14:53:25 -08:00
Chris Robinson 3131104595 Filter out a couple pulseaudio stream properties by setting them to 0-length data
It seems Qt/Phonon will globally set media.role and phonon.streamid properties,
causing them to apply even to our streams if they happen to be loaded in the
same process. This is particularly a problem because media.role gets set to
"event", preventing the streams from showing in pavucontrol.
2012-03-05 13:00:51 -08:00
Chris Robinson f64bdc4bd4 Returned pa_operations can be NULL 2012-03-05 08:37:50 -08:00
Chris Robinson fe6e532c87 Use a separate backend callback to start playback of the device
This allows us to properly update the ALCdevice and its resources with the new
parameters before starting playback, instead of expecting the mixer to block
and wait after it has begun.

This also lets us avoid holding the device lock while resetting and starting
the device, which helps prevent lock inversion on some backends (ie, one thread
locking A then B, and another thread locking B then A), ultimately allowing
certain backends to asynchronously update the ALCdevice without risk of lockup.
Capture still has issues here, however.
2012-03-05 07:11:09 -08:00
Chris Robinson 5cdeeb47f3 Avoid some uninitialized warnings 2012-03-05 00:28:57 -08:00
Chris Robinson bc1bb7f90f Print and handle errors from pa_stream_readable_size 2012-03-05 00:11:28 -08:00
Chris Robinson 0f0141b9dd Set prebuf to 0 since we're handling the stream start manually 2012-03-04 09:24:07 -08:00
Chris Robinson 302c08a14b Enforce range limits on periods and period_size. 2012-03-04 05:44:37 -08:00
Chris Robinson b643f13a6e Make sure the pulse stream is properly started and better handle buffer size changes 2012-03-04 05:30:42 -08:00
Chris Robinson 487d05a73e Invert a nested loop 2012-03-03 10:31:27 -08:00
Chris Robinson 91ed077eba Handle BS2B cross-feed right after click removal 2012-03-03 09:41:16 -08:00
Chris Robinson 49433c2074 Slight correction for handling the wave writer backend's timer wrapping 2012-03-03 08:50:15 -08:00
Chris Robinson a93ff6ef3c Slight correction for handling the null backend's timer wrapping 2012-03-03 08:47:23 -08:00
Chris Robinson 44e10c4f69 Remove some unneeded pulseaudio calls 2012-03-02 09:46:36 -08:00
Chris Robinson 7a832c4522 Don't unload libpulse
This sometimes spawns esoteric errors in dlclose
2012-03-02 09:27:30 -08:00
Chris Robinson 7d0faba424 Remove some unneeded markers 2012-03-02 09:08:17 -08:00
Chris Robinson 01d942628b Set prebuf to the expected buffer size
This is to make sure the stream starts even if PulseAudio increases tlength.
2012-03-02 05:38:11 -08:00
Chris Robinson 2a9012c94d Don't rely on PulseAudio to wake us up using early requests 2012-03-02 04:51:29 -08:00
Chris Robinson b571926a6d Avoid a leak if PortAudio fails to give a usable channel count 2012-03-02 02:14:04 -08:00
Chris Robinson f784aa704d Make sure the device gets stopped when closing even if there's no contexts 2012-03-02 00:10:24 -08:00
Chris Robinson 153affac12 Recalculate the new update size using the device's UpdateSize 2012-03-02 00:08:56 -08:00
Chris Robinson e5d365a3d9 Avoid an unnecessary doCapture check 2012-03-01 20:47:49 -08:00
Chris Robinson 6ffaabeb75 Update the layout config option names 2012-03-01 10:06:55 -08:00
Chris Robinson 06debb153d Fix a memory leak 2012-03-01 09:56:25 -08:00
Chris Robinson 51e6786f31 Set the func list after successfully connecting to PulseAudio 2012-03-01 09:22:37 -08:00
Chris Robinson 50ef19720d Make alcLoopbackOpenDeviceSOFT take a standard "device" name for a parameter 2012-03-01 08:30:21 -08:00
Chris Robinson db4d62d17c Print out a more descriptive name for the opened device in openal-info 2012-03-01 06:59:51 -08:00
Chris Robinson 8d24bd720f Don't use GUIDs to ID mmdevapi devices, and don't enumerate if not needed 2012-03-01 06:07:00 -08:00
Chris Robinson 55556f0e6c Avoid enumerating when opening the default ALSA device 2012-03-01 04:58:28 -08:00
Chris Robinson 7d9cabebff Use NULL to open the default PulseAudio device, and get the actual device name from the stream 2012-03-01 04:37:40 -08:00
Chris Robinson 9602c46809 Move some function definitions down 2012-03-01 04:12:47 -08:00
Chris Robinson 85daab0d5e Don't define lib handles when dynamic loading is disabled 2012-03-01 03:46:45 -08:00
Chris Robinson 105faa1935 Only support PA_API_VERSION 12 2012-03-01 03:29:28 -08:00
Chris Robinson b299b90964 Update the stored buffer attributes if PulseAudio changes it 2012-03-01 03:09:15 -08:00
Chris Robinson 346f1ac293 Don't allow the PulseAudio stream to move
Since the device specifier isn't updated to reflect the change, it's best to
not allow it to move. This should be fixed eventually.
2012-03-01 02:52:32 -08:00
Chris Robinson 6e113eea89 Don't force a sample spec when looking for the default device 2012-03-01 01:34:49 -08:00
Chris Robinson 54f906b347 Don't check if the pulseaudio sink is suspended when opening 2012-03-01 01:19:07 -08:00
Chris Robinson 4b252bc494 Constify a couple string pointers 2012-03-01 01:03:37 -08:00
Chris Robinson b192165fb4 Look for and enumerate the default PulseAudio source first 2012-02-29 23:52:10 -08:00
Chris Robinson f887f4efdd Use a separate function to create and connect a PulseAudio record stream 2012-02-29 23:46:30 -08:00
Chris Robinson b37e54eead Look for and enumerate the default PulseAudio sink first 2012-02-29 23:35:01 -08:00
Chris Robinson ea4f458c1d Avoid enumerating multiple devices with the same name 2012-02-29 23:21:38 -08:00
Chris Robinson 394c76d64f Avoid passing the ALCdevice to connect_playback_stream 2012-02-29 23:13:09 -08:00
Chris Robinson d34fc21a50 Print the enumerated devices from PulseAudio 2012-02-29 22:31:51 -08:00
Chris Robinson f5435aa2de Minor cleanups for OSS and Solaris 2012-02-29 21:45:44 -08:00
Chris Robinson e88f954cbf Allow reading audio from ALSA directly if the requested length is supported 2012-02-29 10:01:45 -08:00
Chris Robinson fe897f291b Don't store the frame size with pulse_data 2012-02-29 06:51:21 -08:00
Chris Robinson fbb6239299 Read capture data from pulseaudio as needed, avoiding a ring buffer 2012-02-29 05:57:54 -08:00
Chris Robinson ae1633497c Get and release the mmdevapi render client iface on the message thread 2012-02-29 05:54:58 -08:00
Chris Robinson 00b0e64bd2 Use local variables to determine how much to write to mmdevapi 2012-02-29 00:32:20 -08:00
Chris Robinson 2747c87893 Print out unsupported audio format info from ffmpeg 2012-02-28 04:04:52 -08:00
Chris Robinson 2285c79ded Give "OpenAL Soft" for the standard device name 2012-02-28 03:36:16 -08:00
Chris Robinson 230e784b9e Trace the name of the created device 2012-02-27 21:57:33 -08:00
Chris Robinson 4b88168edb Use a switch to handle the ALSA PCM state 2012-02-27 04:31:03 -08:00
Chris Robinson f29fbdf088 Print enumerated ALSA devices 2012-02-26 23:02:29 -08:00
Chris Robinson 233acff3c4 Print enumerated dsound devices 2012-02-26 22:55:50 -08:00
Chris Robinson 5e625c9a68 Watch for unsupported sample types for dsound capture 2012-02-26 22:03:27 -08:00
Chris Robinson da4408835d Print the mmdevapi device and GUID found 2012-02-26 21:59:27 -08:00
Chris Robinson b78b8f0c82 Use separate loops for getting and checking device attributes 2012-02-25 18:03:33 -08:00
Chris Robinson 484e8f07a0 Watch for CLSIDFromString errors 2012-02-23 21:41:24 -08:00
Chris Robinson 504cdadd60 Use an enum for the device type 2012-02-23 15:25:30 -08:00
Chris Robinson 45c10229d9 Print a message when loading the "none" reverb preset 2012-02-23 13:49:46 -08:00
Chris Robinson 973b92b8fd Minor rearrangements for the pulseaudio mixing loop 2012-02-22 18:33:28 -08:00
Chris Robinson 6ba0fd25a2 Remove an unneeded wrapper 2012-02-22 18:08:15 -08:00
Chris Robinson 1dde8ad60b Use the stored minreq size from PulseAudio for rounding off the length to write 2012-02-21 18:07:20 -08:00
Chris Robinson 45b9cbe2b3 Only probe for devices when a backend is loaded 2012-02-20 22:12:48 -08:00
Chris Robinson 14912229b1 Avoid default names for winmm and dsound 2012-02-20 22:03:08 -08:00
Chris Robinson 2b64df05e6 Avoid using a default name with the MMDevApi backend 2012-02-20 21:46:01 -08:00
Chris Robinson 01d8d956da Avoid using a default name when opening a PulseAudio device 2012-02-20 21:03:54 -08:00
Chris Robinson 4f0d862cbe Set the default ALSA device name when probing 2012-02-20 20:59:55 -08:00
Chris Robinson e2ccc6f98e Always use "OpenAL Soft" for the short device enumeration list 2012-02-20 20:45:22 -08:00
Chris Robinson d24ada7ab7 Don't accept the pulseaudio default name for capture 2012-02-20 20:29:20 -08:00
Chris Robinson 54e2316b65 Use a string to report unsupported capture sample types 2012-02-20 20:25:58 -08:00
Chris Robinson 58316a97d5 Override the resampler as needed right after calculating the step value 2012-02-20 20:08:45 -08:00
Chris Robinson 771ef3e8d5 Rename p -> hp for ALSA's hw params 2012-02-20 12:46:09 -08:00
Chris Robinson 65ed18960e Add a text file describing the available environment variables 2012-02-19 23:03:04 -08:00
Chris Robinson 799f8da333 Recognize "none" to disable the default reverb 2012-02-19 17:41:42 -08:00
Chris Robinson 40bb8bd9dc Remove the trailing double-underscore from a couple env vars 2012-02-19 17:24:01 -08:00
Chris Robinson 426f0273cb Remove mention of the environment variables from alsoftrc.sample
There will be a separate file to document all of them.
2012-02-19 17:20:02 -08:00
Chris Robinson 03ec2d6fc7 Check for the ALSOFT_DRIVERS env var for a list of backend drivers
This overrides the 'drivers' config option
2012-02-19 14:27:00 -08:00
Chris Robinson e4f14fdc61 Check the pulse spawn-server config option before testing a connection to pulseaudio 2012-02-19 14:07:44 -08:00
Chris Robinson 418c766493 Use memset to clear the bs2b filter's last sample and remove the unused is_clear function 2012-02-19 13:09:29 -08:00
Chris Robinson 4a65747a4b Add a COUNTOF macro to get the number of entries in a static array 2012-02-19 12:07:40 -08:00
Chris Robinson 6dc194ed1d Fix a misnamed variable 2012-02-19 11:56:01 -08:00
Chris Robinson 1aa69e77e9 Print a warning if using the 'format' config option 2012-02-19 11:54:24 -08:00
Chris Robinson 6ac16867b4 Only set a default slot for non-NULL effect types 2012-02-18 17:09:08 -08:00
Chris Robinson bbc679a5db Minor MMDevApi cleanups 2012-02-18 13:08:54 -08:00
Chris Robinson 592fb2b913 Make sure an ALSA capture device was found before accessing the map 2012-02-18 12:39:17 -08:00
Chris Robinson f68f3f5f86 Simplify ALSA parameter error checking 2012-02-18 12:34:58 -08:00
Chris Robinson 5f23860880 Rename a couple variables and fix their types 2012-02-18 11:07:54 -08:00
Chris Robinson faf59a7cba Fix some comments 2012-02-18 11:03:42 -08:00
Chris Robinson cc2cb1142b Remove unused variables 2012-02-17 12:32:43 -08:00
Chris Robinson eb8be88866 Use the correct type to store the count from IMMDeviceCollection_GetCount 2012-02-17 12:31:53 -08:00
Chris Robinson e43e1bd7f5 Silence another MSVC warning 2012-02-17 01:32:35 -08:00
Chris Robinson eb586b0ed7 Initialize a variable before use 2012-02-17 01:30:41 -08:00
Chris Robinson 75aa96a4a6 Silence an MSVC warning 2012-02-17 01:29:23 -08:00
Chris Robinson 10257f485a Support device enumeration with mmdevapi 2012-02-16 17:04:08 -08:00
Chris Robinson deee6a73f0 Fix a device count leak and make sure COM is cleaned up if an mmdevice open fails 2012-02-16 10:08:50 -08:00
Chris Robinson 84ba0a94c0 Make sure the source write position is at least 15ms ahead of the read 2012-02-16 00:11:50 -08:00
Chris Robinson 5d17cef55f Calculate the buffer time before modifying the frequency 2012-02-15 22:54:17 -08:00
Chris Robinson 70f1a7e3ca Get the mmdevapi device period after initialization 2012-02-15 22:40:01 -08:00
Chris Robinson 60785eab8e Move the endian test macro to alMain.h 2012-02-15 21:47:35 -08:00
Chris Robinson 7e9af6f406 Use a switch to check the device format with winmm 2012-02-15 21:13:13 -08:00
Chris Robinson 6b272ff585 Add a device parameter to alcLoopbackOpenDeviceSOFT 2012-02-15 20:52:49 -08:00
Chris Robinson fecd679f33 Add a device request flag for the sample type 2012-02-15 16:26:32 -08:00
Chris Robinson 2ab0e3521c Remove parameter names from typedefs 2012-02-15 15:23:23 -08:00
Chris Robinson 9afd6b2858 Separate the format config option into channels and sample-type 2012-02-15 15:22:44 -08:00
Chris Robinson 670c88a64c Define a minimum output sample rate and warn if the config option goes below it 2012-02-15 12:26:19 -08:00
Chris Robinson 425ff7cb00 Combine a couple if checks 2012-02-15 11:28:19 -08:00
Chris Robinson 1140b3ae83 Support signed and unsigned 32-bit int output 2012-02-14 11:44:57 -08:00
Chris Robinson 5e1d1a52ba Check for each ALSA prefix config option only as needed 2012-02-13 10:33:53 -08:00
Chris Robinson e394d14cda Use more proper enum names for the resampler 2012-02-12 08:45:19 -08:00
Chris Robinson 9f073b6f1b Use a proper enum value for setting the default distance model 2012-02-12 08:18:20 -08:00
Chris Robinson b375b130ba Add config options for card- and device-specific prefixes in ALSA device names 2012-02-11 09:36:40 -08:00
Chris Robinson 3fb6351212 Format the ALSA device name when enumerating them 2012-02-11 06:55:24 -08:00
Chris Robinson 61be01efc1 Rename SpeakerGain to ChannelGain 2012-02-10 00:29:47 -08:00
Chris Robinson 23bda38be0 Match the 7.1 channel angles with the speakers 2012-02-09 23:59:24 -08:00
Chris Robinson e6a0dd10a9 Pre-scale the channel angles 2012-02-09 23:52:20 -08:00
Chris Robinson ef68aa39f8 Rename non_virtual_channels to direct_channels 2012-02-09 23:35:17 -08:00
Chris Robinson b4b492c417 Improve checks for supported output formats from ALSA 2012-02-09 22:26:16 -08:00
Chris Robinson a98e381c8e Ensure ALbyte3 and ALubyte3 are the proper size 2012-02-07 08:05:01 -08:00
Chris Robinson 18f87b97d5 Always use the default speaker layout for loopback devices 2012-02-07 07:29:34 -08:00
Chris Robinson c211f1d3fe Don't enable BS2B for loopback devices 2012-02-07 07:06:38 -08:00
Chris Robinson deb84cfdac Improve a couple error messages with the full ALSA device control name 2012-02-07 07:04:33 -08:00
Chris Robinson 7ad1b45d11 Change the default stereo speaker positions to match the stereo channel positions
A separate "headphones" configuration may be nice to add for -90,+90, however
not many audio APIs can detect this. Ideally HRTF would be used with
headphones too, which largely ignores the speaker positions, however there
could be situations where this is unfeasible or unwanted.
2012-02-04 10:29:19 -08:00
Chris Robinson 47161150d7 Check for a 32-bit x86 processor before using MSVC's asm intrinsics 2012-02-03 19:34:06 -08:00
Chris Robinson 8e6832407a Only use fast float-to-int GCC assembly for x86 and x86_64 targets 2012-02-03 17:40:21 -08:00
Chris Robinson 9166432ccf Fix typo in the "CarpetedHallway" reverb preset 2012-02-01 16:31:37 -08:00
Chris Robinson 0107e74986 Use an enum for static const values 2012-01-31 03:43:52 -08:00
Chris Robinson c605e06e07 Make the EFX preset values explicit floats 2012-01-31 02:57:22 -08:00
Chris Robinson 15a8e58225 Implement capture for the DirectSound backend
Based on a patch by Jeffrey Knockel <jeff250.at.gmail.com>
2012-01-31 01:47:59 -08:00
Chris Robinson 4393b6b05f Only initialize the default reverb effect when a slot is available 2012-01-29 22:49:17 -08:00
Chris Robinson ed037698fd Reorder a couple effect presets 2012-01-29 22:16:39 -08:00
Chris Robinson e870c22f87 av_find_stream_info is also deprecated, in favor of avformat_find_stream_info 2012-01-29 20:06:30 -08:00
Chris Robinson fd6f03cf74 Use AVMEDIA_TYPE_AUDIO instead of the deprecated CODEC_TYPE_AUDIO 2012-01-29 16:21:57 -08:00
Chris Robinson 706f407ed5 Add some more reverb presets 2012-01-27 23:15:16 -08:00
Chris Robinson dd3abd0f16 Use sizeof(ALfloat) when finding the max stepping value
The mixer always reads from floats, so the size of the storage type is
unimportant.
2012-01-26 22:33:36 -08:00
Chris Robinson 3fda804217 Pass the uncompressed sample count to LoadData and ConvertData for IMA4 2012-01-26 16:53:21 -08:00
Chris Robinson 1d1440ac64 Make sure context attributes are specified for loopback devices 2012-01-26 16:31:46 -08:00
Chris Robinson 119768001c Make sure InitializeEffect on the default slot doesn't set a context error 2012-01-26 14:46:52 -08:00
Chris Robinson 3ee92a2b33 Return the error code from UpdateDeviceParams 2012-01-25 20:00:34 -08:00
Chris Robinson f87b607a53 Make sure the attributes list specifies a format for loopback devices 2012-01-25 19:54:55 -08:00
Chris Robinson b4ba83ec34 Avoid a bit of code duplication 2012-01-25 19:32:10 -08:00
Chris Robinson d807c4bf87 Don't process a default device slot if it doesn't exist 2012-01-25 18:48:26 -08:00
Chris Robinson 423f89c908 Fix a typo 2012-01-24 15:11:23 -08:00
Chris Robinson 8d07bc41c9 Some cleanups for the reverb list 2012-01-24 13:29:33 -08:00
Chris Robinson 86ef115e21 Set the source's slot send parameter to NULL if it's the AL_EFFECT_NULL type 2012-01-23 06:29:03 -08:00
Chris Robinson 1dd8aa9b6f Link with AudioToolbox.framework for the CoreAudio backend if it's found 2012-01-23 03:45:04 -08:00
Chris Robinson f520257463 Avoid duplicating some initialization code 2012-01-20 16:23:15 -08:00
Chris Robinson 00dc3088c8 Honor the disabled effects for the default reverb 2012-01-20 15:56:32 -08:00
Chris Robinson e52e4b1a8c Not all devices will have a default effect slot 2012-01-20 12:53:41 -08:00
Chris Robinson 0ef3a30b84 Fix WaveIn shutdown for real
The processing thread must be messaged when shutting down, and depending on the
state of the device, waveInReset may not do it. Additionally, all buffers must
be removed from the device before they can be unprepared and the device closed.
2012-01-20 12:36:23 -08:00
Chris Robinson b375897374 Remove an unnecessary else statement 2012-01-20 12:20:24 -08:00
Chris Robinson 2b2ce8bf3b Always message the WinMM processing thread when a buffer is done
So the processing thread can keep track of completed buffers when shutting
down, too.
2012-01-20 12:06:31 -08:00
Chris Robinson 47c8c15878 Fix a possible race condition when shutting down WinMM devices
If the processing threads are interrupted between the shutdown check and re-
adding the buffer back to the device, the device can be left with a buffer that
will get unprepared and freed while in use.
2012-01-20 03:02:21 -08:00
Chris Robinson fa36435290 Add a default-reverb config option, and rename __ALSOFT_FORCE_REVERB to match 2012-01-20 01:51:27 -08:00
Chris Robinson 4b83123cb8 Install efx-presets.h 2012-01-19 22:30:12 -08:00
Chris Robinson 37b17c8c78 Add the ability to specify a preset for forced reverb 2012-01-19 20:02:57 -08:00
Chris Robinson 51e81f4867 Add a global option to apply a reverb effect on source send 0
A special slot on the device is created and processed, so it can be shared
across all contexts on the device. Sources that don't have a slot set on send 0
will use this special slot instead.
2012-01-19 19:30:03 -08:00
Chris Robinson ae7b61b040 Avoid printing messages about device parameter changes in the backends 2012-01-17 16:38:58 -08:00
Chris Robinson 5a2a534240 Report parameter request changes in UpdateDeviceParams 2012-01-17 15:55:37 -08:00
Chris Robinson 09258ca5c1 Change the default output format to 32-bit float 2012-01-17 15:38:36 -08:00
Chris Robinson e0966d99a1 Retry opening the PortAudio device with 16-bit short if 32-bit float output fails 2012-01-17 15:26:22 -08:00
Chris Robinson 66a700729b Retry opening the DSound device with 16-bit short if 32-bit float output fails 2012-01-17 12:38:47 -08:00
Chris Robinson a7266442c2 Retry opening the WinMM device with 16-bit short if 32-bit float output fails 2012-01-17 12:21:52 -08:00
Chris Robinson cf34b9c04e Support 32-bit float in the WinMM backend 2012-01-17 12:17:41 -08:00
Chris Robinson 530597347c Safely insert the new context into the list 2012-01-12 06:13:24 -08:00
Chris Robinson c543611897 Add some casts 2012-01-11 00:55:02 -08:00
Chris Robinson d88596e13c There's no need to pass a buffer to avio_alloc_context 2012-01-11 00:43:24 -08:00
Chris Robinson c59bbe7c22 Handle a couple of special AVSEEK_ seek modes 2012-01-11 00:32:16 -08:00
Chris Robinson d4670faafd Fix compiling the example program, and support AL_SOFT_buffer_samples with it 2012-01-10 02:12:54 -08:00
Chris Robinson e772fb7d0e Finalize AL_SOFT_buffer_samples 2012-01-10 01:14:02 -08:00
Chris Robinson 29ba8f9f1a Remove the unnecessary AL_MULAW_SOFT, AL_ALAW_SOFT, and AL_IMA4_SOFT defines 2012-01-10 00:59:10 -08:00
Chris Robinson 61af4d715c Append _SOFT to the AL_SOFT_buffer_samples enums 2012-01-10 00:41:05 -08:00
Chris Robinson 535091e36c Make LockDevice, LockContext, etc, inline 2012-01-09 23:37:03 -08:00
Chris Robinson 5b7f8c1816 Check earlier for ffmpeg 2012-01-02 11:52:20 -08:00
Chris Robinson 18216ab1a9 Remove the warning when a context being released is globally current
Just about every implementation allows this, and there's no direct harm caused
by it. However, leave the warnings for when it's still current on specific
threads, as this can cause issues.
2012-01-01 15:36:31 -08:00
Chris Robinson 5500ed9209 Use the device lock when removing the context from the device's list 2012-01-01 15:22:58 -08:00
Chris Robinson 886f874ff3 Use a proper typedef for handling atomic pointer swaps 2012-01-01 15:00:03 -08:00
Chris Robinson 466cac328f Add an example program that streams audio using ffmpeg 2012-01-01 12:36:41 -08:00
Chris Robinson 06caac2619 Update some config option descriptions 2011-12-20 01:45:29 -08:00
Chris Robinson 2691c33b55 Use a string to specify the resampler config option 2011-12-20 01:36:01 -08:00
Chris Robinson 7f6844e48d Use a struct to associate channel enums and their angles 2011-12-20 01:17:11 -08:00
Chris Robinson a5a929ff72 Restore the old FPU mode if the effects fail to update with new device parameters 2011-12-20 00:35:32 -08:00
Chris Robinson 84b5311257 Use an explicit 0 for the "no error" enums 2011-12-03 08:27:51 -08:00
Chris Robinson 6a97f6a327 Reset the ALSA device if the number of available samples grows too large 2011-11-28 10:24:24 -08:00
Chris Robinson dfd02817fa Make ALSA XRUN when the number of available samples exceeds the buffer size 2011-11-28 09:12:30 -08:00
Chris Robinson 222d2363cd Don't fail to insert a map entry when the key exists and the limit is reached 2011-11-26 03:52:07 -08:00
Chris Robinson 14c117ffd3 Initialize listener matrix to identity 2011-11-26 03:37:37 -08:00
Chris Robinson d5df2ad3ce Define TlsDestructor for Windows static builds, too 2011-11-12 16:00:37 -08:00
Chris Robinson c56b2734fd Use loops to write reverb output 2011-11-02 08:15:10 -07:00
Chris Robinson 5eebe73f79 Use a loop to write the modulator effect output 2011-11-01 17:12:56 -07:00
Chris Robinson 21d400e3c6 Use panning for echo instead of specifying discrete channels 2011-11-01 17:03:11 -07:00
Chris Robinson d270188578 Append _SOFT to the ALC loopback format enums 2011-11-01 16:00:47 -07:00
Chris Robinson fcf9034c2b Calculate the listener matrix when a new orientation is specified
This is so the matrix isn't derived each time a source is updated, and it will
make supporting user-defined matrices easier.
2011-10-30 08:27:24 -07:00
Chris Robinson 956e6f95ec Don't translate the listener velocity 2011-10-30 05:49:17 -07:00
Chris Robinson 50913948a0 Don't transform/translate vectors with an invalid listener orientation 2011-10-30 05:47:14 -07:00
Chris Robinson a5c02556e6 Add a work-around for cross-compiling with MinGW 2011-10-27 21:22:00 -07:00
Chris Robinson 319f40462f Initialize/Uninitialize COM as needed 2011-10-24 22:11:16 -07:00
Chris Robinson e5374f60c9 Don't close devices that are left open on lib shutdown 2011-10-24 08:23:41 -07:00
Chris Robinson 75679c959a Don't update the device update parameters when PulseAudio does an async buffer update
It risks a deadlock, and though the UpdateSize won't change, we'll still fill
as much of the buffer as we can up to a multiple of it
2011-10-19 16:07:56 -07:00
Chris Robinson 628356a294 Set AL_STOPPED after setting AL_PLAYING when a source has nothing to play 2011-10-15 10:33:30 -07:00
Chris Robinson 0fba3b0e1e Use the local Device variable 2011-10-11 22:30:58 -07:00
Chris Robinson 92a650c827 Use the local variable instead of re-reading the source property 2011-10-11 22:29:06 -07:00
Chris Robinson 3bbde05e0e Use the square root to build the panning table instead of sin/cos 2011-10-10 09:39:02 -07:00
Chris Robinson 3324bab81e Mark a couple more arrays with restrict 2011-10-08 03:08:13 -07:00
Chris Robinson 81133769de Return the key's value from the map when it's removed 2011-10-06 06:39:13 -07:00
Chris Robinson a7d3779dfa Check for the HRTF object instead of a flag 2011-10-06 01:16:07 -07:00
Chris Robinson 75fee8c11f Add min/max/clamp methods for 64-bit int 2011-10-04 22:39:35 -07:00
Chris Robinson 9e11b0a8c6 Fix maximum BufferSize calculation 2011-10-04 22:35:01 -07:00
Chris Robinson 5861920453 Rename a variable to avoid confusion 2011-10-04 22:16:54 -07:00
Chris Robinson eb277cc578 Remove some unneeded templates and parameters 2011-10-04 09:55:36 -07:00
Chris Robinson 20fd648729 Convert samples to float when copying to the stack 2011-10-04 09:47:08 -07:00
Chris Robinson 11caba9807 Use sample frames when handling the buffer length 2011-10-04 02:08:45 -07:00
Chris Robinson 35b4b31d57 Track the temp stack buffer using sample frames instead of bytes 2011-10-03 10:06:09 -07:00
Chris Robinson a5c74e324c Make sure GCC properly errors when checking visiblity attributes 2011-10-02 22:12:31 -07:00
Chris Robinson e1cbf06653 Don't use a double when calculating the HRTF coefficients 2011-10-02 22:05:03 -07:00
Chris Robinson 5a1959f0cf Make a floating-point constant a float type 2011-10-02 22:01:51 -07:00
Chris Robinson 7f5074949e Don't use inline asm with MSVC on 64-bit 2011-10-02 21:44:08 -07:00
Chris Robinson cf10a8d321 Get rid of some unnecessary casting 2011-10-02 16:54:45 -07:00
Chris Robinson a05006b06a Rename some parameters 2011-10-02 07:31:26 -07:00
Chris Robinson eb0b96752a Remove the OriginalAlign buffer field, and calculate it as needed 2011-10-01 19:52:07 -07:00
Chris Robinson 2f453eba35 Fix potential divide-by-0 2011-10-01 08:37:42 -07:00
Chris Robinson 8b2e1fdd9a Add buffer properties to get the internal format, and the length in bytes, samples, and seconds
The provided buffer lengths correspond to the source offsets, in that the byte
length specifies the end of the byte offset (ie, when the buffer is used for a
static source, the offset will range between 0 (inclusive) and the byte length
(exclusive)). Although an application could use the AL_SIZE, AL_CHANNELS,
AL_BITS, and AL_FREQUENCY properties to find the length in samples and seconds,
the byte length cannot be reliably calculated this way.
2011-10-01 06:19:55 -07:00
Chris Robinson c99b32a8ec Use tokens matching the string 2011-10-01 04:56:45 -07:00
Chris Robinson 92f95e4d94 Add support for AL_EXT_ALAW 2011-10-01 04:55:03 -07:00
Chris Robinson d1011f8d37 Add AL_EXT_MULAW and AL_EXT_ALAW tokens to alext.h 2011-10-01 04:05:39 -07:00
Chris Robinson a486045f7c Improve index calculation for reverb modulation updates 2011-10-01 02:38:28 -07:00
Chris Robinson 0e7dc93681 Add some formatting spaces to the reverb state struct 2011-10-01 02:09:17 -07:00
Chris Robinson a7bbf7a741 Rename LOWPASSFREQCUTOFF to LOWPASSFREQREF 2011-09-30 23:07:15 -07:00
Chris Robinson bfa782f329 Define the values for F_PI and F_PI_2 directly instead of using M_PI 2011-09-30 22:53:47 -07:00
Chris Robinson bed37a148c Use raise(SIGTRAP) instead of kill(getpid(),SIGTRAP) 2011-09-30 20:46:18 -07:00
Chris Robinson bf19186223 Apply the initial wet send reverb decay before clamping the gains 2011-09-30 17:51:21 -07:00
Chris Robinson 087e75d47f Multiply by the reciprocal value instead of dividing 2011-09-29 22:29:10 -07:00
Chris Robinson 9e2600cac4 Use fast float-to-int conversions for some mixer-related code 2011-09-29 06:55:00 -07:00
Chris Robinson 3c27c24dec Set the mixer FPU mode when setting a new effect on an effect slot 2011-09-29 05:25:01 -07:00
Chris Robinson 1b81642db5 Set the mixer FPU mode for device parameter updates 2011-09-29 05:15:20 -07:00
Chris Robinson d3a6de3f86 Set the FPU into single-precision mode for mixer updates 2011-09-29 05:10:15 -07:00
Chris Robinson f4925a0e6a Use inline functions to set/restore the FPU mode for mixer updates 2011-09-29 04:03:18 -07:00
Chris Robinson b6b3ca6e6f Use inline assembly for fast float-to-int conversions 2011-09-29 03:51:46 -07:00
Chris Robinson 53572da7de Set toward-zero rounding when updating in alDeferUpdatesSOFT 2011-09-28 22:02:36 -07:00
Chris Robinson 8a0e0265bc Clamp the low-pass reference gain to -60 dB instead of -40 dB 2011-09-25 11:32:51 -07:00
Chris Robinson 0ada7b2da5 Copy only the gains needed for the channel being mixed 2011-09-24 22:24:26 -07:00
Chris Robinson 1dee1245ff A static source only has one buffer in the queue 2011-09-24 21:21:59 -07:00
Chris Robinson e9da6950ee Centralize the Lookup and Remove macros 2011-09-24 18:34:45 -07:00
Chris Robinson 12abd75aed Only warn when a symbol fails to load 2011-09-24 14:52:54 -07:00
Chris Robinson 044774ed72 Rename the MMDevAPI backend's MessageProc function 2011-09-24 13:55:44 -07:00
Chris Robinson cf56b0733b Look for and use atan2f, log10f, and floorf 2011-09-24 12:17:39 -07:00
Chris Robinson 2b0a63003f Cast a 64-bit variable to a 32-bit int 2011-09-24 00:52:58 -07:00
Chris Robinson deef98658b Don't require libm for the float-type math functions 2011-09-24 00:42:14 -07:00
Chris Robinson d9544d006b Use aluAtan instead of atan 2011-09-24 00:04:34 -07:00
Chris Robinson 6a2b2a0aed Silence MSVC warnings in the HRTF code 2011-09-23 23:16:42 -07:00
Chris Robinson 9060d0cc36 Add a WAVEFORM_FRACONE macro and minor cleanups for the ring modulator 2011-09-23 23:11:35 -07:00
Chris Robinson b4f9f89480 Use float types for the resamplers instead of double 2011-09-23 23:03:59 -07:00
Chris Robinson a9b6b284c0 Change a double type to a float 2011-09-23 22:50:33 -07:00
Chris Robinson da62f50528 Check for asinf and use it 2011-09-23 22:44:34 -07:00
Chris Robinson e84e38cc19 Make AIRABSORBGAINHF a float type 2011-09-23 22:37:20 -07:00
Chris Robinson 9266a37276 Move ConeScale and ZScale to ALu.c and alu.h, and make them floats 2011-09-23 22:33:37 -07:00
Chris Robinson ff8ee68852 Add atomic functions for GCC inline asm 2011-09-23 12:42:13 -07:00
Chris Robinson 470b506952 Use macros for float-typed PI values, to avoid manual casts everywhere 2011-09-22 11:17:01 -07:00
Chris Robinson de8a447ea5 More MSVC precision casts 2011-09-22 01:20:49 -07:00
Chris Robinson b2f4520ba1 Add a few more precision casts 2011-09-22 01:09:02 -07:00
Chris Robinson a4b1239f45 Use cosf and sinf when available
Also clear away a few more MSVC precision warnings
2011-09-22 01:00:44 -07:00
Chris Robinson 43350f9066 Silence some MSVC precision warnings 2011-09-22 00:35:08 -07:00
Chris Robinson 0988023d30 Constify some parameters 2011-09-22 00:31:42 -07:00
Chris Robinson e81e20446f Don't use the -fvisibility switch if the visibility attributes didn't work 2011-09-21 23:41:52 -07:00
Chris Robinson 64080250ff Actually check for hidden visibility 2011-09-20 18:35:27 -07:00
Chris Robinson 4e19f82a2b Try to use "default" and "hidden" visibility when "protected" and "internal" aren't available 2011-09-20 16:53:05 -07:00
Chris Robinson 97743e32c2 Remove a couple type size checks 2011-09-20 15:47:45 -07:00
Chris Robinson b8d53fb7e9 Check for SLES/OpenSLES.h along with SLES/OpenSLES_Android.h 2011-09-20 15:43:00 -07:00
Chris Robinson 390d94ec97 Define _WIN32_WINNT on the command line with _WIN32 2011-09-20 14:59:01 -07:00
Chris Robinson e01092a0da Move Sleep implementation into helper.c and emulate sched_yield for Windows 2011-09-20 14:43:53 -07:00
Chris Robinson 312e9a436d Fix indentation 2011-09-20 13:58:45 -07:00
Chris Robinson e43470da7a Make a separate log level to trace reference counts, to avoid log spam for traces 2011-09-20 12:24:23 -07:00
Chris Robinson d3e7a26db6 Fix a warning message 2011-09-20 11:58:26 -07:00
Chris Robinson 8c2a2a5c9d Trace created device and context pointers 2011-09-20 11:55:40 -07:00
Chris Robinson bf2ac6625c Avoid size_t and ssize_t in some places 2011-09-20 11:40:56 -07:00
Chris Robinson edb386eb1e Add a ConfigValueStr function, to return the string through a parameter 2011-09-19 11:29:18 -07:00
Chris Robinson cc3dd648ac Check the number of available samples before calling the capture method 2011-09-18 20:27:34 -07:00
Chris Robinson 98b2fa6cb5 Use the ALC types for the device format enum values 2011-09-18 19:43:59 -07:00
Chris Robinson b615c7d0a2 Use arrays instead of large switches to decompose formats 2011-09-18 19:06:19 -07:00
Chris Robinson 7e06a10f73 Return int and float config values through a parameter
This allows the getter functions to return whether or not the option exists
without a separate call and check.
2011-09-18 16:16:55 -07:00
Chris Robinson d46db2f648 Avoid a buffer underrun when getting the end of a config option value 2011-09-18 11:46:39 -07:00
Chris Robinson 6d77aabb23 Update a config file comment 2011-09-18 11:25:44 -07:00
Chris Robinson a7b9ee6bcb Allow loading multiple HRTF tables through a comma-separated list 2011-09-18 11:10:32 -07:00
Chris Robinson 0e5c221a3c Dynamically allocate space for HRTF tables 2011-09-18 10:09:32 -07:00
Chris Robinson 25f7c27043 Store the HRTF tables used in the device 2011-09-18 09:52:40 -07:00
Chris Robinson ec3b78e52d Fix a mutex leak in a capture open error path 2011-09-16 02:17:51 -07:00
Chris Robinson 4e903c84cf Fix comment on external HRTF file format 2011-09-15 02:27:02 -07:00
Chris Robinson ae3ec4e767 Trace compatible HRTF formats when loading instead of on error 2011-09-15 02:05:48 -07:00
Chris Robinson fd22226242 Make alcSetError static 2011-09-14 11:58:51 -07:00
Chris Robinson fe1e046ea6 Remove a couple ineffective alcSetError calls 2011-09-14 11:55:57 -07:00
Chris Robinson 2171aaa35c Use IsDebuggerPresent instead of the VC-only __try/__except 2011-09-14 02:10:42 -07:00
Chris Robinson 97024151e4 Return an error from the CaptureSamples method instead of setting it 2011-09-14 02:01:35 -07:00
Chris Robinson 62dfea43c6 Limit the minimum ALSA capture size to 100ms, and the maximum period size to 50ms 2011-09-13 23:51:22 -07:00
Chris Robinson a4f8408150 Use maxu to clamp PulseAudio's capture buffer size 2011-09-13 21:53:34 -07:00
Chris Robinson 80f2b787ef Pre-apply the deferred source offset only when it's playing or paused 2011-09-12 06:04:40 -07:00
Chris Robinson 404cfde33e Rename the ALEffect_ macros to ALeffectState_ to reflect what they work on 2011-09-12 05:59:23 -07:00
Chris Robinson 145bc6da6b Be a bit more robust while handling the global device list 2011-09-12 03:57:53 -07:00
Chris Robinson 69b10e2d7c Remove the context from being current before removing it from the device 2011-09-12 03:35:21 -07:00
Chris Robinson 25e86e8e91 Get rid of IsContext 2011-09-12 03:18:27 -07:00
Chris Robinson 780417ba39 Use VerifyDevice to validate a device handle instead of IsDevice 2011-09-12 02:17:31 -07:00
Chris Robinson 9f159bfb33 Look for __ALSOFT_TRAP_ERROR to trap both AL and ALC errors 2011-09-12 01:50:57 -07:00
Chris Robinson c2e9cda2d1 Shorten some warning messages 2011-09-12 01:21:54 -07:00
Chris Robinson 1d6ecee64f Use the active source list when stopping sources on disconnect 2011-09-12 01:11:46 -07:00
Chris Robinson 3ee2826565 Minor cleanup for applying click-removal to wet buffers 2011-09-12 01:09:01 -07:00
Chris Robinson 0ceea27b44 Remove the effect slot parameter from the effect process method 2011-09-12 00:44:52 -07:00
Chris Robinson 0dc5837b82 Fix a possible race condition when setting an effect on a slot 2011-09-11 20:51:30 -07:00
Chris Robinson b4cbb3380a Fix non-GCC CompExchangePtr implementations 2011-09-11 09:39:29 -07:00
Chris Robinson d9cb2baf4a Don't increment the context reference count when locked 2011-09-11 09:29:24 -07:00
Chris Robinson 8f456f68ff Remove GetLockedContext 2011-09-11 09:28:30 -07:00
Chris Robinson 54a421ec58 Get rid of some more GetLockedContext calls 2011-09-11 09:13:01 -07:00
Chris Robinson 6ce420afe3 Use function pointers to set type-specific effect properties 2011-09-11 08:59:47 -07:00
Chris Robinson 8028770901 Avoid accessing EAX-only reverb properties for non-EAX updates 2011-09-11 08:50:48 -07:00
Chris Robinson d51b93f869 Remove the union from the effect parameter types 2011-09-11 07:42:23 -07:00
Chris Robinson ab2b62c980 Use function pointers to set type-specific filter properties 2011-09-11 07:34:03 -07:00
Chris Robinson 97fa7cc9ac More lock avoidance 2011-09-11 06:58:49 -07:00
Chris Robinson 2648a9b011 Just reference the context when checking for extensions 2011-09-11 04:32:34 -07:00
Chris Robinson 1fdc25df75 Use a RWLock to protect access to a buffer instead of the device lock 2011-09-11 03:57:40 -07:00
Chris Robinson 4db24af59a Avoid holding the context lock for the buffer functions 2011-09-11 02:37:52 -07:00
Chris Robinson d85c12c385 Avoid holding the context lock when setting auxiliary slot properties 2011-09-11 02:01:31 -07:00
Chris Robinson ccd8cbc2a9 Make some listener properties volatile 2011-09-11 01:26:09 -07:00
Chris Robinson 1075cce7b3 Mark some source properties volatile 2011-09-11 01:18:57 -07:00
Chris Robinson 89f438df71 Small fixes to setting the source's direct filter and auxiliary send 2011-09-11 00:58:33 -07:00
Chris Robinson 97027a7ad9 Avoid holding the context lock while setting source parameters
Note that some parameters still need the lock when getting or setting them.
2011-09-11 00:47:31 -07:00
Chris Robinson 3a8ef2f0d6 Initialize source parameters before adding the source to the map 2011-09-10 21:21:07 -07:00
Chris Robinson 4c8e6dead1 Don't defer stopped and initial source state changes
Typically when these are set, an app will be releasing the buffer from the
source, possibly to immediately reuse it. There would be an extra burden placed
on the app if it was required to process updates before it could fully release
the buffer from the source.
2011-09-10 21:02:50 -07:00
Chris Robinson c19a7408d9 Add a comment about when FreeContext and FreeDevice are called 2011-09-10 20:52:19 -07:00
Chris Robinson c7b9d27b85 Trace the device pointer when warning about leftover objects 2011-09-10 20:49:16 -07:00
Chris Robinson 30510dc478 Set the device-connected flag to false first when handling a disconnect 2011-09-10 19:22:46 -07:00
Chris Robinson b788ae52b0 Condense some code 2011-09-10 19:19:32 -07:00
Chris Robinson ccbd67eab6 Clean up some code comments 2011-09-10 19:14:14 -07:00
Chris Robinson f21b1eefda Lock the lists while probing devices 2011-09-10 09:12:02 -07:00
Chris Robinson 6cd55a0a10 Clean up some comments 2011-09-10 09:00:01 -07:00
Chris Robinson 0c5c63f4ba Slightly modify a warning 2011-09-10 07:49:35 -07:00
Chris Robinson 3dcd1e793e Properly destroy contexts that are left on the device when it's closed 2011-09-10 07:35:48 -07:00
Chris Robinson 419294cddd Avoid locking the device when adding and removing contexts
Also, don't keep track of the number of contexts per device
2011-09-10 07:18:29 -07:00
Chris Robinson b9448a476e Avoid holding the list lock when not needed 2011-09-10 05:19:08 -07:00
Chris Robinson 238a747414 Warn about contexts that are errantly left current
These won't show by default in release mode, unless the log level is changed to
show warnings.
2011-09-10 03:18:31 -07:00
Chris Robinson c35433ec7a Hold an extra reference on the device for each of its contexts 2011-09-10 03:01:24 -07:00
Chris Robinson e8c9da0124 Add some reference counting to the device 2011-09-10 02:43:07 -07:00
Chris Robinson 18cf6e3210 Fix a parameter type 2011-09-10 02:13:52 -07:00
Chris Robinson c9205a58ae Use alGetEnumValue to check for supported filters and effects 2011-09-10 02:09:18 -07:00
Chris Robinson 23d693cd06 Add an option to trap device errors in a debugger 2011-09-10 01:23:59 -07:00
Chris Robinson 724ad0d893 Add an option to trap context errors in a debugger 2011-09-10 01:12:34 -07:00
Chris Robinson 7a0df8553f Allow PulseAudio's tlength to grow to make sure there's at least two updates 2011-09-09 22:30:24 -07:00
Chris Robinson 477215883f Use an array to get the device format from the user config string 2011-09-09 21:33:18 -07:00
Chris Robinson 05114815ba Avoid an unnecessary lock 2011-09-02 15:57:50 -07:00
Chris Robinson 9080d5fda0 Do an atomic compare-exchange on the global context when destroying a context 2011-09-02 02:57:21 -07:00
Chris Robinson 108b43458f Fix multichannel wet gainhf calculation 2011-09-02 02:54:00 -07:00
Chris Robinson 3dfd67680c Use an atomic exchange to get the old global context when setting a new one 2011-09-02 02:32:35 -07:00
Chris Robinson 3a2fa18744 Log the function name instead of the source file and line number 2011-09-02 02:00:37 -07:00
Chris Robinson 370c9f553d Trace the reverb buffer size 2011-09-02 01:13:22 -07:00
Chris Robinson e80aa008b2 Combine the reverb effects
Updating and processing still differs depending on whether standard or EAX
reverb is used or not. The only functional difference should be that the
allocated buffer (and subsequent offsets) take into account the modulation
and echo times.
2011-09-01 20:06:51 -07:00
Chris Robinson 812d91cbf8 Don't recreate the effect when switching between the dedicated effect types 2011-09-01 18:51:24 -07:00
Chris Robinson 942c8bf8a7 Combine the dedicated (dialog/LFE) effects 2011-09-01 18:01:14 -07:00
Chris Robinson b6b3e2f1cc Fix a comment 2011-08-31 14:01:15 -07:00
Chris Robinson ee5ff943f3 Fix a potential infinite loop when removing an effect slot 2011-08-31 13:36:47 -07:00
Chris Robinson b28f48c1bd Store the filter gains directly in the source instead of duplicate filter objects 2011-08-31 02:18:16 -07:00
Chris Robinson 49e2fa428f Avoid the context lock when generating and deleting effects and filters 2011-08-31 02:15:03 -07:00
Chris Robinson 2fcf97e207 Avoid the context lock when generating and deleting buffers 2011-08-31 01:13:02 -07:00
Chris Robinson f3ac3cd1e2 Don't set a thread priority if real-time isn't requested 2011-08-31 01:05:01 -07:00
Chris Robinson dd74757319 Add a function to initialize a RWLock 2011-08-31 01:00:19 -07:00
Chris Robinson ab0b5d9890 Hold the context lock only as needed when handling the listener 2011-08-31 00:33:33 -07:00
Chris Robinson 23f576360c Avoid locking the context while getting and setting global state 2011-08-31 00:19:27 -07:00
Chris Robinson d7bd9c7559 Use the active effect slot list for pending updates in alDeferUpdatesSOFT 2011-08-30 23:33:01 -07:00
Chris Robinson 9fb91f70aa Rename GetReffedContext to GetContextRef 2011-08-30 23:28:38 -07:00
Chris Robinson a32a3bcda8 Use a more appropriate error for trying to delete an effect slot that's in use 2011-08-30 20:57:14 -07:00
Chris Robinson 16dc73ff48 Hold the lock only as needed when generating and deleting effect slots 2011-08-30 20:49:49 -07:00
Chris Robinson 0a1321aaae Add a limit to the UIntMap size and use it for sources and effect slots 2011-08-30 20:33:47 -07:00
Chris Robinson 189add1d5a Use a separate array for the auxiliary slots in the mixer 2011-08-30 20:13:42 -07:00
Chris Robinson 755062fb76 Fix compilation with MSVC 2011-08-30 17:55:52 -07:00
Chris Robinson 7d577832cd Add functions to retrieve the source from the source map while removing it 2011-08-30 17:32:49 -07:00
Chris Robinson c4866afbe0 Use a RWLock and atomic exchanges for thunk handling 2011-08-30 17:24:58 -07:00
Chris Robinson ee60248d19 Lock the context while deleting sources only as needed 2011-08-30 00:33:01 -07:00
Chris Robinson d546813c05 Don't lock the context while checking the validity of objects 2011-08-30 00:04:02 -07:00
Chris Robinson f02d9e22d7 Do a pointer exchange when replacing the source buffer queue 2011-08-29 23:55:24 -07:00
Chris Robinson cc67f45892 Use the reference counting functions for the buffer and auxiliary slot refs 2011-08-29 23:10:02 -07:00
Chris Robinson c6a110ec59 Hold the context lock as needed while generating and deleting sources 2011-08-29 22:51:18 -07:00
Chris Robinson 7408396fd4 Use a generic int type to handle enum swaps 2011-08-29 21:30:12 -07:00
Chris Robinson da081b81c4 Do a compare-exchange to set the context error
This allows for unlocked context access when getting the error
2011-08-29 20:52:13 -07:00
Chris Robinson 500ad776ea Exchange the AL error when retrieving it 2011-08-29 20:34:47 -07:00
Chris Robinson e4a2b69b37 Make specific functions to lock/unlock UIntMap access 2011-08-29 20:21:28 -07:00
Chris Robinson 8eaa9bb469 Manually lock the map while iterating through its contents 2011-08-29 20:05:50 -07:00
Chris Robinson b283dd3682 Use a read-write lock to protect access to the UInt maps 2011-08-29 19:15:22 -07:00
Chris Robinson 4a5dd73a3c Make the source's NeedsUpdate volatile 2011-08-29 13:43:59 -07:00
Chris Robinson 950570b8c3 Do a proper exchange when setting a new state 2011-08-29 13:29:37 -07:00
Chris Robinson 72beb577b6 Lock the context as needed for the defer and process calls 2011-08-29 13:22:07 -07:00
Chris Robinson de65ee08c9 Make ALCcontext's DeferUpdates field volatile 2011-08-29 11:55:01 -07:00
Chris Robinson c06f4eb7f7 Hold a reference on the global context 2011-08-29 11:10:17 -07:00
Chris Robinson 0abe13e3ad GCC's atomic built-ins were introduced in 4.1.0, so check for that version 2011-08-29 10:51:58 -07:00
Chris Robinson 2ac808ffa2 Fix typo 2011-08-29 01:01:20 -07:00
Chris Robinson 58078e2c1e Use atomic exchanges when checking for updates to objects' internal parameters 2011-08-29 00:50:55 -07:00
Chris Robinson 01503f8a7b Use an enum instead of an boolean for some flags
They still only hold AL_TRUE or AL_FALSE, but some systems can't properly
handle atomic swaps of 1-byte types.
2011-08-29 00:03:09 -07:00
Chris Robinson aa99e1220b Increment the context reference count when locking 2011-08-28 23:49:50 -07:00
Chris Robinson 783375af56 Use a list of contexts in the device instead of an array 2011-08-28 19:28:41 -07:00
Chris Robinson 1d9f21f6dc Avoid a global list of contexts 2011-08-28 18:53:23 -07:00
Chris Robinson 0900c281a3 Check if the context is valid only if it's replacing the current thread context 2011-08-28 18:17:06 -07:00
Chris Robinson f8c4b16c30 Hold a reference on the context when being set as current on the thread
This should vastly improve efficiency for retrieving the current thread
context, as we can be assured the stored context pointer will always be valid.
2011-08-28 18:08:48 -07:00
Chris Robinson c567339718 Rename ALCcontext_Deref to ALCcontext_DecRef 2011-08-28 17:38:55 -07:00
Chris Robinson 5eceb593e9 Emulate pthread TLS functions in Windows 2011-08-28 17:21:01 -07:00
Chris Robinson 82244f298c Add reference counting to the ALC contexts 2011-08-28 15:44:03 -07:00
Chris Robinson 3ab20d4ccb Print an error for invalid speaker layout keys 2011-08-28 10:25:40 -07:00
Chris Robinson ccc2644e6b Free the WaveIn buffers' data after unpreparing them all 2011-08-25 11:33:13 -07:00
Chris Robinson 7e2155d937 Return an ALC error enum from the OpenCapture backend method 2011-08-24 14:44:15 -07:00
Chris Robinson c696d4dbb2 Return an ALC error enum from the OpenPlayback backend method 2011-08-24 14:24:48 -07:00
Chris Robinson f5195ee4f2 Remove the Buffer field from the source 2011-08-23 09:55:22 -07:00
Chris Robinson 9f25ad42c1 Explicitly set BufferListStart's prev field 2011-08-23 09:27:35 -07:00
Chris Robinson 1d4dc7d7a9 Add AL_SOFTX_deferred_updates to the context's extension list 2011-08-22 18:57:28 -07:00
Chris Robinson 65d42083e1 Prevent source and effect slot updates from occuring while updates are deferred 2011-08-22 17:13:03 -07:00
Chris Robinson 6992a67dd9 Remove some g_ prefixes 2011-08-22 07:50:08 -07:00
Chris Robinson 922f5fa081 Rename a couple variables 2011-08-22 07:44:22 -07:00
Chris Robinson 199df253ca Always use the thunk functions to get object IDs 2011-08-22 07:40:14 -07:00
Chris Robinson c1f435cc18 Don't use the thunk array for object lookups 2011-08-22 07:22:02 -07:00
Chris Robinson 858592832f Defer source offset changes requested by the app 2011-08-21 00:49:04 -07:00
Chris Robinson a97211b572 Use -1 to mark an invalid source offset instead of 0 2011-08-21 00:35:37 -07:00
Chris Robinson f196a9fc67 Defer source state changes from alSourcePlay/Pause/Stop/Rewind calls 2011-08-20 23:59:24 -07:00
Chris Robinson 7ea71d8bfa Use a separate function to set the source state 2011-08-20 06:31:10 -07:00
Chris Robinson 9b615a0add Remove some spaces 2011-08-20 04:58:50 -07:00
Chris Robinson 4540034039 Move the GUID initialization to the helper 2011-08-20 04:55:11 -07:00
Chris Robinson 29d58f3d84 Set the loopback backend functions first 2011-08-20 04:43:47 -07:00
Chris Robinson 5290c820b4 Print the ALC_DEFAULT_ALL_DEVICES_SPECIFIER when available 2011-08-20 04:16:22 -07:00
Chris Robinson 22ad15e1f1 Move some functions into a separate helper source file 2011-08-20 04:01:07 -07:00
Chris Robinson 80b8abb0ec Don't enumerate "PulseAudio Default" in the ALL_DEVICES list 2011-08-20 03:00:38 -07:00
Chris Robinson 529ff3197a Don't expose "DirectSound Default" in the ALL_DEVICES list
This is under the assumption that one of the devices in ALL_DEVICES corresponds
to the default. This is not true for all backends (eg, ALSA).
2011-08-20 02:49:15 -07:00
Chris Robinson b036bc9e04 More closely emulate pthread_once in Windows 2011-08-20 01:07:27 -07:00
Chris Robinson 9989f33fc2 Move backend sources to a separate sub-directory 2011-08-20 00:41:47 -07:00
Chris Robinson ba4456d24a Use the proper variable type 2011-08-19 23:05:54 -07:00
Chris Robinson 00718ca03f Use the string ID instead of numeral index to reference the ALSA card
The index has a habit of changing, where the ID should be more consistent.
2011-08-19 20:47:08 -07:00
Chris Robinson 6b8475b435 Add options to specify alternate ALSA device prefixes 2011-08-19 04:02:36 -07:00
Chris Robinson e51295c79e Don't scale the wet send by the number of channels
Each channel should be treated as a distinct audio source, so multiple channels
should act as multiple sources.
2011-08-19 03:59:57 -07:00
Chris Robinson b40aa8636b Remove a couple unneeded variables 2011-08-19 03:01:57 -07:00
Chris Robinson b3645df56f Delete the mutex if the device fails to open 2011-08-19 02:58:21 -07:00
Chris Robinson 711f0a29ec Make sure there's a valid backend before trying to open a device 2011-08-19 02:55:36 -07:00
Chris Robinson e8e1286572 Remove the "via *" portion of the enumerated devices 2011-08-19 01:59:03 -07:00
Chris Robinson 3d722b9ba0 Don't remove backends that fail to initialize 2011-08-19 01:54:55 -07:00
Chris Robinson 4ac0a507e0 Use only the first available backend for playback or capture devices
This should help cut down on the number of duplicate devices when enumerating
on a system that supports multiple backends. It will also avoid the problem of
backends that don't play well with others (eg, PulseAudio).
2011-08-19 01:41:16 -07:00
Chris Robinson d54908d946 Attempt to connect a context when pulseaudio initializes 2011-08-19 01:40:16 -07:00
Chris Robinson 6ba5128f72 Use separate lists for playback and capture backends 2011-08-19 00:30:05 -07:00
Chris Robinson c96a6c2b1b Remove a typedef 2011-08-18 23:58:00 -07:00
Chris Robinson 0b0588cc37 Load backend libs on init 2011-08-18 23:56:11 -07:00
Chris Robinson 742bb12498 Make DSoundLoad return a boolean 2011-08-18 01:17:42 -07:00
Chris Robinson f00017c8c1 Avoid some LP types 2011-08-18 00:31:44 -07:00
Chris Robinson d976d02936 Only attempt to load MMDevApi and DSound once, on init 2011-08-18 00:13:43 -07:00
Chris Robinson 45f0886eba Set the proper union member to 0 2011-08-17 20:44:05 -07:00
Chris Robinson 057fef88ae Remove backends that fail to initialize 2011-08-17 06:15:43 -07:00
Chris Robinson 8148626ba3 Allow the backend init functions to return failure 2011-08-17 06:05:26 -07:00
Chris Robinson 14ffb8bd9b Coalesce some mixer sample converters 2011-08-17 02:33:25 -07:00
Chris Robinson 2f8510db31 Avoid reading some more source parameters multiple times when updating 2011-08-17 01:54:09 -07:00
Chris Robinson 38a4d9a6c5 Get rid of the remaining min/max usage 2011-08-16 18:53:04 -07:00
Chris Robinson 9f5bf5f930 Rename minF/maxF/clampF to minf/maxf/clampf for consistency 2011-08-16 18:40:21 -07:00
Chris Robinson 04dad28228 Use mini/maxi/clampi and minu/maxu/clampu to replace min/max calls 2011-08-16 18:33:10 -07:00
Chris Robinson a96f817738 Avoid a float->int->float conversion 2011-08-16 06:13:55 -07:00
Chris Robinson 8a51a7ea2d Use inline minF/maxF/clampF functions instead of the __min/__max macros 2011-08-16 04:21:58 -07:00
Chris Robinson b3cb511c06 Fix wet path conehf calculation 2011-08-13 06:58:05 -07:00
Chris Robinson 7e3d02d991 Make sure there's a buffer to render loopback samples to 2011-08-12 15:44:21 -07:00
Chris Robinson 412cec73de Avoid a temporary throw-away buffer for mixing null output 2011-08-12 15:42:36 -07:00
Chris Robinson a72c0f7470 Use an existing function to clear and free the context 2011-08-12 05:40:09 -07:00
Chris Robinson 45a245d7de Round the HRTF sample step count 2011-08-11 21:43:21 -07:00
Chris Robinson 1e60481040 Use ARM Neon vector ops to apply HRTFs when available 2011-08-11 19:02:45 -07:00
Chris Robinson cda4c738e8 Don't declare i in a for() statement 2011-08-08 13:34:42 -07:00
Chris Robinson f7c176e8ca Use a message thread to handle MMDevAPI backend methods
Because MMDevAPI uses COM, CoInitialize must be called on the thread(s) where
the device calls are made. OpenAL has no such requirement, thus no guarantee
that COM will be (or remain) initialized on the calling thread(s).
2011-08-03 10:42:29 -07:00
Chris Robinson 3e2bc847d8 Avoid closing devices and deinitializing backends on process exit
They are still closed and deinitialized when the DLL is simply being detached
(via FreeLibrary), however.
2011-08-03 09:46:18 -07:00
Chris Robinson b5092a6212 Delay reading the config file on Windows, too 2011-08-03 09:37:58 -07:00
Chris Robinson 81d401eab5 Use specialized click removal loops for mono and stereo output 2011-07-30 05:43:47 -07:00
Chris Robinson f986f7dfad Wait until all headers are unprepared before freeing the buffer 2011-07-28 08:27:52 -07:00
Chris Robinson bcbc1dea25 Make the thread event auto-resetting 2011-07-28 08:23:19 -07:00
Chris Robinson c8326ab328 Remove the unnecessary wave header event
It's only ever set before sending the quit message, which will set the thread
event. It's also only waited on just before the thread event is used to signal
the end of the thread.
2011-07-28 08:18:43 -07:00
Chris Robinson 91c6bc58dc Use unnamed events for winmm 2011-07-28 08:16:09 -07:00
Chris Robinson c722579c18 Make the DSound and MMDevAPI events initially non-signaled 2011-07-24 05:29:43 -07:00
Chris Robinson 2f3bd5b5d9 Move an include to where it makes more sense to be 2011-07-23 05:53:53 -07:00
Chris Robinson fad80a4f92 Don't cast for the float versions of math functions 2011-07-23 05:52:10 -07:00
Chris Robinson 1b0a55f44c Use real-time priority by default on Windows
It's actually "time-critical", but it seems normal priority doesn't cope as
well when the system is under moderate load.
2011-07-23 05:44:55 -07:00
Chris Robinson 14b359beb0 Fix cmake check 2011-07-23 04:36:03 -07:00
Chris Robinson f32876d4bd Check for the finite() function along with _finite() 2011-07-23 04:23:54 -07:00
Chris Robinson 13f9dbe582 Look for ieeefp.h and include it when appropriate 2011-07-23 04:06:29 -07:00
Chris Robinson 8dfa2560b1 Use a better method for determining if shared functions exist 2011-07-23 00:48:19 -07:00
Chris Robinson 0c8c3b16d2 Round UpdateSize to the nearest multiple of MMDevAPI's period size 2011-07-21 18:53:15 -07:00
Chris Robinson 3d2812bd35 Reset the MMDevAPI and DSound events before starting playback 2011-07-21 17:04:33 -07:00
Chris Robinson a0e5cbc47f Fix DSound UpdateSize calculation when NumUpdates is clamped 2011-07-21 16:53:25 -07:00
Chris Robinson d5ddc6acee Make sure some state values are finite 2011-07-21 16:18:21 -07:00
Chris Robinson 30750d8763 Create and close the DSound event handle with the device 2011-07-21 03:38:43 -07:00
Chris Robinson 3e4659076a Use an event to signal the mmdevapi backend to mix
Also, use a multiple of the default period size for the update size, since the
event apparently triggers on period boundaries.
2011-07-21 03:32:20 -07:00
Chris Robinson 7cd6327969 Use DSound notifications to wake up the mixer thread 2011-07-21 02:48:09 -07:00
Chris Robinson 77128d298e Add an option to emulate EAX reverb using standard reverb 2011-07-20 22:53:46 -07:00
Chris Robinson 1e8a379a03 Add a config option to boost reverb output 2011-07-20 22:26:16 -07:00
Chris Robinson b889823b21 Set real-time priority for the WaveOut backend 2011-07-20 19:59:47 -07:00
Chris Robinson 9723c553b6 Scale reverb output based on the number of channels
A scale of sqrt(2/numchannels) is used so the perceived volume matches as if it
was stereo output, which seems to match other implementations.
2011-07-20 19:57:24 -07:00
Chris Robinson 6bfb0371eb Make sure some effect property values are finite 2011-07-20 03:33:06 -07:00
Chris Robinson 1348bf2476 Make sure some listener property values are finite 2011-07-20 03:27:05 -07:00
Chris Robinson 36446f3a58 Make sure source vectors are finite values 2011-07-20 03:18:46 -07:00
Chris Robinson 5a484f7493 Look for an isfinite function 2011-07-20 03:18:11 -07:00
Chris Robinson 244d60fb96 Slightly improve the gain change delta calculation 2011-07-19 00:43:31 -07:00
Chris Robinson 0ae9638aa5 Add a lost comment 2011-07-18 17:44:37 -07:00
Chris Robinson 55b893c784 Improve buffer metrics when using the MMDevAPI backend 2011-07-17 19:42:03 -07:00
Chris Robinson c9b6bc848f Simplify some reverb update calculations 2011-07-17 17:51:13 -07:00
Chris Robinson f97310c757 Apply the click removal offset first, before decreasing it 2011-07-17 07:23:19 -07:00
Chris Robinson 87b3520d02 Fix GetMovingHrtfCoeffs return type 2011-07-17 07:16:10 -07:00
Chris Robinson 887de0523f Scale the delay down once for the post-stepping mix loop 2011-07-17 02:34:35 -07:00
Chris Robinson a7a1f802a8 Invert the device channel map 2011-07-17 01:55:25 -07:00
Chris Robinson 163cc62a00 Add a couple new functions to handle deferred updates
Currently no-ops, they will be used in place of alcSuspendContext and
alcProcessContext for batching updates since the mentioned functions have no
coherent functionality between system implementations.
2011-07-16 16:59:20 -07:00
Chris Robinson 5f566ebf05 Fade between HRTF coefficients, to reduce noise from sudden changes 2011-07-16 16:24:01 -07:00
Chris Robinson 1622986467 Fix some format types 2011-07-16 04:21:40 -07:00
Chris Robinson ce6db53e5f Apply the slot gain during the effect update method 2011-07-16 03:35:51 -07:00
Chris Robinson 292ea0607d Request a slot update when the gain changes 2011-07-16 03:15:28 -07:00
Chris Robinson 3bd7256dc8 Pass the effect slot to the effect update method 2011-07-16 03:02:16 -07:00
Chris Robinson da2429a1d0 Allow effect slots to be updated asynchronously
Updates when the slot changes effect type is still sychronous, however, to
ensure a proper state for the Process method call. Fixing this would
essentially require all effects to work from the same state.
2011-07-16 02:41:02 -07:00
Chris Robinson 54b5f35125 Warn about HRTF being disabled in the compatibility check function 2011-07-16 00:39:13 -07:00
Chris Robinson 23bfb03d2a Improve the external HRTF data file format
Although more parameters are read from the file, some must currently conform to
specific values. In the future, these restrictions may be lifted.
2011-07-16 00:22:01 -07:00
Chris Robinson 7381b1a696 Make the sample rate part of the HRTF struct 2011-07-15 23:45:03 -07:00
Chris Robinson 99bcb7a0f6 Use both root paths when looking for Wine headers, and disable them by default 2011-07-13 01:49:43 -07:00
Chris Robinson 17773c5644 Rename the ERROR macro to ERR 2011-07-13 01:43:00 -07:00
Chris Robinson e1e47c6e43 Fix CMAKE_FIND_ROOT_PATH in XCompile.txt 2011-07-13 01:31:17 -07:00
Chris Robinson 2bb3d31d5c Avoid holding the global list lock while calling some capture methods 2011-07-13 01:21:30 -07:00
Chris Robinson 2a7bf1234b Use the correct send slot when mixing 2011-07-11 22:32:27 -07:00
Chris Robinson e56e462317 Fix default room air absorption 2011-07-11 22:07:37 -07:00
Chris Robinson 3245e992c3 Always pass the slot's effect to the update method 2011-07-11 01:51:24 -07:00
Chris Robinson 1299fa2801 Avoid some alListenerfv calls while under the context lock 2011-07-11 01:21:29 -07:00
Chris Robinson 52c78194b3 Update the context when an auxiliary slot is modified 2011-07-11 01:13:58 -07:00
Chris Robinson 58466a304b Use a flag to signifiy that all sources need updating 2011-07-11 01:05:42 -07:00
Chris Robinson 51c09e94b8 Avoid some alGet* duplication 2011-07-11 00:51:18 -07:00
Chris Robinson 22ccaf7f4a Trace device update size and count 2011-07-11 00:05:53 -07:00
Chris Robinson b237ebba44 Trace when the format is being requested 2011-07-10 23:57:45 -07:00
Chris Robinson 6038bbd6ec Avoid redundantly tracing HRTF status 2011-07-10 23:50:55 -07:00
Chris Robinson 84a67ef766 Trace device parameters when updating 2011-07-10 22:54:39 -07:00
Chris Robinson e03df97919 Accept "openal soft" and "openal-soft" to open a device 2011-07-10 22:36:10 -07:00
Chris Robinson 7bedd9ef7a Replace some AL_PRINT calls with proper logging 2011-07-10 22:32:44 -07:00
Chris Robinson 72cd670636 Use logging macros in the opensl backend 2011-07-10 22:31:24 -07:00
Chris Robinson 9b028e76d2 Use logging macros in the wave backend 2011-07-10 22:29:25 -07:00
Chris Robinson 479b4c9531 Use logging macros in the solaris backend 2011-07-10 22:28:34 -07:00
Chris Robinson 28f7d2151e Use logging macros in the winmm backend 2011-07-10 22:27:46 -07:00
Chris Robinson cd1560e2b0 Use logging macros in the coreaudio backend 2011-07-10 22:26:02 -07:00
Chris Robinson 87b4c93af9 Use logging macros for the portaudio backend 2011-07-10 22:22:38 -07:00
Chris Robinson 0393d4ba71 Use logging macros in the sndio backend 2011-07-10 22:20:34 -07:00
Chris Robinson 717a0592ba Use logging macros in the oss backend 2011-07-10 22:17:12 -07:00
Chris Robinson a67aff220f Use logging macros in the null backend 2011-07-10 22:15:16 -07:00
Chris Robinson e47e9c5ac3 Use logging macros in the mmdevapi backend 2011-07-10 22:13:57 -07:00
Chris Robinson 4cd9367520 Use logging macros in the dsound backend 2011-07-10 21:57:32 -07:00
Chris Robinson c4ac014a0c Use the logging macros for the alsa backend 2011-07-10 21:53:32 -07:00
Chris Robinson 21c99ca1e8 Use the logging macros in the pulseaudio backend 2011-07-10 21:51:41 -07:00
Chris Robinson 2cd3e9bcdb Use the logging macro for thunk errors 2011-07-10 21:49:01 -07:00
Chris Robinson f56fbbb777 Use logging macros for config handling 2011-07-10 21:44:42 -07:00
Chris Robinson b64156aa2b Add some macros for logging at various levels, and use them 2011-07-10 21:30:25 -07:00
Chris Robinson 5cb4129bc7 Use a per-device lock instead of a global one 2011-07-06 05:07:36 -07:00
Chris Robinson bed264ad77 Use a Lock/UnlockDevice function instead of locking a NULL context 2011-07-06 02:58:43 -07:00
Chris Robinson f8be0448b0 Don't modify the source's WetGain[HF]Auto because of a slot's state 2011-07-06 00:07:37 -07:00
Chris Robinson 75fa891e0a Store and use the send slot in the source params 2011-07-05 14:14:20 -07:00
Chris Robinson 21574f7e16 Scale the WetGain parameter directly instead of on each application 2011-07-05 14:00:11 -07:00
Chris Robinson 0903a7f1e0 Apply wet path calculations with their dry path equivalents
The auxiliary slot (and related effect) properties are retrieved at the same
time as the source properties. This will help ensure each property is accessed
from the source and slot only once.
2011-07-05 11:00:52 -07:00
Chris Robinson c8d385c998 Use a helper to tell if an effect type is reverb 2011-07-05 04:36:41 -07:00
Chris Robinson 4c35bfbc10 Read the source's RoomRolloffFactor once 2011-07-05 03:55:16 -07:00
Chris Robinson 83e322c5f3 Force front-centered for mono sounds that comes from the listener under HRTF 2011-07-05 03:36:14 -07:00
Chris Robinson 6020b964c7 Fix some formatting 2011-07-04 22:36:51 -07:00
Chris Robinson b2d5367830 Fix rolloff calculations for auxiliary sends 2011-07-04 07:32:23 -07:00
Chris Robinson d307ee8c2f Implement a lerped lookup of the HRTF coefficients/delays
Code supplied by Christopher Fitzgerald
2011-07-04 07:20:38 -07:00
Chris Robinson 202f57552a Use a proper enum for the distance model 2011-07-03 19:39:19 -07:00
Chris Robinson 5ba864b6da Calculate the wet gain decay time attenuation with linear values 2011-07-03 19:22:14 -07:00
Chris Robinson 30e97d5223 Read the RoomRolloffFactor property with the other properties 2011-07-03 03:34:40 -07:00
Chris Robinson 69be02c0fd Set the default auxiliary sends to MAX_SENDS
Since the property is ALC_MAX_AUXILIARY_SENDS, it makes more sense to default
it to the maximum and let the app lower it on request.
2011-07-03 03:18:18 -07:00
Chris Robinson eefda551de Properly handle input samples for changes with the FIR coefficients
This makes sure previously processed samples are not changed due to changes in
the FIR filter. It also applies the coefficients in ascending order with the
values, to improve caching.
2011-07-03 02:14:33 -07:00
Chris Robinson ac7ca07221 Get rid of a couple typedefs 2011-07-02 21:33:53 -07:00
Chris Robinson b043390ec2 Update a trace 2011-07-02 19:02:45 -07:00
Chris Robinson 4c94ba6d8a Properly save the original FPU state when using _controlfp 2011-07-02 02:56:06 -07:00
Chris Robinson 7b87519c15 Move functions to where they're used 2011-07-02 02:54:05 -07:00
Chris Robinson 14bfe0293a Use separate functions to find valid ALC loopback device formats 2011-07-02 02:51:33 -07:00
Chris Robinson 931d422443 Use separate ALC enums for loopback device formats 2011-07-02 02:25:34 -07:00
Chris Robinson 895150eebe Update HRTF coefficients 2011-07-01 05:08:57 -07:00
Chris Robinson a5ccae5779 Do air absorption with linear gain values
This copies the way the calculation is done with the wet path
2011-07-01 02:30:15 -07:00
Chris Robinson 1635132fd5 Use a template function to handle processing ring modulator types 2011-07-01 01:48:04 -07:00
Chris Robinson 048aee66cf Avoid accessing source properties more than once when updating parameters 2011-07-01 01:46:56 -07:00
Chris Robinson aea2868ce1 Avoid calling some al[Get]Effect functions while the context is locked 2011-06-30 20:59:35 -07:00
Chris Robinson 723755788d Rename Suspend/ProcessContext since they are locking a mutex 2011-06-30 18:10:04 -07:00
Chris Robinson 032d0836a7 Declare some variables closer to where they're used 2011-06-29 23:32:48 -07:00
Chris Robinson 5736bbc3e4 Add a source property to skip channel virtualization for multi-channel buffers
With virtualization disabled, channels are mapped directly from input to output
and any input channel that is missing an output is dropped. Any virtualization
effects (such as HRTF filters) for positional cues are also skipped.

The idea is to allow applications a way to play pre-filtered audio that channel
vitualization effects could interfere with.
2011-06-29 23:18:49 -07:00
Chris Robinson 1b773a8585 Select the correct resampler 2011-06-28 00:30:00 -07:00
Chris Robinson 3f0214ed6b Implement capture support for the CoreAudio backend 2011-06-27 23:49:17 -07:00
Chris Robinson ea83608ee4 Avoid a junk sample at the start of the ring buffer, and allocate the buffer
memory at the end of the ring buffer itself.
2011-06-27 14:30:45 -07:00
Chris Robinson 8cae1aee80 Clamp PortAudio output to stereo 2011-06-27 01:00:34 -07:00
Chris Robinson 3db061e670 Combine the two pa_load definitions into one 2011-06-26 15:40:15 -07:00
Chris Robinson efaaf9b5f9 Don't bother with a per-context lock for disconnecting devices 2011-06-26 01:26:50 -07:00
Chris Robinson c451bf370d Remove an incorrect ProcessContext call 2011-06-26 01:22:29 -07:00
Chris Robinson 212b187447 Add a function to check if a device is compatible with the Hrtf filter 2011-06-25 21:39:36 -07:00
Chris Robinson ac9a6e891f Fix the cross-compile toolchain script
CMAKE_INSTALL_PREFIX is now properly set, and the pkgconfig env vars are set so
it won't find .pc files for the default compiler.
2011-06-25 13:49:40 -07:00
Chris Robinson 1fc44d5788 Select the mixer during a source update 2011-06-25 00:13:56 -07:00
Chris Robinson 913c70557d Fix formatter for size_t 2011-06-24 15:03:29 -07:00
Chris Robinson e8b785677d Make sure to clear HAVE_SNDIO before checking backends 2011-06-23 18:39:16 -07:00
Chris Robinson 5c17eb69cb Fix comment typo 2011-06-23 17:02:57 -07:00
Chris Robinson f6d1e0f299 Avoid setting a thread priority for OpenBSD
It apparently causes a negative performance impact regardless of which values
are set.
2011-06-23 15:42:35 -07:00
Chris Robinson e42bdc2022 Fix device Update parameters for sndio 2011-06-23 15:42:16 -07:00
Chris Robinson cf44f499b8 Be silent about failing to load shared libs 2011-06-22 20:48:45 -07:00
Chris Robinson 39c984fda8 Actually load libsndio.so 2011-06-22 20:45:45 -07:00
Chris Robinson 9c23bc53b7 Update the default drivers config option comment 2011-06-22 19:31:27 -07:00
Chris Robinson 96b6cd46e6 Add a FreeBSD sndio backend 2011-06-22 19:29:13 -07:00
Chris Robinson bc6e3879d4 Properly handle the PortAudio lib in OpenBSD 2011-06-22 16:43:37 -07:00
Chris Robinson 3dcfd0dc98 Use 'Distance' for the unclamped distance value, since the clamped value is
only used for distance attenuation
2011-06-21 12:55:21 -07:00
Chris Robinson 40b8934487 Calculate wet gain when needed 2011-06-18 16:45:26 -07:00
Chris Robinson 0d39ac6528 Allow alThunkAddEntry to return a proper error 2011-06-17 23:59:25 -07:00
Chris Robinson 157e1394d6 Open the log file with config initialization 2011-06-17 18:54:05 -07:00
Chris Robinson edf78b077e Use separate lines for HRTF history and values 2011-06-17 16:22:39 -07:00
Chris Robinson 753e64c76c Do stereo duplication in two passes
First using the rear channels, then using the normal stereo channels
2011-06-17 16:20:18 -07:00
Chris Robinson 3a072a294d Avoid resetting a flag that isn't on 2011-06-17 14:59:10 -07:00
Chris Robinson 23ae3c69b5 Handle the device's disconnected status earlier when playing a source 2011-06-17 13:21:02 -07:00
Chris Robinson bef9c5e2d5 Avoid some al[Get]Effect* calls from under the context lock 2011-06-17 13:07:47 -07:00
Chris Robinson 58add24830 Call al[Get]Filterf directly from the *v equivalents
There are no filter parameters which take multiple values, and besides some
duplicated checks, they call straight through anyway.
2011-06-16 14:40:37 -07:00
Chris Robinson fdffbfd2c4 Use the predefined filter macros instead of hardcoded values 2011-06-16 10:53:01 -07:00
Chris Robinson 357f841e88 Fix namespacing of EFX filter property values 2011-06-16 10:52:17 -07:00
Chris Robinson 7d73ac4405 Avoid calling some AL functions from under the context lock
There are still some more occurances to clear out (deletion in gen error,
effects, some filters), which shall be coming up. There is a possibility for a
deadlock between the listlock and the global/context lock, if another attempt
to get the listlock is made while under the context lock.
2011-06-16 09:14:41 -07:00
Chris Robinson c429a5be25 The DirectSound DLL is always loaded by the Win32 API 2011-06-16 06:17:57 -07:00
Chris Robinson fba58fb1f0 Make sure user configuration is always initialized for Windows 2011-06-16 05:36:16 -07:00
Chris Robinson dad7f1cf0f Prefer DllMain when in Windows 2011-06-16 05:34:13 -07:00
Chris Robinson 8bee7a2b7f Don't suspend individual contexts when updating 2011-06-16 05:29:38 -07:00
Chris Robinson 632b4e6332 Avoid some channel order duplication 2011-06-16 00:00:40 -07:00
Chris Robinson f26798bd19 Remove some unnecessary casts 2011-06-15 23:52:21 -07:00
Chris Robinson 7f4dcefc80 Remove the databuffer functions and structs
It's been disabled for a while now, and not likely to be re-enabled.
2011-06-15 23:46:35 -07:00
Chris Robinson d702cb9b49 Avoid an unnecessary lock when retrieving the current context 2011-06-15 23:22:34 -07:00
Chris Robinson 2081228055 Declare some variables where they're used 2011-06-15 06:45:51 -07:00
Chris Robinson f85283c036 Don't prematurely set the HRTF flag 2011-06-15 02:00:41 -07:00
Chris Robinson 14d6ab384d Use a flag to specify when a device is running 2011-06-15 01:59:07 -07:00
Chris Robinson 62036745f3 Separate config init from library init
OSX has a bug where the file descriptor resource limit can't be increased once
certain functions (such as fopen) are used. Since lib initialization happens in
a global constructor and includes opening and parsing config files, it prevents
apps from being able to increase the rlimit once the lib is loaded, which is
usually before main().

By delaying config init, it allows apps the opportunity to change the rlimit
before calling certain OpenAL functions.
2011-06-14 09:43:33 -07:00
Chris Robinson 264274685a Throw an error when no global initialization is available 2011-06-14 08:47:53 -07:00
Chris Robinson 1babf28491 Unset the local context if it's being destroyed 2011-06-14 08:27:09 -07:00
Chris Robinson 5a15dc4ddf Avoid multiple list searches when destroying devices and contexts 2011-06-14 07:04:08 -07:00
Chris Robinson 0f782b385b Create TLS for contexts earlier 2011-06-14 06:57:51 -07:00
Chris Robinson 1534fcfafd Remove some unneeded includes 2011-06-14 05:06:39 -07:00
Chris Robinson 1c7ed6e693 Avoid using function pointers directly in the ALSA backend
Also make it use the lib wrappers
2011-06-14 05:00:59 -07:00
Chris Robinson 0c5c56cf88 Avoid using function pointers directly in the PulseAudio backend
Also, switch to the lib wrapper functions
2011-06-14 04:45:52 -07:00
Chris Robinson 53c5275aa4 Use a proper enum for the probe type 2011-06-14 04:02:58 -07:00
Chris Robinson c93d7a1721 Open the logfile in append/text mode 2011-06-14 03:04:00 -07:00
Chris Robinson 9c7dad1bdf Combine multiple probe functions into one 2011-06-14 02:28:15 -07:00
Chris Robinson bfe09b933e Trace errors in the opensl callback 2011-06-14 01:51:44 -07:00
Chris Robinson 823f5779e1 Set format_pcm according to the device format 2011-06-14 01:48:13 -07:00
Chris Robinson 96a18ba1d5 Make fewer assumptions on the OpenSL buffer count 2011-06-12 19:36:28 -07:00
Chris Robinson b8bb41107c Don't be silent when an OpenSL error occurs 2011-06-12 18:10:01 -07:00
Chris Robinson ccffb7e380 Add missing semicolon 2011-06-12 16:30:51 -07:00
Chris Robinson 39088b2035 Uninline the timeGetTime wrapper 2011-06-12 05:04:36 -07:00
Chris Robinson 8db05b8c17 Avoid defining a macro twice 2011-06-12 04:45:03 -07:00
Chris Robinson ba069ded40 Add an OpenSL backend
Currently for Android's OpenSL ES implementation
2011-06-12 04:41:42 -07:00
Chris Robinson 6b8209fdc9 Cleanup dynamic loading in the PortAudio backend 2011-06-12 04:37:32 -07:00
Chris Robinson ccf62fc525 Add wrappers to handle dyanmically loading libs 2011-06-12 04:36:24 -07:00
Chris Robinson 6bfab6427a Avoid calling some function pointers directly 2011-06-12 03:55:02 -07:00
Chris Robinson aab4f85383 Change HRTF table user input format 2011-06-03 03:15:13 -07:00
Chris Robinson 99b9208896 Improve default HRTF filter delays
They're now rounded from the source's float delays
2011-06-03 03:09:13 -07:00
Chris Robinson 7402e3743d Readd the default HRTF filter (based on the diffuse set) 2011-06-03 01:47:33 -07:00
Chris Robinson 7ddfacb58f Use a minimum phase HRTF data set
This reduces the coefficient size from 128 down to 32, with a set of delays
2011-06-03 01:06:00 -07:00
Chris Robinson c7a80418d9 Separate device-type parameter checks for alcGetIntegerv 2011-05-29 23:20:33 -07:00
Chris Robinson e98104dac8 Avoid holding locks once the context is removed from the lists 2011-05-29 23:03:59 -07:00
Chris Robinson 884f668855 Uninline a couple more functions 2011-05-29 03:28:34 -07:00
Chris Robinson 2bbe9d1b1f Uninline a couple mutex wrapper functions 2011-05-29 03:08:26 -07:00
Chris Robinson 91c3cffe41 Protect the mixer while the device's context array is being updated 2011-05-29 03:04:32 -07:00
Chris Robinson 60a55aa897 Hold the global lock while the device is being updated 2011-05-29 02:56:00 -07:00
Chris Robinson 9325a78043 Use a separate lock for device and context list accesses 2011-05-29 02:26:46 -07:00
Chris Robinson cd0e80126c Require a lock for IsDevice calls 2011-05-28 22:21:11 -07:00
Chris Robinson 1778c0d7d8 Get the device format directly from the string 2011-05-28 21:37:33 -07:00
Chris Robinson b07901f1a0 Set the subformat type when an unknown one is encountered 2011-05-28 21:21:37 -07:00
Chris Robinson a15a1abb21 Trace the format that is set when reporting HRTF disabled 2011-05-28 20:40:46 -07:00
Chris Robinson 7da2eea8f0 Add a 5.1 device format that uses side channels instead of back 2011-05-28 19:35:32 -07:00
Chris Robinson 596a1af7d9 Switch to the diffuse HRTF data set 2011-05-26 15:43:26 -07:00
Chris Robinson 6b6a7757ce Clear HRTF coefficients for the LFE channel 2011-05-25 19:04:19 -07:00
Chris Robinson 8a6266239c Rename Quad to Quadraphonic 2011-05-24 14:34:53 -07:00
Chris Robinson d83af679bd Fix handling of GUID definitions 2011-05-22 13:29:32 -07:00
Chris Robinson af005668da Avoid using an unnecessary temp variable 2011-05-21 23:14:55 -07:00
Chris Robinson d07e94056d Use libuuid when it has MMDevApi's UIDs 2011-05-21 21:57:44 -07:00
Chris Robinson 4d7aab1df4 Make some declarations static or static const 2011-05-21 21:28:27 -07:00
Chris Robinson c3cbfecbae Remove duplicate macros 2011-05-21 21:16:30 -07:00
Chris Robinson a9d9553fff Use a multi-dimensional array for the panning LUT 2011-05-21 17:45:54 -07:00
Chris Robinson 5cdf774ea7 Use the stored sample and channel count 2011-05-21 17:36:54 -07:00
Chris Robinson b75d4beb1a Dedicated dialog should go in front 2011-05-20 09:50:31 -07:00
Chris Robinson 35a0430c81 Store the separate effect parameters in a union 2011-05-20 09:36:36 -07:00
Chris Robinson 1b5caa4112 Check against the correct limits 2011-05-20 09:19:53 -07:00
Chris Robinson cbbb04eb40 Always fully normalize the position when using HRTF 2011-05-20 07:58:05 -07:00
Chris Robinson 7396aaf2c2 Fix HRTF elevation calculation 2011-05-19 17:57:14 -07:00
Chris Robinson 555ccce4ee Update the device update fields after initializing the MMDevApi device 2011-05-19 15:55:27 -07:00
Chris Robinson b838d123f8 Multiply the history offset in the filtering funcitons 2011-05-18 18:52:47 -07:00
Chris Robinson 1d3926e187 Remove some more duplication 2011-05-18 18:49:41 -07:00
Chris Robinson 194f8fc791 Uninline lpCoeffCalc 2011-05-18 18:42:25 -07:00
Chris Robinson c316766144 Use lerp() in a couple more places 2011-05-18 18:09:04 -07:00
Chris Robinson c00b2f9254 Avoid looking in the buffer queue to find the frame size 2011-05-18 17:02:18 -07:00
Chris Robinson 35c38e0b5e Update alsoftrc.sample 2011-05-18 15:13:11 -07:00
Chris Robinson 87ef4eeb36 Add cmake options to require specific backends
Note that this alone doesn't gurantee run-time availability for backends libs
that are loaded at run-time.
2011-05-18 05:34:21 -07:00
Chris Robinson 06f5f0b7c8 Make mixers channel-count agnostic
As a result, this combines/removes a bunch of mixers
2011-05-17 13:25:15 -07:00
Chris Robinson 9f91ff4734 Move the channel loop to the outside of the sample mixing loop 2011-05-17 12:49:26 -07:00
Chris Robinson f7936b4709 Avoid multiple getenv calls to the same var 2011-05-17 10:15:53 -07:00
Chris Robinson 60965e3a6c Determine the function export attribute using CMake 2011-05-17 09:13:55 -07:00
Chris Robinson b5cb2d633c Avoid including config.h in the utilities 2011-05-17 09:03:54 -07:00
Chris Robinson 810734718b Always look for libwinmm 2011-05-17 08:36:26 -07:00
Chris Robinson ca48c2e51b Modify the cross-compile toolchain file to only need a HOST option 2011-05-17 06:53:36 -07:00
Chris Robinson 86ed2ee72b Add mmdevapi to alsoftrc.sample 2011-05-17 05:04:08 -07:00
Chris Robinson 2abeed069b Improve handling of format support for MMDevApi 2011-05-17 04:54:09 -07:00
Chris Robinson 569106acd3 Fix COM initialization with MMDevApi 2011-05-16 10:31:38 -07:00
Chris Robinson 507d2f8afb Properly set the channel order for WinMM playback 2011-05-16 10:28:17 -07:00
Chris Robinson 54769a823e Implement playback using MMDevApi 2011-05-16 04:13:37 -07:00
Chris Robinson cf3287f8ec Fix closing of waveOut devices 2011-05-16 03:16:47 -07:00
Chris Robinson c5fbc9f05c Define GUIDs in ALc.c instead of the individual backend source files 2011-05-15 21:47:50 -07:00
Chris Robinson 2940b0f390 Add a skeleton backend for MMDevApi 2011-05-15 20:26:25 -07:00
Chris Robinson 442e41f825 Add an option to use Wine's Windows headers when building under MinGW 2011-05-15 20:25:09 -07:00
Chris Robinson e95b718cf4 Improve handling of device channels with DSound 2011-05-15 05:24:27 -07:00
Chris Robinson 143c08bfcb Use channel config strings in log output 2011-05-15 04:49:18 -07:00
Chris Robinson b3902c8950 Add functions to get strings from the device format 2011-05-15 04:03:15 -07:00
Chris Robinson 7210796cb8 Combine multiple loops 2011-05-15 02:12:42 -07:00
Chris Robinson 949cfe2ceb Re-enable duplication for stereo sounds 2011-05-15 00:18:28 -07:00
Chris Robinson c39f27d5f8 Set the duplicate-stereo flag properly after the device format is reset 2011-05-13 21:27:46 -07:00
Chris Robinson c9ac4f06ff Remove an unused macro and rename another 2011-05-07 04:35:49 -07:00
Chris Robinson 674b14faa3 Make a couple more pointers restricted 2011-05-07 04:32:53 -07:00
Chris Robinson a8fdcd30a5 Some minor cleanups 2011-05-07 04:31:43 -07:00
Chris Robinson db3cb23c1d Add an option to reverse Z panning of mono sources
Applications that are not built around OpenAL's orientation system need to
convert their given vectors to it. Depending on how this is done, it can lead
to proper stereo (left-right) panning with improper surround sound (front-back)
panning, which thusly sounds correct with stereo output and incorrect with 4+
channel output.

This option is intended to help fix playback of such applications on surround
sound systems, without having to resort to forcing stereo output.
2011-05-07 03:54:46 -07:00
Chris Robinson 7972f7a2da Combine duplicate arrays 2011-05-06 23:25:15 -07:00
Chris Robinson 8c3d50be28 Skip LFE with HRTF output 2011-05-06 04:46:21 -07:00
Chris Robinson 4198f3062c Remove the device channel matrix 2011-05-06 04:42:54 -07:00
Chris Robinson c2a6efc77a Use the panning algorithms to build the multi-channel source matrix
This prevents the stereo-duplication option from working. It should hopefully
be restored soon.
2011-05-06 04:37:10 -07:00
Chris Robinson 6928487aa1 Remove some redundancy 2011-05-06 02:53:22 -07:00
Chris Robinson e608317e70 Fix device flag value 2011-05-06 01:59:32 -07:00
Chris Robinson 64b5d7a519 Check the correct flag in the dsound backend 2011-05-06 01:53:13 -07:00
Chris Robinson eef41e76d7 Don't clear the request flag if a new context doesn't specify a frequency 2011-05-06 01:50:19 -07:00
Chris Robinson d583f7f307 Update sources automatically when device parameters change 2011-05-06 01:06:01 -07:00
Chris Robinson f97eca34df Minor source update fixes 2011-05-06 00:51:12 -07:00
Chris Robinson 1363e044ac Remove the head_dampen option
Now that HRTF is properly supported, it's not needed
2011-05-06 00:38:10 -07:00
Chris Robinson 9967d4eadd Mark a couple more pointers as restricted 2011-05-06 00:33:58 -07:00
Chris Robinson 2972de1047 Use function pointers to call the source mixer 2011-05-06 00:20:40 -07:00
Chris Robinson 38db4115fc Fix a comment 2011-05-05 22:36:26 -07:00
Chris Robinson 0e824914b2 Use signed samples for 8-bit storage 2011-05-05 18:54:10 -07:00
Chris Robinson 7832a6d1d8 Add a warning when HRTF is disabled 2011-05-03 20:23:35 -07:00
Chris Robinson 0cce93a1f8 Fix WinMM backend compilation 2011-05-03 17:12:05 -07:00
Chris Robinson 679f2480c9 Add a device flag for channel config requests 2011-05-03 17:11:07 -07:00
Chris Robinson db7ca2c7ca Combine the mono and multi-channel mixer templates 2011-05-03 16:34:28 -07:00
Chris Robinson e2850df07e Use the same filters for mono sources and multi-channel 2011-05-03 16:18:46 -07:00
Chris Robinson 48def2fecb Properly handle elevations that don't have angles up to 180 2011-05-03 03:15:28 -07:00
Chris Robinson ba236ad108 Add a frequency-request device flag 2011-05-03 02:29:26 -07:00
Chris Robinson 9a28402b90 Fix non-spatialized mono sources 2011-05-02 18:33:32 -07:00
Chris Robinson 8c705cc4ea Mark some mixer pointers as restricted 2011-05-02 17:14:57 -07:00
Chris Robinson 24aaa24b5c Check for the C99 restrict keyword
GCC does not default to C99 mode yet, so does not know restrict, however it
still allows using __restrict in its place
2011-05-02 17:06:32 -07:00
Chris Robinson fd795a7eeb Add casts to silence some warnings 2011-05-02 15:04:35 -07:00
Chris Robinson abdc254e55 Use a pointer-to-arrays for the local HRTF coefficients 2011-05-02 13:35:13 -07:00
Chris Robinson f843b7e2e3 Implement HRTF mixers for multi-channel sources 2011-05-02 02:22:30 -07:00
Chris Robinson eea86ab891 Use flags instead of separate bools 2011-05-01 18:18:37 -07:00
Chris Robinson d7a452588c Document the hrtf config option 2011-05-01 14:16:05 -07:00
Chris Robinson 56d9418119 Add an HRTF filter for mono sources
The data is based on the KEMAR HRTF data provided by MIT, which can be found at
<http://sound.media.mit.edu/resources/KEMAR.html>. The compact measurements
were used. See hrtf_tables.inc for more information.

The filter is only available for stereo output, using a 44100hz playback rate.
Note also that it currently only applies to mono sounds, and the cf_level and
head_dampen config options are ignored while it is active.
2011-05-01 13:59:44 -07:00
Chris Robinson 0109104027 Add some source fields for HRTF data 2011-05-01 13:21:56 -07:00
Chris Robinson c9c965ef85 Add a device flag for enabling HRTF 2011-05-01 13:19:23 -07:00
Chris Robinson af3adf5244 Be silent if the PulseAudio context fails to connect while probing 2011-04-30 17:58:37 -07:00
Chris Robinson 43f97b4da1 Use the new format names when possible 2011-04-29 11:55:59 -07:00
Chris Robinson 63f07db303 Add the SOFT moniker for the loopback extension functions and enums 2011-04-28 11:37:23 -07:00
Chris Robinson 2e9ca89dd3 Reorder some cases 2011-04-27 21:05:46 -07:00
Chris Robinson 8586aeabe8 Minor fix for 24-bit conversions to float and double 2011-04-27 19:26:27 -07:00
Chris Robinson c031b4d5d0 Allow MSVC to build a static lib
Based on a patch by Michał Cichoń <michcic@gmail.com>
2011-04-27 16:33:44 -07:00
Chris Robinson d91b3464a4 Fix 24-bit sample loading for big-endian 2011-04-27 15:46:30 -07:00
Chris Robinson 650d94e1a6 Change some sample type values 2011-04-27 12:20:50 -07:00
Chris Robinson 543134a6d2 Add loopback device properties to the ALCenum list 2011-04-27 12:18:24 -07:00
Chris Robinson ab2626f9df Add a couple in-progress extensions to the extension lists 2011-04-27 12:15:16 -07:00
Chris Robinson d50f9249d6 Add support for packed 24-bit samples 2011-04-26 18:17:50 -07:00
Chris Robinson 10a9753183 Add a compatibility option to treat cone angles as half angles
All previous versions of the library treated the source cone angles as half
angles, which is contrary to the spec. Setting the __ALSOFT_HALF_ANGLE_CONES
environment variable to "true" or "1" restores the buggy behavior for
compatibility with applications that expect it.

This is not a config file option because new apps should not be made to depend
on the old behavior.
2011-04-22 23:17:27 -07:00
Chris Robinson 1e8718fe87 Convert full-width cone angle source properties to half-width
The spec intends the property values to be the full angle encompassed by the
cones, but the calculation interprets them as the angle from the center
point.
2011-04-22 22:59:58 -07:00
Chris Robinson 678d0b87d0 Apply the device matrix to the multi-channel source matrix
Mono sources and effects already output according to the available output
device channels. Multiplying the device matrix with the source matrix results
in a matrix that has the same effect as applying the source matrix followed by
the device matrix, so all the channel remixing can be done in one place.
2011-04-14 21:03:37 -07:00
Chris Robinson 319dfce300 Fix LFE channel output 2011-04-14 15:20:25 -07:00
Chris Robinson c3e86933d0 Only set relevant device matrix entries 2011-04-12 17:08:02 -07:00
Chris Robinson 936acf8c10 Allow the buffer_samples API to be retrieved 2011-04-10 09:48:37 -07:00
Chris Robinson 358d402cd0 Move Convert_IMA4 into the template declarations 2011-03-21 09:42:03 -07:00
Chris Robinson d11593eb5c Use nested loops when converting data 2011-03-19 12:40:14 -07:00
Chris Robinson 4bdedc7fde Use more appropriate enum values 2011-03-18 07:28:06 -07:00
Chris Robinson 9be625d6e8 Add some new format names 2011-03-17 08:42:25 -07:00
Chris Robinson 898b245bb2 Make LoadData return an error if the dst format is not valid or compatible 2011-03-16 19:39:31 -07:00
Chris Robinson be37f10fed Add alIsBufferFormatSupportedSOFT 2011-03-16 13:57:00 -07:00
Chris Robinson a87f651b4d Combine ConvertInput* and ConvertOutput* helpers
The UserFmt* enum types are a complete set of all recognized channel configs and
sample types, so casting Fmt* enum types to them is valid.
2011-03-16 13:32:57 -07:00
Chris Robinson 575195a283 Add alGetBufferSamplesSOFT 2011-03-16 12:56:39 -07:00
Chris Robinson 5621ee4239 Buffers made with alBufferSamplesSOFT always reference the internal format
This is not necessarily the same as the format of the originating data
2011-03-16 12:24:53 -07:00
Chris Robinson f5c4e67aef Add alBufferSubSamplesSOFT 2011-03-16 12:13:17 -07:00
Chris Robinson 2f7de9d696 Add alBufferSamplesSOFT, as an initial start to AL_SOFT_buffer_samples 2011-03-16 11:29:22 -07:00
Chris Robinson 9cee723e92 Pass the number of compressed frames to LoadData 2011-03-16 10:00:24 -07:00
Chris Robinson 4a1c0fedca Use the defines for the UserFmt* and Fmt* types 2011-03-16 05:47:07 -07:00
Chris Robinson b510958f9e NoErr should be noErr 2011-03-15 11:52:18 -07:00
Chris Robinson d6c8bb35b4 Add a CoreAudio backend
Code courtesy of Garin Hiebert <garinh@cheesetoast.net>
2011-03-15 04:58:56 -07:00
Chris Robinson 4899674b6c Move ALC_ENUMERATE_ALL_EXT enums to alc.h, to match other systems' headers 2011-03-14 09:04:41 -07:00
Chris Robinson 4eeed5376f Invert the device matrix row/column
It is accessed now as mat[target][source]
2011-03-13 08:46:54 -07:00
Chris Robinson 77ad538e68 Remove more unneeded casts 2011-03-13 07:11:09 -07:00
Chris Robinson b699aca65b Remove unnecessary casts 2011-03-13 06:34:41 -07:00
Chris Robinson ffd19fe961 Rename ConvertData* to ConvertInput* 2011-03-13 00:05:19 -08:00
Chris Robinson 208912ceac Fix DSound floating-point sample assumptions 2011-03-12 22:52:33 -08:00
Chris Robinson 89c253ce41 Recognize ALC_EXT_DEDICATED with openal-info 2011-03-12 21:28:40 -08:00
Chris Robinson b1d4508d90 Use a loop to make sure the requested effect is not disabled 2011-03-12 20:54:49 -08:00
Chris Robinson 8249dc8559 Combine multiple lists into one 2011-03-12 20:37:22 -08:00
Chris Robinson 59fe4f8a36 Don't return enums for disabled effects 2011-03-12 20:27:46 -08:00
Chris Robinson acb493665d Add dedicated to the list of excludefx 2011-03-12 20:15:21 -08:00
Chris Robinson 73123bc313 Add support for ALC_EXT_DEDICATED 2011-03-12 20:11:25 -08:00
Chris Robinson 947aa1342c Add ALC_EXT_DEDICATED to alext.h 2011-03-12 07:19:42 -08:00
Chris Robinson 20c8f9fe31 Add AL_EXT_FOLDBACK to alext.h 2011-03-12 06:35:45 -08:00
Chris Robinson 66ee3bc217 Better protect the device for multi-threading access 2011-03-12 06:23:17 -08:00
Chris Robinson 031a2a1b1e Implement a basic non-real-time loopback device
Currently it behaves just like a normal device except contexts are only
processed during calls to alcRenderSamples. Additionally, the ALC_SYNC and
ALC_REFRESH context attributes are not valid for these devices, and there are
two new context attributes to specify the rendering format: ALC_FORMAT_TYPE
and ALC_FORMAT_CHANNELS. These each take one of the type and channel enums
added.
This stuff is subject to change.
2011-03-11 00:13:44 -08:00
Chris Robinson 9c87b73ad5 Fix a compiler warning about checking differing enum types
One of the enum types is actually a subset of the other, and share the same
integer values for compatible enumation values
2011-03-10 01:27:42 -08:00
Chris Robinson 97139a530f Filter NaN sample values when converting floats and doubles 2011-03-04 16:18:03 -08:00
Chris Robinson b483b1e380 Release 1.13 2011-02-15 12:10:44 -08:00
Chris Robinson d9126eeb2c Finalize the loop points extension as AL_SOFT_loop_points 2011-02-09 22:54:12 -08:00
Chris Robinson d8048e136f BufferFreq doesn't need to be a float 2011-02-09 11:19:33 -08:00
Chris Robinson fd64fea279 Use the correct winmm device ID type 2011-02-08 10:33:18 -08:00
Chris Robinson 667fd24c84 Add an option to force usage of static MSVC runtimes 2011-02-08 00:34:25 -08:00
Chris Robinson 9ffb38d6be Prevent unused variable warnings when monotonic clock isn't available 2011-02-08 00:22:22 -08:00
Chris Robinson 13397feccf Don't inline CalcLimitedHfRatio 2011-02-07 23:58:40 -08:00
Chris Robinson 57b05fb6d4 Add a missing enum value for PA_API_VERSION 11 2011-02-07 23:53:07 -08:00
Chris Robinson 41a2c25b5a Include cguid.h for GUID_NULL 2011-02-07 22:46:54 -08:00
Chris Robinson b214249290 Check for internal visibility, since that's what is used 2011-02-07 13:55:48 -08:00
Chris Robinson 8dad1c382b Add the standard "revision" number to the library name 2011-02-06 02:39:22 -08:00
Chris Robinson 6713a47d38 Fix looping on loop points 2011-02-06 01:07:37 -08:00
Chris Robinson 02e0223fe8 Re-enable channel-config-specific layout options 2011-01-23 23:57:39 -08:00
Chris Robinson 6c4add67e1 Don't duplicate the device list append function 2011-01-23 23:16:55 -08:00
Chris Robinson 2b7324c06e Avoid using a variable for array sizes and const variable initialization 2011-01-23 22:30:18 -08:00
Chris Robinson c95bd6cadf Fix loop handling when traversing the buffer queue backwards 2011-01-23 15:04:42 -08:00
Chris Robinson d73694d3e6 More improvements to the AudioIO backend 2010-12-09 23:53:32 -08:00
Chris Robinson 5d607f9484 Better check format type returned by AUDIO_SETINFO 2010-12-09 23:47:11 -08:00
Chris Robinson 816c38e9e4 Add signed 8-bit output to the AudioIO backend 2010-12-09 23:43:29 -08:00
Chris Robinson 09130e5dcd Fix some AudioIO backend warnings 2010-12-09 23:41:54 -08:00
Chris Robinson b87447787a Cleanup some ok() macros 2010-12-09 23:32:47 -08:00
Chris Robinson 5a548f8366 Another fix for float-to-int conversions 2010-12-09 22:47:06 -08:00
Chris Robinson 023658605e Constify some variables 2010-12-09 19:47:08 -08:00
Chris Robinson 031111014b Be consistent with variable name use 2010-12-09 18:09:47 -08:00
Chris Robinson b5b9303e66 Fix up some conversions 2010-12-09 17:37:57 -08:00
Chris Robinson 3deaa2fad3 Combine stereo and multi-channel templates 2010-12-09 17:14:12 -08:00
Chris Robinson c3cd4c80b2 Use a matrix when rendering to the dry buffer 2010-12-09 16:37:23 -08:00
Chris Robinson be3f3c4bf0 Make better use of the type range when converting from float 2010-12-09 05:06:29 -08:00
Chris Robinson d1ca8b4470 Use simple loops instead of several explicit lines for the mono mixer 2010-12-09 05:05:42 -08:00
Chris Robinson 72e3386c6a Be a bit more generic with the multi-channel mixer loops 2010-12-09 04:41:52 -08:00
Chris Robinson 4010a6b745 Remove some now-unused functions 2010-12-08 02:56:24 -08:00
Chris Robinson 0218957eb5 Use "internal" visibility by default
All functions callable by apps, directly or indirectly (eg, through function
pointers), are marked as "protected", and internal visibility can provide
benefits over hidden when we know functions won't be called by other modules.
2010-12-08 02:32:09 -08:00
Chris Robinson cd65ab7dfa Add an IMA4 encoder 2010-12-05 03:34:19 -08:00
Chris Robinson c4adf541c1 Set the playing flag to TRUE when the dsound buffer starts playing 2010-12-04 20:22:12 -08:00
Chris Robinson 88e3a22772 Separate device format into 'channel config' and 'sample type' components 2010-12-04 19:50:00 -08:00
Chris Robinson 191803ad53 Fix wave and null device calculations when the timer wraps 2010-12-03 23:48:59 -08:00
Chris Robinson 1b7be672fa No need to clamp the app-specified pitch 2010-12-03 23:08:26 -08:00
Chris Robinson 9581325b9c Rename SrcFmt -> UserFmt 2010-12-03 22:33:41 -08:00
Chris Robinson 59990acc2a Add functions to write (signed) byte and ushort samples to devices 2010-12-02 16:36:37 -08:00
Chris Robinson 0bf7716332 Remove incomplete EXT_buffer_sub_data, as it's (temporarily) superceded by SOFT_buffer_sub_data
The EXT version can come back when other implementations take an interest
2010-12-02 01:46:43 -08:00
Chris Robinson 3339e5dc6a Use memcpy to copy a string instead of sprintf 2010-12-02 01:12:49 -08:00
Chris Robinson 30b3f68ddf Make a function static 2010-12-02 01:05:29 -08:00
Chris Robinson 75552f2765 Remove unused macro 2010-12-01 23:21:18 -08:00
Chris Robinson 4a0bf9fd44 Template-ize the device buffer writing functions 2010-12-01 21:50:49 -08:00
Chris Robinson fa28098a83 Some general cleanups 2010-12-01 20:34:29 -08:00
Chris Robinson 646409cbdf Don't limit IMA4 decoding to 2 channels 2010-12-01 18:36:07 -08:00
Chris Robinson 9e8fb89a52 Rename OUTPUTCHANNELS to something more descriptive 2010-12-01 18:33:17 -08:00
Chris Robinson 14441e0e53 Rename some variables 2010-12-01 14:19:57 -08:00
Chris Robinson 7f5814c4d8 Use min/max to clamp the IMA4 sample and index values 2010-12-01 14:07:21 -08:00
Chris Robinson e3afc3587e Fix handling of -32768 in the muLaw encoder 2010-12-01 02:24:39 -08:00
Chris Robinson 8a52c44d15 Don'f fail if realloc returns NULL for 0 sizes 2010-12-01 02:00:41 -08:00
Chris Robinson e6e18732b5 Make sure the muLaw sample encoder is inlined 2010-11-30 18:06:54 -08:00
Chris Robinson 3f8ae8f1ce Fix IMA4 decoding 2010-11-30 16:54:30 -08:00
Chris Robinson a79129835c Fix some comments and line spacing 2010-11-30 13:04:48 -08:00
Chris Robinson 6fcaecdc9f Fix int-to-double conversion 2010-11-30 12:26:37 -08:00
Chris Robinson 8dc8090888 Make muLaw decoding work similar to encoding 2010-11-30 01:26:43 -08:00
Chris Robinson 4db2f1ec7d Implement a muLaw encoder 2010-11-30 01:20:40 -08:00
Chris Robinson 06fa030260 Rename the IMA4 block decoder function 2010-11-30 01:00:37 -08:00
Chris Robinson 018f9fc278 Handle all channel configurations for double 2010-11-30 00:32:13 -08:00
Chris Robinson c0f6d46cd8 Allow LoadData to handle IMA4 data 2010-11-30 00:28:02 -08:00
Chris Robinson 8e43b1fe04 Let the storable format enum values share the input format enum values where they overlap 2010-11-29 23:57:07 -08:00
Chris Robinson 04df919a1c Clean up muLaw format loading a bit 2010-11-29 23:46:49 -08:00
Chris Robinson f82e628f08 Allow converting IMA4 to types other than short 2010-11-29 22:55:46 -08:00
Chris Robinson 07a7c03adb Check for a couple missing input formats and remove an unneeded default case 2010-11-29 22:07:07 -08:00
Chris Robinson e800f8c0a7 Let DecomposeInputType verify the format passed to alBufferSubDataSOFT 2010-11-29 22:01:54 -08:00
Chris Robinson d02dbef9d2 Pass the input channel config and sample type to LoadData 2010-11-29 21:55:47 -08:00
Chris Robinson 55262bc6e9 Make the decompose functions return false when given an unhandled format 2010-11-29 20:34:33 -08:00
Chris Robinson 51ed22afb9 Combine two switch blocks 2010-11-29 20:17:15 -08:00
Chris Robinson 0cf32e2946 Reorder some parameters for consistency 2010-11-29 19:48:18 -08:00
Chris Robinson 693ab4d8bc Fix source offset calculations 2010-11-29 19:36:33 -08:00
Chris Robinson e4869b447c Store the decomposed source format in the buffer 2010-11-29 19:27:33 -08:00
Chris Robinson 547f356131 Keep a handle on the buffer with the format when queueing new buffers 2010-11-29 17:35:22 -08:00
Chris Robinson 017ab1b3fd Add IMA4 as a source data type 2010-11-29 17:14:22 -08:00
Chris Robinson 07ef566de1 Add support for (unsigned) int input formats 2010-11-29 17:00:22 -08:00
Chris Robinson 3c8a29a179 Reorder and rename parameters for the format decomposition functions 2010-11-29 15:19:39 -08:00
Chris Robinson f74032d244 Uninline a couple more functions 2010-11-29 15:01:27 -08:00
Chris Robinson eb489ac886 Store double formats as float
The mixer will cut it down to float anyway, so it's unnecessary and needlessly
creates more mixer functions
2010-11-28 23:07:57 -08:00
Chris Robinson 986628b8b2 Avoid temp storage 2010-11-28 22:50:27 -08:00
Chris Robinson da4f5c6f96 Uninline some functions
Also add -Winline to the compiler command line to watch for future inline problems
2010-11-28 19:52:17 -08:00
Chris Robinson f09ae196a8 Avoid making Resampler[Pre]Padding static 2010-11-28 17:37:14 -08:00
Chris Robinson 3e702ae2bc Improve static builds with MinGW 2010-11-28 16:19:11 -08:00
Chris Robinson 490d1c6a8e Prefer GCC's constructor, even in Windows 2010-11-28 14:27:07 -08:00
Chris Robinson 0e748d98d5 Rename some stuff for consistency 2010-11-28 13:08:51 -08:00
Chris Robinson c41e893361 Don't store the internal format in the buffer
The type and channel config are good enough
2010-11-28 12:53:35 -08:00
Chris Robinson 2fd8d6916b Support rear formats directly in the mixer 2010-11-27 22:55:20 -08:00
Chris Robinson b4eaf1ab5a Avoid a potential overflow when setting the source offset 2010-11-27 22:22:14 -08:00
Chris Robinson 3c8e9a7f24 Clean up the source byte offset code 2010-11-27 22:13:29 -08:00
Chris Robinson 67ec72284d Remove some unneeded muLaw special cases 2010-11-27 22:06:51 -08:00
Chris Robinson 754a122aa0 Support muLaw with LoadData 2010-11-27 22:00:24 -08:00
Chris Robinson 0486d633c6 Remove an unnecessary assert 2010-11-27 20:41:09 -08:00
Chris Robinson 09b063002b Be much more flexible with loading and converting buffer data 2010-11-27 20:33:37 -08:00
Chris Robinson 8828f4d0e5 Don't inline the decompose function 2010-11-27 15:37:51 -08:00
Chris Robinson 9495cf71fd Decompose input buffer formats and use it when converting uncompressed data 2010-11-27 15:33:33 -08:00
Chris Robinson 4d0f70439c Rename a function 2010-11-27 14:30:13 -08:00
Chris Robinson d3bb5d4fcb Add a basic WaveOut device
It can still use more work, but it seems to work
2010-11-27 14:13:40 -08:00
Chris Robinson 61315d4dfb Shorten a couple really long lines 2010-11-27 00:51:21 -08:00
Chris Robinson 2a123a4760 Support 64-bit double buffers directly 2010-11-27 00:32:53 -08:00
Chris Robinson 4689ffb72d muLaw converts to 16-bit, not float 2010-11-27 00:17:19 -08:00
Chris Robinson d2895c7985 Use the enums in a couple more places 2010-11-27 00:15:07 -08:00
Chris Robinson 6abb9d151e Use enums when selecting the mixer 2010-11-26 23:42:30 -08:00
Chris Robinson 08827efae3 Remove an unnecessary 'struct' keyword 2010-11-26 20:35:47 -08:00
Chris Robinson 16c05d2c05 Avoid some more code duplication 2010-11-26 20:22:14 -08:00
Chris Robinson 4d4d699780 Fix step calculations 2010-11-26 20:17:05 -08:00
Chris Robinson ca1ec4b221 Fix some comments 2010-11-26 18:01:29 -08:00
Chris Robinson facb922f3e Properly clamp high pitch values 2010-11-26 17:47:43 -08:00
Chris Robinson d7987677ac Subtract the fractional position separately 2010-11-26 15:51:13 -08:00
Chris Robinson 5fbbfa482f Rename some variables to be clearer 2010-11-26 12:59:45 -08:00
Chris Robinson 7287b5cd3c Make the buffer padding size dependent on the resampler 2010-11-26 02:53:15 -08:00
Chris Robinson 0692cf304d Don't allocate padding with the buffer itself 2010-11-26 02:31:17 -08:00
Chris Robinson 88ebe7e4c1 Decrease the buffer size more 2010-11-26 02:14:11 -08:00
Chris Robinson d647ed60e8 Convert a few divisions to multiplications 2010-11-26 01:35:40 -08:00
Chris Robinson 1cb29ece08 Make a FRACTIONONE macro, and use it 2010-11-26 01:21:46 -08:00
Chris Robinson de8b7fbc5f Share the interpolation functions and use them in the reverb effect 2010-11-26 01:07:54 -08:00
Chris Robinson 98d78f7ff9 Slightly improve channel gain calculations 2010-11-26 00:24:54 -08:00
Chris Robinson 3d1eb7dcad Add a missing break statement 2010-11-25 23:13:50 -08:00
Chris Robinson e1c0b5ea24 Call MixSource directly, instead of through a function pointer 2010-11-25 23:09:18 -08:00
Chris Robinson 30820c1bde Add a cubic resampler 2010-11-25 23:05:44 -08:00
Chris Robinson 46b9802902 Force the point resampler when the source plays at normal speed 2010-11-25 22:15:38 -08:00
Chris Robinson b6fb28de1a Pass a pointer to the samplers so they can read just the samples they need 2010-11-25 22:04:17 -08:00
Chris Robinson 17fc4ba5e3 Add "pre-padding" to the temp buffer
This will help to implement resamplers that want previous samples
2010-11-25 21:42:15 -08:00
Chris Robinson 596514f7aa Make the buffer queue a double-linked list 2010-11-25 18:30:57 -08:00
Chris Robinson 6e3a6f90e9 Be less wave-in-specific in the winmm backend 2010-11-25 17:37:34 -08:00
Chris Robinson fbd6439bd2 Make the first enumerated DirectSound device use the default, and fix the name 2010-11-25 14:35:32 -08:00
Chris Robinson f72c735f9e Make sure the target buffer size is frame aligned 2010-11-25 14:23:03 -08:00
Chris Robinson 9b23fc5db8 Minor rework of the template macros 2010-11-25 14:07:52 -08:00
Chris Robinson aaff188b3b Remove the cosine resampler
It's too slow when auxiliary sends are being used.
2010-11-25 13:49:51 -08:00
Chris Robinson 2595d85cca Double-up the interpolation functions (and make them use doubles) 2010-11-25 13:45:35 -08:00
Chris Robinson 2c96c29938 Rename some "template" functions 2010-11-25 13:22:54 -08:00
Chris Robinson 65919b7037 Always make sure there's a sample available to mix, for pending click removal 2010-11-25 13:17:51 -08:00
Chris Robinson f1bb7c33f1 Fix a bunch of comments 2010-11-25 12:07:12 -08:00
Chris Robinson 8e7a4046d0 Don't "convert" LOKI quad to MCFORMATS quad 2010-11-25 11:49:35 -08:00
Chris Robinson f4e0c6a348 Use a temporary stack buffer to store the source buffer data to be mixed
This makes it much easier to pack the playable buffer data so that it's a
continuous data stream. This could normally be broken up otherwise, such as
when using loop points or small queued buffers.
Currently it defaults to a 16KB stack buffer, but this can be overridden at
compile time.
2010-11-25 11:16:19 -08:00
Chris Robinson 885a5e9f90 Use 0-based access for the buffer data 2010-11-24 20:44:21 -08:00
Chris Robinson 22e3e9a18b Support 8-bit sample data in the mixer 2010-11-24 19:41:25 -08:00
Chris Robinson 445cde2dd4 Check the sample byte size after the resampler 2010-11-24 17:23:09 -08:00
Chris Robinson 3dd58cf765 Get rid of a useless union 2010-11-24 17:10:41 -08:00
Chris Robinson cd87061749 Change the mixer macros to declare functions 2010-11-24 17:07:50 -08:00
Chris Robinson 1311e051d9 Set mixer sample pos and frac when needed 2010-11-24 14:54:46 -08:00
Chris Robinson c9363832fe Fully progress the source to a stopped state when no buffers are playable 2010-11-24 10:16:53 -08:00
Chris Robinson 6ab22e7cbb Reorder some stored source params 2010-11-24 10:01:50 -08:00
Chris Robinson bb13f7f234 Make sure the buffer padding is always cleared before looking for the next buffer 2010-11-24 07:20:41 -08:00
Chris Robinson 13ba253aec Calculate ALSA buffer length with the other values 2010-11-23 07:24:27 -08:00
Chris Robinson c58469e234 Handle the timer wrapping in the wave and null output devices 2010-11-21 11:34:16 -08:00
Chris Robinson 57a03bc2b5 Use helpers to write 16- and 32-bit values 2010-11-21 06:54:41 -08:00
Chris Robinson a7b4e0b5c5 Get rid of the device timer stuff 2010-11-21 06:32:59 -08:00
Chris Robinson bbb45e326c Avoid temporary float variables 2010-11-21 03:58:37 -08:00
Chris Robinson dfe3e402a8 Pass the data pointer and proper sampler to the mixer macro 2010-11-21 03:33:33 -08:00
Chris Robinson e884da50ea Move aluMixData back to ALu.c 2010-11-21 02:51:18 -08:00
Chris Robinson 4c576631ad Hide AL_EXTX_sample_buffer_object
It hasn't been going anywhere, and it's current use is dubious. Leave the code
in for now, but it may be removed later.
2010-11-21 02:36:34 -08:00
Chris Robinson 5f6f046d25 Use a double when converting millisecond offsets to byte offsets 2010-11-07 21:41:04 -08:00
Chris Robinson 65e033c64b Increase the max number of source sends to 4, and decrease the default to 1 2010-11-06 15:08:54 -07:00
Chris Robinson 07346da740 Use the number of sends the device is configured for in more places 2010-11-06 14:27:33 -07:00
Chris Robinson c95f182a90 Remove unnecessary comments and reorder some lines 2010-11-06 14:07:30 -07:00
Chris Robinson 289c74788e Use a switch to select the appropriate channel-count mixer 2010-11-06 12:21:46 -07:00
Chris Robinson 65a8d9278d Declare a variable where it's used 2010-11-01 12:44:56 -07:00
Chris Robinson 887c830d56 Remove explicit use of -funroll-loops
I'm not sure this really helps much.
2010-10-15 15:21:23 -07:00
Chris Robinson 6db4e08efb Fix fpu state handling with _controlfp 2010-10-15 10:35:47 -07:00
Chris Robinson 4f81bce800 Improve a macro to reference its parameter 2010-10-11 12:24:28 -07:00
Chris Robinson 932fcfa8bf Fix 64-bit compilation 2010-10-11 12:24:07 -07:00
Chris Robinson 314832e35a Rename a couple more variables 2010-10-10 04:00:50 -07:00
Chris Robinson 6a9dd185e6 Improve naming and placement of a couple variables 2010-10-10 03:47:57 -07:00
Chris Robinson 2172827f43 Simplify a calculation 2010-10-09 15:24:24 -07:00
Chris Robinson 90e9cd970a Check resampler mode first when selecting the mixer 2010-09-26 13:53:02 -07:00
Chris Robinson 845ca95888 Get a variable where it's needed 2010-09-26 13:30:46 -07:00
Chris Robinson 92d8d2f8a4 Pass the device to the mix function and localize the dry mix and click buffers 2010-09-26 12:23:22 -07:00
Chris Robinson 7cd52b2857 Clarify a check 2010-09-26 01:29:28 -07:00
Chris Robinson 9fbd6c6c3f Make the SourceMix function a method of the ALsource struct 2010-09-26 01:15:27 -07:00
Chris Robinson 08fdc5fa98 Avoid updating the source in MixSource 2010-09-25 23:49:57 -07:00
Chris Robinson 7e362249ff Convert shorts so that 0 remains 0 2010-09-25 21:13:40 -07:00
Chris Robinson 9fa2db0227 Don't try to open the ALSA device a second time if the first fails 2010-09-25 20:20:10 -07:00
Chris Robinson 4c75a72a90 Avoid some code duplication 2010-09-25 20:18:07 -07:00
Chris Robinson a0b2778161 Localize more variables and remove unnecessary ones 2010-09-25 14:19:36 -07:00
Chris Robinson bc6d94cd25 Avoid sampling beyond the end of the loop 2010-09-24 23:32:50 -07:00
Chris Robinson e70141e57b Localize some variables to the mixer macros
The hope here is to help break the mixer loops into separate functions, so the
macro expansion doesn't cause the MixSource function to explode in size and
kill compilation speed.
2010-09-24 23:24:01 -07:00
Chris Robinson 2e70b82eaa Use separate mixing loops for the dry path and wet paths
This will increase CPU use a bit for sources that use auxiliary sends
(particularly with the cosine resampler), but it makes it more scalable when
adding more sends per source. Additionally, it will improve performance of
sources that don't use auxiliary sends.

The cosine resampler can probably be improved by using a lookup table instead
of calling cos() as there are 14 bits of fractional precision, so a 16384-
element float array would cover it all. This can also be reduced to a half or
quarter size if the precision loss is found to be acceptable.
2010-09-24 18:29:49 -07:00
Chris Robinson 117ed52091 Better protect against negative attenuation 2010-09-24 13:16:09 -07:00
Chris Robinson e9d5e53dbe Use ALfloat for the dry mix buffer 2010-09-23 17:44:02 -07:00
Chris Robinson e308694521 Remove an unnecessary variable 2010-09-23 16:51:30 -07:00
Chris Robinson 7e498012ff Rename some variables to be less confusing 2010-09-23 16:49:33 -07:00
Chris Robinson f98bf32be8 Fix line indentation 2010-09-23 15:08:30 -07:00
Chris Robinson 0f2ed8c84d Be consistent with a variable's use 2010-09-23 13:49:21 -07:00
Chris Robinson 8d67cdfaab Convert float to short similar to short to float 2010-09-23 08:43:39 -07:00
Chris Robinson 67ba924ed3 Store and mix signed 16-bit samples 2010-09-22 23:38:06 -07:00
Chris Robinson 764cfb6a0d Allow the mixing loop to access the different sample formats 2010-09-22 20:53:04 -07:00
Chris Robinson 4e3c945093 Compact some reused code 2010-09-22 18:49:46 -07:00
Chris Robinson 8558bc1d41 Allow accessing the buffer data as multiple data types in the mixer
Also reduces a bunch of indentation
2010-09-22 17:19:35 -07:00
Chris Robinson 03f56419d0 Duplicate stereo sources by default
The mixer is smart enough now to handle proper volume adjustments depending on
the number of output speakers
2010-09-22 11:09:34 -07:00
Chris Robinson 3ee9d24c3f Use separate macros for the different mixing loops 2010-09-22 09:38:24 -07:00
Chris Robinson 9b1ad6c873 Consolidate some code 2010-09-21 19:49:47 -07:00
Chris Robinson 97daaade8a Reduce some more indentation 2010-09-21 16:54:33 -07:00
Chris Robinson 8a1d5a21c3 Reduce some indentation 2010-09-21 15:12:08 -07:00
Chris Robinson 301a8ba3a4 Improve some range checks 2010-09-21 14:41:43 -07:00
Chris Robinson 2d4453968d Implement AL_SOFT_buffer_sub_data using the current AL_EXT_buffer_sub_data spec
This extension can be useful for some applications, but a full EXT version may
not be ready for some time. Using the SOFT moniker will help differentiate it
in case changes need to be done for the EXT version.
2010-09-21 09:43:35 -07:00
Chris Robinson a2580a85a8 Improve range checking for BufferSubData 2010-09-19 14:00:55 -07:00
Chris Robinson 8a0e15ff37 Store air absorption factor locally 2010-09-12 00:10:33 -07:00
Chris Robinson 8953a73fb1 Prevent effectiveDist from going negative 2010-09-11 23:57:15 -07:00
Chris Robinson 1a2883ae9a Pass dry-path click buffers as parameters to MixSource 2010-09-11 23:43:12 -07:00
Chris Robinson a2358ffc41 Source positions at and after the end of the buffer queue go back to 0 2010-09-09 18:27:14 -07:00
Chris Robinson 33eb2786f8 Avoid another non-descript incrementing variable 2010-09-09 16:47:54 -07:00
Chris Robinson c8ec4fd505 Avoid using a single-letter iterator value 2010-09-09 14:53:14 -07:00
Chris Robinson fe98ab5398 Combine multiple checks into one 2010-09-08 17:29:16 -07:00
Chris Robinson 76be7eb1e7 Better protect against sample overflow when converting float to short 2010-09-08 16:26:19 -07:00
Chris Robinson 6e32812bc1 Remove unnecessary check 2010-09-07 22:38:29 -07:00
Chris Robinson 50a7be6385 Fix comparison check 2010-09-07 22:23:37 -07:00
Chris Robinson 3763c95784 Add missing else 2010-09-07 16:36:42 -07:00
Chris Robinson 5fa5252648 Watch for a few more negative sizes 2010-09-07 16:33:17 -07:00
Chris Robinson 1e82561a22 Check for invalid negative sizes 2010-09-07 16:18:24 -07:00
Chris Robinson ba32a52bb6 Remove unused struct member 2010-09-07 16:07:35 -07:00
Chris Robinson 6027fda0ce Combine two arrays into one 2010-08-16 16:07:44 -07:00
Chris Robinson e5cae87502 Handle clicks by watching changes between updates 2010-08-16 14:53:21 -07:00
Chris Robinson ba0ec1b4ba Use the correct value to dereference an array 2010-08-16 11:42:18 -07:00
Chris Robinson 2acd6f52f1 Add a bit more information to the README 2010-08-15 16:55:11 -07:00
Chris Robinson b520228bc6 Consolidate some click removal calculations 2010-08-15 15:55:02 -07:00
Chris Robinson 343a8241ab Use a multiplier instead of if checks 2010-08-15 15:09:38 -07:00
Chris Robinson 00525274a0 Add click removal for wet sends 2010-08-15 14:52:12 -07:00
Chris Robinson 2915d9dbd9 Use click removal to handle harsh panning/volume changes 2010-08-15 00:19:38 -07:00
Chris Robinson 0c49e5ba56 Use click removal when starting a source 2010-08-14 22:59:55 -07:00
Chris Robinson b65bc45236 Add a corrective, click-remval sample value offset
This will hopefully be more effective and rebust at removing clicks and pops,
particularly from starts and stops in the middle of a sound. Based on an idea
by Ben Davis.
2010-08-14 21:30:14 -07:00
Chris Robinson 94b7e5a227 Rename Null Output to No Output 2010-08-13 22:06:38 -07:00
Chris Robinson 928572d384 Start the device when creating a context without specified attributes 2010-08-12 17:24:55 -07:00
Chris Robinson 2d1988bb6f Output on available channels only, for the echo and modulator effects 2010-08-09 06:12:00 -07:00
Chris Robinson e007dc3614 Fix early/late reverb panning, and only output reverb on available channels 2010-08-09 05:11:58 -07:00
Chris Robinson 2ed929eadc Update device parameters using a separate function 2010-08-09 00:28:48 -07:00
Chris Robinson f1924fa7ea Decrement context count when it's removed from the list 2010-08-08 02:48:28 -07:00
Chris Robinson df822513fa Don't re-init and re-allocate some stuff when the device is left running 2010-08-07 09:13:51 -07:00
Chris Robinson 762bdaeee1 Panning init cleanup 2010-08-07 08:49:29 -07:00
Chris Robinson 8003278a55 Combine non-attenuated source calculation functions 2010-08-07 06:57:31 -07:00
Chris Robinson 5f22d30fc9 Calculate the source stepping value with the param calculations 2010-08-07 05:43:16 -07:00
Chris Robinson d6dc855511 Set up increment once 2010-08-07 02:32:16 -07:00
Chris Robinson 8f49f2c25e Forward some more source properties instead of duplicating 2010-08-07 01:35:43 -07:00
Chris Robinson f4304ca062 Calculate the actual stepping value in the source update method 2010-08-07 00:38:02 -07:00
Chris Robinson 044662e4b7 Calculate gain steps once during a source mix 2010-08-06 07:55:00 -07:00
Chris Robinson d9d8319c22 Effectslot's Effectstate should never be NULL 2010-08-06 04:52:34 -07:00
Chris Robinson 56b094767b Remove an unnecessary check
The number of buffers played should never exceed the buffer count when playing,
and the buffer list is used later on regardless
2010-08-06 01:14:37 -07:00
Chris Robinson 98bc60cfb7 Combine stereo and stereo-duplicate mixers
Use a separate update method for stereo sources to the set appropriate channel
gains
2010-08-05 01:07:20 -07:00
Chris Robinson 2aacca76de Improve a warning message 2010-08-04 06:18:23 -07:00
Chris Robinson aea615edb3 Prevent re-probing while opening a Pulse device if no devices were found 2010-08-04 05:07:56 -07:00
Chris Robinson f6b2dfd09f Only except a NULL device name for Pulse if some devices were found 2010-08-04 04:56:07 -07:00
Chris Robinson 7f9bcfbc7d Do not enumerate PulseAudio devices if a context fails to connect 2010-08-04 04:21:39 -07:00
Chris Robinson 22cc5af1fe pa_context_errno can return a positive value 2010-08-04 04:11:38 -07:00
Chris Robinson 0dc3f1984e Move the core mixer functions to a separate source file 2010-08-03 23:19:36 -07:00
Chris Robinson e74976e645 Use a callback to specify the source update method 2010-08-03 23:10:00 -07:00
Chris Robinson 91278608c5 Add some spacing 2010-08-03 01:44:52 -07:00
Chris Robinson 8e2d765671 Move active source iteration to aluMixData 2010-08-03 01:09:02 -07:00
Chris Robinson 2af39e51f8 Separate speaker/panning initialization into another source file 2010-08-03 00:21:36 -07:00
Chris Robinson 1504cf8812 Use millisecond resolution for the Null and Wave Writer backends 2010-08-02 22:34:19 -07:00
Chris Robinson 3bece35bbd Prevent getting bad time values when pa_stream_get_time fails
Also makes sure that reported time won't go backwards
2010-08-02 22:27:32 -07:00
Chris Robinson ae41ad5d1e Use a better method to time the Null and Wave Writer backends
This better compensates for precision loss when converting milliseconds to the
sample rate
2010-08-02 20:04:52 -07:00
Chris Robinson ee61f7a55c Make sure to request a tlength that's at least minreq*2
And warn if Pulse returns a minreq that's too large
2010-08-02 17:24:40 -07:00
Chris Robinson 241ddf76d4 Enforce the device time to be a multiple of the reported resolution 2010-08-01 16:31:00 -07:00
Chris Robinson fe6e73ede9 Be a bit more verbose when a device fails to open 2010-08-01 16:20:28 -07:00
Chris Robinson 8dab4c418c Use Pulse's stream time for the device time 2010-07-31 21:33:46 -07:00
Chris Robinson 41e2c41ecc Combine duplicate lines into the mixing macro 2010-07-31 21:09:59 -07:00
Chris Robinson 30108c7855 Remove an unnecessary variable 2010-07-31 19:14:27 -07:00
Chris Robinson 40ba9db406 Only call Pulse functions from under a lock 2010-07-31 16:07:04 -07:00
Chris Robinson f1f2941511 Add experimental device attributes for apps to query
These will be part of the ALC_EXT_device_time extension. Behavior, values,
etc, are all subject to change.
2010-07-30 20:23:55 -07:00
Chris Robinson d886fb118b Signal the Pulse mainloop on underruns
Otherwise there are (rare) risks of not getting signaled after writing the
amount of free audio data the client knows about, leading to a mixer loop
lockup
2010-07-30 20:20:40 -07:00
Chris Robinson 46d46c49a8 Store the time precision with the device 2010-07-25 12:54:50 -07:00
Chris Robinson 40dd1fb853 Add a backend callback to get the device time
The method should monotonically count the number of nanoseconds the device has
active contexts
2010-07-24 19:14:32 -07:00
Chris Robinson ab77fc14d5 Make killNow volatile 2010-07-24 10:54:12 -07:00
Chris Robinson e0d0edc0fc Close the log file last during shutdown 2010-07-22 09:16:28 -07:00
Chris Robinson 7eb124d99c Keep count of the number of samples played 2010-07-22 08:11:44 -07:00
Chris Robinson 88f236ccd3 Make sure the device is stopped if there was an error setting up the first context 2010-07-21 14:50:39 -07:00
Chris Robinson 34a0c998cd Use CLOCK_MONOTONIC when available 2010-07-18 06:21:16 -07:00
Chris Robinson e658df493a Update PulseAudio using period-sized chunks
To match the behavior of other backends
2010-07-17 23:30:25 -07:00
Chris Robinson b2a257b6b0 Rename examples to utilities
There is only the one, and it more accurately reflects what it is
2010-07-17 01:02:51 -07:00
Chris Robinson cde577690a Set the backend HAVE_ macros off before checking their availability 2010-07-17 00:37:54 -07:00
Chris Robinson c85d53cfbe Remove the commit count from the version number
As it's only updated for releases, it's kinda useless
2010-07-16 00:18:21 -07:00
Chris Robinson 26127cd2f2 Use a long single buffer for WaveIn's capture buffers 2010-07-12 16:37:44 -07:00
Chris Robinson 42d9140afe Check the buffer's original format when queueing on a source 2010-07-12 15:53:11 -07:00
Chris Robinson 52ad28df92 Fix WaveIn device cleanup order 2010-07-08 17:37:35 -07:00
Chris Robinson 58ba5fd0dd Add missing static keyword to WinMM vars 2010-07-08 15:10:59 -07:00
Chris Robinson 71cc91cc4a Use the existing ring buffer methods for WaveIn 2010-07-07 02:47:29 -07:00
Chris Robinson 6db3463d17 Fix backslash alignment for the single-channel mixer macro 2010-07-06 16:32:58 -07:00
Chris Robinson 969818db6f Use a 100ms capture buffer minimum for PulseAudio, with 50ms fragments
This better matches what is given with the WaveIn backend
2010-07-04 16:27:42 -07:00
Chris Robinson d4b191d27d Avoid retrying the requested ALSA format after it failed 2010-07-04 15:48:47 -07:00
Chris Robinson 6b23f2dfa3 snd_pcm_recover should automatically re-prepare the stream as needed 2010-06-16 02:17:41 -07:00
Chris Robinson 17e6840f92 Prevent multiple WinMM devices from getting the same name, as well 2010-06-10 15:54:04 -07:00
Chris Robinson a1f987c016 Improve handling of lost DirectSound buffers 2010-06-09 23:32:35 -07:00
Chris Robinson cff805e0a3 Prevent multiple DirectSound devices from getting the same name, too 2010-06-09 23:11:34 -07:00
Chris Robinson 25a941666a Prevent multiple PulseAudio devices from getting the same name 2010-06-09 18:22:05 -07:00
Chris Robinson 8c59849ea4 Make sure the log file is set before initializing the rest of the lib 2010-06-08 02:02:48 -07:00
Chris Robinson f9e569099c Make the Wave Writer backend optional 2010-06-08 02:01:11 -07:00
Chris Robinson 6fd6e4eacf Remove unused variable 2010-06-07 03:49:21 -07:00
Chris Robinson ce07270973 Remove support for the old 'refresh' config option 2010-06-06 00:53:29 -07:00
Chris Robinson ac05863f72 Make sure the effectslot map is properly initialized 2010-06-06 00:21:13 -07:00
Chris Robinson 7f6df7695c Use an array of active sources when mixing
Prevents iterating over all allocated sources during mixing updates
2010-06-06 00:17:50 -07:00
Chris Robinson ed58571079 Use non-blocking mode for ALSA capture 2010-06-05 19:56:58 -07:00
Chris Robinson 80fbe8a788 Allow prepending backend names with - to remove them from the available devices 2010-06-05 19:33:06 -07:00
Chris Robinson 0fdec056fa Improve error recovery when capturing from ALSA 2010-06-05 17:41:33 -07:00
Chris Robinson 1915fe831f Read capture data from ALSA when querying the available sample count 2010-06-05 04:43:26 -07:00
Chris Robinson 98c01a40e6 Improve locking when calling the backend capture API 2010-06-05 04:42:05 -07:00
Chris Robinson 33234d605a Don't attempt to look for more samples from Pulse after a disconnect 2010-06-05 00:09:45 -07:00
Chris Robinson c6defe9a6d Read PulseAudio's capture data into the ring buffer when querying the sample count
This ensures we have all the samples available that the app knows about
2010-06-04 00:27:31 -07:00
Chris Robinson 244daba501 Don't overwrite data when the ring buffer overflows 2010-06-04 00:24:23 -07:00
Chris Robinson 43dadcd9e4 Use a UIntMap for the Databuffers 2010-06-03 19:35:08 -07:00
Chris Robinson 90db244b5f Skip mixing after checking looping validity 2010-06-03 03:58:04 -07:00
Chris Robinson e98f1205e5 Increase the temp buffer sizes to construct device names with 2010-05-31 19:04:41 -07:00
Chris Robinson 2205f91e5f Fix Pulse mainloop handling for device probing 2010-05-31 19:02:20 -07:00
Chris Robinson da1dee351d Update device naming to be more apparent about the device being used 2010-05-31 19:00:33 -07:00
Chris Robinson 694e9a5fec Always add the default PulseAudio device when probing 2010-05-30 23:04:04 -07:00
Chris Robinson 9ac5d8ad2d List all available PulseAudio sources 2010-05-30 21:05:05 -07:00
Chris Robinson 706b9f2357 Probe and expose all available PulseAudio sinks for the enumerate_all extension 2010-05-30 20:33:57 -07:00
Chris Robinson 55b3675dee Add a separate function to create/connect a pulseaudio context 2010-05-30 19:05:19 -07:00
Chris Robinson dc86563486 Pass the threaded main loop object to context/stream_state_callback 2010-05-30 18:19:01 -07:00
Chris Robinson ebccfa93c3 Don't unload libs when they're not needed
Some libs don't really like being unloaded and reloaded all the time, and the
benefits aren't that great
2010-05-28 23:00:59 -07:00
Chris Robinson e9f4576d4d Watch for changes to the PulseAudio sink device 2010-05-28 17:03:57 -07:00
Chris Robinson 880902fecc Add a Null Output device
This device will mix and fully process contexts as normal
2010-05-28 16:41:52 -07:00
Chris Robinson 96cf5b7282 Avoid constantly loading and unloading PortAudio
It seems this triggers a bug in the lib, causing a crash. It may not be a bad
idea to remove dynamic unloading/reloading all through-out.
2010-05-28 02:22:17 -07:00
Chris Robinson f89c9f7ea4 Connect a pulse stream on device open, to make sure the device isn't suspended
Also use the opportunity to get the stream's device's name, so later reset
calls will use the same device
2010-05-27 22:12:54 -07:00
Chris Robinson 27a4c871fd Update head dampening after a device reset 2010-05-26 23:36:55 -07:00
Chris Robinson 37190b2caf Add a function to get the frame size from a format 2010-05-24 21:51:30 -07:00
Chris Robinson c6b948323e Better watch for invalid values in alBufferSubDataEXT 2010-05-24 21:33:43 -07:00
Chris Robinson ad2957ed98 Reduce the mixing buffer size 2010-05-24 20:10:35 -07:00
Chris Robinson c469bfcb9e Make error checking consistent in alBuffer.c 2010-05-24 19:52:27 -07:00
Chris Robinson 3d16be1822 Fix alBufferiv error handling 2010-05-24 19:02:36 -07:00
Chris Robinson ad10d4ee74 Increment pointer when read 2010-05-24 17:40:16 -07:00
Chris Robinson 3ba3c1ca31 Pass the number of blocks to ConvertDataIMA4 2010-05-24 17:31:49 -07:00
Chris Robinson 4ad28964de Be careful of integer overflows when allocating buffer storage 2010-05-24 17:08:12 -07:00
Chris Robinson 15ce7fb8f7 Cleanup some variables and names 2010-05-24 03:28:00 -07:00
Chris Robinson 80a22b6484 Reorder some error checks and watch for negative buffer sizes 2010-05-24 03:20:14 -07:00
Chris Robinson 8cfac7c6b8 Don't bother storing the loop points in the source 2010-05-24 01:07:13 -07:00
Chris Robinson 9ac6b4c2c8 Be big endian safe with the IMA4 decoder 2010-05-22 15:37:32 -07:00
Chris Robinson 861a933b7b Use the ALSOFT_LOGFILE env var to specify the output for AL_PRINT 2010-05-21 18:16:27 -07:00
Chris Robinson 58e5404d61 Loop points should be specified in sample offsets 2010-05-21 15:52:35 -07:00
Chris Robinson 3676fdc4db Add mono and stereo channel masks for DSound output 2010-05-21 14:12:09 -07:00
Chris Robinson e7a555a953 Add an empty efx-creative.h header
This is for compatibility with projects that include it in Windows. Everything
from it is already defined in efx.h.
2010-05-21 11:21:35 -07:00
Chris Robinson 1e6ba29cd2 Consistency fix 2010-05-19 11:06:13 -07:00
Chris Robinson c5c83882b3 Use unsigned types when finding the source offsets 2010-05-19 10:38:28 -07:00
Chris Robinson ea3bc0518c A couple formatting fixes 2010-05-19 10:36:24 -07:00
Chris Robinson 2d46a1001e Use a map for the filter list 2010-05-18 17:54:45 -07:00
Chris Robinson 4edd7fe647 Use a map for the effects list 2010-05-18 17:41:06 -07:00
Chris Robinson ad5dfab428 Improve compatbility with latest AL_EXT_buffer_sub_data spec 2010-05-18 17:15:21 -07:00
Chris Robinson 85838c1d57 Define ARGSTACK and CALLSTACK only when needed for testing shared libs 2010-05-16 08:03:05 -07:00
Chris Robinson 4fbb3ccf66 Always look for winmm under Windows
It's needed for timeGetTime, even if the WinMM backend is disabled
2010-05-16 07:52:43 -07:00
Chris Robinson 7f533c6a25 Change inline -> __inline for MSVC 2010-05-16 06:02:27 -07:00
Chris Robinson 6dab9d54d1 Use the loop start when filling in padding data for looping sources 2010-05-13 06:52:44 -07:00
Chris Robinson 7ed5d12717 Pay attention to the source loop points 2010-05-13 04:53:21 -07:00
Chris Robinson 23b2c1f902 Only use a modulo to loop when the source is static 2010-05-13 02:12:50 -07:00
Chris Robinson 5d579dd1a8 Store loop points as uncompressed frame offsets in the source when a buffer is attached 2010-05-13 02:10:33 -07:00
Chris Robinson 0ce138341c Add initial structural support for AL_EXT_loop_points 2010-05-13 02:03:48 -07:00
Chris Robinson 61b682131e Reduce some indentation 2010-05-12 07:30:45 -07:00
Chris Robinson a53e3dda75 Don't needlessly expose a variable for the backends 2010-05-12 07:27:12 -07:00
Chris Robinson 2220c22c90 Move incomplete extension declarations to alMain.h 2010-05-12 06:59:47 -07:00
Chris Robinson e3a70e5021 Scale output of effects to compensate for device down-mixing 2010-05-12 04:56:03 -07:00
Chris Robinson af4faaf666 Use a UIntMap for the effect slot list 2010-05-12 02:20:14 -07:00
Chris Robinson f2548570b8 Store the buffer's original data size and block alignment 2010-05-12 01:36:09 -07:00
Chris Robinson d678f1d88b Store looping locally when mixing a source 2010-05-12 00:38:04 -07:00
Chris Robinson f0ce1bff3e Simplify and fix applying a source offset 2010-05-11 11:59:41 -07:00
Chris Robinson ab3c23478d Use a separate function to convert compressed bytes to frames 2010-05-11 11:06:48 -07:00
Chris Robinson 4e65e9bfa9 Only a streaming source can have a processed buffer 2010-05-11 08:53:38 -07:00
Chris Robinson 053aeee5d3 Rename a variable 2010-05-11 07:09:44 -07:00
Chris Robinson 1652dc02ab Look for the map insertion point using a binary search 2010-05-10 11:40:57 -07:00
Chris Robinson 099c2f3593 Use a simple loop to set multi-channel dry gains 2010-05-09 22:06:10 -07:00
Chris Robinson 0378422fcb Use a map to store sources and buffers
And do a lookup using a binary search instead of linear
2010-05-01 19:59:41 -07:00
Chris Robinson 0760415d08 Use doubles instead of floats for the source offset calculations 2010-04-28 17:58:20 -07:00
Chris Robinson 5730ccaa39 Combine AL and ALC function lists 2010-04-28 15:07:38 -07:00
Chris Robinson aaa7082aa8 Get the offset even if the current buffer is 0 2010-04-28 14:08:10 -07:00
Chris Robinson 5d7815beed Only apply ambient gain to available output channels 2010-04-27 11:39:54 -07:00
Chris Robinson a0ee2ccce7 Add a couple missing values to the *GetEnumValue tables 2010-04-25 08:40:37 -07:00
Chris Robinson 110be7f500 Add an option to scale the output mix 2010-04-23 07:54:43 -07:00
Chris Robinson 52663e8a44 Combine two loops into one 2010-04-23 07:23:38 -07:00
Chris Robinson 8646647b3e Update stereodup config option comment 2010-04-22 05:22:20 -07:00
Chris Robinson a04dac670e Make stereo duplication a property of the device
Further, don't use it with mono/stereo output
2010-04-20 03:57:40 -07:00
Chris Robinson 81dd71dd71 Stop and start the backend device only if new attributes are being requested 2010-04-17 00:50:28 -07:00
Chris Robinson 4d15391c88 Disable PulseAudio's write callback when disconnecting 2010-04-17 00:27:13 -07:00
Chris Robinson fc2473f826 Translate the source position separately
This is to handle the case where an app specifies the same values for the
source and listener, and expects centered panning. This fails due to floating-
point errors in the matrix, causing the result to be ever-so-slightly off of 0.

This error would normally be hidden by the position normalization, which will
not lengthen a distance shorter than the reference distance so the panning
would be nearly imperceptible. But that also fails if the reference distance
is set to 0, causing the position to expand to a full unit.

Keep the 4x4 matrix calculations, however. It will still be useful for the
requested listener matrix extension.
2010-04-16 02:09:53 -07:00
Chris Robinson 000d848f0b Return immediately when no layout is specified 2010-04-11 23:03:36 -07:00
Chris Robinson 3c5007352e More type fixes 2010-04-11 20:17:43 -07:00
Chris Robinson e0fa497948 Use a linear scaling when sending multi-channel sources to auxiliary slots 2010-04-11 15:20:46 -07:00
Chris Robinson f082c73539 Use proper types for some variables 2010-04-11 14:33:22 -07:00
Chris Robinson d4f8bd665f Only consider output speakers for the panning LUT 2010-04-11 14:23:10 -07:00
Chris Robinson 58d0db6eab Don't use LIB_INSTALL_DIR since that can be the full path 2010-04-11 12:42:47 -07:00
Chris Robinson 1544ddf0a5 Avoid reading buffer 0's size 2010-04-10 17:31:08 -07:00
Chris Robinson 488ec612bb Avoid hard-coding the channel count 2010-04-09 14:21:47 -07:00
Chris Robinson 484702a2e5 Get the speaker arrangement before setting up the channel matrix 2010-04-09 12:27:30 -07:00
Chris Robinson 371058fb9e Re-enable stereo duplication 2010-04-08 23:00:14 -07:00
Chris Robinson 97b00670f5 Use the proper type for the speaker-to-channel map 2010-04-08 18:05:24 -07:00
Chris Robinson 704b386cc5 Scale the ring modulator's mono input when expanding to multi-channel 2010-04-08 16:34:51 -07:00
Chris Robinson aace50ebf4 Store the panning LUT in the device 2010-04-08 15:58:11 -07:00
Chris Robinson 49201e892b Use a single layout for the virtual speakers
The downmix should probably be improved to take the angles into account
2010-04-08 15:41:32 -07:00
Chris Robinson 19b8deba66 Apply a scalar to the output downmix so channels don't get more than a 100% mix
All channels get the same scalar so channel balance (should be) maintained
2010-04-08 15:23:03 -07:00
Chris Robinson 068c0076af Set the device channel matrix when the device is reset 2010-04-08 15:02:03 -07:00
Chris Robinson 37c93a6ad8 Always mix internally at 8.1
The channels are remixed when writing to the output buffer. Stereo duplication
is currently broken, but this can be restored later
2010-04-08 14:47:12 -07:00
Chris Robinson 1b1c76da34 Invert device channel map array 2010-04-08 13:11:21 -07:00
Chris Robinson 5db1aec1d1 Make some functions static 2010-04-08 12:14:18 -07:00
Chris Robinson 05ca5c88ef Update alsoftrc.sample for the ring modulator 2010-04-08 10:44:35 -07:00
Chris Robinson 980167c99b Modulate with the requested waveform in the ring modulator 2010-04-08 10:37:09 -07:00
Chris Robinson 76f8c1e4e2 Implement a basic high-pass cutoff filter in the ring modulator 2010-04-08 09:36:20 -07:00
Chris Robinson b273d616ad Implement a skeleton Ring Modulator effect 2010-04-08 08:54:28 -07:00
Chris Robinson c16b895460 Fix non-dynamic PortAudio 2010-04-01 03:25:39 -07:00
Chris Robinson ec1a4884d9 Release 1.12.854 2010-03-29 22:05:21 -07:00
Chris Robinson bb4ed8b1db ALC_EXT_thread_local_context is now complete 2010-03-29 22:01:54 -07:00
Chris Robinson 4e54f93477 Make sure ALbyte and ALCbyte are signed 2010-03-28 23:24:41 -07:00
Chris Robinson 4ac1772149 No need to continue supporting _OPENAL32LIB 2010-03-28 02:12:32 -07:00
Chris Robinson 3f235c51f6 Remove a couple unnecessary lines 2010-03-26 21:58:19 -07:00
Chris Robinson 7bdf0d5156 Shorten some variable names 2010-03-26 00:41:27 -07:00
Chris Robinson d2a6fd58a3 Use unsigned types for mono and stereo source count hints 2010-03-25 18:39:16 -07:00
Chris Robinson 05098862c5 Fix comparison check 2010-03-24 23:48:38 -07:00
Chris Robinson c8dd0246da Fix alcGetEnumValue error handling 2010-03-24 22:57:35 -07:00
Chris Robinson b3c389c0a0 Constify and properly type some variables and struct members 2010-03-24 22:43:08 -07:00
Chris Robinson 15b9fc9099 Improve timing for the wave file writer 2010-03-24 22:20:55 -07:00
Chris Robinson 1c14c13c2f Fix 8-bit output with the Wave Writer 2010-03-24 16:58:58 -07:00
Chris Robinson b79b92967f Fix comment typo 2010-03-24 16:53:11 -07:00
Chris Robinson f77832fea2 Remove unnecessary NULL check 2010-03-24 03:43:37 -07:00
Chris Robinson 4ce8a17afd Reduce some indentation 2010-03-24 02:23:00 -07:00
Chris Robinson 702c62c9a2 Use a global handle to store the process-wide context 2010-03-23 21:05:29 -07:00
Chris Robinson 661059bf0f Rename alcMakeCurrent to alcSetThreadContext 2010-03-23 19:49:31 -07:00
Chris Robinson 7fb4c4ce4f Move extension function declarations to alext.h/efx.h 2010-03-23 18:21:55 -07:00
Chris Robinson 52834744fa Return if PortAudio fails to load in Windows 2010-03-23 17:45:37 -07:00
Chris Robinson 3e9934e810 Mark extension functions with AL_API/ALC_API 2010-03-23 17:44:01 -07:00
Chris Robinson 556e9b8fee Use protected visibility for exported API functions
Protected visibility is like default visibility, in that functions will be
"exported" from the library. However, it also guarantees that references to the
functions from within the library will be to the library's version, even if the
symbols are overriden by the application.
2010-03-22 23:10:29 -07:00
Chris Robinson ef92c63455 Define AL_BUILD_LIBRARY only when building the lib 2010-03-22 23:09:04 -07:00
Chris Robinson ae8858c516 Whitespace fixes 2010-03-22 15:12:20 -07:00
Chris Robinson 0691486813 Support PortAudio in Windows 2010-03-21 20:57:15 -07:00
Chris Robinson 49db3bf916 Cleanup and fixup Release* functions 2010-03-20 21:49:02 -07:00
Chris Robinson 99f28f25b0 Avoid calling alDelete* from alGen* 2010-03-20 21:38:05 -07:00
Chris Robinson 27358c8ce8 Don't expose enums for unsupported filter types 2010-03-20 20:30:43 -07:00
Chris Robinson 899fbdfe08 Add EAX Reverb and Echo parameters to the enum table 2010-03-20 20:24:50 -07:00
Chris Robinson eea23a012a Relax circular layout requirement 2010-03-20 00:54:44 -07:00
Chris Robinson 2235a53824 Reduce some indentation 2010-03-19 20:49:23 -07:00
Chris Robinson 52f82f0b94 Simplify removing the context handle from the device's context array 2010-03-19 14:53:32 -07:00
Chris Robinson a572b13743 Don't use deprecated macros 2010-03-19 14:34:18 -07:00
Chris Robinson 4340a6f8fe Remove another unnecessary assert 2010-03-19 01:35:57 -07:00
Chris Robinson 4be97dc735 Use proper storage type for the new format 2010-03-19 01:26:56 -07:00
Chris Robinson 799126df0e Use a better method to derive the offset from the data pointer 2010-03-18 19:32:03 -07:00
Alam Arias a65ec178df cast AL_SIZE value to ALint 2010-03-18 16:33:16 -07:00
Alam Arias cf4027df38 Mingw64's shlobj.h wants at least 0x501 2010-03-18 16:33:08 -07:00
Alam Arias 127b845960 DXSDK_DIR is MSVC only 2010-03-18 16:32:53 -07:00
Alam Arias e3637b8452 use ALintptrEXT in alcReverb.c 2010-03-18 16:32:49 -07:00
Alam Arias 745d36dc76 add _CRT_NONSTDC_NO_DEPRECATE define for MSVC 2010-03-18 16:32:44 -07:00
Chris Robinson 2355d6a4a0 Use ptrdiff types for databuffer offset/length handling
Should improve addressing for non-32-bit systems
2010-03-18 14:46:33 -07:00
Chris Robinson e1965fe7d9 Convert CR/LF -> LF
Spotted by Alam Arias
2010-03-18 14:23:31 -07:00
Chris Robinson 781444d12c Use size_t where appropriate
Spotted by Alam Arias
2010-03-18 14:21:06 -07:00
Chris Robinson b6571904ce Define _WIN32_IE to 0x400 only if it's a lesser value by default
Spotted by Alam Arias
2010-03-18 13:46:18 -07:00
Chris Robinson 97b25755e7 Support capture with PortAudio 2010-03-18 01:58:25 -07:00
Chris Robinson bdfafb454b Create WAVEFORMATEXTENSIBLE wave files for multi-channel and float support 2010-03-18 00:53:58 -07:00
Chris Robinson 0fee20a415 Simplifiy verification loops 2010-03-17 20:16:02 -07:00
Chris Robinson 186e0f3b04 Use a separate list for NULL-device extensions 2010-03-17 19:46:20 -07:00
Chris Robinson 2e6c5e590f Remove old comment 2010-03-17 19:28:01 -07:00
Chris Robinson 9d4e715ee7 Don't return unsupported effects from alGetEnumValue 2010-03-17 19:20:52 -07:00
Chris Robinson 932e5ec9b8 The enums are the same as with mcforamts, so advertise AL_EXT_MULAW too 2010-03-17 19:15:51 -07:00
Chris Robinson af5fb1d535 Remove unnecessary assert 2010-03-17 19:04:02 -07:00
Chris Robinson 2953daebf5 GetSourceOffset can't fail 2010-03-17 15:19:00 -07:00
Chris Robinson dd82b68175 Handle source offsets for muLaw formats 2010-03-17 15:15:12 -07:00
Chris Robinson 05a081a7b8 Allow selecting databuffer 0 2010-03-17 14:04:25 -07:00
Chris Robinson 9c417d33cc clock_gettime is available only when _POSIX_TIMERS is greater than 0 2010-03-17 12:04:33 -07:00
Chris Robinson 975f92fc84 Remove unnecessary stop call 2010-03-16 21:29:55 -07:00
Chris Robinson 0097beb84c Remove unused variable 2010-03-16 21:12:36 -07:00
Chris Robinson 65e16cc8bb Remove unneeded checks 2010-03-16 20:29:01 -07:00
Chris Robinson 2687155200 Get rid of more alIs* calls 2010-03-16 20:23:46 -07:00
Chris Robinson 49321961e8 Effect and filter ID 0 is valid 2010-03-16 19:14:05 -07:00
Chris Robinson 65f43637ce Avoid some alIs* calls while under the context lock
Instead, use functions that verify the ID by searching the object list and
returning its handle
2010-03-16 18:54:36 -07:00
Chris Robinson f37cfc486d Pass the context to alSetError 2010-03-16 17:35:51 -07:00
Chris Robinson a337a59fb8 Use alext.h for extension definitions 2010-03-16 16:25:30 -07:00
Chris Robinson ec917e8e2f Rename some struct members for consistency 2010-03-16 15:37:41 -07:00
Chris Robinson 89d84131a4 Avoid dereferencing a NULL buffer when unqueueing buffer 0 2010-03-15 16:10:21 -07:00
Chris Robinson 2033f60d24 Print an error when realloc fails 2010-03-15 14:28:38 -07:00
Chris Robinson d4159430f0 Set the buffer length for Pulse when opening the device
So it will properly scale with context frequency requests
2010-03-14 22:20:55 -07:00
Chris Robinson 14255a38fc Pulse's buffer size is not a good measurement for the update size
Lie and say 20ms instead, since there is no stable method to get such info
2010-03-14 21:45:23 -07:00
Chris Robinson 6c5f1b78d7 Reduce the mixing buffers to the next power of two 2010-03-14 03:30:42 -07:00
Chris Robinson 1f2d3a0132 Remove duplication of setting source angles 2010-03-14 03:23:18 -07:00
Chris Robinson c23e4ed412 Add support for AL_EXT_DOUBLE 2010-03-13 21:32:45 -08:00
Chris Robinson 8c0118e7ae Add support for AL_EXT_MULAW_MCFORMATS 2010-03-13 21:03:34 -08:00
Chris Robinson 9d4107a515 Add AL_EXT_MULAW_MCFORMATS tokens to alext.h 2010-03-13 18:39:12 -08:00
Chris Robinson d07b9c2c11 Rewrite openal-info
Output is mostly unchanged, however there are differences. Device-specific info
(including context-specific info) is separated from NULL-device queries, and
there is now a distinction between ALC versions of the NULL device and the
opened device. Additionally, an alternate playback device can be queried by
specifying its name as the first parameter.
2010-03-13 18:03:01 -08:00
Chris Robinson 3108a6a997 Limit PulseAudio's buffer size to the requested length 2010-03-11 09:47:26 -08:00
Chris Robinson b734cab6fc Fix the retrieval of the RW offsets using the correct functions 2010-03-10 07:33:30 -08:00
Chris Robinson 08b1bed38b Remove a couple incorrect comments 2010-03-10 07:16:53 -08:00
Chris Robinson df6320eb0a Remove duplicate copyright notice 2010-03-09 11:25:34 -08:00
Chris Robinson 80f1ec0d7e Protect some capture calls with a mutex 2010-03-09 10:14:52 -08:00
Chris Robinson 98f4f5a4f0 Add EFX types and enums to alext.h
The types and enums are in efx.h, which is included by alext.h. It's done this
way because EFX has a lot if definitions which would polute alext.h
2010-03-09 09:28:22 -08:00
Chris Robinson 8feb089f5c Build device lists only when needed 2010-03-09 06:09:29 -08:00
Chris Robinson 2ba3a88ace Probe physical devices separately from appending them to the device list 2010-03-09 05:44:18 -08:00
Chris Robinson 1f10195c47 Use powf when available 2010-03-07 22:12:33 -08:00
Chris Robinson dc40702b53 Remove unused source param count macro 2010-03-07 21:48:25 -08:00
Chris Robinson a9e0e57797 Keep UpdateSize updated when apps request a frequency 2010-02-24 18:51:57 -08:00
Chris Robinson 9b47048231 Silence some warnings 2010-02-16 05:44:39 -08:00
Chris Robinson c05a3d3549 Better handle run-time linking 2010-02-16 05:43:36 -08:00
Chris Robinson 2083884ae3 Properly check for functions in Win32 shared libs 2010-02-16 05:36:49 -08:00
Chris Robinson 2f644c7ed5 Constify some globals 2010-02-15 22:01:23 -08:00
Chris Robinson d17c4a098c Avoid probing for devices on lib initialization 2010-02-10 16:34:43 -08:00
Chris Robinson 96303893bc Set ALSA playback buffer and period size based on time
So rate adjustments won't modify the latency
2010-02-08 17:42:44 -08:00
Chris Robinson a329f9c84a Fix retrieval of the current global context when changing it 2010-02-08 16:58:26 -08:00
Chris Robinson fc96e965ae Always disable ALSA's resampler for playback
This means the frequency config option won't have an effect if the ALSA device
can't set an alternate sampling rate
2010-02-08 16:38:53 -08:00
Chris Robinson 365a62d63a Improve source write offset calculations 2010-02-07 20:11:24 -08:00
Chris Robinson 3a87c3c3ba Avoid using periods with PulseAudio, and add an option to specify its buffer length 2010-02-07 19:29:48 -08:00
Chris Robinson 54dc26b145 Enable the WinMM backend only if the lib check succeeds 2010-02-05 12:07:51 -08:00
Chris Robinson 78c1629aeb Disable ALSA's resampler when no specific output rate is requested 2010-02-05 11:45:17 -08:00
Chris Robinson bd518ed264 Make sure all requested data gets written to PulseAudio 2010-01-24 00:03:23 -08:00
Chris Robinson 56379bffac Use pa_channel_map_superset only when available with PulseAudio 0.9.15
pa_channel_map_equal can otherwise detect some compatible output modes
2010-01-22 21:20:08 -08:00
Chris Robinson 11d7a0e394 Specify the buffer size to ALSA, so the period count remains flexible
Under conditions where the period size is fixed (such as dmix), ALSA will still
attempt to provide the requested number of periods even if the requested period
size needs to be dramatically altered. In these cases, it would be better to
increase or decrease the period count, instead of growing or shrinking the
total buffer size and significantly changing the latency.
2010-01-20 01:19:32 -08:00
Chris Robinson 3ad86a1c1b Release 1.11.753 2010-01-17 17:46:27 -08:00
Chris Robinson 931f5875cd Fix speaker angle fixup 2010-01-12 09:11:46 -08:00
Chris Robinson f22b02a762 al_print doesn't need to be inline 2010-01-12 09:05:57 -08:00
Chris Robinson 505f61ff43 Properly trace the invalid speaker angle 2010-01-12 08:50:32 -08:00
Chris Robinson 0c2efa1253 Use GCC's format attribute for al_printf 2010-01-12 08:48:25 -08:00
Chris Robinson 5921e18be2 Fix some typos with the solaris backend 2010-01-12 08:28:07 -08:00
Chris Robinson 5b9e6fe440 Only allow 8- and 16-bit, and mono and stereo, wave file output 2010-01-12 08:26:25 -08:00
Chris Robinson 35ba7d70dc Consolidate some source offset handling code 2010-01-12 02:43:37 -08:00
Chris Robinson 026b4b8f4c Better handle large second offsets 2010-01-12 02:26:38 -08:00
Chris Robinson c924a50bed Don't use a flag to set an error when applying the source offset 2010-01-12 02:22:38 -08:00
Chris Robinson 574792d2e1 Fix Windows compilation 2010-01-11 23:47:03 -08:00
Chris Robinson ab2eb5a603 Check buffer size when copying padding instead of the data pointer 2010-01-11 10:58:33 -08:00
Chris Robinson 3d7f925d52 Add helpful values to the resampler enum 2010-01-11 07:02:29 -08:00
Chris Robinson 93b584ff84 Add a cosine resampler 2010-01-11 06:19:54 -08:00
Chris Robinson 705849ca73 Add an option for point resampling 2010-01-11 05:37:20 -08:00
Chris Robinson 1a57f095e8 Hold global lock during mixing only when iterating device contexts 2010-01-11 03:57:49 -08:00
Chris Robinson ac9c2e8c4a Cleanup OSS/Solaris loop a bit 2010-01-10 12:40:59 -08:00
Chris Robinson 45f8efec41 Return the default config string for empty entries 2010-01-09 06:48:43 -08:00
Chris Robinson ef7df2416d Hide OSS and Solaris devices if their files can't be stat'd 2010-01-09 06:40:50 -08:00
Chris Robinson cb113315f7 Promote AL_EXT_source_distance_model to complete 2010-01-09 03:27:16 -08:00
Chris Robinson d61f90a9c2 Make sure the device handle is valid when getting the device error 2010-01-09 03:25:13 -08:00
Chris Robinson 3d11fb219e Hold the default context extensions globally 2010-01-09 02:48:18 -08:00
Chris Robinson 4d9a368f96 Suppress connection refused errors
Since that just typically means the server isn't running
2010-01-08 01:43:27 -08:00
Chris Robinson 43220b604c Reduce some indentation 2010-01-08 01:21:57 -08:00
Chris Robinson 91f28fa87c Try the PulseAudio backend first 2010-01-08 01:08:27 -08:00
Chris Robinson 82547db2db Prepare the pcm handle after recovering 2010-01-06 23:02:28 -08:00
Chris Robinson 64ac3a4739 Use snd_pcm_recover in more places 2010-01-06 22:55:20 -08:00
Chris Robinson c90616b963 Use snd_pcm_recover to recover from certain device errors 2010-01-06 22:50:30 -08:00
Chris Robinson 0ceaa01c3d Adjust PulseAudio's capture latency 2009-12-30 15:33:16 -08:00
Chris Robinson 7d7e503603 Properly retrieve device-inspecific errors 2009-12-28 23:29:49 -08:00
Chris Robinson 7ee81eac0f Store ALC errors with the device when possible 2009-12-28 23:19:13 -08:00
Chris Robinson c9a08fc7b2 Remove some unneeded functions 2009-12-28 13:12:45 -08:00
Chris Robinson 69ab93a824 Add a function to check if a config option is set to a non-empty value 2009-12-28 13:08:15 -08:00
Chris Robinson 179b660eee Enforce a lower bound playback frequency of 8khz 2009-12-28 12:47:59 -08:00
Chris Robinson a0ef7be9a5 Improve layout parsing and allow using long names for speakers 2009-12-28 11:49:55 -08:00
Chris Robinson 2a735b14dc Add an option to spawn a PulseAudio server on request 2009-12-28 10:49:31 -08:00
Chris Robinson a294dd8d9b Be more lenient in signaling the mainloop 2009-12-28 10:15:59 -08:00
Chris Robinson dc1522282b Try to find a compatible format from Pulse's default sink 2009-12-27 11:05:59 -08:00
Chris Robinson 528a4c6a02 Update panning for existing AL contexts when creating a new one 2009-12-26 20:27:14 -08:00
Chris Robinson 1770a8b62b A NULL Pulse context won't have a valid error code 2009-12-26 12:18:16 -08:00
Chris Robinson 77a0a6de95 Wait for the buffer attrib update from pulse to finish 2009-12-26 11:30:41 -08:00
Chris Robinson c1fd977e79 Consolidate pulse capture failure path 2009-12-26 10:46:29 -08:00
Chris Robinson cbbda93292 Make sure a proper channel map is set for pulse capture 2009-12-26 09:17:03 -08:00
Chris Robinson c6340ce12d Clean up some loading checks 2009-12-26 08:49:11 -08:00
Chris Robinson 7bc739e965 Use the proper logging function 2009-12-26 08:16:25 -08:00
Chris Robinson 9f988808c7 Start and stop PortAudio's stream in the proper methods 2009-12-26 08:14:28 -08:00
Chris Robinson 6e9ce47a4b GetConfigValueBool should take an int, not a float 2009-12-26 07:42:57 -08:00
Chris Robinson 89f59c0e1c Shorten a long line 2009-12-26 07:42:16 -08:00
Chris Robinson 3793919892 Capture as much as possible directly from PulseAudio 2009-12-25 17:56:57 -08:00
Chris Robinson d1699d50f6 Add missing newline 2009-12-25 15:18:32 -08:00
Chris Robinson b94d950b1e Undefine no longer needed macro 2009-12-25 14:11:43 -08:00
Chris Robinson d3e77a0f63 Fix incorrect error check 2009-12-25 13:19:25 -08:00
Chris Robinson 965a71ee90 Only use pa_stream_set_buffer_attr_callback when available (0.9.15+) 2009-12-25 13:17:21 -08:00
Chris Robinson fd794b44b2 Use pa_stream_begin_write when available for "zero-copy" writing
Must be compiled against 0.9.16 or newer to be available. It will fall back to
the old method if the function is not available at run-time.
2009-12-25 13:11:17 -08:00
Chris Robinson c9dcba17a9 Check error returns instead of error string 2009-12-25 13:05:04 -08:00
Chris Robinson 88de4e15b3 Mark the source for updating when setting a buffer on it
Changing the buffer can change the playback format, which can require different
source parameter calculations. Queueing a buffer on a source that has no
buffers (or only buffers without a format, eg. buffer 0) has the same effect
2009-12-25 05:09:29 -08:00
Chris Robinson 7f0c6629b9 Use a 64-bit value to scale potentially-large numbers 2009-12-24 15:41:45 -08:00
Chris Robinson f6ca39403d Use the Pulse server-specified playback rate by default 2009-12-24 15:35:22 -08:00
Chris Robinson ea7cf35ea4 Use pa_xmalloc instead of pa_xmalloc0 2009-12-24 07:38:46 -08:00
Chris Robinson accea119d9 Update pulse capture ring buffer in 25ms chunks 2009-12-24 04:08:04 -08:00
Chris Robinson 6ea7b43c90 Don't force latency adjustment with PulseAudio 2009-12-23 13:59:58 -08:00
Chris Robinson ddfad996a9 Don't render mono as stereo 2009-12-21 02:59:30 -08:00
Chris Robinson d786f99094 Scale samples down when converting stereo to mono 2009-12-21 02:27:25 -08:00
Chris Robinson 008563450c Improve some indentations 2009-12-20 21:50:00 -08:00
Chris Robinson 69c238a2e6 Properly retrieve the device frequency 2009-12-20 21:19:57 -08:00
Chris Robinson b3fdf170b1 Fix header comment for AL_PITCH 2009-12-16 22:50:54 -08:00
Chris Robinson 56cc038603 Improve initial decay calculations for sends to reverb 2009-12-10 18:37:36 -08:00
Chris Robinson 4c83c689a8 Use the specified reverb air absorption value for wet sends 2009-12-10 18:22:45 -08:00
Chris Robinson 2b7953c472 Track whether a context is suspended or not 2009-12-09 12:14:53 -08:00
Chris Robinson 368ef1cea9 Store the source state locally after making sure it needs mixing 2009-12-09 11:56:53 -08:00
Chris Robinson bd696a6b37 Fix IMA ADPCM offset calculation 2009-12-09 09:50:09 -08:00
Chris Robinson a9fc272e39 Prettify CMake checks for compiler switches 2009-12-09 08:46:35 -08:00
Chris Robinson c5952d1ddc Move the pkg-config file to the base directory 2009-12-09 07:36:06 -08:00
Chris Robinson 656a406377 Use an inline function to calculate the low-pass filter coefficient 2009-12-09 07:21:59 -08:00
Chris Robinson 5fcd6cc510 Split non-attenuated source calculations into a separate function 2009-12-09 07:02:26 -08:00
Chris Robinson e09b6020a6 Fix typo for reverb creation 2009-12-09 06:46:06 -08:00
Chris Robinson 84d2d623b6 Add a head-dampening option
This simulates occlusion of the player's head for sounds coming from behind,
when outputing to mono or stereo
2009-12-08 14:18:07 -08:00
Chris Robinson 1694e5bd12 Store the original pre-clamped distance instead of re-computing it 2009-12-08 10:12:18 -08:00
Chris Robinson 5170e251f9 Use the correct wet filter history offset 2009-12-07 12:45:23 -08:00
Chris Robinson 4697e946d3 Internally store 32-bit float buffer data, and mix accordingly 2009-12-07 10:35:30 -08:00
Chris Robinson 9286e3984c Move default channel order setting out of the header 2009-12-07 04:19:33 -08:00
Chris Robinson 88f3d747b7 Add a simple README 2009-12-07 01:05:01 -08:00
Chris Robinson d4427c54ea Change internal order to match WFX 2009-12-07 00:51:27 -08:00
Chris Robinson 92ade80557 Fix 6.1 channel order 2009-12-07 00:49:56 -08:00
Chris Robinson 8138446b8c Restrict setting some wet path values to active sends only 2009-12-06 03:59:12 -08:00
Chris Robinson 58ecc7fad4 Check for potential NULL accesses with the IsBadWritePtr wrapper 2009-12-04 01:33:50 -08:00
Chris Robinson 311cc5c62f Don't wait to accept stream connections 2009-12-03 04:43:38 -08:00
Chris Robinson 4a928ea9fa Don't signal on synchronous changes and don't wait to accept context changes 2009-12-02 08:10:45 -08:00
Chris Robinson c1eb444a39 Remove some assumptions of 16-bit internal storage 2009-12-02 05:55:33 -08:00
Chris Robinson b5270e0bb3 Use a channel-map to specify the output device channel order 2009-12-02 04:03:51 -08:00
Chris Robinson 6cfc31777b Add an option for real-time priority mixing
Default to disable for now, as a safety precaution
2009-12-01 23:15:09 -08:00
Chris Robinson 0e1e8503e0 Properly accept PulseAudio's mainloop signal on connection failure 2009-12-01 22:42:43 -08:00
Chris Robinson 974d0b4e91 Fix retrieved update size from pulseaudio 2009-12-01 12:21:02 -08:00
Chris Robinson d66832a39c Accept a signal only when the pulseaudio stream/context is ready 2009-12-01 12:18:34 -08:00
Chris Robinson d5889a941f Clamp dry gain after cone attenuation is applied 2009-12-01 03:32:04 -08:00
Chris Robinson 6248e986e5 Don't complain if the length given by pulse isn't an exact multiple of the period size 2009-12-01 02:23:38 -08:00
Chris Robinson 786b98a013 Avoid setting a field redundantly 2009-11-29 23:07:04 -08:00
Chris Robinson f63d8dbf38 Enable real-time priority for ALSA, OSS, and DirectSound mixing loops 2009-11-29 23:02:21 -08:00
Chris Robinson 15aad09ce7 Check for the pthread_setschedparam function 2009-11-29 22:44:56 -08:00
Chris Robinson fdd314f7f8 Reset the kill flag after the thread has stopped 2009-11-29 10:22:12 -08:00
Chris Robinson 39b456d88c Add AL_EXT_double tokens to alext.h 2009-11-28 22:19:04 -08:00
Chris Robinson d930fb8d3d Call the Update effect method for null effects 2009-11-28 20:09:41 -08:00
Chris Robinson 3ec64eb0fd Call to the right databuffer function 2009-11-28 19:37:29 -08:00
Chris Robinson d81c9819b8 Remove unnecessary returns 2009-11-28 19:36:05 -08:00
Chris Robinson 98ce1d14c1 Update AL_EXTX_source_distance_model to require explicit enabling
The in-progress spec has been updated to reflect this
2009-11-27 20:05:21 -08:00
Chris Robinson 69f9ab88b9 Send multi-channel sources to auxiliary effect slots
They are downmixed to mono using a volume-preserving scalar, and passed
through a 1-pole low-pass filter (not chained)
2009-11-26 00:39:32 -08:00
Chris Robinson 1a0676f0eb Mark sources for updating when a new context is made from the device 2009-11-25 16:28:19 -08:00
Chris Robinson 658923175f Update source parameters only when they need changing 2009-11-25 16:21:47 -08:00
Chris Robinson 877f4340ba Base air absorption on distance attenuation, try 2 2009-11-24 21:19:11 -08:00
Chris Robinson 35a9ccb41f Revert "Base air absorption on the distance attenuation"
This reverts commit c7c2f9385f.

Fundamentally wrong. The -6dB rolloff is every doubling of the distance, and
the (scaled) -0.05dB rolloff is supposed to be every additional unit.
2009-11-24 01:39:34 -08:00
Chris Robinson c7c2f9385f Base air absorption on the distance attenuation 2009-11-23 16:25:37 -08:00
Chris Robinson d1f3dbb9a1 Make modulation index 0 map to offset 0 2009-11-23 04:14:12 -08:00
Chris Robinson cfb30fe975 Use a 4x4 matrix to transform coordinates 2009-11-23 04:13:51 -08:00
Chris Robinson 2d1b378ef2 Transform all relevant vectors for converting world-space to listener-space 2009-11-22 22:36:20 -08:00
Chris Robinson 06bbee2449 Add a function for 1-pole filtering 2009-11-22 21:20:27 -08:00
Chris Robinson 85bc300dfa ALCAPIENTRY is deprecated in favor of ALC_APIENTRY 2009-11-22 21:15:11 -08:00
Chris Robinson 0662adacb9 Fix alBufferDataStatic extension name in alext.h 2009-11-22 21:12:43 -08:00
Chris Robinson 65a153da6c Update the drivers config file comment 2009-11-22 15:43:05 -08:00
Chris Robinson c5ee010640 The echo should not take energy-attenuated input 2009-11-22 15:37:32 -08:00
Chris Robinson 1b18b4a0ee Allow unlisted backends to stay available when the drivers list ends with , 2009-11-22 01:06:05 -08:00
Chris Robinson 58765aab6b Print available devices before trying to open one 2009-11-19 19:02:16 -08:00
Chris Robinson 1483af1baa Watch for NULL and empty device lists 2009-11-19 18:49:24 -08:00
Chris Robinson 13979793f6 Display supported filters using a comma-separated listing 2009-11-19 18:46:23 -08:00
Chris Robinson 9c228e7625 Be clearer if device opening or context setup fails 2009-11-19 18:25:29 -08:00
Chris Robinson 6a667b36d1 Reorganize and improve the reverb effect
Code supplied by Christopher Fitzgerald. This update also implements the echo
and modulation parameters.
2009-11-19 14:05:04 -08:00
Chris Robinson fe37f1968d Better approximate the wet attenuation model for reverb 2009-11-19 11:06:41 -08:00
Chris Robinson 4565bdd7ce Make sure there's at least a one-sample delay for the echo's first tap 2009-11-19 10:42:41 -08:00
Chris Robinson 5f3c07ca3b Apply the reverb room rolloff factor for EAX reverb too 2009-11-19 10:29:10 -08:00
Chris Robinson 8d1da6a8ca Move NextPowerOf2 to alMain.h 2009-11-19 09:50:15 -08:00
Chris Robinson ff8e09495d Move aluCart2LUTpos to alu.h 2009-11-19 09:24:35 -08:00
Chris Robinson e868eef679 Make sure to set the new echo sample buffer and remove an unused macro 2009-11-18 17:34:08 -08:00
Chris Robinson ea90f781ff Release 1.10.622 2009-11-08 21:36:44 -08:00
Chris Robinson c1b161b44b Handle NULL effect objects as AL_EFFECT_NULL effects 2009-11-05 20:50:56 -08:00
Chris Robinson aa84b2e328 Handle setting AL_EFFECT_NULL effect types on a slot 2009-11-05 18:22:43 -08:00
Chris Robinson ebc1602816 Use the DXSDK_DIR variable when set 2009-11-02 14:57:48 -08:00
Chris Robinson dcd6a55529 Use a realtime clock for measuring time 2009-11-01 10:03:05 -08:00
Chris Robinson fb258a7416 Properly lock the device when setting it disconnected 2009-11-01 09:29:20 -08:00
Chris Robinson 5aed927887 Watch for stream and context failures from pulse, and report disconnects 2009-10-31 20:05:15 -07:00
Chris Robinson d964bb9f2f Fix length calculation for pulse 2009-10-31 19:30:12 -07:00
Chris Robinson 87dc7a5b97 Set a proper channel map for PulseAudio 2009-10-31 19:29:41 -07:00
Chris Robinson ae63ca481d Mix all updates PulseAudio requests 2009-10-31 17:59:30 -07:00
Chris Robinson 8e599103b6 Watch for buffer attribute changes from PulseAudio 2009-10-31 17:57:35 -07:00
Chris Robinson af0140e260 Use signals to watch for state changes
This partially reverts commit 617b6728d3
2009-10-31 17:52:26 -07:00
Chris Robinson 9d43907710 Properly free the device name 2009-10-31 13:25:26 -07:00
Chris Robinson a3fcd67a82 Remove some unneeded buffer fields, make padding a constant amount 2009-10-25 08:31:28 -07:00
Chris Robinson fe3a43e2d4 Remove the format and frequency from the source, get them manually 2009-10-25 06:26:19 -07:00
Chris Robinson e095047b02 Small fixups 2009-10-25 06:16:21 -07:00
Chris Robinson 31a106344f Calculate more store only once per loop 2009-10-25 05:34:47 -07:00
Chris Robinson b0a82aa420 Store the buffer format and frequency in the source when updated 2009-10-25 05:03:22 -07:00
Chris Robinson c003d6032d Retreive and store source params once per mix update 2009-10-25 04:39:36 -07:00
Chris Robinson 1665595138 Remove unneeded bufferlistitem properties 2009-10-25 02:59:31 -07:00
Chris Robinson bbccf76b45 Dereference left over buffers and slots when sources are released 2009-10-24 07:09:44 -07:00
Chris Robinson 1f47fa9243 Try 32-bit float before 16-bit, and stereo before mono 2009-10-24 03:20:47 -07:00
Chris Robinson 7b24a12a66 Check for the -pthread switch instead of using _REENTRANT 2009-10-23 10:36:32 -07:00
Chris Robinson 921e7ac3e9 Store the buffer handle directly in the source and buffer queue list 2009-10-22 09:31:26 -07:00
Chris Robinson 8d807add41 Store the bufferID in the buffer struct 2009-10-22 08:53:59 -07:00
Chris Robinson 8501fce38b Remove unused source fields 2009-10-21 15:40:09 -07:00
Chris Robinson 55d7984582 Set the calculated source parameters directly 2009-10-21 15:31:21 -07:00
Chris Robinson 8dbac9c0bd Store the calculated source parameters in the source struct 2009-10-21 14:25:54 -07:00
Chris Robinson 47b8510b0c Don't assume 16-bit samples 2009-10-21 13:50:53 -07:00
Chris Robinson 4e399b41cd Calculate source filter coefficients with the source parameters 2009-10-21 13:08:50 -07:00
Chris Robinson bdec1e037f Remove unnecessary variable 2009-10-21 12:48:04 -07:00
Chris Robinson 9924cce466 Make sure the ALSA device list is reset if no cards are found 2009-10-21 11:53:45 -07:00
Chris Robinson d3ecbd75af Clear the echo and delay lines even if the buffer doesn't change size 2009-10-21 02:03:33 -07:00
Chris Robinson 75b65ab2a2 Remove the Frequency field from the context 2009-10-20 13:47:55 -07:00
Chris Robinson eca8825ab4 Explicitly suspend the context being processed for mixing 2009-10-20 13:38:02 -07:00
Chris Robinson 9f9b7cf885 Make sure the context is properly locked while updating slots and sends 2009-10-20 13:02:28 -07:00
Chris Robinson cd695d7f15 Allow creating multiple contexts on a device 2009-10-20 12:58:19 -07:00
Chris Robinson 9c0ae597cd Make sure the effect slots and source sends are properly updated
Slots need to be updated due to possible frequency changes, and source sends
need to be updated in case some active sends were disabled
2009-10-20 12:53:07 -07:00
Chris Robinson 4461b4c56f Be more tolerant with resetting the fragment size 2009-10-20 12:28:51 -07:00
Chris Robinson 93361118b7 Store a device's contexts in a dynamic array 2009-10-20 11:54:04 -07:00
Chris Robinson 50f963f6c6 Don't try to clamp the listener-to-source velocity for local sources
Local sources will always have a 0 VLS value
2009-10-20 11:03:16 -07:00
Chris Robinson 67c3e47ed4 Avoid handling NaN when scaling float samples for output 2009-10-20 09:48:09 -07:00
Chris Robinson f14cf8289e Add a method to update device-dependant effect parameters.
The effect state's update method will be called afterwards
2009-10-20 08:31:44 -07:00
Chris Robinson 790aa68621 Reduce indentation for CalcSourceParams 2009-10-19 13:25:40 -07:00
Chris Robinson 6d1d61026d Be context-agnostic in the effect Create functions
This allows the effect Update functions to handle the playback frequency being
changed. By default the effects assume a maximum frequency of 192khz, however,
it can go higher at the cost of the sample buffers being cleared and the risk
of an abort() if reallocation fails
2009-10-19 07:46:53 -07:00
Chris Robinson a4e3ca933b EINTR is not a fatal write error 2009-10-19 00:33:00 -07:00
Chris Robinson 1fb58f9f8e Fix OSS and Solaris playback loop check 2009-10-17 22:17:59 -07:00
Chris Robinson 86e0b9386d Remove duplicate check in ALSA mmap playback 2009-10-16 10:57:58 -07:00
Chris Robinson c7c4cf221a Make the dry buffer part of the device 2009-10-09 01:06:33 -07:00
Chris Robinson d6e439244a Rename SetALCError for consistency 2009-10-07 04:32:14 -07:00
Chris Robinson 5ff225fa1b Add missing ) in pulseaudio backend 2009-10-02 07:34:49 -07:00
Chris Robinson 2a77e840cc Fix type casts for 7.1 output 2009-09-30 16:02:49 -07:00
Chris Robinson 00272883f6 Fallback to 16-bit or 8-bit, or mono, if ALSA doesn't accept the request 2009-09-27 08:35:10 -07:00
Chris Robinson bd6f3b1273 Report disconnect if the device fails to reset 2009-09-27 04:58:42 -07:00
Chris Robinson 4e9767bb22 Don't store the ALSA format 2009-09-27 04:03:11 -07:00
Chris Robinson 1d54b7a266 Fix capture, too 2009-09-27 03:57:19 -07:00
Chris Robinson c9506d939a Make sure ALSA properly loads, and fix the thread stop condition 2009-09-27 01:12:42 -07:00
Chris Robinson 21217824b7 Avoid duplicate error handling 2009-09-27 00:58:11 -07:00
Chris Robinson 8024df2991 Load backend libs on-demand 2009-09-27 00:21:40 -07:00
Chris Robinson f72b6fe717 Release 1.9.563 2009-09-26 01:42:21 -07:00
Chris Robinson 8d29d25d60 Condense some local variables 2009-09-24 14:51:40 -07:00
Chris Robinson af8e7ab984 Check the source start position in alSourcePlayv instead of the mixer 2009-09-24 12:24:10 -07:00
Chris Robinson 4289d5de7d Parse the attribute list and reset the device before creating the context 2009-09-24 11:31:01 -07:00
Chris Robinson 83734aff0e Slightly improve the multi-channel mixing loops 2009-09-24 08:52:51 -07:00
Chris Robinson 617b6728d3 Remove the state callbacks and watch for changes synchronously 2009-09-24 00:26:41 -07:00
Chris Robinson 7a8fd6cb20 Get rid of unnecessary messages from pulseaudio 2009-09-23 08:34:15 -07:00
Chris Robinson 55da339586 Properly clean up the pulse device 2009-09-23 08:19:00 -07:00
Chris Robinson 774eae0f2f Silence unused parameter warning 2009-09-23 07:10:23 -07:00
Chris Robinson 201b108a54 Attempt to reload backend libs when probing, if they didn't initially load 2009-09-23 01:33:58 -07:00
Chris Robinson bdbdbcea26 Update in properly-sized chunks for PulseAudio 2009-09-23 01:24:10 -07:00
Chris Robinson f6c1a21cf0 Properly flip the backend entries when sorting the device list 2009-09-22 04:42:46 -07:00
Chris Robinson c953072a15 Fix reset condition check 2009-09-22 00:16:21 -07:00
Chris Robinson 93f3e9357b (Re)allocate and clear the stereo-to-binaural filter as needed 2009-09-21 23:52:59 -07:00
Chris Robinson 8ea8b49464 Avoid locking a NULL context when a device is disconnected 2009-09-21 23:31:04 -07:00
Chris Robinson 62cef44dcb Reinitialize the stereo-to-binaural filter after resetting the device 2009-09-21 23:25:26 -07:00
Chris Robinson a2edc95207 Properly set the number of sends requested by the app 2009-09-21 23:18:39 -07:00
Chris Robinson 4cd41e3e08 Don't allow setting an invalid auxiliary send 2009-09-21 23:09:31 -07:00
Chris Robinson b641f993ac Hide the wave writer device if no output file is set 2009-09-21 05:03:40 -07:00
Chris Robinson e2905b6bc9 Properly handle forced 32-bit float output with DSound 2009-09-21 02:57:17 -07:00
Chris Robinson e11b59a80f Return imediately if trying to set an unknown format 2009-09-21 02:53:33 -07:00
Chris Robinson 0ae02e8ad4 Support floating point capture for backends that can handle it 2009-09-21 02:31:33 -07:00
Chris Robinson 2cbdffab86 Create the ALSA capture ring buffer with the proper size 2009-09-21 02:14:32 -07:00
Chris Robinson 86eefdb2a8 Mix all pending periods at once instead of one at a time 2009-09-20 00:44:39 -07:00
Chris Robinson 750399ccd7 Let verify_state restore from an ALSA underrun 2009-09-20 00:40:23 -07:00
Chris Robinson fb97ca6022 Remove left-over backend-specific period options 2009-09-16 23:29:32 -07:00
Chris Robinson cbcaa54173 Store the number of periods in the device instead of the buffer size
Also keep all the fields in sync
2009-09-16 22:58:54 -07:00
Chris Robinson 94e3fca702 Remove unnecessary parameters, and rename methods 2009-09-16 00:24:44 -07:00
Chris Robinson ffff104554 Restore the device frequency using the stream info 2009-09-16 00:08:11 -07:00
Chris Robinson 307a9dd1b2 Update the frequency with what the stream actually got set with 2009-09-15 23:14:14 -07:00
Chris Robinson 5dff8ea820 Properly terminate PortAudio when closing 2009-09-15 22:45:27 -07:00
Chris Robinson 49648fe22d Make a GetConfigValueBool function and use it 2009-09-15 22:18:13 -07:00
Chris Robinson 9f037e8980 Pass the device to aluMixData 2009-09-15 19:30:27 -07:00
Chris Robinson 12f81bcbb9 Move the stereo-to-binaural filter to the device 2009-09-15 19:06:47 -07:00
Chris Robinson 6636131d3b Pass the frame count to aluMixData 2009-09-15 18:19:00 -07:00
Chris Robinson eeea9631ce Split the source mixing loop into a separate function
Helps reduce the function size and indentation levels
2009-09-15 17:56:31 -07:00
Chris Robinson f9d228c30a Add missing context checks 2009-09-12 20:22:03 -07:00
Chris Robinson d516f8c4bd Update comment 2009-09-12 20:02:45 -07:00
Chris Robinson 5d1c3a0c63 Fix wave writer backend 2009-09-12 19:58:36 -07:00
Chris Robinson 396f2d6050 Mix the proper size for every update, and notify disconnects 2009-09-12 19:36:16 -07:00
Chris Robinson e25b01c3a2 Start Solaris playback when a context is ready 2009-09-12 18:19:52 -07:00
Chris Robinson b29a24afb0 Move the default out-of-tree build dir to build 2009-09-12 17:54:27 -07:00
Chris Robinson d6d1dba3d2 Initialize OpenAL with a constructor call instead of first-use 2009-09-12 17:49:08 -07:00
Chris Robinson 8b36a9d121 Get rid of deinit code duplication 2009-09-12 17:29:35 -07:00
Chris Robinson 59ed9338d8 Add support for the in-progress ALC_EXT_thread_local_context extension 2009-09-12 16:45:46 -07:00
Chris Robinson b444dea63b Fix compilation for Windows 2009-08-28 06:33:59 -07:00
Chris Robinson 1816c8bd37 Make a copy of the default device name for the app
The pointer to it could otherwise change if the device list is rebuilt, which
would be bad if the app has it
2009-08-27 20:13:35 -07:00
Chris Robinson c27948a7ee Don't free a NULL handle 2009-08-27 19:01:12 -07:00
Chris Robinson 832dc8a585 Remove unnecessary vars and rework device name checks 2009-08-27 18:55:18 -07:00
Chris Robinson bb121e68a6 Rebuild device lists when retrieving them 2009-08-27 06:09:33 -07:00
Chris Robinson 1ec26fd789 Dynamically allocate device lists 2009-08-27 03:55:36 -07:00
Chris Robinson 4ff4a7e3b9 Close some libs when deinitializing 2009-08-27 03:12:54 -07:00
Chris Robinson 6bb14e45ce Store a copy of the device name in the device 2009-08-27 02:53:09 -07:00
Chris Robinson 45dc804819 Store copies of the device names in the individual backends 2009-08-27 01:47:41 -07:00
Chris Robinson 81db01ebf1 Add a method to deinitialize backends 2009-08-26 23:45:00 -07:00
Chris Robinson 06c576a945 Support disconnect for OSS and Solaris 2009-08-26 21:49:38 -07:00
Chris Robinson 929b025fd6 Support disconnect for ALSA playback and capture
As a consequence for capture, mmap is no longer supported. Later on, supporting
mmap capture to write directly into the ring buffer is a possibility.
2009-08-26 21:27:10 -07:00
Chris Robinson 7976de05a5 Add base support for ALC_EXT_disconnect
Individual backends need to be updated to handle disconnection events
2009-08-26 19:15:17 -07:00
Chris Robinson 70c88879ab Add ALC_EXT_disconnect to alext.h 2009-08-26 18:29:25 -07:00
Chris Robinson 276ee63b99 Define PATH_MAX if it isn't already 2009-08-19 12:59:40 -07:00
Chris Robinson 487f0dde75 Print source and auxiliary slot debug warnings from alcDestroyContext 2009-08-16 16:11:22 -07:00
Chris Robinson c8f700930a More modifications and fixes for context checks 2009-08-16 16:02:13 -07:00
Chris Robinson decbe4df45 Modify some context checks 2009-08-16 15:09:36 -07:00
Chris Robinson 462f27c129 Use a function to retrieve the current context in an already-locked state
This should help prevent race-conditions with a context being destroyed between
breing retrieved and locked
2009-08-16 14:09:23 -07:00
Chris Robinson 2d1191697a Fix the Solaris backend 2009-08-16 13:16:41 -07:00
Chris Robinson 0b5a0d1e79 Reset the target if the databuffer being deleted is currently selected 2009-08-16 11:12:13 -07:00
Chris Robinson 0b7eb9f118 Add in-progress working extension AL_EXTX_sample_buffer_object 2009-08-16 00:54:08 -07:00
Chris Robinson dc26261065 Support 32-bit float output 2009-08-15 13:20:35 -07:00
Chris Robinson 9bea67fb1c Use a function to convert float to unsigned byte 2009-08-15 11:33:38 -07:00
Chris Robinson 8246bc3418 Use a custom function to get the requested format 2009-08-15 10:32:54 -07:00
Chris Robinson 01e32b58da Fix some size checks 2009-08-15 10:01:55 -07:00
Chris Robinson 9d05ff0468 Verify the device pointer is a valid device 2009-08-15 09:55:08 -07:00
Chris Robinson 510ccc7f17 Store the effect and filter lists in the device 2009-08-15 09:39:18 -07:00
Chris Robinson 43067ed2b8 Store the buffer list in the device 2009-08-15 09:14:08 -07:00
Chris Robinson 4e4c9aef15 Calculate the buffer size and frame size when needed 2009-08-14 13:08:25 -07:00
Chris Robinson 4031ee5ef0 Fix speaker override check 2009-08-14 07:27:19 -07:00
Chris Robinson e079291202 Remove unnecessary function parameters 2009-08-13 19:36:14 -07:00
Chris Robinson 826c641668 Hold the lock while finding a capture device to open 2009-08-13 19:19:16 -07:00
Chris Robinson 6ae845fd9e Don't let the device frequency change when PortAudio gets a new context 2009-08-13 17:13:37 -07:00
Chris Robinson a78fd58dca Create PulseAudio's playback stream when the AL context is created 2009-08-13 17:08:47 -07:00
Chris Robinson a8ae610489 Set context frequency only if it successfully starts 2009-08-13 15:35:10 -07:00
Chris Robinson b86a1e5797 Add a note about app and system defaults 2009-08-13 13:48:06 -07:00
Chris Robinson 45552a68ce Hold the lock while initializing context playback 2009-08-13 13:32:42 -07:00
Chris Robinson d46655fbb2 Support the ALC_FREQUENCY context attribute 2009-08-13 13:28:35 -07:00
Chris Robinson 87fee8c504 Start DSound playback at context creation 2009-08-13 13:11:05 -07:00
Chris Robinson 9ff0617807 Don't clamp the wave writer's update size 2009-08-13 12:35:42 -07:00
Chris Robinson 243939f94f Allow delaying playback start until context creation, and don't use UpdateSize to store the buffer size
This will make it possible to support the context attributes (frequency,
refresh, etc) for some backends
2009-08-13 12:28:46 -07:00
Chris Robinson 739385bd89 Add AL_EXT_BUFFER_DATA_STATIC to alext.h 2009-08-13 10:10:34 -07:00
Chris Robinson 32060f53cd Reset the buffer played count when the queue is removed via the AL_BUFFER property 2009-08-11 14:16:30 -07:00
Chris Robinson 4ee3972f15 Update queued buffer states when source looping is toggled 2009-08-11 07:57:18 -07:00
Chris Robinson 00a9cf4a85 Remove more unneeded variables 2009-07-07 21:11:13 -07:00
Chris Robinson 1dcd538ad9 Remove unneeded variables 2009-07-07 21:01:41 -07:00
Chris Robinson a8973514ba Don't load functions if libpulse failed to open 2009-07-07 12:51:18 -07:00
Chris Robinson 0ac9e57d28 Store the requested mono/stereo source count and sends in the device
Although the properties are set as context attributes, they are queried from
the device. If multiple contexts per device are ever supported, it would not
be straight forward about where to read the values from. This way, the
attributes can be treated as device-specific attributes that are updated when
a new context is created.
2009-07-06 03:09:01 -07:00
Chris Robinson 5460e85c40 Set the right access mode for non-mmap capture 2009-07-02 20:50:12 -07:00
Chris Robinson 432f0ba34c Specify the right format for ALSA recording 2009-07-02 20:32:19 -07:00
Chris Robinson 7e01e53445 Fix parsing of layout configuration string 2009-07-02 20:31:36 -07:00
Chris Robinson 043fe6edd2 Release 1.8.466 2009-06-07 22:30:08 -07:00
Chris Robinson ef68e5d0ff Protect ring buffer access with the lock 2009-06-07 21:34:05 -07:00
Chris Robinson c6f3a4e062 Move a couple inline functions into the header 2009-06-07 20:16:41 -07:00
Chris Robinson 87ed53c7f6 Don't read deprecated config files 2009-06-07 20:12:01 -07:00
Alam Arias 89e9437b84 add check for _WAVEFORMATEXTENSIBLE_ and define _WIN32_IE before inlcuding any header 2009-06-07 19:43:42 -07:00
Chris Robinson 1454c46b5f Use a thread-safe static inline function for printing 2009-06-07 15:42:15 -07:00
Chris Robinson 0fac1e9115 Store the max number of auxiliary slots in the device 2009-06-07 14:53:22 -07:00
Chris Robinson f3a3358e63 Fix for MSVC
MSVC won't accept zero-sized arrays at the end of structs, if that struct is
used in another struct that's not also at the end. This wastes a float for each
FILTER object
2009-06-06 23:33:53 -07:00
Chris Robinson 3c122b0bef Set an error if effect creation fails 2009-05-31 11:54:49 -07:00
Chris Robinson 7940003d06 Set an error if NaN is given for panning values 2009-05-31 11:34:07 -07:00
Chris Robinson 45b16ff456 Use the generic FILTER object for the master effect filter
Also fix a couple comments
2009-05-30 12:54:53 -07:00
Chris Robinson 9341f4f884 Fixup panning gain calculations
Clamp the panning vector magnitude to 1, and use an energy-reduction method as
the vector magnitude increases (to simulate reverb area occlusion)
2009-05-30 00:32:17 -07:00
Chris Robinson 2c20f26784 Apply slot gain on slot output, not input 2009-05-29 16:51:00 -07:00
Chris Robinson 2a21a449b4 Slot gain changes should have an immediate effect 2009-05-29 13:50:58 -07:00
Chris Robinson 74dc7090fd Don't expose effect-specific structures 2009-05-29 13:30:50 -07:00
Chris Robinson e12ac95d69 Use the MIN/MAX/DEFAULT macros for checking and setting the effect parameters 2009-05-29 12:40:08 -07:00
Chris Robinson 34ea7eba9e Add preliminary support for the EAX Reverb effect
Not all parameters are supported yet, though it is a little more fuctional than
standard reverb
2009-05-29 01:32:54 -07:00
Chris Robinson 6d3ba44f55 Don't update the devicevalues before returning success 2009-05-27 07:02:33 -07:00
Chris Robinson 5a8ad67660 Lock the context before getting the mmap region to update 2009-05-26 14:54:59 -07:00
Chris Robinson f1e442408b Set the correct data size 2009-05-26 14:51:57 -07:00
Chris Robinson a946af4463 Simplify ALSA PCM parameter retrieval 2009-05-26 10:08:27 -07:00
Chris Robinson e01cd92d56 Set avail_min so snd_pcm_wait will wait for the full update to be ready 2009-05-26 10:03:17 -07:00
Chris Robinson 923af8c3a6 Don't update the source's gains in the sample mixing loop
Update copies stored on the stack instead, then update the source after mixing
2009-05-26 09:23:49 -07:00
Chris Robinson ac04cf57fa Make sure _CRT_SECURE_NO_WARNINGS is always defined for MSVC 2009-05-26 06:02:40 -07:00
Chris Robinson 1f6c4e01db Properly fall back to non-mmap capture if the parameters fail 2009-05-25 16:06:03 -07:00
Chris Robinson 04135723a2 Get rid of the ugly ok() macro 2009-05-25 13:07:49 -07:00
Chris Robinson 93fbdb1e6c Redo OSS mixing loop 2009-05-25 12:12:37 -07:00
Chris Robinson c1de15f840 Update in descrete amounts using the update size 2009-05-25 12:01:14 -07:00
Chris Robinson 3be399c555 Do not open pulseaudio if it didn't load 2009-05-19 06:37:22 -07:00
Chris Robinson 1f5453075c Dynamically load PulseAudio 2009-05-19 06:35:12 -07:00
Chris Robinson 33a74f1594 Clear the filter history directly 2009-05-17 22:50:07 -07:00
Chris Robinson e4da1224cb Optionally install the sample configuration file 2009-05-17 22:36:45 -07:00
Chris Robinson 5c2a47620c Reformat the sample config file 2009-05-17 22:24:29 -07:00
Chris Robinson 1bfa7609d2 Make the filter functions global inline, and use it for echo 2009-05-16 23:34:26 -07:00
Chris Robinson 7e8501123a Set some common macros in alu.h 2009-05-16 23:26:39 -07:00
Chris Robinson c447eeb2c7 Use the source reference distance to specify full panning magnitude
Sources that are closer than the specified reference distance will not pan to
full magnitude, thus providing a smoother transition as it moves around near
the listener
2009-05-16 03:54:16 -07:00
Chris Robinson ad19cea6e0 Make sure DSSPEAKER_5POINT1 is defined 2009-05-14 05:24:18 -07:00
Chris Robinson 0ce29863e3 Prevent spawning PulseAudio if it's not already running 2009-05-06 00:19:35 -07:00
Chris Robinson 7a7a4844f4 Make the filter history buffer size flexible
This lets the filter history buffer be as big as needed for a given use, so
that it can have a size large enough for the more demanding cases, but not be
wasteful for lesser-demanding cases, while not incuring the overhead of an
added pointer indirection
2009-04-16 05:43:09 -07:00
Chris Robinson a2adbb1ab5 Add a PulseAudio backend 2009-04-16 05:17:42 -07:00
Chris Robinson a97fc792d8 Increase the default maximum number of sends to 2 2009-04-14 22:18:47 -07:00
Chris Robinson e9a6a1d6f5 Use a 2-pole filter for the wet path low-pass filter
This should help keep CPU use from increasing a lot when the number of sends
increases. Also changes the function names to reflect the difference
2009-04-14 22:04:18 -07:00
Chris Robinson f245f0ef87 Make the number of source sends variable
The highest value is clamped to MAX_SENDS
2009-04-13 20:33:41 -07:00
Chris Robinson a30f431b63 Reduce the number of send loops 2009-04-13 02:50:40 -07:00
Chris Robinson 58f48f20e2 Rename Standard Reverb to Reverb 2009-04-13 02:01:21 -07:00
Chris Robinson ee1b02b709 Fix comment regarding the 3rd echo tap 2009-04-12 18:54:26 -07:00
Chris Robinson 55c790c9ff Add the Echo effect 2009-04-12 16:01:10 -07:00
Chris Robinson 65b69f3308 Fix air absorption 2009-04-11 20:27:55 -07:00
Chris Robinson c67fbd72dd Pay attention to the MAX_SENDS value 2009-04-11 20:04:46 -07:00
Chris Robinson 30f57d0824 Make auxiliary effect slot count configurable 2009-04-11 18:16:05 -07:00
Chris Robinson 1c54018111 Move the WetBuffer into the effect slot object
This should make it easier to support multiple slots
2009-04-11 17:04:55 -07:00
Chris Robinson e80e1b6d9f Use LIB_SUFFIX when creating the default lib install dir
Thanks to Hanno Böck for pointing this out
2009-04-07 12:11:41 -07:00
Chris Robinson 437f00d6de Add missing comment markers 2009-04-07 11:41:41 -07:00
Chris Robinson fc6d6b1601 Use the square of the values when calculating the density gain 2009-03-21 10:42:42 -07:00
Chris Robinson 9306e36d52 Make sure M_PI is defined for reverb 2009-03-15 23:14:40 -07:00
Chris Robinson 61122a5093 Release 1.7.411 2009-03-14 22:24:59 -07:00
Chris Robinson a8a4ff8af1 Constify some parameters 2009-03-13 23:08:15 -07:00
Chris Robinson 8a857c35ee Calculate filter coefficients in aluMixData 2009-03-13 22:58:54 -07:00
Chris Robinson 89ddd7d8e5 Don't modify the device struct until playback succesfully starts 2009-03-13 22:16:01 -07:00
Chris Robinson 8d0c4ccb3b The room rolloff factor can go up to 10 2009-03-13 02:12:45 -07:00
Chris Robinson 8ee47d5573 Dynamically load dsound when possible 2009-03-10 02:46:42 -07:00
Chris Robinson 9e88011417 Add a cast for setting a dummy pointer value 2009-03-10 02:20:05 -07:00
Chris Robinson f8949ee7a1 Always add the default ALSA device even if no cards are present 2009-03-10 01:46:51 -07:00
Chris Robinson 62aa2d0ba7 Only expose the default ALSA device in standard enumeration 2009-03-10 01:28:01 -07:00
Chris Robinson ace047d625 Append the card and device indices to the ALSA device strings 2009-03-10 01:21:42 -07:00
Chris Robinson d6277db209 Fix alsoftrc configuration sample comments 2009-03-10 01:08:03 -07:00
Chris Robinson 7ebb28327f Remove the SDL backend 2009-03-10 01:03:39 -07:00
Chris Robinson 86931cbde4 Add a PortAudio backend 2009-03-10 00:55:29 -07:00
Chris Robinson 6d7be151dc Remove the unneeded path from the cross-compiler commands 2009-03-06 20:09:44 -08:00
Chris Robinson 07227b9806 Use a modified reverb model that obeys the reverb parameters better 2009-03-02 18:48:23 -08:00
Chris Robinson 8348d719cd Clamp gain of multichannel sources 2009-02-10 15:15:49 -08:00
Chris Robinson 0fcefd865b Install the pkgconfig file to the correct directory 2009-02-10 14:39:48 -08:00
Chris Robinson 57c2e9b5f8 Include assert.h for assert() 2009-02-02 11:18:33 -08:00
Chris Robinson 7d7fc39035 Use calculated distance from reference for air absorption 2009-01-30 10:56:25 -08:00
Chris Robinson 351105b3df Fix incorrect comment 2009-01-30 10:53:09 -08:00
Chris Robinson cbfc33215b Use M_PI since it is sure to be defined 2009-01-27 07:11:58 -08:00
Chris Robinson 5a93b56673 Fix ignored return value warning 2009-01-26 08:10:05 -08:00
Chris Robinson 1f4c69c17a Use a matrix for up- and down-mixing channels 2009-01-25 22:11:07 -08:00
Chris Robinson f5b19fad20 Duplicate stereo onto the side channels as well as the back 2009-01-25 19:54:50 -08:00
Chris Robinson bc60818e9a Don't read stereo layout when output is mono 2009-01-25 19:33:52 -08:00
Chris Robinson f82c88f016 Add options for user-configurable speaker arrangements 2009-01-25 19:20:47 -08:00
Chris Robinson 98e86decad 6.1 uses front- and back-center, not left- and right-back channels 2009-01-24 15:13:14 -08:00
Chris Robinson aaf2c0ebd4 Seperate mixing loops depending on source channel configuration 2009-01-24 13:57:01 -08:00
Chris Robinson 778b74cae1 Reimplement panning using lookup tables, based on a patch by Christian Borss
This allows speaker positions to be specified by discrete angles around the
listener, providing more flexibility and configurability in placement.
Additional patches to take advantage of this are forthcoming.
2009-01-24 10:38:04 -08:00
Chris Robinson 43ee1edd97 Properly capitalize the libname in Win32 2009-01-10 21:23:53 -08:00
Chris Robinson dd7e23740b Remove XCOMPILEWIN32 option in favor of CMake 2.6's cross-compiling caps 2008-12-12 11:19:38 -08:00
Chris Robinson 1acd6da745 Search for SDL.h in addition to SDL/SDL.h 2008-12-12 11:09:23 -08:00
Chris Robinson 3056f91ec5 Apply the dry filter to multi-channel sources
Unlike mono sources, they use 2 chained one-pole filters instead of 4
2008-12-10 11:54:13 -08:00
Chris Robinson ed03570e1a Fix some CMake checks 2008-12-07 02:20:17 -08:00
Chris Robinson 2ec0e48d06 Protect playback device opening with a mutex lock 2008-12-07 01:07:54 -08:00
Chris Robinson 8b54d59b8c Add an SDL backend 2008-12-07 01:05:39 -08:00
Chris Robinson f6a4dbabdd Add cast for setting a dummy pointer value 2008-12-06 12:17:29 -08:00
Chris Robinson a71c291bcb Let CMAKE_DEBUG_POSTFIX be exposed for graphical CMake front-ends 2008-12-02 02:37:51 -08:00
Chris Robinson 55b9ccc2de Implement AL_EXTX_source_distance_model
As with other EXTX extensions, this is subject to change and removal as the
spec gets worked on
2008-11-25 18:56:10 -08:00
Chris Robinson 67d67a3bf6 Release 1.6.372 2008-11-21 09:16:29 -08:00
Chris Robinson 591de1ecb4 Wait until one full fragment is empty before mixing 2008-11-21 07:52:13 -08:00
Chris Robinson 3dad17c263 Make the DSound emulated fragment count configurable 2008-11-21 07:48:03 -08:00
Chris Robinson eefc18170d Fix a comment 2008-11-20 10:09:37 -08:00
Chris Robinson 5f84c5339d Fix early reflection input 2008-11-19 09:14:40 -08:00
Chris Robinson 2d461379ef Handle ALSA capture errors a bit better 2008-11-19 09:01:03 -08:00
Chris Robinson c8123756ff Simplify in-sample low-pass filter coefficient calculation 2008-11-18 06:35:00 -08:00
Chris Robinson 76c7789ee7 Fix low-pass coefficient calculation 2008-11-18 04:31:24 -08:00
Chris Robinson 13a2e6ef1f Don't calculate reverb HF limit if air absorption is 1 2008-11-18 03:26:02 -08:00
Chris Robinson 0ecb34b850 Non-cross-compiled DLLs shouldn't have lib prefixed 2008-11-18 03:24:49 -08:00
Chris Robinson 1f86c48d95 Remove outdated comments and add copyright header 2008-11-17 09:32:25 -08:00
Chris Robinson 7e1295df9a DirectSound is not explicitly dependant on windows.h 2008-11-16 04:39:12 -08:00
Chris Robinson 482b160c8a Remove unneeded macro 2008-11-16 01:07:39 -08:00
Chris Robinson 181eb95b13 Use a better dB-to-linear gain convertion 2008-11-16 00:57:35 -08:00
Chris Robinson c0ccd31a3e Implement a new reverb effect
Code created and graciously provided by Christopher Fitzgerald
2008-11-16 00:29:49 -08:00
Chris Robinson d72b132c57 Add an option to disable specific EFX effect types 2008-11-14 07:13:59 -08:00
Chris Robinson 506912aed7 Add cross-compiling option 2008-11-13 23:13:15 -08:00
Chris Robinson 670d70d3c9 Allow specifying another config file with the ALSOFT_CONF env var 2008-11-13 07:58:39 -08:00
Chris Robinson 010f7d12f4 Don't ramp gains when starting a sound from the beginning 2008-11-13 05:48:38 -08:00
Chris Robinson da684564ea Avoid unnecessary floating-point math 2008-11-11 17:59:55 -08:00
Chris Robinson fc4c867f27 Add initial AL_EXTX_buffer_sub_data support
Note that this is an in-development extension, as noted by the EXTX moniker
instead of EXT. It's behavior is subject to change, and the extension string
will be removed (replaced with the official string once it's finalized).
Developers are discouraged from using this in production code, though feel
free to play around with it.
2008-11-11 05:57:32 -08:00
Chris Robinson 9ba30c4e20 Fix Win32 thread handle leak 2008-11-05 19:42:56 -08:00
Chris Robinson 15334e56cd Be more flexible with channel count when loading IMA4 data 2008-11-02 15:30:56 -08:00
Chris Robinson ffa42ff22c Seperate data converters into reusable functions 2008-11-02 01:24:57 -07:00
Chris Robinson a7c62dbabc More padding fixes 2008-11-01 16:37:32 -07:00
Chris Robinson eda1e41152 More buffer conversion refactoring 2008-11-01 16:35:16 -07:00
Chris Robinson af5a5b76ec Padding is not dependant on the frequency cutoff anymore 2008-10-31 23:32:28 -07:00
Chris Robinson 87f3a0dc16 Restructure buffer data conversion code a bit 2008-10-31 22:13:35 -07:00
Chris Robinson 2c80a80704 Fix typo preventing capture from opening 2008-10-27 23:37:56 -07:00
Chris Robinson 301a4c4a95 Append the driver and its version to the AL version string 2008-10-25 15:48:17 -07:00
Chris Robinson 8fc4a3b724 Make sure an appropriate error is set when opening a device fails 2008-10-24 19:58:49 -07:00
Chris Robinson cb6f040005 Use plughw for capture so ALSA can convert capture data 2008-10-14 09:50:37 -07:00
Chris Robinson b91c2e4a99 Include float.h if it exists, for _RC_CHOP and _MCW_RC 2008-10-14 09:47:32 -07:00
Chris Robinson 59a71b1454 Remove another unused source member 2008-10-10 01:31:31 -07:00
Chris Robinson 36f133a5ae Use a modulo to keep the buffer position in range for looping sources
A high pitch and low buffer size can cause a lot of unnecessary iterations
otherwise, that just decrement the position
2008-10-10 01:13:32 -07:00
Chris Robinson 74a58c0d09 Clamp source position to the buffer size when it stops 2008-10-09 23:54:31 -07:00
Chris Robinson bfa1107781 Remove unneeded source member variable 2008-10-09 23:44:48 -07:00
Chris Robinson 11397f7667 Commit missing changes 2008-10-09 20:58:12 -07:00
Chris Robinson 6e9e8239ef Only send one channel through the wet path 2008-10-09 04:02:34 -07:00
Chris Robinson af9932d28b Increase max pitch to 65536
This should be safe now
2008-10-09 02:50:00 -07:00
Chris Robinson 87ff8a65e9 Simplify the lerp function 2008-10-09 02:32:47 -07:00
Chris Robinson 7b6f207790 Don't apply the wet path for multi-channel buffers 2008-10-09 02:28:52 -07:00
Chris Robinson 8672008e43 Skip mixing if the read position is beyond the end of the buffer 2008-10-09 01:17:39 -07:00
Chris Robinson c8cd193346 The wet path should be silent if no effect is set on the slot 2008-10-09 01:07:02 -07:00
Chris Robinson be292e5f0b Don't hold the whole-number position in the fractional value
This will help prevent overflows when the max pitch is increased
2008-10-02 23:53:46 -07:00
Chris Robinson 3863dcc9cb Use a new low-pass filter, based on the I3DL2 spec
Many thanks to Christopher Fitzgerald, for helping with it
2008-10-02 22:20:42 -07:00
Chris Robinson a2568409fc Implement non-mmap ALSA capture 2008-09-29 17:24:50 -07:00
Chris Robinson 6567cdd7b5 Air absorption factor is applied to the dB value, not linear gain 2008-09-22 17:01:47 -07:00
Chris Robinson 5bbf55a401 Add a variable to override the default library type with 2008-09-16 07:43:38 -07:00
Chris Robinson 4a530e2146 Fixup some source parameter calculations 2008-09-16 07:36:48 -07:00
Chris Robinson 27ba8f7b60 Fix function pointer declarations 2008-09-16 06:19:27 -07:00
Chris Robinson 6bfdb57a5b Use a 12dB/oct rolloff instead of 24 for the lowpass filter 2008-09-13 02:46:14 -07:00
Chris Robinson 26e8ea60a5 Store pi as a static const 2008-09-13 00:44:48 -07:00
Chris Robinson f4ea188ffa Fix typo to get the proper minor ALC version 2008-09-12 18:07:12 -07:00
Chris Robinson 1266580420 Print EFX info when the extension is available 2008-09-12 18:05:23 -07:00
Chris Robinson 16d96eed7b Add a Solaris playback backend 2008-09-07 14:34:14 -07:00
Chris Robinson fa76168683 Clear the end of the buffer when at the end of the queue and not looping 2008-09-06 14:08:53 -07:00
Chris Robinson 5f3329b2c9 Don't export extension function symbols from the lib 2008-09-06 13:45:27 -07:00
Chris Robinson db541f3cfa Remove unneeded source struct member 2008-08-15 17:43:07 -07:00
Chris Robinson 3e19ba6ca8 Clear channel volumes when starting a source 2008-08-15 16:33:47 -07:00
Chris Robinson ac8c082b89 Overwrite the input wet sample with the output 2008-08-14 20:44:55 -07:00
Chris Robinson 084df2a229 Allow setting the EFX doppler factor source property 2008-08-14 16:14:16 -07:00
Chris Robinson 22557070ec Ramp channel gains to remove pops and clicks from abrupt changes
Thanks to Christopher Fitzgerald for helping me work on it
2008-08-14 05:43:52 -07:00
Chris Robinson f8ef66954c Include fenv.h if it exists for fesetround 2008-08-08 08:12:41 -07:00
Chris Robinson ef59901e7c Set FPU mode to round toward zero for mixing 2008-08-08 07:32:21 -07:00
Chris Robinson cfe620ccb5 Remove unnecessary casting 2008-08-08 00:21:25 -07:00
Chris Robinson 453b015225 Prevent a 0 or negative increment for the buffer position
Thanks to Christopher Fitzgerald for pointing these last two problems out
2008-08-05 20:51:30 -07:00
Chris Robinson c1cf9ae8f6 Pass a dummy variable to CreateThread to satisfy Win9x 2008-08-05 20:19:13 -07:00
Chris Robinson f1414c650e Release 1.5.304 2008-07-27 19:58:32 -07:00
Chris Robinson 869b041f2f Reduce the default buffer size to 4096
Should help with latency issues some people have and not put too much extra
burden on the mixer, hopefully
2008-07-26 21:07:08 -07:00
Chris Robinson 8621fbb015 Improve getting and setting EFX filter parameters 2008-07-26 18:32:45 -07:00
Chris Robinson 597e01153e Use arrays instead of pointer-to-arrays for the low-pass filter 2008-07-26 17:13:50 -07:00
Chris Robinson d3e5fcd13e Fix some calculations for the reverb buffer 2008-07-26 01:57:04 -07:00
Chris Robinson 3e0f9cc716 Make the filter processing function inline 2008-07-26 00:58:54 -07:00
Chris Robinson c7e49c9f57 Implement yet another low-pass filter
This one using the Butterworth IIR filter design
2008-07-25 19:31:12 -07:00
Chris Robinson e2ed8ff2bf Use a temp pointer when realloc()ing
So the original data isn't lost on out-of-memory conditions
2008-07-24 13:44:26 -07:00
Chris Robinson 559c786d0c Specify padding per buffer, and make sure it's large enough for the filter step 2008-07-24 00:41:25 -07:00
Chris Robinson c3a7480961 Don't advertise extra samples for mixing 2008-07-23 23:27:38 -07:00
Chris Robinson a75e75aef5 Implement an alternative low-pass filter
This method samples from the buffer so that it gets a time-correct 5khz stream,
which is subtracted from the original sample and has the high-frequency gain
applied, then added back.
A better method may be to average all the samples from the current one to the
one freq/5000 away, instead of bilinear filtering the two nearest freq/5000
apart. Processing cost will need to determine its viability
2008-07-23 22:29:53 -07:00
Chris Robinson d45b1207d0 Make sure the correct libname is used for pkg-config 2008-07-23 11:58:36 -07:00
Chris Robinson 5a9e24dea1 Add a warning when building on Windows with the DSound backend disabled 2008-07-23 00:51:55 -07:00
Chris Robinson dc8132e965 Add a pkg-config file to install on the system 2008-07-22 18:42:53 -07:00
Chris Robinson 20bcdc1ef6 Add AL_LOKI_IMA_ADPCM_format and AL_EXT_vorbis tokens to alext.h 2008-07-22 14:45:31 -07:00
Chris Robinson 93c0f61050 Clarify implicit destruction warnings 2008-07-22 14:29:27 -07:00
Chris Robinson 3a8c543f8b Move ALC_ENUMERATE_ALL_EXT tokens to alext.h 2008-07-22 13:50:08 -07:00
Chris Robinson 9e96156451 Add AL_LOKI_WAVE_format tokens to alext.h 2008-07-22 13:45:26 -07:00
Chris Robinson 19aabd6d02 Add ALC_LOKI_audio_channel tokens to alext.h 2008-07-22 13:16:58 -07:00
Chris Robinson 87b5d7bc7b Store extension list with a pointer, not a per-context array 2008-07-22 12:39:10 -07:00
Chris Robinson 646714b585 Set the new linking policy for CMake 2.6 to avoid warnings 2008-07-22 11:26:56 -07:00
Chris Robinson eba60c30c5 Don't force initialization when shutting down
Thanks to Michael Simms
2008-07-17 18:45:21 -07:00
Chris Robinson e66bb09156 Move (de)initialization into ALc.c and remove unneeded file 2008-07-17 18:38:07 -07:00
Chris Robinson 0042b1f80d Implement doppler factor source property 2008-07-15 02:33:05 -07:00
Chris Robinson 6d416ee734 Add the reverb room rolloff to the source room rolloff, not override 2008-07-15 02:23:53 -07:00
Chris Robinson 97d3a45aff Don't check the number of objects being deleted with the number currently allocated
Since apps can validly delete buffer 0, and delete the same source/buffer multiple times in a single call
2008-07-11 09:12:11 -07:00
Chris Robinson 9e9ff44b17 Use volatile for member variables that are changed in a different thread 2008-07-10 20:36:28 -07:00
Chris Robinson f369be148f Reduce the mix buffer sizes by half
Nearly 3MB is a bit much. Could reduce it further, but this is good enough for now.
2008-07-08 19:37:14 -07:00
Chris Robinson 3a09e446b3 Leave SourceToListener untransformed for use with untransformed velocities
Distance is also left untransformed so cone calculations with SoundToListener
are correct
2008-07-03 03:13:43 -07:00
Chris Robinson 2d0b12e49e Store thread return value in the struct to avoid void*-to-uint casting 2008-06-17 19:46:37 -07:00
Chris Robinson 55e2f294ac Allow for overriding the default lib destination with LIB_INSTALL_DIR
So 64-bit builds can be optionally redirected to lib64
2008-06-06 18:39:18 -07:00
Chris Robinson 2a4b467f08 Make the project explicitly C
So it doesn't search for an unneeded C++ compiler
2008-06-06 18:33:13 -07:00
Chris Robinson 2ae9da696a Release 1.4.272 2008-06-04 20:47:20 -07:00
Chris Robinson 376997c3ef Fix config value check 2008-06-04 20:44:51 -07:00
49 changed files with 1577 additions and 16159 deletions
+9 -1
View File
@@ -1 +1,9 @@
CMakeConf
build*/
winbuild
win64build
## kdevelop
*.kdev4
## qt-creator
CMakeLists.txt.user*
-1267
View File
File diff suppressed because it is too large Load Diff
-1169
View File
File diff suppressed because it is too large Load Diff
-318
View File
@@ -1,318 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "alMain.h"
#ifdef _WIN32
#define _WIN32_IE 0x400
#include <shlobj.h>
#endif
typedef struct ConfigEntry {
char *key;
char *value;
} ConfigEntry;
typedef struct ConfigBlock {
char *name;
ConfigEntry *entries;
size_t entryCount;
} ConfigBlock;
static ConfigBlock *cfgBlocks;
static size_t cfgCount;
static char buffer[1024];
static void LoadConfigFromFile(FILE *f)
{
ConfigBlock *curBlock = cfgBlocks;
ConfigEntry *ent;
while(fgets(buffer, sizeof(buffer), f))
{
size_t i = 0;
while(isspace(buffer[i]))
i++;
if(!buffer[i] || buffer[i] == '#')
continue;
memmove(buffer, buffer+i, strlen(buffer+i)+1);
if(buffer[0] == '[')
{
ConfigBlock *nextBlock;
i = 1;
while(buffer[i] && buffer[i] != ']')
i++;
if(!buffer[i])
{
AL_PRINT("config parse error: bad line \"%s\"\n", buffer);
continue;
}
buffer[i] = 0;
do {
i++;
if(buffer[i] && !isspace(buffer[i]))
{
if(buffer[i] != '#')
AL_PRINT("config warning: extra data after block: \"%s\"\n", buffer+i);
break;
}
} while(buffer[i]);
nextBlock = NULL;
for(i = 0;i < cfgCount;i++)
{
if(strcasecmp(cfgBlocks[i].name, buffer+1) == 0)
{
nextBlock = cfgBlocks+i;
// AL_PRINT("found block '%s'\n", nextBlock->name);
break;
}
}
if(!nextBlock)
{
nextBlock = realloc(cfgBlocks, (cfgCount+1)*sizeof(ConfigBlock));
if(!nextBlock)
{
AL_PRINT("config parse error: error reallocating config blocks\n");
continue;
}
cfgBlocks = nextBlock;
nextBlock = cfgBlocks+cfgCount;
cfgCount++;
nextBlock->name = strdup(buffer+1);
nextBlock->entries = NULL;
nextBlock->entryCount = 0;
// AL_PRINT("found new block '%s'\n", nextBlock->name);
}
curBlock = nextBlock;
continue;
}
/* Look for the option name */
i = 0;
while(buffer[i] && buffer[i] != '#' && buffer[i] != '=' &&
!isspace(buffer[i]))
i++;
if(!buffer[i] || buffer[i] == '#' || i == 0)
{
AL_PRINT("config parse error: malformed option line: \"%s\"\n", buffer);
continue;
}
/* Seperate the option */
if(buffer[i] != '=')
{
buffer[i++] = 0;
while(isspace(buffer[i]))
i++;
if(buffer[i] != '=')
{
AL_PRINT("config parse error: option without a value: \"%s\"\n", buffer);
continue;
}
}
/* Find the start of the value */
buffer[i++] = 0;
while(isspace(buffer[i]))
i++;
/* Check if we already have this option set */
ent = curBlock->entries;
while((size_t)(ent-curBlock->entries) < curBlock->entryCount)
{
if(strcasecmp(ent->key, buffer) == 0)
break;
ent++;
}
if((size_t)(ent-curBlock->entries) >= curBlock->entryCount)
{
/* Allocate a new option entry */
ent = realloc(curBlock->entries, (curBlock->entryCount+1)*sizeof(ConfigEntry));
if(!ent)
{
AL_PRINT("config parse error: error reallocating config entries\n");
continue;
}
curBlock->entries = ent;
ent = curBlock->entries + curBlock->entryCount;
curBlock->entryCount++;
ent->key = strdup(buffer);
ent->value = NULL;
}
/* Look for the end of the line (Null term, new-line, or #-symbol) and
eat up the trailing whitespace */
memmove(buffer, buffer+i, strlen(buffer+i)+1);
i = 0;
while(buffer[i] && buffer[i] != '#' && buffer[i] != '\n')
i++;
do {
i--;
} while(isspace(buffer[i]));
buffer[++i] = 0;
free(ent->value);
ent->value = strdup(buffer);
// AL_PRINT("found '%s' = '%s'\n", ent->key, ent->value);
}
}
void ReadALConfig(void)
{
FILE *f;
cfgBlocks = calloc(1, sizeof(ConfigBlock));
cfgBlocks->name = strdup("general");
cfgCount = 1;
#ifdef _WIN32
if(SHGetSpecialFolderPathA(NULL, buffer, CSIDL_APPDATA, FALSE) != FALSE)
{
int p = strlen(buffer);
snprintf(buffer+p, sizeof(buffer)-p, "\\alsoft.ini");
f = fopen(buffer, "rt");
if(f)
{
LoadConfigFromFile(f);
fclose(f);
}
}
#else
f = fopen("/etc/openal/alsoft.conf", "r");
if(!f)
{
f = fopen("/etc/openal/config", "r");
if(f)
AL_PRINT("Reading /etc/openal/config; this file is deprecated\n"
"\tPlease rename it to /etc/openal/alsoft.conf\n");
}
if(f)
{
LoadConfigFromFile(f);
fclose(f);
}
if(getenv("HOME") && *(getenv("HOME")))
{
snprintf(buffer, sizeof(buffer), "%s/.alsoftrc", getenv("HOME"));
f = fopen(buffer, "r");
if(!f)
{
snprintf(buffer, sizeof(buffer), "%s/.openalrc", getenv("HOME"));
f = fopen(buffer, "r");
if(f)
AL_PRINT("Reading ~/.openalrc; this file is deprecated\n"
"\tPlease rename it to ~/.alsoftrc\n");
}
if(f)
{
LoadConfigFromFile(f);
fclose(f);
}
}
#endif
}
void FreeALConfig(void)
{
size_t i;
for(i = 0;i < cfgCount;i++)
{
size_t j;
for(j = 0;j < cfgBlocks[i].entryCount;j++)
{
free(cfgBlocks[i].entries[j].key);
free(cfgBlocks[i].entries[j].value);
}
free(cfgBlocks[i].entries);
free(cfgBlocks[i].name);
}
free(cfgBlocks);
cfgBlocks = NULL;
cfgCount = 0;
}
const char *GetConfigValue(const char *blockName, const char *keyName, const char *def)
{
size_t i, j;
if(keyName)
{
if(!blockName)
blockName = "general";
for(i = 0;i < cfgCount;i++)
{
if(strcasecmp(cfgBlocks[i].name, blockName) != 0)
continue;
for(j = 0;j < cfgBlocks[i].entryCount;j++)
{
if(strcasecmp(cfgBlocks[i].entries[j].key, keyName) == 0)
return cfgBlocks[i].entries[j].value;
}
}
}
return def;
}
int GetConfigValueInt(const char *blockName, const char *keyName, int def)
{
const char *val = GetConfigValue(blockName, keyName, "");
if(!val[0]) return def;
return strtol(val, NULL, 0);
}
float GetConfigValueFloat(const char *blockName, const char *keyName, float def)
{
const char *val = GetConfigValue(blockName, keyName, "");
if(!val[0]) return def;
#ifdef HAVE_STRTOF
return strtof(val, NULL);
#else
return (float)strtod(val, NULL);
#endif
}
-123
View File
@@ -1,123 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <string.h>
#include <stdlib.h>
#include "alMain.h"
struct RingBuffer {
ALubyte *mem;
ALsizei frame_size;
ALsizei length;
ALint read_pos;
ALint write_pos;
CRITICAL_SECTION cs;
};
RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length)
{
RingBuffer *ring = calloc(1, sizeof(*ring));
if(ring)
{
ring->frame_size = frame_size;
ring->length = length+1;
ring->write_pos = 1;
ring->mem = malloc((length+1)*frame_size);
if(!ring->mem)
{
free(ring);
ring = NULL;
}
InitializeCriticalSection(&ring->cs);
}
return ring;
}
void DestroyRingBuffer(RingBuffer *ring)
{
if(ring)
{
DeleteCriticalSection(&ring->cs);
free(ring->mem);
free(ring);
}
}
ALsizei RingBufferSize(RingBuffer *ring)
{
ALsizei s;
EnterCriticalSection(&ring->cs);
s = (ring->write_pos-ring->read_pos-1+ring->length) % ring->length;
LeaveCriticalSection(&ring->cs);
return s;
}
void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len)
{
int remain = ring->length - ring->write_pos;
EnterCriticalSection(&ring->cs);
if((ring->read_pos-ring->write_pos+ring->length)%ring->length < len)
ring->read_pos = (ring->write_pos+len) % ring->length;
if(remain < len)
{
memcpy(ring->mem+(ring->write_pos*ring->frame_size), data, remain*ring->frame_size);
memcpy(ring->mem, data+(remain*ring->frame_size), (len-remain)*ring->frame_size);
}
else
memcpy(ring->mem+(ring->write_pos*ring->frame_size), data, len*ring->frame_size);
ring->write_pos += len;
ring->write_pos %= ring->length;
LeaveCriticalSection(&ring->cs);
}
void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len)
{
int remain = ring->length - ring->read_pos;
EnterCriticalSection(&ring->cs);
if(remain < len)
{
memcpy(data, ring->mem+(ring->read_pos*ring->frame_size), remain*ring->frame_size);
memcpy(data+(remain*ring->frame_size), ring->mem, (len-remain)*ring->frame_size);
}
else
memcpy(data, ring->mem+(ring->read_pos*ring->frame_size), len*ring->frame_size);
ring->read_pos += len;
ring->read_pos %= ring->length;
LeaveCriticalSection(&ring->cs);
}
-125
View File
@@ -1,125 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include "alMain.h"
#include "alThunk.h"
#ifdef _WIN32
typedef struct {
ALuint (*func)(ALvoid*);
ALvoid *ptr;
HANDLE thread;
} ThreadInfo;
static DWORD CALLBACK StarterFunc(void *ptr)
{
ThreadInfo *inf = (ThreadInfo*)ptr;
ALint ret;
ret = inf->func(inf->ptr);
ExitThread((DWORD)ret);
return (DWORD)ret;
}
ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr)
{
ThreadInfo *inf = malloc(sizeof(ThreadInfo));
if(!inf) return 0;
inf->func = func;
inf->ptr = ptr;
inf->thread = CreateThread(NULL, 0, StarterFunc, inf, 0, NULL);
if(!inf->thread)
{
free(inf);
return NULL;
}
return inf;
}
ALuint StopThread(ALvoid *thread)
{
ThreadInfo *inf = thread;
DWORD ret = 0;
WaitForSingleObject(inf->thread, INFINITE);
GetExitCodeThread(inf->thread, &ret);
free(inf);
return (ALuint)ret;
}
#else
#include <pthread.h>
typedef struct {
ALuint (*func)(ALvoid*);
ALvoid *ptr;
pthread_t thread;
} ThreadInfo;
static void *StarterFunc(void *ptr)
{
ThreadInfo *inf = (ThreadInfo*)ptr;
ALint ret;
ret = inf->func(inf->ptr);
return (void*)ret;
}
ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr)
{
ThreadInfo *inf = malloc(sizeof(ThreadInfo));
if(!inf) return 0;
inf->func = func;
inf->ptr = ptr;
if(pthread_create(&inf->thread, NULL, StarterFunc, inf) != 0)
{
free(inf);
return NULL;
}
return inf;
}
ALuint StopThread(ALvoid *thread)
{
ThreadInfo *inf = thread;
void *ret;
pthread_join(inf->thread, &ret);
free(inf);
return (ALuint)ret;
}
#endif
-908
View File
@@ -1,908 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include "alMain.h"
#include "AL/al.h"
#include "AL/alc.h"
#include <alsa/asoundlib.h>
typedef struct {
snd_pcm_t *pcmHandle;
snd_pcm_format_t format;
ALvoid *buffer;
ALsizei size;
int killNow;
ALvoid *thread;
} alsa_data;
typedef struct {
ALCchar *name;
int card, dev;
} DevMap;
static void *alsa_handle;
#define MAKE_FUNC(f) static typeof(f) * p##f
MAKE_FUNC(snd_strerror);
MAKE_FUNC(snd_pcm_open);
MAKE_FUNC(snd_pcm_close);
MAKE_FUNC(snd_pcm_nonblock);
MAKE_FUNC(snd_pcm_frames_to_bytes);
MAKE_FUNC(snd_pcm_hw_params_malloc);
MAKE_FUNC(snd_pcm_hw_params_free);
MAKE_FUNC(snd_pcm_hw_params_any);
MAKE_FUNC(snd_pcm_hw_params_set_access);
MAKE_FUNC(snd_pcm_hw_params_set_format);
MAKE_FUNC(snd_pcm_hw_params_set_channels);
MAKE_FUNC(snd_pcm_hw_params_set_periods_near);
MAKE_FUNC(snd_pcm_hw_params_set_rate_near);
MAKE_FUNC(snd_pcm_hw_params_set_rate);
MAKE_FUNC(snd_pcm_hw_params_set_buffer_size_near);
MAKE_FUNC(snd_pcm_hw_params_set_buffer_size_min);
MAKE_FUNC(snd_pcm_hw_params_get_period_size);
MAKE_FUNC(snd_pcm_hw_params_get_access);
MAKE_FUNC(snd_pcm_hw_params);
MAKE_FUNC(snd_pcm_prepare);
MAKE_FUNC(snd_pcm_start);
MAKE_FUNC(snd_pcm_resume);
MAKE_FUNC(snd_pcm_wait);
MAKE_FUNC(snd_pcm_state);
MAKE_FUNC(snd_pcm_avail_update);
MAKE_FUNC(snd_pcm_areas_silence);
MAKE_FUNC(snd_pcm_mmap_begin);
MAKE_FUNC(snd_pcm_mmap_commit);
MAKE_FUNC(snd_pcm_writei);
MAKE_FUNC(snd_pcm_drain);
MAKE_FUNC(snd_pcm_info_malloc);
MAKE_FUNC(snd_pcm_info_free);
MAKE_FUNC(snd_pcm_info_set_device);
MAKE_FUNC(snd_pcm_info_set_subdevice);
MAKE_FUNC(snd_pcm_info_set_stream);
MAKE_FUNC(snd_pcm_info_get_name);
MAKE_FUNC(snd_ctl_pcm_next_device);
MAKE_FUNC(snd_ctl_pcm_info);
MAKE_FUNC(snd_ctl_open);
MAKE_FUNC(snd_ctl_close);
MAKE_FUNC(snd_ctl_card_info_malloc);
MAKE_FUNC(snd_ctl_card_info_free);
MAKE_FUNC(snd_ctl_card_info);
MAKE_FUNC(snd_ctl_card_info_get_name);
MAKE_FUNC(snd_card_next);
#undef MAKE_FUNC
#define MAX_DEVICES 16
#define MAX_ALL_DEVICES 32
static DevMap allDevNameMap[MAX_ALL_DEVICES];
static ALCchar *alsaDeviceList[MAX_DEVICES];
static DevMap allCaptureDevNameMap[MAX_ALL_DEVICES];
static int xrun_recovery(snd_pcm_t *handle, int err)
{
if (err == -EPIPE)
{ /* under-run */
err = psnd_pcm_prepare(handle);
if (err < 0)
AL_PRINT("prepare failed: %s\n", psnd_strerror(err));
}
else if (err == -ESTRPIPE)
{
while ((err = psnd_pcm_resume(handle)) == -EAGAIN)
Sleep(1); /* wait until the suspend flag is released */
if (err < 0)
{
err = psnd_pcm_prepare(handle);
if (err < 0)
AL_PRINT("prepare failed: %s\n", psnd_strerror(err));
}
}
return err;
}
static ALuint ALSAProc(ALvoid *ptr)
{
ALCdevice *pDevice = (ALCdevice*)ptr;
alsa_data *data = (alsa_data*)pDevice->ExtraData;
const snd_pcm_channel_area_t *areas = NULL;
snd_pcm_sframes_t avail, commitres;
snd_pcm_uframes_t offset, frames;
char *WritePtr;
int WriteCnt;
int err;
while(!data->killNow)
{
snd_pcm_state_t state = psnd_pcm_state(data->pcmHandle);
if(state == SND_PCM_STATE_XRUN)
{
err = xrun_recovery(data->pcmHandle, -EPIPE);
if (err < 0)
{
AL_PRINT("XRUN recovery failed: %s\n", psnd_strerror(err));
break;
}
}
else if (state == SND_PCM_STATE_SUSPENDED)
{
err = xrun_recovery(data->pcmHandle, -ESTRPIPE);
if (err < 0)
{
AL_PRINT("SUSPEND recovery failed: %s\n", psnd_strerror(err));
break;
}
}
avail = psnd_pcm_avail_update(data->pcmHandle);
if(avail < 0)
{
err = xrun_recovery(data->pcmHandle, avail);
if (err < 0)
{
AL_PRINT("available update failed: %s\n", psnd_strerror(err));
break;
}
}
// make sure there's frames to process
if(avail == 0)
{
if(state != SND_PCM_STATE_RUNNING)
{
err = psnd_pcm_start(data->pcmHandle);
if(err < 0)
err = xrun_recovery(data->pcmHandle, err);
if(err < 0)
{
AL_PRINT("start failed: %s\n", psnd_strerror(err));
break;
}
}
else if(psnd_pcm_wait(data->pcmHandle, 1000) == 0)
AL_PRINT("Wait timeout... buffer size too low?\n");
continue;
}
// it is possible that contiguous areas are smaller, thus we use a loop
while (avail > 0)
{
frames = avail;
err = psnd_pcm_mmap_begin(data->pcmHandle, &areas, &offset, &frames);
if (err < 0)
{
err = xrun_recovery(data->pcmHandle, err);
if (err < 0)
AL_PRINT("mmap begin error: %s\n", psnd_strerror(err));
break;
}
SuspendContext(NULL);
WritePtr = (char*)areas->addr + (offset * areas->step / 8);
WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames);
aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format);
ProcessContext(NULL);
commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames);
if (commitres < 0 || (commitres-frames) != 0)
{
AL_PRINT("mmap commit error: %s\n",
psnd_strerror(commitres >= 0 ? -EPIPE : commitres));
break;
}
avail -= frames;
}
}
return 0;
}
static ALuint ALSANoMMapProc(ALvoid *ptr)
{
ALCdevice *pDevice = (ALCdevice*)ptr;
alsa_data *data = (alsa_data*)pDevice->ExtraData;
snd_pcm_sframes_t avail;
char *WritePtr;
while(!data->killNow)
{
SuspendContext(NULL);
aluMixData(pDevice->Context, data->buffer, data->size, pDevice->Format);
ProcessContext(NULL);
WritePtr = data->buffer;
avail = (snd_pcm_uframes_t)data->size / psnd_pcm_frames_to_bytes(data->pcmHandle, 1);
while(avail > 0)
{
int ret = psnd_pcm_writei(data->pcmHandle, WritePtr, avail);
switch (ret)
{
case -EAGAIN:
continue;
case -ESTRPIPE:
while((ret=psnd_pcm_resume(data->pcmHandle)) == -EAGAIN)
Sleep(1);
break;
case -EPIPE:
break;
default:
if (ret >= 0)
{
WritePtr += psnd_pcm_frames_to_bytes(data->pcmHandle, ret);
avail -= ret;
}
break;
}
if (ret < 0)
{
ret = psnd_pcm_prepare(data->pcmHandle);
if(ret < 0)
break;
}
}
}
return 0;
}
static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
snd_pcm_uframes_t bufferSizeInFrames;
snd_pcm_hw_params_t *p = NULL;
snd_pcm_access_t access;
unsigned int periods;
alsa_data *data;
char driver[64];
const char *str;
int allowmmap;
char *err;
int i;
if(!alsa_handle)
return ALC_FALSE;
strncpy(driver, GetConfigValue("alsa", "device", "default"), sizeof(driver)-1);
driver[sizeof(driver)-1] = 0;
if(deviceName)
{
size_t idx;
for(idx = 0;idx < MAX_ALL_DEVICES;idx++)
{
if(allDevNameMap[idx].name &&
strcmp(deviceName, allDevNameMap[idx].name) == 0)
{
device->szDeviceName = allDevNameMap[idx].name;
if(idx > 0)
sprintf(driver, "hw:%d,%d", allDevNameMap[idx].card, allDevNameMap[idx].dev);
goto open_alsa;
}
}
for(idx = 0;idx < MAX_DEVICES;idx++)
{
if(alsaDeviceList[idx] &&
strcmp(deviceName, alsaDeviceList[idx]) == 0)
{
device->szDeviceName = alsaDeviceList[idx];
if(idx > 0)
sprintf(driver, "hw:%zd,0", idx-1);
goto open_alsa;
}
}
return ALC_FALSE;
}
else
device->szDeviceName = alsaDeviceList[0];
open_alsa:
data = (alsa_data*)calloc(1, sizeof(alsa_data));
i = psnd_pcm_open(&data->pcmHandle, driver, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
if(i < 0)
{
Sleep(200);
i = psnd_pcm_open(&data->pcmHandle, driver, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
}
if(i >= 0)
{
i = psnd_pcm_nonblock(data->pcmHandle, 0);
if(i < 0)
psnd_pcm_close(data->pcmHandle);
}
if(i < 0)
{
free(data);
AL_PRINT("Could not open playback device '%s': %s\n", driver, psnd_strerror(i));
return ALC_FALSE;
}
switch(aluBytesFromFormat(device->Format))
{
case 1:
data->format = SND_PCM_FORMAT_U8;
break;
case 2:
data->format = SND_PCM_FORMAT_S16;
break;
default:
data->format = SND_PCM_FORMAT_UNKNOWN;
AL_PRINT("Unknown format?! %x\n", device->Format);
}
periods = GetConfigValueInt("alsa", "periods", 0);
bufferSizeInFrames = device->UpdateSize;
str = GetConfigValue("alsa", "mmap", "true");
allowmmap = (strcasecmp(str, "true") == 0 ||
strcasecmp(str, "yes") == 0 ||
strcasecmp(str, "on") == 0 ||
atoi(str) != 0);
psnd_pcm_hw_params_malloc(&p);
#define ok(func, str) (i=(func),((i<0)?(err=(str)),0:1))
/* start with the largest configuration space possible */
if(!(ok(psnd_pcm_hw_params_any(data->pcmHandle, p), "any") &&
/* set interleaved access */
((allowmmap && ok(psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_MMAP_INTERLEAVED), "set access")) ||
ok(psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_RW_INTERLEAVED), "set access")) &&
/* set format (implicitly sets sample bits) */
ok(psnd_pcm_hw_params_set_format(data->pcmHandle, p, data->format), "set format") &&
/* set channels (implicitly sets frame bits) */
ok(psnd_pcm_hw_params_set_channels(data->pcmHandle, p, aluChannelsFromFormat(device->Format)), "set channels") &&
/* set periods (implicitly constrains period/buffer parameters) */
(!periods || ok(psnd_pcm_hw_params_set_periods_near(data->pcmHandle, p, &periods, NULL), "set periods near")) &&
/* set rate (implicitly constrains period/buffer parameters) */
ok(psnd_pcm_hw_params_set_rate_near(data->pcmHandle, p, &device->Frequency, NULL), "set rate near") &&
/* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */
ok(psnd_pcm_hw_params_set_buffer_size_near(data->pcmHandle, p, &bufferSizeInFrames), "set buffer size near") &&
/* install and prepare hardware configuration */
ok(psnd_pcm_hw_params(data->pcmHandle, p), "set params")))
{
AL_PRINT("%s failed: %s\n", err, psnd_strerror(i));
psnd_pcm_hw_params_free(p);
psnd_pcm_close(data->pcmHandle);
free(data);
return ALC_FALSE;
}
#undef ok
if((i=psnd_pcm_hw_params_get_access(p, &access)) < 0)
{
AL_PRINT("get_access failed: %s\n", psnd_strerror(i));
psnd_pcm_hw_params_free(p);
psnd_pcm_close(data->pcmHandle);
free(data);
return ALC_FALSE;
}
if((i=psnd_pcm_hw_params_get_period_size(p, &bufferSizeInFrames, NULL)) < 0)
{
AL_PRINT("get_period_size failed: %s\n", psnd_strerror(i));
psnd_pcm_hw_params_free(p);
psnd_pcm_close(data->pcmHandle);
free(data);
return ALC_FALSE;
}
psnd_pcm_hw_params_free(p);
device->UpdateSize = bufferSizeInFrames;
data->size = psnd_pcm_frames_to_bytes(data->pcmHandle, device->UpdateSize);
if(access == SND_PCM_ACCESS_RW_INTERLEAVED)
{
data->buffer = malloc(data->size);
if(!data->buffer)
{
AL_PRINT("buffer malloc failed\n");
psnd_pcm_close(data->pcmHandle);
free(data);
return ALC_FALSE;
}
}
else
{
i = psnd_pcm_prepare(data->pcmHandle);
if(i < 0)
{
AL_PRINT("prepare error: %s\n", psnd_strerror(i));
psnd_pcm_close(data->pcmHandle);
free(data->buffer);
free(data);
return ALC_FALSE;
}
}
device->ExtraData = data;
if(access == SND_PCM_ACCESS_RW_INTERLEAVED)
data->thread = StartThread(ALSANoMMapProc, device);
else
data->thread = StartThread(ALSAProc, device);
if(data->thread == NULL)
{
psnd_pcm_close(data->pcmHandle);
device->ExtraData = NULL;
free(data->buffer);
free(data);
return ALC_FALSE;
}
return ALC_TRUE;
}
static void alsa_close_playback(ALCdevice *device)
{
alsa_data *data = (alsa_data*)device->ExtraData;
data->killNow = 1;
StopThread(data->thread);
psnd_pcm_close(data->pcmHandle);
free(data->buffer);
free(data);
device->ExtraData = NULL;
}
static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
{
snd_pcm_format_t alsaFormat;
snd_pcm_hw_params_t *p;
snd_pcm_uframes_t bufferSizeInFrames;
alsa_data *data;
char driver[64];
char *err;
int i;
if(!alsa_handle)
return ALC_FALSE;
strncpy(driver, GetConfigValue("alsa", "capture", "default"), sizeof(driver)-1);
driver[sizeof(driver)-1] = 0;
if(deviceName)
{
size_t idx;
for(idx = 0;idx < MAX_ALL_DEVICES;idx++)
{
if(allCaptureDevNameMap[idx].name &&
strcmp(deviceName, allCaptureDevNameMap[idx].name) == 0)
{
pDevice->szDeviceName = allCaptureDevNameMap[idx].name;
if(idx > 0)
sprintf(driver, "hw:%d,%d", allCaptureDevNameMap[idx].card, allCaptureDevNameMap[idx].dev);
goto open_alsa;
}
}
return ALC_FALSE;
}
else
pDevice->szDeviceName = allCaptureDevNameMap[0].name;
open_alsa:
data = (alsa_data*)calloc(1, sizeof(alsa_data));
i = psnd_pcm_open(&data->pcmHandle, driver, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
if(i < 0)
{
Sleep(200);
i = psnd_pcm_open(&data->pcmHandle, driver, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
}
if(i >= 0)
{
i = psnd_pcm_nonblock(data->pcmHandle, 0);
if(i < 0)
psnd_pcm_close(data->pcmHandle);
}
if(i < 0)
{
free(data);
AL_PRINT("Could not open capture device '%s': %s\n", driver, psnd_strerror(i));
return ALC_FALSE;
}
switch(aluBytesFromFormat(format))
{
case 1:
alsaFormat = SND_PCM_FORMAT_U8;
break;
case 2:
alsaFormat = SND_PCM_FORMAT_S16;
break;
default:
alsaFormat = SND_PCM_FORMAT_UNKNOWN;
AL_PRINT("Unknown format?! %x\n", format);
}
bufferSizeInFrames = SampleSize;
psnd_pcm_hw_params_malloc(&p);
#define ok(func, str) (i=(func),((i<0)?(err=(str)),0:1))
/* start with the largest configuration space possible */
if(!(ok(psnd_pcm_hw_params_any(data->pcmHandle, p), "any") &&
/* set interleaved access */
ok(psnd_pcm_hw_params_set_access(data->pcmHandle, p, SND_PCM_ACCESS_MMAP_INTERLEAVED), "set access") &&
/* set format (implicitly sets sample bits) */
ok(psnd_pcm_hw_params_set_format(data->pcmHandle, p, alsaFormat), "set format") &&
/* set channels (implicitly sets frame bits) */
ok(psnd_pcm_hw_params_set_channels(data->pcmHandle, p, aluChannelsFromFormat(pDevice->Format)), "set channels") &&
/* set rate (implicitly constrains period/buffer parameters) */
ok(psnd_pcm_hw_params_set_rate(data->pcmHandle, p, frequency, 0), "set rate") &&
/* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */
ok(psnd_pcm_hw_params_set_buffer_size_min(data->pcmHandle, p, &bufferSizeInFrames), "set buffer size min") &&
/* install and prepare hardware configuration */
ok(psnd_pcm_hw_params(data->pcmHandle, p), "set params")))
{
AL_PRINT("%s failed: %s\n", err, psnd_strerror(i));
psnd_pcm_hw_params_free(p);
psnd_pcm_close(data->pcmHandle);
free(data);
return ALC_FALSE;
}
#undef ok
psnd_pcm_hw_params_free(p);
i = psnd_pcm_prepare(data->pcmHandle);
if(i < 0)
{
AL_PRINT("prepare error: %s\n", psnd_strerror(i));
psnd_pcm_close(data->pcmHandle);
free(data);
return ALC_FALSE;
}
pDevice->ExtraData = data;
return ALC_TRUE;
}
static void alsa_close_capture(ALCdevice *pDevice)
{
alsa_data *data = (alsa_data*)pDevice->ExtraData;
psnd_pcm_close(data->pcmHandle);
free(data);
pDevice->ExtraData = NULL;
}
static void alsa_start_capture(ALCdevice *pDevice)
{
alsa_data *data = (alsa_data*)pDevice->ExtraData;
psnd_pcm_prepare(data->pcmHandle);
psnd_pcm_start(data->pcmHandle);
}
static void alsa_stop_capture(ALCdevice *pDevice)
{
alsa_data *data = (alsa_data*)pDevice->ExtraData;
psnd_pcm_drain(data->pcmHandle);
}
static void alsa_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
{
alsa_data *data = (alsa_data*)pDevice->ExtraData;
const snd_pcm_channel_area_t *areas = NULL;
snd_pcm_sframes_t frames, commitres;
snd_pcm_uframes_t size, offset;
int err;
frames = psnd_pcm_avail_update(data->pcmHandle);
if(frames < 0)
{
err = xrun_recovery(data->pcmHandle, frames);
if (err < 0)
AL_PRINT("available update failed: %s\n", psnd_strerror(err));
else
frames = psnd_pcm_avail_update(data->pcmHandle);
}
if (frames < (snd_pcm_sframes_t)lSamples)
{
SetALCError(ALC_INVALID_VALUE);
return;
}
// it is possible that contiguous areas are smaller, thus we use a loop
while (lSamples > 0)
{
char *Pointer;
int Count;
size = lSamples;
err = psnd_pcm_mmap_begin(data->pcmHandle, &areas, &offset, &size);
if (err < 0)
{
err = xrun_recovery(data->pcmHandle, err);
if (err < 0)
{
AL_PRINT("mmap begin error: %s\n", psnd_strerror(err));
break;
}
continue;
}
Pointer = (char*)areas->addr + (offset * areas->step / 8);
Count = psnd_pcm_frames_to_bytes(data->pcmHandle, size);
memcpy(pBuffer, Pointer, Count);
pBuffer = (char*)pBuffer + Count;
commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, size);
if (commitres < 0 || (commitres-size) != 0)
{
AL_PRINT("mmap commit error: %s\n",
psnd_strerror(commitres >= 0 ? -EPIPE : commitres));
break;
}
lSamples -= size;
}
}
static ALCuint alsa_available_samples(ALCdevice *pDevice)
{
alsa_data *data = (alsa_data*)pDevice->ExtraData;
snd_pcm_sframes_t frames = psnd_pcm_avail_update(data->pcmHandle);
if(frames < 0)
{
int err = xrun_recovery(data->pcmHandle, frames);
if (err < 0)
AL_PRINT("available update failed: %s\n", psnd_strerror(err));
else
frames = psnd_pcm_avail_update(data->pcmHandle);
if(frames < 0) /* ew.. */
SetALCError(ALC_INVALID_DEVICE);
}
return max(frames, 0);
}
BackendFuncs alsa_funcs = {
alsa_open_playback,
alsa_close_playback,
alsa_open_capture,
alsa_close_capture,
alsa_start_capture,
alsa_stop_capture,
alsa_capture_samples,
alsa_available_samples
};
void alc_alsa_init(BackendFuncs *func_list)
{
snd_ctl_t *handle;
int card, err, dev, idx = 1;
snd_ctl_card_info_t *info;
snd_pcm_info_t *pcminfo;
snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
char name[128];
char *str;
*func_list = alsa_funcs;
#ifdef HAVE_DLFCN_H
alsa_handle = dlopen("libasound.so.2", RTLD_NOW);
if(!alsa_handle)
return;
dlerror();
#define LOAD_FUNC(f) do { \
p##f = (typeof(f)*)dlsym(alsa_handle, #f); \
if((str=dlerror()) != NULL) \
{ \
dlclose(alsa_handle); \
alsa_handle = NULL; \
AL_PRINT("Could not load %s from libasound.so.2: %s\n", #f, str); \
return; \
} \
} while(0)
#else
str = NULL;
alsa_handle = 0xDEADBEEF;
#define LOAD_FUNC(f) p##f = f
#endif
LOAD_FUNC(snd_strerror);
LOAD_FUNC(snd_pcm_open);
LOAD_FUNC(snd_pcm_close);
LOAD_FUNC(snd_pcm_nonblock);
LOAD_FUNC(snd_pcm_frames_to_bytes);
LOAD_FUNC(snd_pcm_hw_params_malloc);
LOAD_FUNC(snd_pcm_hw_params_free);
LOAD_FUNC(snd_pcm_hw_params_any);
LOAD_FUNC(snd_pcm_hw_params_set_access);
LOAD_FUNC(snd_pcm_hw_params_set_format);
LOAD_FUNC(snd_pcm_hw_params_set_channels);
LOAD_FUNC(snd_pcm_hw_params_set_periods_near);
LOAD_FUNC(snd_pcm_hw_params_set_rate_near);
LOAD_FUNC(snd_pcm_hw_params_set_rate);
LOAD_FUNC(snd_pcm_hw_params_set_buffer_size_near);
LOAD_FUNC(snd_pcm_hw_params_set_buffer_size_min);
LOAD_FUNC(snd_pcm_hw_params_get_period_size);
LOAD_FUNC(snd_pcm_hw_params_get_access);
LOAD_FUNC(snd_pcm_hw_params);
LOAD_FUNC(snd_pcm_prepare);
LOAD_FUNC(snd_pcm_start);
LOAD_FUNC(snd_pcm_resume);
LOAD_FUNC(snd_pcm_wait);
LOAD_FUNC(snd_pcm_state);
LOAD_FUNC(snd_pcm_avail_update);
LOAD_FUNC(snd_pcm_areas_silence);
LOAD_FUNC(snd_pcm_mmap_begin);
LOAD_FUNC(snd_pcm_mmap_commit);
LOAD_FUNC(snd_pcm_writei);
LOAD_FUNC(snd_pcm_drain);
LOAD_FUNC(snd_pcm_info_malloc);
LOAD_FUNC(snd_pcm_info_free);
LOAD_FUNC(snd_pcm_info_set_device);
LOAD_FUNC(snd_pcm_info_set_subdevice);
LOAD_FUNC(snd_pcm_info_set_stream);
LOAD_FUNC(snd_pcm_info_get_name);
LOAD_FUNC(snd_ctl_pcm_next_device);
LOAD_FUNC(snd_ctl_pcm_info);
LOAD_FUNC(snd_ctl_open);
LOAD_FUNC(snd_ctl_close);
LOAD_FUNC(snd_ctl_card_info_malloc);
LOAD_FUNC(snd_ctl_card_info_free);
LOAD_FUNC(snd_ctl_card_info);
LOAD_FUNC(snd_ctl_card_info_get_name);
LOAD_FUNC(snd_card_next);
#undef LOAD_FUNC
psnd_ctl_card_info_malloc(&info);
psnd_pcm_info_malloc(&pcminfo);
card = -1;
if(psnd_card_next(&card) < 0 || card < 0)
AL_PRINT("no playback cards found...\n");
else
{
alsaDeviceList[0] = AppendDeviceList("ALSA Software on default");
allDevNameMap[0].name = AppendAllDeviceList("ALSA Software on default");
}
while (card >= 0) {
int firstDev = 1;
sprintf(name, "hw:%d", card);
if ((err = psnd_ctl_open(&handle, name, 0)) < 0) {
AL_PRINT("control open (%i): %s\n", card, psnd_strerror(err));
goto next_card;
}
if ((err = psnd_ctl_card_info(handle, info)) < 0) {
AL_PRINT("control hardware info (%i): %s\n", card, psnd_strerror(err));
psnd_ctl_close(handle);
goto next_card;
}
dev = -1;
while (idx < MAX_ALL_DEVICES) {
const char *cname, *dname;
if (psnd_ctl_pcm_next_device(handle, &dev)<0)
AL_PRINT("snd_ctl_pcm_next_device failed\n");
if (dev < 0)
break;
if(firstDev && card < MAX_DEVICES-1) {
firstDev = 0;
snprintf(name, sizeof(name), "ALSA Software on %s",
psnd_ctl_card_info_get_name(info));
alsaDeviceList[card+1] = AppendDeviceList(name);
}
psnd_pcm_info_set_device(pcminfo, dev);
psnd_pcm_info_set_subdevice(pcminfo, 0);
psnd_pcm_info_set_stream(pcminfo, stream);
if ((err = psnd_ctl_pcm_info(handle, pcminfo)) < 0) {
if (err != -ENOENT)
AL_PRINT("control digital audio info (%i): %s\n", card, psnd_strerror(err));
continue;
}
cname = psnd_ctl_card_info_get_name(info);
dname = psnd_pcm_info_get_name(pcminfo);
snprintf(name, sizeof(name), "ALSA Software on %s [%s]",
cname, dname);
allDevNameMap[idx].name = AppendAllDeviceList(name);
allDevNameMap[idx].card = card;
allDevNameMap[idx].dev = dev;
idx++;
}
psnd_ctl_close(handle);
next_card:
if(psnd_card_next(&card) < 0) {
AL_PRINT("snd_card_next failed\n");
break;
}
}
stream = SND_PCM_STREAM_CAPTURE;
card = -1;
if(psnd_card_next(&card) < 0 || card < 0) {
AL_PRINT("no capture cards found...\n");
psnd_pcm_info_free(pcminfo);
psnd_ctl_card_info_free(info);
return;
}
allCaptureDevNameMap[0].name = AppendCaptureDeviceList("ALSA Capture on default");
idx = 1;
while (card >= 0) {
sprintf(name, "hw:%d", card);
handle = NULL;
if ((err = psnd_ctl_open(&handle, name, 0)) < 0) {
AL_PRINT("control open (%i): %s\n", card, psnd_strerror(err));
}
if (err >= 0 && (err = psnd_ctl_card_info(handle, info)) < 0) {
AL_PRINT("control hardware info (%i): %s\n", card, psnd_strerror(err));
}
else if (err >= 0)
{
dev = -1;
while (idx < MAX_ALL_DEVICES) {
const char *cname, *dname;
if (psnd_ctl_pcm_next_device(handle, &dev)<0)
AL_PRINT("snd_ctl_pcm_next_device failed\n");
if (dev < 0)
break;
psnd_pcm_info_set_device(pcminfo, dev);
psnd_pcm_info_set_subdevice(pcminfo, 0);
psnd_pcm_info_set_stream(pcminfo, stream);
if ((err = psnd_ctl_pcm_info(handle, pcminfo)) < 0) {
if (err != -ENOENT)
AL_PRINT("control digital audio info (%i): %s\n", card, psnd_strerror(err));
continue;
}
cname = psnd_ctl_card_info_get_name(info);
dname = psnd_pcm_info_get_name(pcminfo);
snprintf(name, sizeof(name), "ALSA Capture on %s [%s]",
cname, dname);
allCaptureDevNameMap[idx].name = AppendCaptureDeviceList(name);
allCaptureDevNameMap[idx].card = card;
allCaptureDevNameMap[idx].dev = dev;
idx++;
}
}
if(handle) psnd_ctl_close(handle);
if(psnd_card_next(&card) < 0) {
AL_PRINT("snd_card_next failed\n");
break;
}
}
psnd_pcm_info_free(pcminfo);
psnd_ctl_card_info_free(info);
}
-203
View File
@@ -1,203 +0,0 @@
/*-
* Copyright (c) 2005 Boris Mikhaylov
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <math.h>
#include "bs2b.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/* Single pole IIR filter.
* O[n] = a0*I[n] + a1*I[n-1] + b1*O[n-1]
*/
/* Lowpass filter */
#define lo_filter(in, out_1) (bs2b->a0_lo*(in) + bs2b->b1_lo*(out_1))
/* Highboost filter */
#define hi_filter(in, in_1, out_1) (bs2b->a0_hi*(in) + bs2b->a1_hi*(in_1) + bs2b->b1_hi*(out_1))
/* Set up all data. */
static void init(struct bs2b *bs2b)
{
double Fc_lo, Fc_hi;
double G_lo, G_hi;
double x;
if ((bs2b->srate > 192000) || (bs2b->srate < 2000))
bs2b->srate = BS2B_DEFAULT_SRATE;
switch(bs2b->level)
{
case BS2B_LOW_CLEVEL: /* Low crossfeed level */
Fc_lo = 360.0;
Fc_hi = 501.0;
G_lo = 0.398107170553497;
G_hi = 0.205671765275719;
break;
case BS2B_MIDDLE_CLEVEL: /* Middle crossfeed level */
Fc_lo = 500.0;
Fc_hi = 711.0;
G_lo = 0.459726988530872;
G_hi = 0.228208484414988;
break;
case BS2B_HIGH_CLEVEL: /* High crossfeed level (virtual speakers are closer to itself) */
Fc_lo = 700.0;
Fc_hi = 1021.0;
G_lo = 0.530884444230988;
G_hi = 0.250105790667544;
break;
case BS2B_LOW_ECLEVEL: /* Low easy crossfeed level */
Fc_lo = 360.0;
Fc_hi = 494.0;
G_lo = 0.316227766016838;
G_hi = 0.168236228897329;
break;
case BS2B_MIDDLE_ECLEVEL: /* Middle easy crossfeed level */
Fc_lo = 500.0;
Fc_hi = 689.0;
G_lo = 0.354813389233575;
G_hi = 0.187169483835901;
break;
default: /* High easy crossfeed level */
bs2b->level = BS2B_HIGH_ECLEVEL;
Fc_lo = 700.0;
Fc_hi = 975.0;
G_lo = 0.398107170553497;
G_hi = 0.205671765275719;
break;
} /* switch */
/* $fc = $Fc / $s;
* $d = 1 / 2 / pi / $fc;
* $x = exp(-1 / $d);
*/
x = exp(-2.0 * M_PI * Fc_lo / bs2b->srate);
bs2b->b1_lo = x;
bs2b->a0_lo = G_lo * (1.0 - x);
x = exp(-2.0 * M_PI * Fc_hi / bs2b->srate);
bs2b->b1_hi = x;
bs2b->a0_hi = 1.0 - G_hi * (1.0 - x);
bs2b->a1_hi = -x;
bs2b->gain = 1.0 / (1.0 - G_hi + G_lo);
bs2b_clear(bs2b);
} /* init */
/* Exported functions.
* See descriptions in "bs2b.h"
*/
void bs2b_set_level(struct bs2b *bs2b, int level)
{
if(level == bs2b->level)
return;
bs2b->level = level;
init(bs2b);
} /* bs2b_set_level */
int bs2b_get_level(struct bs2b *bs2b)
{
return bs2b->level;
} /* bs2b_get_level */
void bs2b_set_srate(struct bs2b *bs2b, int srate)
{
if (srate == bs2b->srate)
return;
bs2b->srate = srate;
init(bs2b);
} /* bs2b_set_srate */
int bs2b_get_srate(struct bs2b *bs2b)
{
return bs2b->srate;
} /* bs2b_get_srate */
void bs2b_clear(struct bs2b *bs2b)
{
int loopv = sizeof(bs2b->last_sample);
while (loopv)
{
((char *)&bs2b->last_sample)[--loopv] = 0;
}
} /* bs2b_clear */
int bs2b_is_clear(struct bs2b *bs2b)
{
int loopv = sizeof(bs2b->last_sample);
while (loopv)
{
if (((char *)&bs2b->last_sample)[--loopv] != 0)
return 0;
}
return 1;
} /* bs2b_is_clear */
void bs2b_cross_feed(struct bs2b *bs2b, float *sample)
{
/* Lowpass filter */
bs2b->last_sample.lo[0] = lo_filter(sample[0], bs2b->last_sample.lo[0]);
bs2b->last_sample.lo[1] = lo_filter(sample[1], bs2b->last_sample.lo[1]);
/* Highboost filter */
bs2b->last_sample.hi[0] = hi_filter(sample[0], bs2b->last_sample.asis[0], bs2b->last_sample.hi[0]);
bs2b->last_sample.hi[1] = hi_filter(sample[1], bs2b->last_sample.asis[1], bs2b->last_sample.hi[1]);
bs2b->last_sample.asis[0] = sample[0];
bs2b->last_sample.asis[1] = sample[1];
/* Crossfeed */
sample[0] = bs2b->last_sample.hi[0] + bs2b->last_sample.lo[1];
sample[1] = bs2b->last_sample.hi[1] + bs2b->last_sample.lo[0];
/* Bass boost cause allpass attenuation */
sample[0] *= bs2b->gain;
sample[1] *= bs2b->gain;
/* Clipping of overloaded samples */
#if 0
if (sample[0] > 1.0)
sample[0] = 1.0;
if (sample[0] < -1.0)
sample[0] = -1.0;
if (sample[1] > 1.0)
sample[1] = 1.0;
if (sample[1] < -1.0)
sample[1] = -1.0;
#endif
} /* bs2b_cross_feed */
-417
View File
@@ -1,417 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#define _WIN32_WINNT 0x0500
#define INITGUID
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <dsound.h>
#include <mmreg.h>
#include "alMain.h"
#include "AL/al.h"
#include "AL/alc.h"
#ifndef DSSPEAKER_7POINT1
#define DSSPEAKER_7POINT1 7
#endif
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
// Since DSound doesn't report the fragment size, just assume 4 fragments
#define DS_FRAGS 4
typedef struct {
// DirectSound Playback Device
LPDIRECTSOUND lpDS;
LPDIRECTSOUNDBUFFER DSpbuffer;
LPDIRECTSOUNDBUFFER DSsbuffer;
int killNow;
ALvoid *thread;
} DSoundData;
typedef struct {
ALCchar *name;
GUID guid;
} DevMap;
static DevMap DeviceList[16];
static ALuint DSoundProc(ALvoid *ptr)
{
ALCdevice *pDevice = (ALCdevice*)ptr;
DSoundData *pData = (DSoundData*)pDevice->ExtraData;
DWORD LastCursor = 0;
DWORD PlayCursor;
VOID *WritePtr1, *WritePtr2;
DWORD WriteCnt1, WriteCnt2;
DWORD BufferSize;
DWORD avail;
HRESULT err;
BufferSize = pDevice->UpdateSize * DS_FRAGS *
aluBytesFromFormat(pDevice->Format) *
aluChannelsFromFormat(pDevice->Format);
while(!pData->killNow)
{
// Get current play and write cursors
IDirectSoundBuffer_GetCurrentPosition(pData->DSsbuffer, &PlayCursor, NULL);
avail = (PlayCursor-LastCursor+BufferSize) % BufferSize;
if(avail == 0)
{
Sleep(1);
continue;
}
// Lock output buffer
WriteCnt1 = 0;
WriteCnt2 = 0;
err = IDirectSoundBuffer_Lock(pData->DSsbuffer, LastCursor, avail, &WritePtr1, &WriteCnt1, &WritePtr2, &WriteCnt2, 0);
// If the buffer is lost, restore it, play and lock
if(err == DSERR_BUFFERLOST)
{
err = IDirectSoundBuffer_Restore(pData->DSsbuffer);
if(SUCCEEDED(err))
err = IDirectSoundBuffer_Play(pData->DSsbuffer, 0, 0, DSBPLAY_LOOPING);
if(SUCCEEDED(err))
err = IDirectSoundBuffer_Lock(pData->DSsbuffer, LastCursor, avail, &WritePtr1, &WriteCnt1, &WritePtr2, &WriteCnt2, 0);
}
// Successfully locked the output buffer
if(SUCCEEDED(err))
{
// If we have an active context, mix data directly into output buffer otherwise fill with silence
SuspendContext(NULL);
aluMixData(pDevice->Context, WritePtr1, WriteCnt1, pDevice->Format);
aluMixData(pDevice->Context, WritePtr2, WriteCnt2, pDevice->Format);
ProcessContext(NULL);
// Unlock output buffer only when successfully locked
IDirectSoundBuffer_Unlock(pData->DSsbuffer, WritePtr1, WriteCnt1, WritePtr2, WriteCnt2);
}
else
AL_PRINT("Buffer lock error: %#lx\n", err);
// Update old write cursor location
LastCursor += WriteCnt1+WriteCnt2;
LastCursor %= BufferSize;
}
return 0;
}
static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
{
DSBUFFERDESC DSBDescription;
DSoundData *pData = NULL;
WAVEFORMATEXTENSIBLE OutputType;
DWORD frameSize = 0;
LPGUID guid = NULL;
DWORD speakers;
HRESULT hr;
if(deviceName)
{
int i;
for(i = 0;DeviceList[i].name;i++)
{
if(strcmp(deviceName, DeviceList[i].name) == 0)
{
device->szDeviceName = DeviceList[i].name;
if(i > 0)
guid = &DeviceList[i].guid;
break;
}
}
if(!DeviceList[i].name)
return ALC_FALSE;
}
else
device->szDeviceName = DeviceList[0].name;
memset(&OutputType, 0, sizeof(OutputType));
//Initialise requested device
pData = calloc(1, sizeof(DSoundData));
if(!pData)
{
SetALCError(ALC_OUT_OF_MEMORY);
return ALC_FALSE;
}
//DirectSound Init code
hr = DirectSoundCreate(guid, &pData->lpDS, NULL);
if(SUCCEEDED(hr))
hr = IDirectSound_SetCooperativeLevel(pData->lpDS, GetForegroundWindow(), DSSCL_PRIORITY);
if(SUCCEEDED(hr))
{
if(*(GetConfigValue(NULL, "format", "")) != 0)
hr = IDirectSound_GetSpeakerConfig(pData->lpDS, &speakers);
else
{
if(device->Format == AL_FORMAT_MONO8 || device->Format == AL_FORMAT_MONO16)
speakers = DSSPEAKER_COMBINED(DSSPEAKER_MONO, 0);
else if(device->Format == AL_FORMAT_STEREO8 || device->Format == AL_FORMAT_STEREO16)
speakers = DSSPEAKER_COMBINED(DSSPEAKER_STEREO, 0);
else if(device->Format == AL_FORMAT_QUAD8 || device->Format == AL_FORMAT_QUAD16)
speakers = DSSPEAKER_COMBINED(DSSPEAKER_QUAD, 0);
else if(device->Format == AL_FORMAT_51CHN8 || device->Format == AL_FORMAT_51CHN16)
speakers = DSSPEAKER_COMBINED(DSSPEAKER_5POINT1, 0);
else if(device->Format == AL_FORMAT_71CHN8 || device->Format == AL_FORMAT_71CHN16)
speakers = DSSPEAKER_COMBINED(DSSPEAKER_7POINT1, 0);
else
hr = IDirectSound_GetSpeakerConfig(pData->lpDS, &speakers);
}
}
if(SUCCEEDED(hr))
{
speakers = DSSPEAKER_CONFIG(speakers);
if(speakers == DSSPEAKER_MONO)
{
if(aluBytesFromFormat(device->Format) == 1)
device->Format = AL_FORMAT_MONO8;
else
device->Format = AL_FORMAT_MONO16;
}
else if(speakers == DSSPEAKER_STEREO)
{
if(aluBytesFromFormat(device->Format) == 1)
device->Format = AL_FORMAT_STEREO8;
else
device->Format = AL_FORMAT_STEREO16;
}
else if(speakers == DSSPEAKER_QUAD)
{
if(aluBytesFromFormat(device->Format) == 1)
device->Format = AL_FORMAT_QUAD8;
else
device->Format = AL_FORMAT_QUAD16;
OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
SPEAKER_FRONT_RIGHT |
SPEAKER_BACK_LEFT |
SPEAKER_BACK_RIGHT;
}
else if(speakers == DSSPEAKER_5POINT1)
{
if(aluBytesFromFormat(device->Format) == 1)
device->Format = AL_FORMAT_51CHN8;
else
device->Format = AL_FORMAT_51CHN16;
OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
SPEAKER_FRONT_RIGHT |
SPEAKER_FRONT_CENTER |
SPEAKER_LOW_FREQUENCY |
SPEAKER_BACK_LEFT |
SPEAKER_BACK_RIGHT;
}
else if(speakers == DSSPEAKER_7POINT1)
{
if(aluBytesFromFormat(device->Format) == 1)
device->Format = AL_FORMAT_71CHN8;
else
device->Format = AL_FORMAT_71CHN16;
OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
SPEAKER_FRONT_RIGHT |
SPEAKER_FRONT_CENTER |
SPEAKER_LOW_FREQUENCY |
SPEAKER_BACK_LEFT |
SPEAKER_BACK_RIGHT |
SPEAKER_SIDE_LEFT |
SPEAKER_SIDE_RIGHT;
}
frameSize = aluBytesFromFormat(device->Format) *
aluChannelsFromFormat(device->Format);
OutputType.Format.wFormatTag = WAVE_FORMAT_PCM;
OutputType.Format.nChannels = aluChannelsFromFormat(device->Format);
OutputType.Format.wBitsPerSample = aluBytesFromFormat(device->Format) * 8;
OutputType.Format.nBlockAlign = OutputType.Format.nChannels*OutputType.Format.wBitsPerSample/8;
OutputType.Format.nSamplesPerSec = device->Frequency;
OutputType.Format.nAvgBytesPerSec = OutputType.Format.nSamplesPerSec*OutputType.Format.nBlockAlign;
OutputType.Format.cbSize = 0;
device->UpdateSize /= DS_FRAGS;
}
if(OutputType.Format.nChannels > 2)
{
OutputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
OutputType.Format.cbSize = 22;
OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
}
else
{
if(SUCCEEDED(hr))
{
memset(&DSBDescription,0,sizeof(DSBUFFERDESC));
DSBDescription.dwSize=sizeof(DSBUFFERDESC);
DSBDescription.dwFlags=DSBCAPS_PRIMARYBUFFER;
hr = IDirectSound_CreateSoundBuffer(pData->lpDS, &DSBDescription, &pData->DSpbuffer, NULL);
}
if(SUCCEEDED(hr))
hr = IDirectSoundBuffer_SetFormat(pData->DSpbuffer,&OutputType.Format);
}
if(SUCCEEDED(hr))
{
memset(&DSBDescription,0,sizeof(DSBUFFERDESC));
DSBDescription.dwSize=sizeof(DSBUFFERDESC);
DSBDescription.dwFlags=DSBCAPS_GLOBALFOCUS|DSBCAPS_GETCURRENTPOSITION2;
DSBDescription.dwBufferBytes=device->UpdateSize * DS_FRAGS * frameSize;
DSBDescription.lpwfxFormat=&OutputType.Format;
hr = IDirectSound_CreateSoundBuffer(pData->lpDS, &DSBDescription, &pData->DSsbuffer, NULL);
}
if(SUCCEEDED(hr))
hr = IDirectSoundBuffer_Play(pData->DSsbuffer, 0, 0, DSBPLAY_LOOPING);
if(SUCCEEDED(hr))
{
device->ExtraData = pData;
pData->thread = StartThread(DSoundProc, device);
if(!pData->thread)
hr = E_FAIL;
}
if(FAILED(hr))
{
if (pData->DSsbuffer)
IDirectSoundBuffer_Release(pData->DSsbuffer);
if (pData->DSpbuffer)
IDirectSoundBuffer_Release(pData->DSpbuffer);
if (pData->lpDS)
IDirectSound_Release(pData->lpDS);
free(pData);
return ALC_FALSE;
}
return ALC_TRUE;
}
static void DSoundClosePlayback(ALCdevice *device)
{
DSoundData *pData = device->ExtraData;
pData->killNow = 1;
StopThread(pData->thread);
IDirectSoundBuffer_Release(pData->DSsbuffer);
if (pData->DSpbuffer)
IDirectSoundBuffer_Release(pData->DSpbuffer);
IDirectSound_Release(pData->lpDS);
free(pData);
device->ExtraData = NULL;
}
static ALCboolean DSoundOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
{
(void)pDevice;
(void)deviceName;
(void)frequency;
(void)format;
(void)SampleSize;
return ALC_FALSE;
}
static void DSoundCloseCapture(ALCdevice *pDevice)
{
(void)pDevice;
}
static void DSoundStartCapture(ALCdevice *pDevice)
{
(void)pDevice;
}
static void DSoundStopCapture(ALCdevice *pDevice)
{
(void)pDevice;
}
static void DSoundCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
{
(void)pDevice;
(void)pBuffer;
(void)lSamples;
}
static ALCuint DSoundAvailableSamples(ALCdevice *pDevice)
{
(void)pDevice;
return 0;
}
BackendFuncs DSoundFuncs = {
DSoundOpenPlayback,
DSoundClosePlayback,
DSoundOpenCapture,
DSoundCloseCapture,
DSoundStartCapture,
DSoundStopCapture,
DSoundCaptureSamples,
DSoundAvailableSamples
};
static BOOL CALLBACK DSoundEnumDevices(LPGUID guid, LPCSTR desc, LPCSTR drvname, LPVOID data)
{
size_t *iter = data;
(void)drvname;
if(guid)
{
char str[128];
snprintf(str, sizeof(str), "DirectSound Software on %s", desc);
DeviceList[*iter].name = AppendAllDeviceList(str);
DeviceList[*iter].guid = *guid;
(*iter)++;
}
else
DeviceList[0].name = AppendDeviceList("DirectSound Software");
return TRUE;
}
void alcDSoundInit(BackendFuncs *FuncList)
{
size_t iter = 1;
HRESULT hr;
*FuncList = DSoundFuncs;
hr = DirectSoundEnumerate(DSoundEnumDevices, &iter);
if(FAILED(hr))
AL_PRINT("Error enumerating DirectSound devices (%#x)!\n", (unsigned int)hr);
}
-454
View File
@@ -1,454 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <unistd.h>
#include <errno.h>
#include <math.h>
#include "alMain.h"
#include "AL/al.h"
#include "AL/alc.h"
#include <sys/soundcard.h>
/*
* The OSS documentation talks about SOUND_MIXER_READ, but the header
* only contains MIXER_READ. Play safe. Same for WRITE.
*/
#ifndef SOUND_MIXER_READ
#define SOUND_MIXER_READ MIXER_READ
#endif
#ifndef SOUND_MIXER_WRITE
#define SOUND_MIXER_WRITE MIXER_WRITE
#endif
static char *oss_device;
static char *oss_device_capture;
typedef struct {
int fd;
int killNow;
ALvoid *thread;
ALubyte *mix_data;
int data_size;
RingBuffer *ring;
int doCapture;
} oss_data;
static int log2i(ALCuint x)
{
int y = 0;
while (x > 1)
{
x >>= 1;
y++;
}
return y;
}
static ALuint OSSProc(ALvoid *ptr)
{
ALCdevice *pDevice = (ALCdevice*)ptr;
oss_data *data = (oss_data*)pDevice->ExtraData;
int remaining = 0;
int wrote;
while(!data->killNow)
{
int len = data->data_size - remaining;
if(len > 0)
{
SuspendContext(NULL);
aluMixData(pDevice->Context, data->mix_data+remaining, len, pDevice->Format);
ProcessContext(NULL);
}
remaining += len;
wrote = write(data->fd, data->mix_data, remaining);
if(wrote < 0)
{
AL_PRINT("write failed: %s\n", strerror(errno));
remaining = 0;
}
else if(wrote > 0)
{
remaining -= wrote;
if(remaining > 0)
memmove(data->mix_data, data->mix_data+wrote, remaining);
}
else
Sleep(1);
}
return 0;
}
static ALuint OSSCaptureProc(ALvoid *ptr)
{
ALCdevice *pDevice = (ALCdevice*)ptr;
oss_data *data = (oss_data*)pDevice->ExtraData;
int frameSize;
int amt;
frameSize = aluBytesFromFormat(pDevice->Format);
frameSize *= aluChannelsFromFormat(pDevice->Format);
while(!data->killNow)
{
amt = read(data->fd, data->mix_data, data->data_size);
if(amt < 0)
{
AL_PRINT("read failed: %s\n", strerror(errno));
break;
}
if(amt == 0)
{
Sleep(1);
continue;
}
if(data->doCapture)
WriteRingBuffer(data->ring, data->mix_data, amt/frameSize);
}
return 0;
}
static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
int numFragmentsLogSize;
int log2FragmentSize;
unsigned int periods;
audio_buf_info info;
ALuint frameSize;
char driver[64];
int numChannels;
oss_data *data;
int ossFormat;
int ossSpeed;
char *err;
int i;
strncpy(driver, GetConfigValue("oss", "device", "/dev/dsp"), sizeof(driver)-1);
driver[sizeof(driver)-1] = 0;
if(deviceName)
{
if(strcmp(deviceName, oss_device))
return ALC_FALSE;
device->szDeviceName = oss_device;
}
else
device->szDeviceName = oss_device;
data = (oss_data*)calloc(1, sizeof(oss_data));
data->killNow = 0;
data->fd = open(driver, O_WRONLY);
if(data->fd == -1)
{
free(data);
AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
return ALC_FALSE;
}
switch(aluBytesFromFormat(device->Format))
{
case 1:
ossFormat = AFMT_U8;
break;
case 2:
ossFormat = AFMT_S16_NE;
break;
default:
ossFormat = -1;
AL_PRINT("Unknown format?! %x\n", device->Format);
}
periods = GetConfigValueInt("oss", "periods", 4);
if((int)periods <= 0)
periods = 4;
numChannels = aluChannelsFromFormat(device->Format);
frameSize = numChannels * aluBytesFromFormat(device->Format);
ossSpeed = device->Frequency;
log2FragmentSize = log2i(device->UpdateSize * frameSize / periods);
/* according to the OSS spec, 16 bytes are the minimum */
if (log2FragmentSize < 4)
log2FragmentSize = 4;
numFragmentsLogSize = (periods << 16) | log2FragmentSize;
#define ok(func, str) (i=(func),((i<0)?(err=(str)),0:1))
if (!(ok(ioctl(data->fd, SNDCTL_DSP_SETFRAGMENT, &numFragmentsLogSize), "set fragment") &&
ok(ioctl(data->fd, SNDCTL_DSP_SETFMT, &ossFormat), "set format") &&
ok(ioctl(data->fd, SNDCTL_DSP_CHANNELS, &numChannels), "set channels") &&
ok(ioctl(data->fd, SNDCTL_DSP_SPEED, &ossSpeed), "set speed") &&
ok(ioctl(data->fd, SNDCTL_DSP_GETOSPACE, &info), "get space")))
{
AL_PRINT("%s failed: %s\n", err, strerror(errno));
close(data->fd);
free(data);
return ALC_FALSE;
}
#undef ok
device->Frequency = ossSpeed;
if((int)aluChannelsFromFormat(device->Format) != numChannels)
{
AL_PRINT("Could not set %d channels, got %d instead\n", aluChannelsFromFormat(device->Format), numChannels);
close(data->fd);
free(data);
return ALC_FALSE;
}
if(!((ossFormat == AFMT_U8 && aluBytesFromFormat(device->Format) == 1) ||
(ossFormat == AFMT_S16_NE && aluBytesFromFormat(device->Format) == 2)))
{
AL_PRINT("Could not set %d-bit output, got format %#x\n", aluBytesFromFormat(device->Format)*8, ossFormat);
close(data->fd);
free(data);
return ALC_FALSE;
}
device->UpdateSize = info.fragsize / frameSize;
data->data_size = device->UpdateSize * frameSize;
data->mix_data = calloc(1, data->data_size);
device->ExtraData = data;
data->thread = StartThread(OSSProc, device);
if(data->thread == NULL)
{
device->ExtraData = NULL;
free(data->mix_data);
free(data);
return ALC_FALSE;
}
return ALC_TRUE;
}
static void oss_close_playback(ALCdevice *device)
{
oss_data *data = (oss_data*)device->ExtraData;
data->killNow = 1;
StopThread(data->thread);
close(data->fd);
free(data->mix_data);
free(data);
device->ExtraData = NULL;
}
static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
{
int numFragmentsLogSize;
int log2FragmentSize;
unsigned int periods;
audio_buf_info info;
ALuint frameSize;
int numChannels;
char driver[64];
oss_data *data;
int ossFormat;
int ossSpeed;
char *err;
int i;
strncpy(driver, GetConfigValue("oss", "capture", "/dev/dsp"), sizeof(driver)-1);
driver[sizeof(driver)-1] = 0;
if(deviceName)
{
if(strcmp(deviceName, oss_device_capture))
return ALC_FALSE;
device->szDeviceName = oss_device_capture;
}
else
device->szDeviceName = oss_device_capture;
data = (oss_data*)calloc(1, sizeof(oss_data));
data->killNow = 0;
data->fd = open(driver, O_RDONLY);
if(data->fd == -1)
{
free(data);
AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
return ALC_FALSE;
}
switch(aluBytesFromFormat(format))
{
case 1:
ossFormat = AFMT_U8;
break;
case 2:
ossFormat = AFMT_S16_NE;
break;
default:
ossFormat = -1;
AL_PRINT("Unknown format?! %x\n", device->Format);
}
periods = 4;
numChannels = aluChannelsFromFormat(device->Format);
frameSize = numChannels * aluBytesFromFormat(device->Format);
ossSpeed = frequency;
log2FragmentSize = log2i(SampleSize * frameSize / periods);
/* according to the OSS spec, 16 bytes are the minimum */
if (log2FragmentSize < 4)
log2FragmentSize = 4;
numFragmentsLogSize = (periods << 16) | log2FragmentSize;
#define ok(func, str) (i=(func),((i<0)?(err=(str)),0:1))
if (!(ok(ioctl(data->fd, SNDCTL_DSP_SETFRAGMENT, &numFragmentsLogSize), "set fragment") &&
ok(ioctl(data->fd, SNDCTL_DSP_SETFMT, &ossFormat), "set format") &&
ok(ioctl(data->fd, SNDCTL_DSP_CHANNELS, &numChannels), "set channels") &&
ok(ioctl(data->fd, SNDCTL_DSP_SPEED, &ossSpeed), "set speed") &&
ok(ioctl(data->fd, SNDCTL_DSP_GETISPACE, &info), "get space")))
{
AL_PRINT("%s failed: %s\n", err, strerror(errno));
close(data->fd);
free(data);
return ALC_FALSE;
}
#undef ok
if((int)aluChannelsFromFormat(device->Format) != numChannels)
{
AL_PRINT("Could not set %d channels, got %d instead\n", aluChannelsFromFormat(device->Format), numChannels);
close(data->fd);
free(data);
return ALC_FALSE;
}
if(!((ossFormat == AFMT_U8 && aluBytesFromFormat(device->Format) == 1) ||
(ossFormat == AFMT_S16_NE && aluBytesFromFormat(device->Format) == 2)))
{
AL_PRINT("Could not set %d-bit input, got format %#x\n", aluBytesFromFormat(device->Format)*8, ossFormat);
close(data->fd);
free(data);
return ALC_FALSE;
}
data->ring = CreateRingBuffer(frameSize, SampleSize);
if(!data->ring)
{
AL_PRINT("ring buffer create failed\n");
close(data->fd);
free(data);
return ALC_FALSE;
}
data->data_size = info.fragsize;
data->mix_data = calloc(1, data->data_size);
device->ExtraData = data;
data->thread = StartThread(OSSCaptureProc, device);
if(data->thread == NULL)
{
device->ExtraData = NULL;
free(data->mix_data);
free(data);
return ALC_FALSE;
}
return ALC_TRUE;
}
static void oss_close_capture(ALCdevice *device)
{
oss_data *data = (oss_data*)device->ExtraData;
data->killNow = 1;
StopThread(data->thread);
close(data->fd);
DestroyRingBuffer(data->ring);
free(data->mix_data);
free(data);
device->ExtraData = NULL;
}
static void oss_start_capture(ALCdevice *pDevice)
{
oss_data *data = (oss_data*)pDevice->ExtraData;
data->doCapture = 1;
}
static void oss_stop_capture(ALCdevice *pDevice)
{
oss_data *data = (oss_data*)pDevice->ExtraData;
data->doCapture = 0;
}
static void oss_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
{
oss_data *data = (oss_data*)pDevice->ExtraData;
if(lSamples <= (ALCuint)RingBufferSize(data->ring))
ReadRingBuffer(data->ring, pBuffer, lSamples);
else
SetALCError(ALC_INVALID_VALUE);
}
static ALCuint oss_available_samples(ALCdevice *pDevice)
{
oss_data *data = (oss_data*)pDevice->ExtraData;
return RingBufferSize(data->ring);
}
BackendFuncs oss_funcs = {
oss_open_playback,
oss_close_playback,
oss_open_capture,
oss_close_capture,
oss_start_capture,
oss_stop_capture,
oss_capture_samples,
oss_available_samples
};
void alc_oss_init(BackendFuncs *func_list)
{
*func_list = oss_funcs;
oss_device = AppendDeviceList("OSS Software");
AppendAllDeviceList(oss_device);
oss_device_capture = AppendCaptureDeviceList("OSS Capture");
}
-334
View File
@@ -1,334 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include "alMain.h"
#include "AL/al.h"
#include "AL/alc.h"
typedef struct {
FILE *f;
long DataStart;
ALvoid *buffer;
ALuint size;
int killNow;
ALvoid *thread;
} wave_data;
static ALCchar *waveDevice;
static ALuint WaveProc(ALvoid *ptr)
{
ALCdevice *pDevice = (ALCdevice*)ptr;
wave_data *data = (wave_data*)pDevice->ExtraData;
ALuint frameSize;
ALuint now, last;
size_t WriteCnt;
ALuint avail;
union {
short s;
char b[sizeof(short)];
} uSB;
uSB.s = 1;
frameSize = aluBytesFromFormat(pDevice->Format) *
aluChannelsFromFormat(pDevice->Format);
last = timeGetTime();
while(!data->killNow)
{
now = timeGetTime();
avail = (now-last) * pDevice->Frequency / 1000;
if(avail < pDevice->UpdateSize/4)
{
Sleep(1);
continue;
}
while(avail > 0)
{
SuspendContext(NULL);
WriteCnt = min(data->size, avail);
aluMixData(pDevice->Context, data->buffer, WriteCnt * frameSize,
pDevice->Format);
ProcessContext(NULL);
if(uSB.b[0] != 1 && aluBytesFromFormat(pDevice->Format) > 1)
{
ALubyte *bytes = data->buffer;
ALuint i;
for(i = 0;i < WriteCnt*frameSize;i++)
fputc(bytes[i^1], data->f);
}
else
fwrite(data->buffer, frameSize, WriteCnt, data->f);
if(ferror(data->f))
{
AL_PRINT("Error writing to file\n");
data->killNow = 1;
break;
}
avail -= WriteCnt;
}
last = now;
}
return 0;
}
static ALCboolean wave_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
wave_data *data;
ALuint channels;
ALuint bits;
const char *fname;
int i;
fname = GetConfigValue("wave", "file", "");
if(!fname[0])
return ALC_FALSE;
if(deviceName)
{
if(strcmp(deviceName, waveDevice) != 0)
return ALC_FALSE;
device->szDeviceName = waveDevice;
}
else
device->szDeviceName = waveDevice;
data = (wave_data*)calloc(1, sizeof(wave_data));
data->f = fopen(fname, "wb");
if(!data->f)
{
free(data);
AL_PRINT("Could not open file '%s': %s\n", fname, strerror(errno));
return ALC_FALSE;
}
bits = aluBytesFromFormat(device->Format) * 8;
channels = aluChannelsFromFormat(device->Format);
switch(bits)
{
case 8:
case 16:
if(channels == 0)
{
AL_PRINT("Unknown format?! %x\n", device->Format);
fclose(data->f);
free(data);
return ALC_FALSE;
}
break;
default:
AL_PRINT("Unknown format?! %x\n", device->Format);
fclose(data->f);
free(data);
return ALC_FALSE;
}
fprintf(data->f, "RIFF");
fputc(0, data->f); // 'RIFF' header len; filled in at close
fputc(0, data->f);
fputc(0, data->f);
fputc(0, data->f);
fprintf(data->f, "WAVE");
fprintf(data->f, "fmt ");
fputc(16, data->f); // 'fmt ' header len; 16 bytes for PCM
fputc(0, data->f);
fputc(0, data->f);
fputc(0, data->f);
// 16-bit val, format type id (PCM: 1)
fputc(1, data->f);
fputc(0, data->f);
// 16-bit val, channel count
fputc(channels&0xff, data->f);
fputc((channels>>8)&0xff, data->f);
// 32-bit val, frequency
fputc(device->Frequency&0xff, data->f);
fputc((device->Frequency>>8)&0xff, data->f);
fputc((device->Frequency>>16)&0xff, data->f);
fputc((device->Frequency>>24)&0xff, data->f);
// 32-bit val, bytes per second
i = device->Frequency * channels * bits / 8;
fputc(i&0xff, data->f);
fputc((i>>8)&0xff, data->f);
fputc((i>>16)&0xff, data->f);
fputc((i>>24)&0xff, data->f);
// 16-bit val, frame size
i = channels * bits / 8;
fputc(i&0xff, data->f);
fputc((i>>8)&0xff, data->f);
// 16-bit val, bits per sample
fputc(bits&0xff, data->f);
fputc((bits>>8)&0xff, data->f);
fprintf(data->f, "data");
fputc(0, data->f); // 'data' header len; filled in at close
fputc(0, data->f);
fputc(0, data->f);
fputc(0, data->f);
if(ferror(data->f))
{
AL_PRINT("Error writing header: %s\n", strerror(errno));
fclose(data->f);
free(data);
return ALC_FALSE;
}
data->DataStart = ftell(data->f);
device->UpdateSize = max(device->UpdateSize, 2048);
data->size = device->UpdateSize;
data->buffer = malloc(data->size * channels * bits / 8);
if(!data->buffer)
{
AL_PRINT("buffer malloc failed\n");
fclose(data->f);
free(data);
return ALC_FALSE;
}
device->ExtraData = data;
data->thread = StartThread(WaveProc, device);
if(data->thread == NULL)
{
device->ExtraData = NULL;
fclose(data->f);
free(data->buffer);
free(data);
return ALC_FALSE;
}
return ALC_TRUE;
}
static void wave_close_playback(ALCdevice *device)
{
wave_data *data = (wave_data*)device->ExtraData;
ALuint dataLen;
long size;
data->killNow = 1;
StopThread(data->thread);
size = ftell(data->f);
if(size > 0)
{
dataLen = size - data->DataStart;
if(fseek(data->f, data->DataStart-4, SEEK_SET) == 0)
{
fputc(dataLen&0xff, data->f); // 'data' header len
fputc((dataLen>>8)&0xff, data->f);
fputc((dataLen>>16)&0xff, data->f);
fputc((dataLen>>24)&0xff, data->f);
}
if(fseek(data->f, 4, SEEK_SET) == 0)
{
size -= 8;
fputc(size&0xff, data->f); // 'WAVE' header len
fputc((size>>8)&0xff, data->f);
fputc((size>>16)&0xff, data->f);
fputc((size>>24)&0xff, data->f);
}
}
fclose(data->f);
free(data->buffer);
free(data);
device->ExtraData = NULL;
}
static ALCboolean wave_open_capture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
{
(void)pDevice;
(void)deviceName;
(void)frequency;
(void)format;
(void)SampleSize;
return ALC_FALSE;
}
static void wave_close_capture(ALCdevice *pDevice)
{
(void)pDevice;
}
static void wave_start_capture(ALCdevice *pDevice)
{
(void)pDevice;
}
static void wave_stop_capture(ALCdevice *pDevice)
{
(void)pDevice;
}
static void wave_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
{
(void)pDevice;
(void)pBuffer;
(void)lSamples;
}
static ALCuint wave_available_samples(ALCdevice *pDevice)
{
(void)pDevice;
return 0;
}
BackendFuncs wave_funcs = {
wave_open_playback,
wave_close_playback,
wave_open_capture,
wave_close_capture,
wave_start_capture,
wave_stop_capture,
wave_capture_samples,
wave_available_samples
};
void alc_wave_init(BackendFuncs *func_list)
{
*func_list = wave_funcs;
waveDevice = AppendDeviceList("Wave File Writer");
AppendAllDeviceList(waveDevice);
}
-442
View File
@@ -1,442 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#define _WIN32_WINNT 0x0500
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <windows.h>
#include <mmsystem.h>
#include "alMain.h"
#include "AL/al.h"
#include "AL/alc.h"
typedef struct {
// MMSYSTEM Capture Device
ALboolean bWaveInShutdown;
HANDLE hWaveInHdrEvent;
HANDLE hWaveInThreadEvent;
HANDLE hWaveInThread;
DWORD ulWaveInThreadID;
ALint lWaveInBuffersCommitted;
HWAVEIN hWaveInHandle;
WAVEHDR WaveInBuffer[4];
ALCchar *pCapturedSampleData;
ALuint ulCapturedDataSize;
ALuint ulReadCapturedDataPos;
ALuint ulWriteCapturedDataPos;
} WinMMData;
static ALCchar *CaptureDeviceList[16];
/*
WaveInProc
Posts a message to 'CaptureThreadProc' everytime a WaveIn Buffer is completed and
returns to the application (with more data)
*/
static void CALLBACK WaveInProc(HWAVEIN hDevice,UINT uMsg,DWORD_PTR dwInstance,DWORD_PTR dwParam1,DWORD_PTR dwParam2)
{
ALCdevice *pDevice = (ALCdevice *)dwInstance;
WinMMData *pData = pDevice->ExtraData;
(void)hDevice;
(void)dwParam2;
if ((uMsg==WIM_DATA))
{
// Decrement number of buffers in use
pData->lWaveInBuffersCommitted--;
if (pData->bWaveInShutdown == AL_FALSE)
{
// Notify Wave Processor Thread that a Wave Header has returned
PostThreadMessage(pData->ulWaveInThreadID,uMsg,0,dwParam1);
}
else
{
if (pData->lWaveInBuffersCommitted == 0)
{
// Signal Wave Buffers Returned event
if (pData->hWaveInHdrEvent)
SetEvent(pData->hWaveInHdrEvent);
// Post 'Quit' Message to WaveIn Processor Thread
PostThreadMessage(pData->ulWaveInThreadID,WM_QUIT,0,0);
}
}
}
}
/*
CaptureThreadProc
Used by "MMSYSTEM" Device. Called when a WaveIn buffer had been filled with new
audio data.
*/
DWORD WINAPI CaptureThreadProc(LPVOID lpParameter)
{
ALCdevice *pDevice = (ALCdevice*)lpParameter;
WinMMData *pData = pDevice->ExtraData;
ALuint ulOffset, ulMaxSize, ulSection;
LPWAVEHDR pWaveHdr;
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
if ((msg.message==WIM_DATA)&&(!pData->bWaveInShutdown))
{
SuspendContext(NULL);
pWaveHdr = ((LPWAVEHDR)msg.lParam);
// Calculate offset in local buffer to write data to
ulOffset = pData->ulWriteCapturedDataPos % pData->ulCapturedDataSize;
if ((ulOffset + pWaveHdr->dwBytesRecorded) > pData->ulCapturedDataSize)
{
ulSection = pData->ulCapturedDataSize - ulOffset;
memcpy(pData->pCapturedSampleData + ulOffset, pWaveHdr->lpData, ulSection);
memcpy(pData->pCapturedSampleData, pWaveHdr->lpData + ulSection, pWaveHdr->dwBytesRecorded - ulSection);
}
else
{
memcpy(pData->pCapturedSampleData + ulOffset, pWaveHdr->lpData, pWaveHdr->dwBytesRecorded);
}
pData->ulWriteCapturedDataPos += pWaveHdr->dwBytesRecorded;
if (pData->ulWriteCapturedDataPos > (pData->ulReadCapturedDataPos + pData->ulCapturedDataSize))
{
// Application has not read enough audio data from the capture buffer so data has been
// overwritten. Reset ReadPosition.
pData->ulReadCapturedDataPos = pData->ulWriteCapturedDataPos - pData->ulCapturedDataSize;
}
// To prevent an over-flow prevent the offset values from getting too large
ulMaxSize = pData->ulCapturedDataSize << 4;
if ((pData->ulReadCapturedDataPos > ulMaxSize) && (pData->ulWriteCapturedDataPos > ulMaxSize))
{
pData->ulReadCapturedDataPos -= ulMaxSize;
pData->ulWriteCapturedDataPos -= ulMaxSize;
}
// Send buffer back to capture more data
waveInAddBuffer(pData->hWaveInHandle,pWaveHdr,sizeof(WAVEHDR));
pData->lWaveInBuffersCommitted++;
ProcessContext(NULL);
}
}
// Signal Wave Thread completed event
if (pData->hWaveInThreadEvent)
SetEvent(pData->hWaveInThreadEvent);
ExitThread(0);
return 0;
}
static ALCboolean WinMMOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
{
(void)device;
(void)deviceName;
return ALC_FALSE;
}
static void WinMMClosePlayback(ALCdevice *device)
{
(void)device;
}
static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
{
WAVEFORMATEX wfexCaptureFormat;
WinMMData *pData = NULL;
ALint lDeviceID = 0;
ALint lBufferSize;
ALint i;
(void)format;
// Find the Device ID matching the deviceName if valid
if (deviceName)
{
for(i = 0;CaptureDeviceList[i];i++)
{
if (!strcmp(deviceName, CaptureDeviceList[i]))
{
lDeviceID = i;
break;
}
}
if(!CaptureDeviceList[i])
return ALC_FALSE;
}
pDevice->szDeviceName = CaptureDeviceList[lDeviceID];
pData = calloc(1, sizeof(*pData));
if(!pData)
{
SetALCError(ALC_OUT_OF_MEMORY);
return ALC_FALSE;
}
memset(&wfexCaptureFormat, 0, sizeof(WAVEFORMATEX));
wfexCaptureFormat.wFormatTag = WAVE_FORMAT_PCM;
wfexCaptureFormat.nChannels = aluChannelsFromFormat(pDevice->Format);
wfexCaptureFormat.wBitsPerSample = aluBytesFromFormat(pDevice->Format) * 8;
wfexCaptureFormat.nBlockAlign = wfexCaptureFormat.wBitsPerSample *
wfexCaptureFormat.nChannels / 8;
wfexCaptureFormat.nSamplesPerSec = frequency;
wfexCaptureFormat.nAvgBytesPerSec = wfexCaptureFormat.nSamplesPerSec *
wfexCaptureFormat.nBlockAlign;
wfexCaptureFormat.cbSize = 0;
if (waveInOpen(&pData->hWaveInHandle, lDeviceID, &wfexCaptureFormat, (DWORD_PTR)&WaveInProc, (DWORD_PTR)pDevice, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
goto failure;
pData->hWaveInHdrEvent = CreateEvent(NULL, AL_TRUE, AL_FALSE, "WaveInAllHeadersReturned");
if (pData->hWaveInHdrEvent == NULL)
goto failure;
pData->hWaveInThreadEvent = CreateEvent(NULL, AL_TRUE, AL_FALSE, "WaveInThreadDestroyed");
if (pData->hWaveInThreadEvent == NULL)
goto failure;
// Allocate circular memory buffer for the captured audio
pData->ulCapturedDataSize = SampleSize * wfexCaptureFormat.nBlockAlign;
// Make sure circular buffer is at least 100ms in size (and an exact multiple of
// the block alignment
if (pData->ulCapturedDataSize < (wfexCaptureFormat.nAvgBytesPerSec / 10))
{
pData->ulCapturedDataSize = wfexCaptureFormat.nAvgBytesPerSec / 10;
pData->ulCapturedDataSize -= (pData->ulCapturedDataSize % wfexCaptureFormat.nBlockAlign);
}
pData->pCapturedSampleData = (ALCchar*)malloc(pData->ulCapturedDataSize);
pData->lWaveInBuffersCommitted=0;
// Create 4 Buffers of 50ms each
lBufferSize = wfexCaptureFormat.nAvgBytesPerSec / 20;
lBufferSize -= (lBufferSize % wfexCaptureFormat.nBlockAlign);
for (i=0;i<4;i++)
{
memset(&pData->WaveInBuffer[i], 0, sizeof(WAVEHDR));
pData->WaveInBuffer[i].dwBufferLength = lBufferSize;
pData->WaveInBuffer[i].lpData = calloc(1,pData->WaveInBuffer[i].dwBufferLength);
pData->WaveInBuffer[i].dwFlags = 0;
pData->WaveInBuffer[i].dwLoops = 0;
waveInPrepareHeader(pData->hWaveInHandle, &pData->WaveInBuffer[i], sizeof(WAVEHDR));
waveInAddBuffer(pData->hWaveInHandle, &pData->WaveInBuffer[i], sizeof(WAVEHDR));
pData->lWaveInBuffersCommitted++;
}
pData->ulReadCapturedDataPos = 0;
pData->ulWriteCapturedDataPos = 0;
pDevice->ExtraData = pData;
pData->hWaveInThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CaptureThreadProc, (LPVOID)pDevice, 0, &pData->ulWaveInThreadID);
if (pData->hWaveInThread == NULL)
goto failure;
return ALC_TRUE;
failure:
for (i=0;i<4;i++)
{
if(pData->WaveInBuffer[i].lpData)
{
waveInUnprepareHeader(pData->hWaveInHandle, &pData->WaveInBuffer[i], sizeof(WAVEHDR));
free(pData->WaveInBuffer[i].lpData);
}
}
free(pData->pCapturedSampleData);
if(pData->hWaveInHandle)
waveInClose(pData->hWaveInHandle);
if(pData->hWaveInThread)
CloseHandle(pData->hWaveInThread);
if (pData->hWaveInHdrEvent)
CloseHandle(pData->hWaveInHdrEvent);
if (pData->hWaveInThreadEvent)
CloseHandle(pData->hWaveInThreadEvent);
free(pData);
return ALC_FALSE;
}
static void WinMMCloseCapture(ALCdevice *pDevice)
{
WinMMData *pData = (WinMMData*)pDevice->ExtraData;
int i;
// Call waveOutReset to shutdown wave device
pData->bWaveInShutdown = AL_TRUE;
waveInReset(pData->hWaveInHandle);
// Wait for signal that all Wave Buffers have returned
WaitForSingleObjectEx(pData->hWaveInHdrEvent, 5000, FALSE);
// Wait for signal that Wave Thread has been destroyed
WaitForSingleObjectEx(pData->hWaveInThreadEvent, 5000, FALSE);
// Release the wave buffers
for (i=0;i<4;i++)
{
waveInUnprepareHeader(pData->hWaveInHandle, &pData->WaveInBuffer[i], sizeof(WAVEHDR));
free(pData->WaveInBuffer[i].lpData);
}
// Free Audio Buffer data
free(pData->pCapturedSampleData);
pData->pCapturedSampleData = NULL;
// Close the Wave device
waveInClose(pData->hWaveInHandle);
pData->hWaveInHandle = 0;
CloseHandle(pData->hWaveInThread);
pData->hWaveInThread = 0;
if (pData->hWaveInHdrEvent)
{
CloseHandle(pData->hWaveInHdrEvent);
pData->hWaveInHdrEvent = 0;
}
if (pData->hWaveInThreadEvent)
{
CloseHandle(pData->hWaveInThreadEvent);
pData->hWaveInThreadEvent = 0;
}
free(pData);
pDevice->ExtraData = NULL;
}
static void WinMMStartCapture(ALCdevice *pDevice)
{
WinMMData *pData = (WinMMData*)pDevice->ExtraData;
waveInStart(pData->hWaveInHandle);
}
static void WinMMStopCapture(ALCdevice *pDevice)
{
WinMMData *pData = (WinMMData*)pDevice->ExtraData;
waveInStop(pData->hWaveInHandle);
}
static void WinMMCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
{
WinMMData *pData = (WinMMData*)pDevice->ExtraData;
ALuint ulSamples = (unsigned long)lSamples;
ALuint ulBytes, ulBytesToCopy;
ALuint ulCapturedSamples;
ALuint ulReadOffset;
ALuint frameSize = aluBytesFromFormat(pDevice->Format) *
aluChannelsFromFormat(pDevice->Format);
// Check that we have the requested numbers of Samples
ulCapturedSamples = (pData->ulWriteCapturedDataPos -
pData->ulReadCapturedDataPos) /
frameSize;
if(ulSamples > ulCapturedSamples)
{
SetALCError(ALC_INVALID_VALUE);
return;
}
ulBytes = ulSamples * frameSize;
// Get Read Offset
ulReadOffset = (pData->ulReadCapturedDataPos % pData->ulCapturedDataSize);
// Check for wrap-around condition
if ((ulReadOffset + ulBytes) > pData->ulCapturedDataSize)
{
// Copy data from last Read position to end of data
ulBytesToCopy = pData->ulCapturedDataSize - ulReadOffset;
memcpy(pBuffer, pData->pCapturedSampleData + ulReadOffset, ulBytesToCopy);
// Copy rest of the data from the start of the captured data
memcpy(((char *)pBuffer) + ulBytesToCopy, pData->pCapturedSampleData, ulBytes - ulBytesToCopy);
}
else
{
// Copy data from the read position in the captured data
memcpy(pBuffer, pData->pCapturedSampleData + ulReadOffset, ulBytes);
}
// Update Read Position
pData->ulReadCapturedDataPos += ulBytes;
}
static ALCuint WinMMAvailableSamples(ALCdevice *pDevice)
{
WinMMData *pData = (WinMMData*)pDevice->ExtraData;
ALCuint lCapturedBytes = (pData->ulWriteCapturedDataPos - pData->ulReadCapturedDataPos);
return lCapturedBytes / (aluBytesFromFormat(pDevice->Format) *
aluChannelsFromFormat(pDevice->Format));
}
BackendFuncs WinMMFuncs = {
WinMMOpenPlayback,
WinMMClosePlayback,
WinMMOpenCapture,
WinMMCloseCapture,
WinMMStartCapture,
WinMMStopCapture,
WinMMCaptureSamples,
WinMMAvailableSamples
};
void alcWinMMInit(BackendFuncs *FuncList)
{
ALint lNumDevs;
ALint lLoop;
*FuncList = WinMMFuncs;
lNumDevs = waveInGetNumDevs();
for (lLoop = 0; lLoop < lNumDevs; lLoop++)
{
WAVEINCAPS WaveInCaps;
if(waveInGetDevCaps(lLoop, &WaveInCaps, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR)
{
char name[128];
snprintf(name, sizeof(name), "WaveIn on %s", WaveInCaps.szPname);
CaptureDeviceList[lLoop] = AppendCaptureDeviceList(name);
}
}
}
View File
-334
View File
@@ -1,334 +0,0 @@
# CMake build file list for OpenAL
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckIncludeFile)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckCCompilerFlag)
INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckTypeSize)
PROJECT(OpenAL)
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
OPTION(ALSA "Check for ALSA backend" ON)
OPTION(OSS "Check for OSS backend" ON)
OPTION(DSOUND "Check for DirectSound backend" ON)
OPTION(WINMM "Check for Windows Multimedia backend" ON)
OPTION(DLOPEN "Check for the dlopen API for loading optional libs" ON)
OPTION(WERROR "Treat compile warnings as errors" OFF)
OPTION(EXAMPLES "Build example programs" ON)
SET(LIB_MAJOR_VERSION "1")
SET(LIB_MINOR_VERSION "4")
SET(LIB_BUILD_VERSION "270")
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_BUILD_VERSION}")
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT)
CHECK_TYPE_SIZE("void*" SIZEOF_VOIDP)
# Add definitions, compiler switches, etc.
INCLUDE_DIRECTORIES(OpenAL32/Include include "${OpenAL_BINARY_DIR}")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF()
IF(MSVC)
# ???
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_DEBUG")
SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
ELSE()
ADD_DEFINITIONS(-Wall)
CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
IF("${HAVE_W_EXTRA}")
ADD_DEFINITIONS(-Wextra)
ENDIF()
IF(WERROR)
ADD_DEFINITIONS(-Werror)
ENDIF()
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -funroll-loops -D_DEBUG" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds."
FORCE)
SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING
"Flags used by the compiler during release minsize builds."
FORCE)
SET(CMAKE_C_FLAGS_RELEASE "-O2 -funroll-loops -fomit-frame-pointer -DNDEBUG" CACHE STRING
"Flags used by the compiler during release builds"
FORCE)
SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING
"Flags used by the compiler during debug builds."
FORCE)
# Set visibility options if available
IF(NOT WIN32)
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_SWITCH)
IF("${HAVE_VISIBILITY_SWITCH}")
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
int main() {return 0;}" HAVE_GCC_VISIBILITY)
IF("${HAVE_GCC_VISIBILITY}")
ADD_DEFINITIONS(-fvisibility=hidden -DHAVE_GCC_VISIBILITY)
ENDIF()
ENDIF()
ENDIF()
ENDIF()
CHECK_LIBRARY_EXISTS(m sqrtf "" HAVE_SQRTF)
CHECK_LIBRARY_EXISTS(m acosf "" HAVE_ACOSF)
IF(HAVE_SQRTF OR HAVE_ACOSF)
SET(EXTRA_LIBS m ${EXTRA_LIBS})
ENDIF()
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
IF(NOT HAVE_STRCASECMP)
CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
IF(NOT HAVE__STRICMP)
MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
ENDIF()
ADD_DEFINITIONS(-Dstrcasecmp=_stricmp)
ENDIF()
CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
IF(NOT HAVE_STRNCASECMP)
CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
IF(NOT HAVE__STRNICMP)
MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
ENDIF()
ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)
ENDIF()
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
IF(NOT HAVE_SNPRINTF)
CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
IF(NOT HAVE__SNPRINTF)
MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
ENDIF()
ADD_DEFINITIONS(-Dsnprintf=_snprintf)
ENDIF()
# Check for the dlopen API (for dynamicly loading backend libs)
IF(DLOPEN)
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
IF(HAVE_DLFCN_H)
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
IF(HAVE_LIBDL)
SET(EXTRA_LIBS dl ${EXTRA_LIBS})
ENDIF()
ENDIF()
ENDIF()
# Check if we have Windows headers
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0500)
IF(NOT HAVE_WINDOWS_H)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
IF(NOT HAVE_GETTIMEOFDAY)
MESSAGE(FATAL_ERROR "No timing function found!")
ENDIF()
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
IF(NOT HAVE_NANOSLEEP)
MESSAGE(FATAL_ERROR "No sleep function found!")
ENDIF()
# We need pthreads outside of Windows
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
IF(NOT HAVE_PTHREAD_H)
MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
ENDIF()
# Some systems need pthread_np.h to get recursive mutexes
CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
# _GNU_SOURCE is needed on some systems for extra attributes, and
# _REENTRANT is needed for libc thread-safety
ADD_DEFINITIONS(-D_GNU_SOURCE=1 -D_REENTRANT)
CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
IF(HAVE_LIBPTHREAD)
SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
ENDIF()
ENDIF()
# Check for a 64-bit type
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
IF(NOT HAVE_STDINT_H)
IF(HAVE_WINDOWS_H)
CHECK_C_SOURCE_COMPILES("\#define _WIN32_WINNT 0x0500
\#include <windows.h>
__int64 foo;
int main() {return 0;}" HAVE___INT64)
ENDIF()
IF(NOT HAVE___INT64)
IF(NOT SIZEOF_LONG MATCHES "8")
IF(NOT SIZEOF_LONG_LONG MATCHES "8")
MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
ENDIF()
ENDIF()
ENDIF()
ENDIF()
SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c
OpenAL32/alBuffer.c
OpenAL32/alEffect.c
OpenAL32/alError.c
OpenAL32/alExtension.c
OpenAL32/alFilter.c
OpenAL32/alListener.c
OpenAL32/alSource.c
OpenAL32/alState.c
OpenAL32/alThunk.c
OpenAL32/OpenAL32.c
)
SET(ALC_OBJS Alc/ALc.c
Alc/ALu.c
Alc/alcConfig.c
Alc/alcRing.c
Alc/alcThread.c
Alc/bs2b.c
Alc/wave.c
)
SET(BACKENDS "")
# Check ALSA backend
IF(ALSA)
CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H)
IF(HAVE_ALSA_ASOUNDLIB_H)
CHECK_LIBRARY_EXISTS(asound snd_pcm_open "" HAVE_LIBASOUND)
IF(HAVE_DLFCN_H OR HAVE_LIBASOUND)
SET(HAVE_ALSA 1)
SET(ALC_OBJS ${ALC_OBJS} Alc/alsa.c)
IF(HAVE_DLFCN_H)
SET(BACKENDS "${BACKENDS} ALSA,")
ELSE()
SET(BACKENDS "${BACKENDS} ALSA \(linked\),")
SET(EXTRA_LIBS asound ${EXTRA_LIBS})
ENDIF()
ENDIF()
ENDIF()
ENDIF()
# Check OSS backend
IF(OSS)
CHECK_INCLUDE_FILE(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
IF(HAVE_SYS_SOUNDCARD_H)
SET(HAVE_OSS 1)
SET(ALC_OBJS ${ALC_OBJS} Alc/oss.c)
SET(BACKENDS "${BACKENDS} OSS,")
ENDIF()
ENDIF()
# Check DSound/MMSystem backend
IF(HAVE_WINDOWS_H)
IF(DSOUND)
CHECK_INCLUDE_FILE(dsound.h HAVE_DSOUND_H)
IF(HAVE_DSOUND_H)
SET(HAVE_DSOUND 1)
SET(ALC_OBJS ${ALC_OBJS} Alc/dsound.c)
SET(BACKENDS "${BACKENDS} DirectSound,")
SET(CMAKE_REQUIRED_LIBRARIES dsound)
CHECK_C_SOURCE_COMPILES("int main() {return 0;}" HAVE_LIBDSOUND)
SET(CMAKE_REQUIRED_LIBRARIES "")
# CHECK_LIBRARY_EXISTS(dsound DirectSoundCreate "" HAVE_LIBDSOUND)
IF(HAVE_LIBDSOUND)
SET(EXTRA_LIBS dsound ${EXTRA_LIBS})
ENDIF()
ENDIF()
ENDIF()
IF(WINMM)
CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0500)
IF(HAVE_MMSYSTEM_H)
SET(HAVE_WINMM 1)
SET(ALC_OBJS ${ALC_OBJS} Alc/winmm.c)
SET(BACKENDS "${BACKENDS} WinMM,")
SET(CMAKE_REQUIRED_LIBRARIES winmm)
CHECK_C_SOURCE_COMPILES("int main() {return 0;}" HAVE_LIBWINMM)
SET(CMAKE_REQUIRED_LIBRARIES "")
# CHECK_LIBRARY_EXISTS(winmm waveInOpen "" HAVE_LIBWINMM)
IF(HAVE_LIBWINMM)
SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
ENDIF()
ENDIF()
ENDIF()
ENDIF()
# This is always available
SET(BACKENDS "${BACKENDS} WaveFile")
# End configuration
CONFIGURE_FILE(
"${OpenAL_SOURCE_DIR}/config.h.in"
"${OpenAL_BINARY_DIR}/config.h")
ADD_DEFINITIONS(-DAL_BUILD_LIBRARY)
# Build a shared library
IF(WIN32)
SET(LIBNAME openal32)
ELSE()
SET(LIBNAME openal)
ENDIF()
ADD_LIBRARY(${LIBNAME} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION}
SOVERSION ${LIB_MAJOR_VERSION})
IF(WIN32)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
ENDIF()
TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS})
# Add an install target here
INSTALL(TARGETS ${LIBNAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
INSTALL(FILES include/AL/al.h
include/AL/alc.h
include/AL/alext.h
DESTINATION include/AL
)
IF(EXAMPLES)
ADD_EXECUTABLE(openal-info examples/openal-info.c)
TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})
INSTALL(TARGETS openal-info
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
ENDIF()
MESSAGE(STATUS "")
MESSAGE(STATUS "Building OpenAL with support for the following backends:")
MESSAGE(STATUS " ${BACKENDS}")
MESSAGE(STATUS "")
-484
View File
@@ -1,484 +0,0 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, 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 library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
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 Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, 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 or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the 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 a program 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.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
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, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
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 compile 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) 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.
c) 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.
d) 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 source code 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 to
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 Library 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
Appendix: 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 Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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!
-61
View File
@@ -1,61 +0,0 @@
#ifndef _AL_AUXEFFECTSLOT_H_
#define _AL_AUXEFFECTSLOT_H_
#include "alEffect.h"
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AL_EFFECTSLOT_EFFECT 0x0001
#define AL_EFFECTSLOT_GAIN 0x0002
#define AL_EFFECTSLOT_AUXILIARY_SEND_AUTO 0x0003
#define AL_EFFECTSLOT_NULL 0x0000
typedef struct ALeffectslot
{
ALeffect effect;
ALfloat Gain;
ALboolean AuxSendAuto;
ALfloat *ReverbBuffer;
// in frames!
ALuint ReverbLength;
ALuint ReverbPos;
ALuint ReverbReflectPos;
ALuint ReverbLatePos;
ALfloat ReverbDecayGain;
ALfloat LastDecaySample;
ALuint refcount;
// Index to itself
ALuint effectslot;
struct ALeffectslot *next;
} ALeffectslot;
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context);
#ifdef __cplusplus
}
#endif
#endif
-32
View File
@@ -1,32 +0,0 @@
#ifndef _AL_BUFFER_H_
#define _AL_BUFFER_H_
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
#define UNUSED 0
#define PENDING 1
#define PROCESSED 2
typedef struct ALbuffer_struct
{
ALenum format;
ALenum eOriginalFormat;
ALshort *data;
ALsizei size;
ALsizei frequency;
ALenum state;
ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0)
struct ALbuffer_struct *next;
} ALbuffer;
ALvoid ReleaseALBuffers(ALvoid);
#ifdef __cplusplus
}
#endif
#endif
-89
View File
@@ -1,89 +0,0 @@
#ifndef _AL_EFFECT_H_
#define _AL_EFFECT_H_
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AL_EFFECT_TYPE 0x8001
#define AL_EFFECT_NULL 0x0000
#define AL_EFFECT_REVERB 0x0001
#define AL_EFFECT_CHORUS 0x0002
#define AL_EFFECT_DISTORTION 0x0003
#define AL_EFFECT_ECHO 0x0004
#define AL_EFFECT_FLANGER 0x0005
#define AL_EFFECT_FREQUENCY_SHIFTER 0x0006
#define AL_EFFECT_VOCAL_MORPHER 0x0007
#define AL_EFFECT_PITCH_SHIFTER 0x0008
#define AL_EFFECT_RING_MODULATOR 0x0009
#define AL_EFFECT_AUTOWAH 0x000A
#define AL_EFFECT_COMPRESSOR 0x000B
#define AL_EFFECT_EQUALIZER 0x000C
#define AL_REVERB_DENSITY 0x0001
#define AL_REVERB_DIFFUSION 0x0002
#define AL_REVERB_GAIN 0x0003
#define AL_REVERB_GAINHF 0x0004
#define AL_REVERB_DECAY_TIME 0x0005
#define AL_REVERB_DECAY_HFRATIO 0x0006
#define AL_REVERB_REFLECTIONS_GAIN 0x0007
#define AL_REVERB_REFLECTIONS_DELAY 0x0008
#define AL_REVERB_LATE_REVERB_GAIN 0x0009
#define AL_REVERB_LATE_REVERB_DELAY 0x000A
#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
#define AL_REVERB_DECAY_HFLIMIT 0x000D
typedef struct ALeffect_struct
{
// Effect type (AL_EFFECT_NULL, ...)
ALenum type;
struct {
ALfloat Density;
ALfloat Diffusion;
ALfloat Gain;
ALfloat GainHF;
ALfloat DecayTime;
ALfloat DecayHFRatio;
ALfloat ReflectionsGain;
ALfloat ReflectionsDelay;
ALfloat LateReverbGain;
ALfloat LateReverbDelay;
ALfloat AirAbsorptionGainHF;
ALfloat RoomRolloffFactor;
ALboolean DecayHFLimit;
} Reverb;
// Index to itself
ALuint effect;
struct ALeffect_struct *next;
} ALeffect;
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects);
AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
ALvoid ReleaseALEffects(ALvoid);
#ifdef __cplusplus
}
#endif
#endif
-16
View File
@@ -1,16 +0,0 @@
#ifndef _AL_ERROR_H_
#define _AL_ERROR_H_
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
ALvoid alSetError(ALenum errorCode);
#ifdef __cplusplus
}
#endif
#endif
-33
View File
@@ -1,33 +0,0 @@
#ifndef _AL_EXTENSION_H_
#define _AL_EXTENSION_H_
#include "AL/al.h"
#include "AL/alc.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ALextension_struct
{
ALchar *extName;
ALvoid *address;
} ALextension;
typedef struct ALfunction_struct
{
ALchar *funcName;
ALvoid *address;
} ALfunction;
typedef struct ALenum_struct
{
ALchar *enumName;
ALenum value;
} ALenums;
#ifdef __cplusplus
}
#endif
#endif
-55
View File
@@ -1,55 +0,0 @@
#ifndef _AL_FILTER_H_
#define _AL_FILTER_H_
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AL_FILTER_TYPE 0x8001
#define AL_FILTER_NULL 0x0000
#define AL_FILTER_LOWPASS 0x0001
#define AL_FILTER_HIGHPASS 0x0002
#define AL_FILTER_BANDPASS 0x0003
#define AL_LOWPASS_GAIN 0x0001
#define AL_LOWPASS_GAINHF 0x0002
typedef struct ALfilter_struct
{
// Filter type (AL_FILTER_NULL, ...)
ALenum type;
ALfloat Gain;
ALfloat GainHF;
// Index to itself
ALuint filter;
struct ALfilter_struct *next;
} ALfilter;
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters);
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
ALvoid ReleaseALFilters(ALvoid);
#ifdef __cplusplus
}
#endif
#endif
-26
View File
@@ -1,26 +0,0 @@
#ifndef _AL_LISTENER_H_
#define _AL_LISTENER_H_
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AL_METERS_PER_UNIT 0x20004
typedef struct ALlistener_struct
{
ALfloat Position[3];
ALfloat Velocity[3];
ALfloat Forward[3];
ALfloat Up[3];
ALfloat Gain;
ALfloat MetersPerUnit;
} ALlistener;
#ifdef __cplusplus
}
#endif
#endif
-241
View File
@@ -1,241 +0,0 @@
#ifndef AL_MAIN_H
#define AL_MAIN_H
#include <string.h>
#include <stdio.h>
#include "alu.h"
#ifdef _WIN32
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
#include <windows.h>
#else
#include <assert.h>
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
#include <sys/time.h>
#include <time.h>
#include <errno.h>
#define IsBadWritePtr(a,b) (0)
typedef pthread_mutex_t CRITICAL_SECTION;
static inline void EnterCriticalSection(CRITICAL_SECTION *cs)
{
int ret;
ret = pthread_mutex_lock(cs);
assert(ret == 0);
}
static inline void LeaveCriticalSection(CRITICAL_SECTION *cs)
{
int ret;
ret = pthread_mutex_unlock(cs);
assert(ret == 0);
}
static inline void InitializeCriticalSection(CRITICAL_SECTION *cs)
{
pthread_mutexattr_t attrib;
int ret;
ret = pthread_mutexattr_init(&attrib);
assert(ret == 0);
ret = pthread_mutexattr_settype(&attrib, PTHREAD_MUTEX_RECURSIVE);
#ifdef HAVE_PTHREAD_NP_H
if(ret != 0)
ret = pthread_mutexattr_setkind_np(&attrib, PTHREAD_MUTEX_RECURSIVE);
#endif
assert(ret == 0);
ret = pthread_mutex_init(cs, &attrib);
assert(ret == 0);
pthread_mutexattr_destroy(&attrib);
}
static inline void DeleteCriticalSection(CRITICAL_SECTION *cs)
{
int ret;
ret = pthread_mutex_destroy(cs);
assert(ret == 0);
}
/* NOTE: This wrapper isn't quite accurate as it returns an ALuint, as opposed
* to the expected DWORD. Both are defined as unsigned 32-bit types, however.
* Additionally, Win32 is supposed to measure the time since Windows started,
* as opposed to the actual time. */
static inline ALuint timeGetTime(void)
{
struct timeval tv;
int ret;
ret = gettimeofday(&tv, NULL);
assert(ret == 0);
return tv.tv_usec/1000 + tv.tv_sec*1000;
}
static inline void Sleep(ALuint t)
{
struct timespec tv, rem;
tv.tv_nsec = (t*1000000)%1000000000;
tv.tv_sec = t/1000;
while(nanosleep(&tv, &rem) == -1 && errno == EINTR)
tv = rem;
}
#define min(x,y) (((x)<(y))?(x):(y))
#define max(x,y) (((x)>(y))?(x):(y))
#endif
#include "AL/al.h"
#include "AL/alc.h"
#include "AL/alext.h"
#include "alListener.h"
#ifdef __cplusplus
extern "C" {
#endif
extern CRITICAL_SECTION _alMutex;
extern char _alDebug[256];
#define AL_PRINT(...) do { \
int _al_print_i; \
const char *_al_print_fn = strrchr(__FILE__, '/'); \
if(!_al_print_fn) _al_print_fn = __FILE__; \
else _al_print_fn += 1; \
_al_print_i = snprintf(_alDebug, sizeof(_alDebug), "AL lib: %s:%d: ", _al_print_fn, __LINE__); \
if(_al_print_i < (int)sizeof(_alDebug) && _al_print_i > 0) \
snprintf(_alDebug+_al_print_i, sizeof(_alDebug)-_al_print_i, __VA_ARGS__); \
_alDebug[sizeof(_alDebug)-1] = 0; \
fprintf(stderr, "%s", _alDebug); \
} while(0)
#define SWMIXER_OUTPUT_RATE 44100
#define SPEEDOFSOUNDMETRESPERSEC (343.3f)
#define AIRABSORBGAINHF (0.994f)
typedef struct {
ALCboolean (*OpenPlayback)(ALCdevice*, const ALCchar*);
void (*ClosePlayback)(ALCdevice*);
ALCboolean (*OpenCapture)(ALCdevice*, const ALCchar*, ALCuint, ALCenum, ALCsizei);
void (*CloseCapture)(ALCdevice*);
void (*StartCapture)(ALCdevice*);
void (*StopCapture)(ALCdevice*);
void (*CaptureSamples)(ALCdevice*, void*, ALCuint);
ALCuint (*AvailableSamples)(ALCdevice*);
} BackendFuncs;
void alc_alsa_init(BackendFuncs *func_list);
void alc_oss_init(BackendFuncs *func_list);
void alcDSoundInit(BackendFuncs *func_list);
void alcWinMMInit(BackendFuncs *FuncList);
void alc_wave_init(BackendFuncs *func_list);
struct ALCdevice_struct
{
ALboolean IsCaptureDevice;
ALuint Frequency;
ALuint UpdateSize;
ALenum Format;
ALCchar *szDeviceName;
// Maximum number of sources that can be created
ALuint MaxNoOfSources;
// Context created on this device
ALCcontext *Context;
BackendFuncs *Funcs;
void *ExtraData; // For the backend's use
ALCdevice *next;
};
#define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
#define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
#define ALCdevice_OpenCapture(a,b,c,d,e) ((a)->Funcs->OpenCapture((a), (b), (c), (d), (e)))
#define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
#define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
#define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
#define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
#define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
struct ALCcontext_struct
{
ALlistener Listener;
struct ALsource *Source;
ALuint SourceCount;
struct ALeffectslot *AuxiliaryEffectSlot;
ALuint AuxiliaryEffectSlotCount;
ALenum LastError;
ALboolean InUse;
ALuint Frequency;
ALenum DistanceModel;
ALfloat DopplerFactor;
ALfloat DopplerVelocity;
ALfloat flSpeedOfSound;
ALint lNumMonoSources;
ALint lNumStereoSources;
ALCdevice *Device;
ALCchar ExtensionList[1024];
struct bs2b *bs2b;
ALCcontext *next;
};
ALCvoid ReleaseALC(ALCvoid);
ALCchar *AppendDeviceList(char *name);
ALCchar *AppendAllDeviceList(char *name);
ALCchar *AppendCaptureDeviceList(char *name);
ALCvoid SetALCError(ALenum errorCode);
ALCvoid SuspendContext(ALCcontext *context);
ALCvoid ProcessContext(ALCcontext *context);
ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr);
ALuint StopThread(ALvoid *thread);
typedef struct RingBuffer RingBuffer;
RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length);
void DestroyRingBuffer(RingBuffer *ring);
ALsizei RingBufferSize(RingBuffer *ring);
void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len);
void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len);
void ReadALConfig(void);
void FreeALConfig(void);
const char *GetConfigValue(const char *blockName, const char *keyName, const char *def);
int GetConfigValueInt(const char *blockName, const char *keyName, int def);
float GetConfigValueFloat(const char *blockName, const char *keyName, float def);
#ifdef __cplusplus
}
#endif
#endif
-105
View File
@@ -1,105 +0,0 @@
#ifndef _AL_SOURCE_H_
#define _AL_SOURCE_H_
#define AL_NUM_SOURCE_PARAMS 128
/* This cannot be changed without working on the code! */
#define MAX_SENDS 1
#include "alFilter.h"
#include "AL/al.h"
#define AL_DIRECT_FILTER 0x20005
#define AL_AUXILIARY_SEND_FILTER 0x20006
#define AL_AIR_ABSORPTION_FACTOR 0x20007
#define AL_ROOM_ROLLOFF_FACTOR 0x20008
#define AL_CONE_OUTER_GAINHF 0x20009
#define AL_DIRECT_FILTER_GAINHF_AUTO 0x2000A
#define AL_AUXILIARY_SEND_FILTER_GAIN_AUTO 0x2000B
#define AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO 0x2000C
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ALbufferlistitem
{
ALuint buffer;
ALuint bufferstate;
ALuint flag;
struct ALbufferlistitem *next;
} ALbufferlistitem;
typedef struct ALsource
{
ALfloat flPitch;
ALfloat flGain;
ALfloat flOuterGain;
ALfloat flMinGain;
ALfloat flMaxGain;
ALfloat flInnerAngle;
ALfloat flOuterAngle;
ALfloat flRefDistance;
ALfloat flMaxDistance;
ALfloat flRollOffFactor;
ALfloat vPosition[3];
ALfloat vVelocity[3];
ALfloat vOrientation[3];
ALboolean bHeadRelative;
ALboolean bLooping;
ALuint ulBufferID;
ALboolean inuse;
ALboolean play;
ALenum state;
ALuint position;
ALuint position_fraction;
struct ALbufferlistitem *queue; // Linked list of buffers in queue
ALuint BuffersInQueue; // Number of buffers in queue
ALuint BuffersProcessed; // Number of buffers already processed (played)
ALuint TotalBufferDataSize; // Total amount of data contained in the buffers queued for this source
ALuint BuffersPlayed; // Number of buffers played on this loop
ALuint BufferPosition; // Read position in audio data of current buffer
ALfilter DirectFilter;
struct {
struct ALeffectslot *Slot;
ALfilter WetFilter;
} Send[MAX_SENDS];
ALfloat LastDrySample;
ALfloat LastWetSample;
ALboolean DryGainHFAuto;
ALboolean WetGainAuto;
ALboolean WetGainHFAuto;
ALfloat OuterGainHF;
ALfloat AirAbsorptionFactor;
ALfloat RoomRolloffFactor;
// Index to itself
ALuint source;
ALint lBytesPlayed;
ALint lOffset;
ALint lOffsetType;
// Source Type (Static, Streaming, or Undetermined)
ALint lSourceType;
struct ALsource *next;
} ALsource;
ALvoid ReleaseALSources(ALCcontext *Context);
#ifdef __cplusplus
}
#endif
#endif
-14
View File
@@ -1,14 +0,0 @@
#ifndef _AL_STATE_H_
#define _AL_STATE_H_
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif
-42
View File
@@ -1,42 +0,0 @@
#ifndef _AL_THUNK_H_
#define _AL_THUNK_H_
#include "config.h"
#include "AL/al.h"
#include "AL/alc.h"
#ifdef __cplusplus
extern "C" {
#endif
void alThunkInit(void);
void alThunkExit(void);
ALuint alThunkAddEntry(ALvoid * ptr);
void alThunkRemoveEntry(ALuint index);
ALvoid *alThunkLookupEntry(ALuint index);
#if (SIZEOF_VOIDP > SIZEOF_UINT)
#define ALTHUNK_INIT() alThunkInit()
#define ALTHUNK_EXIT() alThunkExit()
#define ALTHUNK_ADDENTRY(p) alThunkAddEntry(p)
#define ALTHUNK_REMOVEENTRY(i) alThunkRemoveEntry(i)
#define ALTHUNK_LOOKUPENTRY(i) alThunkLookupEntry(i)
#else
#define ALTHUNK_INIT()
#define ALTHUNK_EXIT()
#define ALTHUNK_ADDENTRY(p) ((ALuint)p)
#define ALTHUNK_REMOVEENTRY(i)
#define ALTHUNK_LOOKUPENTRY(i) ((ALvoid*)(i))
#endif // (SIZEOF_VOIDP > SIZEOF_INT)
#ifdef __cplusplus
}
#endif
#endif //_AL_THUNK_H_
-22
View File
@@ -1,22 +0,0 @@
#ifndef _ALU_H_
#define _ALU_H_
#include "AL/al.h"
#include "AL/alc.h"
#ifdef __cplusplus
extern "C" {
#endif
extern ALboolean DuplicateStereo;
__inline ALuint aluBytesFromFormat(ALenum format);
__inline ALuint aluChannelsFromFormat(ALenum format);
ALvoid aluMixData(ALCcontext *context,ALvoid *buffer,ALsizei size,ALenum format);
#ifdef __cplusplus
}
#endif
#endif
-109
View File
@@ -1,109 +0,0 @@
/*-
* Copyright (c) 2005 Boris Mikhaylov
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef BS2B_H
#define BS2B_H
/* Number of crossfeed levels */
#define BS2B_CLEVELS 3
/* Normal crossfeed levels */
#define BS2B_HIGH_CLEVEL 3
#define BS2B_MIDDLE_CLEVEL 2
#define BS2B_LOW_CLEVEL 1
/* Easy crossfeed levels */
#define BS2B_HIGH_ECLEVEL BS2B_HIGH_CLEVEL + BS2B_CLEVELS
#define BS2B_MIDDLE_ECLEVEL BS2B_MIDDLE_CLEVEL + BS2B_CLEVELS
#define BS2B_LOW_ECLEVEL BS2B_LOW_CLEVEL + BS2B_CLEVELS
/* Default crossfeed levels */
#define BS2B_DEFAULT_CLEVEL BS2B_HIGH_ECLEVEL
/* Default sample rate (Hz) */
#define BS2B_DEFAULT_SRATE 44100
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
struct bs2b {
int level; /* Crossfeed level */
int srate; /* Sample rate (Hz) */
/* Lowpass IIR filter coefficients */
double a0_lo;
double b1_lo;
/* Highboost IIR filter coefficients */
double a0_hi;
double a1_hi;
double b1_hi;
/* Global gain against overloading */
double gain;
/* Buffer of last filtered sample.
* [0] - first channel, [1] - second channel
*/
struct t_last_sample {
double asis[2];
double lo[2];
double hi[2];
} last_sample;
};
/* Clear buffers and set new coefficients with new crossfeed level value.
* level - crossfeed level of *LEVEL values.
*/
void bs2b_set_level(struct bs2b *bs2b, int level);
/* Return current crossfeed level value */
int bs2b_get_level(struct bs2b *bs2b);
/* Clear buffers and set new coefficients with new sample rate value.
* srate - sample rate by Hz.
*/
void bs2b_set_srate(struct bs2b *bs2b, int srate);
/* Return current sample rate value */
int bs2b_get_srate(struct bs2b *bs2b);
/* Clear buffer */
void bs2b_clear(struct bs2b *bs2b);
/* Return 1 if buffer is clear */
int bs2b_is_clear(struct bs2b *bs2b);
/* Crossfeeds one stereo sample that are pointed by sample.
* [0] - first channel, [1] - second channel.
* Returns crossfided samle by sample pointer.
*/
/* sample poits to floats */
void bs2b_cross_feed(struct bs2b *bs2b, float *sample);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* BS2B_H */
-74
View File
@@ -1,74 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include "alMain.h"
#include "alBuffer.h"
#include "alFilter.h"
#include "alEffect.h"
#include "alAuxEffectSlot.h"
#include "alThunk.h"
CRITICAL_SECTION _alMutex;
#ifdef _WIN32
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
(void)lpReserved;
// Perform actions based on the reason for calling.
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
break;
case DLL_PROCESS_DETACH:
ReleaseALC();
ReleaseALBuffers();
ReleaseALEffects();
ReleaseALFilters();
FreeALConfig();
ALTHUNK_EXIT();
DeleteCriticalSection(&_alMutex);
break;
}
return TRUE;
}
#else
#ifdef HAVE_GCC_DESTRUCTOR
static void my_deinit() __attribute__((destructor));
static void my_deinit()
{
static ALenum once = AL_FALSE;
if(once) return;
once = AL_TRUE;
ReleaseALC();
ReleaseALBuffers();
ReleaseALEffects();
ReleaseALFilters();
FreeALConfig();
ALTHUNK_EXIT();
DeleteCriticalSection(&_alMutex);
}
#endif
#endif
-541
View File
@@ -1,541 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include <math.h>
#include "AL/al.h"
#include "AL/alc.h"
#include "alMain.h"
#include "alAuxEffectSlot.h"
#include "alThunk.h"
#include "alError.h"
static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, ALeffect *effect);
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
{
ALCcontext *Context;
ALsizei i;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (n > 0)
{
/* NOTE: We only support one slot currently */
if(n == 1 && Context->AuxiliaryEffectSlotCount == 0)
{
// Check that enough memory has been allocted in the 'effectslots' array for n Effect Slots
if (!IsBadWritePtr((void*)effectslots, n * sizeof(ALuint)))
{
ALeffectslot **list = &Context->AuxiliaryEffectSlot;
while(*list)
list = &(*list)->next;
i = 0;
while(i < n)
{
*list = calloc(1, sizeof(ALeffectslot));
if(!(*list))
{
// We must have run out or memory
alDeleteAuxiliaryEffectSlots(i, effectslots);
alSetError(AL_OUT_OF_MEMORY);
break;
}
(*list)->Gain = 1.0;
(*list)->AuxSendAuto = AL_TRUE;
(*list)->refcount = 0;
effectslots[i] = (ALuint)ALTHUNK_ADDENTRY(*list);
(*list)->effectslot = effectslots[i];
Context->AuxiliaryEffectSlotCount++;
i++;
list = &(*list)->next;
}
}
}
else
alSetError(AL_INVALID_OPERATION);
}
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
{
ALCcontext *Context;
ALeffectslot *ALAuxiliaryEffectSlot;
ALsizei i;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (n >= 0)
{
// Check that all effectslots are valid
for (i = 0; i < n; i++)
{
if (!alIsAuxiliaryEffectSlot(effectslots[i]))
{
alSetError(AL_INVALID_NAME);
break;
}
else
{
ALAuxiliaryEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslots[i]);
if(ALAuxiliaryEffectSlot->refcount > 0)
{
alSetError(AL_INVALID_NAME);
break;
}
}
}
if (i == n)
{
// All effectslots are valid
for (i = 0; i < n; i++)
{
// Recheck that the effectslot is valid, because there could be duplicated names
if (alIsAuxiliaryEffectSlot(effectslots[i]))
{
ALeffectslot **list;
ALAuxiliaryEffectSlot = ((ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslots[i]));
// Remove Source from list of Sources
list = &Context->AuxiliaryEffectSlot;
while(*list && *list != ALAuxiliaryEffectSlot)
list = &(*list)->next;
if(*list)
*list = (*list)->next;
ALTHUNK_REMOVEENTRY(ALAuxiliaryEffectSlot->effectslot);
free(ALAuxiliaryEffectSlot->ReverbBuffer);
memset(ALAuxiliaryEffectSlot, 0, sizeof(ALeffectslot));
free(ALAuxiliaryEffectSlot);
Context->AuxiliaryEffectSlotCount--;
}
}
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(Context);
}
AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot)
{
ALCcontext *Context;
ALeffectslot **list;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return AL_FALSE;
}
SuspendContext(Context);
list = &Context->AuxiliaryEffectSlot;
while(*list && (*list)->effectslot != effectslot)
list = &(*list)->next;
ProcessContext(Context);
return (*list ? AL_TRUE : AL_FALSE);
}
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (alIsAuxiliaryEffectSlot(effectslot))
{
ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot);
switch(param)
{
case AL_EFFECTSLOT_EFFECT:
if(alIsEffect(iValue))
{
ALeffect *effect = (ALeffect*)ALTHUNK_LOOKUPENTRY(iValue);
InitializeEffect(Context, ALEffectSlot, effect);
}
else
alSetError(AL_INVALID_VALUE);
break;
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
if(iValue == AL_TRUE || iValue == AL_FALSE)
ALEffectSlot->AuxSendAuto = iValue;
else
alSetError(AL_INVALID_VALUE);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (alIsAuxiliaryEffectSlot(effectslot))
{
switch(param)
{
case AL_EFFECTSLOT_EFFECT:
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
alAuxiliaryEffectSloti(effectslot, param, piValues[0]);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (alIsAuxiliaryEffectSlot(effectslot))
{
ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot);
switch(param)
{
case AL_EFFECTSLOT_GAIN:
if(flValue >= 0.0f && flValue <= 1.0f)
ALEffectSlot->Gain = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (alIsAuxiliaryEffectSlot(effectslot))
{
switch(param)
{
case AL_EFFECTSLOT_GAIN:
alAuxiliaryEffectSlotf(effectslot, param, pflValues[0]);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (alIsAuxiliaryEffectSlot(effectslot))
{
ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot);
switch(param)
{
case AL_EFFECTSLOT_EFFECT:
*piValue = ALEffectSlot->effect.effect;
break;
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
*piValue = ALEffectSlot->AuxSendAuto;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (alIsAuxiliaryEffectSlot(effectslot))
{
switch(param)
{
case AL_EFFECTSLOT_EFFECT:
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
alGetAuxiliaryEffectSloti(effectslot, param, piValues);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (alIsAuxiliaryEffectSlot(effectslot))
{
ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot);
switch(param)
{
case AL_EFFECTSLOT_GAIN:
*pflValue = ALEffectSlot->Gain;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
if(!Context)
{
alSetError(AL_INVALID_OPERATION);
return;
}
SuspendContext(Context);
if (alIsAuxiliaryEffectSlot(effectslot))
{
switch(param)
{
case AL_EFFECTSLOT_GAIN:
alGetAuxiliaryEffectSlotf(effectslot, param, pflValues);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, ALeffect *effect)
{
ALfloat *ptr = NULL;
if(!effect)
{
memset(&ALEffectSlot->effect, 0, sizeof(ALEffectSlot->effect));
goto done;
}
if(effect->type == AL_EFFECT_REVERB)
{
ALuint size;
ALfloat reverbwait;
reverbwait = (1.0f-effect->Reverb.Density)*(0.1f-0.075f) + 0.075f;
size = (ALuint)((ALfloat)Context->Frequency *
(effect->Reverb.ReflectionsDelay +
effect->Reverb.LateReverbDelay +
reverbwait)) + 1;
ptr = calloc(size, sizeof(ALfloat));
if(!ptr)
{
alSetError(AL_OUT_OF_MEMORY);
return;
}
if(ALEffectSlot->ReverbBuffer)
memcpy(ptr, ALEffectSlot->ReverbBuffer, min(size, ALEffectSlot->ReverbLength)*sizeof(ALfloat));
ALEffectSlot->ReverbLength = size;
ALEffectSlot->ReverbPos %= size;
ALEffectSlot->ReverbReflectPos = (ALuint)(ALEffectSlot->ReverbLength -
((ALfloat)Context->Frequency *
effect->Reverb.ReflectionsDelay) +
ALEffectSlot->ReverbPos) %
ALEffectSlot->ReverbLength;
ALEffectSlot->ReverbLatePos = (ALuint)(ALEffectSlot->ReverbLength -
((ALfloat)Context->Frequency *
(effect->Reverb.LateReverbDelay +
effect->Reverb.ReflectionsDelay)) +
ALEffectSlot->ReverbPos) %
ALEffectSlot->ReverbLength;
ALEffectSlot->ReverbDecayGain = pow(1.0/32768.0, 1.0/(effect->Reverb.DecayTime/reverbwait));
}
memcpy(&ALEffectSlot->effect, effect, sizeof(*effect));
done:
free(ALEffectSlot->ReverbBuffer);
ALEffectSlot->ReverbBuffer = ptr;
}
ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context)
{
#ifdef _DEBUG
if(Context->AuxiliaryEffectSlotCount > 0)
AL_PRINT("alcDestroyContext(): %d AuxiliaryEffectSlot(s) NOT deleted\n", Context->AuxiliaryEffectSlotCount);
#endif
while(Context->AuxiliaryEffectSlot)
{
ALeffectslot *temp = Context->AuxiliaryEffectSlot;
Context->AuxiliaryEffectSlot = Context->AuxiliaryEffectSlot->next;
// Release effectslot structure
free(temp->ReverbBuffer);
ALTHUNK_REMOVEENTRY(temp->effectslot);
memset(temp, 0, sizeof(ALeffectslot));
free(temp);
}
Context->AuxiliaryEffectSlotCount = 0;
}
-1114
View File
File diff suppressed because it is too large Load Diff
-630
View File
@@ -1,630 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include "AL/al.h"
#include "AL/alc.h"
#include "alMain.h"
#include "alEffect.h"
#include "alThunk.h"
#include "alError.h"
static ALeffect *g_EffectList;
static ALuint g_EffectCount;
static void InitEffectParams(ALeffect *effect, ALenum type);
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
{
ALCcontext *Context;
ALsizei i;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (n > 0)
{
// Check that enough memory has been allocted in the 'effects' array for n Effects
if (!IsBadWritePtr((void*)effects, n * sizeof(ALuint)))
{
ALeffect **list = &g_EffectList;
while(*list)
list = &(*list)->next;
i = 0;
while(i < n)
{
*list = calloc(1, sizeof(ALeffect));
if(!(*list))
{
// We must have run out or memory
alDeleteEffects(i, effects);
alSetError(AL_OUT_OF_MEMORY);
break;
}
effects[i] = (ALuint)ALTHUNK_ADDENTRY(*list);
(*list)->effect = effects[i];
InitEffectParams(*list, AL_EFFECT_NULL);
g_EffectCount++;
i++;
list = &(*list)->next;
}
}
}
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects)
{
ALCcontext *Context;
ALeffect *ALEffect;
ALsizei i;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (n >= 0)
{
// Check that all effects are valid
for (i = 0; i < n; i++)
{
if (!alIsEffect(effects[i]))
{
alSetError(AL_INVALID_NAME);
break;
}
}
if (i == n)
{
// All effects are valid
for (i = 0; i < n; i++)
{
// Recheck that the effect is valid, because there could be duplicated names
if (effects[i] && alIsEffect(effects[i]))
{
ALeffect **list;
ALEffect = ((ALeffect*)ALTHUNK_LOOKUPENTRY(effects[i]));
// Remove Source from list of Sources
list = &g_EffectList;
while(*list && *list != ALEffect)
list = &(*list)->next;
if(*list)
*list = (*list)->next;
ALTHUNK_REMOVEENTRY(ALEffect->effect);
memset(ALEffect, 0, sizeof(ALeffect));
free(ALEffect);
g_EffectCount--;
}
}
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(Context);
}
AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect)
{
ALCcontext *Context;
ALeffect **list;
Context = alcGetCurrentContext();
SuspendContext(Context);
list = &g_EffectList;
while(*list && (*list)->effect != effect)
list = &(*list)->next;
ProcessContext(Context);
return ((*list || !effect) ? AL_TRUE : AL_FALSE);
}
AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (effect && alIsEffect(effect))
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
if(param == AL_EFFECT_TYPE)
{
if(iValue == AL_EFFECT_NULL ||
iValue == AL_EFFECT_REVERB)
InitEffectParams(ALEffect, iValue);
else
alSetError(AL_INVALID_VALUE);
}
else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
case AL_REVERB_DECAY_HFLIMIT:
if(iValue == AL_TRUE || iValue == AL_FALSE)
ALEffect->Reverb.DecayHFLimit = iValue;
else
alSetError(AL_INVALID_VALUE);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_ENUM);
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (effect && alIsEffect(effect))
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
if(param == AL_EFFECT_TYPE)
{
alEffecti(effect, param, piValues[0]);
}
else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
case AL_REVERB_DECAY_HFLIMIT:
alEffecti(effect, param, piValues[0]);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_ENUM);
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (effect && alIsEffect(effect))
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
case AL_REVERB_DENSITY:
if(flValue >= 0.0f && flValue <= 1.0f)
ALEffect->Reverb.Density = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_DIFFUSION:
if(flValue >= 0.0f && flValue <= 1.0f)
ALEffect->Reverb.Diffusion = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_GAIN:
if(flValue >= 0.0f && flValue <= 1.0f)
ALEffect->Reverb.Gain = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_GAINHF:
if(flValue >= 0.0f && flValue <= 1.0f)
ALEffect->Reverb.GainHF = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_DECAY_TIME:
if(flValue >= 0.1f && flValue <= 20.0f)
ALEffect->Reverb.DecayTime = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_DECAY_HFRATIO:
if(flValue >= 0.1f && flValue <= 2.0f)
ALEffect->Reverb.DecayHFRatio = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_REFLECTIONS_GAIN:
if(flValue >= 0.0f && flValue <= 3.16f)
ALEffect->Reverb.ReflectionsGain = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_REFLECTIONS_DELAY:
if(flValue >= 0.0f && flValue <= 0.3f)
ALEffect->Reverb.ReflectionsDelay = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_LATE_REVERB_GAIN:
if(flValue >= 0.0f && flValue <= 10.0f)
ALEffect->Reverb.LateReverbGain = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_LATE_REVERB_DELAY:
if(flValue >= 0.0f && flValue <= 0.1f)
ALEffect->Reverb.LateReverbDelay = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_AIR_ABSORPTION_GAINHF:
if(flValue >= 0.892f && flValue <= 1.0f)
ALEffect->Reverb.AirAbsorptionGainHF = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_REVERB_ROOM_ROLLOFF_FACTOR:
if(flValue >= 0.0f && flValue <= 10.0f)
ALEffect->Reverb.RoomRolloffFactor = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_ENUM);
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (effect && alIsEffect(effect))
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
case AL_REVERB_DENSITY:
case AL_REVERB_DIFFUSION:
case AL_REVERB_GAIN:
case AL_REVERB_GAINHF:
case AL_REVERB_DECAY_TIME:
case AL_REVERB_DECAY_HFRATIO:
case AL_REVERB_REFLECTIONS_GAIN:
case AL_REVERB_REFLECTIONS_DELAY:
case AL_REVERB_LATE_REVERB_GAIN:
case AL_REVERB_LATE_REVERB_DELAY:
case AL_REVERB_AIR_ABSORPTION_GAINHF:
case AL_REVERB_ROOM_ROLLOFF_FACTOR:
alEffectf(effect, param, pflValues[0]);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_ENUM);
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (effect && alIsEffect(effect))
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
if(param == AL_EFFECT_TYPE)
{
*piValue = ALEffect->type;
}
else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
case AL_REVERB_DECAY_HFLIMIT:
*piValue = ALEffect->Reverb.DecayHFLimit;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_ENUM);
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (effect && alIsEffect(effect))
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
if(param == AL_EFFECT_TYPE)
{
alGetEffecti(effect, param, piValues);
}
else if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
case AL_REVERB_DECAY_HFLIMIT:
alGetEffecti(effect, param, piValues);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_ENUM);
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (effect && alIsEffect(effect))
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
case AL_REVERB_DENSITY:
*pflValue = ALEffect->Reverb.Density;
break;
case AL_REVERB_DIFFUSION:
*pflValue = ALEffect->Reverb.Diffusion;
break;
case AL_REVERB_GAIN:
*pflValue = ALEffect->Reverb.Gain;
break;
case AL_REVERB_GAINHF:
*pflValue = ALEffect->Reverb.GainHF;
break;
case AL_REVERB_DECAY_TIME:
*pflValue = ALEffect->Reverb.DecayTime;
break;
case AL_REVERB_DECAY_HFRATIO:
*pflValue = ALEffect->Reverb.DecayHFRatio;
break;
case AL_REVERB_REFLECTIONS_GAIN:
*pflValue = ALEffect->Reverb.ReflectionsGain;
break;
case AL_REVERB_REFLECTIONS_DELAY:
*pflValue = ALEffect->Reverb.ReflectionsDelay;
break;
case AL_REVERB_LATE_REVERB_GAIN:
*pflValue = ALEffect->Reverb.LateReverbGain;
break;
case AL_REVERB_LATE_REVERB_DELAY:
*pflValue = ALEffect->Reverb.LateReverbDelay;
break;
case AL_REVERB_AIR_ABSORPTION_GAINHF:
*pflValue = ALEffect->Reverb.AirAbsorptionGainHF;
break;
case AL_REVERB_ROOM_ROLLOFF_FACTOR:
*pflValue = ALEffect->Reverb.RoomRolloffFactor;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_ENUM);
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (effect && alIsEffect(effect))
{
ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect);
if(ALEffect->type == AL_EFFECT_REVERB)
{
switch(param)
{
case AL_REVERB_DENSITY:
case AL_REVERB_DIFFUSION:
case AL_REVERB_GAIN:
case AL_REVERB_GAINHF:
case AL_REVERB_DECAY_TIME:
case AL_REVERB_DECAY_HFRATIO:
case AL_REVERB_REFLECTIONS_GAIN:
case AL_REVERB_REFLECTIONS_DELAY:
case AL_REVERB_LATE_REVERB_GAIN:
case AL_REVERB_LATE_REVERB_DELAY:
case AL_REVERB_AIR_ABSORPTION_GAINHF:
case AL_REVERB_ROOM_ROLLOFF_FACTOR:
alGetEffectf(effect, param, pflValues);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_ENUM);
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
ALvoid ReleaseALEffects(ALvoid)
{
#ifdef _DEBUG
if(g_EffectCount > 0)
AL_PRINT("exit() %d Effect(s) NOT deleted\n", g_EffectCount);
#endif
while(g_EffectList)
{
ALeffect *temp = g_EffectList;
g_EffectList = g_EffectList->next;
// Release effect structure
memset(temp, 0, sizeof(ALeffect));
free(temp);
}
g_EffectCount = 0;
}
static void InitEffectParams(ALeffect *effect, ALenum type)
{
effect->type = type;
switch(type)
{
case AL_EFFECT_REVERB:
effect->Reverb.Density = 1.0f;
effect->Reverb.Diffusion = 1.0f;
effect->Reverb.Gain = 0.32f;
effect->Reverb.GainHF = 0.89f;
effect->Reverb.DecayTime = 1.49f;
effect->Reverb.DecayHFRatio = 0.83f;
effect->Reverb.ReflectionsGain = 0.05f;
effect->Reverb.ReflectionsDelay = 0.007f;
effect->Reverb.LateReverbGain = 1.26f;
effect->Reverb.LateReverbDelay = 0.011f;
effect->Reverb.AirAbsorptionGainHF = 0.994f;
effect->Reverb.RoomRolloffFactor = 0.0f;
effect->Reverb.DecayHFLimit = AL_TRUE;
break;
}
}
-59
View File
@@ -1,59 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2000 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include "alMain.h"
#include "AL/alc.h"
#include "alError.h"
ALAPI ALenum ALAPIENTRY alGetError(ALvoid)
{
ALCcontext *Context;
ALenum errorCode;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (Context)
{
errorCode = Context->LastError;
Context->LastError = AL_NO_ERROR;
}
else
errorCode = AL_INVALID_OPERATION;
ProcessContext(Context);
return errorCode;
}
ALvoid alSetError(ALenum errorCode)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
SuspendContext(Context);
if (Context && Context->LastError == AL_NO_ERROR)
Context->LastError = errorCode;
ProcessContext(Context);
}
-387
View File
@@ -1,387 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "alExtension.h"
#include "alError.h"
#include "alMain.h"
#include "alFilter.h"
#include "alEffect.h"
#include "alAuxEffectSlot.h"
#include "alSource.h"
#include "AL/al.h"
#include "AL/alc.h"
static ALfunction function[]= {
{ "alEnable", (ALvoid *) alEnable },
{ "alDisable", (ALvoid *) alDisable },
{ "alIsEnabled", (ALvoid *) alIsEnabled },
{ "alGetString", (ALvoid *) alGetString },
{ "alGetBooleanv", (ALvoid *) alGetBooleanv },
{ "alGetIntegerv", (ALvoid *) alGetIntegerv },
{ "alGetFloatv", (ALvoid *) alGetFloatv },
{ "alGetDoublev", (ALvoid *) alGetDoublev },
{ "alGetBoolean", (ALvoid *) alGetBoolean },
{ "alGetInteger", (ALvoid *) alGetInteger },
{ "alGetFloat", (ALvoid *) alGetFloat },
{ "alGetDouble", (ALvoid *) alGetDouble },
{ "alGetError", (ALvoid *) alGetError },
{ "alIsExtensionPresent", (ALvoid *) alIsExtensionPresent },
{ "alGetProcAddress", (ALvoid *) alGetProcAddress },
{ "alGetEnumValue", (ALvoid *) alGetEnumValue },
{ "alListenerf", (ALvoid *) alListenerf },
{ "alListener3f", (ALvoid *) alListener3f },
{ "alListenerfv", (ALvoid *) alListenerfv },
{ "alListeneri", (ALvoid *) alListeneri },
{ "alListener3i", (ALvoid *) alListener3i },
{ "alListeneriv", (ALvoid *) alListeneriv },
{ "alGetListenerf", (ALvoid *) alGetListenerf },
{ "alGetListener3f", (ALvoid *) alGetListener3f },
{ "alGetListenerfv", (ALvoid *) alGetListenerfv },
{ "alGetListeneri", (ALvoid *) alGetListeneri },
{ "alGetListener3i", (ALvoid *) alGetListener3i },
{ "alGetListeneriv", (ALvoid *) alGetListeneriv },
{ "alGenSources", (ALvoid *) alGenSources },
{ "alDeleteSources", (ALvoid *) alDeleteSources },
{ "alIsSource", (ALvoid *) alIsSource },
{ "alSourcef", (ALvoid *) alSourcef },
{ "alSource3f", (ALvoid *) alSource3f },
{ "alSourcefv", (ALvoid *) alSourcefv },
{ "alSourcei", (ALvoid *) alSourcei },
{ "alSource3i", (ALvoid *) alSource3i },
{ "alSourceiv", (ALvoid *) alSourceiv },
{ "alGetSourcef", (ALvoid *) alGetSourcef },
{ "alGetSource3f", (ALvoid *) alGetSource3f },
{ "alGetSourcefv", (ALvoid *) alGetSourcefv },
{ "alGetSourcei", (ALvoid *) alGetSourcei },
{ "alGetSource3i", (ALvoid *) alGetSource3i },
{ "alGetSourceiv", (ALvoid *) alGetSourceiv },
{ "alSourcePlayv", (ALvoid *) alSourcePlayv },
{ "alSourceStopv", (ALvoid *) alSourceStopv },
{ "alSourceRewindv", (ALvoid *) alSourceRewindv },
{ "alSourcePausev", (ALvoid *) alSourcePausev },
{ "alSourcePlay", (ALvoid *) alSourcePlay },
{ "alSourceStop", (ALvoid *) alSourceStop },
{ "alSourceRewind", (ALvoid *) alSourceRewind },
{ "alSourcePause", (ALvoid *) alSourcePause },
{ "alSourceQueueBuffers", (ALvoid *) alSourceQueueBuffers },
{ "alSourceUnqueueBuffers", (ALvoid *) alSourceUnqueueBuffers },
{ "alGenBuffers", (ALvoid *) alGenBuffers },
{ "alDeleteBuffers", (ALvoid *) alDeleteBuffers },
{ "alIsBuffer", (ALvoid *) alIsBuffer },
{ "alBufferData", (ALvoid *) alBufferData },
{ "alBufferf", (ALvoid *) alBufferf },
{ "alBuffer3f", (ALvoid *) alBuffer3f },
{ "alBufferfv", (ALvoid *) alBufferfv },
{ "alBufferi", (ALvoid *) alBufferi },
{ "alBuffer3i", (ALvoid *) alBuffer3i },
{ "alBufferiv", (ALvoid *) alBufferiv },
{ "alGetBufferf", (ALvoid *) alGetBufferf },
{ "alGetBuffer3f", (ALvoid *) alGetBuffer3f },
{ "alGetBufferfv", (ALvoid *) alGetBufferfv },
{ "alGetBufferi", (ALvoid *) alGetBufferi },
{ "alGetBuffer3i", (ALvoid *) alGetBuffer3i },
{ "alGetBufferiv", (ALvoid *) alGetBufferiv },
{ "alDopplerFactor", (ALvoid *) alDopplerFactor },
{ "alDopplerVelocity", (ALvoid *) alDopplerVelocity },
{ "alSpeedOfSound", (ALvoid *) alSpeedOfSound },
{ "alDistanceModel", (ALvoid *) alDistanceModel },
{ "alGenFilters", (ALvoid *) alGenFilters },
{ "alDeleteFilters", (ALvoid *) alDeleteFilters },
{ "alIsFilter", (ALvoid *) alIsFilter },
{ "alFilteri", (ALvoid *) alFilteri },
{ "alFilteriv", (ALvoid *) alFilteriv },
{ "alFilterf", (ALvoid *) alFilterf },
{ "alFilterfv", (ALvoid *) alFilterfv },
{ "alGetFilteri", (ALvoid *) alGetFilteri },
{ "alGetFilteriv", (ALvoid *) alGetFilteriv },
{ "alGetFilterf", (ALvoid *) alGetFilterf },
{ "alGetFilterfv", (ALvoid *) alGetFilterfv },
{ "alGenEffects", (ALvoid *) alGenEffects },
{ "alDeleteEffects", (ALvoid *) alDeleteEffects },
{ "alIsEffect", (ALvoid *) alIsEffect },
{ "alEffecti", (ALvoid *) alEffecti },
{ "alEffectiv", (ALvoid *) alEffectiv },
{ "alEffectf", (ALvoid *) alEffectf },
{ "alEffectfv", (ALvoid *) alEffectfv },
{ "alGetEffecti", (ALvoid *) alGetEffecti },
{ "alGetEffectiv", (ALvoid *) alGetEffectiv },
{ "alGetEffectf", (ALvoid *) alGetEffectf },
{ "alGetEffectfv", (ALvoid *) alGetEffectfv },
{ "alGenAuxiliaryEffectSlots", (ALvoid *) alGenAuxiliaryEffectSlots },
{ "alDeleteAuxiliaryEffectSlots",(ALvoid *) alDeleteAuxiliaryEffectSlots},
{ "alIsAuxiliaryEffectSlot", (ALvoid *) alIsAuxiliaryEffectSlot },
{ "alAuxiliaryEffectSloti", (ALvoid *) alAuxiliaryEffectSloti },
{ "alAuxiliaryEffectSlotiv", (ALvoid *) alAuxiliaryEffectSlotiv },
{ "alAuxiliaryEffectSlotf", (ALvoid *) alAuxiliaryEffectSlotf },
{ "alAuxiliaryEffectSlotfv", (ALvoid *) alAuxiliaryEffectSlotfv },
{ "alGetAuxiliaryEffectSloti", (ALvoid *) alGetAuxiliaryEffectSloti },
{ "alGetAuxiliaryEffectSlotiv", (ALvoid *) alGetAuxiliaryEffectSlotiv},
{ "alGetAuxiliaryEffectSlotf", (ALvoid *) alGetAuxiliaryEffectSlotf },
{ "alGetAuxiliaryEffectSlotfv", (ALvoid *) alGetAuxiliaryEffectSlotfv},
{ NULL, (ALvoid *) NULL } };
static ALenums enumeration[]={
// Types
{ (ALchar *)"AL_INVALID", AL_INVALID },
{ (ALchar *)"AL_NONE", AL_NONE },
{ (ALchar *)"AL_FALSE", AL_FALSE },
{ (ALchar *)"AL_TRUE", AL_TRUE },
// Source and Listener Properties
{ (ALchar *)"AL_SOURCE_RELATIVE", AL_SOURCE_RELATIVE },
{ (ALchar *)"AL_CONE_INNER_ANGLE", AL_CONE_INNER_ANGLE },
{ (ALchar *)"AL_CONE_OUTER_ANGLE", AL_CONE_OUTER_ANGLE },
{ (ALchar *)"AL_PITCH", AL_PITCH },
{ (ALchar *)"AL_POSITION", AL_POSITION },
{ (ALchar *)"AL_DIRECTION", AL_DIRECTION },
{ (ALchar *)"AL_VELOCITY", AL_VELOCITY },
{ (ALchar *)"AL_LOOPING", AL_LOOPING },
{ (ALchar *)"AL_BUFFER", AL_BUFFER },
{ (ALchar *)"AL_GAIN", AL_GAIN },
{ (ALchar *)"AL_MIN_GAIN", AL_MIN_GAIN },
{ (ALchar *)"AL_MAX_GAIN", AL_MAX_GAIN },
{ (ALchar *)"AL_ORIENTATION", AL_ORIENTATION },
{ (ALchar *)"AL_REFERENCE_DISTANCE", AL_REFERENCE_DISTANCE },
{ (ALchar *)"AL_ROLLOFF_FACTOR", AL_ROLLOFF_FACTOR },
{ (ALchar *)"AL_CONE_OUTER_GAIN", AL_CONE_OUTER_GAIN },
{ (ALchar *)"AL_MAX_DISTANCE", AL_MAX_DISTANCE },
{ (ALchar *)"AL_SEC_OFFSET", AL_SEC_OFFSET },
{ (ALchar *)"AL_SAMPLE_OFFSET", AL_SAMPLE_OFFSET },
{ (ALchar *)"AL_BYTE_OFFSET", AL_BYTE_OFFSET },
{ (ALchar *)"AL_SOURCE_TYPE", AL_SOURCE_TYPE },
{ (ALchar *)"AL_STATIC", AL_STATIC },
{ (ALchar *)"AL_STREAMING", AL_STREAMING },
{ (ALchar *)"AL_UNDETERMINED", AL_UNDETERMINED },
{ (ALchar *)"AL_METERS_PER_UNIT", AL_METERS_PER_UNIT },
// Source EFX Properties
{ (ALchar *)"AL_DIRECT_FILTER", AL_DIRECT_FILTER },
{ (ALchar *)"AL_AUXILIARY_SEND_FILTER", AL_AUXILIARY_SEND_FILTER },
{ (ALchar *)"AL_AIR_ABSORPTION_FACTOR", AL_AIR_ABSORPTION_FACTOR },
{ (ALchar *)"AL_ROOM_ROLLOFF_FACTOR", AL_ROOM_ROLLOFF_FACTOR },
{ (ALchar *)"AL_CONE_OUTER_GAINHF", AL_CONE_OUTER_GAINHF },
{ (ALchar *)"AL_DIRECT_FILTER_GAINHF_AUTO", AL_DIRECT_FILTER_GAINHF_AUTO },
{ (ALchar *)"AL_AUXILIARY_SEND_FILTER_GAIN_AUTO", AL_AUXILIARY_SEND_FILTER_GAIN_AUTO },
{ (ALchar *)"AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO", AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO},
// Source State information
{ (ALchar *)"AL_SOURCE_STATE", AL_SOURCE_STATE },
{ (ALchar *)"AL_INITIAL", AL_INITIAL },
{ (ALchar *)"AL_PLAYING", AL_PLAYING },
{ (ALchar *)"AL_PAUSED", AL_PAUSED },
{ (ALchar *)"AL_STOPPED", AL_STOPPED },
// Queue information
{ (ALchar *)"AL_BUFFERS_QUEUED", AL_BUFFERS_QUEUED },
{ (ALchar *)"AL_BUFFERS_PROCESSED", AL_BUFFERS_PROCESSED },
// Buffer Formats
{ (ALchar *)"AL_FORMAT_MONO8", AL_FORMAT_MONO8 },
{ (ALchar *)"AL_FORMAT_MONO16", AL_FORMAT_MONO16 },
{ (ALchar *)"AL_FORMAT_MONO_FLOAT32", AL_FORMAT_MONO_FLOAT32 },
{ (ALchar *)"AL_FORMAT_STEREO8", AL_FORMAT_STEREO8 },
{ (ALchar *)"AL_FORMAT_STEREO16", AL_FORMAT_STEREO16 },
{ (ALchar *)"AL_FORMAT_STEREO_FLOAT32", AL_FORMAT_STEREO_FLOAT32 },
{ (ALchar *)"AL_FORMAT_MONO_IMA4", AL_FORMAT_MONO_IMA4 },
{ (ALchar *)"AL_FORMAT_STEREO_IMA4", AL_FORMAT_STEREO_IMA4 },
{ (ALchar *)"AL_FORMAT_QUAD8_LOKI", AL_FORMAT_QUAD8_LOKI },
{ (ALchar *)"AL_FORMAT_QUAD16_LOKI", AL_FORMAT_QUAD16_LOKI },
{ (ALchar *)"AL_FORMAT_QUAD8", AL_FORMAT_QUAD8 },
{ (ALchar *)"AL_FORMAT_QUAD16", AL_FORMAT_QUAD16 },
{ (ALchar *)"AL_FORMAT_QUAD32", AL_FORMAT_QUAD32 },
{ (ALchar *)"AL_FORMAT_51CHN8", AL_FORMAT_51CHN8 },
{ (ALchar *)"AL_FORMAT_51CHN16", AL_FORMAT_51CHN16 },
{ (ALchar *)"AL_FORMAT_51CHN32", AL_FORMAT_51CHN32 },
{ (ALchar *)"AL_FORMAT_61CHN8", AL_FORMAT_61CHN8 },
{ (ALchar *)"AL_FORMAT_61CHN16", AL_FORMAT_61CHN16 },
{ (ALchar *)"AL_FORMAT_61CHN32", AL_FORMAT_61CHN32 },
{ (ALchar *)"AL_FORMAT_71CHN8", AL_FORMAT_71CHN8 },
{ (ALchar *)"AL_FORMAT_71CHN16", AL_FORMAT_71CHN16 },
{ (ALchar *)"AL_FORMAT_71CHN32", AL_FORMAT_71CHN32 },
{ (ALchar *)"AL_FORMAT_REAR8", AL_FORMAT_REAR8 },
{ (ALchar *)"AL_FORMAT_REAR16", AL_FORMAT_REAR16 },
{ (ALchar *)"AL_FORMAT_REAR32", AL_FORMAT_REAR32 },
// Buffer attributes
{ (ALchar *)"AL_FREQUENCY", AL_FREQUENCY },
{ (ALchar *)"AL_BITS", AL_BITS },
{ (ALchar *)"AL_CHANNELS", AL_CHANNELS },
{ (ALchar *)"AL_SIZE", AL_SIZE },
// Buffer States (not supported yet)
{ (ALchar *)"AL_UNUSED", AL_UNUSED },
{ (ALchar *)"AL_PENDING", AL_PENDING },
{ (ALchar *)"AL_PROCESSED", AL_PROCESSED },
// AL Error Messages
{ (ALchar *)"AL_NO_ERROR", AL_NO_ERROR },
{ (ALchar *)"AL_INVALID_NAME", AL_INVALID_NAME },
{ (ALchar *)"AL_INVALID_ENUM", AL_INVALID_ENUM },
{ (ALchar *)"AL_INVALID_VALUE", AL_INVALID_VALUE },
{ (ALchar *)"AL_INVALID_OPERATION", AL_INVALID_OPERATION },
{ (ALchar *)"AL_OUT_OF_MEMORY", AL_OUT_OF_MEMORY },
// Context strings
{ (ALchar *)"AL_VENDOR", AL_VENDOR },
{ (ALchar *)"AL_VERSION", AL_VERSION },
{ (ALchar *)"AL_RENDERER", AL_RENDERER },
{ (ALchar *)"AL_EXTENSIONS", AL_EXTENSIONS },
// Global states
{ (ALchar *)"AL_DOPPLER_FACTOR", AL_DOPPLER_FACTOR },
{ (ALchar *)"AL_DOPPLER_VELOCITY", AL_DOPPLER_VELOCITY },
{ (ALchar *)"AL_DISTANCE_MODEL", AL_DISTANCE_MODEL },
{ (ALchar *)"AL_SPEED_OF_SOUND", AL_SPEED_OF_SOUND },
// Distance Models
{ (ALchar *)"AL_INVERSE_DISTANCE", AL_INVERSE_DISTANCE },
{ (ALchar *)"AL_INVERSE_DISTANCE_CLAMPED", AL_INVERSE_DISTANCE_CLAMPED },
{ (ALchar *)"AL_LINEAR_DISTANCE", AL_LINEAR_DISTANCE },
{ (ALchar *)"AL_LINEAR_DISTANCE_CLAMPED", AL_LINEAR_DISTANCE_CLAMPED },
{ (ALchar *)"AL_EXPONENT_DISTANCE", AL_EXPONENT_DISTANCE },
{ (ALchar *)"AL_EXPONENT_DISTANCE_CLAMPED", AL_EXPONENT_DISTANCE_CLAMPED },
// Filter types
{ (ALchar *)"AL_FILTER_TYPE", AL_FILTER_TYPE },
{ (ALchar *)"AL_FILTER_NULL", AL_FILTER_NULL },
{ (ALchar *)"AL_FILTER_LOWPASS", AL_FILTER_LOWPASS },
{ (ALchar *)"AL_FILTER_HIGHPASS", AL_FILTER_HIGHPASS },
{ (ALchar *)"AL_FILTER_BANDPASS", AL_FILTER_BANDPASS },
// Filter params
{ (ALchar *)"AL_LOWPASS_GAIN", AL_LOWPASS_GAIN },
{ (ALchar *)"AL_LOWPASS_GAINHF", AL_LOWPASS_GAINHF },
// Effect types
{ (ALchar *)"AL_EFFECT_TYPE", AL_EFFECT_TYPE },
{ (ALchar *)"AL_EFFECT_NULL", AL_EFFECT_NULL },
{ (ALchar *)"AL_EFFECT_REVERB", AL_EFFECT_REVERB },
{ (ALchar *)"AL_EFFECT_CHORUS", AL_EFFECT_CHORUS },
{ (ALchar *)"AL_EFFECT_DISTORTION", AL_EFFECT_DISTORTION },
{ (ALchar *)"AL_EFFECT_ECHO", AL_EFFECT_ECHO },
{ (ALchar *)"AL_EFFECT_FLANGER", AL_EFFECT_FLANGER },
{ (ALchar *)"AL_EFFECT_FREQUENCY_SHIFTER", AL_EFFECT_FREQUENCY_SHIFTER },
{ (ALchar *)"AL_EFFECT_VOCAL_MORPHER", AL_EFFECT_VOCAL_MORPHER },
{ (ALchar *)"AL_EFFECT_PITCH_SHIFTER", AL_EFFECT_PITCH_SHIFTER },
{ (ALchar *)"AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR },
{ (ALchar *)"AL_EFFECT_AUTOWAH", AL_EFFECT_AUTOWAH },
{ (ALchar *)"AL_EFFECT_COMPRESSOR", AL_EFFECT_COMPRESSOR },
{ (ALchar *)"AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER },
// Reverb params
{ (ALchar *)"AL_REVERB_DENSITY", AL_REVERB_DENSITY },
{ (ALchar *)"AL_REVERB_DIFFUSION", AL_REVERB_DIFFUSION },
{ (ALchar *)"AL_REVERB_GAIN", AL_REVERB_GAIN },
{ (ALchar *)"AL_REVERB_GAINHF", AL_REVERB_GAINHF },
{ (ALchar *)"AL_REVERB_DECAY_TIME", AL_REVERB_DECAY_TIME },
{ (ALchar *)"AL_REVERB_DECAY_HFRATIO", AL_REVERB_DECAY_HFRATIO },
{ (ALchar *)"AL_REVERB_REFLECTIONS_GAIN", AL_REVERB_REFLECTIONS_GAIN },
{ (ALchar *)"AL_REVERB_REFLECTIONS_DELAY", AL_REVERB_REFLECTIONS_DELAY },
{ (ALchar *)"AL_REVERB_LATE_REVERB_GAIN", AL_REVERB_LATE_REVERB_GAIN },
{ (ALchar *)"AL_REVERB_LATE_REVERB_DELAY", AL_REVERB_LATE_REVERB_DELAY },
{ (ALchar *)"AL_REVERB_AIR_ABSORPTION_GAINHF", AL_REVERB_AIR_ABSORPTION_GAINHF },
{ (ALchar *)"AL_REVERB_ROOM_ROLLOFF_FACTOR", AL_REVERB_ROOM_ROLLOFF_FACTOR },
{ (ALchar *)"AL_REVERB_DECAY_HFLIMIT", AL_REVERB_DECAY_HFLIMIT },
// Default
{ (ALchar *)NULL, (ALenum)0 }
};
ALAPI ALboolean ALAPIENTRY alIsExtensionPresent(const ALchar *extName)
{
ALboolean bIsSupported = AL_FALSE;
ALCcontext *pContext;
const char *ptr;
size_t len;
if (!extName)
{
alSetError(AL_INVALID_VALUE);
return AL_FALSE;
}
pContext = alcGetCurrentContext();
if(!pContext)
{
alSetError(AL_INVALID_OPERATION);
return AL_FALSE;
}
SuspendContext(pContext);
len = strlen(extName);
ptr = pContext->ExtensionList;
while(ptr && *ptr)
{
if(strncasecmp(ptr, extName, len) == 0 &&
(ptr[len] == '\0' || isspace(ptr[len])))
{
bIsSupported = AL_TRUE;
break;
}
if((ptr=strchr(ptr, ' ')) != NULL)
{
do {
++ptr;
} while(isspace(*ptr));
}
}
ProcessContext(pContext);
return bIsSupported;
}
ALAPI ALvoid * ALAPIENTRY alGetProcAddress(const ALchar *funcName)
{
ALsizei i = 0;
while(function[i].funcName &&
strcmp((char*)function[i].funcName, (char*)funcName) != 0)
i++;
return function[i].address;
}
/* NOTE: This function must be able to run without a context! */
ALAPI ALenum ALAPIENTRY alGetEnumValue(const ALchar *enumName)
{
ALsizei i = 0;
while(enumeration[i].enumName &&
strcmp(enumeration[i].enumName, enumName) != 0)
i++;
return enumeration[i].value;
}
-424
View File
@@ -1,424 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include "AL/al.h"
#include "AL/alc.h"
#include "alMain.h"
#include "alFilter.h"
#include "alThunk.h"
#include "alError.h"
static ALfilter *g_FilterList;
static ALuint g_FilterCount;
static void InitFilterParams(ALfilter *filter, ALenum type);
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
{
ALCcontext *Context;
ALsizei i;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (n > 0)
{
// Check that enough memory has been allocted in the 'filters' array for n Filters
if (!IsBadWritePtr((void*)filters, n * sizeof(ALuint)))
{
ALfilter **list = &g_FilterList;
while(*list)
list = &(*list)->next;
i = 0;
while(i < n)
{
*list = calloc(1, sizeof(ALfilter));
if(!(*list))
{
// We must have run out or memory
alDeleteFilters(i, filters);
alSetError(AL_OUT_OF_MEMORY);
break;
}
filters[i] = (ALuint)ALTHUNK_ADDENTRY(*list);
(*list)->filter = filters[i];
InitFilterParams(*list, AL_FILTER_NULL);
g_FilterCount++;
i++;
list = &(*list)->next;
}
}
}
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters)
{
ALCcontext *Context;
ALfilter *ALFilter;
ALsizei i;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (n >= 0)
{
// Check that all filters are valid
for (i = 0; i < n; i++)
{
if (!alIsFilter(filters[i]))
{
alSetError(AL_INVALID_NAME);
break;
}
}
if (i == n)
{
// All filters are valid
for (i = 0; i < n; i++)
{
// Recheck that the filter is valid, because there could be duplicated names
if (filters[i] && alIsFilter(filters[i]))
{
ALfilter **list;
ALFilter = ((ALfilter*)ALTHUNK_LOOKUPENTRY(filters[i]));
// Remove Source from list of Sources
list = &g_FilterList;
while(*list && *list != ALFilter)
list = &(*list)->next;
if(*list)
*list = (*list)->next;
ALTHUNK_REMOVEENTRY(ALFilter->filter);
memset(ALFilter, 0, sizeof(ALfilter));
free(ALFilter);
g_FilterCount--;
}
}
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(Context);
}
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter)
{
ALCcontext *Context;
ALfilter **list;
Context = alcGetCurrentContext();
SuspendContext(Context);
list = &g_FilterList;
while(*list && (*list)->filter != filter)
list = &(*list)->next;
ProcessContext(Context);
return ((*list || !filter) ? AL_TRUE : AL_FALSE);
}
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (filter && alIsFilter(filter))
{
ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter);
switch(param)
{
case AL_FILTER_TYPE:
if(iValue == AL_FILTER_NULL ||
iValue == AL_FILTER_LOWPASS)
InitFilterParams(ALFilter, iValue);
else
alSetError(AL_INVALID_VALUE);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (filter && alIsFilter(filter))
{
switch(param)
{
case AL_FILTER_TYPE:
alFilteri(filter, param, piValues[0]);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (filter && alIsFilter(filter))
{
ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter);
switch(param)
{
case AL_LOWPASS_GAIN:
if(ALFilter->type == AL_FILTER_LOWPASS)
{
if(flValue >= 0.0f && flValue <= 1.0f)
ALFilter->Gain = flValue;
}
else
alSetError(AL_INVALID_ENUM);
break;
case AL_LOWPASS_GAINHF:
if(ALFilter->type == AL_FILTER_LOWPASS)
{
if(flValue >= 0.0f && flValue <= 1.0f)
ALFilter->GainHF = flValue;
}
else
alSetError(AL_INVALID_ENUM);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (filter && alIsFilter(filter))
{
switch(param)
{
case AL_LOWPASS_GAIN:
case AL_LOWPASS_GAINHF:
alFilterf(filter, param, pflValues[0]);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue)
{
ALCcontext *Context;
(void)piValue;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (filter && alIsFilter(filter))
{
switch(param)
{
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues)
{
ALCcontext *Context;
(void)piValues;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (filter && alIsFilter(filter))
{
switch(param)
{
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (filter && alIsFilter(filter))
{
ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter);
switch(param)
{
case AL_LOWPASS_GAIN:
if(ALFilter->type == AL_FILTER_LOWPASS)
*pflValue = ALFilter->Gain;
else
alSetError(AL_INVALID_ENUM);
break;
case AL_LOWPASS_GAINHF:
if(ALFilter->type == AL_FILTER_LOWPASS)
*pflValue = ALFilter->GainHF;
else
alSetError(AL_INVALID_ENUM);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues)
{
ALCcontext *Context;
Context = alcGetCurrentContext();
SuspendContext(Context);
if (filter && alIsFilter(filter))
{
switch(param)
{
case AL_LOWPASS_GAIN:
case AL_LOWPASS_GAINHF:
alGetFilterf(filter, param, pflValues);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_NAME);
ProcessContext(Context);
}
ALvoid ReleaseALFilters(ALvoid)
{
#ifdef _DEBUG
if(g_FilterCount > 0)
AL_PRINT("exit() %d Filter(s) NOT deleted\n", g_FilterCount);
#endif
while(g_FilterList)
{
ALfilter *temp = g_FilterList;
g_FilterList = g_FilterList->next;
// Release filter structure
memset(temp, 0, sizeof(ALfilter));
free(temp);
}
g_FilterCount = 0;
}
static void InitFilterParams(ALfilter *filter, ALenum type)
{
filter->type = type;
filter->Gain = 1.0;
filter->GainHF = 1.0;
}
-537
View File
@@ -1,537 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2000 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include "alMain.h"
#include "AL/alc.h"
#include "alError.h"
#include "alListener.h"
ALAPI ALvoid ALAPIENTRY alListenerf(ALenum eParam, ALfloat flValue)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
switch (eParam)
{
case AL_GAIN:
if (flValue >= 0.0f)
pContext->Listener.Gain = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
case AL_METERS_PER_UNIT:
if (flValue > 0.0f)
pContext->Listener.MetersPerUnit = flValue;
else
alSetError(AL_INVALID_VALUE);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI ALvoid ALAPIENTRY alListener3f(ALenum eParam, ALfloat flValue1, ALfloat flValue2, ALfloat flValue3)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
switch(eParam)
{
case AL_POSITION:
pContext->Listener.Position[0] = flValue1;
pContext->Listener.Position[1] = flValue2;
pContext->Listener.Position[2] = flValue3;
break;
case AL_VELOCITY:
pContext->Listener.Velocity[0] = flValue1;
pContext->Listener.Velocity[1] = flValue2;
pContext->Listener.Velocity[2] = flValue3;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI ALvoid ALAPIENTRY alListenerfv(ALenum eParam, const ALfloat *pflValues)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if (pflValues)
{
switch (eParam)
{
case AL_GAIN:
if (pflValues[0] >= 0.0f)
pContext->Listener.Gain = pflValues[0];
else
alSetError(AL_INVALID_VALUE);
break;
case AL_METERS_PER_UNIT:
if (pflValues[0] > 0.0f)
pContext->Listener.MetersPerUnit = pflValues[0];
else
alSetError(AL_INVALID_VALUE);
break;
case AL_POSITION:
pContext->Listener.Position[0] = pflValues[0];
pContext->Listener.Position[1] = pflValues[1];
pContext->Listener.Position[2] = pflValues[2];
break;
case AL_VELOCITY:
pContext->Listener.Velocity[0] = pflValues[0];
pContext->Listener.Velocity[1] = pflValues[1];
pContext->Listener.Velocity[2] = pflValues[2];
break;
case AL_ORIENTATION:
// AT then UP
pContext->Listener.Forward[0] = pflValues[0];
pContext->Listener.Forward[1] = pflValues[1];
pContext->Listener.Forward[2] = pflValues[2];
pContext->Listener.Up[0] = pflValues[3];
pContext->Listener.Up[1] = pflValues[4];
pContext->Listener.Up[2] = pflValues[5];
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI ALvoid ALAPIENTRY alListeneri(ALenum eParam, ALint lValue)
{
ALCcontext *pContext;
(void)lValue;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
switch (eParam)
{
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI void ALAPIENTRY alListener3i(ALenum eParam, ALint lValue1, ALint lValue2, ALint lValue3)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
switch(eParam)
{
case AL_POSITION:
case AL_VELOCITY:
alListener3f(eParam, (ALfloat)lValue1, (ALfloat)lValue2, (ALfloat)lValue3);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI void ALAPIENTRY alListeneriv( ALenum eParam, const ALint* plValues )
{
ALCcontext *pContext;
ALfloat flValues[6];
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if (plValues)
{
switch (eParam)
{
case AL_POSITION:
case AL_VELOCITY:
flValues[0] = (ALfloat)plValues[0];
flValues[1] = (ALfloat)plValues[1];
flValues[2] = (ALfloat)plValues[2];
alListenerfv(eParam, flValues);
break;
case AL_ORIENTATION:
flValues[0] = (ALfloat)plValues[0];
flValues[1] = (ALfloat)plValues[1];
flValues[2] = (ALfloat)plValues[2];
flValues[3] = (ALfloat)plValues[3];
flValues[4] = (ALfloat)plValues[4];
flValues[5] = (ALfloat)plValues[5];
alListenerfv(eParam, flValues);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI ALvoid ALAPIENTRY alGetListenerf(ALenum eParam, ALfloat *pflValue)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if (pflValue)
{
switch (eParam)
{
case AL_GAIN:
*pflValue = pContext->Listener.Gain;
break;
case AL_METERS_PER_UNIT:
*pflValue = pContext->Listener.MetersPerUnit;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI ALvoid ALAPIENTRY alGetListener3f(ALenum eParam, ALfloat *pflValue1, ALfloat *pflValue2, ALfloat *pflValue3)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if ((pflValue1) && (pflValue2) && (pflValue3))
{
switch (eParam)
{
case AL_POSITION:
*pflValue1 = pContext->Listener.Position[0];
*pflValue2 = pContext->Listener.Position[1];
*pflValue3 = pContext->Listener.Position[2];
break;
case AL_VELOCITY:
*pflValue1 = pContext->Listener.Velocity[0];
*pflValue2 = pContext->Listener.Velocity[1];
*pflValue3 = pContext->Listener.Velocity[2];
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI ALvoid ALAPIENTRY alGetListenerfv(ALenum eParam, ALfloat *pflValues)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if (pflValues)
{
switch (eParam)
{
case AL_GAIN:
pflValues[0] = pContext->Listener.Gain;
break;
case AL_METERS_PER_UNIT:
pflValues[0] = pContext->Listener.MetersPerUnit;
break;
case AL_POSITION:
pflValues[0] = pContext->Listener.Position[0];
pflValues[1] = pContext->Listener.Position[1];
pflValues[2] = pContext->Listener.Position[2];
break;
case AL_VELOCITY:
pflValues[0] = pContext->Listener.Velocity[0];
pflValues[1] = pContext->Listener.Velocity[1];
pflValues[2] = pContext->Listener.Velocity[2];
break;
case AL_ORIENTATION:
// AT then UP
pflValues[0] = pContext->Listener.Forward[0];
pflValues[1] = pContext->Listener.Forward[1];
pflValues[2] = pContext->Listener.Forward[2];
pflValues[3] = pContext->Listener.Up[0];
pflValues[4] = pContext->Listener.Up[1];
pflValues[5] = pContext->Listener.Up[2];
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI ALvoid ALAPIENTRY alGetListeneri(ALenum eParam, ALint *plValue)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if (plValue)
{
switch (eParam)
{
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI void ALAPIENTRY alGetListener3i(ALenum eParam, ALint *plValue1, ALint *plValue2, ALint *plValue3)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if ((plValue1) && (plValue2) && (plValue3))
{
switch (eParam)
{
case AL_POSITION:
*plValue1 = (ALint)pContext->Listener.Position[0];
*plValue2 = (ALint)pContext->Listener.Position[1];
*plValue3 = (ALint)pContext->Listener.Position[2];
break;
case AL_VELOCITY:
*plValue1 = (ALint)pContext->Listener.Velocity[0];
*plValue2 = (ALint)pContext->Listener.Velocity[1];
*plValue3 = (ALint)pContext->Listener.Velocity[2];
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
ALAPI void ALAPIENTRY alGetListeneriv(ALenum eParam, ALint* plValues)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if (plValues)
{
switch (eParam)
{
case AL_POSITION:
plValues[0] = (ALint)pContext->Listener.Position[0];
plValues[1] = (ALint)pContext->Listener.Position[1];
plValues[2] = (ALint)pContext->Listener.Position[2];
break;
case AL_VELOCITY:
plValues[0] = (ALint)pContext->Listener.Velocity[0];
plValues[1] = (ALint)pContext->Listener.Velocity[1];
plValues[2] = (ALint)pContext->Listener.Velocity[2];
break;
case AL_ORIENTATION:
// AT then UP
plValues[0] = (ALint)pContext->Listener.Forward[0];
plValues[1] = (ALint)pContext->Listener.Forward[1];
plValues[2] = (ALint)pContext->Listener.Forward[2];
plValues[3] = (ALint)pContext->Listener.Up[0];
plValues[4] = (ALint)pContext->Listener.Up[1];
plValues[5] = (ALint)pContext->Listener.Up[2];
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
alSetError(AL_INVALID_OPERATION);
return;
}
-2305
View File
File diff suppressed because it is too large Load Diff
-679
View File
@@ -1,679 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2000 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include "alMain.h"
#include "AL/alc.h"
#include "alError.h"
#include "alState.h"
static const ALchar alVendor[] = "OpenAL Community";
static const ALchar alVersion[] = "1.1";
static const ALchar alRenderer[] = "OpenAL Soft";
// Error Messages
static const ALchar alNoError[] = "No Error";
static const ALchar alErrInvalidName[] = "Invalid Name";
static const ALchar alErrInvalidEnum[] = "Invalid Enum";
static const ALchar alErrInvalidValue[] = "Invalid Value";
static const ALchar alErrInvalidOp[] = "Invalid Operation";
static const ALchar alErrOutOfMemory[] = "Out of Memory";
ALAPI ALvoid ALAPIENTRY alEnable(ALenum capability)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
switch (capability)
{
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
}
ALAPI ALvoid ALAPIENTRY alDisable(ALenum capability)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
switch (capability)
{
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
}
ALAPI ALboolean ALAPIENTRY alIsEnabled(ALenum capability)
{
ALCcontext *Context;
ALboolean value=AL_FALSE;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
switch (capability)
{
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return value;
}
ALAPI ALboolean ALAPIENTRY alGetBoolean(ALenum pname)
{
ALCcontext *Context;
ALboolean value=AL_FALSE;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
switch (pname)
{
case AL_DOPPLER_FACTOR:
if (Context->DopplerFactor != 0.0f)
value = AL_TRUE;
break;
case AL_DOPPLER_VELOCITY:
if (Context->DopplerVelocity != 0.0f)
value = AL_TRUE;
break;
case AL_DISTANCE_MODEL:
if (Context->DistanceModel == AL_INVERSE_DISTANCE_CLAMPED)
value = AL_TRUE;
break;
case AL_SPEED_OF_SOUND:
if (Context->flSpeedOfSound != 0.0f)
value = AL_TRUE;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return value;
}
ALAPI ALdouble ALAPIENTRY alGetDouble(ALenum pname)
{
ALCcontext *Context;
ALdouble value = 0.0;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
switch (pname)
{
case AL_DOPPLER_FACTOR:
value = (double)Context->DopplerFactor;
break;
case AL_DOPPLER_VELOCITY:
value = (double)Context->DopplerVelocity;
break;
case AL_DISTANCE_MODEL:
value = (double)Context->DistanceModel;
break;
case AL_SPEED_OF_SOUND:
value = (double)Context->flSpeedOfSound;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return value;
}
ALAPI ALfloat ALAPIENTRY alGetFloat(ALenum pname)
{
ALCcontext *Context;
ALfloat value = 0.0f;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
switch (pname)
{
case AL_DOPPLER_FACTOR:
value = Context->DopplerFactor;
break;
case AL_DOPPLER_VELOCITY:
value = Context->DopplerVelocity;
break;
case AL_DISTANCE_MODEL:
value = (float)Context->DistanceModel;
break;
case AL_SPEED_OF_SOUND:
value = Context->flSpeedOfSound;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return value;
}
ALAPI ALint ALAPIENTRY alGetInteger(ALenum pname)
{
ALCcontext *Context;
ALint value = 0;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
switch (pname)
{
case AL_DOPPLER_FACTOR:
value = (ALint)Context->DopplerFactor;
break;
case AL_DOPPLER_VELOCITY:
value = (ALint)Context->DopplerVelocity;
break;
case AL_DISTANCE_MODEL:
value = (ALint)Context->DistanceModel;
break;
case AL_SPEED_OF_SOUND:
value = (ALint)Context->flSpeedOfSound;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return value;
}
ALAPI ALvoid ALAPIENTRY alGetBooleanv(ALenum pname,ALboolean *data)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
if (data)
{
switch (pname)
{
case AL_DOPPLER_FACTOR:
*data = (ALboolean)((Context->DopplerFactor != 0.0f) ? AL_TRUE : AL_FALSE);
break;
case AL_DOPPLER_VELOCITY:
*data = (ALboolean)((Context->DopplerVelocity != 0.0f) ? AL_TRUE : AL_FALSE);
break;
case AL_DISTANCE_MODEL:
*data = (ALboolean)((Context->DistanceModel == AL_INVERSE_DISTANCE_CLAMPED) ? AL_TRUE : AL_FALSE);
break;
case AL_SPEED_OF_SOUND:
*data = (ALboolean)((Context->flSpeedOfSound != 0.0f) ? AL_TRUE : AL_FALSE);
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
{
// data is a NULL pointer
alSetError(AL_INVALID_VALUE);
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return;
}
ALAPI ALvoid ALAPIENTRY alGetDoublev(ALenum pname,ALdouble *data)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
if (data)
{
switch (pname)
{
case AL_DOPPLER_FACTOR:
*data = (double)Context->DopplerFactor;
break;
case AL_DOPPLER_VELOCITY:
*data = (double)Context->DopplerVelocity;
break;
case AL_DISTANCE_MODEL:
*data = (double)Context->DistanceModel;
break;
case AL_SPEED_OF_SOUND:
*data = (double)Context->flSpeedOfSound;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
{
// data is a NULL pointer
alSetError(AL_INVALID_VALUE);
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return;
}
ALAPI ALvoid ALAPIENTRY alGetFloatv(ALenum pname,ALfloat *data)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
if (data)
{
switch (pname)
{
case AL_DOPPLER_FACTOR:
*data = Context->DopplerFactor;
break;
case AL_DOPPLER_VELOCITY:
*data = Context->DopplerVelocity;
break;
case AL_DISTANCE_MODEL:
*data = (float)Context->DistanceModel;
break;
case AL_SPEED_OF_SOUND:
*data = Context->flSpeedOfSound;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
{
// data is a NULL pointer
alSetError(AL_INVALID_VALUE);
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return;
}
ALAPI ALvoid ALAPIENTRY alGetIntegerv(ALenum pname,ALint *data)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
if (data)
{
switch (pname)
{
case AL_DOPPLER_FACTOR:
*data = (ALint)Context->DopplerFactor;
break;
case AL_DOPPLER_VELOCITY:
*data = (ALint)Context->DopplerVelocity;
break;
case AL_DISTANCE_MODEL:
*data = (ALint)Context->DistanceModel;
break;
case AL_SPEED_OF_SOUND:
*data = (ALint)Context->flSpeedOfSound;
break;
default:
alSetError(AL_INVALID_ENUM);
break;
}
}
else
{
// data is a NULL pointer
alSetError(AL_INVALID_VALUE);
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return;
}
ALAPI const ALchar* ALAPIENTRY alGetString(ALenum pname)
{
const ALchar *value;
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if(!pContext)
{
alSetError(AL_INVALID_OPERATION);
return NULL;
}
SuspendContext(pContext);
switch(pname)
{
case AL_VENDOR:
value=alVendor;
break;
case AL_VERSION:
value=alVersion;
break;
case AL_RENDERER:
value=alRenderer;
break;
case AL_EXTENSIONS:
value=pContext->ExtensionList;//alExtensions;
break;
case AL_NO_ERROR:
value=alNoError;
break;
case AL_INVALID_NAME:
value=alErrInvalidName;
break;
case AL_INVALID_ENUM:
value=alErrInvalidEnum;
break;
case AL_INVALID_VALUE:
value=alErrInvalidValue;
break;
case AL_INVALID_OPERATION:
value=alErrInvalidOp;
break;
case AL_OUT_OF_MEMORY:
value=alErrOutOfMemory;
break;
default:
value=NULL;
alSetError(AL_INVALID_ENUM);
break;
}
ProcessContext(pContext);
return value;
}
ALAPI ALvoid ALAPIENTRY alDopplerFactor(ALfloat value)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
if (value>=0.0f)
Context->DopplerFactor = value;
else
alSetError(AL_INVALID_VALUE);
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return;
}
ALAPI ALvoid ALAPIENTRY alDopplerVelocity(ALfloat value)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
if (value>0.0f)
Context->DopplerVelocity=value;
else
alSetError(AL_INVALID_VALUE);
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return;
}
ALAPI ALvoid ALAPIENTRY alSpeedOfSound(ALfloat flSpeedOfSound)
{
ALCcontext *pContext;
pContext = alcGetCurrentContext();
if (pContext)
{
SuspendContext(pContext);
if (flSpeedOfSound > 0.0f)
pContext->flSpeedOfSound = flSpeedOfSound;
else
alSetError(AL_INVALID_VALUE);
ProcessContext(pContext);
}
else
{
alSetError(AL_INVALID_OPERATION);
}
return;
}
ALAPI ALvoid ALAPIENTRY alDistanceModel(ALenum value)
{
ALCcontext *Context;
Context=alcGetCurrentContext();
if (Context)
{
SuspendContext(Context);
switch (value)
{
case AL_NONE:
case AL_INVERSE_DISTANCE:
case AL_INVERSE_DISTANCE_CLAMPED:
case AL_LINEAR_DISTANCE:
case AL_LINEAR_DISTANCE_CLAMPED:
case AL_EXPONENT_DISTANCE:
case AL_EXPONENT_DISTANCE_CLAMPED:
Context->DistanceModel = value;
break;
default:
alSetError(AL_INVALID_VALUE);
break;
}
ProcessContext(Context);
}
else
{
// Invalid Context
alSetError(AL_INVALID_OPERATION);
}
return;
}
-110
View File
@@ -1,110 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 1999-2007 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <stdlib.h>
#include "alMain.h"
#include "alThunk.h"
typedef struct {
ALvoid *ptr;
ALboolean InUse;
} ThunkEntry;
static ThunkEntry *g_ThunkArray;
static ALuint g_ThunkArraySize;
static CRITICAL_SECTION g_ThunkLock;
void alThunkInit(void)
{
InitializeCriticalSection(&g_ThunkLock);
g_ThunkArraySize = 1;
g_ThunkArray = calloc(1, g_ThunkArraySize * sizeof(ThunkEntry));
}
void alThunkExit(void)
{
free(g_ThunkArray);
g_ThunkArray = NULL;
g_ThunkArraySize = 0;
DeleteCriticalSection(&g_ThunkLock);
}
ALuint alThunkAddEntry(ALvoid *ptr)
{
ALuint index;
EnterCriticalSection(&g_ThunkLock);
for(index = 0;index < g_ThunkArraySize;index++)
{
if(g_ThunkArray[index].InUse == AL_FALSE)
break;
}
if(index == g_ThunkArraySize)
{
ThunkEntry *NewList;
NewList = realloc(g_ThunkArray, g_ThunkArraySize*2 * sizeof(ThunkEntry));
if(!NewList)
{
LeaveCriticalSection(&g_ThunkLock);
return 0;
}
memset(&NewList[g_ThunkArraySize], 0, g_ThunkArraySize*sizeof(ThunkEntry));
g_ThunkArraySize *= 2;
g_ThunkArray = NewList;
}
g_ThunkArray[index].ptr = ptr;
g_ThunkArray[index].InUse = AL_TRUE;
LeaveCriticalSection(&g_ThunkLock);
return index+1;
}
void alThunkRemoveEntry(ALuint index)
{
EnterCriticalSection(&g_ThunkLock);
if(index > 0 && index <= g_ThunkArraySize)
g_ThunkArray[index-1].InUse = AL_FALSE;
LeaveCriticalSection(&g_ThunkLock);
}
ALvoid *alThunkLookupEntry(ALuint index)
{
ALvoid *ptr = NULL;
EnterCriticalSection(&g_ThunkLock);
if(index > 0 && index <= g_ThunkArraySize)
ptr = g_ThunkArray[index-1].ptr;
LeaveCriticalSection(&g_ThunkLock);
return ptr;
}
+16
View File
@@ -0,0 +1,16 @@
# openal-soft-vita
This repo contains patchsets for vita [openal-soft](https://openal-soft.org/) port.
Format is openal-soft-<openal_version>-vita-<patchset_version>.patch
For full source see vita-* branches
# building
```
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
make install
```
-95
View File
@@ -1,95 +0,0 @@
# OpenAL config file. Options that are not under a block or are under the
# [general] block are for general, non-backend-specific options. Blocks may
# appear multiple times, and duplicated options will take the last value
# specified.
# The system-wide settings can be put in /etc/openal/alsoft.conf and user-
# specific override settings in ~/.alsoftrc.
# For Windows, these settings should go into %AppData%\alsoft.ini
# Option and block names are case-insenstive. The supplied values are only
# hints and may not be honored (though generally it'll try to get as close as
# possible). These are the current available settings:
format = AL_FORMAT_STEREO16 # Sets the output format. Can be one of:
# AL_FORMAT_MONO8 (8-bit mono)
# AL_FORMAT_STEREO8 (8-bit stereo)
# AL_FORMAT_QUAD8 (8-bit 4-channel)
# AL_FORMAT_51CHN8 (8-bit 5.1 output)
# AL_FORMAT_61CHN8 (8-bit 6.1 output)
# AL_FORMAT_71CHN8 (8-bit 7.1 output)
# AL_FORMAT_MONO16 (16-bit mono)
# AL_FORMAT_STEREO16 (16-bit stereo)
# AL_FORMAT_QUAD16 (16-bit 4-channel)
# AL_FORMAT_51CHN16 (16-bit 5.1 output)
# AL_FORMAT_61CHN16 (16-bit 6.1 output)
# AL_FORMAT_71CHN16 (16-bit 7.1 output)
# Default is AL_FORMAT_STEREO16
cf_level = 0 # Sets the crossfeed level for stereo output. Valid values are:
# 0 - No crossfeed
# 1 - Low crossfeed
# 2 - Middle crossfeed
# 3 - High crossfeed (virtual speakers are closer to itself)
# 4 - Low easy crossfeed
# 5 - Middle easy crossfeed
# 6 - High easy crossfeed
# Default is 0. Users of headphones may want to try various
# settings. Has no effect on non-stereo modes.
frequency = 44100 # Sets the output frequency. Default is 44100
refresh = 8192 # Sets the buffer size, in frames. Default is 8192. Note that
# the actual granularity may or may not be less than this.
sources = 256 # Sets the maximum number of allocatable sources. Lower values
# may help for systems with apps that try to play more sounds
# than the CPU can handle. Default is 256
stereodup = # Sets whether to duplicate stereo sounds on the rear speakers for
# 4+ channel output. This can make stereo sources substantially
# louder than mono or even 4+ channel sources, but provides a
# "fuller" playback quality. True, yes, on, and non-0 values will
# duplicate stereo sources. 0 and anything else will cause stereo
# sounds to only play out the front speakers.
# Default is false
drivers = # Sets the backend driver list order, comma-seperated. Unknown
# backends and duplicated names are ignored, and unlisted backends
# won't be considered for use. An empty list means the default.
# Default is:
# alsa,oss,dsound,winmm,wave
[alsa] # ALSA backend stuff
device = default # Sets the device name for the default playback device.
# Default is default
periods = 0 # Sets the number of update buffers for playback. A value of 0
# means auto-select. Default is 0
capture = default # Sets the device name for the default capture device.
# Default is default
mmap = true # Sets whether to try using mmap mode (helps reduce latencies and
# CPU consumption). If mmap isn't available, it will automatically
# fall back to non-mmap mode. True, yes, on, and non-0 values will
# attempt to use mmap. 0 and anything else will force mmap off.
# Default is true.
[oss] # OSS backend stuff
device = /dev/dsp # Sets the device name for OSS output. Default is /dev/dsp
periods = 4 # Sets the number of update buffers. Default is 4
capture = /dev/dsp # Sets the device name for OSS capture. Default is /dev/dsp
[dsound] # DirectSound backend stuff
# Nothing yet...
[winmm] # Windows Multimedia backend stuff
# Nothing yet...
[wave] # Wave File Writer stuff
file = # Sets the filename of the wave file to write to. An empty name
# prevents the backend from opening, even when explicitly requested.
# THIS WILL OVERWRITE EXISTING FILES WITHOUT QUESTION!
# Default is empty
-52
View File
@@ -1,52 +0,0 @@
#ifndef CONFIG_H
#define CONFIG_H
/* Define if we have the ALSA backend */
#cmakedefine HAVE_ALSA
/* Define if we have the OSS backend */
#cmakedefine HAVE_OSS
/* Define if we have the DSound backend */
#cmakedefine HAVE_DSOUND
/* Define if we have the Windows Multimedia backend */
#cmakedefine HAVE_WINMM
/* Define if we have dlfcn.h */
#cmakedefine HAVE_DLFCN_H
/* Define if we have the sqrtf function */
#cmakedefine HAVE_SQRTF
/* Define if we have the acosf function */
#cmakedefine HAVE_ACOSF
/* Define if we have the strtof function */
#cmakedefine HAVE_STRTOF
/* Define if we have stdint.h */
#cmakedefine HAVE_STDINT_H
/* Define if we have the __int64 type */
#cmakedefine HAVE___INT64
/* Define to the size of a long int type */
#cmakedefine SIZEOF_LONG ${SIZEOF_LONG}
/* Define to the size of a long long int type */
#cmakedefine SIZEOF_LONG_LONG ${SIZEOF_LONG_LONG}
/* Define to the size of an unsigned int type */
#cmakedefine SIZEOF_UINT ${SIZEOF_UINT}
/* Define to the size of a void pointer type */
#cmakedefine SIZEOF_VOIDP ${SIZEOF_VOIDP}
/* Define if we have GCC's destructor attribute */
#cmakedefine HAVE_GCC_DESTRUCTOR
/* Define if we have pthread_np.h */
#cmakedefine HAVE_PTHREAD_NP_H
#endif
-171
View File
@@ -1,171 +0,0 @@
/*
* openal-info: Display information about ALC and AL.
*
* Idea based on glxinfo for OpenGL.
* Initial OpenAL version by Erik Hofman <erik@ehofman.com>.
* Further hacked by Sven Panne <sven.panne@aedion.de>.
* More work (clean up) by Chris Robinson <chris.kcat@gmail.com>.
*
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "AL/alc.h"
#include "AL/al.h"
#include "AL/alext.h"
static const int indentation = 4;
static const int maxmimumWidth = 79;
static void printChar(int c, int *width)
{
putchar(c);
*width = ((c == '\n') ? 0 : ((*width) + 1));
}
static void indent(int *width)
{
int i;
for(i = 0; i < indentation; i++)
printChar(' ', width);
}
static void printExtensions(const char *header, char separator, const char *extensions)
{
int width = 0, start = 0, end = 0;
printf("%s:\n", header);
if(extensions == NULL || extensions[0] == '\0')
return;
indent(&width);
while (1)
{
if(extensions[end] == separator || extensions[end] == '\0')
{
if(width + end - start + 2 > maxmimumWidth)
{
printChar('\n', &width);
indent(&width);
}
while(start < end)
{
printChar(extensions[start], &width);
start++;
}
if(extensions[end] == '\0')
break;
start++;
end++;
if(extensions[end] == '\0')
break;
printChar(',', &width);
printChar(' ', &width);
}
end++;
}
printChar('\n', &width);
}
static void die(const char *kind, const char *description)
{
fprintf(stderr, "%s error %s occured\n", kind, description);
exit(EXIT_FAILURE);
}
static void checkForErrors(void)
{
{
ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext());
ALCenum error = alcGetError(device);
if(error != ALC_NO_ERROR)
die("ALC", (const char*)alcGetString(device, error));
}
{
ALenum error = alGetError();
if(error != AL_NO_ERROR)
die("AL", (const char*)alGetString(error));
}
}
static void printDevices(ALCenum which, const char *kind)
{
const char *s = alcGetString(NULL, which);
checkForErrors();
printf("Available %sdevices:\n", kind);
while(*s != '\0')
{
printf(" %s\n", s);
while(*s++ != '\0')
;
}
}
static void printALCInfo (void)
{
ALCint major, minor;
ALCdevice *device;
if(alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)
{
if(alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATE_ALL_EXT") == AL_TRUE)
printDevices(ALC_ALL_DEVICES_SPECIFIER, "playback ");
else
printDevices(ALC_DEVICE_SPECIFIER, "playback ");
printDevices(ALC_CAPTURE_DEVICE_SPECIFIER, "capture ");
}
else
printf("No device enumeration available\n");
device = alcGetContextsDevice(alcGetCurrentContext());
checkForErrors();
printf("Default device: %s\n",
alcGetString(device, ALC_DEFAULT_DEVICE_SPECIFIER));
printf("Default capture device: %s\n",
alcGetString(device, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER));
alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major);
alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &minor);
checkForErrors();
printf("ALC version: %d.%d\n", (int)major, (int)minor);
printExtensions("ALC extensions", ' ',
alcGetString(device, ALC_EXTENSIONS));
checkForErrors();
}
static void printALInfo(void)
{
printf("OpenAL vendor string: %s\n", alGetString(AL_VENDOR));
printf("OpenAL renderer string: %s\n", alGetString(AL_RENDERER));
printf("OpenAL version string: %s\n", alGetString(AL_VERSION));
printExtensions("OpenAL extensions", ' ', alGetString(AL_EXTENSIONS));
checkForErrors();
}
int main()
{
ALCdevice *device = alcOpenDevice(NULL);
ALCcontext *context = alcCreateContext(device, NULL);
alcMakeContextCurrent(context);
checkForErrors();
printALCInfo();
printALInfo();
checkForErrors();
alcMakeContextCurrent(NULL);
alcDestroyContext(context);
alcCloseDevice(device);
return EXIT_SUCCESS;
}
-724
View File
@@ -1,724 +0,0 @@
#ifndef AL_AL_H
#define AL_AL_H
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(_WIN32) && !defined(_XBOX)
/* _OPENAL32LIB is deprecated */
#if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB)
#define AL_API __declspec(dllexport)
#else
#define AL_API __declspec(dllimport)
#endif
#else
#if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
#define AL_API __attribute__((visibility("default")))
#else
#define AL_API extern
#endif
#endif
#if defined(_WIN32)
#define AL_APIENTRY __cdecl
#else
#define AL_APIENTRY
#endif
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export on
#endif
/*
* The OPENAL, ALAPI, ALAPIENTRY, AL_INVALID, AL_ILLEGAL_ENUM, and
* AL_ILLEGAL_COMMAND macros are deprecated, but are included for
* applications porting code from AL 1.0
*/
#define OPENAL
#define ALAPI AL_API
#define ALAPIENTRY AL_APIENTRY
#define AL_INVALID (-1)
#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
#define AL_VERSION_1_0
#define AL_VERSION_1_1
/** 8-bit boolean */
typedef char ALboolean;
/** character */
typedef char ALchar;
/** signed 8-bit 2's complement integer */
typedef char ALbyte;
/** unsigned 8-bit integer */
typedef unsigned char ALubyte;
/** signed 16-bit 2's complement integer */
typedef short ALshort;
/** unsigned 16-bit integer */
typedef unsigned short ALushort;
/** signed 32-bit 2's complement integer */
typedef int ALint;
/** unsigned 32-bit integer */
typedef unsigned int ALuint;
/** non-negative 32-bit binary integer size */
typedef int ALsizei;
/** enumerated 32-bit value */
typedef int ALenum;
/** 32-bit IEEE754 floating-point */
typedef float ALfloat;
/** 64-bit IEEE754 floating-point */
typedef double ALdouble;
/** void type (for opaque pointers only) */
typedef void ALvoid;
/* Enumerant values begin at column 50. No tabs. */
/* "no distance model" or "no buffer" */
#define AL_NONE 0
/* Boolean False. */
#define AL_FALSE 0
/** Boolean True. */
#define AL_TRUE 1
/** Indicate Source has relative coordinates. */
#define AL_SOURCE_RELATIVE 0x202
/**
* Directional source, inner cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
#define AL_CONE_INNER_ANGLE 0x1001
/**
* Directional source, outer cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
#define AL_CONE_OUTER_ANGLE 0x1002
/**
* Specify the pitch to be applied, either at source,
* or on mixer results, at listener.
* Range: [0.5-2.0]
* Default: 1.0
*/
#define AL_PITCH 0x1003
/**
* Specify the current location in three dimensional space.
* OpenAL, like OpenGL, uses a right handed coordinate system,
* where in a frontal default view X (thumb) points right,
* Y points up (index finger), and Z points towards the
* viewer/camera (middle finger).
* To switch from a left handed coordinate system, flip the
* sign on the Z coordinate.
* Listener position is always in the world coordinate system.
*/
#define AL_POSITION 0x1004
/** Specify the current direction. */
#define AL_DIRECTION 0x1005
/** Specify the current velocity in three dimensional space. */
#define AL_VELOCITY 0x1006
/**
* Indicate whether source is looping.
* Type: ALboolean?
* Range: [AL_TRUE, AL_FALSE]
* Default: FALSE.
*/
#define AL_LOOPING 0x1007
/**
* Indicate the buffer to provide sound samples.
* Type: ALuint.
* Range: any valid Buffer id.
*/
#define AL_BUFFER 0x1009
/**
* Indicate the gain (volume amplification) applied.
* Type: ALfloat.
* Range: ]0.0- ]
* A value of 1.0 means un-attenuated/unchanged.
* Each division by 2 equals an attenuation of -6dB.
* Each multiplicaton with 2 equals an amplification of +6dB.
* A value of 0.0 is meaningless with respect to a logarithmic
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
*/
#define AL_GAIN 0x100A
/*
* Indicate minimum source attenuation
* Type: ALfloat
* Range: [0.0 - 1.0]
*
* Logarthmic
*/
#define AL_MIN_GAIN 0x100D
/**
* Indicate maximum source attenuation
* Type: ALfloat
* Range: [0.0 - 1.0]
*
* Logarthmic
*/
#define AL_MAX_GAIN 0x100E
/**
* Indicate listener orientation.
*
* at/up
*/
#define AL_ORIENTATION 0x100F
/**
* Source state information.
*/
#define AL_SOURCE_STATE 0x1010
#define AL_INITIAL 0x1011
#define AL_PLAYING 0x1012
#define AL_PAUSED 0x1013
#define AL_STOPPED 0x1014
/**
* Buffer Queue params
*/
#define AL_BUFFERS_QUEUED 0x1015
#define AL_BUFFERS_PROCESSED 0x1016
/**
* Source buffer position information
*/
#define AL_SEC_OFFSET 0x1024
#define AL_SAMPLE_OFFSET 0x1025
#define AL_BYTE_OFFSET 0x1026
/*
* Source type (Static, Streaming or undetermined)
* Source is Static if a Buffer has been attached using AL_BUFFER
* Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
* Source is undetermined when it has the NULL buffer attached
*/
#define AL_SOURCE_TYPE 0x1027
#define AL_STATIC 0x1028
#define AL_STREAMING 0x1029
#define AL_UNDETERMINED 0x1030
/** Sound samples: format specifier. */
#define AL_FORMAT_MONO8 0x1100
#define AL_FORMAT_MONO16 0x1101
#define AL_FORMAT_STEREO8 0x1102
#define AL_FORMAT_STEREO16 0x1103
/**
* source specific reference distance
* Type: ALfloat
* Range: 0.0 - +inf
*
* At 0.0, no distance attenuation occurs. Default is
* 1.0.
*/
#define AL_REFERENCE_DISTANCE 0x1020
/**
* source specific rolloff factor
* Type: ALfloat
* Range: 0.0 - +inf
*
*/
#define AL_ROLLOFF_FACTOR 0x1021
/**
* Directional source, outer cone gain.
*
* Default: 0.0
* Range: [0.0 - 1.0]
* Logarithmic
*/
#define AL_CONE_OUTER_GAIN 0x1022
/**
* Indicate distance above which sources are not
* attenuated using the inverse clamped distance model.
*
* Default: +inf
* Type: ALfloat
* Range: 0.0 - +inf
*/
#define AL_MAX_DISTANCE 0x1023
/**
* Sound samples: frequency, in units of Hertz [Hz].
* This is the number of samples per second. Half of the
* sample frequency marks the maximum significant
* frequency component.
*/
#define AL_FREQUENCY 0x2001
#define AL_BITS 0x2002
#define AL_CHANNELS 0x2003
#define AL_SIZE 0x2004
/**
* Buffer state.
*
* Not supported for public use (yet).
*/
#define AL_UNUSED 0x2010
#define AL_PENDING 0x2011
#define AL_PROCESSED 0x2012
/** Errors: No Error. */
#define AL_NO_ERROR AL_FALSE
/**
* Invalid Name paramater passed to AL call.
*/
#define AL_INVALID_NAME 0xA001
/**
* Invalid parameter passed to AL call.
*/
#define AL_INVALID_ENUM 0xA002
/**
* Invalid enum parameter value.
*/
#define AL_INVALID_VALUE 0xA003
/**
* Illegal call.
*/
#define AL_INVALID_OPERATION 0xA004
/**
* No mojo.
*/
#define AL_OUT_OF_MEMORY 0xA005
/** Context strings: Vendor Name. */
#define AL_VENDOR 0xB001
#define AL_VERSION 0xB002
#define AL_RENDERER 0xB003
#define AL_EXTENSIONS 0xB004
/** Global tweakage. */
/**
* Doppler scale. Default 1.0
*/
#define AL_DOPPLER_FACTOR 0xC000
/**
* Tweaks speed of propagation.
*/
#define AL_DOPPLER_VELOCITY 0xC001
/**
* Speed of Sound in units per second
*/
#define AL_SPEED_OF_SOUND 0xC003
/**
* Distance models
*
* used in conjunction with DistanceModel
*
* implicit: NONE, which disances distance attenuation.
*/
#define AL_DISTANCE_MODEL 0xD000
#define AL_INVERSE_DISTANCE 0xD001
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
#define AL_LINEAR_DISTANCE 0xD003
#define AL_LINEAR_DISTANCE_CLAMPED 0xD004
#define AL_EXPONENT_DISTANCE 0xD005
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
/*
* Renderer State management
*/
AL_API void AL_APIENTRY alEnable( ALenum capability );
AL_API void AL_APIENTRY alDisable( ALenum capability );
AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability );
/*
* State retrieval
*/
AL_API const ALchar* AL_APIENTRY alGetString( ALenum param );
AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* data );
AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* data );
AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* data );
AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data );
AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param );
AL_API ALint AL_APIENTRY alGetInteger( ALenum param );
AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param );
AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param );
/*
* Error support.
* Obtain the most recent error generated in the AL state machine.
*/
AL_API ALenum AL_APIENTRY alGetError( void );
/*
* Extension support.
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
*/
AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname );
AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname );
AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename );
/*
* LISTENER
* Listener represents the location and orientation of the
* 'user' in 3D-space.
*
* Properties include: -
*
* Gain AL_GAIN ALfloat
* Position AL_POSITION ALfloat[3]
* Velocity AL_VELOCITY ALfloat[3]
* Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
*/
/*
* Set Listener parameters
*/
AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value );
AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alListeneri( ALenum param, ALint value );
AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values );
/*
* Get Listener parameters
*/
AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetListeneri( ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values );
/**
* SOURCE
* Sources represent individual sound objects in 3D-space.
* Sources take the PCM data provided in the specified Buffer,
* apply Source-specific modifications, and then
* submit them to be mixed according to spatial arrangement etc.
*
* Properties include: -
*
* Gain AL_GAIN ALfloat
* Min Gain AL_MIN_GAIN ALfloat
* Max Gain AL_MAX_GAIN ALfloat
* Position AL_POSITION ALfloat[3]
* Velocity AL_VELOCITY ALfloat[3]
* Direction AL_DIRECTION ALfloat[3]
* Head Relative Mode AL_SOURCE_RELATIVE ALint (AL_TRUE or AL_FALSE)
* Reference Distance AL_REFERENCE_DISTANCE ALfloat
* Max Distance AL_MAX_DISTANCE ALfloat
* RollOff Factor AL_ROLLOFF_FACTOR ALfloat
* Inner Angle AL_CONE_INNER_ANGLE ALint or ALfloat
* Outer Angle AL_CONE_OUTER_ANGLE ALint or ALfloat
* Cone Outer Gain AL_CONE_OUTER_GAIN ALint or ALfloat
* Pitch AL_PITCH ALfloat
* Looping AL_LOOPING ALint (AL_TRUE or AL_FALSE)
* MS Offset AL_MSEC_OFFSET ALint or ALfloat
* Byte Offset AL_BYTE_OFFSET ALint or ALfloat
* Sample Offset AL_SAMPLE_OFFSET ALint or ALfloat
* Attached Buffer AL_BUFFER ALint
* State (Query only) AL_SOURCE_STATE ALint
* Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint
* Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint
*/
/* Create Source objects */
AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* sources );
/* Delete Source objects */
AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* sources );
/* Verify a handle is a valid Source */
AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid );
/*
* Set Source parameters
*/
AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
/*
* Get Source parameters
*/
AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values );
/*
* Source vector based playback calls
*/
/* Play, replay, or resume (if paused) a list of Sources */
AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
/* Stop a list of Sources */
AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
/* Rewind a list of Sources */
AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
/* Pause a list of Sources */
AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids );
/*
* Source based playback calls
*/
/* Play, replay, or resume a Source */
AL_API void AL_APIENTRY alSourcePlay( ALuint sid );
/* Stop a Source */
AL_API void AL_APIENTRY alSourceStop( ALuint sid );
/* Rewind a Source (set playback postiton to beginning) */
AL_API void AL_APIENTRY alSourceRewind( ALuint sid );
/* Pause a Source */
AL_API void AL_APIENTRY alSourcePause( ALuint sid );
/*
* Source Queuing
*/
AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );
AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
/**
* BUFFER
* Buffer objects are storage space for sample data.
* Buffers are referred to by Sources. One Buffer can be used
* by multiple Sources.
*
* Properties include: -
*
* Frequency (Query only) AL_FREQUENCY ALint
* Size (Query only) AL_SIZE ALint
* Bits (Query only) AL_BITS ALint
* Channels (Query only) AL_CHANNELS ALint
*/
/* Create Buffer objects */
AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
/* Delete Buffer objects */
AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers );
/* Verify a handle is a valid Buffer */
AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid );
/* Specify the data to be copied into a buffer */
AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
/*
* Set Buffer parameters
*/
AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value );
AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value );
AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values );
/*
* Get Buffer parameters
*/
AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
/*
* Global Parameters
*/
AL_API void AL_APIENTRY alDopplerFactor( ALfloat value );
AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value );
AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value );
AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
/*
* Pointer-to-function types, useful for dynamically getting AL entry points.
*/
typedef void (AL_APIENTRY *LPALENABLE)( ALenum capability );
typedef void (AL_APIENTRY *LPALDISABLE)( ALenum capability );
typedef ALboolean (AL_APIENTRY *LPALISENABLED)( ALenum capability );
typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)( ALenum param );
typedef void (AL_APIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
typedef void (AL_APIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
typedef void (AL_APIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
typedef void (AL_APIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)( ALenum param );
typedef ALint (AL_APIENTRY *LPALGETINTEGER)( ALenum param );
typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)( ALenum param );
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)( ALenum param );
typedef ALenum (AL_APIENTRY *LPALGETERROR)( void );
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
typedef void (AL_APIENTRY *LPALLISTENERF)( ALenum param, ALfloat value );
typedef void (AL_APIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALLISTENERI)( ALenum param, ALint value );
typedef void (AL_APIENTRY *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALLISTENERIV)( ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
typedef void (AL_APIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
typedef void (AL_APIENTRY *LPALGETLISTENERIV)( ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources );
typedef void (AL_APIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
typedef ALboolean (AL_APIENTRY *LPALISSOURCE)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
typedef void (AL_APIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
typedef void (AL_APIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
typedef void (AL_APIENTRY *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEPLAY)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCESTOP)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEREWIND)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEPAUSE)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
typedef void (AL_APIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
typedef void (AL_APIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
typedef ALboolean (AL_APIENTRY *LPALISBUFFER)( ALuint bid );
typedef void (AL_APIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
typedef void (AL_APIENTRY *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value);
typedef void (AL_APIENTRY *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALBUFFERI)( ALuint bid, ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
typedef void (AL_APIENTRY *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
typedef void (AL_APIENTRY *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)( ALfloat value );
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export off
#endif
#if defined(__cplusplus)
} /* extern "C" */
#endif
#endif /* AL_AL_H */
-281
View File
@@ -1,281 +0,0 @@
#ifndef AL_ALC_H
#define AL_ALC_H
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(_WIN32) && !defined(_XBOX)
/* _OPENAL32LIB is deprecated */
#if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB)
#define ALC_API __declspec(dllexport)
#else
#define ALC_API __declspec(dllimport)
#endif
#else
#if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
#define ALC_API __attribute__((visibility("default")))
#else
#define ALC_API extern
#endif
#endif
#if defined(_WIN32)
#define ALC_APIENTRY __cdecl
#else
#define ALC_APIENTRY
#endif
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export on
#endif
/*
* The ALCAPI, ALCAPIENTRY, and ALC_INVALID macros are deprecated, but are
* included for applications porting code from AL 1.0
*/
#define ALCAPI ALC_API
#define ALCAPIENTRY ALC_APIENTRY
#define ALC_INVALID 0
#define ALC_VERSION_0_1 1
typedef struct ALCdevice_struct ALCdevice;
typedef struct ALCcontext_struct ALCcontext;
/** 8-bit boolean */
typedef char ALCboolean;
/** character */
typedef char ALCchar;
/** signed 8-bit 2's complement integer */
typedef char ALCbyte;
/** unsigned 8-bit integer */
typedef unsigned char ALCubyte;
/** signed 16-bit 2's complement integer */
typedef short ALCshort;
/** unsigned 16-bit integer */
typedef unsigned short ALCushort;
/** signed 32-bit 2's complement integer */
typedef int ALCint;
/** unsigned 32-bit integer */
typedef unsigned int ALCuint;
/** non-negative 32-bit binary integer size */
typedef int ALCsizei;
/** enumerated 32-bit value */
typedef int ALCenum;
/** 32-bit IEEE754 floating-point */
typedef float ALCfloat;
/** 64-bit IEEE754 floating-point */
typedef double ALCdouble;
/** void type (for opaque pointers only) */
typedef void ALCvoid;
/* Enumerant values begin at column 50. No tabs. */
/* Boolean False. */
#define ALC_FALSE 0
/* Boolean True. */
#define ALC_TRUE 1
/**
* followed by <int> Hz
*/
#define ALC_FREQUENCY 0x1007
/**
* followed by <int> Hz
*/
#define ALC_REFRESH 0x1008
/**
* followed by AL_TRUE, AL_FALSE
*/
#define ALC_SYNC 0x1009
/**
* followed by <int> Num of requested Mono (3D) Sources
*/
#define ALC_MONO_SOURCES 0x1010
/**
* followed by <int> Num of requested Stereo Sources
*/
#define ALC_STEREO_SOURCES 0x1011
/**
* errors
*/
/**
* No error
*/
#define ALC_NO_ERROR ALC_FALSE
/**
* No device
*/
#define ALC_INVALID_DEVICE 0xA001
/**
* invalid context ID
*/
#define ALC_INVALID_CONTEXT 0xA002
/**
* bad enum
*/
#define ALC_INVALID_ENUM 0xA003
/**
* bad value
*/
#define ALC_INVALID_VALUE 0xA004
/**
* Out of memory.
*/
#define ALC_OUT_OF_MEMORY 0xA005
/**
* The Specifier string for default device
*/
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
#define ALC_DEVICE_SPECIFIER 0x1005
#define ALC_EXTENSIONS 0x1006
#define ALC_MAJOR_VERSION 0x1000
#define ALC_MINOR_VERSION 0x1001
#define ALC_ATTRIBUTES_SIZE 0x1002
#define ALC_ALL_ATTRIBUTES 0x1003
/**
* ALC_ENUMERATE_ALL_EXT enums
*/
#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
#define ALC_ALL_DEVICES_SPECIFIER 0x1013
/**
* Capture extension
*/
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
#define ALC_CAPTURE_SAMPLES 0x312
/*
* Context Management
*/
ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
/*
* Device Management
*/
ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
/*
* Error support.
* Obtain the most recent Context error
*/
ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
/*
* Extension support.
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
*/
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
/*
* Query functions
*/
ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
/*
* Capture functions
*/
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
/*
* Pointer-to-function types, useful for dynamically getting ALC entry points.
*/
typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export off
#endif
#if defined(__cplusplus)
}
#endif
#endif /* AL_ALC_H */
-69
View File
@@ -1,69 +0,0 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 2008 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#ifndef AL_ALEXT_H
#define AL_ALEXT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef AL_EXT_float32
#define AL_EXT_float32 1
#define AL_FORMAT_MONO_FLOAT32 0x10010
#define AL_FORMAT_STEREO_FLOAT32 0x10011
#endif
#ifndef AL_LOKI_quadriphonic
#define AL_LOKI_quadriphonic 1
#define AL_FORMAT_QUAD8_LOKI 0x10004
#define AL_FORMAT_QUAD16_LOKI 0x10005
#endif
#ifndef AL_EXT_MCFORMATS
#define AL_EXT_MCFORMATS 1
#define AL_FORMAT_QUAD8 0x1204
#define AL_FORMAT_QUAD16 0x1205
#define AL_FORMAT_QUAD32 0x1206
#define AL_FORMAT_REAR8 0x1207
#define AL_FORMAT_REAR16 0x1208
#define AL_FORMAT_REAR32 0x1209
#define AL_FORMAT_51CHN8 0x120A
#define AL_FORMAT_51CHN16 0x120B
#define AL_FORMAT_51CHN32 0x120C
#define AL_FORMAT_61CHN8 0x120D
#define AL_FORMAT_61CHN16 0x120E
#define AL_FORMAT_61CHN32 0x120F
#define AL_FORMAT_71CHN8 0x1210
#define AL_FORMAT_71CHN16 0x1211
#define AL_FORMAT_71CHN32 0x1212
#endif
#ifndef AL_EXT_IMA4
#define AL_EXT_IMA4 1
#define AL_FORMAT_MONO_IMA4 0x1300
#define AL_FORMAT_STEREO_IMA4 0x1301
#endif
#ifdef __cplusplus
}
#endif
#endif
-483
View File
@@ -1,483 +0,0 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, 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 library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
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 Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, 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 or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the 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 a program 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.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
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, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
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 compile 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) 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.
c) 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.
d) 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 source code 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 to
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 Library 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
Appendix: 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 Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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!
+728
View File
@@ -0,0 +1,728 @@
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 8bf2e1da..8b3b1fa5 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -105,6 +105,9 @@ static struct BackendInfo BackendList[] = {
#ifdef HAVE_SDL2
{ "sdl2", ALCsdl2BackendFactory_getFactory },
#endif
+#ifdef HAVE_VITA
+ { "vita", ALCvitaBackendFactory_getFactory },
+#endif
{ "null", ALCnullBackendFactory_getFactory },
#ifdef HAVE_WAVE
diff --git a/Alc/alconfig.c b/Alc/alconfig.c
index 3d0ed140..4e1e6803 100644
--- a/Alc/alconfig.c
+++ b/Alc/alconfig.c
@@ -420,6 +420,29 @@ void ReadALConfig(void)
alstr_reset(&ppath);
}
+#elif defined __vita__
+void ReadALConfig(void)
+{
+ const char* config_paths[] =
+ {
+ "app0:/alsoft.conf",
+ "ux0:/data/openal/alsoft.conf"
+ };
+
+ FILE* f;
+ unsigned int i;
+ for(i = 0; i < sizeof(config_paths) / sizeof(*config_paths); ++i)
+ {
+ TRACE("Loading config %s...\n", config_paths[i]);
+ f = al_fopen(config_paths[i], "r");
+ if(f)
+ {
+ LoadConfigFromFile(f);
+ fclose(f);
+ break;
+ }
+ }
+}
#else
void ReadALConfig(void)
{
diff --git a/Alc/backends/base.h b/Alc/backends/base.h
index 03db56e9..74b75c45 100644
--- a/Alc/backends/base.h
+++ b/Alc/backends/base.h
@@ -150,6 +150,7 @@ ALCbackendFactory *ALCdsoundBackendFactory_getFactory(void);
ALCbackendFactory *ALCwinmmBackendFactory_getFactory(void);
ALCbackendFactory *ALCportBackendFactory_getFactory(void);
ALCbackendFactory *ALCopenslBackendFactory_getFactory(void);
+ALCbackendFactory *ALCvitaBackendFactory_getFactory(void);
ALCbackendFactory *ALCnullBackendFactory_getFactory(void);
ALCbackendFactory *ALCwaveBackendFactory_getFactory(void);
ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void);
diff --git a/Alc/backends/vita.c b/Alc/backends/vita.c
new file mode 100644
index 00000000..625b0fe2
--- /dev/null
+++ b/Alc/backends/vita.c
@@ -0,0 +1,436 @@
+/**
+ * OpenAL cross platform audio library
+ * Copyright (C) 2018 by authors.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * Or go to http://www.gnu.org/copyleft/lgpl.html
+ */
+
+#include "config.h"
+
+#include <psp2/audioin.h>
+#include <psp2/audioout.h>
+#include <stdlib.h>
+
+#include "alMain.h"
+#include "alu.h"
+#include "ringbuffer.h"
+#include "threads.h"
+
+#include "backends/base.h"
+
+static const ALCchar playbackDeviceName[] = "PS Vita Speakers/Headphones";
+static const ALCchar captureDeviceName[] = "PS Vita Microphone";
+
+// -----------------------------------------------------------------------------
+// Playback
+// -----------------------------------------------------------------------------
+typedef struct ALCvitaPlayback
+{
+ DERIVE_FROM_TYPE(ALCbackend);
+
+ ATOMIC(int) killNow;
+ althrd_t thread;
+
+ int portNumber;
+ ALsizei frameSize;
+ void* waveBuffer;
+
+ ALuint Frequency;
+ enum DevFmtChannels FmtChans;
+ enum DevFmtType FmtType;
+ ALuint UpdateSize;
+} ALCvitaPlayback;
+
+static void ALCvitaPlayback_Construct(ALCvitaPlayback *self, ALCdevice *device);
+static void ALCvitaPlayback_Destruct(ALCvitaPlayback *self);
+static ALCenum ALCvitaPlayback_open(ALCvitaPlayback *self, const ALCchar *name);
+static ALCboolean ALCvitaPlayback_reset(ALCvitaPlayback *self);
+static ALCboolean ALCvitaPlayback_start(ALCvitaPlayback *self);
+static void ALCvitaPlayback_stop(ALCvitaPlayback *self);
+static DECLARE_FORWARD2(ALCvitaPlayback, ALCbackend, ALCenum, captureSamples, void*, ALCuint)
+static DECLARE_FORWARD(ALCvitaPlayback, ALCbackend, ALCuint, availableSamples)
+static DECLARE_FORWARD(ALCvitaPlayback, ALCbackend, ClockLatency, getClockLatency)
+static DECLARE_FORWARD(ALCvitaPlayback, ALCbackend, void, lock)
+static DECLARE_FORWARD(ALCvitaPlayback, ALCbackend, void, unlock)
+DECLARE_DEFAULT_ALLOCATORS(ALCvitaPlayback)
+
+DEFINE_ALCBACKEND_VTABLE(ALCvitaPlayback);
+
+static void ALCvitaPlayback_Construct(ALCvitaPlayback *self, ALCdevice *device)
+{
+ ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
+ SET_VTABLE2(ALCvitaPlayback, ALCbackend, self);
+
+ self->portNumber = 0;
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+}
+
+static void ALCvitaPlayback_Destruct(ALCvitaPlayback *self)
+{
+ if (self->portNumber)
+ {
+ sceAudioOutReleasePort(self->portNumber);
+ self->portNumber = 0;
+ }
+
+ if (self->waveBuffer)
+ {
+ free(self->waveBuffer);
+ self->waveBuffer = NULL;
+ }
+
+ ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
+}
+
+static int ALCvitaPlayback_MixerProc(void *ptr)
+{
+ ALCvitaPlayback *self = (ALCvitaPlayback*)ptr;
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ while (!ATOMIC_LOAD(&self->killNow, almemory_order_acquire))
+ {
+ ALCvitaPlayback_lock(self);
+ aluMixData(device, self->waveBuffer, device->UpdateSize);
+ ALCvitaPlayback_unlock(self);
+ sceAudioOutOutput(self->portNumber, self->waveBuffer);
+ }
+
+ return 0;
+}
+
+static ALCenum ALCvitaPlayback_open(ALCvitaPlayback *self, const ALCchar *name)
+{
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ /* Only signed short output sample format is supported */
+ device->FmtType = DevFmtShort;
+
+ /* Only mono/stereo channel configurations are supported */
+ if (device->FmtChans != DevFmtMono && device->FmtChans != DevFmtStereo)
+ device->FmtChans = DevFmtStereo;
+
+ /* TODO: Validate samplerate and update size */
+
+ self->portNumber = sceAudioOutOpenPort(
+ SCE_AUDIO_OUT_PORT_TYPE_BGM,
+ device->UpdateSize,
+ device->Frequency,
+ device->FmtChans == DevFmtStereo ? SCE_AUDIO_OUT_MODE_STEREO : SCE_AUDIO_OUT_MODE_MONO
+ );
+
+ if (self->portNumber < 0)
+ return ALC_INVALID_VALUE;
+
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+
+ self->waveBuffer = calloc(device->UpdateSize * self->frameSize, 1);
+
+ alstr_copy_cstr(&device->DeviceName, name ? name : playbackDeviceName);
+
+ return ALC_NO_ERROR;
+}
+
+static ALCboolean ALCvitaPlayback_reset(ALCvitaPlayback *self)
+{
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ if (device->FmtChans != DevFmtMono && device->FmtChans != DevFmtStereo)
+ device->FmtChans = DevFmtStereo;
+
+ sceAudioOutSetConfig(
+ self->portNumber,
+ device->UpdateSize,
+ device->Frequency,
+ device->FmtChans == DevFmtStereo ? SCE_AUDIO_OUT_MODE_STEREO : SCE_AUDIO_OUT_MODE_MONO
+ );
+
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+
+ if (self->waveBuffer)
+ {
+ free(self->waveBuffer);
+ }
+
+ self->waveBuffer = calloc(device->UpdateSize * self->frameSize, 1);
+
+ SetDefaultWFXChannelOrder(device);
+
+ return ALC_TRUE;
+}
+
+static ALCboolean ALCvitaPlayback_start(ALCvitaPlayback *self)
+{
+ ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
+ if (althrd_create(&self->thread, ALCvitaPlayback_MixerProc, self) != althrd_success)
+ return ALC_FALSE;
+
+ return ALC_TRUE;
+}
+
+static void ALCvitaPlayback_stop(ALCvitaPlayback *self)
+{
+ int res;
+
+ if (ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel))
+ return;
+
+ althrd_join(self->thread, &res);
+}
+
+// -----------------------------------------------------------------------------
+// Capture
+// -----------------------------------------------------------------------------
+typedef struct ALCvitaCapture
+{
+ DERIVE_FROM_TYPE(ALCbackend);
+
+ ATOMIC(int) killNow;
+ althrd_t thread;
+
+ int portNumber;
+ ALsizei frameSize;
+ ll_ringbuffer_t *ring;
+
+ ALuint Frequency;
+ enum DevFmtChannels FmtChans;
+ enum DevFmtType FmtType;
+ ALuint UpdateSize;
+} ALCvitaCapture;
+
+static void ALCvitaCapture_Construct(ALCvitaCapture *self, ALCdevice *device);
+static void ALCvitaCapture_Destruct(ALCvitaCapture *self);
+static ALCenum ALCvitaCapture_open(ALCvitaCapture *self, const ALCchar *name);
+static ALCboolean ALCvitaCapture_reset(ALCvitaCapture *self);
+static ALCboolean ALCvitaCapture_start(ALCvitaCapture *self);
+static void ALCvitaCapture_stop(ALCvitaCapture *self);
+static ALCenum ALCvitaCapture_captureSamples(ALCvitaCapture *self, ALCvoid *buffer, ALCuint samples);
+static ALCuint ALCvitaCapture_availableSamples(ALCvitaCapture *self);
+static DECLARE_FORWARD(ALCvitaCapture, ALCbackend, ClockLatency, getClockLatency)
+static DECLARE_FORWARD(ALCvitaCapture, ALCbackend, void, lock)
+static DECLARE_FORWARD(ALCvitaCapture, ALCbackend, void, unlock)
+DECLARE_DEFAULT_ALLOCATORS(ALCvitaCapture)
+
+DEFINE_ALCBACKEND_VTABLE(ALCvitaCapture);
+
+static void ALCvitaCapture_Construct(ALCvitaCapture *self, ALCdevice *device)
+{
+ ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
+ SET_VTABLE2(ALCvitaCapture, ALCbackend, self);
+
+ self->portNumber = 0;
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+}
+
+static void ALCvitaCapture_Destruct(ALCvitaCapture *self)
+{
+ if (self->portNumber)
+ {
+ sceAudioOutReleasePort(self->portNumber);
+ self->portNumber = 0;
+ }
+
+ if (self->ring)
+ {
+ ll_ringbuffer_free(self->ring);
+ self->ring = NULL;
+ }
+
+ ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
+}
+
+static int ALCvitaCapture_MixerProc(void *ptr)
+{
+ ALCvitaCapture *self = (ALCvitaCapture*)ptr;
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ void* buf = malloc(self->frameSize * device->UpdateSize);
+
+ while (!ATOMIC_LOAD(&self->killNow, almemory_order_acquire))
+ {
+ sceAudioInInput(self->portNumber, buf);
+ ll_ringbuffer_write(self->ring, buf, self->frameSize * device->UpdateSize);
+ }
+
+ free(buf);
+
+ return 0;
+}
+
+static ALCenum ALCvitaCapture_open(ALCvitaCapture *self, const ALCchar *name)
+{
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ /* Only signed short output sample format is supported */
+ device->FmtType = DevFmtShort;
+
+ /* Only mono channel configuration is supported */
+ if (device->FmtChans != DevFmtMono)
+ device->FmtChans = DevFmtMono;
+
+ /* TODO: Validate samplerate and update size */
+
+ self->portNumber = sceAudioInOpenPort(
+ SCE_AUDIO_IN_PORT_TYPE_RAW,
+ device->UpdateSize,
+ device->Frequency,
+ SCE_AUDIO_IN_PARAM_FORMAT_S16_MONO
+ );
+
+ if (self->portNumber < 0)
+ {
+ return ALC_INVALID_VALUE;
+ }
+
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+
+ self->ring = ll_ringbuffer_create(device->UpdateSize * device->NumUpdates, self->frameSize, false);
+ if (self->ring == NULL)
+ return ALC_INVALID_VALUE;
+
+ alstr_copy_cstr(&device->DeviceName, name ? name : captureDeviceName);
+
+ return ALC_NO_ERROR;
+}
+
+static ALCboolean ALCvitaCapture_reset(ALCvitaCapture *self)
+{
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+ SetDefaultWFXChannelOrder(device);
+ return ALC_TRUE;
+}
+
+static ALCboolean ALCvitaCapture_start(ALCvitaCapture *self)
+{
+ ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
+ if (althrd_create(&self->thread, ALCvitaCapture_MixerProc, self) != althrd_success)
+ return ALC_FALSE;
+
+ return ALC_TRUE;
+}
+
+static void ALCvitaCapture_stop(ALCvitaCapture *self)
+{
+ int res;
+
+ if (ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel))
+ return;
+
+ althrd_join(self->thread, &res);
+}
+
+static ALCuint ALCvitaCapture_availableSamples(ALCvitaCapture *self)
+{
+ return ll_ringbuffer_read_space(self->ring);
+}
+
+static ALCenum ALCvitaCapture_captureSamples(ALCvitaCapture *self, ALCvoid *buffer, ALCuint samples)
+{
+ ll_ringbuffer_read(self->ring, buffer, samples);
+ return ALC_NO_ERROR;
+}
+
+typedef struct ALCvitaBackendFactory {
+ DERIVE_FROM_TYPE(ALCbackendFactory);
+} ALCvitaBackendFactory;
+#define ALCvitaBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCvitaBackendFactory, ALCbackendFactory) } }
+
+ALCbackendFactory *ALCvitaBackendFactory_getFactory(void);
+
+static ALCboolean ALCvitaBackendFactory_init(ALCvitaBackendFactory *self);
+static void ALCvitaBackendFactory_deinit(ALCvitaBackendFactory *self);
+static ALCboolean ALCvitaBackendFactory_querySupport(ALCvitaBackendFactory *self, ALCbackend_Type type);
+static void ALCvitaBackendFactory_probe(ALCvitaBackendFactory *self, enum DevProbe type, al_string *outnames);
+static ALCbackend* ALCvitaBackendFactory_createBackend(ALCvitaBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
+
+DEFINE_ALCBACKENDFACTORY_VTABLE(ALCvitaBackendFactory);
+
+ALCbackendFactory *ALCvitaBackendFactory_getFactory(void)
+{
+ static ALCvitaBackendFactory factory = ALCvitaBACKENDFACTORY_INITIALIZER;
+ return STATIC_CAST(ALCbackendFactory, &factory);
+}
+
+
+static ALCboolean ALCvitaBackendFactory_init(ALCvitaBackendFactory* UNUSED(self))
+{
+ return AL_TRUE;
+}
+
+static void ALCvitaBackendFactory_deinit(ALCvitaBackendFactory* UNUSED(self))
+{
+}
+
+static ALCboolean ALCvitaBackendFactory_querySupport(ALCvitaBackendFactory* UNUSED(self), ALCbackend_Type type)
+{
+ if (type == ALCbackend_Playback || type == ALCbackend_Capture)
+ return ALC_TRUE;
+
+ return ALC_FALSE;
+}
+
+static void ALCvitaBackendFactory_probe(ALCvitaBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
+{
+ if (type == ALL_DEVICE_PROBE)
+ alstr_append_range(outnames, playbackDeviceName, playbackDeviceName+sizeof(playbackDeviceName));
+ else if (type == CAPTURE_DEVICE_PROBE)
+ alstr_append_range(outnames, captureDeviceName, playbackDeviceName+sizeof(captureDeviceName));
+}
+
+static ALCbackend* ALCvitaBackendFactory_createBackend(ALCvitaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type)
+{
+ if (type == ALCbackend_Playback)
+ {
+ ALCvitaPlayback *backend;
+ NEW_OBJ(backend, ALCvitaPlayback)(device);
+
+ if (!backend)
+ return NULL;
+
+ return STATIC_CAST(ALCbackend, backend);
+ }
+
+ if (type == ALCbackend_Capture)
+ {
+ ALCvitaCapture *backend;
+ NEW_OBJ(backend, ALCvitaCapture)(device);
+
+ if (!backend)
+ return NULL;
+
+ return STATIC_CAST(ALCbackend, backend);
+ }
+ return NULL;
+}
diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h
index 2d7d1d62..d2160793 100644
--- a/Alc/bformatdec.h
+++ b/Alc/bformatdec.h
@@ -24,9 +24,9 @@
/* NOTE: These are scale factors as applied to Ambisonics content. Decoder
* coefficients should be divided by these values to get proper N3D scalings.
*/
-const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS];
-const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS];
-const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS];
+extern const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS];
+extern const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS];
+extern const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS];
struct AmbDecConf;
diff --git a/Alc/helpers.c b/Alc/helpers.c
index d2cb6253..1815dcfc 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -102,7 +102,9 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x
#ifndef _WIN32
#include <sys/types.h>
#include <sys/stat.h>
+#ifndef __vita__
#include <sys/mman.h>
+#endif
#include <fcntl.h>
#include <unistd.h>
#elif defined(_WIN32_IE)
@@ -218,6 +220,9 @@ void FillCPUCaps(int capfilter)
#endif
#endif
#ifdef HAVE_NEON
+#ifdef __vita__
+ caps |= CPU_CAP_NEON;
+#else
FILE *file = fopen("/proc/cpuinfo", "rt");
if(!file)
ERR("Failed to open /proc/cpuinfo, cannot check for NEON support\n");
@@ -262,6 +267,7 @@ void FillCPUCaps(int capfilter)
alstr_reset(&features);
}
+#endif
#endif
TRACE("Extensions:%s%s%s%s%s%s\n",
@@ -680,6 +686,11 @@ void UnmapFileMem(const struct FileMapping *mapping)
void GetProcBinary(al_string *path, al_string *fname)
{
+#ifdef __vita__
+ if(path) alstr_copy_cstr(path, "app0:/");
+ if(fname) alstr_copy_cstr(fname, "eboot.bin");
+
+#else
char *pathname = NULL;
size_t pathlen;
@@ -770,7 +781,7 @@ void GetProcBinary(al_string *path, al_string *fname)
if(fname) alstr_copy_cstr(fname, pathname);
}
free(pathname);
-
+#endif
if(path && fname)
TRACE("Got: %s, %s\n", alstr_get_cstr(*path), alstr_get_cstr(*fname));
else if(path) TRACE("Got path: %s\n", alstr_get_cstr(*path));
@@ -871,6 +882,10 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
while(ATOMIC_EXCHANGE_SEQ(&search_lock, 1) == 1)
althrd_yield();
+#ifdef __vita__
+ DirectorySearch(subdir, ext, &results);
+#else
+
if(subdir[0] == '/')
DirectorySearch(subdir, ext, &results);
else
@@ -953,7 +968,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
alstr_reset(&path);
}
-
+#endif
ATOMIC_STORE_SEQ(&search_lock, 0);
return results;
@@ -980,6 +995,10 @@ struct FileMapping MapFileToMem(const char *fname)
return ret;
}
+#ifdef __vita__
+ ptr = malloc(sbuf.st_size);
+ read(fd, ptr, sbuf.st_size);
+#else
ptr = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if(ptr == MAP_FAILED)
{
@@ -987,7 +1006,7 @@ struct FileMapping MapFileToMem(const char *fname)
close(fd);
return ret;
}
-
+#endif
ret.fd = fd;
ret.ptr = ptr;
ret.len = sbuf.st_size;
@@ -996,7 +1015,11 @@ struct FileMapping MapFileToMem(const char *fname)
void UnmapFileMem(const struct FileMapping *mapping)
{
+#ifdef __vita__
+ free(mapping->ptr);
+#else
munmap(mapping->ptr, mapping->len);
+#endif
close(mapping->fd);
}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39b80250..4e0c78eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,13 @@ if(DEFINED LIB_SUFFIX)
message(WARNING "LIB_SUFFIX is deprecated. Use the variables provided by the GNUInstallDirs module instead")
endif()
+if(VITA)
+ SET(LIBTYPE STATIC)
+ SET(ALSOFT_DLOPEN OFF)
+ SET(ALSOFT_UTILS OFF)
+ SET(ALSOFT_TESTS OFF)
+ SET(ALSOFT_EXAMPLES OFF)
+endif()
SET(CPP_DEFS ) # C pre-process, not C++
SET(INC_PATHS )
@@ -632,9 +639,11 @@ IF(NOT HAVE_WINDOWS_H)
MESSAGE(FATAL_ERROR "No timing function found!")
ENDIF()
- CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
- IF(NOT HAVE_NANOSLEEP)
- MESSAGE(FATAL_ERROR "No sleep function found!")
+ IF(NOT VITA)
+ CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
+ IF(NOT HAVE_NANOSLEEP)
+ MESSAGE(FATAL_ERROR "No sleep function found!")
+ ENDIF()
ENDIF()
# We need pthreads outside of Windows
@@ -1249,6 +1258,20 @@ IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend")
ENDIF()
+# Check for VITA backend
+IF(VITA)
+ OPTION(ALSOFT_BACKEND_VITA "Enable SDL2 backend" ON)
+ IF(ALSOFT_BACKEND_VITA)
+ SET(HAVE_VITA 1)
+ SET(ALC_OBJS ${ALC_OBJS} Alc/backends/vita.c)
+ SET(BACKENDS "${BACKENDS} VITA,")
+ add_definitions("-Dmemcpy=sceClibMemcpy")
+ add_definitions("-Dmemset=sceClibMemset")
+ add_definitions("-Dmemmove=sceClibMemmove")
+ add_definitions("-Dmemcmp=sceClibMemcmp")
+ ENDIF()
+ENDIF()
+
# Optionally enable the Wave Writer backend
OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
IF(ALSOFT_BACKEND_WAVE)
diff --git a/common/threads.h b/common/threads.h
index b0bebd8d..26aef7ba 100644
--- a/common/threads.h
+++ b/common/threads.h
@@ -2,6 +2,9 @@
#define AL_THREADS_H
#include <time.h>
+#ifdef __vita__
+#include <psp2/kernel/threadmgr.h>
+#endif
#if defined(__GNUC__) && defined(__i386__)
/* force_align_arg_pointer is required for proper function arguments aligning
@@ -165,6 +168,13 @@ inline void althrd_yield(void)
inline int althrd_sleep(const struct timespec *ts, struct timespec *rem)
{
+#ifdef __vita__
+ if(sceKernelDelayThread(ts->tv_sec * 1000000 + ts->tv_nsec / 1000) != 0)
+ {
+ return -2;
+ }
+ return 0;
+#else
int ret = nanosleep(ts, rem);
if(ret != 0)
{
@@ -172,6 +182,7 @@ inline int althrd_sleep(const struct timespec *ts, struct timespec *rem)
errno = 0;
}
return ret;
+#endif
}
diff --git a/config.h.in b/config.h.in
index 9cc6c16b..9799bf85 100644
--- a/config.h.in
+++ b/config.h.in
@@ -83,6 +83,9 @@
/* Define if we have the SDL2 backend */
#cmakedefine HAVE_SDL2
+/* Define if we have the PS Vita backend */
+#cmakedefine HAVE_VITA
+
/* Define if we have the stat function */
#cmakedefine HAVE_STAT
+824
View File
@@ -0,0 +1,824 @@
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 8bf2e1da..8b3b1fa5 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -105,6 +105,9 @@ static struct BackendInfo BackendList[] = {
#ifdef HAVE_SDL2
{ "sdl2", ALCsdl2BackendFactory_getFactory },
#endif
+#ifdef HAVE_VITA
+ { "vita", ALCvitaBackendFactory_getFactory },
+#endif
{ "null", ALCnullBackendFactory_getFactory },
#ifdef HAVE_WAVE
diff --git a/Alc/alconfig.c b/Alc/alconfig.c
index 3d0ed140..4e1e6803 100644
--- a/Alc/alconfig.c
+++ b/Alc/alconfig.c
@@ -420,6 +420,29 @@ void ReadALConfig(void)
alstr_reset(&ppath);
}
+#elif defined __vita__
+void ReadALConfig(void)
+{
+ const char* config_paths[] =
+ {
+ "app0:/alsoft.conf",
+ "ux0:/data/openal/alsoft.conf"
+ };
+
+ FILE* f;
+ unsigned int i;
+ for(i = 0; i < sizeof(config_paths) / sizeof(*config_paths); ++i)
+ {
+ TRACE("Loading config %s...\n", config_paths[i]);
+ f = al_fopen(config_paths[i], "r");
+ if(f)
+ {
+ LoadConfigFromFile(f);
+ fclose(f);
+ break;
+ }
+ }
+}
#else
void ReadALConfig(void)
{
diff --git a/Alc/backends/base.h b/Alc/backends/base.h
index 03db56e9..74b75c45 100644
--- a/Alc/backends/base.h
+++ b/Alc/backends/base.h
@@ -150,6 +150,7 @@ ALCbackendFactory *ALCdsoundBackendFactory_getFactory(void);
ALCbackendFactory *ALCwinmmBackendFactory_getFactory(void);
ALCbackendFactory *ALCportBackendFactory_getFactory(void);
ALCbackendFactory *ALCopenslBackendFactory_getFactory(void);
+ALCbackendFactory *ALCvitaBackendFactory_getFactory(void);
ALCbackendFactory *ALCnullBackendFactory_getFactory(void);
ALCbackendFactory *ALCwaveBackendFactory_getFactory(void);
ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void);
diff --git a/Alc/backends/vita.c b/Alc/backends/vita.c
new file mode 100644
index 00000000..f7c5d262
--- /dev/null
+++ b/Alc/backends/vita.c
@@ -0,0 +1,513 @@
+/**
+ * OpenAL cross platform audio library
+ * Copyright (C) 2018 by authors.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * Or go to http://www.gnu.org/copyleft/lgpl.html
+ */
+
+#include "config.h"
+
+#include <psp2/audioin.h>
+#include <psp2/audioout.h>
+#include <stdlib.h>
+
+#include "alMain.h"
+#include "alu.h"
+#include "ringbuffer.h"
+#include "threads.h"
+
+#include "backends/base.h"
+
+#define AUDIO_SAMPLE_ALIGN(s) (((s) + 63) & ~63)
+
+static const ALCchar playbackDeviceName[] = "PS Vita Speakers/Headphones";
+static const ALCchar captureDeviceName[] = "PS Vita Microphone";
+
+extern unsigned int _oal_thread_priority __attribute__((weak));
+extern unsigned int _oal_thread_affinity __attribute__((weak));
+
+// -----------------------------------------------------------------------------
+// Playback
+// -----------------------------------------------------------------------------
+typedef struct ALCvitaPlayback
+{
+ DERIVE_FROM_TYPE(ALCbackend);
+
+ ATOMIC(int) killNow;
+ SceUID thread;
+ SceKernelLwMutexWork lock;
+
+ int portNumber;
+ ALsizei frameSize;
+ void* waveBuffer;
+
+ ALuint Frequency;
+ enum DevFmtChannels FmtChans;
+ enum DevFmtType FmtType;
+ ALuint UpdateSize;
+} ALCvitaPlayback;
+
+static void ALCvitaPlayback_Construct(ALCvitaPlayback *self, ALCdevice *device);
+static void ALCvitaPlayback_Destruct(ALCvitaPlayback *self);
+static ALCenum ALCvitaPlayback_open(ALCvitaPlayback *self, const ALCchar *name);
+static ALCboolean ALCvitaPlayback_reset(ALCvitaPlayback *self);
+static ALCboolean ALCvitaPlayback_start(ALCvitaPlayback *self);
+static void ALCvitaPlayback_stop(ALCvitaPlayback *self);
+static void ALCvitaPlayback_lock(ALCvitaPlayback *self);
+static void ALCvitaPlayback_unlock(ALCvitaPlayback *self);
+
+static DECLARE_FORWARD2(ALCvitaPlayback, ALCbackend, ALCenum, captureSamples, void*, ALCuint)
+static DECLARE_FORWARD(ALCvitaPlayback, ALCbackend, ALCuint, availableSamples)
+static DECLARE_FORWARD(ALCvitaPlayback, ALCbackend, ClockLatency, getClockLatency)
+DECLARE_DEFAULT_ALLOCATORS(ALCvitaPlayback)
+
+DEFINE_ALCBACKEND_VTABLE(ALCvitaPlayback);
+
+static void ALCvitaPlayback_Construct(ALCvitaPlayback *self, ALCdevice *device)
+{
+ ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
+ SET_VTABLE2(ALCvitaPlayback, ALCbackend, self);
+
+ device->UpdateSize = AUDIO_SAMPLE_ALIGN(device->UpdateSize);
+
+ self->portNumber = 0;
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+
+ sceKernelCreateLwMutex(
+ &self->lock,
+ "OpenAL Vita playback mutex",
+ SCE_KERNEL_MUTEX_ATTR_RECURSIVE, // No SCE_KERNEL_LW_MUTEX_ATTR_RECURSIVE in VitaSDK, but it's the same
+ 0,
+ NULL
+ );
+}
+
+static void ALCvitaPlayback_Destruct(ALCvitaPlayback *self)
+{
+ if (self->portNumber)
+ {
+ sceAudioOutReleasePort(self->portNumber);
+ self->portNumber = 0;
+ }
+
+ if (self->waveBuffer)
+ {
+ free(self->waveBuffer);
+ self->waveBuffer = NULL;
+ }
+
+ sceKernelDeleteLwMutex(&self->lock);
+
+ ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
+}
+
+static int ALCvitaPlayback_MixerProc(SceSize args, void *argp)
+{
+ (void)args;
+ ALCvitaPlayback *self = *(ALCvitaPlayback **) argp;
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ while (!ATOMIC_LOAD(&self->killNow, almemory_order_acquire))
+ {
+ ALCvitaPlayback_lock(self);
+ aluMixData(device, self->waveBuffer, device->UpdateSize);
+ ALCvitaPlayback_unlock(self);
+ sceAudioOutOutput(self->portNumber, self->waveBuffer);
+ }
+
+ return 0;
+}
+
+static ALCenum ALCvitaPlayback_open(ALCvitaPlayback *self, const ALCchar *name)
+{
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ /* Only signed short output sample format is supported */
+ device->FmtType = DevFmtShort;
+
+ /* Only mono/stereo channel configurations are supported */
+ if (device->FmtChans != DevFmtMono && device->FmtChans != DevFmtStereo)
+ device->FmtChans = DevFmtStereo;
+
+ device->UpdateSize = AUDIO_SAMPLE_ALIGN(device->UpdateSize);
+
+ self->portNumber = sceAudioOutOpenPort(
+ SCE_AUDIO_OUT_PORT_TYPE_BGM,
+ device->UpdateSize,
+ device->Frequency,
+ device->FmtChans == DevFmtStereo ? SCE_AUDIO_OUT_MODE_STEREO : SCE_AUDIO_OUT_MODE_MONO
+ );
+
+ if (self->portNumber < 0)
+ return ALC_INVALID_VALUE;
+
+
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+
+ self->waveBuffer = calloc(device->UpdateSize * self->frameSize, 1);
+
+ alstr_copy_cstr(&device->DeviceName, name ? name : playbackDeviceName);
+
+ return ALC_NO_ERROR;
+}
+
+static ALCboolean ALCvitaPlayback_reset(ALCvitaPlayback *self)
+{
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ if (device->FmtChans != DevFmtMono && device->FmtChans != DevFmtStereo)
+ device->FmtChans = DevFmtStereo;
+
+ device->UpdateSize = AUDIO_SAMPLE_ALIGN(device->UpdateSize);
+
+ sceAudioOutSetConfig(
+ self->portNumber,
+ device->UpdateSize,
+ device->Frequency,
+ device->FmtChans == DevFmtStereo ? SCE_AUDIO_OUT_MODE_STEREO : SCE_AUDIO_OUT_MODE_MONO
+ );
+
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+
+ if (self->waveBuffer)
+ {
+ free(self->waveBuffer);
+ }
+
+ self->waveBuffer = calloc(device->UpdateSize * self->frameSize, 1);
+
+ SetDefaultWFXChannelOrder(device);
+
+ return ALC_TRUE;
+}
+
+static ALCboolean ALCvitaPlayback_start(ALCvitaPlayback *self)
+{
+ ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
+
+ int priority = 128; // middle
+ int affinity = 0; // DEFAULT
+ int stack_size = 0x10000; // 64Kib
+
+ if (&_oal_thread_priority != NULL) {
+ priority = _oal_thread_priority;
+ } else {
+ SceKernelThreadInfo info;
+ info.size = sizeof(SceKernelThreadInfo);
+ if (sceKernelGetThreadInfo(sceKernelGetThreadId(), &info) == 0) {
+ priority = info.currentPriority - 1;
+ }
+ }
+
+ if (priority < 64 && priority != 0) priority = 64;
+ if (priority > 191) priority = 191;
+
+ if (&_oal_thread_affinity != NULL) {
+ affinity = _oal_thread_affinity;
+ }
+
+ self->thread = sceKernelCreateThread("OpenAL Vita playback thread", ALCvitaPlayback_MixerProc,
+ priority, stack_size, 0, affinity, NULL);
+
+ if (self->thread < 0)
+ return ALC_FALSE;
+
+ int ret = sceKernelStartThread(self->thread, 4, &self);
+ if (ret < 0)
+ return ALC_FALSE;
+
+ return ALC_TRUE;
+}
+
+static void ALCvitaPlayback_stop(ALCvitaPlayback *self)
+{
+ if (ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel))
+ return;
+
+ sceKernelWaitThreadEnd(self->thread, NULL, NULL);
+ sceKernelDeleteThread(self->thread);
+}
+
+static void ALCvitaPlayback_lock(ALCvitaPlayback *self)
+{
+ sceKernelLockLwMutex(&self->lock, 1, NULL);
+}
+
+static void ALCvitaPlayback_unlock(ALCvitaPlayback *self)
+{
+ sceKernelUnlockLwMutex(&self->lock, 1);
+}
+
+// -----------------------------------------------------------------------------
+// Capture
+// -----------------------------------------------------------------------------
+typedef struct ALCvitaCapture
+{
+ DERIVE_FROM_TYPE(ALCbackend);
+
+ ATOMIC(int) killNow;
+ althrd_t thread;
+ SceKernelLwMutexWork lock;
+
+ int portNumber;
+ ALsizei frameSize;
+ ll_ringbuffer_t *ring;
+
+ ALuint Frequency;
+ enum DevFmtChannels FmtChans;
+ enum DevFmtType FmtType;
+ ALuint UpdateSize;
+} ALCvitaCapture;
+
+static void ALCvitaCapture_Construct(ALCvitaCapture *self, ALCdevice *device);
+static void ALCvitaCapture_Destruct(ALCvitaCapture *self);
+static ALCenum ALCvitaCapture_open(ALCvitaCapture *self, const ALCchar *name);
+static ALCboolean ALCvitaCapture_reset(ALCvitaCapture *self);
+static ALCboolean ALCvitaCapture_start(ALCvitaCapture *self);
+static void ALCvitaCapture_stop(ALCvitaCapture *self);
+static void ALCvitaCapture_lock(ALCvitaCapture *self);
+static void ALCvitaCapture_unlock(ALCvitaCapture *self);
+static ALCenum ALCvitaCapture_captureSamples(ALCvitaCapture *self, ALCvoid *buffer, ALCuint samples);
+static ALCuint ALCvitaCapture_availableSamples(ALCvitaCapture *self);
+static DECLARE_FORWARD(ALCvitaCapture, ALCbackend, ClockLatency, getClockLatency)
+DECLARE_DEFAULT_ALLOCATORS(ALCvitaCapture)
+
+DEFINE_ALCBACKEND_VTABLE(ALCvitaCapture);
+
+static void ALCvitaCapture_Construct(ALCvitaCapture *self, ALCdevice *device)
+{
+ ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
+ SET_VTABLE2(ALCvitaCapture, ALCbackend, self);
+
+ self->portNumber = 0;
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+}
+
+static void ALCvitaCapture_Destruct(ALCvitaCapture *self)
+{
+ if (self->portNumber)
+ {
+ sceAudioOutReleasePort(self->portNumber);
+ self->portNumber = 0;
+ }
+
+ if (self->ring)
+ {
+ ll_ringbuffer_free(self->ring);
+ self->ring = NULL;
+ }
+
+ ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
+}
+
+static int ALCvitaCapture_MixerProc(void *ptr)
+{
+ ALCvitaCapture *self = (ALCvitaCapture*)ptr;
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ void* buf = malloc(self->frameSize * device->UpdateSize);
+
+ while (!ATOMIC_LOAD(&self->killNow, almemory_order_acquire))
+ {
+ sceAudioInInput(self->portNumber, buf);
+ ll_ringbuffer_write(self->ring, buf, self->frameSize * device->UpdateSize);
+ }
+
+ free(buf);
+
+ return 0;
+}
+
+static ALCenum ALCvitaCapture_open(ALCvitaCapture *self, const ALCchar *name)
+{
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+
+ /* Only signed short output sample format is supported */
+ device->FmtType = DevFmtShort;
+
+ /* Only mono channel configuration is supported */
+ if (device->FmtChans != DevFmtMono)
+ device->FmtChans = DevFmtMono;
+
+ /* TODO: Validate samplerate and update size */
+
+ self->portNumber = sceAudioInOpenPort(
+ SCE_AUDIO_IN_PORT_TYPE_RAW,
+ device->UpdateSize,
+ device->Frequency,
+ SCE_AUDIO_IN_PARAM_FORMAT_S16_MONO
+ );
+
+ if (self->portNumber < 0)
+ {
+ return ALC_INVALID_VALUE;
+ }
+
+ self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
+ self->Frequency = device->Frequency;
+ self->FmtChans = device->FmtChans;
+ self->FmtType = device->FmtType;
+ self->UpdateSize = device->UpdateSize;
+
+ self->ring = ll_ringbuffer_create(device->UpdateSize * device->NumUpdates, self->frameSize, false);
+ if (self->ring == NULL)
+ return ALC_INVALID_VALUE;
+
+ alstr_copy_cstr(&device->DeviceName, name ? name : captureDeviceName);
+
+ return ALC_NO_ERROR;
+}
+
+static ALCboolean ALCvitaCapture_reset(ALCvitaCapture *self)
+{
+ ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
+ SetDefaultWFXChannelOrder(device);
+ return ALC_TRUE;
+}
+
+static ALCboolean ALCvitaCapture_start(ALCvitaCapture *self)
+{
+ ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
+ if (althrd_create(&self->thread, ALCvitaCapture_MixerProc, self) != althrd_success)
+ return ALC_FALSE;
+
+ return ALC_TRUE;
+}
+
+static void ALCvitaCapture_stop(ALCvitaCapture *self)
+{
+ int res;
+
+ if (ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel))
+ return;
+
+ althrd_join(self->thread, &res);
+}
+
+static void ALCvitaCapture_lock(ALCvitaCapture *self)
+{
+ sceKernelLockLwMutex(&self->lock, 1, NULL);
+}
+
+static void ALCvitaCapture_unlock(ALCvitaCapture *self)
+{
+ sceKernelUnlockLwMutex(&self->lock, 1);
+}
+
+
+static ALCuint ALCvitaCapture_availableSamples(ALCvitaCapture *self)
+{
+ return ll_ringbuffer_read_space(self->ring);
+}
+
+static ALCenum ALCvitaCapture_captureSamples(ALCvitaCapture *self, ALCvoid *buffer, ALCuint samples)
+{
+ ll_ringbuffer_read(self->ring, buffer, samples);
+ return ALC_NO_ERROR;
+}
+
+// -----------------------------------------------------------------------------
+// Backends
+// -----------------------------------------------------------------------------
+
+typedef struct ALCvitaBackendFactory {
+ DERIVE_FROM_TYPE(ALCbackendFactory);
+} ALCvitaBackendFactory;
+#define ALCvitaBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCvitaBackendFactory, ALCbackendFactory) } }
+
+ALCbackendFactory *ALCvitaBackendFactory_getFactory(void);
+
+static ALCboolean ALCvitaBackendFactory_init(ALCvitaBackendFactory *self);
+static void ALCvitaBackendFactory_deinit(ALCvitaBackendFactory *self);
+static ALCboolean ALCvitaBackendFactory_querySupport(ALCvitaBackendFactory *self, ALCbackend_Type type);
+static void ALCvitaBackendFactory_probe(ALCvitaBackendFactory *self, enum DevProbe type, al_string *outnames);
+static ALCbackend* ALCvitaBackendFactory_createBackend(ALCvitaBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
+
+DEFINE_ALCBACKENDFACTORY_VTABLE(ALCvitaBackendFactory);
+
+ALCbackendFactory *ALCvitaBackendFactory_getFactory(void)
+{
+ static ALCvitaBackendFactory factory = ALCvitaBACKENDFACTORY_INITIALIZER;
+ return STATIC_CAST(ALCbackendFactory, &factory);
+}
+
+
+static ALCboolean ALCvitaBackendFactory_init(ALCvitaBackendFactory* UNUSED(self))
+{
+ return AL_TRUE;
+}
+
+static void ALCvitaBackendFactory_deinit(ALCvitaBackendFactory* UNUSED(self))
+{
+}
+
+static ALCboolean ALCvitaBackendFactory_querySupport(ALCvitaBackendFactory* UNUSED(self), ALCbackend_Type type)
+{
+ if (type == ALCbackend_Playback || type == ALCbackend_Capture)
+ return ALC_TRUE;
+
+ return ALC_FALSE;
+}
+
+static void ALCvitaBackendFactory_probe(ALCvitaBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
+{
+ if (type == ALL_DEVICE_PROBE)
+ alstr_append_range(outnames, playbackDeviceName, playbackDeviceName+sizeof(playbackDeviceName));
+ else if (type == CAPTURE_DEVICE_PROBE)
+ alstr_append_range(outnames, captureDeviceName, playbackDeviceName+sizeof(captureDeviceName));
+}
+
+static ALCbackend* ALCvitaBackendFactory_createBackend(ALCvitaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type)
+{
+ if (type == ALCbackend_Playback)
+ {
+ ALCvitaPlayback *backend;
+ NEW_OBJ(backend, ALCvitaPlayback)(device);
+
+ if (!backend)
+ return NULL;
+
+ return STATIC_CAST(ALCbackend, backend);
+ }
+
+ if (type == ALCbackend_Capture)
+ {
+ ALCvitaCapture *backend;
+ NEW_OBJ(backend, ALCvitaCapture)(device);
+
+ if (!backend)
+ return NULL;
+
+ return STATIC_CAST(ALCbackend, backend);
+ }
+ return NULL;
+}
diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h
index 2d7d1d62..d2160793 100644
--- a/Alc/bformatdec.h
+++ b/Alc/bformatdec.h
@@ -24,9 +24,9 @@
/* NOTE: These are scale factors as applied to Ambisonics content. Decoder
* coefficients should be divided by these values to get proper N3D scalings.
*/
-const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS];
-const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS];
-const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS];
+extern const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS];
+extern const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS];
+extern const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS];
struct AmbDecConf;
diff --git a/Alc/helpers.c b/Alc/helpers.c
index d2cb6253..1815dcfc 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -102,7 +102,9 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x
#ifndef _WIN32
#include <sys/types.h>
#include <sys/stat.h>
+#ifndef __vita__
#include <sys/mman.h>
+#endif
#include <fcntl.h>
#include <unistd.h>
#elif defined(_WIN32_IE)
@@ -218,6 +220,9 @@ void FillCPUCaps(int capfilter)
#endif
#endif
#ifdef HAVE_NEON
+#ifdef __vita__
+ caps |= CPU_CAP_NEON;
+#else
FILE *file = fopen("/proc/cpuinfo", "rt");
if(!file)
ERR("Failed to open /proc/cpuinfo, cannot check for NEON support\n");
@@ -262,6 +267,7 @@ void FillCPUCaps(int capfilter)
alstr_reset(&features);
}
+#endif
#endif
TRACE("Extensions:%s%s%s%s%s%s\n",
@@ -680,6 +686,11 @@ void UnmapFileMem(const struct FileMapping *mapping)
void GetProcBinary(al_string *path, al_string *fname)
{
+#ifdef __vita__
+ if(path) alstr_copy_cstr(path, "app0:/");
+ if(fname) alstr_copy_cstr(fname, "eboot.bin");
+
+#else
char *pathname = NULL;
size_t pathlen;
@@ -770,7 +781,7 @@ void GetProcBinary(al_string *path, al_string *fname)
if(fname) alstr_copy_cstr(fname, pathname);
}
free(pathname);
-
+#endif
if(path && fname)
TRACE("Got: %s, %s\n", alstr_get_cstr(*path), alstr_get_cstr(*fname));
else if(path) TRACE("Got path: %s\n", alstr_get_cstr(*path));
@@ -871,6 +882,10 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
while(ATOMIC_EXCHANGE_SEQ(&search_lock, 1) == 1)
althrd_yield();
+#ifdef __vita__
+ DirectorySearch(subdir, ext, &results);
+#else
+
if(subdir[0] == '/')
DirectorySearch(subdir, ext, &results);
else
@@ -953,7 +968,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
alstr_reset(&path);
}
-
+#endif
ATOMIC_STORE_SEQ(&search_lock, 0);
return results;
@@ -980,6 +995,10 @@ struct FileMapping MapFileToMem(const char *fname)
return ret;
}
+#ifdef __vita__
+ ptr = malloc(sbuf.st_size);
+ read(fd, ptr, sbuf.st_size);
+#else
ptr = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if(ptr == MAP_FAILED)
{
@@ -987,7 +1006,7 @@ struct FileMapping MapFileToMem(const char *fname)
close(fd);
return ret;
}
-
+#endif
ret.fd = fd;
ret.ptr = ptr;
ret.len = sbuf.st_size;
@@ -996,7 +1015,11 @@ struct FileMapping MapFileToMem(const char *fname)
void UnmapFileMem(const struct FileMapping *mapping)
{
+#ifdef __vita__
+ free(mapping->ptr);
+#else
munmap(mapping->ptr, mapping->len);
+#endif
close(mapping->fd);
}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39b80250..c8a2525b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
# CMake build file list for OpenAL
-CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(OpenAL)
@@ -61,6 +61,13 @@ if(DEFINED LIB_SUFFIX)
message(WARNING "LIB_SUFFIX is deprecated. Use the variables provided by the GNUInstallDirs module instead")
endif()
+if(VITA)
+ SET(LIBTYPE STATIC)
+ SET(ALSOFT_DLOPEN OFF)
+ SET(ALSOFT_UTILS OFF)
+ SET(ALSOFT_TESTS OFF)
+ SET(ALSOFT_EXAMPLES OFF)
+endif()
SET(CPP_DEFS ) # C pre-process, not C++
SET(INC_PATHS )
@@ -632,9 +639,11 @@ IF(NOT HAVE_WINDOWS_H)
MESSAGE(FATAL_ERROR "No timing function found!")
ENDIF()
- CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
- IF(NOT HAVE_NANOSLEEP)
- MESSAGE(FATAL_ERROR "No sleep function found!")
+ IF(NOT VITA)
+ CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
+ IF(NOT HAVE_NANOSLEEP)
+ MESSAGE(FATAL_ERROR "No sleep function found!")
+ ENDIF()
ENDIF()
# We need pthreads outside of Windows
@@ -1249,6 +1258,20 @@ IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend")
ENDIF()
+# Check for VITA backend
+IF(VITA)
+ OPTION(ALSOFT_BACKEND_VITA "Enable VITA backend" ON)
+ IF(ALSOFT_BACKEND_VITA)
+ SET(HAVE_VITA 1)
+ SET(ALC_OBJS ${ALC_OBJS} Alc/backends/vita.c)
+ SET(BACKENDS "${BACKENDS} VITA,")
+ add_definitions("-Dmemcpy=sceClibMemcpy")
+ add_definitions("-Dmemset=sceClibMemset")
+ add_definitions("-Dmemmove=sceClibMemmove")
+ add_definitions("-Dmemcmp=sceClibMemcmp")
+ ENDIF()
+ENDIF()
+
# Optionally enable the Wave Writer backend
OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
IF(ALSOFT_BACKEND_WAVE)
diff --git a/common/threads.h b/common/threads.h
index b0bebd8d..9e76f33c 100644
--- a/common/threads.h
+++ b/common/threads.h
@@ -2,6 +2,9 @@
#define AL_THREADS_H
#include <time.h>
+#ifdef __vita__
+#include <psp2/kernel/threadmgr.h>
+#endif
#if defined(__GNUC__) && defined(__i386__)
/* force_align_arg_pointer is required for proper function arguments aligning
@@ -165,6 +168,14 @@ inline void althrd_yield(void)
inline int althrd_sleep(const struct timespec *ts, struct timespec *rem)
{
+#ifdef __vita__
+ (void)rem; // unused
+ if(sceKernelDelayThread(ts->tv_sec * 1000000 + ts->tv_nsec / 1000) != 0)
+ {
+ return -2;
+ }
+ return 0;
+#else
int ret = nanosleep(ts, rem);
if(ret != 0)
{
@@ -172,6 +183,7 @@ inline int althrd_sleep(const struct timespec *ts, struct timespec *rem)
errno = 0;
}
return ret;
+#endif
}
diff --git a/config.h.in b/config.h.in
index 9cc6c16b..9799bf85 100644
--- a/config.h.in
+++ b/config.h.in
@@ -83,6 +83,9 @@
/* Define if we have the SDL2 backend */
#cmakedefine HAVE_SDL2
+/* Define if we have the PS Vita backend */
+#cmakedefine HAVE_VITA
+
/* Define if we have the stat function */
#cmakedefine HAVE_STAT
diff --git a/native-tools/CMakeLists.txt b/native-tools/CMakeLists.txt
index 5e816bba..e2db9067 100644
--- a/native-tools/CMakeLists.txt
+++ b/native-tools/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.2)
+cmake_minimum_required(VERSION 3.5)
project(native-tools)