Commit Graph
30 Commits
Author SHA1 Message Date
Glenn Maynard 1bd5513698 Switch to floating-point sound internally.
This allows us to change the volume of sounds in filters ("volume",
"fade" properties) without quantizing the audio prematurely.  Previously,
we had a hack to apply volume changes as a mixing-time step.  This
can be done at any point in the filter chain now.

This also means we only need to worry about clipping at the very
last mixing step, instead of at every place we change sound.

Dithering for 16-bit audio and more intelligent gain control
is possible, as we have full-resolution, unclipped sound at the
mixing phase.

We support high resolution source sounds; both Vorbis and MAD
supply more than 16 bits.

Several filters, such as resampling, are easier to implement as
floats; these no longer need to convert back and forth.

Negatives:
 - More memory use.  The main case of this is in RageSoundReader_Preload,
which will be fixed: we can preload in 16-bit without losing most of the
above.
 - Some extra overhead for accessing more memory.
2007-01-27 07:14:58 +00:00
Glenn Maynard fd4b5f93bb RageSoundReader::Read(char *) -> int16_t *. This was originally
char * based on the idea of supporting more than one sample type.
I don't plan to do that (though I may change the sample type to float
or int32).
2007-01-20 01:10:24 +00:00
Glenn Maynard 76832cad3b add GetRate 2006-12-27 07:38:11 +00:00
Glenn Maynard 71be488f42 make RageSoundReader_Resample_Good a RageSoundReader_Filter 2006-12-23 06:38:42 +00:00
Glenn Maynard 7385c1f4c1 merge SetPosition_Accurate and SetPosition_Fast. Use a property
instead.
2006-12-10 08:59:13 +00:00
Glenn Maynard 25e67dd4dc RageSoundReader::Read(buf, unsigned bytes) -> (buf, int frames);
return value in frames, not bytes
2006-12-10 03:56:36 +00:00
Glenn Maynard ca67a9cb7c change SetPosition_Accurate and SetPosition_Fast to take and return frames 2006-12-09 06:35:09 +00:00
Glenn Maynard ce89886873 optimize the 1:1 case 2006-11-30 07:23:56 +00:00
Glenn Maynard f41362f7a9 SoundReader -> RageSoundReader 2006-11-30 04:19:51 +00:00
Glenn Maynard 9e261cca19 support dynamic rate changing 2006-11-30 03:57:09 +00:00
Glenn Maynard 14c8d02e9e GetNextSourceFrame, GetStreamToSourceRatio 2006-11-29 21:47:23 +00:00
Glenn Maynard acb7f4ae6b doesn't exist 2006-11-29 09:05:04 +00:00
Glenn Maynard 73d26022fa remove unused 2006-11-29 02:46:54 +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 7c56fe71dd copy with a copy ctor 2006-11-29 02:38:56 +00:00
Glenn Maynard f417cf604d derive from RageSoundReader 2006-11-29 02:30:18 +00:00
Glenn Maynard 8ccb1a83d8 allow modifying the downsampling ratio on the fly 2006-11-28 21:51:24 +00:00
Glenn Maynard da024345f3 cleanup 2006-10-27 05:53:23 +00:00
Glenn Maynard 7a95f5da5b covariant Copy() 2006-10-20 00:01:18 +00:00
Glenn Maynard 5d64dff234 Rewritten sound resampler.
This eliminates the (optional) libresample dependency, which will clean up
building and eliminate the goofy 5k DLL.  It's also faster.

This doesn't implement "HighQuality".  That would involve changing L from
8 to 16.  I might implement that in the future, but it sounds decent to me.  (It's
a little tricky, since PolyphaseFilter::RunPolyphaseFilter needs L to be
a constant for speed.)
2006-02-13 04:50:28 +00:00
Glenn Maynard 91e8e6a430 comment 2005-02-13 03:08:45 +00:00
Glenn Maynard ed2939b205 IsStreamingFromDisk 2004-08-21 07:01:54 +00:00
Glenn Maynard 7085ec70fe vc6 workaround and rearrange 2004-07-24 04:11:07 +00:00
Glenn Maynard 27243e074c working on variable channel count support (to allow preloading mono samples
in half memory, and to avoid redundant resampling in mono files)
2004-07-24 01:22:10 +00:00
Glenn Maynard f9f10e2372 more license updates 2004-05-06 02:40:33 +00:00
Glenn Maynard 6acfd7a22e remove GetOffsetFix 2004-02-20 04:16:12 +00:00
Glenn Maynard 036fd2beb9 Fix: don't chop off the first 26ms of each MP3 (but don't change sync,
either).
2003-10-02 04:56:09 +00:00
Glenn Maynard acd42b6a87 cleanup 2003-09-25 00:46:51 +00:00
Glenn Maynard c9a265d5f8 MP3 GetLength is const now, so we can clean this up, too. 2003-09-25 00:43:10 +00:00
Glenn Maynard 6954e0facf Move the linear resampler to RageSoundReader_Resample_Fast.
Add RageSoundReader_Resample_Good, using libresample.
2003-09-24 22:31:34 +00:00