Commit Graph

18 Commits

Author SHA1 Message Date
Steve Checkoway 60f953f3c1 Fix comments. havn't -> haven't. 2008-01-05 11:56:03 +00:00
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 e45978da43 use vector 2007-01-22 02:31: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 969e65dea8 propagate properties through to the source, so we don't lose eg. "continue"
settings.  Properties sent through a Split will affect all users.
2007-01-11 04:06:22 +00:00
Glenn Maynard 250dd40c33 fix RageSoundReader_ChannelSplit error reporting: don't return
eg. END_OF_FILE or WOULD_BLOCK if we still have buffered data
2007-01-06 06:58:09 +00:00
Glenn Maynard 24ecf88620 pass errors
fix iMaxFrameRequested with negative frames
2006-12-27 02:00:15 +00:00
Glenn Maynard 00f371fa7c remove IsStreamingFromDisk 2006-12-23 07:15:32 +00:00
Glenn Maynard be8c435569 fix RageSoundReader_Split::SetPosition(0) 2006-12-22 08:11:58 +00:00
Glenn Maynard d2b8ac925a comment 2006-12-21 05:37:09 +00:00
Glenn Maynard 1b60b0a86d fix up seeking 2006-12-21 05:26:24 +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 0b529a4960 RageSoundReader::Read() returns sound data which may be at a
different rate than the source it's reading from; one second
of returned data may correspond to two seconds in the source
material.

GetStreamToSourceRatio returns the ratio of returned data in
the next Read() call to source data.  This is propagated
upwards in the filter tree, so rate changes by a speed changer
in the middle of the tree will be reflected in the final
GetStreamToSourceRatio().

This means that whenever the ratio changes, Read() stops
returning data; it returns whatever it has, so the caller
has an opportunity to call GetStreamToSourceRatio again
and notice the change.

These semantics can be annoying to implement in some
cases, where only the processing of Read() may notice
a ratio change.  Read() may want to return 0, to say
"something changed, call GetStreamToSourceRatio again",
but 0 means EOF.

Add RageSoundReader::END_OF_FILE.  0 is now no
longer a special case; it means "there's more data, I
just didn't return any this time".  This is functionally
equivalent to errno EINTR.
2006-12-10 07:08:17 +00:00
Glenn Maynard ef519723fb fix warning 2006-12-10 04:04:50 +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 7bcb489288 buffering fixes 2006-12-10 03:34:44 +00:00
Glenn Maynard 2b95cdcce9 comment 2006-12-10 01:00:17 +00:00
Glenn Maynard 204d081b09 `RageSoundReader_ChannelSplit 2006-12-09 23:36:53 +00:00