Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in Ardour #12

Closed
alcomposer opened this issue Dec 14, 2019 · 8 comments
Closed

Crash in Ardour #12

alcomposer opened this issue Dec 14, 2019 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@alcomposer
Copy link
Collaborator

alcomposer commented Dec 14, 2019

System Info:

OS: Arch Linux x86_64
Host: TM1701
Kernel: 5.4.2-arch1-1
Uptime: 1 day, 2 hours, 29 mins
Packages: 2445 (pacman), 21 (flatpak)
Shell: bash 5.0.11
Resolution: 1920x1080
DE: GNOME 3.34.2
WM: Mutter
WM Theme: Adwaita
Theme: Adwaita [GTK2/3]
Icons: Adwaita [GTK2/3]
Terminal: gnome-terminal
CPU: Intel i7-8550U (8) @ 4.000GHz
GPU: NVIDIA GeForce MX150
GPU: Intel UHD Graphics 620
Memory: 4294MiB / 15899MiB

Ardour crashes when trying to play a loaded SFZ library with Sfizz: introduced in commit: f012d45

Ardour terminal output:

Removed 0 out of 8 regions.
Loading file for Xylo_Medium_C4_ff_01_far.wav in the background
ardour-6.0.pre0.2674: /home/alexmitchell/Documents/github/sfizz/external/abseil-cpp/absl/types/span.h:357: void absl::lts_2019_08_08::Span<T>::remove_prefix(absl::lts_2019_08_08::Span<T>::size_type) [with T = float; absl::lts_2019_08_08::Span<T>::size_type = long unsigned int]: Assertion `size() >= n' failed.
Aborted (core dumped)
Backtrace (generated via ./ardbg):

#0  0x00007ffff2cf2f25 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff2cdc897 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff2cdc767 in _nl_load_domain.cold () at /usr/lib/libc.so.6
#3  0x00007ffff2ceb526 in  () at /usr/lib/libc.so.6
#4  0x00007fffd14cfe21 in absl::lts_2019_08_08::Span<float>::remove_prefix(unsigned long) ()
    at /usr/local/lib/lv2/sfizz.lv2/sfizz.so
#5  0x00007fffd14cf6ae in sfz::ADSREnvelope<float>::getBlock(absl::lts_2019_08_08::Span<float>) ()
    at /usr/local/lib/lv2/sfizz.lv2/sfizz.so
#6  0x00007fffd14c676b in sfz::Voice::processStereo(sfz::AudioSpan<float, 2u>) () at /usr/local/lib/lv2/sfizz.lv2/sfizz.so
#7  0x00007fffd14c6289 in sfz::Voice::renderBlock(sfz::AudioSpan<float, 2u>) () at /usr/local/lib/lv2/sfizz.lv2/sfizz.so
#8  0x00007fffd14903c1 in sfz::Synth::renderBlock(sfz::AudioSpan<float, 2u>) () at /usr/local/lib/lv2/sfizz.lv2/sfizz.so
#9  0x00007fffd148bce5 in sfizz_render_block () at /usr/local/lib/lv2/sfizz.lv2/sfizz.so
#10 0x00007fffd148ac88 in run () at /usr/local/lib/lv2/sfizz.lv2/sfizz.so
#11 0x00007ffff78fef6b in lilv_instance_run(LilvInstance*, uint32_t) (instance=0x55555ac0d050, sample_count=1024)
    at /usr/include/lilv-0/lilv/lilv.h:1704
#12 0x00007ffff7910537 in ARDOUR::LV2Plugin::run(unsigned int, bool) (this=0x555561225780, nframes=1024, sync_work=false)
    at ../libs/ardour/lv2_plugin.cc:3176
#13 0x00007ffff790e26f in ARDOUR::LV2Plugin::connect_and_run(ARDOUR::BufferSet&, long, long, double, ARDOUR::ChanMapping const&, ARDOUR::ChanMapping const&, unsigned int, long)
    (this=0x555561225780, bufs=..., start=1035, end=1035, speed=0, in_map=..., out_map=..., nframes=1024, offset=0)
    at ../libs/ardour/lv2_plugin.cc:2836
#14 0x00007ffff765c33f in ARDOUR::PluginInsert::connect_and_run(ARDOUR::BufferSet&, long, long, double, unsigned int, long, bool) (this=0x5555612562e0, bufs=..., start=1035, end=1035, speed=0, nframes=1024, offset=0, with_auto=true)
    at ../libs/ardour/plugin_insert.cc:1038
#15 0x00007ffff765d9b5 in ARDOUR::PluginInsert::run(ARDOUR::BufferSet&, long, long, double, unsigned int, bool)
    (this=0x5555612562e0, bufs=..., start_sample=1035, end_sample=1035, speed=0, nframes=1024)
    at ../libs/ardour/plugin_insert.cc:1243
#16 0x00007ffff76fe4c2 in ARDOUR::Route::process_output_buffers(ARDOUR::BufferSet&, long, long, unsigned int, bool, bool)
    (this=
    0x55555e65a6a0, bufs=..., start_sample=1035, end_sample=1035, nframes=1024, gain_automation_ok=false, run_disk_reader=false) at ../libs/ardour/route.cc:537
#17 0x00007ffff76ff5e1 in ARDOUR::Route::run_route(long, long, unsigned int, bool, bool)
    (this=0x55555e65a6a0, start_sample=0, end_sample=0, nframes=1024, gain_automation_ok=false, run_disk_reader=false)
    at ../libs/ardour/route.cc:728
#18 0x00007ffff7712c0c in ARDOUR::Route::no_roll_unlocked(unsigned int, long, long, bool)
    (this=0x55555e65a6a0, nframes=1024, start_sample=0, end_sample=0, session_state_changing=false)
--Type <RET> for more, q to quit, c to continue without paging--
    at ../libs/ardour/route.cc:3912
#19 0x00007ffff75cd9c3 in ARDOUR::MidiTrack::no_roll_unlocked(unsigned int, long, long, bool) (this=
    0x55555e65a6a0, nframes=1024, start_sample=0, end_sample=0, state_changing=false) at ../libs/ardour/midi_track.cc:344
#20 0x00007ffff7712ad4 in ARDOUR::Route::no_roll(unsigned int, long, long, bool)
    (this=0x55555e65a6a0, nframes=1024, start_sample=0, end_sample=0, session_state_changing=false)
    at ../libs/ardour/route.cc:3882
#21 0x00007ffff72b67fc in ARDOUR::Graph::process_one_route(ARDOUR::Route*) (this=0x555558224fd0, route=0x55555e65a6a0)
    at ../libs/ardour/graph.cc:670
#22 0x00007ffff72bb7dc in ARDOUR::GraphNode::process() (this=0x55555e65ab78) at ../libs/ardour/graphnode.cc:80
#23 0x00007ffff72b6a5b in ARDOUR::GraphNode::run(int) (this=0x55555e65ab78, chain=1)
    at /home/alexmitchell/Documents/github/ardour/libs/ardour/ardour/graphnode.h:62
#24 0x00007ffff72b430c in ARDOUR::Graph::run_one() (this=0x555558224fd0) at ../libs/ardour/graph.cc:442
#25 0x00007ffff72b4673 in ARDOUR::Graph::helper_thread() (this=0x555558224fd0) at ../libs/ardour/graph.cc:470
#26 0x00007ffff72baff3 in boost::_mfi::mf0<void, ARDOUR::Graph>::operator()(ARDOUR::Graph*) const
    (this=0x7fffe00d20f8, p=0x555558224fd0) at /usr/include/boost/bind/mem_fn_template.hpp:49
#27 0x00007ffff72ba7f3 in boost::_bi::list1<boost::_bi::value<ARDOUR::Graph*> >::operator()<boost::_mfi::mf0<void, ARDOUR::Graph>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, ARDOUR::Graph>&, boost::_bi::list0&, int)
    (this=0x7fffe00d2108, f=..., a=...) at /usr/include/boost/bind/bind.hpp:259
#28 0x00007ffff72b9c7c in boost::_bi::bind_t<void, boost::_mfi::mf0<void, ARDOUR::Graph>, boost::_bi::list1<boost::_bi::value<ARDOUR::Graph*> > >::operator()() (this=0x7fffe00d20f8) at /usr/include/boost/bind/bind.hpp:1294
#29 0x00007ffff72b93a7 in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ARDOUR::Graph>, boost::_bi::list1<boost::_bi::value<ARDOUR::Graph*> > >, void>::invoke(boost::detail::function::function_buffer&) (function_obj_ptr=...) at /usr/include/boost/function/function_template.hpp:158
#30 0x0000555555b7c4e9 in boost::function0<void>::operator()() const (this=0x7fffe00d20f0)
    at /usr/include/boost/function/function_template.hpp:763
#31 0x00007fffe1309f05 in ARDOUR::AlsaAudioBackend::alsa_process_thread(void*) (arg=0x55555a174100)
    at ../libs/backends/alsa/alsa_audiobackend.cc:1095
#32 0x00007ffff39584cf in start_thread () at /usr/lib/libpthread.so.0
#33 0x00007ffff2db62d3 in clone () at /usr/lib/libc.so.6
@alcomposer alcomposer changed the title Crash in Ardour & #2bbde74 Crash in Ardour & 2bbde74 Dec 14, 2019
@alcomposer alcomposer changed the title Crash in Ardour & 2bbde74 Crash in Ardour Dec 14, 2019
@paulfd paulfd added the bug Something isn't working label Dec 14, 2019
@paulfd paulfd self-assigned this Dec 14, 2019
@paulfd
Copy link
Member

paulfd commented Dec 14, 2019

Could you try with f473539? I did indeed introduce a wrong behavior in this commit...

@alcomposer
Copy link
Collaborator Author

alcomposer commented Dec 15, 2019

Yes this fixed the issue.

@x42
Copy link

x42 commented Dec 15, 2019

What is the motivation here? The sample-rate is passed to the plugin when the plugin is instantiated and must not change. So you can pick it up directly from instantiate (...)

The parameter-option is only for the benefit of GUIs (and it is passed as atom_Float). Support for this was only added recently. Ardour 5.x did no support this option.

@paulfd
Copy link
Member

paulfd commented Dec 15, 2019

I seem to recall that e.g. VST can change sample rates on the fly. At least such an option existed in Juce. I assumed this option was there to handle this possibility.

@x42
Copy link

x42 commented Dec 15, 2019

Yes, VST has that option (but almost no VSTs implement this properly. Check e.g. frequency grid-lines in VSTs EQs when changing the rate).

It is also super rare that anyone would change rate of a project while running. That's not click-free, nor realtime-safe, and one cannot do this live anyway. Also many plugins allocate buffers depending on sample-rate, so LV2 opted to just take down and re-instantiate the plugin.

I'm not aware of any LV2 host that allows changing the sample-rate while running. jalv, Ardour, Qtractor don't (maybe Carla does?).

@paulfd
Copy link
Member

paulfd commented Dec 15, 2019

I agree it seems overly optimistic to change the sample rate live, but as far as I could see there is really nothing preventing it in the way the "Options" extension is set. The API documentation mentions that the methods are in the "instantiation" threading class but that the options are there to enable changing some parameters of the plugin at runtime.

I don't remember exactly but the reason why I put this code path to change the sample rate was probably because I had an unmap around that told me that the host sent a sample rate option, and figured I probably should handle it somehow :) If I can disregard it it's fine as I already initialize the default sample rate to the parameter passed to the instantiate(...) function. Is it the same for the block size or can this actually change at runtime?

@x42
Copy link

x42 commented Dec 15, 2019

The API documentation mentions that the methods are in the "instantiation" threading class but that the options are there to enable changing some parameters of the plugin at runtime.

Indeed. it's theoretically possible possible that way.

Is it the same for the block size or can this actually change at runtime?

Yes, it can change at runtime. A plugin must also support run(..,n_samples) for any non-negative number of n_samples. The block-size is only an upper bound.

e.g. Ardour splits the cycle when looping or when there's port-automation. So in a single process cycle of 1024 samples, the plugin may be called with run(567); /* parameter or position changes*/ run (457);

@paulfd
Copy link
Member

paulfd commented Dec 15, 2019

Ahhh I see that's how this is implemented. It seemed weird to have only a single parameter value per block with automation curves. Thanks :D I aimed at doing it this way though so hopefully I succeeded...

My question however was more related to whether the max sample rate may change by calling set_options(...) after instantiation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants