[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11767] branches/soc-2007-hcube/intern/ tinySND: Changed API: now fillBuffer has no return value.
Csaba Hruska
csaba.hruska at gmail.com
Tue Aug 21 20:23:57 CEST 2007
Revision: 11767
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11767
Author: hcube
Date: 2007-08-21 20:23:57 +0200 (Tue, 21 Aug 2007)
Log Message:
-----------
Changed API: now fillBuffer has no return value.
Modified Paths:
--------------
branches/soc-2007-hcube/intern/tinySND/SND_AiffReader.h
branches/soc-2007-hcube/intern/tinySND/SND_DataProvider.h
branches/soc-2007-hcube/intern/tinySND/SND_WavReader.h
branches/soc-2007-hcube/intern/tinySND/ffmpeg/ffmpegReader.cpp
branches/soc-2007-hcube/intern/tinySND/ffmpeg/ffmpegReader.h
branches/soc-2007-hcube/intern/tinySND/intern/SND_AiffReader.cpp
branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileReader.cpp
branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileReader.h
Modified: branches/soc-2007-hcube/intern/tinySND/SND_AiffReader.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_AiffReader.h 2007-08-21 15:36:40 UTC (rev 11766)
+++ branches/soc-2007-hcube/intern/tinySND/SND_AiffReader.h 2007-08-21 18:23:57 UTC (rev 11767)
@@ -10,10 +10,10 @@
SND_AiffReader( char *data, int size );
~SND_AiffReader();
- bool isFormatSupported();
+ bool isFormatSupported();
- void seek( int frameNum );
- int fillBuffer( float *buffer, int framesNum );
+ void seek( int frameNum );
+ void fillBuffer( float *buffer, int framesNum );
};
Modified: branches/soc-2007-hcube/intern/tinySND/SND_DataProvider.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_DataProvider.h 2007-08-21 15:36:40 UTC (rev 11766)
+++ branches/soc-2007-hcube/intern/tinySND/SND_DataProvider.h 2007-08-21 18:23:57 UTC (rev 11767)
@@ -8,24 +8,24 @@
{
public:
- virtual ~SND_DataProvider() {}
+ virtual ~SND_DataProvider() {}
// true if file loading is succed, false if there was an error
- virtual bool isFormatSupported() = 0;
+ virtual bool isFormatSupported() = 0;
- int getNumFrames() const { return mNumFrames; }
- float getDuration() const { return mDuration; } // in sec
+ int getNumFrames() const { return mNumFrames; }
+ float getDuration() const { return mDuration; } // in sec
- float getSampleRate() const { return mSampleRate; }
- int getBitRate() const { return mBitRate; }
+ float getSampleRate() const { return mSampleRate; }
+ int getBitRate() const { return mBitRate; }
- int getNumChannels() const { return mNumChannels; }
+ int getNumChannels() const { return mNumChannels; }
- bool isSeekable() const { return mIsSeekable; }
+ bool isSeekable() const { return mIsSeekable; }
virtual void seek( int frameNum ) = 0;
- virtual int fillBuffer( float *buffer, int framesNum ) = 0;
+ virtual void fillBuffer( float *buffer, int framesNum ) = 0;
protected:
int mNumFrames;
Modified: branches/soc-2007-hcube/intern/tinySND/SND_WavReader.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_WavReader.h 2007-08-21 15:36:40 UTC (rev 11766)
+++ branches/soc-2007-hcube/intern/tinySND/SND_WavReader.h 2007-08-21 18:23:57 UTC (rev 11767)
@@ -10,10 +10,10 @@
SND_WavReader( char *data, int size );
~SND_WavReader();
- bool isFormatSupported();
+ bool isFormatSupported();
- void seek( int frameNum );
- int fillBuffer( float *buffer, int framesNum );
+ void seek( int frameNum );
+ void fillBuffer( float *buffer, int framesNum );
};
Modified: branches/soc-2007-hcube/intern/tinySND/ffmpeg/ffmpegReader.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/ffmpeg/ffmpegReader.cpp 2007-08-21 15:36:40 UTC (rev 11766)
+++ branches/soc-2007-hcube/intern/tinySND/ffmpeg/ffmpegReader.cpp 2007-08-21 18:23:57 UTC (rev 11767)
@@ -129,12 +129,14 @@
void ffmpegReader::seek( int frameNum )
{
+ // !!!! NOT IMPLEMENTED YET !!!!
}
-int ffmpegReader::fillBuffer( float *buffer, int framesNum )
+void ffmpegReader::fillBuffer( float *buffer, int framesNum )
{
AVPacket packet;
- return 0;
+
+ // !!!! NOT IMPLEMENTED YET !!!!
}
/*
static void sound_hdaudio_extract_small_block(
Modified: branches/soc-2007-hcube/intern/tinySND/ffmpeg/ffmpegReader.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/ffmpeg/ffmpegReader.h 2007-08-21 15:36:40 UTC (rev 11766)
+++ branches/soc-2007-hcube/intern/tinySND/ffmpeg/ffmpegReader.h 2007-08-21 18:23:57 UTC (rev 11767)
@@ -12,10 +12,10 @@
ffmpegReader( char *filename );
~ffmpegReader();
- bool isFormatSupported();
+ bool isFormatSupported();
- void seek( int frameNum );
- int fillBuffer( float *buffer, int framesNum );
+ void seek( int frameNum );
+ void fillBuffer( float *buffer, int framesNum );
private:
AVCodec *mCodec;
Modified: branches/soc-2007-hcube/intern/tinySND/intern/SND_AiffReader.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/intern/SND_AiffReader.cpp 2007-08-21 15:36:40 UTC (rev 11766)
+++ branches/soc-2007-hcube/intern/tinySND/intern/SND_AiffReader.cpp 2007-08-21 18:23:57 UTC (rev 11767)
@@ -4,27 +4,33 @@
{
// read header chunk
// parse header and set up internal properties
+
+ // !!!! NOT IMPLEMENTED YET !!!!
}
SND_AiffReader::SND_AiffReader( char *data, int size )
{
+ // !!!! NOT IMPLEMENTED YET !!!!
}
SND_AiffReader::~SND_AiffReader()
{
+ // !!!! NOT IMPLEMENTED YET !!!!
}
bool SND_AiffReader::isFormatSupported(void)
{
+ // !!!! NOT IMPLEMENTED YET !!!!
return false;
}
void SND_AiffReader::seek( int frameNum )
{
+ // !!!! NOT IMPLEMENTED YET !!!!
}
-int SND_AiffReader::fillBuffer( float *buffer, int framesNum )
+void SND_AiffReader::fillBuffer( float *buffer, int framesNum )
{
- return 0;
+ // !!!! NOT IMPLEMENTED YET !!!!
}
Modified: branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileReader.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileReader.cpp 2007-08-21 15:36:40 UTC (rev 11766)
+++ branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileReader.cpp 2007-08-21 18:23:57 UTC (rev 11767)
@@ -1,10 +1,25 @@
#include <assert.h>
#include "sndfileReader.h"
+#include <stdio.h>
+
sndfileReader::sndfileReader( char *filename )
{
mSF_Info.format = 0;
mSndFile = sf_open( filename, SFM_READ, &mSF_Info );
+
+ if( mSndFile == 0 )
+ {
+ mNumFrames = 0;
+ mSampleRate = 0.0;
+ mBitRate = 0;
+ mNumChannels = 0;
+ mIsSeekable = false;
+ mDuration = 0.0;
+
+ return;
+ }
+
mNumFrames = mSF_Info.frames;
mSampleRate = mSF_Info.samplerate;
@@ -52,19 +67,35 @@
void sndfileReader::seek( int frameNum )
{
assert( mSndFile != 0 );
-
- if( mIsSeekable )
- {
- sf_seek( mSndFile, frameNum, SEEK_SET );
- }
+ assert( mIsSeekable );
+
+ int offset = sf_seek( mSndFile, frameNum, SEEK_SET );
+
+ int error = sf_error( mSndFile );
+ if( error != SF_ERR_NO_ERROR )
+ {
+ printf( "%s\n", sf_error_number( error ) );
+ }
+ assert( error == SF_ERR_NO_ERROR );
+
+ assert( offset == frameNum );
}
-int sndfileReader::fillBuffer( float *buffer, int framesNum )
+void sndfileReader::fillBuffer( float *buffer, int framesNum )
{
assert( mSndFile != 0 );
assert( buffer != 0 );
- return sf_read_float( mSndFile, buffer, framesNum );
+ int count = sf_readf_float( mSndFile, buffer, framesNum );
+
+ int error = sf_error( mSndFile );
+ if( error != SF_ERR_NO_ERROR )
+ {
+ printf( "%s\n", sf_error_number( error ) );
+ }
+ assert( error == SF_ERR_NO_ERROR );
+
+ assert( count == framesNum );
}
Modified: branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileReader.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileReader.h 2007-08-21 15:36:40 UTC (rev 11766)
+++ branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileReader.h 2007-08-21 18:23:57 UTC (rev 11767)
@@ -10,10 +10,10 @@
sndfileReader( char *filename );
~sndfileReader();
- bool isFormatSupported();
+ bool isFormatSupported();
- void seek( int frameNum );
- int fillBuffer( float *buffer, int framesNum );
+ void seek( int frameNum );
+ void fillBuffer( float *buffer, int framesNum );
private:
SNDFILE *mSndFile;
More information about the Bf-blender-cvs
mailing list