diff options
author | Monty <xiphmont@xiph.org> | 2003-08-18 05:34:01 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2003-08-18 05:34:01 +0000 |
commit | 938f4699b2390c9a035e15736d06a3bf2c5ff40c (patch) | |
tree | 2150d1ef37cc9fc2ee4c386d6cb28b8939ee820a /lib/synthesis.c | |
parent | 9a2fc5d1ebc7eb74d32cd45b1f830bc5d5e3a9e2 (diff) | |
download | libvorbis-git-938f4699b2390c9a035e15736d06a3bf2c5ff40c.tar.gz |
Vorbisfile API addition for game and mod coders;
Do a 'free' sample rate conversion from source rate to half source
rate by calling ov_halfrate() after ov_open(); Although this is solid
for immediately desired usage, I want to clean it up a bit before
advertising it's existence, so no doc addition yet.
Does not break binary API.
Monty
svn path=/trunk/vorbis/; revision=5222
Diffstat (limited to 'lib/synthesis.c')
-rw-r--r-- | lib/synthesis.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/synthesis.c b/lib/synthesis.c index ec3f5bfc..d645c5ab 100644 --- a/lib/synthesis.c +++ b/lib/synthesis.c @@ -11,7 +11,7 @@ ******************************************************************** function: single-block PCM synthesis - last mod: $Id: synthesis.c,v 1.29 2002/10/11 11:14:41 xiphmont Exp $ + last mod: $Id: synthesis.c,v 1.30 2003/08/18 05:34:01 xiphmont Exp $ ********************************************************************/ @@ -152,4 +152,19 @@ long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){ return(ci->blocksizes[ci->mode_param[mode]->blockflag]); } +int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){ + /* set / clear half-sample-rate mode */ + codec_setup_info *ci=vi->codec_setup; + + /* right now, our MDCT can't handle < 64 sample windows. */ + if(ci->blocksizes[0]<=64 && flag)return -1; + ci->halfrate_flag=(flag?1:0); + return 0; +} + +int vorbis_synthesis_halfrate_p(vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + return ci->halfrate_flag; +} + |