Exemplo n.º 1
0
bool BassPlayer::closeAllDevices() {
    bool ret = true;

    for(QHash<int, bool>::Iterator it = opened_devices.begin(); it != opened_devices.end(); it++) {
        bool op_res = BASS_SetDevice(it.key()) && BASS_Free();

        if (!op_res)
            qCritical() << "DEVICE CLOSE ERROR" << BASS_ErrorGetCode();

        ret &= op_res;
    }

    opened_devices.clear();

    return ret;
}
Exemplo n.º 2
0
void StreamFile::setUrl(const QString url){



     BASS_SetDevice(device);

    QString w_url;

        w_url=QDir::toNativeSeparators(url);

        #ifdef Q_WS_X11
           w_url=QDir::toNativeSeparators(url.toUtf8());
        #endif

        stream=BASS_StreamCreateFile(FALSE, w_url.toLatin1(), 0, 0, BASS_STREAM_AUTOFREE);

}
Exemplo n.º 3
0
bool BassPlayer::setOutputDevice(const QString & device_name) {
    int curr_device = BASS_GetDevice();

    int new_device = outputDeviceList().value(device_name, default_device).toInt();

    if (curr_device == new_device)
        return true;

    bool res = false;

    if ((res = initOutputDevice(new_device))) {
        //INFO: we cant close here old device // we must close it later
        res = BASS_SetDevice(new_device);
        if (isPlayed() || isPaused())
            res &= BASS_ChannelSetDevice(chan, new_device);
    }

    return res;
}
Exemplo n.º 4
0
/**
 * This function load the song
 * @brief Stream::Load
 * @param url
 * @return void
 */
void Stream::Load(const QString url)
{

    BASS_SetDevice(Dispositivo);//dispositivo
    IsPisador=false;


// mem 33

   /**
    *  PAUSES
    */
    if(IsPause(streamA)&& IsPause(streamB))//pause in both
    {
        BASS_ChannelPlay(streamA,false);
        BASS_ChannelPlay(streamB,false);
        Timer->start(Render);
        return;
    }

    if(IsPause(streamA))//stream A in pause
    {
        BASS_ChannelPlay(streamA,false);//make play
        Timer->start(Render);
        return;
    }

    if(IsPause(streamB))//stream B in pause
    {
        BASS_ChannelPlay(streamB,false);
        Timer->start(Render);
        return;
    }

   /**
    *  PLAY
    */
    if(IsPlay(streamA)&& IsPlay(streamB))//both playing
    {
        if(streamUltimo == streamA)    // ESTAN LOS DOS CUAL ES EL ULTIMO PARA QUITAR EL OTRO
        {
            // TimerB->stop();
            BASS_ChannelStop(streamB);
            BASS_StreamFree(streamB); //lo liberamos
        }
        else
        {
            // TimerA->stop();
            BASS_ChannelStop(streamA);
            BASS_StreamFree(streamA); //lo liberamos
        }

                //a revisar*******************
        BASS_StreamFree(streamA); //lo liberamos
        BASS_StreamFree(streamB); //lo liberamos
    }

    if(IsPlay(streamA))//if stream A is play
    {
        Timer->stop();
        streamB = StreamTipo(url);  //############################
        PlayB();

        if(FundirSolapar)//checks if this options is enable
        {
            w_Fader->setStream(streamA);
            w_Fader->setFundir(Fundir);
            w_Fader->start();
        }

        return;
    }


    if(IsPlay(streamB))//if stream B is play
    {
        Timer->stop();
        streamA = StreamTipo(url); //#######################################
        PlayA();
        if(FundirSolapar)
        {
            w_Fader->setStream(streamB);
            w_Fader->setFundir(Fundir);
            w_Fader->start();
        }
        return;
    }

    streamA = StreamTipo(url); //#############################################

    PlayA();
}