git-svn-id: svn://elaine/murooma/trunk@209 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-08-24 18:40:27 +00:00
parent 10323c0485
commit 559baf31e3
6 changed files with 79 additions and 28 deletions

View file

@ -27,18 +27,33 @@ Chunk::~Chunk()
bool Chunk::isEndOfChunk() const
{
return idx >= (wireChunk->length / format.frameSize);
return idx >= getFrameCount();
}
double Chunk::getFrameCount() const
{
return (wireChunk->length / format.frameSize);
}
double Chunk::getDuration() const
{
// std::cout << wireChunk->length << "\t" << format.frameSize << "\t" << (wireChunk->length / format.frameSize) << "\t" << ((double)format.rate / 1000.) << "\n";
return (wireChunk->length / format.frameSize) / ((double)format.rate / 1000.);
return getFrameCount() / format.msRate();
}
int Chunk::seek(int frames)
{
idx += frames;
if (idx > getFrameCount())
idx = getFrameCount();
if (idx < 0)
idx = 0;
return idx;
}
int Chunk::read(void* outputBuffer, size_t frameCount)
{