Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 18, 2010, 3:48:49 PM (14 years ago)
Author:
erwin
Message:

More tries to fix the sound: there seems to be no context in the stream thread…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound5/src/orxonox/sound/SoundStreamer.cc

    r6506 r6562  
    2828
    2929#include <al.h>
     30#include <alc.h>
    3031#include <vorbis/vorbisfile.h>
    3132#include "SoundManager.h"
     
    6768        ALuint initbuffers[4];
    6869        alGenBuffers(4, initbuffers);
     70        if (ALint error = alGetError()) {
     71            COUT(2) << "Sound: Streamer: Could not generate buffer:" << getALErrorString(error) << std::endl;
     72            return;
     73        }
    6974        int current_section;
    7075
     
    8489
    8590            alBufferData(initbuffers[i], format, &inbuffer, ret, vorbisInfo->rate);
     91            alGetError();
    8692        }
    8793        alSourceQueueBuffers(audioSource, 4, initbuffers);
     94        if (ALint error = alGetError()) {
     95            COUT(2) << "Sound: Warning: Couldn't queue buffers: " << getALErrorString(error) << std::endl;
     96        }
    8897
    8998        while(true) // Stream forever, control through thread control
    9099        {
    91100            int processed;
     101
     102        if(alcGetCurrentContext() == NULL)
     103            COUT(2) << "This should not be!" << std::endl;
     104
    92105            alGetSourcei(audioSource, AL_BUFFERS_PROCESSED, &processed);
    93106            if (ALint error = alGetError())
    94             COUT(2) << "Sound Warning: Couldn't get number of processed buffers: " << getALErrorString(error) << std::endl;
     107            COUT(2) << "Sound: Warning: Couldn't get number of processed buffers: " << getALErrorString(error) << std::endl;
    95108
    96109            if(processed > 0)
     
    99112                alSourceUnqueueBuffers(audioSource, processed, buffers);
    100113                if (ALint error = alGetError())
    101                     COUT(2) << "Sound Warning: Couldn't unqueue buffers: " << getALErrorString(error) << std::endl;
     114                    COUT(2) << "Sound: Warning: Couldn't unqueue buffers: " << getALErrorString(error) << std::endl;
    102115
    103116                for(int i = 0; i < processed; i++)
     
    116129
    117130                    alBufferData(buffers[i], format, &inbuffer, ret, vorbisInfo->rate);
     131                    alGetError();
    118132                }
    119133
    120134                alSourceQueueBuffers(audioSource, processed, buffers);
    121135                if (ALint error = alGetError())
    122                     COUT(2) << "Sound Warning: Couldn't queue buffers: " << getALErrorString(error) << std::endl;
     136                    COUT(2) << "Sound: Warning: Couldn't queue buffers: " << getALErrorString(error) << std::endl;
    123137            }
    124             msleep(250); // perhaps another value here is better
     138            msleep(100); // perhaps another value here is better
    125139        }
    126140    }
Note: See TracChangeset for help on using the changeset viewer.