summaryrefslogtreecommitdiff
path: root/libs/ardour/disk_writer.cc
AgeCommit message (Collapse)Author
2020-04-14Fix playback alignment when adding/removing channelsRobin Gareus
The disk-reader assumes that all playback ringbuffers are in sync and have the same fill_level.
2020-04-07use shared_ptr to manage backend port lifetimes (Pulse,ALSA,Dummy,JACK)Paul Davis
JACK is not yet finished. Changes also include minor reformatting and a spelling correction (latecies to latencies)
2020-03-29Fix optimized build crashes (missing return value) - #7958Robin Gareus
2020-03-28Create write sources for template/dup tracks - #7940Robin Gareus
This fixes a crash with missing [MIDI] write-sources after duplicating tracks [1]: Stealing write-source name fails, because there is no write-source. When duplicating tracks, reset_write_sources() is called before any playlists are set [2]. So no new write-sources are created because _playlists[DATA-TYPE] is empty. During normal track creation write-sources are usually added by the input-change handler [3]. However in this case the state has been set, and since there is no change, DiskWriter::configure_io does not call use_new_write_source() NB. This also re-creates write-source when playlists are changed. -=- [1] #3 0x00007f4420690102 in __GI___assert_fail at assert.c:101 #4 0x0000562bfa300dc9 in boost::shared_ptr<ARDOUR::SMFSource>::operator->() const at /usr/include/boost/smart_ptr/shared_ptr.hpp:734 #5 0x00007f442579ffa1 in ARDOUR::DiskWriter::steal_write_source_name[abi:cxx11]() at ../libs/ardour/disk_writer.cc:1290 #6 0x00007f4425e476b6 in ARDOUR::Track::steal_write_source_name[abi:cxx11]() at ../libs/ardour/track.cc:476 #7 0x00007f4425d060a2 in ARDOUR::Session::create_midi_source_by_stealing_name at ../libs/ardour/session.cc:4955 #8 0x0000562bf9ed39ab in MidiTimeAxisView::add_region at ../gtk2_ardour/midi_time_axis.cc:1650 #9 0x0000562bf9b05f2a in Drag::add_midi_region at ../gtk2_ardour/editor_drag.cc:568 -=- [2] #0 0x00007ffff7582e2f in ARDOUR::DiskWriter::reset_write_sources at ../libs/ardour/disk_writer.cc:946 #1 0x00007ffff757fce6 in ARDOUR::DiskWriter::set_state at ../libs/ardour/disk_writer.cc:333 #2 0x00007ffff7a81c93 in ARDOUR::Route::set_processor_state at ../libs/ardour/route.cc:3054 #3 0x00007ffff7a7f5d5 in ARDOUR::Route::set_state at ../libs/ardour/route.cc:2697 #4 0x00007ffff7c2aa1d in ARDOUR::Track::set_state at ../libs/ardour/track.cc:172 #5 0x00007ffff794f204 in ARDOUR::MidiTrack::set_state at ../libs/ardour/midi_track.cc:152 #6 0x00007ffff7b7e06b in ARDOUR::Session::XMLRouteFactory at ../libs/ardour/session_state.cc:1890 #7 0x00007ffff7addf7e in ARDOUR::Session::new_route_from_template at ../libs/ardour/session.cc:3048 #8 0x000055555621329a in DuplicateRouteDialog::on_response(int) at ../gtk2_ardour/duplicate_routes_dialog.cc:194 -=- [3] #0 0x00007ffff7583243 in ARDOUR::DiskWriter::use_new_write_source at ../libs/ardour/disk_writer.cc:996 #1 0x00007ffff75831c7 in ARDOUR::DiskWriter::reset_write_sources at ../libs/ardour/disk_writer.cc:989 #2 0x00007ffff75851ea in ARDOUR::DiskWriter::configure_io at ../libs/ardour/disk_writer.cc:1335 #3 0x00007ffff7a7b308 in ARDOUR::Route::configure_processors_unlocked at ../libs/ardour/route.cc:1912 #4 0x00007ffff7a79e4b in ARDOUR::Route::configure_processors at ../libs/ardour/route.cc:1719 #5 0x00007ffff7a86695 in ARDOUR::Route::input_change_handler at ../libs/ardour/route.cc:3632
2020-03-17remove destructive/tape mode tracksPaul Davis
2020-03-08Replace strftime() with Glib::DateTime()Robin Gareus
This is mainly for windows compatibility "%F" is not supported. An alternative would be to s/%F/%Y-%m-%d/ to produce the ISO date.
2020-02-19fix old write source names being used after a track is renamedPaul Davis
2020-01-29Fix MIDI loop capture alignmentRobin Gareus
Loop recording creates a single long source, regions have to be "split" from this source, using "start" as offset. Since MIDI uses absolute timestamps, offsetting this by accumulating buffer_position += (*ci)->samples; like Track::use_captured_audio_sources() does, is not correct. Furthermore, record_enabled() may be off when stopping recording, MIDI needs to be flushed regardless.
2020-01-29Allow to dis/engage rec-arm while loopingRobin Gareus
2020-01-29Fix loop recording alignmentRobin Gareus
DiskWriter::transport_looped() is called from the session when engine loops. This does not take local disk-reader run() latency offset into account. finish_capture() needs to be postponed until the disk-writer itself reaches the loop-position. This is achieved by postponing loop() and calling it once loop-length of samples has been captured. This works because engaging loop always seeks to the loop-position and first loop resets _capture_captured.
2020-01-18Fix MIDI capture alignmentRobin Gareus
This fixes Audio/MIDI alignment when recording normally. Loop and/or Punch-in recording is still not aligned properly (both audio and MIDI). _accumulated_capture_offset is initialized once, accumulated offsets (rec_nframes) are kept, even when ::check_record_status() is called multiple times.
2020-01-18Zero capture-offset regardless of data-typeRobin Gareus
_accumulated_capture_offset is only used for MIDI, however this is helpful when debugging. Previously audio kept accumulating the offset indefinitely.
2020-01-09Fix MIDI loop recording - Revert "Fix MIDI disk-writer flush"Robin Gareus
This reverts commit 254f22e372ff1155e76bea2c9a6f9c6c85a94868.
2020-01-09Towards fixing MIDI capture alignmentRobin Gareus
When there is no overlap (Evoral::OverlapNone) of local transport position and the record-range, MIDI data does not need to be offset. This matches audio recording: Only write to the capture ringbuffer when there is an overlap. (There is still some unknown, unresolved discrepancy remaining to be tracked down)
2020-01-09Fix CaptureAlignment debug messsageRobin Gareus
2020-01-07Fix MIDI disk-writer flushRobin Gareus
to_write must not exceed `total = _samples_pending_write`. If the write succeeds (events spanning `to_write` samples are written) to_write is atomically subtracted from `_samples_pending_write`.
2019-12-11variable renaming in Butler for various buffer sizesPaul Davis
2019-11-18fix typo/thinko in logic to decide if MIDI buffers in DiskWriter require the ↵Paul Davis
butler (to write to disk)
2019-11-02refactor SessionEvent and DiskIO so that we pass around ↵Paul Davis
boost::shared_ptr<Track> rather than Route (this the raw pointers used inside SessionEvent)
2019-09-26Don't try to process MIDI input in a DiskWriter if it has no _midi_bufPaul Davis
... which implies it has no MIDI input port(s) either. This fixes behaviour caused by BufferSet::get...() returning a valid MidiBuffer because it was based on using the _available count within the BufferSet, even though the _count value indicated there was no buffer available (to match the I/O configuration of the Route).
2019-09-05Reset write-source only when necessaryRobin Gareus
When I/O port-counts do not change, plugin re-order happens in sync in the process-thread. ::configure_io() is only called to ensure that the current configuration is valid. In case that the ChanCount does not change, the method must be realtime-safe and not block. DiskWriter::reset_write_sources() is not realtime-safe and implicitly causes a session-save: Write-sources are destroyed and re-created. This includes a call to write_source->drop_references(), which triggers ARDOUR::Session::remove_source(), which saves the session. Furthermore adding/removing plugins will likewise call ::configure_io(). Previously any processor change on a track lead to saving the session!
2019-08-12NO-OP: mark private variables, remove cruftRobin Gareus
2019-08-12Initialize some more uninitialized variablesRobin Gareus
2019-08-03Update libardour GPL boilerplate and (C) from git logRobin Gareus
2019-08-01(Source List) Clean up the natural_position implementation (libardour part).Ben Loftis
2019-08-01(Source List) Source property signals (libardour part)Ben Loftis
2019-08-01(Source List) Take-ID: new (working) implementation.Ben Loftis
2018-12-23Fix cases where there's no MIDI buffer (e.g. audio audition)Robin Gareus
2018-11-29Disk I/O: only allocate midi-buffer if neededRobin Gareus
This fixes a memory-leak (_midi_buf was allocated in DiskIOProc but only delete in DiskReader). Also skip midi-refill early on
2018-07-09Separate ChannelInfo for disk reader and writerRobin Gareus
This allows to use different types for write and read buffers, in preparation for a dedicated reader-buffer.
2017-10-31Move Loop Location to ProcessorsRobin Gareus
The processors will becomes responsible to know about loop-positions and map latency-compensated start_sample, end_sample into the loop-range as needed.
2017-10-04Clean up State API:Robin Gareus
* Processor implement get_state(), classes derived from Processor implement protected ::state() -- as documented in processor.h * likewise for Route, Track: make ::state() a protected interface * removal of "full_state", use explicit "template_save" * use RAII/Unwind to skip saving automation-state
2017-10-02remove cruftPaul Davis
2017-10-01Fix MIDI rec-region displayRobin Gareus
gui_feed_buffer is used for DiskWriter -> GUI notifications. It was wrongly migrated from MidiDiskstream to DiskReader in 7fb6807
2017-10-01Fix recording MIDIRobin Gareus
- Fix API call to add region(midi_region) -- set count to "1" - Forward DataRecorded() signal - remove botched merge/rebase" a4a87f56 accidentally brought back code from old-destructive API which was removed in af103cf3 and 08c13007 There is no per track NonLayered record mode anymore, it's session global. - set can_record correctly to not accidentally clear last capture sources for cont'd recording (toggle track's rec-arm)
2017-09-30Disk-writer: don't record immediate/oob eventsRobin Gareus
2017-09-30Align punch in/out recording with latency-compensationRobin Gareus
2017-09-29Remove unused punch+preroll APIRobin Gareus
This API was not used, also superseded by record w/preroll.
2017-09-29Ongoing work on latency compensationRobin Gareus
The general goal is to align transport-sample to be the audible frame and use that as "anchor" for all processing. transport_sample cannot become negative (00:00:00:00 is the first audible frame). Internally transport pre-rolls (read-ahead) before the transport starts to move. This allows inputs and disk to prefill the pipeline. When starting to roll, the session counts down a global "remaning preroll" counter, which is the worst-latency from in-to-out. Each route in turn will start processing at its own output-latency. Route::process_output_buffers() - which does the actual processing incl disk i/o - begins by offsetting the "current sample" by the route's process-latency and decrements the offset for each latent processor. At the end of the function the output will be aligned and match transport-sample - downstream-playback-latency (if any). PS. This commit is a first step only: transport looping & vari-speed have not yet been implemented/updated.
2017-09-29NO-OP: WhitespaceRobin Gareus
2017-09-29Remove code related to capture-offset.Robin Gareus
2017-09-24convert codebase to use Temporal for various time typesPaul Davis
2017-09-22NO-OP: whitespaceRobin Gareus
2017-09-22AlignmentChoise is a Track PropertyRobin Gareus
The DiskWriter uses AlignStyle which is set dynamically by the Track and may depend on I/O connections.
2017-09-21fix clang compilation (include header ordering)Robin Gareus
"i18n.h" needs to be included last, after types have been defined or clang bails out: "call to function 'operator<<' is not visible in the template definition"
2017-09-18globally change all use of "frame" to refer to audio into "sample".Paul Davis
Generated by tools/f2s. Some hand-editing will be required in a few places to fix up comments related to timecode and video in order to keep the legible
2017-09-18move _file_frame from DiskIOProcessor into DiskReader (only place where it ↵Paul Davis
is needed); split into by-type array to deal with different rate of audio & MIDI i/o
2017-09-18DiskWriter needs to drop source refs in its destructor.Paul Davis
SerializedRCUManager can't do this by itself
2017-09-18change visible name of disk i/o processorsPaul Davis
2017-09-18comment out debug trace outputPaul Davis