Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Error message with sfml-audip  (Read 5578 times)

0 Members and 1 Guest are viewing this topic.

cfrankb

  • Newbie
  • *
  • Posts: 29
    • View Profile
Error message with sfml-audip
« on: December 20, 2009, 08:20:17 am »
Hi,

This is error message I'm getting: AL lib: pulseaudio.c:386: Context did not get ready: Connection refused

What does it mean? What's causing it and how to do I fix it?

Code: [Select]


// main.cpp
//

#include <QFile>
#include "Snd.h"

int main(int argc, char *argv[])
{
    QFile file("test.wav");
    if (file.open(QIODevice::ReadOnly)) {
        qDebug("file opened\n");
        int size = file.size();
        char * buf = new char[size];;
        file.read(buf, size);

        char t[5];
        t[4] = 0;
        memcpy(t, buf, 4);
        qDebug("header: %s\n", t);

        CSnd snd;
        snd.Create(buf, size, QString("test"));
        snd.Play();

        delete [] buf;
    }

    return 0;
}




Code: [Select]

// Snd.h : header file
//
#ifndef _SND_H
#define _SND_H

#include <QtGui/QApplication>
#include <SFML/Audio.hpp>

/////////////////////////////////////////////////////////////////////////////
// CSnd

class CSnd
{
    // Construction
public:
    CSnd();

    // Attributes
public:
    bool IsValid () {
        return m_buffer && m_sound;
    }
    QString GetName() const;

    // Operations
public:
    void SetName (const QString);
    bool Create(const char *, int, const QString );
    bool Play ();
    bool Stop ();
    void RemoveAt (int n);

    // Implementation
public:
    ~CSnd();

protected:

    sf::SoundBuffer *m_buffer;
    sf::Sound *m_sound;

    QString m_name;
};

/////////////////////////////////////////////////////////////////////////////

#endif



Code: [Select]

// Snd.cpp : implementation file
//

#include "Snd.h"
#define q2c(__qstring__) (char*) __qstring__.toAscii().constData()

/////////////////////////////////////////////////////////////////////////////
// CSnd

CSnd::CSnd()
{

    m_buffer = NULL;
    m_sound = NULL;

}

CSnd::~CSnd()
{

    if (m_buffer) {
        delete m_buffer;
    }

    if (m_sound) {
        delete m_sound;
    }

}

/////////////////////////////////////////////////////////////////////////////
// CSnd message handlers

bool CSnd::Play ()
{
    if (IsValid() == FALSE) {
        // qDebug ("Warning - Cannot play from an invalid CSnd object '%s'\n",  q2c(m_name));
        return false;
    }

    sf::Sound::Status status = m_sound->GetStatus();
    if (status !=   sf::Sound::Playing ) {
        m_sound->Play();
        return true;
    }

    return true;
}

bool CSnd::Stop ()
{
    return false;
}


bool CSnd::Create(const char *buffer, int size, const QString name)
{
    if (!size) return true;
    if (!buffer ){
        qDebug("buffer is null\n");
    }

    m_sound = new sf::Sound;
    m_buffer = new sf::SoundBuffer;

    if (!m_buffer->LoadFromMemory(buffer, size))
    {
        qDebug("couldn't create: %s\n", q2c(name));
        return false;
    }
    m_sound->SetBuffer(*m_buffer);
    m_name = name;

    return true;
}

QString CSnd::GetName() const
{
    return m_name;
}

void CSnd::SetName(const QString name)
{
    m_name = name;
}




Running OpenSuse 11.2. Latest stable release.

Regards.
Frank B.[/code]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Error message with sfml-audip
« Reply #1 on: December 20, 2009, 10:19:52 am »
Do you have the latest version of OpenAL-Soft?
Laurent Gomila - SFML developer

cfrankb

  • Newbie
  • *
  • Posts: 29
    • View Profile
Error message with sfml-audip
« Reply #2 on: December 20, 2009, 02:12:17 pm »
openal 1.9.616 (came w/ OpenSuse 11.2)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Error message with sfml-audip
« Reply #3 on: December 20, 2009, 02:32:37 pm »
Which version of SFML do you use? Have you tried SFML 2?
Laurent Gomila - SFML developer

cfrankb

  • Newbie
  • *
  • Posts: 29
    • View Profile
Error message with sfml-audip
« Reply #4 on: December 20, 2009, 02:33:29 pm »
SFML 1.5.

I haven't tried 2.0 yet.

cfrankb

  • Newbie
  • *
  • Posts: 29
    • View Profile
Error message with sfml-audip
« Reply #5 on: December 20, 2009, 11:49:45 pm »
I just compiled 2.0. The problem is still there.

AL lib: pulseaudio.c:386: Context did not get ready: Connection refused

Although, it's not crashing the application anymore! ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Error message with sfml-audip
« Reply #6 on: December 20, 2009, 11:57:13 pm »
Apparently there are still issues with the PulseAudio backend of OpenAL-Soft. Maybe you can try to grab the latest sources and recompile it (I saw an update from 9 november that is supposed to fix a lot of bugs related to this backend), or you can try choosing another backend (OSS, ALSA) if your system has one of them. I think you can do it in the OpenAL-Soft configuration file.
Laurent Gomila - SFML developer

cfrankb

  • Newbie
  • *
  • Posts: 29
    • View Profile
Error message with sfml-audip
« Reply #7 on: December 21, 2009, 12:01:04 am »
I was too eager to report on the good news !  :cry:

The game module stopped crashing because of the work around.

#ifdef SFML
    sf::SoundBuffer snd;
    sleep(1);
#endif

It doesn't change anything as far as the test application goes.

Someone on another forum suggested this could be a problem with the version of openAL shipped with OpenSuse 11.2. Any ideas?

 

anything