X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstreamer.cpp;h=b90a9d1c73ab3f78b50384c805348ff40b960699;hb=641dea4e9e0dad7389d49e70234cf792174ff0e9;hp=6808b181678f4535dca699e5f25f107fa553d592;hpb=2a685e572e2ab8d9f50129de3f0869628edb3d8e;p=libs%2Fal.git diff --git a/source/streamer.cpp b/source/streamer.cpp index 6808b18..b90a9d1 100644 --- a/source/streamer.cpp +++ b/source/streamer.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspal -Copyright © 2008-2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include "buffer.h" #include "sound.h" #include "streamer.h" @@ -61,13 +54,13 @@ void Streamer::tick() unsigned freq = snd->get_frequency(); unsigned chunk_size = freq&~0xF; unsigned queued = src.get_buffers_queued(); + vector data(chunk_size); for(unsigned i=queued; i<4; ++i) { - char data[chunk_size]; unsigned pos = 0; while(posread(data+pos, chunk_size-pos); + unsigned len = snd->read(&data[0]+pos, chunk_size-pos); if(len==0) break; pos += len; @@ -76,7 +69,7 @@ void Streamer::tick() if(pos) { Buffer *buf = new Buffer; - buf->data(snd->get_format(), data, pos, freq); + buf->data(snd->get_format(), &data[0], pos, freq); src.queue_buffer(*buf); buffers.push_back(buf); }