V
V
Vitaly Stolyarov2016-12-14 20:16:12
ALSA
Vitaly Stolyarov, 2016-12-14 20:16:12

Setting up OpenAL on Ubuntu?

In alsoft.conf I registered
drivers = port, alsa
Installed OpenAL, ALSA, compiled and installed PortAudio
If you register only alsa, you get

AL lib: (WW) alc_initconfig: No playback backend available!
AL lib: (WW) alc_initconfig: No capture backend available!

otherwise with port

AL lib: (EE) ALCportPlayback_open: Pa_OpenStream() returned an error: Invalid device

Same and doesn't want to work in OSS
AL lib: (EE) ALCplaybackOSS_open: Could not open /dev/dsp: No such file or directory

Although, when building, PortAudio specifies the
Configuration summary:

Target ...................... x86_64-unknown-linux-gnu
C++ bindings ................ no
Debug output ................ no
ALSA ........................ yes
ASIHPI ..... ................. no
OSS ........................ yes
JACK .... .................... no

Based on this, it is not clear what the problem is, how to make OpenAL work normally? and are there really so many crutches when assembling such things?
source
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alut.h>
#include <stdio.h>

// gcc -o simplealut simplealut.c `pkg-config --libs freealut`
//
#define FILENAME "sample.wav"

int main(int argc, char **argv) {

    ALuint buffer, source;
    ALint state;

    // Initialize the environment
    alutInit(0, NULL);

    // Capture errors
    alGetError();

    // Load pcm data into buffer
    /*   buffer = alutCreateBufferFromFile(FILENAME);

       // Create sound source (use buffer to fill source)
       alGenSources(1, &source);
       alSourcei(source, AL_BUFFER, buffer);

       // Play
       alSourcePlay(source);

       // Wait for the song to complete
       do {
           alGetSourcei(source, AL_SOURCE_STATE, &state);
       } while (state == AL_PLAYING);

       // Clean up sources and buffers
       alDeleteSources(1, &source);
       alDeleteBuffers(1, &buffer);
     */
    // Exit everything
    alutExit();

    return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Stolyarov, 2016-12-14
@Ni55aN

And in less than 10 minutes, after installing ALSA, I rebuilt and reinstalled OpenAL, and this solved the problem
. P.S. It's not the first time

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question