Commit Graph
63 Commits
Author SHA1 Message Date
sukibaby 0447d9ae58 Consistency in Windows ifdefs/windows.h includes
Changing all defined(_WINDOWS) to defined(_WIN32)

Defining WIN32_LEAN_AND_MEAN in all files except those in Archutils/Win32
2024-06-24 15:48:05 -07:00
phantom10111 b365dcd65d PulseAudio: Hold mainloop lock during GetPosition() call
Mainloop lock needs to be held to access PulseAudio object from outside the
event loop thread, in particular in GetPosition() calls. Otherwise we might hit
a race condition and have the call fail. There's also a possibility that the
call might randomly fail if it's called before first timing data is received
for the stream, so handle that case as well.

Also fix the stream write callback to call Mix() with correct parameters, as
well as do the work in a loop in case pa_stream_begin_write() returns smaller
memory buffer than was requested.
2024-05-11 10:26:50 -07:00
phantom10111 481161574e PulseAudio: Report actual audio playback position
PulseAudio driver used to report position of last frame written to audio stream
instead of actual playback position. This kind of worked, since on average the
write position doesn't diverge too much from actual elaped time, but it can
result in note stuttering and in general isn't very accurate. Change the
implementation to use actual playback position from PulseAudio stream.

Remove some compatibity code with old PulseAudio, since version 0.9.10 was
released in 2008.

Also, as an optimization to avoid unnecessary memory copying, use
pa_stream_begin_write() to mix audio directly into PulseAudio memory.
2024-04-12 22:40:41 -07:00
Martin Natano bacecae1f7 Decouple <vector> 2023-04-21 22:13:41 +02:00
Martin Natano aa87f85eef Decouple <cstdint> 2023-04-21 22:13:41 +02:00
Martin Natano 78fb2e9fc3 Decouple <cstddef> 2023-04-20 11:21:29 +02:00
Martin Natano b68ca517e6 Clean up math functions
- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include

e.g. floorf(x) -> std::floor(x)
2023-04-19 19:31:40 +02:00
teejusb c2b9b09418 Allow Windows users to select a device to use with WaveOut 2023-02-18 09:00:58 -08:00
Brian Phlipot 4a6b1a743c Enable more compiler warnings and treat them as errors. 2023-02-02 11:54:17 -08:00
Brian Phlipot a0e805e511 Add std:: prefixes to all shuffle calls. Use unique_ptr instead of shared_ptr. 2022-10-03 16:21:19 -07:00
Brian Phlipot 95e55f5cdd Last RString MSVC compiler error. Eliminate gotos to fix more MSVC compiler errors. 2022-10-03 16:21:19 -07:00
Michael Sundqvist 0cba3579de Remove global "using namespace std;" declarations, use "std::" prefixes on all std elements
Fix whitespace changes
2022-07-31 22:14:38 +02:00
Martin Natano 3eb239ad3b Replace deprecated macOS APIs with modern equivalents 2022-06-05 12:04:37 +02:00
Martin Natano 2bb9124c72 Clean up build system 2022-05-30 23:57:33 +02:00
Martin Natano 7d8ff85018 Remove access to the root FS from lua
On linux / is mounted to /rootfs in RageFile, which allows access to the
_whole_ filesystem from lua. This means themes and mod files can
re-write user data and extract files via USB profiles.

/rootfs was only added for internal use by the alsa, oss and memory card
drivers, so it can be easily replaced with direct fstream file access.
2022-02-06 15:31:31 +01:00
Colby Klein 261daef933 fix build and no audio out on macOS 11, closes issue #2080 2021-01-08 07:58:35 -08:00
Matias Hilden cb10b61d34 fix leftover macro loop in JACK sound driver 2019-12-08 13:52:07 +02:00
teejusb 7e3789b131 Integrate C++11 branch into 5_1-new 2019-06-22 12:35:38 -07:00
Dan Guzek 9088a2e57f backport macOS AudioDevice cleanup into 5_1-new (#1735)
* Replaced Deprecated AudioDevice Functions

* Fixed an oversight.

I still didn’t see any issues.
2018-09-11 04:18:57 -07:00
Chris Pable c200600c65 Fix audio drivers with a low sample count maximum value (#1697) 2018-08-02 08:28:24 -07:00
Chris Pable 55281cebd2 keep xp on life support a bit longer, check for vista+ stuff (#1456) 2017-05-25 00:34:33 -07:00
Kyzentun Keeslala 832fd0e1b6 Use case insensitive lookup when removing invalid sound drivers, the same lookup used when creating the sound driver. Change ffmpeg fetching to fetch from stepmania's mirror because ffmpeg.org moved theirs. 2016-08-04 16:57:31 -06:00
Kyzentun Keeslala d6cf7575b2 Don't allow trying to use a sound driver that is not in the list for the platform. 2016-06-07 18:28:06 -06:00
Kyzentun Keeslala bd19b1b29a Added global lua function for fetching the list of available sound drivers. Moved WaveOut to the front of the list to make it the first driver to try on Windows. 2016-03-05 18:11:59 -07:00
Jason Felds e093d204c8 Use proper cmake detection of features.
This attempts to organize all needed items and places appropriate defines
in a single location. Redundant comparisons/defines were removed when noticed.

A few caveats, however:

* This may be better targeted towards the 5_1_0 branch instead of master right now.
* Cmake will run a little slower on configuration/generation now. That's due to the sanity checks it runs.
* There are some more checks to be added later, but this should be a solid start.

Thanks to the [libical](https://github.com/libical/libical) project for inspiration.
2015-09-05 10:51:17 -04:00
Jason Felds 80542a5a7d Require reasons for checkpoints. 2015-06-08 18:37:13 -04:00
Jonathan Berney f9f486b812 Fixed indentation issues accidentally introduced 2014-10-07 19:56:33 -07:00
Jonathan Berney 218c10ef97 Update RageSoundDriver_AU.cpp
The Yosemite crash happens when we call CFRunLoopAddObserver. It doesn't seem to like runLoopRef. Replacing the first argument to this call with CFRunLoopGetCurrent() avoids the crash, but the app then hangs because CFRunLoopWakeUp doesn't cause observerRef (NameHALThread) to fire, so the semaphore is not posted. Commenting the semaphore wait line allows the game to boot in Yosemite, and seems to play totally normally. This doesn't really fix our problem (we are trying to name the HAL thread, and a catastrophic error occurs), but it shows us what the problem is.

We are obtaining runLoopRef using an API call that was deprecated years ago. However, the Apple-approved replacement code doesn't produce a runLoopRef that avoids the crash, either. So I'm not sure how we get the correct runLoopRef so we can name the thread.

This is my first time looking at the code base, but I don't see the value of naming the thread. In the interest of keeping Stepmania compatible with the upcoming operating system, I propose we just remove the thread-naming logic.
2014-10-07 19:48:58 -07:00
freem ef04f2914a Replace the usage of SOUND_PCM_WRITE_RATE with SNDCTL_DSP_SPEED. (See issue #292) 2014-09-05 03:43:00 -05:00
Devin J. Pohly b2744946c9 fix memory leak in JACK driver 2014-02-08 21:40:40 -05:00
Devin J. Pohly db894326e7 fix port-choosing logic in JACK driver 2014-02-08 21:40:40 -05:00
Ben "root" Anderson 970bb39a81 RageSoundDriver_JACK: Autoconnect by default. More robust port detection and connection logic. 2014-01-25 11:04:46 -06:00
Ben "root" Anderson 36864f8ae7 RageSoundDriver_JACK: Try to connect to the system playback ports if no SoundDevice was specified. 2014-01-25 10:16:26 -06:00
Ben "root" Anderson fe91ae4b18 RageSoundDriver_JACK: Explicitly hint that we would rather fail than start a new jackd instance. 2014-01-25 09:55:45 -06:00
Devin J. Pohly 3527ad1ab8 JACK: let Init do the cleanup on failure
Previously, if Init failed, we were calling jack_client_close twice and
segfaulting.
2013-08-26 08:40:52 -04:00
Devin J. Pohly 2933a71d5d JACK: fix race condition with decode thread
It was possible for the JACK callback to execute before the decode thread had
been started, causing an assertion.
2013-08-20 09:33:35 -04:00
Devin J. Pohly eb634bae3e Finish JACK audio driver: now with actual audio! 2013-08-08 14:56:38 -04:00
Devin J. Pohly 98352844ab Add JACK sample rate callback
This will be necessary once we start the decoding thread, which calls
GetSampleRate a lot.
2013-08-08 14:43:15 -04:00
Devin J. Pohly 982d9e2dbc Add MixDeinterlaced to RageSoundDriver
This complements the read_deinterlace function just added.
2013-08-08 13:30:39 -04:00
Devin J. Pohly f9208e1276 Add skeletal sound driver for JACK
This doesn't make any sound yet, but it creates the JACK client and connects
the requested ports if any.
2013-08-06 19:24:55 -04:00
Jason Felds 07b9fb6da5 The big NULL replacement party part 6.
...and ', NULL' had even more to replace.
2013-05-03 23:49:23 -04:00
Jason Felds 28e5148dec The big NULL replacement party part 5.
Right. ' = NULL' would get a lot of these.
2013-05-03 23:39:52 -04:00
Jason Felds a3f37dc2b4 The big NULL replacement party part 3.
Getting there I think.
2013-05-03 23:16:39 -04:00
Jason Felds ba59dd1656 The big NULL replacement party part 2.
This may take a bit. Trying to do this by operator/command.
2013-05-03 23:11:42 -04:00
Jason Felds 9f24627bf9 The big NULL replacement party part 1.
This is meant to be a safer alternative since
NULL can often be 0. Let's not rely on that.

And yes, I know this is a lot of files. This is
a safer thing to do in big commits vs for loops.
2013-05-03 23:01:54 -04:00
Jason Felds c67419ecc8 There goes the macro file.
This is one of my bigger commits in this branch.

Still, shouldn't cause a problem.
2013-05-01 23:54:39 -04:00
Jason Felds 02d16ce574 Eww: quad loop. 2013-05-01 23:39:15 -04:00
Jason Felds 0bd79b9984 Loops plus minor improvements. 2013-04-30 23:11:53 -04:00
Jason Felds 0897ce48e4 Another one similar. 2013-04-30 23:07:23 -04:00
Devin J. Pohly feb919f0bf Revert memory leak commits
5f7001e: "Added a new branch"
01456ed: "Fixed a lot of memory leaks"
dac4493: "Fixed all remaining memory leaks that I could figure out"
0792db7: "Removed the smnew macro and the call to _CrtSetDbgFlag()"

Some of these caused destructor-time problems due to static initialization
order fiasco and related issues.  Notably, the program would no longer exit on
OSX and had to be killed.

There were probably legitimate fixes in here, but since these are monolithic
commits it's too much work to extract them now.  Let's reapply them
individually and in the forward direction.
2013-04-27 00:05:14 -04:00