Logo Search packages:      
Sourcecode: akode version File versions  Download package

bool aKode::Player::load ( const char *  filename  ) 

Loads the file filename and prepares for playing. Returns false if the file cannot be loaded or decoded.

State: Open -> Loaded

Definition at line 262 of file player.cpp.

References load(), state(), stop(), and unload().

Referenced by load().

                                      {
    if (state() == Closed) return false;

    if (state() == Paused || state() == Playing)
        stop();

    if (state() == Loaded)
        unload();

    assert(state() == Open);

    d->src = new MMapFile(filename);
    // Test if the file _can_ be mmaped
    if (!d->src->openRO()) {
        delete d->src;
        d->src = new LocalFile(filename);
        if (!d->src->openRO()) {
            AKODE_DEBUG("Could not open " << filename);
            delete d->src;
            d->src = 0;
            return false;
        }
    }
    // Some of the later code expects it to be closed
    d->src->close();
    d->my_file = true;

    return load();
}


Generated by  Doxygen 1.6.0   Back to index