buffer size

git-svn-id: svn://elaine/murooma/trunk@77 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-07-07 04:45:17 +00:00
parent 5361199d87
commit 36e0ffe7ee
3 changed files with 10 additions and 1 deletions

View file

@ -168,6 +168,8 @@ int main (int argc, char *argv[])
std::cerr << "Unsuccessful in setting thread realtime prio" << std::endl;
*/
stream = new Stream();
stream->setBufferLen(bufferMs);
initAudio();
Chunk* chunk;// = new Chunk();
while (1)

View file

@ -15,6 +15,12 @@ Stream::Stream() : sleep(0), lastPlayerChunk(NULL), median(0), shortMedian(0), l
}
void Stream::setBufferLen(size_t bufferLenMs)
{
bufferMs = bufferLenMs;
}
void Stream::addChunk(Chunk* chunk)
{
Chunk* c = new Chunk(*chunk);
@ -213,7 +219,7 @@ void Stream::getChunk(short* outputBuffer, double outputBufferDacTime, unsigned
lastUpdate = now;
median = pBuffer->median();
shortMedian = pShortBuffer->median();
if (abs(age) > 300)
if (abs(age) > 700)
sleep = age;
else if (pShortBuffer->full() && (abs(shortMedian) > WIRE_CHUNK_MS))
sleep = shortMedian;

View file

@ -19,6 +19,7 @@ public:
timeval getNextPlayerChunk(short* outputBuffer, int correction = 0);
void getSilentPlayerChunk(short* outputBuffer);
void getChunk(short* outputBuffer, double outputBufferDacTime, unsigned long framesPerBuffer);
void setBufferLen(size_t bufferLenMs);
private:
void sleepMs(int ms);