Commit Graph

36 Commits

Author SHA1 Message Date
Aaron McLeran
8d78a89d3f UE-19303 Fixing crash when pausing/unpausing game in Mac
[CL 2639527 by Aaron McLeran in Main branch]
2015-07-30 18:02:32 -04:00
Aaron McLeran
64e7ff6ccb UE-17938 Fixing some issues that cause mac to sound different than PC client
- Switching to a EQ filter type that is more similar to XAudio2's filter
- Piping the per-voice high-frequency attenuation parameter to a new per-voice low-pass filter
- making the effect processing serial rather than parallel
- Clamping max volumes to 1.0 (linear) before setting volumes on API calls. Not doing this causes sounds to distort as max volume being used was 4.0 and we have volume scale factors greater than 1.0

[CL 2631483 by Aaron McLeran in Main branch]
2015-07-23 18:01:47 -04:00
Aaron McLeran
6ed6e4bff0 UE-18905 ShooterGame crash when closing in game menu
- Re-adding the SAFE_CA_CALL wrapper around AUGraphUpdate since there a legit OSStatus code which can result from API call that isn't noErr. In the case of unpausing sounds, etc, this can happen.

[CL 2628158 by Aaron McLeran in Main branch]
2015-07-21 17:08:25 -04:00
Aaron McLeran
15b333032e BLOCKING ISSUE UE-17563 Fixing core audio crash
- QAGame's Test map TM-MultipleSounds allowed me to finally repro the issue after a few minutes. Reducing the number of voices in CoreAudio caused the issue to happen immediately.
- Crash was due to an invalid audio unit index (-1) when the number of active audio units exceeds total number of available audio units
- Fixed by properly failing to play a sound if no audio unit/voice indices are available rather than trying to construct an AUGraph with the invalid index.
- Added more asserts to make sure things are what they should be.
- Changed the MAX_AUDIOCHANNELS #define used in Mac-code so it can be different than other platforms. Other platforms use this as an upper limit but don'''t allocate resources according to it, Mac however, allocates resources and allows voices to play up to the max number. Rather than fix that right now, we''ll hard-code that upper limit on mac to be on-par with PC
- Went ahead and reduced the number of max voices on Mac since PC only uses 32 and this was set to be 64 (for mono/stereo files) and 16 for multichannel files for a total of 80 max voices. Mac is already perf-heavy on the main thread, this will help to decrease perf due to audio and will be more in-line with PC audio.

#codereview Michael.Trepka Marc.Audy
#lockdown Nick.Penwarden

[CL 2623909 by Aaron McLeran in Main branch]
2015-07-16 21:46:19 -04:00
Aaron McLeran
dadb2b42db UE-17938 Adding ability to set a volume headroom per platform to better achieve platform consistency with respect to volume.
- Added stubs per platform in their ini file that doesn't change volume, except for mac which this bug is about and for which I reduced the volume by -6 dB. This can be changed by designers as per needed for their game per platform. The final headroom should be set by designers.
- Removed the hard-coded headroom constant used in OpenAL recently added.

[CL 2611741 by Aaron McLeran in Main branch]
2015-07-06 18:06:48 -04:00
Michael Trepka
43ed941ff7 Changed the order of AudioUnit and AudioToolbox linking in two more places to solve issues with Mac 10.11 SDK
#codereview Aaron.McLeran

[CL 2593742 by Michael Trepka in Main branch]
2015-06-19 12:57:27 -04:00
Michael Trepka
a10c6ddbba Merging CL 2590157 - Workaround for CoreAudio linking issue with OS X 10.11 SDK
#codereview Josh.Adams

[CL 2590333 by Michael Trepka in Main branch]
2015-06-17 12:45:36 -04:00
Marc Audy
1f3af26fb1 Use a triple buffer XAudio/Core for realtime audio decompression to ensure that if async task is getting starved audio does not hitch; if final buffer is active then ensure completion on the main thread of the pending async task so starvation will not occur.
Properly initialize audio resource when playing a native sound with a specified start time.
#codereview Aaron.McLeran

[CL 2588686 by Marc Audy in Main branch]
2015-06-16 11:13:47 -04:00
Marc Audy
2c1e24d7bb Fix crash in async realtime audio decompression
[CL 2581672 by Marc Audy in Main branch]
2015-06-09 15:31:08 -04:00
Marc Audy
60228ea69e Asynchronous realtime audio decompression/procedural generation (XAudio2, Mac, Android)
[CL 2578892 by Marc Audy in Main branch]
2015-06-05 16:09:35 -04:00
Marc Audy
ba008b0bdf Fix shadow variables
[CL 2521205 by Marc Audy in Main branch]
2015-04-22 11:37:49 -04:00
Aaron McLeran
5d0f293fdc UnrealAudio - Checkin CoreAudio implementation
- checked in first-pass on CoreAudio (Mac/iOS) implementation of audio device module of new UnrealAudio
- fixed an issue with wrapping phase for sine functions (and thus fixed unit tests)
- changed simple device out unit test to be more simple (pure sine tone on each channel in octaves every second)

[CL 2519686 by Aaron McLeran in Main branch]
2015-04-21 14:56:17 -04:00
Mark Satterthwaite
ca51a96a05 You can only register the radio component once on OS X, so try to find it first & then only register if we fail to find it.
#codereview michael.trepka

[CL 2478952 by Mark Satterthwaite in Main branch]
2015-03-13 15:10:44 -04:00
Aaron McLeran
d2729ee628 Supporting multiple audio devices for multiple PIE and other potential use-cases.
- Created audio device manager which manages weak ref handles to audio devices
- Audio device handles are created with WorldContexts and accessed through UWorld objects
- All access to audio devices are now through audio device handles
- There is a main/default audio device for GEngine for use with the Editor and single worldcontext games

#codereview marc.audy, matthew.griffin

[CL 2477046 by Aaron McLeran in Main branch]
2015-03-12 12:59:33 -04:00
Michael Trepka
e35bd52414 Initialize InverseTransform in FCoreAudioDevice::InitializeHardware()
[CL 2466414 by Michael Trepka in Main branch]
2015-03-02 11:39:35 -05:00
Ben Marsh
149375b14b Update copyright notices to 2015.
[CL 2379638 by Ben Marsh in Main branch]
2014-12-07 19:09:38 -05:00
Matthew Griffin
f1c4513760 Renaming FVector ClampSize and SafeNormal functions for clarity
Used DEPRECATED Macro to keep old names around in case I've missed anything

[CL 2370785 by Matthew Griffin in Main branch]
2014-11-26 10:01:12 -05:00
Matthew Griffin
e529148280 Added config setting for audio volume when app is unfocused
Removed GVolumeMultiplier and added an equivalent to FApp to contain the code to load the unfocused volume multiplier from config.

UE-4449 - Allow users to choose whether audio can be heard when focus is lost

#codereview Robert.Manuszewski

[CL 2341022 by Matthew Griffin in Main branch]
2014-10-27 08:15:41 -04:00
Lina Halper
e513ea2300 Named FMatrix/FTransform unsafe Inverse to InverseFast, and InverseSafe,InverseSlow to Inverse as people often use Inverse as default function.
- Inverse was one of the main reasons of crashes via lots of functions. Seems making default Inverse to be safer version seems better.

[CL 2255081 by Lina Halper in Main branch]
2014-08-13 15:29:41 -04:00
Michael Trepka
e5fa9d51e7 Initial support for specifying additional files or folders that need to be copied to Mac app bundle in module's Build.cs file. For now only used for Mac CoreAudio's RadioEffectUnit plugin. More files and support for iOS bundles will follow soon.
[CL 2234811 by Michael Trepka in Main branch]
2014-07-28 14:55:48 -04:00
Matthew Griffin
150343eca3 Fixing Mac build error
Missed brackets from end of function call

[CL 2218156 by Matthew Griffin in Main branch]
2014-07-15 07:04:22 -04:00
Matthew Griffin
c0d29a957c Multi channel support for Opus
Implemented CookSurround function for AudioFormatOpus, refactoring as much common code from the standard Cook into re-usable functions.
Changed OpusAudioInfo class to use a multistream decoder for all sounds, as 1 and 2 channel sounds can still be decoded by it. Just had to create an array of mappings that would take the internal Opus format and give back PCM data in the order that Unreal expects.
Also made the OpusDecoderWrapper a true wrapper so that you don't have to use any opus functions outside of it and it will not function if WITH_OPUS is not defined.
Added a virtual function to the CompressedAudioInfo interface, to check whether its uncompressed data will be in the Vorbis format. This is to make sure that code currently just checking whether there is a DecompressionState can now be sure that the Vorbis format is being used before routing sound to different speakers.
Made sure that you can't cause any problems by adding or removing a SoundWave from the Audio Streaming Manager more than once. Also rearranged where sounds are added to the manager so that it is only done in one place and it's safe when changing quality triggers recompression/splitting.
Added a global multidimensional array to store all the Vorbis channel orderings as they needed to be used in multiple places.
Added Logging and Memory tracking for the streaming process.

[CL 2217839 by Matthew Griffin in Main branch]
2014-07-15 06:09:13 -04:00
Matthew Griffin
c28dea244e Splitting format specific classes out of AudioDecompress.cpp/h
New files added to contain FVorbisAudioInfo and FOpusAudioInfo, added all necessary includes
Added a few more checks for whether the target platform supports audio streaming where appropriate
Moved #define to .h file as it was being used in two .cpp files (working because of unity build)

[CL 2137973 by Matthew Griffin in Main branch]
2014-07-04 09:47:36 -04:00
Matthew Griffin
f92177afd9 Removing more duplicated variables from audio sub classes
Duplicate ResourceID would have caused the same problems in HTML5 and Linux as Android. Other duplications are errors waiting to happen, there are a couple of stats functions that could be using the base class versions and not displaying the correct information.

[CL 2119229 by Matthew Griffin in Main branch]
2014-06-27 05:15:16 -04:00
Matthew Griffin
551379cad2 Fixing issues with SoundWave memory and duplicated variables in some platforms.
Moved most of the contents of FAudioDevice::FreeResource to USoundWave::FreeResources so that we can be sure that all memory is cleared up during teardown.
Removed FreeResource function from some subclasses of audio device, as they weren't doing anything different than the base one.
Also removed ListSounds function from these same classes as that seems to have fallen behind current base class version and isn't used anyway.
Removed platform specific audio buffer storage so that there isn't confusion about which is being used and ensured that casts are used when necessary.
Fixed compile issue with STAT_AudioResourceCreationTime for HTML5.

[CL 2109273 by Matthew Griffin in Main branch]
2014-06-18 10:31:15 -04:00