#14899 closed defect (wontfix)
wxSound doesn't work under Linux (OSS not supported any more)
| Reported by: | sermelo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | base | Version: | 3.1.0 |
| Keywords: | wxSound | Cc: | igor.cali0@… |
| Blocked By: | Blocking: | ||
| Patch: | no |
Description
I'm testing to play a wav file with a simple code. All go well except that nothing sound.
My system is a ubuntu 12.10 32bits
This is the code:
#include <wx/sound.h>
#include "wx/wx.h"
#include <iostream>
int main ()
{
wxSound *mySound;
mySound = new wxSound(_T("XXXXX.wav"), false);
if(mySound->IsOk());
{
std::cout<<"All fine";
mySound->Play(wxSOUND_SYNC);
::wxBell();
}
return 1;
}
Change History (26)
comment:1 Changed 9 years ago by lanurmi
comment:2 follow-up: ↓ 4 Changed 9 years ago by vadz
- Milestone 2.8.13 deleted
- Status changed from new to infoneeded_new
Please test the sound sample.
comment:3 in reply to: ↑ description Changed 9 years ago by sermelo
- Status changed from infoneeded_new to new
Replying to sermelo:
I'm testing to play a wav file with a simple code. All go well except that nothing sound.
My system is a ubuntu 12.10 32bits
This is the code:
#include <wx/sound.h>
#include "wx/wx.h"
#include <iostream>
int main ()
{
wxSound *mySound;
mySound = new wxSound(_T("XXXXX.wav"), false);
if(mySound->IsOk());
{
std::cout<<"All fine";
mySound->Play(wxSOUND_SYNC);
::wxBell();
}
return 1;
}
This this source the :wxBell line have to be removed. I added it to test it, but the error of wxSound is the same.
comment:4 in reply to: ↑ 2 Changed 9 years ago by sermelo
Replying to vadz:
Please test the sound sample.
The sound sample is fine. I play it with "play" command without problem, and also I tested with other sound files.
Also the mySound->Play(wxSOUND_SYNC); doesn't block the program for the time the wav file last
comment:5 Changed 9 years ago by vadz
- Resolution set to invalid
- Status changed from new to closed
If it works in the sound sample and doesn't work in your program, the problem is in the latter and not in wx. One possible explanation is that you don't initialize wxWidgets at all in your code.
comment:6 follow-up: ↓ 8 Changed 5 years ago by LeoMetre
- Component changed from base to samples
- Keywords WxSound added; wxsound removed
- Priority changed from normal to critical
- Resolution invalid deleted
- Status changed from closed to reopened
I am with same problem! apparently the .Play() method does not work with me
The WAV File plays and the file path are correct.
Anyone has some news about this issue?
Best regards
const char* chars = "/home/test.wav";
//wxString sFile = wxString::FromUTF8(chars);
wxString sFile(chars, wxConvUTF8);
wxSound pSound(sFile,true);
if( pSound.IsOk() )
{
if (pSound.Play(wxSOUND_ASYNC)){
wxMessageBox( wxT("Play!") );e
}
else
wxMessageBox( wxT("not play!") );
}
else
wxMessageBox( wxT("not ok!") );
comment:7 follow-up: ↓ 11 Changed 5 years ago by vadz
- Keywords wxSound added; WxSound removed
- Priority changed from critical to normal
- Status changed from reopened to infoneeded_new
As mentioned in the bug submission guidelines: Please do not change the priority. Please do describe if the bug is reproducible in the sound sample. Please also describe the version and the platform you're testing under.
comment:8 in reply to: ↑ 6 Changed 5 years ago by dmarques
- Status changed from infoneeded_new to new
Replying to LeoMetre:
I am with same problem! apparently the .Play() method does not work with me
The WAV File plays and the file path are correct.
Anyone has some news about this issue?
Best regards
const char* chars = "/home/test.wav"; //wxString sFile = wxString::FromUTF8(chars); wxString sFile(chars, wxConvUTF8); wxSound pSound(sFile,true); if( pSound.IsOk() ) { if (pSound.Play(wxSOUND_ASYNC)){ wxMessageBox( wxT("Play!") );e } else wxMessageBox( wxT("not play!") ); } else wxMessageBox( wxT("not ok!") );
I've been facing the same problem, in Windows and Linux, for ages. There must be something else needed for wxSound to actually .Play wav files...
This particular piece of code ends up in success but no sound is ever played.
comment:9 Changed 5 years ago by vadz
- Status changed from new to infoneeded_new
I don't know how to explain it more clearly, but the sound sample does work with the WAV files provided in it on my, and many other, systems. To do anything about the problem we need to know whether you can reproduce the problem in the sample and, if yes, learn more details about your system. It is worse than useless to change the status of the bug without providing any information.
comment:10 Changed 5 years ago by ericj
- Status changed from infoneeded_new to new
wxSound definitely works under Windows.
I don't use Linux, but from an older thread on the forum i know that wxWidgets requires OSS under Linux which doesn't seem to be included in newer distros.
Try adding "wxLog::AddTraceMask("sound");" do your application. It should tell you which sound backend the sample tries to use. Or "no sound" if it doesn't find any suitable sound backend.
comment:11 in reply to: ↑ 7 Changed 5 years ago by LeoMetre
Replying to vadz:
As mentioned in the bug submission guidelines: Please do not change the priority. Please do describe if the bug is reproducible in the sound sample. Please also describe the version and the platform you're testing under.
Dear vadz,
I use the same OS (Ubuntu), with CodeBlocks 13.12 and WX 2.6
my "includes":
#include <wx/msgdlg.h>
#include <wx/sound.h>
#include <wx/textfile.h>
i am following the steps suggest on this ticket and the problem still the same:
- check if the wxWidgets are initialized (ok); In this case, there are something more to be initialized ? I am following the docummentation.
- Play the WAV file manually (ok! the problem isn't the wav file and the path are correct);
- Check if there is any bug or exception (nothing);
Additional: when i run the project, the " .Play(wxSOUND_ASYNC)" returns true without exceptions.
If there is any other information that you want i can reply it ASAP.
I am thanfull for your help and i am waiting for your considerations.
comment:12 Changed 5 years ago by vadz
- Status changed from new to infoneeded_new
If you're really using 15 year old wxWidgets 2.6, you need to update to at least wxWidgets 3.0 and ideally 3.1 and retest.
If you're not using this ancient version, I'm sorry but if what I wrote in comment:7 (it's just 3 sentences, yet you didn't seem to notice the 2nd one) and comment:9 is not enough, it looks like there is simply nothing I can do.
comment:13 Changed 5 years ago by dmarques
- Status changed from infoneeded_new to new
I've been working with wxWidgets for over a decade and it is quite impressive but, the only thing that NEVER got to work was wxSound (and wxBell).
I have had every wxSound sample available on the internet tested in several hardware and systems over these years and no sound ever played, anywhere.
And those tests were never run on wx 2.6, but always on 2.8 or, lately, on 3.0.
The systems:
- Windows XP (32 bits)
- Windows 7 (32 and 64 bits)
- Windows 10 (64 bits)
- Ubuntu 10.04 LTS (32 and 64 bits)
- Ubuntu 12.10 (64 bits)
- Ubuntu 14.04 LTS (32 and 64 bits)
The hardware:
- Very old 64 bite single-core Athlon (AC97 mobo);
- Old dual core (Realtek ALC250) laptop;
- Quad-Core (unknown onboard sound system);
- i7 laptop (Realtek ALC272);
- External USB 7.1 audio unit;
- i3 Dell laptop (unknown onboard sound system).
Playing sounds isn't a major issue for me so, I've simply given up and kept trying it over again from time to time.
However, from my perspective, this does not seem to be a bug, because wxSound would have to WORK, with a flaw, to be considered one. AFAIK, this is actually one entirely malfunctioned feature.
The only one in wxWidgets, I think.
comment:14 Changed 5 years ago by vadz
- Status changed from new to infoneeded_new
It's amazing to have written so much yet without ever mentioning if you tested the sound sample -- which is the main thing I'm asking for since 2 days already (my bet is that you didn't and that you're in for a huge surprise when you run it and it does produce sound).
comment:15 Changed 5 years ago by ericj
- Status changed from infoneeded_new to new
I usually don't work under Linux, but i just tried this with a fresh Ubuntu 14.04 LTS 64bit and a fresh wxWidgets 3.1.0
The sound sample does indeed not play any sound. When adding wxLog::AddTraceMask("sound"); to the sample, it outputs:
Trace: (sound) using backend 'No sound'
Ubunto has dropped support for OSS and AFAICS wxWidgets only has backends for OSS and SDL under Linux.
Installing the packages "oss-compat" and "alsa-oss" didn't change anything either (but as i have no clue about Linux, i don't know if that was supposed to work).
Bottom line: I think we need a volunteer to write an ALSA backend for wxSound.
comment:16 Changed 5 years ago by nerijus
I can confirm I get Trace: (sound) using backend 'No sound' too after adding wxLog::AddTraceMask("sound"); to the sample. Fedora 23 here.
comment:17 Changed 5 years ago by vadz
- Component changed from samples to base
- Summary changed from wxSound().Play Don't work [LINUX] to wxSound doesn't work under Linux (OSS not supported any more)
- Version changed from 2.8.x to 3.1.0
I'm not sure what is going on with the SDL plugin in this code, but I guess it's off by default and it seems that OSS indeed doesn't work any longer... FWIW the code tests for this simply by trying to open /dev/dsp, so it could possibly also be a permission problem, can you look at it?
In any case, having an ALSA backend would definitely be nice. But, to return to comment:13, wxSound at least still definitely does work under MSW.
comment:18 Changed 5 years ago by ericj
Small addition: Installing the "oss-compat" package under Ubuntu does make the sound sample work. I just hadn't rebooted before.
comment:19 Changed 5 years ago by nerijus
There's no /dev/dsp on Fedora 23 (didn't try to install any oss-compat packages). BTW, pulseaudio backend would be nice too.
comment:20 follow-up: ↓ 21 Changed 5 years ago by dmarques
I have to correct one piece of information.
I hadn't noticed that the sound sample on Github had changed.
The version I have tried before, and failed to play sound on all the systems I mentioned earlier, was an ancient 1998 sample version, dating back to 25/10/98, by Marcel Rasche and Vaclav Slavik.
I have just tested the current 2004 version on a 64 bit Ubuntu 14.04 LTS and... No sound.
As suggested, I've added oss-compat and... No sound.
Also, I've tried alsa-oss and... No sound.
BTW, I've tried to make wxSound play embeded byte streamed wav since 2010 (when I first started dealing with this) but it never made a difference (I don't think this relate to the problem itself).
The best I always got is .Play to return true but no output at all.
I will try this (current) version on Windows tomorrow.
comment:21 in reply to: ↑ 20 Changed 5 years ago by oneeyeman
Hi,
Replying to dmarques:
I have to correct one piece of information.
I hadn't noticed that the sound sample on Github had changed.
The version I have tried before, and failed to play sound on all the systems I mentioned earlier, was an ancient 1998 sample version, dating back to 25/10/98, by Marcel Rasche and Vaclav Slavik.
Are you saying you tried the sample with old wx version dated back to 1998?
Or you just copied the sample code in the appropriate directory of the current distribution?
I have just tested the current 2004 version on a 64 bit Ubuntu 14.04 LTS and... No sound.
As suggested, I've added oss-compat and... No sound.
Please grab everything from current Git, build it and try again.
Also did you reboot after oss-compat installation as written by ericj?
Also, I've tried alsa-oss and... No sound.
BTW, I've tried to make wxSound play embeded byte streamed wav since 2010 (when I first started dealing with this) but it never made a difference (I don't think this relate to the problem itself).
The best I always got is .Play to return true but no output at all.
I will try this (current) version on Windows tomorrow.
And the proper way on Linux please.
comment:22 Changed 5 years ago by dmarques
Updating and answering your questions:
I use CodeBlocks + Gnu/MinGw so I can't simply grab everything from the sound sample folder on GitHub... After merging the wxSound sample project into one new Codeblocks+Gnu/MinGW project (and fixing error/warning messages) this was the outcome:
On a 32 bits windows 7, finally some sample play.
But, the magic relied on something I've found on the internet just yesterday: libwinmm.a. After its addition to the linking process, voilà.
Perhaps I am still missing something but there is some initial lag while starting the WAV play. Is it always like that? Is there a way to quick start the sound play? I've tried playing sounds from a file and from a RAM buffer but it made no difference for that matter. Also, SYNC or ASYNC made no difference.
On Ubuntu, however, nothing is new.
When I wrote here yesterday I hadn't booted after installing oss-compat but, I now have and, still nothing.
comment:23 Changed 5 years ago by ardovm
Hello all,
for what it's worth, I could get wxSound playing on Ubuntu 14.04.5, wxWidgets 2.8.12.1, by installing the "osspd" package.
From https://sourceforge.net/projects/osspd/ :
OSS Proxy Daemon is a Linux userland OSS sound device (/dev/[a]dsp and /dev/mixer) implementation using CUSE. Currently it supports forwarding OSS sound streams to PulseAudio and ALSA.
comment:24 Changed 5 years ago by igi
- Cc igor.cali0@… added
comment:25 Changed 4 years ago by vadz
- Resolution set to wontfix
- Status changed from new to closed
I don't think we can really do anything about this one, the existing implementation does work with osspd and I've opened #18000 as a ticket to track/coordinate new backend development if anybody is interested in it.

This piece of code has a bug, it will always say all is fine.