MCPcopy Create free account
hub / github.com/assaultcube/AC / stream

Method stream

source/src/oggstream.cpp:150–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150bool oggstream::stream(ALuint bufid)
151{
152 ASSERT(valid);
153
154 loopi(2)
155 {
156 char pcm[BUFSIZE];
157 ALsizei size = 0;
158 int bitstream;
159 while(size < BUFSIZE)
160 {
161 long bytes = ov_read(&oggfile, pcm + size, BUFSIZE - size, isbigendian(), 2, 1, &bitstream);
162 if(bytes > 0) size += bytes;
163 else if (bytes < 0) return false;
164 else break; // done
165 }
166
167 if(size==0)
168 {
169 if(looping && !ov_pcm_seek(&oggfile, 0)) continue; // try again to replay
170 else return false;
171 }
172
173 alclearerr();
174 alBufferData(bufid, format, pcm, size, info->rate);
175 return !ALERR;
176 }
177
178 return false;
179}
180
181bool oggstream::update()
182{

Callers

nothing calls this directly

Calls 3

isbigendianFunction · 0.85
alclearerrFunction · 0.85
loopiFunction · 0.70

Tested by

no test coverage detected