Commit Graph

109 Commits

Author SHA1 Message Date
Chris Robinson
6bf6c6fb7b More overflow protection 2008-01-20 13:27:54 -08:00
Chris Robinson
29618bee10 Prevent float samples from overflowing when converting to 16-bit 2008-01-20 00:43:02 -08:00
Chris Robinson
db80f682c9 Clean a couple debug messages 2008-01-19 21:41:09 -08:00
Chris Robinson
e1cdbac5a0 Close ALC first when exiting since devices might've been running when deleting stuff 2008-01-19 20:58:50 -08:00
Chris Robinson
4caf2c7edd Implement AL_EFFECT_REVERB
Here is a quick description of how the reverb effect works:

 +--->---+*(4)
 |       V       new sample
 +-----+---+---+    |
 |extra|ltr|ref| <- +*(1)
 +-----+---+---+
   (3,5)*|   |*(2)
         +-->|
             V
         out sample

 1) Apply master reverb gain to incoming sample and place it at the head of the
    buffer. The master reverb gainhf was already applied when the source was
    initially mixed.
 2) Copy the delayed reflection sample to an output sample and apply the
    reflection gain.
 3) Apply the late reverb gain to the late reverb sample
 4) Copy the end of the buffer, applying a decay gain and the decay hf ratio,
    and add to the late reverb.
 5) Copy the late reverb sample, adding to the output sample.

 Then the head and sampling points are shifted forward, and done again for each
 new sample. The extra buffer length is determined by the Reverb Density
 property. A value of 0 gives a length of 0.1 seconds (long, with fairly
 distinct echos) , and 1 gives 0.075 seconds (short, indistinct echos).
 The decay gain is calculated such that after a number of loops to satisfy the
 Decay Time, a sample will be 1/32768th as powerful (virtually insignificant to
 the resulting output, and only getting further reduced). It is calculated as:

 DecayGain = pow(1.0f/32768.0f, 1.0/(DecayTime/ExtraLength));

 Things to note: Reverb Diffusion is not currently handled, nor is Decay HF
 Limit. Decay HF Ratios above 1 probably give incorrect results. Also, this
 method likely sucks, but it's the best I can come up with before release. :)
2008-01-18 21:25:40 -08:00
Chris Robinson
1b9d740244 Remove duplicated source freeing code 2008-01-18 00:56:01 -08:00
Chris Robinson
73e386dc6f Release effect slots when deleting sources 2008-01-17 21:17:08 -08:00
Chris Robinson
6735fc7911 Add missing config.h includes 2008-01-16 14:09:04 -08:00
Chris Robinson
be34dbe608 Don't include alAuxEffectSlot.h in alSource.h 2008-01-16 14:01:24 -08:00
Chris Robinson
70102e7cd3 Fix debug comments 2008-01-16 13:58:10 -08:00
Chris Robinson
8ad16145f6 Make sure sources are deleted with the context 2008-01-16 13:27:15 -08:00
Chris Robinson
bb7b18d4e1 Keep track of references to effect slots, so they aren't deleted while in use 2008-01-16 13:20:09 -08:00
Chris Robinson
10a9bc62bf Store a reference to the effect slot in a source's send, not a copy 2008-01-16 12:43:25 -08:00
Chris Robinson
8cbbf17519 Allow getting and setting reverb parameters, as well as setting reverb effects
Reverb is still not implemented. The parameters just no-op for now.
2008-01-15 23:32:28 -08:00
Chris Robinson
bf87aed459 Add reverb parameters 2008-01-15 20:32:20 -08:00
Chris Robinson
42306f93b3 Set default room rolloff factor 2008-01-15 19:59:19 -08:00
Chris Robinson
7b1b8bd741 Set the default outer cone gainhf 2008-01-15 17:40:37 -08:00
Chris Robinson
a11f25e47b Fix source and buffer out-of-memory conditions 2008-01-15 16:30:43 -08:00
Chris Robinson
a6213ebfc7 Fix allocation of multiple effect slots, effects, and filters 2008-01-15 16:24:12 -08:00
Chris Robinson
b95fcf5da1 Store effect slots in the context 2008-01-15 16:22:39 -08:00
Chris Robinson
707e596811 Don't append _struct to the effect slot struct name 2008-01-15 16:01:27 -08:00
Chris Robinson
5678041b92 Remove errant line 2008-01-15 15:53:58 -08:00
Chris Robinson
7f850d8fb0 Make sure a valid context is set for effect slots 2008-01-15 15:53:06 -08:00
Chris Robinson
7edc576e9c Fix some copy/paste errors 2008-01-15 15:37:54 -08:00
Chris Robinson
0041a09576 Move include so win32 gets it too, and remove unnecessary line 2008-01-15 12:45:24 -08:00
Chris Robinson
a2e2522612 Let alIsExtensionPresent work with mixed-case extension names 2008-01-14 16:26:22 -08:00
Chris Robinson
df07e8a65b Add support for AL_LOKI_quadriphonic 2008-01-14 16:11:15 -08:00
Chris Robinson
e519338a2b Add missing stdio include 2008-01-14 10:55:13 -08:00
Chris Robinson
7a4870bd97 Close dangling devices when exiting 2008-01-14 10:54:33 -08:00
Chris Robinson
29c6238b52 Keep track of open devices 2008-01-14 10:39:54 -08:00
Chris Robinson
3bbbf8a025 Merge branch 'master' into efx-experiment 2008-01-11 17:19:08 -08:00
Chris Robinson
f10408739e Add a wave file writing backend 2008-01-11 09:32:22 -08:00
Chris Robinson
e1d0ad749b Use nanosleep instead of usleep
So not to rely on the non-standard unistd.h header
2008-01-11 08:15:44 -08:00
Chris Robinson
2a5a5b5c1b Add Sleep wrapper 2008-01-11 06:54:09 -08:00
Chris Robinson
a97ecb8690 Add a timing wrapper, using gettimeofday 2008-01-11 06:01:51 -08:00
Chris Robinson
298f6f440a Add missing header include 2008-01-06 01:15:44 -08:00
Chris Robinson
5e48be27b8 Merge branch 'master' into efx-experiment 2008-01-04 14:40:38 -08:00
Chris Robinson
8fe39042da Add the Bauer stereophonic-to-binaural DSP (bs2b) code and hooks 2008-01-03 05:36:51 -08:00
Chris Robinson
3d78d93b40 Merge branch 'master' into efx-experiment 2007-12-31 19:34:52 -08:00
Chris Robinson
9382956b0e Remove obsolete comment 2007-12-31 06:00:50 -08:00
Chris Robinson
1397417fcd Handle AL_FORMAT_REAR* formats 2007-12-31 05:46:20 -08:00
Chris Robinson
c9a539eade Allow loading of 4, 5.1, 6.1, and 7.1 sample data 2007-12-31 05:06:59 -08:00
Chris Robinson
79b95da0a3 Check specific formats before general properties 2007-12-31 02:57:58 -08:00
Chris Robinson
1c85273662 Export float32 formats 2007-12-31 02:55:35 -08:00
Chris Robinson
76dd568971 Add some more formats 2007-12-31 02:53:56 -08:00
Chris Robinson
7a99b1fa32 Make some defines local to ALu.c 2007-12-31 01:16:13 -08:00
Chris Robinson
e82c27ab04 Fix includes so alMain.h doesn't include so much by itself 2007-12-31 01:09:57 -08:00
Chris Robinson
f32098e04d Don't append _struct to the source struct name 2007-12-31 01:09:21 -08:00
Chris Robinson
1e0fa58d79 Remove unused macros 2007-12-31 00:52:34 -08:00
Chris Robinson
1061108c61 Remove some duplication 2007-12-28 22:56:48 -08:00