Exemple #1
0
/* Function: al_set_sample_instance_playing
 */
bool al_set_sample_instance_playing(ALLEGRO_SAMPLE_INSTANCE *spl, bool val)
{
    ASSERT(spl);

    if (!spl->parent.u.ptr) {
        _al_set_error(ALLEGRO_INVALID_OBJECT, "Sample has no parent");
        return false;
    }
    if (!spl->spl_data.buffer.ptr) {
        _al_set_error(ALLEGRO_INVALID_OBJECT, "Sample has no data");
        return false;
    }

    if (spl->parent.is_voice) {
        /* parent is voice */
        ALLEGRO_VOICE *voice = spl->parent.u.voice;

        return al_set_voice_playing(voice, val);
    }

    /* parent is mixer */
    maybe_lock_mutex(spl->mutex);
    spl->is_playing = val;
    if (!val)
        spl->pos = 0;
    maybe_unlock_mutex(spl->mutex);
    return true;
}
Exemple #2
0
void AudioStream::play()
{
	al_set_audio_stream_playing(m_stream, true);
	al_set_voice_playing(m_voice, true);
}