- per_sfx->filesize = fs_filesize;
- s->fetcher_data = per_sfx;
- s->fetcher = &ogg_fetcher;
- s->format.speed = shm->format.speed;
- s->format.width = 2; // We always work with 16 bits samples
- s->format.channels = vi->channels;
- s->loopstart = -1;
- s->total_length = (size_t)len / (vi->channels * 2) * (float)(shm->format.speed / vi->rate);
+ per_sfx->filesize = filesize;
+ sfx->memsize += filesize;
+
+ per_sfx->format.speed = vi->rate;
+ per_sfx->format.width = 2; // We always work with 16 bits samples
+ per_sfx->format.channels = vi->channels;
+
+ sfx->fetcher_data = per_sfx;
+ sfx->fetcher = &ogg_fetcher;
+ sfx->flags |= SFXFLAG_STREAMED;
+ per_sfx->total_length = sfx->total_length = (int)((size_t)len / (per_sfx->format.channels * 2) * ((double)snd_renderbuffer->format.speed / per_sfx->format.speed));
+ sfx->loopstart = sfx->total_length;
+ vc = qov_comment(&vf, -1);
+ if(vc)
+ {
+ thiscomment = qvorbis_comment_query(vc, "LOOP_START", 0);
+ if(thiscomment)
+ sfx->loopstart = bound(0, (unsigned int) (atof(thiscomment) * (double)snd_renderbuffer->format.speed / (double)per_sfx->format.speed), sfx->total_length);
+ thiscomment = qvorbis_comment_query(vc, "REPLAYGAIN_TRACK_PEAK", 0);
+ if(thiscomment)
+ peak = atof(thiscomment);
+ thiscomment = qvorbis_comment_query(vc, "REPLAYGAIN_TRACK_GAIN", 0);
+ if(thiscomment)
+ gaindb = atof(thiscomment);
+ }