Помощь - Поиск - Пользователи - Календарь
Полная версия этой страницы: OpenAL
Форум на CrossPlatform.RU > Библиотеки > Другие библиотеки
disasterpiece
Пытаюсь разобраться с OpenAL, необходимо генерировать некий синусоидальный сигнал с заданными параметрами и соответственно воспроизводить его. Но вместо сгенерированного сигнала всегда воспроизводиться какая-то фигня и всегда одинаковая. Каторая вообще ни от чего не зависит. Да же если весь буфер заполнять одним значением.
Код:

    ALerror = alGetError();

    pDevice = alcOpenDevice(ui->comboBox->itemText(ui->comboBox->currentIndex()).toAscii());
    if(pDevice)
    {
        pContext = alcCreateContext(pDevice, NULL);
        if (pContext)
        {
//          this->showError(QString("Opened %1 Device").arg(alcGetString(pDevice, ALC_DEVICE_SPECIFIER)));
            qDebug() << QString("Opened %1 Device").arg(alcGetString(pDevice, ALC_DEVICE_SPECIFIER));
        }
        else
        {
                alcCloseDevice(pDevice);
                this->getSoundError();
                this->showError(QString("Error open device"));
                exit(-1);
        }
    }
    else
    {
        this->showError(QString("Error open device"));
        exit(-1);
    }
    alcMakeContextCurrent(pContext);
    this->getSoundError();

    alGenBuffers( 1, &uiBuffer );
    this->getSoundError();

    alGenSources(1, &sources);
    this->getSoundError();

    this->fillBuffer(Buffer, 1, ui->lineEdit->text().toInt(), Freq);

    alBufferData(uiBuffer, AL_FORMAT_MONO16, Buffer, 1*Freq, Freq);
    this->getSoundError();

    // Attach Source to Buffer
    alSourcei(sources, AL_BUFFER, uiBuffer);
    this->getSoundError();

    // Play Source
    alSourcePlay(sources);
    this->getSoundError();

    do
    {
        qApp->processEvents();
        // Get Source State
        alGetSourcei(sources, AL_SOURCE_STATE, &iState);
        //qDebug() << "play";
    } while (iState == AL_PLAYING);


    alSourceStop(sources);
    alDeleteSources(1, &sources);
    alDeleteBuffers(1, &uiBuffer);
    this->getSoundError();

    alcMakeContextCurrent(NULL);
    alcDestroyContext(pContext);
    alcCloseDevice(pDevice);
    this->getSoundError();
disasterpiece
вот, помогите разобраться..
Для просмотра полной версии этой страницы, пожалуйста, пройдите по ссылке.
Форум IP.Board © 2001-2024 IPS, Inc.