Preferences hang if check PortAudio but no API/Devices are populated and press OK/Apply

• May 15, 2017 - 16:09
Reported version
2.2
Type
Functional
Severity
S4 - Minor
Status
closed
Project

Pref hang if check PortAudio when no dropbox populated.png

Note: I'm on arch linux mate running Arch's official 2.1 build.


Comments

Interestingly on my older arch machine that is still on MuseScore 2.0.3, when I first visit preferences and check portAudio, nothing gets populated, but I'm sucessfully able to press OK, and then when I revisit preferences, I see those dropdown boxes are populated.

So my first though it: well shouldn't those dropdown boxes get populated the instant that PortAudio checkbox is checked? Anyone know why not?

I'm running my 3.0 branch in QtCreator, and pressed the pause button while experiencing the hang, and according to the stack trace, Pa_OpenStream is hanging on some pthread mutextlock:

__lll_lock_wait 0x7ffff4f42d8c
2 pthread_mutex_lock 0x7ffff4f3bb25
3 snd_pcm_sw_params 0x7ffff7269ecc
4 snd_pcm_sw_params 0x7ffff7269e21
5 ?? 0x7ffff4d0f030
6 ?? 0x7ffff4d13a37
7 ?? 0x7ffff4d146a0
8 Pa_OpenStream 0x7ffff4d0a4ea
9 Ms::Portaudio::init pa.cpp 126 0x109a811
10 Ms::driverFactory driver.cpp 87 0xf9c4ea
11 Ms::PreferenceDialog::apply preferences.cpp 1420 0xcb154b
12 Ms::PreferenceDialog::buttonBoxClicked preferences.cpp 1329 0xcb08eb
13 Ms::PreferenceDialog::qt_static_metacall moc_prefsdialog.cpp 187 0x10d665d
14 QMetaObject::activate(QObject *, int, int, void * *) 0x7fffebcf4d79
15 QDialogButtonBox::clicked(QAbstractButton *) 0x7ffff3b2cf5f
16 ?? 0x7ffff3b2d57a
17 QMetaObject::activate(QObject *, int, int, void * *) 0x7fffebcf4d79
18 QAbstractButton::clicked(bool) 0x7ffff3afed02
19 ?? 0x7ffff3afef54
20 ?? 0x7ffff3b00347
...

So I'm thinking this is something which I need to report to PortAudio people. I could try maybe using their latest library and seeing if it works. Anyway, for reference, the call:

err = Pa_OpenStream(&stream, 0, &out, double(_sampleRate), 0, 0, paCallback, (void*)this);

has nothing unusual as I can tell...the output PaStreamParameters variable contains:

channelCount 2 int
device 9 PaDeviceIndex
hostApiSpecificStreamInfo 0x0 void*
sampleFormat 1 PaSampleFormat
suggestedLatency 0.1 PaTime

and the sample rate is 48000, which is all reasonable.

I should note I do have Jack installed on my machine, but I get this hang regardless of whether I have started jack or not.

I'm noting that in Portaudio::init before Pa_OpenStream() is called, PaDeviceIndex idx gets assigned to preferences.portaudioDevice, which is -1, and then the next lines:

if (idx < 0)
idx = Pa_GetDefaultOutputDevice();

Will result in idx being assigned to 9. That must mean I have at least 10 devices...and maybe the 10th device on my machine is suspect...

Status (old) active closed

I'm closing this because I've determined that musescore isn't at fault. I had a custom .asoundrc file which was probably confusing alsa, and so I think what happened is Alsa though it was a valid device, but it wasn't, so it hung while trying to open.