static double get_delay(struct ao *ao) { ALint queued; unqueue_buffers(); alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued); return queued * CHUNK_SAMPLES / (double)ao->samplerate; }
static float get_delay(struct ao *ao) { ALint queued; unqueue_buffers(); alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued); return queued * CHUNK_SIZE / 2 / (float)ao->samplerate; }
bool Source::stream_buffers (IStreamable * stream) { ALint processed = processed_buffer_count(); bool complete = true; // std::cerr << "Processed buffers = " << processed << std::endl; AudioError::reset(); while (processed--) { ALuint buffer; unqueue_buffers(&buffer, 1); bool result = stream->load_next_buffer(this, buffer); if (result) { queue_buffers(&buffer, 1); } else { complete = false; } } AudioError::check("Streaming Buffers"); return complete; }
static int get_space(void) { ALint queued; unqueue_buffers(); alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued); queued = NUM_BUF - queued - 3; if (queued < 0) return 0; return queued * CHUNK_SIZE * ao_data.channels; }
static int get_space(struct ao *ao) { ALint queued; unqueue_buffers(); alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued); queued = NUM_BUF - queued - 3; if (queued < 0) return 0; return queued * CHUNK_SIZE * ao->channels.num; }
/** * \brief stop playing and empty buffers (for seeking/pause) */ static void reset(struct ao *ao) { alSourceStopv(ao->channels.num, sources); unqueue_buffers(); }
/** * \brief stop playing and empty buffers (for seeking/pause) */ static void reset(void) { alSourceStopv(ao_data.channels, sources); unqueue_buffers(); }