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
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
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
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
9c155a57fb
Use unique_ptr for DirectHrtfState
2018-11-22 07:54:29 -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
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
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
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
16d0e79db7
Add compile-time traits for FmtType enum values
2018-11-20 02:42:49 -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
8472a9d916
Use proper inheritence for the effect state objects
2018-11-19 22:34:26 -08:00
Chris Robinson
3ae1c78d1a
Use std::isfinite instead of isfinite
2018-11-19 09:51:29 -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
ac2a420351
Remove the ATOMIC_THREAD_FENCE macro
2018-11-19 05:04:17 -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
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
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
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
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
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
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
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
1fae8c16a8
Convert threads.c to C++
...
Also vastly simplify and remove related code.
2018-11-17 05:31:29 -08:00
Chris Robinson
3bbfd0c099
Fix compilation with MSVC
2018-11-16 23:01:40 -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
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
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
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
8f771a0387
Convert alSource.c to C++
2018-11-15 03:13:54 -08:00
Chris Robinson
46301a087c
Use C++ a bit more with alc.cpp
2018-11-14 06:17:47 -08:00
Chris Robinson
b15dcea4bb
Move extern inline declarations to their own C source
2018-11-14 00:07:50 -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
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
51ed335833
Use C++ more with helpers.cpp
2018-11-11 19:17:40 -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
4eed3e9236
Move static functions to an anonymous namespace
2018-11-08 03:31:42 -08: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
624bc1c839
Convert alBuffer.c to C++
...
A test to ensure everything works.
2018-10-31 10:37:16 -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
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
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
Filip Gawin
08226bc6b0
Simplify some statements
2018-10-29 13:38:58 +01: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
79314c4461
Include the limiter's lookAhead delay in the device latency
2018-09-25 23:05:27 -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
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
7f4441ffbe
Handle the bsinc C resampler like the others
2018-09-17 04:07:56 -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
46cfedb117
Pass the device name list to the backend probe method
2018-09-07 22:02:37 -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
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
ed1f1d2bf3
Start an extension to allow source filter gains greater than 1
2018-07-15 21:01:26 -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
8219bb374d
Fix a couple property variable names
2018-05-22 06:19:59 -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
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
Chris Robinson
0cd375f03c
Add a function to calculate coefficients from X, Y, Z components
2018-05-17 03:52:40 -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
1e04c4c689
Make a faster float2int method for x87 targets
2018-05-12 22:34:15 -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
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
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
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
150586d7fe
Add an ASSUME macro that requires a true condition
2018-04-17 22:50:50 -07:00
Chris Robinson
9c5307a48a
Rename BiquadState to BiquadFilter
2018-04-04 18:07:46 -07:00
Chris Robinson
5aecce5a0d
Store the ALbufferlistitem's composited/max sample length
2018-03-27 18:09:28 -07:00
Chris Robinson
6990478369
Rename ALfilterState/Type to BiquadState/Type
2018-03-23 14:52:59 -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
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
8eb7a94e1c
Apply a distance decay on the source send for the reverb's DecayLFRatio
2018-03-11 22:40:08 -07:00
Chris Robinson
30821e978b
Add extern "C" to some headers
2018-03-09 17:24:03 -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
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
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
bd32a682f7
Use atomic variables instead of volatile
2018-03-02 19:16:55 -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
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
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
b5aa0c0759
Remove the unnecessary ComputeAmbientGains
2018-02-18 23:56:51 -08:00
Chris Robinson
e63e0ee596
Combine multiple functions called sequentially
2018-02-11 22:23:03 -08:00
Chris Robinson
b11e31fbfd
Clear stale 'post's on the event semphaphore
2018-02-11 06:14:18 -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
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
b99e64a0e3
Provide more descriptive messages to disconnection events
2018-02-03 13:54:42 -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
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
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
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
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
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
38a3ba74d4
Report the problem value for global state errors
2018-01-28 13:13:40 -08:00
Chris Robinson
dcc5a10c7b
Use a fixed array for the effect state factory list
2018-01-28 00:10:12 -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
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
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
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
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
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
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
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
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
e80b016cbe
Use a global RowMixerFunc
2018-01-16 12:18:59 -08:00
Chris Robinson
5deb1df8db
Add min/max/clamp functions for size_t
2018-01-16 09:39:28 -08:00
Chris Robinson
bc44efb91d
Use ALsizei for some count/length variables
2018-01-15 18:31:43 -08:00
Chris Robinson
682205a3d4
Finalize ALC_SOFT_device_clock
2018-01-15 06:45:53 -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