на Линуксе wxSound ну очень быстро

Это русская секция форума wxWidjets. В этой секции вы можете обсуждать любые вопросы, связанные с wxWidgets на вашем родном языке.
Post Reply
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

на Линуксе wxSound ну очень быстро

Post by cutecode »

на windows wav-файл проигрывается так, как и надо.
А на Линуксе таже функция пригрывает очень быстро
Можно ли как то исправить?

Code: Select all

bool PlaySound(wxString &sz)
{
	if (!wxFileExists(sz))
	{
		write_message(L"PlaySound() - Файл не существует " + sz);
		return false;
	}

	bool bresult = false;
	wxSound snd(sz);
	if (snd.IsOk())
		bresult = snd.Play();

	return bresult;
}
Attachments
А_12_1.wav.zip
(352.45 KiB) Downloaded 190 times
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: на Линуксе wxSound ну очень быстро

Post by cutecode »

вот так это звучит на Линуксе, хотя если просто открыть wav-файл двойным щелчком, он произносится правильно
На винде такой проблемы нет
Attachments
1.mp4.zip
(300.5 KiB) Downloaded 190 times
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: на Линуксе wxSound ну очень быстро

Post by doublemax »

This sounds like a bug. The documentation says that if you play the sound asynchronously, it keeps playing even if you destroy the sound object.

What happens if you delay the destruction of the sound object?
What sound backend do you use?

Please run the "sound" sample that comes with wxWidgets and try the "play sound asynchronously (object on stack)". If the same happens there, please open a bug report at http://trac.wxwidgets.org
Use the source, Luke!
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: на Линуксе wxSound ну очень быстро

Post by cutecode »

Hello
I tried wxSOUND_SYNC and wxSOUND_ASYNC - with the same result

I dont know how to know my sound backend, how to know it?
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: на Линуксе wxSound ну очень быстро

Post by doublemax »

I dont know how to know my sound backend, how to know it?
Add this line to your code:

Code: Select all

wxLog::AddTraceMask("sound");
It should be displayed in the console window.
Use the source, Luke!
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: на Линуксе wxSound ну очень быстро

Post by cutecode »

I launched my App from consol, here is the log trace

Code: Select all

alexander@debian:~/Documents/_builds/debug_dll$ ./soft_itUD64
18:25:10: Trace: (sound) using backend 'Open Sound System'
18:25:10: Trace: (sound) asking audio to stop
18:25:10: Trace: (sound) audio was stopped
18:25:10: Trace: (sound) launched async playback thread

(soft_itUD64:21319): Gdk-WARNING **: gdk_window_set_icon_list: icons too large

(soft_itUD64:21319): Gdk-WARNING **: gdk_window_set_icon_list: icons too large
18:25:10: Trace: (sound) Unable to set DSP to mono.
18:25:10: Trace: (sound) terminated async playback thread
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: на Линуксе wxSound ну очень быстро

Post by doublemax »

Still looks like a bug to me. What wxWidgets version are you using?

Try a sleep after Play() in order to see if destruction of the sound object stops the sound playing. If that's the case please open a bug report.
Use the source, Luke!
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: на Линуксе wxSound ну очень быстро

Post by cutecode »

Hello,

Code: Select all

alexander@debian:~$ wx-config --version
3.1.3
wxSleep(5); did not help

as a temporary solution I added this part of code

Code: Select all

#ifdef __WXGTK__
	wxString szShell;
	szShell.Printf(L"aplay %s", sz);
	wxExecute(szShell, wxEXEC_SYNC | wxEXEC_HIDE_CONSOLE);
	bresult = true;
#else
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: на Линуксе wxSound ну очень быстро

Post by doublemax »

wxSleep(5); did not help
That was not intended as a fix. I just wanted to narrow down the behavior.
Use the source, Luke!
Post Reply