Пример #1
0
void KRAudioSource::stop()
{
    // Stop playback of audio.  If audio is already stopped, this has no effect.
    // If play() is called afterwards, playback will continue at the current audio sample position.
    
    if(m_playing) {
        m_paused_audio_frame = getAudioFrame();
        m_start_audio_frame = -1;
        m_playing = false;
        getContext().getAudioManager()->deactivateAudioSource(this);
    }
}
Пример #2
0
void KRAudioSource::sample(int frame_count, int channel, float *buffer, float gain)
{
    KRAudioSample *source_sample = getAudioSample();
    if(source_sample && m_playing) {
        __int64_t next_frame = getAudioFrame();
        source_sample->sample(next_frame, frame_count, channel, buffer, gain, m_looping);
        if(!m_looping && next_frame > source_sample->getFrameCount()) {
            stop();
        }
    } else {
        memset(buffer, 0, sizeof(float) * frame_count);
    }
}
Пример #3
0
AudioFrame * myAudioBuffer::getAudioFrame(float pct) {
    return getAudioFrame(getLastTimestamp()-(getInitTime()+getTotalTime()*pct));
}
Пример #4
0
bool BufferSinkFilterContext::getAudioFrame(AudioSamples &samples, OptionalErrorCode ec)
{
    return getAudioFrame(samples, 0, ec);
}
Пример #5
0
float KRAudioSource::getAudioTime()
{
    // Gets the audio playback position with units of floating point seconds.
    
    return getAudioFrame() / 44100.0f;
}