3 This file is part of libmspal
4 Copyright © 2008 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
17 Streamer::Streamer(Source &s):
26 for(list<Buffer *>::iterator i=buffers.begin(); i!=buffers.end(); ++i)
30 void Streamer::play(Sound &s)
45 if(unsigned n=src.get_buffers_processed())
47 for(unsigned i=0; i<n; ++i)
49 src.unqueue_buffer(*buffers.front());
50 delete buffers.front();
51 buffers.erase(buffers.begin());
58 unsigned freq=snd->get_frequency();
59 unsigned chunk_size=freq&~0xF;
60 unsigned queued=src.get_buffers_queued();
61 for(unsigned i=queued; i<4; ++i)
63 char data[chunk_size];
67 unsigned len=snd->read(data+pos, chunk_size-pos);
75 Buffer *buf=new Buffer;
76 buf->data(snd->get_format(), data, pos, freq);
77 src.queue_buffer(*buf);
78 buffers.push_back(buf);