Commit Graph

239 Commits

Author SHA1 Message Date
Glenn Maynard b860c0c51c RageSound::GetDataToPlay: always return a full block if possible
(the sound filters are allowed to return less data than was requested,
even if not EOF)
2006-12-06 06:16:15 +00:00
Glenn Maynard edcc1c2f40 bind RageSound 2006-12-04 22:31:25 +00:00
Glenn Maynard 99f4097ec1 fix audio lead-ins 2006-12-01 11:15:46 +00:00
Glenn Maynard 90b56c3705 remove m_fRate (if you really want that effect, set both pitch and speed) 2006-11-30 07:34:05 +00:00
Glenn Maynard 458be5efa4 add RageSoundLoadParams, to specify load-time params
allow loading pitch shifter
add pitch and speed params
2006-11-30 07:28:26 +00:00
Glenn Maynard 2ee6acbcbe stream frames are 64-bit (sound driver api change) 2006-11-30 06:00:51 +00:00
Glenn Maynard 7af5741c08 stream frames are 64-bit 2006-11-30 05:55:42 +00:00
Glenn Maynard cd5f4a6e39 SoundReader_FileReader -> RageSoundReader_FileReader 2006-11-30 04:22:38 +00:00
Glenn Maynard eee319b535 Refactor sample tracking to support GetNextSourceFrame and
GetStreamToSourceRatio.  This will allow RateChange() to
be implemented with a filter, instead of being built into
RageSound, allow filters that change the music rate while
preserving robust correlation to the original audio.

This tightens up the frame definitions, resulting in three
frame counters:
 - source frames; frames into the original source audio
 - stream frames; frame counter after all filtering
 - hardware frames; the sound driver's frame counter

All frames are in the sample rate of the stream; if audio
is resampled to match the hardware, the resampled audio is
considered the source audio, and frame units are in the
resulting sample rate.

By design, source frames are never exposed to the sound
driver, which only deals with stream and hardware frames.

The principle of the ratio API is that while a filter stream
should ideally output audio at the exact rate it advertises
through GetStreamToSourceRatio, rounding error will inevitably
creep in.  Rather than depending on the ratio being exact
over an arbitrary length of time, each filter's GetNextSourceFrame
calculates the actual next source frame.  Typically, it
will be equal to (its value before the previous read) + (number
of frames read * previous ratio).  This avoids hard-to-debug
synchronization drift.

(This also eliminates the 1k buffer which was used for crappy
rate changing, which can be readded with a buffer filter if
needed.  Rate changing is disabled for a while until a bit
more work is done.)
2006-11-30 03:54:57 +00:00
Glenn Maynard 3afa9e231e change param order 2006-11-30 02:11:08 +00:00
Glenn Maynard 115bad2017 CommitPosition -> Insert 2006-11-30 01:47:51 +00:00
Glenn Maynard 1146c57dc8 specify source and dest sample rate in the ctor; they don't change 2006-11-29 02:45:40 +00:00
Glenn Maynard 3e11c3ca8e create RageSoundReader_Resample_Good directly 2006-11-29 02:20:42 +00:00
Glenn Maynard f2b893939d SoundReader -> RageSoundReader 2006-11-29 02:20:10 +00:00
Glenn Maynard e2923274f4 Insert -> CommitPosition 2006-11-26 18:44:06 +00:00
Glenn Maynard a3a0b16bad "PlayTheSound"? Don't rename functions to ridiculous things like that. This works fine in VC7 and VC8, so I'm reverting it. Ask before making ugly changes. 2006-11-19 00:41:50 +00:00
Jason Felds 2202eb8547 Workaround for Windows API issues (PlaySound -> PlaySound[A/U] bug). Thank rikai for testing on Linux. Untested on Mac right now. 2006-11-18 17:31:18 +00:00
Steve Checkoway 30d9410b65 Unneeded. 2006-11-01 10:45:51 +00:00
Glenn Maynard da024345f3 cleanup 2006-10-27 05:53:23 +00:00
Glenn Maynard ba1daf8183 annoying log 2006-09-12 22:01:59 +00:00
Chris Danford 7f821e8cfc CString -> RString 2006-01-22 01:00:06 +00:00
Glenn Maynard 66fd1baca2 cleanup 2005-12-23 05:31:27 +00:00
Glenn Maynard eb151cf9d3 remove XXX: Fail() is no longer tricky 2005-12-23 05:24:23 +00:00
Glenn Maynard 443e80551f prefer standard find() over Find 2005-12-21 08:27:00 +00:00
Glenn Maynard a42177e5df remove old comments: this is all in RageSoundPosMap now 2005-11-23 19:03:04 +00:00
Glenn Maynard 217193ce45 fix old comments. This is a case where comments are a problem: these
comments fell behind the code.  In this case, it's better to use a better
name than "iSize" which indicates units, eg. "iBytes" or "iFrames", than
to explain the units in a comment.
2005-11-23 19:00:32 +00:00
Glenn Maynard 32e4c0ba6e cleanup 2005-11-23 18:58:25 +00:00
Glenn Maynard d868908941 fix comment more 2005-11-23 18:53:31 +00:00
Glenn Maynard 3a77a52dba this only returns bool; fix comment 2005-11-23 18:52:49 +00:00
Glenn Maynard 599636992e cleanup 2005-11-23 18:51:00 +00:00
Glenn Maynard 8f26a6c2ec the sound must not already be playing 2005-11-23 18:31:29 +00:00
Glenn Maynard a9ac27c730 move SoundResampleQuality into RageSoundReader_Resample 2005-10-27 16:51:18 +00:00
Glenn Maynard 7a67264ece remove GetVolume 2005-10-23 07:05:33 +00:00
Glenn Maynard 8b34d6eef8 cleanup 2005-10-23 07:04:55 +00:00
Glenn Maynard 03cb8bda22 remove unused 2005-10-19 11:47:56 +00:00
Chris Danford 7bfa77f9ac mute before starting the sound. Fixes little pops. 2005-10-13 22:10:40 +00:00
Chris Danford ced0a0c6e9 fix transition sounds playing when attract sounds are off 2005-10-13 22:07:40 +00:00
Glenn Maynard 643da8e2ce Apply m_bIsCriticalSound permanently on play, so we don't start playing previously
muted sounds when GetPlayOnlyCriticalSounds changes.  Fixes background music
playing for a split second in some sound drivers when start is pressed during attract.
2005-10-04 07:35:35 +00:00
Chris Danford 15880eafd6 When in attract and not playing attract sounds, have SOUNDMAN only play sounds with RageSoundParams.m_bCriticalSound == true.
Currently, only the coin sound has RageSoundParams.m_bCriticalSound = true.
2005-10-04 06:51:06 +00:00
Chris Danford a1cc399f3f mute attract sounds inside of RageSound and don't mute everywhere that a sound might possibly be used in an attract screen 2005-10-03 23:54:40 +00:00
Chris Danford 7b345b5c75 make volume changes affect playing sounds 2005-10-02 08:35:46 +00:00
Glenn Maynard 2f3905325d style cleanup 2005-09-23 00:12:32 +00:00
Glenn Maynard 9ef48d4a48 reuse preloaded sounds 2005-07-18 19:09:31 +00:00
Steve Checkoway c1f4c33fb9 Fix format string. 2005-06-19 00:21:48 +00:00
Glenn Maynard 55f47ff85c style cleanup 2005-06-08 04:47:03 +00:00
Glenn Maynard 6c1a16e61d assertions -> warnings 2005-06-08 04:16:03 +00:00
Chris Danford e389ba6191 convert the rest to use Preference 2005-05-16 09:36:32 +00:00
Chris Danford c45c229995 cleanup: don't cast bool to int 2005-03-16 04:10:10 +00:00
Glenn Maynard ef68b4acdd Working on clean pausing support. (This will break the ALSA and DSound hardware builds until they're updated, soon.) 2005-03-10 22:49:28 +00:00
Glenn Maynard 7ac35530e9 comment 2005-01-20 01:49:04 +00:00