Commit Graph

523 Commits

Author SHA1 Message Date
LAGonauta 332e9bd378 Added 32-bit fixed point support to OpenAL backend.
Changed method to detect 32-bit floating point and
32-bit fixed point support.
2016-10-27 18:47:13 -02:00
Michael Maltese 45903b7b4d AudioCommon: SupportsDPL2Decoder, SupportsLatencyControl, SupportsVolumeChanges 2016-10-09 19:18:16 -07:00
Léo Lam 39fd6dcd5b Fix missing includes
Aren't indirect includes great?
2016-10-07 23:46:41 +02:00
LAGonauta d4759a55b6 Fix for false error about unqueuing buffers (OpenAL)
and hopefully added saner error reporting.
2016-10-04 21:57:36 -03:00
shuffle2 7f4106646e Merge pull request #4271 from ligfx/audiofix
OpenAL: Don't request samples if buffers are full
2016-10-02 21:00:10 -07:00
Michael Maltese 8fa79f3897 fix indendentation 2016-10-01 21:36:51 -07:00
Michael Maltese 567dffc1ee OpenAL: Don't request samples if buffers are full
Makes the buffering code a bit more explicit (circular buffer, but
blocks until individual buffers get unqueued by OpenAL), and fixes a
bug in the startup of Super Mario Sunshine:
https://bugs.dolphin-emu.org/issues/9811
2016-10-01 21:36:46 -07:00
aldelaro5 f0aa9b3751 Reorganise a ton of logs level
Most of this commits changes performance decreasing logs from info to debug and also cleans up innacurate levels.
2016-10-01 15:50:28 -04:00
Léo Lam dca22e08eb Use Common::Flag and Common::Event when possible
Replaces old and simple usages of std::atomic<bool> with Common::Flag
(which was introduced after the initial usage), so it's clear that
the variable is a flag and because Common::Flag is well tested.

This also replaces the ready logic in WiimoteReal with Common::Event
since it was basically just unnecessarily reimplementing Common::Event.
2016-08-10 16:08:15 +02:00
Lioncash 128d762aea AudioCommon: const correctness 2016-07-31 19:14:20 -04:00
Lioncash ecc1710676 AudioCommon: Make the SoundStream global a unique_ptr 2016-07-31 15:45:28 -04:00
Chris Burgener 76abf1f727 Remove AddStereoSample function 2016-07-01 00:59:25 -04:00
Chris Burgener ca2eaac704 Split Audio Dumps on Sample Rate Changes 2016-06-24 21:12:15 -04:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
EmptyChaos c1922783f8 Core: Threadsafety Synchronization Fixes (Frame Advance / FifoPlayer)
Fix Frame Advance and FifoPlayer pause/unpause/stop.

CPU::EnableStepping is not atomic but is called from multiple threads
which races and leaves the system in a random state; also instruction
stepping was unstable, m_StepEvent had an almost random value because
of the dual purpose it served which could cause races where CPU::Run
would SingleStep when it was supposed to be sleeping.

FifoPlayer never FinishStateMove()d which was causing it to deadlock.
Rather than partially reimplementing CPU::Run, just use CPUCoreBase
and then call CPU::Run(). More DRY and less likely to have weird bugs
specific to the player (i.e the previous freezing on pause/stop).

Refactor PowerPC::state into CPU since it manages the state of the
CPU Thread which is controlled by CPU, not PowerPC. This simplifies
the architecture somewhat and eliminates races that can be caused by
calling PowerPC state functions directly instead of using CPU's
(because they bypassed the EnableStepping lock).
2016-05-13 09:23:44 +10:00
Mathew Maidment 08c9e3b7a4 Merge pull request #3602 from OatmealDome/coreaudio
CoreAudioSound: Minor clean up
2016-02-07 22:25:15 -05:00
OatmealDome 36a20c3535 CoreAudioSound: Replace deprecated parameters
The kAudioUnitParameterFlag_* parameters don't exist on iOS.
2016-02-06 16:48:03 -05:00
OatmealDome 2e24996a9c CoreAudioSound: Only include AudioUnit 2016-02-06 16:47:49 -05:00
Ryan Houdek 2f7e3ae58e CMakeLists cleanup and enable Android headless building. 2016-02-05 11:24:11 -06:00
Lioncash c70487163f Mixer: Convert defines into concrete variables
Gets defines out of global scope.
2016-01-15 23:41:53 -05:00
Lioncash fc6a2f490f Mixer: Directly initialize class members 2016-01-14 01:32:31 -05:00
Lioncash 531a3ed09a Mixer: Devirtualize
Nothing in the codebase inherits from this class
2016-01-14 01:32:24 -05:00
degasus 3ff4ec275a Throttler: Rename "framelimiter" to "emulation speed".
We don't throttle by frames, we throttle by coretiming speed.
So looking up VI for calculating the speed was just very wrong.
The new ini option is a float, 1.0f for fullspeed.
In the GUI, percentual values are used.
2016-01-05 23:39:05 +01:00
Ryan Houdek 1db01a8c56 [OpenSLES] Fix a delay in audio processing.
A failure on my part. I was updating the two buffers in the wrong order, so we were always a buffer behind in sending audio out to OpenSLES.
2016-01-03 11:33:38 -06:00
skidau cfa925fbbe Updated SoundTouch library to 1.9.2 2015-12-28 23:08:55 +11:00
Markus Wick 164e045123 Merge pull request #3317 from lioncash/null
NullSound: Minor changes
2015-12-15 17:38:37 +01:00
Ryan Houdek cb5be45f72 Merge pull request #3200 from degasus/master
Throttler + Mixer: Configureable variance
2015-12-11 07:04:56 -05:00
Lioncash 0917db7fc0 NullSound: Use std::array for the buffer 2015-12-05 18:13:55 -05:00
Lioncash 0d4baa0744 NullSound: Replace header define with private constant 2015-12-05 18:13:49 -05:00
Lioncash e0eef7bef4 WaveFile: Get rid of an explicit delete 2015-12-02 20:05:18 -05:00
degasus 888c377b57 Throttler + Mixer: Configureable variance 2015-11-03 08:22:36 +01:00
shuffle2 9878004871 Merge pull request #3105 from phire/dont_block
ALSA: Don't block on Clear() call.
2015-10-03 17:55:26 -07:00
Lioncash 5464e698fc Merge pull request #3102 from rohit-n/build-pch
Fix building with PCH disabled.
2015-10-03 13:30:51 -04:00
Scott Mansell a10a3ecbac ALSA: Don't block on Clear() call.
snd_pcm_writei() is meant to block block until all samples are written,
but apparently in some situations it can block for much longer, prehaps
even a infinite time, in the case of virtual machine FifoCI runs in.

Because it grabed a mutex before blocking, it could also block the
Clear() call for an infinite length of time, blocking dolphin's emu
thread.

snd_pcm_writei() also takes 10-15 seconds if you run dolphin under GDB
and can randomly take 5 or so seconds during normal usage.

By moving all the pause code to the ALSA thread, Clear() no-longer
blocks and everyone keeps their sanity.
2015-10-03 16:31:55 +13:00
Rohit Nirmal 6001366aac Alsa: Silence -Wsign-compare warning. 2015-10-02 21:10:06 -05:00
booto 6c28ea58ab AlsaSound: fix buffer type, clean up macros 2015-09-30 19:14:03 +08:00
Rohit Nirmal 3b75f45cf6 Fix building with PCH disabled. 2015-09-28 11:51:08 -05:00
Lioncash cc036ca86c Common: Remove other Common prefixed headers from Common.h 2015-09-26 18:51:58 -04:00
Lioncash 1d42db2439 Common: Move NonCopyable to its own header 2015-09-26 18:50:35 -04:00
Ryan Houdek f121d7a8cd Merge pull request #3026 from lioncash/constexpr
MathUtil: Make Clamp and IsPow2 constexpr functions.
2015-09-12 02:28:38 -04:00
Lioncash b9e360df7b MathUtil: Convert Clamp into a constexpr function 2015-09-12 01:18:28 -04:00
LAGonauta b98b55c7be Added X-Fi check and convert surround FLOAT to SHORT when it is detected
Fixed braces, first try fixing mac compilation and removed useless NULL
comparison.
2015-09-11 13:22:04 -03:00
Shawn Hoffman aa7208e270 [windows] Update projects to vs2015. 2015-09-03 04:23:01 -07:00
Markus Wick e60018abd4 Merge pull request #2854 from Tilka/valgrind
Fix some small stuff found with Valgrind
2015-08-15 20:52:12 +02:00
Markus Wick 3469694b46 Merge pull request #2676 from Stevoisiak/SpellingCorrections
Minor spelling corrections
2015-08-15 18:36:56 +02:00
Tillmann Karras 0b73a9ed25 PulseAudio: fix small memleak 2015-08-15 12:51:11 +02:00
Moncef Mechri 333f998123 Don't busy wait in the audio thread (ALSA)
When the emulation is paused and the ALSA backend is used, make the audio
thread wait on a condition variable instead of busy-waiting. This commit
fixes bug #7729

Since the ALSA API is not thread-safe, calls to snd_pcm_drop() and snd_pcm_prepare()
in AlsaSound::Clear() are protected by the same mutex as the condition variable in AlsaSound::SoundLoop()
to make sure that we do not call these functions while a call to
snd_pcm_writei() is ongoing.
2015-08-11 03:54:54 +02:00
Moncef Mechri a0c5247743 Initialize ALSA before starting the audio thread
This fixes a race condition:

Before this commit, there was a race condition when starting a game:

Core::EmuThread(), after having started (but not necessarily completed)
the initialization of the audio thread, calls Core::SetState() which calls
CCPU::EnableStepping(), which in turns calls AudioCommon::ClearAudioBuffer().

This means that SoundStream::Clear() can be called before
AlsaSound::AlsaInit() has completed.
2015-08-11 03:54:54 +02:00
Markus Wick e297e3e666 Merge pull request #2825 from lioncash/log
AudioCommon: Log to AUDIO, not DSPHLE
2015-08-10 10:25:51 +02:00
Moncef Mechri 8b767a1189 Use dummy audio backend if the selected backend fails to start
If the selected audio backend fails to Start() (which could happen for
example if there is no audio device), we currently still use the backend
anyway. This can lead to crashes on some platforms (such as Windows) and
is outright wrong anyway.

This commit fallbacks to the Null audio backend if the selected backend
couldn't be started.

This fixes bug #6001
2015-08-10 03:46:45 +02:00
Lioncash 4c6930d36c AudioCommon: Remove unused code from XAudio streams 2015-08-09 21:37:34 -04:00
Lioncash 3f78d74fc1 AudioCommon: Log to AUDIO, not DSPHLE
This code is not related to DSPHLE.
2015-08-09 21:36:03 -04:00
Lioncash 7ee0e75633 Remove unnecessary virtual keywords 2015-07-30 10:33:08 -04:00
Stevoisiak 7248f9b524 Minor spelling corrections 2015-06-29 14:51:21 -04:00
Jules Blok a71e81a143 Merge pull request #2659 from Armada651/openal-conv
OpenALStream: Fix sample conversion.
2015-06-27 00:13:02 +02:00
Jules Blok 86dd81cf6b OpenALStream: Fix sample conversion.
Looks like it wasn't symmetric anymore.
2015-06-25 12:42:41 +02:00
Lioncash 9dd607b923 Mixer: Fix erroneous global prefixes on class variables 2015-06-20 21:48:50 -04:00
Lioncash d81dffd4f0 Mixer: Devirtualize DTK and DSP audio logging functions
Their functionality is already complete in the base class; there's no need to allow overriding.
2015-06-20 21:46:20 -04:00
degasus c375111076 Options: merge SCoreStartupParameter into SConfig 2015-06-12 19:07:45 +02:00
JosJuice 030d467d62 Use PanicAlert instead of PanicAlertT when appropriate
It means less work for the translators... But I'm not too sure
about this, because most of these have already been translated.
2015-06-04 13:25:17 +02:00
degasus 9a96e3c416 AudioCommon: Remove lock on Pause state
We had to lock audiocommon with the old asynchron HLE audio emulation,
now our Mixer is just a plain FIFO which may underrun.
Of course, this will stutter, but underruning the audio backend is likely worse.
2015-05-28 19:58:18 +02:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Tillmann Karras 268f52e054 Add missing license headers 2015-05-25 13:11:47 +02:00
Lioncash 6b30c9710c SoundStream: Devirtualize StartLogAudio and StopLogAudio
These don't rely on anything that might need to be implemented in other SoundStream classes.
2015-05-24 06:10:11 -04:00
Lioncash 07d4dbe657 AudioCommon: Add missing override specifiers
Also removes unnecessary virtual keywords.
2015-05-24 06:10:03 -04:00
Lioncash 4695233c98 SoundStream: Devirtualize GetMixer
Since it's handled by the base class, there's no need to allow overriding.
2015-05-24 05:49:51 -04:00
Lioncash 35ee8a1362 SoundStream: Internally construct the mixer
Instead of creating the mixer externally and then passing it in, it can just be made within the class.
2015-05-24 05:49:41 -04:00
Lioncash f907e5cace AlsaSoundStream: Use an enum class for signifying ALSA thread state 2015-05-11 01:56:01 -04:00
Lioncash 353205132c AlsaSoundStream: Convert volatile variables to atomics 2015-05-11 01:55:59 -04:00
Lioncash 7b376abd3b Mixer: Convert volatile variables to atomics. 2015-05-11 01:55:50 -04:00
Lioncash 4920dbed13 AudioCommon: Migrate threadData to OpenALStream and AOSoundStream
This is only ever used in these two sound streams. Seems silly to have it as a class member. Converted it to an atomic as well.
2015-05-10 01:02:25 -04:00
Stevoisiak 78971b0840 (Visual Studio) Categorize SoundStream.h with other SoundStream files 2015-04-03 14:37:03 -04:00
Stevoisiak 93b16a4a2d Formatting/Whitespace Cleanup
Various fixes to formatting and whitespace
2015-02-25 10:48:21 -05:00
Markus Wick e0b0ef3868 Revert "High quality resampler" 2015-02-23 18:43:13 +01:00
kamiyo e864521182 High Quality Resampler, using FIR filter
For more information:
https://docs.google.com/document/d/1tBEgsJh7QiwNwepXI0eobfK3U8LkJButSyeuFt1degM/edit?usp=sharing

removed: SSE includes (not used)

added: 16bit -> float -> 16bit functions
added: linear interpolator and high-quality (windowed-sinc) interpolator functions (including Resampler class)
added: dithering

changed: renamed variables and reformatted a few things to fit with style guide (braces, #include->const)
changed: use s16, u16, s32, u32 etc
changed: store samples and do all computations as floats
changed: volume from 0 - 255
2015-02-18 21:13:45 -05:00
Scott Mansell 43dfec07c9 Cleanup DotProduct function to make it more readable. 2015-02-16 13:53:58 +13:00
Scott Mansell 7add7b685f Remove unneeded spaces from code.
Line now matches the style of the rest of the function.
2015-02-16 12:59:45 +13:00
magumagu 0f96a0104e Merge pull request #1752 from Buddybenj/clean-up
Clean Up
2015-02-10 11:39:14 -08:00
Benjamin Przybocki 4f324ad742 Clean Up 2015-01-24 17:10:21 -06:00
skidau 6e99accf06 Merge pull request #1917 from adamdmoss/no-lfe
Remove explicit subwoofer/LFE channel from Pulseaudio and OpenAL
2015-01-23 12:30:48 +11:00
Adam D. Moss 05d2bf6060 Audio: Drop the LFE/subwoofer channel from the decoded surround
DPL2Decode still doesn't decode 5.1 properly, leaving bass in all channels, but its 5.0 is pretty good, so leave it at that.
2015-01-19 10:24:44 +00:00
Stevoisiak cb86db7b68 Minor consistency changes
Mostly small changes, like capitalization and spelling
2015-01-12 15:18:18 -05:00
skidau f7f70f9039 Merge pull request #1847 from adamdmoss/openal-floatfix
OpenAL: Fix volume of sample conversion
2015-01-10 12:16:05 +11:00
skidau 530f894d87 Merge pull request #1845 from adamdmoss/lfe1
Audio: Fix subwoofer output in software 5.1 decoding
2015-01-09 11:59:29 +11:00
skidau ac33423db5 Merge pull request #1835 from adamdmoss/master
Pulseaudio: Support 5-channel surround, optional in UI
2015-01-09 11:59:02 +11:00
Adam Moss 95c912310d PulseAudio: Support 5.1 surround, optional in UI 2015-01-08 11:10:34 +00:00
Adam Moss b1c9f56acd Audio: Fix warning in DPL2 subwoofer change 2015-01-08 10:48:30 +00:00
skidau 25c6f6e6a1 Merge pull request #1782 from FL-dolphinemu/master
Issue 7968: Added keybinds for increasing, decreasing, and muting audio.
2015-01-08 14:09:18 +11:00
Adam Moss 2c892c7b68 OpenAL: Fix volume of sample conversion 2015-01-07 12:34:02 +00:00
Adam Moss 7580069dea Audio: Fuller subwoofer processing for software 5.1 decode
Code was only using front-left and front-right to calculate bass, but
HRTF code - which this was once based on - uses all five channels and
this sounds fuller.
2015-01-07 11:58:02 +00:00
Adam Moss f324f3f68f Audio: Fix subwoofer output in software 5.1 decoding
The FIR filter was only using the first sample of each input packet.
2015-01-07 10:24:25 +00:00
Tillmann Karras 6bcdb10eee CMake: simplify some expressions 2015-01-03 13:17:57 +01:00
FL.dolphinemu 78f8bf7423 Issue 7968: Added keybinds for increasing, decreasing, and muting audio. 2014-12-28 22:03:21 +01:00
comex b36b55cfcb Upgrade AudioUnit API usage.
weird that such a simple change doesn't seem to have any obvious
documentation on Apple's website or elsewhere...
2014-11-25 00:42:21 -05:00
comex aae234c5d7 Fix name conflict between SoundTouch BOOL and ObjC BOOL. 2014-11-25 00:27:13 -05:00
Stevoisiak b25e1a2eb4 Various formatting and consistency fixes 2014-11-13 22:42:18 -05:00
Ryan Houdek 5204acd5ee Fixes OpenSLES's sample rate.
I was statically setting the sample rate to 44.1Khz when we default to run at 48Khz.
This was causing audio to sound much too low.
2014-10-23 11:29:49 -05:00
Ryan Houdek 73512ad38f Fix a race condition in our OpenSL ES audio backend.
After calling enqueue the callback would fire before we had assigned g_mixer a value.
This would cause a fun crash to happen.
2014-10-18 08:32:14 -05:00
skidau 0d1f8527c7 Merge pull request #1297 from RisingFog/audio-dump-during-emulation
Start/Stop Audio Dump During Emulation
2014-10-18 13:16:41 +11:00