Commit Graph
63 Commits
Author SHA1 Message Date
Glenn Maynard acc0b14ee1 push file opening upwards, instead of duplicating it in each loader 2007-02-21 10:10:18 +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 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 aa4be6dffb Return 1 from SetPosition(n) on success, 0 on seek past EOF, not
"the position seeked to".  This fixes a special case: SetPosition(n)
returning 0 was EOF except when SetPosition(0).  The returned value
on success was always n, anyway; we never seek to a different position
and return success.
2006-12-21 05:07:49 +00:00
Glenn Maynard f33bb09334 use default 2006-12-11 05:59:27 +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 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 3583b1cf10 this reader is not limited to 2 channels 2006-12-09 02:56:30 +00:00
Glenn Maynard cd5f4a6e39 SoundReader_FileReader -> RageSoundReader_FileReader 2006-11-30 04:22:38 +00:00
Glenn Maynard c68c60c67a GetNextStreamFrame -> GetNextSourceFrame 2006-11-29 09:15:23 +00:00
Glenn Maynard 0f9e6c9153 GetNextStreamFrame implementations 2006-11-29 07:40:19 +00:00
Glenn Maynard 7a95f5da5b covariant Copy() 2006-10-20 00:01:18 +00:00
Steve Checkoway 6ea2a41b00 Cleanup RageException::Throw(). Do not use ssprintf() inside of Throw() and do not pass it bare error messages. Use RageException::Throw( "%s", sError.c_str() ); instead. Be consistent with quoting file names "%s" and theme metrics as "%s : %s". Try to make them complete English sentences when possible. 2006-09-17 01:19:19 +00:00
Glenn Maynard 2b9f484548 spacing (only) 2006-02-14 11:30:53 +00:00
Chris Danford 7f821e8cfc CString -> RString 2006-01-22 01:00:06 +00:00
Glenn Maynard f500aac258 XIPH_LIB_DIR -> OGG_LIB_DIR 2005-10-20 11:11:26 +00:00
Glenn Maynard 23e882b51f Clean up Xiph includes. 2005-10-20 03:42:29 +00:00
Ben Anderson d3e3c756ac Use _MSC_VER properly; comment #if block 2005-06-26 04:00:34 +00:00
Renaud Lepage 1b124c16a5 Someone had made ifdefs that were confusing if compiling for Xbox. The conflictual situations have been resolved. 2005-05-30 23:43:37 +00:00
Thad Ward 5949e5bc90 (this is possibly going to annoy some people, but..)
put all (obvious) MSVC lines in #if defined(_MSC_VER) blocks, primarilly
to allow alternative win32 compilers to be used.
2005-05-11 04:43:54 +00:00
Glenn Maynard a5ab1a5664 fix error check 2005-04-27 01:48:52 +00:00
Glenn Maynard 64daf9379d add error check 2005-04-27 01:30:11 +00:00
Glenn Maynard be9b7dd3cf add Open( RageFileBasic *f ), cleanup 2005-03-30 23:07:52 +00:00
Glenn Maynard cbe80105fb don't bother keeping a separate vorbis buffer; it doesn't help 2004-08-12 04:38:33 +00:00
Glenn Maynard e366586e36 cleanup 2004-07-24 02:02:01 +00:00
Glenn Maynard 69cf82de49 handle mono 2004-07-24 02:01:12 +00:00
Glenn Maynard dd4bc636f4 cleanups 2004-06-13 20:03:18 +00:00
Glenn Maynard 1efd594730 byte swap update 2004-06-13 07:35:08 +00:00
Glenn Maynard aef80ea1a0 fix Tremor 2004-06-12 05:43:58 +00:00
Glenn Maynard 00efa1e6ed update deprecated names
file failing to open is a fatal error
2004-05-21 20:56:57 +00:00
Glenn Maynard 3119833bae types 2004-05-11 21:08:13 +00:00
Glenn Maynard b131b68871 remove old checkpoints 2004-05-09 07:27:29 +00:00
Glenn Maynard f9f10e2372 more license updates 2004-05-06 02:40:33 +00:00
Steve Checkoway 20a8bab45c Clean up includes. 2004-04-05 05:22:32 +00:00
Glenn Maynard 8642a728aa troubleshooting 2004-02-23 01:40:13 +00:00
Glenn Maynard 9bd0ca032b fix memleak on open fail 2004-02-23 00:29:16 +00:00
Glenn Maynard 179f6cd9ba Revert: this breaks compiles in Linux, by using the local Vorbis source
(which we only use in Win32) instead of the system headers.

The correct fix is to add "vorbis" to the include file path in the Xbox
project, like we do in the Windows project.
2004-01-17 05:52:09 +00:00
Manu Evans ce888de237 fixed some xbox build errors :/ 2004-01-17 05:21:24 +00:00
Glenn Maynard d79898e15b simplify 2003-12-04 21:10:48 +00:00
Glenn Maynard 76be499083 fix delete 2003-12-04 20:23:35 +00:00
Glenn Maynard 0600c9acbb use RageFile 2003-12-04 19:57:32 +00:00
Chris Danford 47def7d3dc xbox updates 2003-11-13 00:39:36 +00:00
Glenn Maynard 20798c677c remove old comments 2003-11-02 04:05:38 +00:00
Glenn Maynard 72f357d80d Maintain precise sync through corruptions in Oggs. (Can't do that with MP3!) 2003-11-01 17:55:00 +00:00
Glenn Maynard d3755f98a5 fix crashes when files fail to open 2003-10-12 03:01:07 +00:00
Glenn Maynard 892ca27777 Change EOF seek behavior: reading after a seek past EOF returns EOF.
Minor Vorbis seek fix.
2003-10-07 04:03:22 +00:00
Glenn Maynard 4f89b016ef cleanup 2003-09-19 21:14:10 +00:00
Glenn Maynard 0e0db29069 un-fix the not-a-fix 2003-09-15 01:30:39 +00:00