Commit Graph

570 Commits

Author SHA1 Message Date
Michael Maltese f6e1da0dc0 AudioCommon: add Cubeb backend 2017-05-27 18:28:56 -07:00
Pierre Bourdon d592bdd4d4 Migrate to Visual Studio 2017.
Auto-generated by the IDE, I'll trust it knows what it's doing.
2017-05-25 15:58:59 -07:00
MerryMage c9f50fd4ed DPL2Decoder: Prefer static_cast to C-style casts 2017-04-23 09:21:30 +01:00
MerryMage 4f884d0b2f DPL2Decoder: Simplify DotProduct 2017-04-23 09:21:30 +01:00
MerryMage 42a1f7939d DPL2Decoder: Prefer std::vector to calloc-ed array 2017-04-23 09:21:29 +01:00
MerryMage 71dc810418 DPL2Decoder: Make constant variables const in DesignFIR 2017-04-23 09:18:29 +01:00
MerryMage 751351fd20 DPL2Decoder: Simplify cut-off frequency logic in DesignFIR 2017-04-23 09:18:29 +01:00
MerryMage 24027c1d4a DPL2Decoder: Reduce scope of variable in DesignFIR 2017-04-23 09:18:29 +01:00
MerryMage d0e75bb438 DPL2Decoder: Remove unnecessary pointer arguments of DesignFIR 2017-04-23 09:18:28 +01:00
Michael Maltese c538cdcd47 AudioCommon: set volume _after_ starting stream
Fixes an error with the CoreAudio backend, which apparently doesn't
allow you to set the volume before starting the stream:

```
59:31:087 AudioCommon/CoreAudioSoundStream.cpp:97 E[Audio]: error setting volume
```

This shouldn't cause any problems with other backends, since the mixer
starts with silence anyways.
2017-04-20 02:06:42 -07:00
MerryMage cbaa00457a Mixer: Tweak audio stretch parameters 2017-04-12 17:56:58 +01:00
MerryMage 9397fdfe95 Mixer: Use a temporary buffer when stretching audio 2017-04-12 14:58:20 +01:00
MerryMage f5018010d3 Mixer: Calculate actual_samples based on availability in all FIFOs 2017-04-12 14:58:19 +01:00
MerryMage ac0df5b2db Mixer: Disable frequency shifting when stretching is enabled 2017-04-12 13:56:29 +01:00
MerryMage 26514358f4 Add audio stretching as a configuration option 2017-04-12 13:56:29 +01:00
MerryMage b8c867dd7a Mixer: Implement audio stretching 2017-04-12 13:56:28 +01:00
MerryMage 5b81f2a31d Mixer: Return actual number of samples mixed into buffer from MixerFifo::Mix
No code in the codebase currently depends on the return value of this function.
2017-04-12 13:15:00 +01:00
MerryMage 6a4945090c OpenALStream: Remove audio stretching 2017-04-12 13:15:00 +01:00
Michael Maltese af63235dc4 Remove libao sound backend
A single person uses it[0], and it sometimes messes up the Linux
buildbots ("ninja: error: 'ao', needed by 'Binaries/dolphin-emu', missing
and no known rule to make it").

[0]: https://analytics.dolphin-emu.org/stats/popular-audio-backends.txt
2017-03-31 14:59:57 -07:00
Markus Wick 7b19475911 Merge pull request #4548 from stenzek/gcc-sse
Support SSSE3 texture decoders and CRC32 hashing on non-native builds (gcc)
2017-03-13 14:28:01 +01:00
Lioncash 552c0d8404 Common: Move byte swapping utilities into their own header
This moves all the byte swapping utilities into a header named Swap.h.

A dedicated header is much more preferable here due to the size of the
code itself. In general usage throughout the codebase, CommonFuncs.h was
generally only included for these functions anyway. These being in their
own header avoids dumping the lesser used utilities into scope. As well
as providing a localized area for more utilities related to byte
swapping in the future (should they be needed). This also makes it nicer
to identify which files depend on the byte swapping utilities in
particular.

Since this is a completely new header, moving the code uncovered a few
indirect includes, as well as making some other inclusions unnecessary.
2017-03-03 17:18:18 -05:00
Phil Christensen 2ed61b0ee1 C++ conformance fixes (MSVC /permissive-)
We (the Microsoft C++ team) use the dolphin project as part of our "Real world code" tests.
I noticed a few issues in windows specific code when building dolphin with the MSVC compiler
in its conformance mode (/permissive-).  For more information on /permissive- see our blog
https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/.

These changes are to address 3 different types of issues:

1) Use of qualified names in member declarations

    struct A {
        void A::f() { } // error C4596: illegal qualified name in member declaration
                        // remove redundant 'A::' to fix
    };

2) Binding a non-const reference to a temporary

    struct S{};
  
    // If arg is in 'in' parameter, then it should be made const.
    void func(S& arg){}
  
    int main() {
      //error C2664: 'void func(S &)': cannot convert argument 1 from 'S' to 'S &'
      //note: A non-const reference may only be bound to an lvalue
      func( S() );
   
      //Work around this by creating a local, and using it to call the function
      S s;
      func( s );
    }

3) Add missing #include <intrin.h>

Because of the workaround you are using in the code you will need to include
this.  This is because of changes in the libraries and not /permissive-
2017-02-15 20:37:04 -08:00
JosJuice 01073946b4 Fix default audio backend on Android being "No audio output"
People who already have encountered the problem will need to
manually change the audio backend (or delete the config INI).
2017-02-08 21:29:27 +01:00
Florent Castelli c1dcd06043 cmake: Move PulseAudio detection to AudioCommon 2017-02-07 23:35:44 +01:00
Florent Castelli d1eaa59a8e cmake: Move detection of OpenAL to AudioCommon 2017-02-07 03:42:43 +01:00
Florent Castelli cbb7e4072a cmake: Move AO detection to AudioCommon 2017-02-07 03:42:43 +01:00
Florent Castelli 2fceb016b4 cmake: Move ALSA detection to AudioCommon 2017-02-05 02:55:05 +01:00
Florent Castelli d615c0f868 cmake: Add imported target to FindALSA 2017-02-05 02:55:05 +01:00
Florent Castelli 9ebfaa9324 AudioCommon: Move logic for default sound backend there from ConfigManager
This way, we don't have to leak the HAVE_ALSA define there.
2017-02-05 02:55:04 +01:00
Florent Castelli 31dfaafe0b AudioCommon: Remove checks against NullSound::isValid()
The NullAudio backend is guaranteed to be compiled in, so no reason
to check it.
In addition to that, if it wasn't valid, it wouldn't work as a fallback
in InitSoundStream as there are uses to g_sound_stream later.
2017-02-05 02:55:04 +01:00
Florent Castelli ee8a21f1d0 cmake: In AudioCommon, append sources and dependencies to a real target 2017-02-05 02:55:04 +01:00
Florent Castelli f1ba7832a5 cmake: Reindent AudioCommon 2017-02-05 02:55:04 +01:00
Florent Castelli fb02a321b6 cmake: Move OpenSLES detection to AudioCommon through find_package() 2017-02-04 03:38:11 +01:00
Florent Castelli 87380c1c2c cmake: Change endif(.*) to endif() 2017-01-25 15:07:32 +01:00
Stenzek d315052552 AudioCommon: Remove unused _M_SSE test 2017-01-24 20:04:55 +10:00
Florent Castelli a7bf9271b5 Fix missing includes 2017-01-24 03:31:51 +01:00
Matthew Parlane f70a1a27fa Merge pull request #4726 from ligfx/addingwindowsheaders
Fix building without PCH on Windows
2017-01-24 13:47:36 +13:00
Mat M 93faf26217 Merge pull request #4721 from RisingFog/remove_dead_audiodump_code
Remove dead audio dumping code
2017-01-23 09:17:11 -05:00
Chris Burgener dd9709509c Remove dead audio dumping code 2017-01-23 09:11:48 -05:00
Michael Maltese 713ec5ffd5 Add includes for building on Windows without PCH 2017-01-23 01:37:41 -08:00
Florent Castelli b5b9c0cfc3 cmake: Build XAudio 2.7 backend on Windows 2017-01-21 00:34:02 +01:00
Chris Burgener 47b3a9c68e Add Silent Audio Dumping INI Option 2017-01-08 13:53:44 -05:00
Chris Burgener debc40e85b Display warning when dumping audio if file exists 2016-12-17 22:45:01 -05:00
Lioncash 87f2a74c08 AudioCommon: Remove unnecessary headers
Now AudioCommon code won't need to be recompiled if the TAS movie header
is ever modified.
2016-12-11 06:11:37 -05:00
Léo Lam 72e3f1ecec Remove unnecessary ConfigManager includes
Making changes to ConfigManager.h has always been a pain, because
it means rebuilding half of Dolphin, since a lot of files depend on
and include this header.

However, it turns out some includes are unnecessary. This commit
removes ConfigManager includes from files which don't contain
SConfig or GPUDeterminismMode or GPU_DETERMINISM (which means the
ConfigManager include is not used).

(I've also had to get rid of some indirect includes.)
2016-11-27 22:38:38 +01:00
Markus Wick 9ce1cdde98 Merge pull request #4414 from linkmauve/single-newline
Remove double newlines at the end of *_LOG messages
2016-11-02 12:20:46 +01:00
Emmanuel Gil Peyrot c9e6b05ce9 Core: Remove double newlines at the end of *_LOG messages. 2016-11-02 02:09:33 +00:00
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