Commit Graph
502 Commits
Author SHA1 Message Date
Steve Checkoway 0d10c76e87 Unscatter arch includes. 2006-11-17 18:25:20 +00:00
Steve Checkoway 5f9ee5c5bd Set sample rate of the device, if possible. 2006-11-17 17:37:51 +00:00
Steve Checkoway 1ea6837c02 Header cleanup. 2006-11-17 17:13:39 +00:00
Steve Checkoway e988ea9945 Survive device changes, (external) sample rate changes, etc. 2006-11-17 16:59:22 +00:00
Steve Checkoway 1f79f25240 Fix crash by stopping the audio _on_ the real time thread. This ensures that the current buffer gets played but that it never gets called again. I'm not convinced that the property listeners won't get called but I'm not sure how to handle those sanely just yet, at least in a lockless manner.
This code doesn't handle external format changes very well yet--but then, neither does the other sound driver.
2006-11-12 09:04:14 +00:00
Glenn Maynard e130d73f88 DSERR_BUFFERLOST handling in DSoundBuf::GetPosition 2006-10-04 02:33:20 +00:00
Glenn Maynard 03ce23e9ea ARRAYLEN 2006-09-18 23:27:09 +00:00
Glenn Maynard b77024f3bc include 2006-09-18 22:45:42 +00:00
Glenn Maynard 1f7fe1afd3 include 2006-09-18 22:24:18 +00:00
Glenn Maynard 62c114b49e remove param 2006-08-21 00:20:13 +00:00
Steve Checkoway a07e194cf1 Revert. Fixes Linux build. 2006-07-18 05:51:37 +00:00
Jason Felds 366c3440d4 Fix VC8 macro redef warning. (more to come) 2006-07-18 03:56:37 +00:00
Steve Checkoway b1d08d1f8b This is still a work in progress (although I haven't worked on it in over a month). 2006-07-17 00:44:38 +00:00
Steve Checkoway a2dca95d01 Use native endian. Now Alsa works for powerpc linux. 2006-06-29 03:22:29 +00:00
Steve Checkoway 8d82bdfb82 Do not allocate or deallocate memory in the mixing thread. Doing so can block that thread which is possibly a realtime thread. Distinguish between STOPPED and AVAILABLE. In the STOPPED state, the memory for the sound is still around. It will be deallocated in Update() at which time the state will change to AVAILABLE.
The BUFFERING state is to keep all other threads from accessing the sound while StartMixing() is prebuffering. It corresponds to the old state STOPPED with available set to false.
2006-06-19 06:43:43 +00:00
Steve Checkoway 78d055dfad Beginning of a sound driver that uses AUHAL instead of dealing with the HAL itself. Apple engineers claim it's easier to use (although, I note there's almost zero documentation) and it correctly handles things like device format changing. It currently works, for the most part (on 10.4 and above). 2006-06-18 19:05:40 +00:00
Steve Checkoway 8d9c59287d Handle JackChanged getting called when the device is stopped. 2006-06-18 18:55:48 +00:00
Steve Checkoway 2572b8c5ea That last commit was a bit more than I intended. Oh well. It (and this one) simplify the property listener code and add more listeners. 2006-06-18 09:40:56 +00:00
Steve Checkoway 1f72db5efc Fix parameter order. 2006-06-18 08:28:18 +00:00
Glenn Maynard 3a70b367c0 temporary fix for crash (proper fix will take more time) 2006-06-11 19:07:54 +00:00
Steve Checkoway bc6cf3b9a3 missed commit 2006-05-20 05:37:03 +00:00
Steve Checkoway 76e98bdaf5 More logging, but less noisy logging (log instead of info). 2006-05-19 20:26:25 +00:00
Steve Checkoway 59c663b238 Attempt to handle devices other than the built-in audio correctly. Not tested on anything but the built-in audio. 2006-05-19 08:09:38 +00:00
Steve Checkoway 060b68ff00 Add more logging: Check that the sample rate we just set matches what the device declares as it's sample rate; log if the device's sample rate changes while it's running. 2006-05-17 07:40:54 +00:00
Steve Checkoway c2b857d01c Remove bloated c++ wrapper. 2006-05-06 11:19:25 +00:00
Steve Checkoway 75d67fbe85 Spacing. 2006-01-22 07:24:18 +00:00
Steve Checkoway 3a4f3a8efd Less noisy. 2006-01-22 07:23:05 +00:00
Steve Checkoway 4a8daa3671 Fix: plugging in head phones causes arrows to stop moving. 2006-01-22 07:21:31 +00:00
Steve Checkoway f909c72376 Cleanup spacing. 2006-01-22 05:33:37 +00:00
Chris Danford 7f821e8cfc CString -> RString 2006-01-22 01:00:06 +00:00
Steve Checkoway 9ed7548de1 Use new api. 2006-01-21 11:14:13 +00:00
Glenn Maynard 2084896f7d RageSoundUtil::Attenuate 2005-12-30 19:04:18 +00:00
Steve Checkoway 99c41cde08 Cleanup registered threads. 2005-12-20 03:20:31 +00:00
Glenn Maynard dcfff261ed use RageThreadRegister. These should be freed properly, so things still work if the driver is recreated for some reason. There may be no guarantee that the same thread will always call the I/O callback--it may recreate the thread on overload, for example ... 2005-12-19 02:06:56 +00:00
Steve Checkoway 510254abb4 Add more property listeners, name the two threads created by the audio HAL. 2005-12-17 13:10:23 +00:00
Steve Checkoway 223c541ecc This stops crashes when headphones are removed. If they're removed during gameplay, the arrows stop scrolling and the receptors stop flashing to the beat. After the hardware reconfigures itself (~.5s), the music resumes.
My guess (which I don't have time to test right now) is that the returned position is reset when the hardware starts back up.
2005-12-15 11:44:46 +00:00
Glenn Maynard 6497ac8f94 style 2005-12-07 03:03:21 +00:00
Glenn Maynard 321931c19a not used 2005-12-07 03:01:23 +00:00
Glenn Maynard b617542b62 cleanup 2005-12-07 03:00:27 +00:00
Glenn Maynard b6ba17a7bb fix busy looping on slower systems, inefficient buffer filling 2005-11-28 17:17:35 +00:00
Glenn Maynard b948f686cc cleanup 2005-11-25 20:38:03 +00:00
Glenn Maynard 9ed3cde95a cleanup 2005-11-25 18:36:44 +00:00
Renaud Lepage 6e6e89276d Fix for Xbox compilation. It was easier with HAVE_FOO, but oh well. 2005-11-16 04:38:28 +00:00
Glenn Maynard 3bbfe9ebc0 Two tests for not filling a buffer:
if( m_iBufferBytesFilled > m_iWriteAhead )

	int iNumBytesEmpty = m_iWriteAhead - m_iBufferBytesFilled;
	if( iNumBytesEmpty < iChunksize )

The latter, manipulated a bit, is actually:

	if( m_iBufferBytesFilled+iChunksize >= m_iWriteAhead )

These do almost the same thing.  This isn't what was intended.  The
former checks whether we *want* to write another buffer (based on our
preferred writeahead).  The latter was meant to check whether it's *possible*
to fit another chunk into the buffer.  It should check against m_iBufferSize,
not m_iWriteAhead.

This fixes writeahead: 4096 means "write if we have less than 4096 frames
buffered", not "write if writing the new chunk would result in still having
less than 4096 frames buffered".  This is important on slower devices, like
USB headsets.
2005-11-10 22:10:05 +00:00
Steve Checkoway 8310140755 Set new arbitrary values with the input handler above the sound decoder. 2005-10-24 11:40:43 +00:00
Steve Checkoway 05201a047c Header cleanup. Use SetThreadPrecedence() and add potential replacement code for GetCurrentTime(). 2005-10-24 11:21:17 +00:00
Steve Checkoway aa0f90feae __MACOSX__ --> MACOSX, keep __MACOSX__ for ogg. 2005-10-24 10:37:56 +00:00
Steve Checkoway 35ad7eb289 Support preferred sample rates and report the latency more correctly. 2005-10-24 08:55:25 +00:00
Steve Checkoway cb229a8774 Remove redundant defines. 2005-10-24 08:17:12 +00:00
Glenn Maynard 539ec6aa5c HAVE_WIN32 -> WINDOWS. HAVE_LINUXKERNEL -> LINUX. If some features originating in Linux work on other systems, then define them specifically (eg. HAVE_LINUX_JOYSTICKS). 2005-10-24 07:22:28 +00:00