| 148 | } |
| 149 | |
| 150 | bool 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 | |
| 181 | bool oggstream::update() |
| 182 | { |
nothing calls this directly
no test coverage detected