summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2017-09-18 12:39:17 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2017-09-18 12:39:17 -0400
commit30b087ab3d28f1585987fa3f6ae006562ae192e3 (patch)
tree620ae0250b5d77f90a18f8c2b83be61e4fe7b0b5
parentcb956e3e480716a3efd280a5287bdd7bee1cedc5 (diff)
globally change all use of "frame" to refer to audio into "sample".
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
-rw-r--r--gtk2_ardour/add_route_dialog.cc14
-rw-r--r--gtk2_ardour/add_route_dialog.h4
-rw-r--r--gtk2_ardour/add_video_dialog.cc2
-rw-r--r--gtk2_ardour/analysis_window.cc6
-rw-r--r--gtk2_ardour/ardour_ui.cc84
-rw-r--r--gtk2_ardour/ardour_ui.h18
-rw-r--r--gtk2_ardour/ardour_ui2.cc8
-rw-r--r--gtk2_ardour/ardour_ui_dependents.cc6
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc4
-rw-r--r--gtk2_ardour/ardour_ui_options.cc4
-rw-r--r--gtk2_ardour/au_pluginui.h2
-rw-r--r--gtk2_ardour/audio_clock.cc280
-rw-r--r--gtk2_ardour/audio_clock.h52
-rw-r--r--gtk2_ardour/audio_region_view.cc102
-rw-r--r--gtk2_ardour/audio_region_view.h18
-rw-r--r--gtk2_ardour/audio_streamview.cc32
-rw-r--r--gtk2_ardour/audio_streamview.h4
-rw-r--r--gtk2_ardour/audio_time_axis.cc8
-rw-r--r--gtk2_ardour/automation_controller.cc8
-rw-r--r--gtk2_ardour/automation_line.cc46
-rw-r--r--gtk2_ardour/automation_line.h26
-rw-r--r--gtk2_ardour/automation_region_view.cc26
-rw-r--r--gtk2_ardour/automation_region_view.h14
-rw-r--r--gtk2_ardour/automation_streamview.cc8
-rw-r--r--gtk2_ardour/automation_streamview.h4
-rw-r--r--gtk2_ardour/automation_time_axis.cc26
-rw-r--r--gtk2_ardour/automation_time_axis.h10
-rw-r--r--gtk2_ardour/clock_group.cc2
-rw-r--r--gtk2_ardour/edit_note_dialog.cc4
-rw-r--r--gtk2_ardour/editor.cc400
-rw-r--r--gtk2_ardour/editor.h214
-rw-r--r--gtk2_ardour/editor_actions.cc16
-rw-r--r--gtk2_ardour/editor_audio_import.cc30
-rw-r--r--gtk2_ardour/editor_canvas.cc70
-rw-r--r--gtk2_ardour/editor_canvas_events.cc8
-rw-r--r--gtk2_ardour/editor_cursors.cc12
-rw-r--r--gtk2_ardour/editor_cursors.h10
-rw-r--r--gtk2_ardour/editor_drag.cc742
-rw-r--r--gtk2_ardour/editor_drag.h162
-rw-r--r--gtk2_ardour/editor_export_audio.cc22
-rw-r--r--gtk2_ardour/editor_keys.cc24
-rw-r--r--gtk2_ardour/editor_markers.cc60
-rw-r--r--gtk2_ardour/editor_mouse.cc40
-rw-r--r--gtk2_ardour/editor_ops.cc830
-rw-r--r--gtk2_ardour/editor_pt_import.cc14
-rw-r--r--gtk2_ardour/editor_regions.cc46
-rw-r--r--gtk2_ardour/editor_regions.h4
-rw-r--r--gtk2_ardour/editor_routes.cc2
-rw-r--r--gtk2_ardour/editor_rulers.cc166
-rw-r--r--gtk2_ardour/editor_selection.cc128
-rw-r--r--gtk2_ardour/editor_summary.cc30
-rw-r--r--gtk2_ardour/editor_summary.h16
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc72
-rw-r--r--gtk2_ardour/editor_timefx.cc6
-rw-r--r--gtk2_ardour/editor_videotimeline.cc2
-rw-r--r--gtk2_ardour/engine_dialog.cc22
-rw-r--r--gtk2_ardour/enums.cc2
-rw-r--r--gtk2_ardour/export_dialog.cc2
-rw-r--r--gtk2_ardour/export_format_dialog.cc24
-rw-r--r--gtk2_ardour/export_report.cc14
-rw-r--r--gtk2_ardour/export_report.h2
-rw-r--r--gtk2_ardour/export_timespan_selector.cc52
-rw-r--r--gtk2_ardour/export_timespan_selector.h8
-rw-r--r--gtk2_ardour/export_video_dialog.cc84
-rw-r--r--gtk2_ardour/export_video_dialog.h2
-rw-r--r--gtk2_ardour/fft_graph.cc2
-rw-r--r--gtk2_ardour/gain_meter.cc4
-rw-r--r--gtk2_ardour/generic_pluginui.cc60
-rw-r--r--gtk2_ardour/insert_remove_time_dialog.cc8
-rw-r--r--gtk2_ardour/insert_remove_time_dialog.h4
-rw-r--r--gtk2_ardour/latency_gui.cc10
-rw-r--r--gtk2_ardour/latency_gui.h10
-rw-r--r--gtk2_ardour/location_ui.cc36
-rw-r--r--gtk2_ardour/location_ui.h4
-rw-r--r--gtk2_ardour/luainstance.cc4
-rw-r--r--gtk2_ardour/lv2_plugin_ui.cc4
-rw-r--r--gtk2_ardour/main.cc2
-rw-r--r--gtk2_ardour/main_clock.cc6
-rw-r--r--gtk2_ardour/main_clock.h2
-rw-r--r--gtk2_ardour/marker.cc18
-rw-r--r--gtk2_ardour/marker.h8
-rw-r--r--gtk2_ardour/marker_selection.h2
-rw-r--r--gtk2_ardour/midi_automation_line.cc2
-rw-r--r--gtk2_ardour/midi_automation_line.h2
-rw-r--r--gtk2_ardour/midi_list_editor.cc6
-rw-r--r--gtk2_ardour/midi_region_view.cc246
-rw-r--r--gtk2_ardour/midi_region_view.h70
-rw-r--r--gtk2_ardour/midi_streamview.cc14
-rw-r--r--gtk2_ardour/midi_streamview.h2
-rw-r--r--gtk2_ardour/midi_time_axis.cc14
-rw-r--r--gtk2_ardour/midi_time_axis.h4
-rw-r--r--gtk2_ardour/midi_tracer.cc4
-rw-r--r--gtk2_ardour/mini_timeline.cc62
-rw-r--r--gtk2_ardour/mini_timeline.h14
-rw-r--r--gtk2_ardour/mixer_strip.cc24
-rw-r--r--gtk2_ardour/mixer_strip.h2
-rw-r--r--gtk2_ardour/mixer_ui.cc30
-rw-r--r--gtk2_ardour/mixer_ui.h6
-rw-r--r--gtk2_ardour/monitor_section.cc4
-rw-r--r--gtk2_ardour/option_editor.cc2
-rw-r--r--gtk2_ardour/panner_ui.cc6
-rw-r--r--gtk2_ardour/patch_change_dialog.cc4
-rw-r--r--gtk2_ardour/patch_change_dialog.h6
-rw-r--r--gtk2_ardour/plugin_display.cc6
-rw-r--r--gtk2_ardour/plugin_display.h2
-rw-r--r--gtk2_ardour/plugin_eq_gui.cc22
-rw-r--r--gtk2_ardour/plugin_eq_gui.h4
-rw-r--r--gtk2_ardour/plugin_selector.cc12
-rw-r--r--gtk2_ardour/plugin_ui.cc6
-rw-r--r--gtk2_ardour/port_insert_ui.cc8
-rw-r--r--gtk2_ardour/processor_box.cc6
-rw-r--r--gtk2_ardour/processor_box.h2
-rw-r--r--gtk2_ardour/public_editor.h70
-rw-r--r--gtk2_ardour/rc_option_editor.cc4
-rw-r--r--gtk2_ardour/region_editor.cc6
-rw-r--r--gtk2_ardour/region_layering_order_editor.cc2
-rw-r--r--gtk2_ardour/region_layering_order_editor.h4
-rw-r--r--gtk2_ardour/region_selection.cc14
-rw-r--r--gtk2_ardour/region_selection.h4
-rw-r--r--gtk2_ardour/region_view.cc162
-rw-r--r--gtk2_ardour/region_view.h28
-rw-r--r--gtk2_ardour/rhythm_ferret.cc10
-rw-r--r--gtk2_ardour/rhythm_ferret.h4
-rw-r--r--gtk2_ardour/route_params_ui.cc72
-rw-r--r--gtk2_ardour/route_params_ui.h18
-rw-r--r--gtk2_ardour/route_time_axis.cc20
-rw-r--r--gtk2_ardour/route_time_axis.h12
-rw-r--r--gtk2_ardour/route_ui.cc8
-rw-r--r--gtk2_ardour/selection.cc22
-rw-r--r--gtk2_ardour/selection.h14
-rw-r--r--gtk2_ardour/selection_memento.cc2
-rw-r--r--gtk2_ardour/session_dialog.cc18
-rw-r--r--gtk2_ardour/session_dialog.h4
-rw-r--r--gtk2_ardour/session_import_dialog.cc10
-rw-r--r--gtk2_ardour/session_import_dialog.h2
-rw-r--r--gtk2_ardour/session_option_editor.cc2
-rw-r--r--gtk2_ardour/sfdb_ui.cc30
-rw-r--r--gtk2_ardour/sfdb_ui.h4
-rw-r--r--gtk2_ardour/simple_progress_dialog.h2
-rw-r--r--gtk2_ardour/soundcloud_export_selector.cc14
-rw-r--r--gtk2_ardour/speaker_dialog.cc10
-rw-r--r--gtk2_ardour/speaker_dialog.h2
-rw-r--r--gtk2_ardour/step_editor.cc30
-rw-r--r--gtk2_ardour/step_editor.h2
-rw-r--r--gtk2_ardour/streamview.cc36
-rw-r--r--gtk2_ardour/streamview.h20
-rw-r--r--gtk2_ardour/strip_silence_dialog.cc16
-rw-r--r--gtk2_ardour/strip_silence_dialog.h4
-rw-r--r--gtk2_ardour/tape_region_view.cc2
-rw-r--r--gtk2_ardour/template_dialog.cc6
-rw-r--r--gtk2_ardour/tempo_curve.cc40
-rw-r--r--gtk2_ardour/tempo_curve.h10
-rw-r--r--gtk2_ardour/tempo_dialog.cc18
-rw-r--r--gtk2_ardour/tempo_dialog.h4
-rw-r--r--gtk2_ardour/tempo_lines.cc30
-rw-r--r--gtk2_ardour/tempo_lines.h16
-rw-r--r--gtk2_ardour/time_axis_view.cc36
-rw-r--r--gtk2_ardour/time_axis_view.h12
-rw-r--r--gtk2_ardour/time_axis_view_item.cc224
-rw-r--r--gtk2_ardour/time_axis_view_item.h60
-rw-r--r--gtk2_ardour/time_fx_dialog.cc4
-rw-r--r--gtk2_ardour/time_fx_dialog.h4
-rw-r--r--gtk2_ardour/time_info_box.cc20
-rw-r--r--gtk2_ardour/time_selection.cc14
-rw-r--r--gtk2_ardour/time_selection.h6
-rw-r--r--gtk2_ardour/transcode_ffmpeg.cc18
-rw-r--r--gtk2_ardour/transcode_ffmpeg.h10
-rw-r--r--gtk2_ardour/transcode_video_dialog.cc4
-rw-r--r--gtk2_ardour/transcode_video_dialog.h2
-rw-r--r--gtk2_ardour/vca_master_strip.cc20
-rw-r--r--gtk2_ardour/vca_master_strip.h2
-rw-r--r--gtk2_ardour/vca_time_axis.cc2
-rw-r--r--gtk2_ardour/verbose_cursor.cc16
-rw-r--r--gtk2_ardour/verbose_cursor.h4
-rw-r--r--gtk2_ardour/video_image_frame.cc22
-rw-r--r--gtk2_ardour/video_image_frame.h22
-rw-r--r--gtk2_ardour/video_monitor.cc42
-rw-r--r--gtk2_ardour/video_monitor.h8
-rw-r--r--gtk2_ardour/video_timeline.cc118
-rw-r--r--gtk2_ardour/video_timeline.h30
-rw-r--r--libs/ardour/amp.cc30
-rw-r--r--libs/ardour/analysis_graph.cc32
-rw-r--r--libs/ardour/ardour/amp.h16
-rw-r--r--libs/ardour/ardour/analysis_graph.h10
-rw-r--r--libs/ardour/ardour/async_midi_port.h6
-rw-r--r--libs/ardour/ardour/audio_backend.h10
-rw-r--r--libs/ardour/ardour/audio_buffer.h48
-rw-r--r--libs/ardour/ardour/audio_playlist_source.h6
-rw-r--r--libs/ardour/ardour/audio_track.h6
-rw-r--r--libs/ardour/ardour/audio_unit.h18
-rw-r--r--libs/ardour/ardour/audioanalyser.h4
-rw-r--r--libs/ardour/ardour/audioengine.h38
-rw-r--r--libs/ardour/ardour/audiofilesource.h12
-rw-r--r--libs/ardour/ardour/audioplaylist.h4
-rw-r--r--libs/ardour/ardour/audioregion.h50
-rw-r--r--libs/ardour/ardour/audiosource.h46
-rw-r--r--libs/ardour/ardour/auditioner.h32
-rw-r--r--libs/ardour/ardour/automatable.h8
-rw-r--r--libs/ardour/ardour/automation_control.h2
-rw-r--r--libs/ardour/ardour/automation_list.h4
-rw-r--r--libs/ardour/ardour/automation_watch.h4
-rw-r--r--libs/ardour/ardour/beats_samples_converter.h (renamed from libs/ardour/ardour/beats_frames_converter.h)38
-rw-r--r--libs/ardour/ardour/buffer.h6
-rw-r--r--libs/ardour/ardour/buffer_set.h14
-rw-r--r--libs/ardour/ardour/butler.h8
-rw-r--r--libs/ardour/ardour/caimportable.h10
-rw-r--r--libs/ardour/ardour/capturing_processor.h8
-rw-r--r--libs/ardour/ardour/click.h8
-rw-r--r--libs/ardour/ardour/coreaudiosource.h8
-rw-r--r--libs/ardour/ardour/delayline.h14
-rw-r--r--libs/ardour/ardour/delivery.h6
-rw-r--r--libs/ardour/ardour/disk_io.h36
-rw-r--r--libs/ardour/ardour/disk_reader.h52
-rw-r--r--libs/ardour/ardour/disk_writer.h56
-rw-r--r--libs/ardour/ardour/dsp_filter.h2
-rw-r--r--libs/ardour/ardour/element_importer.h4
-rw-r--r--libs/ardour/ardour/engine_state_controller.h10
-rw-r--r--libs/ardour/ardour/export_analysis.h2
-rw-r--r--libs/ardour/ardour/export_channel.h28
-rw-r--r--libs/ardour/ardour/export_format_base.h2
-rw-r--r--libs/ardour/ardour/export_format_specification.h10
-rw-r--r--libs/ardour/ardour/export_graph_builder.h20
-rw-r--r--libs/ardour/ardour/export_handler.h20
-rw-r--r--libs/ardour/ardour/export_profile_manager.h6
-rw-r--r--libs/ardour/ardour/export_status.h8
-rw-r--r--libs/ardour/ardour/export_timespan.h24
-rw-r--r--libs/ardour/ardour/fixed_delay.h14
-rw-r--r--libs/ardour/ardour/gain_control.h2
-rw-r--r--libs/ardour/ardour/graph.h8
-rw-r--r--libs/ardour/ardour/importable_source.h10
-rw-r--r--libs/ardour/ardour/internal_return.h2
-rw-r--r--libs/ardour/ardour/internal_send.h2
-rw-r--r--libs/ardour/ardour/interpolation.h6
-rw-r--r--libs/ardour/ardour/io.h10
-rw-r--r--libs/ardour/ardour/io_processor.h2
-rw-r--r--libs/ardour/ardour/ladspa_plugin.h12
-rw-r--r--libs/ardour/ardour/latent.h10
-rw-r--r--libs/ardour/ardour/location.h34
-rw-r--r--libs/ardour/ardour/ltc_file_reader.h2
-rw-r--r--libs/ardour/ardour/lua_api.h4
-rw-r--r--libs/ardour/ardour/luaproc.h6
-rw-r--r--libs/ardour/ardour/lv2_plugin.h22
-rw-r--r--libs/ardour/ardour/meter.h2
-rw-r--r--libs/ardour/ardour/midi_buffer.h12
-rw-r--r--libs/ardour/ardour/midi_cursor.h2
-rw-r--r--libs/ardour/ardour/midi_playlist.h28
-rw-r--r--libs/ardour/ardour/midi_playlist_source.h32
-rw-r--r--libs/ardour/ardour/midi_port.h2
-rw-r--r--libs/ardour/ardour/midi_region.h40
-rw-r--r--libs/ardour/ardour/midi_ring_buffer.h10
-rw-r--r--libs/ardour/ardour/midi_scene_changer.h14
-rw-r--r--libs/ardour/ardour/midi_source.h72
-rw-r--r--libs/ardour/ardour/midi_state_tracker.h4
-rw-r--r--libs/ardour/ardour/midi_track.h24
-rw-r--r--libs/ardour/ardour/mididm.h8
-rw-r--r--libs/ardour/ardour/monitor_processor.h2
-rw-r--r--libs/ardour/ardour/mute_control.h2
-rw-r--r--libs/ardour/ardour/note_fixer.h20
-rw-r--r--libs/ardour/ardour/panner.h6
-rw-r--r--libs/ardour/ardour/panner_shell.h2
-rw-r--r--libs/ardour/ardour/playlist.h102
-rw-r--r--libs/ardour/ardour/playlist_factory.h2
-rw-r--r--libs/ardour/ardour/playlist_source.h6
-rw-r--r--libs/ardour/ardour/plugin.h8
-rw-r--r--libs/ardour/ardour/plugin_insert.h20
-rw-r--r--libs/ardour/ardour/port.h6
-rw-r--r--libs/ardour/ardour/port_engine.h2
-rw-r--r--libs/ardour/ardour/port_insert.h14
-rw-r--r--libs/ardour/ardour/processor.h12
-rw-r--r--libs/ardour/ardour/rc_configuration_vars.h12
-rw-r--r--libs/ardour/ardour/readable.h4
-rw-r--r--libs/ardour/ardour/region.h152
-rw-r--r--libs/ardour/ardour/region_factory.h2
-rw-r--r--libs/ardour/ardour/resampled_source.h12
-rw-r--r--libs/ardour/ardour/return.h2
-rw-r--r--libs/ardour/ardour/route.h64
-rw-r--r--libs/ardour/ardour/scene_changer.h4
-rw-r--r--libs/ardour/ardour/send.h14
-rw-r--r--libs/ardour/ardour/session.h256
-rw-r--r--libs/ardour/ardour/session_configuration_vars.h4
-rw-r--r--libs/ardour/ardour/session_event.h20
-rw-r--r--libs/ardour/ardour/sidechain.h2
-rw-r--r--libs/ardour/ardour/silentfilesource.h14
-rw-r--r--libs/ardour/ardour/slavable_automation_control.h12
-rw-r--r--libs/ardour/ardour/slave.h154
-rw-r--r--libs/ardour/ardour/smf_source.h28
-rw-r--r--libs/ardour/ardour/sndfileimportable.h12
-rw-r--r--libs/ardour/ardour/sndfilesource.h34
-rw-r--r--libs/ardour/ardour/soundseq.h4
-rw-r--r--libs/ardour/ardour/source.h12
-rw-r--r--libs/ardour/ardour/source_factory.h6
-rw-r--r--libs/ardour/ardour/srcfilesource.h26
-rw-r--r--libs/ardour/ardour/strip_silence.h4
-rw-r--r--libs/ardour/ardour/tempo.h166
-rw-r--r--libs/ardour/ardour/thread_buffers.h2
-rw-r--r--libs/ardour/ardour/ticker.h4
-rw-r--r--libs/ardour/ardour/track.h34
-rw-r--r--libs/ardour/ardour/types.h104
-rw-r--r--libs/ardour/ardour/unknown_processor.h2
-rw-r--r--libs/ardour/ardour/uri_map.h2
-rw-r--r--libs/ardour/ardour/utils.h2
-rw-r--r--libs/ardour/ardour/vestige/aeffectx.h2
-rw-r--r--libs/ardour/ardour/vst_plugin.h10
-rw-r--r--libs/ardour/async_midi_port.cc6
-rw-r--r--libs/ardour/audio_buffer.cc2
-rw-r--r--libs/ardour/audio_playlist.cc48
-rw-r--r--libs/ardour/audio_playlist_source.cc22
-rw-r--r--libs/ardour/audio_region_importer.cc2
-rw-r--r--libs/ardour/audio_track.cc18
-rw-r--r--libs/ardour/audio_track_importer.cc2
-rw-r--r--libs/ardour/audio_unit.cc84
-rw-r--r--libs/ardour/audioanalyser.cc8
-rw-r--r--libs/ardour/audioengine.cc62
-rw-r--r--libs/ardour/audiofilesource.cc10
-rw-r--r--libs/ardour/audioregion.cc190
-rw-r--r--libs/ardour/audiosource.cc160
-rw-r--r--libs/ardour/auditioner.cc34
-rw-r--r--libs/ardour/automatable.cc6
-rw-r--r--libs/ardour/automation.cc2
-rw-r--r--libs/ardour/automation_control.cc10
-rw-r--r--libs/ardour/automation_list.cc8
-rw-r--r--libs/ardour/automation_watch.cc10
-rw-r--r--libs/ardour/beats_samples_converter.cc (renamed from libs/ardour/beats_frames_converter.cc)26
-rw-r--r--libs/ardour/buffer_set.cc26
-rw-r--r--libs/ardour/butler.cc18
-rw-r--r--libs/ardour/caimportable.cc16
-rw-r--r--libs/ardour/capturing_processor.cc4
-rw-r--r--libs/ardour/coreaudiosource.cc20
-rw-r--r--libs/ardour/default_click.cc4
-rw-r--r--libs/ardour/delayline.cc34
-rw-r--r--libs/ardour/delivery.cc10
-rw-r--r--libs/ardour/disk_io.cc46
-rw-r--r--libs/ardour/disk_reader.cc246
-rw-r--r--libs/ardour/disk_writer.cc240
-rw-r--r--libs/ardour/dsp_filter.cc2
-rw-r--r--libs/ardour/ebur128_analysis.cc8
-rw-r--r--libs/ardour/element_importer.cc8
-rw-r--r--libs/ardour/engine_slave.cc4
-rw-r--r--libs/ardour/engine_state_controller.cc16
-rw-r--r--libs/ardour/enums.cc10
-rw-r--r--libs/ardour/export_channel.cc60
-rw-r--r--libs/ardour/export_format_base.cc2
-rw-r--r--libs/ardour/export_format_specification.cc20
-rw-r--r--libs/ardour/export_graph_builder.cc94
-rw-r--r--libs/ardour/export_handler.cc72
-rw-r--r--libs/ardour/export_profile_manager.cc4
-rw-r--r--libs/ardour/export_status.cc8
-rw-r--r--libs/ardour/export_timespan.cc16
-rw-r--r--libs/ardour/filter.cc4
-rw-r--r--libs/ardour/fixed_delay.cc26
-rw-r--r--libs/ardour/gain_control.cc4
-rw-r--r--libs/ardour/graph.cc20
-rw-r--r--libs/ardour/import.cc28
-rw-r--r--libs/ardour/internal_return.cc2
-rw-r--r--libs/ardour/internal_send.cc14
-rw-r--r--libs/ardour/interpolation.cc26
-rw-r--r--libs/ardour/io.cc14
-rw-r--r--libs/ardour/io_processor.cc2
-rw-r--r--libs/ardour/ladspa_plugin.cc20
-rw-r--r--libs/ardour/location.cc98
-rw-r--r--libs/ardour/location_importer.cc2
-rw-r--r--libs/ardour/ltc_slave.cc146
-rw-r--r--libs/ardour/lua_api.cc10
-rw-r--r--libs/ardour/luabindings.cc120
-rw-r--r--libs/ardour/luaproc.cc10
-rw-r--r--libs/ardour/lv2_evbuf.c14
-rw-r--r--libs/ardour/lv2_evbuf.h4
-rw-r--r--libs/ardour/lv2_plugin.cc100
-rw-r--r--libs/ardour/meter.cc16
-rw-r--r--libs/ardour/midi_buffer.cc8
-rw-r--r--libs/ardour/midi_channel_filter.cc2
-rw-r--r--libs/ardour/midi_clock_slave.cc104
-rw-r--r--libs/ardour/midi_playlist.cc60
-rw-r--r--libs/ardour/midi_playlist_source.cc32
-rw-r--r--libs/ardour/midi_port.cc8
-rw-r--r--libs/ardour/midi_region.cc110
-rw-r--r--libs/ardour/midi_ring_buffer.cc12
-rw-r--r--libs/ardour/midi_scene_changer.cc14
-rw-r--r--libs/ardour/midi_source.cc62
-rw-r--r--libs/ardour/midi_state_tracker.cc4
-rw-r--r--libs/ardour/midi_stretch.cc2
-rw-r--r--libs/ardour/midi_track.cc40
-rw-r--r--libs/ardour/midi_ui.cc2
-rw-r--r--libs/ardour/mididm.cc4
-rw-r--r--libs/ardour/monitor_processor.cc4
-rw-r--r--libs/ardour/mtc_slave.cc74
-rw-r--r--libs/ardour/mute_control.cc2
-rw-r--r--libs/ardour/note_fixer.cc22
-rw-r--r--libs/ardour/onset_detector.cc6
-rw-r--r--libs/ardour/panner.cc2
-rw-r--r--libs/ardour/panner_shell.cc4
-rw-r--r--libs/ardour/playlist.cc342
-rw-r--r--libs/ardour/playlist_factory.cc2
-rw-r--r--libs/ardour/playlist_source.cc2
-rw-r--r--libs/ardour/plugin.cc4
-rw-r--r--libs/ardour/plugin_insert.cc52
-rw-r--r--libs/ardour/port_insert.cc34
-rw-r--r--libs/ardour/port_manager.cc2
-rw-r--r--libs/ardour/processor.cc2
-rw-r--r--libs/ardour/rb_effect.cc52
-rw-r--r--libs/ardour/rc_configuration.cc4
-rw-r--r--libs/ardour/region.cc172
-rw-r--r--libs/ardour/region_factory.cc6
-rw-r--r--libs/ardour/resampled_source.cc10
-rw-r--r--libs/ardour/return.cc8
-rw-r--r--libs/ardour/reverse.cc10
-rw-r--r--libs/ardour/route.cc118
-rw-r--r--libs/ardour/send.cc16
-rw-r--r--libs/ardour/session.cc186
-rw-r--r--libs/ardour/session_click.cc24
-rw-r--r--libs/ardour/session_events.cc40
-rw-r--r--libs/ardour/session_export.cc16
-rw-r--r--libs/ardour/session_ltc.cc120
-rw-r--r--libs/ardour/session_midi.cc62
-rw-r--r--libs/ardour/session_process.cc222
-rw-r--r--libs/ardour/session_state.cc30
-rw-r--r--libs/ardour/session_time.cc74
-rw-r--r--libs/ardour/session_transport.cc248
-rw-r--r--libs/ardour/session_vst.cc28
-rw-r--r--libs/ardour/sidechain.cc2
-rw-r--r--libs/ardour/slavable_automation_control.cc18
-rw-r--r--libs/ardour/slave.cc32
-rw-r--r--libs/ardour/smf_source.cc76
-rw-r--r--libs/ardour/sndfileimportable.cc20
-rw-r--r--libs/ardour/sndfilesource.cc122
-rw-r--r--libs/ardour/source.cc6
-rw-r--r--libs/ardour/source_factory.cc6
-rw-r--r--libs/ardour/srcfilesource.cc18
-rw-r--r--libs/ardour/st_stretch.cc30
-rw-r--r--libs/ardour/strip_silence.cc8
-rw-r--r--libs/ardour/tempo.cc686
-rw-r--r--libs/ardour/test/audio_region_read_test.cc8
-rw-r--r--libs/ardour/test/audio_region_test.h2
-rw-r--r--libs/ardour/test/bbt_test.cc2
-rw-r--r--libs/ardour/test/combine_regions_test.cc4
-rw-r--r--libs/ardour/test/framepos_minus_beats_test.cc46
-rw-r--r--libs/ardour/test/framepos_plus_beats_test.cc56
-rw-r--r--libs/ardour/test/framewalk_to_beats_test.cc58
-rw-r--r--libs/ardour/test/interpolation_test.cc32
-rw-r--r--libs/ardour/test/midi_clock_slave_test.cc10
-rw-r--r--libs/ardour/test/midi_clock_slave_test.h34
-rw-r--r--libs/ardour/test/playlist_read_test.cc2
-rw-r--r--libs/ardour/test/profiling/lots_of_regions.cc4
-rw-r--r--libs/ardour/test/tempo_test.cc146
-rw-r--r--libs/ardour/thread_buffers.cc2
-rw-r--r--libs/ardour/ticker.cc52
-rw-r--r--libs/ardour/track.cc94
-rw-r--r--libs/ardour/transient_detector.cc8
-rw-r--r--libs/ardour/unknown_processor.cc2
-rw-r--r--libs/ardour/uri_map.cc2
-rw-r--r--libs/ardour/utils.cc6
-rw-r--r--libs/ardour/vst_plugin.cc14
-rw-r--r--libs/ardour/wscript2
-rw-r--r--libs/audiographer/audiographer/general/analyser.h10
-rw-r--r--libs/audiographer/audiographer/general/chunker.h30
-rw-r--r--libs/audiographer/audiographer/general/deinterleaver.h24
-rw-r--r--libs/audiographer/audiographer/general/interleaver.h54
-rw-r--r--libs/audiographer/audiographer/general/loudness_reader.h6
-rw-r--r--libs/audiographer/audiographer/general/normalizer.h4
-rw-r--r--libs/audiographer/audiographer/general/peak_reader.h2
-rw-r--r--libs/audiographer/audiographer/general/sample_format_converter.h10
-rw-r--r--libs/audiographer/audiographer/general/silence_trimmer.h108
-rw-r--r--libs/audiographer/audiographer/general/sr_converter.h14
-rw-r--r--libs/audiographer/audiographer/process_context.h102
-rw-r--r--libs/audiographer/audiographer/routines.h22
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile.h2
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile_reader.h14
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile_writer.h16
-rw-r--r--libs/audiographer/audiographer/sndfile/tmp_file_rt.h24
-rw-r--r--libs/audiographer/audiographer/sndfile/tmp_file_sync.h4
-rw-r--r--libs/audiographer/audiographer/type_utils.h26
-rw-r--r--libs/audiographer/audiographer/types.h2
-rw-r--r--libs/audiographer/src/general/analyser.cc26
-rw-r--r--libs/audiographer/src/general/loudness_reader.cc12
-rw-r--r--libs/audiographer/src/general/normalizer.cc16
-rw-r--r--libs/audiographer/src/general/sample_format_converter.cc44
-rw-r--r--libs/audiographer/src/general/sr_converter.cc78
-rw-r--r--libs/audiographer/tests/general/chunker_test.cc116
-rw-r--r--libs/audiographer/tests/general/deinterleaver_test.cc68
-rw-r--r--libs/audiographer/tests/general/interleaver_deinterleaver_test.cc58
-rw-r--r--libs/audiographer/tests/general/interleaver_test.cc62
-rw-r--r--libs/audiographer/tests/general/normalizer_test.cc12
-rw-r--r--libs/audiographer/tests/general/peak_reader_test.cc8
-rw-r--r--libs/audiographer/tests/general/sample_format_converter_test.cc136
-rw-r--r--libs/audiographer/tests/general/silence_trimmer_test.cc104
-rw-r--r--libs/audiographer/tests/general/sr_converter_test.cc68
-rw-r--r--libs/audiographer/tests/general/threader_test.cc66
-rw-r--r--libs/audiographer/tests/sndfile/tmp_file_test.cc12
-rw-r--r--libs/audiographer/tests/type_utils_test.cc16
-rw-r--r--libs/audiographer/tests/utils.h30
-rw-r--r--libs/audiographer/tests/utils/identity_vertex_test.cc42
-rw-r--r--libs/backends/alsa/alsa_audiobackend.cc4
-rw-r--r--libs/backends/alsa/alsa_audiobackend.h6
-rw-r--r--libs/backends/alsa/alsa_slave.cc4
-rw-r--r--libs/backends/coreaudio/coreaudio_backend.cc4
-rw-r--r--libs/backends/coreaudio/coreaudio_backend.h4
-rw-r--r--libs/backends/coreaudio/coreaudio_pcmio.cc36
-rw-r--r--libs/backends/coreaudio/coreaudio_pcmio.h2
-rw-r--r--libs/backends/dummy/dummy_audiobackend.cc4
-rw-r--r--libs/backends/dummy/dummy_audiobackend.h6
-rw-r--r--libs/backends/dummy/dummy_midi_seq.h2
-rw-r--r--libs/backends/jack/jack_audiobackend.cc12
-rw-r--r--libs/backends/jack/jack_audiobackend.h10
-rw-r--r--libs/backends/jack/jack_session.cc6
-rw-r--r--libs/backends/jack/weak_libjack.h8
-rw-r--r--libs/backends/portaudio/audio_utils.h8
-rw-r--r--libs/backends/portaudio/cycle_timer.h2
-rw-r--r--libs/backends/portaudio/portaudio_backend.cc12
-rw-r--r--libs/backends/portaudio/portaudio_backend.h8
-rw-r--r--libs/backends/portaudio/portaudio_io.cc58
-rw-r--r--libs/backends/portaudio/portaudio_io.h6
-rw-r--r--libs/canvas/framed_curve.cc2
-rw-r--r--libs/clearlooks-newer/clearlooks_draw.c86
-rw-r--r--libs/clearlooks-newer/clearlooks_style.c50
-rw-r--r--libs/clearlooks-newer/clearlooks_types.h6
-rw-r--r--libs/midi++2/channel.cc2
-rw-r--r--libs/midi++2/ipmidi_port.cc2
-rw-r--r--libs/midi++2/midi++/channel.h2
-rw-r--r--libs/midi++2/midi++/ipmidi_port.h2
-rw-r--r--libs/midi++2/midi++/mmc.h2
-rw-r--r--libs/midi++2/midi++/parser.h16
-rw-r--r--libs/midi++2/midi++/port.h4
-rw-r--r--libs/midi++2/midi++/types.h2
-rw-r--r--libs/midi++2/mtc.cc48
-rw-r--r--libs/panners/1in2out/panner_1in2out.cc6
-rw-r--r--libs/panners/1in2out/panner_1in2out.h2
-rw-r--r--libs/panners/2in2out/panner_2in2out.cc6
-rw-r--r--libs/panners/2in2out/panner_2in2out.h2
-rw-r--r--libs/panners/stereobalance/panner_balance.cc4
-rw-r--r--libs/panners/stereobalance/panner_balance.h2
-rw-r--r--libs/panners/vbap/vbap.cc2
-rw-r--r--libs/panners/vbap/vbap.h2
-rw-r--r--libs/pbd/convert.cc16
-rw-r--r--libs/pbd/pbd/convert.h4
-rw-r--r--libs/pbd/stacktrace.cc14
-rw-r--r--libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc16
-rw-r--r--libs/surfaces/cc121/cc121.cc6
-rw-r--r--libs/surfaces/control_protocol/basic_ui.cc36
-rw-r--r--libs/surfaces/control_protocol/control_protocol/basic_ui.h14
-rw-r--r--libs/surfaces/faderport/faderport.cc4
-rw-r--r--libs/surfaces/faderport8/actions.cc16
-rw-r--r--libs/surfaces/faderport8/faderport8.cc6
-rw-r--r--libs/surfaces/faderport8/fp8_strip.cc12
-rw-r--r--libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc10
-rw-r--r--libs/surfaces/frontier/tranzport/tranzport_control_protocol.h8
-rw-r--r--libs/surfaces/generic_midi/generic_midi_control_protocol.cc2
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc32
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.h8
-rw-r--r--libs/surfaces/mackie/mcp_buttons.cc8
-rw-r--r--libs/surfaces/mackie/strip.cc8
-rw-r--r--libs/surfaces/osc/osc.cc32
-rw-r--r--libs/surfaces/osc/osc.h4
-rw-r--r--libs/surfaces/osc/osc_global_observer.cc32
-rw-r--r--libs/surfaces/osc/osc_global_observer.h2
-rw-r--r--libs/surfaces/push2/canvas.cc46
-rw-r--r--libs/surfaces/push2/canvas.h8
-rw-r--r--libs/surfaces/push2/mix.cc4
-rw-r--r--libs/surfaces/push2/push2.cc8
-rw-r--r--libs/surfaces/push2/track_mix.cc26
-rw-r--r--libs/surfaces/tranzport/button_events.cc2
-rw-r--r--libs/surfaces/tranzport/general.cc6
-rw-r--r--libs/surfaces/tranzport/init.cc2
-rw-r--r--libs/surfaces/tranzport/show.cc6
-rw-r--r--libs/surfaces/tranzport/tranzport_control_protocol.h8
-rw-r--r--libs/timecode/src/time.cc80
-rw-r--r--libs/timecode/timecode/time.h10
-rw-r--r--libs/waveview/wave_view.cc24
-rw-r--r--libs/waveview/waveview/wave_view.h8
-rw-r--r--libs/waveview/waveview/wave_view_private.h32
-rw-r--r--nutemp/t.cc12
-rw-r--r--nutemp/t.h20
-rw-r--r--session_utils/export.cc14
-rw-r--r--session_utils/fix_bbtppq.cc12
-rw-r--r--tools/bb/bb.cc4
-rw-r--r--tools/omf/omftool.cc18
-rw-r--r--tools/omf/omftool.h2
-rw-r--r--tools/sftest.cc4
577 files changed, 9008 insertions, 9002 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc
index bf218fb8d8..61f23d54e9 100644
--- a/gtk2_ardour/add_route_dialog.cc
+++ b/gtk2_ardour/add_route_dialog.cc
@@ -204,12 +204,12 @@ You may select:\n \
desc_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
desc_scroller->add (trk_template_desc);
- //this is the outer frame that surrounds the description and the settings-table
- trk_template_outer_frame.set_name (X_("TextHighlightFrame"));
+ //this is the outer sample that surrounds the description and the settings-table
+ trk_template_outer_sample.set_name (X_("TextHighlightFrame"));
//this is the "inner frame" that surrounds the description text
- trk_template_desc_frame.set_name (X_("TextHighlightFrame"));
- trk_template_desc_frame.add (*desc_scroller);
+ trk_template_desc_sample.set_name (X_("TextHighlightFrame"));
+ trk_template_desc_sample.add (*desc_scroller);
/* template_chooser is the treeview showing available templates */
trk_template_model = TreeStore::create (track_template_columns);
@@ -238,14 +238,14 @@ You may select:\n \
settings_table->set_border_width (12);
VBox* settings_vbox = manage (new VBox);
- settings_vbox->pack_start(trk_template_desc_frame , true, true);
+ settings_vbox->pack_start(trk_template_desc_sample , true, true);
settings_vbox->pack_start(*settings_table , true, true);
settings_vbox->set_border_width (4);
- trk_template_outer_frame.add (*settings_vbox);
+ trk_template_outer_sample.add (*settings_vbox);
template_hbox->pack_start (*template_scroller, true, true);
- template_hbox->pack_start (trk_template_outer_frame, true, true);
+ template_hbox->pack_start (trk_template_outer_sample, true, true);
vbox->pack_start (*template_hbox, true, true);
diff --git a/gtk2_ardour/add_route_dialog.h b/gtk2_ardour/add_route_dialog.h
index 351022c101..a637e1e6b7 100644
--- a/gtk2_ardour/add_route_dialog.h
+++ b/gtk2_ardour/add_route_dialog.h
@@ -141,8 +141,8 @@ private:
void trk_template_row_selected ();
Gtk::TextView trk_template_desc;
- Gtk::Frame trk_template_outer_frame;
- Gtk::Frame trk_template_desc_frame;
+ Gtk::Frame trk_template_outer_sample;
+ Gtk::Frame trk_template_desc_sample;
void reset_template_option_visibility ();
void new_group_dialog_finished (int, RouteGroupDialog*);
diff --git a/gtk2_ardour/add_video_dialog.cc b/gtk2_ardour/add_video_dialog.cc
index 2e092bb4da..22679755a5 100644
--- a/gtk2_ardour/add_video_dialog.cc
+++ b/gtk2_ardour/add_video_dialog.cc
@@ -693,7 +693,7 @@ AddVideoDialog::request_preview(std::string u)
clip_yoff = (PREVIEW_HEIGHT - clip_height)/2;
char url[2048];
- snprintf(url, sizeof(url), "%s%s?frame=%lli&w=%d&h=%di&file=%s&format=rgb"
+ snprintf(url, sizeof(url), "%s%s?sample=%lli&w=%d&h=%di&file=%s&format=rgb"
, video_server_url.c_str()
, (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
, (long long) (video_duration * seek_slider.get_value() / 1000.0)
diff --git a/gtk2_ardour/analysis_window.cc b/gtk2_ardour/analysis_window.cc
index e078a7ee2b..91e6d13362 100644
--- a/gtk2_ardour/analysis_window.cc
+++ b/gtk2_ardour/analysis_window.cc
@@ -260,7 +260,7 @@ AnalysisWindow::analyze_data (Gtk::Button * /*button*/)
int n;
for (int channel = 0; channel < n_inputs; channel++) {
- framecnt_t x = 0;
+ samplecnt_t x = 0;
while (x < j->length()) {
// TODO: What about stereo+ channels? composite all to one, I guess
@@ -313,8 +313,8 @@ AnalysisWindow::analyze_data (Gtk::Button * /*button*/)
int n;
for (unsigned int channel = 0; channel < arv->region()->n_channels(); channel++) {
- framecnt_t x = 0;
- framecnt_t length = arv->region()->length();
+ samplecnt_t x = 0;
+ samplecnt_t length = arv->region()->length();
while (x < length) {
// TODO: What about stereo+ channels? composite all to one, I guess
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 0e75652856..7819a53fab 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -202,7 +202,7 @@ using namespace Editing;
ARDOUR_UI *ARDOUR_UI::theArdourUI = 0;
-sigc::signal<void, framepos_t, bool, framepos_t> ARDOUR_UI::Clock;
+sigc::signal<void, samplepos_t, bool, samplepos_t> ARDOUR_UI::Clock;
sigc::signal<void> ARDOUR_UI::CloseAllDialogs;
static bool
@@ -1581,7 +1581,7 @@ ARDOUR_UI::set_fps_timeout_connection ()
* signals to the GUI Thread..
*/
interval = floor(500. /* update twice per FPS, since Glib::signal_timeout is very irregular */
- * _session->frame_rate() / _session->nominal_frame_rate()
+ * _session->sample_rate() / _session->nominal_sample_rate()
/ _session->timecode_frames_per_second()
);
#ifdef PLATFORM_WINDOWS
@@ -1601,7 +1601,7 @@ ARDOUR_UI::set_fps_timeout_connection ()
}
void
-ARDOUR_UI::update_sample_rate (framecnt_t)
+ARDOUR_UI::update_sample_rate (samplecnt_t)
{
char buf[64];
@@ -1613,7 +1613,7 @@ ARDOUR_UI::update_sample_rate (framecnt_t)
} else {
- framecnt_t rate = AudioEngine::instance()->sample_rate();
+ samplecnt_t rate = AudioEngine::instance()->sample_rate();
if (rate == 0) {
/* no sample rate available */
@@ -1789,43 +1789,43 @@ ARDOUR_UI::update_disk_space()
return;
}
- boost::optional<framecnt_t> opt_frames = _session->available_capture_duration();
+ boost::optional<samplecnt_t> opt_samples = _session->available_capture_duration();
char buf[64];
- framecnt_t fr = _session->frame_rate();
+ samplecnt_t fr = _session->sample_rate();
if (fr == 0) {
/* skip update - no SR available */
return;
}
- if (!opt_frames) {
+ if (!opt_samples) {
/* Available space is unknown */
snprintf (buf, sizeof (buf), "%s", _("Disk: <span foreground=\"green\">Unknown</span>"));
- } else if (opt_frames.get_value_or (0) == max_framecnt) {
+ } else if (opt_samples.get_value_or (0) == max_samplecnt) {
snprintf (buf, sizeof (buf), "%s", _("Disk: <span foreground=\"green\">24hrs+</span>"));
} else {
rec_enabled_streams = 0;
_session->foreach_route (this, &ARDOUR_UI::count_recenabled_streams, false);
- framecnt_t frames = opt_frames.get_value_or (0);
+ samplecnt_t samples = opt_samples.get_value_or (0);
if (rec_enabled_streams) {
- frames /= rec_enabled_streams;
+ samples /= rec_enabled_streams;
}
int hrs;
int mins;
int secs;
- hrs = frames / (fr * 3600);
+ hrs = samples / (fr * 3600);
if (hrs > 24) {
snprintf (buf, sizeof (buf), "%s", _("Disk: <span foreground=\"green\">&gt;24 hrs</span>"));
} else {
- frames -= hrs * fr * 3600;
- mins = frames / (fr * 60);
- frames -= mins * fr * 60;
- secs = frames / fr;
+ samples -= hrs * fr * 3600;
+ mins = samples / (fr * 60);
+ samples -= mins * fr * 60;
+ secs = samples / fr;
bool const low = (hrs == 0 && mins <= 30);
@@ -2180,7 +2180,7 @@ ARDOUR_UI::transport_goto_start ()
*/
if (editor) {
- editor->center_screen (_session->current_start_frame ());
+ editor->center_screen (_session->current_start_sample ());
}
}
}
@@ -2208,30 +2208,30 @@ ARDOUR_UI::transport_goto_wallclock ()
time_t now;
struct tm tmnow;
- framepos_t frames;
+ samplepos_t samples;
time (&now);
localtime_r (&now, &tmnow);
- framecnt_t frame_rate = _session->frame_rate();
+ samplecnt_t sample_rate = _session->sample_rate();
- if (frame_rate == 0) {
+ if (sample_rate == 0) {
/* no frame rate available */
return;
}
- frames = tmnow.tm_hour * (60 * 60 * frame_rate);
- frames += tmnow.tm_min * (60 * frame_rate);
- frames += tmnow.tm_sec * frame_rate;
+ samples = tmnow.tm_hour * (60 * 60 * sample_rate);
+ samples += tmnow.tm_min * (60 * sample_rate);
+ samples += tmnow.tm_sec * sample_rate;
- _session->request_locate (frames, _session->transport_rolling ());
+ _session->request_locate (samples, _session->transport_rolling ());
/* force displayed area in editor to start no matter
what "follow playhead" setting is.
*/
if (editor) {
- editor->center_screen (frames);
+ editor->center_screen (samples);
}
}
}
@@ -2240,15 +2240,15 @@ void
ARDOUR_UI::transport_goto_end ()
{
if (_session) {
- framepos_t const frame = _session->current_end_frame();
- _session->request_locate (frame);
+ samplepos_t const sample = _session->current_end_sample();
+ _session->request_locate (sample);
/* force displayed area in editor to start no matter
what "follow playhead" setting is.
*/
if (editor) {
- editor->center_screen (frame);
+ editor->center_screen (sample);
}
}
}
@@ -2461,9 +2461,9 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
* want to do this.
*/
- if (UIConfiguration::instance().get_follow_edits() && ( editor->get_selection().time.front().start == _session->transport_frame() ) ) { //if playhead is exactly at the start of a range, we can assume it was placed there by follow_edits
+ if (UIConfiguration::instance().get_follow_edits() && ( editor->get_selection().time.front().start == _session->transport_sample() ) ) { //if playhead is exactly at the start of a range, we can assume it was placed there by follow_edits
_session->request_play_range (&editor->get_selection().time, true);
- _session->set_requested_return_frame( editor->get_selection().time.front().start ); //force an auto-return here
+ _session->set_requested_return_sample( editor->get_selection().time.front().start ); //force an auto-return here
}
_session->request_transport_speed (1.0f);
}
@@ -2706,7 +2706,7 @@ ARDOUR_UI::update_clocks ()
if (!_session) return;
if (editor && !editor->dragging_playhead()) {
- Clock (_session->audible_frame(), false, editor->get_preferred_edit_position (EDIT_IGNORE_PHEAD)); /* EMIT_SIGNAL */
+ Clock (_session->audible_sample(), false, editor->get_preferred_edit_position (EDIT_IGNORE_PHEAD)); /* EMIT_SIGNAL */
}
}
@@ -4345,7 +4345,7 @@ ARDOUR_UI::cleanup_peakfiles ()
RegionSelection rs;
TrackViewList empty;
empty.clear();
- editor->get_regions_after(rs, (framepos_t) 0, empty);
+ editor->get_regions_after(rs, (samplepos_t) 0, empty);
std::list<RegionView*> views = rs.by_layer();
// remove displayed audio-region-views waveforms
@@ -4794,10 +4794,10 @@ ARDOUR_UI::add_video (Gtk::Window* float_window)
LTCFileReader ltcr (audio_from_video, video_timeline->get_video_file_fps());
/* TODO ASK user which channel: 0 .. ltcr->channels() - 1 */
- ltc_seq = ltcr.read_ltc (/*channel*/ 0, /*max LTC frames to decode*/ 15);
+ ltc_seq = ltcr.read_ltc (/*channel*/ 0, /*max LTC samples to decode*/ 15);
/* TODO seek near end of file, and read LTC until end.
- * if it fails to find any LTC frames, scan complete file
+ * if it fails to find any LTC samples, scan complete file
*
* calculate drift of LTC compared to video-duration,
* ask user for reference (timecode from start/mid/end)
@@ -4813,16 +4813,16 @@ ARDOUR_UI::add_video (Gtk::Window* float_window)
} else {
/* the very first TC in the file is somteimes not aligned properly */
int i = ltc_seq.size() -1;
- ARDOUR::frameoffset_t video_start_offset =
- _session->nominal_frame_rate() * (ltc_seq[i].timecode_sec - ltc_seq[i].framepos_sec);
+ ARDOUR::sampleoffset_t video_start_offset =
+ _session->nominal_sample_rate() * (ltc_seq[i].timecode_sec - ltc_seq[i].framepos_sec);
PBD::info << string_compose (_("Align video-start to %1 [samples]"), video_start_offset) << endmsg;
video_timeline->set_offset(video_start_offset);
}
}
_session->maybe_update_session_range(
- std::max(video_timeline->get_offset(), (ARDOUR::frameoffset_t) 0),
- std::max(video_timeline->get_offset() + video_timeline->get_duration(), (ARDOUR::frameoffset_t) 0));
+ std::max(video_timeline->get_offset(), (ARDOUR::sampleoffset_t) 0),
+ std::max(video_timeline->get_offset() + video_timeline->get_duration(), (ARDOUR::sampleoffset_t) 0));
if (add_video_dialog->launch_xjadeo() && local_file) {
@@ -4988,7 +4988,7 @@ ARDOUR_UI::keyboard_settings () const
}
void
-ARDOUR_UI::create_xrun_marker (framepos_t where)
+ARDOUR_UI::create_xrun_marker (samplepos_t where)
{
if (_session) {
Location *location = new Location (*_session, where, where, _("xrun"), Location::IsMark, 0);
@@ -5005,7 +5005,7 @@ ARDOUR_UI::halt_on_xrun_message ()
}
void
-ARDOUR_UI::xrun_handler (framepos_t where)
+ARDOUR_UI::xrun_handler (samplepos_t where)
{
if (!_session) {
return;
@@ -5229,7 +5229,7 @@ what you would like to do.\n"), PROGRAM_NAME));
}
int
-ARDOUR_UI::sr_mismatch_dialog (framecnt_t desired, framecnt_t actual)
+ARDOUR_UI::sr_mismatch_dialog (samplecnt_t desired, samplecnt_t actual)
{
HBox* hbox = new HBox();
Image* image = new Image (Stock::DIALOG_WARNING, ICON_SIZE_DIALOG);
@@ -5262,7 +5262,7 @@ audio may be played at the wrong sample rate.\n"), desired, PROGRAM_NAME, actual
}
void
-ARDOUR_UI::sr_mismatch_message (framecnt_t desired, framecnt_t actual)
+ARDOUR_UI::sr_mismatch_message (samplecnt_t desired, samplecnt_t actual)
{
MessageDialog msg (string_compose (_("\
This session was created with a sample rate of %1 Hz, but\n\
@@ -5286,7 +5286,7 @@ ARDOUR_UI::use_config ()
}
void
-ARDOUR_UI::update_transport_clocks (framepos_t pos)
+ARDOUR_UI::update_transport_clocks (samplepos_t pos)
{
if (UIConfiguration::instance().get_primary_clock_delta_edit_cursor()) {
primary_clock->set (pos, false, editor->get_preferred_edit_position (EDIT_IGNORE_PHEAD));
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index fbe1486736..d98977c270 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -228,12 +228,12 @@ public:
static PublicEditor* _instance;
- /** Emitted frequently with the audible frame, false, and the edit point as
+ /** Emitted frequently with the audible sample, false, and the edit point as
* parameters respectively.
*
* (either RapidScreenUpdate || SuperRapidScreenUpdate - user-config)
*/
- static sigc::signal<void, framepos_t, bool, framepos_t> Clock;
+ static sigc::signal<void, samplepos_t, bool, samplepos_t> Clock;
static void close_all_dialogs () { CloseAllDialogs(); }
static sigc::signal<void> CloseAllDialogs;
@@ -249,8 +249,8 @@ public:
gboolean configure_handler (GdkEventConfigure* conf);
void halt_on_xrun_message ();
- void xrun_handler (framepos_t);
- void create_xrun_marker (framepos_t);
+ void xrun_handler (samplepos_t);
+ void create_xrun_marker (samplepos_t);
GUIObjectState* gui_object_state;
@@ -437,7 +437,7 @@ private:
void start_clocking ();
void stop_clocking ();
- void update_transport_clocks (framepos_t pos);
+ void update_transport_clocks (samplepos_t pos);
void record_state_changed ();
std::list<MidiTracer*> _midi_tracer_windows;
@@ -445,7 +445,7 @@ private:
/* Transport Control */
Gtk::Table transport_table;
- Gtk::Frame transport_frame;
+ Gtk::Frame transport_sample;
Gtk::HBox transport_hbox;
ArdourWidgets::ArdourVSpacer* secondary_clock_spacer;
@@ -604,7 +604,7 @@ private:
void update_buffer_load ();
Gtk::Label sample_rate_label;
- void update_sample_rate (ARDOUR::framecnt_t);
+ void update_sample_rate (ARDOUR::samplecnt_t);
Gtk::Label format_label;
void update_format ();
@@ -777,8 +777,8 @@ private:
void session_dialog (std::string);
int pending_state_dialog ();
- int sr_mismatch_dialog (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
- void sr_mismatch_message (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
+ int sr_mismatch_dialog (ARDOUR::samplecnt_t, ARDOUR::samplecnt_t);
+ void sr_mismatch_message (ARDOUR::samplecnt_t, ARDOUR::samplecnt_t);
Gtk::MenuItem* jack_disconnect_item;
Gtk::MenuItem* jack_reconnect_item;
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc
index a7794faf78..07e835e62f 100644
--- a/gtk2_ardour/ardour_ui2.cc
+++ b/gtk2_ardour/ardour_ui2.cc
@@ -456,19 +456,19 @@ ARDOUR_UI::setup_transport ()
transport_table.set_row_spacings (4);
transport_table.set_border_width (2);
- transport_frame.set_name ("TransportFrame");
- transport_frame.set_shadow_type (Gtk::SHADOW_NONE);
+ transport_sample.set_name ("TransportFrame");
+ transport_sample.set_shadow_type (Gtk::SHADOW_NONE);
/* An event box to hold the table. We use this because we want specific
control over the background color, and without this event box,
- nothing inside the transport_frame actually draws a background. We
+ nothing inside the transport_sample actually draws a background. We
would therefore end up seeing the background of the parent widget,
which is probably some default color. Adding the EventBox adds a
widget that will draw the background, using a style based on
the parent, "TransportFrame".
*/
Gtk::EventBox* ebox = manage (new Gtk::EventBox);
- transport_frame.add (*ebox);
+ transport_sample.add (*ebox);
ebox->add (transport_table);
/* transport controls sub-group */
diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc
index 87beab6b0e..307eac5451 100644
--- a/gtk2_ardour/ardour_ui_dependents.cc
+++ b/gtk2_ardour/ardour_ui_dependents.cc
@@ -296,9 +296,9 @@ ARDOUR_UI::setup_windows ()
main_vpacker.pack_start (top_packer, false, false);
- /* now add the transport frame to the top of main window */
+ /* now add the transport sample to the top of main window */
- main_vpacker.pack_start (transport_frame, false, false);
+ main_vpacker.pack_start (transport_sample, false, false);
main_vpacker.pack_start (_tabs, true, true);
#ifdef TOP_MENUBAR
@@ -336,7 +336,7 @@ ARDOUR_UI::setup_windows ()
*/
_main_window.add (main_vpacker);
- transport_frame.show_all ();
+ transport_sample.show_all ();
const XMLNode* mnode = main_window_settings ();
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 873d07e9a6..39a92aee86 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -568,7 +568,7 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_action (transport_actions, X_("primary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::MinSec, false));
ActionManager::session_sensitive_actions.push_back (act);
- act = global_actions.register_action (transport_actions, X_("primary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Frames, false));
+ act = global_actions.register_action (transport_actions, X_("primary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Samples, false));
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_action (transport_actions, X_("secondary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Timecode, false));
@@ -577,7 +577,7 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_action (transport_actions, X_("secondary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::MinSec, false));
ActionManager::session_sensitive_actions.push_back (act);
- act = global_actions.register_action (transport_actions, X_("secondary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Frames, false));
+ act = global_actions.register_action (transport_actions, X_("secondary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Samples, false));
ActionManager::session_sensitive_actions.push_back (act);
act = global_actions.register_toggle_action (transport_actions, X_("SessionMonitorIn"), _("All Input"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_monitoring_in));
diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc
index 14a8695c8b..f624e660ee 100644
--- a/gtk2_ardour/ardour_ui_options.cc
+++ b/gtk2_ardour/ardour_ui_options.cc
@@ -562,8 +562,8 @@ ARDOUR_UI::reset_main_clocks ()
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::reset_main_clocks)
if (_session) {
- primary_clock->set (_session->audible_frame(), true);
- secondary_clock->set (_session->audible_frame(), true);
+ primary_clock->set (_session->audible_sample(), true);
+ secondary_clock->set (_session->audible_sample(), true);
} else {
primary_clock->set (0, true);
secondary_clock->set (0, true);
diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h
index eafe822078..cf61b99aca 100644
--- a/gtk2_ardour/au_pluginui.h
+++ b/gtk2_ardour/au_pluginui.h
@@ -132,7 +132,7 @@ private:
NSWindow* cocoa_window;
NSView* au_view;
- NSRect last_au_frame;
+ NSRect last_au_sample;
bool in_live_resize;
uint32_t plugin_requested_resize;
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index 3c5d065264..ea61979311 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -453,7 +453,7 @@ AudioClock::get_field (Field f)
case Timecode_Seconds:
return edit_string.substr (7, 2);
break;
- case Timecode_Frames:
+ case Timecode_frames:
return edit_string.substr (10, 2);
break;
case MS_Hours:
@@ -477,7 +477,7 @@ AudioClock::get_field (Field f)
case Ticks:
return edit_string.substr (8, 4);
break;
- case AudioFrames:
+ case S_Samples:
return edit_string;
break;
}
@@ -504,7 +504,7 @@ AudioClock::end_edit (bool modify)
ok = minsec_validate_edit (edit_string);
break;
- case Frames:
+ case Samples:
if (edit_string.length() < 1) {
edit_string = pre_edit_string;
}
@@ -520,27 +520,27 @@ AudioClock::end_edit (bool modify)
} else {
editing = false;
- framepos_t pos = 0; /* stupid gcc */
+ samplepos_t pos = 0; /* stupid gcc */
switch (_mode) {
case Timecode:
- pos = frames_from_timecode_string (edit_string);
+ pos = samples_from_timecode_string (edit_string);
break;
case BBT:
if (is_duration) {
- pos = frame_duration_from_bbt_string (bbt_reference_time, edit_string);
+ pos = sample_duration_from_bbt_string (bbt_reference_time, edit_string);
} else {
- pos = frames_from_bbt_string (0, edit_string);
+ pos = samples_from_bbt_string (0, edit_string);
}
break;
case MinSec:
- pos = frames_from_minsec_string (edit_string);
+ pos = samples_from_minsec_string (edit_string);
break;
- case Frames:
- pos = frames_from_audioframes_string (edit_string);
+ case Samples:
+ pos = samples_from_audioframes_string (edit_string);
break;
}
@@ -575,10 +575,10 @@ AudioClock::drop_focus ()
}
}
-framecnt_t
-AudioClock::parse_as_frames_distance (const std::string& str)
+samplecnt_t
+AudioClock::parse_as_samples_distance (const std::string& str)
{
- framecnt_t f;
+ samplecnt_t f;
if (sscanf (str.c_str(), "%" PRId64, &f) == 1) {
return f;
@@ -587,10 +587,10 @@ AudioClock::parse_as_frames_distance (const std::string& str)
return 0;
}
-framecnt_t
+samplecnt_t
AudioClock::parse_as_minsec_distance (const std::string& str)
{
- framecnt_t sr = _session->frame_rate();
+ samplecnt_t sr = _session->sample_rate();
int msecs;
int secs;
int mins;
@@ -637,12 +637,12 @@ AudioClock::parse_as_minsec_distance (const std::string& str)
return 0;
}
-framecnt_t
+samplecnt_t
AudioClock::parse_as_timecode_distance (const std::string& str)
{
double fps = _session->timecode_frames_per_second();
- framecnt_t sr = _session->frame_rate();
- int frames;
+ samplecnt_t sr = _session->sample_rate();
+ int samples;
int secs;
int mins;
int hrs;
@@ -652,32 +652,32 @@ AudioClock::parse_as_timecode_distance (const std::string& str)
return 0;
case 1:
case 2:
- sscanf (str.c_str(), "%" PRId32, &frames);
- return llrint ((frames/(float)fps) * sr);
+ sscanf (str.c_str(), "%" PRId32, &samples);
+ return llrint ((samples/(float)fps) * sr);
case 3:
- sscanf (str.c_str(), "%1" PRId32 "%" PRId32, &secs, &frames);
- return (secs * sr) + llrint ((frames/(float)fps) * sr);
+ sscanf (str.c_str(), "%1" PRId32 "%" PRId32, &secs, &samples);
+ return (secs * sr) + llrint ((samples/(float)fps) * sr);
case 4:
- sscanf (str.c_str(), "%2" PRId32 "%" PRId32, &secs, &frames);
- return (secs * sr) + llrint ((frames/(float)fps) * sr);
+ sscanf (str.c_str(), "%2" PRId32 "%" PRId32, &secs, &samples);
+ return (secs * sr) + llrint ((samples/(float)fps) * sr);
case 5:
- sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &frames);
- return (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
+ sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &samples);
+ return (mins * 60 * sr) + (secs * sr) + llrint ((samples/(float)fps) * sr);
case 6:
- sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &frames);
- return (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
+ sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &samples);
+ return (mins * 60 * sr) + (secs * sr) + llrint ((samples/(float)fps) * sr);
case 7:
- sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &frames);
- return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
+ sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &samples);
+ return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + llrint ((samples/(float)fps) * sr);
case 8:
- sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &frames);
- return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
+ sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &samples);
+ return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + llrint ((samples/(float)fps) * sr);
default:
break;
@@ -686,21 +686,21 @@ AudioClock::parse_as_timecode_distance (const std::string& str)
return 0;
}
-framecnt_t
+samplecnt_t
AudioClock::parse_as_bbt_distance (const std::string&)
{
return 0;
}
-framecnt_t
+samplecnt_t
AudioClock::parse_as_distance (const std::string& instr)
{
switch (_mode) {
case Timecode:
return parse_as_timecode_distance (instr);
break;
- case Frames:
- return parse_as_frames_distance (instr);
+ case Samples:
+ return parse_as_samples_distance (instr);
break;
case BBT:
return parse_as_bbt_distance (instr);
@@ -730,7 +730,7 @@ AudioClock::end_edit_relative (bool add)
ok = minsec_validate_edit (edit_string);
break;
- case Frames:
+ case Samples:
break;
}
@@ -744,21 +744,21 @@ AudioClock::end_edit_relative (bool add)
return;
}
- framecnt_t frames = parse_as_distance (input_string);
+ samplecnt_t samples = parse_as_distance (input_string);
editing = false;
editing = false;
_layout->set_attributes (normal_attributes);
- if (frames != 0) {
+ if (samples != 0) {
if (add) {
- set (current_time() + frames, true);
+ set (current_time() + samples, true);
} else {
- framepos_t c = current_time();
+ samplepos_t c = current_time();
- if (c > frames || _negative_allowed) {
- set (c - frames, true);
+ if (c > samples || _negative_allowed) {
+ set (c - samples, true);
} else {
set (0, true);
}
@@ -794,7 +794,7 @@ AudioClock::session_configuration_changed (std::string p)
return;
}
- framecnt_t current;
+ samplecnt_t current;
switch (_mode) {
case Timecode:
@@ -811,7 +811,7 @@ AudioClock::session_configuration_changed (std::string p)
}
void
-AudioClock::set (framepos_t when, bool force, framecnt_t offset)
+AudioClock::set (samplepos_t when, bool force, samplecnt_t offset)
{
if ((!force && !is_visible()) || _session == 0) {
return;
@@ -866,8 +866,8 @@ AudioClock::set (framepos_t when, bool force, framecnt_t offset)
set_minsec (when, force);
break;
- case Frames:
- set_frames (when, force);
+ case Samples:
+ set_samples (when, force);
break;
}
}
@@ -970,7 +970,7 @@ AudioClock::set_out_of_bounds (bool negative)
}
void
-AudioClock::set_frames (framepos_t when, bool /*force*/)
+AudioClock::set_samples (samplepos_t when, bool /*force*/)
{
char buf[32];
bool negative = false;
@@ -998,7 +998,7 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
}
if (_with_info) {
- framecnt_t rate = _session->frame_rate();
+ samplecnt_t rate = _session->sample_rate();
if (fmod (rate, 100.0) == 0.0) {
sprintf (buf, "%.1fkHz", rate/1000.0);
@@ -1020,9 +1020,9 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
}
void
-AudioClock::print_minsec (framepos_t when, char* buf, size_t bufsize, float frame_rate)
+AudioClock::print_minsec (samplepos_t when, char* buf, size_t bufsize, float sample_rate)
{
- framecnt_t left;
+ samplecnt_t left;
int hrs;
int mins;
int secs;
@@ -1037,13 +1037,13 @@ AudioClock::print_minsec (framepos_t when, char* buf, size_t bufsize, float fram
}
left = when;
- hrs = (int) floor (left / (frame_rate * 60.0f * 60.0f));
- left -= (framecnt_t) floor (hrs * frame_rate * 60.0f * 60.0f);
- mins = (int) floor (left / (frame_rate * 60.0f));
- left -= (framecnt_t) floor (mins * frame_rate * 60.0f);
- secs = (int) floor (left / (float) frame_rate);
- left -= (framecnt_t) floor ((double)(secs * frame_rate));
- millisecs = floor (left * 1000.0 / (float) frame_rate);
+ hrs = (int) floor (left / (sample_rate * 60.0f * 60.0f));
+ left -= (samplecnt_t) floor (hrs * sample_rate * 60.0f * 60.0f);
+ mins = (int) floor (left / (sample_rate * 60.0f));
+ left -= (samplecnt_t) floor (mins * sample_rate * 60.0f);
+ secs = (int) floor (left / (float) sample_rate);
+ left -= (samplecnt_t) floor ((double)(secs * sample_rate));
+ millisecs = floor (left * 1000.0 / (float) sample_rate);
if (negative) {
snprintf (buf, bufsize, "-%02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs);
@@ -1054,7 +1054,7 @@ AudioClock::print_minsec (framepos_t when, char* buf, size_t bufsize, float fram
}
void
-AudioClock::set_minsec (framepos_t when, bool /*force*/)
+AudioClock::set_minsec (samplepos_t when, bool /*force*/)
{
char buf[32];
@@ -1069,7 +1069,7 @@ AudioClock::set_minsec (framepos_t when, bool /*force*/)
if (when >= _limit_pos || when <= -_limit_pos) {
set_out_of_bounds (when < 0);
} else {
- print_minsec (when, buf, sizeof (buf), _session->frame_rate());
+ print_minsec (when, buf, sizeof (buf), _session->sample_rate());
_layout->set_text (buf);
}
@@ -1077,7 +1077,7 @@ AudioClock::set_minsec (framepos_t when, bool /*force*/)
}
void
-AudioClock::set_timecode (framepos_t when, bool /*force*/)
+AudioClock::set_timecode (samplepos_t when, bool /*force*/)
{
Timecode::Time TC;
bool negative = false;
@@ -1113,7 +1113,7 @@ AudioClock::set_timecode (framepos_t when, bool /*force*/)
}
void
-AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/)
+AudioClock::set_bbt (samplepos_t when, samplecnt_t offset, bool /*force*/)
{
char buf[64];
Timecode::BBT_Time BBT;
@@ -1144,15 +1144,15 @@ AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/)
offset = bbt_reference_time;
}
- const double divisions = tmap.meter_section_at_frame (offset).divisions_per_bar();
+ const double divisions = tmap.meter_section_at_sample (offset).divisions_per_bar();
Timecode::BBT_Time sub_bbt;
if (negative) {
- BBT = tmap.bbt_at_beat (tmap.beat_at_frame (offset));
- sub_bbt = tmap.bbt_at_frame (offset - when);
+ BBT = tmap.bbt_at_beat (tmap.beat_at_sample (offset));
+ sub_bbt = tmap.bbt_at_sample (offset - when);
} else {
- BBT = tmap.bbt_at_beat (tmap.beat_at_frame (when + offset));
- sub_bbt = tmap.bbt_at_frame (offset);
+ BBT = tmap.bbt_at_beat (tmap.beat_at_sample (when + offset));
+ sub_bbt = tmap.bbt_at_sample (offset);
}
BBT.bars -= sub_bbt.bars;
@@ -1177,7 +1177,7 @@ AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/)
}
}
} else {
- BBT = _session->tempo_map().bbt_at_frame (when);
+ BBT = _session->tempo_map().bbt_at_sample (when);
}
if (negative) {
@@ -1191,7 +1191,7 @@ AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/)
_layout->set_text (buf);
if (_with_info) {
- framepos_t pos;
+ samplepos_t pos;
if (bbt_reference_time < 0) {
pos = when;
@@ -1202,13 +1202,13 @@ AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/)
TempoMetric m (_session->tempo_map().metric_at (pos));
if (m.tempo().note_type() == 4) {
- snprintf (buf, sizeof(buf), "\u2669 = %.3f", _session->tempo_map().tempo_at_frame (pos).note_types_per_minute());
+ snprintf (buf, sizeof(buf), "\u2669 = %.3f", _session->tempo_map().tempo_at_sample (pos).note_types_per_minute());
_left_btn.set_text (string_compose ("%1", buf), true);
} else if (m.tempo().note_type() == 8) {
- snprintf (buf, sizeof(buf), "\u266a = %.3f", _session->tempo_map().tempo_at_frame (pos).note_types_per_minute());
+ snprintf (buf, sizeof(buf), "\u266a = %.3f", _session->tempo_map().tempo_at_sample (pos).note_types_per_minute());
_left_btn.set_text (string_compose ("%1", buf), true);
} else {
- snprintf (buf, sizeof(buf), "%.1f = %.3f", m.tempo().note_type(), _session->tempo_map().tempo_at_frame (pos).note_types_per_minute());
+ snprintf (buf, sizeof(buf), "%.1f = %.3f", m.tempo().note_type(), _session->tempo_map().tempo_at_sample (pos).note_types_per_minute());
_left_btn.set_text (string_compose ("%1: %2", S_("Tempo|T"), buf), true);
}
@@ -1226,7 +1226,7 @@ AudioClock::set_session (Session *s)
int64_t limit_sec = UIConfiguration::instance().get_clock_display_limit ();
if (limit_sec > 0) {
- _limit_pos = (framecnt_t) floor ((double)(limit_sec * _session->frame_rate()));
+ _limit_pos = (samplecnt_t) floor ((double)(limit_sec * _session->sample_rate()));
}
Config->ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context());
@@ -1268,7 +1268,7 @@ AudioClock::on_key_press_event (GdkEventKey* ev)
string new_text;
char new_char = 0;
int highlight_length;
- framepos_t pos;
+ samplepos_t pos;
switch (ev->keyval) {
case GDK_0:
@@ -1368,7 +1368,7 @@ AudioClock::on_key_press_event (GdkEventKey* ev)
use_input_string:
switch (_mode) {
- case Frames:
+ case Samples:
/* get this one in the right order, and to the right width */
if (ev->keyval == GDK_Delete || ev->keyval == GDK_BackSpace) {
edit_string = edit_string.substr (0, edit_string.length() - 1);
@@ -1487,7 +1487,7 @@ AudioClock::index_to_field (int index) const
} else if (index < 10) {
return Timecode_Seconds;
} else {
- return Timecode_Frames;
+ return Timecode_frames;
}
break;
case BBT:
@@ -1510,8 +1510,8 @@ AudioClock::index_to_field (int index) const
return MS_Milliseconds;
}
break;
- case Frames:
- return AudioFrames;
+ case Samples:
+ return S_Samples;
break;
}
@@ -1601,7 +1601,7 @@ AudioClock::on_button_release_event (GdkEventButton *ev)
f = index_to_field (index);
switch (f) {
- case Timecode_Frames:
+ case Timecode_frames:
case MS_Milliseconds:
case Ticks:
f = Field (0);
@@ -1668,32 +1668,32 @@ AudioClock::on_scroll_event (GdkEventScroll *ev)
}
Field f = index_to_field (index);
- framepos_t frames = 0;
+ samplepos_t samples = 0;
switch (ev->direction) {
case GDK_SCROLL_UP:
- frames = get_frame_step (f, current_time(), 1);
- if (frames != 0) {
+ samples = get_sample_step (f, current_time(), 1);
+ if (samples != 0) {
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
- frames *= 10;
+ samples *= 10;
}
- set (current_time() + frames, true);
+ set (current_time() + samples, true);
ValueChanged (); /* EMIT_SIGNAL */
}
break;
case GDK_SCROLL_DOWN:
- frames = get_frame_step (f, current_time(), -1);
- if (frames != 0) {
+ samples = get_sample_step (f, current_time(), -1);
+ if (samples != 0) {
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
- frames *= 10;
+ samples *= 10;
}
- if (!_negative_allowed && (double)current_time() - (double)frames < 0.0) {
+ if (!_negative_allowed && (double)current_time() - (double)samples < 0.0) {
set (0, true);
} else {
- set (current_time() - frames, true);
+ set (current_time() - samples, true);
}
ValueChanged (); /* EMIT_SIGNAL */
@@ -1715,35 +1715,35 @@ AudioClock::on_motion_notify_event (GdkEventMotion *ev)
return false;
}
- float pixel_frame_scale_factor = 0.2f;
+ float pixel_sample_scale_factor = 0.2f;
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
- pixel_frame_scale_factor = 0.1f;
+ pixel_sample_scale_factor = 0.1f;
}
if (Keyboard::modifier_state_contains (ev->state,
Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) {
- pixel_frame_scale_factor = 0.025f;
+ pixel_sample_scale_factor = 0.025f;
}
double y_delta = ev->y - drag_y;
- drag_accum += y_delta*pixel_frame_scale_factor;
+ drag_accum += y_delta*pixel_sample_scale_factor;
drag_y = ev->y;
if (floor (drag_accum) != 0) {
- framepos_t frames;
- framepos_t pos;
+ samplepos_t samples;
+ samplepos_t pos;
int dir;
dir = (drag_accum < 0 ? 1:-1);
pos = current_time();
- frames = get_frame_step (drag_field, pos, dir);
+ samples = get_sample_step (drag_field, pos, dir);
- if (frames != 0 && frames * drag_accum < current_time()) {
- set ((framepos_t) floor (pos - drag_accum * frames), false); // minus because up is negative in GTK
+ if (samples != 0 && samples * drag_accum < current_time()) {
+ set ((samplepos_t) floor (pos - drag_accum * samples), false); // minus because up is negative in GTK
} else {
set (0 , false);
}
@@ -1755,40 +1755,40 @@ AudioClock::on_motion_notify_event (GdkEventMotion *ev)
return true;
}
-framepos_t
-AudioClock::get_frame_step (Field field, framepos_t pos, int dir)
+samplepos_t
+AudioClock::get_sample_step (Field field, samplepos_t pos, int dir)
{
- framecnt_t f = 0;
+ samplecnt_t f = 0;
Timecode::BBT_Time BBT;
switch (field) {
case Timecode_Hours:
- f = (framecnt_t) floor (3600.0 * _session->frame_rate());
+ f = (samplecnt_t) floor (3600.0 * _session->sample_rate());
break;
case Timecode_Minutes:
- f = (framecnt_t) floor (60.0 * _session->frame_rate());
+ f = (samplecnt_t) floor (60.0 * _session->sample_rate());
break;
case Timecode_Seconds:
- f = _session->frame_rate();
+ f = _session->sample_rate();
break;
- case Timecode_Frames:
- f = (framecnt_t) floor (_session->frame_rate() / _session->timecode_frames_per_second());
+ case Timecode_frames:
+ f = (samplecnt_t) floor (_session->sample_rate() / _session->timecode_frames_per_second());
break;
- case AudioFrames:
+ case S_Samples:
f = 1;
break;
case MS_Hours:
- f = (framecnt_t) floor (3600.0 * _session->frame_rate());
+ f = (samplecnt_t) floor (3600.0 * _session->sample_rate());
break;
case MS_Minutes:
- f = (framecnt_t) floor (60.0 * _session->frame_rate());
+ f = (samplecnt_t) floor (60.0 * _session->sample_rate());
break;
case MS_Seconds:
- f = (framecnt_t) _session->frame_rate();
+ f = (samplecnt_t) _session->sample_rate();
break;
case MS_Milliseconds:
- f = (framecnt_t) floor (_session->frame_rate() / 1000.0);
+ f = (samplecnt_t) floor (_session->sample_rate() / 1000.0);
break;
case Bars:
@@ -1810,7 +1810,7 @@ AudioClock::get_frame_step (Field field, framepos_t pos, int dir)
f = _session->tempo_map().bbt_duration_at(pos,BBT,dir);
break;
default:
- error << string_compose (_("programming error: %1"), "attempt to get frames from non-text field!") << endmsg;
+ error << string_compose (_("programming error: %1"), "attempt to get samples from non-text field!") << endmsg;
f = 0;
break;
}
@@ -1818,30 +1818,30 @@ AudioClock::get_frame_step (Field field, framepos_t pos, int dir)
return f;
}
-framepos_t
-AudioClock::current_time (framepos_t) const
+samplepos_t
+AudioClock::current_time (samplepos_t) const
{
return last_when;
}
-framepos_t
-AudioClock::current_duration (framepos_t pos) const
+samplepos_t
+AudioClock::current_duration (samplepos_t pos) const
{
- framepos_t ret = 0;
+ samplepos_t ret = 0;
switch (_mode) {
case Timecode:
ret = last_when;
break;
case BBT:
- ret = frame_duration_from_bbt_string (pos, _layout->get_text());
+ ret = sample_duration_from_bbt_string (pos, _layout->get_text());
break;
case MinSec:
ret = last_when;
break;
- case Frames:
+ case Samples:
ret = last_when;
break;
}
@@ -1930,15 +1930,15 @@ AudioClock::minsec_validate_edit (const string& str)
return true;
}
-framepos_t
-AudioClock::frames_from_timecode_string (const string& str) const
+samplepos_t
+AudioClock::samples_from_timecode_string (const string& str) const
{
if (_session == 0) {
return 0;
}
Timecode::Time TC;
- framepos_t sample;
+ samplepos_t sample;
char ignored[2];
int hours;
@@ -1960,26 +1960,26 @@ AudioClock::frames_from_timecode_string (const string& str) const
return sample;
}
-framepos_t
-AudioClock::frames_from_minsec_string (const string& str) const
+samplepos_t
+AudioClock::samples_from_minsec_string (const string& str) const
{
if (_session == 0) {
return 0;
}
int hrs, mins, secs, millisecs;
- framecnt_t sr = _session->frame_rate();
+ samplecnt_t sr = _session->sample_rate();
if (sscanf (str.c_str(), "%d:%d:%d.%d", &hrs, &mins, &secs, &millisecs) != 4) {
error << string_compose (_("programming error: %1 %2"), "badly formatted minsec clock string", str) << endmsg;
return 0;
}
- return (framepos_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr) + (millisecs * sr / 1000.0));
+ return (samplepos_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr) + (millisecs * sr / 1000.0));
}
-framepos_t
-AudioClock::frames_from_bbt_string (framepos_t pos, const string& str) const
+samplepos_t
+AudioClock::samples_from_bbt_string (samplepos_t pos, const string& str) const
{
if (_session == 0) {
error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
@@ -1996,18 +1996,18 @@ AudioClock::frames_from_bbt_string (framepos_t pos, const string& str) const
if (is_duration) {
any.bbt.bars++;
any.bbt.beats++;
- return _session->any_duration_to_frames (pos, any);
+ return _session->any_duration_to_samples (pos, any);
} else {
- return _session->convert_to_frames (any);
+ return _session->convert_to_samples (any);
}
}
-framepos_t
-AudioClock::frame_duration_from_bbt_string (framepos_t pos, const string& str) const
+samplepos_t
+AudioClock::sample_duration_from_bbt_string (samplepos_t pos, const string& str) const
{
if (_session == 0) {
- error << "AudioClock::frame_duration_from_bbt_string() called with BBT mode but without session!" << endmsg;
+ error << "AudioClock::sample_duration_from_bbt_string() called with BBT mode but without session!" << endmsg;
return 0;
}
@@ -2020,10 +2020,10 @@ AudioClock::frame_duration_from_bbt_string (framepos_t pos, const string& str) c
return _session->tempo_map().bbt_duration_at(pos,bbt,1);
}
-framepos_t
-AudioClock::frames_from_audioframes_string (const string& str) const
+samplepos_t
+AudioClock::samples_from_audioframes_string (const string& str) const
{
- framepos_t f;
+ samplepos_t f;
sscanf (str.c_str(), "%" PRId64, &f);
return f;
}
@@ -2057,7 +2057,7 @@ AudioClock::build_ops_menu ()
ops_items.push_back (MenuElem (_("Timecode"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), Timecode, false)));
ops_items.push_back (MenuElem (_("Bars:Beats"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), BBT, false)));
ops_items.push_back (MenuElem (_("Minutes:Seconds"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), MinSec, false)));
- ops_items.push_back (MenuElem (_("Samples"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), Frames, false)));
+ ops_items.push_back (MenuElem (_("Samples"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), Samples, false)));
if (editable && !_off && !is_duration && !_follows_playhead) {
ops_items.push_back (SeparatorElem());
@@ -2075,7 +2075,7 @@ AudioClock::set_from_playhead ()
return;
}
- set (_session->transport_frame());
+ set (_session->transport_sample());
ValueChanged ();
}
@@ -2141,7 +2141,7 @@ AudioClock::set_mode (Mode m, bool noemit)
insert_map.push_back (1);
break;
- case Frames:
+ case Samples:
break;
}
@@ -2155,7 +2155,7 @@ AudioClock::set_mode (Mode m, bool noemit)
}
void
-AudioClock::set_bbt_reference (framepos_t pos)
+AudioClock::set_bbt_reference (samplepos_t pos)
{
bbt_reference_time = pos;
}
diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h
index 9ff8221229..e48dec0dc5 100644
--- a/gtk2_ardour/audio_clock.h
+++ b/gtk2_ardour/audio_clock.h
@@ -47,7 +47,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
Timecode,
BBT,
MinSec,
- Frames
+ Samples
};
AudioClock (const std::string& clock_name, bool is_transient, const std::string& widget_name,
@@ -66,19 +66,19 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
void focus ();
- void set (framepos_t, bool force = false, ARDOUR::framecnt_t offset = 0);
+ void set (samplepos_t, bool force = false, ARDOUR::samplecnt_t offset = 0);
void set_from_playhead ();
void locate ();
void set_mode (Mode, bool noemit = false);
- void set_bbt_reference (framepos_t);
+ void set_bbt_reference (samplepos_t);
void set_is_duration (bool);
void copy_text_to_clipboard () const;
std::string name() const { return _name; }
- framepos_t current_time (framepos_t position = 0) const;
- framepos_t current_duration (framepos_t position = 0) const;
+ samplepos_t current_time (samplepos_t position = 0) const;
+ samplepos_t current_duration (samplepos_t position = 0) const;
void set_session (ARDOUR::Session *s);
void set_negative_allowed (bool yn);
@@ -93,7 +93,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
*/
void set_scale (double x, double y);
- static void print_minsec (framepos_t, char* buf, size_t bufsize, float frame_rate);
+ static void print_minsec (samplepos_t, char* buf, size_t bufsize, float sample_rate);
sigc::signal<void> ValueChanged;
sigc::signal<void> mode_changed;
@@ -130,7 +130,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
bool _negative_allowed;
bool edit_is_negative;
- framepos_t _limit_pos;
+ samplepos_t _limit_pos;
Glib::RefPtr<Pango::Layout> _layout;
@@ -158,7 +158,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
Timecode_Hours = 1,
Timecode_Minutes,
Timecode_Seconds,
- Timecode_Frames,
+ Timecode_frames,
MS_Hours,
MS_Minutes,
MS_Seconds,
@@ -166,7 +166,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
Bars,
Beats,
Ticks,
- AudioFrames,
+ S_Samples,
};
Field index_to_field (int index) const;
@@ -184,8 +184,8 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
std::string pre_edit_string;
std::string input_string;
- framepos_t bbt_reference_time;
- framepos_t last_when;
+ samplepos_t bbt_reference_time;
+ samplepos_t last_when;
bool last_pdelta;
bool last_sdelta;
@@ -205,25 +205,25 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
bool on_focus_out_event (GdkEventFocus*);
void set_slave_info ();
- void set_timecode (framepos_t, bool);
- void set_bbt (framepos_t, ARDOUR::framecnt_t, bool);
- void set_minsec (framepos_t, bool);
- void set_frames (framepos_t, bool);
+ void set_timecode (samplepos_t, bool);
+ void set_bbt (samplepos_t, ARDOUR::samplecnt_t, bool);
+ void set_minsec (samplepos_t, bool);
+ void set_samples (samplepos_t, bool);
void set_out_of_bounds (bool negative);
void set_clock_dimensions (Gtk::Requisition&);
- framepos_t get_frame_step (Field, framepos_t pos = 0, int dir = 1);
+ samplepos_t get_sample_step (Field, samplepos_t pos = 0, int dir = 1);
bool timecode_validate_edit (const std::string&);
bool bbt_validate_edit (const std::string&);
bool minsec_validate_edit (const std::string&);
- framepos_t frames_from_timecode_string (const std::string&) const;
- framepos_t frames_from_bbt_string (framepos_t, const std::string&) const;
- framepos_t frame_duration_from_bbt_string (framepos_t, const std::string&) const;
- framepos_t frames_from_minsec_string (const std::string&) const;
- framepos_t frames_from_audioframes_string (const std::string&) const;
+ samplepos_t samples_from_timecode_string (const std::string&) const;
+ samplepos_t samples_from_bbt_string (samplepos_t, const std::string&) const;
+ samplepos_t sample_duration_from_bbt_string (samplepos_t, const std::string&) const;
+ samplepos_t samples_from_minsec_string (const std::string&) const;
+ samplepos_t samples_from_audioframes_string (const std::string&) const;
void session_configuration_changed (std::string);
void session_property_changed (const PBD::PropertyChange&);
@@ -234,12 +234,12 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
void end_edit (bool);
void end_edit_relative (bool);
void edit_next_field ();
- ARDOUR::framecnt_t parse_as_distance (const std::string&);
+ ARDOUR::samplecnt_t parse_as_distance (const std::string&);
- ARDOUR::framecnt_t parse_as_timecode_distance (const std::string&);
- ARDOUR::framecnt_t parse_as_minsec_distance (const std::string&);
- ARDOUR::framecnt_t parse_as_bbt_distance (const std::string&);
- ARDOUR::framecnt_t parse_as_frames_distance (const std::string&);
+ ARDOUR::samplecnt_t parse_as_timecode_distance (const std::string&);
+ ARDOUR::samplecnt_t parse_as_minsec_distance (const std::string&);
+ ARDOUR::samplecnt_t parse_as_bbt_distance (const std::string&);
+ ARDOUR::samplecnt_t parse_as_samples_distance (const std::string&);
void set_font (Pango::FontDescription);
void set_colors ();
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index fd35f23645..1e1a9f2c39 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -292,7 +292,7 @@ AudioRegionView::~AudioRegionView ()
}
_data_ready_connections.clear ();
- for (list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator i = feature_lines.begin(); i != feature_lines.end(); ++i) {
+ for (list<std::pair<samplepos_t, ArdourCanvas::Line*> >::iterator i = feature_lines.begin(); i != feature_lines.end(); ++i) {
delete ((*i).second);
}
@@ -389,7 +389,7 @@ AudioRegionView::region_renamed ()
{
std::string str = RegionView::make_name ();
- if (audio_region()->speed_mismatch (trackview.session()->frame_rate())) {
+ if (audio_region()->speed_mismatch (trackview.session()->sample_rate())) {
str = string ("*") + str;
}
@@ -436,9 +436,9 @@ AudioRegionView::region_resized (const PropertyChange& what_changed)
}
/* hide transient lines that extend beyond the region */
- list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
- framepos_t first = _region->first_frame();
- framepos_t last = _region->last_frame();
+ list<std::pair<samplepos_t, ArdourCanvas::Line*> >::iterator l;
+ samplepos_t first = _region->first_sample();
+ samplepos_t last = _region->last_sample();
for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
if (l->first < first || l->first >= last) {
@@ -483,10 +483,10 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
return;
}
- framepos_t position = _region->position();
+ samplepos_t position = _region->position();
AnalysisFeatureList::const_iterator i;
- list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
+ list<std::pair<samplepos_t, ArdourCanvas::Line*> >::iterator l;
double y1;
if (_height >= NAME_HIGHLIGHT_THRESH) {
y1 = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
@@ -580,8 +580,8 @@ AudioRegionView::set_height (gdouble height)
reset_fade_shapes ();
/* Update heights for any feature lines */
- framepos_t position = _region->position();
- list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
+ samplepos_t position = _region->position();
+ list<std::pair<samplepos_t, ArdourCanvas::Line*> >::iterator l;
double y1;
if (_height >= NAME_HIGHLIGHT_THRESH) {
y1 = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
@@ -611,20 +611,20 @@ AudioRegionView::reset_fade_shapes ()
void
AudioRegionView::reset_fade_in_shape ()
{
- reset_fade_in_shape_width (audio_region(), (framecnt_t) audio_region()->fade_in()->back()->when);
+ reset_fade_in_shape_width (audio_region(), (samplecnt_t) audio_region()->fade_in()->back()->when);
}
void
-AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, framecnt_t width, bool drag_active)
+AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, samplecnt_t width, bool drag_active)
{
trim_fade_in_drag_active = drag_active;
if (fade_in_handle == 0) {
return;
}
- /* smallest size for a fade is 64 frames */
+ /* smallest size for a fade is 64 samples */
- width = std::max ((framecnt_t) 64, width);
+ width = std::max ((samplecnt_t) 64, width);
/* round here to prevent little visual glitches with sub-pixel placement */
double const pwidth = floor (width / samples_per_pixel);
@@ -682,33 +682,33 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, f
redraw_start_xfade_to (ar, width, points, effective_height, handle_left);
/* ensure trim handle stays on top */
- if (frame_handle_start) {
- frame_handle_start->raise_to_top();
+ if (sample_handle_start) {
+ sample_handle_start->raise_to_top();
}
}
void
AudioRegionView::reset_fade_out_shape ()
{
- reset_fade_out_shape_width (audio_region(), (framecnt_t) audio_region()->fade_out()->back()->when);
+ reset_fade_out_shape_width (audio_region(), (samplecnt_t) audio_region()->fade_out()->back()->when);
}
void
-AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar, framecnt_t width, bool drag_active)
+AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar, samplecnt_t width, bool drag_active)
{
trim_fade_out_drag_active = drag_active;
if (fade_out_handle == 0) {
return;
}
- /* smallest size for a fade is 64 frames */
+ /* smallest size for a fade is 64 samples */
- width = std::max ((framecnt_t) 64, width);
+ width = std::max ((samplecnt_t) 64, width);
double const pwidth = floor(trackview.editor().sample_to_pixel (width));
- /* the right edge should be right on the region frame is the pixel
+ /* the right edge should be right on the region sample is the pixel
* width is zero. Hence the additional + 1.0 at the end.
*/
@@ -768,18 +768,18 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar,
redraw_end_xfade_to (ar, width, points, effective_height, handle_right, pwidth);
/* ensure trim handle stays on top */
- if (frame_handle_end) {
- frame_handle_end->raise_to_top();
+ if (sample_handle_end) {
+ sample_handle_end->raise_to_top();
}
}
-framepos_t
+samplepos_t
AudioRegionView::get_fade_in_shape_width ()
{
return audio_region()->fade_in()->back()->when;
}
-framepos_t
+samplepos_t
AudioRegionView::get_fade_out_shape_width ()
{
return audio_region()->fade_out()->back()->when;
@@ -800,7 +800,7 @@ AudioRegionView::redraw_start_xfade ()
}
void
-AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t /*width*/, Points& points, double effective_height,
+AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, samplecnt_t /*width*/, Points& points, double effective_height,
double rect_width)
{
if (points.size() < 2) {
@@ -889,7 +889,7 @@ AudioRegionView::redraw_end_xfade ()
}
void
-AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t width, Points& points, double effective_height,
+AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, samplecnt_t width, Points& points, double effective_height,
double rect_edge, double rect_width)
{
if (points.size() < 2) {
@@ -1234,7 +1234,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
}
/* first waveview starts at 1.0, not 0.0 since that will overlap the
- * frame
+ * sample
*/
gdouble yoff = which * ht;
@@ -1303,7 +1303,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
/* Restore stacked coverage */
LayerDisplay layer_display;
if (trackview.get_gui_property ("layer-display", layer_display)) {
- update_coverage_frames (layer_display);
+ update_coverage_samples (layer_display);
}
}
@@ -1332,14 +1332,14 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev, b
item->canvas_to_item (mx, my);
- framecnt_t const frame_within_region = (framecnt_t) floor (mx * samples_per_pixel);
+ samplecnt_t const sample_within_region = (samplecnt_t) floor (mx * samples_per_pixel);
- if (!gain_line->control_points_adjacent (frame_within_region, before_p, after_p)) {
+ if (!gain_line->control_points_adjacent (sample_within_region, before_p, after_p)) {
/* no adjacent points */
return;
}
- /*y is in item frame */
+ /*y is in item sample */
double const bx = gain_line->nth (before_p)->get_x();
double const ax = gain_line->nth (after_p)->get_x();
double const click_ratio = (ax - mx) / (ax - bx);
@@ -1349,10 +1349,10 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev, b
/* don't create points that can't be seen */
update_envelope_visibility ();
- framepos_t rpos = region ()->position ();
- MusicFrame snap_pos (trackview.editor().pixel_to_sample (mx) + rpos, 0);
+ samplepos_t rpos = region ()->position ();
+ MusicSample snap_pos (trackview.editor().pixel_to_sample (mx) + rpos, 0);
trackview.editor ().snap_to_with_modifier (snap_pos, ev);
- framepos_t fx = snap_pos.frame - rpos;
+ samplepos_t fx = snap_pos.sample - rpos;
if (fx > _region->length()) {
return;
@@ -1589,13 +1589,13 @@ AudioRegionView::set_some_waveform_colors (vector<ArdourWaveView::WaveView*>& wa
}
void
-AudioRegionView::set_frame_color ()
+AudioRegionView::set_sample_color ()
{
- if (!frame) {
+ if (!sample) {
return;
}
- RegionView::set_frame_color ();
+ RegionView::set_sample_color ();
set_waveform_colors ();
}
@@ -1623,9 +1623,9 @@ AudioRegionView::set_fade_visibility (bool yn)
}
void
-AudioRegionView::update_coverage_frames (LayerDisplay d)
+AudioRegionView::update_coverage_samples (LayerDisplay d)
{
- RegionView::update_coverage_frames (d);
+ RegionView::update_coverage_samples (d);
if (d == Stacked) {
if (fade_in_handle) { fade_in_handle->raise_to_top (); }
@@ -1651,9 +1651,9 @@ AudioRegionView::transients_changed ()
{
AnalysisFeatureList analysis_features;
_region->transients (analysis_features);
- framepos_t position = _region->position();
- framepos_t first = _region->first_frame();
- framepos_t last = _region->last_frame();
+ samplepos_t position = _region->position();
+ samplepos_t first = _region->first_sample();
+ samplepos_t last = _region->last_sample();
double y1;
if (_height >= NAME_HIGHLIGHT_THRESH) {
@@ -1686,7 +1686,7 @@ AudioRegionView::transients_changed ()
}
AnalysisFeatureList::const_iterator i;
- list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
+ list<std::pair<samplepos_t, ArdourCanvas::Line*> >::iterator l;
for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
@@ -1712,8 +1712,8 @@ AudioRegionView::transients_changed ()
void
AudioRegionView::update_transient(float /*old_pos*/, float new_pos)
{
- /* Find frame at old pos, calulate new frame then update region transients*/
- list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
+ /* Find sample at old pos, calulate new sample then update region transients*/
+ list<std::pair<samplepos_t, ArdourCanvas::Line*> >::iterator l;
for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
@@ -1722,10 +1722,10 @@ AudioRegionView::update_transient(float /*old_pos*/, float new_pos)
float* pos = (float*) (*l).second->get_data ("position");
if (rint(new_pos) == rint(*pos)) {
- framepos_t position = _region->position();
- framepos_t old_frame = (*l).first;
- framepos_t new_frame = trackview.editor().pixel_to_sample (new_pos) + position;
- _region->update_transient (old_frame, new_frame);
+ samplepos_t position = _region->position();
+ samplepos_t old_sample = (*l).first;
+ samplepos_t new_sample = trackview.editor().pixel_to_sample (new_pos) + position;
+ _region->update_transient (old_sample, new_sample);
break;
}
}
@@ -1737,9 +1737,9 @@ AudioRegionView::remove_transient (float pos)
/* this is called from Editor::remove_transient () with pos == get_data ("position")
* which is the item's x-coordinate inside the ARV.
*
- * Find frame at old pos, calulate new frame then update region transients
+ * Find sample at old pos, calulate new sample then update region transients
*/
- list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
+ list<std::pair<samplepos_t, ArdourCanvas::Line*> >::iterator l;
for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
float *line_pos = (float*) (*l).second->get_data ("position");
diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h
index 8841ee2e43..d12d8ff086 100644
--- a/gtk2_ardour/audio_region_view.h
+++ b/gtk2_ardour/audio_region_view.h
@@ -97,14 +97,14 @@ public:
GhostRegion* add_ghost (TimeAxisView&);
- void reset_fade_in_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, framecnt_t, bool drag_active = false);
- void reset_fade_out_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, framecnt_t, bool drag_active = false);
+ void reset_fade_in_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, samplecnt_t, bool drag_active = false);
+ void reset_fade_out_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, samplecnt_t, bool drag_active = false);
- framepos_t get_fade_in_shape_width ();
- framepos_t get_fade_out_shape_width ();
+ samplepos_t get_fade_in_shape_width ();
+ samplepos_t get_fade_out_shape_width ();
void set_fade_visibility (bool);
- void update_coverage_frames (LayerDisplay);
+ void update_coverage_samples (LayerDisplay);
void update_transient(float old_pos, float new_pos);
void remove_transient(float pos);
@@ -119,8 +119,8 @@ public:
void drag_start ();
void drag_end ();
- void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t, ArdourCanvas::Points&, double, double);
- void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t, ArdourCanvas::Points&, double, double, double);
+ void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, samplecnt_t, ArdourCanvas::Points&, double, double);
+ void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, samplecnt_t, ArdourCanvas::Points&, double, double, double);
void redraw_start_xfade ();
void redraw_end_xfade ();
@@ -155,7 +155,7 @@ protected:
std::vector<ArdourWaveView::WaveView *> waves;
std::vector<ArdourWaveView::WaveView *> tmp_waves; ///< see ::create_waves()
- std::list<std::pair<framepos_t, ArdourCanvas::Line*> > feature_lines;
+ std::list<std::pair<samplepos_t, ArdourCanvas::Line*> > feature_lines;
ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position
ArdourCanvas::Rectangle* fade_in_handle; ///< fade in handle, or 0
@@ -197,7 +197,7 @@ protected:
void set_colors ();
void set_waveform_colors ();
void reset_width_dependent_items (double pixel_width);
- void set_frame_color ();
+ void set_sample_color ();
void color_handler ();
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index 95f2c6888b..7e79c33893 100644
--- a/gtk2_ardour/audio_streamview.cc
+++ b/gtk2_ardour/audio_streamview.cc
@@ -210,10 +210,10 @@ AudioStreamView::setup_rec_box ()
// handle multi
- framepos_t start = 0;
+ samplepos_t start = 0;
if (rec_regions.size() > 0) {
start = rec_regions.back().first->start()
- + _trackview.track()->get_captured_frames(rec_regions.size()-1);
+ + _trackview.track()->get_captured_samples(rec_regions.size()-1);
}
PropertyList plist;
@@ -227,17 +227,17 @@ AudioStreamView::setup_rec_box ()
boost::dynamic_pointer_cast<AudioRegion>(RegionFactory::create (sources, plist, false)));
assert(region);
- region->set_position (_trackview.session()->transport_frame());
+ region->set_position (_trackview.session()->transport_sample());
rec_regions.push_back (make_pair(region, (RegionView*) 0));
}
/* start a new rec box */
boost::shared_ptr<AudioTrack> at = _trackview.audio_track();
- framepos_t const frame_pos = at->current_capture_start ();
+ samplepos_t const sample_pos = at->current_capture_start ();
double const width = ((at->mode() == Destructive) ? 2 : 0);
- create_rec_box(frame_pos, width);
+ create_rec_box(sample_pos, width);
} else if (rec_active &&
(_trackview.session()->record_status() != Session::Recording ||
@@ -289,7 +289,7 @@ AudioStreamView::setup_rec_box ()
}
void
-AudioStreamView::rec_peak_range_ready (framepos_t start, framecnt_t cnt, boost::weak_ptr<Source> weak_src)
+AudioStreamView::rec_peak_range_ready (samplepos_t start, samplecnt_t cnt, boost::weak_ptr<Source> weak_src)
{
ENSURE_GUI_THREAD (*this, &AudioStreamView::rec_peak_range_ready, start, cnt, weak_src)
@@ -301,8 +301,8 @@ AudioStreamView::rec_peak_range_ready (framepos_t start, framecnt_t cnt, boost::
// this is called from the peak building thread
- if (rec_data_ready_map.size() == 0 || start + cnt > last_rec_data_frame) {
- last_rec_data_frame = start + cnt;
+ if (rec_data_ready_map.size() == 0 || start + cnt > last_rec_data_sample) {
+ last_rec_data_sample = start + cnt;
}
rec_data_ready_map[src] = true;
@@ -314,7 +314,7 @@ AudioStreamView::rec_peak_range_ready (framepos_t start, framecnt_t cnt, boost::
}
void
-AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
+AudioStreamView::update_rec_regions (samplepos_t start, samplecnt_t cnt)
{
if (!UIConfiguration::instance().get_show_waveforms_while_recording ()) {
return;
@@ -342,19 +342,19 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
continue;
}
- framecnt_t origlen = region->length();
+ samplecnt_t origlen = region->length();
if (region == rec_regions.back().first && rec_active) {
- if (last_rec_data_frame > region->start()) {
+ if (last_rec_data_sample > region->start()) {
- framecnt_t nlen = last_rec_data_frame - region->start();
+ samplecnt_t nlen = last_rec_data_sample - region->start();
if (nlen != region->length()) {
region->suspend_property_changes ();
/* set non-musical position / length */
- region->set_position (_trackview.track()->get_capture_start_frame(n));
+ region->set_position (_trackview.track()->get_capture_start_sample(n));
region->set_length (nlen, 0);
region->resume_property_changes ();
@@ -374,14 +374,14 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
} else {
- framecnt_t nlen = _trackview.track()->get_captured_frames(n);
+ samplecnt_t nlen = _trackview.track()->get_captured_samples(n);
if (nlen != region->length()) {
if (region->source_length(0) >= region->start() + nlen) {
region->suspend_property_changes ();
- region->set_position (_trackview.track()->get_capture_start_frame(n));
+ region->set_position (_trackview.track()->get_capture_start_sample(n));
region->set_length (nlen, 0);
region->resume_property_changes ();
@@ -438,7 +438,7 @@ AudioStreamView::hide_xfades_with (boost::shared_ptr<AudioRegion> ar)
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
if (arv) {
- switch (arv->region()->coverage (ar->position(), ar->last_frame())) {
+ switch (arv->region()->coverage (ar->position(), ar->last_sample())) {
case Evoral::OverlapNone:
break;
default:
diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h
index 53da6e9eb0..ba118190da 100644
--- a/gtk2_ardour/audio_streamview.h
+++ b/gtk2_ardour/audio_streamview.h
@@ -66,8 +66,8 @@ public:
private:
void setup_rec_box ();
- void rec_peak_range_ready (framepos_t start, ARDOUR::framecnt_t cnt, boost::weak_ptr<ARDOUR::Source> src);
- void update_rec_regions (ARDOUR::framepos_t, ARDOUR::framecnt_t);
+ void rec_peak_range_ready (samplepos_t start, ARDOUR::samplecnt_t cnt, boost::weak_ptr<ARDOUR::Source> src);
+ void update_rec_regions (ARDOUR::samplepos_t, ARDOUR::samplecnt_t);
RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves, bool recording = false);
void remove_audio_region_view (boost::shared_ptr<ARDOUR::AudioRegion> );
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc
index 72af2f846c..7f7900c835 100644
--- a/gtk2_ardour/audio_time_axis.cc
+++ b/gtk2_ardour/audio_time_axis.cc
@@ -93,10 +93,10 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
if (is_audio_track()) {
controls_ebox.set_name ("AudioTrackControlsBaseUnselected");
- time_axis_frame.set_name ("AudioTrackControlsBaseUnselected");
+ time_axis_sample.set_name ("AudioTrackControlsBaseUnselected");
} else { // bus
controls_ebox.set_name ("AudioBusControlsBaseUnselected");
- time_axis_frame.set_name ("AudioBusControlsBaseUnselected");
+ time_axis_sample.set_name ("AudioBusControlsBaseUnselected");
}
/* if set_state above didn't create a gain automation child, we need to make one */
@@ -308,10 +308,10 @@ AudioTimeAxisView::update_control_names ()
if (selected()) {
controls_ebox.set_name (controls_base_selected_name);
- time_axis_frame.set_name (controls_base_selected_name);
+ time_axis_sample.set_name (controls_base_selected_name);
} else {
controls_ebox.set_name (controls_base_unselected_name);
- time_axis_frame.set_name (controls_base_unselected_name);
+ time_axis_sample.set_name (controls_base_unselected_name);
}
}
diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc
index d53c61432e..ac4fcc253e 100644
--- a/gtk2_ardour/automation_controller.cc
+++ b/gtk2_ardour/automation_controller.cc
@@ -194,13 +194,13 @@ AutomationController::value_adjusted ()
void
AutomationController::start_touch()
{
- _controllable->start_touch (_controllable->session().transport_frame());
+ _controllable->start_touch (_controllable->session().transport_sample());
}
void
AutomationController::end_touch ()
{
- _controllable->stop_touch (_controllable->session().transport_frame());
+ _controllable->stop_touch (_controllable->session().transport_sample());
}
bool
@@ -258,8 +258,8 @@ AutomationController::set_freq_beats(double beats)
{
const ARDOUR::ParameterDescriptor& desc = _controllable->desc();
const ARDOUR::Session& session = _controllable->session();
- const framepos_t pos = session.transport_frame();
- const ARDOUR::Tempo& tempo = session.tempo_map().tempo_at_frame (pos);
+ const samplepos_t pos = session.transport_sample();
+ const ARDOUR::Tempo& tempo = session.tempo_map().tempo_at_sample (pos);
const double bpm = tempo.note_types_per_minute();
const double bps = bpm / 60.0;
const double freq = bps / beats;
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index a97ab0df07..2353b6c2fc 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -70,7 +70,7 @@ using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
-/** @param converter A TimeConverter whose origin_b is the start time of the AutomationList in session frames.
+/** @param converter A TimeConverter whose origin_b is the start time of the AutomationList in session samples.
* This will not be deleted by AutomationLine.
*/
AutomationLine::AutomationLine (const string& name,
@@ -78,14 +78,14 @@ AutomationLine::AutomationLine (const string& name,
ArdourCanvas::Item& parent,
boost::shared_ptr<AutomationList> al,
const ParameterDescriptor& desc,
- Evoral::TimeConverter<double, framepos_t>* converter)
+ Evoral::TimeConverter<double, samplepos_t>* converter)
: trackview (tv)
, _name (name)
, alist (al)
- , _time_converter (converter ? converter : new Evoral::IdentityConverter<double, framepos_t>)
+ , _time_converter (converter ? converter : new Evoral::IdentityConverter<double, samplepos_t>)
, _parent_group (parent)
, _offset (0)
- , _maximum_time (max_framepos)
+ , _maximum_time (max_samplepos)
, _fill (false)
, _desc (desc)
{
@@ -488,9 +488,9 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e)
if (front()->view_index() > 0) {
before_x = line.nth (front()->view_index() - 1)->get_x();
- const framepos_t pos = e.pixel_to_sample(before_x);
- const Meter& meter = map.meter_at_frame (pos);
- const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at_frame (pos), e.session()->frame_rate())
+ const samplepos_t pos = e.pixel_to_sample(before_x);
+ const Meter& meter = map.meter_at_sample (pos);
+ const samplecnt_t len = ceil (meter.samples_per_bar (map.tempo_at_sample (pos), e.session()->sample_rate())
/ (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()) );
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
@@ -504,9 +504,9 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e)
if (back()->view_index() < (line.npoints() - 1)) {
after_x = line.nth (back()->view_index() + 1)->get_x();
- const framepos_t pos = e.pixel_to_sample(after_x);
- const Meter& meter = map.meter_at_frame (pos);
- const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at_frame (pos), e.session()->frame_rate())
+ const samplepos_t pos = e.pixel_to_sample(after_x);
+ const Meter& meter = map.meter_at_sample (pos);
+ const samplecnt_t len = ceil (meter.samples_per_bar (map.tempo_at_sample (pos), e.session()->sample_rate())
/ (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()));
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
@@ -872,14 +872,14 @@ AutomationLine::remove_point (ControlPoint& cp)
}
/** Get selectable points within an area.
- * @param start Start position in session frames.
- * @param end End position in session frames.
+ * @param start Start position in session samples.
+ * @param end End position in session samples.
* @param bot Bottom y range, as a fraction of line height, where 0 is the bottom of the line.
* @param top Top y range, as a fraction of line height, where 0 is the bottom of the line.
* @param result Filled in with selectable things; in this case, ControlPoints.
*/
void
-AutomationLine::get_selectables (framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results)
+AutomationLine::get_selectables (samplepos_t start, samplepos_t end, double botfrac, double topfrac, list<Selectable*>& results)
{
/* convert fractions to display coordinates with 0 at the top of the track */
double const bot_track = (1 - topfrac) * trackview.current_height ();
@@ -889,12 +889,12 @@ AutomationLine::get_selectables (framepos_t start, framepos_t end, double botfra
double const model_when = (*(*i)->model())->when;
/* model_when is relative to the start of the source, so we just need to add on the origin_b here
- (as it is the session frame position of the start of the source)
+ (as it is the session sample position of the start of the source)
*/
- framepos_t const session_frames_when = _time_converter->to (model_when) + _time_converter->origin_b ();
+ samplepos_t const session_samples_when = _time_converter->to (model_when) + _time_converter->origin_b ();
- if (session_frames_when >= start && session_frames_when <= end && (*i)->get_y() >= bot_track && (*i)->get_y() <= top_track) {
+ if (session_samples_when >= start && session_samples_when <= end && (*i)->get_y() >= bot_track && (*i)->get_y() <= top_track) {
results.push_back (*i);
}
}
@@ -988,7 +988,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
continue;
}
- if (tx >= max_framepos || tx < 0 || tx >= _maximum_time) {
+ if (tx >= max_samplepos || tx < 0 || tx >= _maximum_time) {
continue;
}
@@ -1307,7 +1307,7 @@ AutomationLine::memento_command_binder ()
* to the start of the track or region that it is on.
*/
void
-AutomationLine::set_maximum_time (framecnt_t t)
+AutomationLine::set_maximum_time (samplecnt_t t)
{
if (_maximum_time == t) {
return;
@@ -1318,11 +1318,11 @@ AutomationLine::set_maximum_time (framecnt_t t)
}
-/** @return min and max x positions of points that are in the list, in session frames */
-pair<framepos_t, framepos_t>
+/** @return min and max x positions of points that are in the list, in session samples */
+pair<samplepos_t, samplepos_t>
AutomationLine::get_point_x_range () const
{
- pair<framepos_t, framepos_t> r (max_framepos, 0);
+ pair<samplepos_t, samplepos_t> r (max_samplepos, 0);
for (AutomationList::const_iterator i = the_list()->begin(); i != the_list()->end(); ++i) {
r.first = min (r.first, session_position (i));
@@ -1332,14 +1332,14 @@ AutomationLine::get_point_x_range () const
return r;
}
-framepos_t
+samplepos_t
AutomationLine::session_position (AutomationList::const_iterator p) const
{
return _time_converter->to ((*p)->when) + _offset + _time_converter->origin_b ();
}
void
-AutomationLine::set_offset (framepos_t off)
+AutomationLine::set_offset (samplepos_t off)
{
if (_offset == off) {
return;
diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h
index 315f7daf12..57d90a1edc 100644
--- a/gtk2_ardour/automation_line.h
+++ b/gtk2_ardour/automation_line.h
@@ -66,7 +66,7 @@ public:
ArdourCanvas::Item& parent,
boost::shared_ptr<ARDOUR::AutomationList> al,
const ARDOUR::ParameterDescriptor& desc,
- Evoral::TimeConverter<double, ARDOUR::framepos_t>* converter = 0);
+ Evoral::TimeConverter<double, ARDOUR::samplepos_t>* converter = 0);
virtual ~AutomationLine ();
@@ -76,7 +76,7 @@ public:
void set_fill (bool f) { _fill = f; } // owner needs to call set_height
void set_selected_points (PointSelection const &);
- void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*>&);
+ void get_selectables (ARDOUR::samplepos_t, ARDOUR::samplepos_t, double, double, std::list<Selectable*>&);
void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
virtual void remove_point (ControlPoint&);
@@ -145,22 +145,22 @@ public:
virtual MementoCommandBinder<ARDOUR::AutomationList>* memento_command_binder ();
- const Evoral::TimeConverter<double, ARDOUR::framepos_t>& time_converter () const {
+ const Evoral::TimeConverter<double, ARDOUR::samplepos_t>& time_converter () const {
return *_time_converter;
}
- std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> get_point_x_range () const;
+ std::pair<ARDOUR::samplepos_t, ARDOUR::samplepos_t> get_point_x_range () const;
- void set_maximum_time (ARDOUR::framecnt_t);
- ARDOUR::framecnt_t maximum_time () const {
+ void set_maximum_time (ARDOUR::samplecnt_t);
+ ARDOUR::samplecnt_t maximum_time () const {
return _maximum_time;
}
- void set_offset (ARDOUR::framecnt_t);
- ARDOUR::framecnt_t offset () { return _offset; }
- void set_width (ARDOUR::framecnt_t);
+ void set_offset (ARDOUR::samplecnt_t);
+ ARDOUR::samplecnt_t offset () { return _offset; }
+ void set_width (ARDOUR::samplecnt_t);
- framepos_t session_position (ARDOUR::AutomationList::const_iterator) const;
+ samplepos_t session_position (ARDOUR::AutomationList::const_iterator) const;
protected:
@@ -169,7 +169,7 @@ protected:
uint32_t _line_color;
boost::shared_ptr<ARDOUR::AutomationList> alist;
- Evoral::TimeConverter<double, ARDOUR::framepos_t>* _time_converter;
+ Evoral::TimeConverter<double, ARDOUR::samplepos_t>* _time_converter;
/** true if _time_converter belongs to us (ie we should delete it on destruction) */
bool _our_time_converter;
@@ -225,7 +225,7 @@ private:
/** offset from the start of the automation list to the start of the line, so that
* a +ve offset means that the 0 on the line is at _offset in the list
*/
- ARDOUR::framecnt_t _offset;
+ ARDOUR::samplecnt_t _offset;
bool is_stepped() const;
void update_visibility ();
@@ -238,7 +238,7 @@ private:
PBD::ScopedConnectionList _list_connections;
/** maximum time that a point on this line can be at, relative to the position of its region or start of its track */
- ARDOUR::framecnt_t _maximum_time;
+ ARDOUR::samplecnt_t _maximum_time;
bool _fill;
diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc
index 4a16177d29..9e8ba910ad 100644
--- a/gtk2_ardour/automation_region_view.cc
+++ b/gtk2_ardour/automation_region_view.cc
@@ -83,7 +83,7 @@ AutomationRegionView::init (bool /*wfd*/)
set_height (trackview.current_height());
- fill_color_name = "midi frame base";
+ fill_color_name = "midi sample base";
set_colors ();
_enable_display = true;
@@ -110,11 +110,11 @@ AutomationRegionView::get_fill_color() const
{
const std::string mod_name = (_dragging ? "dragging region" :
trackview.editor().internal_editing() ? "editable region" :
- "midi frame base");
+ "midi sample base");
if (_selected) {
return UIConfiguration::instance().color_mod ("selected region base", mod_name);
} else if (high_enough_for_name || !UIConfiguration::instance().get_color_regions_using_track_color()) {
- return UIConfiguration::instance().color_mod ("midi frame base", mod_name);
+ return UIConfiguration::instance().color_mod ("midi sample base", mod_name);
}
return UIConfiguration::instance().color_mod (fill_color, mod_name);
}
@@ -122,8 +122,8 @@ AutomationRegionView::get_fill_color() const
void
AutomationRegionView::mouse_mode_changed ()
{
- // Adjust frame colour (become more transparent for internal tools)
- set_frame_color();
+ // Adjust sample colour (become more transparent for internal tools)
+ set_sample_color();
}
bool
@@ -160,11 +160,11 @@ AutomationRegionView::canvas_group_event (GdkEvent* ev)
return RegionView::canvas_group_event (ev);
}
-/** @param when Position in frames, where 0 is the start of the region.
+/** @param when Position in samples, where 0 is the start of the region.
* @param y y position, relative to our TimeAxisView.
*/
void
-AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double y, bool with_guard_points)
+AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double y, bool with_guard_points)
{
if (!_line) {
boost::shared_ptr<Evoral::Control> c = _region->control(_parameter, true);
@@ -182,9 +182,9 @@ AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double
const double h = trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2;
y = 1.0 - (y / h);
- /* snap frame */
+ /* snap sample */
- when = snap_frame_to_frame (when - _region->start ()).frame + _region->start ();
+ when = snap_sample_to_sample (when - _region->start ()).sample + _region->start ();
/* map using line */
@@ -206,7 +206,7 @@ AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double
}
bool
-AutomationRegionView::paste (framepos_t pos,
+AutomationRegionView::paste (samplepos_t pos,
unsigned paste_count,
float times,
boost::shared_ptr<const ARDOUR::AutomationList> slist)
@@ -227,7 +227,7 @@ AutomationRegionView::paste (framepos_t pos
/* add multi-paste offset if applicable */
if (parameter_is_midi (src_type)) {
// convert length to samples (incl tempo-ramps)
- len = DoubleBeatsFramesConverter (view->session()->tempo_map(), pos).to (len * paste_count);
+ len = DoubleBeatsSamplesConverter (view->session()->tempo_map(), pos).to (len * paste_count);
pos += view->editor ().get_paste_offset (pos, paste_count > 0 ? 1 : 0, len);
} else {
pos += view->editor ().get_paste_offset (pos, paste_count, len);
@@ -238,7 +238,7 @@ AutomationRegionView::paste (framepos_t pos
pos - _source_relative_time_converter.origin_b());
XMLNode& before = my_list->get_state();
- my_list->paste(*slist, model_pos, DoubleBeatsFramesConverter (view->session()->tempo_map(), pos));
+ my_list->paste(*slist, model_pos, DoubleBeatsSamplesConverter (view->session()->tempo_map(), pos));
view->session()->add_command(
new MementoCommand<ARDOUR::AutomationList>(_line->memento_command_binder(), &before, &my_list->get_state()));
@@ -256,7 +256,7 @@ AutomationRegionView::set_height (double h)
}
bool
-AutomationRegionView::set_position (framepos_t pos, void* src, double* ignored)
+AutomationRegionView::set_position (samplepos_t pos, void* src, double* ignored)
{
if (_line) {
_line->set_maximum_time (_region->length ());
diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h
index 76632901f7..ce34e763d3 100644
--- a/gtk2_ardour/automation_region_view.h
+++ b/gtk2_ardour/automation_region_view.h
@@ -49,16 +49,16 @@ public:
void init (bool wfd);
- bool paste (framepos_t pos,
+ bool paste (samplepos_t pos,
unsigned paste_count,
float times,
boost::shared_ptr<const ARDOUR::AutomationList> slist);
- ARDOUR::DoubleBeatsFramesConverter const & region_relative_time_converter () const {
+ ARDOUR::DoubleBeatsSamplesConverter const & region_relative_time_converter () const {
return _region_relative_time_converter;
}
- ARDOUR::DoubleBeatsFramesConverter const & source_relative_time_converter () const {
+ ARDOUR::DoubleBeatsSamplesConverter const & source_relative_time_converter () const {
return _source_relative_time_converter;
}
@@ -77,17 +77,17 @@ public:
protected:
void create_line(boost::shared_ptr<ARDOUR::AutomationList> list);
- bool set_position(framepos_t pos, void* src, double* ignored);
+ bool set_position(samplepos_t pos, void* src, double* ignored);
void region_resized (const PBD::PropertyChange&);
bool canvas_group_event(GdkEvent* ev);
- void add_automation_event (GdkEvent* event, framepos_t when, double y, bool with_guard_points);
+ void add_automation_event (GdkEvent* event, samplepos_t when, double y, bool with_guard_points);
void mouse_mode_changed ();
void entered();
void exited();
private:
- ARDOUR::DoubleBeatsFramesConverter _region_relative_time_converter;
- ARDOUR::DoubleBeatsFramesConverter _source_relative_time_converter;
+ ARDOUR::DoubleBeatsSamplesConverter _region_relative_time_converter;
+ ARDOUR::DoubleBeatsSamplesConverter _source_relative_time_converter;
Evoral::Parameter _parameter;
boost::shared_ptr<AutomationLine> _line;
PBD::ScopedConnection _mouse_mode_connection;
diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc
index 933a4bf55d..60c8912114 100644
--- a/gtk2_ardour/automation_streamview.cc
+++ b/gtk2_ardour/automation_streamview.cc
@@ -275,15 +275,15 @@ AutomationStreamView::clear ()
}
}
-/** @param start Start position in session frames.
- * @param end End position in session frames.
+/** @param start Start position in session samples.
+ * @param end End position in session samples.
* @param bot Bottom position expressed as a fraction of track height where 0 is the bottom of the track.
* @param top Top position expressed as a fraction of track height where 0 is the bottom of the track.
* NOTE: this y system is different to that for the StreamView method that this overrides, which is a little
* confusing.
*/
void
-AutomationStreamView::get_selectables (framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results, bool /*within*/)
+AutomationStreamView::get_selectables (samplepos_t start, samplepos_t end, double botfrac, double topfrac, list<Selectable*>& results, bool /*within*/)
{
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
AutomationRegionView* arv = dynamic_cast<AutomationRegionView*> (*i);
@@ -319,7 +319,7 @@ AutomationStreamView::get_lines () const
}
bool
-AutomationStreamView::paste (framepos_t pos,
+AutomationStreamView::paste (samplepos_t pos,
unsigned paste_count,
float times,
boost::shared_ptr<ARDOUR::AutomationList> alist)
diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h
index eed0bb7bbb..275b0f3b75 100644
--- a/gtk2_ardour/automation_streamview.h
+++ b/gtk2_ardour/automation_streamview.h
@@ -60,12 +60,12 @@ public:
void clear ();
- void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*> &, bool within = false);
+ void get_selectables (ARDOUR::samplepos_t, ARDOUR::samplepos_t, double, double, std::list<Selectable*> &, bool within = false);
void set_selected_points (PointSelection &);
std::list<boost::shared_ptr<AutomationLine> > get_lines () const;
- bool paste (framepos_t pos,
+ bool paste (samplepos_t pos,
unsigned paste_count,
float times,
boost::shared_ptr<ARDOUR::AutomationList> list);
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 8e74774e79..6d80b14f3b 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -31,7 +31,7 @@
#include "pbd/unwind.h"
#include "ardour/automation_control.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/event_type_map.h"
#include "ardour/parameter_types.h"
#include "ardour/profile.h"
@@ -275,7 +275,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
controls_base_unselected_name = X_("AutomationTrackControlsBase");
controls_ebox.set_name (controls_base_unselected_name);
- time_axis_frame.set_name (controls_base_unselected_name);
+ time_axis_sample.set_name (controls_base_unselected_name);
/* ask for notifications of any new RegionViews */
if (show_regions) {
@@ -726,7 +726,7 @@ AutomationTimeAxisView::build_display_menu ()
}
void
-AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t frame, double y, bool with_guard_points)
+AutomationTimeAxisView::add_automation_event (GdkEvent* event, samplepos_t sample, double y, bool with_guard_points)
{
if (!_line) {
return;
@@ -741,14 +741,14 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t frame,
return;
}
- MusicFrame when (frame, 0);
+ MusicSample when (sample, 0);
_editor.snap_to_with_modifier (when, event);
if (UIConfiguration::instance().get_new_automation_points_on_lane()) {
if (_control->list()->size () == 0) {
y = _control->get_value ();
} else {
- y = _control->list()->eval (when.frame);
+ y = _control->list()->eval (when.sample);
}
} else {
double x = 0;
@@ -762,12 +762,12 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t frame,
XMLNode& before = list->get_state();
std::list<Selectable*> results;
- if (list->editor_add (when.frame, y, with_guard_points)) {
+ if (list->editor_add (when.sample, y, with_guard_points)) {
XMLNode& after = list->get_state();
_editor.begin_reversible_command (_("add automation event"));
_session->add_command (new MementoCommand<ARDOUR::AutomationList> (*list.get (), &before, &after));
- _line->get_selectables (when.frame, when.frame, 0.0, 1.0, results);
+ _line->get_selectables (when.sample, when.sample, 0.0, 1.0, results);
_editor.get_selection ().set (results);
_editor.commit_reversible_command ();
@@ -776,7 +776,7 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t frame,
}
bool
-AutomationTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t divisions)
+AutomationTimeAxisView::paste (samplepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t divisions)
{
if (_line) {
return paste_one (pos, ctx.count, ctx.times, selection, ctx.counts, ctx.greedy);
@@ -797,7 +797,7 @@ AutomationTimeAxisView::paste (framepos_t pos, const Selection& selection, Paste
}
bool
-AutomationTimeAxisView::paste_one (framepos_t pos, unsigned paste_count, float times, const Selection& selection, ItemCounts& counts, bool greedy)
+AutomationTimeAxisView::paste_one (samplepos_t pos, unsigned paste_count, float times, const Selection& selection, ItemCounts& counts, bool greedy)
{
boost::shared_ptr<AutomationList> alist(_line->the_list());
@@ -824,7 +824,7 @@ AutomationTimeAxisView::paste_one (framepos_t pos, unsigned paste_count, float t
if (parameter_is_midi (src_type)) {
// convert length to samples (incl tempo-ramps)
- len = DoubleBeatsFramesConverter (_session->tempo_map(), pos).to (len * paste_count);
+ len = DoubleBeatsSamplesConverter (_session->tempo_map(), pos).to (len * paste_count);
pos += _editor.get_paste_offset (pos, paste_count > 0 ? 1 : 0, len);
} else {
pos += _editor.get_paste_offset (pos, paste_count, len);
@@ -834,14 +834,14 @@ AutomationTimeAxisView::paste_one (framepos_t pos, unsigned paste_count, float t
double const model_pos = _line->time_converter().from (pos - _line->time_converter().origin_b ());
XMLNode &before = alist->get_state();
- alist->paste (**p, model_pos, DoubleBeatsFramesConverter (_session->tempo_map(), pos));
+ alist->paste (**p, model_pos, DoubleBeatsSamplesConverter (_session->tempo_map(), pos));
_session->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
return true;
}
void
-AutomationTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results, bool /*within*/)
+AutomationTimeAxisView::get_selectables (samplepos_t start, samplepos_t end, double top, double bot, list<Selectable*>& results, bool /*within*/)
{
if (!_line && !_view) {
return;
@@ -1138,7 +1138,7 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel
XMLNode &before = alist->get_state();
/* convert time selection to automation list model coordinates */
- const Evoral::TimeConverter<double, ARDOUR::framepos_t>& tc = line.time_converter ();
+ const Evoral::TimeConverter<double, ARDOUR::samplepos_t>& tc = line.time_converter ();
double const start = tc.from (selection.time.front().start - tc.origin_b ());
double const end = tc.from (selection.time.front().end - tc.origin_b ());
diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h
index cabe532646..3129ebdc32 100644
--- a/gtk2_ardour/automation_time_axis.h
+++ b/gtk2_ardour/automation_time_axis.h
@@ -80,7 +80,7 @@ public:
boost::shared_ptr<ARDOUR::Stripable> stripable() const;
ARDOUR::PresentationInfo const & presentation_info () const;
- void add_automation_event (GdkEvent *, framepos_t, double, bool with_guard_points);
+ void add_automation_event (GdkEvent *, samplepos_t, double, bool with_guard_points);
void clear_lines ();
@@ -91,16 +91,16 @@ public:
std::list<boost::shared_ptr<AutomationLine> > lines () const;
void set_selected_points (PointSelection&);
- void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&, bool within = false);
+ void get_selectables (ARDOUR::samplepos_t start, ARDOUR::samplepos_t end, double top, double bot, std::list<Selectable *>&, bool within = false);
void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
- void show_timestretch (framepos_t /*start*/, framepos_t /*end*/, int /*layers*/, int /*layer*/) {}
+ void show_timestretch (samplepos_t /*start*/, samplepos_t /*end*/, int /*layers*/, int /*layer*/) {}
void hide_timestretch () {}
/* editing operations */
void cut_copy_clear (Selection&, Editing::CutCopyOp);
- bool paste (ARDOUR::framepos_t, const Selection&, PasteContext&, const int32_t sub_num);
+ bool paste (ARDOUR::samplepos_t, const Selection&, PasteContext&, const int32_t sub_num);
int set_state (const XMLNode&, int version);
@@ -183,7 +183,7 @@ protected:
void build_display_menu ();
void cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp);
- bool paste_one (ARDOUR::framepos_t, unsigned, float times, const Selection&, ItemCounts& counts, bool greedy=false);
+ bool paste_one (ARDOUR::samplepos_t, unsigned, float times, const Selection&, ItemCounts& counts, bool greedy=false);
void route_going_away ();
void set_automation_state (ARDOUR::AutoState);
diff --git a/gtk2_ardour/clock_group.cc b/gtk2_ardour/clock_group.cc
index f439004aad..5a8c3a9848 100644
--- a/gtk2_ardour/clock_group.cc
+++ b/gtk2_ardour/clock_group.cc
@@ -21,7 +21,7 @@
ClockGroup::ClockGroup ()
: ignore_changes (false)
- , _clock_mode (AudioClock::Frames)
+ , _clock_mode (AudioClock::Samples)
{
}
diff --git a/gtk2_ardour/edit_note_dialog.cc b/gtk2_ardour/edit_note_dialog.cc
index 997713ae2d..d538225b61 100644
--- a/gtk2_ardour/edit_note_dialog.cc
+++ b/gtk2_ardour/edit_note_dialog.cc
@@ -197,7 +197,7 @@ EditNoteDialog::done (int r)
}
}
- framecnt_t const region_samples = _time_clock.current_time() - (_region_view->region()->position() - _region_view->region()->start());
+ samplecnt_t const region_samples = _time_clock.current_time() - (_region_view->region()->position() - _region_view->region()->start());
Evoral::Beats const t = _region_view->source_relative_time_converter().from (region_samples);
if (!_time_all.get_sensitive() || _time_all.get_active ()) {
@@ -211,7 +211,7 @@ EditNoteDialog::done (int r)
if (!_length_all.get_sensitive() || _length_all.get_active ()) {
for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
- framepos_t const note_end_sample = region_samples + _length_clock.current_duration (_time_clock.current_time());
+ samplepos_t const note_end_sample = region_samples + _length_clock.current_duration (_time_clock.current_time());
Evoral::Beats const d = _region_view->source_relative_time_converter().from (note_end_sample) - (*i)->note()->time();
if (d != (*i)->note()->length()) {
_region_view->change_note_length (*i, d);
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 1701c38411..cfc324efc6 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -161,8 +161,8 @@ using Gtkmm2ext::Keyboard;
double Editor::timebar_height = 15.0;
static const gchar *_snap_type_strings[] = {
- N_("CD Frames"),
- N_("TC Frames"),
+ N_("CD Samples"),
+ N_("TC Samples"),
N_("TC Seconds"),
N_("TC Minutes"),
N_("Seconds"),
@@ -248,7 +248,7 @@ Editor::Editor ()
, _playlist_selector (0)
, _time_info_box (0)
, no_save_visual (false)
- , leftmost_frame (0)
+ , _leftmost_sample (0)
, samples_per_pixel (2048)
, zoom_focus (ZoomFocusPlayhead)
, mouse_mode (MouseObject)
@@ -702,14 +702,14 @@ Editor::Editor ()
VBox* summary_arrows_right = manage (new VBox);
summary_arrows_right->pack_start (*summary_arrow_right);
- Frame* summary_frame = manage (new Frame);
- summary_frame->set_shadow_type (Gtk::SHADOW_ETCHED_IN);
+ Frame* summary_sample = manage (new Frame);
+ summary_sample->set_shadow_type (Gtk::SHADOW_ETCHED_IN);
- summary_frame->add (*_summary);
- summary_frame->show ();
+ summary_sample->add (*_summary);
+ summary_sample->show ();
_summary_hbox.pack_start (*summary_arrows_left, false, false);
- _summary_hbox.pack_start (*summary_frame, true, true);
+ _summary_hbox.pack_start (*summary_sample, true, true);
_summary_hbox.pack_start (*summary_arrows_right, false, false);
if (!ARDOUR::Profile->get_trx()) {
@@ -1073,25 +1073,25 @@ Editor::control_scroll (float fraction)
/*
_control_scroll_target is an optional<T>
- it acts like a pointer to an framepos_t, with
+ it acts like a pointer to an samplepos_t, with
a operator conversion to boolean to check
that it has a value could possibly use
- playhead_cursor->current_frame to store the
+ playhead_cursor->current_sample to store the
value and a boolean in the class to know
when it's out of date
*/
if (!_control_scroll_target) {
- _control_scroll_target = _session->transport_frame();
+ _control_scroll_target = _session->transport_sample();
_dragging_playhead = true;
}
- if ((fraction < 0.0f) && (*_control_scroll_target <= (framepos_t) fabs(step))) {
+ if ((fraction < 0.0f) && (*_control_scroll_target <= (samplepos_t) fabs(step))) {
*_control_scroll_target = 0;
- } else if ((fraction > 0.0f) && (max_framepos - *_control_scroll_target < step)) {
- *_control_scroll_target = max_framepos - (current_page_samples()*2); // allow room for slop in where the PH is on the screen
+ } else if ((fraction > 0.0f) && (max_samplepos - *_control_scroll_target < step)) {
+ *_control_scroll_target = max_samplepos - (current_page_samples()*2); // allow room for slop in where the PH is on the screen
} else {
- *_control_scroll_target += (framepos_t) trunc (step);
+ *_control_scroll_target += (samplepos_t) trunc (step);
}
/* move visuals, we'll catch up with it later */
@@ -1122,7 +1122,7 @@ Editor::control_scroll (float fraction)
}
bool
-Editor::deferred_control_scroll (framepos_t /*target*/)
+Editor::deferred_control_scroll (samplepos_t /*target*/)
{
_session->request_locate (*_control_scroll_target, _session->transport_rolling());
// reset for next stream
@@ -1234,46 +1234,46 @@ Editor::lock_timeout_callback ()
}
void
-Editor::map_position_change (framepos_t frame)
+Editor::map_position_change (samplepos_t sample)
{
- ENSURE_GUI_THREAD (*this, &Editor::map_position_change, frame)
+ ENSURE_GUI_THREAD (*this, &Editor::map_position_change, sample)
if (_session == 0) {
return;
}
if (_follow_playhead) {
- center_screen (frame);
+ center_screen (sample);
}
- playhead_cursor->set_position (frame);
+ playhead_cursor->set_position (sample);
}
void
-Editor::center_screen (framepos_t frame)
+Editor::center_screen (samplepos_t sample)
{
- framecnt_t const page = _visible_canvas_width * samples_per_pixel;
+ samplecnt_t const page = _visible_canvas_width * samples_per_pixel;
/* if we're off the page, then scroll.
*/
- if (frame < leftmost_frame || frame >= leftmost_frame + page) {
- center_screen_internal (frame, page);
+ if (sample < _leftmost_sample || sample >= _leftmost_sample + page) {
+ center_screen_internal (sample, page);
}
}
void
-Editor::center_screen_internal (framepos_t frame, float page)
+Editor::center_screen_internal (samplepos_t sample, float page)
{
page /= 2;
- if (frame > page) {
- frame -= (framepos_t) page;
+ if (sample > page) {
+ sample -= (samplepos_t) page;
} else {
- frame = 0;
+ sample = 0;
}
- reset_x_origin (frame);
+ reset_x_origin (sample);
}
@@ -1319,9 +1319,9 @@ Editor::set_session (Session *t)
return;
}
- //initialize leftmost_frame to the extents of the session
- //this prevents a bogus setting of leftmost = "0" if the summary view asks for the leftmost frame before the visible state has been loaded from instant.xml
- leftmost_frame = session_gui_extents().first;
+ //initialize _leftmost_sample to the extents of the session
+ //this prevents a bogus setting of leftmost = "0" if the summary view asks for the leftmost sample before the visible state has been loaded from instant.xml
+ _leftmost_sample = session_gui_extents().first;
_playlist_selector->set_session (_session);
nudge_clock->set_session (_session);
@@ -1377,7 +1377,7 @@ Editor::set_session (Session *t)
/* catch up with the playhead */
- _session->request_locate (playhead_cursor->current_frame ());
+ _session->request_locate (playhead_cursor->current_sample ());
_pending_initial_locate = true;
update_title ();
@@ -1740,7 +1740,7 @@ Editor::loudness_analyze_region_selection ()
Selection& s (PublicEditor::instance ().get_selection ());
RegionSelection ars = s.regions;
ARDOUR::AnalysisGraph ag (_session);
- framecnt_t total_work = 0;
+ samplecnt_t total_work = 0;
for (RegionSelection::iterator j = ars.begin (); j != ars.end (); ++j) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*j);
@@ -1756,7 +1756,7 @@ Editor::loudness_analyze_region_selection ()
SimpleProgressDialog spd (_("Region Loudness Analysis"), sigc::mem_fun (ag, &AnalysisGraph::cancel));
ScopedConnection c;
- ag.set_total_frames (total_work);
+ ag.set_total_samples (total_work);
ag.Progress.connect_same_thread (c, boost::bind (&SimpleProgressDialog::update_progress, &spd, _1, _2));
spd.show();
@@ -1787,7 +1787,7 @@ Editor::loudness_analyze_range_selection ()
Selection& s (PublicEditor::instance ().get_selection ());
TimeSelection ts = s.time;
ARDOUR::AnalysisGraph ag (_session);
- framecnt_t total_work = 0;
+ samplecnt_t total_work = 0;
for (TrackSelection::iterator i = s.tracks.begin (); i != s.tracks.end (); ++i) {
boost::shared_ptr<AudioPlaylist> pl = boost::dynamic_pointer_cast<AudioPlaylist> ((*i)->playlist ());
@@ -1805,7 +1805,7 @@ Editor::loudness_analyze_range_selection ()
SimpleProgressDialog spd (_("Range Loudness Analysis"), sigc::mem_fun (ag, &AnalysisGraph::cancel));
ScopedConnection c;
- ag.set_total_frames (total_work);
+ ag.set_total_samples (total_work);
ag.Progress.connect_same_thread (c, boost::bind (&SimpleProgressDialog::update_progress, &spd, _1, _2));
spd.show();
@@ -1906,7 +1906,7 @@ Editor::add_region_context_items (Menu_Helpers::MenuList& edit_items, boost::sha
act->set_sensitive (true);
}
- const framepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, true);
+ const samplepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, true);
edit_items.push_back (*_popup_region_menu_item);
if (Config->get_layer_model() == Manual && track->playlist()->count_regions_at (position) > 1 && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) {
@@ -2219,7 +2219,7 @@ Editor::set_snap_to (SnapType st)
case SnapToBeatDiv4:
case SnapToBeatDiv3:
case SnapToBeatDiv2: {
- compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
+ compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
update_tempo_based_rulers ();
break;
}
@@ -2301,10 +2301,10 @@ Editor::set_edit_point_preference (EditPoint ep, bool force)
Glib::RefPtr<RadioAction>::cast_dynamic(act)->set_active (true);
}
- framepos_t foo;
+ samplepos_t foo;
bool in_track_canvas;
- if (!mouse_frame (foo, in_track_canvas)) {
+ if (!mouse_sample (foo, in_track_canvas)) {
in_track_canvas = false;
}
@@ -2323,7 +2323,7 @@ Editor::set_state (const XMLNode& node, int version)
Tabbable::set_state (node, version);
- framepos_t ph_pos;
+ samplepos_t ph_pos;
if (_session && node.get_property ("playhead", ph_pos)) {
if (ph_pos >= 0) {
playhead_cursor->set_position (ph_pos);
@@ -2384,7 +2384,7 @@ Editor::set_state (const XMLNode& node, int version)
set_mouse_mode (MouseObject, true);
}
- framepos_t lf_pos;
+ samplepos_t lf_pos;
if (node.get_property ("left-frame", lf_pos)) {
if (lf_pos < 0) {
lf_pos = 0;
@@ -2486,12 +2486,12 @@ Editor::set_state (const XMLNode& node, int version)
}
}
- framepos_t nudge_clock_value;
+ samplepos_t nudge_clock_value;
if (node.get_property ("nudge-clock-value", nudge_clock_value)) {
nudge_clock->set (nudge_clock_value);
} else {
nudge_clock->set_mode (AudioClock::Timecode);
- nudge_clock->set (_session->frame_rate() * 5, true);
+ nudge_clock->set (_session->sample_rate() * 5, true);
}
{
@@ -2559,8 +2559,8 @@ Editor::get_state ()
node->set_property ("edit-point", _edit_point);
node->set_property ("visible-track-count", _visible_track_count);
- node->set_property ("playhead", playhead_cursor->current_frame ());
- node->set_property ("left-frame", leftmost_frame);
+ node->set_property ("playhead", playhead_cursor->current_sample ());
+ node->set_property ("left-frame", _leftmost_sample);
node->set_property ("y-origin", vertical_adjustment.get_value ());
node->set_property ("show-measures", _show_measures);
@@ -2642,7 +2642,7 @@ Editor::trackview_by_y_position (double y, bool trackview_relative_offset) const
* @param event Event to get current key modifier information from, or 0.
*/
void
-Editor::snap_to_with_modifier (MusicFrame& start, GdkEvent const * event, RoundMode direction, bool for_mark)
+Editor::snap_to_with_modifier (MusicSample& start, GdkEvent const * event, RoundMode direction, bool for_mark)
{
if (!_session || !event) {
return;
@@ -2652,7 +2652,7 @@ Editor::snap_to_with_modifier (MusicFrame& start, GdkEvent const * event, RoundM
if (_snap_mode == SnapOff) {
snap_to_internal (start, direction, for_mark);
} else {
- start.set (start.frame, 0);
+ start.set (start.sample, 0);
}
} else {
if (_snap_mode != SnapOff) {
@@ -2661,16 +2661,16 @@ Editor::snap_to_with_modifier (MusicFrame& start, GdkEvent const * event, RoundM
/* SnapOff, but we pressed the snap_delta modifier */
snap_to_internal (start, direction, for_mark);
} else {
- start.set (start.frame, 0);
+ start.set (start.sample, 0);
}
}
}
void
-Editor::snap_to (MusicFrame& start, RoundMode direction, bool for_mark, bool ensure_snap)
+Editor::snap_to (MusicSample& start, RoundMode direction, bool for_mark, bool ensure_snap)
{
if (!_session || (_snap_mode == SnapOff && !ensure_snap)) {
- start.set (start.frame, 0);
+ start.set (start.sample, 0);
return;
}
@@ -2678,11 +2678,11 @@ Editor::snap_to (MusicFrame& start, RoundMode direction, bool for_mark, bool ens
}
void
-Editor::timecode_snap_to_internal (MusicFrame& pos, RoundMode direction, bool /*for_mark*/)
+Editor::timecode_snap_to_internal (MusicSample& pos, RoundMode direction, bool /*for_mark*/)
{
- framepos_t start = pos.frame;
- const framepos_t one_timecode_second = (framepos_t)(rint(_session->timecode_frames_per_second()) * _session->samples_per_timecode_frame());
- framepos_t one_timecode_minute = (framepos_t)(rint(_session->timecode_frames_per_second()) * _session->samples_per_timecode_frame() * 60);
+ samplepos_t start = pos.sample;
+ const samplepos_t one_timecode_second = (samplepos_t)(rint(_session->timecode_frames_per_second()) * _session->samples_per_timecode_frame());
+ samplepos_t one_timecode_minute = (samplepos_t)(rint(_session->timecode_frames_per_second()) * _session->samples_per_timecode_frame() * 60);
switch (_snap_type) {
case SnapToTimecodeFrame:
@@ -2690,9 +2690,9 @@ Editor::timecode_snap_to_internal (MusicFrame& pos, RoundMode direction, bool /*
fmod((double)start, (double)_session->samples_per_timecode_frame()) == 0) {
/* start is already on a whole timecode frame, do nothing */
} else if (((direction == 0) && (fmod((double)start, (double)_session->samples_per_timecode_frame()) > (_session->samples_per_timecode_frame() / 2))) || (direction > 0)) {
- start = (framepos_t) (ceil ((double) start / _session->samples_per_timecode_frame()) * _session->samples_per_timecode_frame());
+ start = (samplepos_t) (ceil ((double) start / _session->samples_per_timecode_frame()) * _session->samples_per_timecode_frame());
} else {
- start = (framepos_t) (floor ((double) start / _session->samples_per_timecode_frame()) * _session->samples_per_timecode_frame());
+ start = (samplepos_t) (floor ((double) start / _session->samples_per_timecode_frame()) * _session->samples_per_timecode_frame());
}
break;
@@ -2706,9 +2706,9 @@ Editor::timecode_snap_to_internal (MusicFrame& pos, RoundMode direction, bool /*
(start % one_timecode_second == 0)) {
/* start is already on a whole second, do nothing */
} else if (((direction == 0) && (start % one_timecode_second > one_timecode_second / 2)) || direction > 0) {
- start = (framepos_t) ceil ((double) start / one_timecode_second) * one_timecode_second;
+ start = (samplepos_t) ceil ((double) start / one_timecode_second) * one_timecode_second;
} else {
- start = (framepos_t) floor ((double) start / one_timecode_second) * one_timecode_second;
+ start = (samplepos_t) floor ((double) start / one_timecode_second) * one_timecode_second;
}
if (_session->config.get_timecode_offset_negative()) {
@@ -2728,9 +2728,9 @@ Editor::timecode_snap_to_internal (MusicFrame& pos, RoundMode direction, bool /*
(start % one_timecode_minute == 0)) {
/* start is already on a whole minute, do nothing */
} else if (((direction == 0) && (start % one_timecode_minute > one_timecode_minute / 2)) || direction > 0) {
- start = (framepos_t) ceil ((double) start / one_timecode_minute) * one_timecode_minute;
+ start = (samplepos_t) ceil ((double) start / one_timecode_minute) * one_timecode_minute;
} else {
- start = (framepos_t) floor ((double) start / one_timecode_minute) * one_timecode_minute;
+ start = (samplepos_t) floor ((double) start / one_timecode_minute) * one_timecode_minute;
}
if (_session->config.get_timecode_offset_negative()) {
start -= _session->config.get_timecode_offset ();
@@ -2747,13 +2747,13 @@ Editor::timecode_snap_to_internal (MusicFrame& pos, RoundMode direction, bool /*
}
void
-Editor::snap_to_internal (MusicFrame& start, RoundMode direction, bool for_mark, bool ensure_snap)
+Editor::snap_to_internal (MusicSample& start, RoundMode direction, bool for_mark, bool ensure_snap)
{
- const framepos_t one_second = _session->frame_rate();
- const framepos_t one_minute = _session->frame_rate() * 60;
- framepos_t presnap = start.frame;
- framepos_t before;
- framepos_t after;
+ const samplepos_t one_second = _session->sample_rate();
+ const samplepos_t one_minute = _session->sample_rate() * 60;
+ samplepos_t presnap = start.sample;
+ samplepos_t before;
+ samplepos_t after;
switch (_snap_type) {
case SnapToTimecodeFrame:
@@ -2763,104 +2763,104 @@ Editor::snap_to_internal (MusicFrame& start, RoundMode direction, bool for_mark,
case SnapToCDFrame:
if ((direction == RoundUpMaybe || direction == RoundDownMaybe) &&
- start.frame % (one_second/75) == 0) {
- /* start is already on a whole CD frame, do nothing */
- } else if (((direction == 0) && (start.frame % (one_second/75) > (one_second/75) / 2)) || (direction > 0)) {
- start.frame = (framepos_t) ceil ((double) start.frame / (one_second / 75)) * (one_second / 75);
+ start.sample % (one_second/75) == 0) {
+ /* start is already on a whole CD sample, do nothing */
+ } else if (((direction == 0) && (start.sample % (one_second/75) > (one_second/75) / 2)) || (direction > 0)) {
+ start.sample = (samplepos_t) ceil ((double) start.sample / (one_second / 75)) * (one_second / 75);
} else {
- start.frame = (framepos_t) floor ((double) start.frame / (one_second / 75)) * (one_second / 75);
+ start.sample = (samplepos_t) floor ((double) start.sample / (one_second / 75)) * (one_second / 75);
}
- start.set (start.frame, 0);
+ start.set (start.sample, 0);
break;
case SnapToSeconds:
if ((direction == RoundUpMaybe || direction == RoundDownMaybe) &&
- start.frame % one_second == 0) {
+ start.sample % one_second == 0) {
/* start is already on a whole second, do nothing */
- } else if (((direction == 0) && (start.frame % one_second > one_second / 2)) || (direction > 0)) {
- start.frame = (framepos_t) ceil ((double) start.frame / one_second) * one_second;
+ } else if (((direction == 0) && (start.sample % one_second > one_second / 2)) || (direction > 0)) {
+ start.sample = (samplepos_t) ceil ((double) start.sample / one_second) * one_second;
} else {
- start.frame = (framepos_t) floor ((double) start.frame / one_second) * one_second;
+ start.sample = (samplepos_t) floor ((double) start.sample / one_second) * one_second;
}
- start.set (start.frame, 0);
+ start.set (start.sample, 0);
break;
case SnapToMinutes:
if ((direction == RoundUpMaybe || direction == RoundDownMaybe) &&
- start.frame % one_minute == 0) {
+ start.sample % one_minute == 0) {
/* start is already on a whole minute, do nothing */
- } else if (((direction == 0) && (start.frame % one_minute > one_minute / 2)) || (direction > 0)) {
- start.frame = (framepos_t) ceil ((double) start.frame / one_minute) * one_minute;
+ } else if (((direction == 0) && (start.sample % one_minute > one_minute / 2)) || (direction > 0)) {
+ start.sample = (samplepos_t) ceil ((double) start.sample / one_minute) * one_minute;
} else {
- start.frame = (framepos_t) floor ((double) start.frame / one_minute) * one_minute;
+ start.sample = (samplepos_t) floor ((double) start.sample / one_minute) * one_minute;
}
- start.set (start.frame, 0);
+ start.set (start.sample, 0);
break;
case SnapToBar:
- start = _session->tempo_map().round_to_bar (start.frame, direction);
+ start = _session->tempo_map().round_to_bar (start.sample, direction);
break;
case SnapToBeat:
- start = _session->tempo_map().round_to_beat (start.frame, direction);
+ start = _session->tempo_map().round_to_beat (start.sample, direction);
break;
case SnapToBeatDiv128:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 128, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 128, direction);
break;
case SnapToBeatDiv64:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 64, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 64, direction);
break;
case SnapToBeatDiv32:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 32, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 32, direction);
break;
case SnapToBeatDiv28:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 28, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 28, direction);
break;
case SnapToBeatDiv24:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 24, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 24, direction);
break;
case SnapToBeatDiv20:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 20, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 20, direction);
break;
case SnapToBeatDiv16:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 16, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 16, direction);
break;
case SnapToBeatDiv14:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 14, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 14, direction);
break;
case SnapToBeatDiv12:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 12, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 12, direction);
break;
case SnapToBeatDiv10:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 10, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 10, direction);
break;
case SnapToBeatDiv8:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 8, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 8, direction);
break;
case SnapToBeatDiv7:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 7, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 7, direction);
break;
case SnapToBeatDiv6:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 6, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 6, direction);
break;
case SnapToBeatDiv5:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 5, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 5, direction);
break;
case SnapToBeatDiv4:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 4, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 4, direction);
break;
case SnapToBeatDiv3:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 3, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 3, direction);
break;
case SnapToBeatDiv2:
- start = _session->tempo_map().round_to_quarter_note_subdivision (start.frame, 2, direction);
+ start = _session->tempo_map().round_to_quarter_note_subdivision (start.sample, 2, direction);
break;
case SnapToMark:
@@ -2868,30 +2868,30 @@ Editor::snap_to_internal (MusicFrame& start, RoundMode direction, bool for_mark,
return;
}
- _session->locations()->marks_either_side (start.frame, before, after);
+ _session->locations()->marks_either_side (start.sample, before, after);
- if (before == max_framepos && after == max_framepos) {
+ if (before == max_samplepos && after == max_samplepos) {
/* No marks to snap to, so just don't snap */
return;
- } else if (before == max_framepos) {
- start.frame = after;
- } else if (after == max_framepos) {
- start.frame = before;
- } else if (before != max_framepos && after != max_framepos) {
+ } else if (before == max_samplepos) {
+ start.sample = after;
+ } else if (after == max_samplepos) {
+ start.sample = before;
+ } else if (before != max_samplepos && after != max_samplepos) {
if ((direction == RoundUpMaybe || direction == RoundUpAlways))
- start.frame = after;
+ start.sample = after;
else if ((direction == RoundDownMaybe || direction == RoundDownAlways))
- start.frame = before;
+ start.sample = before;
else if (direction == 0 ) {
- if ((start.frame - before) < (after - start.frame)) {
- start.frame = before;
+ if ((start.sample - before) < (after - start.sample)) {
+ start.sample = before;
} else {
- start.frame = after;
+ start.sample = after;
}
}
}
- start.set (start.frame, 0);
+ start.set (start.sample, 0);
break;
@@ -2901,13 +2901,13 @@ Editor::snap_to_internal (MusicFrame& start, RoundMode direction, bool for_mark,
case SnapToRegionBoundary:
if (!region_boundary_cache.empty()) {
- vector<framepos_t>::iterator prev = region_boundary_cache.end ();
- vector<framepos_t>::iterator next = region_boundary_cache.end ();
+ vector<samplepos_t>::iterator prev = region_boundary_cache.end ();
+ vector<samplepos_t>::iterator next = region_boundary_cache.end ();
if (direction > 0) {
- next = std::upper_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start.frame);
+ next = std::upper_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start.sample);
} else {
- next = std::lower_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start.frame);
+ next = std::lower_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start.sample);
}
if (next != region_boundary_cache.begin ()) {
@@ -2915,17 +2915,17 @@ Editor::snap_to_internal (MusicFrame& start, RoundMode direction, bool for_mark,
prev--;
}
- framepos_t const p = (prev == region_boundary_cache.end()) ? region_boundary_cache.front () : *prev;
- framepos_t const n = (next == region_boundary_cache.end()) ? region_boundary_cache.back () : *next;
+ samplepos_t const p = (prev == region_boundary_cache.end()) ? region_boundary_cache.front () : *prev;
+ samplepos_t const n = (next == region_boundary_cache.end()) ? region_boundary_cache.back () : *next;
- if (start.frame > (p + n) / 2) {
- start.frame = n;
+ if (start.sample > (p + n) / 2) {
+ start.sample = n;
} else {
- start.frame = p;
+ start.sample = p;
}
}
- start.set (start.frame, 0);
+ start.set (start.sample, 0);
break;
}
@@ -2940,13 +2940,13 @@ Editor::snap_to_internal (MusicFrame& start, RoundMode direction, bool for_mark,
return;
}
- if (presnap > start.frame) {
- if (presnap > (start.frame + pixel_to_sample(snap_threshold))) {
+ if (presnap > start.sample) {
+ if (presnap > (start.sample + pixel_to_sample(snap_threshold))) {
start.set (presnap, 0);
}
- } else if (presnap < start.frame) {
- if (presnap < (start.frame - pixel_to_sample(snap_threshold))) {
+ } else if (presnap < start.sample) {
+ if (presnap < (start.sample - pixel_to_sample(snap_threshold))) {
start.set (presnap, 0);
}
}
@@ -3795,7 +3795,7 @@ Editor::set_zoom_preset (int64_t ms)
return;
}
- ARDOUR::framecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
+ ARDOUR::samplecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
temporal_zoom( (sample_rate * ms / 1000) / _visible_canvas_width );
}
@@ -3942,7 +3942,7 @@ Editor::set_show_measures (bool yn)
}
std::vector<TempoMap::BBTPoint> grid;
- compute_current_bbt_points (grid, leftmost_frame, leftmost_frame + current_page_samples());
+ compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples());
draw_measures (grid);
}
@@ -4004,8 +4004,8 @@ Editor::playlist_selector () const
return *_playlist_selector;
}
-framecnt_t
-Editor::get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t duration)
+samplecnt_t
+Editor::get_paste_offset (samplepos_t pos, unsigned paste_count, samplecnt_t duration)
{
if (paste_count == 0) {
/* don't bother calculating an offset that will be zero anyway */
@@ -4013,18 +4013,18 @@ Editor::get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t durat
}
/* calculate basic unsnapped multi-paste offset */
- framecnt_t offset = paste_count * duration;
+ samplecnt_t offset = paste_count * duration;
/* snap offset so pos + offset is aligned to the grid */
- MusicFrame offset_pos (pos + offset, 0);
+ MusicSample offset_pos (pos + offset, 0);
snap_to(offset_pos, RoundUpMaybe);
- offset = offset_pos.frame - pos;
+ offset = offset_pos.sample - pos;
return offset;
}
unsigned
-Editor::get_grid_beat_divisions(framepos_t position)
+Editor::get_grid_beat_divisions(samplepos_t position)
{
switch (_snap_type) {
case SnapToBeatDiv128: return 128;
@@ -4091,7 +4091,7 @@ Editor::get_grid_music_divisions (uint32_t event_state)
}
Evoral::Beats
-Editor::get_grid_type_as_beats (bool& success, framepos_t position)
+Editor::get_grid_type_as_beats (bool& success, samplepos_t position)
{
success = true;
@@ -4102,10 +4102,10 @@ Editor::get_grid_type_as_beats (bool& success, framepos_t position)
switch (_snap_type) {
case SnapToBeat:
- return Evoral::Beats(4.0 / _session->tempo_map().meter_at_frame (position).note_divisor());
+ return Evoral::Beats(4.0 / _session->tempo_map().meter_at_sample (position).note_divisor());
case SnapToBar:
if (_session) {
- const Meter& m = _session->tempo_map().meter_at_frame (position);
+ const Meter& m = _session->tempo_map().meter_at_sample (position);
return Evoral::Beats((4.0 * m.divisions_per_bar()) / m.note_divisor());
}
break;
@@ -4117,10 +4117,10 @@ Editor::get_grid_type_as_beats (bool& success, framepos_t position)
return Evoral::Beats();
}
-framecnt_t
-Editor::get_nudge_distance (framepos_t pos, framecnt_t& next)
+samplecnt_t
+Editor::get_nudge_distance (samplepos_t pos, samplecnt_t& next)
{
- framecnt_t ret;
+ samplecnt_t ret;
ret = nudge_clock->current_duration (pos);
next = ret + 1; /* XXXX fix me */
@@ -4180,7 +4180,7 @@ Editor::playlist_deletion_dialog (boost::shared_ptr<Playlist> pl)
}
bool
-Editor::audio_region_selection_covers (framepos_t where)
+Editor::audio_region_selection_covers (samplepos_t where)
{
for (RegionSelection::iterator a = selection->regions.begin(); a != selection->regions.end(); ++a) {
if ((*a)->region()->covers (where)) {
@@ -4351,13 +4351,13 @@ Editor::get_y_origin () const
}
/** Queue up a change to the viewport x origin.
- * @param frame New x origin.
+ * @param sample New x origin.
*/
void
-Editor::reset_x_origin (framepos_t frame)
+Editor::reset_x_origin (samplepos_t sample)
{
pending_visual_change.add (VisualChange::TimeOrigin);
- pending_visual_change.time_origin = frame;
+ pending_visual_change.time_origin = sample;
ensure_visual_change_idle_handler ();
}
@@ -4370,7 +4370,7 @@ Editor::reset_y_origin (double y)
}
void
-Editor::reset_zoom (framecnt_t spp)
+Editor::reset_zoom (samplecnt_t spp)
{
if (spp == samples_per_pixel) {
return;
@@ -4382,9 +4382,9 @@ Editor::reset_zoom (framecnt_t spp)
}
void
-Editor::reposition_and_zoom (framepos_t frame, double fpu)
+Editor::reposition_and_zoom (samplepos_t sample, double fpu)
{
- reset_x_origin (frame);
+ reset_x_origin (sample);
reset_zoom (fpu);
if (!no_save_visual) {
@@ -4408,7 +4408,7 @@ Editor::current_visual_state (bool with_tracks)
VisualState* vs = new VisualState (with_tracks);
vs->y_position = vertical_adjustment.get_value();
vs->samples_per_pixel = samples_per_pixel;
- vs->leftmost_frame = leftmost_frame;
+ vs->_leftmost_sample = _leftmost_sample;
vs->zoom_focus = zoom_focus;
if (with_tracks) {
@@ -4474,7 +4474,7 @@ Editor::use_visual_state (VisualState& vs)
vertical_adjustment.set_value (vs.y_position);
set_zoom_focus (vs.zoom_focus);
- reposition_and_zoom (vs.leftmost_frame, vs.samples_per_pixel);
+ reposition_and_zoom (vs._leftmost_sample, vs.samples_per_pixel);
if (vs.gui_state) {
ARDOUR_UI::instance()->gui_object_state->set_state (vs.gui_state->get_state());
@@ -4493,14 +4493,14 @@ Editor::use_visual_state (VisualState& vs)
* @param spp new number of samples per pixel
*/
void
-Editor::set_samples_per_pixel (framecnt_t spp)
+Editor::set_samples_per_pixel (samplecnt_t spp)
{
if (spp < 1) {
return;
}
- const framecnt_t three_days = 3 * 24 * 60 * 60 * (_session ? _session->frame_rate() : 48000);
- const framecnt_t lots_of_pixels = 4000;
+ const samplecnt_t three_days = 3 * 24 * 60 * 60 * (_session ? _session->sample_rate() : 48000);
+ const samplecnt_t lots_of_pixels = 4000;
/* if the zoom level is greater than what you'd get trying to display 3
* days of audio on a really big screen, then it's too big.
@@ -4522,7 +4522,7 @@ Editor::on_samples_per_pixel_changed ()
bool const showing_time_selection = selection->time.length() > 0;
- if (showing_time_selection && selection->time.start () != selection->time.end_frame ()) {
+ if (showing_time_selection && selection->time.start () != selection->time.end_sample ()) {
for (TrackViewList::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
(*i)->reshow_selection (selection->time);
}
@@ -4538,7 +4538,7 @@ Editor::on_samples_per_pixel_changed ()
}
if (playhead_cursor) {
- playhead_cursor->set_position (playhead_cursor->current_frame ());
+ playhead_cursor->set_position (playhead_cursor->current_sample ());
}
refresh_location_display();
@@ -4549,10 +4549,10 @@ Editor::on_samples_per_pixel_changed ()
instant_save ();
}
-framepos_t
+samplepos_t
Editor::playhead_cursor_sample () const
{
- return playhead_cursor->current_frame();
+ return playhead_cursor->current_sample();
}
void
@@ -4697,11 +4697,11 @@ Editor::sort_track_selection (TrackViewList& sel)
sel.sort (cmp);
}
-framepos_t
+samplepos_t
Editor::get_preferred_edit_position (EditIgnoreOption ignore, bool from_context_menu, bool from_outside_canvas)
{
bool ignored;
- framepos_t where = 0;
+ samplepos_t where = 0;
EditPoint ep = _edit_point;
if (Profile->get_mixbus()) {
@@ -4729,14 +4729,14 @@ Editor::get_preferred_edit_position (EditIgnoreOption ignore, bool from_context_
ep = EditAtPlayhead;
}
- MusicFrame snap_mf (0, 0);
+ MusicSample snap_mf (0, 0);
switch (ep) {
case EditAtPlayhead:
if (_dragging_playhead && _control_scroll_target) {
where = *_control_scroll_target;
} else {
- where = _session->audible_frame();
+ where = _session->audible_sample();
}
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use playhead @ %1\n", where));
break;
@@ -4759,13 +4759,13 @@ Editor::get_preferred_edit_position (EditIgnoreOption ignore, bool from_context_
default:
case EditAtMouse:
- if (!mouse_frame (where, ignored)) {
+ if (!mouse_sample (where, ignored)) {
/* XXX not right but what can we do ? */
return 0;
}
- snap_mf.frame = where;
+ snap_mf.sample = where;
snap_to (snap_mf);
- where = snap_mf.frame;
+ where = snap_mf.sample;
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use mouse @ %1\n", where));
break;
}
@@ -4774,7 +4774,7 @@ Editor::get_preferred_edit_position (EditIgnoreOption ignore, bool from_context_
}
void
-Editor::set_loop_range (framepos_t start, framepos_t end, string cmd)
+Editor::set_loop_range (samplepos_t start, samplepos_t end, string cmd)
{
if (!_session) return;
@@ -4801,7 +4801,7 @@ Editor::set_loop_range (framepos_t start, framepos_t end, string cmd)
}
void
-Editor::set_punch_range (framepos_t start, framepos_t end, string cmd)
+Editor::set_punch_range (samplepos_t start, samplepos_t end, string cmd)
{
if (!_session) return;
@@ -4833,7 +4833,7 @@ Editor::set_punch_range (framepos_t start, framepos_t end, string cmd)
* @param ts Tracks to look on; if this is empty, all tracks are examined.
*/
void
-Editor::get_regions_at (RegionSelection& rs, framepos_t where, const TrackViewList& ts) const
+Editor::get_regions_at (RegionSelection& rs, samplepos_t where, const TrackViewList& ts) const
{
const TrackViewList* tracks;
@@ -4867,7 +4867,7 @@ Editor::get_regions_at (RegionSelection& rs, framepos_t where, const TrackViewLi
}
void
-Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackViewList& ts) const
+Editor::get_regions_after (RegionSelection& rs, samplepos_t where, const TrackViewList& ts) const
{
const TrackViewList* tracks;
@@ -4885,7 +4885,7 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
- boost::shared_ptr<RegionList> regions = pl->regions_touched (where, max_framepos);
+ boost::shared_ptr<RegionList> regions = pl->regions_touched (where, max_samplepos);
for (RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
@@ -4930,7 +4930,7 @@ Editor::get_regions_from_selection_and_edit_point (EditIgnoreOption ignore, bool
/* no region selected or entered, but some selected tracks:
* act on all regions on the selected tracks at the edit point
*/
- framepos_t const where = get_preferred_edit_position (ignore, from_context_menu, from_outside_canvas);
+ samplepos_t const where = get_preferred_edit_position (ignore, from_context_menu, from_outside_canvas);
get_regions_at(regions, where, tracks);
}
}
@@ -4950,7 +4950,7 @@ Editor::get_regions_from_selection_and_edit_point (EditIgnoreOption ignore, bool
* Note that we have forced the rule that selected regions and selected tracks are mutually exclusive
*/
RegionSelection
-Editor::get_regions_from_selection_and_mouse (framepos_t pos)
+Editor::get_regions_from_selection_and_mouse (samplepos_t pos)
{
RegionSelection regions;
@@ -5233,7 +5233,7 @@ Editor::located ()
ENSURE_GUI_THREAD (*this, &Editor::located);
if (_session) {
- playhead_cursor->set_position (_session->audible_frame ());
+ playhead_cursor->set_position (_session->audible_sample ());
if (_follow_playhead && !_pending_initial_locate) {
reset_x_origin_to_follow_playhead ();
}
@@ -5727,39 +5727,39 @@ Editor::scroll_release ()
void
Editor::reset_x_origin_to_follow_playhead ()
{
- framepos_t const frame = playhead_cursor->current_frame ();
+ samplepos_t const sample = playhead_cursor->current_sample ();
- if (frame < leftmost_frame || frame > leftmost_frame + current_page_samples()) {
+ if (sample < _leftmost_sample || sample > _leftmost_sample + current_page_samples()) {
if (_session->transport_speed() < 0) {
- if (frame > (current_page_samples() / 2)) {
- center_screen (frame-(current_page_samples()/2));
+ if (sample > (current_page_samples() / 2)) {
+ center_screen (sample-(current_page_samples()/2));
} else {
center_screen (current_page_samples()/2);
}
} else {
- framepos_t l = 0;
+ samplepos_t l = 0;
- if (frame < leftmost_frame) {
+ if (sample < _leftmost_sample) {
/* moving left */
if (_session->transport_rolling()) {
/* rolling; end up with the playhead at the right of the page */
- l = frame - current_page_samples ();
+ l = sample - current_page_samples ();
} else {
/* not rolling: end up with the playhead 1/4 of the way along the page */
- l = frame - current_page_samples() / 4;
+ l = sample - current_page_samples() / 4;
}
} else {
/* moving right */
if (_session->transport_rolling()) {
/* rolling: end up with the playhead on the left of the page */
- l = frame;
+ l = sample;
} else {
/* not rolling: end up with the playhead 3/4 of the way along the page */
- l = frame - 3 * current_page_samples() / 4;
+ l = sample - 3 * current_page_samples() / 4;
}
}
@@ -5805,7 +5805,7 @@ Editor::super_rapid_screen_update ()
* will move the playhead before the locate request is processed, causing
* a visual glitch.
* 2. if we're not rolling, there's nothing to do here (locates are handled elsewhere).
- * 3. if we're still at the same frame that we were last time, there's nothing to do.
+ * 3. if we're still at the same sample that we were last time, there's nothing to do.
*/
if (_pending_locate_request || !_session->transport_rolling ()) {
_last_update_time = 0;
@@ -5818,7 +5818,7 @@ Editor::super_rapid_screen_update ()
}
bool latent_locate = false;
- framepos_t frame = _session->audible_frame (&latent_locate);
+ samplepos_t sample = _session->audible_sample (&latent_locate);
const int64_t now = g_get_monotonic_time ();
double err = 0;
@@ -5831,20 +5831,20 @@ Editor::super_rapid_screen_update ()
if (_last_update_time > 0) {
/* interpolate and smoothen playhead position */
- const double ds = (now - _last_update_time) * _session->transport_speed() * _session->nominal_frame_rate () * 1e-6;
- framepos_t guess = playhead_cursor->current_frame () + rint (ds);
- err = frame - guess;
+ const double ds = (now - _last_update_time) * _session->transport_speed() * _session->nominal_sample_rate () * 1e-6;
+ samplepos_t guess = playhead_cursor->current_sample () + rint (ds);
+ err = sample - guess;
guess += err * .12 + _err_screen_engine; // time-constant based on 25fps (super_rapid_screen_update)
_err_screen_engine += .0144 * (err - _err_screen_engine); // tc^2
#if 0 // DEBUG
printf ("eng: %ld gui:%ld (%+6.1f) diff: %6.1f (err: %7.2f)\n",
- frame, guess, ds,
+ sample, guess, ds,
err, _err_screen_engine);
#endif
- frame = guess;
+ sample = guess;
} else {
_err_screen_engine = 0;
}
@@ -5852,18 +5852,18 @@ Editor::super_rapid_screen_update ()
if (err > 8192 || latent_locate) {
// in case of x-runs or freewheeling
_last_update_time = 0;
- frame = _session->audible_frame ();
+ sample = _session->audible_sample ();
} else {
_last_update_time = now;
}
- if (playhead_cursor->current_frame () == frame) {
+ if (playhead_cursor->current_sample () == sample) {
return;
}
- playhead_cursor->set_position (frame);
+ playhead_cursor->set_position (sample);
- if (_session->requested_return_frame() >= 0) {
+ if (_session->requested_return_sample() >= 0) {
_last_update_time = 0;
return;
}
@@ -5882,13 +5882,13 @@ Editor::super_rapid_screen_update ()
if (!_stationary_playhead) {
reset_x_origin_to_follow_playhead ();
} else {
- framepos_t const frame = playhead_cursor->current_frame ();
- double target = ((double)frame - (double)current_page_samples() / 2.0);
+ samplepos_t const sample = playhead_cursor->current_sample ();
+ double target = ((double)sample - (double)current_page_samples() / 2.0);
if (target <= 0.0) {
target = 0.0;
}
// compare to EditorCursor::set_position()
- double const old_pos = sample_to_pixel_unrounded (leftmost_frame);
+ double const old_pos = sample_to_pixel_unrounded (_leftmost_sample);
double const new_pos = sample_to_pixel_unrounded (target);
if (rint (new_pos) != rint (old_pos)) {
reset_x_origin (pixel_to_sample (new_pos));
@@ -5991,7 +5991,7 @@ Editor::show_editor_list (bool yn)
void
Editor::change_region_layering_order (bool from_context_menu)
{
- const framepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, from_context_menu);
+ const samplepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, from_context_menu);
if (!clicked_routeview) {
if (layering_order_editor) {
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 68ba110123..3eed94ddcf 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -149,10 +149,10 @@ public:
void first_idle ();
virtual bool have_idled () const { return _have_idled; }
- framepos_t leftmost_sample() const { return leftmost_frame; }
+ samplepos_t leftmost_sample() const { return _leftmost_sample; }
- framecnt_t current_page_samples() const {
- return (framecnt_t) _visible_canvas_width * samples_per_pixel;
+ samplecnt_t current_page_samples() const {
+ return (samplecnt_t) _visible_canvas_width * samples_per_pixel;
}
double visible_canvas_height () const {
@@ -219,7 +219,7 @@ public:
account any scrolling offsets.
*/
- framepos_t pixel_to_sample_from_event (double pixel) const {
+ samplepos_t pixel_to_sample_from_event (double pixel) const {
/* pixel can be less than zero when motion events
are processed. since we've already run the world->canvas
@@ -234,22 +234,22 @@ public:
}
}
- framepos_t pixel_to_sample (double pixel) const {
+ samplepos_t pixel_to_sample (double pixel) const {
return pixel * samples_per_pixel;
}
- double sample_to_pixel (framepos_t sample) const {
+ double sample_to_pixel (samplepos_t sample) const {
return round (sample / (double) samples_per_pixel);
}
- double sample_to_pixel_unrounded (framepos_t sample) const {
+ double sample_to_pixel_unrounded (samplepos_t sample) const {
return sample / (double) samples_per_pixel;
}
/* selection */
Selection& get_selection() const { return *selection; }
- bool get_selection_extents (framepos_t &start, framepos_t &end) const; // the time extents of the current selection, whether Range, Region(s), Control Points, or Notes
+ bool get_selection_extents (samplepos_t &start, samplepos_t &end) const; // the time extents of the current selection, whether Range, Region(s), Control Points, or Notes
Selection& get_cut_buffer() const { return *cut_buffer; }
void set_selection (std::list<Selectable*>, Selection::Operation);
@@ -257,7 +257,7 @@ public:
bool extend_selection_to_track (TimeAxisView&);
void play_selection ();
- void maybe_locate_with_edit_preroll (framepos_t);
+ void maybe_locate_with_edit_preroll (samplepos_t);
void play_with_preroll ();
void rec_with_preroll ();
void rec_with_count_in ();
@@ -266,7 +266,7 @@ public:
void invert_selection_in_track ();
void invert_selection ();
void deselect_all ();
- long select_range (framepos_t, framepos_t);
+ long select_range (samplepos_t, samplepos_t);
void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
@@ -297,7 +297,7 @@ public:
void set_zoom_focus (Editing::ZoomFocus);
Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
- framecnt_t get_current_zoom () const { return samples_per_pixel; }
+ samplecnt_t get_current_zoom () const { return samples_per_pixel; }
void cycle_zoom_focus ();
void temporal_zoom_step (bool zoom_out);
void temporal_zoom_step_scale (bool zoom_out, double scale);
@@ -331,10 +331,10 @@ public:
/* nudge is initiated by transport controls owned by ARDOUR_UI */
- framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next);
- framecnt_t get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t duration);
- unsigned get_grid_beat_divisions(framepos_t position);
- Evoral::Beats get_grid_type_as_beats (bool& success, framepos_t position);
+ samplecnt_t get_nudge_distance (samplepos_t pos, samplecnt_t& next);
+ samplecnt_t get_paste_offset (samplepos_t pos, unsigned paste_count, samplecnt_t duration);
+ unsigned get_grid_beat_divisions(samplepos_t position);
+ Evoral::Beats get_grid_type_as_beats (bool& success, samplepos_t position);
int32_t get_grid_music_divisions (uint32_t event_state);
@@ -365,7 +365,7 @@ public:
void toggle_measure_visibility ();
/* returns the left-most and right-most time that the gui should allow the user to scroll to */
- std::pair <framepos_t,framepos_t> session_gui_extents( bool use_extra = true ) const;
+ std::pair <samplepos_t,samplepos_t> session_gui_extents( bool use_extra = true ) const;
/* fades */
@@ -401,13 +401,13 @@ public:
void restore_editing_space();
double get_y_origin () const;
- void reset_x_origin (framepos_t);
+ void reset_x_origin (samplepos_t);
void reset_x_origin_to_follow_playhead ();
void reset_y_origin (double);
- void reset_zoom (framecnt_t);
- void reposition_and_zoom (framepos_t, double);
+ void reset_zoom (samplecnt_t);
+ void reposition_and_zoom (samplepos_t, double);
- framepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE,
+ samplepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE,
bool use_context_click = false,
bool from_outside_canvas = false);
@@ -439,13 +439,13 @@ public:
ARDOUR::SrcQuality quality,
ARDOUR::MidiTrackNameSource mts,
ARDOUR::MidiTempoMapDisposition mtd,
- framepos_t& pos,
+ samplepos_t& pos,
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
void do_embed (std::vector<std::string> paths,
Editing::ImportDisposition disposition,
Editing::ImportMode mode,
- framepos_t& pos,
+ samplepos_t& pos,
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions, bool src_comparison);
@@ -453,22 +453,22 @@ public:
void get_regionviews_by_id (PBD::ID const id, RegionSelection & regions) const;
void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > >&) const;
- void center_screen (framepos_t);
+ void center_screen (samplepos_t);
TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
- void snap_to (ARDOUR::MusicFrame& first,
+ void snap_to (ARDOUR::MusicSample& first,
ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
bool for_mark = false,
bool ensure_snap = false);
- void snap_to_with_modifier (ARDOUR::MusicFrame& first,
+ void snap_to_with_modifier (ARDOUR::MusicSample& first,
GdkEvent const * ev,
ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
bool for_mark = false);
- void snap_to (ARDOUR::MusicFrame& first,
- ARDOUR::MusicFrame& last,
+ void snap_to (ARDOUR::MusicSample& first,
+ ARDOUR::MusicSample& last,
ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
bool for_mark = false);
@@ -546,19 +546,19 @@ public:
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
/* editing operations that need to be public */
- void mouse_add_new_marker (framepos_t where, bool is_cd=false);
- void split_regions_at (ARDOUR::MusicFrame, RegionSelection&, bool snap = true);
+ void mouse_add_new_marker (samplepos_t where, bool is_cd=false);
+ void split_regions_at (ARDOUR::MusicSample, RegionSelection&, bool snap = true);
void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
- RegionSelection get_regions_from_selection_and_mouse (framepos_t);
+ RegionSelection get_regions_from_selection_and_mouse (samplepos_t);
- void mouse_add_new_tempo_event (framepos_t where);
- void mouse_add_new_meter_event (framepos_t where);
+ void mouse_add_new_tempo_event (samplepos_t where);
+ void mouse_add_new_meter_event (samplepos_t where);
void edit_tempo_section (ARDOUR::TempoSection*);
void edit_meter_section (ARDOUR::MeterSection*);
protected:
void map_transport_state ();
- void map_position_change (framepos_t);
+ void map_position_change (samplepos_t);
void transport_looped ();
void on_realize();
@@ -573,7 +573,7 @@ private:
bool constructed;
// to keep track of the playhead position for control_scroll
- boost::optional<framepos_t> _control_scroll_target;
+ boost::optional<samplepos_t> _control_scroll_target;
PlaylistSelector* _playlist_selector;
@@ -585,8 +585,8 @@ private:
VisualState (bool with_tracks);
~VisualState ();
double y_position;
- framecnt_t samples_per_pixel;
- framepos_t leftmost_frame;
+ samplecnt_t samples_per_pixel;
+ samplepos_t _leftmost_sample;
Editing::ZoomFocus zoom_focus;
GUIObjectState* gui_state;
};
@@ -604,11 +604,11 @@ private:
void start_visual_state_op (uint32_t n);
void cancel_visual_state_op (uint32_t n);
- framepos_t leftmost_frame;
- framecnt_t samples_per_pixel;
+ samplepos_t _leftmost_sample;
+ samplecnt_t samples_per_pixel;
Editing::ZoomFocus zoom_focus;
- void set_samples_per_pixel (framecnt_t);
+ void set_samples_per_pixel (samplecnt_t);
void on_samples_per_pixel_changed ();
Editing::MouseMode mouse_mode;
@@ -688,7 +688,7 @@ private:
void setup_lines ();
void set_name (const std::string&);
- void set_position (framepos_t start, framepos_t end = 0);
+ void set_position (samplepos_t start, samplepos_t end = 0);
void set_color_rgba (uint32_t);
};
@@ -716,9 +716,9 @@ private:
void hide_marker (ArdourCanvas::Item*, GdkEvent*);
void clear_marker_display ();
- void mouse_add_new_range (framepos_t);
- void mouse_add_new_loop (framepos_t);
- void mouse_add_new_punch (framepos_t);
+ void mouse_add_new_range (samplepos_t);
+ void mouse_add_new_loop (samplepos_t);
+ void mouse_add_new_punch (samplepos_t);
bool choose_new_marker_name(std::string &name);
void update_cd_marker_display ();
void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
@@ -915,7 +915,7 @@ private:
void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
void update_fixed_rulers ();
void update_tempo_based_rulers ();
- void popup_ruler_menu (framepos_t where = 0, ItemType type = RegionItem);
+ void popup_ruler_menu (samplepos_t where = 0, ItemType type = RegionItem);
void update_ruler_visibility ();
void set_ruler_visible (RulerType, bool);
void toggle_ruler_visibility (RulerType rt);
@@ -936,14 +936,14 @@ private:
MinsecRulerScale minsec_ruler_scale;
- framecnt_t minsec_mark_interval;
+ samplecnt_t minsec_mark_interval;
gint minsec_mark_modulo;
gint minsec_nmarks;
- void set_minsec_ruler_scale (framepos_t, framepos_t);
+ void set_minsec_ruler_scale (samplepos_t, samplepos_t);
enum TimecodeRulerScale {
timecode_show_bits,
- timecode_show_frames,
+ timecode_show_samples,
timecode_show_seconds,
timecode_show_minutes,
timecode_show_hours,
@@ -954,10 +954,10 @@ private:
gint timecode_mark_modulo;
gint timecode_nmarks;
- void set_timecode_ruler_scale (framepos_t, framepos_t);
+ void set_timecode_ruler_scale (samplepos_t, samplepos_t);
- framecnt_t _samples_ruler_interval;
- void set_samples_ruler_scale (framepos_t, framepos_t);
+ samplecnt_t _samples_ruler_interval;
+ void set_samples_ruler_scale (samplepos_t, samplepos_t);
enum BBTRulerScale {
bbt_show_many,
@@ -977,7 +977,7 @@ private:
gint bbt_nmarks;
uint32_t bbt_bar_helper_on;
uint32_t bbt_accent_modulo;
- void compute_bbt_ruler_scale (framepos_t lower, framepos_t upper);
+ void compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper);
ArdourCanvas::Ruler* timecode_ruler;
ArdourCanvas::Ruler* bbt_ruler;
@@ -1013,7 +1013,7 @@ private:
Glib::RefPtr<Gtk::ToggleAction> xjadeo_proc_action;
Glib::RefPtr<Gtk::ToggleAction> xjadeo_ontop_action;
Glib::RefPtr<Gtk::ToggleAction> xjadeo_timecode_action;
- Glib::RefPtr<Gtk::ToggleAction> xjadeo_frame_action;
+ Glib::RefPtr<Gtk::ToggleAction> xjadeo_sample_action;
Glib::RefPtr<Gtk::ToggleAction> xjadeo_osdbg_action;
Glib::RefPtr<Gtk::ToggleAction> xjadeo_fullscreen_action;
Glib::RefPtr<Gtk::ToggleAction> xjadeo_letterbox_action;
@@ -1032,9 +1032,9 @@ private:
friend class EditorCursor;
EditorCursor* playhead_cursor;
- framepos_t playhead_cursor_sample () const;
+ samplepos_t playhead_cursor_sample () const;
- framepos_t get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen);
+ samplepos_t get_region_boundary (samplepos_t pos, int32_t dir, bool with_selection, bool only_onscreen);
void cursor_to_region_boundary (bool with_selection, int32_t dir);
void cursor_to_next_region_boundary (bool with_selection);
@@ -1059,10 +1059,10 @@ private:
void select_all_selectables_between (bool within);
void select_range_between ();
- boost::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::framepos_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
- ARDOUR::framepos_t find_next_region_boundary (ARDOUR::framepos_t, int32_t dir, const TrackViewList&);
+ boost::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::samplepos_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
+ ARDOUR::samplepos_t find_next_region_boundary (ARDOUR::samplepos_t, int32_t dir, const TrackViewList&);
- std::vector<ARDOUR::framepos_t> region_boundary_cache;
+ std::vector<ARDOUR::samplepos_t> region_boundary_cache;
void build_region_boundary_cache ();
Gtk::HBox toplevel_hpacker;
@@ -1119,7 +1119,7 @@ private:
void control_unselect ();
void access_action (const std::string&, const std::string&);
void set_toggleaction (const std::string&, const std::string&, bool);
- bool deferred_control_scroll (framepos_t);
+ bool deferred_control_scroll (samplepos_t);
sigc::connection control_scroll_connection;
void tie_vertical_scrolling ();
@@ -1135,8 +1135,8 @@ private:
};
Type pending;
- framepos_t time_origin;
- framecnt_t samples_per_pixel;
+ samplepos_t time_origin;
+ samplecnt_t samples_per_pixel;
double y_origin;
int idle_handler_id;
@@ -1173,7 +1173,7 @@ private:
TrackViewList get_tracks_for_range_action () const;
sigc::connection super_rapid_screen_update_connection;
- void center_screen_internal (framepos_t, float);
+ void center_screen_internal (samplepos_t, float);
void super_rapid_screen_update ();
@@ -1182,8 +1182,8 @@ private:
void session_going_away ();
- framepos_t cut_buffer_start;
- framecnt_t cut_buffer_length;
+ samplepos_t cut_buffer_start;
+ samplecnt_t cut_buffer_length;
boost::shared_ptr<CursorContext> _press_cursor_ctx; ///< Button press cursor context
@@ -1216,7 +1216,7 @@ private:
/* CUT/COPY/PASTE */
- framepos_t last_paste_pos;
+ samplepos_t last_paste_pos;
unsigned paste_count;
void cut_copy (Editing::CutCopyOp);
@@ -1227,7 +1227,7 @@ private:
void cut_copy_midi (Editing::CutCopyOp);
void mouse_paste ();
- void paste_internal (framepos_t position, float times, const int32_t sub_num);
+ void paste_internal (samplepos_t position, float times, const int32_t sub_num);
/* EDITING OPERATIONS */
@@ -1255,14 +1255,14 @@ private:
void lower_region_to_bottom ();
void split_region_at_transients ();
void crop_region_to_selection ();
- void crop_region_to (framepos_t start, framepos_t end);
- void set_sync_point (framepos_t, const RegionSelection&);
+ void crop_region_to (samplepos_t start, samplepos_t end);
+ void set_sync_point (samplepos_t, const RegionSelection&);
void set_region_sync_position ();
void remove_region_sync();
void align_regions (ARDOUR::RegionPoint);
void align_regions_relative (ARDOUR::RegionPoint point);
- void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
- void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
+ void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, samplepos_t position);
+ void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, samplepos_t position);
void remove_selected_regions ();
void remove_clicked_region ();
void show_region_properties ();
@@ -1295,10 +1295,10 @@ private:
void fork_region ();
void do_insert_time ();
- void insert_time (framepos_t, framecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool, bool);
+ void insert_time (samplepos_t, samplecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool, bool);
void do_remove_time ();
- void remove_time (framepos_t pos, framecnt_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too,
+ void remove_time (samplepos_t pos, samplecnt_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too,
bool glued_markers_too, bool locked_markers_too, bool tempo_too);
void tab_to_transient (bool forward);
@@ -1306,7 +1306,7 @@ private:
void set_tempo_from_region ();
void use_range_as_bar ();
- void define_one_bar (framepos_t start, framepos_t end);
+ void define_one_bar (samplepos_t start, samplepos_t end);
void audition_region_from_region_list ();
void hide_region_from_region_list ();
@@ -1339,13 +1339,13 @@ private:
void play_location (ARDOUR::Location&);
void loop_location (ARDOUR::Location&);
- void calc_extra_zoom_edges(framepos_t &start, framepos_t &end);
+ void calc_extra_zoom_edges(samplepos_t &start, samplepos_t &end);
void temporal_zoom_selection (Editing::ZoomAxis);
void temporal_zoom_session ();
void temporal_zoom_extents ();
- void temporal_zoom (framecnt_t samples_per_pixel);
- void temporal_zoom_by_frame (framepos_t start, framepos_t end);
- void temporal_zoom_to_frame (bool coarser, framepos_t frame);
+ void temporal_zoom (samplecnt_t samples_per_pixel);
+ void temporal_zoom_by_sample (samplepos_t start, samplepos_t end);
+ void temporal_zoom_to_sample (bool coarser, samplepos_t sample);
void insert_region_list_selection (float times);
@@ -1370,16 +1370,16 @@ private:
SoundFileOmega* sfbrowser;
- void bring_in_external_audio (Editing::ImportMode mode, framepos_t& pos);
+ void bring_in_external_audio (Editing::ImportMode mode, samplepos_t& pos);
- bool idle_drop_paths (std::vector<std::string> paths, framepos_t frame, double ypos, bool copy);
- void drop_paths_part_two (const std::vector<std::string>& paths, framepos_t frame, double ypos, bool copy);
+ bool idle_drop_paths (std::vector<std::string> paths, samplepos_t sample, double ypos, bool copy);
+ void drop_paths_part_two (const std::vector<std::string>& paths, samplepos_t sample, double ypos, bool copy);
int import_sndfiles (std::vector<std::string> paths,
Editing::ImportDisposition disposition,
Editing::ImportMode mode,
ARDOUR::SrcQuality quality,
- framepos_t& pos,
+ samplepos_t& pos,
int target_regions,
int target_tracks,
boost::shared_ptr<ARDOUR::Track>& track,
@@ -1391,7 +1391,7 @@ private:
bool& check_sample_rate,
Editing::ImportDisposition disposition,
Editing::ImportMode mode,
- framepos_t& pos,
+ samplepos_t& pos,
int target_regions,
int target_tracks,
boost::shared_ptr<ARDOUR::Track>& track,
@@ -1399,7 +1399,7 @@ private:
int add_sources (std::vector<std::string> paths,
ARDOUR::SourceList& sources,
- framepos_t& pos,
+ samplepos_t& pos,
Editing::ImportDisposition disposition,
Editing::ImportMode mode,
int target_regions,
@@ -1411,7 +1411,7 @@ private:
int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region,
uint32_t in_chans,
uint32_t out_chans,
- framepos_t& pos,
+ samplepos_t& pos,
Editing::ImportMode mode,
boost::shared_ptr<ARDOUR::Track>& existing_track,
const std::string& new_track_name,
@@ -1434,7 +1434,7 @@ private:
struct EditorImportStatus : public ARDOUR::ImportStatus {
Editing::ImportMode mode;
- framepos_t pos;
+ samplepos_t pos;
int target_tracks;
int target_regions;
boost::shared_ptr<ARDOUR::Track> track;
@@ -1450,7 +1450,7 @@ private:
void import_audio (bool as_tracks);
void do_import (std::vector<std::string> paths, bool split, bool as_tracks);
- void import_smf_tempo_map (Evoral::SMF const &, framepos_t pos);
+ void import_smf_tempo_map (Evoral::SMF const &, samplepos_t pos);
void move_to_start ();
void move_to_end ();
void center_playhead ();
@@ -1480,7 +1480,7 @@ private:
void set_selection_from_loop ();
void set_selection_from_region ();
- void add_location_mark (framepos_t where);
+ void add_location_mark (samplepos_t where);
void add_location_from_region ();
void add_locations_from_region ();
void add_location_from_selection ();
@@ -1495,8 +1495,8 @@ private:
void set_loop_from_region (bool play);
- void set_loop_range (framepos_t start, framepos_t end, std::string cmd);
- void set_punch_range (framepos_t start, framepos_t end, std::string cmd);
+ void set_loop_range (samplepos_t start, samplepos_t end, std::string cmd);
+ void set_punch_range (samplepos_t start, samplepos_t end, std::string cmd);
void toggle_location_at_playhead_cursor ();
void add_location_from_playhead_cursor ();
@@ -1511,7 +1511,7 @@ private:
int scrubbing_direction;
int scrub_reversals;
int scrub_reverse_distance;
- void scrub (framepos_t, double);
+ void scrub (samplepos_t, double);
void set_punch_start_from_edit_point ();
void set_punch_end_from_edit_point ();
@@ -1521,7 +1521,7 @@ private:
void keyboard_selection_begin ( Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE );
void keyboard_selection_finish (bool add, Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE);
bool have_pending_keyboard_selection;
- framepos_t pending_keyboard_selection_start;
+ samplepos_t pending_keyboard_selection_start;
void move_range_selection_start_or_end_to_region_boundary (bool, bool);
@@ -1583,7 +1583,7 @@ private:
bool can_remove_control_point (ArdourCanvas::Item *);
void remove_control_point (ArdourCanvas::Item *);
- void mouse_brush_insert_region (RegionView*, framepos_t pos);
+ void mouse_brush_insert_region (RegionView*, samplepos_t pos);
/* Canvas event handlers */
@@ -1601,7 +1601,7 @@ private:
bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*, bool trim = false);
bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
bool canvas_wave_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
- bool canvas_frame_handle_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
+ bool canvas_sample_handle_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
bool canvas_feature_line_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*);
@@ -1628,7 +1628,7 @@ private:
void toggle_video_timeline_locked ();
void set_video_timeline_locked (const bool);
void queue_visual_videotimeline_update ();
- void embed_audio_from_video (std::string, framepos_t n = 0, bool lock_position_to_video = true);
+ void embed_audio_from_video (std::string, samplepos_t n = 0, bool lock_position_to_video = true);
bool track_selection_change_without_scroll () const {
return _track_selection_change_without_scroll;
@@ -1754,7 +1754,7 @@ private:
void remove_metric_marks ();
void draw_metric_marks (const ARDOUR::Metrics& metrics);
- void compute_current_bbt_points (std::vector<ARDOUR::TempoMap::BBTPoint>& grid, framepos_t left, framepos_t right);
+ void compute_current_bbt_points (std::vector<ARDOUR::TempoMap::BBTPoint>& grid, samplepos_t left, samplepos_t right);
void tempo_map_changed (const PBD::PropertyChange&);
void tempometric_position_changed (const PBD::PropertyChange&);
@@ -1889,7 +1889,7 @@ private:
bool get_smart_mode() const;
- bool audio_region_selection_covers (framepos_t where);
+ bool audio_region_selection_covers (samplepos_t where);
/* transport range select process */
@@ -1913,7 +1913,7 @@ private:
/* object rubberband select process */
- void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
+ void select_all_within (samplepos_t, samplepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
ArdourCanvas::Rectangle* rubberband_rect;
@@ -1947,7 +1947,7 @@ private:
void stop_canvas_autoscroll ();
/* trimming */
- void point_trim (GdkEvent *, framepos_t);
+ void point_trim (GdkEvent *, samplepos_t);
void trim_region_front();
void trim_region_back();
@@ -2047,19 +2047,19 @@ private:
void duplicate_range (bool with_dialog);
void duplicate_regions (float times);
- /** computes the timeline frame (sample) of an event whose coordinates
+ /** computes the timeline sample (sample) of an event whose coordinates
* are in canvas units (pixels, scroll offset included).
*/
- framepos_t canvas_event_sample (GdkEvent const *, double* px = 0, double* py = 0) const;
+ samplepos_t canvas_event_sample (GdkEvent const *, double* px = 0, double* py = 0) const;
- /** computes the timeline frame (sample) of an event whose coordinates
+ /** computes the timeline sample (sample) of an event whose coordinates
* are in window units (pixels, no scroll offset).
*/
- framepos_t window_event_sample (GdkEvent const *, double* px = 0, double* py = 0) const;
+ samplepos_t window_event_sample (GdkEvent const *, double* px = 0, double* py = 0) const;
/* returns false if mouse pointer is not in track or marker canvas
*/
- bool mouse_frame (framepos_t&, bool& in_track_canvas) const;
+ bool mouse_sample (samplepos_t&, bool& in_track_canvas) const;
TimeFXDialog* current_timefx;
static void* timefx_thread (void *arg);
@@ -2166,10 +2166,10 @@ private:
void selected_marker_moved (ARDOUR::Location*);
- bool get_edit_op_range (framepos_t& start, framepos_t& end) const;
+ bool get_edit_op_range (samplepos_t& start, samplepos_t& end) const;
- void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
- void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
+ void get_regions_at (RegionSelection&, samplepos_t where, const TrackViewList& ts) const;
+ void get_regions_after (RegionSelection&, samplepos_t where, const TrackViewList& ts) const;
RegionSelection get_regions_from_selection_and_edit_point (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE,
bool use_context_click = false,
@@ -2183,12 +2183,12 @@ private:
void select_next_stripable (bool routes_only = true);
void select_prev_stripable (bool routes_only = true);
- void snap_to_internal (ARDOUR::MusicFrame& first,
+ void snap_to_internal (ARDOUR::MusicSample& first,
ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
bool for_mark = false,
bool ensure_snap = false);
- void timecode_snap_to_internal (ARDOUR::MusicFrame& first,
+ void timecode_snap_to_internal (ARDOUR::MusicSample& first,
ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
bool for_mark = false);
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 8a447beecf..33fd27f323 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -613,7 +613,7 @@ Editor::register_actions ()
xjadeo_ontop_action = Glib::RefPtr<ToggleAction>::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-ontop"), _("Always on Top"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 1)));
xjadeo_timecode_action = Glib::RefPtr<ToggleAction>::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 2)));
- xjadeo_frame_action = Glib::RefPtr<ToggleAction>::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-frame"), _("Frame number"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 3)));
+ xjadeo_sample_action = Glib::RefPtr<ToggleAction>::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-frame"), _("Frame number"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 3)));
xjadeo_osdbg_action = Glib::RefPtr<ToggleAction>::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-osdbg"), _("Timecode Background"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 4)));
xjadeo_fullscreen_action = Glib::RefPtr<ToggleAction>::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-fullscreen"), _("Fullscreen"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 5)));
xjadeo_letterbox_action = Glib::RefPtr<ToggleAction>::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-letterbox"), _("Letterbox"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 6)));
@@ -654,8 +654,8 @@ Editor::register_actions ()
xjadeo_ontop_action->set_sensitive (false);
xjadeo_timecode_action->set_active (false);
xjadeo_timecode_action->set_sensitive (false);
- xjadeo_frame_action->set_active (false);
- xjadeo_frame_action->set_sensitive (false);
+ xjadeo_sample_action->set_active (false);
+ xjadeo_sample_action->set_sensitive (false);
xjadeo_osdbg_action->set_active (false);
xjadeo_osdbg_action->set_sensitive (false);
xjadeo_fullscreen_action->set_active (false);
@@ -873,7 +873,7 @@ Editor::toggle_xjadeo_proc (int state)
bool onoff = xjadeo_proc_action->get_active();
xjadeo_ontop_action->set_sensitive(onoff);
xjadeo_timecode_action->set_sensitive(onoff);
- xjadeo_frame_action->set_sensitive(onoff);
+ xjadeo_sample_action->set_sensitive(onoff);
xjadeo_osdbg_action->set_sensitive(onoff);
xjadeo_fullscreen_action->set_sensitive(onoff);
xjadeo_letterbox_action->set_sensitive(onoff);
@@ -902,7 +902,7 @@ Editor::toggle_xjadeo_viewoption (int what, int state)
action = xjadeo_timecode_action;
break;
case 3:
- action = xjadeo_frame_action;
+ action = xjadeo_sample_action;
break;
case 4:
action = xjadeo_osdbg_action;
@@ -944,7 +944,7 @@ Editor::set_xjadeo_viewoption (int what)
action = xjadeo_timecode_action;
break;
case 3:
- action = xjadeo_frame_action;
+ action = xjadeo_sample_action;
break;
case 4:
action = xjadeo_osdbg_action;
@@ -981,14 +981,14 @@ Editor::toggle_measure_visibility ()
void
Editor::edit_current_meter ()
{
- ARDOUR::MeterSection* ms = const_cast<ARDOUR::MeterSection*>(&_session->tempo_map().meter_section_at_frame (ARDOUR_UI::instance()->primary_clock->absolute_time()));
+ ARDOUR::MeterSection* ms = const_cast<ARDOUR::MeterSection*>(&_session->tempo_map().meter_section_at_sample (ARDOUR_UI::instance()->primary_clock->absolute_time()));
edit_meter_section (ms);
}
void
Editor::edit_current_tempo ()
{
- ARDOUR::TempoSection* ts = const_cast<ARDOUR::TempoSection*>(&_session->tempo_map().tempo_section_at_frame (ARDOUR_UI::instance()->primary_clock->absolute_time()));
+ ARDOUR::TempoSection* ts = const_cast<ARDOUR::TempoSection*>(&_session->tempo_map().tempo_section_at_sample (ARDOUR_UI::instance()->primary_clock->absolute_time()));
edit_tempo_section (ts);
}
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index 0ee0810ff2..2d668d214c 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -263,7 +263,7 @@ Editor::get_nth_selected_midi_track (int nth) const
}
void
-Editor::import_smf_tempo_map (Evoral::SMF const & smf, framepos_t pos)
+Editor::import_smf_tempo_map (Evoral::SMF const & smf, samplepos_t pos)
{
if (!_session) {
return;
@@ -275,7 +275,7 @@ Editor::import_smf_tempo_map (Evoral::SMF const & smf, framepos_t pos)
return;
}
- const framecnt_t sample_rate = _session->frame_rate ();
+ const samplecnt_t sample_rate = _session->sample_rate ();
TempoMap new_map (sample_rate);
Meter last_meter (4.0, 4.0);
bool have_initial_meter = false;
@@ -297,8 +297,8 @@ Editor::import_smf_tempo_map (Evoral::SMF const & smf, framepos_t pos)
}
} else {
- new_map.replace_meter (new_map.meter_section_at_frame (0), meter, bbt, pos, AudioTime);
- new_map.replace_tempo (new_map.tempo_section_at_frame (0), tempo, 0.0, pos, AudioTime);
+ new_map.replace_meter (new_map.meter_section_at_sample (0), meter, bbt, pos, AudioTime);
+ new_map.replace_tempo (new_map.tempo_section_at_sample (0), tempo, 0.0, pos, AudioTime);
have_initial_meter = true;
}
@@ -322,7 +322,7 @@ Editor::do_import (vector<string> paths,
SrcQuality quality,
MidiTrackNameSource midi_track_name_source,
MidiTempoMapDisposition smf_tempo_disposition,
- framepos_t& pos,
+ samplepos_t& pos,
ARDOUR::PluginInfoPtr instrument)
{
boost::shared_ptr<Track> track;
@@ -461,7 +461,7 @@ Editor::do_import (vector<string> paths,
}
void
-Editor::do_embed (vector<string> paths, ImportDisposition import_as, ImportMode mode, framepos_t& pos, ARDOUR::PluginInfoPtr instrument)
+Editor::do_embed (vector<string> paths, ImportDisposition import_as, ImportMode mode, samplepos_t& pos, ARDOUR::PluginInfoPtr instrument)
{
boost::shared_ptr<Track> track;
bool check_sample_rate = true;
@@ -547,7 +547,7 @@ Editor::import_sndfiles (vector<string> paths,
ImportDisposition disposition,
ImportMode mode,
SrcQuality quality,
- framepos_t& pos,
+ samplepos_t& pos,
int target_regions,
int target_tracks,
boost::shared_ptr<Track>& track,
@@ -617,7 +617,7 @@ Editor::embed_sndfiles (vector<string> paths,
bool& check_sample_rate,
ImportDisposition disposition,
ImportMode mode,
- framepos_t& pos,
+ samplepos_t& pos,
int target_regions,
int target_tracks,
boost::shared_ptr<Track>& track,
@@ -643,7 +643,7 @@ Editor::embed_sndfiles (vector<string> paths,
return -3;
}
- if (check_sample_rate && (finfo.samplerate != (int) _session->frame_rate())) {
+ if (check_sample_rate && (finfo.samplerate != (int) _session->sample_rate())) {
vector<string> choices;
if (multifile) {
@@ -739,7 +739,7 @@ Editor::embed_sndfiles (vector<string> paths,
int
Editor::add_sources (vector<string> paths,
SourceList& sources,
- framepos_t& pos,
+ samplepos_t& pos,
ImportDisposition disposition,
ImportMode mode,
int target_regions,
@@ -857,12 +857,12 @@ Editor::add_sources (vector<string> paths,
/* Fudge region length to ensure it is non-zero; make it 1 beat at 120bpm
for want of a better idea. It can't be too small, otherwise if this
- is a MIDI region the conversion from frames -> beats -> frames will
+ is a MIDI region the conversion from samples -> beats -> samples will
round it back down to 0 again.
*/
- framecnt_t len = (*x)->length (pos);
+ samplecnt_t len = (*x)->length (pos);
if (len == 0) {
- len = (60.0 / 120.0) * _session->frame_rate ();
+ len = (60.0 / 120.0) * _session->sample_rate ();
}
plist.add (ARDOUR::Properties::start, 0);
@@ -899,7 +899,7 @@ Editor::add_sources (vector<string> paths,
}
int n = 0;
- framepos_t rlen = 0;
+ samplepos_t rlen = 0;
begin_reversible_command (Operations::insert_file);
@@ -970,7 +970,7 @@ int
Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
uint32_t in_chans,
uint32_t out_chans,
- framepos_t& pos,
+ samplepos_t& pos,
ImportMode mode,
boost::shared_ptr<Track>& existing_track,
const string& new_track_name,
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 56571c3de8..5aeed49f43 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -379,14 +379,14 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
}
bool
-Editor::idle_drop_paths (vector<string> paths, framepos_t frame, double ypos, bool copy)
+Editor::idle_drop_paths (vector<string> paths, samplepos_t sample, double ypos, bool copy)
{
- drop_paths_part_two (paths, frame, ypos, copy);
+ drop_paths_part_two (paths, sample, ypos, copy);
return false;
}
void
-Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, double ypos, bool copy)
+Editor::drop_paths_part_two (const vector<string>& paths, samplepos_t sample, double ypos, bool copy)
{
RouteTimeAxisView* tv;
@@ -412,15 +412,15 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
/* drop onto canvas background: create new tracks */
- frame = 0;
+ sample = 0;
InstrumentSelector is; // instantiation builds instrument-list and sets default.
- do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackName, SMFTempoIgnore, frame, is.selected_instrument());
+ do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackName, SMFTempoIgnore, sample, is.selected_instrument());
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack,
- SrcBest, SMFTrackName, SMFTempoIgnore, frame);
+ SrcBest, SMFTrackName, SMFTempoIgnore, sample);
} else {
- do_embed (audio_paths, Editing::ImportDistinctFiles, ImportAsTrack, frame);
+ do_embed (audio_paths, Editing::ImportDistinctFiles, ImportAsTrack, sample);
}
} else if ((tv = dynamic_cast<RouteTimeAxisView*> (tvp.first)) != 0) {
@@ -432,13 +432,13 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
selection->set (tv);
do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack,
- SrcBest, SMFTrackName, SMFTempoIgnore, frame);
+ SrcBest, SMFTrackName, SMFTempoIgnore, sample);
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack,
- SrcBest, SMFTrackName, SMFTempoIgnore, frame);
+ SrcBest, SMFTrackName, SMFTempoIgnore, sample);
} else {
- do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, frame);
+ do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, sample);
}
}
}
@@ -463,7 +463,7 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
ev.button.x = x;
ev.button.y = y;
- MusicFrame when (window_event_sample (&ev, 0, &cy), 0);
+ MusicSample when (window_event_sample (&ev, 0, &cy), 0);
snap_to (when);
bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY);
@@ -472,9 +472,9 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
the main event loop with GTK/Quartz. Since import/embed wants
to push up a progress dialog, defer all this till we go idle.
*/
- Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &Editor::idle_drop_paths), paths, when.frame, cy, copy));
+ Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &Editor::idle_drop_paths), paths, when.sample, cy, copy));
#else
- drop_paths_part_two (paths, when.frame, cy, copy);
+ drop_paths_part_two (paths, when.sample, cy, copy);
#endif
}
@@ -569,7 +569,7 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers)
toplevel->get_window()->get_pointer (x, y, mask);
- if ((allow_horiz && ((x < scrolling_boundary.x0 && leftmost_frame > 0) || x >= scrolling_boundary.x1)) ||
+ if ((allow_horiz && ((x < scrolling_boundary.x0 && _leftmost_sample > 0) || x >= scrolling_boundary.x1)) ||
(allow_vert && ((y < scrolling_boundary.y0 && vertical_adjustment.get_value() > 0)|| y >= scrolling_boundary.y1))) {
start_canvas_autoscroll (allow_horiz, allow_vert, scrolling_boundary);
}
@@ -581,15 +581,15 @@ Editor::autoscroll_active () const
return autoscroll_connection.connected ();
}
-std::pair <framepos_t,framepos_t>
+std::pair <samplepos_t,samplepos_t>
Editor::session_gui_extents ( bool use_extra ) const
{
if (!_session) {
- return std::pair <framepos_t,framepos_t>(max_framepos,0);
+ return std::pair <samplepos_t,samplepos_t>(max_samplepos,0);
}
- framecnt_t session_extent_start = _session->current_start_frame();
- framecnt_t session_extent_end = _session->current_end_frame();
+ samplecnt_t session_extent_start = _session->current_start_sample();
+ samplecnt_t session_extent_end = _session->current_end_sample();
//calculate the extents of all regions in every playlist
//NOTE: we should listen to playlists, and cache these values so we don't calculate them every time.
@@ -600,7 +600,7 @@ Editor::session_gui_extents ( bool use_extra ) const
if (tr) {
boost::shared_ptr<Playlist> pl = tr->playlist();
if ( pl && !pl->all_regions_empty() ) {
- pair<framepos_t, framepos_t> e;
+ pair<samplepos_t, samplepos_t> e;
e = pl->get_extent();
if (e.first < session_extent_start) {
session_extent_start = e.first;
@@ -617,20 +617,20 @@ Editor::session_gui_extents ( bool use_extra ) const
//add additional time to the ui extents ( user-defined in config )
if (use_extra) {
- framecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_frame_rate();
+ samplecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_sample_rate();
session_extent_end += extra;
session_extent_start -= extra;
}
//range-check
- if (session_extent_end > max_framepos) {
- session_extent_end = max_framepos;
+ if (session_extent_end > max_samplepos) {
+ session_extent_end = max_samplepos;
}
if (session_extent_start < 0) {
session_extent_start = 0;
}
- std::pair <framepos_t,framepos_t> ret (session_extent_start, session_extent_end);
+ std::pair <samplepos_t,samplepos_t> ret (session_extent_start, session_extent_end);
return ret;
}
@@ -639,7 +639,7 @@ Editor::autoscroll_canvas ()
{
int x, y;
Gdk::ModifierType mask;
- frameoffset_t dx = 0;
+ sampleoffset_t dx = 0;
bool no_stop = false;
Gtk::Window* toplevel = dynamic_cast<Gtk::Window*>(contents().get_toplevel());
@@ -654,7 +654,7 @@ Editor::autoscroll_canvas ()
if (autoscroll_horizontal_allowed) {
- framepos_t new_frame = leftmost_frame;
+ samplepos_t new_sample = _leftmost_sample;
/* horizontal */
@@ -668,10 +668,10 @@ Editor::autoscroll_canvas ()
dx *= UIConfiguration::instance().get_draggable_playhead_speed();
- if (leftmost_frame < max_framepos - dx) {
- new_frame = leftmost_frame + dx;
+ if (_leftmost_sample < max_samplepos - dx) {
+ new_sample = _leftmost_sample + dx;
} else {
- new_frame = max_framepos;
+ new_sample = max_samplepos;
}
no_stop = true;
@@ -685,17 +685,17 @@ Editor::autoscroll_canvas ()
dx *= UIConfiguration::instance().get_draggable_playhead_speed();
- if (leftmost_frame >= dx) {
- new_frame = leftmost_frame - dx;
+ if (_leftmost_sample >= dx) {
+ new_sample = _leftmost_sample - dx;
} else {
- new_frame = 0;
+ new_sample = 0;
}
no_stop = true;
}
- if (new_frame != leftmost_frame) {
- vc.time_origin = new_frame;
+ if (new_sample != _leftmost_sample) {
+ vc.time_origin = new_sample;
vc.add (VisualChange::TimeOrigin);
}
}
@@ -969,7 +969,7 @@ Editor::set_horizontal_position (double p)
{
horizontal_adjustment.set_value (p);
- leftmost_frame = (framepos_t) floor (p * samples_per_pixel);
+ _leftmost_sample = (samplepos_t) floor (p * samples_per_pixel);
}
void
@@ -1052,7 +1052,7 @@ Editor::color_handler()
double
Editor::horizontal_position () const
{
- return sample_to_pixel (leftmost_frame);
+ return sample_to_pixel (_leftmost_sample);
}
bool
diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc
index 2848649a5e..fbdb730b4a 100644
--- a/gtk2_ardour/editor_canvas_events.cc
+++ b/gtk2_ardour/editor_canvas_events.cc
@@ -797,11 +797,11 @@ Editor::canvas_selection_end_trim_event (GdkEvent *event, ArdourCanvas::Item* it
}
bool
-Editor::canvas_frame_handle_event (GdkEvent* event, ArdourCanvas::Item* item, RegionView* rv)
+Editor::canvas_sample_handle_event (GdkEvent* event, ArdourCanvas::Item* item, RegionView* rv)
{
bool ret = false;
- /* frame handles are not active when in internal edit mode, because actual notes
+ /* sample handles are not active when in internal edit mode, because actual notes
might be in the area occupied by the handle - we want them to be editable as normal.
*/
@@ -809,7 +809,7 @@ Editor::canvas_frame_handle_event (GdkEvent* event, ArdourCanvas::Item* item, Re
return false;
}
- /* NOTE: frame handles pretend to be the colored trim bar from an event handling
+ /* NOTE: sample handles pretend to be the colored trim bar from an event handling
perspective. XXX change this ??
*/
@@ -1264,7 +1264,7 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
event.button.y = y;
/* assume we're dragging with button 1 */
event.motion.state = Gdk::BUTTON1_MASK;
- framepos_t const pos = window_event_sample (&event, &px, &py);
+ samplepos_t const pos = window_event_sample (&event, &px, &py);
boost::shared_ptr<Region> region = _regions->get_dragged_region ();
if (!region) { return; }
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc
index de89274fcc..7f39cbe175 100644
--- a/gtk2_ardour/editor_cursors.cc
+++ b/gtk2_ardour/editor_cursors.cc
@@ -50,7 +50,7 @@ EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,Ardour
_track_canvas_item->set_x (0);
- _current_frame = 1; /* force redraw at 0 */
+ _current_sample = 1; /* force redraw at 0 */
}
EditorCursor::EditorCursor (Editor& ed)
@@ -66,7 +66,7 @@ EditorCursor::EditorCursor (Editor& ed)
_track_canvas_item->set_x (0);
- _current_frame = 1; /* force redraw at 0 */
+ _current_sample = 1; /* force redraw at 0 */
}
EditorCursor::~EditorCursor ()
@@ -75,17 +75,17 @@ EditorCursor::~EditorCursor ()
}
void
-EditorCursor::set_position (framepos_t frame)
+EditorCursor::set_position (samplepos_t sample)
{
- if (_current_frame != frame) { PositionChanged (frame); }
+ if (_current_sample != sample) { PositionChanged (sample); }
- double const new_pos = _editor.sample_to_pixel_unrounded (frame);
+ double const new_pos = _editor.sample_to_pixel_unrounded (sample);
if (rint(new_pos) != rint(_track_canvas_item->x ())) {
_track_canvas_item->set_x (new_pos);
}
- _current_frame = frame;
+ _current_sample = sample;
}
void
diff --git a/gtk2_ardour/editor_cursors.h b/gtk2_ardour/editor_cursors.h
index f6d4997690..4b8b4b67da 100644
--- a/gtk2_ardour/editor_cursors.h
+++ b/gtk2_ardour/editor_cursors.h
@@ -36,7 +36,7 @@ public:
EditorCursor (Editor&);
~EditorCursor ();
- void set_position (framepos_t);
+ void set_position (samplepos_t);
void show ();
@@ -44,20 +44,20 @@ public:
void set_color (Gtkmm2ext::Color);
void set_sensitive (bool);
- framepos_t current_frame () const {
- return _current_frame;
+ samplepos_t current_sample () const {
+ return _current_sample;
}
ArdourCanvas::Arrow& track_canvas_item () {
return *_track_canvas_item;
}
- PBD::Signal1<void, framepos_t> PositionChanged;
+ PBD::Signal1<void, samplepos_t> PositionChanged;
private:
Editor& _editor;
ArdourCanvas::Arrow* _track_canvas_item;
- framepos_t _current_frame;
+ samplepos_t _current_sample;
};
#endif // __gtk_ardour_editor_cursors_h__
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 9b5838aaad..aad1778972 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -86,7 +86,7 @@ DragManager::DragManager (Editor* e)
, _ending (false)
, _current_pointer_x (0.0)
, _current_pointer_y (0.0)
- , _current_pointer_frame (0)
+ , _current_pointer_sample (0)
, _old_follow_playhead (false)
{
}
@@ -139,7 +139,7 @@ DragManager::start_grab (GdkEvent* e, Gdk::Cursor* c)
_old_follow_playhead = _editor->follow_playhead ();
_editor->set_follow_playhead (false);
- _current_pointer_frame = _editor->canvas_event_sample (e, &_current_pointer_x, &_current_pointer_y);
+ _current_pointer_sample = _editor->canvas_event_sample (e, &_current_pointer_x, &_current_pointer_y);
for (list<Drag*>::const_iterator i = _drags.begin(); i != _drags.end(); ++i) {
(*i)->start_grab (e, c);
@@ -191,7 +191,7 @@ DragManager::motion_handler (GdkEvent* e, bool from_autoscroll)
* Can we guarantee that this is true?
*/
- _current_pointer_frame = _editor->canvas_event_sample (e, &_current_pointer_x, &_current_pointer_y);
+ _current_pointer_sample = _editor->canvas_event_sample (e, &_current_pointer_x, &_current_pointer_y);
for (list<Drag*>::iterator i = _drags.begin(); i != _drags.end(); ++i) {
bool const t = (*i)->motion_handler (e, from_autoscroll);
@@ -222,7 +222,7 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i, bool trackview_only)
: _editor (e)
, _drags (0)
, _item (i)
- , _pointer_frame_offset (0)
+ , _pointer_sample_offset (0)
, _x_constrained (false)
, _y_constrained (false)
, _was_rolling (false)
@@ -235,9 +235,9 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i, bool trackview_only)
, _grab_y (0.0)
, _last_pointer_x (0.0)
, _last_pointer_y (0.0)
- , _raw_grab_frame (0)
- , _grab_frame (0)
- , _last_pointer_frame (0)
+ , _raw_grab_sample (0)
+ , _grab_sample (0)
+ , _last_pointer_sample (0)
, _snap_delta (0)
, _snap_delta_music (0.0)
, _constraint_pressed (false)
@@ -267,11 +267,11 @@ Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
/* we set up x/y dragging constraints on first move */
_constraint_pressed = ArdourKeyboard::indicates_constraint (event->button.state);
- _raw_grab_frame = _editor->canvas_event_sample (event, &_grab_x, &_grab_y);
+ _raw_grab_sample = _editor->canvas_event_sample (event, &_grab_x, &_grab_y);
- setup_pointer_frame_offset ();
- _grab_frame = adjusted_frame (_raw_grab_frame, event).frame;
- _last_pointer_frame = _grab_frame;
+ setup_pointer_sample_offset ();
+ _grab_sample = adjusted_sample (_raw_grab_sample, event).sample;
+ _last_pointer_sample = _grab_sample;
_last_pointer_x = _grab_x;
if (_trackview_only) {
@@ -326,13 +326,13 @@ Drag::end_grab (GdkEvent* event)
return _move_threshold_passed;
}
-MusicFrame
-Drag::adjusted_frame (framepos_t f, GdkEvent const * event, bool snap) const
+MusicSample
+Drag::adjusted_sample (samplepos_t f, GdkEvent const * event, bool snap) const
{
- MusicFrame pos (0, 0);
+ MusicSample pos (0, 0);
- if (f > _pointer_frame_offset) {
- pos.frame = f - _pointer_frame_offset;
+ if (f > _pointer_sample_offset) {
+ pos.sample = f - _pointer_sample_offset;
}
if (snap) {
@@ -342,13 +342,13 @@ Drag::adjusted_frame (framepos_t f, GdkEvent const * event, bool snap) const
return pos;
}
-framepos_t
-Drag::adjusted_current_frame (GdkEvent const * event, bool snap) const
+samplepos_t
+Drag::adjusted_current_sample (GdkEvent const * event, bool snap) const
{
- return adjusted_frame (_drags->current_pointer_frame (), event, snap).frame;
+ return adjusted_sample (_drags->current_pointer_sample (), event, snap).sample;
}
-frameoffset_t
+sampleoffset_t
Drag::snap_delta (guint state) const
{
if (ArdourKeyboard::indicates_snap_delta (state)) {
@@ -384,17 +384,17 @@ Drag::current_pointer_y () const
}
void
-Drag::setup_snap_delta (MusicFrame pos)
+Drag::setup_snap_delta (MusicSample pos)
{
TempoMap& map (_editor->session()->tempo_map());
- MusicFrame snap (pos);
+ MusicSample snap (pos);
_editor->snap_to (snap, ARDOUR::RoundNearest, false, true);
- _snap_delta = snap.frame - pos.frame;
+ _snap_delta = snap.sample - pos.sample;
_snap_delta_music = 0.0;
if (_snap_delta != 0) {
- _snap_delta_music = map.exact_qn_at_frame (snap.frame, snap.division) - map.exact_qn_at_frame (pos.frame, pos.division);
+ _snap_delta_music = map.exact_qn_at_sample (snap.sample, snap.division) - map.exact_qn_at_sample (pos.sample, pos.division);
}
}
@@ -408,13 +408,13 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
return false;
}
- pair<framecnt_t, int> const threshold = move_threshold ();
+ pair<samplecnt_t, int> const threshold = move_threshold ();
bool const old_move_threshold_passed = _move_threshold_passed;
if (!_move_threshold_passed) {
- bool const xp = (::llabs (_drags->current_pointer_frame () - _raw_grab_frame) >= threshold.first);
+ bool const xp = (::llabs (_drags->current_pointer_sample () - _raw_grab_sample) >= threshold.first);
bool const yp = (::fabs ((current_pointer_y () - _grab_y)) >= threshold.second);
_move_threshold_passed = ((xp && x_movement_matters()) || (yp && y_movement_matters()));
@@ -485,7 +485,7 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
_last_pointer_x = _drags->current_pointer_x ();
_last_pointer_y = current_pointer_y ();
- _last_pointer_frame = adjusted_current_frame (event, false);
+ _last_pointer_sample = adjusted_current_sample (event, false);
}
return true;
@@ -510,14 +510,14 @@ Drag::abort ()
}
void
-Drag::show_verbose_cursor_time (framepos_t frame)
+Drag::show_verbose_cursor_time (samplepos_t sample)
{
- _editor->verbose_cursor()->set_time (frame);
+ _editor->verbose_cursor()->set_time (sample);
_editor->verbose_cursor()->show ();
}
void
-Drag::show_verbose_cursor_duration (framepos_t start, framepos_t end, double /*xoffset*/)
+Drag::show_verbose_cursor_duration (samplepos_t start, samplepos_t end, double /*xoffset*/)
{
_editor->verbose_cursor()->set_duration (start, end);
_editor->verbose_cursor()->show ();
@@ -535,12 +535,12 @@ Drag::add_midi_region (MidiTimeAxisView* view, bool commit)
{
if (_editor->session()) {
const TempoMap& map (_editor->session()->tempo_map());
- framecnt_t pos = grab_frame();
+ samplecnt_t pos = grab_sample();
/* not that the frame rate used here can be affected by pull up/down which
might be wrong.
*/
- framecnt_t len = map.frame_at_beat (max (0.0, map.beat_at_frame (pos)) + 1.0) - pos;
- return view->add_region (grab_frame(), len, commit);
+ samplecnt_t len = map.sample_at_beat (max (0.0, map.beat_at_sample (pos)) + 1.0) - pos;
+ return view->add_region (grab_sample(), len, commit);
}
return boost::shared_ptr<Region>();
@@ -640,7 +640,7 @@ RegionMotionDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
Drag::start_grab (event, cursor);
setup_snap_delta (_last_position);
- show_verbose_cursor_time (_last_position.frame);
+ show_verbose_cursor_time (_last_position.sample);
pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (current_pointer_y ());
if (tv.first) {
@@ -660,9 +660,9 @@ RegionMotionDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
}
double
-RegionMotionDrag::compute_x_delta (GdkEvent const * event, MusicFrame* pending_region_position)
+RegionMotionDrag::compute_x_delta (GdkEvent const * event, MusicSample* pending_region_position)
{
- /* compute the amount of pointer motion in frames, and where
+ /* compute the amount of pointer motion in samples, and where
the region would be if we moved it by that much.
*/
if (_x_constrained) {
@@ -670,30 +670,30 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, MusicFrame* pending_r
return 0.0;
}
- *pending_region_position = adjusted_frame (_drags->current_pointer_frame (), event, false);
+ *pending_region_position = adjusted_sample (_drags->current_pointer_sample (), event, false);
- framecnt_t sync_offset;
+ samplecnt_t sync_offset;
int32_t sync_dir;
sync_offset = _primary->region()->sync_offset (sync_dir);
/* we don't handle a sync point that lies before zero.
*/
- if (sync_dir >= 0 || (sync_dir < 0 && pending_region_position->frame >= sync_offset)) {
+ if (sync_dir >= 0 || (sync_dir < 0 && pending_region_position->sample >= sync_offset)) {
- framecnt_t const sd = snap_delta (event->button.state);
- MusicFrame sync_snap (pending_region_position->frame + (sync_dir * sync_offset) + sd, 0);
+ samplecnt_t const sd = snap_delta (event->button.state);
+ MusicSample sync_snap (pending_region_position->sample + (sync_dir * sync_offset) + sd, 0);
_editor->snap_to_with_modifier (sync_snap, event);
if (sync_offset == 0 && sd == 0) {
*pending_region_position = sync_snap;
} else {
- pending_region_position->set (_primary->region()->adjust_to_sync (sync_snap.frame) - sd, 0);
+ pending_region_position->set (_primary->region()->adjust_to_sync (sync_snap.sample) - sd, 0);
}
} else {
*pending_region_position = _last_position;
}
- if (pending_region_position->frame > max_framepos - _primary->region()->length()) {
+ if (pending_region_position->sample > max_samplepos - _primary->region()->length()) {
*pending_region_position = _last_position;
}
@@ -701,19 +701,19 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, MusicFrame* pending_r
bool const x_move_allowed = !_x_constrained;
- if ((pending_region_position->frame != _last_position.frame) && x_move_allowed) {
+ if ((pending_region_position->sample != _last_position.sample) && x_move_allowed) {
/* x movement since last time (in pixels) */
- dx = _editor->sample_to_pixel_unrounded (pending_region_position->frame - _last_position.frame);
+ dx = _editor->sample_to_pixel_unrounded (pending_region_position->sample - _last_position.sample);
/* total x movement */
- framecnt_t total_dx = _editor->pixel_to_sample (_total_x_delta + dx);
+ samplecnt_t total_dx = _editor->pixel_to_sample (_total_x_delta + dx);
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
- frameoffset_t const off = i->view->region()->position() + total_dx;
+ sampleoffset_t const off = i->view->region()->position() + total_dx;
if (off < 0) {
dx = dx - _editor->sample_to_pixel_unrounded (off);
- *pending_region_position = MusicFrame (pending_region_position->frame - off, 0);
+ *pending_region_position = MusicSample (pending_region_position->sample - off, 0);
break;
}
}
@@ -954,11 +954,11 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
/* Work out the change in x */
TempoMap& tmap = _editor->session()->tempo_map();
- MusicFrame pending_region_position (0, 0);
+ MusicSample pending_region_position (0, 0);
double const x_delta = compute_x_delta (event, &pending_region_position);
- double const last_pos_qn = tmap.exact_qn_at_frame (_last_position.frame, _last_position.division);
- double const qn_delta = tmap.exact_qn_at_frame (pending_region_position.frame, pending_region_position.division) - last_pos_qn;
+ double const last_pos_qn = tmap.exact_qn_at_sample (_last_position.sample, _last_position.division);
+ double const qn_delta = tmap.exact_qn_at_sample (pending_region_position.sample, pending_region_position.division) - last_pos_qn;
_last_position = pending_region_position;
@@ -1163,7 +1163,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
i->layer += this_delta_layer;
if (_brushing) {
- _editor->mouse_brush_insert_region (rv, pending_region_position.frame);
+ _editor->mouse_brush_insert_region (rv, pending_region_position.sample);
} else {
Duple track_origin;
@@ -1204,8 +1204,8 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
/* Now move the region view */
if (rv->region()->position_lock_style() == MusicTime) {
- double const last_qn = tmap.quarter_note_at_frame (rv->get_position());
- framepos_t const x_pos_music = tmap.frame_at_quarter_note (last_qn + qn_delta);
+ double const last_qn = tmap.quarter_note_at_sample (rv->get_position());
+ samplepos_t const x_pos_music = tmap.sample_at_quarter_note (last_qn + qn_delta);
rv->set_position (x_pos_music, 0);
rv->move (0, y_delta);
@@ -1218,7 +1218,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
_total_x_delta += x_delta;
if (x_delta != 0 && !_brushing) {
- show_verbose_cursor_time (_last_position.frame);
+ show_verbose_cursor_time (_last_position.sample);
}
/* keep track of pointer movement */
@@ -1406,7 +1406,7 @@ RegionMoveDrag::finished (GdkEvent* ev, bool movement_occurred)
i->view->get_canvas_group()->show ();
}
- bool const changed_position = (_last_position.frame != _primary->region()->position());
+ bool const changed_position = (_last_position.sample != _primary->region()->position());
bool const changed_tracks = (_time_axis_views[_views.front().time_axis_view] != &_views.front().view->get_time_axis_view());
if (_copy) {
@@ -1468,15 +1468,15 @@ RegionMoveDrag::create_destination_time_axis (boost::shared_ptr<Region> region,
}
void
-RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed_tracks*/, MusicFrame last_position, int32_t const ev_state)
+RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed_tracks*/, MusicSample last_position, int32_t const ev_state)
{
RegionSelection new_views;
PlaylistSet modified_playlists;
RouteTimeAxisView* new_time_axis_view = 0;
- framecnt_t const drag_delta = _primary->region()->position() - _last_position.frame;
+ samplecnt_t const drag_delta = _primary->region()->position() - _last_position.sample;
TempoMap& tmap (_editor->session()->tempo_map());
- const double last_pos_qn = tmap.exact_qn_at_frame (last_position.frame, last_position.division);
+ const double last_pos_qn = tmap.exact_qn_at_sample (last_position.sample, last_position.division);
const double qn_delta = _primary->region()->quarter_note() - last_pos_qn;
if (_brushing) {
@@ -1502,7 +1502,7 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed
continue;
}
- MusicFrame where (0, 0);
+ MusicSample where (0, 0);
double quarter_note;
if (changed_position && !_x_constrained) {
@@ -1585,7 +1585,7 @@ void
RegionMoveDrag::finished_no_copy (
bool const changed_position,
bool const changed_tracks,
- MusicFrame last_position,
+ MusicSample last_position,
int32_t const ev_state
)
{
@@ -1594,13 +1594,13 @@ RegionMoveDrag::finished_no_copy (
PlaylistSet frozen_playlists;
set<RouteTimeAxisView*> views_to_update;
RouteTimeAxisView* new_time_axis_view = 0;
- framecnt_t const drag_delta = _primary->region()->position() - last_position.frame;
+ samplecnt_t const drag_delta = _primary->region()->position() - last_position.sample;
typedef map<boost::shared_ptr<Playlist>, RouteTimeAxisView*> PlaylistMapping;
PlaylistMapping playlist_mapping;
TempoMap& tmap (_editor->session()->tempo_map());
- const double last_pos_qn = tmap.exact_qn_at_frame (last_position.frame, last_position.division);
+ const double last_pos_qn = tmap.exact_qn_at_sample (last_position.sample, last_position.division);
const double qn_delta = _primary->region()->quarter_note() - last_pos_qn;
std::set<boost::shared_ptr<const Region> > uniq;
@@ -1651,7 +1651,7 @@ RegionMoveDrag::finished_no_copy (
views_to_update.insert (dest_rtv);
- MusicFrame where (0, 0);
+ MusicSample where (0, 0);
double quarter_note;
if (changed_position && !_x_constrained) {
@@ -1743,11 +1743,11 @@ RegionMoveDrag::finished_no_copy (
playlist->freeze ();
}
if (rv == _primary) {
- rv->region()->set_position (where.frame, last_position.division);
+ rv->region()->set_position (where.sample, last_position.division);
} else {
if (rv->region()->position_lock_style() == AudioTime) {
- /* move by frame offset */
- rv->region()->set_position (where.frame, 0);
+ /* move by sample offset */
+ rv->region()->set_position (where.sample, 0);
} else {
/* move by music offset */
rv->region()->set_position_music (rv->region()->quarter_note() - qn_delta);
@@ -1854,7 +1854,7 @@ RegionMoveDrag::insert_region_into_playlist (
boost::shared_ptr<Region> region,
RouteTimeAxisView* dest_rtv,
layer_t dest_layer,
- MusicFrame where,
+ MusicSample where,
double quarter_note,
PlaylistSet& modified_playlists,
bool for_music
@@ -1875,9 +1875,9 @@ RegionMoveDrag::insert_region_into_playlist (
dest_playlist->clear_changes ();
}
if (for_music) {
- dest_playlist->add_region (region, where.frame, 1.0, false, where.division, quarter_note, true);
+ dest_playlist->add_region (region, where.sample, 1.0, false, where.division, quarter_note, true);
} else {
- dest_playlist->add_region (region, where.frame, 1.0, false, where.division);
+ dest_playlist->add_region (region, where.sample, 1.0, false, where.division);
}
if (dest_rtv->view()->layer_display() == Stacked || dest_rtv->view()->layer_display() == Expanded) {
@@ -1967,16 +1967,16 @@ RegionMoveDrag::RegionMoveDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p,
{
DEBUG_TRACE (DEBUG::Drags, "New RegionMoveDrag\n");
- _last_position = MusicFrame (_primary->region()->position(), 0);
+ _last_position = MusicSample (_primary->region()->position(), 0);
}
void
-RegionMoveDrag::setup_pointer_frame_offset ()
+RegionMoveDrag::setup_pointer_sample_offset ()
{
- _pointer_frame_offset = raw_grab_frame() - _last_position.frame;
+ _pointer_sample_offset = raw_grab_sample() - _last_position.sample;
}
-RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr<Region> r, RouteTimeAxisView* v, framepos_t pos)
+RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr<Region> r, RouteTimeAxisView* v, samplepos_t pos)
: RegionMotionDrag (e, 0, 0, list<RegionView*> (), false)
{
DEBUG_TRACE (DEBUG::Drags, "New RegionInsertDrag\n");
@@ -1990,7 +1990,7 @@ RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr<Region> r, Rout
_primary->set_position (pos, 0);
_views.push_back (DraggingView (_primary, this, v));
- _last_position = MusicFrame (pos, 0);
+ _last_position = MusicSample (pos, 0);
_item = _primary->get_canvas_group ();
}
@@ -2012,11 +2012,11 @@ RegionInsertDrag::finished (GdkEvent * event, bool)
playlist->clear_changes ();
_editor->snap_to_with_modifier (_last_position, event);
- playlist->add_region (_primary->region (), _last_position.frame, 1.0, false, _last_position.division);
+ playlist->add_region (_primary->region (), _last_position.sample, 1.0, false, _last_position.division);
// Mixbus doesn't seem to ripple when inserting regions from the list: should we? yes, probably
if (Config->get_edit_mode() == Ripple) {
- playlist->ripple (_last_position.frame, _primary->region()->length(), _primary->region());
+ playlist->ripple (_last_position.sample, _primary->region()->length(), _primary->region());
}
_editor->session()->add_command (new StatefulDiffCommand (playlist));
@@ -2080,7 +2080,7 @@ RegionSpliceDrag::motion (GdkEvent* event, bool)
RegionSelection copy;
_editor->selection->regions.by_position(copy);
- framepos_t const pf = adjusted_current_frame (event);
+ samplepos_t const pf = adjusted_current_sample (event);
for (RegionSelection::iterator i = copy.begin(); i != copy.end(); ++i) {
@@ -2101,11 +2101,11 @@ RegionSpliceDrag::motion (GdkEvent* event, bool)
}
if (dir > 0) {
- if (pf < (*i)->region()->last_frame() + 1) {
+ if (pf < (*i)->region()->last_sample() + 1) {
continue;
}
} else {
- if (pf > (*i)->region()->first_frame()) {
+ if (pf > (*i)->region()->first_sample()) {
continue;
}
}
@@ -2132,10 +2132,10 @@ RegionSpliceDrag::aborted (bool)
*/
void
-RegionRippleDrag::add_all_after_to_views(TimeAxisView *tav, framepos_t where, const RegionSelection &exclude, bool drag_in_progress)
+RegionRippleDrag::add_all_after_to_views(TimeAxisView *tav, samplepos_t where, const RegionSelection &exclude, bool drag_in_progress)
{
- boost::shared_ptr<RegionList> rl = tav->playlist()->regions_with_start_within (Evoral::Range<framepos_t>(where, max_framepos));
+ boost::shared_ptr<RegionList> rl = tav->playlist()->regions_with_start_within (Evoral::Range<samplepos_t>(where, max_samplepos));
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(tav);
RegionSelection to_ripple;
@@ -2172,7 +2172,7 @@ RegionRippleDrag::add_all_after_to_views(TimeAxisView *tav, framepos_t where, co
}
void
-RegionRippleDrag::remove_unselected_from_views(framecnt_t amount, bool move_regions)
+RegionRippleDrag::remove_unselected_from_views(samplecnt_t amount, bool move_regions)
{
for (std::list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ) {
@@ -2227,7 +2227,7 @@ RegionRippleDrag::RegionRippleDrag (Editor* e, ArdourCanvas::Item* i, RegionView
DEBUG_TRACE (DEBUG::Drags, "New RegionRippleDrag\n");
// compute length of selection
RegionSelection selected_regions = _editor->selection->regions;
- selection_length = selected_regions.end_frame() - selected_regions.start();
+ selection_length = selected_regions.end_sample() - selected_regions.start();
// we'll only allow dragging to another track in ripple mode if all the regions
// being dragged start off on the same track
@@ -2291,17 +2291,17 @@ RegionRippleDrag::motion (GdkEvent* event, bool first_move)
return;
}
- framepos_t where = adjusted_current_frame (event);
+ samplepos_t where = adjusted_current_sample (event);
assert (where >= 0);
- MusicFrame after (0, 0);
+ MusicSample after (0, 0);
double delta = compute_x_delta (event, &after);
- framecnt_t amount = _editor->pixel_to_sample (delta);
+ samplecnt_t amount = _editor->pixel_to_sample (delta);
if (allow_moves_across_tracks) {
// all the originally selected regions were on the same track
- framecnt_t adjust = 0;
+ samplecnt_t adjust = 0;
if (prev_tav && tv != prev_tav) {
// dragged onto a different track
// remove the unselected regions from _views, restore them to their original positions
@@ -2430,19 +2430,19 @@ RegionCreateDrag::motion (GdkEvent* event, bool first_move)
} else {
if (_region) {
- framepos_t const f = adjusted_current_frame (event);
- if (f <= grab_frame()) {
+ samplepos_t const f = adjusted_current_sample (event);
+ if (f <= grab_sample()) {
_region->set_initial_position (f);
}
- /* Don't use a zero-length region, and subtract 1 frame from the snapped length
+ /* Don't use a zero-length region, and subtract 1 sample from the snapped length
so that if this region is duplicated, its duplicate starts on
- a snap point rather than 1 frame after a snap point. Otherwise things get
- a bit confusing as if a region starts 1 frame after a snap point, one cannot
+ a snap point rather than 1 sample after a snap point. Otherwise things get
+ a bit confusing as if a region starts 1 sample after a snap point, one cannot
place snapped notes at the start of the region.
*/
- if (f != grab_frame()) {
- framecnt_t const len = (framecnt_t) fabs ((double)(f - grab_frame () - 1));
+ if (f != grab_sample()) {
+ samplecnt_t const len = (samplecnt_t) fabs ((double)(f - grab_sample () - 1));
_region->set_length (len < 1 ? 1 : len, _editor->get_grid_music_divisions (event->button.state));
}
}
@@ -2698,7 +2698,7 @@ VideoTimeLineDrag::VideoTimeLineDrag (Editor* e, ArdourCanvas::Item* i)
RegionSelection rs;
TrackViewList empty;
empty.clear();
- _editor->get_regions_after(rs, (framepos_t) 0, empty);
+ _editor->get_regions_after(rs, (samplepos_t) 0, empty);
std::list<RegionView*> views = rs.by_layer();
_stuck = false;
@@ -2741,7 +2741,7 @@ VideoTimeLineDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
for (list<AVDraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
if (i->initial_position < _max_backwards_drag || _max_backwards_drag < 0) {
- _max_backwards_drag = ARDOUR_UI::instance()->video_timeline->quantify_frames_to_apv (i->initial_position);
+ _max_backwards_drag = ARDOUR_UI::instance()->video_timeline->quantify_samples_to_apv (i->initial_position);
}
}
DEBUG_TRACE (DEBUG::Drags, string_compose("VideoTimeLineDrag: max backwards-drag: %1\n", _max_backwards_drag));
@@ -2767,8 +2767,8 @@ VideoTimeLineDrag::motion (GdkEvent* event, bool first_move)
return;
}
- framecnt_t dt = adjusted_current_frame (event) - raw_grab_frame() + _pointer_frame_offset;
- dt = ARDOUR_UI::instance()->video_timeline->quantify_frames_to_apv(_startdrag_video_offset+dt) - _startdrag_video_offset;
+ samplecnt_t dt = adjusted_current_sample (event) - raw_grab_sample() + _pointer_sample_offset;
+ dt = ARDOUR_UI::instance()->video_timeline->quantify_samples_to_apv(_startdrag_video_offset+dt) - _startdrag_video_offset;
if (_max_backwards_drag >= 0 && dt <= - _max_backwards_drag) {
dt = - _max_backwards_drag;
@@ -2789,7 +2789,7 @@ VideoTimeLineDrag::motion (GdkEvent* event, bool first_move)
rv->region_changed(ARDOUR::Properties::position);
}
- const framepos_t offset = ARDOUR_UI::instance()->video_timeline->get_offset();
+ const samplepos_t offset = ARDOUR_UI::instance()->video_timeline->get_offset();
Timecode::Time timecode;
Timecode::Time timediff;
char buf[128];
@@ -2837,8 +2837,8 @@ VideoTimeLineDrag::finished (GdkEvent * /*event*/, bool movement_occurred)
}
_editor->session()->maybe_update_session_range(
- std::max(ARDOUR_UI::instance()->video_timeline->get_offset(), (ARDOUR::frameoffset_t) 0),
- std::max(ARDOUR_UI::instance()->video_timeline->get_offset() + ARDOUR_UI::instance()->video_timeline->get_duration(), (ARDOUR::frameoffset_t) 0)
+ std::max(ARDOUR_UI::instance()->video_timeline->get_offset(), (ARDOUR::sampleoffset_t) 0),
+ std::max(ARDOUR_UI::instance()->video_timeline->get_offset() + ARDOUR_UI::instance()->video_timeline->get_duration(), (ARDOUR::sampleoffset_t) 0)
);
@@ -2875,12 +2875,12 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
TimeAxisView* tvp = &_primary->get_time_axis_view ();
RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
- framepos_t const region_start = _primary->region()->position();
- framepos_t const region_end = _primary->region()->last_frame();
- framecnt_t const region_length = _primary->region()->length();
+ samplepos_t const region_start = _primary->region()->position();
+ samplepos_t const region_end = _primary->region()->last_sample();
+ samplecnt_t const region_length = _primary->region()->length();
- framepos_t const pf = adjusted_current_frame (event);
- setup_snap_delta (MusicFrame(region_start, 0));
+ samplepos_t const pf = adjusted_current_sample (event);
+ setup_snap_delta (MusicSample(region_start, 0));
if (Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::trim_contents_modifier ())) {
/* Move the contents of the region around without changing the region bounds */
@@ -2937,10 +2937,10 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
TimeAxisView* tvp = &_primary->get_time_axis_view ();
RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
- frameoffset_t frame_delta = 0;
+ sampleoffset_t sample_delta = 0;
- MusicFrame adj_frame = adjusted_frame (_drags->current_pointer_frame () + snap_delta (event->button.state), event, true);
- framecnt_t dt = adj_frame.frame - raw_grab_frame () + _pointer_frame_offset - snap_delta (event->button.state);
+ MusicSample adj_sample = adjusted_sample (_drags->current_pointer_sample () + snap_delta (event->button.state), event, true);
+ samplecnt_t dt = adj_sample.sample - raw_grab_sample () + _pointer_sample_offset - snap_delta (event->button.state);
if (first_move) {
@@ -3020,7 +3020,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
if (!arv) continue;
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
if (ar->locked()) continue;
- framecnt_t len = ar->fade_in()->back()->when;
+ samplecnt_t len = ar->fade_in()->back()->when;
if (len < dt) dt = min(dt, len);
}
break;
@@ -3030,7 +3030,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
if (!arv) continue;
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
if (ar->locked()) continue;
- framecnt_t len = ar->fade_out()->back()->when;
+ samplecnt_t len = ar->fade_out()->back()->when;
if (len < -dt) dt = max(dt, -len);
}
break;
@@ -3043,15 +3043,15 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
case StartTrim:
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
bool changed = i->view->trim_front (i->initial_position + dt, non_overlap_trim
- , adj_frame.division);
+ , adj_sample.division);
if (changed && _preserve_fade_anchor) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (i->view);
if (arv) {
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
- framecnt_t len = ar->fade_in()->back()->when;
- framecnt_t diff = ar->first_frame() - i->initial_position;
- framepos_t new_length = len - diff;
+ samplecnt_t len = ar->fade_in()->back()->when;
+ samplecnt_t diff = ar->first_sample() - i->initial_position;
+ samplepos_t new_length = len - diff;
i->anchored_fade_length = min (ar->length(), new_length);
//i->anchored_fade_length = ar->verify_xfade_bounds (new_length, true /*START*/ );
arv->reset_fade_in_shape_width (ar, i->anchored_fade_length, true);
@@ -3062,14 +3062,14 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
case EndTrim:
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
- bool changed = i->view->trim_end (i->initial_end + dt, non_overlap_trim, adj_frame.division);
+ bool changed = i->view->trim_end (i->initial_end + dt, non_overlap_trim, adj_sample.division);
if (changed && _preserve_fade_anchor) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (i->view);
if (arv) {
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
- framecnt_t len = ar->fade_out()->back()->when;
- framecnt_t diff = 1 + ar->last_frame() - i->initial_end;
- framepos_t new_length = len + diff;
+ samplecnt_t len = ar->fade_out()->back()->when;
+ samplecnt_t diff = 1 + ar->last_sample() - i->initial_end;
+ samplepos_t new_length = len + diff;
i->anchored_fade_length = min (ar->length(), new_length);
//i->anchored_fade_length = ar->verify_xfade_bounds (new_length, false /*END*/ );
arv->reset_fade_out_shape_width (ar, i->anchored_fade_length, true);
@@ -3080,10 +3080,10 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
case ContentsTrim:
{
- frame_delta = (last_pointer_frame() - adjusted_current_frame(event));
+ sample_delta = (last_pointer_sample() - adjusted_current_sample(event));
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
- i->view->move_contents (frame_delta);
+ i->view->move_contents (sample_delta);
}
}
break;
@@ -3094,10 +3094,10 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
show_verbose_cursor_time (rv->region()->position());
break;
case EndTrim:
- show_verbose_cursor_duration (rv->region()->position(), rv->region()->last_frame());
+ show_verbose_cursor_duration (rv->region()->position(), rv->region()->last_sample());
break;
case ContentsTrim:
- // show_verbose_cursor_time (frame_delta);
+ // show_verbose_cursor_time (sample_delta);
break;
}
}
@@ -3174,8 +3174,8 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
} else {
/* no mouse movement */
- if (adjusted_current_frame (event) != adjusted_frame (_drags->current_pointer_frame(), event, false).frame) {
- _editor->point_trim (event, adjusted_current_frame (event));
+ if (adjusted_current_sample (event) != adjusted_sample (_drags->current_pointer_sample(), event, false).sample) {
+ _editor->point_trim (event, adjusted_current_sample (event));
}
}
@@ -3205,7 +3205,7 @@ TrimDrag::aborted (bool movement_occurred)
}
void
-TrimDrag::setup_pointer_frame_offset ()
+TrimDrag::setup_pointer_sample_offset ()
{
list<DraggingView>::iterator i = _views.begin ();
while (i != _views.end() && i->view != _primary) {
@@ -3218,10 +3218,10 @@ TrimDrag::setup_pointer_frame_offset ()
switch (_operation) {
case StartTrim:
- _pointer_frame_offset = raw_grab_frame() - i->initial_position;
+ _pointer_sample_offset = raw_grab_sample() - i->initial_position;
break;
case EndTrim:
- _pointer_frame_offset = raw_grab_frame() - i->initial_end;
+ _pointer_sample_offset = raw_grab_sample() - i->initial_end;
break;
case ContentsTrim:
break;
@@ -3246,13 +3246,13 @@ void
MeterMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{
Drag::start_grab (event, cursor);
- show_verbose_cursor_time (adjusted_current_frame(event));
+ show_verbose_cursor_time (adjusted_current_sample(event));
}
void
-MeterMarkerDrag::setup_pointer_frame_offset ()
+MeterMarkerDrag::setup_pointer_sample_offset ()
{
- _pointer_frame_offset = raw_grab_frame() - _marker->meter().frame();
+ _pointer_sample_offset = raw_grab_sample() - _marker->meter().sample();
}
void
@@ -3288,14 +3288,14 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
Timecode::BBT_Time bbt = _real_section->bbt();
/* we can't add a meter where one currently exists */
- if (_real_section->frame() < adjusted_current_frame (event, false)) {
+ if (_real_section->sample() < adjusted_current_sample (event, false)) {
++bbt.bars;
} else {
--bbt.bars;
}
- const framepos_t frame = map.frame_at_bbt (bbt);
+ const samplepos_t sample = map.sample_at_bbt (bbt);
_real_section = map.add_meter (Meter (_marker->meter().divisions_per_bar(), _marker->meter().note_divisor())
- , bbt, frame, _real_section->position_lock_style());
+ , bbt, sample, _real_section->position_lock_style());
if (!_real_section) {
aborted (true);
return;
@@ -3309,19 +3309,19 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
}
}
- framepos_t pf = adjusted_current_frame (event);
+ samplepos_t pf = adjusted_current_sample (event);
if (_real_section->position_lock_style() == AudioTime && _editor->snap_musical()) {
/* never snap to music for audio locked */
- pf = adjusted_current_frame (event, false);
+ pf = adjusted_current_sample (event, false);
}
_editor->session()->tempo_map().gui_set_meter_position (_real_section, pf);
/* fake marker meeds to stay under the mouse, unlike the real one. */
- _marker->set_position (adjusted_current_frame (event, false));
+ _marker->set_position (adjusted_current_sample (event, false));
- show_verbose_cursor_time (_real_section->frame());
+ show_verbose_cursor_time (_real_section->sample());
}
void
@@ -3352,7 +3352,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
void
MeterMarkerDrag::aborted (bool moved)
{
- _marker->set_position (_marker->meter().frame ());
+ _marker->set_position (_marker->meter().sample ());
if (moved) {
/* reinstate old snap setting */
_editor->set_snap_to (_old_snap_type);
@@ -3389,14 +3389,14 @@ TempoMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
if (!_real_section->active()) {
show_verbose_cursor_text (_("inactive"));
} else {
- show_verbose_cursor_time (adjusted_current_frame (event));
+ show_verbose_cursor_time (adjusted_current_sample (event));
}
}
void
-TempoMarkerDrag::setup_pointer_frame_offset ()
+TempoMarkerDrag::setup_pointer_sample_offset ()
{
- _pointer_frame_offset = raw_grab_frame() - _real_section->frame();
+ _pointer_sample_offset = raw_grab_sample() - _real_section->sample();
}
void
@@ -3436,15 +3436,15 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
} else {
const Tempo tempo (_marker->tempo());
- const framepos_t frame = adjusted_current_frame (event) + 1;
+ const samplepos_t sample = adjusted_current_sample (event) + 1;
_editor->begin_reversible_command (_("copy tempo mark"));
if (_real_section->position_lock_style() == MusicTime) {
const int32_t divisions = _editor->get_grid_music_divisions (event->button.state);
- _real_section = map.add_tempo (tempo, map.exact_qn_at_frame (frame, divisions), 0, MusicTime);
+ _real_section = map.add_tempo (tempo, map.exact_qn_at_sample (sample, divisions), 0, MusicTime);
} else {
- _real_section = map.add_tempo (tempo, 0.0, frame, AudioTime);
+ _real_section = map.add_tempo (tempo, 0.0, sample, AudioTime);
}
if (!_real_section) {
@@ -3470,15 +3470,15 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
show_verbose_cursor_text (strs.str());
} else if (_movable && !_real_section->locked_to_meter()) {
- framepos_t pf;
+ samplepos_t pf;
if (_editor->snap_musical()) {
/* we can't snap to a grid that we are about to move.
* gui_move_tempo() will sort out snap using the supplied beat divisions.
*/
- pf = adjusted_current_frame (event, false);
+ pf = adjusted_current_sample (event, false);
} else {
- pf = adjusted_current_frame (event);
+ pf = adjusted_current_sample (event);
}
/* snap to beat is 1, snap to bar is -1 (sorry) */
@@ -3486,9 +3486,9 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
map.gui_set_tempo_position (_real_section, pf, sub_num);
- show_verbose_cursor_time (_real_section->frame());
+ show_verbose_cursor_time (_real_section->sample());
}
- _marker->set_position (adjusted_current_frame (event, false));
+ _marker->set_position (adjusted_current_sample (event, false));
}
void
@@ -3518,7 +3518,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
void
TempoMarkerDrag::aborted (bool moved)
{
- _marker->set_position (_marker->tempo().frame());
+ _marker->set_position (_marker->tempo().sample());
if (moved) {
TempoMap& map (_editor->session()->tempo_map());
map.set_state (*_before_state, Stateful::current_state_version);
@@ -3543,9 +3543,9 @@ BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{
Drag::start_grab (event, cursor);
TempoMap& map (_editor->session()->tempo_map());
- _tempo = const_cast<TempoSection*> (&map.tempo_section_at_frame (raw_grab_frame()));
+ _tempo = const_cast<TempoSection*> (&map.tempo_section_at_sample (raw_grab_sample()));
- if (adjusted_current_frame (event, false) <= _tempo->frame()) {
+ if (adjusted_current_sample (event, false) <= _tempo->sample()) {
_drag_valid = false;
return;
}
@@ -3565,29 +3565,29 @@ BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
}
void
-BBTRulerDrag::setup_pointer_frame_offset ()
+BBTRulerDrag::setup_pointer_sample_offset ()
{
TempoMap& map (_editor->session()->tempo_map());
/* get current state */
_before_state = &map.get_state();
- const double beat_at_frame = max (0.0, map.beat_at_frame (raw_grab_frame()));
+ const double beat_at_sample = max (0.0, map.beat_at_sample (raw_grab_sample()));
const uint32_t divisions = _editor->get_grid_beat_divisions (0);
double beat = 0.0;
if (divisions > 0) {
- beat = floor (beat_at_frame) + (floor (((beat_at_frame - floor (beat_at_frame)) * divisions)) / divisions);
+ beat = floor (beat_at_sample) + (floor (((beat_at_sample - floor (beat_at_sample)) * divisions)) / divisions);
} else {
/* while it makes some sense for the user to determine the division to 'grab',
grabbing a bar often leads to confusing results wrt the actual tempo section being altered
and the result over steep tempo curves. Use sixteenths.
*/
- beat = floor (beat_at_frame) + (floor (((beat_at_frame - floor (beat_at_frame)) * 4)) / 4);
+ beat = floor (beat_at_sample) + (floor (((beat_at_sample - floor (beat_at_sample)) * 4)) / 4);
}
_grab_qn = map.quarter_note_at_beat (beat);
- _pointer_frame_offset = raw_grab_frame() - map.frame_at_quarter_note (_grab_qn);
+ _pointer_sample_offset = raw_grab_sample() - map.sample_at_quarter_note (_grab_qn);
}
@@ -3603,17 +3603,17 @@ BBTRulerDrag::motion (GdkEvent* event, bool first_move)
}
TempoMap& map (_editor->session()->tempo_map());
- framepos_t pf;
+ samplepos_t pf;
if (_editor->snap_musical()) {
- pf = adjusted_current_frame (event, false);
+ pf = adjusted_current_sample (event, false);
} else {
- pf = adjusted_current_frame (event);
+ pf = adjusted_current_sample (event);
}
if (ArdourKeyboard::indicates_constraint (event->button.state)) {
- /* adjust previous tempo to match pointer frame */
- _editor->session()->tempo_map().gui_stretch_tempo (_tempo, map.frame_at_quarter_note (_grab_qn), pf, _grab_qn, map.quarter_note_at_frame (pf));
+ /* adjust previous tempo to match pointer sample */
+ _editor->session()->tempo_map().gui_stretch_tempo (_tempo, map.sample_at_quarter_note (_grab_qn), pf, _grab_qn, map.quarter_note_at_sample (pf));
}
ostringstream sstr;
@@ -3683,7 +3683,7 @@ TempoTwistDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
TempoMap& map (_editor->session()->tempo_map());
/* get current state */
_before_state = &map.get_state();
- _tempo = const_cast<TempoSection*> (&map.tempo_section_at_frame (raw_grab_frame()));
+ _tempo = const_cast<TempoSection*> (&map.tempo_section_at_sample (raw_grab_sample()));
if (_tempo->locked_to_meter()) {
_drag_valid = false;
@@ -3714,26 +3714,26 @@ TempoTwistDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
}
void
-TempoTwistDrag::setup_pointer_frame_offset ()
+TempoTwistDrag::setup_pointer_sample_offset ()
{
TempoMap& map (_editor->session()->tempo_map());
- const double beat_at_frame = max (0.0, map.beat_at_frame (raw_grab_frame()));
+ const double beat_at_sample = max (0.0, map.beat_at_sample (raw_grab_sample()));
const uint32_t divisions = _editor->get_grid_beat_divisions (0);
double beat = 0.0;
if (divisions > 0) {
- beat = floor (beat_at_frame) + (floor (((beat_at_frame - floor (beat_at_frame)) * divisions)) / divisions);
+ beat = floor (beat_at_sample) + (floor (((beat_at_sample - floor (beat_at_sample)) * divisions)) / divisions);
} else {
/* while it makes some sense for the user to determine the division to 'grab',
grabbing a bar often leads to confusing results wrt the actual tempo section being altered
and the result over steep tempo curves. Use sixteenths.
*/
- beat = floor (beat_at_frame) + (floor (((beat_at_frame - floor (beat_at_frame)) * 4)) / 4);
+ beat = floor (beat_at_sample) + (floor (((beat_at_sample - floor (beat_at_sample)) * 4)) / 4);
}
_grab_qn = map.quarter_note_at_beat (beat);
- _pointer_frame_offset = raw_grab_frame() - map.frame_at_quarter_note (_grab_qn);
+ _pointer_sample_offset = raw_grab_sample() - map.sample_at_quarter_note (_grab_qn);
}
@@ -3751,17 +3751,17 @@ TempoTwistDrag::motion (GdkEvent* event, bool first_move)
_editor->begin_reversible_command (_("twist tempo"));
}
- framepos_t pf;
+ samplepos_t pf;
if (_editor->snap_musical()) {
- pf = adjusted_current_frame (event, false);
+ pf = adjusted_current_sample (event, false);
} else {
- pf = adjusted_current_frame (event);
+ pf = adjusted_current_sample (event);
}
- /* adjust this and the next tempi to match pointer frame */
+ /* adjust this and the next tempi to match pointer sample */
double new_bpm = max (1.5, _grab_tempo.note_types_per_minute() + ((grab_y() - min (-1.0, current_pointer_y())) / 5.0));
- _editor->session()->tempo_map().gui_twist_tempi (_tempo, new_bpm, map.frame_at_quarter_note (_grab_qn), pf);
+ _editor->session()->tempo_map().gui_twist_tempi (_tempo, new_bpm, map.sample_at_quarter_note (_grab_qn), pf);
ostringstream sstr;
sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute() << "\n";
@@ -3826,7 +3826,7 @@ TempoEndDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
TempoSection* prev = 0;
if ((prev = tmap.previous_tempo_section (_tempo)) != 0) {
_editor->tempo_curve_selected (tmap.previous_tempo_section (_tempo), true);
- sstr << "end: " << fixed << setprecision(3) << tmap.tempo_section_at_frame (_tempo->frame() - 1).end_note_types_per_minute() << "\n";
+ sstr << "end: " << fixed << setprecision(3) << tmap.tempo_section_at_sample (_tempo->sample() - 1).end_note_types_per_minute() << "\n";
}
if (_tempo->clamped()) {
@@ -3838,11 +3838,11 @@ TempoEndDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
}
void
-TempoEndDrag::setup_pointer_frame_offset ()
+TempoEndDrag::setup_pointer_sample_offset ()
{
TempoMap& map (_editor->session()->tempo_map());
- _pointer_frame_offset = raw_grab_frame() - map.frame_at_quarter_note (_grab_qn);
+ _pointer_sample_offset = raw_grab_sample() - map.sample_at_quarter_note (_grab_qn);
}
@@ -3859,11 +3859,11 @@ TempoEndDrag::motion (GdkEvent* event, bool first_move)
_editor->begin_reversible_command (_("stretch end tempo"));
}
- framepos_t const pf = adjusted_current_frame (event, false);
- map.gui_stretch_tempo_end (&map.tempo_section_at_frame (_tempo->frame() - 1), map.frame_at_quarter_note (_grab_qn), pf);
+ samplepos_t const pf = adjusted_current_sample (event, false);
+ map.gui_stretch_tempo_end (&map.tempo_section_at_sample (_tempo->sample() - 1), map.sample_at_quarter_note (_grab_qn), pf);
ostringstream sstr;
- sstr << "end: " << fixed << setprecision(3) << map.tempo_section_at_frame (_tempo->frame() - 1).end_note_types_per_minute() << "\n";
+ sstr << "end: " << fixed << setprecision(3) << map.tempo_section_at_sample (_tempo->sample() - 1).end_note_types_per_minute() << "\n";
if (_tempo->clamped()) {
sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute();
@@ -3918,7 +3918,7 @@ CursorDrag::CursorDrag (Editor* e, EditorCursor& c, bool s)
* the diskstream buffers to be refilled, which is too slow).
*/
void
-CursorDrag::fake_locate (framepos_t t)
+CursorDrag::fake_locate (samplepos_t t)
{
if (_editor->session () == 0) {
return;
@@ -3928,7 +3928,7 @@ CursorDrag::fake_locate (framepos_t t)
Session* s = _editor->session ();
if (s->timecode_transmission_suspended ()) {
- framepos_t const f = _editor->playhead_cursor->current_frame ();
+ samplepos_t const f = _editor->playhead_cursor->current_sample ();
/* This is asynchronous so it will be sent "now"
*/
s->send_mmc_locate (f);
@@ -3947,15 +3947,15 @@ void
CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
{
Drag::start_grab (event, c);
- setup_snap_delta (MusicFrame (_editor->playhead_cursor->current_frame(), 0));
+ setup_snap_delta (MusicSample (_editor->playhead_cursor->current_sample(), 0));
_grab_zoom = _editor->samples_per_pixel;
- MusicFrame where (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
+ MusicSample where (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
_editor->snap_to_with_modifier (where, event);
_editor->_dragging_playhead = true;
- _editor->_control_scroll_target = where.frame;
+ _editor->_control_scroll_target = where.sample;
Session* s = _editor->session ();
@@ -3989,7 +3989,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
}
}
- fake_locate (where.frame - snap_delta (event->button.state));
+ fake_locate (where.sample - snap_delta (event->button.state));
_last_y_delta = 0;
}
@@ -3997,12 +3997,12 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
void
CursorDrag::motion (GdkEvent* event, bool)
{
- MusicFrame where (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
+ MusicSample where (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
_editor->snap_to_with_modifier (where, event);
- if (where.frame != last_pointer_frame()) {
- fake_locate (where.frame - snap_delta (event->button.state));
+ if (where.sample != last_pointer_sample()) {
+ fake_locate (where.sample - snap_delta (event->button.state));
}
//maybe do zooming, too, if the option is enabled
@@ -4054,7 +4054,7 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred)
Session* s = _editor->session ();
if (s) {
- s->request_locate (_editor->playhead_cursor->current_frame (), _was_rolling);
+ s->request_locate (_editor->playhead_cursor->current_sample (), _was_rolling);
_editor->_pending_locate_request = true;
s->request_resume_timecode_transmission ();
}
@@ -4070,7 +4070,7 @@ CursorDrag::aborted (bool)
_editor->_dragging_playhead = false;
}
- _editor->playhead_cursor->set_position (adjusted_frame (grab_frame (), 0, false).frame);
+ _editor->playhead_cursor->set_position (adjusted_sample (grab_sample (), 0, false).sample);
}
FadeInDrag::FadeInDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v)
@@ -4086,37 +4086,37 @@ FadeInDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (_primary);
boost::shared_ptr<AudioRegion> const r = arv->audio_region ();
- setup_snap_delta (MusicFrame (r->position(), 0));
+ setup_snap_delta (MusicSample (r->position(), 0));
show_verbose_cursor_duration (r->position(), r->position() + r->fade_in()->back()->when, 32);
}
void
-FadeInDrag::setup_pointer_frame_offset ()
+FadeInDrag::setup_pointer_sample_offset ()
{
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (_primary);
boost::shared_ptr<AudioRegion> const r = arv->audio_region ();
- _pointer_frame_offset = raw_grab_frame() - ((framecnt_t) r->fade_in()->back()->when + r->position());
+ _pointer_sample_offset = raw_grab_sample() - ((samplecnt_t) r->fade_in()->back()->when + r->position());
}
void
FadeInDrag::motion (GdkEvent* event, bool)
{
- framecnt_t fade_length;
+ samplecnt_t fade_length;
- MusicFrame pos (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
+ MusicSample pos (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
_editor->snap_to_with_modifier (pos, event);
- pos.frame -= snap_delta (event->button.state);
+ pos.sample -= snap_delta (event->button.state);
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (_primary->region ());
- if (pos.frame < (region->position() + 64)) {
+ if (pos.sample < (region->position() + 64)) {
fade_length = 64; // this should be a minimum defined somewhere
- } else if (pos.frame > region->position() + region->length() - region->fade_out()->back()->when) {
+ } else if (pos.sample > region->position() + region->length() - region->fade_out()->back()->when) {
fade_length = region->length() - region->fade_out()->back()->when - 1;
} else {
- fade_length = pos.frame - region->position();
+ fade_length = pos.sample - region->position();
}
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
@@ -4140,20 +4140,20 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred)
return;
}
- framecnt_t fade_length;
- MusicFrame pos (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
+ samplecnt_t fade_length;
+ MusicSample pos (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
_editor->snap_to_with_modifier (pos, event);
- pos.frame -= snap_delta (event->button.state);
+ pos.sample -= snap_delta (event->button.state);
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (_primary->region ());
- if (pos.frame < (region->position() + 64)) {
+ if (pos.sample < (region->position() + 64)) {
fade_length = 64; // this should be a minimum defined somewhere
- } else if (pos.frame >= region->position() + region->length() - region->fade_out()->back()->when) {
+ } else if (pos.sample >= region->position() + region->length() - region->fade_out()->back()->when) {
fade_length = region->length() - region->fade_out()->back()->when - 1;
} else {
- fade_length = pos.frame - region->position();
+ fade_length = pos.sample - region->position();
}
bool in_command = false;
@@ -4212,36 +4212,36 @@ FadeOutDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (_primary);
boost::shared_ptr<AudioRegion> r = arv->audio_region ();
- setup_snap_delta (MusicFrame (r->last_frame(), 0));
+ setup_snap_delta (MusicSample (r->last_sample(), 0));
- show_verbose_cursor_duration (r->last_frame() - r->fade_out()->back()->when, r->last_frame());
+ show_verbose_cursor_duration (r->last_sample() - r->fade_out()->back()->when, r->last_sample());
}
void
-FadeOutDrag::setup_pointer_frame_offset ()
+FadeOutDrag::setup_pointer_sample_offset ()
{
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (_primary);
boost::shared_ptr<AudioRegion> r = arv->audio_region ();
- _pointer_frame_offset = raw_grab_frame() - (r->length() - (framecnt_t) r->fade_out()->back()->when + r->position());
+ _pointer_sample_offset = raw_grab_sample() - (r->length() - (samplecnt_t) r->fade_out()->back()->when + r->position());
}
void
FadeOutDrag::motion (GdkEvent* event, bool)
{
- framecnt_t fade_length;
- MusicFrame pos (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
+ samplecnt_t fade_length;
+ MusicSample pos (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
_editor->snap_to_with_modifier (pos, event);
- pos.frame -= snap_delta (event->button.state);
+ pos.sample -= snap_delta (event->button.state);
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (_primary->region ());
- if (pos.frame > (region->last_frame() - 64)) {
+ if (pos.sample > (region->last_sample() - 64)) {
fade_length = 64; // this should really be a minimum fade defined somewhere
- } else if (pos.frame <= region->position() + region->fade_in()->back()->when) {
+ } else if (pos.sample <= region->position() + region->fade_in()->back()->when) {
fade_length = region->length() - region->fade_in()->back()->when - 1;
} else {
- fade_length = region->last_frame() - pos.frame;
+ fade_length = region->last_sample() - pos.sample;
}
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
@@ -4255,7 +4255,7 @@ FadeOutDrag::motion (GdkEvent* event, bool)
tmp->reset_fade_out_shape_width (tmp->audio_region(), fade_length);
}
- show_verbose_cursor_duration (region->last_frame() - fade_length, region->last_frame());
+ show_verbose_cursor_duration (region->last_sample() - fade_length, region->last_sample());
}
void
@@ -4265,20 +4265,20 @@ FadeOutDrag::finished (GdkEvent* event, bool movement_occurred)
return;
}
- framecnt_t fade_length;
- MusicFrame pos (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
+ samplecnt_t fade_length;
+ MusicSample pos (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
_editor->snap_to_with_modifier (pos, event);
- pos.frame -= snap_delta (event->button.state);
+ pos.sample -= snap_delta (event->button.state);
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (_primary->region ());
- if (pos.frame > (region->last_frame() - 64)) {
+ if (pos.sample > (region->last_sample() - 64)) {
fade_length = 64; // this should really be a minimum fade defined somewhere
- } else if (pos.frame <= region->position() + region->fade_in()->back()->when) {
+ } else if (pos.sample <= region->position() + region->fade_in()->back()->when) {
fade_length = region->length() - region->fade_in()->back()->when - 1;
} else {
- fade_length = region->last_frame() - pos.frame;
+ fade_length = region->last_sample() - pos.sample;
}
bool in_command = false;
@@ -4373,7 +4373,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
} else {
show_verbose_cursor_time (location->end());
}
- setup_snap_delta (MusicFrame (is_start ? location->start() : location->end(), 0));
+ setup_snap_delta (MusicSample (is_start ? location->start() : location->end(), 0));
Selection::Operation op = ArdourKeyboard::selection_type (event->button.state);
@@ -4391,13 +4391,13 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{
Locations::LocationList ll;
list<ArdourMarker*> to_add;
- framepos_t s, e;
+ samplepos_t s, e;
_editor->selection->markers.range (s, e);
s = min (_marker->position(), s);
e = max (_marker->position(), e);
s = min (s, e);
e = max (s, e);
- if (e < max_framepos) {
+ if (e < max_samplepos) {
++e;
}
_editor->session()->locations()->find_all_between (s, e, ll, Location::Flags (0));
@@ -4460,25 +4460,25 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
}
void
-MarkerDrag::setup_pointer_frame_offset ()
+MarkerDrag::setup_pointer_sample_offset ()
{
bool is_start;
Location *location = _editor->find_location_from_marker (_marker, is_start);
- _pointer_frame_offset = raw_grab_frame() - (is_start ? location->start() : location->end());
+ _pointer_sample_offset = raw_grab_sample() - (is_start ? location->start() : location->end());
}
void
MarkerDrag::motion (GdkEvent* event, bool)
{
- framecnt_t f_delta = 0;
+ samplecnt_t f_delta = 0;
bool is_start;
bool move_both = false;
Location *real_location;
Location *copy_location = 0;
- framecnt_t const sd = snap_delta (event->button.state);
+ samplecnt_t const sd = snap_delta (event->button.state);
- framecnt_t const newframe = adjusted_frame (_drags->current_pointer_frame () + sd, event, true).frame - sd;
- framepos_t next = newframe;
+ samplecnt_t const newframe = adjusted_sample (_drags->current_pointer_sample () + sd, event, true).sample - sd;
+ samplepos_t next = newframe;
if (Keyboard::modifier_state_contains (event->button.state, ArdourKeyboard::push_points_modifier ())) {
move_both = true;
@@ -4560,8 +4560,8 @@ MarkerDrag::motion (GdkEvent* event, bool)
} else {
- framepos_t new_start = copy_location->start() + f_delta;
- framepos_t new_end = copy_location->end() + f_delta;
+ samplepos_t new_start = copy_location->start() + f_delta;
+ samplepos_t new_end = copy_location->end() + f_delta;
if (is_start) { // start-of-range marker
@@ -4760,7 +4760,7 @@ ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
_fixed_grab_x = _point->get_x() + _editor->sample_to_pixel_unrounded (_point->line().offset());
_fixed_grab_y = _point->get_y();
- setup_snap_delta (MusicFrame (_editor->pixel_to_sample (_fixed_grab_x), 0));
+ setup_snap_delta (MusicSample (_editor->pixel_to_sample (_fixed_grab_x), 0));
float const fraction = 1 - (_point->get_y() / _point->line().height());
show_verbose_cursor_text (_point->line().get_verbose_cursor_string (fraction));
@@ -4813,14 +4813,14 @@ ControlPointDrag::motion (GdkEvent* event, bool first_motion)
cy = zero_gain_y;
}
- MusicFrame cx_mf (_editor->pixel_to_sample (cx) + snap_delta (event->button.state), 0);
+ MusicSample cx_mf (_editor->pixel_to_sample (cx) + snap_delta (event->button.state), 0);
if (!_x_constrained && need_snap) {
_editor->snap_to_with_modifier (cx_mf, event);
}
- cx_mf.frame -= snap_delta (event->button.state);
- cx_mf.frame = min (cx_mf.frame, _point->line().maximum_time() + _point->line().offset());
+ cx_mf.sample -= snap_delta (event->button.state);
+ cx_mf.sample = min (cx_mf.sample, _point->line().maximum_time() + _point->line().offset());
float const fraction = 1.0 - (cy / _point->line().height());
@@ -4830,7 +4830,7 @@ ControlPointDrag::motion (GdkEvent* event, bool first_motion)
_point->line().start_drag_single (_point, _fixed_grab_x, initial_fraction);
}
pair<float, float> result;
- result = _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_mf.frame), fraction, false, _pushing, _final_index);
+ result = _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_mf.sample), fraction, false, _pushing, _final_index);
show_verbose_cursor_text (_point->line().get_verbose_cursor_relative_string (result.first, result.second));
}
@@ -4897,16 +4897,16 @@ LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
_line->grab_item().canvas_to_item (mx, my);
- framecnt_t const frame_within_region = (framecnt_t) floor (mx * _editor->samples_per_pixel);
+ samplecnt_t const sample_within_region = (samplecnt_t) floor (mx * _editor->samples_per_pixel);
- if (!_line->control_points_adjacent (frame_within_region, _before, _after)) {
+ if (!_line->control_points_adjacent (sample_within_region, _before, _after)) {
/* no adjacent points */
return;
}
Drag::start_grab (event, _editor->cursors()->fader);
- /* store grab start in item frame */
+ /* store grab start in item sample */
double const bx = _line->nth (_before)->get_x();
double const ax = _line->nth (_after)->get_x();
double const click_ratio = (ax - mx) / (ax - bx);
@@ -4967,7 +4967,7 @@ LineDrag::finished (GdkEvent* event, bool movement_occurred)
AutomationTimeAxisView* atv;
if ((atv = dynamic_cast<AutomationTimeAxisView*>(_editor->clicked_axisview)) != 0) {
- framepos_t where = grab_frame ();
+ samplepos_t where = grab_sample ();
double cx = 0;
double cy = _fixed_grab_y;
@@ -5018,7 +5018,7 @@ FeatureLineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
_item->parent()->canvas_to_item (cx, cy);
- /* store grab start in parent frame */
+ /* store grab start in parent sample */
_region_view_grab_x = cx;
_before = *(float*) _item->get_data ("position");
@@ -5082,33 +5082,33 @@ void
RubberbandSelectDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
{
Drag::start_grab (event);
- show_verbose_cursor_time (adjusted_current_frame (event, UIConfiguration::instance().get_rubberbanding_snaps_to_grid()));
+ show_verbose_cursor_time (adjusted_current_sample (event, UIConfiguration::instance().get_rubberbanding_snaps_to_grid()));
}
void
RubberbandSelectDrag::motion (GdkEvent* event, bool)
{
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
double y1;
double y2;
- framepos_t const pf = adjusted_current_frame (event, UIConfiguration::instance().get_rubberbanding_snaps_to_grid());
- MusicFrame grab (grab_frame (), 0);
+ samplepos_t const pf = adjusted_current_sample (event, UIConfiguration::instance().get_rubberbanding_snaps_to_grid());
+ MusicSample grab (grab_sample (), 0);
if (UIConfiguration::instance().get_rubberbanding_snaps_to_grid ()) {
_editor->snap_to_with_modifier (grab, event);
} else {
- grab.frame = raw_grab_frame ();
+ grab.sample = raw_grab_sample ();
}
/* base start and end on initial click position */
- if (pf < grab.frame) {
+ if (pf < grab.sample) {
start = pf;
- end = grab.frame;
+ end = grab.sample;
} else {
end = pf;
- start = grab.frame;
+ start = grab.sample;
}
if (current_pointer_y() < grab_y()) {
@@ -5167,13 +5167,13 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool)
void
RubberbandSelectDrag::do_select_things (GdkEvent* event, bool drag_in_progress)
{
- framepos_t x1;
- framepos_t x2;
- framepos_t grab = grab_frame ();
- framepos_t lpf = last_pointer_frame ();
+ samplepos_t x1;
+ samplepos_t x2;
+ samplepos_t grab = grab_sample ();
+ samplepos_t lpf = last_pointer_sample ();
if (!UIConfiguration::instance().get_rubberbanding_snaps_to_grid ()) {
- grab = raw_grab_frame ();
+ grab = raw_grab_sample ();
lpf = _editor->pixel_to_sample_from_event (last_pointer_x());
}
@@ -5257,10 +5257,10 @@ TimeFXDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
_editor->get_selection().add (_primary);
- MusicFrame where (_primary->region()->position(), 0);
+ MusicSample where (_primary->region()->position(), 0);
setup_snap_delta (where);
- show_verbose_cursor_duration (where.frame, adjusted_current_frame (event), 0);
+ show_verbose_cursor_duration (where.sample, adjusted_current_sample (event), 0);
}
void
@@ -5271,16 +5271,16 @@ TimeFXDrag::motion (GdkEvent* event, bool)
pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (grab_y());
int layer = tv.first->layer_display() == Overlaid ? 0 : tv.second;
int layers = tv.first->layer_display() == Overlaid ? 1 : cv->layers();
- MusicFrame pf (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
+ MusicSample pf (_editor->canvas_event_sample (event) + snap_delta (event->button.state), 0);
_editor->snap_to_with_modifier (pf, event);
- pf.frame -= snap_delta (event->button.state);
+ pf.sample -= snap_delta (event->button.state);
- if (pf.frame > rv->region()->position()) {
- rv->get_time_axis_view().show_timestretch (rv->region()->position(), pf.frame, layers, layer);
+ if (pf.sample > rv->region()->position()) {
+ rv->get_time_axis_view().show_timestretch (rv->region()->position(), pf.sample, layers, layer);
}
- show_verbose_cursor_duration (_primary->region()->position(), pf.frame, 0);
+ show_verbose_cursor_duration (_primary->region()->position(), pf.sample, 0);
}
void
@@ -5299,14 +5299,14 @@ TimeFXDrag::finished (GdkEvent* event, bool movement_occurred)
_primary->get_time_axis_view().hide_timestretch ();
- framepos_t adjusted_frame_pos = adjusted_current_frame (event);
+ samplepos_t adjusted_sample_pos = adjusted_current_sample (event);
- if (adjusted_frame_pos < _primary->region()->position()) {
+ if (adjusted_sample_pos < _primary->region()->position()) {
/* backwards drag of the left edge - not usable */
return;
}
- framecnt_t newlen = adjusted_frame_pos - _primary->region()->position();
+ samplecnt_t newlen = adjusted_sample_pos - _primary->region()->position();
fraction = (double) newlen / (double) _primary->region()->length();
@@ -5352,7 +5352,7 @@ ScrubDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
void
ScrubDrag::motion (GdkEvent* /*event*/, bool)
{
- _editor->scrub (adjusted_current_frame (0, false), _drags->current_pointer_x ());
+ _editor->scrub (adjusted_current_sample (0, false), _drags->current_pointer_x ());
}
void
@@ -5381,7 +5381,7 @@ SelectionDrag::SelectionDrag (Editor* e, ArdourCanvas::Item* i, Operation o)
if (_time_selection_at_start) {
start_at_start = _editor->get_selection().time.start();
- end_at_start = _editor->get_selection().time.end_frame();
+ end_at_start = _editor->get_selection().time.end_sample();
}
}
@@ -5431,25 +5431,25 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
if (_operation == SelectionMove) {
show_verbose_cursor_time (_editor->selection->time[_editor->clicked_selection].start);
} else {
- show_verbose_cursor_time (adjusted_current_frame (event));
+ show_verbose_cursor_time (adjusted_current_sample (event));
}
}
void
-SelectionDrag::setup_pointer_frame_offset ()
+SelectionDrag::setup_pointer_sample_offset ()
{
switch (_operation) {
case CreateSelection:
- _pointer_frame_offset = 0;
+ _pointer_sample_offset = 0;
break;
case SelectionStartTrim:
case SelectionMove:
- _pointer_frame_offset = raw_grab_frame() - _editor->selection->time[_editor->clicked_selection].start;
+ _pointer_sample_offset = raw_grab_sample() - _editor->selection->time[_editor->clicked_selection].start;
break;
case SelectionEndTrim:
- _pointer_frame_offset = raw_grab_frame() - _editor->selection->time[_editor->clicked_selection].end;
+ _pointer_sample_offset = raw_grab_sample() - _editor->selection->time[_editor->clicked_selection].end;
break;
case SelectionExtend:
@@ -5460,14 +5460,14 @@ SelectionDrag::setup_pointer_frame_offset ()
void
SelectionDrag::motion (GdkEvent* event, bool first_move)
{
- framepos_t start = 0;
- framepos_t end = 0;
- framecnt_t length = 0;
- framecnt_t distance = 0;
- MusicFrame start_mf (0, 0);
- framepos_t const pending_position = adjusted_current_frame (event);
+ samplepos_t start = 0;
+ samplepos_t end = 0;
+ samplecnt_t length = 0;
+ samplecnt_t distance = 0;
+ MusicSample start_mf (0, 0);
+ samplepos_t const pending_position = adjusted_current_sample (event);
- if (_operation != CreateSelection && pending_position == last_pointer_frame()) {
+ if (_operation != CreateSelection && pending_position == last_pointer_sample()) {
return;
}
@@ -5478,22 +5478,22 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
switch (_operation) {
case CreateSelection:
{
- MusicFrame grab (grab_frame (), 0);
+ MusicSample grab (grab_sample (), 0);
if (first_move) {
- grab.frame = adjusted_current_frame (event, false);
- if (grab.frame < pending_position) {
+ grab.sample = adjusted_current_sample (event, false);
+ if (grab.sample < pending_position) {
_editor->snap_to (grab, RoundDownMaybe);
} else {
_editor->snap_to (grab, RoundUpMaybe);
}
}
- if (pending_position < grab.frame) {
+ if (pending_position < grab.sample) {
start = pending_position;
- end = grab.frame;
+ end = grab.sample;
} else {
end = pending_position;
- start = grab.frame;
+ start = grab.sample;
}
/* first drag: Either add to the selection
@@ -5634,10 +5634,10 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
distance = pending_position - start;
start = pending_position;
- start_mf.frame = start;
+ start_mf.sample = start;
_editor->snap_to (start_mf);
- end = start_mf.frame + length;
+ end = start_mf.sample + length;
break;
@@ -5688,7 +5688,7 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
}
if (_editor->get_selection().time.length() != 0) {
- s->set_range_selection (_editor->get_selection().time.start(), _editor->get_selection().time.end_frame());
+ s->set_range_selection (_editor->get_selection().time.start(), _editor->get_selection().time.end_sample());
} else {
s->clear_range_selection ();
}
@@ -5707,9 +5707,9 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
if (_operation == SelectionExtend) {
if (_time_selection_at_start) {
- framepos_t pos = adjusted_current_frame (event, false);
- framepos_t start = min (pos, start_at_start);
- framepos_t end = max (pos, end_at_start);
+ samplepos_t pos = adjusted_current_sample (event, false);
+ samplepos_t start = min (pos, start_at_start);
+ samplepos_t end = max (pos, end_at_start);
_editor->selection->set (start, end);
}
} else {
@@ -5800,14 +5800,14 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
Drag::start_grab (event, cursor);
- show_verbose_cursor_time (adjusted_current_frame (event));
+ show_verbose_cursor_time (adjusted_current_sample (event));
}
void
RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
{
- framepos_t start = 0;
- framepos_t end = 0;
+ samplepos_t start = 0;
+ samplepos_t end = 0;
ArdourCanvas::Rectangle *crect;
switch (_operation) {
@@ -5829,18 +5829,18 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
break;
}
- framepos_t const pf = adjusted_current_frame (event);
+ samplepos_t const pf = adjusted_current_sample (event);
if (_operation == CreateSkipMarker || _operation == CreateRangeMarker || _operation == CreateTransportMarker || _operation == CreateCDMarker) {
- MusicFrame grab (grab_frame (), 0);
+ MusicSample grab (grab_sample (), 0);
_editor->snap_to (grab);
- if (pf < grab_frame()) {
+ if (pf < grab_sample()) {
start = pf;
- end = grab.frame;
+ end = grab.sample;
} else {
end = pf;
- start = grab.frame;
+ start = grab.sample;
}
/* first drag: Either add to the selection
@@ -5933,7 +5933,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
/* didn't drag, so just locate */
- _editor->session()->request_locate (grab_frame(), _editor->session()->transport_rolling());
+ _editor->session()->request_locate (grab_sample(), _editor->session()->transport_rolling());
} else if (_operation == CreateCDMarker) {
@@ -5942,17 +5942,17 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
} else { /* operation == CreateRangeMarker || CreateSkipMarker */
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
- _editor->session()->locations()->marks_either_side (grab_frame(), start, end);
+ _editor->session()->locations()->marks_either_side (grab_sample(), start, end);
- if (end == max_framepos) {
- end = _editor->session()->current_end_frame ();
+ if (end == max_samplepos) {
+ end = _editor->session()->current_end_sample ();
}
- if (start == max_framepos) {
- start = _editor->session()->current_start_frame ();
+ if (start == max_samplepos) {
+ start = _editor->session()->current_start_sample ();
}
switch (_editor->mouse_mode) {
@@ -6010,10 +6010,10 @@ NoteDrag::NoteDrag (Editor* e, ArdourCanvas::Item* i)
}
void
-NoteDrag::setup_pointer_frame_offset ()
+NoteDrag::setup_pointer_sample_offset ()
{
- _pointer_frame_offset = raw_grab_frame()
- - _editor->session()->tempo_map().frame_at_quarter_note (_region->session_relative_qn (_primary->note()->time().to_double()));
+ _pointer_sample_offset = raw_grab_sample()
+ - _editor->session()->tempo_map().sample_at_quarter_note (_region->session_relative_qn (_primary->note()->time().to_double()));
}
void
@@ -6027,7 +6027,7 @@ NoteDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
_copy = false;
}
- setup_snap_delta (MusicFrame (_region->source_beats_to_absolute_frames (_primary->note()->time ()), 0));
+ setup_snap_delta (MusicSample (_region->source_beats_to_absolute_samples (_primary->note()->time ()), 0));
if (!(_was_selected = _primary->selected())) {
@@ -6061,22 +6061,22 @@ NoteDrag::total_dx (GdkEvent * event) const
TempoMap& map (_editor->session()->tempo_map());
- /* dx in frames */
- frameoffset_t const dx = _editor->pixel_to_sample (_drags->current_pointer_x() - grab_x());
+ /* dx in samples */
+ sampleoffset_t const dx = _editor->pixel_to_sample (_drags->current_pointer_x() - grab_x());
/* primary note time */
- frameoffset_t const n = map.frame_at_quarter_note (_region->session_relative_qn (_primary->note()->time().to_double()));
+ sampleoffset_t const n = map.sample_at_quarter_note (_region->session_relative_qn (_primary->note()->time().to_double()));
/* primary note time in quarter notes */
double const n_qn = _region->session_relative_qn (_primary->note()->time().to_double());
- /* new time of the primary note in session frames */
- frameoffset_t st = n + dx + snap_delta (event->button.state);
+ /* new time of the primary note in session samples */
+ sampleoffset_t st = n + dx + snap_delta (event->button.state);
/* possibly snap and return corresponding delta in quarter notes */
- MusicFrame snap (st, 0);
+ MusicSample snap (st, 0);
_editor->snap_to_with_modifier (snap, event);
- double ret = map.exact_qn_at_frame (snap.frame, snap.division) - n_qn - snap_delta_music (event->button.state);
+ double ret = map.exact_qn_at_sample (snap.sample, snap.division) - n_qn - snap_delta_music (event->button.state);
/* prevent the earliest note being dragged earlier than the region's start position */
if (_earliest + ret < _region->midi_region()->start_beats()) {
@@ -6254,7 +6254,7 @@ AutomationRangeDrag::setup (list<boost::shared_ptr<AutomationLine> > const & lin
list<boost::shared_ptr<AutomationLine> >::const_iterator j = i;
++j;
- pair<framepos_t, framepos_t> r = (*i)->get_point_x_range ();
+ pair<samplepos_t, samplepos_t> r = (*i)->get_point_x_range ();
/* check this range against all the AudioRanges that we are using */
list<AudioRange>::const_iterator k = _ranges.begin ();
@@ -6335,7 +6335,7 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
for (list<AudioRange>::const_iterator i = _ranges.begin(); i != _ranges.end(); ++i) {
- framecnt_t const half = (i->start + i->end) / 2;
+ samplecnt_t const half = (i->start + i->end) / 2;
/* find the line that this audio range starts in */
list<Line>::iterator j = _lines.begin();
@@ -6350,7 +6350,7 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
64 samples length plucked out of thin air.
*/
- framepos_t a = i->start + 64;
+ samplepos_t a = i->start + 64;
if (a > half) {
a = half;
}
@@ -6382,7 +6382,7 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
64 samples length plucked out of thin air.
*/
- framepos_t b = i->end - 64;
+ samplepos_t b = i->end - 64;
if (b < half) {
b = half;
}
@@ -6491,19 +6491,19 @@ PatchChangeDrag::PatchChangeDrag (Editor* e, PatchChange* i, MidiRegionView* r)
, _cumulative_dx (0)
{
DEBUG_TRACE (DEBUG::Drags, string_compose ("New PatchChangeDrag, patch @ %1, grab @ %2\n",
- _region_view->source_beats_to_absolute_frames (_patch_change->patch()->time()),
- grab_frame()));
+ _region_view->source_beats_to_absolute_samples (_patch_change->patch()->time()),
+ grab_sample()));
}
void
PatchChangeDrag::motion (GdkEvent* ev, bool)
{
- framepos_t f = adjusted_current_frame (ev);
+ samplepos_t f = adjusted_current_sample (ev);
boost::shared_ptr<Region> r = _region_view->region ();
f = max (f, r->position ());
- f = min (f, r->last_frame ());
+ f = min (f, r->last_sample ());
- framecnt_t const dxf = f - grab_frame(); // permitted dx in frames
+ samplecnt_t const dxf = f - grab_sample(); // permitted dx in samples
double const dxu = _editor->sample_to_pixel (dxf); // permitted fx in units
_patch_change->move (ArdourCanvas::Duple (dxu - _cumulative_dx, 0));
_cumulative_dx = dxu;
@@ -6520,13 +6520,13 @@ PatchChangeDrag::finished (GdkEvent* ev, bool movement_occurred)
}
boost::shared_ptr<Region> r (_region_view->region ());
- framepos_t f = adjusted_current_frame (ev);
+ samplepos_t f = adjusted_current_sample (ev);
f = max (f, r->position ());
- f = min (f, r->last_frame ());
+ f = min (f, r->last_sample ());
_region_view->move_patch_change (
*_patch_change,
- _region_view->region_frames_to_region_beats (f - (r->position() - r->start()))
+ _region_view->region_samples_to_region_beats (f - (r->position() - r->start()))
);
}
@@ -6537,10 +6537,10 @@ PatchChangeDrag::aborted (bool)
}
void
-PatchChangeDrag::setup_pointer_frame_offset ()
+PatchChangeDrag::setup_pointer_sample_offset ()
{
boost::shared_ptr<Region> region = _region_view->region ();
- _pointer_frame_offset = raw_grab_frame() - _region_view->source_beats_to_absolute_frames (_patch_change->patch()->time());
+ _pointer_sample_offset = raw_grab_sample() - _region_view->source_beats_to_absolute_samples (_patch_change->patch()->time());
}
MidiRubberbandSelectDrag::MidiRubberbandSelectDrag (Editor* e, MidiRegionView* rv)
@@ -6551,7 +6551,7 @@ MidiRubberbandSelectDrag::MidiRubberbandSelectDrag (Editor* e, MidiRegionView* r
}
void
-MidiRubberbandSelectDrag::select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool /*drag_in_progress*/)
+MidiRubberbandSelectDrag::select_things (int button_state, samplepos_t x1, samplepos_t x2, double y1, double y2, bool /*drag_in_progress*/)
{
_region_view->update_drag_selection (
x1, x2, y1, y2,
@@ -6572,7 +6572,7 @@ MidiVerticalSelectDrag::MidiVerticalSelectDrag (Editor* e, MidiRegionView* rv)
}
void
-MidiVerticalSelectDrag::select_things (int button_state, framepos_t /*x1*/, framepos_t /*x2*/, double y1, double y2, bool /*drag_in_progress*/)
+MidiVerticalSelectDrag::select_things (int button_state, samplepos_t /*x1*/, samplepos_t /*x2*/, double y1, double y2, bool /*drag_in_progress*/)
{
double const y = _region_view->midi_view()->y_position ();
@@ -6599,7 +6599,7 @@ EditorRubberbandSelectDrag::EditorRubberbandSelectDrag (Editor* e, ArdourCanvas:
}
void
-EditorRubberbandSelectDrag::select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress)
+EditorRubberbandSelectDrag::select_things (int button_state, samplepos_t x1, samplepos_t x2, double y1, double y2, bool drag_in_progress)
{
if (drag_in_progress) {
/* We just want to select things at the end of the drag, not during it */
@@ -6642,15 +6642,15 @@ NoteCreateDrag::~NoteCreateDrag ()
delete _drag_rect;
}
-framecnt_t
-NoteCreateDrag::grid_frames (framepos_t t) const
+samplecnt_t
+NoteCreateDrag::grid_samples (samplepos_t t) const
{
const Evoral::Beats grid_beats = _region_view->get_grid_beats (t);
- const Evoral::Beats t_beats = _region_view->region_frames_to_region_beats (t);
+ const Evoral::Beats t_beats = _region_view->region_samples_to_region_beats (t);
- return _region_view->region_beats_to_region_frames (t_beats + grid_beats)
- - _region_view->region_beats_to_region_frames (t_beats);
+ return _region_view->region_beats_to_region_samples (t_beats + grid_beats)
+ - _region_view->region_beats_to_region_samples (t_beats);
}
void
@@ -6661,16 +6661,16 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
_drag_rect = new ArdourCanvas::Rectangle (_region_view->get_canvas_group ());
TempoMap& map (_editor->session()->tempo_map());
- const framepos_t pf = _drags->current_pointer_frame ();
+ const samplepos_t pf = _drags->current_pointer_sample ();
const int32_t divisions = _editor->get_grid_music_divisions (event->button.state);
const Evoral::Beats grid_beats = _region_view->get_grid_beats (pf);
- double eqaf = map.exact_qn_at_frame (pf, divisions);
+ double eqaf = map.exact_qn_at_sample (pf, divisions);
if (divisions != 0) {
- const double qaf = map.quarter_note_at_frame (pf);
+ const double qaf = map.quarter_note_at_sample (pf);
/* Hack so that we always snap to the note that we are over, instead of snapping
to the next one if we're more than halfway through the one we're over.
@@ -6682,9 +6682,9 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
}
}
- _note[0] = map.frame_at_quarter_note (eqaf) - _region_view->region()->position();
+ _note[0] = map.sample_at_quarter_note (eqaf) - _region_view->region()->position();
/* minimum initial length is grid beats */
- _note[1] = map.frame_at_quarter_note (eqaf + grid_beats.to_double()) - _region_view->region()->position();
+ _note[1] = map.sample_at_quarter_note (eqaf + grid_beats.to_double()) - _region_view->region()->position();
double const x0 = _editor->sample_to_pixel (_note[0]);
double const x1 = _editor->sample_to_pixel (_note[1]);
@@ -6700,15 +6700,15 @@ void
NoteCreateDrag::motion (GdkEvent* event, bool)
{
TempoMap& map (_editor->session()->tempo_map());
- const framepos_t pf = _drags->current_pointer_frame ();
+ const samplepos_t pf = _drags->current_pointer_sample ();
const int32_t divisions = _editor->get_grid_music_divisions (event->button.state);
- double eqaf = map.exact_qn_at_frame (pf, divisions);
+ double eqaf = map.exact_qn_at_sample (pf, divisions);
if (divisions != 0) {
const Evoral::Beats grid_beats = _region_view->get_grid_beats (pf);
- const double qaf = map.quarter_note_at_frame (pf);
+ const double qaf = map.quarter_note_at_sample (pf);
/* Hack so that we always snap to the note that we are over, instead of snapping
to the next one if we're more than halfway through the one we're over.
*/
@@ -6720,7 +6720,7 @@ NoteCreateDrag::motion (GdkEvent* event, bool)
eqaf += grid_beats.to_double();
}
- _note[1] = max ((framepos_t)0, map.frame_at_quarter_note (eqaf) - _region_view->region()->position ());
+ _note[1] = max ((samplepos_t)0, map.sample_at_quarter_note (eqaf) - _region_view->region()->position ());
double const x0 = _editor->sample_to_pixel (_note[0]);
double const x1 = _editor->sample_to_pixel (_note[1]);
@@ -6732,17 +6732,17 @@ void
NoteCreateDrag::finished (GdkEvent* ev, bool had_movement)
{
/* we create a note even if there was no movement */
- framepos_t const start = min (_note[0], _note[1]);
- framepos_t const start_sess_rel = start + _region_view->region()->position();
- framecnt_t length = max (_editor->pixel_to_sample (1.0), (framecnt_t) fabs ((double)(_note[0] - _note[1])));
- framecnt_t const g = grid_frames (start_sess_rel);
+ samplepos_t const start = min (_note[0], _note[1]);
+ samplepos_t const start_sess_rel = start + _region_view->region()->position();
+ samplecnt_t length = max (_editor->pixel_to_sample (1.0), (samplecnt_t) fabs ((double)(_note[0] - _note[1])));
+ samplecnt_t const g = grid_samples (start_sess_rel);
if (_editor->get_grid_music_divisions (ev->button.state) != 0 && length < g) {
length = g;
}
TempoMap& map (_editor->session()->tempo_map());
- const double qn_length = map.quarter_notes_between_frames (start_sess_rel, start_sess_rel + length);
+ const double qn_length = map.quarter_notes_between_samples (start_sess_rel, start_sess_rel + length);
Evoral::Beats qn_length_beats = max (Evoral::Beats::ticks(1), Evoral::Beats (qn_length));
_editor->begin_reversible_command (_("Create Note"));
@@ -6786,10 +6786,10 @@ HitCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
_y = _region_view->note_to_y (_region_view->y_to_note (y_to_region (event->button.y)));
- const framepos_t pf = _drags->current_pointer_frame ();
+ const samplepos_t pf = _drags->current_pointer_sample ();
const int32_t divisions = _editor->get_grid_music_divisions (event->button.state);
- const double eqaf = map.exact_qn_at_frame (pf, divisions);
+ const double eqaf = map.exact_qn_at_sample (pf, divisions);
boost::shared_ptr<MidiRegion> mr = _region_view->midi_region();
@@ -6797,7 +6797,7 @@ HitCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
return;
}
- const framepos_t start = map.frame_at_quarter_note (eqaf) - _region_view->region()->position();
+ const samplepos_t start = map.sample_at_quarter_note (eqaf) - _region_view->region()->position();
Evoral::Beats length = _region_view->get_grid_beats (pf);
_editor->begin_reversible_command (_("Create Hit"));
@@ -6812,15 +6812,15 @@ HitCreateDrag::motion (GdkEvent* event, bool)
{
TempoMap& map (_editor->session()->tempo_map());
- const framepos_t pf = _drags->current_pointer_frame ();
+ const samplepos_t pf = _drags->current_pointer_sample ();
const int32_t divisions = _editor->get_grid_music_divisions (event->button.state);
if (divisions == 0) {
return;
}
- const double eqaf = map.exact_qn_at_frame (pf, divisions);
- const framepos_t start = map.frame_at_quarter_note (eqaf) - _region_view->region()->position ();
+ const double eqaf = map.exact_qn_at_sample (pf, divisions);
+ const samplepos_t start = map.sample_at_quarter_note (eqaf) - _region_view->region()->position ();
if (_last_pos == start) {
return;
@@ -6879,7 +6879,7 @@ CrossfadeEdgeDrag::motion (GdkEvent*, bool)
{
double distance;
double new_length;
- framecnt_t len;
+ samplecnt_t len;
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
@@ -6911,7 +6911,7 @@ CrossfadeEdgeDrag::finished (GdkEvent*, bool)
{
double distance;
double new_length;
- framecnt_t len;
+ samplecnt_t len;
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
@@ -6956,7 +6956,7 @@ CrossfadeEdgeDrag::aborted (bool)
}
}
-RegionCutDrag::RegionCutDrag (Editor* e, ArdourCanvas::Item* item, framepos_t pos)
+RegionCutDrag::RegionCutDrag (Editor* e, ArdourCanvas::Item* item, samplepos_t pos)
: Drag (e, item, true)
, line (new EditorCursor (*e))
{
@@ -6980,10 +6980,10 @@ RegionCutDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
void
RegionCutDrag::motion (GdkEvent* event, bool)
{
- MusicFrame pos (_drags->current_pointer_frame(), 0);
+ MusicSample pos (_drags->current_pointer_sample(), 0);
_editor->snap_to_with_modifier (pos, event);
- line->set_position (pos.frame);
+ line->set_position (pos.sample);
}
void
@@ -6992,11 +6992,11 @@ RegionCutDrag::finished (GdkEvent* event, bool)
_editor->get_track_canvas()->canvas()->re_enter();
- MusicFrame pos (_drags->current_pointer_frame(), 0);
+ MusicSample pos (_drags->current_pointer_sample(), 0);
_editor->snap_to_with_modifier (pos, event);
line->hide ();
- RegionSelection rs = _editor->get_regions_from_selection_and_mouse (pos.frame);
+ RegionSelection rs = _editor->get_regions_from_selection_and_mouse (pos.sample);
if (rs.empty()) {
return;
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index df54c6bda7..53006676be 100644
--- a/gtk2_ardour/editor_drag.h
+++ b/gtk2_ardour/editor_drag.h
@@ -109,9 +109,9 @@ public:
return _current_pointer_y;
}
- /** @return current pointer frame */
- ARDOUR::framepos_t current_pointer_frame () const {
- return _current_pointer_frame;
+ /** @return current pointer sample */
+ ARDOUR::samplepos_t current_pointer_sample () const {
+ return _current_pointer_sample;
}
private:
@@ -120,7 +120,7 @@ private:
bool _ending; ///< true if end_grab or abort is in progress, otherwise false
double _current_pointer_x; ///< canvas-coordinate space x of the current pointer
double _current_pointer_y; ///< canvas-coordinate space y of the current pointer
- ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at
+ ARDOUR::samplepos_t _current_pointer_sample; ///< sample that the pointer is now at
bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
};
@@ -144,8 +144,8 @@ public:
bool motion_handler (GdkEvent*, bool);
void abort ();
- ARDOUR::MusicFrame adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
- ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
+ ARDOUR::MusicSample adjusted_sample (ARDOUR::samplepos_t, GdkEvent const *, bool snap = true) const;
+ ARDOUR::samplepos_t adjusted_current_sample (GdkEvent const *, bool snap = true) const;
bool was_double_click() const { return _was_double_click; }
void set_double_click (bool yn) { _was_double_click = yn; }
@@ -183,8 +183,8 @@ public:
return true;
}
- /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
- virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
+ /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
+ virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (1, 1);
}
@@ -206,9 +206,9 @@ public:
return _initially_vertical;
}
- /** Set up the _pointer_frame_offset */
- virtual void setup_pointer_frame_offset () {
- _pointer_frame_offset = 0;
+ /** Set up the _pointer_sample_offset */
+ virtual void setup_pointer_sample_offset () {
+ _pointer_sample_offset = 0;
}
protected:
@@ -221,12 +221,12 @@ protected:
return _grab_y;
}
- ARDOUR::framepos_t raw_grab_frame () const {
- return _raw_grab_frame;
+ ARDOUR::samplepos_t raw_grab_sample () const {
+ return _raw_grab_sample;
}
- ARDOUR::framepos_t grab_frame () const {
- return _grab_frame;
+ ARDOUR::samplepos_t grab_sample () const {
+ return _grab_sample;
}
double last_pointer_x () const {
@@ -237,30 +237,30 @@ protected:
return _last_pointer_y;
}
- ARDOUR::framepos_t last_pointer_frame () const {
- return _last_pointer_frame;
+ ARDOUR::samplepos_t last_pointer_sample () const {
+ return _last_pointer_sample;
}
- ARDOUR::frameoffset_t snap_delta (guint const) const;
+ ARDOUR::sampleoffset_t snap_delta (guint const) const;
double snap_delta_music (guint const) const;
double current_pointer_x () const;
double current_pointer_y () const;
/* sets snap delta from unsnapped pos */
- void setup_snap_delta (ARDOUR::MusicFrame pos);
+ void setup_snap_delta (ARDOUR::MusicSample pos);
boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*, bool commit);
- void show_verbose_cursor_time (framepos_t);
- void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
+ void show_verbose_cursor_time (samplepos_t);
+ void show_verbose_cursor_duration (samplepos_t, samplepos_t, double xoffset = 0);
void show_verbose_cursor_text (std::string const &);
Editor* _editor; ///< our editor
DragManager* _drags;
ArdourCanvas::Item* _item; ///< our item
/** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
- ARDOUR::framecnt_t _pointer_frame_offset;
+ ARDOUR::samplecnt_t _pointer_sample_offset;
bool _x_constrained; ///< true if x motion is constrained, otherwise false
bool _y_constrained; ///< true if y motion is constrained, otherwise false
bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
@@ -275,14 +275,14 @@ private:
double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
- ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
- ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
- ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
+ ARDOUR::samplepos_t _raw_grab_sample; ///< unsnapped sample that the mouse was at when start_grab was called, or 0
+ ARDOUR::samplepos_t _grab_sample; ///< adjusted_sample that the mouse was at when start_grab was called, or 0
+ ARDOUR::samplepos_t _last_pointer_sample; ///< adjusted_sample the last time a motion occurred
/* difference between some key position's snapped and unsnapped
- * framepos. used for relative snap.
+ * samplepos. used for relative snap.
*/
- framepos_t _snap_delta;
+ samplepos_t _snap_delta;
double _snap_delta_music;
CursorContext::Handle _cursor_ctx; ///< cursor change context
bool _constraint_pressed; ///< if the keyboard indicated constraint modifier was pressed on start_grab()
@@ -307,9 +307,9 @@ public:
*/
double layer;
double initial_y; ///< the initial y position of the view before any reparenting
- framepos_t initial_position; ///< initial position of the region
- framepos_t initial_end; ///< initial end position of the region
- framepos_t anchored_fade_length; ///< fade_length when anchored during drag
+ samplepos_t initial_position; ///< initial position of the region
+ samplepos_t initial_end; ///< initial end position of the region
+ samplepos_t anchored_fade_length; ///< fade_length when anchored during drag
boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
TimeAxisView* initial_time_axis_view;
};
@@ -364,12 +364,12 @@ public:
protected:
- double compute_x_delta (GdkEvent const *, ARDOUR::MusicFrame *);
+ double compute_x_delta (GdkEvent const *, ARDOUR::MusicSample *);
virtual bool y_movement_allowed (int, double, int skip_invisible = 0) const;
bool _brushing;
bool _ignore_video_lock;
- ARDOUR::MusicFrame _last_position; ///< last position of the thing being dragged
+ ARDOUR::MusicSample _last_position; ///< last position of the thing being dragged
double _total_x_delta;
int _last_pointer_time_axis_view;
double _last_pointer_layer;
@@ -397,11 +397,11 @@ public:
return true;
}
- std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
+ std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (4, 4);
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
protected:
typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
@@ -411,14 +411,14 @@ private:
void finished_no_copy (
bool const,
bool const,
- ARDOUR::MusicFrame,
+ ARDOUR::MusicSample,
int32_t const ev_state
);
void finished_copy (
bool const,
bool const,
- ARDOUR::MusicFrame,
+ ARDOUR::MusicSample,
int32_t const ev_state
);
@@ -426,7 +426,7 @@ private:
boost::shared_ptr<ARDOUR::Region>,
RouteTimeAxisView*,
ARDOUR::layer_t,
- ARDOUR::MusicFrame,
+ ARDOUR::MusicSample,
double quarter_note,
PlaylistSet&,
bool for_music = false
@@ -450,7 +450,7 @@ private:
class RegionInsertDrag : public RegionMotionDrag
{
public:
- RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
+ RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::samplepos_t);
void finished (GdkEvent *, bool);
void aborted (bool);
@@ -488,13 +488,13 @@ protected:
private:
TimeAxisView *prev_tav; // where regions were most recently dragged from
TimeAxisView *orig_tav; // where drag started
- ARDOUR::framecnt_t prev_amount;
- ARDOUR::framepos_t prev_position;
- ARDOUR::framecnt_t selection_length;
+ ARDOUR::samplecnt_t prev_amount;
+ ARDOUR::samplepos_t prev_position;
+ ARDOUR::samplecnt_t selection_length;
bool allow_moves_across_tracks; // only if all selected regions are on one track
ARDOUR::RegionList *exclude;
- void add_all_after_to_views (TimeAxisView *tav, ARDOUR::framepos_t where, const RegionSelection &exclude, bool drag_in_progress);
- void remove_unselected_from_views (ARDOUR::framecnt_t amount, bool move_regions);
+ void add_all_after_to_views (TimeAxisView *tav, ARDOUR::samplepos_t where, const RegionSelection &exclude, bool drag_in_progress);
+ void remove_unselected_from_views (ARDOUR::samplecnt_t amount, bool move_regions);
};
@@ -502,7 +502,7 @@ private:
class RegionCutDrag : public Drag
{
public:
- RegionCutDrag (Editor*, ArdourCanvas::Item*, framepos_t);
+ RegionCutDrag (Editor*, ArdourCanvas::Item*, samplepos_t);
~RegionCutDrag ();
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
@@ -559,7 +559,7 @@ public:
void finished (GdkEvent *, bool);
void aborted (bool);
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
double total_dx (GdkEvent * event) const; // total movement in quarter notes
@@ -596,16 +596,16 @@ public:
private:
double y_to_region (double) const;
- ARDOUR::framecnt_t grid_frames (framepos_t) const;
+ ARDOUR::samplecnt_t grid_samples (samplepos_t) const;
- /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
- virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
+ /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
+ virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (0, 0);
}
MidiRegionView* _region_view;
ArdourCanvas::Rectangle* _drag_rect;
- framepos_t _note[2];
+ samplepos_t _note[2];
};
class HitCreateDrag : public Drag
@@ -629,15 +629,15 @@ public:
private:
double y_to_region (double) const;
- ARDOUR::framecnt_t grid_frames (framepos_t) const;
+ ARDOUR::samplecnt_t grid_samples (samplepos_t) const;
- /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
- virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
+ /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
+ virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (0, 0);
}
MidiRegionView* _region_view;
- framepos_t _last_pos;
+ samplepos_t _last_pos;
double _y;
};
@@ -656,7 +656,7 @@ public:
return false;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
MidiRegionView* _region_view;
@@ -671,7 +671,7 @@ public:
AVDraggingView (RegionView *);
RegionView* view; ///< the view
- framepos_t initial_position; ///< initial position of the region
+ samplepos_t initial_position; ///< initial position of the region
};
/** Drag of video offset */
@@ -698,8 +698,8 @@ protected:
std::list<AVDraggingView> _views; ///< information about all audio that are being dragged along
private:
- ARDOUR::frameoffset_t _startdrag_video_offset;
- ARDOUR::frameoffset_t _max_backwards_drag;
+ ARDOUR::sampleoffset_t _startdrag_video_offset;
+ ARDOUR::sampleoffset_t _max_backwards_drag;
bool _stuck;
};
@@ -724,7 +724,7 @@ public:
return false;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
@@ -753,7 +753,7 @@ public:
return false;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
MeterMarker* _marker;
@@ -784,7 +784,7 @@ public:
return true;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
TempoMarker* _marker;
@@ -816,7 +816,7 @@ public:
return false;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
double _grab_qn;
@@ -844,7 +844,7 @@ public:
return true;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
double _grab_qn;
@@ -875,7 +875,7 @@ public:
return true;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
double _grab_qn;
@@ -904,11 +904,11 @@ public:
}
private:
- void fake_locate (framepos_t);
+ void fake_locate (samplepos_t);
EditorCursor& _cursor;
bool _stop; ///< true to stop the transport on starting the drag, otherwise false
- double _grab_zoom; ///< editor frames per unit when our grab started
+ double _grab_zoom; ///< editor samples per unit when our grab started
//used for zooming
int _last_mx;
@@ -932,7 +932,7 @@ public:
return false;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
};
/** Region fade-out drag */
@@ -950,7 +950,7 @@ public:
return false;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
};
/** Marker drag */
@@ -973,7 +973,7 @@ public:
return false;
}
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
void update_item (ARDOUR::Location *);
@@ -1072,7 +1072,7 @@ public:
void finished (GdkEvent *, bool);
void aborted (bool);
- std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
+ std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (8, 1);
}
@@ -1080,13 +1080,13 @@ public:
/** Select some things within a rectangle.
* @param button_state The button state from the GdkEvent.
- * @param x1 The left-hand side of the rectangle in session frames.
- * @param x2 The right-hand side of the rectangle in session frames.
+ * @param x1 The left-hand side of the rectangle in session samples.
+ * @param x2 The right-hand side of the rectangle in session samples.
* @param y1 The top of the rectangle in trackview coordinates.
* @param y2 The bottom of the rectangle in trackview coordinates.
* @param drag_in_progress true if the drag is currently happening.
*/
- virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
+ virtual void select_things (int button_state, samplepos_t x1, samplepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
virtual void deselect_things () = 0;
@@ -1100,7 +1100,7 @@ class EditorRubberbandSelectDrag : public RubberbandSelectDrag
public:
EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
- void select_things (int, framepos_t, framepos_t, double, double, bool);
+ void select_things (int, samplepos_t, samplepos_t, double, double, bool);
void deselect_things ();
};
@@ -1110,7 +1110,7 @@ class MidiRubberbandSelectDrag : public RubberbandSelectDrag
public:
MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
- void select_things (int, framepos_t, framepos_t, double, double, bool);
+ void select_things (int, samplepos_t, samplepos_t, double, double, bool);
void deselect_things ();
private:
@@ -1123,7 +1123,7 @@ class MidiVerticalSelectDrag : public RubberbandSelectDrag
public:
MidiVerticalSelectDrag (Editor *, MidiRegionView *);
- void select_things (int, framepos_t, framepos_t, double, double, bool);
+ void select_things (int, samplepos_t, samplepos_t, double, double, bool);
void deselect_things ();
private:
@@ -1173,15 +1173,15 @@ public:
void finished (GdkEvent *, bool);
void aborted (bool);
- void setup_pointer_frame_offset ();
+ void setup_pointer_sample_offset ();
private:
Operation _operation;
bool _add;
TrackSelection _track_selection_at_start;
bool _time_selection_at_start;
- framepos_t start_at_start;
- framepos_t end_at_start;
+ samplepos_t start_at_start;
+ samplepos_t end_at_start;
};
/** Range marker drag */
@@ -1230,7 +1230,7 @@ public:
void finished (GdkEvent *, bool);
void aborted (bool);
- std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
+ std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (4, 4);
}
@@ -1267,7 +1267,7 @@ private:
struct Line {
boost::shared_ptr<AutomationLine> line; ///< the line
std::list<ControlPoint*> points; ///< points to drag on the line
- std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
+ std::pair<ARDOUR::samplepos_t, ARDOUR::samplepos_t> range; ///< the range of all points on the line, in session samples
XMLNode* state; ///< the XML state node before the drag
double original_fraction; ///< initial y-fraction before the drag
};
@@ -1294,7 +1294,7 @@ public:
return false;
}
- virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
+ virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (4, 4);
}
diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc
index 1a4f88e2f2..8159b784bc 100644
--- a/gtk2_ardour/editor_export_audio.cc
+++ b/gtk2_ardour/editor_export_audio.cc
@@ -213,11 +213,11 @@ bool
Editor::write_region (string path, boost::shared_ptr<AudioRegion> region)
{
boost::shared_ptr<AudioFileSource> fs;
- const framepos_t chunk_size = 4096;
- framepos_t to_read;
+ const samplepos_t chunk_size = 4096;
+ samplepos_t to_read;
Sample buf[chunk_size];
gain_t gain_buffer[chunk_size];
- framepos_t pos;
+ samplepos_t pos;
char s[PATH_MAX+1];
uint32_t cnt;
vector<boost::shared_ptr<AudioFileSource> > sources;
@@ -266,7 +266,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region)
fs = boost::dynamic_pointer_cast<AudioFileSource> (
SourceFactory::createWritable (DataType::AUDIO, *_session,
path, true,
- false, _session->frame_rate()));
+ false, _session->sample_rate()));
}
catch (failed_constructor& err) {
@@ -285,7 +285,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region)
pos = region->position();
while (to_read) {
- framepos_t this_time;
+ samplepos_t this_time;
this_time = min (to_read, chunk_size);
@@ -363,11 +363,11 @@ bool
Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list<AudioRange>& range)
{
boost::shared_ptr<AudioFileSource> fs;
- const framepos_t chunk_size = 4096;
- framepos_t nframes;
+ const samplepos_t chunk_size = 4096;
+ samplepos_t nframes;
Sample buf[chunk_size];
gain_t gain_buffer[chunk_size];
- framepos_t pos;
+ samplepos_t pos;
char s[PATH_MAX+1];
uint32_t cnt;
string path;
@@ -405,7 +405,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list
fs = boost::dynamic_pointer_cast<AudioFileSource> (
SourceFactory::createWritable (DataType::AUDIO, *_session,
path, true,
- false, _session->frame_rate()));
+ false, _session->sample_rate()));
}
catch (failed_constructor& err) {
@@ -423,7 +423,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list
pos = (*i).start;
while (nframes) {
- framepos_t this_time;
+ samplepos_t this_time;
this_time = min (nframes, chunk_size);
@@ -455,7 +455,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list
while (nframes) {
- framepos_t this_time = min (nframes, chunk_size);
+ samplepos_t this_time = min (nframes, chunk_size);
memset (buf, 0, sizeof (Sample) * this_time);
for (uint32_t n=0; n < channels; ++n) {
diff --git a/gtk2_ardour/editor_keys.cc b/gtk2_ardour/editor_keys.cc
index 2c64d6f4f3..2be9f8d6de 100644
--- a/gtk2_ardour/editor_keys.cc
+++ b/gtk2_ardour/editor_keys.cc
@@ -43,10 +43,10 @@ Editor::keyboard_selection_finish (bool /*add*/, Editing::EditIgnoreOption ign)
{
if (_session) {
- MusicFrame start (selection->time.start(), 0);
- framepos_t end;
+ MusicSample start (selection->time.start(), 0);
+ samplepos_t end;
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
- end = _session->audible_frame();
+ end = _session->audible_sample();
} else {
end = get_preferred_edit_position(ign);
}
@@ -58,7 +58,7 @@ Editor::keyboard_selection_finish (bool /*add*/, Editing::EditIgnoreOption ign)
if ( (_edit_point == EditAtPlayhead) && selection->tracks.empty() )
select_all_tracks();
- selection->set (start.frame, end);
+ selection->set (start.sample, end);
//if session is playing a range, cancel that
if (_session->get_play_range())
@@ -72,25 +72,25 @@ Editor::keyboard_selection_begin (Editing::EditIgnoreOption ign)
{
if (_session) {
- MusicFrame start (0, 0);
- MusicFrame end (selection->time.end_frame(), 0);
+ MusicSample start (0, 0);
+ MusicSample end (selection->time.end_sample(), 0);
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
- start.frame = _session->audible_frame();
+ start.sample = _session->audible_sample();
} else {
- start.frame = get_preferred_edit_position(ign);
+ start.sample = get_preferred_edit_position(ign);
}
//snap the selection start/end
snap_to(start);
//if there's not already a sensible selection endpoint, go "forever"
- if (start.frame > end.frame) {
+ if (start.sample > end.sample) {
#ifdef MIXBUS
// 4hours at most.
// This works around a visual glitch in red-bordered selection rect.
- end.frame = start.frame + _session->nominal_frame_rate() * 60 * 60 * 4;
+ end.sample = start.sample + _session->nominal_sample_rate() * 60 * 60 * 4;
#else
- end.frame = max_framepos;
+ end.sample = max_samplepos;
#endif
}
@@ -98,7 +98,7 @@ Editor::keyboard_selection_begin (Editing::EditIgnoreOption ign)
if ( selection->tracks.empty() )
select_all_tracks();
- selection->set (start.frame, end.frame);
+ selection->set (start.sample, end.sample);
//if session is playing a range, cancel that
if (_session->get_play_range())
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index 996b5878bd..782c1e5f9a 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -597,8 +597,8 @@ Editor::LocationMarkers::set_name (const string& str)
}
void
-Editor::LocationMarkers::set_position (framepos_t startf,
- framepos_t endf)
+Editor::LocationMarkers::set_position (samplepos_t startf,
+ samplepos_t endf)
{
start->set_position (startf);
if (end) {
@@ -643,7 +643,7 @@ Editor::LocationMarkers::setup_lines ()
}
void
-Editor::mouse_add_new_marker (framepos_t where, bool is_cd)
+Editor::mouse_add_new_marker (samplepos_t where, bool is_cd)
{
string markername;
int flags = (is_cd ? Location::IsCDMarker|Location::IsMark : Location::IsMark);
@@ -674,7 +674,7 @@ Editor::mouse_add_new_marker (framepos_t where, bool is_cd)
}
void
-Editor::mouse_add_new_loop (framepos_t where)
+Editor::mouse_add_new_loop (samplepos_t where)
{
if (!_session) {
return;
@@ -684,13 +684,13 @@ Editor::mouse_add_new_loop (framepos_t where)
it's reasonably easy to manipulate after creation.
*/
- framepos_t const end = where + current_page_samples() / 8;
+ samplepos_t const end = where + current_page_samples() / 8;
set_loop_range (where, end, _("set loop range"));
}
void
-Editor::mouse_add_new_punch (framepos_t where)
+Editor::mouse_add_new_punch (samplepos_t where)
{
if (!_session) {
return;
@@ -700,13 +700,13 @@ Editor::mouse_add_new_punch (framepos_t where)
it's reasonably easy to manipulate after creation.
*/
- framepos_t const end = where + current_page_samples() / 8;
+ samplepos_t const end = where + current_page_samples() / 8;
set_punch_range (where, end, _("set punch range"));
}
void
-Editor::mouse_add_new_range (framepos_t where)
+Editor::mouse_add_new_range (samplepos_t where)
{
if (!_session) {
return;
@@ -716,7 +716,7 @@ Editor::mouse_add_new_range (framepos_t where)
it's reasonably easy to manipulate after creation.
*/
- framepos_t const end = where + current_page_samples() / 8;
+ samplepos_t const end = where + current_page_samples() / 8;
string name;
_session->locations()->next_available_name (name, _("range"));
@@ -1220,11 +1220,11 @@ Editor::marker_menu_range_to_next ()
return;
}
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
_session->locations()->marks_either_side (marker->position(), start, end);
- if (end != max_framepos) {
+ if (end != max_samplepos) {
string range_name = l->name();
range_name += "-range";
@@ -1250,13 +1250,13 @@ Editor::marker_menu_set_from_playhead ()
if ((l = find_location_from_marker (marker, is_start)) != 0) {
if (l->is_mark()) {
- l->set_start (_session->audible_frame (), false, true, divisions);
+ l->set_start (_session->audible_sample (), false, true, divisions);
}
else {
if (is_start) {
- l->set_start (_session->audible_frame (), false, true, divisions);
+ l->set_start (_session->audible_sample (), false, true, divisions);
} else {
- l->set_end (_session->audible_frame (), false, true, divisions);
+ l->set_end (_session->audible_sample (), false, true, divisions);
}
}
}
@@ -1284,9 +1284,9 @@ Editor::marker_menu_set_from_selection (bool /*force_regions*/)
} else {
if (!selection->time.empty()) {
- l->set (selection->time.start(), selection->time.end_frame());
+ l->set (selection->time.start(), selection->time.end_sample());
} else if (!selection->regions.empty()) {
- l->set (selection->regions.start(), selection->regions.end_frame());
+ l->set (selection->regions.start(), selection->regions.end_sample());
}
}
}
@@ -1353,18 +1353,18 @@ Editor::marker_menu_zoom_to_range ()
return;
}
- framecnt_t const extra = l->length() * 0.05;
- framepos_t a = l->start ();
+ samplecnt_t const extra = l->length() * 0.05;
+ samplepos_t a = l->start ();
if (a >= extra) {
a -= extra;
}
- framepos_t b = l->end ();
- if (b < (max_framepos - extra)) {
+ samplepos_t b = l->end ();
+ if (b < (max_samplepos - extra)) {
b += extra;
}
- temporal_zoom_by_frame (a, b);
+ temporal_zoom_by_sample (a, b);
}
void
@@ -1426,7 +1426,7 @@ Editor::toggle_marker_lock_style ()
const Timecode::BBT_Time bbt (msp->bbt());
const PositionLockStyle pls = (msp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
- _session->tempo_map().replace_meter (*msp, meter, bbt, msp->frame(), pls);
+ _session->tempo_map().replace_meter (*msp, meter, bbt, msp->sample(), pls);
XMLNode &after = _session->tempo_map().get_state();
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
@@ -1435,14 +1435,14 @@ Editor::toggle_marker_lock_style ()
TempoSection* tsp = &tm->tempo();
const double pulse = tsp->pulse();
- const framepos_t frame = tsp->frame();
+ const samplepos_t sample = tsp->sample();
const PositionLockStyle pls = (tsp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type(), tsp->end_note_types_per_minute());
begin_reversible_command (_("change tempo lock style"));
XMLNode &before = _session->tempo_map().get_state();
- _session->tempo_map().replace_tempo (*tsp, tempo, pulse, frame, pls);
+ _session->tempo_map().replace_tempo (*tsp, tempo, pulse, sample, pls);
XMLNode &after = _session->tempo_map().get_state();
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
@@ -1462,13 +1462,13 @@ Editor::toggle_tempo_type ()
const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type());
const double pulse = tsp->pulse();
- const framepos_t frame = tsp->frame();
+ const samplepos_t sample = tsp->sample();
const PositionLockStyle pls = tsp->position_lock_style();
begin_reversible_command (_("set tempo to constant"));
XMLNode &before = _session->tempo_map().get_state();
- _session->tempo_map().replace_tempo (*tsp, tempo, pulse, frame, pls);
+ _session->tempo_map().replace_tempo (*tsp, tempo, pulse, sample, pls);
XMLNode &after = _session->tempo_map().get_state();
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
@@ -1518,13 +1518,13 @@ Editor::ramp_to_next_tempo ()
if (next_ts) {
const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type(), next_ts->note_types_per_minute());
const double pulse = tsp->pulse();
- const framepos_t frame = tsp->frame();
+ const samplepos_t sample = tsp->sample();
const PositionLockStyle pls = tsp->position_lock_style();
begin_reversible_command (_("ramp to next tempo"));
XMLNode &before = _session->tempo_map().get_state();
- tmap.replace_tempo (*tsp, tempo, pulse, frame, pls);
+ tmap.replace_tempo (*tsp, tempo, pulse, sample, pls);
XMLNode &after = _session->tempo_map().get_state();
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
@@ -1696,7 +1696,7 @@ Editor::update_punch_range_view ()
if (_session->config.get_punch_out()) {
pixel_end = sample_to_pixel (tpl->end());
} else {
- pixel_end = sample_to_pixel (max_framepos);
+ pixel_end = sample_to_pixel (max_samplepos);
}
transport_punch_range_rect->set_x0 (pixel_start);
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 21ace734c2..2509889853 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -83,7 +83,7 @@ using namespace Editing;
using Gtkmm2ext::Keyboard;
bool
-Editor::mouse_frame (framepos_t& where, bool& in_track_canvas) const
+Editor::mouse_sample (samplepos_t& where, bool& in_track_canvas) const
{
/* gdk_window_get_pointer() has X11's XQueryPointer semantics in that it only
pays attentions to subwindows. this means that menu windows are ignored, and
@@ -130,7 +130,7 @@ Editor::mouse_frame (framepos_t& where, bool& in_track_canvas) const
return true;
}
-framepos_t
+samplepos_t
Editor::window_event_sample (GdkEvent const * event, double* pcx, double* pcy) const
{
ArdourCanvas::Duple d;
@@ -155,7 +155,7 @@ Editor::window_event_sample (GdkEvent const * event, double* pcx, double* pcy) c
return pixel_to_sample (d.x);
}
-framepos_t
+samplepos_t
Editor::canvas_event_sample (GdkEvent const * event, double* pcx, double* pcy) const
{
double x;
@@ -178,7 +178,7 @@ Editor::canvas_event_sample (GdkEvent const * event, double* pcx, double* pcy) c
/* note that pixel_to_sample_from_event() never returns less than zero, so even if the pixel
position is negative (as can be the case with motion events in particular),
- the frame location is always positive.
+ the sample location is always positive.
*/
return pixel_to_sample_from_event (x);
@@ -535,7 +535,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
std::list<Selectable*> selectables;
uint32_t before, after;
- framecnt_t const where = (framecnt_t) floor (event->button.x * samples_per_pixel) - clicked_regionview->region ()->position ();
+ samplecnt_t const where = (samplecnt_t) floor (event->button.x * samples_per_pixel) - clicked_regionview->region ()->position ();
if (!argl || !argl->control_points_adjacent (where, before, after)) {
break;
@@ -581,7 +581,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
al->grab_item().canvas_to_item (mx, my);
uint32_t before, after;
- framecnt_t const where = (framecnt_t) floor (mx * samples_per_pixel);
+ samplecnt_t const where = (samplecnt_t) floor (mx * samples_per_pixel);
if (!al || !al->control_points_adjacent (where, before, after)) {
break;
@@ -1052,7 +1052,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
_drags->set (new RegionCreateDrag (this, item, parent), event);
} else {
/* See if there's a region before the click that we can extend, and extend it if so */
- framepos_t const t = canvas_event_sample (event);
+ samplepos_t const t = canvas_event_sample (event);
boost::shared_ptr<Region> prev = pl->find_next_region (t, End, -1);
if (!prev) {
_drags->set (new RegionCreateDrag (this, item, parent), event);
@@ -1283,9 +1283,9 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
UIConfiguration::instance().get_follow_edits() &&
!_session->config.get_external_sync()) {
- MusicFrame where (canvas_event_sample (event), 0);
+ MusicSample where (canvas_event_sample (event), 0);
snap_to (where);
- _session->request_locate (where.frame, false);
+ _session->request_locate (where.sample, false);
}
switch (event->button.button) {
@@ -1332,7 +1332,7 @@ Editor::button_release_dispatch (GdkEventButton* ev)
bool
Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
- MusicFrame where (canvas_event_sample (event), 0);
+ MusicSample where (canvas_event_sample (event), 0);
AutomationTimeAxisView* atv = 0;
_press_cursor_ctx.reset();
@@ -1480,7 +1480,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case SamplesRulerItem:
case MinsecRulerItem:
case BBTRulerItem:
- popup_ruler_menu (where.frame, item_type);
+ popup_ruler_menu (where.sample, item_type);
break;
case MarkerItem:
@@ -1572,7 +1572,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case MarkerBarItem:
if (!_dragging_playhead) {
snap_to_with_modifier (where, event, RoundNearest, true);
- mouse_add_new_marker (where.frame);
+ mouse_add_new_marker (where.sample);
}
return true;
@@ -1580,14 +1580,14 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
if (!_dragging_playhead) {
// if we get here then a dragged range wasn't done
snap_to_with_modifier (where, event, RoundNearest, true);
- mouse_add_new_marker (where.frame, true);
+ mouse_add_new_marker (where.sample, true);
}
return true;
case TempoBarItem:
case TempoCurveItem:
if (!_dragging_playhead && Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
snap_to_with_modifier (where, event);
- mouse_add_new_tempo_event (where.frame);
+ mouse_add_new_tempo_event (where.sample);
}
return true;
@@ -1631,7 +1631,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
if (atv) {
- atv->add_automation_event (event, where.frame, event->button.y, with_guard_points);
+ atv->add_automation_event (event, where.sample, event->button.y, with_guard_points);
}
return true;
break;
@@ -1967,13 +1967,13 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
}
void
-Editor::scrub (framepos_t frame, double current_x)
+Editor::scrub (samplepos_t sample, double current_x)
{
double delta;
if (scrubbing_direction == 0) {
/* first move */
- _session->request_locate (frame, false);
+ _session->request_locate (sample, false);
_session->request_transport_speed (0.1);
scrubbing_direction = 1;
@@ -2208,7 +2208,7 @@ Editor::region_view_item_click (AudioRegionView& rv, GdkEventButton* event)
TimeAxisView* tv = &rv.get_time_axis_view();
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(tv);
- framepos_t where = get_preferred_edit_position();
+ samplepos_t where = get_preferred_edit_position();
if (where >= 0) {
@@ -2263,7 +2263,7 @@ Editor::cancel_time_selection ()
}
void
-Editor::point_trim (GdkEvent* event, framepos_t new_bound)
+Editor::point_trim (GdkEvent* event, samplepos_t new_bound)
{
RegionView* rv = clicked_regionview;
@@ -2366,7 +2366,7 @@ Editor::mouse_rename_region (ArdourCanvas::Item* /*item*/, GdkEvent* /*event*/)
void
-Editor::mouse_brush_insert_region (RegionView* rv, framepos_t pos)
+Editor::mouse_brush_insert_region (RegionView* rv, samplepos_t pos)
{
/* no brushing without a useful snap setting */
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index b0eba11cd9..4bd853002c 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -173,7 +173,7 @@ Editor::redo (uint32_t n)
}
void
-Editor::split_regions_at (MusicFrame where, RegionSelection& regions, bool snap_frame)
+Editor::split_regions_at (MusicSample where, RegionSelection& regions, bool snap_sample)
{
bool frozen = false;
@@ -199,12 +199,12 @@ Editor::split_regions_at (MusicFrame where, RegionSelection& regions, bool snap_
case SnapToRegionEnd:
break;
default:
- if (snap_frame) {
+ if (snap_sample) {
snap_to (where);
}
}
} else {
- if (snap_frame) {
+ if (snap_sample) {
snap_to (where);
}
@@ -220,7 +220,7 @@ Editor::split_regions_at (MusicFrame where, RegionSelection& regions, bool snap_
have something to split.
*/
- if (!(*a)->region()->covers (where.frame)) {
+ if (!(*a)->region()->covers (where.sample)) {
++a;
continue;
}
@@ -298,7 +298,7 @@ Editor::split_regions_at (MusicFrame where, RegionSelection& regions, bool snap_
}
for (RegionSelection::iterator ri = latest_regionviews.begin(); ri != latest_regionviews.end(); ri++) {
- if ((*ri)->region()->position() < where.frame) {
+ if ((*ri)->region()->position() < where.sample) {
// new regions created before the split
if (rsas & NewlyCreatedLeft) {
selection->add (*ri);
@@ -330,15 +330,15 @@ Editor::split_regions_at (MusicFrame where, RegionSelection& regions, bool snap_
void
Editor::move_range_selection_start_or_end_to_region_boundary (bool move_end, bool next)
{
- if (selection->time.start() == selection->time.end_frame()) {
+ if (selection->time.start() == selection->time.end_sample()) {
return;
}
- framepos_t start = selection->time.start ();
- framepos_t end = selection->time.end_frame ();
+ samplepos_t start = selection->time.start ();
+ samplepos_t end = selection->time.end_sample ();
/* the position of the thing we may move */
- framepos_t pos = move_end ? end : start;
+ samplepos_t pos = move_end ? end : start;
int dir = next ? 1 : -1;
/* so we don't find the current region again */
@@ -346,7 +346,7 @@ Editor::move_range_selection_start_or_end_to_region_boundary (bool move_end, boo
pos += dir;
}
- framepos_t const target = get_region_boundary (pos, dir, true, false);
+ samplepos_t const target = get_region_boundary (pos, dir, true, false);
if (target < 0) {
return;
}
@@ -392,8 +392,8 @@ Editor::nudge_backward_release (GdkEventButton* ev)
void
Editor::nudge_forward (bool next, bool force_playhead)
{
- framepos_t distance;
- framepos_t next_distance;
+ samplepos_t distance;
+ samplepos_t next_distance;
if (!_session) {
return;
@@ -441,20 +441,20 @@ Editor::nudge_forward (bool next, bool force_playhead)
if (next) {
distance = next_distance;
}
- if (max_framepos - distance > loc->start() + loc->length()) {
+ if (max_samplepos - distance > loc->start() + loc->length()) {
loc->set_start (loc->start() + distance, false, true, divisions);
} else {
- loc->set_start (max_framepos - loc->length(), false, true, divisions);
+ loc->set_start (max_samplepos - loc->length(), false, true, divisions);
}
} else {
distance = get_nudge_distance (loc->end(), next_distance);
if (next) {
distance = next_distance;
}
- if (max_framepos - distance > loc->end()) {
+ if (max_samplepos - distance > loc->end()) {
loc->set_end (loc->end() + distance, false, true, divisions);
} else {
- loc->set_end (max_framepos, false, true, divisions);
+ loc->set_end (max_samplepos, false, true, divisions);
}
if (loc->is_session_range()) {
_session->set_end_is_free (false);
@@ -473,16 +473,16 @@ Editor::nudge_forward (bool next, bool force_playhead)
commit_reversible_command ();
}
} else {
- distance = get_nudge_distance (playhead_cursor->current_frame (), next_distance);
- _session->request_locate (playhead_cursor->current_frame () + distance);
+ distance = get_nudge_distance (playhead_cursor->current_sample (), next_distance);
+ _session->request_locate (playhead_cursor->current_sample () + distance);
}
}
void
Editor::nudge_backward (bool next, bool force_playhead)
{
- framepos_t distance;
- framepos_t next_distance;
+ samplepos_t distance;
+ samplepos_t next_distance;
if (!_session) {
return;
@@ -568,10 +568,10 @@ Editor::nudge_backward (bool next, bool force_playhead)
} else {
- distance = get_nudge_distance (playhead_cursor->current_frame (), next_distance);
+ distance = get_nudge_distance (playhead_cursor->current_sample (), next_distance);
- if (playhead_cursor->current_frame () > distance) {
- _session->request_locate (playhead_cursor->current_frame () - distance);
+ if (playhead_cursor->current_sample () > distance) {
+ _session->request_locate (playhead_cursor->current_sample () - distance);
} else {
_session->goto_start();
}
@@ -589,7 +589,7 @@ Editor::nudge_forward_capture_offset ()
begin_reversible_command (_("nudge forward"));
- framepos_t const distance = _session->worst_output_latency();
+ samplepos_t const distance = _session->worst_output_latency();
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
boost::shared_ptr<Region> r ((*i)->region());
@@ -613,7 +613,7 @@ Editor::nudge_backward_capture_offset ()
begin_reversible_command (_("nudge backward"));
- framepos_t const distance = _session->worst_output_latency();
+ samplepos_t const distance = _session->worst_output_latency();
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
boost::shared_ptr<Region> r ((*i)->region());
@@ -640,8 +640,8 @@ struct RegionSelectionPositionSorter {
void
Editor::sequence_regions ()
{
- framepos_t r_end;
- framepos_t r_end_prev;
+ samplepos_t r_end;
+ samplepos_t r_end_prev;
int iCount=0;
@@ -705,13 +705,13 @@ void
Editor::move_to_end ()
{
- _session->request_locate (_session->current_end_frame());
+ _session->request_locate (_session->current_end_sample());
}
void
Editor::build_region_boundary_cache ()
{
- framepos_t pos = 0;
+ samplepos_t pos = 0;
vector<RegionPoint> interesting_points;
boost::shared_ptr<Region> r;
TrackViewList tracks;
@@ -723,12 +723,12 @@ Editor::build_region_boundary_cache ()
return;
}
- bool maybe_first_frame = false;
+ bool maybe_first_sample = false;
switch (_snap_type) {
case SnapToRegionStart:
interesting_points.push_back (Start);
- maybe_first_frame = true;
+ maybe_first_sample = true;
break;
case SnapToRegionEnd:
interesting_points.push_back (End);
@@ -739,7 +739,7 @@ Editor::build_region_boundary_cache ()
case SnapToRegionBoundary:
interesting_points.push_back (Start);
interesting_points.push_back (End);
- maybe_first_frame = true;
+ maybe_first_sample = true;
break;
default:
fatal << string_compose (_("build_region_boundary_cache called with snap_type = %1"), _snap_type) << endmsg;
@@ -756,7 +756,7 @@ Editor::build_region_boundary_cache ()
tlist = track_views.filter_to_unique_playlists ();
}
- if (maybe_first_frame) {
+ if (maybe_first_sample) {
TrackViewList::const_iterator i;
for (i = tlist.begin(); i != tlist.end(); ++i) {
boost::shared_ptr<Playlist> pl = (*i)->playlist();
@@ -767,10 +767,10 @@ Editor::build_region_boundary_cache ()
}
}
- while (pos < _session->current_end_frame() && !at_end) {
+ while (pos < _session->current_end_sample() && !at_end) {
- framepos_t rpos;
- framepos_t lpos = max_framepos;
+ samplepos_t rpos;
+ samplepos_t lpos = max_samplepos;
for (vector<RegionPoint>::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) {
@@ -784,11 +784,11 @@ Editor::build_region_boundary_cache ()
switch (*p) {
case Start:
- rpos = r->first_frame();
+ rpos = r->first_sample();
break;
case End:
- rpos = r->last_frame();
+ rpos = r->last_sample();
break;
case SyncPoint:
@@ -807,7 +807,7 @@ Editor::build_region_boundary_cache ()
to sort later.
*/
- vector<framepos_t>::iterator ri;
+ vector<samplepos_t>::iterator ri;
for (ri = region_boundary_cache.begin(); ri != region_boundary_cache.end(); ++ri) {
if (*ri == rpos) {
@@ -829,34 +829,34 @@ Editor::build_region_boundary_cache ()
}
boost::shared_ptr<Region>
-Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack)
+Editor::find_next_region (samplepos_t sample, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack)
{
TrackViewList::iterator i;
- framepos_t closest = max_framepos;
+ samplepos_t closest = max_samplepos;
boost::shared_ptr<Region> ret;
- framepos_t rpos = 0;
+ samplepos_t rpos = 0;
- framepos_t track_frame;
+ samplepos_t track_sample;
RouteTimeAxisView *rtav;
for (i = tracks.begin(); i != tracks.end(); ++i) {
- framecnt_t distance;
+ samplecnt_t distance;
boost::shared_ptr<Region> r;
- track_frame = frame;
+ track_sample = sample;
- if ((r = (*i)->find_next_region (track_frame, point, dir)) == 0) {
+ if ((r = (*i)->find_next_region (track_sample, point, dir)) == 0) {
continue;
}
switch (point) {
case Start:
- rpos = r->first_frame ();
+ rpos = r->first_sample ();
break;
case End:
- rpos = r->last_frame ();
+ rpos = r->last_sample ();
break;
case SyncPoint:
@@ -864,10 +864,10 @@ Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, Trac
break;
}
- if (rpos > frame) {
- distance = rpos - frame;
+ if (rpos > sample) {
+ distance = rpos - sample;
} else {
- distance = frame - rpos;
+ distance = sample - rpos;
}
if (distance < closest) {
@@ -881,15 +881,15 @@ Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, Trac
return ret;
}
-framepos_t
-Editor::find_next_region_boundary (framepos_t pos, int32_t dir, const TrackViewList& tracks)
+samplepos_t
+Editor::find_next_region_boundary (samplepos_t pos, int32_t dir, const TrackViewList& tracks)
{
- framecnt_t distance = max_framepos;
- framepos_t current_nearest = -1;
+ samplecnt_t distance = max_samplepos;
+ samplepos_t current_nearest = -1;
for (TrackViewList::const_iterator i = tracks.begin(); i != tracks.end(); ++i) {
- framepos_t contender;
- framecnt_t d;
+ samplepos_t contender;
+ samplecnt_t d;
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i);
@@ -912,10 +912,10 @@ Editor::find_next_region_boundary (framepos_t pos, int32_t dir, const TrackViewL
return current_nearest;
}
-framepos_t
-Editor::get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen)
+samplepos_t
+Editor::get_region_boundary (samplepos_t pos, int32_t dir, bool with_selection, bool only_onscreen)
{
- framepos_t target;
+ samplepos_t target;
TrackViewList tvl;
if (with_selection && Config->get_region_boundaries_from_selected_tracks()) {
@@ -950,8 +950,8 @@ Editor::get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, b
void
Editor::cursor_to_region_boundary (bool with_selection, int32_t dir)
{
- framepos_t pos = playhead_cursor->current_frame ();
- framepos_t target;
+ samplepos_t pos = playhead_cursor->current_sample ();
+ samplepos_t target;
if (!_session) {
return;
@@ -985,7 +985,7 @@ void
Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t dir)
{
boost::shared_ptr<Region> r;
- framepos_t pos = cursor->current_frame ();
+ samplepos_t pos = cursor->current_sample ();
if (!_session) {
return;
@@ -1019,11 +1019,11 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t
switch (point) {
case Start:
- pos = r->first_frame ();
+ pos = r->first_sample ();
break;
case End:
- pos = r->last_frame ();
+ pos = r->last_sample ();
break;
case SyncPoint:
@@ -1053,7 +1053,7 @@ Editor::cursor_to_previous_region_point (EditorCursor* cursor, RegionPoint point
void
Editor::cursor_to_selection_start (EditorCursor *cursor)
{
- framepos_t pos = 0;
+ samplepos_t pos = 0;
switch (mouse_mode) {
case MouseObject:
@@ -1082,18 +1082,18 @@ Editor::cursor_to_selection_start (EditorCursor *cursor)
void
Editor::cursor_to_selection_end (EditorCursor *cursor)
{
- framepos_t pos = 0;
+ samplepos_t pos = 0;
switch (mouse_mode) {
case MouseObject:
if (!selection->regions.empty()) {
- pos = selection->regions.end_frame();
+ pos = selection->regions.end_sample();
}
break;
case MouseRange:
if (!selection->time.empty()) {
- pos = selection->time.end_frame ();
+ pos = selection->time.end_sample ();
}
break;
@@ -1111,7 +1111,7 @@ Editor::cursor_to_selection_end (EditorCursor *cursor)
void
Editor::selected_marker_to_region_boundary (bool with_selection, int32_t dir)
{
- framepos_t target;
+ samplepos_t target;
Location* loc;
bool ignored;
@@ -1120,10 +1120,10 @@ Editor::selected_marker_to_region_boundary (bool with_selection, int32_t dir)
}
if (selection->markers.empty()) {
- framepos_t mouse;
+ samplepos_t mouse;
bool ignored;
- if (!mouse_frame (mouse, ignored)) {
+ if (!mouse_sample (mouse, ignored)) {
return;
}
@@ -1134,7 +1134,7 @@ Editor::selected_marker_to_region_boundary (bool with_selection, int32_t dir)
return;
}
- framepos_t pos = loc->start();
+ samplepos_t pos = loc->start();
// so we don't find the current region again..
if (dir > 0 || pos > 0) {
@@ -1164,7 +1164,7 @@ void
Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir)
{
boost::shared_ptr<Region> r;
- framepos_t pos;
+ samplepos_t pos;
Location* loc;
bool ignored;
@@ -1199,15 +1199,15 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir)
switch (point) {
case Start:
- pos = r->first_frame ();
+ pos = r->first_sample ();
break;
case End:
- pos = r->last_frame ();
+ pos = r->last_sample ();
break;
case SyncPoint:
- pos = r->adjust_to_sync (r->first_frame());
+ pos = r->adjust_to_sync (r->first_sample());
break;
}
@@ -1229,7 +1229,7 @@ Editor::selected_marker_to_previous_region_point (RegionPoint point)
void
Editor::selected_marker_to_selection_start ()
{
- framepos_t pos = 0;
+ samplepos_t pos = 0;
Location* loc;
bool ignored;
@@ -1264,7 +1264,7 @@ Editor::selected_marker_to_selection_start ()
void
Editor::selected_marker_to_selection_end ()
{
- framepos_t pos = 0;
+ samplepos_t pos = 0;
Location* loc;
bool ignored;
@@ -1279,13 +1279,13 @@ Editor::selected_marker_to_selection_end ()
switch (mouse_mode) {
case MouseObject:
if (!selection->regions.empty()) {
- pos = selection->regions.end_frame();
+ pos = selection->regions.end_sample();
}
break;
case MouseRange:
if (!selection->time.empty()) {
- pos = selection->time.end_frame ();
+ pos = selection->time.end_sample ();
}
break;
@@ -1299,18 +1299,18 @@ Editor::selected_marker_to_selection_end ()
void
Editor::scroll_playhead (bool forward)
{
- framepos_t pos = playhead_cursor->current_frame ();
- framecnt_t delta = (framecnt_t) floor (current_page_samples() / 0.8);
+ samplepos_t pos = playhead_cursor->current_sample ();
+ samplecnt_t delta = (samplecnt_t) floor (current_page_samples() / 0.8);
if (forward) {
- if (pos == max_framepos) {
+ if (pos == max_samplepos) {
return;
}
- if (pos < max_framepos - delta) {
+ if (pos < max_samplepos - delta) {
pos += delta ;
} else {
- pos = max_framepos;
+ pos = max_samplepos;
}
} else {
@@ -1354,10 +1354,10 @@ Editor::cursor_align (bool playhead_to_edit)
Location* loc = find_location_from_marker (*i, ignored);
if (loc->is_mark()) {
- loc->set_start (playhead_cursor->current_frame (), false, true, divisions);
+ loc->set_start (playhead_cursor->current_sample (), false, true, divisions);
} else {
- loc->set (playhead_cursor->current_frame (),
- playhead_cursor->current_frame () + loc->length(), true, divisions);
+ loc->set (playhead_cursor->current_sample (),
+ playhead_cursor->current_sample () + loc->length(), true, divisions);
}
}
}
@@ -1366,33 +1366,33 @@ Editor::cursor_align (bool playhead_to_edit)
void
Editor::scroll_backward (float pages)
{
- framepos_t const one_page = (framepos_t) rint (_visible_canvas_width * samples_per_pixel);
- framepos_t const cnt = (framepos_t) floor (pages * one_page);
+ samplepos_t const one_page = (samplepos_t) rint (_visible_canvas_width * samples_per_pixel);
+ samplepos_t const cnt = (samplepos_t) floor (pages * one_page);
- framepos_t frame;
- if (leftmost_frame < cnt) {
- frame = 0;
+ samplepos_t sample;
+ if (_leftmost_sample < cnt) {
+ sample = 0;
} else {
- frame = leftmost_frame - cnt;
+ sample = _leftmost_sample - cnt;
}
- reset_x_origin (frame);
+ reset_x_origin (sample);
}
void
Editor::scroll_forward (float pages)
{
- framepos_t const one_page = (framepos_t) rint (_visible_canvas_width * samples_per_pixel);
- framepos_t const cnt = (framepos_t) floor (pages * one_page);
+ samplepos_t const one_page = (samplepos_t) rint (_visible_canvas_width * samples_per_pixel);
+ samplepos_t const cnt = (samplepos_t) floor (pages * one_page);
- framepos_t frame;
- if (max_framepos - cnt < leftmost_frame) {
- frame = max_framepos - cnt;
+ samplepos_t sample;
+ if (max_samplepos - cnt < _leftmost_sample) {
+ sample = max_samplepos - cnt;
} else {
- frame = leftmost_frame + cnt;
+ sample = _leftmost_sample + cnt;
}
- reset_x_origin (frame);
+ reset_x_origin (sample);
}
void
@@ -1611,10 +1611,10 @@ Editor::scroll_up_one_track (bool skip_child_views)
void
Editor::scroll_left_step ()
{
- framepos_t xdelta = (current_page_samples() / 8);
+ samplepos_t xdelta = (current_page_samples() / 8);
- if (leftmost_frame > xdelta) {
- reset_x_origin (leftmost_frame - xdelta);
+ if (_leftmost_sample > xdelta) {
+ reset_x_origin (_leftmost_sample - xdelta);
} else {
reset_x_origin (0);
}
@@ -1624,21 +1624,21 @@ Editor::scroll_left_step ()
void
Editor::scroll_right_step ()
{
- framepos_t xdelta = (current_page_samples() / 8);
+ samplepos_t xdelta = (current_page_samples() / 8);
- if (max_framepos - xdelta > leftmost_frame) {
- reset_x_origin (leftmost_frame + xdelta);
+ if (max_samplepos - xdelta > _leftmost_sample) {
+ reset_x_origin (_leftmost_sample + xdelta);
} else {
- reset_x_origin (max_framepos - current_page_samples());
+ reset_x_origin (max_samplepos - current_page_samples());
}
}
void
Editor::scroll_left_half_page ()
{
- framepos_t xdelta = (current_page_samples() / 2);
- if (leftmost_frame > xdelta) {
- reset_x_origin (leftmost_frame - xdelta);
+ samplepos_t xdelta = (current_page_samples() / 2);
+ if (_leftmost_sample > xdelta) {
+ reset_x_origin (_leftmost_sample - xdelta);
} else {
reset_x_origin (0);
}
@@ -1647,11 +1647,11 @@ Editor::scroll_left_half_page ()
void
Editor::scroll_right_half_page ()
{
- framepos_t xdelta = (current_page_samples() / 2);
- if (max_framepos - xdelta > leftmost_frame) {
- reset_x_origin (leftmost_frame + xdelta);
+ samplepos_t xdelta = (current_page_samples() / 2);
+ if (max_samplepos - xdelta > _leftmost_sample) {
+ reset_x_origin (_leftmost_sample + xdelta);
} else {
- reset_x_origin (max_framepos - current_page_samples());
+ reset_x_origin (max_samplepos - current_page_samples());
}
}
@@ -1732,7 +1732,7 @@ Editor::temporal_zoom_step_scale (bool zoom_out, double scale)
{
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_step, zoom_out, scale)
- framecnt_t nspp = samples_per_pixel;
+ samplecnt_t nspp = samples_per_pixel;
if (zoom_out) {
nspp *= scale;
@@ -1748,8 +1748,8 @@ Editor::temporal_zoom_step_scale (bool zoom_out, double scale)
//zoom-behavior-tweaks
//limit our maximum zoom to the session gui extents value
- std::pair<framepos_t, framepos_t> ext = session_gui_extents();
- framecnt_t session_extents_pp = ( ext.second - ext.first ) / _visible_canvas_width;
+ std::pair<samplepos_t, samplepos_t> ext = session_gui_extents();
+ samplecnt_t session_extents_pp = ( ext.second - ext.first ) / _visible_canvas_width;
if (nspp > session_extents_pp)
nspp = session_extents_pp;
@@ -1757,23 +1757,23 @@ Editor::temporal_zoom_step_scale (bool zoom_out, double scale)
}
void
-Editor::temporal_zoom (framecnt_t fpp)
+Editor::temporal_zoom (samplecnt_t fpp)
{
if (!_session) {
return;
}
- framepos_t current_page = current_page_samples();
- framepos_t current_leftmost = leftmost_frame;
- framepos_t current_rightmost;
- framepos_t current_center;
- framepos_t new_page_size;
- framepos_t half_page_size;
- framepos_t leftmost_after_zoom = 0;
- framepos_t where;
+ samplepos_t current_page = current_page_samples();
+ samplepos_t current_leftmost = _leftmost_sample;
+ samplepos_t current_rightmost;
+ samplepos_t current_center;
+ samplepos_t new_page_size;
+ samplepos_t half_page_size;
+ samplepos_t leftmost_after_zoom = 0;
+ samplepos_t where;
bool in_track_canvas;
- bool use_mouse_frame = true;
- framecnt_t nfpp;
+ bool use_mouse_sample = true;
+ samplecnt_t nfpp;
double l;
if (fpp == samples_per_pixel) {
@@ -1788,10 +1788,10 @@ Editor::temporal_zoom (framecnt_t fpp)
// all of which is used for the editor track displays. The whole day
// would be 4147200000 samples, so 2592000 samples per pixel.
- nfpp = min (fpp, (framecnt_t) 2592000);
- nfpp = max ((framecnt_t) 1, nfpp);
+ nfpp = min (fpp, (samplecnt_t) 2592000);
+ nfpp = max ((samplecnt_t) 1, nfpp);
- new_page_size = (framepos_t) floor (_visible_canvas_width * nfpp);
+ new_page_size = (samplepos_t) floor (_visible_canvas_width * nfpp);
half_page_size = new_page_size / 2;
switch (zoom_focus) {
@@ -1800,7 +1800,7 @@ Editor::temporal_zoom (framecnt_t fpp)
break;
case ZoomFocusRight:
- current_rightmost = leftmost_frame + current_page;
+ current_rightmost = _leftmost_sample + current_page;
if (current_rightmost < new_page_size) {
leftmost_after_zoom = 0;
} else {
@@ -1819,14 +1819,14 @@ Editor::temporal_zoom (framecnt_t fpp)
case ZoomFocusPlayhead:
/* centre playhead */
- l = playhead_cursor->current_frame () - (new_page_size * 0.5);
+ l = playhead_cursor->current_sample () - (new_page_size * 0.5);
if (l < 0) {
leftmost_after_zoom = 0;
- } else if (l > max_framepos) {
- leftmost_after_zoom = max_framepos - new_page_size;
+ } else if (l > max_samplepos) {
+ leftmost_after_zoom = max_samplepos - new_page_size;
} else {
- leftmost_after_zoom = (framepos_t) l;
+ leftmost_after_zoom = (samplepos_t) l;
}
break;
@@ -1834,24 +1834,24 @@ Editor::temporal_zoom (framecnt_t fpp)
/* try to keep the mouse over the same point in the display */
if (_drags->active()) {
- where = _drags->current_pointer_frame ();
- } else if (!mouse_frame (where, in_track_canvas)) {
- use_mouse_frame = false;
+ where = _drags->current_pointer_sample ();
+ } else if (!mouse_sample (where, in_track_canvas)) {
+ use_mouse_sample = false;
}
- if (use_mouse_frame) {
+ if (use_mouse_sample) {
l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where);
if (l < 0) {
leftmost_after_zoom = 0;
- } else if (l > max_framepos) {
- leftmost_after_zoom = max_framepos - new_page_size;
+ } else if (l > max_samplepos) {
+ leftmost_after_zoom = max_samplepos - new_page_size;
} else {
- leftmost_after_zoom = (framepos_t) l;
+ leftmost_after_zoom = (samplepos_t) l;
}
} else {
/* use playhead instead */
- where = playhead_cursor->current_frame ();
+ where = playhead_cursor->current_sample ();
if (where < half_page_size) {
leftmost_after_zoom = 0;
@@ -1871,10 +1871,10 @@ Editor::temporal_zoom (framecnt_t fpp)
if (l < 0) {
leftmost_after_zoom = 0;
- } else if (l > max_framepos) {
- leftmost_after_zoom = max_framepos - new_page_size;
+ } else if (l > max_samplepos) {
+ leftmost_after_zoom = max_samplepos - new_page_size;
} else {
- leftmost_after_zoom = (framepos_t) l;
+ leftmost_after_zoom = (samplepos_t) l;
}
} else {
@@ -1885,13 +1885,13 @@ Editor::temporal_zoom (framecnt_t fpp)
}
- // leftmost_after_zoom = min (leftmost_after_zoom, _session->current_end_frame());
+ // leftmost_after_zoom = min (leftmost_after_zoom, _session->current_end_sample());
reposition_and_zoom (leftmost_after_zoom, nfpp);
}
void
-Editor::calc_extra_zoom_edges(framepos_t &start, framepos_t &end)
+Editor::calc_extra_zoom_edges(samplepos_t &start, samplepos_t &end)
{
/* this func helps make sure we leave a little space
at each end of the editor so that the zoom doesn't fit the region
@@ -1904,9 +1904,9 @@ Editor::calc_extra_zoom_edges(framepos_t &start, framepos_t &end)
const double pix_per_mm = (double) pixwidth/ (double) mmwidth;
const double one_centimeter_in_pixels = pix_per_mm * 10.0;
- const framepos_t range = end - start;
- const framecnt_t new_fpp = (framecnt_t) ceil ((double) range / (double) _visible_canvas_width);
- const framepos_t extra_samples = (framepos_t) floor (one_centimeter_in_pixels * new_fpp);
+ const samplepos_t range = end - start;
+ const samplecnt_t new_fpp = (samplecnt_t) ceil ((double) range / (double) _visible_canvas_width);
+ const samplepos_t extra_samples = (samplepos_t) floor (one_centimeter_in_pixels * new_fpp);
if (start > extra_samples) {
start -= extra_samples;
@@ -1914,17 +1914,17 @@ Editor::calc_extra_zoom_edges(framepos_t &start, framepos_t &end)
start = 0;
}
- if (max_framepos - extra_samples > end) {
+ if (max_samplepos - extra_samples > end) {
end += extra_samples;
} else {
- end = max_framepos;
+ end = max_samplepos;
}
}
bool
-Editor::get_selection_extents (framepos_t &start, framepos_t &end) const
+Editor::get_selection_extents (samplepos_t &start, samplepos_t &end) const
{
- start = max_framepos;
+ start = max_samplepos;
end = 0;
bool ret = true;
@@ -1941,14 +1941,14 @@ Editor::get_selection_extents (framepos_t &start, framepos_t &end) const
start = (*i)->region()->position();
}
- if ((*i)->region()->last_frame() + 1 > end) {
- end = (*i)->region()->last_frame() + 1;
+ if ((*i)->region()->last_sample() + 1 > end) {
+ end = (*i)->region()->last_sample() + 1;
}
}
} else if (!selection->time.empty()) {
start = selection->time.start();
- end = selection->time.end_frame();
+ end = selection->time.end_sample();
} else
ret = false; //no selection found
@@ -1972,10 +1972,10 @@ Editor::temporal_zoom_selection (Editing::ZoomAxis axes)
if (axes == Horizontal || axes == Both) {
- framepos_t start, end;
+ samplepos_t start, end;
if (get_selection_extents (start, end)) {
calc_extra_zoom_edges (start, end);
- temporal_zoom_by_frame (start, end);
+ temporal_zoom_by_sample (start, end);
}
}
@@ -1990,18 +1990,18 @@ Editor::temporal_zoom_session ()
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_session)
if (_session) {
- framecnt_t start = _session->current_start_frame();
- framecnt_t end = _session->current_end_frame();
+ samplecnt_t start = _session->current_start_sample();
+ samplecnt_t end = _session->current_end_sample();
if (_session->actively_recording () ) {
- framepos_t cur = playhead_cursor->current_frame ();
+ samplepos_t cur = playhead_cursor->current_sample ();
if (cur > end) {
/* recording beyond the end marker; zoom out
* by 5 seconds more so that if 'follow
* playhead' is active we don't immediately
* scroll.
*/
- end = cur + _session->frame_rate() * 5;
+ end = cur + _session->sample_rate() * 5;
}
}
@@ -2011,7 +2011,7 @@ Editor::temporal_zoom_session ()
calc_extra_zoom_edges(start, end);
- temporal_zoom_by_frame (start, end);
+ temporal_zoom_by_sample (start, end);
}
}
@@ -2021,20 +2021,20 @@ Editor::temporal_zoom_extents ()
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_extents)
if (_session) {
- std::pair<framepos_t, framepos_t> ext = session_gui_extents( false ); //in this case we want to zoom to the extents explicitly; ignore the users prefs for extra padding
+ std::pair<samplepos_t, samplepos_t> ext = session_gui_extents( false ); //in this case we want to zoom to the extents explicitly; ignore the users prefs for extra padding
- framecnt_t start = ext.first;
- framecnt_t end = ext.second;
+ samplecnt_t start = ext.first;
+ samplecnt_t end = ext.second;
if (_session->actively_recording () ) {
- framepos_t cur = playhead_cursor->current_frame ();
+ samplepos_t cur = playhead_cursor->current_sample ();
if (cur > end) {
/* recording beyond the end marker; zoom out
* by 5 seconds more so that if 'follow
* playhead' is active we don't immediately
* scroll.
*/
- end = cur + _session->frame_rate() * 5;
+ end = cur + _session->sample_rate() * 5;
}
}
@@ -2044,12 +2044,12 @@ Editor::temporal_zoom_extents ()
calc_extra_zoom_edges(start, end);
- temporal_zoom_by_frame (start, end);
+ temporal_zoom_by_sample (start, end);
}
}
void
-Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end)
+Editor::temporal_zoom_by_sample (samplepos_t start, samplepos_t end)
{
if (!_session) return;
@@ -2057,13 +2057,13 @@ Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end)
return;
}
- framepos_t range = end - start;
+ samplepos_t range = end - start;
- const framecnt_t new_fpp = (framecnt_t) ceil ((double) range / (double) _visible_canvas_width);
+ const samplecnt_t new_fpp = (samplecnt_t) ceil ((double) range / (double) _visible_canvas_width);
- framepos_t new_page = range;
- framepos_t middle = (framepos_t) floor ((double) start + ((double) range / 2.0f));
- framepos_t new_leftmost = (framepos_t) floor ((double) middle - ((double) new_page / 2.0f));
+ samplepos_t new_page = range;
+ samplepos_t middle = (samplepos_t) floor ((double) start + ((double) range / 2.0f));
+ samplepos_t new_leftmost = (samplepos_t) floor ((double) middle - ((double) new_page / 2.0f));
if (new_leftmost > middle) {
new_leftmost = 0;
@@ -2077,14 +2077,14 @@ Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end)
}
void
-Editor::temporal_zoom_to_frame (bool coarser, framepos_t frame)
+Editor::temporal_zoom_to_sample (bool coarser, samplepos_t sample)
{
if (!_session) {
return;
}
- framecnt_t range_before = frame - leftmost_frame;
- framecnt_t new_spp;
+ samplecnt_t range_before = sample - _leftmost_sample;
+ samplecnt_t new_spp;
if (coarser) {
if (samples_per_pixel <= 1) {
@@ -2110,13 +2110,13 @@ Editor::temporal_zoom_to_frame (bool coarser, framepos_t frame)
return;
}
- /* zoom focus is automatically taken as @param frame when this
+ /* zoom focus is automatically taken as @param sample when this
method is used.
*/
- framepos_t new_leftmost = frame - (framepos_t)range_before;
+ samplepos_t new_leftmost = sample - (samplepos_t)range_before;
- if (new_leftmost > frame) {
+ if (new_leftmost > sample) {
new_leftmost = 0;
}
@@ -2177,8 +2177,8 @@ Editor::add_location_from_selection ()
return;
}
- framepos_t start = selection->time[clicked_selection].start;
- framepos_t end = selection->time[clicked_selection].end;
+ samplepos_t start = selection->time[clicked_selection].start;
+ samplepos_t end = selection->time[clicked_selection].end;
_session->locations()->next_available_name(rangename,"selection");
Location *location = new Location (*_session, start, end, rangename, Location::IsRangeMarker, get_grid_music_divisions(0));
@@ -2194,7 +2194,7 @@ Editor::add_location_from_selection ()
}
void
-Editor::add_location_mark (framepos_t where)
+Editor::add_location_mark (samplepos_t where)
{
string markername;
@@ -2223,11 +2223,11 @@ Editor::set_session_start_from_playhead ()
Location* loc;
if ((loc = _session->locations()->session_range_location()) == 0) { //should never happen
- _session->set_session_extents ( _session->audible_frame(), _session->audible_frame() );
+ _session->set_session_extents ( _session->audible_sample(), _session->audible_sample() );
} else {
XMLNode &before = loc->get_state();
- _session->set_session_extents ( _session->audible_frame(), loc->end() );
+ _session->set_session_extents ( _session->audible_sample(), loc->end() );
XMLNode &after = loc->get_state();
@@ -2247,11 +2247,11 @@ Editor::set_session_end_from_playhead ()
Location* loc;
if ((loc = _session->locations()->session_range_location()) == 0) { //should never happen
- _session->set_session_extents ( _session->audible_frame(), _session->audible_frame() );
+ _session->set_session_extents ( _session->audible_sample(), _session->audible_sample() );
} else {
XMLNode &before = loc->get_state();
- _session->set_session_extents ( loc->start(), _session->audible_frame() );
+ _session->set_session_extents ( loc->start(), _session->audible_sample() );
XMLNode &after = loc->get_state();
@@ -2278,7 +2278,7 @@ Editor::toggle_location_at_playhead_cursor ()
void
Editor::add_location_from_playhead_cursor ()
{
- add_location_mark (_session->audible_frame());
+ add_location_mark (_session->audible_sample());
}
bool
@@ -2291,7 +2291,7 @@ Editor::do_remove_location_at_playhead_cursor ()
//find location(s) at this time
Locations::LocationList locs;
- _session->locations()->find_all_between (_session->audible_frame(), _session->audible_frame()+1, locs, Location::Flags(0));
+ _session->locations()->find_all_between (_session->audible_sample(), _session->audible_sample()+1, locs, Location::Flags(0));
for (Locations::LocationList::iterator i = locs.begin(); i != locs.end(); ++i) {
if ((*i)->is_mark()) {
_session->locations()->remove (*i);
@@ -2333,7 +2333,7 @@ Editor::add_locations_from_region ()
boost::shared_ptr<Region> region = (*i)->region ();
- Location *location = new Location (*_session, region->position(), region->last_frame(), region->name(), Location::IsRangeMarker, 0);
+ Location *location = new Location (*_session, region->position(), region->last_sample(), region->name(), Location::IsRangeMarker, 0);
_session->locations()->add (location, true);
commit = true;
@@ -2374,7 +2374,7 @@ Editor::add_location_from_region ()
}
// single range spanning all selected
- Location *location = new Location (*_session, selection->regions.start(), selection->regions.end_frame(), markername, Location::IsRangeMarker, 0);
+ Location *location = new Location (*_session, selection->regions.start(), selection->regions.end_sample(), markername, Location::IsRangeMarker, 0);
_session->locations()->add (location, true);
begin_reversible_command (_("add marker"));
@@ -2392,7 +2392,7 @@ Editor::jump_forward_to_mark ()
return;
}
- framepos_t pos = _session->locations()->first_mark_after (playhead_cursor->current_frame());
+ samplepos_t pos = _session->locations()->first_mark_after (playhead_cursor->current_sample());
if (pos < 0) {
return;
@@ -2408,12 +2408,12 @@ Editor::jump_backward_to_mark ()
return;
}
- framepos_t pos = _session->locations()->first_mark_before (playhead_cursor->current_frame());
+ samplepos_t pos = _session->locations()->first_mark_before (playhead_cursor->current_sample());
//handle the case where we are rolling, and we're less than one-half second past the mark, we want to go to the prior mark...
if ( _session->transport_rolling() ) {
- if ( (playhead_cursor->current_frame() - pos) < _session->frame_rate()/2 ) {
- framepos_t prior = _session->locations()->first_mark_before ( pos );
+ if ( (playhead_cursor->current_sample() - pos) < _session->sample_rate()/2 ) {
+ samplepos_t prior = _session->locations()->first_mark_before ( pos );
pos = prior;
}
}
@@ -2428,7 +2428,7 @@ Editor::jump_backward_to_mark ()
void
Editor::set_mark ()
{
- framepos_t const pos = _session->audible_frame ();
+ samplepos_t const pos = _session->audible_sample ();
string markername;
_session->locations()->next_available_name (markername, "mark");
@@ -2593,7 +2593,7 @@ Editor::transition_to_rolling (bool fwd)
void
Editor::play_from_start ()
{
- _session->request_locate (_session->current_start_frame(), true);
+ _session->request_locate (_session->current_start_sample(), true);
}
void
@@ -2605,31 +2605,31 @@ Editor::play_from_edit_point ()
void
Editor::play_from_edit_point_and_return ()
{
- framepos_t start_frame;
- framepos_t return_frame;
+ samplepos_t start_sample;
+ samplepos_t return_sample;
- start_frame = get_preferred_edit_position ( EDIT_IGNORE_PHEAD );
+ start_sample = get_preferred_edit_position ( EDIT_IGNORE_PHEAD );
if (_session->transport_rolling()) {
- _session->request_locate (start_frame, false);
+ _session->request_locate (start_sample, false);
return;
}
- /* don't reset the return frame if its already set */
+ /* don't reset the return sample if its already set */
- if ((return_frame = _session->requested_return_frame()) < 0) {
- return_frame = _session->audible_frame();
+ if ((return_sample = _session->requested_return_sample()) < 0) {
+ return_sample = _session->audible_sample();
}
- if (start_frame >= 0) {
- _session->request_roll_at_and_return (start_frame, return_frame);
+ if (start_sample >= 0) {
+ _session->request_roll_at_and_return (start_sample, return_sample);
}
}
void
Editor::play_selection ()
{
- framepos_t start, end;
+ samplepos_t start, end;
if (!get_selection_extents ( start, end))
return;
@@ -2642,7 +2642,7 @@ Editor::play_selection ()
void
-Editor::maybe_locate_with_edit_preroll (framepos_t location)
+Editor::maybe_locate_with_edit_preroll (samplepos_t location)
{
if ( _session->transport_rolling() || !UIConfiguration::instance().get_follow_edits() || _session->config.get_external_sync() )
return;
@@ -2656,8 +2656,8 @@ Editor::maybe_locate_with_edit_preroll (framepos_t location)
//if follow_playhead is on, keep the playhead on the screen
if ( _follow_playhead )
- if ( location < leftmost_frame )
- location = leftmost_frame;
+ if ( location < _leftmost_sample )
+ location = _leftmost_sample;
_session->request_locate( location );
}
@@ -2665,11 +2665,11 @@ Editor::maybe_locate_with_edit_preroll (framepos_t location)
void
Editor::play_with_preroll ()
{
- framepos_t start, end;
+ samplepos_t start, end;
if ( UIConfiguration::instance().get_follow_edits() && get_selection_extents ( start, end) ) {
- const framepos_t preroll = _session->preroll_samples (start);
+ const samplepos_t preroll = _session->preroll_samples (start);
- framepos_t ret = start;
+ samplepos_t ret = start;
if (start > preroll) {
start = start - preroll;
@@ -2682,26 +2682,26 @@ Editor::play_with_preroll ()
lar.push_back (ar);
_session->request_play_range (&lar, true);
- _session->set_requested_return_frame (ret); //force auto-return to return to range start, without the preroll
+ _session->set_requested_return_sample (ret); //force auto-return to return to range start, without the preroll
} else {
- framepos_t ph = playhead_cursor->current_frame ();
- const framepos_t preroll = _session->preroll_samples (ph);
- framepos_t start;
+ samplepos_t ph = playhead_cursor->current_sample ();
+ const samplepos_t preroll = _session->preroll_samples (ph);
+ samplepos_t start;
if (ph > preroll) {
start = ph - preroll;
} else {
start = 0;
}
_session->request_locate (start, true);
- _session->set_requested_return_frame (ph); //force auto-return to return to playhead location, without the preroll
+ _session->set_requested_return_sample (ph); //force auto-return to return to playhead location, without the preroll
}
}
void
Editor::rec_with_preroll ()
{
- framepos_t ph = playhead_cursor->current_frame ();
- framepos_t preroll = _session->preroll_samples (ph);
+ samplepos_t ph = playhead_cursor->current_sample ();
+ samplepos_t preroll = _session->preroll_samples (ph);
_session->request_preroll_record_trim (ph, preroll);
}
@@ -2905,7 +2905,7 @@ Editor::rename_region ()
void
Editor::play_edit_range ()
{
- framepos_t start, end;
+ samplepos_t start, end;
if (get_edit_op_range (start, end)) {
_session->request_bounded_roll (start, end);
@@ -2915,8 +2915,8 @@ Editor::play_edit_range ()
void
Editor::play_selected_region ()
{
- framepos_t start = max_framepos;
- framepos_t end = 0;
+ samplepos_t start = max_samplepos;
+ samplepos_t end = 0;
RegionSelection rs = get_regions_from_selection_and_entered ();
@@ -2928,8 +2928,8 @@ Editor::play_selected_region ()
if ((*i)->region()->position() < start) {
start = (*i)->region()->position();
}
- if ((*i)->region()->last_frame() + 1 > end) {
- end = (*i)->region()->last_frame() + 1;
+ if ((*i)->region()->last_sample() + 1 > end) {
+ end = (*i)->region()->last_sample() + 1;
}
}
@@ -2953,17 +2953,17 @@ Editor::region_from_selection ()
return;
}
- framepos_t start = selection->time[clicked_selection].start;
- framepos_t end = selection->time[clicked_selection].end;
+ samplepos_t start = selection->time[clicked_selection].start;
+ samplepos_t end = selection->time[clicked_selection].end;
TrackViewList tracks = get_tracks_for_range_action ();
- framepos_t selection_cnt = end - start + 1;
+ samplepos_t selection_cnt = end - start + 1;
for (TrackSelection::iterator i = tracks.begin(); i != tracks.end(); ++i) {
boost::shared_ptr<Region> current;
boost::shared_ptr<Playlist> pl;
- framepos_t internal_start;
+ samplepos_t internal_start;
string new_name;
if ((pl = (*i)->playlist()) == 0) {
@@ -2995,13 +2995,13 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_re
return;
}
- framepos_t start, end;
+ samplepos_t start, end;
if (clicked_selection) {
start = selection->time[clicked_selection].start;
end = selection->time[clicked_selection].end;
} else {
start = selection->time.start();
- end = selection->time.end_frame();
+ end = selection->time.end_sample();
}
TrackViewList ts = selection->tracks.filter_to_unique_playlists ();
@@ -3010,7 +3010,7 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_re
for (TrackSelection::iterator i = ts.begin(); i != ts.end(); ++i) {
boost::shared_ptr<Region> current;
boost::shared_ptr<Playlist> playlist;
- framepos_t internal_start;
+ samplepos_t internal_start;
string new_name;
if ((playlist = (*i)->playlist()) == 0) {
@@ -3208,8 +3208,8 @@ Editor::separate_region_from_selection ()
} else {
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
if (get_edit_op_range (start, end)) {
@@ -3315,10 +3315,10 @@ Editor::separate_under_selected_regions ()
}
//Partition on the region bounds
- playlist->partition ((*rl)->first_frame() - 1, (*rl)->last_frame() + 1, true);
+ playlist->partition ((*rl)->first_sample() - 1, (*rl)->last_sample() + 1, true);
//Re-add region that was just removed due to the partition operation
- playlist->add_region( (*rl), (*rl)->first_frame() );
+ playlist->add_region( (*rl), (*rl)->first_sample() );
}
vector<PlaylistState>::iterator pl;
@@ -3343,8 +3343,8 @@ Editor::crop_region_to_selection ()
commit_reversible_command();
} else {
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
if (get_edit_op_range (start, end)) {
begin_reversible_command (_("Crop Regions to Edit Range"));
@@ -3358,7 +3358,7 @@ Editor::crop_region_to_selection ()
}
void
-Editor::crop_region_to (framepos_t start, framepos_t end)
+Editor::crop_region_to (samplepos_t start, samplepos_t end)
{
vector<boost::shared_ptr<Playlist> > playlists;
boost::shared_ptr<Playlist> playlist;
@@ -3394,10 +3394,10 @@ Editor::crop_region_to (framepos_t start, framepos_t end)
return;
}
- framepos_t pos;
- framepos_t new_start;
- framepos_t new_end;
- framecnt_t new_length;
+ samplepos_t pos;
+ samplepos_t new_start;
+ samplepos_t new_end;
+ samplecnt_t new_length;
for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
@@ -3419,10 +3419,10 @@ Editor::crop_region_to (framepos_t start, framepos_t end)
pos = (*i)->position();
new_start = max (start, pos);
- if (max_framepos - pos > (*i)->length()) {
+ if (max_samplepos - pos > (*i)->length()) {
new_end = pos + (*i)->length() - 1;
} else {
- new_end = max_framepos;
+ new_end = max_samplepos;
}
new_end = min (end, new_end);
new_length = new_end - new_start + 1;
@@ -3441,15 +3441,15 @@ Editor::region_fill_track ()
RegionSelection regions = get_regions_from_selection_and_entered ();
RegionSelection foo;
- framepos_t const end = _session->current_end_frame ();
+ samplepos_t const end = _session->current_end_sample ();
- if (regions.empty () || regions.end_frame () + 1 >= end) {
+ if (regions.empty () || regions.end_sample () + 1 >= end) {
return;
}
- framepos_t const start_frame = regions.start ();
- framepos_t const end_frame = regions.end_frame ();
- framecnt_t const gap = end_frame - start_frame + 1;
+ samplepos_t const start_sample = regions.start ();
+ samplepos_t const end_sample = regions.end_sample ();
+ samplecnt_t const gap = end_sample - start_sample + 1;
begin_reversible_command (Operations::region_fill);
@@ -3464,7 +3464,7 @@ Editor::region_fill_track ()
latest_regionviews.clear ();
sigc::connection c = rtv->view()->RegionViewAdded.connect (sigc::mem_fun(*this, &Editor::collect_new_region_view));
- framepos_t const position = end_frame + (r->first_frame() - start_frame + 1);
+ samplepos_t const position = end_sample + (r->first_sample() - start_sample + 1);
playlist = (*i)->region()->playlist();
playlist->clear_changes ();
playlist->duplicate_until (r, position, gap, end);
@@ -3489,7 +3489,7 @@ Editor::set_region_sync_position ()
}
void
-Editor::set_sync_point (framepos_t where, const RegionSelection& rs)
+Editor::set_sync_point (samplepos_t where, const RegionSelection& rs)
{
bool in_command = false;
@@ -3573,7 +3573,7 @@ Editor::align_regions (RegionPoint what)
begin_reversible_command (_("align selection"));
- framepos_t const position = get_preferred_edit_position ();
+ samplepos_t const position = get_preferred_edit_position ();
for (RegionSelection::const_iterator i = rs.begin(); i != rs.end(); ++i) {
align_region_internal ((*i)->region(), what, position);
@@ -3597,10 +3597,10 @@ Editor::align_regions_relative (RegionPoint point)
return;
}
- framepos_t const position = get_preferred_edit_position ();
+ samplepos_t const position = get_preferred_edit_position ();
- framepos_t distance = 0;
- framepos_t pos = 0;
+ samplepos_t distance = 0;
+ samplepos_t pos = 0;
int dir = 1;
list<RegionView*> sorted;
@@ -3620,11 +3620,11 @@ Editor::align_regions_relative (RegionPoint point)
break;
case End:
- if (position > r->last_frame()) {
- distance = position - r->last_frame();
+ if (position > r->last_sample()) {
+ distance = position - r->last_sample();
pos = r->position() + distance;
} else {
- distance = r->last_frame() - position;
+ distance = r->last_sample() - position;
pos = r->position() - distance;
dir = -1;
}
@@ -3677,7 +3677,7 @@ Editor::align_regions_relative (RegionPoint point)
}
void
-Editor::align_region (boost::shared_ptr<Region> region, RegionPoint point, framepos_t position)
+Editor::align_region (boost::shared_ptr<Region> region, RegionPoint point, samplepos_t position)
{
begin_reversible_command (_("align region"));
align_region_internal (region, point, position);
@@ -3685,7 +3685,7 @@ Editor::align_region (boost::shared_ptr<Region> region, RegionPoint point, frame
}
void
-Editor::align_region_internal (boost::shared_ptr<Region> region, RegionPoint point, framepos_t position)
+Editor::align_region_internal (boost::shared_ptr<Region> region, RegionPoint point, samplepos_t position)
{
region->clear_changes ();
@@ -3723,7 +3723,7 @@ Editor::trim_region_back ()
void
Editor::trim_region (bool front)
{
- framepos_t where = get_preferred_edit_position();
+ samplepos_t where = get_preferred_edit_position();
RegionSelection rs = get_regions_from_selection_and_edit_point ();
if (rs.empty()) {
@@ -3793,8 +3793,8 @@ Editor::trim_region_to_location (const Location& loc, const char* str)
return;
}
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
start = loc.start();
end = loc.end();
@@ -3855,24 +3855,24 @@ Editor::trim_to_region(bool forward)
if (forward) {
- next_region = playlist->find_next_region (region->first_frame(), Start, 1);
+ next_region = playlist->find_next_region (region->first_sample(), Start, 1);
if (!next_region) {
continue;
}
- region->trim_end (next_region->first_frame() - 1);
+ region->trim_end (next_region->first_sample() - 1);
arv->region_changed (PropertyChange (ARDOUR::Properties::length));
}
else {
- next_region = playlist->find_next_region (region->first_frame(), Start, 0);
+ next_region = playlist->find_next_region (region->first_sample(), Start, 0);
if (!next_region) {
continue;
}
- region->trim_front (next_region->last_frame() + 1);
+ region->trim_front (next_region->last_sample() + 1);
arv->region_changed (ARDOUR::bounds_change);
}
@@ -4008,9 +4008,9 @@ Editor::bounce_range_selection (bool replace, bool enable_processing)
}
}
- framepos_t start = selection->time[clicked_selection].start;
- framepos_t end = selection->time[clicked_selection].end;
- framepos_t cnt = end - start + 1;
+ samplepos_t start = selection->time[clicked_selection].start;
+ samplepos_t end = selection->time[clicked_selection].end;
+ samplepos_t cnt = end - start + 1;
bool in_command = false;
for (TrackViewList::iterator i = views.begin(); i != views.end(); ++i) {
@@ -4197,7 +4197,7 @@ Editor::cut_copy (CutCopyOp op)
}
}
} else if (selection->time.empty()) {
- framepos_t start, end;
+ samplepos_t start, end;
/* no time selection, see if we can get an edit range
and use that.
*/
@@ -4284,7 +4284,7 @@ Editor::cut_copy_points (Editing::CutCopyOp op, Evoral::Beats earliest, bool mid
}
/* Add all selected points to the relevant copy ControlLists */
- MusicFrame start (std::numeric_limits<framepos_t>::max(), 0);
+ MusicSample start (std::numeric_limits<samplepos_t>::max(), 0);
for (PointSelection::iterator sel_point = selection->points.begin(); sel_point != selection->points.end(); ++sel_point) {
boost::shared_ptr<AutomationList> al = (*sel_point)->line().the_list();
AutomationList::const_iterator ctrl_evt = (*sel_point)->model ();
@@ -4294,8 +4294,8 @@ Editor::cut_copy_points (Editing::CutCopyOp op, Evoral::Beats earliest, bool mid
/* Update earliest MIDI start time in beats */
earliest = std::min(earliest, Evoral::Beats((*ctrl_evt)->when));
} else {
- /* Update earliest session start time in frames */
- start.frame = std::min(start.frame, (*sel_point)->line().session_position(ctrl_evt));
+ /* Update earliest session start time in samples */
+ start.sample = std::min(start.sample, (*sel_point)->line().session_position(ctrl_evt));
}
}
@@ -4306,13 +4306,13 @@ Editor::cut_copy_points (Editing::CutCopyOp op, Evoral::Beats earliest, bool mid
}
earliest.round_down_to_beat();
} else {
- if (start.frame == std::numeric_limits<double>::max()) {
- start.frame = 0; // Weird... don't offset
+ if (start.sample == std::numeric_limits<double>::max()) {
+ start.sample = 0; // Weird... don't offset
}
snap_to(start, RoundDownMaybe);
}
- const double line_offset = midi ? earliest.to_double() : start.frame;
+ const double line_offset = midi ? earliest.to_double() : start.sample;
for (Lists::iterator i = lists.begin(); i != lists.end(); ++i) {
/* Correct this copy list so that it is relative to the earliest
start time, so relative ordering between points is preserved
@@ -4524,7 +4524,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
vector<PlaylistMapping> pmap;
- framepos_t first_position = max_framepos;
+ samplepos_t first_position = max_samplepos;
typedef set<boost::shared_ptr<Playlist> > FreezeList;
FreezeList freezelist;
@@ -4535,7 +4535,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) {
- first_position = min ((framepos_t) (*x)->region()->position(), first_position);
+ first_position = min ((samplepos_t) (*x)->region()->position(), first_position);
if (op == Cut || op == Clear || op == Delete) {
boost::shared_ptr<Playlist> pl = (*x)->region()->playlist();
@@ -4715,25 +4715,25 @@ void
Editor::paste (float times, bool from_context)
{
DEBUG_TRACE (DEBUG::CutNPaste, "paste to preferred edit pos\n");
- MusicFrame where (get_preferred_edit_position (EDIT_IGNORE_NONE, from_context), 0);
- paste_internal (where.frame, times, 0);
+ MusicSample where (get_preferred_edit_position (EDIT_IGNORE_NONE, from_context), 0);
+ paste_internal (where.sample, times, 0);
}
void
Editor::mouse_paste ()
{
- MusicFrame where (0, 0);
+ MusicSample where (0, 0);
bool ignored;
- if (!mouse_frame (where.frame, ignored)) {
+ if (!mouse_sample (where.sample, ignored)) {
return;
}
snap_to (where);
- paste_internal (where.frame, 1, where.division);
+ paste_internal (where.sample, 1, where.division);
}
void
-Editor::paste_internal (framepos_t position, float times, const int32_t sub_num)
+Editor::paste_internal (samplepos_t position, float times, const int32_t sub_num)
{
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("apparent paste position is %1\n", position));
@@ -4741,7 +4741,7 @@ Editor::paste_internal (framepos_t position, float times, const int32_t sub_num)
return;
}
- if (position == max_framepos) {
+ if (position == max_samplepos) {
position = get_preferred_edit_position();
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("preferred edit position is %1\n", position));
}
@@ -4859,9 +4859,9 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
RegionSelection sel = regions; // clear (below) may clear the argument list if its the current region selection
RegionSelection foo;
- framepos_t const start_frame = regions.start ();
- framepos_t const end_frame = regions.end_frame ();
- framecnt_t const gap = end_frame - start_frame + 1;
+ samplepos_t const start_sample = regions.start ();
+ samplepos_t const end_sample = regions.end_sample ();
+ samplecnt_t const gap = end_sample - start_sample + 1;
begin_reversible_command (Operations::duplicate_region);
@@ -4876,7 +4876,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
latest_regionviews.clear ();
sigc::connection c = rtv->view()->RegionViewAdded.connect (sigc::mem_fun(*this, &Editor::collect_new_region_view));
- framepos_t const position = end_frame + (r->first_frame() - start_frame + 1);
+ samplepos_t const position = end_sample + (r->first_sample() - start_sample + 1);
playlist = (*i)->region()->playlist();
playlist->clear_changes ();
playlist->duplicate (r, position, gap, times);
@@ -4930,13 +4930,13 @@ Editor::duplicate_selection (float times)
if (in_command) {
if (times == 1.0f) {
// now "move" range selection to after the current range selection
- framecnt_t distance = 0;
+ samplecnt_t distance = 0;
if (clicked_selection) {
distance =
selection->time[clicked_selection].end - selection->time[clicked_selection].start;
} else {
- distance = selection->time.end_frame () - selection->time.start ();
+ distance = selection->time.end_sample () - selection->time.start ();
}
selection->move_time (distance);
@@ -4959,7 +4959,7 @@ void
Editor::center_playhead ()
{
float const page = _visible_canvas_width * samples_per_pixel;
- center_screen_internal (playhead_cursor->current_frame (), page);
+ center_screen_internal (playhead_cursor->current_sample (), page);
}
void
@@ -4982,9 +4982,9 @@ void
Editor::nudge_track (bool use_edit, bool forwards)
{
boost::shared_ptr<Playlist> playlist;
- framepos_t distance;
- framepos_t next_distance;
- framepos_t start;
+ samplepos_t distance;
+ samplepos_t next_distance;
+ samplepos_t start;
if (use_edit) {
start = get_preferred_edit_position();
@@ -5535,7 +5535,7 @@ Editor::insert_patch_change (bool from_context)
return;
}
- const framepos_t p = get_preferred_edit_position (EDIT_IGNORE_NONE, from_context);
+ const samplepos_t p = get_preferred_edit_position (EDIT_IGNORE_NONE, from_context);
/* XXX: bit of a hack; use the MIDNAM from the first selected region;
there may be more than one, but the PatchChangeDialog can only offer
@@ -5553,7 +5553,7 @@ Editor::insert_patch_change (bool from_context)
for (RegionSelection::iterator i = rs.begin (); i != rs.end(); ++i) {
MidiRegionView* const mrv = dynamic_cast<MidiRegionView*> (*i);
if (mrv) {
- if (p >= mrv->region()->first_frame() && p <= mrv->region()->last_frame()) {
+ if (p >= mrv->region()->first_sample() && p <= mrv->region()->last_sample()) {
mrv->add_patch_change (p - mrv->region()->position(), d.patch ());
}
}
@@ -5948,11 +5948,11 @@ Editor::set_fade_length (bool in)
RegionView* rv = rs.front ();
- framepos_t pos = get_preferred_edit_position();
- framepos_t len;
+ samplepos_t pos = get_preferred_edit_position();
+ samplepos_t len;
char const * cmd;
- if (pos > rv->region()->last_frame() || pos < rv->region()->first_frame()) {
+ if (pos > rv->region()->last_sample() || pos < rv->region()->first_sample()) {
/* edit point is outside the relevant region */
return;
}
@@ -5965,11 +5965,11 @@ Editor::set_fade_length (bool in)
len = pos - rv->region()->position();
cmd = _("set fade in length");
} else {
- if (pos >= rv->region()->last_frame()) {
+ if (pos >= rv->region()->last_sample()) {
/* can't do it */
return;
}
- len = rv->region()->last_frame() - pos;
+ len = rv->region()->last_sample() - pos;
cmd = _("set fade out length");
}
@@ -6234,9 +6234,9 @@ void
Editor::set_edit_point ()
{
bool ignored;
- MusicFrame where (0, 0);
+ MusicSample where (0, 0);
- if (!mouse_frame (where.frame, ignored)) {
+ if (!mouse_sample (where.sample, ignored)) {
return;
}
@@ -6244,7 +6244,7 @@ Editor::set_edit_point ()
if (selection->markers.empty()) {
- mouse_add_new_marker (where.frame);
+ mouse_add_new_marker (where.sample);
} else {
bool ignored;
@@ -6252,7 +6252,7 @@ Editor::set_edit_point ()
Location* loc = find_location_from_marker (selection->markers.front(), ignored);
if (loc) {
- loc->move_to (where.frame, where.division);
+ loc->move_to (where.sample, where.division);
}
}
}
@@ -6263,17 +6263,17 @@ Editor::set_playhead_cursor ()
if (entered_marker) {
_session->request_locate (entered_marker->position(), _session->transport_rolling());
} else {
- MusicFrame where (0, 0);
+ MusicSample where (0, 0);
bool ignored;
- if (!mouse_frame (where.frame, ignored)) {
+ if (!mouse_sample (where.sample, ignored)) {
return;
}
snap_to (where);
if (_session) {
- _session->request_locate (where.frame, _session->transport_rolling());
+ _session->request_locate (where.sample, _session->transport_rolling());
}
}
@@ -6301,9 +6301,9 @@ Editor::split_region ()
if (current_mouse_mode() == MouseObject) { //don't try this for Internal Edit, Stretch, Draw, etc.
RegionSelection rs = get_regions_from_selection_and_edit_point ();
- const framepos_t pos = get_preferred_edit_position();
+ const samplepos_t pos = get_preferred_edit_position();
const int32_t division = get_grid_music_divisions (0);
- MusicFrame where (pos, division);
+ MusicSample where (pos, division);
if (rs.empty()) {
return;
@@ -6399,7 +6399,7 @@ Editor::set_loop_from_selection (bool play)
return;
}
- framepos_t start, end;
+ samplepos_t start, end;
if (!get_selection_extents ( start, end))
return;
@@ -6413,7 +6413,7 @@ Editor::set_loop_from_selection (bool play)
void
Editor::set_loop_from_region (bool play)
{
- framepos_t start, end;
+ samplepos_t start, end;
if (!get_selection_extents ( start, end))
return;
@@ -6432,7 +6432,7 @@ Editor::set_punch_from_selection ()
return;
}
- framepos_t start, end;
+ samplepos_t start, end;
if (!get_selection_extents ( start, end))
return;
@@ -6454,9 +6454,9 @@ Editor::set_auto_punch_range ()
}
Location* tpl = transport_punch_location();
- framepos_t now = playhead_cursor->current_frame();
- framepos_t begin = now;
- framepos_t end = _session->current_end_frame();
+ samplepos_t now = playhead_cursor->current_sample();
+ samplepos_t begin = now;
+ samplepos_t end = _session->current_end_sample();
if (!_session->config.get_punch_in()) {
// First Press - set punch in and create range from here to eternity
@@ -6470,7 +6470,7 @@ Editor::set_auto_punch_range ()
set_punch_range (begin, end, _("Auto Punch In/Out"));
} else {
// normal case for 2nd press - set the punch out
- end = playhead_cursor->current_frame ();
+ end = playhead_cursor->current_sample ();
set_punch_range (tpl->start(), now, _("Auto Punch In/Out"));
_session->config.set_punch_out(true);
}
@@ -6499,7 +6499,7 @@ Editor::set_session_extents_from_selection ()
return;
}
- framepos_t start, end;
+ samplepos_t start, end;
if (!get_selection_extents ( start, end))
return;
@@ -6528,8 +6528,8 @@ Editor::set_punch_start_from_edit_point ()
{
if (_session) {
- MusicFrame start (0, 0);
- framepos_t end = max_framepos;
+ MusicSample start (0, 0);
+ samplepos_t end = max_samplepos;
//use the existing punch end, if any
Location* tpl = transport_punch_location();
@@ -6538,20 +6538,20 @@ Editor::set_punch_start_from_edit_point ()
}
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
- start.frame = _session->audible_frame();
+ start.sample = _session->audible_sample();
} else {
- start.frame = get_preferred_edit_position();
+ start.sample = get_preferred_edit_position();
}
//snap the selection start/end
snap_to(start);
//if there's not already a sensible selection endpoint, go "forever"
- if (start.frame > end ) {
- end = max_framepos;
+ if (start.sample > end ) {
+ end = max_samplepos;
}
- set_punch_range (start.frame, end, _("set punch start from EP"));
+ set_punch_range (start.sample, end, _("set punch start from EP"));
}
}
@@ -6561,8 +6561,8 @@ Editor::set_punch_end_from_edit_point ()
{
if (_session) {
- framepos_t start = 0;
- MusicFrame end (max_framepos, 0);
+ samplepos_t start = 0;
+ MusicSample end (max_samplepos, 0);
//use the existing punch start, if any
Location* tpl = transport_punch_location();
@@ -6571,15 +6571,15 @@ Editor::set_punch_end_from_edit_point ()
}
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
- end.frame = _session->audible_frame();
+ end.sample = _session->audible_sample();
} else {
- end.frame = get_preferred_edit_position();
+ end.sample = get_preferred_edit_position();
}
//snap the selection start/end
snap_to (end);
- set_punch_range (start, end.frame, _("set punch end from EP"));
+ set_punch_range (start, end.sample, _("set punch end from EP"));
}
}
@@ -6589,8 +6589,8 @@ Editor::set_loop_start_from_edit_point ()
{
if (_session) {
- MusicFrame start (0, 0);
- framepos_t end = max_framepos;
+ MusicSample start (0, 0);
+ samplepos_t end = max_samplepos;
//use the existing loop end, if any
Location* tpl = transport_loop_location();
@@ -6599,20 +6599,20 @@ Editor::set_loop_start_from_edit_point ()
}
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
- start.frame = _session->audible_frame();
+ start.sample = _session->audible_sample();
} else {
- start.frame = get_preferred_edit_position();
+ start.sample = get_preferred_edit_position();
}
//snap the selection start/end
snap_to (start);
//if there's not already a sensible selection endpoint, go "forever"
- if (start.frame > end ) {
- end = max_framepos;
+ if (start.sample > end ) {
+ end = max_samplepos;
}
- set_loop_range (start.frame, end, _("set loop start from EP"));
+ set_loop_range (start.sample, end, _("set loop start from EP"));
}
}
@@ -6622,8 +6622,8 @@ Editor::set_loop_end_from_edit_point ()
{
if (_session) {
- framepos_t start = 0;
- MusicFrame end (max_framepos, 0);
+ samplepos_t start = 0;
+ MusicSample end (max_samplepos, 0);
//use the existing loop start, if any
Location* tpl = transport_loop_location();
@@ -6632,22 +6632,22 @@ Editor::set_loop_end_from_edit_point ()
}
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
- end.frame = _session->audible_frame();
+ end.sample = _session->audible_sample();
} else {
- end.frame = get_preferred_edit_position();
+ end.sample = get_preferred_edit_position();
}
//snap the selection start/end
snap_to(end);
- set_loop_range (start, end.frame, _("set loop end from EP"));
+ set_loop_range (start, end.sample, _("set loop end from EP"));
}
}
void
Editor::set_punch_from_region ()
{
- framepos_t start, end;
+ samplepos_t start, end;
if (!get_selection_extents ( start, end))
return;
@@ -6684,40 +6684,40 @@ Editor::set_tempo_from_region ()
RegionView* rv = rs.front();
- define_one_bar (rv->region()->position(), rv->region()->last_frame() + 1);
+ define_one_bar (rv->region()->position(), rv->region()->last_sample() + 1);
}
void
Editor::use_range_as_bar ()
{
- framepos_t start, end;
+ samplepos_t start, end;
if (get_edit_op_range (start, end)) {
define_one_bar (start, end);
}
}
void
-Editor::define_one_bar (framepos_t start, framepos_t end)
+Editor::define_one_bar (samplepos_t start, samplepos_t end)
{
- framepos_t length = end - start;
+ samplepos_t length = end - start;
- const Meter& m (_session->tempo_map().meter_at_frame (start));
+ const Meter& m (_session->tempo_map().meter_at_sample (start));
/* length = 1 bar */
/* We're going to deliver a constant tempo here,
- so we can use frames per beat to determine length.
- now we want frames per beat.
- we have frames per bar, and beats per bar, so ...
+ so we can use samples per beat to determine length.
+ now we want samples per beat.
+ we have samples per bar, and beats per bar, so ...
*/
/* XXXX METER MATH */
- double frames_per_beat = length / m.divisions_per_bar();
+ double samples_per_beat = length / m.divisions_per_bar();
/* beats per minute = */
- double beats_per_minute = (_session->frame_rate() * 60.0) / frames_per_beat;
+ double beats_per_minute = (_session->sample_rate() * 60.0) / samples_per_beat;
/* now decide whether to:
@@ -6726,7 +6726,7 @@ Editor::define_one_bar (framepos_t start, framepos_t end)
*/
- const TempoSection& t (_session->tempo_map().tempo_section_at_frame (start));
+ const TempoSection& t (_session->tempo_map().tempo_section_at_sample (start));
bool do_global = false;
@@ -6774,7 +6774,7 @@ Editor::define_one_bar (framepos_t start, framepos_t end)
if (do_global) {
_session->tempo_map().change_initial_tempo (beats_per_minute, t.note_type(), t.end_note_types_per_minute());
- } else if (t.frame() == start) {
+ } else if (t.sample() == start) {
_session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type(), t.end_note_types_per_minute());
} else {
/* constant tempo */
@@ -6890,10 +6890,10 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
pl->freeze ();
pl->remove_region (r);
- framepos_t pos = 0;
+ samplepos_t pos = 0;
- framepos_t rstart = r->first_frame ();
- framepos_t rend = r->last_frame ();
+ samplepos_t rstart = r->first_sample ();
+ samplepos_t rend = r->last_sample ();
while (x != positions.end()) {
@@ -6905,11 +6905,11 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
/* file start = original start + how far we from the initial position ? */
- framepos_t file_start = r->start() + pos;
+ samplepos_t file_start = r->start() + pos;
/* length = next position - current position */
- framepos_t len = (*x) - pos - rstart;
+ samplepos_t len = (*x) - pos - rstart;
/* XXX we do we really want to allow even single-sample regions?
* shouldn't we have some kind of lower limit on region size?
@@ -6959,7 +6959,7 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
PropertyList plist;
plist.add (ARDOUR::Properties::start, r->start() + pos);
- plist.add (ARDOUR::Properties::length, r->last_frame() - (r->position() + pos) + 1);
+ plist.add (ARDOUR::Properties::length, r->last_sample() - (r->position() + pos) + 1);
plist.add (ARDOUR::Properties::name, new_name);
plist.add (ARDOUR::Properties::layer, 0);
@@ -7006,7 +7006,7 @@ Editor::place_transient()
return;
}
- framepos_t where = get_preferred_edit_position();
+ samplepos_t where = get_preferred_edit_position();
begin_reversible_command (_("place transient"));
@@ -7057,9 +7057,9 @@ Editor::snap_regions_to_grid ()
}
(*r)->region()->clear_changes ();
- MusicFrame start ((*r)->region()->first_frame (), 0);
+ MusicSample start ((*r)->region()->first_sample (), 0);
snap_to (start);
- (*r)->region()->set_position (start.frame, start.division);
+ (*r)->region()->set_position (start.sample, start.division);
_session->add_command(new StatefulDiffCommand ((*r)->region()));
}
@@ -7119,11 +7119,11 @@ Editor::close_region_gaps ()
return;
}
- framepos_t crossfade_len = spin_crossfade.get_value();
- framepos_t pull_back_frames = spin_pullback.get_value();
+ samplepos_t crossfade_len = spin_crossfade.get_value();
+ samplepos_t pull_back_samples = spin_pullback.get_value();
- crossfade_len = lrintf (crossfade_len * _session->frame_rate()/1000);
- pull_back_frames = lrintf (pull_back_frames * _session->frame_rate()/1000);
+ crossfade_len = lrintf (crossfade_len * _session->sample_rate()/1000);
+ pull_back_samples = lrintf (pull_back_samples * _session->sample_rate()/1000);
/* Iterate over the region list and make adjacent regions overlap by crossfade_len_ms */
@@ -7146,7 +7146,7 @@ Editor::close_region_gaps ()
pl->freeze();
}
- framepos_t position = (*r)->region()->position();
+ samplepos_t position = (*r)->region()->position();
if (idx == 0 || position < last_region->position()){
last_region = (*r)->region();
@@ -7155,10 +7155,10 @@ Editor::close_region_gaps ()
}
(*r)->region()->clear_changes ();
- (*r)->region()->trim_front( (position - pull_back_frames));
+ (*r)->region()->trim_front( (position - pull_back_samples));
last_region->clear_changes ();
- last_region->trim_end( (position - pull_back_frames + crossfade_len));
+ last_region->trim_end( (position - pull_back_samples + crossfade_len));
_session->add_command (new StatefulDiffCommand ((*r)->region()));
_session->add_command (new StatefulDiffCommand (last_region));
@@ -7187,7 +7187,7 @@ Editor::tab_to_transient (bool forward)
return;
}
- framepos_t pos = _session->audible_frame ();
+ samplepos_t pos = _session->audible_sample ();
if (!selection->tracks.empty()) {
@@ -7205,7 +7205,7 @@ Editor::tab_to_transient (bool forward)
if (tr) {
boost::shared_ptr<Playlist> pl = tr->playlist ();
if (pl) {
- framepos_t result = pl->find_next_transient (pos, forward ? 1 : -1);
+ samplepos_t result = pl->find_next_transient (pos, forward ? 1 : -1);
if (result >= 0) {
positions.push_back (result);
@@ -7226,7 +7226,7 @@ Editor::tab_to_transient (bool forward)
}
}
- TransientDetector::cleanup_transients (positions, _session->frame_rate(), 3.0);
+ TransientDetector::cleanup_transients (positions, _session->sample_rate(), 3.0);
if (forward) {
AnalysisFeatureList::iterator x;
@@ -7263,12 +7263,12 @@ Editor::playhead_forward_to_grid ()
return;
}
- MusicFrame pos (playhead_cursor->current_frame (), 0);
+ MusicSample pos (playhead_cursor->current_sample (), 0);
- if (pos.frame < max_framepos - 1) {
- pos.frame += 2;
+ if (pos.sample < max_samplepos - 1) {
+ pos.sample += 2;
snap_to_internal (pos, RoundUpAlways, false, true);
- _session->request_locate (pos.frame);
+ _session->request_locate (pos.sample);
}
}
@@ -7280,12 +7280,12 @@ Editor::playhead_backward_to_grid ()
return;
}
- MusicFrame pos (playhead_cursor->current_frame (), 0);
+ MusicSample pos (playhead_cursor->current_sample (), 0);
- if (pos.frame > 2) {
- pos.frame -= 2;
+ if (pos.sample > 2) {
+ pos.sample -= 2;
snap_to_internal (pos, RoundDownAlways, false, true);
- _session->request_locate (pos.frame);
+ _session->request_locate (pos.sample);
}
}
@@ -7543,7 +7543,7 @@ Editor::do_insert_time ()
void
Editor::insert_time (
- framepos_t pos, framecnt_t frames, InsertTimeOption opt,
+ samplepos_t pos, samplecnt_t samples, InsertTimeOption opt,
bool all_playlists, bool ignore_music_glue, bool markers_too, bool glued_markers_too, bool locked_markers_too, bool tempo_too
)
{
@@ -7592,10 +7592,10 @@ Editor::insert_time (
if (opt == SplitIntersected) {
/* non musical split */
- (*i)->split (MusicFrame (pos, 0));
+ (*i)->split (MusicSample (pos, 0));
}
- (*i)->shift (pos, frames, (opt == MoveIntersected), ignore_music_glue);
+ (*i)->shift (pos, samples, (opt == MoveIntersected), ignore_music_glue);
vector<Command*> cmds;
(*i)->rdiff (cmds);
@@ -7611,7 +7611,7 @@ Editor::insert_time (
begin_reversible_command (_("insert time"));
in_command = true;
}
- rtav->route ()->shift (pos, frames);
+ rtav->route ()->shift (pos, samples);
}
}
@@ -7635,9 +7635,9 @@ Editor::insert_time (
if ((*i)->start() >= pos) {
// move end first, in case we're moving by more than the length of the range
if (!(*i)->is_mark()) {
- (*i)->set_end ((*i)->end() + frames, false, true, divisions);
+ (*i)->set_end ((*i)->end() + samples, false, true, divisions);
}
- (*i)->set_start ((*i)->start() + frames, false, true, divisions);
+ (*i)->set_start ((*i)->start() + samples, false, true, divisions);
moved = true;
}
@@ -7663,7 +7663,7 @@ Editor::insert_time (
in_command = true;
}
XMLNode& before (_session->tempo_map().get_state());
- _session->tempo_map().insert_time (pos, frames);
+ _session->tempo_map().insert_time (pos, samples);
XMLNode& after (_session->tempo_map().get_state());
_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
}
@@ -7688,7 +7688,7 @@ Editor::do_remove_time ()
return;
}
- framecnt_t distance = d.distance();
+ samplecnt_t distance = d.distance();
if (distance == 0) {
return;
@@ -7707,7 +7707,7 @@ Editor::do_remove_time ()
}
void
-Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
+Editor::remove_time (samplepos_t pos, samplecnt_t samples, InsertTimeOption opt,
bool ignore_music_glue, bool markers_too, bool glued_markers_too, bool locked_markers_too, bool tempo_too)
{
if (Config->get_edit_mode() == Lock) {
@@ -7730,10 +7730,10 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
}
std::list<AudioRange> rl;
- AudioRange ar(pos, pos+frames, 0);
+ AudioRange ar(pos, pos+samples, 0);
rl.push_back(ar);
pl->cut (rl);
- pl->shift (pos, -frames, true, ignore_music_glue);
+ pl->shift (pos, -samples, true, ignore_music_glue);
XMLNode &after = pl->get_state();
@@ -7747,7 +7747,7 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
begin_reversible_command (_("remove time"));
in_command = true;
}
- rtav->route ()->shift (pos, -frames);
+ rtav->route ()->shift (pos, -samples);
}
}
@@ -7770,39 +7770,39 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
if (!(*i)->is_mark()) { // it's a range; have to handle both start and end
if ((*i)->end() >= pos
- && (*i)->end() < pos+frames
+ && (*i)->end() < pos+samples
&& (*i)->start() >= pos
- && (*i)->end() < pos+frames) { // range is completely enclosed; kill it
+ && (*i)->end() < pos+samples) { // range is completely enclosed; kill it
moved = true;
loc_kill_list.push_back(*i);
} else { // only start or end is included, try to do the right thing
// move start before moving end, to avoid trying to move the end to before the start
// if we're removing more time than the length of the range
- if ((*i)->start() >= pos && (*i)->start() < pos+frames) {
+ if ((*i)->start() >= pos && (*i)->start() < pos+samples) {
// start is within cut
(*i)->set_start (pos, false, true,divisions); // bring the start marker to the beginning of the cut
moved = true;
- } else if ((*i)->start() >= pos+frames) {
+ } else if ((*i)->start() >= pos+samples) {
// start (and thus entire range) lies beyond end of cut
- (*i)->set_start ((*i)->start() - frames, false, true, divisions); // slip the start marker back
+ (*i)->set_start ((*i)->start() - samples, false, true, divisions); // slip the start marker back
moved = true;
}
- if ((*i)->end() >= pos && (*i)->end() < pos+frames) {
+ if ((*i)->end() >= pos && (*i)->end() < pos+samples) {
// end is inside cut
(*i)->set_end (pos, false, true, divisions); // bring the end to the cut
moved = true;
- } else if ((*i)->end() >= pos+frames) {
+ } else if ((*i)->end() >= pos+samples) {
// end is beyond end of cut
- (*i)->set_end ((*i)->end() - frames, false, true, divisions); // slip the end marker back
+ (*i)->set_end ((*i)->end() - samples, false, true, divisions); // slip the end marker back
moved = true;
}
}
- } else if ((*i)->start() >= pos && (*i)->start() < pos+frames ) {
+ } else if ((*i)->start() >= pos && (*i)->start() < pos+samples ) {
loc_kill_list.push_back(*i);
moved = true;
} else if ((*i)->start() >= pos) {
- (*i)->set_start ((*i)->start() -frames, false, true, divisions);
+ (*i)->set_start ((*i)->start() -samples, false, true, divisions);
moved = true;
}
@@ -7829,7 +7829,7 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
if (tempo_too) {
XMLNode& before (_session->tempo_map().get_state());
- if (_session->tempo_map().remove_time (pos, frames) ) {
+ if (_session->tempo_map().remove_time (pos, samples) ) {
if (!in_command) {
begin_reversible_command (_("remove time"));
in_command = true;
diff --git a/gtk2_ardour/editor_pt_import.cc b/gtk2_ardour/editor_pt_import.cc
index 55c3b0b43c..3f6a337569 100644
--- a/gtk2_ardour/editor_pt_import.cc
+++ b/gtk2_ardour/editor_pt_import.cc
@@ -122,12 +122,12 @@ Editor::do_ptimport (std::string ptpath,
bool ok = false;
bool onefailed = false;
PTFFormat ptf;
- framepos_t pos = -1;
+ samplepos_t pos = -1;
vector<ptflookup_t> ptfwavpair;
vector<ptflookup_t> ptfregpair;
- if (ptf.load(ptpath, _session->frame_rate()) == -1) {
+ if (ptf.load(ptpath, _session->sample_rate()) == -1) {
MessageDialog msg (_("Doesn't seem to be a valid PT session file"));
msg.run ();
return;
@@ -229,9 +229,9 @@ Editor::do_ptimport (std::string ptpath,
/* Empty wave - assume MIDI region */
boost::shared_ptr<MidiTrack> midi_track = mt.back();
boost::shared_ptr<Playlist> playlist = midi_track->playlist();
- framepos_t f = (framepos_t)a->startpos;
- framecnt_t length = (framecnt_t)a->length;
- MusicFrame pos (f, 0);
+ samplepos_t f = (samplepos_t)a->startpos;
+ samplecnt_t length = (samplecnt_t)a->length;
+ MusicSample pos (f, 0);
boost::shared_ptr<Source> src = _session->create_midi_source_by_stealing_name (midi_track);
PropertyList plist;
plist.add (ARDOUR::Properties::start, 0);
@@ -239,8 +239,8 @@ Editor::do_ptimport (std::string ptpath,
plist.add (ARDOUR::Properties::name, PBD::basename_nosuffix(src->name()));
boost::shared_ptr<Region> region = (RegionFactory::create (src, plist));
/* sets beat position */
- region->set_position (pos.frame, pos.division);
- midi_track->playlist()->add_region (region, pos.frame, 1.0, false, pos.division);
+ region->set_position (pos.sample, pos.division);
+ midi_track->playlist()->add_region (region, pos.sample, 1.0, false, pos.division);
boost::shared_ptr<MidiRegion> mr = boost::dynamic_pointer_cast<MidiRegion>(region);
boost::shared_ptr<MidiModel> mm = mr->midi_source(0)->model();
diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc
index 0372e1f3d8..c74dc6b6e3 100644
--- a/gtk2_ardour/editor_regions.cc
+++ b/gtk2_ardour/editor_regions.cc
@@ -727,7 +727,7 @@ EditorRegions::update_all_rows ()
}
void
-EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize, bool onoff)
+EditorRegions::format_position (samplepos_t pos, char* buf, size_t bufsize, bool onoff)
{
Timecode::BBT_Time bbt;
Timecode::Time timecode;
@@ -740,7 +740,7 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize, bool
switch (ARDOUR_UI::instance()->secondary_clock->mode ()) {
case AudioClock::BBT:
- bbt = _session->tempo_map().bbt_at_frame (pos);
+ bbt = _session->tempo_map().bbt_at_sample (pos);
if (onoff) {
snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
} else {
@@ -749,17 +749,17 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize, bool
break;
case AudioClock::MinSec:
- framepos_t left;
+ samplepos_t left;
int hrs;
int mins;
float secs;
left = pos;
- hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
- left -= (framecnt_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
- mins = (int) floor (left / (_session->frame_rate() * 60.0f));
- left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f);
- secs = left / (float) _session->frame_rate();
+ hrs = (int) floor (left / (_session->sample_rate() * 60.0f * 60.0f));
+ left -= (samplecnt_t) floor (hrs * _session->sample_rate() * 60.0f * 60.0f);
+ mins = (int) floor (left / (_session->sample_rate() * 60.0f));
+ left -= (samplecnt_t) floor (mins * _session->sample_rate() * 60.0f);
+ secs = left / (float) _session->sample_rate();
if (onoff) {
snprintf (buf, bufsize, "%02d:%02d:%06.3f", hrs, mins, secs);
} else {
@@ -767,7 +767,7 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize, bool
}
break;
- case AudioClock::Frames:
+ case AudioClock::Samples:
if (onoff) {
snprintf (buf, bufsize, "%" PRId64, pos);
} else {
@@ -840,27 +840,27 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
#if 0
if (audioRegion && fades_in_seconds) {
- framepos_t left;
+ samplepos_t left;
int mins;
int millisecs;
left = audioRegion->fade_in()->back()->when;
- mins = (int) floor (left / (_session->frame_rate() * 60.0f));
- left -= (framepos_t) floor (mins * _session->frame_rate() * 60.0f);
- millisecs = (int) floor ((left * 1000.0f) / _session->frame_rate());
+ mins = (int) floor (left / (_session->sample_rate() * 60.0f));
+ left -= (samplepos_t) floor (mins * _session->sample_rate() * 60.0f);
+ millisecs = (int) floor ((left * 1000.0f) / _session->sample_rate());
- if (audioRegion->fade_in()->back()->when >= _session->frame_rate()) {
+ if (audioRegion->fade_in()->back()->when >= _session->sample_rate()) {
sprintf (fadein_str, "%01dM %01dmS", mins, millisecs);
} else {
sprintf (fadein_str, "%01dmS", millisecs);
}
left = audioRegion->fade_out()->back()->when;
- mins = (int) floor (left / (_session->frame_rate() * 60.0f));
- left -= (framepos_t) floor (mins * _session->frame_rate() * 60.0f);
- millisecs = (int) floor ((left * 1000.0f) / _session->frame_rate());
+ mins = (int) floor (left / (_session->sample_rate() * 60.0f));
+ left -= (samplepos_t) floor (mins * _session->sample_rate() * 60.0f);
+ millisecs = (int) floor ((left * 1000.0f) / _session->sample_rate());
- if (audioRegion->fade_out()->back()->when >= _session->frame_rate()) {
+ if (audioRegion->fade_out()->back()->when >= _session->sample_rate()) {
sprintf (fadeout_str, "%01dM %01dmS", mins, millisecs);
} else {
sprintf (fadeout_str, "%01dmS", millisecs);
@@ -883,7 +883,7 @@ EditorRegions::populate_row_length (boost::shared_ptr<Region> region, TreeModel:
if (ARDOUR_UI::instance()->secondary_clock->mode () == AudioClock::BBT) {
TempoMap& map (_session->tempo_map());
- Timecode::BBT_Time bbt = map.bbt_at_beat (map.beat_at_frame (region->last_frame()) - map.beat_at_frame (region->first_frame()));
+ Timecode::BBT_Time bbt = map.bbt_at_beat (map.beat_at_sample (region->last_sample()) - map.beat_at_sample (region->first_sample()));
snprintf (buf, sizeof (buf), "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
} else {
format_position (region->length(), buf, sizeof (buf));
@@ -899,9 +899,9 @@ EditorRegions::populate_row_end (boost::shared_ptr<Region> region, TreeModel::Ro
row[_columns.end] = "";
} else if (used > 1) {
row[_columns.end] = _("Mult.");
- } else if (region->last_frame() >= region->first_frame()) {
+ } else if (region->last_sample() >= region->first_sample()) {
char buf[16];
- format_position (region->last_frame(), buf, sizeof (buf));
+ format_position (region->last_sample(), buf, sizeof (buf));
row[_columns.end] = buf;
} else {
row[_columns.end] = "empty";
@@ -932,7 +932,7 @@ EditorRegions::populate_row_sync (boost::shared_ptr<Region> region, TreeModel::R
} else {
if (region->sync_position() == region->position()) {
row[_columns.sync] = _("Start");
- } else if (region->sync_position() == (region->last_frame())) {
+ } else if (region->sync_position() == (region->last_sample())) {
row[_columns.sync] = _("End");
} else {
char buf[16];
@@ -1319,7 +1319,7 @@ EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context,
}
if (_editor->convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
- framepos_t pos = 0;
+ samplepos_t pos = 0;
bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY);
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
diff --git a/gtk2_ardour/editor_regions.h b/gtk2_ardour/editor_regions.h
index 3284259ed7..c36f338ae5 100644
--- a/gtk2_ardour/editor_regions.h
+++ b/gtk2_ardour/editor_regions.h
@@ -155,7 +155,7 @@ private:
int sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
- void format_position (ARDOUR::framepos_t pos, char* buf, size_t bufsize, bool onoff = true);
+ void format_position (ARDOUR::samplepos_t pos, char* buf, size_t bufsize, bool onoff = true);
void add_region (boost::shared_ptr<ARDOUR::Region>);
@@ -194,7 +194,7 @@ private:
Gtk::Menu* _menu;
Gtk::ScrolledWindow _scroller;
- Gtk::Frame _frame;
+ Gtk::Frame _sample;
Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > _display;
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 809dfd267f..a08c1f0f78 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -1782,7 +1782,7 @@ EditorRoutes::solo_changed_so_update_mute ()
void
EditorRoutes::show_tracks_with_regions_at_playhead ()
{
- boost::shared_ptr<RouteList> const r = _session->get_routes_with_regions_at (_session->transport_frame ());
+ boost::shared_ptr<RouteList> const r = _session->get_routes_with_regions_at (_session->transport_sample ());
set<TimeAxisView*> show;
for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 997d79efa9..661184b9ad 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -193,7 +193,7 @@ Editor::ruler_label_button_release (GdkEventButton* ev)
}
void
-Editor::popup_ruler_menu (framepos_t where, ItemType t)
+Editor::popup_ruler_menu (samplepos_t where, ItemType t)
{
using namespace Menu_Helpers;
@@ -602,10 +602,10 @@ Editor::update_just_timecode ()
return;
}
- framepos_t rightmost_frame = leftmost_frame + current_page_samples();
+ samplepos_t rightmost_sample = _leftmost_sample + current_page_samples();
if (ruler_timecode_action->get_active()) {
- timecode_ruler->set_range (leftmost_frame, rightmost_frame);
+ timecode_ruler->set_range (_leftmost_sample, rightmost_sample);
}
}
@@ -617,22 +617,22 @@ Editor::compute_fixed_ruler_scale ()
}
if (ruler_timecode_action->get_active()) {
- set_timecode_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
+ set_timecode_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
}
if (ruler_minsec_action->get_active()) {
- set_minsec_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
+ set_minsec_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
}
if (ruler_samples_action->get_active()) {
- set_samples_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
+ set_samples_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
}
}
void
Editor::update_fixed_rulers ()
{
- framepos_t rightmost_frame;
+ samplepos_t rightmost_sample;
if (_session == 0) {
return;
@@ -644,22 +644,22 @@ Editor::update_fixed_rulers ()
_samples_metric->units_per_pixel = samples_per_pixel;
_minsec_metric->units_per_pixel = samples_per_pixel;
- rightmost_frame = leftmost_frame + current_page_samples();
+ rightmost_sample = _leftmost_sample + current_page_samples();
/* these force a redraw, which in turn will force execution of the metric callbacks
to compute the relevant ticks to display.
*/
if (ruler_timecode_action->get_active()) {
- timecode_ruler->set_range (leftmost_frame, rightmost_frame);
+ timecode_ruler->set_range (_leftmost_sample, rightmost_sample);
}
if (ruler_samples_action->get_active()) {
- samples_ruler->set_range (leftmost_frame, rightmost_frame);
+ samples_ruler->set_range (_leftmost_sample, rightmost_sample);
}
if (ruler_minsec_action->get_active()) {
- minsec_ruler->set_range (leftmost_frame, rightmost_frame);
+ minsec_ruler->set_range (_leftmost_sample, rightmost_sample);
}
}
@@ -673,54 +673,54 @@ Editor::update_tempo_based_rulers ()
_bbt_metric->units_per_pixel = samples_per_pixel;
if (ruler_bbt_action->get_active()) {
- bbt_ruler->set_range (leftmost_frame, leftmost_frame+current_page_samples());
+ bbt_ruler->set_range (_leftmost_sample, _leftmost_sample+current_page_samples());
}
}
void
-Editor::set_timecode_ruler_scale (framepos_t lower, framepos_t upper)
+Editor::set_timecode_ruler_scale (samplepos_t lower, samplepos_t upper)
{
using namespace std;
- framepos_t spacer;
- framepos_t fr;
+ samplepos_t spacer;
+ samplepos_t fr;
if (_session == 0) {
return;
}
- fr = _session->frame_rate();
+ fr = _session->sample_rate();
- if (lower > (spacer = (framepos_t) (128 * Editor::get_current_zoom ()))) {
+ if (lower > (spacer = (samplepos_t) (128 * Editor::get_current_zoom ()))) {
lower = lower - spacer;
} else {
lower = 0;
}
upper = upper + spacer;
- framecnt_t const range = upper - lower;
+ samplecnt_t const range = upper - lower;
- if (range < (2 * _session->samples_per_timecode_frame())) { /* 0 - 2 frames */
+ if (range < (2 * _session->samples_per_timecode_frame())) { /* 0 - 2 samples */
timecode_ruler_scale = timecode_show_bits;
timecode_mark_modulo = 20;
timecode_nmarks = 2 + (2 * _session->config.get_subframes_per_frame());
- } else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */
- timecode_ruler_scale = timecode_show_frames;
+ } else if (range <= (fr / 4)) { /* 2 samples - 0.250 second */
+ timecode_ruler_scale = timecode_show_samples;
timecode_mark_modulo = 1;
- timecode_nmarks = 2 + (range / (framepos_t)_session->samples_per_timecode_frame());
+ timecode_nmarks = 2 + (range / (samplepos_t)_session->samples_per_timecode_frame());
} else if (range <= (fr / 2)) { /* 0.25-0.5 second */
- timecode_ruler_scale = timecode_show_frames;
+ timecode_ruler_scale = timecode_show_samples;
timecode_mark_modulo = 2;
- timecode_nmarks = 2 + (range / (framepos_t)_session->samples_per_timecode_frame());
+ timecode_nmarks = 2 + (range / (samplepos_t)_session->samples_per_timecode_frame());
} else if (range <= fr) { /* 0.5-1 second */
- timecode_ruler_scale = timecode_show_frames;
+ timecode_ruler_scale = timecode_show_samples;
timecode_mark_modulo = 5;
- timecode_nmarks = 2 + (range / (framepos_t)_session->samples_per_timecode_frame());
+ timecode_nmarks = 2 + (range / (samplepos_t)_session->samples_per_timecode_frame());
} else if (range <= 2 * fr) { /* 1-2 seconds */
- timecode_ruler_scale = timecode_show_frames;
+ timecode_ruler_scale = timecode_show_samples;
timecode_mark_modulo = 10;
- timecode_nmarks = 2 + (range / (framepos_t)_session->samples_per_timecode_frame());
+ timecode_nmarks = 2 + (range / (samplepos_t)_session->samples_per_timecode_frame());
} else if (range <= 8 * fr) { /* 2-8 seconds */
timecode_ruler_scale = timecode_show_seconds;
timecode_mark_modulo = 1;
@@ -771,7 +771,7 @@ Editor::set_timecode_ruler_scale (framepos_t lower, framepos_t upper)
timecode_nmarks = 2 + 24;
} else {
- const framecnt_t hours_in_range = range / (60 * 60 * fr);
+ const samplecnt_t hours_in_range = range / (60 * 60 * fr);
const int text_width_rough_guess = 120; /* pixels, very very approximate guess at how wide the tick mark text is */
/* Normally we do not need to know anything about the width of the canvas
@@ -786,15 +786,15 @@ Editor::set_timecode_ruler_scale (framepos_t lower, framepos_t upper)
timecode_nmarks = _track_canvas->width() / text_width_rough_guess;
timecode_ruler_scale = timecode_show_many_hours;
- timecode_mark_modulo = max ((framecnt_t) 1, 1 + (hours_in_range / timecode_nmarks));
+ timecode_mark_modulo = max ((samplecnt_t) 1, 1 + (hours_in_range / timecode_nmarks));
}
}
void
Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
{
- framepos_t pos;
- framecnt_t spacer;
+ samplepos_t pos;
+ samplecnt_t spacer;
Timecode::Time timecode;
gchar buf[16];
gint n;
@@ -804,13 +804,13 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
return;
}
- if (lower > (spacer = (framecnt_t)(128 * Editor::get_current_zoom ()))) {
+ if (lower > (spacer = (samplecnt_t)(128 * Editor::get_current_zoom ()))) {
lower = lower - spacer;
} else {
lower = 0;
}
- pos = (framecnt_t) floor (lower);
+ pos = (samplecnt_t) floor (lower);
switch (timecode_ruler_scale) {
case timecode_show_bits:
@@ -838,11 +838,11 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
}
break;
- case timecode_show_frames:
+ case timecode_show_samples:
// Find timecode time of this sample (pos)
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ );
- // Go to next whole frame down
- Timecode::frames_floor( timecode );
+ // Go to next whole sample down
+ Timecode::frames_floot( timecode );
for (n = 0; n < timecode_nmarks; n++) {
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ );
if ((timecode.frames % timecode_mark_modulo) == 0) {
@@ -961,7 +961,7 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
}
void
-Editor::compute_bbt_ruler_scale (framepos_t lower, framepos_t upper)
+Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
{
if (_session == 0) {
return;
@@ -969,14 +969,14 @@ Editor::compute_bbt_ruler_scale (framepos_t lower, framepos_t upper)
std::vector<TempoMap::BBTPoint>::const_iterator i;
Timecode::BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
- double floor_lower_beat = floor(max (0.0, _session->tempo_map().beat_at_frame (lower)));
+ double floor_lower_beat = floor(max (0.0, _session->tempo_map().beat_at_sample (lower)));
if (floor_lower_beat < 0.0) {
floor_lower_beat = 0.0;
}
- const framecnt_t beat_before_lower_pos = _session->tempo_map().frame_at_beat (floor_lower_beat);
- const framecnt_t beat_after_upper_pos = _session->tempo_map().frame_at_beat (floor (max (0.0, _session->tempo_map().beat_at_frame (upper))) + 1.0);
+ const samplecnt_t beat_before_lower_pos = _session->tempo_map().sample_at_beat (floor_lower_beat);
+ const samplecnt_t beat_after_upper_pos = _session->tempo_map().sample_at_beat (floor (max (0.0, _session->tempo_map().beat_at_sample (upper))) + 1.0);
_session->bbt_time (beat_before_lower_pos, lower_beat);
_session->bbt_time (beat_after_upper_pos, upper_beat);
@@ -1060,7 +1060,7 @@ Editor::compute_bbt_ruler_scale (framepos_t lower, framepos_t upper)
break;
}
- const double ceil_upper_beat = floor (max (0.0, _session->tempo_map().beat_at_frame (upper))) + 1.0;
+ const double ceil_upper_beat = floor (max (0.0, _session->tempo_map().beat_at_sample (upper))) + 1.0;
if (ceil_upper_beat == floor_lower_beat) {
return;
}
@@ -1118,7 +1118,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
char buf[64];
gint n = 0;
- framepos_t pos;
+ samplepos_t pos;
Timecode::BBT_Time next_beat;
uint32_t beats = 0;
uint32_t tick = 0;
@@ -1151,7 +1151,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
for (n = 1, i = grid.begin(); n < bbt_nmarks && i != grid.end(); ++i) {
- if ((*i).frame < lower && (bbt_bar_helper_on)) {
+ if ((*i).sample < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
edit_last_mark_label (marks, buf);
} else {
@@ -1167,7 +1167,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
buf[0] = '\0';
}
mark.label = buf;
- mark.position = (*i).frame;
+ mark.position = (*i).sample;
marks.push_back (mark);
n++;
}
@@ -1190,7 +1190,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
for (n = 1, i = grid.begin(); n < bbt_nmarks && i != grid.end(); ++i) {
- if ((*i).frame < lower && (bbt_bar_helper_on)) {
+ if ((*i).sample < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
edit_last_mark_label (marks, buf);
helper_active = true;
@@ -1203,11 +1203,11 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
mark.style = ArdourCanvas::Ruler::Mark::Minor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
}
- if (((*i).frame < bbt_position_of_helper) && helper_active) {
+ if (((*i).sample < bbt_position_of_helper) && helper_active) {
buf[0] = '\0';
}
mark.label = buf;
- mark.position = (*i).frame;
+ mark.position = (*i).sample;
marks.push_back (mark);
n++;
}
@@ -1221,7 +1221,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
next_beat.beats = (*i).beat;
next_beat.bars = (*i).bar;
next_beat.ticks = tick;
- pos = _session->tempo_map().frame_at_bbt (next_beat);
+ pos = _session->tempo_map().sample_at_bbt (next_beat);
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
i_am_accented = true;
@@ -1259,7 +1259,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
for (n = 1, i = grid.begin(); n < bbt_nmarks && i != grid.end(); ++i) {
- if ((*i).frame < lower && (bbt_bar_helper_on)) {
+ if ((*i).sample < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
edit_last_mark_label (marks, buf);
helper_active = true;
@@ -1272,11 +1272,11 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
mark.style = ArdourCanvas::Ruler::Mark::Minor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
}
- if (((*i).frame < bbt_position_of_helper) && helper_active) {
+ if (((*i).sample < bbt_position_of_helper) && helper_active) {
buf[0] = '\0';
}
mark.label = buf;
- mark.position = (*i).frame;
+ mark.position = (*i).sample;
marks.push_back (mark);
n++;
}
@@ -1291,7 +1291,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
next_beat.beats = (*i).beat;
next_beat.bars = (*i).bar;
next_beat.ticks = tick;
- pos = _session->tempo_map().frame_at_bbt (next_beat);
+ pos = _session->tempo_map().sample_at_bbt (next_beat);
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
i_am_accented = true;
@@ -1335,7 +1335,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
for (n = 1, i = grid.begin(); n < bbt_nmarks && i != grid.end(); ++i) {
- if ((*i).frame < lower && (bbt_bar_helper_on)) {
+ if ((*i).sample < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
edit_last_mark_label (marks, buf);
helper_active = true;
@@ -1348,11 +1348,11 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
mark.style = ArdourCanvas::Ruler::Mark::Minor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
}
- if (((*i).frame < bbt_position_of_helper) && helper_active) {
+ if (((*i).sample < bbt_position_of_helper) && helper_active) {
buf[0] = '\0';
}
mark.label = buf;
- mark.position = (*i).frame;
+ mark.position = (*i).sample;
marks.push_back (mark);
n++;
}
@@ -1367,7 +1367,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
while (tick < Timecode::BBT_Time::ticks_per_beat && (n < bbt_nmarks)) {
next_beat.ticks = tick;
- pos = _session->tempo_map().frame_at_bbt (next_beat);
+ pos = _session->tempo_map().sample_at_bbt (next_beat);
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
i_am_accented = true;
}
@@ -1423,7 +1423,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
}
}
mark.label = buf;
- mark.position = (*i).frame;
+ mark.position = (*i).sample;
marks.push_back (mark);
++n;
}
@@ -1448,7 +1448,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
}
}
mark.label = buf;
- mark.position = (*i).frame;
+ mark.position = (*i).sample;
marks.push_back (mark);
++n;
}
@@ -1473,7 +1473,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
}
}
mark.label = buf;
- mark.position = (*i).frame;
+ mark.position = (*i).sample;
marks.push_back (mark);
++n;
}
@@ -1498,7 +1498,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
}
}
mark.label = buf;
- mark.position = (*i).frame;
+ mark.position = (*i).sample;
marks.push_back (mark);
++n;
}
@@ -1509,7 +1509,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
}
void
-Editor::set_samples_ruler_scale (framepos_t lower, framepos_t upper)
+Editor::set_samples_ruler_scale (samplepos_t lower, samplepos_t upper)
{
_samples_ruler_interval = (upper - lower) / 5;
}
@@ -1517,8 +1517,8 @@ Editor::set_samples_ruler_scale (framepos_t lower, framepos_t upper)
void
Editor::metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
{
- framepos_t pos;
- framepos_t const ilower = (framepos_t) floor (lower);
+ samplepos_t pos;
+ samplepos_t const ilower = (samplepos_t) floor (lower);
gchar buf[16];
gint nmarks;
gint n;
@@ -1539,15 +1539,15 @@ Editor::metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoub
}
static void
-sample_to_clock_parts ( framepos_t sample,
- framepos_t sample_rate,
+sample_to_clock_parts ( samplepos_t sample,
+ samplepos_t sample_rate,
long *hrs_p,
long *mins_p,
long *secs_p,
long *millisecs_p)
{
- framepos_t left;
+ samplepos_t left;
long hrs;
long mins;
long secs;
@@ -1571,10 +1571,10 @@ sample_to_clock_parts ( framepos_t sample,
}
void
-Editor::set_minsec_ruler_scale (framepos_t lower, framepos_t upper)
+Editor::set_minsec_ruler_scale (samplepos_t lower, samplepos_t upper)
{
- framepos_t fr = _session->frame_rate() * 1000;
- framepos_t spacer;
+ samplepos_t fr = _session->sample_rate() * 1000;
+ samplepos_t spacer;
if (_session == 0) {
return;
@@ -1582,13 +1582,13 @@ Editor::set_minsec_ruler_scale (framepos_t lower, framepos_t upper)
/* to prevent 'flashing' */
- if (lower > (spacer = (framepos_t)(128 * Editor::get_current_zoom ()))) {
+ if (lower > (spacer = (samplepos_t)(128 * Editor::get_current_zoom ()))) {
lower -= spacer;
} else {
lower = 0;
}
upper += spacer;
- framecnt_t const range = (upper - lower) * 1000;
+ samplecnt_t const range = (upper - lower) * 1000;
if (range <= (fr / 10)) { /* 0-0.1 second */
minsec_mark_interval = fr / 1000; /* show 1/1000 seconds */
@@ -1672,7 +1672,7 @@ Editor::set_minsec_ruler_scale (framepos_t lower, framepos_t upper)
minsec_nmarks = 2 + (range / minsec_mark_interval);
} else {
- const framecnt_t hours_in_range = range / (60 * 60 * fr);
+ const samplecnt_t hours_in_range = range / (60 * 60 * fr);
const int text_width_rough_guess = 70; /* pixels, very very approximate guess at how wide the tick mark text is */
/* Normally we do not need to know anything about the width of the canvas
@@ -1686,7 +1686,7 @@ Editor::set_minsec_ruler_scale (framepos_t lower, framepos_t upper)
*/
minsec_nmarks = _track_canvas->width() / text_width_rough_guess;
- minsec_mark_modulo = max ((framecnt_t) 1, 1 + (hours_in_range / minsec_nmarks));
+ minsec_mark_modulo = max ((samplecnt_t) 1, 1 + (hours_in_range / minsec_nmarks));
minsec_mark_interval = minsec_mark_modulo * (60 * 60 * fr);
minsec_ruler_scale = minsec_show_many_hours;
}
@@ -1695,8 +1695,8 @@ Editor::set_minsec_ruler_scale (framepos_t lower, framepos_t upper)
void
Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble lower, gdouble upper, gint /*maxchars*/)
{
- framepos_t pos;
- framepos_t spacer;
+ samplepos_t pos;
+ samplepos_t spacer;
long hrs, mins, secs, millisecs;
gchar buf[16];
gint n;
@@ -1707,19 +1707,19 @@ Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoubl
}
/* to prevent 'flashing' */
- if (lower > (spacer = (framepos_t) (128 * Editor::get_current_zoom ()))) {
+ if (lower > (spacer = (samplepos_t) (128 * Editor::get_current_zoom ()))) {
lower = lower - spacer;
} else {
lower = 0;
}
- pos = (((1000 * (framepos_t) floor(lower)) + (minsec_mark_interval/2))/minsec_mark_interval) * minsec_mark_interval;
+ pos = (((1000 * (samplepos_t) floor(lower)) + (minsec_mark_interval/2))/minsec_mark_interval) * minsec_mark_interval;
switch (minsec_ruler_scale) {
case minsec_show_msecs:
for (n = 0; n < minsec_nmarks && n < upper; pos += minsec_mark_interval, ++n) {
- sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->sample_rate(), &hrs, &mins, &secs, &millisecs);
if (millisecs % minsec_mark_modulo == 0) {
if (millisecs == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major;
@@ -1739,7 +1739,7 @@ Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoubl
case minsec_show_seconds:
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
- sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->sample_rate(), &hrs, &mins, &secs, &millisecs);
if (secs % minsec_mark_modulo == 0) {
if (secs == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major;
@@ -1759,7 +1759,7 @@ Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoubl
case minsec_show_minutes:
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
- sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->sample_rate(), &hrs, &mins, &secs, &millisecs);
if (mins % minsec_mark_modulo == 0) {
if (mins == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major;
@@ -1779,7 +1779,7 @@ Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoubl
case minsec_show_hours:
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
- sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->sample_rate(), &hrs, &mins, &secs, &millisecs);
if (hrs % minsec_mark_modulo == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major;
snprintf (buf, sizeof(buf), "%02ld:%02ld", hrs, mins);
@@ -1795,7 +1795,7 @@ Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoubl
case minsec_show_many_hours:
for (n = 0; n < minsec_nmarks; ) {
- sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
+ sample_to_clock_parts (pos, _session->sample_rate(), &hrs, &mins, &secs, &millisecs);
if (hrs % minsec_mark_modulo == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major;
snprintf (buf, sizeof(buf), "%02ld:00", hrs);
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc
index b5a0be1c78..d705189cdf 100644
--- a/gtk2_ardour/editor_selection.cc
+++ b/gtk2_ardour/editor_selection.cc
@@ -667,24 +667,24 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
} else if (op == Selection::Extend) {
list<Selectable*> results;
- framepos_t last_frame;
- framepos_t first_frame;
+ samplepos_t last_sample;
+ samplepos_t first_sample;
bool same_track = false;
/* 1. find the last selected regionview in the track that was clicked in */
- last_frame = 0;
- first_frame = max_framepos;
+ last_sample = 0;
+ first_sample = max_samplepos;
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
if (&(*x)->get_time_axis_view() == &clicked_regionview->get_time_axis_view()) {
- if ((*x)->region()->last_frame() > last_frame) {
- last_frame = (*x)->region()->last_frame();
+ if ((*x)->region()->last_sample() > last_sample) {
+ last_sample = (*x)->region()->last_sample();
}
- if ((*x)->region()->first_frame() < first_frame) {
- first_frame = (*x)->region()->first_frame();
+ if ((*x)->region()->first_sample() < first_sample) {
+ first_sample = (*x)->region()->first_sample();
}
same_track = true;
@@ -695,34 +695,34 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
/* 2. figure out the boundaries for our search for new objects */
- switch (clicked_regionview->region()->coverage (first_frame, last_frame)) {
+ switch (clicked_regionview->region()->coverage (first_sample, last_sample)) {
case Evoral::OverlapNone:
- if (last_frame < clicked_regionview->region()->first_frame()) {
- first_frame = last_frame;
- last_frame = clicked_regionview->region()->last_frame();
+ if (last_sample < clicked_regionview->region()->first_sample()) {
+ first_sample = last_sample;
+ last_sample = clicked_regionview->region()->last_sample();
} else {
- last_frame = first_frame;
- first_frame = clicked_regionview->region()->first_frame();
+ last_sample = first_sample;
+ first_sample = clicked_regionview->region()->first_sample();
}
break;
case Evoral::OverlapExternal:
- if (last_frame < clicked_regionview->region()->first_frame()) {
- first_frame = last_frame;
- last_frame = clicked_regionview->region()->last_frame();
+ if (last_sample < clicked_regionview->region()->first_sample()) {
+ first_sample = last_sample;
+ last_sample = clicked_regionview->region()->last_sample();
} else {
- last_frame = first_frame;
- first_frame = clicked_regionview->region()->first_frame();
+ last_sample = first_sample;
+ first_sample = clicked_regionview->region()->first_sample();
}
break;
case Evoral::OverlapInternal:
- if (last_frame < clicked_regionview->region()->first_frame()) {
- first_frame = last_frame;
- last_frame = clicked_regionview->region()->last_frame();
+ if (last_sample < clicked_regionview->region()->first_sample()) {
+ first_sample = last_sample;
+ last_sample = clicked_regionview->region()->last_sample();
} else {
- last_frame = first_frame;
- first_frame = clicked_regionview->region()->first_frame();
+ last_sample = first_sample;
+ first_sample = clicked_regionview->region()->first_sample();
}
break;
@@ -742,15 +742,15 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
*/
- first_frame = clicked_regionview->region()->position();
- last_frame = clicked_regionview->region()->last_frame();
+ first_sample = clicked_regionview->region()->position();
+ last_sample = clicked_regionview->region()->last_sample();
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
- if ((*i)->region()->position() < first_frame) {
- first_frame = (*i)->region()->position();
+ if ((*i)->region()->position() < first_sample) {
+ first_sample = (*i)->region()->position();
}
- if ((*i)->region()->last_frame() + 1 > last_frame) {
- last_frame = (*i)->region()->last_frame();
+ if ((*i)->region()->last_sample() + 1 > last_sample) {
+ last_sample = (*i)->region()->last_sample();
}
}
}
@@ -863,7 +863,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
*/
for (set<RouteTimeAxisView*>::iterator t = relevant_tracks.begin(); t != relevant_tracks.end(); ++t) {
- (*t)->get_selectables (first_frame, last_frame, -1.0, -1.0, results);
+ (*t)->get_selectables (first_sample, last_sample, -1.0, -1.0, results);
}
/* 4. convert to a vector of regions */
@@ -1186,7 +1186,7 @@ Editor::time_selection_changed ()
if (_session && !_drags->active()) {
if (selection->time.length() != 0) {
- _session->set_range_selection (selection->time.start(), selection->time.end_frame());
+ _session->set_range_selection (selection->time.start(), selection->time.end_sample());
} else {
_session->clear_range_selection ();
}
@@ -1251,7 +1251,7 @@ Editor::sensitize_the_right_region_actions (bool because_canvas_crossing)
}
} else {
RegionSelection at_edit_point;
- framepos_t const where = get_preferred_edit_position (Editing::EDIT_IGNORE_NONE, false, !within_track_canvas);
+ samplepos_t const where = get_preferred_edit_position (Editing::EDIT_IGNORE_NONE, false, !within_track_canvas);
get_regions_at (at_edit_point, where, selection->tracks);
if (!at_edit_point.empty()) {
have_edit_point = true;
@@ -1569,7 +1569,7 @@ Editor::region_selection_changed ()
if (_session) {
if (!selection->regions.empty()) {
- _session->set_object_selection (selection->regions.start(), selection->regions.end_frame());
+ _session->set_object_selection (selection->regions.start(), selection->regions.end_sample());
} else {
_session->clear_object_selection ();
}
@@ -1596,7 +1596,7 @@ Editor::select_all_in_track (Selection::Operation op)
begin_reversible_selection_op (X_("Select All in Track"));
- clicked_routeview->get_selectables (0, max_framepos, 0, DBL_MAX, touched);
+ clicked_routeview->get_selectables (0, max_samplepos, 0, DBL_MAX, touched);
switch (op) {
case Selection::Toggle:
@@ -1659,7 +1659,7 @@ Editor::select_all_objects (Selection::Operation op)
if ((*iter)->hidden()) {
continue;
}
- (*iter)->get_selectables (0, max_framepos, 0, DBL_MAX, touched);
+ (*iter)->get_selectables (0, max_samplepos, 0, DBL_MAX, touched);
}
begin_reversible_selection_op (X_("select all"));
@@ -1722,15 +1722,15 @@ Editor::invert_selection ()
commit_reversible_selection_op ();
}
-/** @param start Start time in session frames.
- * @param end End time in session frames.
+/** @param start Start time in session samples.
+ * @param end End time in session samples.
* @param top Top (lower) y limit in trackview coordinates (ie 0 at the top of the track view)
* @param bottom Bottom (higher) y limit in trackview coordinates (ie 0 at the top of the track view)
* @param preserve_if_selected true to leave the current selection alone if we're adding to the selection and all of the selectables
* within the region are already selected.
*/
void
-Editor::select_all_within (framepos_t start, framepos_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op, bool preserve_if_selected)
+Editor::select_all_within (samplepos_t start, samplepos_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op, bool preserve_if_selected)
{
list<Selectable*> found;
@@ -1799,7 +1799,7 @@ Editor::set_selection_from_region ()
/* select range (this will clear the region selection) */
- selection->set (selection->regions.start(), selection->regions.end_frame());
+ selection->set (selection->regions.start(), selection->regions.end_sample());
/* and select the tracks */
@@ -1854,8 +1854,8 @@ Editor::select_all_selectables_using_time_selection ()
return;
}
- framepos_t start = selection->time[clicked_selection].start;
- framepos_t end = selection->time[clicked_selection].end;
+ samplepos_t start = selection->time[clicked_selection].start;
+ samplepos_t end = selection->time[clicked_selection].end;
if (end - start < 1) {
return;
@@ -1947,17 +1947,17 @@ Editor::select_all_selectables_using_loop()
void
Editor::select_all_selectables_using_cursor (EditorCursor *cursor, bool after)
{
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
list<Selectable *> touched;
if (after) {
- start = cursor->current_frame();
- end = _session->current_end_frame();
+ start = cursor->current_sample();
+ end = _session->current_end_sample();
} else {
- if (cursor->current_frame() > 0) {
+ if (cursor->current_sample() > 0) {
start = 0;
- end = cursor->current_frame() - 1;
+ end = cursor->current_sample() - 1;
} else {
return;
}
@@ -2000,13 +2000,13 @@ Editor::select_all_selectables_using_cursor (EditorCursor *cursor, bool after)
void
Editor::select_all_selectables_using_edit (bool after, bool from_context_menu)
{
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
list<Selectable *> touched;
if (after) {
start = get_preferred_edit_position(EDIT_IGNORE_NONE, from_context_menu);
- end = _session->current_end_frame();
+ end = _session->current_end_sample();
} else {
if ((end = get_preferred_edit_position(EDIT_IGNORE_NONE, from_context_menu)) > 1) {
start = 0;
@@ -2051,8 +2051,8 @@ Editor::select_all_selectables_using_edit (bool after, bool from_context_menu)
void
Editor::select_all_selectables_between (bool within)
{
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
list<Selectable *> touched;
if (!get_edit_op_range (start, end)) {
@@ -2090,8 +2090,8 @@ Editor::select_all_selectables_between (bool within)
void
Editor::select_range_between ()
{
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
if ( !selection->time.empty() ) {
selection->clear_time ();
@@ -2111,9 +2111,9 @@ Editor::select_range_between ()
}
bool
-Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const
+Editor::get_edit_op_range (samplepos_t& start, samplepos_t& end) const
{
-// framepos_t m;
+// samplepos_t m;
// bool ignored;
/* if an explicit range exists, use it */
@@ -2121,7 +2121,7 @@ Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const
if ( (mouse_mode == MouseRange || get_smart_mode() ) && !selection->time.empty()) {
/* we know that these are ordered */
start = selection->time.start();
- end = selection->time.end_frame();
+ end = selection->time.end_sample();
return true;
} else {
start = 0;
@@ -2129,7 +2129,7 @@ Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const
return false;
}
-// if (!mouse_frame (m, ignored)) {
+// if (!mouse_sample (m, ignored)) {
// /* mouse is not in a canvas, try playhead+selected marker.
// this is probably most true when using menus.
// */
@@ -2139,7 +2139,7 @@ Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const
// }
// start = selection->markers.front()->position();
-// end = _session->audible_frame();
+// end = _session->audible_sample();
// } else {
@@ -2148,10 +2148,10 @@ Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const
// if (selection->markers.empty()) {
// /* use mouse + playhead */
// start = m;
-// end = _session->audible_frame();
+// end = _session->audible_sample();
// } else {
// /* use playhead + selected marker */
-// start = _session->audible_frame();
+// start = _session->audible_sample();
// end = selection->markers.front()->position();
// }
// break;
@@ -2160,7 +2160,7 @@ Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const
// /* use mouse + selected marker */
// if (selection->markers.empty()) {
// start = m;
-// end = _session->audible_frame();
+// end = _session->audible_sample();
// } else {
// start = selection->markers.front()->position();
// end = m;
@@ -2220,7 +2220,7 @@ Editor::deselect_all ()
}
long
-Editor::select_range (framepos_t s, framepos_t e)
+Editor::select_range (samplepos_t s, samplepos_t e)
{
begin_reversible_selection_op (X_("Select Range"));
selection->add (clicked_axisview);
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index 95b54cdf02..6a894eae24 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -118,7 +118,7 @@ EditorSummary::set_session (Session* s)
_editor->selection->RegionsChanged.connect (sigc::mem_fun(*this, &EditorSummary::set_background_dirty));
}
- _leftmost = max_framepos;
+ _leftmost = max_samplepos;
_rightmost = 0;
}
@@ -138,7 +138,7 @@ EditorSummary::render_background_image ()
/* compute start and end points for the summary */
- std::pair<framepos_t, framepos_t> ext = _editor->session_gui_extents();
+ std::pair<samplepos_t, samplepos_t> ext = _editor->session_gui_extents();
double theoretical_start = ext.first;
double theoretical_end = ext.second;
@@ -150,7 +150,7 @@ EditorSummary::render_background_image ()
/* range-check */
_start = theoretical_start > 0 ? theoretical_start : 0;
- _end = theoretical_end < max_framepos ? theoretical_end : max_framepos;
+ _end = theoretical_end < max_samplepos ? theoretical_end : max_samplepos;
/* calculate x scale */
if (_end != _start) {
@@ -212,11 +212,11 @@ EditorSummary::render_background_image ()
cairo_set_line_width (cr, 1);
cairo_set_source_rgb (cr, 1, 1, 0);
- const double p = (_session->current_start_frame() - _start) * _x_scale;
+ const double p = (_session->current_start_sample() - _start) * _x_scale;
cairo_move_to (cr, p, 0);
cairo_line_to (cr, p, get_height());
- double const q = (_session->current_end_frame() - _start) * _x_scale;
+ double const q = (_session->current_end_sample() - _start) * _x_scale;
cairo_move_to (cr, q, 0);
cairo_line_to (cr, q, get_height());
cairo_stroke (cr);
@@ -237,12 +237,12 @@ EditorSummary::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle
}
/* maintain the leftmost and rightmost locations that we've ever reached */
- framecnt_t const leftmost = _editor->leftmost_sample ();
+ samplecnt_t const leftmost = _editor->leftmost_sample ();
if ( leftmost < _leftmost) {
_leftmost = leftmost;
_background_dirty = true;
}
- framecnt_t const rightmost = leftmost + _editor->current_page_samples();
+ samplecnt_t const rightmost = leftmost + _editor->current_page_samples();
if ( rightmost > _rightmost) {
_rightmost = rightmost;
_background_dirty = true;
@@ -289,7 +289,7 @@ EditorSummary::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle
/* XXX: colour should be set from configuration file */
cairo_set_source_rgba (cr, 1, 0, 0, 1);
- const double ph= playhead_frame_to_position (_editor->playhead_cursor->current_frame());
+ const double ph= playhead_sample_to_position (_editor->playhead_cursor->current_sample());
cairo_move_to (cr, ph, 0);
cairo_line_to (cr, ph, get_height());
cairo_stroke (cr);
@@ -407,7 +407,7 @@ EditorSummary::on_key_press_event (GdkEventKey* key)
if (key->keyval == set_playhead_accel.accel_key && (int) key->state == set_playhead_accel.accel_mods) {
if (_session) {
get_pointer (x, y);
- _session->request_locate (_start + (framepos_t) x / _x_scale, _session->transport_rolling());
+ _session->request_locate (_start + (samplepos_t) x / _x_scale, _session->transport_rolling());
return true;
}
}
@@ -577,7 +577,7 @@ void
EditorSummary::reset_to_extents()
{
//reset as if the user never went anywhere outside the extents
- _leftmost = max_framepos;
+ _leftmost = max_samplepos;
_rightmost = 0;
_editor->temporal_zoom_extents ();
@@ -890,10 +890,10 @@ EditorSummary::set_editor_x (pair<double, double> x)
}
void
-EditorSummary::playhead_position_changed (framepos_t p)
+EditorSummary::playhead_position_changed (samplepos_t p)
{
int const o = int (_last_playhead);
- int const n = int (playhead_frame_to_position (p));
+ int const n = int (playhead_sample_to_position (p));
if (_session && o != n) {
int a = max(2, min (o, n));
int b = max (o, n);
@@ -948,13 +948,13 @@ EditorSummary::route_gui_changed (PBD::PropertyChange const& what_changed)
}
double
-EditorSummary::playhead_frame_to_position (framepos_t t) const
+EditorSummary::playhead_sample_to_position (samplepos_t t) const
{
return (t - _start) * _x_scale;
}
-framepos_t
-EditorSummary::position_to_playhead_frame_to_position (double pos) const
+samplepos_t
+EditorSummary::position_to_playhead_sample_to_position (double pos) const
{
return _start + (pos * _x_scale);
}
diff --git a/gtk2_ardour/editor_summary.h b/gtk2_ardour/editor_summary.h
index 6639285eea..d875c7a382 100644
--- a/gtk2_ardour/editor_summary.h
+++ b/gtk2_ardour/editor_summary.h
@@ -75,28 +75,28 @@ private:
void set_editor (std::pair<double, double>);
void set_editor_x (double);
void set_editor_x (std::pair<double, double>);
- void playhead_position_changed (framepos_t);
+ void playhead_position_changed (samplepos_t);
double editor_y_to_summary (double) const;
Position get_position (double, double) const;
void set_cursor (Position);
void route_gui_changed (PBD::PropertyChange const&);
bool suspending_editor_updates () const;
- double playhead_frame_to_position (framepos_t) const;
- framepos_t position_to_playhead_frame_to_position (double pos) const;
+ double playhead_sample_to_position (samplepos_t) const;
+ samplepos_t position_to_playhead_sample_to_position (double pos) const;
void set_overlays_dirty_rect (int, int, int, int);
void summary_zoom_step ( int steps );
- framepos_t _start; ///< start frame of the overview
- framepos_t _end; ///< end frame of the overview
+ samplepos_t _start; ///< start sample of the overview
+ samplepos_t _end; ///< end sample of the overview
- framepos_t _leftmost; ///< the earliest frame we ever viewed
- framepos_t _rightmost; ///< the latest frame we ever viewed
+ samplepos_t _leftmost; ///< the earliest sample we ever viewed
+ samplepos_t _rightmost; ///< the latest sample we ever viewed
/** fraction of the session length by which the overview size should extend past the start and end markers */
double _overhang_fraction;
- double _x_scale; ///< pixels per frame for the x axis of the pixmap
+ double _x_scale; ///< pixels per sample for the x axis of the pixmap
double _track_height;
double _last_playhead;
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index b71ab32087..7817e419be 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -77,7 +77,7 @@ Editor::remove_metric_marks ()
}
struct CurveComparator {
bool operator() (TempoCurve const * a, TempoCurve const * b) {
- return a->tempo().frame() < b->tempo().frame();
+ return a->tempo().sample() < b->tempo().sample();
}
};
void
@@ -112,7 +112,7 @@ Editor::draw_metric_marks (const Metrics& metrics)
uint32_t const tc_color = UIConfiguration::instance().color ("tempo curve");
tempo_curves.push_back (new TempoCurve (*this, *tempo_group, tc_color,
- *(const_cast<TempoSection*>(ts)), ts->frame(), false));
+ *(const_cast<TempoSection*>(ts)), ts->sample(), false));
const std::string tname (X_(""));
if (ts->position_lock_style() == MusicTime) {
@@ -147,9 +147,9 @@ Editor::draw_metric_marks (const Metrics& metrics)
(*x)->set_min_tempo (min_tempo);
++tmp;
if (tmp != tempo_curves.end()) {
- (*x)->set_position ((*x)->tempo().frame(), (*tmp)->tempo().frame());
+ (*x)->set_position ((*x)->tempo().sample(), (*tmp)->tempo().sample());
} else {
- (*x)->set_position ((*x)->tempo().frame(), UINT32_MAX);
+ (*x)->set_position ((*x)->tempo().sample(), UINT32_MAX);
}
if (!(*x)->tempo().active()) {
@@ -184,10 +184,10 @@ Editor::tempo_map_changed (const PropertyChange& /*ignored*/)
tempo_lines->tempo_map_changed(_session->tempo_map().music_origin());
}
- compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
+ compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
std::vector<TempoMap::BBTPoint> grid;
if (bbt_ruler_scale != bbt_show_many) {
- compute_current_bbt_points (grid, leftmost_frame, leftmost_frame + current_page_samples());
+ compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples());
}
_session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
draw_measures (grid);
@@ -220,7 +220,7 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
if ((tempo_marker = dynamic_cast<TempoMarker*> (*x)) != 0) {
if ((ts = &tempo_marker->tempo()) != 0) {
- tempo_marker->set_position (ts->frame ());
+ tempo_marker->set_position (ts->sample ());
if (prev_ts && abs (prev_ts->end_note_types_per_minute() - ts->note_types_per_minute()) < 1.0) {
tempo_marker->set_points_color (UIConfiguration::instance().color ("tempo marker music"));
@@ -238,7 +238,7 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
}
if ((meter_marker = dynamic_cast<MeterMarker*> (*x)) != 0) {
if ((ms = &meter_marker->meter()) != 0) {
- meter_marker->set_position (ms->frame ());
+ meter_marker->set_position (ms->sample ());
}
}
}
@@ -259,9 +259,9 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
(*x)->set_min_tempo (min_tempo);
++tmp;
if (tmp != tempo_curves.end()) {
- (*x)->set_position ((*x)->tempo().frame(), (*tmp)->tempo().frame());
+ (*x)->set_position ((*x)->tempo().sample(), (*tmp)->tempo().sample());
} else {
- (*x)->set_position ((*x)->tempo().frame(), UINT32_MAX);
+ (*x)->set_position ((*x)->tempo().sample(), UINT32_MAX);
}
if (!(*x)->tempo().active()) {
@@ -280,11 +280,11 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
}
}
- compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
+ compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
std::vector<TempoMap::BBTPoint> grid;
if (bbt_ruler_scale != bbt_show_many) {
- compute_current_bbt_points (grid, leftmost_frame, leftmost_frame + current_page_samples());
+ compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples());
}
draw_measures (grid);
@@ -301,12 +301,12 @@ Editor::redisplay_tempo (bool immediate_redraw)
if (immediate_redraw) {
//only recalculate bbt_ruler_scale on a zoom or snap-change; not every redraw; if a case is found where this is necessary, uncomment this line.
-// compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
+// compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
std::vector<TempoMap::BBTPoint> grid;
if (bbt_ruler_scale != bbt_show_many) {
- compute_current_bbt_points (grid, leftmost_frame, leftmost_frame + current_page_samples());
+ compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples());
}
draw_measures (grid);
@@ -337,7 +337,7 @@ Editor::tempo_curve_selected (TempoSection* ts, bool yn)
/* computes a grid starting a beat before and ending a beat after leftmost and rightmost respectively */
void
-Editor::compute_current_bbt_points (std::vector<TempoMap::BBTPoint>& grid, framepos_t leftmost, framepos_t rightmost)
+Editor::compute_current_bbt_points (std::vector<TempoMap::BBTPoint>& grid, samplepos_t leftmost, samplepos_t rightmost)
{
if (!_session) {
return;
@@ -345,35 +345,35 @@ Editor::compute_current_bbt_points (std::vector<TempoMap::BBTPoint>& grid, frame
/* prevent negative values of leftmost from creeping into tempomap
*/
- const double lower_beat = floor (max (0.0, _session->tempo_map().beat_at_frame (leftmost))) - 1.0;
+ const double lower_beat = floor (max (0.0, _session->tempo_map().beat_at_sample (leftmost))) - 1.0;
switch (bbt_ruler_scale) {
case bbt_show_beats:
case bbt_show_ticks:
case bbt_show_ticks_detail:
case bbt_show_ticks_super_detail:
- _session->tempo_map().get_grid (grid, max (_session->tempo_map().frame_at_beat (lower_beat), (framepos_t) 0), rightmost);
+ _session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost);
break;
case bbt_show_1:
- _session->tempo_map().get_grid (grid, max (_session->tempo_map().frame_at_beat (lower_beat), (framepos_t) 0), rightmost, 1);
+ _session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 1);
break;
case bbt_show_4:
- _session->tempo_map().get_grid (grid, max (_session->tempo_map().frame_at_beat (lower_beat), (framepos_t) 0), rightmost, 4);
+ _session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 4);
break;
case bbt_show_16:
- _session->tempo_map().get_grid (grid, max (_session->tempo_map().frame_at_beat (lower_beat), (framepos_t) 0), rightmost, 16);
+ _session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 16);
break;
case bbt_show_64:
- _session->tempo_map().get_grid (grid, max (_session->tempo_map().frame_at_beat (lower_beat), (framepos_t) 0), rightmost, 64);
+ _session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 64);
break;
default:
/* bbt_show_many */
- _session->tempo_map().get_grid (grid, max (_session->tempo_map().frame_at_beat (lower_beat), (framepos_t) 0), rightmost, 128);
+ _session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 128);
break;
}
}
@@ -394,15 +394,15 @@ Editor::draw_measures (std::vector<ARDOUR::TempoMap::BBTPoint>& grid)
}
if (tempo_lines == 0) {
- tempo_lines = new TempoLines (time_line_group, ArdourCanvas::LineSet::Vertical, new BeatsFramesConverter (_session->tempo_map(), _session->tempo_map().music_origin()));
+ tempo_lines = new TempoLines (time_line_group, ArdourCanvas::LineSet::Vertical, new BeatsSamplesConverter (_session->tempo_map(), _session->tempo_map().music_origin()));
}
- const unsigned divisions = get_grid_beat_divisions(leftmost_frame);
- tempo_lines->draw (grid, divisions, leftmost_frame, _session->frame_rate());
+ const unsigned divisions = get_grid_beat_divisions(_leftmost_sample);
+ tempo_lines->draw (grid, divisions, _leftmost_sample, _session->sample_rate());
}
void
-Editor::mouse_add_new_tempo_event (framepos_t frame)
+Editor::mouse_add_new_tempo_event (samplepos_t sample)
{
if (_session == 0) {
return;
@@ -411,12 +411,12 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
TempoMap& map(_session->tempo_map());
begin_reversible_command (_("add tempo mark"));
- const double pulse = map.exact_qn_at_frame (frame, get_grid_music_divisions (0)) / 4.0;
+ const double pulse = map.exact_qn_at_sample (sample, get_grid_music_divisions (0)) / 4.0;
if (pulse > 0.0) {
XMLNode &before = map.get_state();
- /* add music-locked ramped (?) tempo using the bpm/note type at frame*/
- map.add_tempo (map.tempo_at_frame (frame), pulse, 0, MusicTime);
+ /* add music-locked ramped (?) tempo using the bpm/note type at sample*/
+ map.add_tempo (map.tempo_at_sample (sample), pulse, 0, MusicTime);
XMLNode &after = map.get_state();
_session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
@@ -427,7 +427,7 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
}
void
-Editor::mouse_add_new_meter_event (framepos_t frame)
+Editor::mouse_add_new_meter_event (samplepos_t sample)
{
if (_session == 0) {
return;
@@ -435,7 +435,7 @@ Editor::mouse_add_new_meter_event (framepos_t frame)
TempoMap& map(_session->tempo_map());
- MeterDialog meter_dialog (map, frame, _("add"));
+ MeterDialog meter_dialog (map, sample, _("add"));
switch (meter_dialog.run ()) {
case RESPONSE_ACCEPT:
@@ -452,14 +452,14 @@ Editor::mouse_add_new_meter_event (framepos_t frame)
Timecode::BBT_Time requested;
meter_dialog.get_bbt_time (requested);
- const double al_frame = map.frame_at_bbt (requested);
+ const double al_sample = map.sample_at_bbt (requested);
begin_reversible_command (_("add meter mark"));
XMLNode &before = map.get_state();
if (meter_dialog.get_lock_style() == MusicTime) {
map.add_meter (Meter (bpb, note_type), requested, 0, MusicTime);
} else {
- map.add_meter (Meter (bpb, note_type), requested, al_frame, AudioTime);
+ map.add_meter (Meter (bpb, note_type), requested, al_sample, AudioTime);
}
_session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
@@ -509,13 +509,13 @@ Editor::edit_meter_section (MeterSection* section)
Timecode::BBT_Time when;
meter_dialog.get_bbt_time (when);
- const framepos_t frame = _session->tempo_map().frame_at_bbt (when);
+ const samplepos_t sample = _session->tempo_map().sample_at_bbt (when);
const PositionLockStyle pls = (meter_dialog.get_lock_style() == AudioTime) ? AudioTime : MusicTime;
begin_reversible_command (_("replace meter mark"));
XMLNode &before = _session->tempo_map().get_state();
- _session->tempo_map().replace_meter (*section, meter, when, frame, pls);
+ _session->tempo_map().replace_meter (*section, meter, when, sample, pls);
XMLNode &after = _session->tempo_map().get_state();
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
@@ -547,7 +547,7 @@ Editor::edit_tempo_section (TempoSection* section)
XMLNode &before = _session->tempo_map().get_state();
if (tempo_dialog.get_lock_style() == AudioTime) {
- framepos_t const f = _session->tempo_map().predict_tempo_position (section, when).second;
+ samplepos_t const f = _session->tempo_map().predict_tempo_position (section, when).second;
_session->tempo_map().replace_tempo (*section, tempo, 0.0, f, AudioTime);
} else {
double const p = _session->tempo_map().predict_tempo_position (section, when).first;
diff --git a/gtk2_ardour/editor_timefx.cc b/gtk2_ardour/editor_timefx.cc
index 31bac68561..39cda63517 100644
--- a/gtk2_ardour/editor_timefx.cc
+++ b/gtk2_ardour/editor_timefx.cc
@@ -150,9 +150,9 @@ Editor::time_fx (RegionList& regions, float val, bool pitching)
return 0;
}
- const framecnt_t oldlen = (framecnt_t) (regions.front()->length());
- const framecnt_t newlen = (framecnt_t) (regions.front()->length() * val);
- const framecnt_t pos = regions.front()->position ();
+ const samplecnt_t oldlen = (samplecnt_t) (regions.front()->length());
+ const samplecnt_t newlen = (samplecnt_t) (regions.front()->length() * val);
+ const samplecnt_t pos = regions.front()->position ();
delete current_timefx;
current_timefx = new TimeFXDialog (*this, pitching, oldlen, newlen, pos);
diff --git a/gtk2_ardour/editor_videotimeline.cc b/gtk2_ardour/editor_videotimeline.cc
index e087034af0..b5184539fc 100644
--- a/gtk2_ardour/editor_videotimeline.cc
+++ b/gtk2_ardour/editor_videotimeline.cc
@@ -82,7 +82,7 @@ Editor::toggle_video_timeline_locked ()
}
void
-Editor::embed_audio_from_video (std::string path, framepos_t n, bool lock_position_to_video)
+Editor::embed_audio_from_video (std::string path, samplepos_t n, bool lock_position_to_video)
{
vector<std::string> paths;
paths.push_back(path);
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc
index 3939fec8cb..92a85a3a2a 100644
--- a/gtk2_ardour/engine_dialog.cc
+++ b/gtk2_ardour/engine_dialog.cc
@@ -2833,7 +2833,7 @@ EngineControl::check_audio_latency_measurement ()
}
char buf[256];
- ARDOUR::framecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
+ ARDOUR::samplecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
if (sample_rate == 0) {
lm_results.set_markup (string_compose (results_markup, _("Disconnected from audio engine")));
@@ -2841,12 +2841,12 @@ EngineControl::check_audio_latency_measurement ()
return false;
}
- int frames_total = mtdm->del();
- int extra = frames_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
+ int samples_total = mtdm->del();
+ int extra = samples_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
snprintf (buf, sizeof (buf), "%s%d samples (%.3lf ms)\n%s%d samples (%.3lf ms)",
_("Detected roundtrip latency: "),
- frames_total, frames_total * 1000.0f/sample_rate,
+ samples_total, samples_total * 1000.0f/sample_rate,
_("Systemic latency: "),
extra, extra * 1000.0f/sample_rate);
@@ -2887,7 +2887,7 @@ EngineControl::check_midi_latency_measurement ()
}
char buf[256];
- ARDOUR::framecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
+ ARDOUR::samplecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
if (sample_rate == 0) {
lm_results.set_markup (string_compose (results_markup, _("Disconnected from audio engine")));
@@ -2895,11 +2895,11 @@ EngineControl::check_midi_latency_measurement ()
return false;
}
- ARDOUR::framecnt_t frames_total = mididm->latency();
- ARDOUR::framecnt_t extra = frames_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
+ ARDOUR::samplecnt_t samples_total = mididm->latency();
+ ARDOUR::samplecnt_t extra = samples_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
snprintf (buf, sizeof (buf), "%s%" PRId64" samples (%.1lf ms) dev: %.2f[spl]\n%s%" PRId64" samples (%.1lf ms)",
_("Detected roundtrip latency: "),
- frames_total, frames_total * 1000.0f / sample_rate, mididm->deviation (),
+ samples_total, samples_total * 1000.0f / sample_rate, mididm->deviation (),
_("Systemic latency: "),
extra, extra * 1000.0f / sample_rate);
@@ -3000,9 +3000,9 @@ EngineControl::use_latency_button_clicked ()
if (!mididm) {
return;
}
- ARDOUR::framecnt_t frames_total = mididm->latency();
- ARDOUR::framecnt_t extra = frames_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
- uint32_t one_way = max ((ARDOUR::framecnt_t) 0, extra / 2);
+ ARDOUR::samplecnt_t samples_total = mididm->latency();
+ ARDOUR::samplecnt_t extra = samples_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
+ uint32_t one_way = max ((ARDOUR::samplecnt_t) 0, extra / 2);
_measure_midi->input_latency = one_way;
_measure_midi->output_latency = one_way;
if (backend->can_change_systemic_latency_when_running ()) {
diff --git a/gtk2_ardour/enums.cc b/gtk2_ardour/enums.cc
index 608d257645..728a523384 100644
--- a/gtk2_ardour/enums.cc
+++ b/gtk2_ardour/enums.cc
@@ -59,7 +59,7 @@ setup_gtk_ardour_enums ()
REGISTER_CLASS_ENUM (AudioClock, Timecode);
REGISTER_CLASS_ENUM (AudioClock, BBT);
REGISTER_CLASS_ENUM (AudioClock, MinSec);
- REGISTER_CLASS_ENUM (AudioClock, Frames);
+ REGISTER_CLASS_ENUM (AudioClock, Samples);
REGISTER (clock_mode);
REGISTER_ENUM (Wide);
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc
index 9ba65a6646..6b7f13dba6 100644
--- a/gtk2_ardour/export_dialog.cc
+++ b/gtk2_ardour/export_dialog.cc
@@ -402,7 +402,7 @@ ExportDialog::progress_timeout ()
case ExportStatus::Exporting:
status_text = string_compose (_("Exporting '%3' (timespan %1 of %2)"),
status->timespan, status->total_timespans, status->timespan_name);
- progress = ((float) status->processed_frames_current_timespan) / status->total_frames_current_timespan;
+ progress = ((float) status->processed_samples_current_timespan) / status->total_samples_current_timespan;
break;
case ExportStatus::Normalizing:
status_text = string_compose (_("Normalizing '%3' (timespan %1 of %2)"),
diff --git a/gtk2_ardour/export_format_dialog.cc b/gtk2_ardour/export_format_dialog.cc
index 6062d51500..184bcdc3bb 100644
--- a/gtk2_ardour/export_format_dialog.cc
+++ b/gtk2_ardour/export_format_dialog.cc
@@ -300,7 +300,7 @@ ExportFormatDialog::set_session (ARDOUR::Session* s)
if (sample_rate_view.get_selection()->count_selected_rows() == 0) {
Gtk::ListStore::Children::iterator it;
for (it = sample_rate_list->children().begin(); it != sample_rate_list->children().end(); ++it) {
- if ((framecnt_t) (*it)->get_value (sample_rate_cols.ptr)->rate == _session->nominal_frame_rate()) {
+ if ((samplecnt_t) (*it)->get_value (sample_rate_cols.ptr)->rate == _session->nominal_sample_rate()) {
sample_rate_view.get_selection()->select (it);
break;
}
@@ -691,7 +691,7 @@ ExportFormatDialog::change_sample_rate_selection (bool select, WeakSampleRatePtr
if (select) {
ExportFormatManager::SampleRatePtr ptr = rate.lock();
if (ptr && _session) {
- src_quality_combo.set_sensitive ((uint32_t) ptr->rate != _session->frame_rate());
+ src_quality_combo.set_sensitive ((uint32_t) ptr->rate != _session->sample_rate());
}
}
}
@@ -877,7 +877,7 @@ void
ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & time)
{
// TODO position
- clock.set (_session->convert_to_frames (time), true);
+ clock.set (_session->convert_to_samples (time), true);
AudioClock::Mode mode(AudioClock::Timecode);
@@ -888,8 +888,8 @@ ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & ti
case AnyTime::BBT:
mode = AudioClock::BBT;
break;
- case AnyTime::Frames:
- mode = AudioClock::Frames;
+ case AnyTime::Samples:
+ mode = AudioClock::Samples;
break;
case AnyTime::Seconds:
mode = AudioClock::MinSec;
@@ -906,24 +906,24 @@ ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock)
return;
}
- framecnt_t frames = clock.current_duration();
+ samplecnt_t samples = clock.current_duration();
switch (clock.mode()) {
case AudioClock::Timecode:
time.type = AnyTime::Timecode;
- _session->timecode_time (frames, time.timecode);
+ _session->timecode_time (samples, time.timecode);
break;
case AudioClock::BBT:
time.type = AnyTime::BBT;
- _session->bbt_time (frames, time.bbt);
+ _session->bbt_time (samples, time.bbt);
break;
case AudioClock::MinSec:
time.type = AnyTime::Seconds;
- time.seconds = (double) frames / _session->frame_rate();
+ time.seconds = (double) samples / _session->sample_rate();
break;
- case AudioClock::Frames:
- time.type = AnyTime::Frames;
- time.frames = frames;
+ case AudioClock::Samples:
+ time.type = AnyTime::Samples;
+ time.samples = samples;
break;
}
}
diff --git a/gtk2_ardour/export_report.cc b/gtk2_ardour/export_report.cc
index 5840597554..0c7270db72 100644
--- a/gtk2_ardour/export_report.cc
+++ b/gtk2_ardour/export_report.cc
@@ -123,9 +123,9 @@ ExportReport::init (const AnalysisResults & ar, bool with_file)
SoundFileInfo info;
std::string errmsg;
- framecnt_t file_length = 0;
- framecnt_t sample_rate = 0;
- framecnt_t start_off = 0;
+ samplecnt_t file_length = 0;
+ samplecnt_t sample_rate = 0;
+ samplecnt_t start_off = 0;
unsigned int channels = 0;
std::string file_fmt;
@@ -141,7 +141,7 @@ ExportReport::init (const AnalysisResults & ar, bool with_file)
/* File Info Table */
- framecnt_t const nfr = _session ? _session->nominal_frame_rate () : 25;
+ samplecnt_t const nfr = _session ? _session->nominal_sample_rate () : 25;
double src_coef = (double) nfr / info.samplerate;
l = manage (new Label (_("Format:"), ALIGN_END));
@@ -961,7 +961,7 @@ ExportReport::audition (std::string path, unsigned n_chn, int page)
SourceFactory::createExternal (DataType::AUDIO, *_session,
path, n,
Source::Flag (ARDOUR::AudioFileSource::NoPeakFile), false));
- if (afs->sample_rate() != _session->nominal_frame_rate()) {
+ if (afs->sample_rate() != _session->nominal_sample_rate()) {
boost::shared_ptr<SrcFileSource> sfs (new SrcFileSource(*_session, afs, ARDOUR::SrcGood));
srclist.push_back(sfs);
} else {
@@ -1034,7 +1034,7 @@ ExportReport::on_switch_page (GtkNotebookPage*, guint page_num)
}
void
-ExportReport::audition_progress (framecnt_t pos, framecnt_t len)
+ExportReport::audition_progress (samplecnt_t pos, samplecnt_t len)
{
if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
const float p = (float)pos / len;
@@ -1169,7 +1169,7 @@ ExportReport::draw_waveform (Cairo::RefPtr<Cairo::ImageSurface>& wave, ExportAna
// >= -1dBTP (coeff >= .89125, libs/vamp-plugins/TruePeak.cpp)
cr->set_source_rgba (1.0, 0.7, 0, 0.7);
- for (std::set<framepos_t>::const_iterator i = p->truepeakpos[c].begin (); i != p->truepeakpos[c].end (); ++i) {
+ for (std::set<samplepos_t>::const_iterator i = p->truepeakpos[c].begin (); i != p->truepeakpos[c].end (); ++i) {
cr->move_to (m_l + (*i) - .5, clip_top);
cr->line_to (m_l + (*i) - .5, clip_bot);
cr->stroke ();
diff --git a/gtk2_ardour/export_report.h b/gtk2_ardour/export_report.h
index af91ee2dbe..9fdf5c7b40 100644
--- a/gtk2_ardour/export_report.h
+++ b/gtk2_ardour/export_report.h
@@ -204,7 +204,7 @@ private:
void play_audition ();
void audition_active (bool);
void audition_seek (int, float);
- void audition_progress (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
+ void audition_progress (ARDOUR::samplecnt_t, ARDOUR::samplecnt_t);
void on_switch_page (GtkNotebookPage*, guint page_num);
void on_logscale_toggled (Gtk::ToggleButton*);
void on_rectivied_toggled (Gtk::ToggleButton*);
diff --git a/gtk2_ardour/export_timespan_selector.cc b/gtk2_ardour/export_timespan_selector.cc
index 0228bd9130..56b6653ade 100644
--- a/gtk2_ardour/export_timespan_selector.cc
+++ b/gtk2_ardour/export_timespan_selector.cc
@@ -221,28 +221,28 @@ ExportTimespanSelector::construct_label (ARDOUR::Location const * location) cons
std::string start;
std::string end;
- framepos_t start_frame = location->start();
- framepos_t end_frame = location->end();
+ samplepos_t start_sample = location->start();
+ samplepos_t end_sample = location->end();
switch (state->time_format) {
case AudioClock::BBT:
- start = bbt_str (start_frame);
- end = bbt_str (end_frame);
+ start = bbt_str (start_sample);
+ end = bbt_str (end_sample);
break;
case AudioClock::Timecode:
- start = timecode_str (start_frame);
- end = timecode_str (end_frame);
+ start = timecode_str (start_sample);
+ end = timecode_str (end_sample);
break;
case AudioClock::MinSec:
- start = ms_str (start_frame);
- end = ms_str (end_frame);
+ start = ms_str (start_sample);
+ end = ms_str (end_sample);
break;
- case AudioClock::Frames:
- start = to_string (start_frame);
- end = to_string (end_frame);
+ case AudioClock::Samples:
+ start = to_string (start_sample);
+ end = to_string (end_sample);
break;
}
@@ -287,7 +287,7 @@ ExportTimespanSelector::construct_length (ARDOUR::Location const * location) con
s << ms_str (location->length ());
break;
- case AudioClock::Frames:
+ case AudioClock::Samples:
s << location->length ();
break;
}
@@ -297,7 +297,7 @@ ExportTimespanSelector::construct_length (ARDOUR::Location const * location) con
std::string
-ExportTimespanSelector::bbt_str (framepos_t frames) const
+ExportTimespanSelector::bbt_str (samplepos_t samples) const
{
if (!_session) {
return "Error!";
@@ -305,14 +305,14 @@ ExportTimespanSelector::bbt_str (framepos_t frames) const
std::ostringstream oss;
Timecode::BBT_Time time;
- _session->bbt_time (frames, time);
+ _session->bbt_time (samples, time);
print_padded (oss, time);
return oss.str ();
}
std::string
-ExportTimespanSelector::timecode_str (framecnt_t frames) const
+ExportTimespanSelector::timecode_str (samplecnt_t samples) const
{
if (!_session) {
return "Error!";
@@ -321,7 +321,7 @@ ExportTimespanSelector::timecode_str (framecnt_t frames) const
std::ostringstream oss;
Timecode::Time time;
- _session->timecode_time (frames, time);
+ _session->timecode_time (samples, time);
oss << std::setfill('0') << std::right <<
std::setw(2) <<
@@ -337,27 +337,27 @@ ExportTimespanSelector::timecode_str (framecnt_t frames) const
}
std::string
-ExportTimespanSelector::ms_str (framecnt_t frames) const
+ExportTimespanSelector::ms_str (samplecnt_t samples) const
{
if (!_session) {
return "Error!";
}
std::ostringstream oss;
- framecnt_t left;
+ samplecnt_t left;
int hrs;
int mins;
int secs;
int sec_promilles;
- left = frames;
- hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
- left -= (framecnt_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
- mins = (int) floor (left / (_session->frame_rate() * 60.0f));
- left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f);
- secs = (int) floor (left / (float) _session->frame_rate());
- left -= (framecnt_t) floor ((double)(secs * _session->frame_rate()));
- sec_promilles = (int) (left * 1000 / (float) _session->frame_rate() + 0.5);
+ left = samples;
+ hrs = (int) floor (left / (_session->sample_rate() * 60.0f * 60.0f));
+ left -= (samplecnt_t) floor (hrs * _session->sample_rate() * 60.0f * 60.0f);
+ mins = (int) floor (left / (_session->sample_rate() * 60.0f));
+ left -= (samplecnt_t) floor (mins * _session->sample_rate() * 60.0f);
+ secs = (int) floor (left / (float) _session->sample_rate());
+ left -= (samplecnt_t) floor ((double)(secs * _session->sample_rate()));
+ sec_promilles = (int) (left * 1000 / (float) _session->sample_rate() + 0.5);
oss << std::setfill('0') << std::right <<
std::setw(2) <<
diff --git a/gtk2_ardour/export_timespan_selector.h b/gtk2_ardour/export_timespan_selector.h
index 1e1460db6c..1f7a5ae9c2 100644
--- a/gtk2_ardour/export_timespan_selector.h
+++ b/gtk2_ardour/export_timespan_selector.h
@@ -52,7 +52,7 @@ namespace ARDOUR {
}
using ARDOUR::CDMarkerFormat;
-using ARDOUR::framecnt_t;
+using ARDOUR::samplecnt_t;
/// Timespan Selector base
class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
@@ -94,9 +94,9 @@ protected:
std::string construct_label (ARDOUR::Location const * location) const;
std::string construct_length (ARDOUR::Location const * location) const;
- std::string bbt_str (framepos_t frames) const;
- std::string timecode_str (framecnt_t frames) const;
- std::string ms_str (framecnt_t frames) const;
+ std::string bbt_str (samplepos_t samples) const;
+ std::string timecode_str (samplecnt_t samples) const;
+ std::string ms_str (samplecnt_t samples) const;
void update_range_name (std::string const & path, std::string const & new_text);
diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc
index 1972561ed2..2eb177788c 100644
--- a/gtk2_ardour/export_video_dialog.cc
+++ b/gtk2_ardour/export_video_dialog.cc
@@ -96,7 +96,7 @@ ExportVideoDialog::ExportVideoDialog ()
, optimizations_checkbox (_("Codec Optimizations:"))
, optimizations_label ("-")
, deinterlace_checkbox (_("Deinterlace"))
- , bframes_checkbox (_("Use [2] B-frames (MPEG 2 or 4 only)"))
+ , bframes_checkbox (_("Use [2] B-samples (MPEG 2 or 4 only)"))
, fps_checkbox (_("Override FPS (Default is to retain FPS from the input video file):"))
, meta_checkbox (_("Include Session Metadata"))
#if 1 /* tentative debug mode */
@@ -334,14 +334,14 @@ ExportVideoDialog::apply_state (TimeSelection &tme, bool range)
outfn_path_entry.set_text (_session->session_directory().export_path() + G_DIR_SEPARATOR +"export.avi");
// TODO remember setting for export-range.. somehow, (let explicit range override)
- frameoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
+ sampleoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
if (av_offset < 0 ) {
insnd_combo.append_text (_("from 00:00:00:00 to the video's end"));
} else {
insnd_combo.append_text (_("from the video's start to the video's end"));
}
if (!export_range.empty()) {
- insnd_combo.append_text (_("Selected range")); // TODO show export_range.start() -> export_range.end_frame()
+ insnd_combo.append_text (_("Selected range")); // TODO show export_range.start() -> export_range.end_sample()
}
if (range) {
insnd_combo.set_active(2);
@@ -424,7 +424,7 @@ ExportVideoDialog::apply_state (TimeSelection &tme, bool range)
if (node->get_property (X_("Deinterlace"), yn)) {
deinterlace_checkbox.set_active (yn);
}
- if (node->get_property (X_("BFrames"), yn)) {
+ if (node->get_property (X_("BSamples"), yn)) {
bframes_checkbox.set_active (yn);
}
if (node->get_property (X_("ChangeFPS"), yn)) {
@@ -513,7 +513,7 @@ ExportVideoDialog::get_state ()
node->set_property (X_("TwoPassEncode"), twopass_checkbox.get_active());
node->set_property (X_("CodecOptimzations"), optimizations_checkbox.get_active());
node->set_property (X_("Deinterlace"), deinterlace_checkbox.get_active());
- node->set_property (X_("BFrames"), bframes_checkbox.get_active());
+ node->set_property (X_("BSamples"), bframes_checkbox.get_active());
node->set_property (X_("ChangeFPS"), fps_checkbox.get_active());
node->set_property (X_("Metadata"), meta_checkbox.get_active());
@@ -555,7 +555,7 @@ ExportVideoDialog::abort_clicked ()
}
void
-ExportVideoDialog::update_progress (framecnt_t c, framecnt_t a)
+ExportVideoDialog::update_progress (samplecnt_t c, samplecnt_t a)
{
if (a == 0 || c > a) {
pbar.set_pulse_step(.1);
@@ -586,7 +586,7 @@ ExportVideoDialog::audio_progress_display ()
break;
case ExportStatus::Exporting:
pbar.set_text (_("Exporting audio"));
- progress = ((float) status->processed_frames_current_timespan) / status->total_frames_current_timespan;
+ progress = ((float) status->processed_samples_current_timespan) / status->total_samples_current_timespan;
progress = progress / ((_twopass ? 2.0 : 1.0) + (_normalize ? 2.0 : 1.0));
break;
default:
@@ -685,13 +685,13 @@ ExportVideoDialog::launch_export ()
" <Start>"
" <Trim enabled=\"false\"/>"
" <Add enabled=\"false\">"
-" <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" frames=\"0\"/>"
+" <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" samples=\"0\"/>"
" </Add>"
" </Start>"
" <End>"
" <Trim enabled=\"false\"/>"
" <Add enabled=\"false\">"
-" <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" frames=\"0\"/>"
+" <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" samples=\"0\"/>"
" </Add>"
" </End>"
" </Silence>"
@@ -701,19 +701,19 @@ ExportVideoDialog::launch_export ()
boost::shared_ptr<ExportFormatSpecification> fmp = _session->get_export_handler()->add_format(*tree.root());
/* set up range */
- framepos_t start, end;
+ samplepos_t start, end;
start = end = 0;
if (insnd_combo.get_active_row_number() == 1) {
_transcoder = new TranscodeFfmpeg(invid_path_entry.get_text());
if (_transcoder->probe_ok() && _transcoder->get_fps() > 0) {
- end = _transcoder->get_duration() * _session->nominal_frame_rate() / _transcoder->get_fps();
+ end = _transcoder->get_duration() * _session->nominal_sample_rate() / _transcoder->get_fps();
} else {
warning << _("Export Video: Cannot query duration of video-file, using duration from timeline instead.") << endmsg;
end = ARDOUR_UI::instance()->video_timeline->get_duration();
}
if (_transcoder) {delete _transcoder; _transcoder = 0;}
- frameoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
+ sampleoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
#if 0 /* DEBUG */
printf("audio-range -- AV offset: %lld\n", av_offset);
#endif
@@ -723,19 +723,19 @@ ExportVideoDialog::launch_export ()
end += av_offset;
}
else if (insnd_combo.get_active_row_number() == 2) {
- start = ARDOUR_UI::instance()->video_timeline->quantify_frames_to_apv(export_range.start());
- end = ARDOUR_UI::instance()->video_timeline->quantify_frames_to_apv(export_range.end_frame());
+ start = ARDOUR_UI::instance()->video_timeline->quantify_samples_to_apv(export_range.start());
+ end = ARDOUR_UI::instance()->video_timeline->quantify_samples_to_apv(export_range.end_sample());
}
if (end <= 0) {
- start = _session->current_start_frame();
- end = _session->current_end_frame();
+ start = _session->current_start_sample();
+ end = _session->current_end_sample();
}
#if 0 /* DEBUG */
printf("audio export-range %lld -> %lld\n", start, end);
#endif
- const frameoffset_t vstart = ARDOUR_UI::instance()->video_timeline->get_offset();
- const frameoffset_t vend = vstart + ARDOUR_UI::instance()->video_timeline->get_duration();
+ const sampleoffset_t vstart = ARDOUR_UI::instance()->video_timeline->get_offset();
+ const sampleoffset_t vend = vstart + ARDOUR_UI::instance()->video_timeline->get_duration();
if ( (start >= end) || (end < vstart) || (start > vend)) {
warning << _("Export Video: export-range does not include video.") << endmsg;
@@ -936,23 +936,23 @@ ExportVideoDialog::encode_pass (int pass)
ffs["-passlogfile"] = Glib::path_get_dirname (outfn) + G_DIR_SEPARATOR + "ffmpeg2pass";
}
- frameoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
+ sampleoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
double duration_s = 0;
if (insnd_combo.get_active_row_number() == 0) {
/* session start to session end */
- framecnt_t duration_f = _session->current_end_frame() - _session->current_start_frame();
- duration_s = (double)duration_f / (double)_session->nominal_frame_rate();
+ samplecnt_t duration_f = _session->current_end_sample() - _session->current_start_sample();
+ duration_s = (double)duration_f / (double)_session->nominal_sample_rate();
} else if (insnd_combo.get_active_row_number() == 2) {
/* selected range */
- duration_s = export_range.length() / (double)_session->nominal_frame_rate();
+ duration_s = export_range.length() / (double)_session->nominal_sample_rate();
} else {
/* video start to end */
- framecnt_t duration_f = ARDOUR_UI::instance()->video_timeline->get_duration();
+ samplecnt_t duration_f = ARDOUR_UI::instance()->video_timeline->get_duration();
if (av_offset < 0 ) {
duration_f += av_offset;
}
- duration_s = (double)duration_f / (double)_session->nominal_frame_rate();
+ duration_s = (double)duration_f / (double)_session->nominal_sample_rate();
}
std::ostringstream osstream; osstream << duration_s;
@@ -960,14 +960,14 @@ ExportVideoDialog::encode_pass (int pass)
_transcoder->set_duration(duration_s * _transcoder->get_fps());
if (insnd_combo.get_active_row_number() == 0 || insnd_combo.get_active_row_number() == 2) {
- framepos_t start, snend;
- const frameoffset_t vid_duration = ARDOUR_UI::instance()->video_timeline->get_duration();
+ samplepos_t start, snend;
+ const sampleoffset_t vid_duration = ARDOUR_UI::instance()->video_timeline->get_duration();
if (insnd_combo.get_active_row_number() == 0) {
- start = _session->current_start_frame();
- snend = _session->current_end_frame();
+ start = _session->current_start_sample();
+ snend = _session->current_end_sample();
} else {
start = export_range.start();
- snend = export_range.end_frame();
+ snend = export_range.end_sample();
}
#if 0 /* DEBUG */
@@ -976,27 +976,27 @@ ExportVideoDialog::encode_pass (int pass)
#endif
if (av_offset > start && av_offset + vid_duration < snend) {
- _transcoder->set_leadinout((av_offset - start) / (double)_session->nominal_frame_rate(),
- (snend - (av_offset + vid_duration)) / (double)_session->nominal_frame_rate());
+ _transcoder->set_leadinout((av_offset - start) / (double)_session->nominal_sample_rate(),
+ (snend - (av_offset + vid_duration)) / (double)_session->nominal_sample_rate());
} else if (av_offset > start) {
- _transcoder->set_leadinout((av_offset - start) / (double)_session->nominal_frame_rate(), 0);
+ _transcoder->set_leadinout((av_offset - start) / (double)_session->nominal_sample_rate(), 0);
} else if (av_offset + vid_duration < snend) {
- _transcoder->set_leadinout(0, (snend - (av_offset + vid_duration)) / (double)_session->nominal_frame_rate());
- _transcoder->set_avoffset((av_offset - start) / (double)_session->nominal_frame_rate());
+ _transcoder->set_leadinout(0, (snend - (av_offset + vid_duration)) / (double)_session->nominal_sample_rate());
+ _transcoder->set_avoffset((av_offset - start) / (double)_session->nominal_sample_rate());
}
#if 0
else if (start > av_offset) {
- std::ostringstream osstream; osstream << ((start - av_offset) / (double)_session->nominal_frame_rate());
+ std::ostringstream osstream; osstream << ((start - av_offset) / (double)_session->nominal_sample_rate());
ffs["-ss"] = osstream.str();
}
#endif
else {
- _transcoder->set_avoffset((av_offset - start) / (double)_session->nominal_frame_rate());
+ _transcoder->set_avoffset((av_offset - start) / (double)_session->nominal_sample_rate());
}
} else if (av_offset < 0) {
/* from 00:00:00:00 to video-end */
- _transcoder->set_avoffset(av_offset / (double)_session->nominal_frame_rate());
+ _transcoder->set_avoffset(av_offset / (double)_session->nominal_sample_rate());
}
TranscodeFfmpeg::FFSettings meta = _transcoder->default_meta_data();
@@ -1157,7 +1157,7 @@ ExportVideoDialog::preset_combo_changed ()
video_codec_combo.set_active(6);
audio_bitrate_combo.set_active(2);
video_bitrate_combo.set_active(4);
- if (_session->nominal_frame_rate() == 48000 || _session->nominal_frame_rate() == 96000) {
+ if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
audio_samplerate_combo.set_active(2);
} else {
audio_samplerate_combo.set_active(1);
@@ -1169,7 +1169,7 @@ ExportVideoDialog::preset_combo_changed ()
video_codec_combo.set_active(2);
audio_bitrate_combo.set_active(3);
video_bitrate_combo.set_active(4);
- if (_session->nominal_frame_rate() == 48000 || _session->nominal_frame_rate() == 96000) {
+ if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
audio_samplerate_combo.set_active(2);
} else {
audio_samplerate_combo.set_active(1);
@@ -1181,7 +1181,7 @@ ExportVideoDialog::preset_combo_changed ()
video_codec_combo.set_active(7);
audio_bitrate_combo.set_active(3);
video_bitrate_combo.set_active(4);
- if (_session->nominal_frame_rate() == 48000 || _session->nominal_frame_rate() == 96000) {
+ if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
audio_samplerate_combo.set_active(2);
} else {
audio_samplerate_combo.set_active(1);
@@ -1212,7 +1212,7 @@ ExportVideoDialog::preset_combo_changed ()
video_codec_combo.set_active(5);
audio_bitrate_combo.set_active(4);
video_bitrate_combo.set_active(5);
- if (_session->nominal_frame_rate() == 48000 || _session->nominal_frame_rate() == 96000) {
+ if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
audio_samplerate_combo.set_active(2);
} else {
audio_samplerate_combo.set_active(1);
@@ -1224,7 +1224,7 @@ ExportVideoDialog::preset_combo_changed ()
video_codec_combo.set_active(6);
audio_bitrate_combo.set_active(0);
video_bitrate_combo.set_active(0);
- if (_session->nominal_frame_rate() == 48000 || _session->nominal_frame_rate() == 96000) {
+ if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
audio_samplerate_combo.set_active(2);
} else {
audio_samplerate_combo.set_active(1);
diff --git a/gtk2_ardour/export_video_dialog.h b/gtk2_ardour/export_video_dialog.h
index 6e9b00558e..12c75ec141 100644
--- a/gtk2_ardour/export_video_dialog.h
+++ b/gtk2_ardour/export_video_dialog.h
@@ -88,7 +88,7 @@ private:
bool _normalize;
void finished ();
- void update_progress (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
+ void update_progress (ARDOUR::samplecnt_t, ARDOUR::samplecnt_t);
boost::shared_ptr<ARDOUR::ExportStatus> status;
sigc::connection audio_progress_connection;
diff --git a/gtk2_ardour/fft_graph.cc b/gtk2_ardour/fft_graph.cc
index ec54acbaaa..27d5b06f3e 100644
--- a/gtk2_ardour/fft_graph.cc
+++ b/gtk2_ardour/fft_graph.cc
@@ -651,7 +651,7 @@ FFTGraph::on_size_allocate (Gtk::Allocation & alloc)
void
FFTGraph::update_size ()
{
- framecnt_t SR = PublicEditor::instance ().session ()->nominal_frame_rate ();
+ samplecnt_t SR = PublicEditor::instance ().session ()->nominal_sample_rate ();
_fft_start = SR / (double)_dataSize;
_fft_end = .5 * SR;
_fft_log_base = logf (.5 * _dataSize);
diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc
index 02c3967f16..edb1217911 100644
--- a/gtk2_ardour/gain_meter.cc
+++ b/gtk2_ardour/gain_meter.cc
@@ -733,13 +733,13 @@ GainMeterBase::meter_point_clicked (MeterPoint mp)
void
GainMeterBase::amp_start_touch ()
{
- _control->start_touch (_control->session().transport_frame());
+ _control->start_touch (_control->session().transport_sample());
}
void
GainMeterBase::amp_stop_touch ()
{
- _control->stop_touch (_control->session().transport_frame());
+ _control->stop_touch (_control->session().transport_sample());
effective_gain_display ();
}
diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc
index 8be90cfa3f..0e9935b291 100644
--- a/gtk2_ardour/generic_pluginui.cc
+++ b/gtk2_ardour/generic_pluginui.cc
@@ -429,8 +429,8 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
Gtk::Table* button_table = manage (new Gtk::Table (initial_button_rows, initial_button_cols));
Gtk::Table* output_table = manage (new Gtk::Table (initial_output_rows, initial_output_cols));
- Frame* frame;
- Frame* bt_frame;
+ Frame* sample;
+ Frame* bt_sample;
VBox* box;
int output_row, output_col;
int button_row, button_col;
@@ -460,21 +460,21 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
output_table->set_border_width (5);
- bt_frame = manage (new Frame);
- bt_frame->set_name ("BaseFrame");
- bt_frame->set_label (_("Switches"));
- bt_frame->add (*button_table);
- hpacker.pack_start(*bt_frame, true, true);
+ bt_sample = manage (new Frame);
+ bt_sample->set_name ("BaseFrame");
+ bt_sample->set_label (_("Switches"));
+ bt_sample->add (*button_table);
+ hpacker.pack_start(*bt_sample, true, true);
box = manage (new VBox);
box->set_border_width (5);
box->set_spacing (1);
- frame = manage (new Frame);
- frame->set_name ("BaseFrame");
- frame->set_label (_("Controls"));
- frame->add (*box);
- hpacker.pack_start(*frame, true, true);
+ sample = manage (new Frame);
+ sample->set_name ("BaseFrame");
+ sample->set_label (_("Controls"));
+ sample->add (*box);
+ hpacker.pack_start(*sample, true, true);
// Add special controls to UI, and build list of normal controls to be layed out later
std::vector<ControlUI *> cui_controls_list;
@@ -576,14 +576,14 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
if (x > max_controls_per_column || similarity_scores[i] <= similarity_threshold) {
if (x > min_controls_per_column) {
- frame = manage (new Frame);
- frame->set_name ("BaseFrame");
- frame->set_label (_("Controls"));
+ sample = manage (new Frame);
+ sample->set_name ("BaseFrame");
+ sample->set_label (_("Controls"));
box = manage (new VBox);
box->set_border_width (5);
box->set_spacing (1);
- frame->add (*box);
- hpacker.pack_start(*frame, true, true);
+ sample->add (*box);
+ hpacker.pack_start(*sample, true, true);
x = 0;
} else {
HSeparator *split = new HSeparator();
@@ -600,22 +600,22 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
}
if (box->children().empty()) {
- hpacker.remove (*frame);
+ hpacker.remove (*sample);
}
if (button_table->children().empty()) {
- hpacker.remove (*bt_frame);
+ hpacker.remove (*bt_sample);
delete button_table;
} else {
button_table->show_all ();
}
if (!output_table->children().empty()) {
- frame = manage (new Frame);
- frame->set_name ("BaseFrame");
- frame->set_label(_("Meters"));
- frame->add (*output_table);
- hpacker.pack_end (*frame, true, true);
+ sample = manage (new Frame);
+ sample->set_name ("BaseFrame");
+ sample->set_label(_("Meters"));
+ sample->add (*output_table);
+ hpacker.pack_end (*sample, true, true);
output_table->show_all ();
} else {
delete output_table;
@@ -660,15 +660,15 @@ GenericPluginUI::build_midi_table ()
pgm_table->set_border_width (5);
pgm_table->set_col_spacing (2, 10);
- Frame* frame = manage (new Frame);
- frame->set_name ("BaseFrame");
+ Frame* sample = manage (new Frame);
+ sample->set_name ("BaseFrame");
if (dynamic_cast<MidiTrack*> (insert->owner())) {
- frame->set_label (_("MIDI Progams (sent to track)"));
+ sample->set_label (_("MIDI Progams (sent to track)"));
} else {
- frame->set_label (_("MIDI Progams (volatile)"));
+ sample->set_label (_("MIDI Progams (volatile)"));
}
- frame->add (*pgm_table);
- hpacker.pack_start (*frame, false, false);
+ sample->add (*pgm_table);
+ hpacker.pack_start (*sample, false, false);
for (uint8_t chn = 0; chn < 16; ++chn) {
int col = 3 * (chn / 8);
diff --git a/gtk2_ardour/insert_remove_time_dialog.cc b/gtk2_ardour/insert_remove_time_dialog.cc
index f58bfdbaea..162559e539 100644
--- a/gtk2_ardour/insert_remove_time_dialog.cc
+++ b/gtk2_ardour/insert_remove_time_dialog.cc
@@ -74,10 +74,10 @@ InsertRemoveTimeDialog::InsertRemoveTimeDialog (PublicEditor& e, bool remove)
//if a Range is selected, assume the user wants to insert/remove the length of the range
if ( _editor.get_selection().time.length() != 0 ) {
position_clock.set ( _editor.get_selection().time.start(), true );
- duration_clock.set ( _editor.get_selection().time.end_frame(), true, _editor.get_selection().time.start() );
+ duration_clock.set ( _editor.get_selection().time.end_sample(), true, _editor.get_selection().time.start() );
duration_clock.set_bbt_reference (_editor.get_selection().time.start());
} else {
- framepos_t const pos = _editor.get_preferred_edit_position (EDIT_IGNORE_MOUSE);
+ samplepos_t const pos = _editor.get_preferred_edit_position (EDIT_IGNORE_MOUSE);
position_clock.set ( pos, true );
duration_clock.set_bbt_reference (pos);
duration_clock.set (0);
@@ -189,13 +189,13 @@ InsertRemoveTimeDialog::move_locked_markers () const
return _move_locked_markers.get_active ();
}
-framepos_t
+samplepos_t
InsertRemoveTimeDialog::position () const
{
return position_clock.current_time();
}
-framepos_t
+samplepos_t
InsertRemoveTimeDialog::distance () const
{
return duration_clock.current_duration ( position_clock.current_time() );
diff --git a/gtk2_ardour/insert_remove_time_dialog.h b/gtk2_ardour/insert_remove_time_dialog.h
index 999c0ca272..4b0cef6dd9 100644
--- a/gtk2_ardour/insert_remove_time_dialog.h
+++ b/gtk2_ardour/insert_remove_time_dialog.h
@@ -34,8 +34,8 @@ public:
bool move_glued_markers () const;
bool move_locked_markers () const;
bool move_tempos () const;
- framepos_t position () const;
- framepos_t distance () const;
+ samplepos_t position () const;
+ samplepos_t distance () const;
private:
void move_markers_toggled ();
diff --git a/gtk2_ardour/latency_gui.cc b/gtk2_ardour/latency_gui.cc
index de7e7b0b57..870fda9282 100644
--- a/gtk2_ardour/latency_gui.cc
+++ b/gtk2_ardour/latency_gui.cc
@@ -54,7 +54,7 @@ LatencyBarController::get_label (double&)
std::stringstream s;
if (nframes < (_latency_gui->sample_rate / 1000.0)) {
- const framepos_t nf = (framepos_t) rint (nframes);
+ const samplepos_t nf = (samplepos_t) rint (nframes);
s << string_compose (P_("%1 sample", "%1 samples", nf), nf);
} else {
s << std::fixed << std::setprecision (2) << (nframes / (_latency_gui->sample_rate / 1000.0)) << " ms";
@@ -63,13 +63,13 @@ LatencyBarController::get_label (double&)
return s.str ();
}
-LatencyGUI::LatencyGUI (Latent& l, framepos_t sr, framepos_t psz)
+LatencyGUI::LatencyGUI (Latent& l, samplepos_t sr, samplepos_t psz)
: _latent (l),
initial_value (_latent.user_latency()),
sample_rate (sr),
period_size (psz),
ignored (new PBD::IgnorableControllable()),
- /* max 1 second, step by frames, page by msecs */
+ /* max 1 second, step by samples, page by msecs */
adjustment (initial_value, 0.0, sample_rate, 1.0, sample_rate / 1000.0f),
bc (adjustment, this),
reset_button (_("Reset"))
@@ -116,7 +116,7 @@ LatencyGUI::LatencyGUI (Latent& l, framepos_t sr, framepos_t psz)
void
LatencyGUI::finish ()
{
- framepos_t new_value = (framepos_t) adjustment.get_value();
+ samplepos_t new_value = (samplepos_t) adjustment.get_value();
if (new_value != initial_value) {
_latent.set_user_latency (new_value);
}
@@ -161,7 +161,7 @@ LatencyGUI::change_latency_from_button (int dir)
}
}
-LatencyDialog::LatencyDialog (const std::string& title, Latent& l, framepos_t sr, framepos_t psz)
+LatencyDialog::LatencyDialog (const std::string& title, Latent& l, samplepos_t sr, samplepos_t psz)
: ArdourDialog (title, false, true),
lwidget (l, sr, psz)
{
diff --git a/gtk2_ardour/latency_gui.h b/gtk2_ardour/latency_gui.h
index d9b2a3bf4a..943944571e 100644
--- a/gtk2_ardour/latency_gui.h
+++ b/gtk2_ardour/latency_gui.h
@@ -57,7 +57,7 @@ private:
class LatencyGUI : public Gtk::VBox
{
public:
- LatencyGUI (ARDOUR::Latent&, framepos_t sample_rate, framepos_t period_size);
+ LatencyGUI (ARDOUR::Latent&, samplepos_t sample_rate, samplepos_t period_size);
~LatencyGUI() { }
void finish ();
@@ -66,9 +66,9 @@ public:
private:
ARDOUR::Latent& _latent;
- framepos_t initial_value;
- framepos_t sample_rate;
- framepos_t period_size;
+ samplepos_t initial_value;
+ samplepos_t sample_rate;
+ samplepos_t period_size;
boost::shared_ptr<PBD::IgnorableControllable> ignored;
Gtk::Adjustment adjustment;
@@ -91,7 +91,7 @@ private:
class LatencyDialog : public ArdourDialog
{
public:
- LatencyDialog (const std::string& title, ARDOUR::Latent&, framepos_t sample_rate, framepos_t period_size);
+ LatencyDialog (const std::string& title, ARDOUR::Latent&, samplepos_t sample_rate, samplepos_t period_size);
~LatencyDialog() {}
private:
diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc
index 658b7326d9..7f2e2bb3ba 100644
--- a/gtk2_ardour/location_ui.cc
+++ b/gtk2_ardour/location_ui.cc
@@ -284,7 +284,7 @@ LocationEditRow::set_location (Location *loc)
cd_check_button.set_active (location->is_cd_marker());
cd_check_button.show();
- if (location->start() == _session->current_start_frame()) {
+ if (location->start() == _session->current_start_sample()) {
cd_check_button.set_sensitive (false);
} else {
cd_check_button.set_sensitive (true);
@@ -418,10 +418,10 @@ LocationEditRow::to_playhead_button_pressed (LocationPart part)
switch (part) {
case LocStart:
- location->set_start (_session->transport_frame (), false, true, divisions);
+ location->set_start (_session->transport_sample (), false, true, divisions);
break;
case LocEnd:
- location->set_end (_session->transport_frame (), false, true,divisions);
+ location->set_end (_session->transport_sample (), false, true,divisions);
if (location->is_session_range()) {
_session->set_end_is_free (false);
}
@@ -524,7 +524,7 @@ LocationEditRow::cd_toggled ()
//}
if (cd_check_button.get_active()) {
- if (location->start() <= _session->current_start_frame()) {
+ if (location->start() <= _session->current_start_sample()) {
error << _("You cannot put a CD marker at the start of the session") << endmsg;
cd_check_button.set_active (false);
return;
@@ -646,7 +646,7 @@ LocationEditRow::start_changed ()
start_clock.set (location->start());
- if (location->start() == _session->current_start_frame()) {
+ if (location->start() == _session->current_start_sample()) {
cd_check_button.set_sensitive (false);
} else {
cd_check_button.set_sensitive (true);
@@ -753,7 +753,7 @@ LocationEditRow::set_clock_editable_status ()
LocationUI::LocationUI (std::string state_node_name)
: add_location_button (_("New Marker"))
, add_range_button (_("New Range"))
- , _mode (AudioClock::Frames)
+ , _mode (AudioClock::Samples)
, _mode_set (false)
, _state_node_name (state_node_name)
{
@@ -808,15 +808,15 @@ LocationUI::LocationUI (std::string state_node_name)
newest_location = 0;
- loc_frame_box.set_spacing (5);
- loc_frame_box.set_border_width (5);
- loc_frame_box.set_name("LocationFrameBox");
+ loc_sample_box.set_spacing (5);
+ loc_sample_box.set_border_width (5);
+ loc_sample_box.set_name("LocationFrameBox");
- loc_frame_box.pack_start (location_rows_scroller, true, true);
+ loc_sample_box.pack_start (location_rows_scroller, true, true);
add_location_button.set_name ("LocationAddLocationButton");
- table->attach (loc_frame_box, 0, 2, table_row, table_row + 1);
+ table->attach (loc_sample_box, 0, 2, table_row, table_row + 1);
++table_row;
loc_range_panes.add (*table);
@@ -841,14 +841,14 @@ LocationUI::LocationUI (std::string state_node_name)
range_rows_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
range_rows_scroller.set_size_request (-1, 130);
- range_frame_box.set_spacing (5);
- range_frame_box.set_name("LocationFrameBox");
- range_frame_box.set_border_width (5);
- range_frame_box.pack_start (range_rows_scroller, true, true);
+ range_sample_box.set_spacing (5);
+ range_sample_box.set_name("LocationFrameBox");
+ range_sample_box.set_border_width (5);
+ range_sample_box.pack_start (range_rows_scroller, true, true);
add_range_button.set_name ("LocationAddRangeButton");
- table->attach (range_frame_box, 0, 2, table_row, table_row + 1);
+ table->attach (range_sample_box, 0, 2, table_row, table_row + 1);
++table_row;
loc_range_panes.add (*table);
@@ -1047,7 +1047,7 @@ LocationUI::add_new_location()
string markername;
if (_session) {
- framepos_t where = _session->audible_frame();
+ samplepos_t where = _session->audible_sample();
_session->locations()->next_available_name(markername,"mark");
Location *location = new Location (*_session, where, where, markername, Location::IsMark);
if (UIConfiguration::instance().get_name_new_markers()) {
@@ -1069,7 +1069,7 @@ LocationUI::add_new_range()
string rangename;
if (_session) {
- framepos_t where = _session->audible_frame();
+ samplepos_t where = _session->audible_sample();
_session->locations()->next_available_name(rangename,"unnamed");
Location *location = new Location (*_session, where, where, rangename, Location::IsRangeMarker);
PublicEditor::instance().begin_reversible_command (_("add range marker"));
diff --git a/gtk2_ardour/location_ui.h b/gtk2_ardour/location_ui.h
index 46495aa4fc..7c3f4b69c4 100644
--- a/gtk2_ardour/location_ui.h
+++ b/gtk2_ardour/location_ui.h
@@ -182,12 +182,12 @@ private:
ArdourWidgets::VPane loc_range_panes;
- Gtk::VBox loc_frame_box;
+ Gtk::VBox loc_sample_box;
Gtk::Button add_location_button;
Gtk::ScrolledWindow location_rows_scroller;
Gtk::VBox location_rows;
- Gtk::VBox range_frame_box;
+ Gtk::VBox range_sample_box;
Gtk::Button add_range_button;
Gtk::ScrolledWindow range_rows_scroller;
Gtk::VBox range_rows;
diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc
index ff2c8d3164..a20405a599 100644
--- a/gtk2_ardour/luainstance.cc
+++ b/gtk2_ardour/luainstance.cc
@@ -728,14 +728,14 @@ LuaInstance::register_classes (lua_State* L)
.beginClass <RegionSelection> ("RegionSelection")
.addFunction ("start", &RegionSelection::start)
- .addFunction ("end_frame", &RegionSelection::end_frame)
+ .addFunction ("end_frame", &RegionSelection::end_sample)
.addFunction ("n_midi_regions", &RegionSelection::n_midi_regions)
.addFunction ("regionlist", &RegionSelection::regionlist) // XXX check windows binding (libardour)
.endClass ()
.deriveClass <TimeSelection, std::list<ARDOUR::AudioRange> > ("TimeSelection")
.addFunction ("start", &TimeSelection::start)
- .addFunction ("end_frame", &TimeSelection::end_frame)
+ .addFunction ("end_frame", &TimeSelection::end_sample)
.addFunction ("length", &TimeSelection::length)
.endClass ()
diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc
index 25fdf1ed72..641fa8dce8 100644
--- a/gtk2_ardour/lv2_plugin_ui.cc
+++ b/gtk2_ardour/lv2_plugin_ui.cc
@@ -103,9 +103,9 @@ LV2PluginUI::touch(void* controller,
ControllableRef control = me->_controllables[port_index];
if (grabbed) {
- control->start_touch(control->session().transport_frame());
+ control->start_touch(control->session().transport_sample());
} else {
- control->stop_touch(control->session().transport_frame());
+ control->stop_touch(control->session().transport_sample());
}
}
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index 65ce353817..1afe9a21fb 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -137,7 +137,7 @@ static void ardour_g_log (const gchar *log_domain, GLogLevelFlags log_level, con
static gboolean
tell_about_backend_death (void* /* ignored */)
{
- if (AudioEngine::instance()->processed_frames() == 0) {
+ if (AudioEngine::instance()->processed_samples() == 0) {
/* died during startup */
MessageDialog msg (string_compose (_("The audio backend (%1) has failed, or terminated"), AudioEngine::instance()->current_backend_name()), false);
msg.set_position (Gtk::WIN_POS_CENTER);
diff --git a/gtk2_ardour/main_clock.cc b/gtk2_ardour/main_clock.cc
index 6a759eb9dc..ff68e9e22c 100644
--- a/gtk2_ardour/main_clock.cc
+++ b/gtk2_ardour/main_clock.cc
@@ -76,7 +76,7 @@ MainClock::build_ops_menu ()
ops_items.push_back (MenuElem (_("Insert Meter Change"), sigc::mem_fun(*this, &MainClock::insert_new_meter)));
}
-framepos_t
+samplepos_t
MainClock::absolute_time () const
{
if (get_is_duration ()) {
@@ -101,7 +101,7 @@ void
MainClock::edit_current_tempo ()
{
if (!PublicEditor::instance().session()) return;
- ARDOUR::TempoSection* ts = const_cast<ARDOUR::TempoSection*>(&PublicEditor::instance().session()->tempo_map().tempo_section_at_frame (absolute_time()));
+ ARDOUR::TempoSection* ts = const_cast<ARDOUR::TempoSection*>(&PublicEditor::instance().session()->tempo_map().tempo_section_at_sample (absolute_time()));
PublicEditor::instance().edit_tempo_section (ts);
}
@@ -109,7 +109,7 @@ void
MainClock::edit_current_meter ()
{
if (!PublicEditor::instance().session()) return;
- ARDOUR::MeterSection* ms = const_cast<ARDOUR::MeterSection*>(&PublicEditor::instance().session()->tempo_map().meter_section_at_frame (absolute_time()));
+ ARDOUR::MeterSection* ms = const_cast<ARDOUR::MeterSection*>(&PublicEditor::instance().session()->tempo_map().meter_section_at_sample (absolute_time()));
PublicEditor::instance().edit_meter_section (ms);
}
diff --git a/gtk2_ardour/main_clock.h b/gtk2_ardour/main_clock.h
index 28cc988506..3e7b5db046 100644
--- a/gtk2_ardour/main_clock.h
+++ b/gtk2_ardour/main_clock.h
@@ -29,7 +29,7 @@ class MainClock : public AudioClock
{
public:
MainClock (const std::string& clock_name, const std::string& widget_name, bool primary);
- framepos_t absolute_time () const;
+ samplepos_t absolute_time () const;
void set_session (ARDOUR::Session *s);
private:
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index 0b52d144db..b578939f7a 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -64,7 +64,7 @@ void ArdourMarker::setup_sizes(const double timebar_height)
}
ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba, const string& annotation,
- Type type, framepos_t frame, bool handle_events)
+ Type type, samplepos_t sample, bool handle_events)
: editor (ed)
, _parent (&parent)
@@ -255,8 +255,8 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, g
}
- frame_position = frame;
- unit_position = editor.sample_to_pixel (frame);
+ sample_position = sample;
+ unit_position = editor.sample_to_pixel (sample);
unit_position -= _shift;
group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple (unit_position, 1));
@@ -460,18 +460,18 @@ ArdourMarker::setup_name_display ()
}
void
-ArdourMarker::set_position (framepos_t frame)
+ArdourMarker::set_position (samplepos_t sample)
{
- unit_position = editor.sample_to_pixel (frame) - _shift;
+ unit_position = editor.sample_to_pixel (sample) - _shift;
group->set_x_position (unit_position);
setup_line ();
- frame_position = frame;
+ sample_position = sample;
}
void
ArdourMarker::reposition ()
{
- set_position (frame_position);
+ set_position (sample_position);
}
void
@@ -550,7 +550,7 @@ ArdourMarker::set_right_label_limit (double p)
TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text,
ARDOUR::TempoSection& temp)
- : ArdourMarker (editor, parent, rgba, text, Tempo, temp.frame(), false),
+ : ArdourMarker (editor, parent, rgba, text, Tempo, temp.sample(), false),
_tempo (temp)
{
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_tempo_marker_event), group, this));
@@ -584,7 +584,7 @@ TempoMarker::update_height_mark (const double ratio)
MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text,
ARDOUR::MeterSection& m)
- : ArdourMarker (editor, parent, rgba, text, Meter, m.frame(), false),
+ : ArdourMarker (editor, parent, rgba, text, Meter, m.sample(), false),
_meter (m)
{
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_meter_marker_event), group, this));
diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h
index 391653f090..443a3646b7 100644
--- a/gtk2_ardour/marker.h
+++ b/gtk2_ardour/marker.h
@@ -61,7 +61,7 @@ public:
ArdourMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Type,
- framepos_t frame = 0, bool handle_events = true);
+ samplepos_t sample = 0, bool handle_events = true);
virtual ~ArdourMarker ();
@@ -75,13 +75,13 @@ public:
void set_show_line (bool);
void canvas_height_set (double);
- void set_position (framepos_t);
+ void set_position (samplepos_t);
void set_name (const std::string&);
void set_points_color (uint32_t rgba);
void set_color_rgba (uint32_t rgba);
void setup_line ();
- framepos_t position() const { return frame_position; }
+ samplepos_t position() const { return sample_position; }
ArdourCanvas::Container * get_parent() { return _parent; }
void reparent (ArdourCanvas::Container & parent);
@@ -115,7 +115,7 @@ protected:
std::string _name;
double unit_position;
- framepos_t frame_position;
+ samplepos_t sample_position;
double _shift;
Type _type;
int name_height;
diff --git a/gtk2_ardour/marker_selection.h b/gtk2_ardour/marker_selection.h
index 1b322d0885..8633685325 100644
--- a/gtk2_ardour/marker_selection.h
+++ b/gtk2_ardour/marker_selection.h
@@ -27,7 +27,7 @@
class MarkerSelection : public std::list<ArdourMarker*>
{
public:
- void range (ARDOUR::framepos_t& start, ARDOUR::framepos_t& end);
+ void range (ARDOUR::samplepos_t& start, ARDOUR::samplepos_t& end);
};
#endif /* __ardour_gtk_marker_selection_h__ */
diff --git a/gtk2_ardour/midi_automation_line.cc b/gtk2_ardour/midi_automation_line.cc
index 9a40ebbac3..6f86efbea6 100644
--- a/gtk2_ardour/midi_automation_line.cc
+++ b/gtk2_ardour/midi_automation_line.cc
@@ -36,7 +36,7 @@ MidiAutomationLine::MidiAutomationLine (
boost::shared_ptr<ARDOUR::AutomationList> list,
boost::shared_ptr<ARDOUR::MidiRegion> region,
Evoral::Parameter parameter,
- Evoral::TimeConverter<double, ARDOUR::framepos_t>* converter)
+ Evoral::TimeConverter<double, ARDOUR::samplepos_t>* converter)
: AutomationLine (name, tav, parent, list, parameter, converter)
, _region (region)
, _parameter (parameter)
diff --git a/gtk2_ardour/midi_automation_line.h b/gtk2_ardour/midi_automation_line.h
index e0da2a00d7..dd5b229dd2 100644
--- a/gtk2_ardour/midi_automation_line.h
+++ b/gtk2_ardour/midi_automation_line.h
@@ -33,7 +33,7 @@ public:
boost::shared_ptr<ARDOUR::AutomationList>,
boost::shared_ptr<ARDOUR::MidiRegion>,
Evoral::Parameter,
- Evoral::TimeConverter<double, ARDOUR::framepos_t>* converter = 0);
+ Evoral::TimeConverter<double, ARDOUR::samplepos_t>* converter = 0);
MementoCommandBinder<ARDOUR::AutomationList>* memento_command_binder ();
diff --git a/gtk2_ardour/midi_list_editor.cc b/gtk2_ardour/midi_list_editor.cc
index b6100aa552..4c0903fddd 100644
--- a/gtk2_ardour/midi_list_editor.cc
+++ b/gtk2_ardour/midi_list_editor.cc
@@ -24,7 +24,7 @@
#include "evoral/midi_util.h"
#include "evoral/Note.hpp"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/midi_model.h"
#include "ardour/midi_region.h"
#include "ardour/midi_source.h"
@@ -759,7 +759,7 @@ MidiListEditor::redisplay_model ()
if (_session) {
- BeatsFramesConverter conv (_session->tempo_map(), region->position());
+ BeatsSamplesConverter conv (_session->tempo_map(), region->position());
MidiModel::Notes notes = region->midi_source(0)->model()->notes();
TreeModel::Row row;
stringstream ss;
@@ -771,7 +771,7 @@ MidiListEditor::redisplay_model ()
row[columns.note] = (*i)->note();
row[columns.velocity] = (*i)->velocity();
- Timecode::BBT_Time bbt (_session->tempo_map().bbt_at_frame (region->position() + conv.to ((*i)->time())));
+ Timecode::BBT_Time bbt (_session->tempo_map().bbt_at_sample (region->position() + conv.to ((*i)->time())));
ss.str ("");
ss << bbt;
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index a8124a9675..c751c5f58b 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -269,7 +269,7 @@ MidiRegionView::init (bool wfd)
_model = midi_region()->midi_source(0)->model();
_enable_display = false;
- fill_color_name = "midi frame base";
+ fill_color_name = "midi sample base";
RegionView::init (false);
@@ -416,8 +416,8 @@ MidiRegionView::leave_notify (GdkEventCrossing*)
void
MidiRegionView::mouse_mode_changed ()
{
- // Adjust frame colour (become more transparent for internal tools)
- set_frame_color();
+ // Adjust sample colour (become more transparent for internal tools)
+ set_sample_color();
if (_entered) {
if (!trackview.editor().internal_editing()) {
@@ -457,12 +457,12 @@ MidiRegionView::enter_internal (uint32_t state)
_grabbed_keyboard = true;
}
- // Lower frame handles below notes so they don't steal events
- if (frame_handle_start) {
- frame_handle_start->lower_to_bottom();
+ // Lower sample handles below notes so they don't steal events
+ if (sample_handle_start) {
+ sample_handle_start->lower_to_bottom();
}
- if (frame_handle_end) {
- frame_handle_end->lower_to_bottom();
+ if (sample_handle_end) {
+ sample_handle_end->lower_to_bottom();
}
}
@@ -478,12 +478,12 @@ MidiRegionView::leave_internal()
_grabbed_keyboard = false;
}
- // Raise frame handles above notes so they catch events
- if (frame_handle_start) {
- frame_handle_start->raise_to_top();
+ // Raise sample handles above notes so they catch events
+ if (sample_handle_start) {
+ sample_handle_start->raise_to_top();
}
- if (frame_handle_end) {
- frame_handle_end->raise_to_top();
+ if (sample_handle_end) {
+ sample_handle_end->raise_to_top();
}
}
@@ -917,13 +917,13 @@ MidiRegionView::show_list_editor ()
}
/** Add a note to the model, and the view, at a canvas (click) coordinate.
- * \param t time in frames relative to the position of the region
+ * \param t time in samples relative to the position of the region
* \param y vertical position in pixels
* \param length duration of the note in beats
* \param snap_t true to snap t to the grid, otherwise false.
*/
void
-MidiRegionView::create_note_at (framepos_t t, double y, Evoral::Beats length, uint32_t state, bool shift_snap)
+MidiRegionView::create_note_at (samplepos_t t, double y, Evoral::Beats length, uint32_t state, bool shift_snap)
{
if (length < 2 * DBL_EPSILON) {
return;
@@ -937,9 +937,9 @@ MidiRegionView::create_note_at (framepos_t t, double y, Evoral::Beats length, ui
return;
}
- // Start of note in frames relative to region start
+ // Start of note in samples relative to region start
const int32_t divisions = trackview.editor().get_grid_music_divisions (state);
- Evoral::Beats beat_time = snap_frame_to_grid_underneath (t, divisions, shift_snap);
+ Evoral::Beats beat_time = snap_sample_to_grid_underneath (t, divisions, shift_snap);
const double note = view->y_to_note(y);
const uint8_t chan = mtv->get_channel_for_add();
@@ -1175,7 +1175,7 @@ MidiRegionView::redisplay_model()
{
if (_active_notes) {
// Currently recording
- const framecnt_t zoom = trackview.editor().get_current_zoom();
+ const samplecnt_t zoom = trackview.editor().get_current_zoom();
if (zoom != _last_display_zoom) {
/* Update resolved canvas notes to reflect changes in zoom without
touching model. Leave active notes (with length 0) alone since
@@ -1331,12 +1331,12 @@ MidiRegionView::display_patch_changes_on_channel (uint8_t channel, bool active_c
if ((p = find_canvas_patch_change (*i)) != 0) {
- const framecnt_t region_frames = source_beats_to_region_frames ((*i)->time());
+ const samplecnt_t region_samples = source_beats_to_region_samples ((*i)->time());
- if (region_frames < 0 || region_frames >= _region->length()) {
+ if (region_samples < 0 || region_samples >= _region->length()) {
p->hide();
} else {
- const double x = trackview.editor().sample_to_pixel (region_frames);
+ const double x = trackview.editor().sample_to_pixel (region_samples);
const string patch_name = instrument_info().get_patch_name ((*i)->bank(), (*i)->program(), channel);
p->canvas_item()->set_position (ArdourCanvas::Duple (x, 1.0));
p->set_text (patch_name);
@@ -1367,14 +1367,14 @@ MidiRegionView::display_sysexes()
}
if (have_periodic_system_messages) {
- double zoom = trackview.editor().get_current_zoom (); // frames per pixel
+ double zoom = trackview.editor().get_current_zoom (); // samples per pixel
/* get an approximate value for the number of samples per video frame */
- double video_frame = trackview.session()->frame_rate() * (1.0/30);
+ double video_frame = trackview.session()->sample_rate() * (1.0/30);
/* if we are zoomed out beyond than the cutoff (i.e. more
- * frames per pixel than frames per 4 video frames), don't
+ * samples per pixel than samples per 4 video frames), don't
* show periodic sysex messages.
*/
@@ -1406,7 +1406,7 @@ MidiRegionView::display_sysexes()
}
string text = str.str();
- const double x = trackview.editor().sample_to_pixel(source_beats_to_region_frames(time));
+ const double x = trackview.editor().sample_to_pixel(source_beats_to_region_samples(time));
double height = midi_stream_view()->contents_height();
@@ -1424,7 +1424,7 @@ MidiRegionView::display_sysexes()
}
// Show unless message is beyond the region bounds
-// XXX REQUIRES APPROPRIATE OPERATORS FOR Evoral::Beats and framepos? say what?
+// XXX REQUIRES APPROPRIATE OPERATORS FOR Evoral::Beats and samplepos? say what?
#warning paul fix this
// if (time - _region->start() >= _region->length() || time < _region->start()) {
// sysex->hide();
@@ -1623,9 +1623,9 @@ MidiRegionView::resolve_note(uint8_t note, Evoral::Beats end_time)
end_time - _active_notes[note]->note()->time());
/* End time is relative to the region being recorded. */
- const framepos_t end_time_frames = region_beats_to_region_frames(end_time);
+ const samplepos_t end_time_samples = region_beats_to_region_samples(end_time);
- _active_notes[note]->set_x1 (trackview.editor().sample_to_pixel(end_time_frames));
+ _active_notes[note]->set_x1 (trackview.editor().sample_to_pixel(end_time_samples));
_active_notes[note]->set_outline_all ();
_active_notes[note] = 0;
}
@@ -1738,9 +1738,9 @@ MidiRegionView::update_sustained (Note* ev, bool update_ghost_regions)
boost::shared_ptr<NoteType> note = ev->note();
const double session_source_start = _region->quarter_note() - mr->start_beats();
- const framepos_t note_start_frames = map.frame_at_quarter_note (note->time().to_double() + session_source_start) - _region->position();
+ const samplepos_t note_start_samples = map.sample_at_quarter_note (note->time().to_double() + session_source_start) - _region->position();
- const double x0 = trackview.editor().sample_to_pixel (note_start_frames);
+ const double x0 = trackview.editor().sample_to_pixel (note_start_samples);
double x1;
const double y0 = 1 + floor(note_to_y(note->note()));
double y1;
@@ -1753,9 +1753,9 @@ MidiRegionView::update_sustained (Note* ev, bool update_ghost_regions)
note_end_time = mr->start_beats() + mr->length_beats();
}
- const framepos_t note_end_frames = map.frame_at_quarter_note (session_source_start + note_end_time) - _region->position();
+ const samplepos_t note_end_samples = map.sample_at_quarter_note (session_source_start + note_end_time) - _region->position();
- x1 = std::max(1., trackview.editor().sample_to_pixel (note_end_frames)) - 1;
+ x1 = std::max(1., trackview.editor().sample_to_pixel (note_end_samples)) - 1;
} else {
x1 = std::max(1., trackview.editor().sample_to_pixel (_region->length())) - 1;
}
@@ -1798,9 +1798,9 @@ MidiRegionView::update_hit (Hit* ev, bool update_ghost_regions)
boost::shared_ptr<NoteType> note = ev->note();
const double note_time_qn = note->time().to_double() + (_region->quarter_note() - midi_region()->start_beats());
- const framepos_t note_start_frames = trackview.session()->tempo_map().frame_at_quarter_note (note_time_qn) - _region->position();
+ const samplepos_t note_start_samples = trackview.session()->tempo_map().sample_at_quarter_note (note_time_qn) - _region->position();
- const double x = trackview.editor().sample_to_pixel(note_start_frames);
+ const double x = trackview.editor().sample_to_pixel(note_start_samples);
const double diamond_size = std::max(1., floor(note_height()) - 2.);
const double y = 1.5 + floor(note_to_y(note->note())) + diamond_size * .5;
@@ -1896,12 +1896,12 @@ MidiRegionView::step_add_note (uint8_t channel, uint8_t number, uint8_t velocity
/* potentially extend region to hold new note */
- framepos_t end_frame = source_beats_to_absolute_frames (new_note->end_time());
- framepos_t region_end = _region->last_frame();
+ samplepos_t end_sample = source_beats_to_absolute_samples (new_note->end_time());
+ samplepos_t region_end = _region->last_sample();
- if (end_frame > region_end) {
+ if (end_sample > region_end) {
/* XX sets length in beats from audio space. make musical */
- _region->set_length (end_frame - _region->position(), 0);
+ _region->set_length (end_sample - _region->position(), 0);
}
MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
@@ -1935,8 +1935,8 @@ MidiRegionView::step_sustain (Evoral::Beats beats)
void
MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool /*active_channel*/)
{
- framecnt_t region_frames = source_beats_to_region_frames (patch->time());
- const double x = trackview.editor().sample_to_pixel (region_frames);
+ samplecnt_t region_samples = source_beats_to_region_samples (patch->time());
+ const double x = trackview.editor().sample_to_pixel (region_samples);
double const height = midi_stream_view()->contents_height();
@@ -1957,7 +1957,7 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const
if (patch_change->item().width() < _pixel_width) {
// Show unless patch change is beyond the region bounds
- if (region_frames < 0 || region_frames >= _region->length()) {
+ if (region_samples < 0 || region_samples >= _region->length()) {
patch_change->hide();
} else {
patch_change->show();
@@ -2077,12 +2077,12 @@ MidiRegionView::change_patch_change (MidiModel::PatchChangePtr old_change, const
}
/** Add a patch change to the region.
- * @param t Time in frames relative to region position
+ * @param t Time in samples relative to region position
* @param patch Patch to add; time and channel are ignored (time is converted from t, and channel comes from
* MidiTimeAxisView::get_channel_for_add())
*/
void
-MidiRegionView::add_patch_change (framecnt_t t, Evoral::PatchChange<Evoral::Beats> const & patch)
+MidiRegionView::add_patch_change (samplecnt_t t, Evoral::PatchChange<Evoral::Beats> const & patch)
{
string name = _("add patch change");
@@ -2090,7 +2090,7 @@ MidiRegionView::add_patch_change (framecnt_t t, Evoral::PatchChange<Evoral::Beat
MidiModel::PatchChangeDiffCommand* c = _model->new_patch_change_diff_command (name);
c->add (MidiModel::PatchChangePtr (
new Evoral::PatchChange<Evoral::Beats> (
- absolute_frames_to_source_beats (_region->position() + t),
+ absolute_samples_to_source_beats (_region->position() + t),
patch.channel(), patch.program(), patch.bank()
)
)
@@ -2242,12 +2242,12 @@ MidiRegionView::select_all_notes ()
}
void
-MidiRegionView::select_range (framepos_t start, framepos_t end)
+MidiRegionView::select_range (samplepos_t start, samplepos_t end)
{
clear_editor_note_selection ();
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
- framepos_t t = source_beats_to_absolute_frames(i->first->time());
+ samplepos_t t = source_beats_to_absolute_samples(i->first->time());
if (t >= start && t <= end) {
add_to_selection (i->second);
}
@@ -2436,15 +2436,15 @@ MidiRegionView::note_deselected(NoteBase* ev)
}
void
-MidiRegionView::update_drag_selection(framepos_t start, framepos_t end, double gy0, double gy1, bool extend)
+MidiRegionView::update_drag_selection(samplepos_t start, samplepos_t end, double gy0, double gy1, bool extend)
{
PublicEditor& editor = trackview.editor();
// Convert to local coordinates
- const framepos_t p = _region->position();
+ const samplepos_t p = _region->position();
const double y = midi_view()->y_position();
- const double x0 = editor.sample_to_pixel(max((framepos_t)0, start - p));
- const double x1 = editor.sample_to_pixel(max((framepos_t)0, end - p));
+ const double x0 = editor.sample_to_pixel(max((samplepos_t)0, start - p));
+ const double x1 = editor.sample_to_pixel(max((samplepos_t)0, end - p));
const double y0 = max(0.0, gy0 - y);
const double y1 = max(0.0, gy1 - y);
@@ -2581,13 +2581,13 @@ MidiRegionView::move_selection(double dx_qn, double dy, double cumulative_dy)
double const note_time_qn = session_relative_qn (n->note()->time().to_double());
double dx = 0.0;
if (midi_view()->note_mode() == Sustained) {
- dx = editor->sample_to_pixel_unrounded (tmap.frame_at_quarter_note (note_time_qn + dx_qn))
+ dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn))
- n->item()->item_to_canvas (ArdourCanvas::Duple (n->x0(), 0)).x;
} else {
/* Hit::x0() is offset by _position.x, unlike Note::x0() */
Hit* hit = dynamic_cast<Hit*>(n);
if (hit) {
- dx = editor->sample_to_pixel_unrounded (tmap.frame_at_quarter_note (note_time_qn + dx_qn))
+ dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn))
- n->item()->item_to_canvas (ArdourCanvas::Duple (((hit->x0() + hit->x1()) / 2.0) - hit->position().x, 0)).x;
}
}
@@ -2598,7 +2598,7 @@ MidiRegionView::move_selection(double dx_qn, double dy, double cumulative_dy)
if (midi_view()->note_mode() == Sustained) {
Note* sus = dynamic_cast<Note*> (*i);
double const len_dx = editor->sample_to_pixel_unrounded (
- tmap.frame_at_quarter_note (note_time_qn + dx_qn + n->note()->length().to_double()));
+ tmap.sample_at_quarter_note (note_time_qn + dx_qn + n->note()->length().to_double()));
sus->set_x1 (n->item()->canvas_to_item (ArdourCanvas::Duple (len_dx, 0)).x);
}
@@ -2678,12 +2678,12 @@ MidiRegionView::move_copies (double dx_qn, double dy, double cumulative_dy)
double const note_time_qn = session_relative_qn (n->note()->time().to_double());
double dx = 0.0;
if (midi_view()->note_mode() == Sustained) {
- dx = editor->sample_to_pixel_unrounded (tmap.frame_at_quarter_note (note_time_qn + dx_qn))
+ dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn))
- n->item()->item_to_canvas (ArdourCanvas::Duple (n->x0(), 0)).x;
} else {
Hit* hit = dynamic_cast<Hit*>(n);
if (hit) {
- dx = editor->sample_to_pixel_unrounded (tmap.frame_at_quarter_note (note_time_qn + dx_qn))
+ dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn))
- n->item()->item_to_canvas (ArdourCanvas::Duple (((hit->x0() + hit->x1()) / 2.0) - hit->position().x, 0)).x;
}
}
@@ -2693,7 +2693,7 @@ MidiRegionView::move_copies (double dx_qn, double dy, double cumulative_dy)
if (midi_view()->note_mode() == Sustained) {
Note* sus = dynamic_cast<Note*> (*i);
double const len_dx = editor->sample_to_pixel_unrounded (
- tmap.frame_at_quarter_note (note_time_qn + dx_qn + n->note()->length().to_double()));
+ tmap.sample_at_quarter_note (note_time_qn + dx_qn + n->note()->length().to_double()));
sus->set_x1 (n->item()->canvas_to_item (ArdourCanvas::Duple (len_dx, 0)).x);
}
@@ -2837,13 +2837,13 @@ MidiRegionView::note_dropped(NoteBase *, double d_qn, int8_t dnote, bool copy)
/** @param x Pixel relative to the region position.
* @param ensure_snap defaults to false. true = snap always, ignoring snap mode and magnetic snap.
* Used for inverting the snap logic with key modifiers and snap delta calculation.
- * @return Snapped frame relative to the region position.
+ * @return Snapped sample relative to the region position.
*/
-framepos_t
+samplepos_t
MidiRegionView::snap_pixel_to_sample(double x, bool ensure_snap)
{
PublicEditor& editor (trackview.editor());
- return snap_frame_to_frame (editor.pixel_to_sample (x), ensure_snap).frame;
+ return snap_sample_to_sample (editor.pixel_to_sample (x), ensure_snap).sample;
}
/** @param x Pixel relative to the region position.
@@ -2859,55 +2859,55 @@ MidiRegionView::snap_to_pixel(double x, bool ensure_snap)
double
MidiRegionView::get_position_pixels()
{
- framepos_t region_frame = get_position();
- return trackview.editor().sample_to_pixel(region_frame);
+ samplepos_t region_sample = get_position();
+ return trackview.editor().sample_to_pixel(region_sample);
}
double
MidiRegionView::get_end_position_pixels()
{
- framepos_t frame = get_position() + get_duration ();
- return trackview.editor().sample_to_pixel(frame);
+ samplepos_t sample = get_position() + get_duration ();
+ return trackview.editor().sample_to_pixel(sample);
}
-framepos_t
-MidiRegionView::source_beats_to_absolute_frames(Evoral::Beats beats) const
+samplepos_t
+MidiRegionView::source_beats_to_absolute_samples(Evoral::Beats beats) const
{
- /* the time converter will return the frame corresponding to `beats'
+ /* the time converter will return the sample corresponding to `beats'
relative to the start of the source. The start of the source
is an implied position given by region->position - region->start
*/
- const framepos_t source_start = _region->position() - _region->start();
+ const samplepos_t source_start = _region->position() - _region->start();
return source_start + _source_relative_time_converter.to (beats);
}
Evoral::Beats
-MidiRegionView::absolute_frames_to_source_beats(framepos_t frames) const
+MidiRegionView::absolute_samples_to_source_beats(samplepos_t samples) const
{
- /* the `frames' argument needs to be converted into a frame count
+ /* the `samples' argument needs to be converted into a sample count
relative to the start of the source before being passed in to the
converter.
*/
- const framepos_t source_start = _region->position() - _region->start();
- return _source_relative_time_converter.from (frames - source_start);
+ const samplepos_t source_start = _region->position() - _region->start();
+ return _source_relative_time_converter.from (samples - source_start);
}
-framepos_t
-MidiRegionView::region_beats_to_region_frames(Evoral::Beats beats) const
+samplepos_t
+MidiRegionView::region_beats_to_region_samples(Evoral::Beats beats) const
{
return _region_relative_time_converter.to(beats);
}
Evoral::Beats
-MidiRegionView::region_frames_to_region_beats(framepos_t frames) const
+MidiRegionView::region_samples_to_region_beats(samplepos_t samples) const
{
- return _region_relative_time_converter.from(frames);
+ return _region_relative_time_converter.from(samples);
}
double
-MidiRegionView::region_frames_to_region_beats_double (framepos_t frames) const
+MidiRegionView::region_samples_to_region_beats_double (samplepos_t samples) const
{
- return _region_relative_time_converter_double.from(frames);
+ return _region_relative_time_converter_double.from(samples);
}
void
@@ -2988,7 +2988,7 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
}
if (current_x < 0) {
- // This works even with snapping because RegionView::snap_frame_to_frame()
+ // This works even with snapping because RegionView::snap_sample_to_sample()
// snaps forward if the snapped sample is before the beginning of the region
current_x = 0;
}
@@ -3014,15 +3014,15 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
if (!cursor_set) {
/* Convert snap delta from pixels to beats. */
- framepos_t snap_delta_samps = trackview.editor().pixel_to_sample (snap_delta);
+ samplepos_t snap_delta_samps = trackview.editor().pixel_to_sample (snap_delta);
double snap_delta_beats = 0.0;
int sign = 1;
/* negative beat offsets aren't allowed */
if (snap_delta_samps > 0) {
- snap_delta_beats = region_frames_to_region_beats_double (snap_delta_samps);
+ snap_delta_beats = region_samples_to_region_beats_double (snap_delta_samps);
} else if (snap_delta_samps < 0) {
- snap_delta_beats = region_frames_to_region_beats_double ( - snap_delta_samps);
+ snap_delta_beats = region_samples_to_region_beats_double ( - snap_delta_samps);
sign = -1;
}
@@ -3035,7 +3035,7 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
} else {
snapped_x = trackview.editor ().pixel_to_sample (current_x);
}
- const Evoral::Beats beats = Evoral::Beats (tmap.exact_beat_at_frame (snapped_x + midi_region()->position(), divisions)
+ const Evoral::Beats beats = Evoral::Beats (tmap.exact_beat_at_sample (snapped_x + midi_region()->position(), divisions)
- midi_region()->beat()) + midi_region()->start_beats();
Evoral::Beats len = Evoral::Beats();
@@ -3108,20 +3108,20 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
}
/* Convert snap delta from pixels to beats with sign. */
- framepos_t snap_delta_samps = trackview.editor().pixel_to_sample (snap_delta);
+ samplepos_t snap_delta_samps = trackview.editor().pixel_to_sample (snap_delta);
double snap_delta_beats = 0.0;
int sign = 1;
if (snap_delta_samps > 0) {
- snap_delta_beats = region_frames_to_region_beats_double (snap_delta_samps);
+ snap_delta_beats = region_samples_to_region_beats_double (snap_delta_samps);
} else if (snap_delta_samps < 0) {
- snap_delta_beats = region_frames_to_region_beats_double ( - snap_delta_samps);
+ snap_delta_beats = region_samples_to_region_beats_double ( - snap_delta_samps);
sign = -1;
}
uint32_t divisions = 0;
- /* Convert the new x position to a frame within the source */
- framepos_t current_fr;
+ /* Convert the new x position to a sample within the source */
+ samplepos_t current_fr;
if (with_snap) {
current_fr = snap_pixel_to_sample (current_x, ensure_snap);
divisions = trackview.editor().get_grid_music_divisions (0);
@@ -3130,7 +3130,7 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_
}
/* and then to beats */
- const double e_qaf = tmap.exact_qn_at_frame (current_fr + midi_region()->position(), divisions);
+ const double e_qaf = tmap.exact_qn_at_sample (current_fr + midi_region()->position(), divisions);
const double quarter_note_start = _region->quarter_note() - midi_region()->start_beats();
const Evoral::Beats x_beats = Evoral::Beats (e_qaf - quarter_note_start);
@@ -3475,41 +3475,41 @@ MidiRegionView::nudge_notes (bool forward, bool fine)
into a vector and sort before using the first one.
*/
- const framepos_t ref_point = source_beats_to_absolute_frames ((*(_selection.begin()))->note()->time());
+ const samplepos_t ref_point = source_beats_to_absolute_samples ((*(_selection.begin()))->note()->time());
Evoral::Beats delta;
if (!fine) {
/* non-fine, move by 1 bar regardless of snap */
- delta = Evoral::Beats(trackview.session()->tempo_map().meter_at_frame (ref_point).divisions_per_bar());
+ delta = Evoral::Beats(trackview.session()->tempo_map().meter_at_sample (ref_point).divisions_per_bar());
} else if (trackview.editor().snap_mode() == Editing::SnapOff) {
/* grid is off - use nudge distance */
- framepos_t unused;
- const framecnt_t distance = trackview.editor().get_nudge_distance (ref_point, unused);
- delta = region_frames_to_region_beats (fabs ((double)distance));
+ samplepos_t unused;
+ const samplecnt_t distance = trackview.editor().get_nudge_distance (ref_point, unused);
+ delta = region_samples_to_region_beats (fabs ((double)distance));
} else {
/* use grid */
- MusicFrame next_pos (ref_point, 0);
+ MusicSample next_pos (ref_point, 0);
if (forward) {
- if (max_framepos - 1 < next_pos.frame) {
- next_pos.frame += 1;
+ if (max_samplepos - 1 < next_pos.sample) {
+ next_pos.sample += 1;
}
} else {
- if (next_pos.frame == 0) {
+ if (next_pos.sample == 0) {
return;
}
- next_pos.frame -= 1;
+ next_pos.sample -= 1;
}
trackview.editor().snap_to (next_pos, (forward ? RoundUpAlways : RoundDownAlways), false);
- const framecnt_t distance = ref_point - next_pos.frame;
- delta = region_frames_to_region_beats (fabs ((double)distance));
+ const samplecnt_t distance = ref_point - next_pos.sample;
+ delta = region_samples_to_region_beats (fabs ((double)distance));
}
if (!delta) {
@@ -3643,12 +3643,12 @@ MidiRegionView::get_fill_color() const
{
const std::string mod_name = (_dragging ? "dragging region" :
trackview.editor().internal_editing() ? "editable region" :
- "midi frame base");
+ "midi sample base");
if (_selected) {
return UIConfiguration::instance().color_mod ("selected region base", mod_name);
} else if ((!UIConfiguration::instance().get_show_name_highlight() || high_enough_for_name) &&
!UIConfiguration::instance().get_color_regions_using_track_color()) {
- return UIConfiguration::instance().color_mod ("midi frame base", mod_name);
+ return UIConfiguration::instance().color_mod ("midi sample base", mod_name);
}
return UIConfiguration::instance().color_mod (fill_color, mod_name);
}
@@ -3738,7 +3738,7 @@ MidiRegionView::selection_as_cut_buffer () const
/** This method handles undo */
bool
-MidiRegionView::paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t sub_num)
+MidiRegionView::paste (samplepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t sub_num)
{
bool commit = false;
// Paste notes, if available
@@ -3771,7 +3771,7 @@ MidiRegionView::paste (framepos_t pos, const ::Selection& selection, PasteContex
/** This method handles undo */
void
-MidiRegionView::paste_internal (framepos_t pos, unsigned paste_count, float times, const MidiCutBuffer& mcb)
+MidiRegionView::paste_internal (samplepos_t pos, unsigned paste_count, float times, const MidiCutBuffer& mcb)
{
if (mcb.empty()) {
return;
@@ -3785,7 +3785,7 @@ MidiRegionView::paste_internal (framepos_t pos, unsigned paste_count, float time
const Evoral::Beats duration = last_time - first_time;
const Evoral::Beats snap_duration = duration.snap_to(snap_beats);
const Evoral::Beats paste_offset = snap_duration * paste_count;
- const Evoral::Beats quarter_note = absolute_frames_to_source_beats(pos) + paste_offset;
+ const Evoral::Beats quarter_note = absolute_samples_to_source_beats(pos) + paste_offset;
Evoral::Beats end_point = Evoral::Beats();
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("Paste data spans from %1 to %2 (%3) ; paste pos beats = %4 (based on %5 - %6)\n",
@@ -3813,16 +3813,16 @@ MidiRegionView::paste_internal (framepos_t pos, unsigned paste_count, float time
/* if we pasted past the current end of the region, extend the region */
- framepos_t end_frame = source_beats_to_absolute_frames (end_point);
- framepos_t region_end = _region->position() + _region->length() - 1;
+ samplepos_t end_sample = source_beats_to_absolute_samples (end_point);
+ samplepos_t region_end = _region->position() + _region->length() - 1;
- if (end_frame > region_end) {
+ if (end_sample > region_end) {
- DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("Paste extended region from %1 to %2\n", region_end, end_frame));
+ DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("Paste extended region from %1 to %2\n", region_end, end_sample));
_region->clear_changes ();
/* we probably need to get the snap modifier somehow to make this correct for non-musical use */
- _region->set_length (end_frame - _region->position(), trackview.editor().get_grid_music_divisions (0));
+ _region->set_length (end_sample - _region->position(), trackview.editor().get_grid_music_divisions (0));
trackview.session()->add_command (new StatefulDiffCommand (_region));
}
@@ -3959,11 +3959,11 @@ MidiRegionView::update_ghost_note (double x, double y, uint32_t state)
PublicEditor& editor = trackview.editor ();
- framepos_t const unsnapped_frame = editor.pixel_to_sample (x);
+ samplepos_t const unsnapped_sample = editor.pixel_to_sample (x);
const int32_t divisions = editor.get_grid_music_divisions (state);
const bool shift_snap = midi_view()->note_mode() != Percussive;
- const Evoral::Beats snapped_beats = snap_frame_to_grid_underneath (unsnapped_frame, divisions, shift_snap);
+ const Evoral::Beats snapped_beats = snap_sample_to_grid_underneath (unsnapped_sample, divisions, shift_snap);
/* prevent Percussive mode from displaying a ghost hit at region end */
if (!shift_snap && snapped_beats >= midi_region()->start_beats() + midi_region()->length_beats()) {
@@ -3982,7 +3982,7 @@ MidiRegionView::update_ghost_note (double x, double y, uint32_t state)
}
/* calculate time in beats relative to start of source */
- const Evoral::Beats length = get_grid_beats(unsnapped_frame + _region->position());
+ const Evoral::Beats length = get_grid_beats(unsnapped_sample + _region->position());
_ghost_note->note()->set_time (snapped_beats);
_ghost_note->note()->set_length (length);
@@ -4128,7 +4128,7 @@ MidiRegionView::move_step_edit_cursor (Evoral::Beats pos)
_step_edit_cursor_position = pos;
if (_step_edit_cursor) {
- double pixel = trackview.editor().sample_to_pixel (region_beats_to_region_frames (pos));
+ double pixel = trackview.editor().sample_to_pixel (region_beats_to_region_samples (pos));
_step_edit_cursor->set_x0 (pixel);
set_step_edit_cursor_width (_step_edit_cursor_width);
}
@@ -4149,8 +4149,8 @@ MidiRegionView::set_step_edit_cursor_width (Evoral::Beats beats)
if (_step_edit_cursor) {
_step_edit_cursor->set_x1 (_step_edit_cursor->x0() + trackview.editor().sample_to_pixel (
- region_beats_to_region_frames (_step_edit_cursor_position + beats)
- - region_beats_to_region_frames (_step_edit_cursor_position)));
+ region_beats_to_region_samples (_step_edit_cursor_position + beats)
+ - region_beats_to_region_samples (_step_edit_cursor_position)));
}
}
@@ -4175,7 +4175,7 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w)
boost::shared_ptr<MidiBuffer> buf = mtv->midi_track()->get_gui_feed_buffer ();
- framepos_t back = max_framepos;
+ samplepos_t back = max_samplepos;
for (MidiBuffer::iterator i = buf->begin(); i != buf->end(); ++i) {
const Evoral::Event<MidiBuffer::TimeType>& ev = *i;
@@ -4188,7 +4188,7 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w)
}
}
- /* convert from session frames to source beats */
+ /* convert from session samples to source beats */
Evoral::Beats const time_beats = _source_relative_time_converter.from(
ev.time() - src->timeline_position() + _region->start());
@@ -4348,19 +4348,19 @@ MidiRegionView::get_velocity_for_add (MidiModel::TimeType time) const
return (*n)->velocity() + (frac * ((*m)->velocity() - (*n)->velocity()));
}
-/** @param p A session framepos.
+/** @param p A session samplepos.
* @param divisions beat division to snap given by Editor::get_grid_music_divisions() where
* bar is -1, 0 is audio samples and a positive integer is beat subdivisions.
* @return beat duration of p snapped to the grid subdivision underneath it.
*/
Evoral::Beats
-MidiRegionView::snap_frame_to_grid_underneath (framepos_t p, int32_t divisions, bool shift_snap) const
+MidiRegionView::snap_sample_to_grid_underneath (samplepos_t p, int32_t divisions, bool shift_snap) const
{
TempoMap& map (trackview.session()->tempo_map());
- double eqaf = map.exact_qn_at_frame (p + _region->position(), divisions);
+ double eqaf = map.exact_qn_at_sample (p + _region->position(), divisions);
if (divisions != 0 && shift_snap) {
- const double qaf = map.quarter_note_at_frame (p + _region->position());
+ const double qaf = map.quarter_note_at_sample (p + _region->position());
/* Hack so that we always snap to the note that we are over, instead of snapping
to the next one if we're more than halfway through the one we're over.
*/
@@ -4391,7 +4391,7 @@ MidiRegionView::get_selected_channels () const
Evoral::Beats
-MidiRegionView::get_grid_beats(framepos_t pos) const
+MidiRegionView::get_grid_beats(samplepos_t pos) const
{
PublicEditor& editor = trackview.editor();
bool success = false;
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index 20a1ee5b25..d08e0177b7 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -122,8 +122,8 @@ public:
void resolve_note(uint8_t note_num, Evoral::Beats end_time);
void cut_copy_clear (Editing::CutCopyOp);
- bool paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t sub_num);
- void paste_internal (framepos_t pos, unsigned paste_count, float times, const MidiCutBuffer&);
+ bool paste (samplepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t sub_num);
+ void paste_internal (samplepos_t pos, unsigned paste_count, float times, const MidiCutBuffer&);
void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext, bool);
void remove_canvas_patch_change (PatchChange* pc);
@@ -147,7 +147,7 @@ public:
void change_patch_change (PatchChange& old_patch, const MIDI::Name::PatchPrimaryKey& new_patch);
void change_patch_change (ARDOUR::MidiModel::PatchChangePtr, Evoral::PatchChange<Evoral::Beats> const &);
- void add_patch_change (framecnt_t, Evoral::PatchChange<Evoral::Beats> const &);
+ void add_patch_change (samplecnt_t, Evoral::PatchChange<Evoral::Beats> const &);
void move_patch_change (PatchChange &, Evoral::Beats);
void delete_patch_change (PatchChange *);
void edit_patch_change (PatchChange *);
@@ -197,7 +197,7 @@ public:
void delete_note (boost::shared_ptr<NoteType>);
size_t selection_size() { return _selection.size(); }
void select_all_notes ();
- void select_range(framepos_t start, framepos_t end);
+ void select_range(samplepos_t start, samplepos_t end);
void invert_selection ();
Evoral::Beats earliest_in_selection ();
@@ -259,42 +259,42 @@ public:
*/
double snap_to_pixel(double x, bool ensure_snap = false);
- /** Snap a region relative pixel coordinate to frame units.
+ /** Snap a region relative pixel coordinate to sample units.
* @param x a pixel coordinate relative to region start
* @param ensure_snap ignore SnapOff and magnetic snap.
* Required for inverting snap logic with modifier keys and snap delta calculation.
- * @return the snapped framepos_t coordinate relative to region start
+ * @return the snapped samplepos_t coordinate relative to region start
*/
- framepos_t snap_pixel_to_sample(double x, bool ensure_snap = false);
+ samplepos_t snap_pixel_to_sample(double x, bool ensure_snap = false);
- /** Convert a timestamp in beats into frames (both relative to region position) */
- framepos_t region_beats_to_region_frames(Evoral::Beats beats) const;
- /** Convert a timestamp in beats into absolute frames */
- framepos_t region_beats_to_absolute_frames(Evoral::Beats beats) const {
- return _region->position() + region_beats_to_region_frames (beats);
+ /** Convert a timestamp in beats into samples (both relative to region position) */
+ samplepos_t region_beats_to_region_samples(Evoral::Beats beats) const;
+ /** Convert a timestamp in beats into absolute samples */
+ samplepos_t region_beats_to_absolute_samples(Evoral::Beats beats) const {
+ return _region->position() + region_beats_to_region_samples (beats);
}
- /** Convert a timestamp in frames to beats (both relative to region position) */
- Evoral::Beats region_frames_to_region_beats(framepos_t) const;
- double region_frames_to_region_beats_double(framepos_t) const;
-
- /** Convert a timestamp in beats measured from source start into absolute frames */
- framepos_t source_beats_to_absolute_frames(Evoral::Beats beats) const;
- /** Convert a timestamp in beats measured from source start into region-relative frames */
- framepos_t source_beats_to_region_frames(Evoral::Beats beats) const {
- return source_beats_to_absolute_frames (beats) - _region->position();
+ /** Convert a timestamp in samples to beats (both relative to region position) */
+ Evoral::Beats region_samples_to_region_beats(samplepos_t) const;
+ double region_samples_to_region_beats_double(samplepos_t) const;
+
+ /** Convert a timestamp in beats measured from source start into absolute samples */
+ samplepos_t source_beats_to_absolute_samples(Evoral::Beats beats) const;
+ /** Convert a timestamp in beats measured from source start into region-relative samples */
+ samplepos_t source_beats_to_region_samples(Evoral::Beats beats) const {
+ return source_beats_to_absolute_samples (beats) - _region->position();
}
- /** Convert a timestamp in absolute frames to beats measured from source start*/
- Evoral::Beats absolute_frames_to_source_beats(framepos_t) const;
+ /** Convert a timestamp in absolute samples to beats measured from source start*/
+ Evoral::Beats absolute_samples_to_source_beats(samplepos_t) const;
- ARDOUR::BeatsFramesConverter const & region_relative_time_converter () const {
+ ARDOUR::BeatsSamplesConverter const & region_relative_time_converter () const {
return _region_relative_time_converter;
}
- ARDOUR::BeatsFramesConverter const & source_relative_time_converter () const {
+ ARDOUR::BeatsSamplesConverter const & source_relative_time_converter () const {
return _source_relative_time_converter;
}
- ARDOUR::DoubleBeatsFramesConverter const & region_relative_time_converter_double () const {
+ ARDOUR::DoubleBeatsSamplesConverter const & region_relative_time_converter_double () const {
return _region_relative_time_converter_double;
}
@@ -327,13 +327,13 @@ public:
void trim_front_ending ();
/** Add a note to the model, and the view, at a canvas (click) coordinate.
- * \param t time in frames relative to the position of the region
+ * \param t time in samples relative to the position of the region
* \param y vertical position in pixels
* \param length duration of the note in beats
* \param state the keyboard modifier mask for the canvas event (click).
* \param shift_snap true alters snap behavior to round down always (false if the gui has already done that).
*/
- void create_note_at (framepos_t t, double y, Evoral::Beats length, uint32_t state, bool shift_snap);
+ void create_note_at (samplepos_t t, double y, Evoral::Beats length, uint32_t state, bool shift_snap);
/** An external request to clear the note selection, remove MRV from editor
* selection.
@@ -399,7 +399,7 @@ private:
void trim_note(NoteBase* ev, ARDOUR::MidiModel::TimeType start_delta,
ARDOUR::MidiModel::TimeType end_delta);
- void update_drag_selection (framepos_t start, framepos_t end, double y0, double y1, bool extend);
+ void update_drag_selection (samplepos_t start, samplepos_t end, double y0, double y1, bool extend);
void update_vertical_drag_selection (double last_y, double y, bool extend);
void add_to_selection (NoteBase*);
@@ -420,9 +420,9 @@ private:
typedef boost::unordered_map<ARDOUR::MidiModel::constSysExPtr, boost::shared_ptr<SysEx> > SysExes;
typedef std::vector<NoteBase*> CopyDragEvents;
- ARDOUR::BeatsFramesConverter _region_relative_time_converter;
- ARDOUR::BeatsFramesConverter _source_relative_time_converter;
- ARDOUR::DoubleBeatsFramesConverter _region_relative_time_converter_double;
+ ARDOUR::BeatsSamplesConverter _region_relative_time_converter;
+ ARDOUR::BeatsSamplesConverter _source_relative_time_converter;
+ ARDOUR::DoubleBeatsSamplesConverter _region_relative_time_converter_double;
boost::shared_ptr<ARDOUR::MidiModel> _model;
Events _events;
@@ -503,7 +503,7 @@ private:
void data_recorded (boost::weak_ptr<ARDOUR::MidiSource>);
/** Get grid type as beats, or default to 1 if not snapped to beats. */
- Evoral::Beats get_grid_beats(framepos_t pos) const;
+ Evoral::Beats get_grid_beats(samplepos_t pos) const;
void remove_ghost_note ();
void mouse_mode_changed ();
@@ -511,7 +511,7 @@ private:
void leave_internal ();
void hide_verbose_cursor ();
- framecnt_t _last_display_zoom;
+ samplecnt_t _last_display_zoom;
double _last_event_x;
double _last_event_y;
@@ -524,7 +524,7 @@ private:
Gtkmm2ext::Color _patch_change_outline;
Gtkmm2ext::Color _patch_change_fill;
- Evoral::Beats snap_frame_to_grid_underneath (framepos_t p, int32_t divisions, bool shift_snap) const;
+ Evoral::Beats snap_sample_to_grid_underneath (samplepos_t p, int32_t divisions, bool shift_snap) const;
PBD::ScopedConnection _mouse_mode_connection;
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc
index d3a316194d..5e2f055582 100644
--- a/gtk2_ardour/midi_streamview.cc
+++ b/gtk2_ardour/midi_streamview.cc
@@ -467,10 +467,10 @@ MidiStreamView::setup_rec_box ()
// handle multi
- framepos_t start = 0;
+ samplepos_t start = 0;
if (rec_regions.size() > 0) {
start = rec_regions.back().first->start()
- + _trackview.track()->get_captured_frames(rec_regions.size()-1);
+ + _trackview.track()->get_captured_samples(rec_regions.size()-1);
}
if (!rec_regions.empty()) {
@@ -486,10 +486,10 @@ MidiStreamView::setup_rec_box ()
is so that the RegionView gets created with a non-zero width, as apparently
creating a RegionView with a zero width causes it never to be displayed
(there is a warning in TimeAxisViewItem::init about this). However, we
- must also set length_beats to something non-zero, otherwise the frame length
+ must also set length_beats to something non-zero, otherwise the sample length
of 1 causes length_beats to be set to some small quantity << 1. Then
when the position is set up below, this length_beats is used to recompute
- length using BeatsFramesConverter::to, which is slightly innacurate for small
+ length using BeatsSamplesConverter::to, which is slightly innacurate for small
beats values because it converts floating point beats to bars, beats and
integer ticks. The upshot of which being that length gets set back to 0,
meaning no region view is ever seen, meaning no MIDI notes during record (#3820).
@@ -502,8 +502,8 @@ MidiStreamView::setup_rec_box ()
(RegionFactory::create (sources, plist, false)));
if (region) {
region->set_start (_trackview.track()->current_capture_start()
- - _trackview.track()->get_capture_start_frame (0));
- region->set_position (_trackview.session()->transport_frame());
+ - _trackview.track()->get_capture_start_sample (0));
+ region->set_position (_trackview.session()->transport_sample());
RegionView* rv = add_region_view_internal (region, false, true);
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);
@@ -675,7 +675,7 @@ struct RegionPositionSorter {
};
bool
-MidiStreamView::paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num)
+MidiStreamView::paste (ARDOUR::samplepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num)
{
/* Paste into the first region which starts on or before pos. Only called when
using an internal editing tool. */
diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h
index f4328ab093..92d4095844 100644
--- a/gtk2_ardour/midi_streamview.h
+++ b/gtk2_ardour/midi_streamview.h
@@ -103,7 +103,7 @@ public:
RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool);
- bool paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num);
+ bool paste (ARDOUR::samplepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num);
void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views);
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 91cf2b9544..6dfc770a03 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -1330,10 +1330,10 @@ MidiTimeAxisView::update_control_names ()
if (selected()) {
controls_ebox.set_name (controls_base_selected_name);
- time_axis_frame.set_name (controls_base_selected_name);
+ time_axis_sample.set_name (controls_base_selected_name);
} else {
controls_ebox.set_name (controls_base_unselected_name);
- time_axis_frame.set_name (controls_base_unselected_name);
+ time_axis_sample.set_name (controls_base_unselected_name);
}
}
@@ -1535,10 +1535,10 @@ MidiTimeAxisView::automation_child_menu_item (Evoral::Parameter param)
}
boost::shared_ptr<MidiRegion>
-MidiTimeAxisView::add_region (framepos_t f, framecnt_t length, bool commit)
+MidiTimeAxisView::add_region (samplepos_t f, samplecnt_t length, bool commit)
{
Editor* real_editor = dynamic_cast<Editor*> (&_editor);
- MusicFrame pos (f, 0);
+ MusicSample pos (f, 0);
if (commit) {
real_editor->begin_reversible_command (Operations::create_region);
@@ -1556,8 +1556,8 @@ MidiTimeAxisView::add_region (framepos_t f, framecnt_t length, bool commit)
boost::shared_ptr<Region> region = (RegionFactory::create (src, plist));
/* sets beat position */
- region->set_position (pos.frame, pos.division);
- playlist()->add_region (region, pos.frame, 1.0, false, pos.division);
+ region->set_position (pos.sample, pos.division);
+ playlist()->add_region (region, pos.sample, 1.0, false, pos.division);
_session->add_command (new StatefulDiffCommand (playlist()));
if (commit) {
@@ -1632,7 +1632,7 @@ MidiTimeAxisView::contents_height_changed ()
}
bool
-MidiTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num)
+MidiTimeAxisView::paste (samplepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num)
{
if (!_editor.internal_editing()) {
// Non-internal paste, paste regions like any other route
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index cbfc816c27..8af67421be 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -82,13 +82,13 @@ public:
void set_height (uint32_t, TrackHeightMode m = OnlySelf);
- boost::shared_ptr<ARDOUR::MidiRegion> add_region (ARDOUR::framepos_t, ARDOUR::framecnt_t, bool);
+ boost::shared_ptr<ARDOUR::MidiRegion> add_region (ARDOUR::samplepos_t, ARDOUR::samplecnt_t, bool);
void show_all_automation (bool apply_to_selection = false);
void show_existing_automation (bool apply_to_selection = false);
void create_automation_child (const Evoral::Parameter& param, bool show);
- bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx, const int32_t sub_num);
+ bool paste (ARDOUR::samplepos_t, const Selection&, PasteContext& ctx, const int32_t sub_num);
ARDOUR::NoteMode note_mode() const { return _note_mode; }
ARDOUR::ColorMode color_mode() const { return _color_mode; }
diff --git a/gtk2_ardour/midi_tracer.cc b/gtk2_ardour/midi_tracer.cc
index 2f97e5b6d5..df99afbad8 100644
--- a/gtk2_ardour/midi_tracer.cc
+++ b/gtk2_ardour/midi_tracer.cc
@@ -342,9 +342,9 @@ MidiTracer::tracer (Parser&, byte* msg, size_t len)
} else if (len == 10 && msg[0] == 0xf0 && msg[1] == 0x7f && msg[9] == 0xf7) {
- /* MTC full frame */
+ /* MTC full sample */
s += snprintf (
- &buf[s], bufsize, " MTC full frame to %02d:%02d:%02d:%02d\n", msg[5] & 0x1f, msg[6], msg[7], msg[8]
+ &buf[s], bufsize, " MTC full sample to %02d:%02d:%02d:%02d\n", msg[5] & 0x1f, msg[6], msg[7], msg[8]
);
} else if (len == 3 && msg[0] == MIDI::position) {
diff --git a/gtk2_ardour/mini_timeline.cc b/gtk2_ardour/mini_timeline.cc
index 443da0a6f6..43cf76491a 100644
--- a/gtk2_ardour/mini_timeline.cc
+++ b/gtk2_ardour/mini_timeline.cc
@@ -41,7 +41,7 @@
using namespace ARDOUR;
MiniTimeline::MiniTimeline ()
- : _last_update_frame (-1)
+ : _last_update_sample (-1)
, _clock_mode (AudioClock::Timecode)
, _time_width (0)
, _time_height (0)
@@ -180,7 +180,7 @@ MiniTimeline::on_size_allocate (Gtk::Allocation& alloc)
}
void
-MiniTimeline::set_span (framecnt_t ts)
+MiniTimeline::set_span (samplecnt_t ts)
{
assert (_session);
if (_session->config.get_minitimeline_span () == ts) {
@@ -198,11 +198,11 @@ MiniTimeline::super_rapid_update ()
if (!_session || !_session->engine().running() || !is_mapped ()) {
return;
}
- framepos_t const frame = PublicEditor::instance().playhead_cursor_sample ();
+ samplepos_t const sample = PublicEditor::instance().playhead_cursor_sample ();
AudioClock::Mode m = ARDOUR_UI::instance()->primary_clock->mode();
bool change = false;
- if (fabs ((_last_update_frame - frame) * _px_per_sample) >= 1.0) {
+ if (fabs ((_last_update_sample - sample) * _px_per_sample) >= 1.0) {
change = true;
}
@@ -218,7 +218,7 @@ MiniTimeline::super_rapid_update ()
}
if (change) {
- _last_update_frame = frame;
+ _last_update_sample = sample;
update_minitimeline ();
}
}
@@ -242,7 +242,7 @@ MiniTimeline::calculate_time_width ()
case AudioClock::MinSec:
_layout->set_text ("88:88:88,88");
break;
- case AudioClock::Frames:
+ case AudioClock::Samples:
_layout->set_text ("8888888888");
break;
}
@@ -258,15 +258,15 @@ MiniTimeline::calculate_time_spacing ()
return;
}
- const framecnt_t time_span = _session->config.get_minitimeline_span () / 2;
- _time_span_samples = time_span * _session->nominal_frame_rate ();
- _time_granularity = _session->nominal_frame_rate () * ceil (2. * time_span / _n_labels);
+ const samplecnt_t time_span = _session->config.get_minitimeline_span () / 2;
+ _time_span_samples = time_span * _session->nominal_sample_rate ();
+ _time_granularity = _session->nominal_sample_rate () * ceil (2. * time_span / _n_labels);
_px_per_sample = get_width () / (2. * _time_span_samples);
//_px_per_sample = 1.0 / round (1.0 / _px_per_sample);
}
void
-MiniTimeline::format_time (framepos_t when)
+MiniTimeline::format_time (samplepos_t when)
{
switch (_clock_mode) {
case AudioClock::Timecode:
@@ -280,7 +280,7 @@ MiniTimeline::format_time (framepos_t when)
case AudioClock::BBT:
{
char buf[64];
- Timecode::BBT_Time BBT = _session->tempo_map().bbt_at_frame (when);
+ Timecode::BBT_Time BBT = _session->tempo_map().bbt_at_sample (when);
snprintf (buf, sizeof (buf), "%03" PRIu32 BBT_BAR_CHAR "%02" PRIu32 BBT_BAR_CHAR "%04" PRIu32,
BBT.bars, BBT.beats, BBT.ticks);
_layout->set_text (buf);
@@ -289,11 +289,11 @@ MiniTimeline::format_time (framepos_t when)
case AudioClock::MinSec:
{
char buf[32];
- AudioClock::print_minsec (when, buf, sizeof (buf), _session->frame_rate());
+ AudioClock::print_minsec (when, buf, sizeof (buf), _session->sample_rate());
_layout->set_text (std::string(buf).substr(1));
}
break;
- case AudioClock::Frames:
+ case AudioClock::Samples:
{
char buf[32];
snprintf (buf, sizeof (buf), "%" PRId64, when);
@@ -475,10 +475,10 @@ MiniTimeline::draw_edge (cairo_t* cr, int x0, int x1, bool left, const std::stri
struct LocationMarker {
- LocationMarker (const std::string& l, framepos_t w)
+ LocationMarker (const std::string& l, samplepos_t w)
: label (l), when (w) {}
std::string label;
- framepos_t when;
+ samplepos_t when;
};
struct LocationMarkerSort {
@@ -514,12 +514,12 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
}
/* time */
- const framepos_t p = _last_update_frame;
- const framepos_t lower = (std::max ((framepos_t)0, (p - _time_span_samples)) / _time_granularity) * _time_granularity;
+ const samplepos_t p = _last_update_sample;
+ const samplepos_t lower = (std::max ((samplepos_t)0, (p - _time_span_samples)) / _time_granularity) * _time_granularity;
int dot_left = width * .5 + (lower - p) * _px_per_sample;
for (int i = 0; i < 2 + _n_labels; ++i) {
- framepos_t when = lower + i * _time_granularity;
+ samplepos_t when = lower + i * _time_granularity;
double xpos = width * .5 + (when - p) * _px_per_sample;
// TODO round to nearest display TC in +/- 1px
@@ -542,8 +542,8 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
draw_dots (cr, dot_left, width, height - PADDING - _time_height * .5, text);
/* locations */
- framepos_t lmin = std::max ((framepos_t)0, (p - _time_span_samples));
- framepos_t lmax = p + _time_span_samples;
+ samplepos_t lmin = std::max ((samplepos_t)0, (p - _time_span_samples));
+ samplepos_t lmax = p + _time_span_samples;
int tw, th;
_layout->set_text (X_("Marker@"));
@@ -585,7 +585,7 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
int id = 0;
for (std::vector<LocationMarker>::const_iterator l = lm.begin(); l != lm.end(); ++id) {
- framepos_t when = (*l).when;
+ samplepos_t when = (*l).when;
if (when < lmin) {
outside_left = l;
if (++l != lm.end()) {
@@ -660,13 +660,13 @@ MiniTimeline::build_minitl_context_menu ()
assert (_session);
- const framecnt_t time_span = _session->config.get_minitimeline_span ();
+ const samplecnt_t time_span = _session->config.get_minitimeline_span ();
_minitl_context_menu = new Gtk::Menu();
MenuList& items = _minitl_context_menu->items();
// ideally this would have a heading (or rather be a sub-menu to "Visible Time")
- std::map<framecnt_t, std::string> spans;
+ std::map<samplecnt_t, std::string> spans;
spans[30] = _("30 sec");
spans[60] = _("1 min");
spans[120] = _("2 mins");
@@ -675,7 +675,7 @@ MiniTimeline::build_minitl_context_menu ()
spans[1200] = _("20 mins");
RadioMenuItem::Group span_group;
- for (std::map<framecnt_t, std::string>::const_iterator i = spans.begin (); i != spans.end (); ++i) {
+ for (std::map<samplecnt_t, std::string>::const_iterator i = spans.begin (); i != spans.end (); ++i) {
items.push_back (RadioMenuElem (span_group, i->second, sigc::bind (sigc::mem_fun (*this, &MiniTimeline::set_span), i->first)));
if (time_span == i->first) {
static_cast<RadioMenuItem*>(&items.back())->set_active ();
@@ -717,8 +717,8 @@ MiniTimeline::on_button_release_event (GdkEventButton *ev)
}
if (ev->button == 1) {
- framepos_t when = _last_update_frame + (ev->x - get_width() * .5) / _px_per_sample;
- _session->request_locate (std::max ((framepos_t)0, when), _session->transport_rolling ());
+ samplepos_t when = _last_update_sample + (ev->x - get_width() * .5) / _px_per_sample;
+ _session->request_locate (std::max ((samplepos_t)0, when), _session->transport_rolling ());
}
return true;
@@ -774,8 +774,8 @@ MiniTimeline::on_scroll_event (GdkEventScroll *ev)
{
if (!_session) { return true; }
if (_session->actively_recording ()) { return true; }
- const framecnt_t time_span = _session->config.get_minitimeline_span ();
- framepos_t when = _session->audible_frame ();
+ const samplecnt_t time_span = _session->config.get_minitimeline_span ();
+ samplepos_t when = _session->audible_sample ();
double scale = time_span / 60.0;
@@ -790,16 +790,16 @@ MiniTimeline::on_scroll_event (GdkEventScroll *ev)
switch (ev->direction) {
case GDK_SCROLL_UP:
case GDK_SCROLL_RIGHT:
- when += scale * _session->nominal_frame_rate ();
+ when += scale * _session->nominal_sample_rate ();
break;
case GDK_SCROLL_DOWN:
case GDK_SCROLL_LEFT:
- when -= scale * _session->nominal_frame_rate ();
+ when -= scale * _session->nominal_sample_rate ();
break;
default:
return true;
break;
}
- _session->request_locate (std::max ((framepos_t)0, when), _session->transport_rolling ());
+ _session->request_locate (std::max ((samplepos_t)0, when), _session->transport_rolling ());
return true;
}
diff --git a/gtk2_ardour/mini_timeline.h b/gtk2_ardour/mini_timeline.h
index 1dd1a527b7..21b316df39 100644
--- a/gtk2_ardour/mini_timeline.h
+++ b/gtk2_ardour/mini_timeline.h
@@ -69,7 +69,7 @@ private:
int draw_edge (cairo_t*, int x0, int x1, bool left, const std::string&, bool& prelight);
void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
- void format_time (framepos_t when);
+ void format_time (samplepos_t when);
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
@@ -78,22 +78,22 @@ private:
bool on_leave_notify_event (GdkEventCrossing*);
void build_minitl_context_menu ();
- void set_span (ARDOUR::framecnt_t);
+ void set_span (ARDOUR::samplecnt_t);
Glib::RefPtr<Pango::Layout> _layout;
sigc::connection super_rapid_connection;
PBD::ScopedConnectionList marker_connection;
PBD::ScopedConnectionList session_connection;
- framepos_t _last_update_frame;
+ samplepos_t _last_update_sample;
AudioClock::Mode _clock_mode;
int _time_width;
int _time_height;
int _n_labels;
double _px_per_sample;
- ARDOUR::framecnt_t _time_granularity;
- ARDOUR::framecnt_t _time_span_samples;
+ ARDOUR::samplecnt_t _time_granularity;
+ ARDOUR::samplecnt_t _time_span_samples;
int _marker_height;
int _pointer_x;
@@ -102,11 +102,11 @@ private:
Gtk::Menu* _minitl_context_menu;
struct JumpRange {
- JumpRange (int l, int r, framepos_t t, bool p = false)
+ JumpRange (int l, int r, samplepos_t t, bool p = false)
: left (l), right (r), to (t), prelight (p) {}
int left;
int right;
- framepos_t to;
+ samplepos_t to;
bool prelight;
};
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index c3e9b6e1f2..cdd9cac466 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -335,11 +335,11 @@ MixerStrip::init ()
global_vpacker.pack_end (spacer, false, false);
#endif
- global_frame.add (global_vpacker);
- global_frame.set_shadow_type (Gtk::SHADOW_IN);
- global_frame.set_name ("BaseFrame");
+ global_sample.add (global_vpacker);
+ global_sample.set_shadow_type (Gtk::SHADOW_IN);
+ global_sample.set_name ("BaseFrame");
- add (global_frame);
+ add (global_sample);
/* force setting of visible selected status */
@@ -504,7 +504,7 @@ MixerStrip::trim_start_touch ()
{
assert (_route && _session);
if (route()->trim() && route()->trim()->active() && route()->n_inputs().n_audio() > 0) {
- route()->trim()->gain_control ()->start_touch (_session->transport_frame());
+ route()->trim()->gain_control ()->start_touch (_session->transport_sample());
}
}
@@ -513,7 +513,7 @@ MixerStrip::trim_end_touch ()
{
assert (_route && _session);
if (route()->trim() && route()->trim()->active() && route()->n_inputs().n_audio() > 0) {
- route()->trim()->gain_control ()->stop_touch (_session->transport_frame());
+ route()->trim()->gain_control ()->stop_touch (_session->transport_sample());
}
}
@@ -734,7 +734,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
width_button.show();
width_hide_box.show();
- global_frame.show();
+ global_sample.show();
global_vpacker.show();
mute_solo_table.show();
bottom_button_table.show();
@@ -1835,14 +1835,14 @@ MixerStrip::set_selected (bool yn)
AxisView::set_selected (yn);
if (selected()) {
- global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
- global_frame.set_name ("MixerStripSelectedFrame");
+ global_sample.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
+ global_sample.set_name ("MixerStripSelectedFrame");
} else {
- global_frame.set_shadow_type (Gtk::SHADOW_IN);
- global_frame.set_name ("MixerStripFrame");
+ global_sample.set_shadow_type (Gtk::SHADOW_IN);
+ global_sample.set_name ("MixerStripFrame");
}
- global_frame.queue_draw ();
+ global_sample.queue_draw ();
// if (!yn)
// processor_box.deselect_all_processors();
diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h
index e4cecf3586..7b0ab8d2e6 100644
--- a/gtk2_ardour/mixer_strip.h
+++ b/gtk2_ardour/mixer_strip.h
@@ -168,7 +168,7 @@ private:
void hide_clicked();
bool width_button_pressed (GdkEventButton *);
- Gtk::Frame global_frame;
+ Gtk::Frame global_sample;
Gtk::VBox global_vpacker;
ProcessorBox processor_box;
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index ee2f22031f..5232ab32cf 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -213,9 +213,9 @@ Mixer_UI::Mixer_UI ()
group_display_vbox.pack_start (group_display_scroller, true, true);
group_display_vbox.pack_start (*route_group_display_button_box, false, false);
- group_display_frame.set_name ("BaseFrame");
- group_display_frame.set_shadow_type (Gtk::SHADOW_IN);
- group_display_frame.add (group_display_vbox);
+ group_display_sample.set_name ("BaseFrame");
+ group_display_sample.set_shadow_type (Gtk::SHADOW_IN);
+ group_display_sample.add (group_display_vbox);
list<TargetEntry> target_list;
@@ -244,15 +244,15 @@ Mixer_UI::Mixer_UI ()
favorite_plugins_scroller.add (favorite_plugins_display);
favorite_plugins_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
- favorite_plugins_frame.set_name ("BaseFrame");
- favorite_plugins_frame.set_shadow_type (Gtk::SHADOW_IN);
- favorite_plugins_frame.add (favorite_plugins_scroller);
+ favorite_plugins_sample.set_name ("BaseFrame");
+ favorite_plugins_sample.set_shadow_type (Gtk::SHADOW_IN);
+ favorite_plugins_sample.add (favorite_plugins_scroller);
- rhs_pane1.add (favorite_plugins_frame);
- rhs_pane1.add (track_display_frame);
+ rhs_pane1.add (favorite_plugins_sample);
+ rhs_pane1.add (track_display_sample);
rhs_pane2.add (rhs_pane1);
- rhs_pane2.add (group_display_frame);
+ rhs_pane2.add (group_display_sample);
list_vpacker.pack_start (rhs_pane2, true, true);
@@ -331,8 +331,8 @@ Mixer_UI::Mixer_UI ()
group_display_scroller.show();
favorite_plugins_scroller.show();
group_display_vbox.show();
- group_display_frame.show();
- favorite_plugins_frame.show();
+ group_display_sample.show();
+ favorite_plugins_sample.show();
rhs_pane1.show();
rhs_pane2.show();
strip_packer.show();
@@ -2358,12 +2358,12 @@ Mixer_UI::setup_track_display ()
v->pack_start (*b, false, false);
- track_display_frame.set_name("BaseFrame");
- track_display_frame.set_shadow_type (Gtk::SHADOW_IN);
- track_display_frame.add (*v);
+ track_display_sample.set_name("BaseFrame");
+ track_display_sample.set_shadow_type (Gtk::SHADOW_IN);
+ track_display_sample.add (*v);
track_display_scroller.show();
- track_display_frame.show();
+ track_display_sample.show();
track_display.show();
}
diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h
index d0a051dfce..3ab097f8b0 100644
--- a/gtk2_ardour/mixer_ui.h
+++ b/gtk2_ardour/mixer_ui.h
@@ -151,9 +151,9 @@ private:
Gtk::ScrolledWindow group_display_scroller;
Gtk::ScrolledWindow favorite_plugins_scroller;
Gtk::VBox group_display_vbox;
- Gtk::Frame track_display_frame;
- Gtk::Frame group_display_frame;
- Gtk::Frame favorite_plugins_frame;
+ Gtk::Frame track_display_sample;
+ Gtk::Frame group_display_sample;
+ Gtk::Frame favorite_plugins_sample;
ArdourWidgets::VPane rhs_pane1;
ArdourWidgets::VPane rhs_pane2;
ArdourWidgets::HPane inner_pane;
diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc
index 4ec75a4ce4..e52b48c7c7 100644
--- a/gtk2_ardour/monitor_section.cc
+++ b/gtk2_ardour/monitor_section.cc
@@ -441,9 +441,9 @@ MonitorSection::MonitorSection (Session* s)
vpacker.pack_start (master_packer, false, false, PX_SCALE(10));
vpacker.pack_end (*out_packer, false, false,
#ifdef MIXBUS
- scrollbar_height - 2 /* no outer frame */
+ scrollbar_height - 2 /* no outer sample */
#else
- scrollbar_height + 2 /* frame borders */
+ scrollbar_height + 2 /* sample borders */
#endif
);
diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc
index e639dd3a14..97912eab4c 100644
--- a/gtk2_ardour/option_editor.cc
+++ b/gtk2_ardour/option_editor.cc
@@ -574,7 +574,7 @@ void
ClockOption::set_state_from_config ()
{
Timecode::Time TC;
- framepos_t when;
+ samplepos_t when;
if (!Timecode::parse_timecode_format(_get(), TC)) {
_clock.set (0, true);
}
diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc
index 046e20a68a..60f6fa8f6a 100644
--- a/gtk2_ardour/panner_ui.cc
+++ b/gtk2_ardour/panner_ui.cc
@@ -308,7 +308,7 @@ PannerUI::setup_pan ()
twod_panner->set_size_request (-1, rintf(61.f * scale));
twod_panner->set_send_drawing_mode (_send_mode);
- /* and finally, add it to the panner frame */
+ /* and finally, add it to the panner sample */
pan_vbox.pack_start (*twod_panner, false, false);
}
@@ -345,7 +345,7 @@ PannerUI::start_touch (boost::weak_ptr<AutomationControl> wac)
if (!ac) {
return;
}
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
}
void
@@ -355,7 +355,7 @@ PannerUI::stop_touch (boost::weak_ptr<AutomationControl> wac)
if (!ac) {
return;
}
- ac->stop_touch (ac->session().transport_frame());
+ ac->stop_touch (ac->session().transport_sample());
}
bool
diff --git a/gtk2_ardour/patch_change_dialog.cc b/gtk2_ardour/patch_change_dialog.cc
index 32a102af1f..9a7b746b89 100644
--- a/gtk2_ardour/patch_change_dialog.cc
+++ b/gtk2_ardour/patch_change_dialog.cc
@@ -27,7 +27,7 @@
#include "midi++/midnam_patch.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/instrument_info.h"
#include "patch_change_dialog.h"
@@ -41,7 +41,7 @@ using namespace Gtkmm2ext;
/** @param tc If non-0, a time converter for this patch change. If 0, time control will be desensitized */
PatchChangeDialog::PatchChangeDialog (
- const ARDOUR::BeatsFramesConverter* tc,
+ const ARDOUR::BeatsSamplesConverter* tc,
ARDOUR::Session* session,
Evoral::PatchChange<Evoral::Beats> const & patch,
ARDOUR::InstrumentInfo& info,
diff --git a/gtk2_ardour/patch_change_dialog.h b/gtk2_ardour/patch_change_dialog.h
index 0390ecfffa..9a35778986 100644
--- a/gtk2_ardour/patch_change_dialog.h
+++ b/gtk2_ardour/patch_change_dialog.h
@@ -26,7 +26,7 @@
#include "audio_clock.h"
namespace ARDOUR {
- class BeatsFramesConverter;
+ class BeatsSamplesConverter;
class Session;
class InstrumentInfo;
}
@@ -41,7 +41,7 @@ class PatchChangeDialog : public ArdourDialog
{
public:
PatchChangeDialog (
- const ARDOUR::BeatsFramesConverter *,
+ const ARDOUR::BeatsSamplesConverter *,
ARDOUR::Session *,
Evoral::PatchChange<Evoral::Beats> const &,
ARDOUR::InstrumentInfo&,
@@ -68,7 +68,7 @@ private:
int get_14bit_bank () const;
- const ARDOUR::BeatsFramesConverter* _time_converter;
+ const ARDOUR::BeatsSamplesConverter* _time_converter;
ARDOUR::InstrumentInfo& _info;
AudioClock _time;
Gtk::SpinButton _channel;
diff --git a/gtk2_ardour/plugin_display.cc b/gtk2_ardour/plugin_display.cc
index 24d8658d42..e00e8e9559 100644
--- a/gtk2_ardour/plugin_display.cc
+++ b/gtk2_ardour/plugin_display.cc
@@ -145,7 +145,7 @@ PluginDisplay::on_expose_event (GdkEventExpose* ev)
cairo_save (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- display_frame(cr, width, height);
+ display_sample(cr, width, height);
cairo_clip (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
@@ -168,7 +168,7 @@ PluginDisplay::on_expose_event (GdkEventExpose* ev)
std::string name = get_name();
Gtkmm2ext::Color fill_color = UIConfiguration::instance().color (string_compose ("%1: fill active", name), &failed);
- display_frame(cr, width, height);
+ display_sample(cr, width, height);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_set_line_width(cr, 1.0);
if (failed) {
@@ -183,7 +183,7 @@ PluginDisplay::on_expose_event (GdkEventExpose* ev)
}
void
-PluginDisplay::display_frame (cairo_t* cr, double w, double h)
+PluginDisplay::display_sample (cairo_t* cr, double w, double h)
{
cairo_rectangle (cr, 0.0, 0.0, w, h);
}
diff --git a/gtk2_ardour/plugin_display.h b/gtk2_ardour/plugin_display.h
index 2573af2578..38c2777caf 100644
--- a/gtk2_ardour/plugin_display.h
+++ b/gtk2_ardour/plugin_display.h
@@ -43,7 +43,7 @@ protected:
virtual void update_height_alloc (uint32_t inline_height);
virtual uint32_t render_inline (cairo_t *, uint32_t width);
- virtual void display_frame (cairo_t* cr, double w, double h);
+ virtual void display_sample (cairo_t* cr, double w, double h);
boost::shared_ptr<ARDOUR::Plugin> _plug;
PBD::ScopedConnection _qdraw_connection;
diff --git a/gtk2_ardour/plugin_eq_gui.cc b/gtk2_ardour/plugin_eq_gui.cc
index c637968181..274cf014da 100644
--- a/gtk2_ardour/plugin_eq_gui.cc
+++ b/gtk2_ardour/plugin_eq_gui.cc
@@ -65,7 +65,7 @@ PluginEqGui::PluginEqGui(boost::shared_ptr<ARDOUR::PluginInsert> pluginInsert)
, _plugin_insert(pluginInsert)
{
_signal_analysis_running = false;
- _samplerate = ARDOUR_UI::instance()->the_session()->frame_rate();
+ _samplerate = ARDOUR_UI::instance()->the_session()->sample_rate();
_log_coeff = (1.0 - 2.0 * (1000.0/(_samplerate/2.0))) / powf(1000.0/(_samplerate/2.0), 2.0);
_log_max = log10f(1 + _log_coeff);
@@ -366,7 +366,7 @@ PluginEqGui::run_impulse_analysis()
_plugin->set_block_size (_buffer_size);
_plugin->connect_and_run(_bufferset, 0, _buffer_size, 1.0, in_map, out_map, _buffer_size, 0);
- framecnt_t f = _plugin->signal_latency ();
+ samplecnt_t f = _plugin->signal_latency ();
// Adding user_latency() could be interesting
// Gather all output, taking latency into account.
@@ -387,9 +387,9 @@ PluginEqGui::run_impulse_analysis()
}
} else {
//int C = 0;
- //std::cerr << (++C) << ": latency is " << f << " frames, doing split processing.." << std::endl;
- framecnt_t target_offset = 0;
- framecnt_t frames_left = _buffer_size; // refaktoroi
+ //std::cerr << (++C) << ": latency is " << f << " samples, doing split processing.." << std::endl;
+ samplecnt_t target_offset = 0;
+ samplecnt_t samples_left = _buffer_size; // refaktoroi
do {
if (f >= _buffer_size) {
//std::cerr << (++C) << ": f (=" << f << ") is larger than buffer_size, still trying to reach the actual output" << std::endl;
@@ -399,11 +399,11 @@ PluginEqGui::run_impulse_analysis()
// this buffer contains either the first, last or a whole bu the output of the impulse
// first part: offset is 0, so we copy to the start of _collect_bufferset
// we start at output offset "f"
- // .. and copy "buffer size" - "f" - "offset" frames
+ // .. and copy "buffer size" - "f" - "offset" samples
- framecnt_t length = _buffer_size - f - target_offset;
+ samplecnt_t length = _buffer_size - f - target_offset;
- //std::cerr << (++C) << ": copying " << length << " frames to _collect_bufferset.get_audio(i)+" << target_offset << " from bufferset at offset " << f << std::endl;
+ //std::cerr << (++C) << ": copying " << length << " samples to _collect_bufferset.get_audio(i)+" << target_offset << " from bufferset at offset " << f << std::endl;
for (uint32_t i = 0; i < outputs; ++i) {
memcpy(_collect_bufferset.get_audio(i).data(target_offset),
_bufferset.get_audio(inputs + i).data() + f,
@@ -411,10 +411,10 @@ PluginEqGui::run_impulse_analysis()
}
target_offset += length;
- frames_left -= length;
+ samples_left -= length;
f = 0;
}
- if (frames_left > 0) {
+ if (samples_left > 0) {
// Silence the buffers
for (uint32_t i = 0; i < inputs; ++i) {
ARDOUR::AudioBuffer &buf = _bufferset.get_audio(i);
@@ -424,7 +424,7 @@ PluginEqGui::run_impulse_analysis()
_plugin->connect_and_run (_bufferset, target_offset, target_offset + _buffer_size, 1.0, in_map, out_map, _buffer_size, 0);
}
- } while ( frames_left > 0);
+ } while ( samples_left > 0);
}
diff --git a/gtk2_ardour/plugin_eq_gui.h b/gtk2_ardour/plugin_eq_gui.h
index 428fd76d3c..ec6e7364ef 100644
--- a/gtk2_ardour/plugin_eq_gui.h
+++ b/gtk2_ardour/plugin_eq_gui.h
@@ -100,8 +100,8 @@ private:
float _log_coeff;
float _log_max;
- ARDOUR::framecnt_t _buffer_size;
- ARDOUR::framecnt_t _signal_buffer_size;
+ ARDOUR::samplecnt_t _buffer_size;
+ ARDOUR::samplecnt_t _signal_buffer_size;
// buffers
ARDOUR::BufferSet _bufferset;
diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc
index 0a609eb9cd..fc16aa3751 100644
--- a/gtk2_ardour/plugin_selector.cc
+++ b/gtk2_ardour/plugin_selector.cc
@@ -205,18 +205,18 @@ PluginSelector::PluginSelector (PluginManager& mgr)
filter_table->set_col_spacings (2);
filter_table->set_row_spacings (4);
- Frame* filter_frame = manage (new Frame);
- filter_frame->set_name ("BaseFrame");
- filter_frame->set_label (_("Filter"));
- filter_frame->add (*filter_table);
+ Frame* filter_sample = manage (new Frame);
+ filter_sample->set_name ("BaseFrame");
+ filter_sample->set_label (_("Filter"));
+ filter_sample->add (*filter_table);
- filter_frame->show_all ();
+ filter_sample->show_all ();
HBox* side_by_side = manage (new HBox);
VBox* right_side = manage (new VBox);
table->attach (scroller, 0, 7, 0, 5);
- table->attach (*filter_frame, 0, 7, 6, 7, FILL|EXPAND, FILL, 5, 5);
+ table->attach (*filter_sample, 0, 7, 6, 7, FILL|EXPAND, FILL, 5, 5);
right_side->pack_start (ascroller);
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index 93da6e8df8..a91a0b8197 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -549,8 +549,8 @@ PlugUIBase::plugin_going_away ()
void
PlugUIBase::set_latency_label ()
{
- framecnt_t const l = insert->effective_latency ();
- framecnt_t const sr = insert->session().frame_rate ();
+ samplecnt_t const l = insert->effective_latency ();
+ samplecnt_t const sr = insert->session().sample_rate ();
string t;
@@ -567,7 +567,7 @@ void
PlugUIBase::latency_button_clicked ()
{
if (!latency_gui) {
- latency_gui = new LatencyGUI (*(insert.get()), insert->session().frame_rate(), insert->session().get_block_size());
+ latency_gui = new LatencyGUI (*(insert.get()), insert->session().sample_rate(), insert->session().get_block_size());
latency_dialog = new ArdourWindow (_("Edit Latency"));
/* use both keep-above and transient for to try cover as many
different WM's as possible.
diff --git a/gtk2_ardour/port_insert_ui.cc b/gtk2_ardour/port_insert_ui.cc
index d0497357cd..ffe2d34f06 100644
--- a/gtk2_ardour/port_insert_ui.cc
+++ b/gtk2_ardour/port_insert_ui.cc
@@ -67,12 +67,12 @@ PortInsertUI::PortInsertUI (Gtk::Window* parent, ARDOUR::Session* sess, boost::s
void
PortInsertUI::update_latency_display ()
{
- framecnt_t const sample_rate = AudioEngine::instance()->sample_rate();
+ samplecnt_t const sample_rate = AudioEngine::instance()->sample_rate();
if (sample_rate == 0) {
latency_display.set_text (_("Disconnected from audio engine"));
} else {
char buf[64];
- snprintf (buf, sizeof (buf), "%10.3lf frames %10.3lf ms",
+ snprintf (buf, sizeof (buf), "%10.3lf samples %10.3lf ms",
(float)_pi->latency(), (float)_pi->latency() * 1000.0f/sample_rate);
latency_display.set_text(buf);
}
@@ -94,7 +94,7 @@ PortInsertUI::check_latency_measurement ()
}
char buf[128];
- framecnt_t const sample_rate = AudioEngine::instance()->sample_rate();
+ samplecnt_t const sample_rate = AudioEngine::instance()->sample_rate();
if (sample_rate == 0) {
latency_display.set_text (_("Disconnected from audio engine"));
@@ -102,7 +102,7 @@ PortInsertUI::check_latency_measurement ()
return false;
}
- snprintf (buf, sizeof (buf), "%10.3lf frames %10.3lf ms", mtdm->del (), mtdm->del () * 1000.0f/sample_rate);
+ snprintf (buf, sizeof (buf), "%10.3lf samples %10.3lf ms", mtdm->del (), mtdm->del () * 1000.0f/sample_rate);
bool solid = true;
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 18b4b50ef1..b512e11144 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -912,7 +912,7 @@ ProcessorEntry::Control::start_touch ()
if (!c) {
return;
}
- c->start_touch (c->session().transport_frame());
+ c->start_touch (c->session().transport_sample());
}
void
@@ -922,7 +922,7 @@ ProcessorEntry::Control::end_touch ()
if (!c) {
return;
}
- c->stop_touch (c->session().transport_frame());
+ c->stop_touch (c->session().transport_sample());
}
void
@@ -1648,7 +1648,7 @@ ProcessorEntry::PluginInlineDisplay::update_height_alloc (uint32_t inline_height
}
void
-ProcessorEntry::PluginInlineDisplay::display_frame (cairo_t* cr, double w, double h)
+ProcessorEntry::PluginInlineDisplay::display_sample (cairo_t* cr, double w, double h)
{
Gtkmm2ext::rounded_rectangle (cr, .5, -1.5, w - 1, h + 1, 7);
}
diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h
index cb13f42b43..410e5b91d7 100644
--- a/gtk2_ardour/processor_box.h
+++ b/gtk2_ardour/processor_box.h
@@ -255,7 +255,7 @@ private:
bool on_button_press_event (GdkEventButton *ev);
void update_height_alloc (uint32_t inline_height);
- void display_frame (cairo_t* cr, double w, double h);
+ void display_sample (cairo_t* cr, double w, double h);
ProcessorEntry& _entry;
bool _scroll;
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 375594f2bc..9a3f68da71 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -100,8 +100,8 @@ bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
bool forward_key_press (GdkEventKey* ev);
}
-using ARDOUR::framepos_t;
-using ARDOUR::framecnt_t;
+using ARDOUR::samplepos_t;
+using ARDOUR::samplecnt_t;
/// Representation of the interface of the Editor class
@@ -151,7 +151,7 @@ public:
* Snap a value according to the current snap setting.
* ensure_snap overrides SnapOff and magnetic snap
*/
- virtual void snap_to (ARDOUR::MusicFrame& first,
+ virtual void snap_to (ARDOUR::MusicSample& first,
ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
bool for_mark = false,
bool ensure_snap = false) = 0;
@@ -202,13 +202,13 @@ public:
virtual void separate_region_from_selection () = 0;
virtual void transition_to_rolling (bool fwd) = 0;
- virtual framepos_t pixel_to_sample (double pixel) const = 0;
- virtual framepos_t playhead_cursor_sample () const = 0;
- virtual double sample_to_pixel (framepos_t frame) const = 0;
- virtual double sample_to_pixel_unrounded (framepos_t frame) const = 0;
+ virtual samplepos_t pixel_to_sample (double pixel) const = 0;
+ virtual samplepos_t playhead_cursor_sample () const = 0;
+ virtual double sample_to_pixel (samplepos_t sample) const = 0;
+ virtual double sample_to_pixel_unrounded (samplepos_t sample) const = 0;
virtual Selection& get_selection () const = 0;
- virtual bool get_selection_extents (framepos_t &start, framepos_t &end) const = 0;
+ virtual bool get_selection_extents (samplepos_t &start, samplepos_t &end) const = 0;
virtual Selection& get_cut_buffer () const = 0;
virtual void set_selection (std::list<Selectable*>, Selection::Operation) = 0;
@@ -218,7 +218,7 @@ public:
virtual void play_with_preroll () = 0;
virtual void rec_with_preroll () = 0;
virtual void rec_with_count_in () = 0;
- virtual void maybe_locate_with_edit_preroll (framepos_t location) = 0;
+ virtual void maybe_locate_with_edit_preroll (samplepos_t location) = 0;
virtual void goto_nth_marker (int nth) = 0;
virtual void trigger_script (int nth) = 0;
virtual void add_location_from_playhead_cursor () = 0;
@@ -226,8 +226,8 @@ public:
virtual void set_show_measures (bool yn) = 0;
virtual bool show_measures () const = 0;
virtual void remove_tracks () = 0;
- virtual void set_loop_range (framepos_t start, framepos_t end, std::string cmd) = 0;
- virtual void set_punch_range (framepos_t start, framepos_t end, std::string cmd) = 0;
+ virtual void set_loop_range (samplepos_t start, samplepos_t end, std::string cmd) = 0;
+ virtual void set_punch_range (samplepos_t start, samplepos_t end, std::string cmd) = 0;
virtual void jump_forward_to_mark () = 0;
virtual void jump_backward_to_mark () = 0;
@@ -255,10 +255,10 @@ public:
/** Import existing media */
virtual void do_import (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality,
- ARDOUR::MidiTrackNameSource, ARDOUR::MidiTempoMapDisposition, framepos_t&,
+ ARDOUR::MidiTrackNameSource, ARDOUR::MidiTempoMapDisposition, samplepos_t&,
boost::shared_ptr<ARDOUR::PluginInfo> instrument=boost::shared_ptr<ARDOUR::PluginInfo>()) = 0;
virtual void do_embed (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode,
- framepos_t&,
+ samplepos_t&,
boost::shared_ptr<ARDOUR::PluginInfo> instrument=boost::shared_ptr<ARDOUR::PluginInfo>()) = 0;
/** Open main export dialog */
@@ -276,8 +276,8 @@ public:
virtual void register_actions () = 0;
virtual void set_zoom_focus (Editing::ZoomFocus) = 0;
virtual Editing::ZoomFocus get_zoom_focus () const = 0;
- virtual framecnt_t get_current_zoom () const = 0;
- virtual void reset_zoom (framecnt_t) = 0;
+ virtual samplecnt_t get_current_zoom () const = 0;
+ virtual void reset_zoom (samplecnt_t) = 0;
virtual PlaylistSelector& playlist_selector() const = 0;
virtual void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>) = 0;
virtual void new_playlists (TimeAxisView*) = 0;
@@ -308,8 +308,8 @@ public:
/** @return true if the playhead is currently being dragged, otherwise false */
virtual bool dragging_playhead () const = 0;
- virtual framepos_t leftmost_sample() const = 0;
- virtual framecnt_t current_page_samples() const = 0;
+ virtual samplepos_t leftmost_sample() const = 0;
+ virtual samplecnt_t current_page_samples() const = 0;
virtual double visible_canvas_height () const = 0;
virtual void temporal_zoom_step (bool coarser) = 0;
virtual void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top = false) = 0;
@@ -321,7 +321,7 @@ public:
virtual void select_topmost_track () = 0;
virtual void prepare_for_cleanup () = 0;
virtual void finish_cleanup () = 0;
- virtual void reset_x_origin (framepos_t frame) = 0;
+ virtual void reset_x_origin (samplepos_t sample) = 0;
virtual double get_y_origin () const = 0;
virtual void reset_y_origin (double pos) = 0;
virtual void set_visible_track_count (int32_t) = 0;
@@ -329,17 +329,17 @@ public:
virtual void remove_last_capture () = 0;
virtual void maximise_editing_space () = 0;
virtual void restore_editing_space () = 0;
- virtual framepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE, bool from_context_menu = false, bool from_outside_canvas = false) = 0;
+ virtual samplepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE, bool from_context_menu = false, bool from_outside_canvas = false) = 0;
virtual void toggle_meter_updating() = 0;
- virtual void split_regions_at (ARDOUR::MusicFrame, RegionSelection&, bool snap) = 0;
+ virtual void split_regions_at (ARDOUR::MusicSample, RegionSelection&, bool snap) = 0;
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;
- virtual void mouse_add_new_marker (framepos_t where, bool is_cd=false) = 0;
+ virtual void mouse_add_new_marker (samplepos_t where, bool is_cd=false) = 0;
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0;
- virtual framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next) = 0;
- virtual framecnt_t get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t duration) = 0;
- virtual unsigned get_grid_beat_divisions(framepos_t position) = 0;
- virtual Evoral::Beats get_grid_type_as_beats (bool& success, framepos_t position) = 0;
+ virtual samplecnt_t get_nudge_distance (samplepos_t pos, samplecnt_t& next) = 0;
+ virtual samplecnt_t get_paste_offset (samplepos_t pos, unsigned paste_count, samplecnt_t duration) = 0;
+ virtual unsigned get_grid_beat_divisions(samplepos_t position) = 0;
+ virtual Evoral::Beats get_grid_type_as_beats (bool& success, samplepos_t position) = 0;
virtual int32_t get_grid_music_divisions (uint32_t event_state) = 0;
virtual void edit_notes (MidiRegionView*) = 0;
@@ -351,7 +351,7 @@ public:
virtual void set_xjadeo_sensitive (bool onoff) = 0;
virtual int get_videotl_bar_height () const = 0;
virtual void set_video_timeline_height (const int h) = 0;
- virtual void embed_audio_from_video (std::string, framepos_t n = 0, bool lock_position_to_video = true) = 0;
+ virtual void embed_audio_from_video (std::string, samplepos_t n = 0, bool lock_position_to_video = true) = 0;
virtual bool track_selection_change_without_scroll () const = 0;
@@ -365,7 +365,7 @@ public:
sigc::signal<void> ZoomChanged;
sigc::signal<void> Realized;
- sigc::signal<void,framepos_t> UpdateAllTransportClocks;
+ sigc::signal<void,samplepos_t> UpdateAllTransportClocks;
static sigc::signal<void> DropDownKeys;
@@ -397,7 +397,7 @@ public:
virtual bool canvas_fade_out_handle_event (GdkEvent* event, ArdourCanvas::Item*, AudioRegionView*, bool) = 0;
virtual bool canvas_region_view_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*) = 0;
virtual bool canvas_wave_view_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*) = 0;
- virtual bool canvas_frame_handle_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*) = 0;
+ virtual bool canvas_sample_handle_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*) = 0;
virtual bool canvas_region_view_name_highlight_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*) = 0;
virtual bool canvas_region_view_name_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*) = 0;
virtual bool canvas_feature_line_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*) = 0;
@@ -431,7 +431,7 @@ public:
virtual void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>) = 0;
virtual void set_current_movable (boost::shared_ptr<ARDOUR::Movable>) = 0;
- virtual void center_screen (framepos_t) = 0;
+ virtual void center_screen (samplepos_t) = 0;
virtual TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const = 0;
virtual TrackViewList const & get_track_views () const = 0;
@@ -461,19 +461,19 @@ public:
virtual ARDOUR::Location* find_location_from_marker (ArdourMarker *, bool &) const = 0;
virtual ArdourMarker* find_marker_from_location_id (PBD::ID const &, bool) const = 0;
- virtual void snap_to_with_modifier (ARDOUR::MusicFrame& first,
+ virtual void snap_to_with_modifier (ARDOUR::MusicSample& first,
GdkEvent const * ev,
ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
bool for_mark = false) = 0;
- virtual void get_regions_at (RegionSelection &, framepos_t where, TrackViewList const &) const = 0;
- virtual void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const = 0;
- virtual RegionSelection get_regions_from_selection_and_mouse (framepos_t) = 0;
+ virtual void get_regions_at (RegionSelection &, samplepos_t where, TrackViewList const &) const = 0;
+ virtual void get_regions_after (RegionSelection&, samplepos_t where, const TrackViewList& ts) const = 0;
+ virtual RegionSelection get_regions_from_selection_and_mouse (samplepos_t) = 0;
virtual void get_regionviews_by_id (PBD::ID const id, RegionSelection & regions) const = 0;
virtual void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > >&) const = 0;
- virtual void mouse_add_new_tempo_event (framepos_t where) = 0;
- virtual void mouse_add_new_meter_event (framepos_t where) = 0;
+ virtual void mouse_add_new_tempo_event (samplepos_t where) = 0;
+ virtual void mouse_add_new_meter_event (samplepos_t where) = 0;
virtual void edit_tempo_section (ARDOUR::TempoSection*) = 0;
virtual void edit_meter_section (ARDOUR::MeterSection*) = 0;
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc
index 787cfcd07d..fe8b1150da 100644
--- a/gtk2_ardour/rc_option_editor.cc
+++ b/gtk2_ardour/rc_option_editor.cc
@@ -3189,8 +3189,8 @@ RCOptionEditor::RCOptionEditor ()
(_sync_source_2997->tip_widget(),
_("<b>When enabled</b> the external timecode source is assumed to use 29.97 fps instead of 30000/1001.\n"
"SMPTE 12M-1999 specifies 29.97df as 30000/1001. The spec further mentions that "
- "drop-frame timecode has an accumulated error of -86ms over a 24-hour period.\n"
- "Drop-frame timecode would compensate exactly for a NTSC color frame rate of 30 * 0.9990 (ie 29.970000). "
+ "drop-sample timecode has an accumulated error of -86ms over a 24-hour period.\n"
+ "Drop-sample timecode would compensate exactly for a NTSC color frame rate of 30 * 0.9990 (ie 29.970000). "
"That is not the actual rate. However, some vendors use that rate - despite it being against the specs - "
"because the variant of using exactly 29.97 fps has zero timecode drift.\n"
));
diff --git a/gtk2_ardour/region_editor.cc b/gtk2_ardour/region_editor.cc
index bb0199678e..3d4181dd2b 100644
--- a/gtk2_ardour/region_editor.cc
+++ b/gtk2_ardour/region_editor.cc
@@ -315,7 +315,7 @@ RegionEditor::end_clock_changed ()
void
RegionEditor::length_clock_changed ()
{
- framecnt_t frames = length_clock.current_time();
+ samplecnt_t samples = length_clock.current_time();
bool in_command = false;
boost::shared_ptr<Playlist> pl = _region->playlist();
@@ -324,7 +324,7 @@ RegionEditor::length_clock_changed ()
in_command = true;
_region->clear_changes ();
- _region->trim_end (_region->position() + frames - 1);
+ _region->trim_end (_region->position() + samples - 1);
_session->add_command(new StatefulDiffCommand (_region));
}
@@ -370,7 +370,7 @@ RegionEditor::bounds_changed (const PropertyChange& what_changed)
if (what_changed.contains (ARDOUR::Properties::sync_position) || what_changed.contains (ARDOUR::Properties::position)) {
int dir;
- frameoffset_t off = _region->sync_offset (dir);
+ sampleoffset_t off = _region->sync_offset (dir);
if (dir == -1) {
off = -off;
}
diff --git a/gtk2_ardour/region_layering_order_editor.cc b/gtk2_ardour/region_layering_order_editor.cc
index 35f493654e..63a39cd270 100644
--- a/gtk2_ardour/region_layering_order_editor.cc
+++ b/gtk2_ardour/region_layering_order_editor.cc
@@ -186,7 +186,7 @@ RegionLayeringOrderEditor::refill ()
}
void
-RegionLayeringOrderEditor::set_context (const string& a_name, Session* s, TimeAxisView* tav, boost::shared_ptr<Playlist> pl, framepos_t pos)
+RegionLayeringOrderEditor::set_context (const string& a_name, Session* s, TimeAxisView* tav, boost::shared_ptr<Playlist> pl, samplepos_t pos)
{
track_name_label.set_text (a_name);
diff --git a/gtk2_ardour/region_layering_order_editor.h b/gtk2_ardour/region_layering_order_editor.h
index 05ce273f1f..58ef4f8e0e 100644
--- a/gtk2_ardour/region_layering_order_editor.h
+++ b/gtk2_ardour/region_layering_order_editor.h
@@ -43,14 +43,14 @@ public:
RegionLayeringOrderEditor (PublicEditor&);
virtual ~RegionLayeringOrderEditor ();
- void set_context (const std::string &, ARDOUR::Session *, TimeAxisView *, boost::shared_ptr<ARDOUR::Playlist>, ARDOUR::framepos_t);
+ void set_context (const std::string &, ARDOUR::Session *, TimeAxisView *, boost::shared_ptr<ARDOUR::Playlist>, ARDOUR::samplepos_t);
void maybe_present ();
protected:
virtual bool on_key_press_event (GdkEventKey* event);
private:
- framepos_t position;
+ samplepos_t position;
bool in_row_change;
uint32_t regions_at_position;
diff --git a/gtk2_ardour/region_selection.cc b/gtk2_ardour/region_selection.cc
index c0f3f60e3f..e5cc93a0b1 100644
--- a/gtk2_ardour/region_selection.cc
+++ b/gtk2_ardour/region_selection.cc
@@ -261,27 +261,27 @@ RegionSelection::involves (const TimeAxisView& tv) const
return false;
}
-framepos_t
+samplepos_t
RegionSelection::start () const
{
- framepos_t s = max_framepos;
+ samplepos_t s = max_samplepos;
for (RegionSelection::const_iterator i = begin(); i != end(); ++i) {
s = min (s, (*i)->region()->position ());
}
- if (s == max_framepos) {
+ if (s == max_samplepos) {
return 0;
}
return s;
}
-framepos_t
-RegionSelection::end_frame () const
+samplepos_t
+RegionSelection::end_sample () const
{
- framepos_t e = 0;
+ samplepos_t e = 0;
for (RegionSelection::const_iterator i = begin(); i != end(); ++i) {
- e = max (e, (*i)->region()->last_frame ());
+ e = max (e, (*i)->region()->last_sample ());
}
return e;
diff --git a/gtk2_ardour/region_selection.h b/gtk2_ardour/region_selection.h
index 433f92e336..4cbeb2d747 100644
--- a/gtk2_ardour/region_selection.h
+++ b/gtk2_ardour/region_selection.h
@@ -52,11 +52,11 @@ public:
void clear_all();
- framepos_t start () const;
+ samplepos_t start () const;
/* "end" collides with list<>::end */
- framepos_t end_frame () const;
+ samplepos_t end_sample () const;
const std::list<RegionView *>& by_layer() const { return _bylayer; }
void by_position (std::list<RegionView*>&) const;
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index d94c1fae64..daca247297 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -156,18 +156,18 @@ RegionView::init (bool wfd)
name_highlight->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
}
- if (frame_handle_start) {
- frame_handle_start->set_data ("regionview", this);
- frame_handle_start->set_data ("isleft", (void*) 1);
- frame_handle_start->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_frame_handle_event), frame_handle_start, this));
- frame_handle_start->raise_to_top();
+ if (sample_handle_start) {
+ sample_handle_start->set_data ("regionview", this);
+ sample_handle_start->set_data ("isleft", (void*) 1);
+ sample_handle_start->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_sample_handle_event), sample_handle_start, this));
+ sample_handle_start->raise_to_top();
}
- if (frame_handle_end) {
- frame_handle_end->set_data ("regionview", this);
- frame_handle_end->set_data ("isleft", (void*) 0);
- frame_handle_end->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_frame_handle_event), frame_handle_end, this));
- frame_handle_end->raise_to_top();
+ if (sample_handle_end) {
+ sample_handle_end->set_data ("regionview", this);
+ sample_handle_end->set_data ("isleft", (void*) 0);
+ sample_handle_end->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_sample_handle_event), sample_handle_end, this));
+ sample_handle_end->raise_to_top();
}
if (name_text) {
@@ -199,11 +199,11 @@ RegionView::~RegionView ()
delete *g;
}
- for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_frames.begin (); i != _coverage_frames.end (); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_samples.begin (); i != _coverage_samples.end (); ++i) {
delete *i;
}
- drop_silent_frames ();
+ drop_silent_samples ();
delete editor;
}
@@ -218,12 +218,12 @@ RegionView::canvas_group_event (GdkEvent* event)
}
void
-RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*threshold*/)
+RegionView::set_silent_samples (const AudioIntervalResult& silences, double /*threshold*/)
{
- framecnt_t shortest = max_framecnt;
+ samplecnt_t shortest = max_samplecnt;
- /* remove old silent frames */
- drop_silent_frames ();
+ /* remove old silent samples */
+ drop_silent_samples ();
if (silences.empty()) {
return;
@@ -235,7 +235,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
ArdourCanvas::Rectangle* cr = new ArdourCanvas::Rectangle (group);
cr->set_ignore_events (true);
- _silent_frames.push_back (cr);
+ _silent_samples.push_back (cr);
/* coordinates for the rect are relative to the regionview origin */
@@ -250,11 +250,11 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
}
/* Find shortest audible segment */
- framecnt_t shortest_audible = max_framecnt;
+ samplecnt_t shortest_audible = max_samplecnt;
- framecnt_t s = _region->start();
+ samplecnt_t s = _region->start();
for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) {
- framecnt_t const dur = i->first - s;
+ samplecnt_t const dur = i->first - s;
if (dur > 0) {
shortest_audible = min (shortest_audible, dur);
}
@@ -262,7 +262,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
s = i->second;
}
- framecnt_t const dur = _region->start() + _region->length() - 1 - s;
+ samplecnt_t const dur = _region->start() + _region->length() - 1 - s;
if (dur > 0) {
shortest_audible = min (shortest_audible, dur);
}
@@ -277,7 +277,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
_silence_text->set_x_position (trackview.editor().sample_to_pixel (silences.front().first - _region->start()) + 10.0);
_silence_text->set_y_position (20.0);
- double ms = (float) shortest/_region->session().frame_rate();
+ double ms = (float) shortest/_region->session().sample_rate();
/* ms are now in seconds */
@@ -297,9 +297,9 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
+ ", "
+ string_compose (_("shortest = %1 %2"), ms, sunits);
- if (shortest_audible != max_framepos) {
+ if (shortest_audible != max_samplepos) {
/* ms are now in seconds */
- double ma = (float) shortest_audible / _region->session().frame_rate();
+ double ma = (float) shortest_audible / _region->session().sample_rate();
char const * aunits;
if (ma >= 60.0) {
@@ -319,21 +319,21 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
}
void
-RegionView::hide_silent_frames ()
+RegionView::hide_silent_samples ()
{
- for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_samples.begin (); i != _silent_samples.end (); ++i) {
(*i)->hide ();
}
_silence_text->hide();
}
void
-RegionView::drop_silent_frames ()
+RegionView::drop_silent_samples ()
{
- for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_samples.begin (); i != _silent_samples.end (); ++i) {
delete *i;
}
- _silent_frames.clear ();
+ _silent_samples.clear ();
delete _silence_text;
_silence_text = 0;
@@ -432,14 +432,14 @@ RegionView::reset_width_dependent_items (double pixel_width)
void
RegionView::region_muted ()
{
- set_frame_color ();
+ set_sample_color ();
region_renamed ();
}
void
RegionView::region_opacity ()
{
- set_frame_color ();
+ set_sample_color ();
}
void
@@ -455,7 +455,7 @@ RegionView::lower_to_bottom ()
}
bool
-RegionView::set_position (framepos_t pos, void* /*src*/, double* ignored)
+RegionView::set_position (samplepos_t pos, void* /*src*/, double* ignored)
{
double delta;
bool ret;
@@ -491,9 +491,9 @@ RegionView::set_samples_per_pixel (double fpp)
}
bool
-RegionView::set_duration (framecnt_t frames, void *src)
+RegionView::set_duration (samplecnt_t samples, void *src)
{
- if (!TimeAxisViewItem::set_duration (frames, src)) {
+ if (!TimeAxisViewItem::set_duration (samples, src)) {
return false;
}
@@ -600,7 +600,7 @@ void
RegionView::region_sync_changed ()
{
int sync_dir;
- framecnt_t sync_offset;
+ samplecnt_t sync_offset;
sync_offset = _region->sync_offset (sync_dir);
@@ -728,7 +728,7 @@ RegionView::set_height (double h)
if (sync_line) {
Points points;
int sync_dir;
- framecnt_t sync_offset;
+ samplecnt_t sync_offset;
sync_offset = _region->sync_offset (sync_dir);
double offset = sync_offset / samples_per_pixel;
@@ -738,30 +738,30 @@ RegionView::set_height (double h)
);
}
- for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_frames.begin(); i != _coverage_frames.end(); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_samples.begin(); i != _coverage_samples.end(); ++i) {
(*i)->set_y1 (h + 1);
}
- for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin(); i != _silent_frames.end(); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_samples.begin(); i != _silent_samples.end(); ++i) {
(*i)->set_y1 (h + 1);
}
}
-/** Remove old coverage frames and make new ones, if we're in a LayerDisplay mode
+/** Remove old coverage samples and make new ones, if we're in a LayerDisplay mode
* which uses them. */
void
-RegionView::update_coverage_frames (LayerDisplay d)
+RegionView::update_coverage_samples (LayerDisplay d)
{
- /* remove old coverage frames */
- for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_frames.begin (); i != _coverage_frames.end (); ++i) {
+ /* remove old coverage samples */
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_samples.begin (); i != _coverage_samples.end (); ++i) {
delete *i;
}
- _coverage_frames.clear ();
+ _coverage_samples.clear ();
if (d != Stacked) {
- /* don't do coverage frames unless we're in stacked mode */
+ /* don't do coverage samples unless we're in stacked mode */
return;
}
@@ -770,9 +770,9 @@ RegionView::update_coverage_frames (LayerDisplay d)
return;
}
- framepos_t const position = _region->first_frame ();
- framepos_t t = position;
- framepos_t const end = _region->last_frame ();
+ samplepos_t const position = _region->first_sample ();
+ samplepos_t t = position;
+ samplepos_t const end = _region->last_sample ();
ArdourCanvas::Rectangle* cr = 0;
bool me = false;
@@ -795,7 +795,7 @@ RegionView::update_coverage_frames (LayerDisplay d)
/* start off any new rect, if required */
if (cr == 0 || me != new_me) {
cr = new ArdourCanvas::Rectangle (group);
- _coverage_frames.push_back (cr);
+ _coverage_samples.push_back (cr);
cr->set_x0 (trackview.editor().sample_to_pixel (t - position));
cr->set_y0 (1);
cr->set_y1 (_height + 1);
@@ -821,12 +821,12 @@ RegionView::update_coverage_frames (LayerDisplay d)
cr->set_x1 (trackview.editor().sample_to_pixel (end - position));
}
- if (frame_handle_start) {
- frame_handle_start->raise_to_top ();
+ if (sample_handle_start) {
+ sample_handle_start->raise_to_top ();
}
- if (frame_handle_end) {
- frame_handle_end->raise_to_top ();
+ if (sample_handle_end) {
+ sample_handle_end->raise_to_top ();
}
if (name_highlight) {
@@ -839,13 +839,13 @@ RegionView::update_coverage_frames (LayerDisplay d)
}
bool
-RegionView::trim_front (framepos_t new_bound, bool no_overlap, const int32_t sub_num)
+RegionView::trim_front (samplepos_t new_bound, bool no_overlap, const int32_t sub_num)
{
if (_region->locked()) {
return false;
}
- framepos_t const pre_trim_first_frame = _region->first_frame();
+ samplepos_t const pre_trim_first_sample = _region->first_sample();
if (_region->position() == new_bound) {
return false;
@@ -856,50 +856,50 @@ RegionView::trim_front (framepos_t new_bound, bool no_overlap, const int32_t sub
if (no_overlap) {
// Get the next region on the left of this region and shrink/expand it.
boost::shared_ptr<Playlist> playlist (_region->playlist());
- boost::shared_ptr<Region> region_left = playlist->find_next_region (pre_trim_first_frame, End, 0);
+ boost::shared_ptr<Region> region_left = playlist->find_next_region (pre_trim_first_sample, End, 0);
bool regions_touching = false;
- if (region_left != 0 && (pre_trim_first_frame == region_left->last_frame() + 1)) {
+ if (region_left != 0 && (pre_trim_first_sample == region_left->last_sample() + 1)) {
regions_touching = true;
}
- // Only trim region on the left if the first frame has gone beyond the left region's last frame.
- if (region_left != 0 && (region_left->last_frame() > _region->first_frame() || regions_touching)) {
- region_left->trim_end (_region->first_frame() - 1);
+ // Only trim region on the left if the first sample has gone beyond the left region's last sample.
+ if (region_left != 0 && (region_left->last_sample() > _region->first_sample() || regions_touching)) {
+ region_left->trim_end (_region->first_sample() - 1);
}
}
region_changed (ARDOUR::bounds_change);
- return (pre_trim_first_frame != _region->first_frame()); //return true if we actually changed something
+ return (pre_trim_first_sample != _region->first_sample()); //return true if we actually changed something
}
bool
-RegionView::trim_end (framepos_t new_bound, bool no_overlap, const int32_t sub_num)
+RegionView::trim_end (samplepos_t new_bound, bool no_overlap, const int32_t sub_num)
{
if (_region->locked()) {
return false;
}
- framepos_t const pre_trim_last_frame = _region->last_frame();
+ samplepos_t const pre_trim_last_sample = _region->last_sample();
_region->trim_end (new_bound, sub_num);
if (no_overlap) {
// Get the next region on the right of this region and shrink/expand it.
boost::shared_ptr<Playlist> playlist (_region->playlist());
- boost::shared_ptr<Region> region_right = playlist->find_next_region (pre_trim_last_frame, Start, 1);
+ boost::shared_ptr<Region> region_right = playlist->find_next_region (pre_trim_last_sample, Start, 1);
bool regions_touching = false;
- if (region_right != 0 && (pre_trim_last_frame == region_right->first_frame() - 1)) {
+ if (region_right != 0 && (pre_trim_last_sample == region_right->first_sample() - 1)) {
regions_touching = true;
}
- // Only trim region on the right if the last frame has gone beyond the right region's first frame.
- if (region_right != 0 && (region_right->first_frame() < _region->last_frame() || regions_touching)) {
- region_right->trim_front (_region->last_frame() + 1, sub_num);
+ // Only trim region on the right if the last sample has gone beyond the right region's first sample.
+ if (region_right != 0 && (region_right->first_sample() < _region->last_sample() || regions_touching)) {
+ region_right->trim_front (_region->last_sample() + 1, sub_num);
}
region_changed (ARDOUR::bounds_change);
@@ -908,7 +908,7 @@ RegionView::trim_end (framepos_t new_bound, bool no_overlap, const int32_t sub_n
region_changed (PropertyChange (ARDOUR::Properties::length));
}
- return (pre_trim_last_frame != _region->last_frame()); //return true if we actually changed something
+ return (pre_trim_last_sample != _region->last_sample()); //return true if we actually changed something
}
@@ -924,7 +924,7 @@ RegionView::thaw_after_trim ()
void
-RegionView::move_contents (frameoffset_t distance)
+RegionView::move_contents (sampleoffset_t distance)
{
if (_region->locked()) {
return;
@@ -933,29 +933,29 @@ RegionView::move_contents (frameoffset_t distance)
region_changed (PropertyChange (ARDOUR::Properties::start));
}
-/** Snap a frame offset within our region using the current snap settings.
+/** Snap a sample offset within our region using the current snap settings.
* @param x Frame offset from this region's position.
* @param ensure_snap whether to ignore snap_mode (in the case of SnapOff) and magnetic snap.
* Used when inverting snap mode logic with key modifiers, or snap distance calculation.
- * @return Snapped frame offset from this region's position.
+ * @return Snapped sample offset from this region's position.
*/
-MusicFrame
-RegionView::snap_frame_to_frame (frameoffset_t x, bool ensure_snap) const
+MusicSample
+RegionView::snap_sample_to_sample (sampleoffset_t x, bool ensure_snap) const
{
PublicEditor& editor = trackview.editor();
- /* x is region relative, convert it to global absolute frames */
- framepos_t const session_frame = x + _region->position();
+ /* x is region relative, convert it to global absolute samples */
+ samplepos_t const session_sample = x + _region->position();
/* try a snap in either direction */
- MusicFrame frame (session_frame, 0);
- editor.snap_to (frame, RoundNearest, false, ensure_snap);
+ MusicSample sample (session_sample, 0);
+ editor.snap_to (sample, RoundNearest, false, ensure_snap);
/* if we went off the beginning of the region, snap forwards */
- if (frame.frame < _region->position ()) {
- frame.frame = session_frame;
- editor.snap_to (frame, RoundUpAlways, false, ensure_snap);
+ if (sample.sample < _region->position ()) {
+ sample.sample = session_sample;
+ editor.snap_to (sample, RoundUpAlways, false, ensure_snap);
}
/* back to region relative, keeping the relevant divisor */
- return MusicFrame (frame.frame - _region->position(), frame.division);
+ return MusicSample (sample.sample - _region->position(), sample.division);
}
diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h
index 7cc4c6b964..e7b1789491 100644
--- a/gtk2_ardour/region_view.h
+++ b/gtk2_ardour/region_view.h
@@ -27,7 +27,7 @@
#include <sigc++/signal.h>
#include "ardour/region.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "canvas/fwd.h"
@@ -71,14 +71,14 @@ public:
virtual void set_height (double);
virtual void set_samples_per_pixel (double);
- virtual bool set_duration (framecnt_t, void*);
+ virtual bool set_duration (samplecnt_t, void*);
void move (double xdelta, double ydelta);
void raise_to_top ();
void lower_to_bottom ();
- bool set_position(framepos_t pos, void* src, double* delta = 0);
+ bool set_position(samplepos_t pos, void* src, double* delta = 0);
virtual void show_region_editor ();
void hide_region_editor ();
@@ -95,25 +95,25 @@ public:
virtual void exited () {}
virtual void enable_display(bool yn) { _enable_display = yn; }
- virtual void update_coverage_frames (LayerDisplay);
+ virtual void update_coverage_samples (LayerDisplay);
static PBD::Signal1<void,RegionView*> RegionViewGoingAway;
/** Called when a front trim is about to begin */
virtual void trim_front_starting () {}
- bool trim_front (framepos_t, bool, const int32_t sub_num);
+ bool trim_front (samplepos_t, bool, const int32_t sub_num);
/** Called when a start trim has finished */
virtual void trim_front_ending () {}
- bool trim_end (framepos_t, bool, const int32_t sub_num);
- void move_contents (ARDOUR::frameoffset_t);
+ bool trim_end (samplepos_t, bool, const int32_t sub_num);
+ void move_contents (ARDOUR::sampleoffset_t);
virtual void thaw_after_trim ();
- void set_silent_frames (const ARDOUR::AudioIntervalResult&, double threshold);
- void drop_silent_frames ();
- void hide_silent_frames ();
+ void set_silent_samples (const ARDOUR::AudioIntervalResult&, double threshold);
+ void drop_silent_samples ();
+ void hide_silent_samples ();
struct PositionOrder {
bool operator()(const RegionView* a, const RegionView* b) {
@@ -121,7 +121,7 @@ public:
}
};
- ARDOUR::MusicFrame snap_frame_to_frame (ARDOUR::frameoffset_t, bool ensure_snap = false) const;
+ ARDOUR::MusicSample snap_sample_to_sample (ARDOUR::sampleoffset_t, bool ensure_snap = false) const;
protected:
@@ -179,14 +179,14 @@ protected:
* different bits of regions according to whether or not they are the one
* that will be played at any given time.
*/
- std::list<ArdourCanvas::Rectangle*> _coverage_frames;
+ std::list<ArdourCanvas::Rectangle*> _coverage_samples;
/** a list of rectangles used to show silent segments
*/
- std::list<ArdourCanvas::Rectangle*> _silent_frames;
+ std::list<ArdourCanvas::Rectangle*> _silent_samples;
/** a list of rectangles used to show the current silence threshold
*/
- std::list<ArdourCanvas::Rectangle*> _silent_threshold_frames;
+ std::list<ArdourCanvas::Rectangle*> _silent_threshold_samples;
/** a text item to display strip silence statistics */
ArdourCanvas::Text* _silence_text;
};
diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc
index aa4a8c908a..8eb64840f6 100644
--- a/gtk2_ardour/rhythm_ferret.cc
+++ b/gtk2_ardour/rhythm_ferret.cc
@@ -257,10 +257,10 @@ RhythmFerret::run_analysis ()
}
int
-RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, frameoffset_t /*offset*/, AnalysisFeatureList& results)
+RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, sampleoffset_t /*offset*/, AnalysisFeatureList& results)
{
try {
- TransientDetector t (_session->frame_rate());
+ TransientDetector t (_session->sample_rate());
for (uint32_t i = 0; i < readable->n_channels(); ++i) {
@@ -312,10 +312,10 @@ RhythmFerret::get_note_onset_function ()
}
int
-RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, frameoffset_t /*offset*/, AnalysisFeatureList& results)
+RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, sampleoffset_t /*offset*/, AnalysisFeatureList& results)
{
try {
- OnsetDetector t (_session->frame_rate());
+ OnsetDetector t (_session->sample_rate());
for (uint32_t i = 0; i < readable->n_channels(); ++i) {
@@ -347,7 +347,7 @@ RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, fra
}
if (!results.empty()) {
- OnsetDetector::cleanup_onsets (results, _session->frame_rate(), trigger_gap_adjustment.get_value());
+ OnsetDetector::cleanup_onsets (results, _session->sample_rate(), trigger_gap_adjustment.get_value());
}
return 0;
diff --git a/gtk2_ardour/rhythm_ferret.h b/gtk2_ardour/rhythm_ferret.h
index df0a9b3dfe..5f14509a18 100644
--- a/gtk2_ardour/rhythm_ferret.h
+++ b/gtk2_ardour/rhythm_ferret.h
@@ -115,8 +115,8 @@ private:
int get_note_onset_function ();
void run_analysis ();
- int run_percussion_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::frameoffset_t offset, ARDOUR::AnalysisFeatureList& results);
- int run_note_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::frameoffset_t offset, ARDOUR::AnalysisFeatureList& results);
+ int run_percussion_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::sampleoffset_t offset, ARDOUR::AnalysisFeatureList& results);
+ int run_note_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, ARDOUR::sampleoffset_t offset, ARDOUR::AnalysisFeatureList& results);
void do_action ();
void do_split_action ();
diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc
index 2077412670..0b2477dd1a 100644
--- a/gtk2_ardour/route_params_ui.cc
+++ b/gtk2_ardour/route_params_ui.cc
@@ -70,9 +70,9 @@ RouteParams_UI::RouteParams_UI ()
using namespace Notebook_Helpers;
- input_frame.set_shadow_type(Gtk::SHADOW_NONE);
- output_frame.set_shadow_type(Gtk::SHADOW_NONE);
- latency_frame.set_shadow_type (Gtk::SHADOW_NONE);
+ input_sample.set_shadow_type(Gtk::SHADOW_NONE);
+ output_sample.set_shadow_type(Gtk::SHADOW_NONE);
+ latency_sample.set_shadow_type (Gtk::SHADOW_NONE);
notebook.set_show_tabs (true);
notebook.set_show_border (true);
@@ -96,16 +96,16 @@ RouteParams_UI::RouteParams_UI ()
route_select_scroller.add(route_display);
route_select_scroller.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
- route_select_frame.set_name("RouteSelectBaseFrame");
- route_select_frame.set_shadow_type (Gtk::SHADOW_IN);
- route_select_frame.add(route_select_scroller);
+ route_select_sample.set_name("RouteSelectBaseFrame");
+ route_select_sample.set_shadow_type (Gtk::SHADOW_IN);
+ route_select_sample.add(route_select_scroller);
- list_vpacker.pack_start (route_select_frame, true, true);
+ list_vpacker.pack_start (route_select_sample, true, true);
- notebook.pages().push_back (TabElem (input_frame, _("Inputs")));
- notebook.pages().push_back (TabElem (output_frame, _("Outputs")));
+ notebook.pages().push_back (TabElem (input_sample, _("Inputs")));
+ notebook.pages().push_back (TabElem (output_sample, _("Outputs")));
notebook.pages().push_back (TabElem (redir_hpane, _("Plugins, Inserts & Sends")));
- notebook.pages().push_back (TabElem (latency_frame, _("Latency")));
+ notebook.pages().push_back (TabElem (latency_sample, _("Latency")));
notebook.set_name ("InspectorNotebook");
@@ -117,8 +117,8 @@ RouteParams_UI::RouteParams_UI ()
delay_label.set_alignment (0, 0.5);
// changeable area
- route_param_frame.set_name("RouteParamsBaseFrame");
- route_param_frame.set_shadow_type (Gtk::SHADOW_IN);
+ route_param_sample.set_name("RouteParamsBaseFrame");
+ route_param_sample.set_shadow_type (Gtk::SHADOW_IN);
route_hpacker.pack_start (notebook, true, true);
@@ -276,10 +276,10 @@ RouteParams_UI::refresh_latency ()
}
void
-RouteParams_UI::cleanup_latency_frame ()
+RouteParams_UI::cleanup_latency_sample ()
{
if (latency_widget) {
- latency_frame.remove ();
+ latency_sample.remove ();
latency_packer.remove (*latency_widget);
latency_packer.remove (latency_button_box);
latency_packer.remove (delay_label);
@@ -293,9 +293,9 @@ RouteParams_UI::cleanup_latency_frame ()
}
void
-RouteParams_UI::setup_latency_frame ()
+RouteParams_UI::setup_latency_sample ()
{
- latency_widget = new LatencyGUI (*(_route->output()), _session->frame_rate(), AudioEngine::instance()->samples_per_cycle());
+ latency_widget = new LatencyGUI (*(_route->output()), _session->sample_rate(), AudioEngine::instance()->samples_per_cycle());
char buf[128];
snprintf (buf, sizeof (buf), _("Playback delay: %" PRId64 " samples"), _route->initial_delay());
@@ -309,34 +309,34 @@ RouteParams_UI::setup_latency_frame ()
_route->signal_latency_changed.connect (latency_connections, invalidator (*this), boost::bind (&RouteParams_UI::refresh_latency, this), gui_context());
_route->initial_delay_changed.connect (latency_connections, invalidator (*this), boost::bind (&RouteParams_UI::refresh_latency, this), gui_context());
- latency_frame.add (latency_packer);
- latency_frame.show_all ();
+ latency_sample.add (latency_packer);
+ latency_sample.show_all ();
}
void
-RouteParams_UI::setup_io_frames()
+RouteParams_UI::setup_io_samples()
{
- cleanup_io_frames();
+ cleanup_io_samples();
// input
_input_iosel = new IOSelector (this, _session, _route->input());
_input_iosel->setup ();
- input_frame.add (*_input_iosel);
- input_frame.show_all();
+ input_sample.add (*_input_iosel);
+ input_sample.show_all();
// output
_output_iosel = new IOSelector (this, _session, _route->output());
_output_iosel->setup ();
- output_frame.add (*_output_iosel);
- output_frame.show_all();
+ output_sample.add (*_output_iosel);
+ output_sample.show_all();
}
void
-RouteParams_UI::cleanup_io_frames()
+RouteParams_UI::cleanup_io_samples()
{
if (_input_iosel) {
_input_iosel->Finished (IOSelector::Cancelled);
- input_frame.remove();
+ input_sample.remove();
delete _input_iosel;
_input_iosel = 0;
}
@@ -344,7 +344,7 @@ RouteParams_UI::cleanup_io_frames()
if (_output_iosel) {
_output_iosel->Finished (IOSelector::Cancelled);
- output_frame.remove();
+ output_sample.remove();
delete _output_iosel;
_output_iosel = 0;
}
@@ -391,7 +391,7 @@ RouteParams_UI::route_removed (boost::weak_ptr<Route> wr)
}
if (route == _route) {
- cleanup_io_frames();
+ cleanup_io_samples();
cleanup_view();
cleanup_processor_boxes();
@@ -429,10 +429,10 @@ RouteParams_UI::session_going_away ()
route_display_model->clear();
- cleanup_io_frames();
+ cleanup_io_samples();
cleanup_view();
cleanup_processor_boxes();
- cleanup_latency_frame ();
+ cleanup_latency_sample ();
_route.reset ((Route*) 0);
_processor.reset ((Processor*) 0);
@@ -459,17 +459,17 @@ RouteParams_UI::route_selected()
_route_processors_connection.disconnect ();
cleanup_processor_boxes();
cleanup_view();
- cleanup_io_frames();
- cleanup_latency_frame ();
+ cleanup_io_samples();
+ cleanup_latency_sample ();
}
// update the other panes with the correct info
_route = route;
//update_routeinfo (route);
- setup_io_frames();
+ setup_io_samples();
setup_processor_boxes();
- setup_latency_frame ();
+ setup_latency_sample ();
route->processors_changed.connect (_route_processors_connection, invalidator (*this), boost::bind (&RouteParams_UI::processors_changed, this, _1), gui_context());
@@ -483,10 +483,10 @@ RouteParams_UI::route_selected()
_route_processors_connection.disconnect ();
// remove from view
- cleanup_io_frames();
+ cleanup_io_samples();
cleanup_view();
cleanup_processor_boxes();
- cleanup_latency_frame ();
+ cleanup_latency_sample ();
_route.reset ((Route*) 0);
_processor.reset ((Processor*) 0);
diff --git a/gtk2_ardour/route_params_ui.h b/gtk2_ardour/route_params_ui.h
index 76a56c7957..98542171a2 100644
--- a/gtk2_ardour/route_params_ui.h
+++ b/gtk2_ardour/route_params_ui.h
@@ -71,11 +71,11 @@ private:
Gtk::ScrolledWindow route_select_scroller;
Gtk::Notebook notebook;
- Gtk::Frame input_frame;
- Gtk::Frame output_frame;
+ Gtk::Frame input_sample;
+ Gtk::Frame output_sample;
ArdourWidgets::HPane redir_hpane;
- Gtk::Frame route_select_frame;
+ Gtk::Frame route_select_sample;
Gtk::HBox route_hpacker;
Gtk::VBox route_vpacker;
@@ -86,11 +86,11 @@ private:
ArdourWidgets::HPane right_hpane;
- Gtk::Frame route_param_frame;
+ Gtk::Frame route_param_sample;
Gtk::VBox choice_vpacker;
- Gtk::Frame latency_frame;
+ Gtk::Frame latency_sample;
Gtk::VBox latency_packer;
Gtk::HButtonBox latency_button_box;
Gtk::Button latency_apply_button;
@@ -160,11 +160,11 @@ private:
void route_selected();
//void route_unselected (gint row, gint col, GdkEvent *ev);
- void setup_io_frames();
- void cleanup_io_frames();
+ void setup_io_samples();
+ void cleanup_io_samples();
void cleanup_view(bool stopupdate = true);
- void cleanup_latency_frame ();
- void setup_latency_frame ();
+ void cleanup_latency_sample ();
+ void setup_latency_sample ();
void processors_changed (ARDOUR::RouteProcessorChange);
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 0a22ed82dc..7614093e02 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -867,7 +867,7 @@ RouteTimeAxisView::build_display_menu ()
}
void
-RouteTimeAxisView::show_timestretch (framepos_t start, framepos_t end, int layers, int layer)
+RouteTimeAxisView::show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer)
{
TimeAxisView::show_timestretch (start, end, layers, layer);
@@ -1292,7 +1292,7 @@ RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
* @param results List to add things to.
*/
void
-RouteTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results, bool within)
+RouteTimeAxisView::get_selectables (samplepos_t start, samplepos_t end, double top, double bot, list<Selectable*>& results, bool within)
{
if ((_view && ((top < 0.0 && bot < 0.0))) || touched (top, bot)) {
_view->get_selectables (start, end, top, bot, results, within);
@@ -1360,7 +1360,7 @@ RouteTimeAxisView::name_entry_changed (string const& str)
}
boost::shared_ptr<Region>
-RouteTimeAxisView::find_next_region (framepos_t pos, RegionPoint point, int32_t dir)
+RouteTimeAxisView::find_next_region (samplepos_t pos, RegionPoint point, int32_t dir)
{
boost::shared_ptr<Playlist> pl = playlist ();
@@ -1371,8 +1371,8 @@ RouteTimeAxisView::find_next_region (framepos_t pos, RegionPoint point, int32_t
return boost::shared_ptr<Region> ();
}
-framepos_t
-RouteTimeAxisView::find_next_region_boundary (framepos_t pos, int32_t dir)
+samplepos_t
+RouteTimeAxisView::find_next_region_boundary (samplepos_t pos, int32_t dir)
{
boost::shared_ptr<Playlist> pl = playlist ();
@@ -1485,7 +1485,7 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
}
bool
-RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num)
+RouteTimeAxisView::paste (samplepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num)
{
if (!is_track()) {
return false;
@@ -1503,15 +1503,15 @@ RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteConte
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("paste to %1\n", pos));
/* add multi-paste offset if applicable */
- std::pair<framepos_t, framepos_t> extent = (*p)->get_extent();
- const framecnt_t duration = extent.second - extent.first;
+ std::pair<samplepos_t, samplepos_t> extent = (*p)->get_extent();
+ const samplecnt_t duration = extent.second - extent.first;
pos += _editor.get_paste_offset(pos, ctx.count, duration);
pl->clear_changes ();
pl->clear_owned_changes ();
if (Config->get_edit_mode() == Ripple) {
- std::pair<framepos_t, framepos_t> extent = (*p)->get_extent_with_endspace();
- framecnt_t amount = extent.second - extent.first;
+ std::pair<samplepos_t, samplepos_t> extent = (*p)->get_extent_with_endspace();
+ samplecnt_t amount = extent.second - extent.first;
pl->ripple(pos, amount * ctx.times, boost::shared_ptr<Region>());
}
pl->paste (*p, pos, ctx.times, sub_num);
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 3868dfebd1..48af0f82b2 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -90,22 +90,22 @@ public:
void set_samples_per_pixel (double);
void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
- void show_timestretch (framepos_t start, framepos_t end, int layers, int layer);
+ void show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer);
void hide_timestretch ();
void selection_click (GdkEventButton*);
void set_selected_points (PointSelection&);
void set_selected_regionviews (RegionSelection&);
- void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&, bool within = false);
+ void get_selectables (ARDOUR::samplepos_t start, ARDOUR::samplepos_t end, double top, double bot, std::list<Selectable *>&, bool within = false);
void get_inverted_selectables (Selection&, std::list<Selectable*>&);
void set_layer_display (LayerDisplay d, bool apply_to_selection = false);
LayerDisplay layer_display () const;
- boost::shared_ptr<ARDOUR::Region> find_next_region (framepos_t pos, ARDOUR::RegionPoint, int32_t dir);
- framepos_t find_next_region_boundary (framepos_t pos, int32_t dir);
+ boost::shared_ptr<ARDOUR::Region> find_next_region (samplepos_t pos, ARDOUR::RegionPoint, int32_t dir);
+ samplepos_t find_next_region_boundary (samplepos_t pos, int32_t dir);
/* Editing operations */
void cut_copy_clear (Selection&, Editing::CutCopyOp);
- bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx, const int32_t sub_num);
+ bool paste (ARDOUR::samplepos_t, const Selection&, PasteContext& ctx, const int32_t sub_num);
RegionView* combine_regions ();
void uncombine_regions ();
void uncombine_region (RegionView*);
@@ -228,7 +228,7 @@ protected:
virtual void show_existing_automation (bool apply_to_selection = false);
virtual void hide_all_automation (bool apply_to_selection = false);
- void timestretch (framepos_t start, framepos_t end);
+ void timestretch (samplepos_t start, samplepos_t end);
void speed_changed ();
void map_frozen ();
void color_handler ();
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index dd36aa05c9..b9ece1ed07 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -499,7 +499,7 @@ RouteUI::mute_press (GdkEventButton* ev)
}
boost::shared_ptr<MuteControl> mc = _route->mute_control();
- mc->start_touch (_session->audible_frame ());
+ mc->start_touch (_session->audible_sample ());
_session->set_controls (route_list_to_control_list (rl, &Stripable::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::InverseGroup);
}
@@ -515,7 +515,7 @@ RouteUI::mute_press (GdkEventButton* ev)
}
boost::shared_ptr<MuteControl> mc = _route->mute_control();
- mc->start_touch (_session->audible_frame ());
+ mc->start_touch (_session->audible_sample ());
mc->set_value (!_route->muted_by_self(), Controllable::UseGroup);
}
}
@@ -533,7 +533,7 @@ RouteUI::mute_release (GdkEventButton* /*ev*/)
_mute_release = 0;
}
- _route->mute_control()->stop_touch (_session->audible_frame ());
+ _route->mute_control()->stop_touch (_session->audible_sample ());
return false;
}
@@ -1920,7 +1920,7 @@ RouteUI::map_frozen ()
void
RouteUI::adjust_latency ()
{
- LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session->frame_rate(), AudioEngine::instance()->samples_per_cycle());
+ LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session->sample_rate(), AudioEngine::instance()->samples_per_cycle());
}
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc
index a75574bb19..da68450d7b 100644
--- a/gtk2_ardour/selection.cc
+++ b/gtk2_ardour/selection.cc
@@ -338,7 +338,7 @@ Selection::toggle (vector<RegionView*>& r)
}
long
-Selection::toggle (framepos_t start, framepos_t end)
+Selection::toggle (samplepos_t start, samplepos_t end)
{
clear_objects(); //enforce object/range exclusivity
@@ -484,7 +484,7 @@ Selection::add (MidiRegionView* mrv)
}
long
-Selection::add (framepos_t start, framepos_t end)
+Selection::add (samplepos_t start, samplepos_t end)
{
clear_objects(); //enforce object/range exclusivity
@@ -502,7 +502,7 @@ Selection::add (framepos_t start, framepos_t end)
}
void
-Selection::move_time (framecnt_t distance)
+Selection::move_time (samplecnt_t distance)
{
if (distance == 0) {
return;
@@ -517,7 +517,7 @@ Selection::move_time (framecnt_t distance)
}
void
-Selection::replace (uint32_t sid, framepos_t start, framepos_t end)
+Selection::replace (uint32_t sid, samplepos_t start, samplepos_t end)
{
clear_objects(); //enforce object/range exclusivity
@@ -673,7 +673,7 @@ Selection::remove (uint32_t selection_id)
}
void
-Selection::remove (framepos_t /*start*/, framepos_t /*end*/)
+Selection::remove (samplepos_t /*start*/, samplepos_t /*end*/)
{
}
@@ -770,7 +770,7 @@ Selection::set (vector<RegionView*>& v)
* the list of tracks it applies to.
*/
long
-Selection::set (framepos_t start, framepos_t end)
+Selection::set (samplepos_t start, samplepos_t end)
{
clear_objects(); //enforce region/object exclusivity
clear_time();
@@ -807,7 +807,7 @@ Selection::set (framepos_t start, framepos_t end)
* @param end New end time.
*/
void
-Selection::set_preserving_all_ranges (framepos_t start, framepos_t end)
+Selection::set_preserving_all_ranges (samplepos_t start, samplepos_t end)
{
clear_objects(); //enforce region/object exclusivity
@@ -1108,9 +1108,9 @@ Selection::add (const list<ArdourMarker*>& m)
}
void
-MarkerSelection::range (framepos_t& s, framepos_t& e)
+MarkerSelection::range (samplepos_t& s, samplepos_t& e)
{
- s = max_framepos;
+ s = max_samplepos;
e = 0;
for (MarkerSelection::iterator i = begin(); i != end(); ++i) {
@@ -1370,8 +1370,8 @@ Selection::set_state (XMLNode const & node, int)
}
} else if ((*i)->name() == X_("AudioRange")) {
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
if (!(*i)->get_property (X_("start"), start) || !(*i)->get_property (X_("end"), end)) {
assert(false);
diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h
index 7b0da04f82..869589f285 100644
--- a/gtk2_ardour/selection.h
+++ b/gtk2_ardour/selection.h
@@ -128,8 +128,8 @@ public:
void set (RegionView*, bool also_clear_tracks = true);
void set (MidiRegionView*);
void set (std::vector<RegionView*>&);
- long set (framepos_t, framepos_t);
- void set_preserving_all_ranges (framepos_t, framepos_t);
+ long set (samplepos_t, samplepos_t);
+ void set_preserving_all_ranges (samplepos_t, samplepos_t);
void set (boost::shared_ptr<Evoral::ControlList>);
void set (boost::shared_ptr<ARDOUR::Playlist>);
void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
@@ -144,7 +144,7 @@ public:
void toggle (MidiRegionView*);
void toggle (MidiCutBuffer*);
void toggle (std::vector<RegionView*>&);
- long toggle (framepos_t, framepos_t);
+ long toggle (samplepos_t, samplepos_t);
void toggle (ARDOUR::AutomationList*);
void toggle (boost::shared_ptr<ARDOUR::Playlist>);
void toggle (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
@@ -159,7 +159,7 @@ public:
void add (MidiRegionView*);
void add (MidiCutBuffer*);
void add (std::vector<RegionView*>&);
- long add (framepos_t, framepos_t);
+ long add (samplepos_t, samplepos_t);
void add (boost::shared_ptr<Evoral::ControlList>);
void add (boost::shared_ptr<ARDOUR::Playlist>);
void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
@@ -176,7 +176,7 @@ public:
void remove (MidiRegionView*);
void remove (MidiCutBuffer*);
void remove (uint32_t selection_id);
- void remove (framepos_t, framepos_t);
+ void remove (samplepos_t, samplepos_t);
void remove (boost::shared_ptr<ARDOUR::AutomationList>);
void remove (boost::shared_ptr<ARDOUR::Playlist>);
void remove (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
@@ -186,9 +186,9 @@ public:
void remove_regions (TimeAxisView *);
- void move_time (framecnt_t);
+ void move_time (samplecnt_t);
- void replace (uint32_t time_index, framepos_t start, framepos_t end);
+ void replace (uint32_t time_index, samplepos_t start, samplepos_t end);
/*
* A note about items in an editing Selection:
diff --git a/gtk2_ardour/selection_memento.cc b/gtk2_ardour/selection_memento.cc
index fb5c417292..89eda56ccb 100644
--- a/gtk2_ardour/selection_memento.cc
+++ b/gtk2_ardour/selection_memento.cc
@@ -67,7 +67,7 @@ SelectionMemento::set_state (const XMLNode& node, int /*version*/) {
editor.reset_zoom (llrintf (zoom));
}
- framepos_t pos;
+ samplepos_t pos;
if (node.get_property ("left-frame", pos)) {
if (pos < 0) {
pos = 0;
diff --git a/gtk2_ardour/session_dialog.cc b/gtk2_ardour/session_dialog.cc
index 8ad6e2d388..0164366f74 100644
--- a/gtk2_ardour/session_dialog.cc
+++ b/gtk2_ardour/session_dialog.cc
@@ -99,10 +99,10 @@ SessionDialog::SessionDialog (bool require_new, const std::string& session_name,
* and invisible most of the time.
*/
- info_frame.set_shadow_type(SHADOW_ETCHED_OUT);
- info_frame.set_no_show_all (true);
- info_frame.set_border_width (12);
- get_vbox()->pack_start (info_frame, false, false);
+ info_sample.set_shadow_type(SHADOW_ETCHED_OUT);
+ info_sample.set_no_show_all (true);
+ info_sample.set_border_width (12);
+ get_vbox()->pack_start (info_sample, false, false);
setup_new_session_page ();
@@ -453,9 +453,9 @@ SessionDialog::setup_initial_choice_box ()
info_box->pack_start (*updates_button, false, false);
- info_frame.add (*info_box);
+ info_sample.add (*info_box);
info_box->show_all ();
- info_frame.show ();
+ info_sample.show ();
}
/* recent session scroller */
@@ -698,9 +698,9 @@ SessionDialog::setup_new_session_page ()
template_hbox->pack_start (*template_scroller, true, true);
- template_desc_frame.set_name (X_("TextHighlightFrame"));
- template_desc_frame.add (*desc_scroller);
- template_hbox->pack_start (template_desc_frame, true, true);
+ template_desc_sample.set_name (X_("TextHighlightFrame"));
+ template_desc_sample.add (*desc_scroller);
+ template_hbox->pack_start (template_desc_sample, true, true);
}
//template_desc is the textview that displays the currently selected template's description
diff --git a/gtk2_ardour/session_dialog.h b/gtk2_ardour/session_dialog.h
index 9d4f08ed97..aa418addfc 100644
--- a/gtk2_ardour/session_dialog.h
+++ b/gtk2_ardour/session_dialog.h
@@ -84,7 +84,7 @@ private:
bool back_button_pressed (GdkEventButton*);
bool open_button_pressed (GdkEventButton*);
- Gtk::Frame info_frame;
+ Gtk::Frame info_sample;
/* initial choice page */
@@ -175,7 +175,7 @@ private:
void template_row_selected ();
Gtk::TextView template_desc;
- Gtk::Frame template_desc_frame;
+ Gtk::Frame template_desc_sample;
Gtk::VBox session_new_vbox;
Gtk::VBox session_existing_vbox;
diff --git a/gtk2_ardour/session_import_dialog.cc b/gtk2_ardour/session_import_dialog.cc
index 775b736076..caecd979a5 100644
--- a/gtk2_ardour/session_import_dialog.cc
+++ b/gtk2_ardour/session_import_dialog.cc
@@ -62,12 +62,12 @@ SessionImportDialog::SessionImportDialog (ARDOUR::Session* target) :
file_hbox.pack_start (file_entry, true, true);
file_hbox.pack_start (file_browse_button, false, false);
- file_frame.add (file_hbox);
- file_frame.set_border_width (5);
- file_frame.set_name ("ImportFrom");
- file_frame.set_label (_("Import from Session"));
+ file_sample.add (file_hbox);
+ file_sample.set_border_width (5);
+ file_sample.set_name ("ImportFrom");
+ file_sample.set_label (_("Import from Session"));
- get_vbox()->pack_start (file_frame, false, false);
+ get_vbox()->pack_start (file_sample, false, false);
// Session browser
session_tree = TreeStore::create (sb_cols);
diff --git a/gtk2_ardour/session_import_dialog.h b/gtk2_ardour/session_import_dialog.h
index a6ed77516e..35dc15dcc0 100644
--- a/gtk2_ardour/session_import_dialog.h
+++ b/gtk2_ardour/session_import_dialog.h
@@ -78,7 +78,7 @@ private:
XMLTree tree;
// GUI
- Gtk::Frame file_frame;
+ Gtk::Frame file_sample;
Gtk::HBox file_hbox;
Gtk::Entry file_entry;
Gtk::Button file_browse_button;
diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc
index 6c16245ae6..025b0054ec 100644
--- a/gtk2_ardour/session_option_editor.cc
+++ b/gtk2_ardour/session_option_editor.cc
@@ -42,7 +42,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
"timecode-format",
- _("Timecode frames-per-second"),
+ _("Timecode samples-per-second"),
sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
);
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index c9788c8314..61905e209b 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -153,10 +153,10 @@ SoundFileBox::SoundFileBox (bool /*persistent*/)
preview_label.set_markup (_("<b>Sound File Information</b>"));
- border_frame.set_label_widget (preview_label);
- border_frame.add (main_box);
+ border_sample.set_label_widget (preview_label);
+ border_sample.add (main_box);
- pack_start (border_frame, true, true);
+ pack_start (border_sample, true, true);
set_border_width (6);
main_box.set_border_width (6);
@@ -275,7 +275,7 @@ SoundFileBox::audition_active(bool active) {
}
void
-SoundFileBox::audition_progress(ARDOUR::framecnt_t pos, ARDOUR::framecnt_t len) {
+SoundFileBox::audition_progress(ARDOUR::samplecnt_t pos, ARDOUR::samplecnt_t len) {
if (!_seeking) {
seek_slider.set_value( 1000.0 * pos / len);
seek_slider.set_sensitive (true);
@@ -397,7 +397,7 @@ SoundFileBox::setup_labels (const string& filename)
format_text.set_text (n);
channels_value.set_text (to_string (sf_info.channels));
- if (_session && sf_info.samplerate != _session->frame_rate()) {
+ if (_session && sf_info.samplerate != _session->sample_rate()) {
samplerate.set_markup (string_compose ("<b>%1</b>", _("Sample rate:")));
samplerate_value.set_markup (string_compose (X_("<b>%1 Hz</b>"), sf_info.samplerate));
samplerate_value.set_name ("NewSessionSR1Label");
@@ -409,7 +409,7 @@ SoundFileBox::setup_labels (const string& filename)
samplerate.set_name ("NewSessionSR2Label");
}
- framecnt_t const nfr = _session ? _session->nominal_frame_rate() : 25;
+ samplecnt_t const nfr = _session ? _session->nominal_sample_rate() : 25;
double src_coef = (double) nfr / sf_info.samplerate;
length_clock.set (sf_info.length * src_coef + 0.5, true);
@@ -516,7 +516,7 @@ SoundFileBox::audition ()
SourceFactory::createExternal (DataType::AUDIO, *_session,
path, n,
Source::Flag (ARDOUR::AudioFileSource::NoPeakFile), false));
- if (afs->sample_rate() != _session->nominal_frame_rate()) {
+ if (afs->sample_rate() != _session->nominal_sample_rate()) {
boost::shared_ptr<SrcFileSource> sfs (new SrcFileSource(*_session, afs, _src_quality));
srclist.push_back(sfs);
} else {
@@ -549,16 +549,16 @@ SoundFileBox::audition ()
r = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (srclist, plist, false));
}
- frameoffset_t audition_position = 0;
+ sampleoffset_t audition_position = 0;
switch(_import_position) {
case ImportAtTimestamp:
audition_position = 0;
break;
case ImportAtPlayhead:
- audition_position = _session->transport_frame();
+ audition_position = _session->transport_sample();
break;
case ImportAtStart:
- audition_position = _session->current_start_frame();
+ audition_position = _session->current_start_sample();
break;
case ImportAtEditPoint:
audition_position = PublicEditor::instance().get_preferred_edit_position ();
@@ -1636,7 +1636,7 @@ bool
SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool& src_needed, bool& multichannel)
{
SoundFileInfo info;
- framepos_t sz = 0;
+ samplepos_t sz = 0;
bool err = false;
string errmsg;
@@ -1658,7 +1658,7 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
}
}
- if (info.samplerate != _session->frame_rate()) {
+ if (info.samplerate != _session->sample_rate()) {
src_needed = true;
}
@@ -2066,7 +2066,7 @@ SoundFileOmega::do_something (int action)
ImportMode mode = get_mode ();
ImportDisposition chns = get_channel_disposition ();
PluginInfoPtr instrument = instrument_combo.selected_instrument();
- framepos_t where;
+ samplepos_t where;
MidiTrackNameSource mts = get_midi_track_name_source ();
MidiTempoMapDisposition mtd = (get_use_smf_tempo_map () ? SMFTempoUse : SMFTempoIgnore);
@@ -2078,10 +2078,10 @@ SoundFileOmega::do_something (int action)
where = -1;
break;
case ImportAtPlayhead:
- where = _session->transport_frame();
+ where = _session->transport_sample();
break;
case ImportAtStart:
- where = _session->current_start_frame();
+ where = _session->current_start_sample();
break;
}
diff --git a/gtk2_ardour/sfdb_ui.h b/gtk2_ardour/sfdb_ui.h
index 6fa69f21a2..1167271d5a 100644
--- a/gtk2_ardour/sfdb_ui.h
+++ b/gtk2_ardour/sfdb_ui.h
@@ -96,7 +96,7 @@ protected:
AudioClock length_clock;
AudioClock timecode_clock;
- Gtk::Frame border_frame;
+ Gtk::Frame border_sample;
Gtk::Label preview_label;
Gtk::TextView tags_entry;
@@ -113,7 +113,7 @@ protected:
PBD::ScopedConnectionList auditioner_connections;
void audition_active(bool);
- void audition_progress(ARDOUR::framecnt_t, ARDOUR::framecnt_t);
+ void audition_progress(ARDOUR::samplecnt_t, ARDOUR::samplecnt_t);
void update_autoplay ();
void autoplay_toggled ();
diff --git a/gtk2_ardour/simple_progress_dialog.h b/gtk2_ardour/simple_progress_dialog.h
index 494bf12296..c05668b07d 100644
--- a/gtk2_ardour/simple_progress_dialog.h
+++ b/gtk2_ardour/simple_progress_dialog.h
@@ -26,7 +26,7 @@ public:
get_vbox()->pack_start (*cancel_button, PACK_SHRINK);
}
- void update_progress (framecnt_t c, framecnt_t t) {
+ void update_progress (samplecnt_t c, samplecnt_t t) {
pbar->set_fraction ((float) c / (float) t);
// see also ARDOUR_UI::gui_idle_handler();
int timeout = 30;
diff --git a/gtk2_ardour/soundcloud_export_selector.cc b/gtk2_ardour/soundcloud_export_selector.cc
index 1ab13a6b36..3a1d5a1d2b 100644
--- a/gtk2_ardour/soundcloud_export_selector.cc
+++ b/gtk2_ardour/soundcloud_export_selector.cc
@@ -62,16 +62,16 @@ SoundcloudExportSelector::SoundcloudExportSelector () :
soundcloud_username_entry.set_text (ARDOUR::SessionMetadata::Metadata()->user_email());
soundcloud_password_entry.set_visibility (false);
- Gtk::Frame *sc_frame = manage (new Gtk::Frame);
- sc_frame->set_border_width (4);
- sc_frame->set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
- sc_frame->set_name ("soundcloud_export_box");
- pack_start (*sc_frame, false, false);
+ Gtk::Frame *sc_sample = manage (new Gtk::Frame);
+ sc_sample->set_border_width (4);
+ sc_sample->set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
+ sc_sample->set_name ("soundcloud_export_box");
+ pack_start (*sc_sample, false, false);
sc_table.set_border_width (4);
sc_table.set_col_spacings (5);
sc_table.set_row_spacings (5);
- sc_frame->add (sc_table);
+ sc_sample->add (sc_table);
sc_table.attach ( *(Gtk::manage (new Gtk::Image (ARDOUR_UI_UTILS::get_icon (X_("soundcloud"))))) , 0, 1, 0, 2);
@@ -84,7 +84,7 @@ SoundcloudExportSelector::SoundcloudExportSelector () :
sc_table.attach (soundcloud_download_checkbox, 2, 3, 5, 6);
pack_end (progress_bar, false, false);
- sc_frame->show_all ();
+ sc_sample->show_all ();
}
diff --git a/gtk2_ardour/speaker_dialog.cc b/gtk2_ardour/speaker_dialog.cc
index 00495a8000..7fd8f08825 100644
--- a/gtk2_ardour/speaker_dialog.cc
+++ b/gtk2_ardour/speaker_dialog.cc
@@ -34,7 +34,7 @@ using namespace Gtkmm2ext;
SpeakerDialog::SpeakerDialog ()
: ArdourWindow (_("Speaker Configuration"))
- , aspect_frame ("", 0.5, 0.5, 1.5, false)
+ , aspect_sample ("", 0.5, 0.5, 1.5, false)
, azimuth_adjustment (0, 0.0, 360.0, 10.0, 1.0)
, azimuth_spinner (azimuth_adjustment)
, add_speaker_button (_("Add Speaker"))
@@ -49,13 +49,13 @@ SpeakerDialog::SpeakerDialog ()
side_vbox.set_spacing (6);
side_vbox.pack_start (add_speaker_button, false, false);
- aspect_frame.set_size_request (300, 200);
- aspect_frame.set_shadow_type (SHADOW_NONE);
- aspect_frame.add (darea);
+ aspect_sample.set_size_request (300, 200);
+ aspect_sample.set_shadow_type (SHADOW_NONE);
+ aspect_sample.add (darea);
hbox.set_spacing (6);
hbox.set_border_width (6);
- hbox.pack_start (aspect_frame, true, true);
+ hbox.pack_start (aspect_sample, true, true);
hbox.pack_start (side_vbox, false, false);
HBox* current_speaker_hbox = manage (new HBox);
diff --git a/gtk2_ardour/speaker_dialog.h b/gtk2_ardour/speaker_dialog.h
index 9521700380..8066ff56ec 100644
--- a/gtk2_ardour/speaker_dialog.h
+++ b/gtk2_ardour/speaker_dialog.h
@@ -42,7 +42,7 @@ private:
boost::weak_ptr<ARDOUR::Speakers> _speakers;
Gtk::HBox hbox;
Gtk::VBox side_vbox;
- Gtk::AspectFrame aspect_frame;
+ Gtk::AspectFrame aspect_sample;
Gtk::DrawingArea darea;
Gtk::Adjustment azimuth_adjustment;
Gtk::SpinButton azimuth_spinner;
diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc
index ac51076a46..14327cd72d 100644
--- a/gtk2_ardour/step_editor.cc
+++ b/gtk2_ardour/step_editor.cc
@@ -115,11 +115,11 @@ StepEditor::prepare_step_edit_region ()
} else {
- const Meter& m = _mtv.session()->tempo_map().meter_at_frame (step_edit_insert_position);
- double baf = max (0.0, _mtv.session()->tempo_map().beat_at_frame (step_edit_insert_position));
+ const Meter& m = _mtv.session()->tempo_map().meter_at_sample (step_edit_insert_position);
+ double baf = max (0.0, _mtv.session()->tempo_map().beat_at_sample (step_edit_insert_position));
double next_bar_in_beats = baf + m.divisions_per_bar();
- framecnt_t next_bar_pos = _mtv.session()->tempo_map().frame_at_beat (next_bar_in_beats);
- framecnt_t len = next_bar_pos - step_edit_insert_position;
+ samplecnt_t next_bar_pos = _mtv.session()->tempo_map().sample_at_beat (next_bar_in_beats);
+ samplecnt_t len = next_bar_pos - step_edit_insert_position;
step_edit_region = _mtv.add_region (step_edit_insert_position, len, true);
@@ -135,16 +135,16 @@ StepEditor::reset_step_edit_beat_pos ()
assert (step_edit_region);
assert (step_edit_region_view);
- framecnt_t frames_from_start = _editor.get_preferred_edit_position() - step_edit_region->position();
+ samplecnt_t samples_from_start = _editor.get_preferred_edit_position() - step_edit_region->position();
- if (frames_from_start < 0) {
+ if (samples_from_start < 0) {
/* this can happen with snap enabled, and the edit point == Playhead. we snap the
position of the new region, and it can end up after the edit point.
*/
- frames_from_start = 0;
+ samples_from_start = 0;
}
- step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (frames_from_start);
+ step_edit_beat_pos = step_edit_region_view->region_samples_to_region_beats (samples_from_start);
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
}
@@ -179,14 +179,14 @@ StepEditor::stop_step_editing ()
void
StepEditor::check_step_edit ()
{
- MidiRingBuffer<framepos_t>& incoming (_track->step_edit_ring_buffer());
+ MidiRingBuffer<samplepos_t>& incoming (_track->step_edit_ring_buffer());
uint8_t* buf;
uint32_t bufsize = 32;
buf = new uint8_t[bufsize];
while (incoming.read_space()) {
- framepos_t time;
+ samplepos_t time;
Evoral::EventType type;
uint32_t size;
@@ -234,7 +234,7 @@ StepEditor::move_step_edit_beat_pos (Evoral::Beats beats)
}
if (beats > 0.0) {
step_edit_beat_pos = min (step_edit_beat_pos + beats,
- step_edit_region_view->region_frames_to_region_beats (step_edit_region->length()));
+ step_edit_region_view->region_samples_to_region_beats (step_edit_region->length()));
} else if (beats < 0.0) {
if (-beats < step_edit_beat_pos) {
step_edit_beat_pos += beats; // its negative, remember
@@ -283,7 +283,7 @@ StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evo
/* make sure its visible on the horizontal axis */
- framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos + beat_duration);
+ samplepos_t fpos = step_edit_region_view->region_beats_to_absolute_samples (step_edit_beat_pos + beat_duration);
if (fpos >= (_editor.leftmost_sample() + _editor.current_page_samples())) {
_editor.reset_x_origin (fpos - (_editor.current_page_samples()/4));
@@ -409,9 +409,9 @@ StepEditor::step_edit_bar_sync ()
return;
}
- framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos);
- fpos = _session->tempo_map().round_to_bar (fpos, RoundUpAlways).frame;
- step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (fpos - step_edit_region->position()).round_up_to_beat();
+ samplepos_t fpos = step_edit_region_view->region_beats_to_absolute_samples (step_edit_beat_pos);
+ fpos = _session->tempo_map().round_to_bar (fpos, RoundUpAlways).sample;
+ step_edit_beat_pos = step_edit_region_view->region_samples_to_region_beats (fpos - step_edit_region->position()).round_up_to_beat();
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
}
diff --git a/gtk2_ardour/step_editor.h b/gtk2_ardour/step_editor.h
index b16cd8f863..cecd39f2a3 100644
--- a/gtk2_ardour/step_editor.h
+++ b/gtk2_ardour/step_editor.h
@@ -67,7 +67,7 @@ public:
void stop_step_editing ();
private:
- ARDOUR::framepos_t step_edit_insert_position;
+ ARDOUR::samplepos_t step_edit_insert_position;
Evoral::Beats step_edit_beat_pos;
boost::shared_ptr<ARDOUR::MidiRegion> step_edit_region;
MidiRegionView* step_edit_region_view;
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index f13826e47b..c0917d7e57 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -63,7 +63,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Container* canvas_g
, _layers (1)
, _layer_display (Overlaid)
, height (tv.height)
- , last_rec_data_frame(0)
+ , last_rec_data_sample(0)
{
CANVAS_DEBUG_NAME (_canvas_group, string_compose ("SV canvas group %1", _trackview.name()));
@@ -158,7 +158,7 @@ StreamView::set_samples_per_pixel (double fpp)
recbox.rectangle->set_x1 (xend);
}
- update_coverage_frames ();
+ update_coverage_samples ();
return 0;
}
@@ -296,7 +296,7 @@ StreamView::playlist_layered (boost::weak_ptr<Track> wtr)
if (_layer_display == Stacked) {
update_contents_height ();
/* tricky. playlist_changed() does this as well, and its really inefficient. */
- update_coverage_frames ();
+ update_coverage_samples ();
} else {
/* layering has probably been modified. reflect this in the canvas. */
layer_regions();
@@ -324,14 +324,14 @@ StreamView::playlist_switched (boost::weak_ptr<Track> wtr)
/* update layers count and the y positions and heights of our regions */
_layers = tr->playlist()->top_layer() + 1;
update_contents_height ();
- update_coverage_frames ();
+ update_coverage_samples ();
/* catch changes */
tr->playlist()->LayeringChanged.connect (playlist_connections, invalidator (*this), boost::bind (&StreamView::playlist_layered, this, boost::weak_ptr<Track> (tr)), gui_context());
tr->playlist()->RegionAdded.connect (playlist_connections, invalidator (*this), boost::bind (&StreamView::add_region_view, this, _1), gui_context());
tr->playlist()->RegionRemoved.connect (playlist_connections, invalidator (*this), boost::bind (&StreamView::remove_region_view, this, _1), gui_context());
- tr->playlist()->ContentsChanged.connect (playlist_connections, invalidator (*this), boost::bind (&StreamView::update_coverage_frames, this), gui_context());
+ tr->playlist()->ContentsChanged.connect (playlist_connections, invalidator (*this), boost::bind (&StreamView::update_coverage_samples, this), gui_context());
}
@@ -409,9 +409,9 @@ StreamView::transport_looped()
}
void
-StreamView::create_rec_box(framepos_t frame_pos, double width)
+StreamView::create_rec_box(samplepos_t sample_pos, double width)
{
- const double xstart = _trackview.editor().sample_to_pixel(frame_pos);
+ const double xstart = _trackview.editor().sample_to_pixel(sample_pos);
const double xend = xstart + width;
const uint32_t fill_color = UIConfiguration::instance().color_mod("recording rect", "recording_rect");
@@ -432,7 +432,7 @@ StreamView::create_rec_box(framepos_t frame_pos, double width)
if (rec_rects.empty()) {
recbox.start = _trackview.session()->record_location ();
} else {
- recbox.start = _trackview.session()->transport_frame ();
+ recbox.start = _trackview.session()->transport_sample ();
}
rec_rects.push_back (recbox);
@@ -450,7 +450,7 @@ StreamView::update_rec_box ()
if (rec_active && rec_rects.size() > 0) {
/* only update the last box */
RecBoxInfo & rect = rec_rects.back();
- framepos_t const at = _trackview.track()->current_capture_end ();
+ samplepos_t const at = _trackview.track()->current_capture_end ();
double xstart;
double xend;
@@ -544,14 +544,14 @@ StreamView::set_selected_regionviews (RegionSelection& regions)
}
/** Get selectable things within a given range.
- * @param start Start time in session frames.
- * @param end End time in session frames.
+ * @param start Start time in session samples.
+ * @param end End time in session samples.
* @param top Top y range, in trackview coordinates (ie 0 is the top of the track view)
* @param bot Bottom y range, in trackview coordinates (ie 0 is the top of the track view)
* @param result Filled in with selectable things.
*/
void
-StreamView::get_selectables (framepos_t start, framepos_t end, double top, double bottom, list<Selectable*>& results, bool within)
+StreamView::get_selectables (samplepos_t start, samplepos_t end, double top, double bottom, list<Selectable*>& results, bool within)
{
if (_trackview.editor().internal_editing()) {
return; // Don't select regions with an internal tool
@@ -676,19 +676,19 @@ StreamView::set_layer_display (LayerDisplay d)
}
update_contents_height ();
- update_coverage_frames ();
+ update_coverage_samples ();
}
void
-StreamView::update_coverage_frames ()
+StreamView::update_coverage_samples ()
{
for (RegionViewList::iterator i = region_views.begin (); i != region_views.end (); ++i) {
- (*i)->update_coverage_frames (_layer_display);
+ (*i)->update_coverage_samples (_layer_display);
}
}
void
-StreamView::check_record_layers (boost::shared_ptr<Region> region, framepos_t to)
+StreamView::check_record_layers (boost::shared_ptr<Region> region, samplepos_t to)
{
if (_new_rec_layer_time < to) {
/* The region being recorded has overlapped the start of a top-layered region, so
@@ -698,7 +698,7 @@ StreamView::check_record_layers (boost::shared_ptr<Region> region, framepos_t to
*/
/* Stop this happening again */
- _new_rec_layer_time = max_framepos;
+ _new_rec_layer_time = max_samplepos;
/* Make space in the view for the new layer */
++_layers;
@@ -721,6 +721,6 @@ StreamView::setup_new_rec_layer_time (boost::shared_ptr<Region> region)
if (_layer_display == Stacked) {
_new_rec_layer_time = _trackview.track()->playlist()->find_next_top_layer_position (region->start());
} else {
- _new_rec_layer_time = max_framepos;
+ _new_rec_layer_time = max_samplepos;
}
}
diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h
index 094a93eaa9..850bdaea3b 100644
--- a/gtk2_ardour/streamview.h
+++ b/gtk2_ardour/streamview.h
@@ -47,8 +47,8 @@ namespace ArdourCanvas {
struct RecBoxInfo {
ArdourCanvas::Rectangle* rectangle;
- framepos_t start;
- ARDOUR::framecnt_t length;
+ samplepos_t start;
+ ARDOUR::samplecnt_t length;
};
class Selectable;
@@ -98,7 +98,7 @@ public:
void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
void set_selected_regionviews (RegionSelection&);
- void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&, bool within = false);
+ void get_selectables (ARDOUR::samplepos_t, ARDOUR::samplepos_t, double, double, std::list<Selectable* >&, bool within = false);
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}
@@ -116,7 +116,7 @@ public:
return 0;
}
- void check_record_layers (boost::shared_ptr<ARDOUR::Region>, ARDOUR::framepos_t);
+ void check_record_layers (boost::shared_ptr<ARDOUR::Region>, ARDOUR::samplepos_t);
virtual void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
@@ -132,7 +132,7 @@ protected:
void transport_looped();
void rec_enable_changed();
void sess_rec_enable_changed();
- void create_rec_box(framepos_t frame_pos, double width);
+ void create_rec_box(samplepos_t sample_pos, double width);
virtual void setup_rec_box () = 0;
virtual void update_rec_box ();
@@ -151,7 +151,7 @@ protected:
RouteTimeAxisView& _trackview;
ArdourCanvas::Container* _canvas_group;
- ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
+ ArdourCanvas::Rectangle* canvas_rect; /* sample around the whole thing */
typedef std::list<RegionView* > RegionViewList;
RegionViewList region_views;
@@ -176,16 +176,16 @@ protected:
double height;
PBD::ScopedConnectionList rec_data_ready_connections;
- framepos_t last_rec_data_frame;
+ samplepos_t last_rec_data_sample;
/* When recording, the session time at which a new layer must be created for the region
- being recorded, or max_framepos if not applicable.
+ being recorded, or max_samplepos if not applicable.
*/
- framepos_t _new_rec_layer_time;
+ samplepos_t _new_rec_layer_time;
void setup_new_rec_layer_time (boost::shared_ptr<ARDOUR::Region>);
private:
- void update_coverage_frames ();
+ void update_coverage_samples ();
};
#endif /* __ardour_streamview_h__ */
diff --git a/gtk2_ardour/strip_silence_dialog.cc b/gtk2_ardour/strip_silence_dialog.cc
index 52f05a6b94..a2f8bc7983 100644
--- a/gtk2_ardour/strip_silence_dialog.cc
+++ b/gtk2_ardour/strip_silence_dialog.cc
@@ -79,7 +79,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
++n;
_minimum_length->set_session (s);
- _minimum_length->set_mode (AudioClock::Frames);
+ _minimum_length->set_mode (AudioClock::Samples);
_minimum_length->set (1000, true);
table->attach (*Gtk::manage (new Gtk::Label (_("Fade length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL);
@@ -87,7 +87,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
++n;
_fade_length->set_session (s);
- _fade_length->set_mode (AudioClock::Frames);
+ _fade_length->set_mode (AudioClock::Samples);
_fade_length->set (64, true);
hbox->pack_start (*table);
@@ -176,7 +176,7 @@ StripSilenceDialog::drop_rects ()
_lock.unlock ();
for (list<ViewInterval>::iterator v = views.begin(); v != views.end(); ++v) {
- v->view->drop_silent_frames ();
+ v->view->drop_silent_samples ();
}
cancel_button->set_sensitive (false);
@@ -223,7 +223,7 @@ StripSilenceDialog::update_silence_rects ()
double const y = _threshold.get_value();
for (list<ViewInterval>::iterator v = views.begin(); v != views.end(); ++v) {
- v->view->set_silent_frames (v->intervals, y);
+ v->view->set_silent_samples (v->intervals, y);
}
}
@@ -320,16 +320,16 @@ StripSilenceDialog::threshold_changed ()
restart_thread ();
}
-framecnt_t
+samplecnt_t
StripSilenceDialog::minimum_length () const
{
- return std::max((framecnt_t)1, _minimum_length->current_duration (views.front().view->region()->position()));
+ return std::max((samplecnt_t)1, _minimum_length->current_duration (views.front().view->region()->position()));
}
-framecnt_t
+samplecnt_t
StripSilenceDialog::fade_length () const
{
- return std::max((framecnt_t)0, _fade_length->current_duration (views.front().view->region()->position()));
+ return std::max((samplecnt_t)0, _fade_length->current_duration (views.front().view->region()->position()));
}
void
diff --git a/gtk2_ardour/strip_silence_dialog.h b/gtk2_ardour/strip_silence_dialog.h
index a4d444e0ed..8179d2cbe2 100644
--- a/gtk2_ardour/strip_silence_dialog.h
+++ b/gtk2_ardour/strip_silence_dialog.h
@@ -46,8 +46,8 @@ public:
void silences (ARDOUR::AudioIntervalMap&);
- ARDOUR::framecnt_t minimum_length () const;
- ARDOUR::framecnt_t fade_length () const;
+ ARDOUR::samplecnt_t minimum_length () const;
+ ARDOUR::samplecnt_t fade_length () const;
void on_response (int response_id) {
Gtk::Dialog::on_response (response_id);
diff --git a/gtk2_ardour/tape_region_view.cc b/gtk2_ardour/tape_region_view.cc
index 1e3c31f565..f9035ae4f2 100644
--- a/gtk2_ardour/tape_region_view.cc
+++ b/gtk2_ardour/tape_region_view.cc
@@ -124,7 +124,7 @@ TapeAudioRegionView::update (uint32_t /*n*/)
#24 0x00007f957394ee6b in ARDOUR::AudioSource::read_peaks_with_fpp(ARDOUR::PeakData*, long, long, long, double, long) const (this=0x55f6fd359140, peaks=0x55f700da6b80, npeaks=1356, start=113190, cnt=447480, samples_per_visual_peak=330, samples_per_file_peak=256) at ../libs/ardour/audiosource.cc:391
#25 0x00007f957394eb15 in ARDOUR::AudioSource::read_peaks(ARDOUR::PeakData*, long, long, long, double) const (this=0x55f6fd359140, peaks=0x55f700da6b80, npeaks=1356, start=113190, cnt=447480, samples_per_visual_peak=330) at ../libs/ardour/audiosource.cc:337
#26 0x00007f957393a905 in ARDOUR::AudioRegion::read_peaks(ARDOUR::PeakData*, long, long, long, unsigned int, double) const (this=
- 0x55f6fd84c3b0, buf=0x55f700da6b80, npeaks=1356, offset=113190, cnt=447480, chan_n=0, frames_per_pixel=330) at ../libs/ardour/audioregion.cc:431
+ 0x55f6fd84c3b0, buf=0x55f700da6b80, npeaks=1356, offset=113190, cnt=447480, chan_n=0, samples_per_pixel=330) at ../libs/ardour/audioregion.cc:431
#27 0x00007f9574f09caa in ArdourWaveView::WaveView::generate_image(boost::shared_ptr<ArdourWaveView::WaveViewThreadRequest>, bool) const (this=0x55f6fdf341a0, req=..., in_render_thread=false)
at ../libs/canvas/wave_view.cc:1005
#28 0x00007f9574f08e99 in ArdourWaveView::WaveView::get_image(long, long, bool&) const (this=0x55f6fdf341a0, start=225060, end=448800, full_image=@0x7ffc4d9070c7: false)
diff --git a/gtk2_ardour/template_dialog.cc b/gtk2_ardour/template_dialog.cc
index a5bbcd4089..e503be74a9 100644
--- a/gtk2_ardour/template_dialog.cc
+++ b/gtk2_ardour/template_dialog.cc
@@ -268,7 +268,7 @@ TemplateManager::TemplateManager ()
vb->pack_start (*sw);
vb->pack_start (_progress_bar);
- Frame* desc_frame = manage (new Frame (_("Description")));
+ Frame* desc_sample = manage (new Frame (_("Description")));
_description_editor.set_wrap_mode (Gtk::WRAP_WORD);
_description_editor.set_size_request (300,400);
@@ -279,10 +279,10 @@ TemplateManager::TemplateManager ()
_description_editor.get_buffer()->signal_changed().connect (sigc::mem_fun (*this, &TemplateManager::set_desc_dirty));
- desc_frame->add (_description_editor);
+ desc_sample->add (_description_editor);
pack_start (*vb);
- pack_start (*desc_frame);
+ pack_start (*desc_sample);
pack_start (*vb_btns);
show_all_children ();
diff --git a/gtk2_ardour/tempo_curve.cc b/gtk2_ardour/tempo_curve.cc
index 4d2ea31a46..d4b5d91a8e 100644
--- a/gtk2_ardour/tempo_curve.cc
+++ b/gtk2_ardour/tempo_curve.cc
@@ -27,7 +27,7 @@ void TempoCurve::setup_sizes(const double timebar_height)
curve_height = floor (timebar_height) - 2.5;
}
/* ignores Tempo note type - only note_types_per_minute is potentially curved */
-TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba, ARDOUR::TempoSection& temp, framepos_t frame, bool handle_events)
+TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba, ARDOUR::TempoSection& temp, samplepos_t sample, bool handle_events)
: editor (ed)
, _parent (&parent)
@@ -40,8 +40,8 @@ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint
, _start_text (0)
, _end_text (0)
{
- frame_position = frame;
- unit_position = editor.sample_to_pixel (frame);
+ sample_position = sample;
+ unit_position = editor.sample_to_pixel (sample);
group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple (unit_position, 1));
#ifdef CANVAS_DEBUG
@@ -113,19 +113,19 @@ TempoCurve::the_item() const
}
void
-TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
+TempoCurve::set_position (samplepos_t sample, samplepos_t end_sample)
{
- unit_position = editor.sample_to_pixel (frame);
+ unit_position = editor.sample_to_pixel (sample);
group->set_x_position (unit_position);
- frame_position = frame;
- _end_frame = end_frame;
+ sample_position = sample;
+ _end_sample = end_sample;
points->clear();
points = new ArdourCanvas::Points ();
points->push_back (ArdourCanvas::Duple (0.0, curve_height));
- if (frame >= end_frame) {
+ if (sample >= end_sample) {
/* shouldn't happen but ..*/
const double tempo_at = _tempo.note_types_per_minute();
const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height);
@@ -138,25 +138,25 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height);
points->push_back (ArdourCanvas::Duple (0.0, y_pos));
- points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (end_frame - frame), y_pos));
+ points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (end_sample - sample), y_pos));
} else {
- const framepos_t frame_step = max ((end_frame - frame) / 5, (framepos_t) 1);
- framepos_t current_frame = frame;
+ const samplepos_t sample_step = max ((end_sample - sample) / 5, (samplepos_t) 1);
+ samplepos_t current_sample = sample;
- while (current_frame < end_frame) {
- const double tempo_at = _tempo.tempo_at_minute (_tempo.minute_at_frame (current_frame)).note_types_per_minute();
+ while (current_sample < end_sample) {
+ const double tempo_at = _tempo.tempo_at_minute (_tempo.minute_at_sample (current_sample)).note_types_per_minute();
const double y_pos = max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0);
- points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_frame - frame), min (y_pos, curve_height)));
+ points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_sample - sample), min (y_pos, curve_height)));
- current_frame += frame_step;
+ current_sample += sample_step;
}
- const double tempo_at = _tempo.tempo_at_minute (_tempo.minute_at_frame (end_frame)).note_types_per_minute();
+ const double tempo_at = _tempo.tempo_at_minute (_tempo.minute_at_sample (end_sample)).note_types_per_minute();
const double y_pos = max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0);
- points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (end_frame - frame), min (y_pos, curve_height)));
+ points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (end_sample - sample), min (y_pos, curve_height)));
}
_curve->set (*points);
@@ -168,9 +168,9 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
_end_text->set (buf);
_start_text->set_position (ArdourCanvas::Duple (10, .5 ));
- _end_text->set_position (ArdourCanvas::Duple (editor.sample_to_pixel (end_frame - frame) - _end_text->text_width() - 10, .5 ));
+ _end_text->set_position (ArdourCanvas::Duple (editor.sample_to_pixel (end_sample - sample) - _end_text->text_width() - 10, .5 ));
- if (_end_text->text_width() + _start_text->text_width() + 20 > editor.sample_to_pixel (end_frame - frame)) {
+ if (_end_text->text_width() + _start_text->text_width() + 20 > editor.sample_to_pixel (end_sample - sample)) {
_start_text->hide();
_end_text->hide();
} else {
@@ -182,7 +182,7 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
void
TempoCurve::reposition ()
{
- set_position (frame_position, _end_frame);
+ set_position (sample_position, _end_sample);
}
void
diff --git a/gtk2_ardour/tempo_curve.h b/gtk2_ardour/tempo_curve.h
index 621048726b..55ce76db3a 100644
--- a/gtk2_ardour/tempo_curve.h
+++ b/gtk2_ardour/tempo_curve.h
@@ -21,7 +21,7 @@ class PublicEditor;
class TempoCurve : public sigc::trackable
{
public:
- TempoCurve (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, ARDOUR::TempoSection& temp, framepos_t frame, bool handle_events);
+ TempoCurve (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, ARDOUR::TempoSection& temp, samplepos_t sample, bool handle_events);
~TempoCurve ();
static PBD::Signal1<void,TempoCurve*> CatchDeletion;
@@ -31,9 +31,9 @@ public:
ArdourCanvas::Item& the_item() const;
void canvas_height_set (double);
- void set_position (framepos_t lower, framepos_t upper);
+ void set_position (samplepos_t lower, samplepos_t upper);
void set_color_rgba (uint32_t rgba);
- framepos_t position() const { return frame_position; }
+ samplepos_t position() const { return sample_position; }
ArdourCanvas::Container * get_parent() { return _parent; }
void reparent (ArdourCanvas::Container & parent);
@@ -55,8 +55,8 @@ protected:
ArdourCanvas::FramedCurve* _curve;
double unit_position;
- framepos_t frame_position;
- framepos_t _end_frame;
+ samplepos_t sample_position;
+ samplepos_t _end_sample;
bool _shown;
double _canvas_height;
uint32_t _color;
diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc
index 723d931cb8..48b54e981f 100644
--- a/gtk2_ardour/tempo_dialog.cc
+++ b/gtk2_ardour/tempo_dialog.cc
@@ -34,7 +34,7 @@ using namespace Gtkmm2ext;
using namespace ARDOUR;
using namespace PBD;
-TempoDialog::TempoDialog (TempoMap& map, framepos_t frame, const string&)
+TempoDialog::TempoDialog (TempoMap& map, samplepos_t sample, const string&)
: ArdourDialog (_("New Tempo"))
, _map (&map)
, _section (0)
@@ -48,8 +48,8 @@ TempoDialog::TempoDialog (TempoMap& map, framepos_t frame, const string&)
, pulse_selector_label (_("Pulse:"), ALIGN_LEFT, ALIGN_CENTER)
, tap_tempo_button (_("Tap tempo"))
{
- Tempo tempo (map.tempo_at_frame (frame));
- Timecode::BBT_Time when (map.bbt_at_frame (frame));
+ Tempo tempo (map.tempo_at_sample (sample));
+ Timecode::BBT_Time when (map.bbt_at_sample (sample));
init (when, tempo.note_types_per_minute(), tempo.end_note_types_per_minute(), tempo.note_type(), TempoSection::Constant, true, MusicTime);
}
@@ -68,7 +68,7 @@ TempoDialog::TempoDialog (TempoMap& map, TempoSection& section, const string&)
, pulse_selector_label (_("Pulse:"), ALIGN_LEFT, ALIGN_CENTER)
, tap_tempo_button (_("Tap tempo"))
{
- Timecode::BBT_Time when (map.bbt_at_frame (section.frame()));
+ Timecode::BBT_Time when (map.bbt_at_sample (section.sample()));
init (when, section.note_types_per_minute(), section.end_note_types_per_minute(), section.note_type(), section.type()
, section.initial() || section.locked_to_meter(), section.position_lock_style());
}
@@ -477,12 +477,12 @@ TempoDialog::tap_tempo_focus_out (GdkEventFocus* )
return false;
}
-MeterDialog::MeterDialog (TempoMap& map, framepos_t frame, const string&)
+MeterDialog::MeterDialog (TempoMap& map, samplepos_t sample, const string&)
: ArdourDialog (_("New Meter"))
{
- frame = map.round_to_bar(frame, RoundNearest).frame;
- Timecode::BBT_Time when (map.bbt_at_frame (frame));
- Meter meter (map.meter_at_frame (frame));
+ sample = map.round_to_bar(sample, RoundNearest).sample;
+ Timecode::BBT_Time when (map.bbt_at_sample (sample));
+ Meter meter (map.meter_at_sample (sample));
init (when, meter.divisions_per_bar(), meter.note_divisor(), false, MusicTime);
}
@@ -490,7 +490,7 @@ MeterDialog::MeterDialog (TempoMap& map, framepos_t frame, const string&)
MeterDialog::MeterDialog (TempoMap& map, MeterSection& section, const string&)
: ArdourDialog (_("Edit Meter"))
{
- Timecode::BBT_Time when (map.bbt_at_frame (section.frame()));
+ Timecode::BBT_Time when (map.bbt_at_sample (section.sample()));
init (when, section.divisions_per_bar(), section.note_divisor(), section.initial(), section.position_lock_style());
}
diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h
index baa671df43..f9f0dd34a0 100644
--- a/gtk2_ardour/tempo_dialog.h
+++ b/gtk2_ardour/tempo_dialog.h
@@ -38,7 +38,7 @@
class TempoDialog : public ArdourDialog
{
public:
- TempoDialog (ARDOUR::TempoMap&, framepos_t, const std::string & action);
+ TempoDialog (ARDOUR::TempoMap&, samplepos_t, const std::string & action);
TempoDialog (ARDOUR::TempoMap&, ARDOUR::TempoSection&, const std::string & action);
double get_bpm ();
@@ -102,7 +102,7 @@ class MeterDialog : public ArdourDialog
{
public:
- MeterDialog (ARDOUR::TempoMap&, framepos_t, const std::string & action);
+ MeterDialog (ARDOUR::TempoMap&, samplepos_t, const std::string & action);
MeterDialog (ARDOUR::TempoMap&, ARDOUR::MeterSection&, const std::string & action);
double get_bpb ();
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc
index 8d1d183d3a..98de440e48 100644
--- a/gtk2_ardour/tempo_lines.cc
+++ b/gtk2_ardour/tempo_lines.cc
@@ -29,7 +29,7 @@
using namespace std;
-TempoLines::TempoLines (ArdourCanvas::Container* group, double, ARDOUR::BeatsFramesConverter* bfc)
+TempoLines::TempoLines (ArdourCanvas::Container* group, double, ARDOUR::BeatsSamplesConverter* bfc)
: lines (group, ArdourCanvas::LineSet::Vertical)
, _bfc (bfc)
{
@@ -43,7 +43,7 @@ TempoLines::~TempoLines ()
}
void
-TempoLines::tempo_map_changed (framepos_t new_origin)
+TempoLines::tempo_map_changed (samplepos_t new_origin)
{
lines.clear ();
_bfc->set_origin_b (new_origin);
@@ -64,8 +64,8 @@ TempoLines::hide ()
void
TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
unsigned divisions,
- framecnt_t leftmost_frame,
- framecnt_t frame_rate)
+ samplecnt_t leftmost_sample,
+ samplecnt_t sample_rate)
{
const uint32_t base = UIConfiguration::instance().color_mod("measure line beat", "measure line beat");
@@ -80,9 +80,9 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
/* draw line with alpha corresponding to coarsest level */
const uint8_t a = max(8, (int)rint(UINT_RGBA_A(base) / (0.8 * log2(level))));
const uint32_t c = UINT_RGBA_CHANGE_A(base, a);
- const framepos_t f = _bfc->to (Evoral::Beats (grid.begin()->qn + (l / (double) divisions))) + _bfc->origin_b();
+ const samplepos_t f = _bfc->to (Evoral::Beats (grid.begin()->qn + (l / (double) divisions))) + _bfc->origin_b();
- if (f > leftmost_frame) {
+ if (f > leftmost_sample) {
lines.add (PublicEditor::instance().sample_to_pixel_unrounded (f), 1.0, c);
}
}
@@ -91,8 +91,8 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
void
TempoLines::draw (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
unsigned divisions,
- framecnt_t leftmost_frame,
- framecnt_t frame_rate)
+ samplecnt_t leftmost_sample,
+ samplecnt_t sample_rate)
{
std::vector<ARDOUR::TempoMap::BBTPoint>::const_iterator i;
double beat_density;
@@ -129,9 +129,9 @@ TempoLines::draw (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
}
double canvas_width_used = 1.0;
- if (leftmost_frame < grid.front().frame) {
- const framecnt_t frame_distance = max ((framecnt_t) 1, grid.back().frame - grid.front().frame);
- canvas_width_used = 1.0 - ((grid.front().frame - leftmost_frame) / (double) (frame_distance + grid.front().frame));
+ if (leftmost_sample < grid.front().sample) {
+ const samplecnt_t sample_distance = max ((samplecnt_t) 1, grid.back().sample - grid.front().sample);
+ canvas_width_used = 1.0 - ((grid.front().sample - leftmost_sample) / (double) (sample_distance + grid.front().sample));
}
beat_density = (beats * 10.0f) / (lines.canvas()->width() * canvas_width_used);
@@ -148,11 +148,11 @@ TempoLines::draw (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
}
lines.clear ();
- if (beat_density <= 0.12 && grid.begin() != grid.end() && grid.begin()->frame > 0 && !all_bars) {
+ if (beat_density <= 0.12 && grid.begin() != grid.end() && grid.begin()->sample > 0 && !all_bars) {
/* draw subdivisions of the beat before the first visible beat line XX this shouldn't happen now */
std::vector<ARDOUR::TempoMap::BBTPoint> vec;
vec.push_back (*i);
- draw_ticks (vec, divisions, leftmost_frame, frame_rate);
+ draw_ticks (vec, divisions, leftmost_sample, sample_rate);
}
for (i = grid.begin(); i != grid.end(); ++i) {
@@ -171,7 +171,7 @@ TempoLines::draw (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
color = beat_color;
}
- ArdourCanvas::Coord xpos = PublicEditor::instance().sample_to_pixel_unrounded ((*i).frame);
+ ArdourCanvas::Coord xpos = PublicEditor::instance().sample_to_pixel_unrounded ((*i).sample);
lines.add (xpos, 1.0, color);
@@ -179,7 +179,7 @@ TempoLines::draw (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
/* draw subdivisions of this beat */
std::vector<ARDOUR::TempoMap::BBTPoint> vec;
vec.push_back (*i);
- draw_ticks (vec, divisions, leftmost_frame, frame_rate);
+ draw_ticks (vec, divisions, leftmost_sample, sample_rate);
}
}
}
diff --git a/gtk2_ardour/tempo_lines.h b/gtk2_ardour/tempo_lines.h
index 158ef7b1f9..5d1d7d71fa 100644
--- a/gtk2_ardour/tempo_lines.h
+++ b/gtk2_ardour/tempo_lines.h
@@ -19,22 +19,22 @@
#ifndef __ardour_tempo_lines_h__
#define __ardour_tempo_lines_h__
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/tempo.h"
#include "canvas/line_set.h"
class TempoLines {
public:
- TempoLines (ArdourCanvas::Container* group, double screen_height, ARDOUR::BeatsFramesConverter* bfc);
+ TempoLines (ArdourCanvas::Container* group, double screen_height, ARDOUR::BeatsSamplesConverter* bfc);
~TempoLines ();
- void tempo_map_changed(framepos_t new_origin);
+ void tempo_map_changed(samplepos_t new_origin);
void draw (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
unsigned divisions,
- ARDOUR::framecnt_t leftmost_frame,
- ARDOUR::framecnt_t frame_rate);
+ ARDOUR::samplecnt_t leftmost_sample,
+ ARDOUR::samplecnt_t sample_rate);
void show();
void hide();
@@ -42,11 +42,11 @@ public:
private:
void draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
unsigned divisions,
- ARDOUR::framecnt_t leftmost_frame,
- ARDOUR::framecnt_t frame_rate);
+ ARDOUR::samplecnt_t leftmost_sample,
+ ARDOUR::samplecnt_t sample_rate);
ArdourCanvas::LineSet lines;
- ARDOUR::BeatsFramesConverter* _bfc;
+ ARDOUR::BeatsSamplesConverter* _bfc;
};
#endif /* __ardour_tempo_lines_h__ */
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 1dd61338a5..2de7934f5c 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -199,9 +199,9 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
controls_ebox.signal_leave_notify_event().connect (sigc::mem_fun (*this, &TimeAxisView::controls_ebox_leave));
controls_ebox.show ();
- time_axis_frame.set_shadow_type (Gtk::SHADOW_NONE);
- time_axis_frame.add(top_hbox);
- time_axis_frame.show();
+ time_axis_sample.set_shadow_type (Gtk::SHADOW_NONE);
+ time_axis_sample.add(top_hbox);
+ time_axis_sample.show();
HSeparator* separator = manage (new HSeparator());
separator->set_name("TrackSeparator");
@@ -213,7 +213,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
midi_scroomer_size_group->add_widget (scroomer_placeholder);
time_axis_vbox.pack_start (*separator, false, false);
- time_axis_vbox.pack_start (time_axis_frame, true, true);
+ time_axis_vbox.pack_start (time_axis_sample, true, true);
time_axis_vbox.show();
time_axis_hbox.pack_start (time_axis_vbox, true, true);
time_axis_hbox.show();
@@ -757,14 +757,14 @@ TimeAxisView::set_selected (bool yn)
AxisView::set_selected (yn);
if (_selected) {
- time_axis_frame.set_shadow_type (Gtk::SHADOW_IN);
- time_axis_frame.set_name ("MixerStripSelectedFrame");
+ time_axis_sample.set_shadow_type (Gtk::SHADOW_IN);
+ time_axis_sample.set_name ("MixerStripSelectedFrame");
controls_ebox.set_name (controls_base_selected_name);
controls_vbox.set_name (controls_base_selected_name);
time_axis_vbox.set_name (controls_base_selected_name);
} else {
- time_axis_frame.set_shadow_type (Gtk::SHADOW_NONE);
- time_axis_frame.set_name (controls_base_unselected_name);
+ time_axis_sample.set_shadow_type (Gtk::SHADOW_NONE);
+ time_axis_sample.set_name (controls_base_unselected_name);
controls_ebox.set_name (controls_base_unselected_name);
controls_vbox.set_name (controls_base_unselected_name);
time_axis_vbox.set_name (controls_base_unselected_name);
@@ -772,7 +772,7 @@ TimeAxisView::set_selected (bool yn)
hide_selection ();
}
- time_axis_frame.show();
+ time_axis_sample.show();
}
void
@@ -797,7 +797,7 @@ TimeAxisView::set_samples_per_pixel (double fpp)
}
void
-TimeAxisView::show_timestretch (framepos_t start, framepos_t end, int layers, int layer)
+TimeAxisView::show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer)
{
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->show_timestretch (start, end, layers, layer);
@@ -818,7 +818,7 @@ TimeAxisView::show_selection (TimeSelection& ts)
double x1;
double x2;
double y2;
- SelectionRect *rect; time_axis_frame.show();
+ SelectionRect *rect; time_axis_sample.show();
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
@@ -843,8 +843,8 @@ TimeAxisView::show_selection (TimeSelection& ts)
selection_group->raise_to_top();
for (list<AudioRange>::iterator i = ts.begin(); i != ts.end(); ++i) {
- framepos_t start, end;
- framecnt_t cnt;
+ samplepos_t start, end;
+ samplecnt_t cnt;
start = (*i).start;
end = (*i).end;
@@ -1017,14 +1017,14 @@ TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
}
/** Get selectable things within a given range.
- * @param start Start time in session frames.
- * @param end End time in session frames.
+ * @param start Start time in session samples.
+ * @param end End time in session samples.
* @param top Top y range, in trackview coordinates (ie 0 is the top of the track view)
* @param bot Bottom y range, in trackview coordinates (ie 0 is the top of the track view)
* @param result Filled in with selectable things.
*/
void
-TimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results, bool within)
+TimeAxisView::get_selectables (samplepos_t start, samplepos_t end, double top, double bot, list<Selectable*>& results, bool within)
{
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
if (!(*i)->hidden()) {
@@ -1120,8 +1120,8 @@ TimeAxisView::compute_heights ()
Gtk::Table one_row_table (1, 1);
ArdourButton* test_button = manage (new ArdourButton);
const int border_width = 2;
- const int frame_height = 2;
- extra_height = (2 * border_width) + frame_height;
+ const int sample_height = 2;
+ extra_height = (2 * border_width) + sample_height;
window.add (one_row_table);
test_button->set_name ("mute button");
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index 99ed2f37fc..3ec4039e38 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -170,7 +170,7 @@ class TimeAxisView : public virtual AxisView
virtual void show_selection (TimeSelection&);
virtual void hide_selection ();
virtual void reshow_selection (TimeSelection&);
- virtual void show_timestretch (framepos_t start, framepos_t end, int layers, int layer);
+ virtual void show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer);
virtual void hide_timestretch ();
/* editing operations */
@@ -178,11 +178,11 @@ class TimeAxisView : public virtual AxisView
virtual void cut_copy_clear (Selection&, Editing::CutCopyOp) {}
/** Paste a selection.
- * @param pos Position to paste to (session frames).
+ * @param pos Position to paste to (session samples).
* @param selection Selection to paste.
* @param ctx Paste context.
*/
- virtual bool paste (ARDOUR::framepos_t pos,
+ virtual bool paste (ARDOUR::samplepos_t pos,
const Selection& selection,
PasteContext& ctx,
const int32_t sub_num) { return false; }
@@ -192,13 +192,13 @@ class TimeAxisView : public virtual AxisView
virtual void fade_range (TimeSelection&) {}
- virtual boost::shared_ptr<ARDOUR::Region> find_next_region (framepos_t /*pos*/, ARDOUR::RegionPoint, int32_t /*dir*/) {
+ virtual boost::shared_ptr<ARDOUR::Region> find_next_region (samplepos_t /*pos*/, ARDOUR::RegionPoint, int32_t /*dir*/) {
return boost::shared_ptr<ARDOUR::Region> ();
}
void order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top);
- virtual void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*>&, bool within = false);
+ virtual void get_selectables (ARDOUR::samplepos_t, ARDOUR::samplepos_t, double, double, std::list<Selectable*>&, bool within = false);
virtual void get_inverted_selectables (Selection&, std::list<Selectable *>& results);
void add_ghost (RegionView*);
@@ -231,7 +231,7 @@ class TimeAxisView : public virtual AxisView
Gtk::VBox controls_vbox;
Gtk::VBox time_axis_vbox;
Gtk::HBox time_axis_hbox;
- Gtk::Frame time_axis_frame;
+ Gtk::Frame time_axis_sample;
Gtk::HBox top_hbox;
Gtk::Fixed scroomer_placeholder;
bool _name_editing;
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 3f1adb9a1c..bba45d5a24 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -114,12 +114,12 @@ TimeAxisViewItem::set_constant_heights ()
*/
TimeAxisViewItem::TimeAxisViewItem(
const string & it_name, ArdourCanvas::Item& parent, TimeAxisView& tv, double spu, uint32_t base_color,
- framepos_t start, framecnt_t duration, bool recording, bool automation, Visibility vis
+ samplepos_t start, samplecnt_t duration, bool recording, bool automation, Visibility vis
)
: trackview (tv)
- , frame_position (-1)
+ , sample_position (-1)
, item_name (it_name)
- , selection_frame (0)
+ , selection_sample (0)
, _height (1.0)
, _recregion (recording)
, _automation (automation)
@@ -134,9 +134,9 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
, Selectable (other)
, PBD::ScopedConnectionList()
, trackview (other.trackview)
- , frame_position (-1)
+ , sample_position (-1)
, item_name (other.item_name)
- , selection_frame (0)
+ , selection_sample (0)
, _height (1.0)
, _recregion (other._recregion)
, _automation (other._automation)
@@ -149,13 +149,13 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
_selected = other._selected;
- init (parent, other.samples_per_pixel, other.fill_color, other.frame_position,
+ init (parent, other.samples_per_pixel, other.fill_color, other.sample_position,
other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
}
void
TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_color,
- framepos_t start, framepos_t duration, Visibility vis,
+ samplepos_t start, samplepos_t duration, Visibility vis,
bool wide, bool high)
{
group = new ArdourCanvas::Container (parent);
@@ -164,11 +164,11 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
fill_color = base_color;
fill_color_name = "time axis view item base";
samples_per_pixel = fpp;
- frame_position = start;
+ sample_position = start;
item_duration = duration;
name_connected = false;
position_locked = false;
- max_item_duration = ARDOUR::max_framepos;
+ max_item_duration = ARDOUR::max_samplepos;
min_item_duration = 0;
visibility = vis;
_sensitive = true;
@@ -182,20 +182,20 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
}
if (visibility & ShowFrame) {
- frame = new ArdourCanvas::Rectangle (group,
+ sample = new ArdourCanvas::Rectangle (group,
ArdourCanvas::Rect (0.0, 0.0,
trackview.editor().sample_to_pixel(duration),
trackview.current_height()));
- frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
- frame->show ();
+ sample->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
+ sample->show ();
- CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name()));
+ CANVAS_DEBUG_NAME (sample, string_compose ("sample for %1", get_item_name()));
if (_recregion) {
- frame->set_outline_color (UIConfiguration::instance().color ("recording rect"));
+ sample->set_outline_color (UIConfiguration::instance().color ("recording rect"));
} else {
- frame->set_outline_color (UIConfiguration::instance().color ("time axis frame"));
+ sample->set_outline_color (UIConfiguration::instance().color ("time axis frame"));
}
}
@@ -231,19 +231,19 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
double top = TimeAxisViewItem::GRAB_HANDLE_TOP;
double width = TimeAxisViewItem::GRAB_HANDLE_WIDTH;
- frame_handle_start = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
- CANVAS_DEBUG_NAME (frame_handle_start, "TAVI frame handle start");
- frame_handle_start->set_outline (false);
- frame_handle_start->set_fill (false);
- frame_handle_start->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_start));
-
- frame_handle_end = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
- CANVAS_DEBUG_NAME (frame_handle_end, "TAVI frame handle end");
- frame_handle_end->set_outline (false);
- frame_handle_end->set_fill (false);
- frame_handle_end->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_end));
+ sample_handle_start = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
+ CANVAS_DEBUG_NAME (sample_handle_start, "TAVI sample handle start");
+ sample_handle_start->set_outline (false);
+ sample_handle_start->set_fill (false);
+ sample_handle_start->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::sample_handle_crossing), sample_handle_start));
+
+ sample_handle_end = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
+ CANVAS_DEBUG_NAME (sample_handle_end, "TAVI sample handle end");
+ sample_handle_end->set_outline (false);
+ sample_handle_end->set_fill (false);
+ sample_handle_end->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::sample_handle_crossing), sample_handle_end));
} else {
- frame_handle_start = frame_handle_end = 0;
+ sample_handle_start = sample_handle_end = 0;
}
//set_color (base_color);
@@ -276,13 +276,13 @@ TimeAxisViewItem::canvas_group_event (GdkEvent* /*ev*/)
*/
bool
-TimeAxisViewItem::set_position(framepos_t pos, void* src, double* delta)
+TimeAxisViewItem::set_position(samplepos_t pos, void* src, double* delta)
{
if (position_locked) {
return false;
}
- frame_position = pos;
+ sample_position = pos;
double new_unit_pos = trackview.editor().sample_to_pixel (pos);
@@ -298,16 +298,16 @@ TimeAxisViewItem::set_position(framepos_t pos, void* src, double* delta)
}
group->set_x_position (new_unit_pos);
- PositionChanged (frame_position, src); /* EMIT_SIGNAL */
+ PositionChanged (sample_position, src); /* EMIT_SIGNAL */
return true;
}
/** @return position of this item on the timeline */
-framepos_t
+samplepos_t
TimeAxisViewItem::get_position() const
{
- return frame_position;
+ return sample_position;
}
/**
@@ -319,11 +319,11 @@ TimeAxisViewItem::get_position() const
*/
bool
-TimeAxisViewItem::set_duration (framecnt_t dur, void* src)
+TimeAxisViewItem::set_duration (samplecnt_t dur, void* src)
{
if ((dur > max_item_duration) || (dur < min_item_duration)) {
warning << string_compose (
- P_("new duration %1 frame is out of bounds for %2", "new duration of %1 frames is out of bounds for %2", dur),
+ P_("new duration %1 sample is out of bounds for %2", "new duration of %1 samples is out of bounds for %2", dur),
get_item_name(), dur)
<< endmsg;
return false;
@@ -335,8 +335,8 @@ TimeAxisViewItem::set_duration (framecnt_t dur, void* src)
item_duration = dur;
- double end_pixel = trackview.editor().sample_to_pixel (frame_position + dur);
- double first_pixel = trackview.editor().sample_to_pixel (frame_position);
+ double end_pixel = trackview.editor().sample_to_pixel (sample_position + dur);
+ double first_pixel = trackview.editor().sample_to_pixel (sample_position);
reset_width_dependent_items (end_pixel - first_pixel);
@@ -345,7 +345,7 @@ TimeAxisViewItem::set_duration (framecnt_t dur, void* src)
}
/** @return duration of this item */
-framepos_t
+samplepos_t
TimeAxisViewItem::get_duration() const
{
return item_duration;
@@ -358,14 +358,14 @@ TimeAxisViewItem::get_duration() const
* @param src the identity of the object that initiated the change
*/
void
-TimeAxisViewItem::set_max_duration(framecnt_t dur, void* src)
+TimeAxisViewItem::set_max_duration(samplecnt_t dur, void* src)
{
max_item_duration = dur;
MaxDurationChanged(max_item_duration, src); /* EMIT_SIGNAL */
}
/** @return the maximum duration that this item may have */
-framecnt_t
+samplecnt_t
TimeAxisViewItem::get_max_duration() const
{
return max_item_duration;
@@ -378,14 +378,14 @@ TimeAxisViewItem::get_max_duration() const
* @param src the identity of the object that initiated the change
*/
void
-TimeAxisViewItem::set_min_duration(framecnt_t dur, void* src)
+TimeAxisViewItem::set_min_duration(samplecnt_t dur, void* src)
{
min_item_duration = dur;
MinDurationChanged(max_item_duration, src); /* EMIT_SIGNAL */
}
/** @return the minimum duration that this item mey have */
-framecnt_t
+samplecnt_t
TimeAxisViewItem::get_min_duration() const
{
return min_item_duration;
@@ -489,21 +489,21 @@ TimeAxisViewItem::set_selected(bool yn)
}
Selectable::set_selected (yn);
- set_frame_color ();
+ set_sample_color ();
set_name_text_color ();
- if (_selected && frame) {
- if (!selection_frame) {
- selection_frame = new ArdourCanvas::Rectangle (group);
- selection_frame->set_fill (false);
- selection_frame->set_outline_color (UIConfiguration::instance().color ("selected time axis frame"));
- selection_frame->set_ignore_events (true);
+ if (_selected && sample) {
+ if (!selection_sample) {
+ selection_sample = new ArdourCanvas::Rectangle (group);
+ selection_sample->set_fill (false);
+ selection_sample->set_outline_color (UIConfiguration::instance().color ("selected time axis frame"));
+ selection_sample->set_ignore_events (true);
}
- selection_frame->set (frame->get().shrink (1.0));
- selection_frame->show ();
+ selection_sample->set (sample->get().shrink (1.0));
+ selection_sample->show ();
} else {
- if (selection_frame) {
- selection_frame->hide ();
+ if (selection_sample) {
+ selection_sample->hide ();
}
}
}
@@ -555,18 +555,18 @@ TimeAxisViewItem::set_height (double height)
}
}
- if (frame) {
+ if (sample) {
- frame->set_y0 (0.0);
- frame->set_y1 (height);
+ sample->set_y0 (0.0);
+ sample->set_y1 (height);
- if (frame_handle_start) {
- frame_handle_start->set_y1 (height);
- frame_handle_end->set_y1 (height);
+ if (sample_handle_start) {
+ sample_handle_start->set_y1 (height);
+ sample_handle_end->set_y1 (height);
}
- if (selection_frame) {
- selection_frame->set (frame->get().shrink (1.0));
+ if (selection_sample) {
+ selection_sample->set (sample->get().shrink (1.0));
}
}
}
@@ -611,9 +611,9 @@ TimeAxisViewItem::set_color (uint32_t base_color)
}
ArdourCanvas::Item*
-TimeAxisViewItem::get_canvas_frame()
+TimeAxisViewItem::get_canvas_sample()
{
- return frame;
+ return sample;
}
ArdourCanvas::Item*
@@ -634,7 +634,7 @@ TimeAxisViewItem::get_name_highlight()
void
TimeAxisViewItem::set_colors()
{
- set_frame_color ();
+ set_sample_color ();
if (name_highlight) {
name_highlight->set_fill_color (fill_color);
@@ -686,28 +686,28 @@ TimeAxisViewItem::get_fill_color () const
}
/**
- * Sets the frame color depending on whether this item is selected
+ * Sets the sample color depending on whether this item is selected
*/
void
-TimeAxisViewItem::set_frame_color()
+TimeAxisViewItem::set_sample_color()
{
- if (!frame) {
+ if (!sample) {
return;
}
- frame->set_fill_color (get_fill_color());
- set_frame_gradient ();
+ sample->set_fill_color (get_fill_color());
+ set_sample_gradient ();
if (!_recregion) {
- frame->set_outline_color (UIConfiguration::instance().color ("time axis frame"));
+ sample->set_outline_color (UIConfiguration::instance().color ("time axis frame"));
}
}
void
-TimeAxisViewItem::set_frame_gradient ()
+TimeAxisViewItem::set_sample_gradient ()
{
if (UIConfiguration::instance().get_timeline_item_gradient_depth() == 0.0) {
- frame->set_gradient (ArdourCanvas::Fill::StopList (), 0);
+ sample->set_gradient (ArdourCanvas::Fill::StopList (), 0);
return;
}
@@ -730,7 +730,7 @@ TimeAxisViewItem::set_frame_gradient ()
Color darker = hsva_to_color (h, s, v, a);
stops.push_back (std::make_pair (1.0, darker));
- frame->set_gradient (stops, true);
+ sample->set_gradient (stops, true);
}
/**
@@ -741,25 +741,25 @@ TimeAxisViewItem::set_trim_handle_colors()
{
#if 1
/* Leave them transparent for now */
- if (frame_handle_start) {
- frame_handle_start->set_fill_color (0x00000000);
- frame_handle_end->set_fill_color (0x00000000);
+ if (sample_handle_start) {
+ sample_handle_start->set_fill_color (0x00000000);
+ sample_handle_end->set_fill_color (0x00000000);
}
#else
- if (frame_handle_start) {
+ if (sample_handle_start) {
if (position_locked) {
- frame_handle_start->set_fill_color (UIConfiguration::instance().get_TrimHandleLocked());
- frame_handle_end->set_fill_color (UIConfiguration::instance().get_TrimHandleLocked());
+ sample_handle_start->set_fill_color (UIConfiguration::instance().get_TrimHandleLocked());
+ sample_handle_end->set_fill_color (UIConfiguration::instance().get_TrimHandleLocked());
} else {
- frame_handle_start->set_fill_color (UIConfiguration::instance().get_TrimHandle());
- frame_handle_end->set_fill_color (UIConfiguration::instance().get_TrimHandle());
+ sample_handle_start->set_fill_color (UIConfiguration::instance().get_TrimHandle());
+ sample_handle_end->set_fill_color (UIConfiguration::instance().get_TrimHandle());
}
}
#endif
}
bool
-TimeAxisViewItem::frame_handle_crossing (GdkEvent* ev, ArdourCanvas::Rectangle* item)
+TimeAxisViewItem::sample_handle_crossing (GdkEvent* ev, ArdourCanvas::Rectangle* item)
{
switch (ev->type) {
case GDK_LEAVE_NOTIFY:
@@ -780,18 +780,18 @@ TimeAxisViewItem::frame_handle_crossing (GdkEvent* ev, ArdourCanvas::Rectangle*
return false;
}
-/** @return the frames per pixel */
+/** @return the samples per pixel */
double
TimeAxisViewItem::get_samples_per_pixel () const
{
return samples_per_pixel;
}
-/** Set the frames per pixel of this item.
+/** Set the samples per pixel of this item.
* This item is used to determine the relative visual size and position of this item
* based upon its duration and start value.
*
- * @param fpp the new frames per pixel
+ * @param fpp the new samples per pixel
*/
void
TimeAxisViewItem::set_samples_per_pixel (double fpp)
@@ -799,8 +799,8 @@ TimeAxisViewItem::set_samples_per_pixel (double fpp)
samples_per_pixel = fpp;
set_position (this->get_position(), this);
- double end_pixel = trackview.editor().sample_to_pixel (frame_position + get_duration());
- double first_pixel = trackview.editor().sample_to_pixel (frame_position);
+ double end_pixel = trackview.editor().sample_to_pixel (sample_position + get_duration());
+ double first_pixel = trackview.editor().sample_to_pixel (sample_position);
reset_width_dependent_items (end_pixel - first_pixel);
}
@@ -815,47 +815,47 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
if (pixel_width < 2.0) {
- if (frame) {
- frame->set_outline (false);
- frame->set_x1 (std::max(1.0, pixel_width));
+ if (sample) {
+ sample->set_outline (false);
+ sample->set_x1 (std::max(1.0, pixel_width));
}
- if (frame_handle_start) {
- frame_handle_start->hide();
- frame_handle_end->hide();
+ if (sample_handle_start) {
+ sample_handle_start->hide();
+ sample_handle_end->hide();
}
} else {
- if (frame) {
- frame->set_outline (true);
+ if (sample) {
+ sample->set_outline (true);
/* Note: x0 is always zero - the position is defined by
- * the position of the group, not the frame.
+ * the position of the group, not the sample.
*/
- frame->set_x1 (pixel_width);
+ sample->set_x1 (pixel_width);
- if (selection_frame) {
- selection_frame->set (frame->get().shrink (1.0));
+ if (selection_sample) {
+ selection_sample->set (sample->get().shrink (1.0));
}
}
- if (frame_handle_start) {
+ if (sample_handle_start) {
if (pixel_width < (3 * TimeAxisViewItem::GRAB_HANDLE_WIDTH)) {
/*
* there's less than GRAB_HANDLE_WIDTH of the region between
- * the right-hand end of frame_handle_start and the left-hand
- * end of frame_handle_end, so disable the handles
+ * the right-hand end of sample_handle_start and the left-hand
+ * end of sample_handle_end, so disable the handles
*/
- frame_handle_start->hide();
- frame_handle_end->hide();
+ sample_handle_start->hide();
+ sample_handle_end->hide();
} else {
- frame_handle_start->show();
- frame_handle_end->set_x0 (pixel_width - (TimeAxisViewItem::GRAB_HANDLE_WIDTH));
- frame_handle_end->set_x1 (pixel_width);
- frame_handle_end->show();
+ sample_handle_start->show();
+ sample_handle_end->set_x0 (pixel_width - (TimeAxisViewItem::GRAB_HANDLE_WIDTH));
+ sample_handle_end->set_x1 (pixel_width);
+ sample_handle_end->show();
- frame_handle_start->raise_to_top ();
- frame_handle_end->raise_to_top ();
+ sample_handle_start->raise_to_top ();
+ sample_handle_end->raise_to_top ();
}
}
}
@@ -922,7 +922,7 @@ TimeAxisViewItem::parameter_changed (string p)
if (p == "color-regions-using-track-color") {
set_colors ();
} else if (p == "timeline-item-gradient-depth") {
- set_frame_gradient ();
+ set_sample_gradient ();
}
}
@@ -930,12 +930,12 @@ void
TimeAxisViewItem::drag_start ()
{
_dragging = true;
- set_frame_color ();
+ set_sample_color ();
}
void
TimeAxisViewItem::drag_end ()
{
_dragging = false;
- set_frame_color ();
+ set_sample_color ();
}
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 49cd615d6a..41d75883d3 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -37,8 +37,8 @@ namespace ArdourCanvas {
class Text;
}
-using ARDOUR::framepos_t;
-using ARDOUR::framecnt_t;
+using ARDOUR::samplepos_t;
+using ARDOUR::samplecnt_t;
/**
* Base class for items that may appear upon a TimeAxisView.
@@ -49,14 +49,14 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
public:
virtual ~TimeAxisViewItem();
- virtual bool set_position(framepos_t, void*, double* delta = 0);
- framepos_t get_position() const;
- virtual bool set_duration(framecnt_t, void*);
- framecnt_t get_duration() const;
- virtual void set_max_duration(framecnt_t, void*);
- framecnt_t get_max_duration() const;
- virtual void set_min_duration(framecnt_t, void*);
- framecnt_t get_min_duration() const;
+ virtual bool set_position(samplepos_t, void*, double* delta = 0);
+ samplepos_t get_position() const;
+ virtual bool set_duration(samplecnt_t, void*);
+ samplecnt_t get_duration() const;
+ virtual void set_max_duration(samplecnt_t, void*);
+ samplecnt_t get_max_duration() const;
+ virtual void set_min_duration(samplecnt_t, void*);
+ samplecnt_t get_min_duration() const;
virtual void set_position_locked(bool, void*);
bool get_position_locked() const;
void set_max_duration_active(bool, void*);
@@ -78,7 +78,7 @@ public:
virtual uint32_t get_fill_color () const;
- ArdourCanvas::Item* get_canvas_frame();
+ ArdourCanvas::Item* get_canvas_sample();
ArdourCanvas::Item* get_canvas_group();
ArdourCanvas::Item* get_name_highlight();
@@ -127,19 +127,19 @@ public:
sigc::signal<void,std::string,std::string,void*> NameChanged;
/** Emiited when the position of this item changes */
- sigc::signal<void,framepos_t,void*> PositionChanged;
+ sigc::signal<void,samplepos_t,void*> PositionChanged;
/** Emitted when the position lock of this item is changed */
sigc::signal<void,bool,void*> PositionLockChanged;
/** Emitted when the duration of this item changes */
- sigc::signal<void,framecnt_t,void*> DurationChanged;
+ sigc::signal<void,samplecnt_t,void*> DurationChanged;
/** Emitted when the maximum item duration is changed */
- sigc::signal<void,framecnt_t,void*> MaxDurationChanged;
+ sigc::signal<void,samplecnt_t,void*> MaxDurationChanged;
/** Emitted when the mionimum item duration is changed */
- sigc::signal<void,framecnt_t,void*> MinDurationChanged;
+ sigc::signal<void,samplecnt_t,void*> MinDurationChanged;
enum Visibility {
ShowFrame = 0x1,
@@ -154,17 +154,17 @@ public:
protected:
TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeAxisView&, double, uint32_t fill_color,
- framepos_t, framecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0));
+ samplepos_t, samplecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0));
TimeAxisViewItem (const TimeAxisViewItem&);
- void init (ArdourCanvas::Item*, double, uint32_t, framepos_t, framepos_t, Visibility, bool, bool);
+ void init (ArdourCanvas::Item*, double, uint32_t, samplepos_t, samplepos_t, Visibility, bool, bool);
virtual bool canvas_group_event (GdkEvent*);
virtual void set_colors();
- virtual void set_frame_color();
- virtual void set_frame_gradient ();
+ virtual void set_sample_color();
+ virtual void set_sample_gradient ();
void set_trim_handle_colors();
virtual void reset_width_dependent_items (double);
@@ -178,16 +178,16 @@ protected:
bool position_locked;
/** position of this item on the timeline */
- framepos_t frame_position;
+ samplepos_t sample_position;
/** duration of this item upon the timeline */
- framecnt_t item_duration;
+ samplecnt_t item_duration;
/** maximum duration that this item can have */
- framecnt_t max_item_duration;
+ samplecnt_t max_item_duration;
/** minimum duration that this item can have */
- framecnt_t min_item_duration;
+ samplecnt_t min_item_duration;
/** indicates whether the max duration constraint is active */
bool max_duration_active;
@@ -195,7 +195,7 @@ protected:
/** indicates whether the min duration constraint is active */
bool min_duration_active;
- /** frames per canvas pixel */
+ /** samples per canvas pixel */
double samples_per_pixel;
/** should the item respond to events */
@@ -218,16 +218,16 @@ protected:
bool high_enough_for_name;
ArdourCanvas::Container* group;
- ArdourCanvas::Rectangle* frame;
- ArdourCanvas::Rectangle* selection_frame;
+ ArdourCanvas::Rectangle* sample;
+ ArdourCanvas::Rectangle* selection_sample;
ArdourCanvas::Text* name_text;
ArdourCanvas::Rectangle* name_highlight;
- /* with these two values, if frame_handle_start == 0 then frame_handle_end will also be 0 */
- ArdourCanvas::Rectangle* frame_handle_start; ///< `frame' (fade) handle for the start of the item, or 0
- ArdourCanvas::Rectangle* frame_handle_end; ///< `frame' (fade) handle for the end of the item, or 0
+ /* with these two values, if sample_handle_start == 0 then sample_handle_end will also be 0 */
+ ArdourCanvas::Rectangle* sample_handle_start; ///< `sample' (fade) handle for the start of the item, or 0
+ ArdourCanvas::Rectangle* sample_handle_end; ///< `sample' (fade) handle for the end of the item, or 0
- bool frame_handle_crossing (GdkEvent*, ArdourCanvas::Rectangle*);
+ bool sample_handle_crossing (GdkEvent*, ArdourCanvas::Rectangle*);
double _height;
Visibility visibility;
diff --git a/gtk2_ardour/time_fx_dialog.cc b/gtk2_ardour/time_fx_dialog.cc
index eb7750f4f8..c51bdcd5e2 100644
--- a/gtk2_ardour/time_fx_dialog.cc
+++ b/gtk2_ardour/time_fx_dialog.cc
@@ -54,7 +54,7 @@ using namespace PBD;
using namespace Gtk;
using namespace Gtkmm2ext;
-TimeFXDialog::TimeFXDialog (Editor& e, bool pitch, framecnt_t oldlen, framecnt_t new_length, framepos_t position)
+TimeFXDialog::TimeFXDialog (Editor& e, bool pitch, samplecnt_t oldlen, samplecnt_t new_length, samplepos_t position)
: ArdourDialog (X_("time fx dialog"))
, editor (e)
, pitching (pitch)
@@ -302,7 +302,7 @@ TimeFXDialog::duration_adjustment_changed ()
PBD::Unwinder<bool> uw (ignore_clock_change, true);
- duration_clock->set ((framecnt_t) (original_length * (duration_adjustment.get_value()/ 100.0)));
+ duration_clock->set ((samplecnt_t) (original_length * (duration_adjustment.get_value()/ 100.0)));
}
void
diff --git a/gtk2_ardour/time_fx_dialog.h b/gtk2_ardour/time_fx_dialog.h
index 426453ff48..a069124547 100644
--- a/gtk2_ardour/time_fx_dialog.h
+++ b/gtk2_ardour/time_fx_dialog.h
@@ -40,7 +40,7 @@ class TimeFXDialog : public ArdourDialog, public ProgressReporter
{
public:
/* We need a position so that BBT mode in the clock can function */
- TimeFXDialog (Editor& e, bool for_pitch, ARDOUR::framecnt_t old_length, ARDOUR::framecnt_t new_length, ARDOUR::framepos_t position);
+ TimeFXDialog (Editor& e, bool for_pitch, ARDOUR::samplecnt_t old_length, ARDOUR::samplecnt_t new_length, ARDOUR::samplepos_t position);
ARDOUR::TimeFXRequest request;
Editor& editor;
@@ -84,7 +84,7 @@ public:
}
private:
- ARDOUR::framecnt_t original_length;
+ ARDOUR::samplecnt_t original_length;
Gtk::Adjustment pitch_octave_adjustment;
Gtk::Adjustment pitch_semitone_adjustment;
Gtk::Adjustment pitch_cent_adjustment;
diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc
index 53425f9cd9..d5d77acee8 100644
--- a/gtk2_ardour/time_info_box.cc
+++ b/gtk2_ardour/time_info_box.cc
@@ -233,10 +233,10 @@ TimeInfoBox::set_session (Session* s)
void
TimeInfoBox::region_selection_changed ()
{
- framepos_t s, e;
+ samplepos_t s, e;
Selection& selection (Editor::instance().get_selection());
s = selection.regions.start();
- e = selection.regions.end_frame();
+ e = selection.regions.end_sample();
selection_start->set_off (false);
selection_end->set_off (false);
selection_length->set_off (false);
@@ -248,7 +248,7 @@ TimeInfoBox::region_selection_changed ()
void
TimeInfoBox::selection_changed ()
{
- framepos_t s, e;
+ samplepos_t s, e;
Selection& selection (Editor::instance().get_selection());
region_property_connections.drop_connections();
@@ -274,18 +274,18 @@ TimeInfoBox::selection_changed ()
selection_end->set_off (false);
selection_length->set_off (false);
selection_start->set (selection.time.start());
- selection_end->set (selection.time.end_frame());
- selection_length->set (selection.time.end_frame(), false, selection.time.start());
+ selection_end->set (selection.time.end_sample());
+ selection_length->set (selection.time.end_sample(), false, selection.time.start());
} else {
selection_start->set_off (true);
selection_end->set_off (true);
selection_length->set_off (true);
}
} else {
- s = max_framepos;
+ s = max_samplepos;
e = 0;
for (PointSelection::iterator i = selection.points.begin(); i != selection.points.end(); ++i) {
- framepos_t const p = (*i)->line().session_position ((*i)->model ());
+ samplepos_t const p = (*i)->line().session_position ((*i)->model ());
s = min (s, p);
e = max (e, p);
}
@@ -321,7 +321,7 @@ TimeInfoBox::selection_changed ()
if (tact && tact->get_active() && !selection.regions.empty()) {
/* show selected regions */
s = selection.regions.start();
- e = selection.regions.end_frame();
+ e = selection.regions.end_sample();
selection_start->set_off (false);
selection_end->set_off (false);
selection_length->set_off (false);
@@ -338,8 +338,8 @@ TimeInfoBox::selection_changed ()
selection_end->set_off (false);
selection_length->set_off (false);
selection_start->set (selection.time.start());
- selection_end->set (selection.time.end_frame());
- selection_length->set (selection.time.end_frame(), false, selection.time.start());
+ selection_end->set (selection.time.end_sample());
+ selection_length->set (selection.time.end_sample(), false, selection.time.start());
}
break;
diff --git a/gtk2_ardour/time_selection.cc b/gtk2_ardour/time_selection.cc
index 2f40dcb8e4..ba9918d116 100644
--- a/gtk2_ardour/time_selection.cc
+++ b/gtk2_ardour/time_selection.cc
@@ -68,14 +68,14 @@ TimeSelection::consolidate ()
return changed;
}
-framepos_t
+samplepos_t
TimeSelection::start ()
{
if (empty()) {
return 0;
}
- framepos_t first = max_framepos;
+ samplepos_t first = max_samplepos;
for (std::list<AudioRange>::iterator i = begin(); i != end(); ++i) {
if ((*i).start < first) {
@@ -85,10 +85,10 @@ TimeSelection::start ()
return first;
}
-framepos_t
-TimeSelection::end_frame ()
+samplepos_t
+TimeSelection::end_sample ()
{
- framepos_t last = 0;
+ samplepos_t last = 0;
/* XXX make this work like RegionSelection: no linear search needed */
@@ -100,12 +100,12 @@ TimeSelection::end_frame ()
return last;
}
-framecnt_t
+samplecnt_t
TimeSelection::length()
{
if (empty()) {
return 0;
}
- return end_frame() - start() + 1;
+ return end_sample() - start() + 1;
}
diff --git a/gtk2_ardour/time_selection.h b/gtk2_ardour/time_selection.h
index 4c535a8e6a..6e59684a48 100644
--- a/gtk2_ardour/time_selection.h
+++ b/gtk2_ardour/time_selection.h
@@ -32,9 +32,9 @@ class TimeSelection : public std::list<ARDOUR::AudioRange>
public:
ARDOUR::AudioRange& operator[](uint32_t);
- ARDOUR::framepos_t start();
- ARDOUR::framepos_t end_frame();
- ARDOUR::framepos_t length();
+ ARDOUR::samplepos_t start();
+ ARDOUR::samplepos_t end_sample();
+ ARDOUR::samplepos_t length();
bool consolidate ();
};
diff --git a/gtk2_ardour/transcode_ffmpeg.cc b/gtk2_ardour/transcode_ffmpeg.cc
index 6b66123aae..e62d9b301b 100644
--- a/gtk2_ardour/transcode_ffmpeg.cc
+++ b/gtk2_ardour/transcode_ffmpeg.cc
@@ -177,16 +177,16 @@ TranscodeFfmpeg::probe ()
} else if (key == X_("codec_tag_string")) {
if (!m_codec.empty()) m_codec += " ";
m_codec += "(" + value + ")";
- } else if (key == X_("r_frame_rate")) {
+ } else if (key == X_("r_sample_rate")) {
PARSE_FRACTIONAL_FPS(m_fps)
- } else if (key == X_("avg_frame_rate") && m_fps == 0) {
+ } else if (key == X_("avg_sample_rate") && m_fps == 0) {
PARSE_FRACTIONAL_FPS(m_fps)
} else if (key == X_("time_base")) {
PARSE_FRACTIONAL_FPS(timebase)
} else if (key == X_("timecode") && m_duration == 0 && m_fps > 0) {
int h,m,s; char f[32];
if (sscanf(i->at(16).c_str(), "%d:%d:%d:%32s",&h,&m,&s,f) == 4) {
- m_duration = (ARDOUR::framecnt_t) floor(m_fps * (
+ m_duration = (ARDOUR::samplecnt_t) floor(m_fps * (
h * 3600.0
+ m * 60.0
+ s * 1.0
@@ -257,7 +257,7 @@ TranscodeFfmpeg::probe ()
#if 0 /* DEBUG */
printf("FPS: %f\n", m_fps);
- printf("Duration: %lu frames\n",(unsigned long)m_duration);
+ printf("Duration: %lu samples\n",(unsigned long)m_duration);
printf("W/H: %ix%i\n",m_width, m_height);
printf("aspect: %f\n",m_aspect);
printf("codec: %s\n",m_codec.c_str());
@@ -425,7 +425,7 @@ TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf
}
bool
-TranscodeFfmpeg::extract_audio (std::string outfile, ARDOUR::framecnt_t /*samplerate*/, unsigned int stream)
+TranscodeFfmpeg::extract_audio (std::string outfile, ARDOUR::samplecnt_t /*samplerate*/, unsigned int stream)
{
if (!probeok) return false;
if (stream >= m_audio.size()) return false;
@@ -566,12 +566,12 @@ TranscodeFfmpeg::ffmpegparse_a (std::string d, size_t /* s */)
{
const char *t;
int h,m,s; char f[7];
- ARDOUR::framecnt_t p = -1;
+ ARDOUR::samplecnt_t p = -1;
if (!(t=strstr(d.c_str(), "time="))) { return; }
if (sscanf(t+5, "%d:%d:%d.%s",&h,&m,&s,f) == 4) {
- p = (ARDOUR::framecnt_t) floor( 100.0 * (
+ p = (ARDOUR::samplecnt_t) floor( 100.0 * (
h * 3600.0
+ m * 60.0
+ s * 1.0
@@ -591,7 +591,7 @@ TranscodeFfmpeg::ffmpegparse_v (std::string d, size_t /* s */)
if (strstr(d.c_str(), "ERROR") || strstr(d.c_str(), "Error") || strstr(d.c_str(), "error")) {
warning << "ffmpeg-error: " << d << endmsg;
}
- if (strncmp(d.c_str(), "frame=",6)) {
+ if (strncmp(d.c_str(), "sample=",6)) {
#if 1 /* DEBUG */
if (debug_enable) {
d.erase(d.find_last_not_of(" \t\r\n") + 1);
@@ -601,7 +601,7 @@ TranscodeFfmpeg::ffmpegparse_v (std::string d, size_t /* s */)
Progress(0, 0); /* EMIT SIGNAL */
return;
}
- ARDOUR::framecnt_t f = atol(d.substr(6));
+ ARDOUR::samplecnt_t f = atol(d.substr(6));
if (f == 0) {
Progress(0, 0); /* EMIT SIGNAL */
} else {
diff --git a/gtk2_ardour/transcode_ffmpeg.h b/gtk2_ardour/transcode_ffmpeg.h
index 2ee7529dc5..4ea60a368a 100644
--- a/gtk2_ardour/transcode_ffmpeg.h
+++ b/gtk2_ardour/transcode_ffmpeg.h
@@ -70,7 +70,7 @@ class TranscodeFfmpeg : public sigc::trackable
* specified as element-number in \ref get_audio().
* @return \c true if the transcoder process was successfully started.
*/
- bool extract_audio (std::string outfile, ARDOUR::framecnt_t samplerate, unsigned int stream=0);
+ bool extract_audio (std::string outfile, ARDOUR::samplecnt_t samplerate, unsigned int stream=0);
/** transcode video and mux audio files into a new video-file.
* @param outfile full-path of output file to create (existing files are overwritten)
* @param inf_a filename of input audio-file
@@ -100,7 +100,7 @@ class TranscodeFfmpeg : public sigc::trackable
* during \ref encode \ref transcode and \ref extract_audio
* The parameters are current and last video-frame.
*/
- PBD::Signal2<void, ARDOUR::framecnt_t, ARDOUR::framecnt_t> Progress;
+ PBD::Signal2<void, ARDOUR::samplecnt_t, ARDOUR::samplecnt_t> Progress;
/** signal emitted when the transcoder process terminates. */
PBD::Signal0<void> Finished;
@@ -108,7 +108,7 @@ class TranscodeFfmpeg : public sigc::trackable
double get_aspect () { return m_aspect; }
int get_width() { return m_width; }
int get_height() { return m_height; }
- ARDOUR::framecnt_t get_duration() { return m_duration; }
+ ARDOUR::samplecnt_t get_duration() { return m_duration; }
std::string get_codec() { return m_codec; }
FFAudioStreams get_audio() { return m_audio; }
@@ -116,7 +116,7 @@ class TranscodeFfmpeg : public sigc::trackable
/** override file duration used with the \ref Progress signal.
* @param d duration in video-frames = length_in_seconds * get_fps()
*/
- void set_duration(ARDOUR::framecnt_t d) { m_duration = d; }
+ void set_duration(ARDOUR::samplecnt_t d) { m_duration = d; }
/* offset, lead-in/out are in seconds */
void set_avoffset(double av_offset) { m_avoffset = av_offset; }
@@ -136,7 +136,7 @@ class TranscodeFfmpeg : public sigc::trackable
double m_fps;
double m_aspect;
std::string m_sar;
- ARDOUR::framecnt_t m_duration;
+ ARDOUR::samplecnt_t m_duration;
int m_width;
int m_height;
std::string m_codec;
diff --git a/gtk2_ardour/transcode_video_dialog.cc b/gtk2_ardour/transcode_video_dialog.cc
index bf253925fe..2087b19cdd 100644
--- a/gtk2_ardour/transcode_video_dialog.cc
+++ b/gtk2_ardour/transcode_video_dialog.cc
@@ -321,7 +321,7 @@ TranscodeVideoDialog::abort_clicked ()
}
void
-TranscodeVideoDialog::update_progress (framecnt_t c, framecnt_t a)
+TranscodeVideoDialog::update_progress (samplecnt_t c, samplecnt_t a)
{
if (a == 0 || c > a) {
pbar.set_pulse_step(.5);
@@ -377,7 +377,7 @@ TranscodeVideoDialog::launch_extract ()
audio_stream = audio_combo.get_active_row_number() -1;
progress_label.set_text (_("Extracting Audio.."));
- if (!transcoder->extract_audio(audiofile, _session->nominal_frame_rate(), audio_stream)) {
+ if (!transcoder->extract_audio(audiofile, _session->nominal_sample_rate(), audio_stream)) {
ARDOUR_UI::instance()->popup_error(_("Audio Extraction Failed."));
audiofile="";
Gtk::Dialog::response(RESPONSE_CANCEL);
diff --git a/gtk2_ardour/transcode_video_dialog.h b/gtk2_ardour/transcode_video_dialog.h
index 74e0035645..40b077b971 100644
--- a/gtk2_ardour/transcode_video_dialog.h
+++ b/gtk2_ardour/transcode_video_dialog.h
@@ -84,7 +84,7 @@ private:
PBD::Signal0<void> StartNextStage;
void finished ();
- void update_progress (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
+ void update_progress (ARDOUR::samplecnt_t, ARDOUR::samplecnt_t);
TranscodeFfmpeg *transcoder;
diff --git a/gtk2_ardour/vca_master_strip.cc b/gtk2_ardour/vca_master_strip.cc
index eacc1a0ecd..ac232dbd86 100644
--- a/gtk2_ardour/vca_master_strip.cc
+++ b/gtk2_ardour/vca_master_strip.cc
@@ -124,14 +124,14 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
global_vpacker.pack_start (gain_meter.gain_automation_state_button, false, false, 1);
global_vpacker.pack_start (bottom_padding, false, false, 0);
- global_frame.add (global_vpacker);
- global_frame.set_shadow_type (Gtk::SHADOW_IN);
- global_frame.set_name ("BaseFrame");
+ global_sample.add (global_vpacker);
+ global_sample.set_shadow_type (Gtk::SHADOW_IN);
+ global_sample.set_name ("BaseFrame");
- add (global_frame);
+ add (global_sample);
global_vpacker.show ();
- global_frame.show ();
+ global_sample.show ();
top_padding.show ();
vertical_button.show ();
hide_button.show ();
@@ -305,14 +305,14 @@ VCAMasterStrip::set_selected (bool yn)
AxisView::set_selected (yn);
if (_selected) {
- global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
- global_frame.set_name ("MixerStripSelectedFrame");
+ global_sample.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
+ global_sample.set_name ("MixerStripSelectedFrame");
} else {
- global_frame.set_shadow_type (Gtk::SHADOW_IN);
- global_frame.set_name ("MixerStripFrame");
+ global_sample.set_shadow_type (Gtk::SHADOW_IN);
+ global_sample.set_name ("MixerStripFrame");
}
- global_frame.queue_draw ();
+ global_sample.queue_draw ();
}
bool
diff --git a/gtk2_ardour/vca_master_strip.h b/gtk2_ardour/vca_master_strip.h
index d00232a798..72a04caeb1 100644
--- a/gtk2_ardour/vca_master_strip.h
+++ b/gtk2_ardour/vca_master_strip.h
@@ -63,7 +63,7 @@ private:
boost::shared_ptr<ARDOUR::VCA> _vca;
GainMeter gain_meter;
- Gtk::Frame global_frame;
+ Gtk::Frame global_sample;
Gtk::VBox global_vpacker;
Gtk::HBox top_padding;
Gtk::HBox bottom_padding;
diff --git a/gtk2_ardour/vca_time_axis.cc b/gtk2_ardour/vca_time_axis.cc
index efa1c3cdea..6a125a31d3 100644
--- a/gtk2_ardour/vca_time_axis.cc
+++ b/gtk2_ardour/vca_time_axis.cc
@@ -111,7 +111,7 @@ VCATimeAxisView::VCATimeAxisView (PublicEditor& ed, Session* s, ArdourCanvas::Ca
gain_meter.get_gain_slider().show ();
controls_ebox.set_name (controls_base_unselected_name);
- time_axis_frame.set_name (controls_base_unselected_name);
+ time_axis_sample.set_name (controls_base_unselected_name);
s->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::parameter_changed, this, _1), gui_context());
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::parameter_changed, this, _1), gui_context());
diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc
index bf11733b6d..3ad9ae92c6 100644
--- a/gtk2_ardour/verbose_cursor.cc
+++ b/gtk2_ardour/verbose_cursor.cc
@@ -93,7 +93,7 @@ VerboseCursor::set_offset (ArdourCanvas::Duple const & d)
}
void
-VerboseCursor::set_time (framepos_t frame)
+VerboseCursor::set_time (samplepos_t sample)
{
char buf[128];
Timecode::Time timecode;
@@ -109,21 +109,21 @@ VerboseCursor::set_time (framepos_t frame)
switch (m) {
case AudioClock::BBT:
- _editor->_session->bbt_time (frame, bbt);
+ _editor->_session->bbt_time (sample, bbt);
snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
break;
case AudioClock::Timecode:
- _editor->_session->timecode_time (frame, timecode);
+ _editor->_session->timecode_time (sample, timecode);
snprintf (buf, sizeof (buf), "%s", Timecode::timecode_format_time (timecode).c_str());
break;
case AudioClock::MinSec:
- AudioClock::print_minsec (frame, buf, sizeof (buf), _editor->_session->frame_rate());
+ AudioClock::print_minsec (sample, buf, sizeof (buf), _editor->_session->sample_rate());
break;
default:
- snprintf (buf, sizeof(buf), "%" PRIi64, frame);
+ snprintf (buf, sizeof(buf), "%" PRIi64, sample);
break;
}
@@ -131,13 +131,13 @@ VerboseCursor::set_time (framepos_t frame)
}
void
-VerboseCursor::set_duration (framepos_t start, framepos_t end)
+VerboseCursor::set_duration (samplepos_t start, samplepos_t end)
{
char buf[128];
Timecode::Time timecode;
Timecode::BBT_Time sbbt;
Timecode::BBT_Time ebbt;
- Meter meter_at_start (_editor->_session->tempo_map().meter_at_frame (start));
+ Meter meter_at_start (_editor->_session->tempo_map().meter_at_sample (start));
if (_editor->_session == 0) {
return;
@@ -188,7 +188,7 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end)
break;
case AudioClock::MinSec:
- AudioClock::print_minsec (end - start, buf, sizeof (buf), _editor->_session->frame_rate());
+ AudioClock::print_minsec (end - start, buf, sizeof (buf), _editor->_session->sample_rate());
break;
default:
diff --git a/gtk2_ardour/verbose_cursor.h b/gtk2_ardour/verbose_cursor.h
index 20866a4e04..3cbe406208 100644
--- a/gtk2_ardour/verbose_cursor.h
+++ b/gtk2_ardour/verbose_cursor.h
@@ -38,8 +38,8 @@ public:
bool visible () const;
void set (std::string const &);
- void set_time (framepos_t);
- void set_duration (framepos_t, framepos_t);
+ void set_time (samplepos_t);
+ void set_duration (samplepos_t, samplepos_t);
void set_offset (ArdourCanvas::Duple const&);
void show ();
diff --git a/gtk2_ardour/video_image_frame.cc b/gtk2_ardour/video_image_frame.cc
index 093f235107..242d56517d 100644
--- a/gtk2_ardour/video_image_frame.cc
+++ b/gtk2_ardour/video_image_frame.cc
@@ -63,7 +63,7 @@ VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Container& par
image = new ArdourCanvas::Image (_parent, Cairo::FORMAT_ARGB32, clip_width, clip_height);
img = image->get_image();
- fill_frame(0, 0, 0);
+ fill_sample(0, 0, 0);
draw_line();
draw_x();
image->put_image(img);
@@ -80,7 +80,7 @@ VideoImageFrame::~VideoImageFrame ()
}
void
-VideoImageFrame::set_position (framepos_t sample)
+VideoImageFrame::set_position (samplepos_t sample)
{
double new_unit_position = editor.sample_to_pixel (sample);
image->move (ArdourCanvas::Duple (new_unit_position - unit_position, 0.0));
@@ -100,7 +100,7 @@ VideoImageFrame::exposeimg () {
}
void
-VideoImageFrame::set_videoframe (framepos_t videoframenumber, int re)
+VideoImageFrame::set_videoframe (samplepos_t videoframenumber, int re)
{
if (video_frame_number == videoframenumber && rightend == re) return;
@@ -108,7 +108,7 @@ VideoImageFrame::set_videoframe (framepos_t videoframenumber, int re)
rightend = re;
img = image->get_image();
- fill_frame(0, 0, 0);
+ fill_sample(0, 0, 0);
draw_x();
draw_line();
cut_rightend();
@@ -135,7 +135,7 @@ VideoImageFrame::draw_line ()
}
void
-VideoImageFrame::fill_frame (const uint8_t r, const uint8_t g, const uint8_t b)
+VideoImageFrame::fill_sample (const uint8_t r, const uint8_t g, const uint8_t b)
{
const int rowstride = img->stride;
const int clip_height = img->height;
@@ -201,9 +201,9 @@ http_get_thread (void *arg) {
char url[2048];
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
- snprintf(url, sizeof(url), "%s?frame=%li&w=%d&h=%d&file=%s&format=bgra",
+ snprintf(url, sizeof(url), "%s?sample=%li&w=%d&h=%d&file=%s&format=bgra",
vif->get_video_server_url().c_str(),
- (long int) vif->get_req_frame(), vif->get_width(), vif->get_height(),
+ (long int) vif->get_req_sample(), vif->get_width(), vif->get_height(),
vif->get_video_filename().c_str()
);
int status = 0;
@@ -234,7 +234,7 @@ VideoImageFrame::http_download_done (char *data){
if (!data) {
/* Image request failed (HTTP error or timeout) */
img = image->get_image();
- fill_frame(128, 0, 0);
+ fill_sample(128, 0, 0);
draw_x();
cut_rightend();
draw_line();
@@ -250,7 +250,7 @@ VideoImageFrame::http_download_done (char *data){
}
exposeimg();
- /* don't request frames too quickly, wait after user has zoomed */
+ /* don't request samples too quickly, wait after user has zoomed */
Glib::usleep(40000);
if (queued_request) {
@@ -261,7 +261,7 @@ VideoImageFrame::http_download_done (char *data){
void
-VideoImageFrame::http_get(framepos_t fn) {
+VideoImageFrame::http_get(samplepos_t fn) {
if (pthread_mutex_trylock(&request_lock)) {
pthread_mutex_lock(&queue_lock);
queued_request=true;
@@ -284,7 +284,7 @@ VideoImageFrame::http_get(framepos_t fn) {
}
void
-VideoImageFrame::http_get_again(framepos_t /*fn*/) {
+VideoImageFrame::http_get_again(samplepos_t /*fn*/) {
pthread_mutex_lock(&queue_lock);
queued_request=false;
req_video_frame_number=want_video_frame_number;
diff --git a/gtk2_ardour/video_image_frame.h b/gtk2_ardour/video_image_frame.h
index aeb117da9f..421ba55b6d 100644
--- a/gtk2_ardour/video_image_frame.h
+++ b/gtk2_ardour/video_image_frame.h
@@ -49,14 +49,14 @@ class VideoImageFrame : public sigc::trackable
VideoImageFrame (PublicEditor&, ArdourCanvas::Container&, int, int, std::string, std::string);
virtual ~VideoImageFrame ();
- void set_position (framepos_t);
- void set_videoframe (framepos_t, int rightend = -1);
- framepos_t get_video_frame_number() {return video_frame_number;}
+ void set_position (samplepos_t);
+ void set_videoframe (samplepos_t, int rightend = -1);
+ samplepos_t get_video_frame_number() {return video_frame_number;}
int get_height () {return clip_height;}
int get_width () {return clip_width;}
int get_rightend() { return rightend;}
- framepos_t get_req_frame () {return req_video_frame_number;}
+ samplepos_t get_req_sample () {return req_video_frame_number;}
std::string get_video_server_url () {return video_server_url;}
std::string get_video_filename () {return video_filename;}
@@ -78,23 +78,23 @@ class VideoImageFrame : public sigc::trackable
std::string video_filename;
double unit_position;
- framepos_t sample_position;
- framepos_t video_frame_number;
+ samplepos_t sample_position;
+ samplepos_t video_frame_number;
void reposition ();
void exposeimg ();
- void fill_frame (const uint8_t r, const uint8_t g, const uint8_t b);
+ void fill_sample (const uint8_t r, const uint8_t g, const uint8_t b);
void draw_line ();
void draw_x ();
void cut_rightend ();
- void http_get(framepos_t fn);
- void http_get_again(framepos_t fn);
+ void http_get(samplepos_t fn);
+ void http_get_again(samplepos_t fn);
- framepos_t req_video_frame_number;
- framepos_t want_video_frame_number;
+ samplepos_t req_video_frame_number;
+ samplepos_t want_video_frame_number;
bool queued_request;
pthread_mutex_t request_lock;
diff --git a/gtk2_ardour/video_monitor.cc b/gtk2_ardour/video_monitor.cc
index 56dad67dc8..9edc3d1d22 100644
--- a/gtk2_ardour/video_monitor.cc
+++ b/gtk2_ardour/video_monitor.cc
@@ -37,7 +37,7 @@ using namespace ARDOUR_UI_UTILS;
VideoMonitor::VideoMonitor (PublicEditor *ed, std::string xjadeo_bin_path)
: editor (ed)
{
- manually_seeked_frame = 0;
+ manually_seeked_sample = 0;
fps =0.0; // = _session->timecode_frames_per_second();
sync_by_manual_seek = true;
_restore_settings_mask = 0;
@@ -72,7 +72,7 @@ VideoMonitor::start ()
return true;
}
- manually_seeked_frame = 0;
+ manually_seeked_sample = 0;
sync_by_manual_seek = false;
if (clock_connection.connected()) { clock_connection.disconnect(); }
@@ -126,7 +126,7 @@ void
VideoMonitor::open (std::string filename)
{
if (!is_started()) return;
- manually_seeked_frame = 0;
+ manually_seeked_sample = 0;
osdmode = 10; // 1: frameno, 2: timecode, 8: box
starting = 15;
process->write_to_stdin("load " + filename + "\n");
@@ -384,8 +384,8 @@ VideoMonitor::parse_output (std::string d, size_t /*s*/)
osdmode = atoi(value);
if (starting || atoi(xjadeo_settings["osd mode"]) != osdmode) {
if (!starting && _session) _session->set_dirty ();
- if ((osdmode & 1) == 1) { UiState("xjadeo-window-osd-frame-on"); }
- if ((osdmode & 1) == 0) { UiState("xjadeo-window-osd-frame-off"); }
+ if ((osdmode & 1) == 1) { UiState("xjadeo-window-osd-sample-on"); }
+ if ((osdmode & 1) == 0) { UiState("xjadeo-window-osd-sample-off"); }
if ((osdmode & 2) == 2) { UiState("xjadeo-window-osd-timecode-on"); }
if ((osdmode & 2) == 0) { UiState("xjadeo-window-osd-timecode-off"); }
if ((osdmode & 8) == 8) { UiState("xjadeo-window-osd-box-on"); }
@@ -467,31 +467,31 @@ VideoMonitor::get_custom_setting (const std::string k)
return (xjadeo_settings[k]);
}
-#define NO_OFFSET (ARDOUR::max_framepos) //< skip setting or modifying offset
+#define NO_OFFSET (ARDOUR::max_samplepos) //< skip setting or modifying offset
void
VideoMonitor::srsupdate ()
{
if (!_session) { return; }
if (editor->dragging_playhead()) { return ;}
- manual_seek(_session->audible_frame(), false, NO_OFFSET);
+ manual_seek(_session->audible_sample(), false, NO_OFFSET);
}
void
-VideoMonitor::set_offset (ARDOUR::frameoffset_t offset)
+VideoMonitor::set_offset (ARDOUR::sampleoffset_t offset)
{
if (!is_started()) { return; }
if (!_session) { return; }
if (offset == NO_OFFSET ) { return; }
- framecnt_t video_frame_offset;
- framecnt_t audio_sample_rate;
+ samplecnt_t video_frame_offset;
+ samplecnt_t audio_sample_rate;
if (_session->config.get_videotimeline_pullup()) {
- audio_sample_rate = _session->frame_rate();
+ audio_sample_rate = _session->sample_rate();
} else {
- audio_sample_rate = _session->nominal_frame_rate();
+ audio_sample_rate = _session->nominal_sample_rate();
}
- /* Note: pull-up/down are applied here: frame_rate() vs. nominal_frame_rate() */
+ /* Note: pull-up/down are applied here: sample_rate() vs. nominal_sample_rate() */
if (_session->config.get_use_video_file_fps()) {
video_frame_offset = floor(offset * fps / audio_sample_rate);
} else {
@@ -506,19 +506,19 @@ VideoMonitor::set_offset (ARDOUR::frameoffset_t offset)
}
void
-VideoMonitor::manual_seek (framepos_t when, bool /*force*/, ARDOUR::frameoffset_t offset)
+VideoMonitor::manual_seek (samplepos_t when, bool /*force*/, ARDOUR::sampleoffset_t offset)
{
if (!is_started()) { return; }
if (!_session) { return; }
- framecnt_t video_frame;
- framecnt_t audio_sample_rate;
+ samplecnt_t video_frame;
+ samplecnt_t audio_sample_rate;
if (_session->config.get_videotimeline_pullup()) {
- audio_sample_rate = _session->frame_rate();
+ audio_sample_rate = _session->sample_rate();
} else {
- audio_sample_rate = _session->nominal_frame_rate();
+ audio_sample_rate = _session->nominal_sample_rate();
}
- /* Note: pull-up/down are applied here: frame_rate() vs. nominal_frame_rate() */
+ /* Note: pull-up/down are applied here: sample_rate() vs. nominal_sample_rate() */
if (_session->config.get_use_video_file_fps()) {
video_frame = floor(when * fps / audio_sample_rate);
} else {
@@ -526,8 +526,8 @@ VideoMonitor::manual_seek (framepos_t when, bool /*force*/, ARDOUR::frameoffset_
}
if (video_frame < 0 ) video_frame = 0;
- if (video_frame == manually_seeked_frame) { return; }
- manually_seeked_frame = video_frame;
+ if (video_frame == manually_seeked_sample) { return; }
+ manually_seeked_sample = video_frame;
#if 0 /* DEBUG */
std::cout <<"seek: " << video_frame << std::endl;
diff --git a/gtk2_ardour/video_monitor.h b/gtk2_ardour/video_monitor.h
index d2ab91b3a7..1abd472312 100644
--- a/gtk2_ardour/video_monitor.h
+++ b/gtk2_ardour/video_monitor.h
@@ -67,8 +67,8 @@ class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, p
void restore_settings_mask (int i) { _restore_settings_mask = i;}
int restore_settings_mask () const { return _restore_settings_mask;}
- void set_offset (ARDOUR::frameoffset_t);
- void manual_seek (ARDOUR::framepos_t, bool, ARDOUR::frameoffset_t);
+ void set_offset (ARDOUR::sampleoffset_t);
+ void manual_seek (ARDOUR::samplepos_t, bool, ARDOUR::sampleoffset_t);
void srsupdate ();
void querystate ();
bool synced_by_manual_seeks() { return sync_by_manual_seek; }
@@ -98,8 +98,8 @@ class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, p
XJSettings xjadeo_settings;
void xjadeo_sync_setup ();
- ARDOUR::framepos_t manually_seeked_frame;
- ARDOUR::frameoffset_t video_offset;
+ ARDOUR::samplepos_t manually_seeked_sample;
+ ARDOUR::sampleoffset_t video_offset;
bool sync_by_manual_seek;
sigc::connection clock_connection;
sigc::connection state_connection;
diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc
index 83d85f84fc..e336d59534 100644
--- a/gtk2_ardour/video_timeline.cc
+++ b/gtk2_ardour/video_timeline.cc
@@ -62,7 +62,7 @@ VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Container *vbg, in
video_filename = "";
local_file = true;
video_file_fps = 25.0;
- flush_frames = false;
+ flush_samples = false;
vmonitor=0;
reopen_vmonitor=false;
find_xjadeo();
@@ -119,7 +119,7 @@ VideoTimeLine::close_session ()
sessionsave.disconnect();
close_video_monitor();
- remove_frames();
+ remove_samples();
video_filename = "";
video_duration = 0;
GuiUpdate("set-xjadeo-sensitive-off");
@@ -231,24 +231,24 @@ VideoTimeLine::get_state ()
}
void
-VideoTimeLine::remove_frames ()
+VideoTimeLine::remove_samples ()
{
- for (VideoFrames::iterator i = video_frames.begin(); i != video_frames.end(); ++i ) {
- VideoImageFrame *frame = (*i);
- delete frame;
+ for (VideoSamples::iterator i = video_frames.begin(); i != video_frames.end(); ++i ) {
+ VideoImageFrame *sample = (*i);
+ delete sample;
(*i) = 0;
}
video_frames.clear();
}
VideoImageFrame *
-VideoTimeLine::get_video_frame (framepos_t vfn, int cut, int rightend)
+VideoTimeLine::get_video_frame (samplepos_t vfn, int cut, int rightend)
{
if (vfn==0) cut=0;
- for (VideoFrames::iterator i = video_frames.begin(); i != video_frames.end(); ++i) {
- VideoImageFrame *frame = (*i);
- if (abs(frame->get_video_frame_number()-vfn)<=cut
- && frame->get_rightend() == rightend) { return frame; }
+ for (VideoSamples::iterator i = video_frames.begin(); i != video_frames.end(); ++i) {
+ VideoImageFrame *sample = (*i);
+ if (abs(sample->get_video_frame_number()-vfn)<=cut
+ && sample->get_rightend() == rightend) { return sample; }
}
return 0;
}
@@ -267,9 +267,9 @@ VideoTimeLine::get_apv()
}
if (_session->config.get_videotimeline_pullup()) {
- apv = _session->frame_rate();
+ apv = _session->sample_rate();
} else {
- apv = _session->nominal_frame_rate();
+ apv = _session->nominal_sample_rate();
}
if (_session->config.get_use_video_file_fps()) {
apv /= video_file_fps;
@@ -291,30 +291,30 @@ VideoTimeLine::update_video_timeline()
}
const double samples_per_pixel = editor->get_current_zoom();
- const framepos_t leftmost_sample = editor->leftmost_sample();
+ const samplepos_t leftmost_sample = editor->leftmost_sample();
/* Outline:
- * 1) calculate how many frames there should be in current zoom (plus 1 page on each side)
- * 2) calculate first frame and distance between video-frames (according to zoom)
- * 3) destroy/add frames
- * 4) reposition existing frames
- * 5) assign framenumber to frames -> request/decode video.
+ * 1) calculate how many samples there should be in current zoom (plus 1 page on each side)
+ * 2) calculate first sample and distance between video-frames (according to zoom)
+ * 3) destroy/add samples
+ * 4) reposition existing samples
+ * 5) assign framenumber to samples -> request/decode video.
*/
/* video-file and session properties */
double display_vframe_width; /* unit: pixels ; width of one thumbnail in the timeline */
float apv; /* audio samples per video frame; */
- framepos_t leftmost_video_frame; /* unit: video-frame number ; temporary var -> vtl_start */
+ samplepos_t leftmost_video_frame; /* unit: video-frame number ; temporary var -> vtl_start */
/* variables needed to render videotimeline -- what needs to computed first */
- framepos_t vtl_start; /* unit: audio-samples ; first displayed video-frame */
- framepos_t vtl_dist; /* unit: audio-samples ; distance between displayed video-frames */
- unsigned int visible_video_frames; /* number of frames that fit on current canvas */
+ samplepos_t vtl_start; /* unit: audio-samples ; first displayed video-frame */
+ samplepos_t vtl_dist; /* unit: audio-samples ; distance between displayed video-frames */
+ unsigned int visible_video_frames; /* number of samples that fit on current canvas */
if (_session->config.get_videotimeline_pullup()) {
- apv = _session->frame_rate();
+ apv = _session->sample_rate();
} else {
- apv = _session->nominal_frame_rate();
+ apv = _session->nominal_sample_rate();
}
if (_session->config.get_use_video_file_fps()) {
apv /= video_file_fps;
@@ -338,51 +338,51 @@ VideoTimeLine::update_video_timeline()
leftmost_video_frame = floor (floor((long double)(leftmost_sample - video_start_offset - video_offset ) / vtl_dist) * vtl_dist / apv);
vtl_start = rint (video_offset + video_start_offset + leftmost_video_frame * apv);
- visible_video_frames = 2 + ceil((double)editor->current_page_samples() / vtl_dist); /* +2 left+right partial frames */
+ visible_video_frames = 2 + ceil((double)editor->current_page_samples() / vtl_dist); /* +2 left+right partial samples */
/* expand timeline (cache next/prev page images) */
vtl_start -= visible_video_frames * vtl_dist;
visible_video_frames *=3;
- /* don't request frames that are too far to the right */
+ /* don't request samples that are too far to the right */
if (vtl_start < video_offset) {
visible_video_frames = std::max((double)0.0, (double)visible_video_frames + ceil((double)(vtl_start - video_offset)/vtl_dist));
vtl_start = video_offset;
}
/* apply video-file constraints
- * (first frame in video is at video_start_offset) */
+ * (first sample in video is at video_start_offset) */
if (vtl_start > video_start_offset + video_duration + video_offset ) {
visible_video_frames = 0;
}
/* trim end.
- * end = position on timeline (video-offset) minus video-file's first frame position
+ * end = position on timeline (video-offset) minus video-file's first sample position
* TODO optimize: compute rather than iterate */
while (visible_video_frames > 0 && vtl_start + (visible_video_frames-1) * vtl_dist >= video_start_offset + video_duration + video_offset) {
--visible_video_frames;
}
- if (flush_frames) {
- remove_frames();
- flush_frames=false;
+ if (flush_samples) {
+ remove_samples();
+ flush_samples=false;
}
while (video_frames.size() < visible_video_frames) {
- VideoImageFrame *frame;
- frame = new VideoImageFrame(*editor, *videotl_group, display_vframe_width, bar_height, video_server_url, translated_filename());
- frame->ImgChanged.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
- video_frames.push_back(frame);
+ VideoImageFrame *sample;
+ sample = new VideoImageFrame(*editor, *videotl_group, display_vframe_width, bar_height, video_server_url, translated_filename());
+ sample->ImgChanged.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
+ video_frames.push_back(sample);
}
- VideoFrames outdated_video_frames;
+ VideoSamples outdated_video_frames;
std::list<int> remaining;
outdated_video_frames = video_frames;
#if 1
- /* when zoomed out, ignore shifts by +-1 frame
+ /* when zoomed out, ignore shifts by +-1 sample
* which can occur due to rounding errors when
- * scrolling to a new leftmost-audio frame.
+ * scrolling to a new leftmost-audio sample.
*/
int cut =1;
if (vtl_dist/apv < 3.0) cut =0;
@@ -391,40 +391,40 @@ VideoTimeLine::update_video_timeline()
#endif
for (unsigned int vfcount=0; vfcount < visible_video_frames; ++vfcount){
- framepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-frames */
- framepos_t vframeno = rint ( (vfpos - video_offset) / apv); /* unit: video-frames */
- vfpos = (vframeno * apv ) + video_offset; /* audio-frame corresponding to /rounded/ video-frame */
+ samplepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-samples */
+ samplepos_t vframeno = rint ( (vfpos - video_offset) / apv); /* unit: video-frames */
+ vfpos = (vframeno * apv ) + video_offset; /* audio-sample corresponding to /rounded/ video-frame */
int rightend = -1; /* unit: pixels */
if (vfpos + vtl_dist > video_start_offset + video_duration + video_offset) {
rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
//printf("lf(e): %lu\n", vframeno); // XXX
}
- VideoImageFrame * frame = get_video_frame(vframeno, cut, rightend);
- if (frame) {
- frame->set_position(vfpos);
- outdated_video_frames.remove(frame);
+ VideoImageFrame * sample = get_video_frame(vframeno, cut, rightend);
+ if (sample) {
+ sample->set_position(vfpos);
+ outdated_video_frames.remove(sample);
} else {
remaining.push_back(vfcount);
}
}
- for (VideoFrames::iterator i = outdated_video_frames.begin(); i != outdated_video_frames.end(); ++i ) {
- VideoImageFrame *frame = (*i);
+ for (VideoSamples::iterator i = outdated_video_frames.begin(); i != outdated_video_frames.end(); ++i ) {
+ VideoImageFrame *sample = (*i);
if (remaining.empty()) {
- frame->set_position(-2 * vtl_dist + leftmost_sample); /* move off screen */
+ sample->set_position(-2 * vtl_dist + leftmost_sample); /* move off screen */
} else {
int vfcount=remaining.front();
remaining.pop_front();
- framepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-frames */
- framepos_t vframeno = rint ((vfpos - video_offset) / apv); /* unit: video-frames */
+ samplepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-samples */
+ samplepos_t vframeno = rint ((vfpos - video_offset) / apv); /* unit: video-frames */
int rightend = -1; /* unit: pixels */
if (vfpos + vtl_dist > video_start_offset + video_duration + video_offset) {
rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
//printf("lf(n): %lu\n", vframeno); // XXX
}
- frame->set_position(vfpos);
- frame->set_videoframe(vframeno, rightend);
+ sample->set_position(vfpos);
+ sample->set_videoframe(vframeno, rightend);
}
}
}
@@ -463,8 +463,8 @@ VideoTimeLine::video_file_info (std::string filename, bool local)
GuiUpdate("video-unavailable");
return false;
}
- video_duration = _duration * _session->nominal_frame_rate() / video_file_fps;
- video_start_offset = _start_offset * _session->nominal_frame_rate();
+ video_duration = _duration * _session->nominal_sample_rate() / video_file_fps;
+ video_start_offset = _start_offset * _session->nominal_sample_rate();
if (auto_set_session_fps && video_file_fps != _session->timecode_frames_per_second()) {
switch ((int)floorf(video_file_fps*1000.0)) {
@@ -609,9 +609,9 @@ VideoTimeLine::gui_update(std::string const & t) {
editor->toggle_xjadeo_viewoption(2, 1);
} else if (t == "xjadeo-window-osd-timecode-off") {
editor->toggle_xjadeo_viewoption(2, 0);
- } else if (t == "xjadeo-window-osd-frame-on") {
+ } else if (t == "xjadeo-window-osd-sample-on") {
editor->toggle_xjadeo_viewoption(3, 1);
- } else if (t == "xjadeo-window-osd-frame-off") {
+ } else if (t == "xjadeo-window-osd-sample-off") {
editor->toggle_xjadeo_viewoption(3, 0);
} else if (t == "xjadeo-window-osd-box-on") {
editor->toggle_xjadeo_viewoption(4, 1);
@@ -650,7 +650,7 @@ VideoTimeLine::vmon_update () {
void
VideoTimeLine::flush_local_cache () {
- flush_frames = true;
+ flush_samples = true;
vmon_update();
}
@@ -915,7 +915,7 @@ VideoTimeLine::terminated_video_monitor () {
}
void
-VideoTimeLine::manual_seek_video_monitor (framepos_t pos)
+VideoTimeLine::manual_seek_video_monitor (samplepos_t pos)
{
if (!vmonitor) { return; }
if (!vmonitor->is_started()) { return; }
diff --git a/gtk2_ardour/video_timeline.h b/gtk2_ardour/video_timeline.h
index 03aaa902d8..55dd29a897 100644
--- a/gtk2_ardour/video_timeline.h
+++ b/gtk2_ardour/video_timeline.h
@@ -45,7 +45,7 @@ class PublicEditor;
* creates \ref VideoImageFrame as neccesary (which
* query the server for image-data).
*
- * This class contains the algorithm to position the single frames
+ * This class contains the algorithm to position the single samples
* on the timeline according to current-zoom level and video-file
* attributes. see \ref update_video_timeline()
*
@@ -78,7 +78,7 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p
void close_video_monitor ();
void control_video_monitor (int, int);
void terminated_video_monitor ();
- void manual_seek_video_monitor (framepos_t pos);
+ void manual_seek_video_monitor (samplepos_t pos);
void parameter_changed (std::string const & p);
void set_video_server_url (std::string);
@@ -94,10 +94,10 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p
void close_session ();
void sync_session_state (); /* video-monitor does not actively report window/pos changes, query it */
float get_apv(); /* audio samples per video frame; */
- ARDOUR::framecnt_t get_duration () { return video_duration;}
- ARDOUR::frameoffset_t get_offset () { return video_offset;}
- ARDOUR::frameoffset_t quantify_frames_to_apv (ARDOUR::frameoffset_t offset) { return rint(offset/get_apv())*get_apv(); }
- void set_offset (ARDOUR::frameoffset_t offset) { video_offset = quantify_frames_to_apv(offset); } // this function does not update video_offset_p, call save_undo() to finalize changes to this! - this fn is currently only used from editor_drag.cc
+ ARDOUR::samplecnt_t get_duration () { return video_duration;}
+ ARDOUR::sampleoffset_t get_offset () { return video_offset;}
+ ARDOUR::sampleoffset_t quantify_samples_to_apv (ARDOUR::sampleoffset_t offset) { return rint(offset/get_apv())*get_apv(); }
+ void set_offset (ARDOUR::sampleoffset_t offset) { video_offset = quantify_samples_to_apv(offset); } // this function does not update video_offset_p, call save_undo() to finalize changes to this! - this fn is currently only used from editor_drag.cc
protected:
@@ -110,10 +110,10 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p
void find_harvid ();
- ARDOUR::frameoffset_t video_start_offset; /**< unit: audio-samples - video-file */
- ARDOUR::frameoffset_t video_offset; /**< unit: audio-samples - session */
- ARDOUR::frameoffset_t video_offset_p; /**< used for undo from editor_drag.cc */
- framepos_t video_duration; /**< unit: audio-samples */
+ ARDOUR::sampleoffset_t video_start_offset; /**< unit: audio-samples - video-file */
+ ARDOUR::sampleoffset_t video_offset; /**< unit: audio-samples - session */
+ ARDOUR::sampleoffset_t video_offset_p; /**< used for undo from editor_drag.cc */
+ samplepos_t video_duration; /**< unit: audio-samples */
std::string video_filename;
bool local_file;
double video_aspect_ratio;
@@ -129,11 +129,11 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p
std::string xjadeo_version;
std::string harvid_version;
- typedef std::list<VideoImageFrame*> VideoFrames;
- VideoFrames video_frames;
- VideoImageFrame *get_video_frame (framepos_t vfn, int cut=0, int rightend = -1);
- bool flush_frames;
- void remove_frames ();
+ typedef std::list<VideoImageFrame*> VideoSamples;
+ VideoSamples video_frames;
+ VideoImageFrame *get_video_frame (samplepos_t vfn, int cut=0, int rightend = -1);
+ bool flush_samples;
+ void remove_samples ();
std::string translated_filename ();
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc
index 0ce861ca4a..dd3c66bfb7 100644
--- a/libs/ardour/amp.cc
+++ b/libs/ardour/amp.cc
@@ -41,7 +41,7 @@ Amp::Amp (Session& s, const std::string& name, boost::shared_ptr<GainControl> gc
: Processor(s, "Amp")
, _apply_gain_automation(false)
, _current_gain(GAIN_COEFF_ZERO)
- , _current_automation_frame (INT64_MAX)
+ , _current_automation_sample (INT64_MAX)
, _gain_control (gc)
, _gain_automation_buffer(0)
, _midi_amp (control_midi_also)
@@ -75,7 +75,7 @@ scale_midi_velocity(Evoral::Event<MidiBuffer::TimeType>& ev, float factor)
}
void
-Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
+Amp::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
{
if (!_active && !_pending_active) {
return;
@@ -102,7 +102,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
}
}
- const gain_t a = 156.825f / (gain_t)_session.nominal_frame_rate(); // 25 Hz LPF; see Amp::apply_gain for details
+ const gain_t a = 156.825f / (gain_t)_session.nominal_sample_rate(); // 25 Hz LPF; see Amp::apply_gain for details
gain_t lpf = _current_gain;
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
@@ -126,7 +126,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
if (fabsf (_current_gain - target_gain) >= GAIN_COEFF_DELTA) {
- _current_gain = Amp::apply_gain (bufs, _session.nominal_frame_rate(), nframes, _current_gain, target_gain, _midi_amp);
+ _current_gain = Amp::apply_gain (bufs, _session.nominal_sample_rate(), nframes, _current_gain, target_gain, _midi_amp);
/* see note in PluginInsert::connect_and_run ()
* set_value_unchecked() won't emit a signal since the value is effectively unchanged
@@ -165,7 +165,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
}
gain_t
-Amp::apply_gain (BufferSet& bufs, framecnt_t sample_rate, framecnt_t nframes, gain_t initial, gain_t target, bool midi_amp)
+Amp::apply_gain (BufferSet& bufs, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target, bool midi_amp)
{
/** Apply a (potentially) declicked gain to the buffers of @a bufs */
gain_t rv = target;
@@ -231,13 +231,13 @@ Amp::apply_gain (BufferSet& bufs, framecnt_t sample_rate, framecnt_t nframes, ga
}
void
-Amp::declick (BufferSet& bufs, framecnt_t nframes, int dir)
+Amp::declick (BufferSet& bufs, samplecnt_t nframes, int dir)
{
if (nframes == 0 || bufs.count().n_total() == 0) {
return;
}
- const framecnt_t declick = std::min ((framecnt_t) 512, nframes);
+ const samplecnt_t declick = std::min ((samplecnt_t) 512, nframes);
const double fractional_shift = 1.0 / declick ;
gain_t delta, initial;
@@ -273,7 +273,7 @@ Amp::declick (BufferSet& bufs, framecnt_t nframes, int dir)
gain_t
-Amp::apply_gain (AudioBuffer& buf, framecnt_t sample_rate, framecnt_t nframes, gain_t initial, gain_t target)
+Amp::apply_gain (AudioBuffer& buf, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target)
{
/* Apply a (potentially) declicked gain to the contents of @a buf
* -- used by MonitorProcessor::run()
@@ -303,7 +303,7 @@ Amp::apply_gain (AudioBuffer& buf, framecnt_t sample_rate, framecnt_t nframes, g
}
void
-Amp::apply_simple_gain (BufferSet& bufs, framecnt_t nframes, gain_t target, bool midi_amp)
+Amp::apply_simple_gain (BufferSet& bufs, samplecnt_t nframes, gain_t target, bool midi_amp)
{
if (fabsf (target) < GAIN_COEFF_SMALL) {
@@ -348,7 +348,7 @@ Amp::apply_simple_gain (BufferSet& bufs, framecnt_t nframes, gain_t target, bool
}
void
-Amp::apply_simple_gain (AudioBuffer& buf, framecnt_t nframes, gain_t target)
+Amp::apply_simple_gain (AudioBuffer& buf, samplecnt_t nframes, gain_t target)
{
if (fabsf (target) < GAIN_COEFF_SMALL) {
memset (buf.data(), 0, sizeof (Sample) * nframes);
@@ -386,7 +386,7 @@ Amp::set_state (const XMLNode& node, int version)
* transport is rolling).
*/
void
-Amp::setup_gain_automation (framepos_t start_frame, framepos_t end_frame, framecnt_t nframes)
+Amp::setup_gain_automation (samplepos_t start_sample, samplepos_t end_sample, samplecnt_t nframes)
{
Glib::Threads::Mutex::Lock am (control_lock(), Glib::Threads::TRY_LOCK);
@@ -396,15 +396,15 @@ Amp::setup_gain_automation (framepos_t start_frame, framepos_t end_frame, framec
{
assert (_gain_automation_buffer);
- _apply_gain_automation = _gain_control->get_masters_curve ( start_frame, end_frame, _gain_automation_buffer, nframes);
+ _apply_gain_automation = _gain_control->get_masters_curve ( start_sample, end_sample, _gain_automation_buffer, nframes);
- if (start_frame != _current_automation_frame && _session.bounce_processing ()) {
+ if (start_sample != _current_automation_sample && _session.bounce_processing ()) {
_current_gain = _gain_automation_buffer[0];
}
- _current_automation_frame = end_frame;
+ _current_automation_sample = end_sample;
} else {
_apply_gain_automation = false;
- _current_automation_frame = INT64_MAX;
+ _current_automation_sample = INT64_MAX;
}
}
diff --git a/libs/ardour/analysis_graph.cc b/libs/ardour/analysis_graph.cc
index a1e8807d57..fe5b1c9a3b 100644
--- a/libs/ardour/analysis_graph.cc
+++ b/libs/ardour/analysis_graph.cc
@@ -37,8 +37,8 @@ using namespace AudioGrapher;
AnalysisGraph::AnalysisGraph (Session *s)
: _session (s)
, _max_chunksize (8192)
- , _frames_read (0)
- , _frames_end (0)
+ , _samples_read (0)
+ , _samples_end (0)
, _canceled (false)
{
_buf = (Sample *) malloc(sizeof(Sample) * _max_chunksize);
@@ -60,7 +60,7 @@ AnalysisGraph::analyze_region (boost::shared_ptr<AudioRegion> region)
interleaver->init (region->n_channels(), _max_chunksize);
chunker.reset (new Chunker<Sample> (_max_chunksize));
analyser.reset (new Analyser (
- _session->nominal_frame_rate(),
+ _session->nominal_sample_rate(),
region->n_channels(),
_max_chunksize,
region->length()));
@@ -68,11 +68,11 @@ AnalysisGraph::analyze_region (boost::shared_ptr<AudioRegion> region)
interleaver->add_output(chunker);
chunker->add_output (analyser);
- framecnt_t x = 0;
- framecnt_t length = region->length();
+ samplecnt_t x = 0;
+ samplecnt_t length = region->length();
while (x < length) {
- framecnt_t chunk = std::min (_max_chunksize, length - x);
- framecnt_t n = 0;
+ samplecnt_t chunk = std::min (_max_chunksize, length - x);
+ samplecnt_t n = 0;
for (unsigned int channel = 0; channel < region->n_channels(); ++channel) {
memset (_buf, 0, chunk * sizeof (Sample));
n = region->read_at (_buf, _mixbuf, _gainbuf, region->position() + x, chunk, channel);
@@ -88,8 +88,8 @@ AnalysisGraph::analyze_region (boost::shared_ptr<AudioRegion> region)
}
}
x += n;
- _frames_read += n;
- Progress (_frames_read, _frames_end);
+ _samples_read += n;
+ Progress (_samples_read, _samples_end);
if (_canceled) {
return;
}
@@ -112,10 +112,10 @@ AnalysisGraph::analyze_range (boost::shared_ptr<Route> route, boost::shared_ptr<
interleaver->add_output(chunker);
chunker->add_output (analyser);
- framecnt_t x = 0;
+ samplecnt_t x = 0;
while (x < j->length()) {
- framecnt_t chunk = std::min (_max_chunksize, (*j).length() - x);
- framecnt_t n = 0;
+ samplecnt_t chunk = std::min (_max_chunksize, (*j).length() - x);
+ samplecnt_t n = 0;
for (uint32_t channel = 0; channel < n_audio; ++channel) {
n = pl->read (_buf, _mixbuf, _gainbuf, (*j).start + x, chunk, channel);
@@ -126,8 +126,8 @@ AnalysisGraph::analyze_range (boost::shared_ptr<Route> route, boost::shared_ptr<
interleaver->input (channel)->process (context);
}
x += n;
- _frames_read += n;
- Progress (_frames_read, _frames_end);
+ _samples_read += n;
+ Progress (_samples_read, _samples_end);
if (_canceled) {
return;
}
@@ -136,11 +136,11 @@ AnalysisGraph::analyze_range (boost::shared_ptr<Route> route, boost::shared_ptr<
std::string name = string_compose (_("%1 (%2..%3)"), route->name(),
Timecode::timecode_format_sampletime (
(*j).start,
- _session->nominal_frame_rate(),
+ _session->nominal_sample_rate(),
100, false),
Timecode::timecode_format_sampletime (
(*j).start + (*j).length(),
- _session->nominal_frame_rate(),
+ _session->nominal_sample_rate(),
100, false)
);
_results.insert (std::make_pair (name, analyser->result ()));
diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h
index 5bafc04e07..f3b401fc02 100644
--- a/libs/ardour/ardour/amp.h
+++ b/libs/ardour/ardour/amp.h
@@ -47,11 +47,11 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
void set_gain_automation_buffer (gain_t *);
- void setup_gain_automation (framepos_t start_frame, framepos_t end_frame, framecnt_t nframes);
+ void setup_gain_automation (samplepos_t start_sample, samplepos_t end_sample, samplecnt_t nframes);
bool apply_gain_automation() const { return _apply_gain_automation; }
void apply_gain_automation(bool yn) { _apply_gain_automation = yn; }
@@ -59,13 +59,13 @@ public:
XMLNode& state (bool full);
int set_state (const XMLNode&, int version);
- static gain_t apply_gain (BufferSet& bufs, framecnt_t sample_rate, framecnt_t nframes, gain_t initial, gain_t target, bool midi_amp = true);
- static void apply_simple_gain(BufferSet& bufs, framecnt_t nframes, gain_t target, bool midi_amp = true);
+ static gain_t apply_gain (BufferSet& bufs, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target, bool midi_amp = true);
+ static void apply_simple_gain(BufferSet& bufs, samplecnt_t nframes, gain_t target, bool midi_amp = true);
- static gain_t apply_gain (AudioBuffer& buf, framecnt_t sample_rate, framecnt_t nframes, gain_t initial, gain_t target);
- static void apply_simple_gain(AudioBuffer& buf, framecnt_t nframes, gain_t target);
+ static gain_t apply_gain (AudioBuffer& buf, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target);
+ static void apply_simple_gain(AudioBuffer& buf, samplecnt_t nframes, gain_t target);
- static void declick (BufferSet& bufs, framecnt_t nframes, int dir);
+ static void declick (BufferSet& bufs, samplecnt_t nframes, int dir);
static void update_meters();
boost::shared_ptr<GainControl> gain_control() {
@@ -80,7 +80,7 @@ private:
bool _denormal_protection;
bool _apply_gain_automation;
float _current_gain;
- framepos_t _current_automation_frame;
+ samplepos_t _current_automation_sample;
std::string _display_name;
diff --git a/libs/ardour/ardour/analysis_graph.h b/libs/ardour/ardour/analysis_graph.h
index 4724b826c1..c9ea4f4863 100644
--- a/libs/ardour/ardour/analysis_graph.h
+++ b/libs/ardour/ardour/analysis_graph.h
@@ -48,19 +48,19 @@ class LIBARDOUR_API AnalysisGraph {
void cancel () { _canceled = true; }
bool canceled () const { return _canceled; }
- void set_total_frames (framecnt_t p) { _frames_end = p; }
- PBD::Signal2<void, framecnt_t, framecnt_t> Progress;
+ void set_total_samples (samplecnt_t p) { _samples_end = p; }
+ PBD::Signal2<void, samplecnt_t, samplecnt_t> Progress;
private:
ARDOUR::Session* _session;
AnalysisResults _results;
- framecnt_t _max_chunksize;
+ samplecnt_t _max_chunksize;
ARDOUR::Sample* _buf;
ARDOUR::Sample* _mixbuf;
float* _gainbuf;
- framecnt_t _frames_read;
- framecnt_t _frames_end;
+ samplecnt_t _samples_read;
+ samplecnt_t _samples_end;
bool _canceled;
typedef boost::shared_ptr<AudioGrapher::Analyser> AnalysisPtr;
diff --git a/libs/ardour/ardour/async_midi_port.h b/libs/ardour/ardour/async_midi_port.h
index 35f3f53e4f..3639304f77 100644
--- a/libs/ardour/ardour/async_midi_port.h
+++ b/libs/ardour/ardour/async_midi_port.h
@@ -55,7 +55,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port {
void cycle_end (pframes_t nframes);
/* called from non-RT context */
- void parse (framecnt_t timestamp);
+ void parse (samplecnt_t timestamp);
int write (const MIDI::byte *msg, size_t msglen, MIDI::timestamp_t timestamp);
int read (MIDI::byte *buf, size_t bufsize);
/* waits for output to be cleared */
@@ -72,7 +72,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port {
/* Not selectable; use ios() */
int selectable() const { return -1; }
- void set_timer (boost::function<framecnt_t (void)>&);
+ void set_timer (boost::function<samplecnt_t (void)>&);
static void set_process_thread (pthread_t);
static pthread_t get_process_thread () { return _process_thread; }
@@ -83,7 +83,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port {
MIDI::timestamp_t _last_write_timestamp;
bool _flush_at_cycle_start;
bool have_timer;
- boost::function<framecnt_t (void)> timer;
+ boost::function<samplecnt_t (void)> timer;
PBD::RingBuffer< Evoral::Event<double> > output_fifo;
EventRingBuffer<MIDI::timestamp_t> input_fifo;
Glib::Threads::Mutex output_fifo_lock;
diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h
index 6523eb5081..7c0c893103 100644
--- a/libs/ardour/ardour/audio_backend.h
+++ b/libs/ardour/ardour/audio_backend.h
@@ -629,11 +629,11 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
virtual TransportState transport_state () const { return TransportStopped; }
/** Attempt to locate the transport to @param pos
*/
- virtual void transport_locate (framepos_t /*pos*/) {}
+ virtual void transport_locate (samplepos_t /*pos*/) {}
/** Return the current transport location, in samples measured
* from the origin (defined by the transport time master)
*/
- virtual framepos_t transport_frame() const { return 0; }
+ virtual samplepos_t transport_sample() const { return 0; }
/** If @param yn is true, become the time master for any inter-application transport
* timebase, otherwise cease to be the time master for the same.
@@ -661,12 +661,12 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
*
* Can be called from any thread.
*/
- virtual framepos_t sample_time () = 0;
+ virtual samplepos_t sample_time () = 0;
/** Return the time according to the sample clock in use when the most
* recent buffer process cycle began. Can be called from any thread.
*/
- virtual framepos_t sample_time_at_cycle_start () = 0;
+ virtual samplepos_t sample_time_at_cycle_start () = 0;
/** Return the time since the current buffer process cycle started,
* in samples, according to the sample clock in use.
@@ -730,7 +730,7 @@ class LIBARDOUR_API AudioBackend : public PortEngine {
* handled by Ardour itself (LTC and MTC are both handled by Ardour).
* The canonical example is JACK Transport.
*/
- virtual bool speed_and_position (double& speed, framepos_t& position) {
+ virtual bool speed_and_position (double& speed, samplepos_t& position) {
speed = 0.0;
position = 0;
return false;
diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h
index 7d255c5c50..833d1dcb18 100644
--- a/libs/ardour/ardour/audio_buffer.h
+++ b/libs/ardour/ardour/audio_buffer.h
@@ -37,7 +37,7 @@ public:
* @param len number of samples to clear
* @laram offset start offset
*/
- void silence (framecnt_t len, framecnt_t offset = 0);
+ void silence (samplecnt_t len, samplecnt_t offset = 0);
/** Copy samples from src array starting at src_offset into self starting at dst_offset
* @param src array to read from
@@ -45,7 +45,7 @@ public:
* @param dst_offset offset in destination buffer
* @param src_offset start offset in src buffer
*/
- void read_from (const Sample* src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) {
+ void read_from (const Sample* src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) {
assert(src != 0);
assert(_capacity > 0);
assert(len <= _capacity);
@@ -54,12 +54,12 @@ public:
_written = true;
}
- void read_from_with_gain (const Sample* src, framecnt_t len, gain_t gain, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) {
+ void read_from_with_gain (const Sample* src, samplecnt_t len, gain_t gain, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) {
assert(src != 0);
assert(_capacity > 0);
assert(len <= _capacity);
src += src_offset;
- for (framecnt_t n = 0; n < len; ++n) {
+ for (samplecnt_t n = 0; n < len; ++n) {
_data[dst_offset+n] = src[n] * gain;
}
_silent = false;
@@ -72,12 +72,12 @@ public:
* @param dst_offset offset in destination buffer
* @param src_offset start offset in src buffer
*/
- void read_from (const Buffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) {
+ void read_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) {
assert(&src != this);
assert(_capacity > 0);
assert(src.type() == DataType::AUDIO);
assert(dst_offset + len <= _capacity);
- assert( src_offset <= ((framecnt_t) src.capacity()-len));
+ assert( src_offset <= ((samplecnt_t) src.capacity()-len));
memcpy(_data + dst_offset, ((const AudioBuffer&)src).data() + src_offset, sizeof(Sample) * len);
if (dst_offset == 0 && src_offset == 0 && len == _capacity) {
_silent = src.silent();
@@ -87,15 +87,15 @@ public:
_written = true;
}
- /** Accumulate (add) @a len frames @a src starting at @a src_offset into self starting at @a dst_offset */
- void merge_from (const Buffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) {
+ /** Accumulate (add) @a len samples @a src starting at @a src_offset into self starting at @a dst_offset */
+ void merge_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) {
const AudioBuffer* ab = dynamic_cast<const AudioBuffer*>(&src);
assert (ab);
accumulate_from (*ab, len, dst_offset, src_offset);
}
- /** Accumulate (add) @a len frames @a src starting at @a src_offset into self starting at @a dst_offset */
- void accumulate_from (const AudioBuffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) {
+ /** Accumulate (add) @a len samples @a src starting at @a src_offset into self starting at @a dst_offset */
+ void accumulate_from (const AudioBuffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) {
assert(_capacity > 0);
assert(len <= _capacity);
@@ -108,8 +108,8 @@ public:
_written = true;
}
- /** Accumulate (add) @a len frames @a src starting at @a src_offset into self starting at @a dst_offset */
- void accumulate_from (const Sample* src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) {
+ /** Accumulate (add) @a len samples @a src starting at @a src_offset into self starting at @a dst_offset */
+ void accumulate_from (const Sample* src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) {
assert(_capacity > 0);
assert(len <= _capacity);
@@ -122,9 +122,9 @@ public:
_written = true;
}
- /** Accumulate (add) @a len frames @a src starting at @a src_offset into self starting at @dst_offset
+ /** Accumulate (add) @a len samples @a src starting at @a src_offset into self starting at @dst_offset
* scaling by @a gain_coeff */
- void accumulate_with_gain_from (const AudioBuffer& src, framecnt_t len, gain_t gain_coeff, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) {
+ void accumulate_with_gain_from (const AudioBuffer& src, samplecnt_t len, gain_t gain_coeff, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) {
assert(_capacity > 0);
assert(len <= _capacity);
@@ -142,9 +142,9 @@ public:
_written = true;
}
- /** Accumulate (add) @a len frames FROM THE START OF @a src into self
+ /** Accumulate (add) @a len samples FROM THE START OF @a src into self
* scaling by @a gain_coeff */
- void accumulate_with_gain_from (const Sample* src_raw, framecnt_t len, gain_t gain_coeff, frameoffset_t dst_offset = 0) {
+ void accumulate_with_gain_from (const Sample* src_raw, samplecnt_t len, gain_t gain_coeff, sampleoffset_t dst_offset = 0) {
assert(_capacity > 0);
assert(len <= _capacity);
@@ -157,9 +157,9 @@ public:
_written = true;
}
- /** Accumulate (add) @a len frames FROM THE START OF @a src into self
+ /** Accumulate (add) @a len samples FROM THE START OF @a src into self
* scaling by @a gain_coeff */
- void accumulate_with_ramped_gain_from (const Sample* src, framecnt_t len, gain_t initial, gain_t target, frameoffset_t dst_offset = 0) {
+ void accumulate_with_ramped_gain_from (const Sample* src, samplecnt_t len, gain_t initial, gain_t target, sampleoffset_t dst_offset = 0) {
assert(_capacity > 0);
assert(len <= _capacity);
@@ -167,7 +167,7 @@ public:
Sample* dst = _data + dst_offset;
gain_t gain_delta = (target - initial)/len;
- for (framecnt_t n = 0; n < len; ++n) {
+ for (samplecnt_t n = 0; n < len; ++n) {
*dst++ += (*src++ * initial);
initial += gain_delta;
}
@@ -178,9 +178,9 @@ public:
/** apply a fixed gain factor to the audio buffer
* @param gain gain factor
- * @param len number of frames to amplify
+ * @param len number of samples to amplify
*/
- void apply_gain (gain_t gain, framecnt_t len) {
+ void apply_gain (gain_t gain, samplecnt_t len) {
apply_gain_to_buffer (_data, len, gain);
}
@@ -202,19 +202,19 @@ public:
*/
void resize (size_t nframes);
- const Sample* data (framecnt_t offset = 0) const {
+ const Sample* data (samplecnt_t offset = 0) const {
assert(offset <= _capacity);
return _data + offset;
}
- Sample* data (framecnt_t offset = 0) {
+ Sample* data (samplecnt_t offset = 0) {
assert(offset <= _capacity);
_silent = false;
return _data + offset;
}
/** check buffer for silence
- * @param nframes number of frames to check
+ * @param nframes number of samples to check
* @param n first non zero sample (if any)
* @return true if all samples are zero
*/
diff --git a/libs/ardour/ardour/audio_playlist_source.h b/libs/ardour/ardour/audio_playlist_source.h
index 9c815fb238..4a1f5953dc 100644
--- a/libs/ardour/ardour/audio_playlist_source.h
+++ b/libs/ardour/ardour/audio_playlist_source.h
@@ -41,8 +41,8 @@ public:
uint32_t n_channels() const;
bool clamped_at_unity () const { return false; }
- framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const;
- framecnt_t write_unlocked (Sample *src, framecnt_t cnt);
+ samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
+ samplecnt_t write_unlocked (Sample *src, samplecnt_t cnt);
float sample_rate () const;
int setup_peakfile ();
@@ -57,7 +57,7 @@ protected:
friend class SourceFactory;
AudioPlaylistSource (Session&, const PBD::ID& orig, const std::string& name, boost::shared_ptr<AudioPlaylist>, uint32_t chn,
- frameoffset_t begin, framecnt_t len, Source::Flag flags);
+ sampleoffset_t begin, samplecnt_t len, Source::Flag flags);
AudioPlaylistSource (Session&, const XMLNode&);
diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h
index 2779e6a4f8..e93ebd7f02 100644
--- a/libs/ardour/ardour/audio_track.h
+++ b/libs/ardour/ardour/audio_track.h
@@ -37,7 +37,7 @@ class LIBARDOUR_API AudioTrack : public Track
AudioTrack (Session&, std::string name, TrackMode m = Normal);
~AudioTrack ();
- int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
int declick, bool& need_butler);
void freeze_me (InterThreadInfo&);
@@ -45,9 +45,9 @@ class LIBARDOUR_API AudioTrack : public Track
bool bounceable (boost::shared_ptr<Processor>, bool include_endpoint) const;
boost::shared_ptr<Region> bounce (InterThreadInfo&);
- boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&,
+ boost::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo&,
boost::shared_ptr<Processor> endpoint, bool include_endpoint);
- int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes,
+ int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze);
int set_state (const XMLNode&, int version);
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h
index c5c5ed4a95..2e44e6ec63 100644
--- a/libs/ardour/ardour/audio_unit.h
+++ b/libs/ardour/ardour/audio_unit.h
@@ -70,7 +70,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
const char * maker () const { return _info->creator.c_str(); }
uint32_t parameter_count () const;
float default_value (uint32_t port);
- framecnt_t signal_latency() const;
+ samplecnt_t signal_latency() const;
void set_parameter (uint32_t which, float val);
float get_parameter (uint32_t which) const;
@@ -84,9 +84,9 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
int set_block_size (pframes_t nframes);
int connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset);
+ pframes_t nframes, samplecnt_t offset);
std::set<Evoral::Parameter> automatable() const;
std::string describe_parameter (Evoral::Parameter);
IOPortDescription describe_io_port (DataType dt, bool input, uint32_t id) const;
@@ -123,7 +123,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
- UInt32 inNumberFrames,
+ UInt32 inNumberSamples,
AudioBufferList* ioData);
/* "host" callbacks */
@@ -170,7 +170,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
int32_t input_channels;
int32_t output_channels;
std::vector<std::pair<int,int> > io_configs;
- framecnt_t _last_nframes;
+ samplecnt_t _last_nframes;
mutable volatile guint _current_latency;
bool _requires_fixed_size_buffers;
AudioBufferList* buffers;
@@ -213,11 +213,11 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
typedef std::map<uint32_t, uint32_t> ParameterMap;
ParameterMap parameter_map;
uint32_t input_maxbuf;
- framecnt_t input_offset;
- framecnt_t *cb_offsets;
+ samplecnt_t input_offset;
+ samplecnt_t *cb_offsets;
BufferSet* input_buffers;
ChanMapping * input_map;
- framecnt_t frames_processed;
+ samplecnt_t samples_processed;
uint32_t audio_input_cnt;
std::vector<AUParameterDescriptor> descriptors;
@@ -227,7 +227,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
void discover_factory_presets ();
- framepos_t transport_frame;
+ samplepos_t transport_sample;
float transport_speed;
float last_transport_speed;
diff --git a/libs/ardour/ardour/audioanalyser.h b/libs/ardour/ardour/audioanalyser.h
index 03eb7d94fa..0474787aec 100644
--- a/libs/ardour/ardour/audioanalyser.h
+++ b/libs/ardour/ardour/audioanalyser.h
@@ -55,8 +55,8 @@ class LIBARDOUR_API AudioAnalyser : public boost::noncopyable {
AnalysisPlugin* plugin;
AnalysisPluginKey plugin_key;
- framecnt_t bufsize;
- framecnt_t stepsize;
+ samplecnt_t bufsize;
+ samplecnt_t stepsize;
int initialize_plugin (AnalysisPluginKey name, float sample_rate);
int analyse (const std::string& path, Readable*, uint32_t channel);
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index f297e993b3..6e7cdf7496 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -88,14 +88,14 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
void transport_start ();
void transport_stop ();
TransportState transport_state ();
- void transport_locate (framepos_t pos);
- framepos_t transport_frame();
- framecnt_t sample_rate () const;
+ void transport_locate (samplepos_t pos);
+ samplepos_t transport_sample();
+ samplecnt_t sample_rate () const;
pframes_t samples_per_cycle () const;
int usecs_per_cycle () const;
size_t raw_buffer_size (DataType t);
- framepos_t sample_time ();
- framepos_t sample_time_at_cycle_start ();
+ samplepos_t sample_time ();
+ samplepos_t sample_time_at_cycle_start ();
pframes_t samples_since_cycle_start ();
bool get_sync_offset (pframes_t& offset) const;
@@ -138,7 +138,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
return set_buffer_size (samples);
}
- framecnt_t processed_frames() const { return _processed_frames; }
+ samplecnt_t processed_samples() const { return _processed_samples; }
void set_session (Session *);
void remove_session (); // not a replacement for SessionHandle::session_going_away()
@@ -166,7 +166,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
PBD::Signal0<void> Xrun;
/** this signal is emitted if the sample rate changes */
- PBD::Signal1<void, framecnt_t> SampleRateChanged;
+ PBD::Signal1<void, samplecnt_t> SampleRateChanged;
/** this signal is emitted if the buffer size changes */
PBD::Signal1<void, pframes_t> BufferSizeChanged;
@@ -205,8 +205,8 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
int buffer_size_change (pframes_t nframes);
int sample_rate_change (pframes_t nframes);
void freewheel_callback (bool);
- void timebase_callback (TransportState state, pframes_t nframes, framepos_t pos, int new_position);
- int sync_callback (TransportState state, framepos_t position);
+ void timebase_callback (TransportState state, pframes_t nframes, samplepos_t pos, int new_position);
+ int sync_callback (TransportState state, samplepos_t position);
int port_registration_callback ();
void latency_callback (bool for_playback);
void halted_callback (const char* reason);
@@ -258,17 +258,17 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
Glib::Threads::RecMutex _state_lock;
Glib::Threads::Cond session_removed;
bool session_remove_pending;
- frameoffset_t session_removal_countdown;
+ sampleoffset_t session_removal_countdown;
gain_t session_removal_gain;
gain_t session_removal_gain_step;
bool _running;
bool _freewheeling;
- /// number of frames between each check for changes in monitor input
- framecnt_t monitor_check_interval;
- /// time of the last monitor check in frames
- framecnt_t last_monitor_check;
- /// the number of frames processed since start() was called
- framecnt_t _processed_frames;
+ /// number of samples between each check for changes in monitor input
+ samplecnt_t monitor_check_interval;
+ /// time of the last monitor check in samples
+ samplecnt_t last_monitor_check;
+ /// the number of samples processed since start() was called
+ samplecnt_t _processed_samples;
Glib::Threads::Thread* m_meter_thread;
ProcessThread* _main_thread;
MTDM* _mtdm;
@@ -276,10 +276,10 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
LatencyMeasurement _measuring_latency;
PortEngine::PortHandle _latency_input_port;
PortEngine::PortHandle _latency_output_port;
- framecnt_t _latency_flush_frames;
+ samplecnt_t _latency_flush_samples;
std::string _latency_input_name;
std::string _latency_output_name;
- framecnt_t _latency_signal_latency;
+ samplecnt_t _latency_signal_latency;
bool _stopped_for_latency;
bool _started_for_latency;
bool _in_destructor;
@@ -308,7 +308,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
void drop_backend ();
#ifdef SILENCE_AFTER
- framecnt_t _silence_countdown;
+ samplecnt_t _silence_countdown;
uint32_t _silence_hit_cnt;
#endif
diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h
index 49b62116fc..6a3e2569ce 100644
--- a/libs/ardour/ardour/audiofilesource.h
+++ b/libs/ardour/ardour/audiofilesource.h
@@ -50,14 +50,14 @@ public:
/* this block of methods do nothing for regular file sources, but are significant
for files used in destructive recording.
*/
- virtual framepos_t last_capture_start_frame() const { return 0; }
- virtual void mark_capture_start (framepos_t) {}
+ virtual samplepos_t last_capture_start_sample() const { return 0; }
+ virtual void mark_capture_start (samplepos_t) {}
virtual void mark_capture_end () {}
virtual void clear_capture_marks() {}
virtual bool one_of_several_channels () const { return false; }
virtual void flush () = 0;
- virtual int update_header (framepos_t when, struct tm&, time_t) = 0;
+ virtual int update_header (samplepos_t when, struct tm&, time_t) = 0;
virtual int flush_header () = 0;
void mark_streaming_write_completed (const Lock& lock);
@@ -76,7 +76,7 @@ public:
static bool is_empty (Session&, std::string path);
static void set_bwf_serial_number (int);
- static void set_header_position_offset (framecnt_t offset);
+ static void set_header_position_offset (samplecnt_t offset);
static PBD::Signal0<void> HeaderPositionOffsetChanged;
@@ -104,14 +104,14 @@ protected:
int move_dependents_to_trash();
- static Sample* get_interleave_buffer (framecnt_t size);
+ static Sample* get_interleave_buffer (samplecnt_t size);
static char bwf_country_code[3];
static char bwf_organization_code[4];
static char bwf_serial_number[13];
/** Kept up to date with the position of the session location start */
- static framecnt_t header_position_offset;
+ static samplecnt_t header_position_offset;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h
index c4196dc3b6..e66ee0e780 100644
--- a/libs/ardour/ardour/audioplaylist.h
+++ b/libs/ardour/ardour/audioplaylist.h
@@ -39,9 +39,9 @@ public:
AudioPlaylist (Session&, const XMLNode&, bool hidden = false);
AudioPlaylist (Session&, std::string name, bool hidden = false);
AudioPlaylist (boost::shared_ptr<const AudioPlaylist>, std::string name, bool hidden = false);
- AudioPlaylist (boost::shared_ptr<const AudioPlaylist>, framepos_t start, framecnt_t cnt, std::string name, bool hidden = false);
+ AudioPlaylist (boost::shared_ptr<const AudioPlaylist>, samplepos_t start, samplecnt_t cnt, std::string name, bool hidden = false);
- framecnt_t read (Sample *dst, Sample *mixdown, float *gain_buffer, framepos_t start, framecnt_t cnt, uint32_t chan_n=0);
+ samplecnt_t read (Sample *dst, Sample *mixdown, float *gain_buffer, samplepos_t start, samplecnt_t cnt, uint32_t chan_n=0);
bool destroy_region (boost::shared_ptr<Region>);
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h
index 205998e4a8..1262dece4f 100644
--- a/libs/ardour/ardour/audioregion.h
+++ b/libs/ardour/ardour/audioregion.h
@@ -103,52 +103,52 @@ class LIBARDOUR_API AudioRegion : public Region
boost::shared_ptr<AutomationList> inverse_fade_out() { return _inverse_fade_out.val (); }
boost::shared_ptr<AutomationList> envelope() { return _envelope.val (); }
- Evoral::Range<framepos_t> body_range () const;
+ Evoral::Range<samplepos_t> body_range () const;
- virtual framecnt_t read_peaks (PeakData *buf, framecnt_t npeaks,
- framecnt_t offset, framecnt_t cnt,
- uint32_t chan_n=0, double frames_per_pixel = 1.0) const;
+ virtual samplecnt_t read_peaks (PeakData *buf, samplecnt_t npeaks,
+ samplecnt_t offset, samplecnt_t cnt,
+ uint32_t chan_n=0, double samples_per_pixel = 1.0) const;
/* Readable interface */
- virtual framecnt_t read (Sample*, framepos_t pos, framecnt_t cnt, int channel) const;
- virtual framecnt_t readable_length() const { return length(); }
+ virtual samplecnt_t read (Sample*, samplepos_t pos, samplecnt_t cnt, int channel) const;
+ virtual samplecnt_t readable_length() const { return length(); }
- virtual framecnt_t read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf,
- framepos_t position,
- framecnt_t cnt,
+ virtual samplecnt_t read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf,
+ samplepos_t position,
+ samplecnt_t cnt,
uint32_t chan_n = 0) const;
- virtual framecnt_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf,
- framepos_t position, framecnt_t cnt, uint32_t chan_n=0) const;
+ virtual samplecnt_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf,
+ samplepos_t position, samplecnt_t cnt, uint32_t chan_n=0) const;
- virtual framecnt_t read_raw_internal (Sample*, framepos_t, framecnt_t, int channel) const;
+ virtual samplecnt_t read_raw_internal (Sample*, samplepos_t, samplecnt_t, int channel) const;
XMLNode& state ();
XMLNode& get_basic_state ();
int set_state (const XMLNode&, int version);
- void fade_range (framepos_t, framepos_t);
+ void fade_range (samplepos_t, samplepos_t);
bool fade_in_is_default () const;
bool fade_out_is_default () const;
void set_fade_in_active (bool yn);
void set_fade_in_shape (FadeShape);
- void set_fade_in_length (framecnt_t);
- void set_fade_in (FadeShape, framecnt_t);
+ void set_fade_in_length (samplecnt_t);
+ void set_fade_in (FadeShape, samplecnt_t);
void set_fade_in (boost::shared_ptr<AutomationList>);
void set_fade_out_active (bool yn);
void set_fade_out_shape (FadeShape);
- void set_fade_out_length (framecnt_t);
- void set_fade_out (FadeShape, framecnt_t);
+ void set_fade_out_length (samplecnt_t);
+ void set_fade_out (FadeShape, samplecnt_t);
void set_fade_out (boost::shared_ptr<AutomationList>);
void set_default_fade_in ();
void set_default_fade_out ();
- framecnt_t verify_xfade_bounds (framecnt_t, bool start);
+ samplecnt_t verify_xfade_bounds (samplecnt_t, bool start);
void set_envelope_active (bool yn);
void set_default_envelope ();
@@ -174,14 +174,14 @@ class LIBARDOUR_API AudioRegion : public Region
void resume_fade_in ();
void resume_fade_out ();
- void add_transient (framepos_t where);
- void remove_transient (framepos_t where);
+ void add_transient (samplepos_t where);
+ void remove_transient (samplepos_t where);
void clear_transients ();
void set_onsets (AnalysisFeatureList&);
void get_transients (AnalysisFeatureList&);
- void update_transient (framepos_t old_position, framepos_t new_position);
+ void update_transient (samplepos_t old_position, samplepos_t new_position);
- AudioIntervalResult find_silence (Sample, framecnt_t, framecnt_t, InterThreadInfo&) const;
+ AudioIntervalResult find_silence (Sample, samplecnt_t, samplecnt_t, InterThreadInfo&) const;
private:
friend class RegionFactory;
@@ -189,7 +189,7 @@ class LIBARDOUR_API AudioRegion : public Region
AudioRegion (boost::shared_ptr<AudioSource>);
AudioRegion (const SourceList &);
AudioRegion (boost::shared_ptr<const AudioRegion>);
- AudioRegion (boost::shared_ptr<const AudioRegion>, ARDOUR::MusicFrame offset);
+ AudioRegion (boost::shared_ptr<const AudioRegion>, ARDOUR::MusicSample offset);
AudioRegion (boost::shared_ptr<const AudioRegion>, const SourceList&);
AudioRegion (SourceList &);
@@ -216,7 +216,7 @@ class LIBARDOUR_API AudioRegion : public Region
void recompute_gain_at_end ();
void recompute_gain_at_start ();
- framecnt_t read_from_sources (SourceList const &, framecnt_t, Sample *, framepos_t, framecnt_t, uint32_t) const;
+ samplecnt_t read_from_sources (SourceList const &, samplecnt_t, Sample *, samplepos_t, samplecnt_t, uint32_t) const;
void recompute_at_start ();
void recompute_at_end ();
@@ -244,7 +244,7 @@ class LIBARDOUR_API AudioRegion : public Region
protected:
/* default constructor for derived (compound) types */
- AudioRegion (Session& s, framepos_t, framecnt_t, std::string name);
+ AudioRegion (Session& s, samplepos_t, samplecnt_t, std::string name);
int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal);
};
diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h
index 59d5add122..6df4146259 100644
--- a/libs/ardour/ardour/audiosource.h
+++ b/libs/ardour/ardour/audiosource.h
@@ -47,17 +47,17 @@ class LIBARDOUR_API AudioSource : virtual public Source,
AudioSource (Session&, const XMLNode&);
virtual ~AudioSource ();
- framecnt_t readable_length() const { return _length; }
+ samplecnt_t readable_length() const { return _length; }
virtual uint32_t n_channels() const { return 1; }
virtual bool empty() const;
- framecnt_t length (framepos_t pos) const;
- void update_length (framecnt_t cnt);
+ samplecnt_t length (samplepos_t pos) const;
+ void update_length (samplecnt_t cnt);
- virtual framecnt_t available_peaks (double zoom) const;
+ virtual samplecnt_t available_peaks (double zoom) const;
- virtual framecnt_t read (Sample *dst, framepos_t start, framecnt_t cnt, int channel=0) const;
- virtual framecnt_t write (Sample *src, framecnt_t cnt);
+ virtual samplecnt_t read (Sample *dst, samplepos_t start, samplecnt_t cnt, int channel=0) const;
+ virtual samplecnt_t write (Sample *src, samplecnt_t cnt);
virtual float sample_rate () const = 0;
@@ -68,14 +68,14 @@ class LIBARDOUR_API AudioSource : virtual public Source,
void set_captured_for (std::string str) { _captured_for = str; }
std::string captured_for() const { return _captured_for; }
- int read_peaks (PeakData *peaks, framecnt_t npeaks,
- framepos_t start, framecnt_t cnt, double samples_per_visual_peak) const;
+ int read_peaks (PeakData *peaks, samplecnt_t npeaks,
+ samplepos_t start, samplecnt_t cnt, double samples_per_visual_peak) const;
int build_peaks ();
bool peaks_ready (boost::function<void()> callWhenReady, PBD::ScopedConnection** connection_created_if_not_ready, PBD::EventLoop* event_loop) const;
mutable PBD::Signal0<void> PeaksReady;
- mutable PBD::Signal2<void,framepos_t,framepos_t> PeakRangeReady;
+ mutable PBD::Signal2<void,samplepos_t,samplepos_t> PeakRangeReady;
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
@@ -104,7 +104,7 @@ class LIBARDOUR_API AudioSource : virtual public Source,
/** @return true if the each source sample s must be clamped to -1 < s < 1 */
virtual bool clamped_at_unity () const = 0;
- static void allocate_working_buffers (framecnt_t framerate);
+ static void allocate_working_buffers (samplecnt_t framerate);
protected:
static bool _build_missing_peakfiles;
@@ -120,32 +120,32 @@ class LIBARDOUR_API AudioSource : virtual public Source,
static std::vector<boost::shared_array<gain_t> > _gain_buffers;
static Glib::Threads::Mutex _level_buffer_lock;
- static void ensure_buffers_for_level (uint32_t, framecnt_t);
- static void ensure_buffers_for_level_locked (uint32_t, framecnt_t);
+ static void ensure_buffers_for_level (uint32_t, samplecnt_t);
+ static void ensure_buffers_for_level_locked (uint32_t, samplecnt_t);
- framecnt_t _length;
+ samplecnt_t _length;
std::string _peakpath;
std::string _captured_for;
int initialize_peakfile (const std::string& path, const bool in_session = false);
int build_peaks_from_scratch ();
- int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
+ int compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt,
bool force, bool intermediate_peaks_ready_signal);
void truncate_peakfile();
mutable off_t _peak_byte_max; // modified in compute_and_write_peak()
- virtual framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const = 0;
- virtual framecnt_t write_unlocked (Sample *dst, framecnt_t cnt) = 0;
+ virtual samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const = 0;
+ virtual samplecnt_t write_unlocked (Sample *dst, samplecnt_t cnt) = 0;
virtual std::string construct_peak_filepath (const std::string& audio_path, const bool in_session = false, const bool old_peak_name = false) const = 0;
virtual int read_peaks_with_fpp (PeakData *peaks,
- framecnt_t npeaks, framepos_t start, framecnt_t cnt,
- double samples_per_visual_peak, framecnt_t fpp) const;
+ samplecnt_t npeaks, samplepos_t start, samplecnt_t cnt,
+ double samples_per_visual_peak, samplecnt_t fpp) const;
- int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
+ int compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt,
bool force, bool intermediate_peaks_ready_signal,
- framecnt_t frames_per_peak);
+ samplecnt_t samples_per_peak);
private:
bool _peaks_built;
@@ -159,10 +159,10 @@ class LIBARDOUR_API AudioSource : virtual public Source,
Glib::Threads::Mutex _initialize_peaks_lock;
int _peakfile_fd;
- framecnt_t peak_leftover_cnt;
- framecnt_t peak_leftover_size;
+ samplecnt_t peak_leftover_cnt;
+ samplecnt_t peak_leftover_size;
Sample* peak_leftovers;
- framepos_t peak_leftover_frame;
+ samplepos_t peak_leftover_sample;
mutable bool _first_run;
mutable double _last_scale;
diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h
index ffc0ddb331..61d4f2c1cf 100644
--- a/libs/ardour/ardour/auditioner.h
+++ b/libs/ardour/ardour/auditioner.h
@@ -47,10 +47,10 @@ class LIBARDOUR_API Auditioner : public Track
void audition_region (boost::shared_ptr<Region>);
- void seek_to_frame (frameoffset_t pos) { if (_seek_frame < 0 && !_seeking) { _seek_frame = pos; }}
- void seek_to_percent (float const pos) { if (_seek_frame < 0 && !_seeking) { _seek_frame = floorf(length * pos / 100.0); }}
+ void seek_to_sample (sampleoffset_t pos) { if (_seek_sample < 0 && !_seeking) { _seek_sample = pos; }}
+ void seek_to_percent (float const pos) { if (_seek_sample < 0 && !_seeking) { _seek_sample = floorf(length * pos / 100.0); }}
- int play_audition (framecnt_t nframes);
+ int play_audition (samplecnt_t nframes);
MonitorState monitoring_state () const;
@@ -63,20 +63,20 @@ class LIBARDOUR_API Auditioner : public Track
virtual ChanCount input_streams () const;
- frameoffset_t seek_frame() const { return _seeking ? _seek_frame : -1;}
- void seek_response(frameoffset_t pos) {
+ sampleoffset_t seek_sample() const { return _seeking ? _seek_sample : -1;}
+ void seek_response(sampleoffset_t pos) {
_seek_complete = true;
- if (_seeking) { current_frame = pos; _seek_complete = true;}
+ if (_seeking) { current_sample = pos; _seek_complete = true;}
}
- PBD::Signal2<void, ARDOUR::framecnt_t, ARDOUR::framecnt_t> AuditionProgress;
+ PBD::Signal2<void, ARDOUR::samplecnt_t, ARDOUR::samplecnt_t> AuditionProgress;
/* Track */
- int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler);
+ int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler);
DataType data_type () const;
- int roll_audio (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler);
- int roll_midi (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler);
+ int roll_audio (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler);
+ int roll_midi (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler);
/* fake track */
void set_state_part_two () {}
@@ -88,20 +88,20 @@ class LIBARDOUR_API Auditioner : public Track
boost::shared_ptr<Region> bounce (InterThreadInfo&)
{ return boost::shared_ptr<Region> (); }
- boost::shared_ptr<Region> bounce_range (framepos_t, framepos_t, InterThreadInfo&, boost::shared_ptr<Processor>, bool)
+ boost::shared_ptr<Region> bounce_range (samplepos_t, samplepos_t, InterThreadInfo&, boost::shared_ptr<Processor>, bool)
{ return boost::shared_ptr<Region> (); }
- int export_stuff (BufferSet&, framepos_t, framecnt_t, boost::shared_ptr<Processor>, bool, bool, bool)
+ int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool)
{ return -1; }
private:
boost::shared_ptr<AudioRegion> the_region;
boost::shared_ptr<MidiRegion> midi_region;
- framepos_t current_frame;
+ samplepos_t current_sample;
mutable gint _auditioning;
Glib::Threads::Mutex lock;
- framecnt_t length;
- frameoffset_t _seek_frame;
+ samplecnt_t length;
+ sampleoffset_t _seek_sample;
bool _seeking;
bool _seek_complete;
bool via_monitor;
@@ -118,7 +118,7 @@ class LIBARDOUR_API Auditioner : public Track
static void *_drop_ports (void *);
void actually_drop_ports ();
void output_changed (IOChange, void*);
- frameoffset_t _import_position;
+ sampleoffset_t _import_position;
};
}; /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h
index ead74d311d..84164568c5 100644
--- a/libs/ardour/ardour/automatable.h
+++ b/libs/ardour/ardour/automatable.h
@@ -83,10 +83,10 @@ public:
virtual bool find_next_event (double start, double end, Evoral::ControlEvent& ev, bool only_active = true) const;
void clear_controls ();
- virtual void non_realtime_locate (framepos_t now);
- virtual void non_realtime_transport_stop (framepos_t now, bool flush);
+ virtual void non_realtime_locate (samplepos_t now);
+ virtual void non_realtime_transport_stop (samplepos_t now, bool flush);
- virtual void automation_run (framepos_t, pframes_t);
+ virtual void automation_run (samplepos_t, pframes_t);
virtual std::string describe_parameter(Evoral::Parameter param);
@@ -117,7 +117,7 @@ protected:
std::set<Evoral::Parameter> _can_automate_list;
- framepos_t _last_automation_snapshot;
+ samplepos_t _last_automation_snapshot;
SlavableControlList slavables () const { return SlavableControlList(); }
diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h
index e875ea98a6..8de0ec6ec0 100644
--- a/libs/ardour/ardour/automation_control.h
+++ b/libs/ardour/ardour/automation_control.h
@@ -106,7 +106,7 @@ public:
actually_set_value (val, PBD::Controllable::NoGroup);
}
- virtual void automation_run (framepos_t start, pframes_t nframes);
+ virtual void automation_run (samplepos_t start, pframes_t nframes);
double lower() const { return _desc.lower; }
double upper() const { return _desc.upper; }
diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h
index 4601740af1..d6de3decda 100644
--- a/libs/ardour/ardour/automation_list.h
+++ b/libs/ardour/ardour/automation_list.h
@@ -40,7 +40,7 @@
namespace ARDOUR {
class AutomationList;
-class DoubleBeatsFramesConverter;
+class DoubleBeatsSamplesConverter;
/** A SharedStatefulProperty for AutomationLists */
class LIBARDOUR_API AutomationListProperty : public PBD::SharedStatefulProperty<AutomationList>
@@ -82,7 +82,7 @@ public:
AutomationList& operator= (const AutomationList&);
void thaw ();
- bool paste (const ControlList&, double, DoubleBeatsFramesConverter const&);
+ bool paste (const ControlList&, double, DoubleBeatsSamplesConverter const&);
void set_automation_state (AutoState);
AutoState automation_state() const;
diff --git a/libs/ardour/ardour/automation_watch.h b/libs/ardour/ardour/automation_watch.h
index bd8263fc26..5c13184bc7 100644
--- a/libs/ardour/ardour/automation_watch.h
+++ b/libs/ardour/ardour/automation_watch.h
@@ -40,7 +40,7 @@ public:
void add_automation_watch (boost::shared_ptr<ARDOUR::AutomationControl>);
void remove_automation_watch (boost::shared_ptr<ARDOUR::AutomationControl>);
- void transport_stop_automation_watches (ARDOUR::framepos_t);
+ void transport_stop_automation_watches (ARDOUR::samplepos_t);
void set_session (ARDOUR::Session*);
gint timer ();
@@ -54,7 +54,7 @@ private:
static AutomationWatch* _instance;
Glib::Threads::Thread* _thread;
- framepos_t _last_time;
+ samplepos_t _last_time;
bool _run_thread;
AutomationWatches automation_watches;
AutomationConnection automation_connections;
diff --git a/libs/ardour/ardour/beats_frames_converter.h b/libs/ardour/ardour/beats_samples_converter.h
index 19275927a8..f9ca27f209 100644
--- a/libs/ardour/ardour/beats_frames_converter.h
+++ b/libs/ardour/ardour/beats_samples_converter.h
@@ -25,46 +25,46 @@
#include "ardour/libardour_visibility.h"
#include "ardour/types.h"
-#ifndef __ardour_beats_frames_converter_h__
-#define __ardour_beats_frames_converter_h__
+#ifndef __ardour_beats_samples_converter_h__
+#define __ardour_beats_samples_converter_h__
namespace ARDOUR {
class TempoMap;
-/** Converter between quarter-note beats and frames. Takes distances in quarter-note beats or frames
- * from some origin (supplied to the constructor in frames), and converts
+/** Converter between quarter-note beats and samples. Takes distances in quarter-note beats or samples
+ * from some origin (supplied to the constructor in samples), and converts
* them to the opposite unit, taking tempo changes into account.
*/
-class LIBARDOUR_API BeatsFramesConverter
- : public Evoral::TimeConverter<Evoral::Beats,framepos_t> {
+class LIBARDOUR_API BeatsSamplesConverter
+ : public Evoral::TimeConverter<Evoral::Beats,samplepos_t> {
public:
- BeatsFramesConverter (const TempoMap& tempo_map, framepos_t origin)
- : Evoral::TimeConverter<Evoral::Beats, framepos_t> (origin)
+ BeatsSamplesConverter (const TempoMap& tempo_map, samplepos_t origin)
+ : Evoral::TimeConverter<Evoral::Beats, samplepos_t> (origin)
, _tempo_map(tempo_map)
{}
- framepos_t to (Evoral::Beats beats) const;
- Evoral::Beats from (framepos_t frames) const;
+ samplepos_t to (Evoral::Beats beats) const;
+ Evoral::Beats from (samplepos_t samples) const;
private:
const TempoMap& _tempo_map;
};
-/** Converter between quarter-note beats and frames. Takes distances in quarter-note beats or frames
- * from some origin (supplied to the constructor in frames), and converts
+/** Converter between quarter-note beats and samples. Takes distances in quarter-note beats or samples
+ * from some origin (supplied to the constructor in samples), and converts
* them to the opposite unit, taking tempo changes into account.
*/
-class LIBARDOUR_API DoubleBeatsFramesConverter
- : public Evoral::TimeConverter<double,framepos_t> {
+class LIBARDOUR_API DoubleBeatsSamplesConverter
+ : public Evoral::TimeConverter<double,samplepos_t> {
public:
- DoubleBeatsFramesConverter (const TempoMap& tempo_map, framepos_t origin)
- : Evoral::TimeConverter<double, framepos_t> (origin)
+ DoubleBeatsSamplesConverter (const TempoMap& tempo_map, samplepos_t origin)
+ : Evoral::TimeConverter<double, samplepos_t> (origin)
, _tempo_map(tempo_map)
{}
- framepos_t to (double beats) const;
- double from (framepos_t frames) const;
+ samplepos_t to (double beats) const;
+ double from (samplepos_t samples) const;
private:
const TempoMap& _tempo_map;
@@ -72,4 +72,4 @@ private:
} /* namespace ARDOUR */
-#endif /* __ardour_beats_frames_converter_h__ */
+#endif /* __ardour_beats_samples_converter_h__ */
diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h
index 7d6fa75620..349dfbd4b2 100644
--- a/libs/ardour/ardour/buffer.h
+++ b/libs/ardour/ardour/buffer.h
@@ -64,13 +64,13 @@ public:
virtual void resize (size_t) = 0;
/** Clear (eg zero, or empty) buffer */
- virtual void silence (framecnt_t len, framecnt_t offset = 0) = 0;
+ virtual void silence (samplecnt_t len, samplecnt_t offset = 0) = 0;
/** Clear the entire buffer */
virtual void clear() { silence(_capacity, 0); }
- virtual void read_from (const Buffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) = 0;
- virtual void merge_from (const Buffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) = 0;
+ virtual void read_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) = 0;
+ virtual void merge_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) = 0;
protected:
Buffer(DataType type)
diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h
index a4fa53e2fc..bd0c23d9e7 100644
--- a/libs/ardour/ardour/buffer_set.h
+++ b/libs/ardour/ardour/buffer_set.h
@@ -71,10 +71,10 @@ public:
void clear();
void attach_buffers (PortSet& ports);
- void get_backend_port_addresses (PortSet &, framecnt_t);
+ void get_backend_port_addresses (PortSet &, samplecnt_t);
/* the capacity here is a size_t and has a different interpretation depending
- on the DataType of the buffers. for audio, its a frame count. for MIDI
+ on the DataType of the buffers. for audio, its a sample count. for MIDI
its a byte count.
*/
@@ -87,7 +87,7 @@ public:
const ChanCount& count() const { return _count; }
ChanCount& count() { return _count; }
- void silence (framecnt_t nframes, framecnt_t offset);
+ void silence (samplecnt_t nframes, samplecnt_t offset);
bool is_mirror() const { return _is_mirror; }
void set_count(const ChanCount& count) { assert(count <= _available); _count = count; }
@@ -134,9 +134,9 @@ public:
VstEvents* get_vst_midi (size_t);
#endif
- void read_from(const BufferSet& in, framecnt_t nframes);
- void read_from(const BufferSet& in, framecnt_t nframes, DataType);
- void merge_from(const BufferSet& in, framecnt_t nframes);
+ void read_from(const BufferSet& in, samplecnt_t nframes);
+ void read_from(const BufferSet& in, samplecnt_t nframes, DataType);
+ void merge_from(const BufferSet& in, samplecnt_t nframes);
template <typename BS, typename B>
class iterator_base {
@@ -196,7 +196,7 @@ private:
~VSTBuffer ();
void clear ();
- void push_back (Evoral::Event<framepos_t> const &);
+ void push_back (Evoral::Event<samplepos_t> const &);
VstEvents* events () const {
return _events;
}
diff --git a/libs/ardour/ardour/butler.h b/libs/ardour/ardour/butler.h
index 3c254648ff..75a238af4f 100644
--- a/libs/ardour/ardour/butler.h
+++ b/libs/ardour/ardour/butler.h
@@ -59,8 +59,8 @@ class LIBARDOUR_API Butler : public SessionHandleRef
void map_parameters ();
- framecnt_t audio_diskstream_capture_buffer_size() const { return audio_dstream_capture_buffer_size; }
- framecnt_t audio_diskstream_playback_buffer_size() const { return audio_dstream_playback_buffer_size; }
+ samplecnt_t audio_diskstream_capture_buffer_size() const { return audio_dstream_capture_buffer_size; }
+ samplecnt_t audio_diskstream_playback_buffer_size() const { return audio_dstream_playback_buffer_size; }
uint32_t midi_diskstream_buffer_size() const { return midi_dstream_buffer_size; }
bool flush_tracks_to_disk_after_locate (boost::shared_ptr<RouteList>, uint32_t& errors);
@@ -82,8 +82,8 @@ class LIBARDOUR_API Butler : public SessionHandleRef
Glib::Threads::Cond paused;
bool should_run;
mutable gint should_do_transport_work;
- framecnt_t audio_dstream_capture_buffer_size;
- framecnt_t audio_dstream_playback_buffer_size;
+ samplecnt_t audio_dstream_capture_buffer_size;
+ samplecnt_t audio_dstream_playback_buffer_size;
uint32_t midi_dstream_buffer_size;
PBD::RingBuffer<CrossThreadPool*> pool_trash;
diff --git a/libs/ardour/ardour/caimportable.h b/libs/ardour/ardour/caimportable.h
index 441008f521..23fc1782ed 100644
--- a/libs/ardour/ardour/caimportable.h
+++ b/libs/ardour/ardour/caimportable.h
@@ -38,12 +38,12 @@ class LIBARDOUR_API CAImportableSource : public ImportableSource {
CAImportableSource (const std::string& path);
virtual ~CAImportableSource();
- framecnt_t read (Sample* buffer, framecnt_t nframes);
+ samplecnt_t read (Sample* buffer, samplecnt_t nframes);
uint32_t channels() const;
- framecnt_t length() const;
- framecnt_t samplerate() const;
- void seek (framepos_t pos);
- framepos_t natural_position() const { return 0; }
+ samplecnt_t length() const;
+ samplecnt_t samplerate() const;
+ void seek (samplepos_t pos);
+ samplepos_t natural_position() const { return 0; }
bool clamped_at_unity () const { return false; }
protected:
diff --git a/libs/ardour/ardour/capturing_processor.h b/libs/ardour/ardour/capturing_processor.h
index dccb7eb99e..fe548d7bbc 100644
--- a/libs/ardour/ardour/capturing_processor.h
+++ b/libs/ardour/ardour/capturing_processor.h
@@ -29,7 +29,7 @@ namespace ARDOUR {
class LIBARDOUR_API CapturingProcessor : public Processor
{
public:
- CapturingProcessor (Session & session, framecnt_t latency);
+ CapturingProcessor (Session & session, samplecnt_t latency);
~CapturingProcessor();
public: // main interface
@@ -38,7 +38,7 @@ class LIBARDOUR_API CapturingProcessor : public Processor
public: // Processor overrides
bool display_to_user() const { return false; }
int set_block_size (pframes_t nframes);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool result_required);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool result_required);
bool configure_io (ChanCount in, ChanCount out);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
virtual XMLNode& state (bool);
@@ -47,10 +47,10 @@ class LIBARDOUR_API CapturingProcessor : public Processor
void realloc_buffers();
- framecnt_t block_size;
+ samplecnt_t block_size;
BufferSet capture_buffers;
FixedDelay _delaybuffers;
- framecnt_t _latency;
+ samplecnt_t _latency;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/click.h b/libs/ardour/ardour/click.h
index 7fc6d21f73..498a18219d 100644
--- a/libs/ardour/ardour/click.h
+++ b/libs/ardour/ardour/click.h
@@ -31,12 +31,12 @@ namespace ARDOUR {
class LIBARDOUR_API Click {
public:
- framepos_t start;
- framecnt_t duration;
- framecnt_t offset;
+ samplepos_t start;
+ samplecnt_t duration;
+ samplecnt_t offset;
const Sample *data;
- Click (framepos_t s, framecnt_t d, const Sample *b) : start (s), duration (d), offset (0), data (b) {}
+ Click (samplepos_t s, samplecnt_t d, const Sample *b) : start (s), duration (d), offset (0), data (b) {}
void *operator new (size_t) {
return pool.alloc ();
diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h
index bb00776839..f61c6bb984 100644
--- a/libs/ardour/ardour/coreaudiosource.h
+++ b/libs/ardour/ardour/coreaudiosource.h
@@ -41,7 +41,7 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource {
void set_path (const std::string& p);
float sample_rate() const;
- int update_header (framepos_t when, struct tm&, time_t);
+ int update_header (samplepos_t when, struct tm&, time_t);
uint32_t channel_count () const { return n_channels; }
@@ -55,8 +55,8 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource {
protected:
void close ();
- framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const;
- framecnt_t write_unlocked (Sample *, framecnt_t) { return 0; }
+ samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
+ samplecnt_t write_unlocked (Sample *, samplecnt_t) { return 0; }
private:
#ifdef COREAUDIO105
@@ -67,7 +67,7 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource {
uint16_t n_channels;
void init_cafile ();
- int safe_read (Sample*, framepos_t start, framecnt_t cnt, AudioBufferList&) const;
+ int safe_read (Sample*, samplepos_t start, samplecnt_t cnt, AudioBufferList&) const;
};
}; /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/delayline.h b/libs/ardour/ardour/delayline.h
index af025130d2..b760bd94f1 100644
--- a/libs/ardour/ardour/delayline.h
+++ b/libs/ardour/ardour/delayline.h
@@ -42,9 +42,9 @@ public:
bool display_to_user() const { return false; }
- void run (BufferSet&, framepos_t, framepos_t, double, pframes_t, bool);
- void set_delay(framecnt_t signal_delay);
- framecnt_t get_delay() { return _pending_delay; }
+ void run (BufferSet&, samplepos_t, samplepos_t, double, pframes_t, bool);
+ void set_delay(samplecnt_t signal_delay);
+ samplecnt_t get_delay() { return _pending_delay; }
bool configure_io (ChanCount in, ChanCount out);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
@@ -57,12 +57,12 @@ public:
XMLNode& state (bool full);
private:
- void allocate_pending_buffers (framecnt_t);
+ void allocate_pending_buffers (samplecnt_t);
friend class IO;
- framecnt_t _delay, _pending_delay;
- framecnt_t _bsiz, _pending_bsiz;
- frameoffset_t _roff, _woff;
+ samplecnt_t _delay, _pending_delay;
+ samplecnt_t _bsiz, _pending_bsiz;
+ sampleoffset_t _roff, _woff;
boost::shared_array<Sample> _buf;
boost::shared_array<Sample> _pending_buf;
boost::shared_ptr<MidiBuffer> _midi_buf;
diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h
index 7084008949..ce5b050982 100644
--- a/libs/ardour/ardour/delivery.h
+++ b/libs/ardour/ardour/delivery.h
@@ -71,13 +71,13 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
/* supplemental method used with MIDI */
- void flush_buffers (framecnt_t nframes);
+ void flush_buffers (samplecnt_t nframes);
void no_outs_cuz_we_no_monitor(bool);
- void non_realtime_transport_stop (framepos_t now, bool flush);
+ void non_realtime_transport_stop (samplepos_t now, bool flush);
void realtime_locate ();
BufferSet& output_buffers() { return *_output_buffers; }
diff --git a/libs/ardour/ardour/disk_io.h b/libs/ardour/ardour/disk_io.h
index 7f9232b426..c839191331 100644
--- a/libs/ardour/ardour/disk_io.h
+++ b/libs/ardour/ardour/disk_io.h
@@ -79,7 +79,7 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
bool recordable() const { return _flags & Recordable; }
bool non_layered() const { return _flags & NonLayered; }
- virtual void non_realtime_locate (framepos_t);
+ virtual void non_realtime_locate (samplepos_t);
void non_realtime_speed_change ();
bool realtime_speed_change ();
@@ -116,7 +116,7 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
protected:
friend class Auditioner;
- virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0;
+ virtual int seek (samplepos_t which_sample, bool complete_refill = false) = 0;
protected:
Flag _flags;
@@ -129,9 +129,9 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
bool _slaved;
Location* loop_location;
bool in_set_state;
- framepos_t playback_sample;
- framecnt_t wrap_buffer_size;
- framecnt_t speed_buffer_size;
+ samplepos_t playback_sample;
+ samplecnt_t wrap_buffer_size;
+ samplecnt_t speed_buffer_size;
bool _need_butler;
boost::shared_ptr<Route> _route;
@@ -140,10 +140,10 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
Glib::Threads::Mutex state_lock;
static bool get_buffering_presets (BufferingPreset bp,
- framecnt_t& read_chunk_size,
- framecnt_t& read_buffer_size,
- framecnt_t& write_chunk_size,
- framecnt_t& write_buffer_size);
+ samplecnt_t& read_chunk_size,
+ samplecnt_t& read_buffer_size,
+ samplecnt_t& write_chunk_size,
+ samplecnt_t& write_buffer_size);
enum TransitionType {
CaptureStart = 0,
@@ -152,7 +152,7 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
struct CaptureTransition {
TransitionType type;
- framepos_t capture_val; ///< The start or end file frame position
+ samplepos_t capture_val; ///< The start or end file sample position
};
/** Information about one audio channel, playback or capture
@@ -160,7 +160,7 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
*/
struct ChannelInfo : public boost::noncopyable {
- ChannelInfo (framecnt_t buffer_size);
+ ChannelInfo (samplecnt_t buffer_size);
~ChannelInfo ();
/** A ringbuffer for data to be played back, written to in the
@@ -178,9 +178,9 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
boost::shared_ptr<AudioFileSource> write_source;
PBD::RingBufferNPT<CaptureTransition> * capture_transition_buf;
// the following are used in the butler thread only
- framecnt_t curr_capture_cnt;
+ samplecnt_t curr_capture_cnt;
- void resize (framecnt_t);
+ void resize (samplecnt_t);
};
typedef std::vector<ChannelInfo*> ChannelList;
@@ -196,16 +196,16 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
virtual void playlist_changed (const PBD::PropertyChange&) {}
virtual void playlist_deleted (boost::weak_ptr<Playlist>);
- virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool) {}
+ virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool) {}
/* The MIDI stuff */
- MidiRingBuffer<framepos_t>* _midi_buf;
- gint _frames_written_to_ringbuffer;
- gint _frames_read_from_ringbuffer;
+ MidiRingBuffer<samplepos_t>* _midi_buf;
+ gint _samples_written_to_ringbuffer;
+ gint _samples_read_from_ringbuffer;
CubicMidiInterpolation midi_interpolation;
- static void get_location_times (const Location* location, framepos_t* start, framepos_t* end, framepos_t* length);
+ static void get_location_times (const Location* location, samplepos_t* start, samplepos_t* end, samplepos_t* length);
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/disk_reader.h b/libs/ardour/ardour/disk_reader.h
index 023f55be87..8e124a27dd 100644
--- a/libs/ardour/ardour/disk_reader.h
+++ b/libs/ardour/ardour/disk_reader.h
@@ -42,18 +42,18 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
bool set_name (std::string const & str);
std::string display_name() const { return std::string (_("player")); }
- static framecnt_t chunk_frames() { return _chunk_frames; }
- static framecnt_t default_chunk_frames ();
- static void set_chunk_frames (framecnt_t n) { _chunk_frames = n; }
+ static samplecnt_t chunk_samples() { return _chunk_samples; }
+ static samplecnt_t default_chunk_samples ();
+ static void set_chunk_samples (samplecnt_t n) { _chunk_samples = n; }
- void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double speed, pframes_t /*nframes*/, bool /*result_required*/);
+ void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/);
void realtime_handle_transport_stopped ();
void realtime_locate ();
int overwrite_existing_buffers ();
void set_pending_overwrite (bool yn);
- framecnt_t roll_delay() const { return _roll_delay; }
- void set_roll_delay (framecnt_t);
+ samplecnt_t roll_delay() const { return _roll_delay; }
+ void set_roll_delay (samplecnt_t);
virtual XMLNode& state (bool full);
int set_state (const XMLNode&, int version);
@@ -62,7 +62,7 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
float buffer_load() const;
- void move_processor_automation (boost::weak_ptr<Processor>, std::list<Evoral::RangeMove<framepos_t> > const &);
+ void move_processor_automation (boost::weak_ptr<Processor>, std::list<Evoral::RangeMove<samplepos_t> > const &);
/* called by the Butler in a non-realtime context */
@@ -88,16 +88,16 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
void adjust_buffering ();
- int can_internal_playback_seek (framecnt_t distance);
- int internal_playback_seek (framecnt_t distance);
- int seek (framepos_t frame, bool complete_refill = false);
+ int can_internal_playback_seek (samplecnt_t distance);
+ int internal_playback_seek (samplecnt_t distance);
+ int seek (samplepos_t sample, bool complete_refill = false);
static PBD::Signal0<void> Underrun;
void playlist_modified ();
void reset_tracker ();
- static void set_midi_readahead_frames (framecnt_t frames_ahead) { midi_readahead = frames_ahead; }
+ static void set_midi_readahead_samples (samplecnt_t samples_ahead) { midi_readahead = samples_ahead; }
static void set_no_disk_output (bool yn);
static bool no_disk_output() { return _no_disk_output; }
@@ -106,29 +106,29 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
friend class Track;
friend class MidiTrack;
- void resolve_tracker (Evoral::EventSink<framepos_t>& buffer, framepos_t time);
+ void resolve_tracker (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time);
boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const;
void playlist_changed (const PBD::PropertyChange&);
int use_playlist (DataType, boost::shared_ptr<Playlist>);
- void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool);
+ void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool);
private:
- /** The number of frames by which this diskstream's output should be delayed
- with respect to the transport frame. This is used for latency compensation.
+ /** The number of samples by which this diskstream's output should be delayed
+ with respect to the transport sample. This is used for latency compensation.
*/
- framecnt_t _roll_delay;
- framepos_t overwrite_frame;
+ samplecnt_t _roll_delay;
+ samplepos_t overwrite_sample;
off_t overwrite_offset;
bool _pending_overwrite;
bool overwrite_queued;
IOChange input_change_pending;
- framepos_t file_frame[DataType::num_types];
+ samplepos_t file_sample[DataType::num_types];
int _do_refill_with_alloc (bool partial_fill);
- static framecnt_t _chunk_frames;
- static framecnt_t midi_readahead;
+ static samplecnt_t _chunk_samples;
+ static samplecnt_t midi_readahead;
static bool _no_disk_output;
/* The MIDI stuff */
@@ -140,20 +140,20 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
mutable Glib::Threads::Mutex _gui_feed_buffer_mutex;
int audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
- framepos_t& start, framecnt_t cnt,
+ samplepos_t& start, samplecnt_t cnt,
int channel, bool reversed);
- int midi_read (framepos_t& start, framecnt_t cnt, bool reversed);
+ int midi_read (samplepos_t& start, samplecnt_t cnt, bool reversed);
static Sample* _mixdown_buffer;
static gain_t* _gain_buffer;
- int refill (Sample* mixdown_buffer, float* gain_buffer, framecnt_t fill_level);
- int refill_audio (Sample *mixdown_buffer, float *gain_buffer, framecnt_t fill_level);
+ int refill (Sample* mixdown_buffer, float* gain_buffer, samplecnt_t fill_level);
+ int refill_audio (Sample *mixdown_buffer, float *gain_buffer, samplecnt_t fill_level);
int refill_midi ();
- frameoffset_t calculate_playback_distance (pframes_t);
+ sampleoffset_t calculate_playback_distance (pframes_t);
- void get_midi_playback (MidiBuffer& dst, framecnt_t nframes, MonitorState, BufferSet&, double speed, framecnt_t distance);
+ void get_midi_playback (MidiBuffer& dst, samplecnt_t nframes, MonitorState, BufferSet&, double speed, samplecnt_t distance);
};
} // namespace
diff --git a/libs/ardour/ardour/disk_writer.h b/libs/ardour/ardour/disk_writer.h
index 45fc37bdcf..d5446d0ab6 100644
--- a/libs/ardour/ardour/disk_writer.h
+++ b/libs/ardour/ardour/disk_writer.h
@@ -48,12 +48,12 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
bool recordable() const { return _flags & Recordable; }
- static framecnt_t chunk_frames() { return _chunk_frames; }
- static framecnt_t default_chunk_frames ();
- static void set_chunk_frames (framecnt_t n) { _chunk_frames = n; }
+ static samplecnt_t chunk_samples() { return _chunk_samples; }
+ static samplecnt_t default_chunk_samples ();
+ static void set_chunk_samples (samplecnt_t n) { _chunk_samples = n; }
- void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double speed, pframes_t /*nframes*/, bool /*result_required*/);
- void non_realtime_locate (framepos_t);
+ void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/);
+ void non_realtime_locate (samplepos_t);
void realtime_handle_transport_stopped ();
virtual XMLNode& state (bool full);
@@ -89,7 +89,7 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
PBD::Signal0<void> AlignmentStyleChanged;
- void set_input_latency (framecnt_t);
+ void set_input_latency (samplecnt_t);
bool configure_io (ChanCount in, ChanCount out);
@@ -105,21 +105,21 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
int set_non_layered (bool yn);
bool can_become_destructive (bool& requires_bounce) const;
- /** @return Start position of currently-running capture (in session frames) */
- framepos_t current_capture_start() const { return capture_start_frame; }
- framepos_t current_capture_end() const { return capture_start_frame + capture_captured; }
- framepos_t get_capture_start_frame (uint32_t n = 0) const;
- framecnt_t get_captured_frames (uint32_t n = 0) const;
+ /** @return Start position of currently-running capture (in session samples) */
+ samplepos_t current_capture_start() const { return capture_start_sample; }
+ samplepos_t current_capture_end() const { return capture_start_sample + capture_captured; }
+ samplepos_t get_capture_start_sample (uint32_t n = 0) const;
+ samplecnt_t get_captured_samples (uint32_t n = 0) const;
float buffer_load() const;
virtual void request_input_monitoring (bool) {}
virtual void ensure_input_monitoring (bool) {}
- framecnt_t capture_offset() const { return _capture_offset; }
+ samplecnt_t capture_offset() const { return _capture_offset; }
virtual void set_capture_offset ();
- int seek (framepos_t frame, bool complete_refill);
+ int seek (samplepos_t sample, bool complete_refill);
static PBD::Signal0<void> Overrun;
@@ -134,9 +134,9 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
PBD::Signal0<void> RecordEnableChanged;
PBD::Signal0<void> RecordSafeChanged;
- void check_record_status (framepos_t transport_frame, bool can_record);
+ void check_record_status (samplepos_t transport_sample, bool can_record);
- void transport_looped (framepos_t transport_frame);
+ void transport_looped (samplepos_t transport_sample);
void transport_stopped_wallclock (struct tm&, time_t, bool abort);
void adjust_buffering ();
@@ -146,11 +146,11 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
int do_flush (RunContext context, bool force = false);
void get_input_sources ();
- void prepare_record_status (framepos_t /*capture_start_frame*/);
+ void prepare_record_status (samplepos_t /*capture_start_sample*/);
void set_align_style_from_io();
void setup_destructive_playlist ();
void use_destructive_playlist ();
- void prepare_to_stop (framepos_t transport_pos, framepos_t audible_frame);
+ void prepare_to_stop (samplepos_t transport_pos, samplepos_t audible_sample);
void engage_record_enable ();
void disengage_record_enable ();
@@ -161,8 +161,8 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
bool prep_record_disable ();
void calculate_record_range (
- Evoral::OverlapType ot, framepos_t transport_frame, framecnt_t nframes,
- framecnt_t& rec_nframes, framecnt_t& rec_offset
+ Evoral::OverlapType ot, samplepos_t transport_sample, samplecnt_t nframes,
+ samplecnt_t& rec_nframes, samplecnt_t& rec_offset
);
mutable Glib::Threads::Mutex capture_info_lock;
@@ -171,13 +171,13 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
private:
gint _record_enabled;
gint _record_safe;
- framepos_t capture_start_frame;
- framecnt_t capture_captured;
+ samplepos_t capture_start_sample;
+ samplecnt_t capture_captured;
bool was_recording;
- framecnt_t adjust_capture_position;
- framecnt_t _capture_offset;
- framepos_t first_recordable_frame;
- framepos_t last_recordable_frame;
+ samplecnt_t adjust_capture_position;
+ samplecnt_t _capture_offset;
+ samplepos_t first_recordable_sample;
+ samplepos_t last_recordable_sample;
int last_possibly_recording;
AlignStyle _alignment_style;
AlignChoice _alignment_choice;
@@ -187,12 +187,12 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
std::list<boost::shared_ptr<Source> > _last_capture_sources;
std::vector<boost::shared_ptr<AudioFileSource> > capturing_sources;
- static framecnt_t _chunk_frames;
+ static samplecnt_t _chunk_samples;
NoteMode _note_mode;
- volatile gint _frames_pending_write;
+ volatile gint _samples_pending_write;
volatile gint _num_captured_loops;
- framepos_t _accumulated_capture_offset;
+ samplepos_t _accumulated_capture_offset;
/** A buffer that we use to put newly-arrived MIDI data in for
the GUI to read (so that it can update itself).
diff --git a/libs/ardour/ardour/dsp_filter.h b/libs/ardour/ardour/dsp_filter.h
index b7be410950..f54eeac302 100644
--- a/libs/ardour/ardour/dsp_filter.h
+++ b/libs/ardour/ardour/dsp_filter.h
@@ -169,7 +169,7 @@ namespace ARDOUR { namespace DSP {
void process_map (BufferSet* bufs,
const ChanMapping& in,
const ChanMapping& out,
- pframes_t nframes, framecnt_t offset,
+ pframes_t nframes, samplecnt_t offset,
const DataType&);
/** 1st order Low Pass filter */
diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h
index b6d6ff7166..5e107a29f8 100644
--- a/libs/ardour/ardour/element_importer.h
+++ b/libs/ardour/ardour/element_importer.h
@@ -110,13 +110,13 @@ class LIBARDOUR_API ElementImporter
std::string name;
/// The sample rate of the session from which we are importing
- framecnt_t sample_rate;
+ samplecnt_t sample_rate;
/// Converts timecode time to a string
std::string timecode_to_string (Timecode::Time & time) const;
/// Converts samples so that times match the sessions sample rate
- framecnt_t rate_convert_samples (framecnt_t samples) const;
+ samplecnt_t rate_convert_samples (samplecnt_t samples) const;
/// Converts samples so that times match the sessions sample rate (for straight use in XML)
std::string rate_convert_samples (std::string const & samples) const;
diff --git a/libs/ardour/ardour/engine_state_controller.h b/libs/ardour/ardour/engine_state_controller.h
index 7cf4e057dc..f485dbbe5e 100644
--- a/libs/ardour/ardour/engine_state_controller.h
+++ b/libs/ardour/ardour/engine_state_controller.h
@@ -146,13 +146,13 @@ class EngineStateController
*
* @return current sample rate
*/
- ARDOUR::framecnt_t get_current_sample_rate () const;
+ ARDOUR::samplecnt_t get_current_sample_rate () const;
/** Get default sample rate for current backend.
*
* @return default sample rate for current backend
*/
- ARDOUR::framecnt_t get_default_sample_rate () const;
+ ARDOUR::samplecnt_t get_default_sample_rate () const;
/** Get sample rates which are supported by current device and current backend.
*
@@ -369,7 +369,7 @@ class EngineStateController
* @note Use push_state_to_backend() method to update backend/device state with the most recent controller state
* @param sample_rate - new sample rate
*/
- bool set_new_sample_rate_in_controller(framecnt_t sample_rate);
+ bool set_new_sample_rate_in_controller(samplecnt_t sample_rate);
/** Set new buffer size for current device in EngineStateController database
* @note Use push_state_to_backend() method to update backend/device state with the most recent controller state
* @param buffer_size - new buffer size
@@ -470,7 +470,7 @@ class EngineStateController
struct State {
std::string backend_name; ///< state backend name
std::string device_name; ///< state device name
- ARDOUR::framecnt_t sample_rate; ///< sample rate used by the device in this state
+ ARDOUR::samplecnt_t sample_rate; ///< sample rate used by the device in this state
ARDOUR::pframes_t buffer_size; ///< buffer size used by the device in this state
PortStateList input_channel_states; ///< states of device Audio inputs
@@ -609,7 +609,7 @@ class EngineStateController
void _on_device_error();
/** Invoked when current device changes sample rate
*/
- void _on_sample_rate_change(ARDOUR::framecnt_t);
+ void _on_sample_rate_change(ARDOUR::samplecnt_t);
/** Invoked when current device changes buffer size
*/
void _on_buffer_size_change(ARDOUR::pframes_t);
diff --git a/libs/ardour/ardour/export_analysis.h b/libs/ardour/ardour/export_analysis.h
index c911acf9f0..5930784ba2 100644
--- a/libs/ardour/ardour/export_analysis.h
+++ b/libs/ardour/ardour/export_analysis.h
@@ -83,7 +83,7 @@ namespace ARDOUR {
PeakData peaks[2][800];
float spectrum[800][200];
- std::set<framecnt_t> truepeakpos[2]; // bins with >= -1dBTB
+ std::set<samplecnt_t> truepeakpos[2]; // bins with >= -1dBTB
};
typedef boost::shared_ptr<ExportAnalysis> ExportAnalysisPtr;
diff --git a/libs/ardour/ardour/export_channel.h b/libs/ardour/ardour/export_channel.h
index 894406874e..a94d65fbdc 100644
--- a/libs/ardour/ardour/export_channel.h
+++ b/libs/ardour/ardour/export_channel.h
@@ -46,9 +46,9 @@ class LIBARDOUR_API ExportChannel : public boost::less_than_comparable<ExportCha
virtual ~ExportChannel () {}
- virtual void set_max_buffer_size(framecnt_t) { }
+ virtual void set_max_buffer_size(samplecnt_t) { }
- virtual void read (Sample const *& data, framecnt_t frames) const = 0;
+ virtual void read (Sample const *& data, samplecnt_t samples) const = 0;
virtual bool empty () const = 0;
/// Adds state to node passed
@@ -68,9 +68,9 @@ class LIBARDOUR_API PortExportChannel : public ExportChannel
typedef std::set<boost::weak_ptr<AudioPort> > PortSet;
PortExportChannel ();
- void set_max_buffer_size(framecnt_t frames);
+ void set_max_buffer_size(samplecnt_t samples);
- void read (Sample const *& data, framecnt_t frames) const;
+ void read (Sample const *& data, samplecnt_t samples) const;
bool empty () const { return ports.empty(); }
void get_state (XMLNode * node) const;
@@ -84,7 +84,7 @@ class LIBARDOUR_API PortExportChannel : public ExportChannel
private:
PortSet ports;
boost::scoped_array<Sample> buffer;
- framecnt_t buffer_size;
+ samplecnt_t buffer_size;
};
@@ -103,23 +103,23 @@ class LIBARDOUR_API RegionExportChannelFactory
~RegionExportChannelFactory ();
ExportChannelPtr create (uint32_t channel);
- void read (uint32_t channel, Sample const *& data, framecnt_t frames_to_read);
+ void read (uint32_t channel, Sample const *& data, samplecnt_t samples_to_read);
private:
- int new_cycle_started (framecnt_t) { buffers_up_to_date = false; return 0; }
- void update_buffers (framecnt_t frames);
+ int new_cycle_started (samplecnt_t) { buffers_up_to_date = false; return 0; }
+ void update_buffers (samplecnt_t samples);
AudioRegion const & region;
AudioTrack & track;
Type type;
- framecnt_t frames_per_cycle;
+ samplecnt_t samples_per_cycle;
size_t n_channels;
BufferSet buffers;
bool buffers_up_to_date;
- framecnt_t region_start;
- framecnt_t position;
+ samplecnt_t region_start;
+ samplecnt_t position;
boost::scoped_array<Sample> mixdown_buffer;
boost::scoped_array<Sample> gain_buffer;
@@ -133,7 +133,7 @@ class LIBARDOUR_API RegionExportChannel : public ExportChannel
friend class RegionExportChannelFactory;
public:
- void read (Sample const *& data, framecnt_t frames_to_read) const { factory.read (channel, data, frames_to_read); }
+ void read (Sample const *& data, samplecnt_t samples_to_read) const { factory.read (channel, data, samples_to_read); }
void get_state (XMLNode * /*node*/) const {};
void set_state (XMLNode * /*node*/, Session & /*session*/) {};
bool empty () const { return false; }
@@ -164,9 +164,9 @@ class LIBARDOUR_API RouteExportChannel : public ExportChannel
static void create_from_route(std::list<ExportChannelPtr> & result, boost::shared_ptr<Route> route);
public: // ExportChannel interface
- void set_max_buffer_size(framecnt_t frames);
+ void set_max_buffer_size(samplecnt_t samples);
- void read (Sample const *& data, framecnt_t frames) const;
+ void read (Sample const *& data, samplecnt_t samples) const;
bool empty () const { return false; }
void get_state (XMLNode * node) const;
diff --git a/libs/ardour/ardour/export_format_base.h b/libs/ardour/ardour/export_format_base.h
index 093913e294..ee2739eee1 100644
--- a/libs/ardour/ardour/export_format_base.h
+++ b/libs/ardour/ardour/export_format_base.h
@@ -166,7 +166,7 @@ class LIBARDOUR_API ExportFormatBase {
void set_extension (std::string const & extension) { _extension = extension; }
std::string const & extension () const { return _extension; }
- static SampleRate nearest_sample_rate (framecnt_t sample_rate);
+ static SampleRate nearest_sample_rate (samplecnt_t sample_rate);
protected:
diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h
index d473d20234..4fdb16961a 100644
--- a/libs/ardour/ardour/export_format_specification.h
+++ b/libs/ardour/ardour/export_format_specification.h
@@ -48,7 +48,7 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase {
Time (Session & session) : AnyTime (), session (session) {}
Time & operator= (AnyTime const & other);
- framecnt_t get_frames_at (framepos_t position, framecnt_t target_rate) const;
+ samplecnt_t get_samples_at (samplepos_t position, samplecnt_t target_rate) const;
/* Serialization */
@@ -174,10 +174,10 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase {
bool tag () const { return _tag && supports_tagging; }
- framecnt_t silence_beginning_at (framepos_t position, framecnt_t samplerate) const
- { return _silence_beginning.get_frames_at (position, samplerate); }
- framecnt_t silence_end_at (framepos_t position, framecnt_t samplerate) const
- { return _silence_end.get_frames_at (position, samplerate); }
+ samplecnt_t silence_beginning_at (samplepos_t position, samplecnt_t samplerate) const
+ { return _silence_beginning.get_samples_at (position, samplerate); }
+ samplecnt_t silence_end_at (samplepos_t position, samplecnt_t samplerate) const
+ { return _silence_end.get_samples_at (position, samplerate); }
AnyTime silence_beginning_time () const { return _silence_beginning; }
AnyTime silence_end_time () const { return _silence_end; }
diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h
index c9671d729b..ebc3fdadfc 100644
--- a/libs/ardour/ardour/export_graph_builder.h
+++ b/libs/ardour/ardour/export_graph_builder.h
@@ -67,7 +67,7 @@ class LIBARDOUR_API ExportGraphBuilder
ExportGraphBuilder (Session const & session);
~ExportGraphBuilder ();
- int process (framecnt_t frames, bool last_cycle);
+ int process (samplecnt_t samples, bool last_cycle);
bool post_process (); // returns true when finished
bool need_postprocessing () const { return !intermediates.empty(); }
bool realtime() const { return _realtime; }
@@ -121,7 +121,7 @@ class LIBARDOUR_API ExportGraphBuilder
class SFC {
public:
// This constructor so that this can be constructed like a Normalizer
- SFC (ExportGraphBuilder &, FileSpec const & new_config, framecnt_t max_frames);
+ SFC (ExportGraphBuilder &, FileSpec const & new_config, samplecnt_t max_samples);
FloatSinkPtr sink ();
void add_child (FileSpec const & new_config);
void remove_children (bool remove_out_files);
@@ -149,7 +149,7 @@ class LIBARDOUR_API ExportGraphBuilder
class Intermediate {
public:
- Intermediate (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames);
+ Intermediate (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples);
FloatSinkPtr sink ();
void add_child (FileSpec const & new_config);
void remove_children (bool remove_out_files);
@@ -174,7 +174,7 @@ class LIBARDOUR_API ExportGraphBuilder
ExportGraphBuilder & parent;
FileSpec config;
- framecnt_t max_frames_out;
+ samplecnt_t max_samples_out;
bool use_loudness;
bool use_peak;
BufferPtr buffer;
@@ -191,7 +191,7 @@ class LIBARDOUR_API ExportGraphBuilder
// sample rate converter
class SRC {
public:
- SRC (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames);
+ SRC (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples);
FloatSinkPtr sink ();
void add_child (FileSpec const & new_config);
void remove_children (bool remove_out_files);
@@ -209,13 +209,13 @@ class LIBARDOUR_API ExportGraphBuilder
boost::ptr_list<SFC> children;
boost::ptr_list<Intermediate> intermediate_children;
SRConverterPtr converter;
- framecnt_t max_frames_out;
+ samplecnt_t max_samples_out;
};
// Silence trimmer + adder
class SilenceHandler {
public:
- SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames);
+ SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples);
FloatSinkPtr sink ();
void add_child (FileSpec const & new_config);
void remove_children (bool remove_out_files);
@@ -228,7 +228,7 @@ class LIBARDOUR_API ExportGraphBuilder
FileSpec config;
boost::ptr_list<SRC> children;
SilenceTrimmerPtr silence_trimmer;
- framecnt_t max_frames_in;
+ samplecnt_t max_samples_in;
};
// channel configuration
@@ -248,7 +248,7 @@ class LIBARDOUR_API ExportGraphBuilder
boost::ptr_list<SilenceHandler> children;
InterleaverPtr interleaver;
ChunkerPtr chunker;
- framecnt_t max_frames_out;
+ samplecnt_t max_samples_out;
};
Session const & session;
@@ -261,7 +261,7 @@ class LIBARDOUR_API ExportGraphBuilder
// The sources of all data, each channel is read only once
ChannelMap channels;
- framecnt_t process_buffer_frames;
+ samplecnt_t process_buffer_samples;
std::list<Intermediate *> intermediates;
diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h
index 5ed1c0be1c..352451c4a3 100644
--- a/libs/ardour/ardour/export_handler.h
+++ b/libs/ardour/ardour/export_handler.h
@@ -127,7 +127,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr
private:
void handle_duplicate_format_extensions();
- int process (framecnt_t frames);
+ int process (samplecnt_t samples);
Session & session;
boost::shared_ptr<ExportGraphBuilder> graph_builder;
@@ -144,7 +144,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr
/* Timespan management */
void start_timespan ();
- int process_timespan (framecnt_t frames);
+ int process_timespan (samplecnt_t samples);
int post_process ();
void finish_timespan ();
@@ -153,7 +153,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr
TimespanBounds timespan_bounds;
PBD::ScopedConnection process_connection;
- framepos_t process_position;
+ samplepos_t process_position;
/* CD Marker stuff */
@@ -168,7 +168,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr
, track_number (1)
, track_position (0)
, track_duration (0)
- , track_start_frame (0)
+ , track_start_sample (0)
, index_number (1)
, index_position (0)
{}
@@ -192,13 +192,13 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr
/* Track info */
uint32_t track_number;
- framepos_t track_position;
- framepos_t track_duration;
- framepos_t track_start_frame;
+ samplepos_t track_position;
+ samplepos_t track_duration;
+ samplepos_t track_start_sample;
/* Index info */
uint32_t index_number;
- framepos_t index_position;
+ samplepos_t index_position;
};
@@ -217,8 +217,8 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr
void write_index_info_toc (CDMarkerStatus & status);
void write_index_info_mp4ch (CDMarkerStatus & status);
- void frames_to_cd_frames_string (char* buf, framepos_t when);
- void frames_to_chapter_marks_string (char* buf, framepos_t when);
+ void samples_to_cd_samples_string (char* buf, samplepos_t when);
+ void samples_to_chapter_marks_string (char* buf, samplepos_t when);
std::string toc_escape_cdtext (const std::string&);
std::string toc_escape_filename (const std::string&);
diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h
index b0285f8ecc..4f477f65b9 100644
--- a/libs/ardour/ardour/export_profile_manager.h
+++ b/libs/ardour/ardour/export_profile_manager.h
@@ -118,7 +118,7 @@ class LIBARDOUR_API ExportProfileManager
Timecode,
BBT,
MinSec,
- Frames,
+ Samples,
};
struct TimespanState {
@@ -140,8 +140,8 @@ class LIBARDOUR_API ExportProfileManager
typedef boost::shared_ptr<TimespanState> TimespanStatePtr;
typedef std::list<TimespanStatePtr> TimespanStateList;
- void set_selection_range (framepos_t start = 0, framepos_t end = 0);
- std::string set_single_range (framepos_t start, framepos_t end, std::string name);
+ void set_selection_range (samplepos_t start = 0, samplepos_t end = 0);
+ std::string set_single_range (samplepos_t start, samplepos_t end, std::string name);
TimespanStateList const & get_timespans () { return check_list (timespans); }
private:
diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h
index 99642a2d7c..90e6c1b56a 100644
--- a/libs/ardour/ardour/export_status.h
+++ b/libs/ardour/ardour/export_status.h
@@ -72,11 +72,11 @@ class LIBARDOUR_API ExportStatus {
volatile uint32_t timespan;
std::string timespan_name;
- volatile framecnt_t total_frames;
- volatile framecnt_t processed_frames;
+ volatile samplecnt_t total_samples;
+ volatile samplecnt_t processed_samples;
- volatile framecnt_t total_frames_current_timespan;
- volatile framecnt_t processed_frames_current_timespan;
+ volatile samplecnt_t total_samples_current_timespan;
+ volatile samplecnt_t processed_samples_current_timespan;
volatile uint32_t total_postprocessing_cycles;
volatile uint32_t current_postprocessing_cycle;
diff --git a/libs/ardour/ardour/export_timespan.h b/libs/ardour/ardour/export_timespan.h
index d4631cbccc..4999d893b0 100644
--- a/libs/ardour/ardour/export_timespan.h
+++ b/libs/ardour/ardour/export_timespan.h
@@ -42,7 +42,7 @@ class LIBARDOUR_API ExportTimespan
private:
friend class ExportElementFactory;
- ExportTimespan (ExportStatusPtr status, framecnt_t frame_rate);
+ ExportTimespan (ExportStatusPtr status, samplecnt_t sample_rate);
public:
~ExportTimespan ();
@@ -56,26 +56,26 @@ class LIBARDOUR_API ExportTimespan
bool realtime () const { return _realtime; }
void set_realtime (bool rt) { _realtime = rt; }
- void set_range (framepos_t start, framepos_t end);
- framecnt_t get_length () const { return end_frame - start_frame; }
- framepos_t get_start () const { return start_frame; }
- framepos_t get_end () const { return end_frame; }
+ void set_range (samplepos_t start, samplepos_t end);
+ samplecnt_t get_length () const { return end_sample - start_sample; }
+ samplepos_t get_start () const { return start_sample; }
+ samplepos_t get_end () const { return end_sample; }
/// Primarily compare start time, then end time
bool operator< (ExportTimespan const & other) {
- if (start_frame < other.start_frame) { return true; }
- if (start_frame > other.start_frame) { return false; }
- return end_frame < other.end_frame;
+ if (start_sample < other.start_sample) { return true; }
+ if (start_sample > other.start_sample) { return false; }
+ return end_sample < other.end_sample;
}
private:
ExportStatusPtr status;
- framepos_t start_frame;
- framepos_t end_frame;
- framepos_t position;
- framecnt_t frame_rate;
+ samplepos_t start_sample;
+ samplepos_t end_sample;
+ samplepos_t position;
+ samplecnt_t sample_rate;
std::string _name;
std::string _range_id;
diff --git a/libs/ardour/ardour/fixed_delay.h b/libs/ardour/ardour/fixed_delay.h
index 21eaa6567e..d73d7e4b63 100644
--- a/libs/ardour/ardour/fixed_delay.h
+++ b/libs/ardour/ardour/fixed_delay.h
@@ -53,7 +53,7 @@ public:
* @param max_delay the maximum number of samples to delay
* @param shrink when false already allocated buffers are kept if both channel-count and max-delay requirements are satisified
*/
- void configure (const ChanCount& count, framecnt_t max_delay, bool shrink = true);
+ void configure (const ChanCount& count, samplecnt_t max_delay, bool shrink = true);
/** set delay time and update active process buffers
*
@@ -63,7 +63,7 @@ public:
* @param count channels to be processed
* @param delay number of audio samples to delay
*/
- void set (const ChanCount& count, framecnt_t delay);
+ void set (const ChanCount& count, samplecnt_t delay);
/** process a channel
*
@@ -78,15 +78,15 @@ public:
* @param dst_offset offset in output buffer to start writing to
* @param src_offset offset in input buffer to start reading from
*/
- void delay (ARDOUR::DataType dt, uint32_t id, Buffer& out, const Buffer& in, pframes_t n_samples, framecnt_t dst_offset = 0, framecnt_t src_offset = 0);
+ void delay (ARDOUR::DataType dt, uint32_t id, Buffer& out, const Buffer& in, pframes_t n_samples, samplecnt_t dst_offset = 0, samplecnt_t src_offset = 0);
/** zero all buffers */
void flush();
private:
- framecnt_t _max_delay;
- framecnt_t _buf_size;
- framecnt_t _delay;
+ samplecnt_t _max_delay;
+ samplecnt_t _buf_size;
+ samplecnt_t _delay;
ChanCount _count;
struct DelayBuffer {
@@ -96,7 +96,7 @@ private:
: buf (Buffer::create (dt, capacity)), pos (0) {}
~DelayBuffer () { delete buf; }
Buffer * buf;
- framepos_t pos;
+ samplepos_t pos;
};
typedef std::vector<DelayBuffer*> BufferVec;
diff --git a/libs/ardour/ardour/gain_control.h b/libs/ardour/ardour/gain_control.h
index 7fe5cc7bab..a2644582ce 100644
--- a/libs/ardour/ardour/gain_control.h
+++ b/libs/ardour/ardour/gain_control.h
@@ -43,7 +43,7 @@ class LIBARDOUR_API GainControl : public SlavableAutomationControl {
protected:
void post_add_master (boost::shared_ptr<AutomationControl>);
- bool get_masters_curve_locked (framepos_t, framepos_t, float*, framecnt_t) const;
+ bool get_masters_curve_locked (samplepos_t, samplepos_t, float*, samplecnt_t) const;
};
} /* namespace */
diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h
index ce915a6ce4..0dc8e164c4 100644
--- a/libs/ardour/ardour/graph.h
+++ b/libs/ardour/ardour/graph.h
@@ -65,10 +65,10 @@ public:
void helper_thread();
- int process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
+ int process_routes (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick,
bool& need_butler);
- int routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ int routes_no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
bool non_rt_pending, int declick);
void process_one_route (Route * route);
@@ -121,8 +121,8 @@ private:
// parameter caches.
pframes_t _process_nframes;
- framepos_t _process_start_frame;
- framepos_t _process_end_frame;
+ samplepos_t _process_start_sample;
+ samplepos_t _process_end_sample;
bool _process_can_record;
bool _process_non_rt_pending;
int _process_declick;
diff --git a/libs/ardour/ardour/importable_source.h b/libs/ardour/ardour/importable_source.h
index 9463f0b28b..0ca98b401e 100644
--- a/libs/ardour/ardour/importable_source.h
+++ b/libs/ardour/ardour/importable_source.h
@@ -31,13 +31,13 @@ public:
ImportableSource () {}
virtual ~ImportableSource() {}
- virtual framecnt_t read (Sample* buffer, framecnt_t nframes) = 0;
+ virtual samplecnt_t read (Sample* buffer, samplecnt_t nframes) = 0;
virtual float ratio() const { return 1.0f; }
virtual uint32_t channels() const = 0;
- virtual framecnt_t length() const = 0;
- virtual framecnt_t samplerate() const = 0;
- virtual void seek (framepos_t pos) = 0;
- virtual framepos_t natural_position() const = 0;
+ virtual samplecnt_t length() const = 0;
+ virtual samplecnt_t samplerate() const = 0;
+ virtual void seek (samplepos_t pos) = 0;
+ virtual samplepos_t natural_position() const = 0;
virtual bool clamped_at_unity () const = 0;
};
diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h
index 48fcab151e..d2c55b1763 100644
--- a/libs/ardour/ardour/internal_return.h
+++ b/libs/ardour/ardour/internal_return.h
@@ -37,7 +37,7 @@ class LIBARDOUR_API InternalReturn : public Return
XMLNode& state (bool full);
XMLNode& get_state ();
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
bool configure_io (ChanCount, ChanCount);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h
index 8a85fc0f68..c46236c559 100644
--- a/libs/ardour/ardour/internal_send.h
+++ b/libs/ardour/ardour/internal_send.h
@@ -40,7 +40,7 @@ class LIBARDOUR_API InternalSend : public Send
int set_state(const XMLNode& node, int version);
void cycle_start (pframes_t);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
bool feeds (boost::shared_ptr<Route> other) const;
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/ardour/interpolation.h b/libs/ardour/ardour/interpolation.h
index 3c661d8592..4b6a66d54b 100644
--- a/libs/ardour/ardour/interpolation.h
+++ b/libs/ardour/ardour/interpolation.h
@@ -60,19 +60,19 @@ public:
class LIBARDOUR_API LinearInterpolation : public Interpolation {
public:
- framecnt_t interpolate (int channel, framecnt_t nframes, Sample* input, Sample* output);
+ samplecnt_t interpolate (int channel, samplecnt_t nframes, Sample* input, Sample* output);
};
class LIBARDOUR_API CubicInterpolation : public Interpolation {
public:
- framecnt_t interpolate (int channel, framecnt_t nframes, Sample* input, Sample* output);
+ samplecnt_t interpolate (int channel, samplecnt_t nframes, Sample* input, Sample* output);
};
class BufferSet;
class LIBARDOUR_API CubicMidiInterpolation : public Interpolation {
public:
- framecnt_t distance (framecnt_t nframes, bool roll = true);
+ samplecnt_t distance (samplecnt_t nframes, bool roll = true);
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 571737e5a9..6f62e4ca74 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -92,7 +92,7 @@ class LIBARDOUR_API IO : public SessionObject, public Latent
void set_pretty_name (const std::string& str);
std::string pretty_name () const { return _pretty_name_prefix; }
- virtual void silence (framecnt_t);
+ virtual void silence (samplecnt_t);
void increment_port_buffer_offset (pframes_t offset);
int ensure_io (ChanCount cnt, bool clear, void *src);
@@ -115,8 +115,8 @@ class LIBARDOUR_API IO : public SessionObject, public Latent
bool connected () const;
bool physically_connected () const;
- framecnt_t signal_latency () const { return 0; }
- framecnt_t latency () const;
+ samplecnt_t signal_latency () const { return 0; }
+ samplecnt_t latency () const;
PortSet& ports() { return _ports; }
const PortSet& ports() const { return _ports; }
@@ -196,8 +196,8 @@ class LIBARDOUR_API IO : public SessionObject, public Latent
/* three utility functions - this just seems to be simplest place to put them */
void collect_input (BufferSet& bufs, pframes_t nframes, ChanCount offset);
- void process_input (boost::shared_ptr<Processor>, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes);
- void copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, framecnt_t offset);
+ void process_input (boost::shared_ptr<Processor>, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes);
+ void copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, samplecnt_t offset);
/* AudioTrack::deprecated_use_diskstream_connections() needs these */
diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h
index 15bd74d122..f17c338155 100644
--- a/libs/ardour/ardour/io_processor.h
+++ b/libs/ardour/ardour/io_processor.h
@@ -64,7 +64,7 @@ class LIBARDOUR_API IOProcessor : public Processor
void set_input (boost::shared_ptr<IO>);
void set_output (boost::shared_ptr<IO>);
- void silence (framecnt_t nframes, framepos_t start_frame);
+ void silence (samplecnt_t nframes, samplepos_t start_sample);
void disconnect ();
void increment_port_buffer_offset (pframes_t);
diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h
index dbb635fd91..0dca9bd5a6 100644
--- a/libs/ardour/ardour/ladspa_plugin.h
+++ b/libs/ardour/ardour/ladspa_plugin.h
@@ -38,7 +38,7 @@ class Session;
class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
{
public:
- LadspaPlugin (std::string module_path, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, framecnt_t sample_rate);
+ LadspaPlugin (std::string module_path, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, samplecnt_t sample_rate);
LadspaPlugin (const LadspaPlugin &);
~LadspaPlugin ();
@@ -50,7 +50,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
const char* maker() const { return _descriptor->Maker; }
uint32_t parameter_count() const { return _descriptor->PortCount; }
float default_value (uint32_t port) { return _default_value (port); }
- framecnt_t signal_latency() const;
+ samplecnt_t signal_latency() const;
void set_parameter (uint32_t port, float val);
float get_parameter (uint32_t port) const;
int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
@@ -83,9 +83,9 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
int set_block_size (pframes_t /*nframes*/) { return 0; }
int connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset);
+ pframes_t nframes, samplecnt_t offset);
std::string describe_parameter (Evoral::Parameter);
std::string state_node_name() const { return "ladspa"; }
@@ -125,7 +125,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
Glib::Module* _module;
const LADSPA_Descriptor* _descriptor;
LADSPA_Handle _handle;
- framecnt_t _sample_rate;
+ samplecnt_t _sample_rate;
LADSPA_Data* _control_data;
LADSPA_Data* _shadow_data;
LADSPA_Data* _latency_control_port;
@@ -134,7 +134,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
void find_presets ();
- void init (std::string module_path, uint32_t index, framecnt_t rate);
+ void init (std::string module_path, uint32_t index, samplecnt_t rate);
void run_in_place (pframes_t nsamples);
void latency_compute_run ();
int set_state_2X (const XMLNode&, int version);
diff --git a/libs/ardour/ardour/latent.h b/libs/ardour/ardour/latent.h
index bd639a8651..c4464f7ba4 100644
--- a/libs/ardour/ardour/latent.h
+++ b/libs/ardour/ardour/latent.h
@@ -30,10 +30,10 @@ class LIBARDOUR_API Latent {
Latent() : _user_latency (0) {}
virtual ~Latent() {}
- virtual framecnt_t signal_latency() const = 0;
- framecnt_t user_latency () const { return _user_latency; }
+ virtual samplecnt_t signal_latency() const = 0;
+ samplecnt_t user_latency () const { return _user_latency; }
- framecnt_t effective_latency() const {
+ samplecnt_t effective_latency() const {
if (_user_latency) {
return _user_latency;
} else {
@@ -41,10 +41,10 @@ class LIBARDOUR_API Latent {
}
}
- virtual void set_user_latency (framecnt_t val) { _user_latency = val; }
+ virtual void set_user_latency (samplecnt_t val) { _user_latency = val; }
protected:
- framecnt_t _user_latency;
+ samplecnt_t _user_latency;
};
}
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h
index 24ee563915..7015047b77 100644
--- a/libs/ardour/ardour/location.h
+++ b/libs/ardour/ardour/location.h
@@ -58,7 +58,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
};
Location (Session &);
- Location (Session &, framepos_t, framepos_t, const std::string &, Flags bits = Flags(0), const uint32_t sub_num = 0);
+ Location (Session &, samplepos_t, samplepos_t, const std::string &, Flags bits = Flags(0), const uint32_t sub_num = 0);
Location (const Location& other);
Location (Session &, const XMLNode&);
Location* operator= (const Location& other);
@@ -69,15 +69,15 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
void lock ();
void unlock ();
- framepos_t start() const { return _start; }
- framepos_t end() const { return _end; }
- framecnt_t length() const { return _end - _start; }
+ samplepos_t start() const { return _start; }
+ samplepos_t end() const { return _end; }
+ samplecnt_t length() const { return _end - _start; }
- int set_start (framepos_t s, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
- int set_end (framepos_t e, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
- int set (framepos_t start, framepos_t end, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
+ int set_start (samplepos_t s, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
+ int set_end (samplepos_t e, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
+ int set (samplepos_t start, samplepos_t end, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
- int move_to (framepos_t pos, const uint32_t sub_num);
+ int move_to (samplepos_t pos, const uint32_t sub_num);
const std::string& name() const { return _name; }
void set_name (const std::string &str);
@@ -143,16 +143,16 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
PositionLockStyle position_lock_style() const { return _position_lock_style; }
void set_position_lock_style (PositionLockStyle ps);
- void recompute_frames_from_beat ();
+ void recompute_samples_from_beat ();
static PBD::Signal0<void> scene_changed; /* for use by backend scene change management, class level */
PBD::Signal0<void> SceneChangeChanged; /* for use by objects interested in this object */
private:
std::string _name;
- framepos_t _start;
+ samplepos_t _start;
double _start_beat;
- framepos_t _end;
+ samplepos_t _end;
double _end_beat;
Flags _flags;
bool _locked;
@@ -161,7 +161,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
void set_mark (bool yn);
bool set_flag_internal (bool yn, Flags flag);
- void recompute_beat_from_frames (const uint32_t sub_num);
+ void recompute_beat_from_samples (const uint32_t sub_num);
};
/** A collection of session locations including unique dedicated locations (loop, punch, etc) */
@@ -196,14 +196,14 @@ class LIBARDOUR_API Locations : public SessionHandleRef, public PBD::StatefulDes
int set_current (Location *, bool want_lock = true);
Location *current () const { return current_location; }
- Location* mark_at (framepos_t, framecnt_t slop = 0) const;
+ Location* mark_at (samplepos_t, samplecnt_t slop = 0) const;
- framepos_t first_mark_before (framepos_t, bool include_special_ranges = false);
- framepos_t first_mark_after (framepos_t, bool include_special_ranges = false);
+ samplepos_t first_mark_before (samplepos_t, bool include_special_ranges = false);
+ samplepos_t first_mark_after (samplepos_t, bool include_special_ranges = false);
- void marks_either_side (framepos_t const, framepos_t &, framepos_t &) const;
+ void marks_either_side (samplepos_t const, samplepos_t &, samplepos_t &) const;
- void find_all_between (framepos_t start, framepos_t, LocationList&, Location::Flags);
+ void find_all_between (samplepos_t start, samplepos_t, LocationList&, Location::Flags);
PBD::Signal1<void,Location*> current_changed;
diff --git a/libs/ardour/ardour/ltc_file_reader.h b/libs/ardour/ardour/ltc_file_reader.h
index 92ea07f87f..6ced83951e 100644
--- a/libs/ardour/ardour/ltc_file_reader.h
+++ b/libs/ardour/ardour/ltc_file_reader.h
@@ -63,7 +63,7 @@ private:
LTCDecoder* decoder;
float* _interleaved_audio_buffer;
uint32_t _frames_decoded;
- framecnt_t _samples_read;
+ samplecnt_t _samples_read;
};
diff --git a/libs/ardour/ardour/lua_api.h b/libs/ardour/ardour/lua_api.h
index bd71576e7c..797577df00 100644
--- a/libs/ardour/ardour/lua_api.h
+++ b/libs/ardour/ardour/lua_api.h
@@ -292,8 +292,8 @@ namespace ARDOUR { namespace LuaAPI {
private:
::Vamp::Plugin* _plugin;
float _sample_rate;
- framecnt_t _bufsize;
- framecnt_t _stepsize;
+ samplecnt_t _bufsize;
+ samplecnt_t _stepsize;
bool _initialized;
};
diff --git a/libs/ardour/ardour/luaproc.h b/libs/ardour/ardour/luaproc.h
index 2c4f798945..6404944fbb 100644
--- a/libs/ardour/ardour/luaproc.h
+++ b/libs/ardour/ardour/luaproc.h
@@ -85,12 +85,12 @@ public:
void cleanup () { }
int set_block_size (pframes_t /*nframes*/) { return 0; }
- framecnt_t signal_latency() const { return 0; }
+ samplecnt_t signal_latency() const { return 0; }
int connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset);
+ pframes_t nframes, samplecnt_t offset);
std::string describe_parameter (Evoral::Parameter);
void print_parameter (uint32_t, char*, uint32_t len) const;
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index ee4a17d9a9..9e432c1180 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -59,7 +59,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
LV2Plugin (ARDOUR::AudioEngine& engine,
ARDOUR::Session& session,
const void* c_plugin,
- framecnt_t sample_rate);
+ samplecnt_t sample_rate);
LV2Plugin (const LV2Plugin &);
~LV2Plugin ();
@@ -74,8 +74,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
uint32_t num_ports () const;
uint32_t parameter_count () const;
float default_value (uint32_t port);
- framecnt_t max_latency () const;
- framecnt_t signal_latency () const;
+ samplecnt_t max_latency () const;
+ samplecnt_t signal_latency () const;
void set_parameter (uint32_t port, float val);
float get_parameter (uint32_t port) const;
std::string get_docs() const;
@@ -112,9 +112,9 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
bool requires_fixed_sized_buffers () const;
int connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset);
+ pframes_t nframes, samplecnt_t offset);
std::string describe_parameter (Evoral::Parameter);
std::string state_node_name () const { return "lv2"; }
@@ -181,7 +181,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
LV2_Feature** _features;
Worker* _worker;
Worker* _state_worker;
- framecnt_t _sample_rate;
+ samplecnt_t _sample_rate;
float* _control_data;
float* _shadow_data;
float* _defaults;
@@ -190,8 +190,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
float* _bpm_control_port; ///< Special input set by ardour
float* _freewheel_control_port; ///< Special input set by ardour
float* _latency_control_port; ///< Special output set by ardour
- framepos_t _next_cycle_start; ///< Expected start frame of next run cycle
- double _next_cycle_speed; ///< Expected start frame of next run cycle
+ samplepos_t _next_cycle_start; ///< Expected start sample of next run cycle
+ double _next_cycle_speed; ///< Expected start sample of next run cycle
double _next_cycle_beat; ///< Expected bar_beat of next run cycle
double _current_bpm;
PBD::ID _insert_id;
@@ -201,8 +201,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
URIMap& _uri_map;
bool _no_sample_accurate_ctrl;
bool _can_write_automation;
- framecnt_t _max_latency;
- framecnt_t _current_latency;
+ samplecnt_t _max_latency;
+ samplecnt_t _current_latency;
friend const void* lv2plugin_get_port_value(const char* port_symbol,
void* user_data,
@@ -330,7 +330,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
static char* lv2_state_make_path (void* host_data,
const char* path);
- void init (const void* c_plugin, framecnt_t rate);
+ void init (const void* c_plugin, samplecnt_t rate);
void allocate_atom_event_buffers ();
void run (pframes_t nsamples, bool sync_work = false);
diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h
index ddc1e5e48f..52ca751932 100644
--- a/libs/ardour/ardour/meter.h
+++ b/libs/ardour/ardour/meter.h
@@ -64,7 +64,7 @@ public:
void emit_configuration_changed ();
/** Compute peaks */
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
void activate () { }
void deactivate () { }
diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h
index cc48e28d61..509b60f12d 100644
--- a/libs/ardour/ardour/midi_buffer.h
+++ b/libs/ardour/ardour/midi_buffer.h
@@ -33,17 +33,17 @@ namespace ARDOUR {
/** Buffer containing 8-bit unsigned char (MIDI) data. */
-class LIBARDOUR_API MidiBuffer : public Buffer, public Evoral::EventSink<framepos_t>
+class LIBARDOUR_API MidiBuffer : public Buffer, public Evoral::EventSink<samplepos_t>
{
public:
- typedef framepos_t TimeType;
+ typedef samplepos_t TimeType;
MidiBuffer(size_t capacity);
~MidiBuffer();
- void silence (framecnt_t nframes, framecnt_t offset = 0);
- void read_from (const Buffer& src, framecnt_t nframes, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0);
- void merge_from (const Buffer& src, framecnt_t nframes, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0);
+ void silence (samplecnt_t nframes, samplecnt_t offset = 0);
+ void read_from (const Buffer& src, samplecnt_t nframes, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0);
+ void merge_from (const Buffer& src, samplecnt_t nframes, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0);
void copy(const MidiBuffer& copy);
void copy(MidiBuffer const * const);
@@ -67,7 +67,7 @@ public:
class iterator_base
{
public:
- iterator_base<BufferType, EventType>(BufferType& b, framecnt_t o)
+ iterator_base<BufferType, EventType>(BufferType& b, samplecnt_t o)
: buffer(&b), offset(o) {}
iterator_base<BufferType, EventType>(const iterator_base<BufferType,EventType>& o)
diff --git a/libs/ardour/ardour/midi_cursor.h b/libs/ardour/ardour/midi_cursor.h
index 5cb89c87f5..6748a48971 100644
--- a/libs/ardour/ardour/midi_cursor.h
+++ b/libs/ardour/ardour/midi_cursor.h
@@ -47,7 +47,7 @@ struct MidiCursor : public boost::noncopyable {
Evoral::Sequence<Evoral::Beats>::const_iterator iter;
std::set<Evoral::Sequence<Evoral::Beats>::WeakNotePtr> active_notes;
- framepos_t last_read_end;
+ samplepos_t last_read_end;
PBD::ScopedConnectionList connections;
};
diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h
index 722808b2a4..952b0ab00f 100644
--- a/libs/ardour/ardour/midi_playlist.h
+++ b/libs/ardour/ardour/midi_playlist.h
@@ -42,7 +42,7 @@ class Beats;
namespace ARDOUR
{
-class BeatsFramesConverter;
+class BeatsSamplesConverter;
class MidiChannelFilter;
class MidiRegion;
class Session;
@@ -59,8 +59,8 @@ public:
/** This constructor does NOT notify others (session) */
MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other,
- framepos_t start,
- framecnt_t cnt,
+ samplepos_t start,
+ samplecnt_t cnt,
std::string name,
bool hidden = false);
@@ -69,25 +69,25 @@ public:
/** Read a range from the playlist into an event sink.
*
* @param buf Destination for events.
- * @param start First frame of read range.
- * @param cnt Number of frames in read range.
+ * @param start First sample of read range.
+ * @param cnt Number of samples in read range.
* @param loop_range If non-null, all event times will be mapped into this loop range.
* @param chan_n Must be 0 (this is the audio-style "channel", where each
* channel is backed by a separate region, not MIDI channels, which all
* exist in the same region and are not handled here).
- * @return The number of frames read (time, not an event count).
+ * @return The number of samples read (time, not an event count).
*/
- framecnt_t read (Evoral::EventSink<framepos_t>& buf,
- framepos_t start,
- framecnt_t cnt,
- Evoral::Range<framepos_t>* loop_range,
+ samplecnt_t read (Evoral::EventSink<samplepos_t>& buf,
+ samplepos_t start,
+ samplecnt_t cnt,
+ Evoral::Range<samplepos_t>* loop_range,
uint32_t chan_n = 0,
MidiChannelFilter* filter = NULL);
int set_state (const XMLNode&, int version);
bool destroy_region (boost::shared_ptr<Region>);
- void _split_region (boost::shared_ptr<Region>, const MusicFrame& position);
+ void _split_region (boost::shared_ptr<Region>, const MusicSample& position);
void set_note_mode (NoteMode m) { _note_mode = m; }
@@ -110,7 +110,7 @@ public:
* @param dst Sink to write note offs to.
* @param time Time stamp of all written note offs.
*/
- void resolve_note_trackers (Evoral::EventSink<framepos_t>& dst, framepos_t time);
+ void resolve_note_trackers (Evoral::EventSink<samplepos_t>& dst, samplepos_t time);
protected:
void remove_dependents (boost::shared_ptr<Region> region);
@@ -118,7 +118,7 @@ protected:
private:
typedef Evoral::Note<Evoral::Beats> Note;
- typedef Evoral::Event<framepos_t> Event;
+ typedef Evoral::Event<samplepos_t> Event;
struct RegionTracker : public boost::noncopyable {
MidiCursor cursor; ///< Cursor (iterator and read state)
@@ -132,7 +132,7 @@ private:
NoteTrackers _note_trackers;
NoteMode _note_mode;
- framepos_t _read_end;
+ samplepos_t _read_end;
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/midi_playlist_source.h b/libs/ardour/ardour/midi_playlist_source.h
index 7e54cde788..0d140a9855 100644
--- a/libs/ardour/ardour/midi_playlist_source.h
+++ b/libs/ardour/ardour/midi_playlist_source.h
@@ -37,16 +37,16 @@ public:
virtual ~MidiPlaylistSource ();
bool empty() const;
- framecnt_t length (framepos_t) const;
+ samplecnt_t length (samplepos_t) const;
- framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const;
- framecnt_t write_unlocked (Sample *src, framecnt_t cnt);
+ samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
+ samplecnt_t write_unlocked (Sample *src, samplecnt_t cnt);
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
void append_event_beats(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<Evoral::Beats>& ev);
- void append_event_frames(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<framepos_t>& ev, framepos_t source_start);
+ void append_event_samples(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<samplepos_t>& ev, samplepos_t source_start);
void load_model(const Glib::Threads::Mutex::Lock& lock, bool force_reload=false);
void destroy_model(const Glib::Threads::Mutex::Lock& lock);
@@ -54,29 +54,29 @@ protected:
friend class SourceFactory;
MidiPlaylistSource (Session&, const PBD::ID& orig, const std::string& name, boost::shared_ptr<MidiPlaylist>, uint32_t chn,
- frameoffset_t begin, framecnt_t len, Source::Flag flags);
+ sampleoffset_t begin, samplecnt_t len, Source::Flag flags);
MidiPlaylistSource (Session&, const XMLNode&);
void flush_midi(const Lock& lock);
- framecnt_t read_unlocked (const Lock& lock,
- Evoral::EventSink<framepos_t>& dst,
- framepos_t position,
- framepos_t start,
- framecnt_t cnt,
- Evoral::Range<framepos_t>* loop_range,
+ samplecnt_t read_unlocked (const Lock& lock,
+ Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t position,
+ samplepos_t start,
+ samplecnt_t cnt,
+ Evoral::Range<samplepos_t>* loop_range,
MidiStateTracker* tracker,
MidiChannelFilter* filter) const;
- framecnt_t write_unlocked (const Lock& lock,
- MidiRingBuffer<framepos_t>& dst,
- framepos_t position,
- framecnt_t cnt);
+ samplecnt_t write_unlocked (const Lock& lock,
+ MidiRingBuffer<samplepos_t>& dst,
+ samplepos_t position,
+ samplecnt_t cnt);
private:
int set_state (const XMLNode&, int version, bool with_descendants);
- framecnt_t _length;
+ samplecnt_t _length;
};
} /* namespace */
diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h
index 3856d11ac5..e23914c4ce 100644
--- a/libs/ardour/ardour/midi_port.h
+++ b/libs/ardour/ardour/midi_port.h
@@ -94,7 +94,7 @@ class LIBARDOUR_API MidiPort : public Port {
MIDI::Parser _self_parser;
- void resolve_notes (void* buffer, framepos_t when);
+ void resolve_notes (void* buffer, samplepos_t when);
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h
index 36c9125a84..00a5f28a5e 100644
--- a/libs/ardour/ardour/midi_region.h
+++ b/libs/ardour/ardour/midi_region.h
@@ -73,23 +73,23 @@ class LIBARDOUR_API MidiRegion : public Region
boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const;
/* Stub Readable interface */
- virtual framecnt_t read (Sample*, framepos_t /*pos*/, framecnt_t /*cnt*/, int /*channel*/) const { return 0; }
- virtual framecnt_t readable_length() const { return length(); }
+ virtual samplecnt_t read (Sample*, samplepos_t /*pos*/, samplecnt_t /*cnt*/, int /*channel*/) const { return 0; }
+ virtual samplecnt_t readable_length() const { return length(); }
- framecnt_t read_at (Evoral::EventSink<framepos_t>& dst,
- framepos_t position,
- framecnt_t dur,
- Evoral::Range<framepos_t>* loop_range,
+ samplecnt_t read_at (Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t position,
+ samplecnt_t dur,
+ Evoral::Range<samplepos_t>* loop_range,
MidiCursor& cursor,
uint32_t chan_n = 0,
NoteMode mode = Sustained,
MidiStateTracker* tracker = 0,
MidiChannelFilter* filter = 0) const;
- framecnt_t master_read_at (MidiRingBuffer<framepos_t>& dst,
- framepos_t position,
- framecnt_t dur,
- Evoral::Range<framepos_t>* loop_range,
+ samplecnt_t master_read_at (MidiRingBuffer<samplepos_t>& dst,
+ samplepos_t position,
+ samplecnt_t dur,
+ Evoral::Range<samplepos_t>* loop_range,
MidiCursor& cursor,
uint32_t chan_n = 0,
NoteMode mode = Sustained) const;
@@ -129,12 +129,12 @@ class LIBARDOUR_API MidiRegion : public Region
MidiRegion (const SourceList&);
MidiRegion (boost::shared_ptr<const MidiRegion>);
- MidiRegion (boost::shared_ptr<const MidiRegion>, ARDOUR::MusicFrame offset);
+ MidiRegion (boost::shared_ptr<const MidiRegion>, ARDOUR::MusicSample offset);
- framecnt_t _read_at (const SourceList&, Evoral::EventSink<framepos_t>& dst,
- framepos_t position,
- framecnt_t dur,
- Evoral::Range<framepos_t>* loop_range,
+ samplecnt_t _read_at (const SourceList&, Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t position,
+ samplecnt_t dur,
+ Evoral::Range<samplepos_t>* loop_range,
MidiCursor& cursor,
uint32_t chan_n = 0,
NoteMode mode = Sustained,
@@ -147,18 +147,18 @@ class LIBARDOUR_API MidiRegion : public Region
void recompute_at_start ();
void recompute_at_end ();
- void set_position_internal (framepos_t pos, bool allow_bbt_recompute, const int32_t sub_num);
+ void set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num);
void set_position_music_internal (double qn);
- void set_length_internal (framecnt_t len, const int32_t sub_num);
- void set_start_internal (framecnt_t, const int32_t sub_num);
- void trim_to_internal (framepos_t position, framecnt_t length, const int32_t sub_num);
+ void set_length_internal (samplecnt_t len, const int32_t sub_num);
+ void set_start_internal (samplecnt_t, const int32_t sub_num);
+ void trim_to_internal (samplepos_t position, samplecnt_t length, const int32_t sub_num);
void update_length_beats (const int32_t sub_num);
void model_changed ();
void model_shifted (double qn_distance);
void model_automation_state_changed (Evoral::Parameter const &);
- void set_start_beats_from_start_frames ();
+ void set_start_beats_from_start_samples ();
void update_after_tempo_map_change (bool send_change = true);
std::set<Evoral::Parameter> _filtered_parameters; ///< parameters that we ask our source not to return when reading
diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h
index 652f1c49cf..05205d264f 100644
--- a/libs/ardour/ardour/midi_ring_buffer.h
+++ b/libs/ardour/ardour/midi_ring_buffer.h
@@ -48,15 +48,15 @@ public:
inline bool read_prefix(T* time, Evoral::EventType* type, uint32_t* size);
inline bool read_contents(uint32_t size, uint8_t* buf);
- size_t read(MidiBuffer& dst, framepos_t start, framepos_t end, framecnt_t offset=0, bool stop_on_overflow_in_destination=false);
- size_t skip_to(framepos_t start);
+ size_t read(MidiBuffer& dst, samplepos_t start, samplepos_t end, samplecnt_t offset=0, bool stop_on_overflow_in_destination=false);
+ size_t skip_to(samplepos_t start);
void dump(std::ostream& dst);
- void flush (framepos_t start, framepos_t end);
+ void flush (samplepos_t start, samplepos_t end);
void reset_tracker ();
- void resolve_tracker (MidiBuffer& dst, framepos_t);
- void resolve_tracker (Evoral::EventSink<framepos_t>& dst, framepos_t);
+ void resolve_tracker (MidiBuffer& dst, samplepos_t);
+ void resolve_tracker (Evoral::EventSink<samplepos_t>& dst, samplepos_t);
private:
MidiStateTracker _tracker;
diff --git a/libs/ardour/ardour/midi_scene_changer.h b/libs/ardour/ardour/midi_scene_changer.h
index 792f4fb74f..cc9553aab8 100644
--- a/libs/ardour/ardour/midi_scene_changer.h
+++ b/libs/ardour/ardour/midi_scene_changer.h
@@ -35,15 +35,15 @@ class MIDISceneChanger : public SceneChanger
MIDISceneChanger (Session&);
~MIDISceneChanger ();
- void run (framepos_t start, framepos_t end);
+ void run (samplepos_t start, samplepos_t end);
void set_input_port (boost::shared_ptr<MidiPort>);
void set_output_port (boost::shared_ptr<MidiPort>);
- uint8_t bank_at (framepos_t, uint8_t channel);
- uint8_t program_at (framepos_t, uint8_t channel);
+ uint8_t bank_at (samplepos_t, uint8_t channel);
+ uint8_t program_at (samplepos_t, uint8_t channel);
void set_recording (bool);
- void locate (framepos_t);
+ void locate (samplepos_t);
/** Signal emitted whenever any relevant MIDI input is detected.
*/
@@ -54,7 +54,7 @@ class MIDISceneChanger : public SceneChanger
PBD::Signal0<void> MIDIOutputActivity;
private:
- typedef std::multimap<framepos_t,boost::shared_ptr<MIDISceneChange> > Scenes;
+ typedef std::multimap<samplepos_t,boost::shared_ptr<MIDISceneChange> > Scenes;
boost::shared_ptr<MidiPort> input_port;
boost::shared_ptr<MidiPort> output_port;
@@ -62,7 +62,7 @@ class MIDISceneChanger : public SceneChanger
Scenes scenes;
bool _recording;
bool have_seen_bank_changes;
- framepos_t last_program_message_time;
+ samplepos_t last_program_message_time;
unsigned short current_bank;
int last_delivered_program;
int last_delivered_bank;
@@ -70,7 +70,7 @@ class MIDISceneChanger : public SceneChanger
void gather (const Locations::LocationList&);
bool recording () const;
void jump_to (int bank, int program);
- void rt_deliver (MidiBuffer&, framepos_t, boost::shared_ptr<MIDISceneChange>);
+ void rt_deliver (MidiBuffer&, samplepos_t, boost::shared_ptr<MIDISceneChange>);
void non_rt_deliver (boost::shared_ptr<MIDISceneChange>);
void bank_change_input (MIDI::Parser&, unsigned short, int channel);
diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h
index f1d9473a13..5f59baab22 100644
--- a/libs/ardour/ardour/midi_source.h
+++ b/libs/ardour/ardour/midi_source.h
@@ -32,7 +32,7 @@
#include "ardour/buffer.h"
#include "ardour/midi_cursor.h"
#include "ardour/source.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
namespace ARDOUR {
@@ -79,21 +79,21 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
Evoral::Beats end);
/** Read the data in a given time range from the MIDI source.
- * All time stamps in parameters are in audio frames (even if the source has tempo time).
+ * All time stamps in parameters are in audio samples (even if the source has tempo time).
* \param dst Ring buffer where read events are written.
* \param source_start Start position of the SOURCE in this read context.
* \param start Start of range to be read.
- * \param cnt Length of range to be read (in audio frames).
+ * \param cnt Length of range to be read (in audio samples).
* \param loop_range If non-null, all event times will be mapped into this loop range.
* \param tracker an optional pointer to MidiStateTracker object, for note on/off tracking.
* \param filtered Parameters whose MIDI messages will not be returned.
*/
- virtual framecnt_t midi_read (const Lock& lock,
- Evoral::EventSink<framepos_t>& dst,
- framepos_t source_start,
- framepos_t start,
- framecnt_t cnt,
- Evoral::Range<framepos_t>* loop_range,
+ virtual samplecnt_t midi_read (const Lock& lock,
+ Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t source_start,
+ samplepos_t start,
+ samplecnt_t cnt,
+ Evoral::Range<samplepos_t>* loop_range,
MidiCursor& cursor,
MidiStateTracker* tracker,
MidiChannelFilter* filter,
@@ -103,13 +103,13 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
/** Write data from a MidiRingBuffer to this source.
* @param source Source to read from.
- * @param source_start This source's start position in session frames.
+ * @param source_start This source's start position in session samples.
* @param cnt The length of time to write.
*/
- virtual framecnt_t midi_write (const Lock& lock,
- MidiRingBuffer<framepos_t>& src,
- framepos_t source_start,
- framecnt_t cnt);
+ virtual samplecnt_t midi_write (const Lock& lock,
+ MidiRingBuffer<samplepos_t>& src,
+ samplepos_t source_start,
+ samplecnt_t cnt);
/** Append a single event with a timestamp in beats.
*
@@ -118,17 +118,17 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
virtual void append_event_beats(const Lock& lock,
const Evoral::Event<Evoral::Beats>& ev) = 0;
- /** Append a single event with a timestamp in frames.
+ /** Append a single event with a timestamp in samples.
*
* Caller must ensure that the event is later than the last written event.
*/
- virtual void append_event_frames(const Lock& lock,
- const Evoral::Event<framepos_t>& ev,
- framepos_t source_start) = 0;
+ virtual void append_event_samples(const Lock& lock,
+ const Evoral::Event<samplepos_t>& ev,
+ samplepos_t source_start) = 0;
virtual bool empty () const;
- virtual framecnt_t length (framepos_t pos) const;
- virtual void update_length (framecnt_t);
+ virtual samplecnt_t length (samplepos_t pos) const;
+ virtual void update_length (samplecnt_t);
virtual void mark_streaming_midi_write_started (const Lock& lock, NoteMode mode);
virtual void mark_streaming_write_started (const Lock& lock);
@@ -144,9 +144,9 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
* be zero if record is armed while rolling.
* @param loop_length The loop length if looping, otherwise zero.
*/
- void mark_write_starting_now (framecnt_t position,
- framecnt_t capture_length,
- framecnt_t loop_length);
+ void mark_write_starting_now (samplecnt_t position,
+ samplecnt_t capture_length,
+ samplecnt_t loop_length);
/* like ::mark_streaming_write_completed() but with more arguments to
* allow control over MIDI-specific behaviour. Expected to be used only
@@ -208,24 +208,24 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
protected:
virtual void flush_midi(const Lock& lock) = 0;
- virtual framecnt_t read_unlocked (const Lock& lock,
- Evoral::EventSink<framepos_t>& dst,
- framepos_t position,
- framepos_t start,
- framecnt_t cnt,
- Evoral::Range<framepos_t>* loop_range,
+ virtual samplecnt_t read_unlocked (const Lock& lock,
+ Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t position,
+ samplepos_t start,
+ samplecnt_t cnt,
+ Evoral::Range<samplepos_t>* loop_range,
MidiStateTracker* tracker,
MidiChannelFilter* filter) const = 0;
/** Write data to this source from a MidiRingBuffer.
* @param source Buffer to read from.
- * @param position This source's start position in session frames.
+ * @param position This source's start position in session samples.
* @param cnt The duration of this block to write for.
*/
- virtual framecnt_t write_unlocked (const Lock& lock,
- MidiRingBuffer<framepos_t>& source,
- framepos_t position,
- framecnt_t cnt) = 0;
+ virtual samplecnt_t write_unlocked (const Lock& lock,
+ MidiRingBuffer<samplepos_t>& source,
+ samplepos_t position,
+ samplecnt_t cnt) = 0;
std::string _captured_for;
@@ -235,10 +235,10 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
Evoral::Beats _length_beats;
/** The total duration of the current capture. */
- framepos_t _capture_length;
+ samplepos_t _capture_length;
/** Length of transport loop during current capture, or zero. */
- framepos_t _capture_loop_length;
+ samplepos_t _capture_loop_length;
/** Map of interpolation styles to use for Parameters; if they are not in this map,
* the correct interpolation style can be obtained from EventTypeMap::interpolation_of ()
diff --git a/libs/ardour/ardour/midi_state_tracker.h b/libs/ardour/ardour/midi_state_tracker.h
index 6690931422..7843ff7e1d 100644
--- a/libs/ardour/ardour/midi_state_tracker.h
+++ b/libs/ardour/ardour/midi_state_tracker.h
@@ -44,8 +44,8 @@ public:
void track (const uint8_t* evbuf);
void add (uint8_t note, uint8_t chn);
void remove (uint8_t note, uint8_t chn);
- void resolve_notes (MidiBuffer& buffer, framepos_t time);
- void resolve_notes (Evoral::EventSink<framepos_t>& buffer, framepos_t time);
+ void resolve_notes (MidiBuffer& buffer, samplepos_t time);
+ void resolve_notes (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time);
void resolve_notes (MidiSource& src, const Glib::Threads::Mutex::Lock& lock, Evoral::Beats time);
void dump (std::ostream&);
void reset ();
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index f08af83aaa..54a04d8ed3 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -42,10 +42,10 @@ public:
int init ();
- int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler);
+ int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler);
void realtime_locate ();
- void non_realtime_locate (framepos_t);
+ void non_realtime_locate (samplepos_t);
bool can_be_record_enabled ();
bool can_be_record_safe ();
@@ -55,15 +55,15 @@ public:
bool bounceable (boost::shared_ptr<Processor>, bool) const { return false; }
boost::shared_ptr<Region> bounce (InterThreadInfo&);
- boost::shared_ptr<Region> bounce_range (framepos_t start,
- framepos_t end,
+ boost::shared_ptr<Region> bounce_range (samplepos_t start,
+ samplepos_t end,
InterThreadInfo& iti,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint);
int export_stuff (BufferSet& bufs,
- framepos_t start_frame,
- framecnt_t end_frame,
+ samplepos_t start_sample,
+ samplecnt_t end_sample,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint,
bool for_export,
@@ -100,7 +100,7 @@ public:
bool step_editing() const { return _step_editing; }
void set_step_editing (bool yn);
- MidiRingBuffer<framepos_t>& step_edit_ring_buffer() { return _step_edit_ring_buffer; }
+ MidiRingBuffer<samplepos_t>& step_edit_ring_buffer() { return _step_edit_ring_buffer; }
PBD::Signal1<void,bool> StepEditStatusChange;
@@ -138,21 +138,21 @@ protected:
void monitoring_changed (bool, PBD::Controllable::GroupControlDisposition);
private:
- MidiRingBuffer<framepos_t> _immediate_events;
- MidiRingBuffer<framepos_t> _step_edit_ring_buffer;
+ MidiRingBuffer<samplepos_t> _immediate_events;
+ MidiRingBuffer<samplepos_t> _step_edit_ring_buffer;
NoteMode _note_mode;
bool _step_editing;
bool _input_active;
MidiChannelFilter _playback_filter;
MidiChannelFilter _capture_filter;
- void write_out_of_band_data (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, framecnt_t nframes);
+ void write_out_of_band_data (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, samplecnt_t nframes);
void set_state_part_two ();
void set_state_part_three ();
- int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing);
- void push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes);
+ int no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool state_changing);
+ void push_midi_input_to_step_edit_ringbuffer (samplecnt_t nframes);
void track_input_active (IOChange, void*);
void map_input_active (bool);
diff --git a/libs/ardour/ardour/mididm.h b/libs/ardour/ardour/mididm.h
index 5ee964c8e0..e16bb833e6 100644
--- a/libs/ardour/ardour/mididm.h
+++ b/libs/ardour/ardour/mididm.h
@@ -30,12 +30,12 @@ class LIBARDOUR_API MIDIDM
{
public:
- MIDIDM (framecnt_t sample_rate);
+ MIDIDM (samplecnt_t sample_rate);
int process (pframes_t nframes, PortEngine &pe, void *midi_in, void *midi_out);
- framecnt_t latency (void) { return _cnt_total > 10 ? _avg_delay : 0; }
- framecnt_t processed (void) { return _cnt_total; }
+ samplecnt_t latency (void) { return _cnt_total > 10 ? _avg_delay : 0; }
+ samplecnt_t processed (void) { return _cnt_total; }
double deviation (void) { return _cnt_total > 1 ? sqrt(_var_s / ((double)(_cnt_total - 1))) : 0; }
bool ok (void) { return _cnt_total > 200; }
bool have_signal (void) { return (_monotonic_cnt - _last_signal_tme) < (uint64_t) _sample_rate ; }
@@ -44,7 +44,7 @@ private:
int64_t parse_mclk (uint8_t const * const buf, pframes_t timestamp) const;
int64_t parse_mtc (uint8_t const * const buf, pframes_t timestamp) const;
- framecnt_t _sample_rate;
+ samplecnt_t _sample_rate;
uint64_t _monotonic_cnt;
uint64_t _last_signal_tme;
diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h
index 70f0761a49..1d537c0937 100644
--- a/libs/ardour/ardour/monitor_processor.h
+++ b/libs/ardour/ardour/monitor_processor.h
@@ -124,7 +124,7 @@ public:
bool display_to_user() const;
- void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/);
+ void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/);
XMLNode& state (bool full);
int set_state (const XMLNode&, int /* version */);
diff --git a/libs/ardour/ardour/mute_control.h b/libs/ardour/ardour/mute_control.h
index d54ff2dc34..494b554342 100644
--- a/libs/ardour/ardour/mute_control.h
+++ b/libs/ardour/ardour/mute_control.h
@@ -68,7 +68,7 @@ public:
void set_mute_points (MuteMaster::MutePoint);
MuteMaster::MutePoint mute_points () const;
- void automation_run (framepos_t start, pframes_t nframes);
+ void automation_run (samplepos_t start, pframes_t nframes);
protected:
bool handle_master_change (boost::shared_ptr<AutomationControl>);
diff --git a/libs/ardour/ardour/note_fixer.h b/libs/ardour/ardour/note_fixer.h
index 09f45cdec7..34582497d0 100644
--- a/libs/ardour/ardour/note_fixer.h
+++ b/libs/ardour/ardour/note_fixer.h
@@ -33,7 +33,7 @@ namespace Evoral { template<typename Time> class EventSink; }
namespace ARDOUR {
-class BeatsFramesConverter;
+class BeatsSamplesConverter;
class MidiStateTracker;
class TempoMap;
@@ -65,8 +65,8 @@ public:
*/
void prepare(TempoMap& tempo_map,
const MidiModel::NoteDiffCommand* cmd,
- framepos_t origin,
- framepos_t pos,
+ samplepos_t origin,
+ samplepos_t pos,
std::set< boost::weak_ptr<Note> >& active_notes);
/** Emit any pending edit compensation events.
@@ -76,21 +76,21 @@ public:
* the read block immediately following any calls to prepare().
* @param tracker Tracker to update with emitted events.
*/
- void emit(Evoral::EventSink<framepos_t>& dst,
- framepos_t pos,
+ void emit(Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t pos,
MidiStateTracker& tracker);
private:
- typedef Evoral::Event<framepos_t> Event;
+ typedef Evoral::Event<samplepos_t> Event;
typedef std::list<Event*> Events;
- /** Copy a beats event to a frames event with the given time stamp. */
- Event* copy_event(framepos_t time, const Evoral::Event<Evoral::Beats>& ev);
+ /** Copy a beats event to a samples event with the given time stamp. */
+ Event* copy_event(samplepos_t time, const Evoral::Event<Evoral::Beats>& ev);
/** Return true iff `note` is active at `pos`. */
- bool note_is_active(const BeatsFramesConverter& converter,
+ bool note_is_active(const BeatsSamplesConverter& converter,
boost::shared_ptr<Note> note,
- framepos_t pos);
+ samplepos_t pos);
Events _events;
};
diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h
index 0773250094..947baca733 100644
--- a/libs/ardour/ardour/panner.h
+++ b/libs/ardour/ardour/panner.h
@@ -140,7 +140,7 @@ public:
* @param ibufs Input buffers (one per panner input)
* @param obufs Output buffers (one per panner output).
* @param gain_coeff fixed, additional gain coefficient to apply to output samples.
- * @param nframes Number of frames in the input.
+ * @param nframes Number of samples in the input.
*
* Derived panners can choose to implement these if they need to gain more
* control over the panning algorithm. The default is to call
@@ -152,7 +152,7 @@ public:
*/
virtual void distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes);
virtual void distribute_automated (BufferSet& ibufs, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers);
int set_state (const XMLNode&, int version);
@@ -177,7 +177,7 @@ protected:
virtual void distribute_one (AudioBuffer&, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which) = 0;
virtual void distribute_one_automated (AudioBuffer&, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers, uint32_t which) = 0;
int32_t _frozen;
diff --git a/libs/ardour/ardour/panner_shell.h b/libs/ardour/ardour/panner_shell.h
index f344afd54a..59b0e7da81 100644
--- a/libs/ardour/ardour/panner_shell.h
+++ b/libs/ardour/ardour/panner_shell.h
@@ -59,7 +59,7 @@ public:
void configure_io (ChanCount in, ChanCount out);
/// The fundamental Panner function
- void run (BufferSet& src, BufferSet& dest, framepos_t start_frame, framepos_t end_frames, pframes_t nframes);
+ void run (BufferSet& src, BufferSet& dest, samplepos_t start_sample, samplepos_t end_samples, pframes_t nframes);
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index 26c664b0f2..91ddecb711 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -86,7 +86,7 @@ public:
Playlist (Session&, const XMLNode&, DataType type, bool hidden = false);
Playlist (Session&, std::string name, DataType type, bool hidden = false);
Playlist (boost::shared_ptr<const Playlist>, std::string name, bool hidden = false);
- Playlist (boost::shared_ptr<const Playlist>, framepos_t start, framecnt_t cnt, std::string name, bool hidden = false);
+ Playlist (boost::shared_ptr<const Playlist>, samplepos_t start, samplecnt_t cnt, std::string name, bool hidden = false);
virtual ~Playlist ();
@@ -126,8 +126,8 @@ public:
uint32_t n_regions() const;
bool all_regions_empty() const;
- std::pair<framepos_t, framepos_t> get_extent () const;
- std::pair<framepos_t, framepos_t> get_extent_with_endspace() const;
+ std::pair<samplepos_t, samplepos_t> get_extent () const;
+ std::pair<samplepos_t, samplepos_t> get_extent_with_endspace() const;
layer_t top_layer() const;
EditMode get_edit_mode() const { return _edit_mode; }
@@ -135,29 +135,29 @@ public:
/* Editing operations */
- void add_region (boost::shared_ptr<Region>, framepos_t position, float times = 1, bool auto_partition = false, int32_t sub_num = 0, double quarter_note = 0.0, bool for_music = false);
+ void add_region (boost::shared_ptr<Region>, samplepos_t position, float times = 1, bool auto_partition = false, int32_t sub_num = 0, double quarter_note = 0.0, bool for_music = false);
void remove_region (boost::shared_ptr<Region>);
void get_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
void get_source_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
- void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, framepos_t pos);
- void split_region (boost::shared_ptr<Region>, const MusicFrame& position);
- void split (const MusicFrame& at);
- void shift (framepos_t at, frameoffset_t distance, bool move_intersected, bool ignore_music_glue);
- void partition (framepos_t start, framepos_t end, bool cut = false);
- void duplicate (boost::shared_ptr<Region>, framepos_t position, float times);
- void duplicate (boost::shared_ptr<Region>, framepos_t position, framecnt_t gap, float times);
- void duplicate_until (boost::shared_ptr<Region>, framepos_t position, framecnt_t gap, framepos_t end);
+ void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, samplepos_t pos);
+ void split_region (boost::shared_ptr<Region>, const MusicSample& position);
+ void split (const MusicSample& at);
+ void shift (samplepos_t at, sampleoffset_t distance, bool move_intersected, bool ignore_music_glue);
+ void partition (samplepos_t start, samplepos_t end, bool cut = false);
+ void duplicate (boost::shared_ptr<Region>, samplepos_t position, float times);
+ void duplicate (boost::shared_ptr<Region>, samplepos_t position, samplecnt_t gap, float times);
+ void duplicate_until (boost::shared_ptr<Region>, samplepos_t position, samplecnt_t gap, samplepos_t end);
void duplicate_range (AudioRange&, float times);
void duplicate_ranges (std::list<AudioRange>&, float times);
- void nudge_after (framepos_t start, framecnt_t distance, bool forwards);
+ void nudge_after (samplepos_t start, samplecnt_t distance, bool forwards);
boost::shared_ptr<Region> combine (const RegionList&);
void uncombine (boost::shared_ptr<Region>);
void fade_range (std::list<AudioRange>&);
void shuffle (boost::shared_ptr<Region>, int dir);
- void ripple (framepos_t at, framecnt_t distance, RegionList *exclude);
- void ripple (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude) {
+ void ripple (samplepos_t at, samplecnt_t distance, RegionList *exclude);
+ void ripple (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude) {
RegionList el;
if (exclude)
el.push_back (exclude);
@@ -168,29 +168,29 @@ public:
boost::shared_ptr<Playlist> cut (std::list<AudioRange>&, bool result_is_hidden = true);
boost::shared_ptr<Playlist> copy (std::list<AudioRange>&, bool result_is_hidden = true);
- int paste (boost::shared_ptr<Playlist>, framepos_t position, float times, const int32_t sub_num);
+ int paste (boost::shared_ptr<Playlist>, samplepos_t position, float times, const int32_t sub_num);
const RegionListProperty& region_list_property () const { return regions; }
boost::shared_ptr<RegionList> region_list();
- boost::shared_ptr<RegionList> regions_at (framepos_t frame);
- uint32_t count_regions_at (framepos_t) const;
- boost::shared_ptr<RegionList> regions_touched (framepos_t start, framepos_t end);
- boost::shared_ptr<RegionList> regions_with_start_within (Evoral::Range<framepos_t>);
- boost::shared_ptr<RegionList> regions_with_end_within (Evoral::Range<framepos_t>);
+ boost::shared_ptr<RegionList> regions_at (samplepos_t sample);
+ uint32_t count_regions_at (samplepos_t) const;
+ boost::shared_ptr<RegionList> regions_touched (samplepos_t start, samplepos_t end);
+ boost::shared_ptr<RegionList> regions_with_start_within (Evoral::Range<samplepos_t>);
+ boost::shared_ptr<RegionList> regions_with_end_within (Evoral::Range<samplepos_t>);
uint32_t region_use_count (boost::shared_ptr<Region>) const;
boost::shared_ptr<Region> find_region (const PBD::ID&) const;
- boost::shared_ptr<Region> top_region_at (framepos_t frame);
- boost::shared_ptr<Region> top_unmuted_region_at (framepos_t frame);
- boost::shared_ptr<Region> find_next_region (framepos_t frame, RegionPoint point, int dir);
- framepos_t find_next_region_boundary (framepos_t frame, int dir);
+ boost::shared_ptr<Region> top_region_at (samplepos_t sample);
+ boost::shared_ptr<Region> top_unmuted_region_at (samplepos_t sample);
+ boost::shared_ptr<Region> find_next_region (samplepos_t sample, RegionPoint point, int dir);
+ samplepos_t find_next_region_boundary (samplepos_t sample, int dir);
bool region_is_shuffle_constrained (boost::shared_ptr<Region>);
- bool has_region_at (framepos_t const) const;
+ bool has_region_at (samplepos_t const) const;
bool uses_source (boost::shared_ptr<const Source> src, bool shallow = false) const;
void deep_sources (std::set<boost::shared_ptr<Source> >&) const;
- framepos_t find_next_transient (framepos_t position, int dir);
+ samplepos_t find_next_transient (samplepos_t position, int dir);
void foreach_region (boost::function<void (boost::shared_ptr<Region>)>);
@@ -206,12 +206,12 @@ public:
PBD::Signal0<void> LayeringChanged;
/** Emitted when regions have moved (not when regions have only been trimmed) */
- PBD::Signal2<void,std::list< Evoral::RangeMove<framepos_t> > const &, bool> RangesMoved;
+ PBD::Signal2<void,std::list< Evoral::RangeMove<samplepos_t> > const &, bool> RangesMoved;
/** Emitted when regions are extended; the ranges passed are the new extra time ranges
that these regions now occupy.
*/
- PBD::Signal1<void,std::list< Evoral::Range<framepos_t> > const &> RegionsExtended;
+ PBD::Signal1<void,std::list< Evoral::Range<samplepos_t> > const &> RegionsExtended;
static std::string bump_name (std::string old_name, Session&);
@@ -242,7 +242,7 @@ public:
return boost::shared_ptr<Crossfade> ();
}
- framepos_t find_next_top_layer_position (framepos_t) const;
+ samplepos_t find_next_top_layer_position (samplepos_t) const;
uint32_t combine_ops() const { return _combine_ops; }
void set_layer (boost::shared_ptr<Region>, double);
@@ -298,9 +298,9 @@ public:
* region trims are not included in this list; it is used to
* do automation-follows-regions.
*/
- std::list< Evoral::RangeMove<framepos_t> > pending_range_moves;
+ std::list< Evoral::RangeMove<samplepos_t> > pending_range_moves;
/** Extra sections added to regions during trims */
- std::list< Evoral::Range<framepos_t> > pending_region_extensions;
+ std::list< Evoral::Range<samplepos_t> > pending_region_extensions;
uint32_t in_set_state;
bool in_undo;
bool first_set_state;
@@ -334,7 +334,7 @@ public:
void _set_sort_id ();
- boost::shared_ptr<RegionList> regions_touched_locked (framepos_t start, framepos_t end);
+ boost::shared_ptr<RegionList> regions_touched_locked (samplepos_t start, samplepos_t end);
void notify_region_removed (boost::shared_ptr<Region>);
void notify_region_added (boost::shared_ptr<Region>);
@@ -355,16 +355,16 @@ public:
void sort_regions ();
- void possibly_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>());
- void possibly_splice_unlocked(framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>());
+ void possibly_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>());
+ void possibly_splice_unlocked(samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>());
- void core_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude);
- void splice_locked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude);
- void splice_unlocked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude);
+ void core_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude);
+ void splice_locked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude);
+ void splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude);
- void core_ripple (framepos_t at, framecnt_t distance, RegionList *exclude);
- void ripple_locked (framepos_t at, framecnt_t distance, RegionList *exclude);
- void ripple_unlocked (framepos_t at, framecnt_t distance, RegionList *exclude);
+ void core_ripple (samplepos_t at, samplecnt_t distance, RegionList *exclude);
+ void ripple_locked (samplepos_t at, samplecnt_t distance, RegionList *exclude);
+ void ripple_unlocked (samplepos_t at, samplecnt_t distance, RegionList *exclude);
virtual void remove_dependents (boost::shared_ptr<Region> /*region*/) {}
@@ -372,25 +372,25 @@ public:
virtual XMLNode& state (bool);
- bool add_region_internal (boost::shared_ptr<Region>, framepos_t position, int32_t sub_num = 0, double quarter_note = 0.0, bool for_music = false);
+ bool add_region_internal (boost::shared_ptr<Region>, samplepos_t position, int32_t sub_num = 0, double quarter_note = 0.0, bool for_music = false);
int remove_region_internal (boost::shared_ptr<Region>);
void copy_regions (RegionList&) const;
- void partition_internal (framepos_t start, framepos_t end, bool cutting, RegionList& thawlist);
+ void partition_internal (samplepos_t start, samplepos_t end, bool cutting, RegionList& thawlist);
- std::pair<framepos_t, framepos_t> _get_extent() const;
+ std::pair<samplepos_t, samplepos_t> _get_extent() const;
- boost::shared_ptr<Playlist> cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(framepos_t, framecnt_t, bool),
+ boost::shared_ptr<Playlist> cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(samplepos_t, samplecnt_t, bool),
std::list<AudioRange>& ranges, bool result_is_hidden);
- boost::shared_ptr<Playlist> cut (framepos_t start, framecnt_t cnt, bool result_is_hidden);
- boost::shared_ptr<Playlist> copy (framepos_t start, framecnt_t cnt, bool result_is_hidden);
+ boost::shared_ptr<Playlist> cut (samplepos_t start, samplecnt_t cnt, bool result_is_hidden);
+ boost::shared_ptr<Playlist> copy (samplepos_t start, samplecnt_t cnt, bool result_is_hidden);
void relayer ();
void begin_undo ();
void end_undo ();
- virtual void _split_region (boost::shared_ptr<Region>, const MusicFrame& position);
+ virtual void _split_region (boost::shared_ptr<Region>, const MusicSample& position);
typedef std::pair<boost::shared_ptr<Region>, boost::shared_ptr<Region> > TwoRegions;
@@ -410,10 +410,10 @@ public:
private:
void setup_layering_indices (RegionList const &);
- void coalesce_and_check_crossfades (std::list<Evoral::Range<framepos_t> >);
- boost::shared_ptr<RegionList> find_regions_at (framepos_t);
+ void coalesce_and_check_crossfades (std::list<Evoral::Range<samplepos_t> >);
+ boost::shared_ptr<RegionList> find_regions_at (samplepos_t);
- framepos_t _end_space; //this is used when we are pasting a range with extra space at the end
+ samplepos_t _end_space; //this is used when we are pasting a range with extra space at the end
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/playlist_factory.h b/libs/ardour/ardour/playlist_factory.h
index 505836234b..4fbef45be2 100644
--- a/libs/ardour/ardour/playlist_factory.h
+++ b/libs/ardour/ardour/playlist_factory.h
@@ -36,7 +36,7 @@ class LIBARDOUR_API PlaylistFactory {
static boost::shared_ptr<Playlist> create (Session&, const XMLNode&, bool hidden = false, bool unused = false);
static boost::shared_ptr<Playlist> create (DataType type, Session&, std::string name, bool hidden = false);
static boost::shared_ptr<Playlist> create (boost::shared_ptr<const Playlist>, std::string name, bool hidden = false);
- static boost::shared_ptr<Playlist> create (boost::shared_ptr<const Playlist>, framepos_t start, framecnt_t cnt, std::string name, bool hidden = false);
+ static boost::shared_ptr<Playlist> create (boost::shared_ptr<const Playlist>, samplepos_t start, samplecnt_t cnt, std::string name, bool hidden = false);
};
}
diff --git a/libs/ardour/ardour/playlist_source.h b/libs/ardour/ardour/playlist_source.h
index 55cc1f6b59..6316b4dcdd 100644
--- a/libs/ardour/ardour/playlist_source.h
+++ b/libs/ardour/ardour/playlist_source.h
@@ -42,11 +42,11 @@ public:
protected:
boost::shared_ptr<Playlist> _playlist;
PBD::ID _original;
- frameoffset_t _playlist_offset;
- framecnt_t _playlist_length;
+ sampleoffset_t _playlist_offset;
+ samplecnt_t _playlist_length;
PlaylistSource (Session&, const PBD::ID&, const std::string& name, boost::shared_ptr<Playlist>, DataType,
- frameoffset_t begin, framecnt_t len, Source::Flag flags);
+ sampleoffset_t begin, samplecnt_t len, Source::Flag flags);
PlaylistSource (Session&, const XMLNode&);
void add_state (XMLNode&);
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index f51f34b099..e9738a61f1 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -114,9 +114,9 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent
virtual bool inplace_broken() const { return false; }
virtual int connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset);
+ pframes_t nframes, samplecnt_t offset);
virtual std::set<Evoral::Parameter> automatable() const = 0;
virtual std::string describe_parameter (Evoral::Parameter) = 0;
@@ -249,7 +249,7 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent
}
/** the max possible latency a plugin will have */
- virtual framecnt_t max_latency () const { return 0; } // TODO = 0, require implementation
+ virtual samplecnt_t max_latency () const { return 0; } // TODO = 0, require implementation
/** Emitted when a preset is added or removed, respectively */
PBD::Signal0<void> PresetAdded;
@@ -383,7 +383,7 @@ private:
PBD::ScopedConnection _preset_connection;
- MidiRingBuffer<framepos_t> _immediate_events;
+ MidiRingBuffer<samplepos_t> _immediate_events;
void resolve_midi ();
};
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index a40cdc1bea..1076c5198f 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -63,8 +63,8 @@ class LIBARDOUR_API PluginInsert : public Processor
void set_owner (SessionObject*);
void set_state_dir (const std::string& d = "");
- void run (BufferSet& in, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
- void silence (framecnt_t nframes, framepos_t start_frame);
+ void run (BufferSet& in, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
+ void silence (samplecnt_t nframes, samplepos_t start_sample);
void activate ();
void deactivate ();
@@ -231,7 +231,7 @@ class LIBARDOUR_API PluginInsert : public Processor
}
}
- framecnt_t plugin_latency () const;
+ samplecnt_t plugin_latency () const;
bool has_sidechain () const {
return _sidechain ? true : false;
@@ -250,11 +250,11 @@ class LIBARDOUR_API PluginInsert : public Processor
std::string describe_parameter (Evoral::Parameter param);
- framecnt_t signal_latency () const;
+ samplecnt_t signal_latency () const;
boost::shared_ptr<Plugin> get_impulse_analysis_plugin();
- void collect_signal_for_analysis (framecnt_t nframes);
+ void collect_signal_for_analysis (samplecnt_t nframes);
bool strict_io_configured () const {
return _match.strict_io;
@@ -321,8 +321,8 @@ class LIBARDOUR_API PluginInsert : public Processor
boost::weak_ptr<Plugin> _impulseAnalysisPlugin;
- framecnt_t _signal_analysis_collected_nframes;
- framecnt_t _signal_analysis_collect_nframes_max;
+ samplecnt_t _signal_analysis_collected_nframes;
+ samplecnt_t _signal_analysis_collect_nframes_max;
BufferSet _signal_analysis_inputs;
BufferSet _signal_analysis_outputs;
@@ -357,10 +357,10 @@ class LIBARDOUR_API PluginInsert : public Processor
PinMappings _out_map;
ChanMapping _thru_map; // out-idx <= in-idx
- void automate_and_run (BufferSet& bufs, framepos_t start, framepos_t end, double speed, pframes_t nframes);
- void connect_and_run (BufferSet& bufs, framepos_t start, framecnt_t end, double speed, pframes_t nframes, framecnt_t offset, bool with_auto);
+ void automate_and_run (BufferSet& bufs, samplepos_t start, samplepos_t end, double speed, pframes_t nframes);
+ void connect_and_run (BufferSet& bufs, samplepos_t start, samplecnt_t end, double speed, pframes_t nframes, samplecnt_t offset, bool with_auto);
void bypass (BufferSet& bufs, pframes_t nframes);
- void inplace_silence_unconnected (BufferSet&, const PinMappings&, framecnt_t nframes, framecnt_t offset) const;
+ void inplace_silence_unconnected (BufferSet&, const PinMappings&, samplecnt_t nframes, samplecnt_t offset) const;
void create_automatable_parameters ();
void control_list_automation_state_changed (Evoral::Parameter, AutoState);
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h
index 288dddee43..e59df0cb03 100644
--- a/libs/ardour/ardour/port.h
+++ b/libs/ardour/ardour/port.h
@@ -127,10 +127,10 @@ public:
static PBD::Signal0<void> PortDrop;
static PBD::Signal0<void> PortSignalDrop;
- static void set_cycle_framecnt (pframes_t n) {
+ static void set_cycle_samplecnt (pframes_t n) {
_cycle_nframes = n;
}
- static framecnt_t port_offset() { return _global_port_buffer_offset; }
+ static samplecnt_t port_offset() { return _global_port_buffer_offset; }
static void set_global_port_buffer_offset (pframes_t off) {
_global_port_buffer_offset = off;
}
@@ -155,7 +155,7 @@ protected:
static pframes_t _global_port_buffer_offset; /* access only from process() tree */
static pframes_t _cycle_nframes; /* access only from process() tree */
- framecnt_t _port_buffer_offset; /* access only from process() tree */
+ samplecnt_t _port_buffer_offset; /* access only from process() tree */
LatencyRange _private_playback_latency;
LatencyRange _private_capture_latency;
diff --git a/libs/ardour/ardour/port_engine.h b/libs/ardour/ardour/port_engine.h
index 647253baea..88935671a2 100644
--- a/libs/ardour/ardour/port_engine.h
+++ b/libs/ardour/ardour/port_engine.h
@@ -366,7 +366,7 @@ class LIBARDOUR_API PortEngine {
*
* XXX to be removed after some more design cleanup.
*/
- virtual framepos_t sample_time_at_cycle_start () = 0;
+ virtual samplepos_t sample_time_at_cycle_start () = 0;
protected:
PortManager& manager;
diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h
index 0b1b3fbc00..2461f8a90f 100644
--- a/libs/ardour/ardour/port_insert.h
+++ b/libs/ardour/ardour/port_insert.h
@@ -53,13 +53,13 @@ class LIBARDOUR_API PortInsert : public IOProcessor
XMLNode& get_state(void);
int set_state (const XMLNode&, int version);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
- void flush_buffers (framecnt_t nframes) {
+ void flush_buffers (samplecnt_t nframes) {
_out->flush_buffers (nframes);
}
- framecnt_t signal_latency () const;
+ samplecnt_t signal_latency () const;
bool set_name (const std::string& name);
@@ -77,8 +77,8 @@ class LIBARDOUR_API PortInsert : public IOProcessor
void stop_latency_detection ();
MTDM* mtdm () const { return _mtdm; }
- void set_measured_latency (framecnt_t);
- framecnt_t latency () const;
+ void set_measured_latency (samplecnt_t);
+ samplecnt_t latency () const;
static std::string name_and_id_new_insert (Session&, uint32_t&);
@@ -91,8 +91,8 @@ class LIBARDOUR_API PortInsert : public IOProcessor
uint32_t _bitslot;
MTDM* _mtdm;
bool _latency_detect;
- framecnt_t _latency_flush_frames;
- framecnt_t _measured_latency;
+ samplecnt_t _latency_flush_samples;
+ samplecnt_t _measured_latency;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h
index 095ab7fadf..fb77943a34 100644
--- a/libs/ardour/ardour/processor.h
+++ b/libs/ardour/ardour/processor.h
@@ -68,10 +68,10 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
bool get_next_ab_is_active () const { return _next_ab_is_active; }
void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; }
- virtual framecnt_t signal_latency() const { return 0; }
+ virtual samplecnt_t signal_latency() const { return 0; }
- virtual void set_input_latency (framecnt_t);
- framecnt_t input_latency () const { return _input_latency; }
+ virtual void set_input_latency (samplecnt_t);
+ samplecnt_t input_latency () const { return _input_latency; }
virtual int set_block_size (pframes_t /*nframes*/) { return 0; }
virtual bool requires_fixed_sized_buffers() const { return false; }
@@ -79,8 +79,8 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
/** @param result_required true if, on return from this method, @a bufs is required to contain valid data;
* if false, the method need not bother writing to @a bufs if it doesn't want to.
*/
- virtual void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double speed, pframes_t /*nframes*/, bool /*result_required*/) {}
- virtual void silence (framecnt_t nframes, framepos_t start_frame) { automation_run (start_frame, nframes); }
+ virtual void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/) {}
+ virtual void silence (samplecnt_t nframes, samplepos_t start_sample) { automation_run (start_sample, nframes); }
virtual void activate () { _pending_active = true; ActiveChanged(); }
virtual void deactivate () { _pending_active = false; ActiveChanged(); }
@@ -152,7 +152,7 @@ protected:
ProcessorWindowProxy *_window_proxy;
PluginPinWindowProxy *_pinmgr_proxy;
SessionObject* _owner;
- framecnt_t _input_latency;
+ samplecnt_t _input_latency;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h
index b0d8cf192e..fd4d014c59 100644
--- a/libs/ardour/ardour/rc_configuration_vars.h
+++ b/libs/ardour/ardour/rc_configuration_vars.h
@@ -58,7 +58,7 @@ CONFIG_VARIABLE (int32_t, mmc_receive_device_id, "mmc-receive-device-id", 0x7f)
CONFIG_VARIABLE (int32_t, mmc_send_device_id, "mmc-send-device-id", 0)
CONFIG_VARIABLE (int32_t, initial_program_change, "initial-program-change", -1)
CONFIG_VARIABLE (bool, first_midi_bank_is_zero, "display-first-midi-bank-as-zero", false)
-CONFIG_VARIABLE (int32_t, inter_scene_gap_frames, "inter-scene-gap-frames", 1)
+CONFIG_VARIABLE (int32_t, inter_scene_gap_samples, "inter-scene-gap-samples", 1)
CONFIG_VARIABLE (bool, midi_input_follows_selection, "midi-input-follows-selection", 1)
/* Timecode and related */
@@ -89,8 +89,8 @@ CONFIG_VARIABLE (bool, use_tranzport, "use-tranzport", false)
/* disk operations */
- CONFIG_VARIABLE (uint32_t, minimum_disk_read_bytes, "minimum-disk-read-bytes", ARDOUR::DiskReader::default_chunk_frames() * sizeof (ARDOUR::Sample))
-CONFIG_VARIABLE (uint32_t, minimum_disk_write_bytes, "minimum-disk-write-bytes", ARDOUR::DiskWriter::default_chunk_frames() * sizeof (ARDOUR::Sample))
+ CONFIG_VARIABLE (uint32_t, minimum_disk_read_bytes, "minimum-disk-read-bytes", ARDOUR::DiskReader::default_chunk_samples() * sizeof (ARDOUR::Sample))
+CONFIG_VARIABLE (uint32_t, minimum_disk_write_bytes, "minimum-disk-write-bytes", ARDOUR::DiskWriter::default_chunk_samples() * sizeof (ARDOUR::Sample))
CONFIG_VARIABLE (float, midi_readahead, "midi-readahead", 1.0)
CONFIG_VARIABLE (BufferingPreset, buffering_preset, "buffering-preset", Medium)
CONFIG_VARIABLE (float, audio_capture_buffer_seconds, "capture-buffer-seconds", 5.0)
@@ -170,8 +170,8 @@ CONFIG_VARIABLE (bool, loop_is_mode, "loop-is-mode", true)
#else
CONFIG_VARIABLE (bool, loop_is_mode, "loop-is-mode", false)
#endif
-CONFIG_VARIABLE (framecnt_t, preroll, "preroll", 0)
-CONFIG_VARIABLE (framecnt_t, postroll, "postroll", 0)
+CONFIG_VARIABLE (samplecnt_t, preroll, "preroll", 0)
+CONFIG_VARIABLE (samplecnt_t, postroll, "postroll", 0)
CONFIG_VARIABLE (float, rf_speed, "rf-speed", 2.0f)
CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) // used for MMC shuttle
CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) // used for MMC shuttle
@@ -230,7 +230,7 @@ CONFIG_VARIABLE (uint32_t, max_recent_sessions, "max-recent-sessions", 10)
CONFIG_VARIABLE (uint32_t, max_recent_templates, "max-recent-templates", 10)
CONFIG_VARIABLE (double, automation_thinning_factor, "automation-thinning-factor", 20.0)
CONFIG_VARIABLE (std::string, freesound_download_dir, "freesound-download-dir", Glib::get_home_dir() + "/Freesound/snd")
-CONFIG_VARIABLE (framecnt_t, range_location_minimum, "range-location-minimum", 128) /* samples */
+CONFIG_VARIABLE (samplecnt_t, range_location_minimum, "range-location-minimum", 128) /* samples */
CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide)
/* plugin related */
diff --git a/libs/ardour/ardour/readable.h b/libs/ardour/ardour/readable.h
index 4098e26e40..2c84fc0431 100644
--- a/libs/ardour/ardour/readable.h
+++ b/libs/ardour/ardour/readable.h
@@ -30,8 +30,8 @@ class LIBARDOUR_API Readable {
Readable () {}
virtual ~Readable() {}
- virtual framecnt_t read (Sample*, framepos_t pos, framecnt_t cnt, int channel) const = 0;
- virtual framecnt_t readable_length() const = 0;
+ virtual samplecnt_t read (Sample*, samplepos_t pos, samplecnt_t cnt, int channel) const = 0;
+ virtual samplecnt_t readable_length() const = 0;
virtual uint32_t n_channels () const = 0;
};
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index c49d8c86cb..1ae75d1469 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -55,14 +55,14 @@ namespace Properties {
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> hidden;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> position_locked;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> valid_transients;
- LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> start;
- LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> length;
- LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> position;
+ LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> start;
+ LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> length;
+ LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> position;
LIBARDOUR_API extern PBD::PropertyDescriptor<double> beat;
- LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> sync_position;
+ LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> sync_position;
LIBARDOUR_API extern PBD::PropertyDescriptor<layer_t> layer;
- LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> ancestral_start;
- LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> ancestral_length;
+ LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> ancestral_start;
+ LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> ancestral_length;
LIBARDOUR_API extern PBD::PropertyDescriptor<float> stretch;
LIBARDOUR_API extern PBD::PropertyDescriptor<float> shift;
LIBARDOUR_API extern PBD::PropertyDescriptor<PositionLockStyle> position_lock_style;
@@ -104,56 +104,56 @@ class LIBARDOUR_API Region
/** How the region parameters play together:
*
- * POSITION: first frame of the region along the timeline
- * START: first frame of the region within its source(s)
- * LENGTH: number of frames the region represents
+ * POSITION: first sample of the region along the timeline
+ * START: first sample of the region within its source(s)
+ * LENGTH: number of samples the region represents
*/
- framepos_t position () const { return _position; }
- framepos_t start () const { return _start; }
- framecnt_t length () const { return _length; }
+ samplepos_t position () const { return _position; }
+ samplepos_t start () const { return _start; }
+ samplecnt_t length () const { return _length; }
layer_t layer () const { return _layer; }
- framecnt_t source_length(uint32_t n) const;
+ samplecnt_t source_length(uint32_t n) const;
uint32_t max_source_level () const;
/* these two are valid ONLY during a StateChanged signal handler */
- framepos_t last_position () const { return _last_position; }
- framecnt_t last_length () const { return _last_length; }
+ samplepos_t last_position () const { return _last_position; }
+ samplecnt_t last_length () const { return _last_length; }
- framepos_t ancestral_start () const { return _ancestral_start; }
- framecnt_t ancestral_length () const { return _ancestral_length; }
+ samplepos_t ancestral_start () const { return _ancestral_start; }
+ samplecnt_t ancestral_length () const { return _ancestral_length; }
float stretch () const { return _stretch; }
float shift () const { return _shift; }
- void set_ancestral_data (framepos_t start, framecnt_t length, float stretch, float shift);
+ void set_ancestral_data (samplepos_t start, samplecnt_t length, float stretch, float shift);
- frameoffset_t sync_offset (int& dir) const;
- framepos_t sync_position () const;
+ sampleoffset_t sync_offset (int& dir) const;
+ samplepos_t sync_position () const;
- framepos_t adjust_to_sync (framepos_t) const;
+ samplepos_t adjust_to_sync (samplepos_t) const;
- /* first_frame() is an alias; last_frame() just hides some math */
+ /* first_sample() is an alias; last_sample() just hides some math */
- framepos_t first_frame () const { return _position; }
- framepos_t last_frame () const { return _position + _length - 1; }
+ samplepos_t first_sample () const { return _position; }
+ samplepos_t last_sample () const { return _position + _length - 1; }
/** Return the earliest possible value of _position given the
* value of _start within the region's sources
*/
- framepos_t earliest_possible_position () const;
- /** Return the last possible value of _last_frame given the
+ samplepos_t earliest_possible_position () const;
+ /** Return the last possible value of _last_sample given the
* value of _startin the regions's sources
*/
- framepos_t latest_possible_frame () const;
+ samplepos_t latest_possible_sample () const;
- Evoral::Range<framepos_t> last_range () const {
- return Evoral::Range<framepos_t> (_last_position, _last_position + _last_length - 1);
+ Evoral::Range<samplepos_t> last_range () const {
+ return Evoral::Range<samplepos_t> (_last_position, _last_position + _last_length - 1);
}
- Evoral::Range<framepos_t> range () const {
- return Evoral::Range<framepos_t> (first_frame(), last_frame());
+ Evoral::Range<samplepos_t> range () const {
+ return Evoral::Range<samplepos_t> (first_sample(), last_sample());
}
bool hidden () const { return _hidden; }
@@ -185,8 +185,8 @@ class LIBARDOUR_API Region
void suspend_property_changes ();
- bool covers (framepos_t frame) const {
- return first_frame() <= frame && frame <= last_frame();
+ bool covers (samplepos_t sample) const {
+ return first_sample() <= sample && sample <= last_sample();
}
/** @return coverage of this region with the given range;
@@ -195,8 +195,8 @@ class LIBARDOUR_API Region
* OverlapEnd: the range overlaps the end of this region.
* OverlapExternal: the range overlaps all of this region.
*/
- Evoral::OverlapType coverage (framepos_t start, framepos_t end) const {
- return Evoral::coverage (first_frame(), last_frame(), start, end);
+ Evoral::OverlapType coverage (samplepos_t start, samplepos_t end) const {
+ return Evoral::coverage (first_sample(), last_sample(), start, end);
}
bool equivalent (boost::shared_ptr<const Region>) const;
@@ -213,27 +213,27 @@ class LIBARDOUR_API Region
/* EDITING OPERATIONS */
- void set_length (framecnt_t, const int32_t sub_num);
- void set_start (framepos_t);
- void set_position (framepos_t, int32_t sub_num = 0);
+ void set_length (samplecnt_t, const int32_t sub_num);
+ void set_start (samplepos_t);
+ void set_position (samplepos_t, int32_t sub_num = 0);
void set_position_music (double qn);
- void set_initial_position (framepos_t);
- void special_set_position (framepos_t);
+ void set_initial_position (samplepos_t);
+ void special_set_position (samplepos_t);
virtual void update_after_tempo_map_change (bool send_change = true);
- void nudge_position (frameoffset_t);
+ void nudge_position (sampleoffset_t);
bool at_natural_position () const;
void move_to_natural_position ();
- void move_start (frameoffset_t distance, const int32_t sub_num = 0);
- void trim_front (framepos_t new_position, const int32_t sub_num = 0);
- void trim_end (framepos_t new_position, const int32_t sub_num = 0);
- void trim_to (framepos_t position, framecnt_t length, const int32_t sub_num = 0);
+ void move_start (sampleoffset_t distance, const int32_t sub_num = 0);
+ void trim_front (samplepos_t new_position, const int32_t sub_num = 0);
+ void trim_end (samplepos_t new_position, const int32_t sub_num = 0);
+ void trim_to (samplepos_t position, samplecnt_t length, const int32_t sub_num = 0);
- virtual void fade_range (framepos_t, framepos_t) {}
+ virtual void fade_range (samplepos_t, samplepos_t) {}
- void cut_front (framepos_t new_position, const int32_t sub_num = 0);
- void cut_end (framepos_t new_position, const int32_t sub_num = 0);
+ void cut_front (samplepos_t new_position, const int32_t sub_num = 0);
+ void cut_end (samplepos_t new_position, const int32_t sub_num = 0);
void set_layer (layer_t l); /* ONLY Playlist can call this */
void raise ();
@@ -241,7 +241,7 @@ class LIBARDOUR_API Region
void raise_to_top ();
void lower_to_bottom ();
- void set_sync_position (framepos_t n);
+ void set_sync_position (samplepos_t n);
void clear_sync_position ();
void set_hidden (bool yn);
void set_muted (bool yn);
@@ -292,7 +292,7 @@ class LIBARDOUR_API Region
virtual bool is_dependent() const { return false; }
virtual bool depends_on (boost::shared_ptr<Region> /*other*/) const { return false; }
- virtual void add_transient (framepos_t) {
+ virtual void add_transient (samplepos_t) {
// no transients, but its OK
}
@@ -300,11 +300,11 @@ class LIBARDOUR_API Region
// no transients, but its OK
}
- virtual void update_transient (framepos_t /* old_position */, framepos_t /* new_position */) {
+ virtual void update_transient (samplepos_t /* old_position */, samplepos_t /* new_position */) {
// no transients, but its OK
}
- virtual void remove_transient (framepos_t /* where */) {
+ virtual void remove_transient (samplepos_t /* where */) {
// no transients, but its OK
}
@@ -354,13 +354,13 @@ class LIBARDOUR_API Region
Region (boost::shared_ptr<const Region>);
/** Construct a region from another region, at an offset within that region */
- Region (boost::shared_ptr<const Region>, ARDOUR::MusicFrame start_offset);
+ Region (boost::shared_ptr<const Region>, ARDOUR::MusicSample start_offset);
/** Construct a region as a copy of another region, but with different sources */
Region (boost::shared_ptr<const Region>, const SourceList&);
/** Constructor for derived types only */
- Region (Session& s, framepos_t start, framecnt_t length, const std::string& name, DataType);
+ Region (Session& s, samplepos_t start, samplecnt_t length, const std::string& name, DataType);
virtual bool can_trim_start_before_source_start () const {
return false;
@@ -371,11 +371,11 @@ class LIBARDOUR_API Region
void send_change (const PBD::PropertyChange&);
virtual int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal);
void post_set (const PBD::PropertyChange&);
- virtual void set_position_internal (framepos_t pos, bool allow_bbt_recompute, const int32_t sub_num);
+ virtual void set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num);
virtual void set_position_music_internal (double qn);
- virtual void set_length_internal (framecnt_t, const int32_t sub_num);
- virtual void set_start_internal (framecnt_t, const int32_t sub_num = 0);
- bool verify_start_and_length (framepos_t, framecnt_t&);
+ virtual void set_length_internal (samplecnt_t, const int32_t sub_num);
+ virtual void set_start_internal (samplecnt_t, const int32_t sub_num = 0);
+ bool verify_start_and_length (samplepos_t, samplecnt_t&);
void first_edit ();
DataType _type;
@@ -384,12 +384,12 @@ class LIBARDOUR_API Region
PBD::Property<bool> _left_of_split;
PBD::Property<bool> _right_of_split;
PBD::Property<bool> _valid_transients;
- PBD::Property<framepos_t> _start;
- PBD::Property<framecnt_t> _length;
- PBD::Property<framepos_t> _position;
+ PBD::Property<samplepos_t> _start;
+ PBD::Property<samplecnt_t> _length;
+ PBD::Property<samplepos_t> _position;
PBD::Property<double> _beat;
/** Sync position relative to the start of our file */
- PBD::Property<framepos_t> _sync_position;
+ PBD::Property<samplepos_t> _sync_position;
double _quarter_note;
@@ -399,31 +399,31 @@ class LIBARDOUR_API Region
boost::weak_ptr<ARDOUR::Playlist> _playlist;
- void merge_features (AnalysisFeatureList&, const AnalysisFeatureList&, const frameoffset_t) const;
+ void merge_features (AnalysisFeatureList&, const AnalysisFeatureList&, const sampleoffset_t) const;
AnalysisFeatureList _onsets; // used by the Ferret (Aubio OnsetDetector)
// _transient_user_start is covered by _valid_transients
AnalysisFeatureList _user_transients; // user added
- framepos_t _transient_user_start; // region's _start relative to user_transients
+ samplepos_t _transient_user_start; // region's _start relative to user_transients
// these are used by Playlist::find_next_transient() in absence of onsets
AnalysisFeatureList _transients; // Source Analysis (QM Transient), user read-only
- framepos_t _transient_analysis_start;
- framepos_t _transient_analysis_end;
+ samplepos_t _transient_analysis_start;
+ samplepos_t _transient_analysis_end;
private:
void mid_thaw (const PBD::PropertyChange&);
- virtual void trim_to_internal (framepos_t position, framecnt_t length, const int32_t sub_num);
- void modify_front (framepos_t new_position, bool reset_fade, const int32_t sub_num);
- void modify_end (framepos_t new_position, bool reset_fade, const int32_t sub_num);
+ virtual void trim_to_internal (samplepos_t position, samplecnt_t length, const int32_t sub_num);
+ void modify_front (samplepos_t new_position, bool reset_fade, const int32_t sub_num);
+ void modify_end (samplepos_t new_position, bool reset_fade, const int32_t sub_num);
void maybe_uncopy ();
- bool verify_start (framepos_t);
- bool verify_start_mutable (framepos_t&_start);
- bool verify_length (framecnt_t&);
+ bool verify_start (samplepos_t);
+ bool verify_start_mutable (samplepos_t&_start);
+ bool verify_length (samplecnt_t&);
virtual void recompute_at_start () = 0;
virtual void recompute_at_end () = 0;
@@ -438,15 +438,15 @@ class LIBARDOUR_API Region
PBD::Property<bool> _external;
PBD::Property<bool> _hidden;
PBD::Property<bool> _position_locked;
- PBD::Property<framepos_t> _ancestral_start;
- PBD::Property<framecnt_t> _ancestral_length;
+ PBD::Property<samplepos_t> _ancestral_start;
+ PBD::Property<samplecnt_t> _ancestral_length;
PBD::Property<float> _stretch;
PBD::Property<float> _shift;
PBD::EnumProperty<PositionLockStyle> _position_lock_style;
PBD::Property<uint64_t> _layering_index;
- framecnt_t _last_length;
- framepos_t _last_position;
+ samplecnt_t _last_length;
+ samplepos_t _last_position;
mutable RegionEditState _first_edit;
layer_t _layer;
diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h
index edfbfba6f0..c661fed019 100644
--- a/libs/ardour/ardour/region_factory.h
+++ b/libs/ardour/ardour/region_factory.h
@@ -75,7 +75,7 @@ public:
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other,
const PBD::PropertyList&, bool announce = true);
/** create a copy of @param other starting at @param offset within @param other */
- static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, ARDOUR::MusicFrame offset,
+ static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, ARDOUR::MusicSample offset,
const PBD::PropertyList&, bool announce = true);
/** create a "copy" of @param other but using a different set of sources @param srcs */
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const SourceList& srcs,
diff --git a/libs/ardour/ardour/resampled_source.h b/libs/ardour/ardour/resampled_source.h
index 0c90581a29..2bf002befe 100644
--- a/libs/ardour/ardour/resampled_source.h
+++ b/libs/ardour/ardour/resampled_source.h
@@ -31,17 +31,17 @@ namespace ARDOUR {
class LIBARDOUR_API ResampledImportableSource : public ImportableSource
{
public:
- ResampledImportableSource (boost::shared_ptr<ImportableSource>, framecnt_t rate, SrcQuality);
+ ResampledImportableSource (boost::shared_ptr<ImportableSource>, samplecnt_t rate, SrcQuality);
~ResampledImportableSource ();
- framecnt_t read (Sample* buffer, framecnt_t nframes);
+ samplecnt_t read (Sample* buffer, samplecnt_t nframes);
float ratio() const { return _src_data.src_ratio; }
uint32_t channels() const { return source->channels(); }
- framecnt_t length() const { return source->length(); }
- framecnt_t samplerate() const { return source->samplerate(); }
- void seek (framepos_t);
- framepos_t natural_position() const;
+ samplecnt_t length() const { return source->length(); }
+ samplecnt_t samplerate() const { return source->samplerate(); }
+ void seek (samplepos_t);
+ samplepos_t natural_position() const;
bool clamped_at_unity () const {
/* resampling may generate inter-sample peaks with magnitude > 1 */
diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h
index d42a280ffb..18845f9815 100644
--- a/libs/ardour/ardour/return.h
+++ b/libs/ardour/ardour/return.h
@@ -42,7 +42,7 @@ public:
uint32_t bit_slot() const { return _bitslot; }
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
boost::shared_ptr<Amp> amp() const { return _amp; }
boost::shared_ptr<PeakMeter> meter() const { return _meter; }
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index dc693d3a7e..829ebd435b 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -133,26 +133,26 @@ public:
/* these are the core of the API of a Route. see the protected sections as well */
- virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ virtual int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
int declick, bool& need_butler);
- virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ virtual int no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
bool state_changing);
- virtual int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ virtual int silent_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
bool& need_butler);
virtual bool can_record() { return false; }
- virtual void non_realtime_transport_stop (framepos_t now, bool flush);
+ virtual void non_realtime_transport_stop (samplepos_t now, bool flush);
virtual void realtime_handle_transport_stopped () {}
virtual void realtime_locate () {}
- virtual void non_realtime_locate (framepos_t);
+ virtual void non_realtime_locate (samplepos_t);
virtual void set_pending_declick (int);
/* end of vfunc-based API */
- void shift (framepos_t, framecnt_t);
+ void shift (samplepos_t, samplecnt_t);
void set_trim (gain_t val, PBD::Controllable::GroupControlDisposition);
@@ -336,15 +336,15 @@ public:
*/
bool remove_sidechain (boost::shared_ptr<Processor> proc) { return add_remove_sidechain (proc, false); }
- framecnt_t set_private_port_latencies (bool playback) const;
- void set_public_port_latencies (framecnt_t, bool playback) const;
+ samplecnt_t set_private_port_latencies (bool playback) const;
+ void set_public_port_latencies (samplecnt_t, bool playback) const;
- framecnt_t update_signal_latency();
- virtual void set_latency_compensation (framecnt_t);
+ samplecnt_t update_signal_latency();
+ virtual void set_latency_compensation (samplecnt_t);
- void set_user_latency (framecnt_t);
- framecnt_t initial_delay() const { return _initial_delay; }
- framecnt_t signal_latency() const { return _signal_latency; }
+ void set_user_latency (samplecnt_t);
+ samplecnt_t initial_delay() const { return _initial_delay; }
+ samplecnt_t signal_latency() const { return _signal_latency; }
PBD::Signal0<void> active_changed;
PBD::Signal0<void> denormal_protection_changed;
@@ -582,7 +582,7 @@ public:
/* can only be executed by a route for which is_monitor() is true
* (i.e. the monitor out)
*/
- void monitor_run (framepos_t start_frame, framepos_t end_frame,
+ void monitor_run (samplepos_t start_sample, samplepos_t end_sample,
pframes_t nframes, int declick);
bool slaved_to (boost::shared_ptr<VCA>) const;
@@ -599,39 +599,39 @@ public:
void curve_reallocate ();
virtual void set_block_size (pframes_t nframes);
- virtual framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&) { return nframes; }
+ virtual samplecnt_t check_initial_delay (samplecnt_t nframes, samplepos_t&) { return nframes; }
void fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr<IO> io, pframes_t nframes);
- void passthru (BufferSet&, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick);
+ void passthru (BufferSet&, samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick);
- virtual void write_out_of_band_data (BufferSet& /* bufs */, framepos_t /* start_frame */, framepos_t /* end_frame */,
- framecnt_t /* nframes */) {}
+ virtual void write_out_of_band_data (BufferSet& /* bufs */, samplepos_t /* start_sample */, samplepos_t /* end_sample */,
+ samplecnt_t /* nframes */) {}
virtual void process_output_buffers (BufferSet& bufs,
- framepos_t start_frame, framepos_t end_frame,
+ samplepos_t start_sample, samplepos_t end_sample,
pframes_t nframes, int declick,
bool gain_automation_ok);
- void flush_processor_buffers_locked (framecnt_t nframes);
+ void flush_processor_buffers_locked (samplecnt_t nframes);
virtual void bounce_process (BufferSet& bufs,
- framepos_t start_frame, framecnt_t nframes,
+ samplepos_t start_sample, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint,
bool for_export, bool for_freeze);
- framecnt_t bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
+ samplecnt_t bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
ChanCount bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
boost::shared_ptr<IO> _input;
boost::shared_ptr<IO> _output;
bool _active;
- framecnt_t _signal_latency;
- framecnt_t _signal_latency_at_amp_position;
- framecnt_t _signal_latency_at_trim_position;
- framecnt_t _initial_delay;
- framecnt_t _roll_delay;
+ samplecnt_t _signal_latency;
+ samplecnt_t _signal_latency_at_amp_position;
+ samplecnt_t _signal_latency_at_trim_position;
+ samplecnt_t _initial_delay;
+ samplecnt_t _roll_delay;
ProcessorList _processors;
mutable Glib::Threads::RWLock _processor_lock;
@@ -686,11 +686,11 @@ public:
int configure_processors (ProcessorStreams*);
- void passthru_silence (framepos_t start_frame, framepos_t end_frame,
+ void passthru_silence (samplepos_t start_sample, samplepos_t end_sample,
pframes_t nframes, int declick);
- void silence (framecnt_t);
- void silence_unlocked (framecnt_t);
+ void silence (samplecnt_t);
+ void silence_unlocked (samplecnt_t);
ChanCount processor_max_streams;
ChanCount processor_out_streams;
@@ -698,7 +698,7 @@ public:
uint32_t pans_required() const;
ChanCount n_process_buffers ();
- virtual void maybe_declick (BufferSet&, framecnt_t, int);
+ virtual void maybe_declick (BufferSet&, samplecnt_t, int);
boost::shared_ptr<GainControl> _gain_control;
boost::shared_ptr<Amp> _amp;
@@ -746,7 +746,7 @@ private:
void set_self_solo (bool yn);
void set_processor_positions ();
- framecnt_t update_port_latencies (PortSet& ports, PortSet& feeders, bool playback, framecnt_t) const;
+ samplecnt_t update_port_latencies (PortSet& ports, PortSet& feeders, bool playback, samplecnt_t) const;
void setup_invisible_processors ();
diff --git a/libs/ardour/ardour/scene_changer.h b/libs/ardour/ardour/scene_changer.h
index 4b837f4cdb..86a545af14 100644
--- a/libs/ardour/ardour/scene_changer.h
+++ b/libs/ardour/ardour/scene_changer.h
@@ -46,8 +46,8 @@ class SceneChanger : public SessionHandleRef
SceneChanger (Session& s) : SessionHandleRef (s) {}
virtual ~SceneChanger () {};
- virtual void run (framepos_t start, framepos_t end) = 0;
- virtual void locate (framepos_t where) = 0;
+ virtual void run (samplepos_t start, samplepos_t end) = 0;
+ virtual void locate (samplepos_t where) = 0;
};
} /* namespace */
diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h
index 002397f0cd..4594d38847 100644
--- a/libs/ardour/ardour/send.h
+++ b/libs/ardour/ardour/send.h
@@ -61,16 +61,16 @@ class LIBARDOUR_API Send : public Delivery
uint32_t pans_required() const { return _configured_input.n_audio(); }
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
/* latency compensation */
- void set_delay_in (framecnt_t);
- void set_delay_out (framecnt_t);
- framecnt_t get_delay_in () const { return _delay_in; }
- framecnt_t get_delay_out () const { return _delay_out; }
+ void set_delay_in (samplecnt_t);
+ void set_delay_out (samplecnt_t);
+ samplecnt_t get_delay_in () const { return _delay_in; }
+ samplecnt_t get_delay_out () const { return _delay_out; }
void activate ();
void deactivate ();
@@ -97,8 +97,8 @@ class LIBARDOUR_API Send : public Delivery
uint32_t _bitslot;
- framecnt_t _delay_in;
- framecnt_t _delay_out;
+ samplecnt_t _delay_in;
+ samplecnt_t _delay_out;
bool _remove_on_disconnect;
};
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 02534c682f..b052ba5b69 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -300,7 +300,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
StripableList get_stripables () const;
boost::shared_ptr<RouteList> get_tracks() const;
boost::shared_ptr<RouteList> get_routes_with_internal_returns() const;
- boost::shared_ptr<RouteList> get_routes_with_regions_at (framepos_t const) const;
+ boost::shared_ptr<RouteList> get_routes_with_regions_at (samplepos_t const) const;
uint32_t nstripables (bool with_monitor = false) const;
uint32_t nroutes() const { return routes.reader()->size(); }
@@ -385,8 +385,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
*/
PBD::Signal0<void> TransportStateChange;
- PBD::Signal1<void,framepos_t> PositionChanged; /* sent after any non-sequential motion */
- PBD::Signal1<void,framepos_t> Xrun;
+ PBD::Signal1<void,samplepos_t> PositionChanged; /* sent after any non-sequential motion */
+ PBD::Signal1<void,samplepos_t> Xrun;
PBD::Signal0<void> TransportLooped;
/** emitted when a locate has occurred */
@@ -414,15 +414,15 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void queue_event (SessionEvent*);
- void request_roll_at_and_return (framepos_t start, framepos_t return_to);
- void request_bounded_roll (framepos_t start, framepos_t end);
+ void request_roll_at_and_return (samplepos_t start, samplepos_t return_to);
+ void request_bounded_roll (samplepos_t start, samplepos_t end);
void request_stop (bool abort = false, bool clear_state = false);
- void request_locate (framepos_t frame, bool with_roll = false);
+ void request_locate (samplepos_t sample, bool with_roll = false);
void request_play_loop (bool yn, bool leave_rolling = false);
bool get_play_loop () const { return play_loop; }
- framepos_t last_transport_start () const { return _last_roll_location; }
+ samplepos_t last_transport_start () const { return _last_roll_location; }
void goto_end ();
void goto_start (bool and_roll = false);
void use_rf_shuttle_speed ();
@@ -440,16 +440,16 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
int wipe ();
- framepos_t current_end_frame () const;
- framepos_t current_start_frame () const;
+ samplepos_t current_end_sample () const;
+ samplepos_t current_start_sample () const;
/** "actual" sample rate of session, set by current audioengine rate, pullup/down etc. */
- framecnt_t frame_rate () const { return _current_frame_rate; }
+ samplecnt_t sample_rate () const { return _current_sample_rate; }
/** "native" sample rate of session, regardless of current audioengine rate, pullup/down etc */
- framecnt_t nominal_frame_rate () const { return _nominal_frame_rate; }
- framecnt_t frames_per_hour () const { return _frames_per_hour; }
+ samplecnt_t nominal_sample_rate () const { return _nominal_sample_rate; }
+ samplecnt_t frames_per_hour () const { return _frames_per_hour; }
double samples_per_timecode_frame() const { return _samples_per_timecode_frame; }
- framecnt_t timecode_frames_per_hour() const { return _timecode_frames_per_hour; }
+ samplecnt_t timecode_frames_per_hour() const { return _timecode_frames_per_hour; }
MIDI::byte get_mtc_timecode_bits() const {
return mtc_timecode_bits; /* encoding of SMTPE type for MTC */
@@ -468,16 +468,16 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void set_auto_punch_location (Location *);
void set_auto_loop_location (Location *);
- void set_session_extents (framepos_t start, framepos_t end);
+ void set_session_extents (samplepos_t start, samplepos_t end);
bool end_is_free () const { return _session_range_end_is_free; }
void set_end_is_free (bool);
int location_name(std::string& result, std::string base = std::string(""));
pframes_t get_block_size() const { return current_block_size; }
- framecnt_t worst_output_latency () const { return _worst_output_latency; }
- framecnt_t worst_input_latency () const { return _worst_input_latency; }
- framecnt_t worst_track_latency () const { return _worst_track_latency; }
- framecnt_t worst_playback_latency () const { return _worst_output_latency + _worst_track_latency; }
+ samplecnt_t worst_output_latency () const { return _worst_output_latency; }
+ samplecnt_t worst_input_latency () const { return _worst_input_latency; }
+ samplecnt_t worst_track_latency () const { return _worst_track_latency; }
+ samplecnt_t worst_playback_latency () const { return _worst_output_latency + _worst_track_latency; }
struct SaveAs {
std::string new_parent_folder; /* parent folder where new session folder will be created */
@@ -677,11 +677,11 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
/* Time */
- framepos_t transport_frame () const {return _transport_frame; }
- framepos_t record_location () const {return _last_record_location; }
- framepos_t audible_frame (bool* latent_locate = NULL) const;
- framepos_t requested_return_frame() const { return _requested_return_frame; }
- void set_requested_return_frame(framepos_t return_to);
+ samplepos_t transport_sample () const {return _transport_sample; }
+ samplepos_t record_location () const {return _last_record_location; }
+ samplepos_t audible_sample (bool* latent_locate = NULL) const;
+ samplepos_t requested_return_sample() const { return _requested_return_sample; }
+ void set_requested_return_sample(samplepos_t return_to);
enum PullupFormat {
pullup_Plus4Plus1,
@@ -697,21 +697,21 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void sync_time_vars();
- void bbt_time (framepos_t when, Timecode::BBT_Time&);
- void timecode_to_sample(Timecode::Time& timecode, framepos_t& sample, bool use_offset, bool use_subframes) const;
- void sample_to_timecode(framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
+ void bbt_time (samplepos_t when, Timecode::BBT_Time&);
+ void timecode_to_sample(Timecode::Time& timecode, samplepos_t& sample, bool use_offset, bool use_subframes) const;
+ void sample_to_timecode(samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
void timecode_time (Timecode::Time &);
- void timecode_time (framepos_t when, Timecode::Time&);
- void timecode_time_subframes (framepos_t when, Timecode::Time&);
+ void timecode_time (samplepos_t when, Timecode::Time&);
+ void timecode_time_subframes (samplepos_t when, Timecode::Time&);
- void timecode_duration (framecnt_t, Timecode::Time&) const;
- void timecode_duration_string (char *, size_t len, framecnt_t) const;
+ void timecode_duration (samplecnt_t, Timecode::Time&) const;
+ void timecode_duration_string (char *, size_t len, samplecnt_t) const;
- framecnt_t convert_to_frames (AnyTime const & position);
- framecnt_t any_duration_to_frames (framepos_t position, AnyTime const & duration);
+ samplecnt_t convert_to_samples (AnyTime const & position);
+ samplecnt_t any_duration_to_samples (samplepos_t position, AnyTime const & duration);
- static PBD::Signal1<void, framepos_t> StartTimeChanged;
- static PBD::Signal1<void, framepos_t> EndTimeChanged;
+ static PBD::Signal1<void, samplepos_t> StartTimeChanged;
+ static PBD::Signal1<void, samplepos_t> EndTimeChanged;
void request_sync_source (Slave*);
bool synced_to_engine() const { return _slave && config.get_external_sync() && Config->get_sync_source() == Engine; }
@@ -747,9 +747,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
boost::shared_ptr<ExportHandler> get_export_handler ();
boost::shared_ptr<ExportStatus> get_export_status ();
- int start_audio_export (framepos_t position, bool realtime = false, bool region_export = false, bool comensate_master_latency = false);
+ int start_audio_export (samplepos_t position, bool realtime = false, bool region_export = false, bool comensate_master_latency = false);
- PBD::Signal1<int, framecnt_t> ProcessExport;
+ PBD::Signal1<int, samplecnt_t> ProcessExport;
static PBD::Signal2<void,std::string, std::string> Exported;
void add_source (boost::shared_ptr<Source>);
@@ -779,10 +779,10 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
/** handlers should return 0 for "ignore the rate mismatch",
!0 for "do not use this session"
*/
- static PBD::Signal2<int, framecnt_t, framecnt_t> AskAboutSampleRateMismatch;
+ static PBD::Signal2<int, samplecnt_t, samplecnt_t> AskAboutSampleRateMismatch;
/** non interactive message */
- static PBD::Signal2<void, framecnt_t, framecnt_t> NotifyAboutSampleRateMismatch;
+ static PBD::Signal2<void, samplecnt_t, samplecnt_t> NotifyAboutSampleRateMismatch;
/** handlers should return !0 for use pending state, 0 for ignore it.
*/
@@ -825,7 +825,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
/* flattening stuff */
- boost::shared_ptr<Region> write_one_track (Track&, framepos_t start, framepos_t end,
+ boost::shared_ptr<Region> write_one_track (Track&, samplepos_t start, samplepos_t end,
bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint, bool for_export, bool for_freeze);
@@ -910,7 +910,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
/* s/w "RAID" management */
- boost::optional<framecnt_t> available_capture_duration();
+ boost::optional<samplecnt_t> available_capture_duration();
/* I/O bundles */
@@ -1004,25 +1004,25 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void request_cancel_play_range ();
bool get_play_range () const { return _play_range; }
- void maybe_update_session_range (framepos_t, framepos_t);
+ void maybe_update_session_range (samplepos_t, samplepos_t);
/* preroll */
- framecnt_t preroll_samples (framepos_t) const;
+ samplecnt_t preroll_samples (samplepos_t) const;
- void request_preroll_record_punch (framepos_t start, framecnt_t preroll);
- void request_preroll_record_trim (framepos_t start, framecnt_t preroll);
+ void request_preroll_record_punch (samplepos_t start, samplecnt_t preroll);
+ void request_preroll_record_trim (samplepos_t start, samplecnt_t preroll);
void request_count_in_record ();
- framepos_t preroll_record_punch_pos () const { return _preroll_record_punch_pos; }
+ samplepos_t preroll_record_punch_pos () const { return _preroll_record_punch_pos; }
bool preroll_record_punch_enabled () const { return _preroll_record_punch_pos >= 0; }
- framecnt_t preroll_record_trim_len () const { return _preroll_record_trim_len; }
+ samplecnt_t preroll_record_trim_len () const { return _preroll_record_trim_len; }
/* temporary hacks to allow selection to be pushed from GUI into backend.
Whenever we move the selection object into libardour, these will go away.
*/
- void set_range_selection (framepos_t start, framepos_t end);
- void set_object_selection (framepos_t start, framepos_t end);
+ void set_range_selection (samplepos_t start, samplepos_t end);
+ void set_object_selection (samplepos_t start, samplepos_t end);
void clear_range_selection ();
void clear_object_selection ();
@@ -1115,7 +1115,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
boost::shared_ptr<SessionPlaylists> playlists;
- void send_mmc_locate (framepos_t);
+ void send_mmc_locate (samplepos_t);
void queue_full_time_code () { _send_timecode_update = true; }
void queue_song_position_pointer () { /* currently does nothing */ }
@@ -1206,7 +1206,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
protected:
friend class AudioEngine;
void set_block_size (pframes_t nframes);
- void set_frame_rate (framecnt_t nframes);
+ void set_sample_rate (samplecnt_t nframes);
#ifdef USE_TRACKS_CODE_FEATURES
void reconnect_existing_routes (bool withLock, bool reconnect_master = true, bool reconnect_inputs = true, bool reconnect_outputs = true);
#endif
@@ -1236,12 +1236,12 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
process_function_type last_process_function;
bool _bounce_processing_active;
bool waiting_for_sync_offset;
- framecnt_t _base_frame_rate; // sample-rate of the session at creation time, "native" SR
- framecnt_t _nominal_frame_rate; // overridden by audioengine setting
- framecnt_t _current_frame_rate; // this includes video pullup offset
+ samplecnt_t _base_sample_rate; // sample-rate of the session at creation time, "native" SR
+ samplecnt_t _nominal_sample_rate; // overridden by audioengine setting
+ samplecnt_t _current_sample_rate; // this includes video pullup offset
int transport_sub_state;
mutable gint _record_status;
- framepos_t _transport_frame;
+ samplepos_t _transport_sample;
gint _seek_counter;
Location* _session_range_location; ///< session range, or 0 if there is nothing in the session yet
bool _session_range_end_is_free;
@@ -1257,13 +1257,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
CubicInterpolation interpolation;
bool auto_play_legal;
- framepos_t _last_slave_transport_frame;
- framecnt_t maximum_output_latency;
- framepos_t _requested_return_frame;
+ samplepos_t _last_slave_transport_sample;
+ samplecnt_t maximum_output_latency;
+ samplepos_t _requested_return_sample;
pframes_t current_block_size;
- framecnt_t _worst_output_latency;
- framecnt_t _worst_input_latency;
- framecnt_t _worst_track_latency;
+ samplecnt_t _worst_output_latency;
+ samplecnt_t _worst_input_latency;
+ samplecnt_t _worst_track_latency;
bool _have_captured;
bool _non_soloed_outs_muted;
bool _listening;
@@ -1306,7 +1306,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void unblock_processing() { g_atomic_int_set (&processing_prohibited, 0); }
bool processing_blocked() const { return g_atomic_int_get (&processing_prohibited); }
- static const framecnt_t bounce_chunk_size;
+ static const samplecnt_t bounce_chunk_size;
/* slave tracking */
@@ -1320,26 +1320,26 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
SlaveState _slave_state;
gint _mtc_active;
gint _ltc_active;
- framepos_t slave_wait_end;
+ samplepos_t slave_wait_end;
void reset_slave_state ();
bool follow_slave (pframes_t);
- void calculate_moving_average_of_slave_delta (int dir, framecnt_t this_delta);
- void track_slave_state (float slave_speed, framepos_t slave_transport_frame, framecnt_t this_delta);
+ void calculate_moving_average_of_slave_delta (int dir, samplecnt_t this_delta);
+ void track_slave_state (float slave_speed, samplepos_t slave_transport_sample, samplecnt_t this_delta);
void switch_to_sync_source (SyncSource); /* !RT context */
void drop_sync_source (); /* !RT context */
void use_sync_source (Slave*); /* RT context */
bool post_export_sync;
- framepos_t post_export_position;
+ samplepos_t post_export_position;
bool _exporting;
bool _export_rolling;
bool _realtime_export;
bool _region_export;
- framepos_t _export_preroll;
- framepos_t _export_latency;
+ samplepos_t _export_preroll;
+ samplepos_t _export_latency;
boost::shared_ptr<ExportHandler> export_handler;
boost::shared_ptr<ExportStatus> export_status;
@@ -1380,7 +1380,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
}
}
- bool maybe_stop (framepos_t limit);
+ bool maybe_stop (samplepos_t limit);
bool maybe_sync_start (pframes_t &);
void check_declick_out ();
@@ -1389,13 +1389,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
std::string _name;
bool _is_new;
bool _send_qf_mtc;
- /** Number of process frames since the last MTC output (when sending MTC); used to
+ /** Number of process samples since the last MTC output (when sending MTC); used to
* know when to send full MTC messages every so often.
*/
pframes_t _pframes_since_last_mtc;
bool play_loop;
bool loop_changing;
- framepos_t last_loopend;
+ samplepos_t last_loopend;
boost::scoped_ptr<SessionDirectory> _session_dir;
@@ -1421,13 +1421,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
int load_state (std::string snapshot_name);
static int parse_stateful_loading_version (const std::string&);
- framepos_t _last_roll_location;
- /** the session frame time at which we last rolled, located, or changed transport direction */
- framepos_t _last_roll_or_reversal_location;
- framepos_t _last_record_location;
+ samplepos_t _last_roll_location;
+ /** the session sample time at which we last rolled, located, or changed transport direction */
+ samplepos_t _last_roll_or_reversal_location;
+ samplepos_t _last_record_location;
bool pending_locate_roll;
- framepos_t pending_locate_frame;
+ samplepos_t pending_locate_sample;
bool pending_locate_flush;
bool pending_abort;
bool pending_auto_loop;
@@ -1470,7 +1470,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
uint32_t rf_scale;
void set_rf_speed (float speed);
- void reset_rf_scale (framecnt_t frames_moved);
+ void reset_rf_scale (samplecnt_t samples_moved);
Locations* _locations;
void location_added (Location*);
@@ -1494,7 +1494,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
PBD::ScopedConnectionList loop_connections;
void auto_loop_changed (Location *);
- void auto_loop_declick_range (Location *, framepos_t &, framepos_t &);
+ void auto_loop_declick_range (Location *, samplepos_t &, samplepos_t &);
int ensure_engine (uint32_t desired_sample_rate, bool);
void pre_engine_init (std::string path);
@@ -1509,19 +1509,19 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void enable_record ();
- void increment_transport_position (framecnt_t val) {
- if (max_framepos - val < _transport_frame) {
- _transport_frame = max_framepos;
+ void increment_transport_position (samplecnt_t val) {
+ if (max_samplepos - val < _transport_sample) {
+ _transport_sample = max_samplepos;
} else {
- _transport_frame += val;
+ _transport_sample += val;
}
}
- void decrement_transport_position (framecnt_t val) {
- if (val < _transport_frame) {
- _transport_frame -= val;
+ void decrement_transport_position (samplecnt_t val) {
+ if (val < _transport_sample) {
+ _transport_sample -= val;
} else {
- _transport_frame = 0;
+ _transport_sample = 0;
}
}
@@ -1633,19 +1633,19 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
Timecode::Time transmitting_timecode_time;
int next_quarter_frame_to_send;
- double _samples_per_timecode_frame; /* has to be floating point because of drop frame */
- framecnt_t _frames_per_hour;
- framecnt_t _timecode_frames_per_hour;
+ double _samples_per_timecode_frame; /* has to be floating point because of drop sample */
+ samplecnt_t _frames_per_hour;
+ samplecnt_t _timecode_frames_per_hour;
/* cache the most-recently requested time conversions. This helps when we
- * have multiple clocks showing the same time (e.g. the transport frame) */
+ * have multiple clocks showing the same time (e.g. the transport sample) */
bool last_timecode_valid;
- framepos_t last_timecode_when;
+ samplepos_t last_timecode_when;
Timecode::Time last_timecode;
- bool _send_timecode_update; ///< Flag to send a full frame (Timecode) MTC message this cycle
+ bool _send_timecode_update; ///< Flag to send a full sample (Timecode) MTC message this cycle
- int send_midi_time_code_for_cycle (framepos_t, framepos_t, pframes_t nframes);
+ int send_midi_time_code_for_cycle (samplepos_t, samplepos_t, pframes_t nframes);
LTCEncoder* ltc_encoder;
ltcsnd_sample_t* ltc_enc_buf;
@@ -1656,13 +1656,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
double ltc_speed;
int32_t ltc_enc_byte;
- framepos_t ltc_enc_pos;
+ samplepos_t ltc_enc_pos;
double ltc_enc_cnt;
- framepos_t ltc_enc_off;
+ samplepos_t ltc_enc_off;
bool restarting;
- framepos_t ltc_prev_cycle;
+ samplepos_t ltc_prev_cycle;
- framepos_t ltc_timecode_offset;
+ samplepos_t ltc_timecode_offset;
bool ltc_timecode_negative_offset;
LatencyRange ltc_out_latency;
@@ -1673,7 +1673,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void ltc_tx_resync_latency();
void ltc_tx_recalculate_position();
void ltc_tx_parse_offset();
- void ltc_tx_send_time_code_for_cycle (framepos_t, framepos_t, double, double, pframes_t nframes);
+ void ltc_tx_send_time_code_for_cycle (samplepos_t, samplepos_t, double, double, pframes_t nframes);
PBD::ScopedConnectionList ltc_tx_connections;
@@ -1693,11 +1693,11 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void unset_play_loop ();
void overwrite_some_buffers (Track *);
void flush_all_inserts ();
- int micro_locate (framecnt_t distance);
- void locate (framepos_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true);
- void start_locate (framepos_t, bool with_roll, bool with_flush, bool for_loop_enabled=false, bool force=false);
- void force_locate (framepos_t frame, bool with_roll = false);
- void set_transport_speed (double speed, framepos_t destination_frame, bool abort = false, bool clear_state = false, bool as_default = false);
+ int micro_locate (samplecnt_t distance);
+ void locate (samplepos_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true);
+ void start_locate (samplepos_t, bool with_roll, bool with_flush, bool for_loop_enabled=false, bool force=false);
+ void force_locate (samplepos_t sample, bool with_roll = false);
+ void set_transport_speed (double speed, samplepos_t destination_sample, bool abort = false, bool clear_state = false, bool as_default = false);
void stop_transport (bool abort = false, bool clear_state = false);
void start_transport ();
void realtime_stop (bool abort, bool clear_state);
@@ -1711,15 +1711,15 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void engine_halted ();
void xrun_recovery ();
void set_track_loop (bool);
- bool select_playhead_priority_target (framepos_t&);
+ bool select_playhead_priority_target (samplepos_t&);
void follow_playhead_priority ();
/* These are synchronous and so can only be called from within the process
* cycle
*/
- int send_full_time_code (framepos_t, pframes_t nframes);
- void send_song_position_pointer (framepos_t);
+ int send_full_time_code (samplepos_t, pframes_t nframes);
+ void send_song_position_pointer (samplepos_t);
TempoMap *_tempo_map;
void tempo_map_changed (const PBD::PropertyChange&);
@@ -1807,8 +1807,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void remove_playlist (boost::weak_ptr<Playlist>);
void track_playlist_changed (boost::weak_ptr<Track>);
void playlist_region_added (boost::weak_ptr<Region>);
- void playlist_ranges_moved (std::list<Evoral::RangeMove<framepos_t> > const &);
- void playlist_regions_extended (std::list<Evoral::Range<framepos_t> > const &);
+ void playlist_ranges_moved (std::list<Evoral::RangeMove<samplepos_t> > const &);
+ void playlist_regions_extended (std::list<Evoral::Range<samplepos_t> > const &);
/* CURVES and AUTOMATION LISTS */
std::map<PBD::ID, AutomationList*> automation_lists;
@@ -1829,7 +1829,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
/* FLATTEN */
- int flatten_one_track (AudioTrack&, framepos_t start, framecnt_t cnt);
+ int flatten_one_track (AudioTrack&, samplepos_t start, samplecnt_t cnt);
/* INSERT AND SEND MANAGEMENT */
@@ -1894,7 +1894,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
*/
std::list<GQuark> _current_trans_quarks;
- int backend_sync_callback (TransportState, framepos_t);
+ int backend_sync_callback (TransportState, samplepos_t);
void process_rtop (SessionEvent*);
@@ -1917,24 +1917,24 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
boost::shared_ptr<Amp> _click_gain;
Sample* click_data;
Sample* click_emphasis_data;
- framecnt_t click_length;
- framecnt_t click_emphasis_length;
+ samplecnt_t click_length;
+ samplecnt_t click_emphasis_length;
mutable Glib::Threads::RWLock click_lock;
static const Sample default_click[];
- static const framecnt_t default_click_length;
+ static const samplecnt_t default_click_length;
static const Sample default_click_emphasis[];
- static const framecnt_t default_click_emphasis_length;
+ static const samplecnt_t default_click_emphasis_length;
Click *get_click();
- framepos_t _clicks_cleared;
+ samplepos_t _clicks_cleared;
void setup_click_sounds (int which);
- void setup_click_sounds (Sample**, Sample const *, framecnt_t*, framecnt_t, std::string const &);
+ void setup_click_sounds (Sample**, Sample const *, samplecnt_t*, samplecnt_t, std::string const &);
void clear_clicks ();
- void click (framepos_t start, framecnt_t nframes);
- void run_click (framepos_t start, framecnt_t nframes);
- void add_click (framepos_t pos, bool emphasis);
- framecnt_t _count_in_samples;
+ void click (samplepos_t start, samplecnt_t nframes);
+ void run_click (samplepos_t start, samplecnt_t nframes);
+ void add_click (samplepos_t pos, bool emphasis);
+ samplecnt_t _count_in_samples;
/* range playback */
@@ -1946,14 +1946,14 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
/* temporary hacks to allow selection to be pushed from GUI into backend
Whenever we move the selection object into libardour, these will go away.
*/
- Evoral::Range<framepos_t> _range_selection;
- Evoral::Range<framepos_t> _object_selection;
+ Evoral::Range<samplepos_t> _range_selection;
+ Evoral::Range<samplepos_t> _object_selection;
void unset_preroll_record_punch ();
void unset_preroll_record_trim ();
- framepos_t _preroll_record_punch_pos;
- framecnt_t _preroll_record_trim_len;
+ samplepos_t _preroll_record_punch_pos;
+ samplecnt_t _preroll_record_trim_len;
bool _count_in_once;
/* main outs */
@@ -1986,7 +1986,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
static bool _disable_all_loaded_plugins;
static bool _bypass_all_loaded_plugins;
- mutable bool have_looped; ///< Used in ::audible_frame(*)
+ mutable bool have_looped; ///< Used in ::audible_sample(*)
void update_route_record_state ();
gint _have_rec_enabled_track;
@@ -2031,7 +2031,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void rt_set_controls (boost::shared_ptr<ControlList>, double val, PBD::Controllable::GroupControlDisposition group_override);
void rt_clear_all_solo_state (boost::shared_ptr<RouteList>, bool yn, PBD::Controllable::GroupControlDisposition group_override);
- void set_session_range_location (framepos_t, framepos_t);
+ void set_session_range_location (samplepos_t, samplepos_t);
void setup_midi_machine_control ();
@@ -2043,11 +2043,11 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void update_locations_after_tempo_map_change (const Locations::LocationList &);
- void start_time_changed (framepos_t);
- void end_time_changed (framepos_t);
+ void start_time_changed (samplepos_t);
+ void end_time_changed (samplepos_t);
void set_track_monitor_input_status (bool);
- framepos_t compute_stop_limit () const;
+ samplepos_t compute_stop_limit () const;
boost::shared_ptr<Speakers> _speakers;
void load_nested_sources (const XMLNode& node);
diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h
index 2f8d52b2b2..90d8874df4 100644
--- a/libs/ardour/ardour/session_configuration_vars.h
+++ b/libs/ardour/ardour/session_configuration_vars.h
@@ -41,7 +41,7 @@ CONFIG_VARIABLE (MonitorChoice, session_monitoring, "session-monitoring", Monito
CONFIG_VARIABLE (bool, layered_record_mode, "layered-record-mode", false)
CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100)
CONFIG_VARIABLE (Timecode::TimecodeFormat, timecode_format, "timecode-format", Timecode::timecode_30)
-CONFIG_VARIABLE (framecnt_t, minitimeline_span, "minitimeline-span", 120) // seconds
+CONFIG_VARIABLE (samplecnt_t, minitimeline_span, "minitimeline-span", 120) // seconds
CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", PBD::path_expand)
CONFIG_VARIABLE_SPECIAL(std::string, audio_search_path, "audio-search-path", "", PBD::search_path_expand)
CONFIG_VARIABLE_SPECIAL(std::string, midi_search_path, "midi-search-path", "", PBD::search_path_expand)
@@ -53,7 +53,7 @@ CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false)
CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f)
CONFIG_VARIABLE (bool, external_sync, "external-sync", false)
CONFIG_VARIABLE (InsertMergePolicy, insert_merge_policy, "insert-merge-policy", InsertMergeRelax)
-CONFIG_VARIABLE (framecnt_t, timecode_offset, "timecode-offset", 0)
+CONFIG_VARIABLE (samplecnt_t, timecode_offset, "timecode-offset", 0)
CONFIG_VARIABLE (bool, timecode_offset_negative, "timecode-offset-negative", true)
CONFIG_VARIABLE (std::string, slave_timecode_offset, "slave-timecode-offset", " 00:00:00:00")
CONFIG_VARIABLE (std::string, timecode_generator_offset, "timecode-generator-offset", " 00:00:00:00")
diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h
index 7649960ee1..86ea425645 100644
--- a/libs/ardour/ardour/session_event.h
+++ b/libs/ardour/ardour/session_event.h
@@ -76,14 +76,14 @@ public:
Type type;
Action action;
- framepos_t action_frame;
- framepos_t target_frame;
+ samplepos_t action_sample;
+ samplepos_t target_sample;
double speed;
union {
void* ptr;
bool yes_or_no;
- framepos_t target2_frame;
+ samplepos_t target2_sample;
Slave* slave;
Route* route;
};
@@ -112,18 +112,18 @@ public:
boost::shared_ptr<Region> region;
- SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false);
+ SessionEvent (Type t, Action a, samplepos_t when, samplepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false);
void set_ptr (void* p) {
ptr = p;
}
bool before (const SessionEvent& other) const {
- return action_frame < other.action_frame;
+ return action_sample < other.action_sample;
}
bool after (const SessionEvent& other) const {
- return action_frame > other.action_frame;
+ return action_sample > other.action_sample;
}
static bool compare (const SessionEvent *e1, const SessionEvent *e2) {
@@ -133,7 +133,7 @@ public:
void* operator new (size_t);
void operator delete (void *ptr, size_t /*size*/);
- static const framepos_t Immediate = -1;
+ static const samplepos_t Immediate = -1;
static bool has_per_thread_pool ();
static void create_per_thread_pool (const std::string& n, uint32_t nitems);
@@ -175,13 +175,13 @@ protected:
void dump_events () const;
void merge_event (SessionEvent*);
- void replace_event (SessionEvent::Type, framepos_t action_frame, framepos_t target = 0);
+ void replace_event (SessionEvent::Type, samplepos_t action_sample, samplepos_t target = 0);
bool _replace_event (SessionEvent*);
bool _remove_event (SessionEvent *);
void _clear_event_type (SessionEvent::Type);
- void add_event (framepos_t action_frame, SessionEvent::Type type, framepos_t target_frame = 0);
- void remove_event (framepos_t frame, SessionEvent::Type type);
+ void add_event (samplepos_t action_sample, SessionEvent::Type type, samplepos_t target_sample = 0);
+ void remove_event (samplepos_t sample, SessionEvent::Type type);
virtual void process_event(SessionEvent*) = 0;
virtual void set_next_event () = 0;
diff --git a/libs/ardour/ardour/sidechain.h b/libs/ardour/ardour/sidechain.h
index 9d44c3efa2..f3755496c2 100644
--- a/libs/ardour/ardour/sidechain.h
+++ b/libs/ardour/ardour/sidechain.h
@@ -34,7 +34,7 @@ public:
SideChain (Session&, const std::string&);
virtual ~SideChain ();
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h
index 80f4b361b2..a0bd51cc38 100644
--- a/libs/ardour/ardour/silentfilesource.h
+++ b/libs/ardour/ardour/silentfilesource.h
@@ -27,11 +27,11 @@ namespace ARDOUR {
class LIBARDOUR_API SilentFileSource : public AudioFileSource {
public:
- int update_header (framepos_t /*when*/, struct tm&, time_t) { return 0; }
+ int update_header (samplepos_t /*when*/, struct tm&, time_t) { return 0; }
int flush_header () { return 0; }
float sample_rate () const { return _sample_rate; }
- void set_length (framecnt_t len) { _length = len; }
+ void set_length (samplecnt_t len) { _length = len; }
void flush () {}
bool destructive() const { return false; }
@@ -43,7 +43,7 @@ protected:
void close() {}
friend class SourceFactory;
- SilentFileSource (Session& s, const XMLNode& x, framecnt_t len, float srate)
+ SilentFileSource (Session& s, const XMLNode& x, samplecnt_t len, float srate)
: Source (s, x)
, AudioFileSource (s, x, false)
, _sample_rate(srate)
@@ -51,17 +51,17 @@ protected:
_length = len;
}
- framecnt_t read_unlocked (Sample *dst, framepos_t /*start*/, framecnt_t cnt) const {
+ samplecnt_t read_unlocked (Sample *dst, samplepos_t /*start*/, samplecnt_t cnt) const {
memset (dst, 0, sizeof (Sample) * cnt);
return cnt;
}
- framecnt_t write_unlocked (Sample */*dst*/, framecnt_t /*cnt*/) { return 0; }
+ samplecnt_t write_unlocked (Sample */*dst*/, samplecnt_t /*cnt*/) { return 0; }
void set_header_timeline_position () {}
- int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t /*start*/, framecnt_t /*cnt*/,
- double /*frames_per_pixel*/, framecnt_t /*fpp*/) const {
+ int read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos_t /*start*/, samplecnt_t /*cnt*/,
+ double /*samples_per_pixel*/, samplecnt_t /*fpp*/) const {
memset (peaks, 0, sizeof (PeakData) * npeaks);
return 0;
}
diff --git a/libs/ardour/ardour/slavable_automation_control.h b/libs/ardour/ardour/slavable_automation_control.h
index 091d55b989..9cc1442bfb 100644
--- a/libs/ardour/ardour/slavable_automation_control.h
+++ b/libs/ardour/ardour/slavable_automation_control.h
@@ -46,7 +46,7 @@ public:
bool slaved_to (boost::shared_ptr<AutomationControl>) const;
bool slaved () const;
- virtual void automation_run (framepos_t start, pframes_t nframes);
+ virtual void automation_run (samplepos_t start, pframes_t nframes);
double get_masters_value () const {
Glib::Threads::RWLock::ReaderLock lm (master_lock);
@@ -59,7 +59,7 @@ public:
return reduce_by_masters_locked (val, ignore_automation_state);
}
- bool get_masters_curve (framepos_t s, framepos_t e, float* v, framecnt_t l) const {
+ bool get_masters_curve (samplepos_t s, samplepos_t e, float* v, samplecnt_t l) const {
Glib::Threads::RWLock::ReaderLock lm (master_lock);
return get_masters_curve_locked (s, e, v, l);
}
@@ -137,15 +137,15 @@ protected:
void actually_set_value (double value, PBD::Controllable::GroupControlDisposition);
void update_boolean_masters_records (boost::shared_ptr<AutomationControl>);
- virtual bool get_masters_curve_locked (framepos_t, framepos_t, float*, framecnt_t) const;
- bool masters_curve_multiply (framepos_t, framepos_t, float*, framecnt_t) const;
+ virtual bool get_masters_curve_locked (samplepos_t, samplepos_t, float*, samplecnt_t) const;
+ bool masters_curve_multiply (samplepos_t, samplepos_t, float*, samplecnt_t) const;
virtual double reduce_by_masters_locked (double val, bool) const;
virtual double scale_automation_callback (double val, double ratio) const;
virtual bool handle_master_change (boost::shared_ptr<AutomationControl>);
- virtual bool boolean_automation_run_locked (framepos_t start, pframes_t len);
- bool boolean_automation_run (framepos_t start, pframes_t len);
+ virtual bool boolean_automation_run_locked (samplepos_t start, pframes_t len);
+ bool boolean_automation_run (samplepos_t start, pframes_t len);
virtual void master_changed (bool from_self, GroupControlDisposition gcd, boost::weak_ptr<AutomationControl>);
virtual double get_masters_value_locked () const;
diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h
index 80ff208572..3c0f52d5ae 100644
--- a/libs/ardour/ardour/slave.h
+++ b/libs/ardour/ardour/slave.h
@@ -116,7 +116,7 @@ class LIBARDOUR_API Slave {
* @param position - The transport position requested
* @return - The return value is currently ignored (see Session::follow_slave)
*/
- virtual bool speed_and_position (double& speed, framepos_t& position) = 0;
+ virtual bool speed_and_position (double& speed, samplepos_t& position) = 0;
/**
* reports to ARDOUR whether the Slave is currently synced to its external
@@ -146,7 +146,7 @@ class LIBARDOUR_API Slave {
* @return - the timing resolution of the Slave - If the distance of ARDOURs transport
* to the slave becomes greater than the resolution, sound will stop
*/
- virtual framecnt_t resolution() const = 0;
+ virtual samplecnt_t resolution() const = 0;
/**
* @return - when returning true, ARDOUR will wait for seekahead_distance() before transport
@@ -155,11 +155,11 @@ class LIBARDOUR_API Slave {
virtual bool requires_seekahead () const = 0;
/**
- * @return the number of frames that this slave wants to seek ahead. Relevant
+ * @return the number of samples that this slave wants to seek ahead. Relevant
* only if requires_seekahead() returns true.
*/
- virtual framecnt_t seekahead_distance() const { return 0; }
+ virtual samplecnt_t seekahead_distance() const { return 0; }
/**
* @return - when returning true, ARDOUR will use transport speed 1.0 no matter what
@@ -184,15 +184,15 @@ class LIBARDOUR_API ISlaveSessionProxy {
public:
virtual ~ISlaveSessionProxy() {}
virtual TempoMap& tempo_map() const { return *((TempoMap *) 0); }
- virtual framecnt_t frame_rate() const { return 0; }
- virtual pframes_t frames_per_cycle() const { return 0; }
- virtual framepos_t audible_frame () const { return 0; }
- virtual framepos_t transport_frame () const { return 0; }
- virtual pframes_t frames_since_cycle_start () const { return 0; }
- virtual framepos_t sample_time_at_cycle_start() const { return 0; }
- virtual framepos_t frame_time () const { return 0; }
-
- virtual void request_locate (framepos_t /*frame*/, bool with_roll = false) {
+ virtual samplecnt_t sample_rate() const { return 0; }
+ virtual pframes_t samples_per_cycle() const { return 0; }
+ virtual samplepos_t audible_sample () const { return 0; }
+ virtual samplepos_t transport_sample () const { return 0; }
+ virtual pframes_t samples_since_cycle_start () const { return 0; }
+ virtual samplepos_t sample_time_at_cycle_start() const { return 0; }
+ virtual samplepos_t sample_time () const { return 0; }
+
+ virtual void request_locate (samplepos_t /*sample*/, bool with_roll = false) {
(void) with_roll;
}
virtual void request_transport_speed (double /*speed*/) {}
@@ -207,22 +207,22 @@ class LIBARDOUR_API SlaveSessionProxy : public ISlaveSessionProxy {
SlaveSessionProxy(Session &s) : session(s) {}
TempoMap& tempo_map() const;
- framecnt_t frame_rate() const;
- pframes_t frames_per_cycle() const;
- framepos_t audible_frame () const;
- framepos_t transport_frame () const;
- pframes_t frames_since_cycle_start () const;
- framepos_t sample_time_at_cycle_start() const;
- framepos_t frame_time () const;
-
- void request_locate (framepos_t frame, bool with_roll = false);
+ samplecnt_t sample_rate() const;
+ pframes_t samples_per_cycle() const;
+ samplepos_t audible_sample () const;
+ samplepos_t transport_sample () const;
+ pframes_t samples_since_cycle_start () const;
+ samplepos_t sample_time_at_cycle_start() const;
+ samplepos_t sample_time () const;
+
+ void request_locate (samplepos_t sample, bool with_roll = false);
void request_transport_speed (double speed);
};
struct LIBARDOUR_API SafeTime {
volatile int guard1;
- framepos_t position;
- framepos_t timestamp;
+ samplepos_t position;
+ samplepos_t timestamp;
double speed;
volatile int guard2;
@@ -248,7 +248,7 @@ class LIBARDOUR_API TimecodeSlave : public Slave {
*/
virtual std::string approximate_current_position() const = 0;
- framepos_t timecode_offset;
+ samplepos_t timecode_offset;
bool timecode_negative_offset;
PBD::Signal1<void, bool> ActiveChanged;
@@ -260,15 +260,15 @@ class LIBARDOUR_API MTC_Slave : public TimecodeSlave {
~MTC_Slave ();
void rebind (MidiPort&);
- bool speed_and_position (double&, framepos_t&);
+ bool speed_and_position (double&, samplepos_t&);
bool locked() const;
bool ok() const;
void handle_locate (const MIDI::byte*);
- framecnt_t resolution () const;
+ samplecnt_t resolution () const;
bool requires_seekahead () const { return false; }
- framecnt_t seekahead_distance() const;
+ samplecnt_t seekahead_distance() const;
bool give_slave_full_control_over_transport_speed() const;
Timecode::TimecodeFormat apparent_timecode_format() const;
@@ -282,16 +282,16 @@ class LIBARDOUR_API MTC_Slave : public TimecodeSlave {
PBD::ScopedConnection config_connection;
bool can_notify_on_unknown_rate;
- static const int frame_tolerance;
+ static const int sample_tolerance;
SafeTime current;
- framepos_t mtc_frame; /* current time */
+ samplepos_t mtc_frame; /* current time */
double mtc_frame_dll;
- framepos_t last_inbound_frame; /* when we got it; audio clocked */
+ samplepos_t last_inbound_frame; /* when we got it; audio clocked */
MIDI::byte last_mtc_fps_byte;
- framepos_t window_begin;
- framepos_t window_end;
- framepos_t first_mtc_timestamp;
+ samplepos_t window_begin;
+ samplepos_t window_end;
+ samplepos_t first_mtc_timestamp;
bool did_reset_tc_format;
Timecode::TimecodeFormat saved_tc_format;
Glib::Threads::Mutex reset_lock;
@@ -307,11 +307,11 @@ class LIBARDOUR_API MTC_Slave : public TimecodeSlave {
Timecode::TimecodeFormat a3e_timecode;
Timecode::Time timecode;
bool printed_timecode_warning;
- frameoffset_t current_delta;
+ sampleoffset_t current_delta;
/* DLL - chase MTC */
- double t0; ///< time at the beginning of the MTC quater frame
- double t1; ///< calculated end of the MTC quater frame
+ double t0; ///< time at the beginning of the MTC quater sample
+ double t1; ///< calculated end of the MTC quater sample
double e2; ///< second order loop error
double b, c, omega; ///< DLL filter coefficients
@@ -326,14 +326,14 @@ class LIBARDOUR_API MTC_Slave : public TimecodeSlave {
void queue_reset (bool with_pos);
void maybe_reset ();
- void update_mtc_qtr (MIDI::Parser&, int, framepos_t);
- void update_mtc_time (const MIDI::byte *, bool, framepos_t);
+ void update_mtc_qtr (MIDI::Parser&, int, samplepos_t);
+ void update_mtc_time (const MIDI::byte *, bool, samplepos_t);
void update_mtc_status (MIDI::MTC_Status);
void read_current (SafeTime *) const;
- void reset_window (framepos_t);
- bool outside_window (framepos_t) const;
- void init_mtc_dll(framepos_t, double);
- void init_engine_dll (framepos_t, framepos_t);
+ void reset_window (samplepos_t);
+ bool outside_window (samplepos_t) const;
+ void init_mtc_dll(samplepos_t, double);
+ void init_engine_dll (samplepos_t, samplepos_t);
void parse_timecode_offset();
void parameter_changed(std::string const & p);
};
@@ -343,14 +343,14 @@ public:
LTC_Slave (Session&);
~LTC_Slave ();
- bool speed_and_position (double&, framepos_t&);
+ bool speed_and_position (double&, samplepos_t&);
bool locked() const;
bool ok() const;
- framecnt_t resolution () const;
+ samplecnt_t resolution () const;
bool requires_seekahead () const { return false; }
- framecnt_t seekahead_distance () const { return 0; }
+ samplecnt_t seekahead_distance () const { return 0; }
bool give_slave_full_control_over_transport_speed() const { return true; }
Timecode::TimecodeFormat apparent_timecode_format() const;
@@ -358,12 +358,12 @@ public:
std::string approximate_current_delta() const;
private:
- void parse_ltc(const pframes_t, const Sample* const, const framecnt_t);
- void process_ltc(framepos_t const);
- void init_engine_dll (framepos_t, int32_t);
+ void parse_ltc(const pframes_t, const Sample* const, const samplecnt_t);
+ void process_ltc(samplepos_t const);
+ void init_engine_dll (samplepos_t, int32_t);
bool detect_discontinuity(LTCFrameExt *, int, bool);
bool detect_ltc_fps(int, bool);
- bool equal_ltc_frame_time(LTCFrame *a, LTCFrame *b);
+ bool equal_ltc_sample_time(LTCFrame *a, LTCFrame *b);
void reset (bool with_ts = true);
void resync_xrun();
void resync_latency();
@@ -375,16 +375,16 @@ public:
Timecode::TimecodeFormat saved_tc_format;
LTCDecoder * decoder;
- double frames_per_ltc_frame;
+ double samples_per_ltc_frame;
Timecode::Time timecode;
- LTCFrameExt prev_frame;
+ LTCFrameExt prev_sample;
bool fps_detected;
- framecnt_t monotonic_cnt;
- framecnt_t last_timestamp;
- framecnt_t last_ltc_frame;
+ samplecnt_t monotonic_cnt;
+ samplecnt_t last_timestamp;
+ samplecnt_t last_ltc_sample;
double ltc_speed;
- frameoffset_t current_delta;
+ sampleoffset_t current_delta;
int delayedlocked;
int ltc_detect_fps_cnt;
@@ -401,8 +401,8 @@ public:
/* DLL - chase LTC */
int transport_direction;
int engine_dll_initstate;
- double t0; ///< time at the beginning of the MTC quater frame
- double t1; ///< calculated end of the MTC quater frame
+ double t0; ///< time at the beginning of the MTC quater sample
+ double t1; ///< calculated end of the MTC quater sample
double e2; ///< second order loop error
double b, c; ///< DLL filter coefficients
};
@@ -416,13 +416,13 @@ class LIBARDOUR_API MIDIClock_Slave : public Slave {
~MIDIClock_Slave ();
void rebind (MidiPort&);
- bool speed_and_position (double&, framepos_t&);
+ bool speed_and_position (double&, samplepos_t&);
bool locked() const;
bool ok() const;
bool starting() const;
- framecnt_t resolution () const;
+ samplecnt_t resolution () const;
bool requires_seekahead () const { return false; }
bool give_slave_full_control_over_transport_speed() const { return true; }
@@ -433,17 +433,17 @@ class LIBARDOUR_API MIDIClock_Slave : public Slave {
ISlaveSessionProxy* session;
PBD::ScopedConnectionList port_connections;
- /// pulses per quarter note for one MIDI clock frame (default 24)
+ /// pulses per quarter note for one MIDI clock sample (default 24)
int ppqn;
- /// the duration of one ppqn in frame time
- double one_ppqn_in_frames;
+ /// the duration of one ppqn in sample time
+ double one_ppqn_in_samples;
/// the timestamp of the first MIDI clock message
- framepos_t first_timestamp;
+ samplepos_t first_timestamp;
/// the time stamp and should-be transport position of the last inbound MIDI clock message
- framepos_t last_timestamp;
+ samplepos_t last_timestamp;
double should_be_position;
/// the number of midi clock messages received (zero-based)
@@ -452,10 +452,10 @@ class LIBARDOUR_API MIDIClock_Slave : public Slave {
//the delay locked loop (DLL), see www.kokkinizita.net/papers/usingdll.pdf
- /// time at the beginning of the MIDI clock frame
+ /// time at the beginning of the MIDI clock sample
double t0;
- /// calculated end of the MIDI clock frame
+ /// calculated end of the MIDI clock sample
double t1;
/// loop error = real value - expected value
@@ -470,20 +470,20 @@ class LIBARDOUR_API MIDIClock_Slave : public Slave {
/// DLL filter coefficients
double b, c, omega;
- frameoffset_t current_delta;
+ sampleoffset_t current_delta;
void reset ();
- void start (MIDI::Parser& parser, framepos_t timestamp);
- void contineu (MIDI::Parser& parser, framepos_t timestamp);
- void stop (MIDI::Parser& parser, framepos_t timestamp);
+ void start (MIDI::Parser& parser, samplepos_t timestamp);
+ void contineu (MIDI::Parser& parser, samplepos_t timestamp);
+ void stop (MIDI::Parser& parser, samplepos_t timestamp);
void position (MIDI::Parser& parser, MIDI::byte* message, size_t size);
// we can't use continue because it is a C++ keyword
- void calculate_one_ppqn_in_frames_at(framepos_t time);
- framepos_t calculate_song_position(uint16_t song_position_in_sixteenth_notes);
+ void calculate_one_ppqn_in_samples_at(samplepos_t time);
+ samplepos_t calculate_song_position(uint16_t song_position_in_sixteenth_notes);
void calculate_filter_coefficients();
- void update_midi_clock (MIDI::Parser& parser, framepos_t timestamp);
+ void update_midi_clock (MIDI::Parser& parser, samplepos_t timestamp);
void read_current (SafeTime *) const;
- bool stop_if_no_more_clock_events(framepos_t& pos, framepos_t now);
+ bool stop_if_no_more_clock_events(samplepos_t& pos, samplepos_t now);
/// whether transport should be rolling
bool _started;
@@ -499,12 +499,12 @@ class LIBARDOUR_API Engine_Slave : public Slave
Engine_Slave (AudioEngine&);
~Engine_Slave ();
- bool speed_and_position (double& speed, framepos_t& pos);
+ bool speed_and_position (double& speed, samplepos_t& pos);
bool starting() const { return _starting; }
bool locked() const;
bool ok() const;
- framecnt_t resolution () const { return 1; }
+ samplecnt_t resolution () const { return 1; }
bool requires_seekahead () const { return false; }
bool is_always_synced() const { return true; }
diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h
index 9bc6584355..5b121b4a52 100644
--- a/libs/ardour/ardour/smf_source.h
+++ b/libs/ardour/ardour/smf_source.h
@@ -52,7 +52,7 @@ public:
}
void append_event_beats (const Lock& lock, const Evoral::Event<Evoral::Beats>& ev);
- void append_event_frames (const Lock& lock, const Evoral::Event<framepos_t>& ev, framepos_t source_start);
+ void append_event_samples (const Lock& lock, const Evoral::Event<samplepos_t>& ev, samplepos_t source_start);
void mark_streaming_midi_write_started (const Lock& lock, NoteMode mode);
void mark_streaming_write_completed (const Lock& lock);
@@ -79,29 +79,29 @@ public:
private:
bool _open;
Evoral::Beats _last_ev_time_beats;
- framepos_t _last_ev_time_frames;
+ samplepos_t _last_ev_time_samples;
/** end time (start + duration) of last call to read_unlocked */
- mutable framepos_t _smf_last_read_end;
+ mutable samplepos_t _smf_last_read_end;
/** time (in SMF ticks, 1 tick per _ppqn) of the last event read by read_unlocked */
- mutable framepos_t _smf_last_read_time;
+ mutable samplepos_t _smf_last_read_time;
int open_for_write ();
void ensure_disk_file (const Lock& lock);
- framecnt_t read_unlocked (const Lock& lock,
- Evoral::EventSink<framepos_t>& dst,
- framepos_t position,
- framepos_t start,
- framecnt_t cnt,
- Evoral::Range<framepos_t>* loop_range,
+ samplecnt_t read_unlocked (const Lock& lock,
+ Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t position,
+ samplepos_t start,
+ samplecnt_t cnt,
+ Evoral::Range<samplepos_t>* loop_range,
MidiStateTracker* tracker,
MidiChannelFilter* filter) const;
- framecnt_t write_unlocked (const Lock& lock,
- MidiRingBuffer<framepos_t>& src,
- framepos_t position,
- framecnt_t cnt);
+ samplecnt_t write_unlocked (const Lock& lock,
+ MidiRingBuffer<samplepos_t>& src,
+ samplepos_t position,
+ samplecnt_t cnt);
};
diff --git a/libs/ardour/ardour/sndfileimportable.h b/libs/ardour/ardour/sndfileimportable.h
index 10c429c545..28e1ccf3cf 100644
--- a/libs/ardour/ardour/sndfileimportable.h
+++ b/libs/ardour/ardour/sndfileimportable.h
@@ -33,12 +33,12 @@ class LIBARDOUR_API SndFileImportableSource : public ImportableSource {
SndFileImportableSource (const std::string& path);
virtual ~SndFileImportableSource();
- framecnt_t read (Sample* buffer, framecnt_t nframes);
+ samplecnt_t read (Sample* buffer, samplecnt_t nframes);
uint32_t channels() const;
- framecnt_t length() const;
- framecnt_t samplerate() const;
- void seek (framepos_t pos);
- framepos_t natural_position() const;
+ samplecnt_t length() const;
+ samplecnt_t samplerate() const;
+ void seek (samplepos_t pos);
+ samplepos_t natural_position() const;
bool clamped_at_unity () const;
protected:
@@ -46,7 +46,7 @@ class LIBARDOUR_API SndFileImportableSource : public ImportableSource {
boost::shared_ptr<SNDFILE> in;
/* these are int64_t so as to be independent of whatever
- types Ardour may use for framepos_t, framecnt_t etc.
+ types Ardour may use for samplepos_t, samplecnt_t etc.
*/
int64_t timecode;
diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h
index 0130765123..218bbd242a 100644
--- a/libs/ardour/ardour/sndfilesource.h
+++ b/libs/ardour/ardour/sndfilesource.h
@@ -35,7 +35,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
/* Constructor to be called for new in-session files */
SndFileSource (Session&, const std::string& path, const std::string& origin,
- SampleFormat samp_format, HeaderFormat hdr_format, framecnt_t rate,
+ SampleFormat samp_format, HeaderFormat hdr_format, samplecnt_t rate,
Flag flags = SndFileSource::default_writable_flags);
/* Constructor to be called for recovering files being used for
@@ -56,14 +56,14 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
~SndFileSource ();
float sample_rate () const;
- int update_header (framepos_t when, struct tm&, time_t);
+ int update_header (samplepos_t when, struct tm&, time_t);
int flush_header ();
void flush ();
- framepos_t natural_position () const;
+ samplepos_t natural_position () const;
- framepos_t last_capture_start_frame() const;
- void mark_capture_start (framepos_t);
+ samplepos_t last_capture_start_sample() const;
+ void mark_capture_start (samplepos_t);
void mark_capture_end ();
void clear_capture_marks();
@@ -72,7 +72,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
bool clamped_at_unity () const;
- static void setup_standard_crossfades (Session const &, framecnt_t sample_rate);
+ static void setup_standard_crossfades (Session const &, samplecnt_t sample_rate);
static const Source::Flag default_writable_flags;
static int get_soundfile_info (const std::string& path, SoundFileInfo& _info, std::string& error_msg);
@@ -83,9 +83,9 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
void set_path (const std::string& p);
void set_header_timeline_position ();
- framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const;
- framecnt_t write_unlocked (Sample *dst, framecnt_t cnt);
- framecnt_t write_float (Sample* data, framepos_t pos, framecnt_t cnt);
+ samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
+ samplecnt_t write_unlocked (Sample *dst, samplecnt_t cnt);
+ samplecnt_t write_float (Sample* data, samplepos_t pos, samplecnt_t cnt);
private:
SNDFILE* _sndfile;
@@ -94,25 +94,25 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
void init_sndfile ();
int open();
- int setup_broadcast_info (framepos_t when, struct tm&, time_t);
+ int setup_broadcast_info (samplepos_t when, struct tm&, time_t);
void file_closed ();
/* destructive */
- static framecnt_t xfade_frames;
+ static samplecnt_t xfade_samples;
static gain_t* out_coefficient;
static gain_t* in_coefficient;
bool _capture_start;
bool _capture_end;
- framepos_t capture_start_frame;
- framepos_t file_pos; // unit is frames
+ samplepos_t capture_start_sample;
+ samplepos_t file_pos; // unit is samples
Sample* xfade_buf;
- framecnt_t crossfade (Sample* data, framecnt_t cnt, int dir);
- void set_timeline_position (framepos_t);
- framecnt_t destructive_write_unlocked (Sample *dst, framecnt_t cnt);
- framecnt_t nondestructive_write_unlocked (Sample *dst, framecnt_t cnt);
+ samplecnt_t crossfade (Sample* data, samplecnt_t cnt, int dir);
+ void set_timeline_position (samplepos_t);
+ samplecnt_t destructive_write_unlocked (Sample *dst, samplecnt_t cnt);
+ samplecnt_t nondestructive_write_unlocked (Sample *dst, samplecnt_t cnt);
void handle_header_position_change ();
PBD::ScopedConnection header_position_connection;
};
diff --git a/libs/ardour/ardour/soundseq.h b/libs/ardour/ardour/soundseq.h
index 02425a71cf..93faa75b9b 100644
--- a/libs/ardour/ardour/soundseq.h
+++ b/libs/ardour/ardour/soundseq.h
@@ -31,13 +31,13 @@ struct LIBARDOUR_API peak_data_t {
peak_datum max;
};
-const uint32_t frames_per_peak = 2048;
+const uint32_t samples_per_peak = 2048;
class LIBARDOUR_API Sound : public EDL::Piece {
public:
int peak (peak_data_t& pk, uint32_t start, uint32_t cnt);
int read_peaks (peak_data_t *, uint32_t npeaks, uint32_t start, uint32_t cnt);
- int build_peak (uint32_t first_frame, uint32_t cnt);
+ int build_peak (uint32_t first_sample, uint32_t cnt);
};
class LIBARDOUR_API SoundPlaylist : public EDL::Playlist {
diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h
index 275fe7c11a..b269f6976d 100644
--- a/libs/ardour/ardour/source.h
+++ b/libs/ardour/ardour/source.h
@@ -65,10 +65,10 @@ class LIBARDOUR_API Source : public SessionObject
void stamp (time_t when) { _timestamp = when; }
virtual bool empty () const = 0;
- virtual framecnt_t length (framepos_t pos) const = 0;
- virtual void update_length (framecnt_t cnt) = 0;
+ virtual samplecnt_t length (samplepos_t pos) const = 0;
+ virtual void update_length (samplecnt_t cnt) = 0;
- virtual framepos_t natural_position() const { return 0; }
+ virtual samplepos_t natural_position() const { return 0; }
void mark_for_remove();
@@ -98,8 +98,8 @@ class LIBARDOUR_API Source : public SessionObject
std::string get_transients_path() const;
int load_transients (const std::string&);
- framepos_t timeline_position() const { return _timeline_position; }
- virtual void set_timeline_position (framepos_t pos);
+ samplepos_t timeline_position() const { return _timeline_position; }
+ virtual void set_timeline_position (samplepos_t pos);
void set_allow_remove_if_empty (bool yn);
@@ -119,7 +119,7 @@ class LIBARDOUR_API Source : public SessionObject
DataType _type;
Flag _flags;
time_t _timestamp;
- framepos_t _timeline_position;
+ samplepos_t _timeline_position;
bool _analysed;
mutable Glib::Threads::Mutex _lock;
mutable Glib::Threads::Mutex _analysis_lock;
diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h
index b1ee6438f5..0cf934cfaa 100644
--- a/libs/ardour/ardour/source_factory.h
+++ b/libs/ardour/ardour/source_factory.h
@@ -44,7 +44,7 @@ class LIBARDOUR_API SourceFactory {
static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false);
static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node,
- framecnt_t nframes, float sample_rate);
+ samplecnt_t nframes, float sample_rate);
static boost::shared_ptr<Source> createExternal
(DataType type, Session&,
@@ -54,7 +54,7 @@ class LIBARDOUR_API SourceFactory {
static boost::shared_ptr<Source> createWritable
(DataType type, Session&,
const std::string& path,
- bool destructive, framecnt_t rate, bool announce = true, bool async = false);
+ bool destructive, samplecnt_t rate, bool announce = true, bool async = false);
static boost::shared_ptr<Source> createForRecovery
@@ -62,7 +62,7 @@ class LIBARDOUR_API SourceFactory {
static boost::shared_ptr<Source> createFromPlaylist
(DataType type, Session& s, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name,
- uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, bool defer_peaks);
+ uint32_t chn, sampleoffset_t start, samplecnt_t len, bool copy, bool defer_peaks);
static Glib::Threads::Cond PeaksToBuild;
static Glib::Threads::Mutex peak_building_lock;
diff --git a/libs/ardour/ardour/srcfilesource.h b/libs/ardour/ardour/srcfilesource.h
index 3dc1590dda..a7d23912ec 100644
--- a/libs/ardour/ardour/srcfilesource.h
+++ b/libs/ardour/ardour/srcfilesource.h
@@ -35,17 +35,17 @@ public:
SrcFileSource (Session&, boost::shared_ptr<AudioFileSource>, SrcQuality srcq = SrcQuality(SrcQuick));
~SrcFileSource ();
- int update_header (framepos_t /*when*/, struct tm&, time_t) { return 0; }
+ int update_header (samplepos_t /*when*/, struct tm&, time_t) { return 0; }
int flush_header () { return 0; }
void flush () { }
void set_header_timeline_position () {};
- void set_length (framecnt_t /*len*/) {};
+ void set_length (samplecnt_t /*len*/) {};
- float sample_rate () const { return _session.nominal_frame_rate(); }
+ float sample_rate () const { return _session.nominal_sample_rate(); }
- framepos_t natural_position() const { return _source->natural_position() * _ratio;}
- framecnt_t readable_length() const { return _source->readable_length() * _ratio; }
- framecnt_t length (framepos_t pos) const { return _source->length(pos) * _ratio; }
+ samplepos_t natural_position() const { return _source->natural_position() * _ratio;}
+ samplecnt_t readable_length() const { return _source->readable_length() * _ratio; }
+ samplecnt_t length (samplepos_t pos) const { return _source->length(pos) * _ratio; }
bool destructive() const { return false; }
bool can_be_analysed() const { return false; }
@@ -53,11 +53,11 @@ public:
protected:
void close ();
- framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const;
- framecnt_t write_unlocked (Sample */*dst*/, framecnt_t /*cnt*/) { return 0; }
+ samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
+ samplecnt_t write_unlocked (Sample */*dst*/, samplecnt_t /*cnt*/) { return 0; }
- int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t /*start*/, framecnt_t /*cnt*/,
- double /*samples_per_unit*/, framecnt_t /*fpp*/) const {
+ int read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos_t /*start*/, samplecnt_t /*cnt*/,
+ double /*samples_per_unit*/, samplecnt_t /*fpp*/) const {
memset (peaks, 0, sizeof (PeakData) * npeaks);
return 0;
}
@@ -70,12 +70,12 @@ private:
mutable SRC_DATA _src_data;
mutable Sample* _src_buffer;
- mutable framepos_t _source_position;
- mutable framepos_t _target_position;
+ mutable samplepos_t _source_position;
+ mutable samplepos_t _target_position;
mutable double _fract_position;
double _ratio;
- framecnt_t src_buffer_size;
+ samplecnt_t src_buffer_size;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/strip_silence.h b/libs/ardour/ardour/strip_silence.h
index 59f4ea0a57..69057ffe51 100644
--- a/libs/ardour/ardour/strip_silence.h
+++ b/libs/ardour/ardour/strip_silence.h
@@ -25,13 +25,13 @@ namespace ARDOUR {
class LIBARDOUR_API StripSilence : public Filter
{
public:
- StripSilence (Session &, const AudioIntervalMap&, framecnt_t fade_length);
+ StripSilence (Session &, const AudioIntervalMap&, samplecnt_t fade_length);
int run (boost::shared_ptr<ARDOUR::Region>, Progress* progress = 0);
private:
const AudioIntervalMap& _smap;
- framecnt_t _fade_length; ///< fade in/out to use on trimmed regions, in samples
+ samplecnt_t _fade_length; ///< fade in/out to use on trimmed regions, in samples
};
}
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h
index 78d18dd122..99c28b5748 100644
--- a/libs/ardour/ardour/tempo.h
+++ b/libs/ardour/ardour/tempo.h
@@ -79,17 +79,17 @@ class LIBARDOUR_API Tempo {
double end_pulses_per_minute () const { return end_note_types_per_minute (1.0); }
/** audio samples per note type.
- * if you want an instantaneous value for this, use TempoMap::frames_per_quarter_note_at() instead.
+ * if you want an instantaneous value for this, use TempoMap::samples_per_quarter_note_at() instead.
* @param sr samplerate
*/
- double frames_per_note_type (framecnt_t sr) const {
+ double samples_per_note_type (samplecnt_t sr) const {
return (60.0 * sr) / _note_types_per_minute;
}
/** audio samples per quarter note.
- * if you want an instantaneous value for this, use TempoMap::frames_per_quarter_note_at() instead.
+ * if you want an instantaneous value for this, use TempoMap::samples_per_quarter_note_at() instead.
* @param sr samplerate
*/
- double frames_per_quarter_note (framecnt_t sr) const {
+ double samples_per_quarter_note (samplecnt_t sr) const {
return (60.0 * sr) / quarter_notes_per_minute ();
}
@@ -108,8 +108,8 @@ class LIBARDOUR_API Meter {
double divisions_per_bar () const { return _divisions_per_bar; }
double note_divisor() const { return _note_type; }
- double frames_per_bar (const Tempo&, framecnt_t sr) const;
- double frames_per_grid (const Tempo&, framecnt_t sr) const;
+ double samples_per_bar (const Tempo&, samplecnt_t sr) const;
+ double samples_per_grid (const Tempo&, samplecnt_t sr) const;
inline bool operator==(const Meter& other)
{ return _divisions_per_bar == other.divisions_per_bar() && _note_type == other.note_divisor(); }
@@ -130,7 +130,7 @@ class LIBARDOUR_API Meter {
/** A section of timeline with a certain Tempo or Meter. */
class LIBARDOUR_API MetricSection {
public:
- MetricSection (double pulse, double minute, PositionLockStyle pls, bool is_tempo, framecnt_t sample_rate)
+ MetricSection (double pulse, double minute, PositionLockStyle pls, bool is_tempo, samplecnt_t sample_rate)
: _pulse (pulse), _minute (minute), _initial (false), _position_lock_style (pls), _is_tempo (is_tempo), _sample_rate (sample_rate) {}
virtual ~MetricSection() {}
@@ -143,7 +143,7 @@ class LIBARDOUR_API MetricSection {
_minute = m;
}
- framepos_t frame () const { return frame_at_minute (_minute); }
+ samplepos_t sample () const { return sample_at_minute (_minute); }
void set_initial (bool yn) { _initial = yn; }
bool initial() const { return _initial; }
@@ -160,8 +160,8 @@ class LIBARDOUR_API MetricSection {
void set_position_lock_style (PositionLockStyle ps) { _position_lock_style = ps; }
bool is_tempo () const { return _is_tempo; }
- framepos_t frame_at_minute (const double& time) const;
- double minute_at_frame (const framepos_t frame) const;
+ samplepos_t sample_at_minute (const double& time) const;
+ double minute_at_sample (const samplepos_t sample) const;
protected:
void add_state_to_node (XMLNode& node) const;
@@ -173,16 +173,16 @@ private:
bool _initial;
PositionLockStyle _position_lock_style;
const bool _is_tempo;
- framecnt_t _sample_rate;
+ samplecnt_t _sample_rate;
};
/** A section of timeline with a certain Meter. */
class LIBARDOUR_API MeterSection : public MetricSection, public Meter {
public:
- MeterSection (double pulse, double minute, double beat, const Timecode::BBT_Time& bbt, double bpb, double note_type, PositionLockStyle pls, framecnt_t sr)
+ MeterSection (double pulse, double minute, double beat, const Timecode::BBT_Time& bbt, double bpb, double note_type, PositionLockStyle pls, samplecnt_t sr)
: MetricSection (pulse, minute, pls, false, sr), Meter (bpb, note_type), _bbt (bbt), _beat (beat) {}
- MeterSection (const XMLNode&, const framecnt_t sample_rate);
+ MeterSection (const XMLNode&, const samplecnt_t sample_rate);
static const std::string xml_state_node_name;
@@ -210,10 +210,10 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
Constant,
};
- TempoSection (const double& pulse, const double& minute, Tempo tempo, PositionLockStyle pls, framecnt_t sr)
+ TempoSection (const double& pulse, const double& minute, Tempo tempo, PositionLockStyle pls, samplecnt_t sr)
: MetricSection (pulse, minute, pls, true, sr), Tempo (tempo), _c (0.0), _active (true), _locked_to_meter (false), _clamped (false) {}
- TempoSection (const XMLNode&, const framecnt_t sample_rate);
+ TempoSection (const XMLNode&, const samplecnt_t sample_rate);
static const std::string xml_state_node_name;
@@ -245,8 +245,8 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
double compute_c_pulse (const double& end_ntpm, const double& end_pulse) const;
double compute_c_minute (const double& end_ntpm, const double& end_minute) const;
- double pulse_at_frame (const framepos_t frame) const;
- framepos_t frame_at_pulse (const double& pulse) const;
+ double pulse_at_sample (const samplepos_t sample) const;
+ samplepos_t sample_at_pulse (const double& pulse) const;
Timecode::BBT_Time legacy_bbt () { return _legacy_bbt; }
@@ -330,7 +330,7 @@ class LIBARDOUR_API TempoMetric {
class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
{
public:
- TempoMap (framecnt_t frame_rate);
+ TempoMap (samplecnt_t sample_rate);
~TempoMap();
TempoMap& operator= (TempoMap const &);
@@ -345,18 +345,18 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
struct BBTPoint {
Meter meter;
Tempo tempo;
- framepos_t frame;
+ samplepos_t sample;
uint32_t bar;
uint32_t beat;
double qn;
- BBTPoint (const MeterSection& m, const Tempo& t, framepos_t f,
+ BBTPoint (const MeterSection& m, const Tempo& t, samplepos_t f,
uint32_t b, uint32_t e, double qnote)
- : meter (m), tempo (t), frame (f), bar (b), beat (e), qn (qnote) {}
+ : meter (m), tempo (t), sample (f), bar (b), beat (e), qn (qnote) {}
Timecode::BBT_Time bbt() const { return Timecode::BBT_Time (bar, beat, 0); }
operator Timecode::BBT_Time() const { return bbt(); }
- operator framepos_t() const { return frame; }
+ operator samplepos_t() const { return sample; }
bool is_bar() const { return beat == 1; }
};
@@ -366,17 +366,17 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
}
void get_grid (std::vector<BBTPoint>&,
- framepos_t start, framepos_t end, uint32_t bar_mod = 0);
+ samplepos_t start, samplepos_t end, uint32_t bar_mod = 0);
static const Tempo& default_tempo() { return _default_tempo; }
static const Meter& default_meter() { return _default_meter; }
/* because tempi may be ramped, this is only valid for the instant requested.*/
- double frames_per_quarter_note_at (const framepos_t, const framecnt_t sr) const;
+ double samples_per_quarter_note_at (const samplepos_t, const samplecnt_t sr) const;
- const TempoSection& tempo_section_at_frame (framepos_t frame) const;
- TempoSection& tempo_section_at_frame (framepos_t frame);
- const MeterSection& meter_section_at_frame (framepos_t frame) const;
+ const TempoSection& tempo_section_at_sample (samplepos_t sample) const;
+ TempoSection& tempo_section_at_sample (samplepos_t sample);
+ const MeterSection& meter_section_at_sample (samplepos_t sample) const;
const MeterSection& meter_section_at_beat (double beat) const;
TempoSection* previous_tempo_section (TempoSection*) const;
@@ -384,37 +384,37 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
/** add a tempo section locked to pls. ignored values will be set in recompute_tempi()
* @param pulse pulse position of new section. ignored if pls == AudioTime
- * @param frame frame position of new section. ignored if pls == MusicTime
+ * @param sample frame position of new section. ignored if pls == MusicTime
* @param type type of new tempo section (Ramp, Constant)
*/
- TempoSection* add_tempo (const Tempo&, const double& pulse, const framepos_t frame, PositionLockStyle pls);
+ TempoSection* add_tempo (const Tempo&, const double& pulse, const samplepos_t sample, PositionLockStyle pls);
/** add a meter section locked to pls.. ignored values will be set in recompute_meters()
* @param meter the Meter to be added
* @param where bbt position of new section
- * @param frame frame position of new section. ignored if pls == MusicTime
- * note that @frame may also be ignored if it would create an un-solvable map
- * (previous audio-locked tempi may place the requested beat at an earlier time than frame)
+ * @param sample frame position of new section. ignored if pls == MusicTime
+ * note that @sample may also be ignored if it would create an un-solvable map
+ * (previous audio-locked tempi may place the requested beat at an earlier time than sample)
* in which case the new meter will be placed at the specified BBT.
* @param pls the position lock style
*
* adding an audio-locked meter will add a meter-locked tempo section at the meter position.
* the meter-locked tempo tempo will be the Tempo at @beat
*/
- MeterSection* add_meter (const Meter& meter, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls);
+ MeterSection* add_meter (const Meter& meter, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls);
void remove_tempo (const TempoSection&, bool send_signal);
void remove_meter (const MeterSection&, bool send_signal);
- void replace_tempo (TempoSection&, const Tempo&, const double& pulse, const framepos_t frame, PositionLockStyle pls);
+ void replace_tempo (TempoSection&, const Tempo&, const double& pulse, const samplepos_t sample, PositionLockStyle pls);
- void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls);
+ void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls);
- MusicFrame round_to_bar (framepos_t frame, RoundMode dir);
- MusicFrame round_to_beat (framepos_t frame, RoundMode dir);
- MusicFrame round_to_quarter_note_subdivision (framepos_t fr, int sub_num, RoundMode dir);
+ MusicSample round_to_bar (samplepos_t sample, RoundMode dir);
+ MusicSample round_to_beat (samplepos_t sample, RoundMode dir);
+ MusicSample round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundMode dir);
- void set_length (framepos_t frames);
+ void set_length (samplepos_t samples);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version);
@@ -424,27 +424,27 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
TempoMetric metric_at (Timecode::BBT_Time bbt) const;
- /** Return the TempoMetric at frame @p t, and point @p last to the latest
+ /** Return the TempoMetric at sample @p t, and point @p last to the latest
* metric change <= t, if it is non-NULL.
*/
- TempoMetric metric_at (framepos_t, Metrics::const_iterator* last=NULL) const;
+ TempoMetric metric_at (samplepos_t, Metrics::const_iterator* last=NULL) const;
Metrics::const_iterator metrics_end() { return _metrics.end(); }
- void change_existing_tempo_at (framepos_t, double bpm, double note_type, double end_ntpm);
+ void change_existing_tempo_at (samplepos_t, double bpm, double note_type, double end_ntpm);
void change_initial_tempo (double ntpm, double note_type, double end_ntpm);
- void insert_time (framepos_t, framecnt_t);
- bool remove_time (framepos_t where, framecnt_t amount); //returns true if anything was moved
+ void insert_time (samplepos_t, samplecnt_t);
+ bool remove_time (samplepos_t where, samplecnt_t amount); //returns true if anything was moved
int n_tempos () const;
int n_meters () const;
- framecnt_t frame_rate () const { return _frame_rate; }
+ samplecnt_t sample_rate () const { return _sample_rate; }
/* TEMPO- AND METER-SENSITIVE FUNCTIONS
- bbt_at_frame(), frame_at_bbt(), beat_at_frame(), frame_at_beat()
+ bbt_at_sample(), sample_at_bbt(), beat_at_sample(), sample_at_beat()
and bbt_duration_at()
are all sensitive to tempo and meter, and will give answers
that align with the grid formed by tempo and meter sections.
@@ -453,17 +453,17 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
whose location is canonically defined in Evoral::Beats.
*/
- double beat_at_frame (const framecnt_t frame) const;
- framepos_t frame_at_beat (const double& beat) const;
+ double beat_at_sample (const samplecnt_t sample) const;
+ samplepos_t sample_at_beat (const double& beat) const;
- const Meter& meter_at_frame (framepos_t) const;
+ const Meter& meter_at_sample (samplepos_t) const;
/* bbt - it's nearly always better to use meter-based beat (above)
unless tick resolution is desirable.
*/
- Timecode::BBT_Time bbt_at_frame (framepos_t when);
- Timecode::BBT_Time bbt_at_frame_rt (framepos_t when);
- framepos_t frame_at_bbt (const Timecode::BBT_Time&);
+ Timecode::BBT_Time bbt_at_sample (samplepos_t when);
+ Timecode::BBT_Time bbt_at_sample_rt (samplepos_t when);
+ samplepos_t sample_at_bbt (const Timecode::BBT_Time&);
double beat_at_bbt (const Timecode::BBT_Time& bbt);
Timecode::BBT_Time bbt_at_beat (const double& beats);
@@ -472,8 +472,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
double quarter_note_at_bbt_rt (const Timecode::BBT_Time& bbt);
Timecode::BBT_Time bbt_at_quarter_note (const double& quarter_note);
- framecnt_t bbt_duration_at (framepos_t, const Timecode::BBT_Time&, int dir);
- framepos_t framepos_plus_bbt (framepos_t pos, Timecode::BBT_Time b) const;
+ samplecnt_t bbt_duration_at (samplepos_t, const Timecode::BBT_Time&, int dir);
+ samplepos_t samplepos_plus_bbt (samplepos_t pos, Timecode::BBT_Time b) const;
/* TEMPO-SENSITIVE FUNCTIONS
@@ -485,46 +485,46 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
whose location is canonically defined in Evoral::Beats.
*/
- framepos_t framepos_plus_qn (framepos_t, Evoral::Beats) const;
- Evoral::Beats framewalk_to_qn (framepos_t pos, framecnt_t distance) const;
+ samplepos_t samplepos_plus_qn (samplepos_t, Evoral::Beats) const;
+ Evoral::Beats framewalk_to_qn (samplepos_t pos, samplecnt_t distance) const;
/* quarter note related functions are also tempo-sensitive and ignore meter.
quarter notes may be compared with and assigned to Evoral::Beats.
*/
- double quarter_note_at_frame (const framepos_t frame) const;
- double quarter_note_at_frame_rt (const framepos_t frame) const;
- framepos_t frame_at_quarter_note (const double quarter_note) const;
+ double quarter_note_at_sample (const samplepos_t sample) const;
+ double quarter_note_at_sample_rt (const samplepos_t sample) const;
+ samplepos_t sample_at_quarter_note (const double quarter_note) const;
- framecnt_t frames_between_quarter_notes (const double start, const double end) const;
- double quarter_notes_between_frames (const framecnt_t start, const framecnt_t end) const;
+ samplecnt_t samples_between_quarter_notes (const double start, const double end) const;
+ double quarter_notes_between_samples (const samplecnt_t start, const samplecnt_t end) const;
double quarter_note_at_beat (const double beat) const;
double beat_at_quarter_note (const double beat) const;
- /* obtain a musical subdivision via a frame position and magic note divisor.*/
- double exact_qn_at_frame (const framepos_t frame, const int32_t sub_num) const;
- double exact_beat_at_frame (const framepos_t frame, const int32_t sub_num) const;
+ /* obtain a musical subdivision via a sample position and magic note divisor.*/
+ double exact_qn_at_sample (const samplepos_t sample, const int32_t sub_num) const;
+ double exact_beat_at_sample (const samplepos_t sample, const int32_t sub_num) const;
- Tempo tempo_at_frame (const framepos_t frame) const;
- framepos_t frame_at_tempo (const Tempo& tempo) const;
+ Tempo tempo_at_sample (const samplepos_t sample) const;
+ samplepos_t sample_at_tempo (const Tempo& tempo) const;
Tempo tempo_at_quarter_note (const double& beat) const;
double quarter_note_at_tempo (const Tempo& tempo) const;
- void gui_set_tempo_position (TempoSection*, const framepos_t frame, const int& sub_num);
- void gui_set_meter_position (MeterSection*, const framepos_t frame);
+ void gui_set_tempo_position (TempoSection*, const samplepos_t sample, const int& sub_num);
+ void gui_set_meter_position (MeterSection*, const samplepos_t sample);
bool gui_change_tempo (TempoSection*, const Tempo& bpm);
- void gui_stretch_tempo (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame, const double start_qnote, const double end_qnote);
- void gui_stretch_tempo_end (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame);
- bool gui_twist_tempi (TempoSection* first, const Tempo& bpm, const framepos_t frame, const framepos_t end_frame);
+ void gui_stretch_tempo (TempoSection* tempo, const samplepos_t sample, const samplepos_t end_sample, const double start_qnote, const double end_qnote);
+ void gui_stretch_tempo_end (TempoSection* tempo, const samplepos_t sample, const samplepos_t end_sample);
+ bool gui_twist_tempi (TempoSection* first, const Tempo& bpm, const samplepos_t sample, const samplepos_t end_sample);
- std::pair<double, framepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt);
+ std::pair<double, samplepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt);
bool can_solve_bbt (TempoSection* section, const Timecode::BBT_Time& bbt);
PBD::Signal1<void,const PBD::PropertyChange&> MetricPositionChanged;
void fix_legacy_session();
void fix_legacy_end_session();
- framepos_t music_origin ();
+ samplepos_t music_origin ();
private:
/* prevent copy construction */
@@ -558,7 +558,7 @@ private:
Timecode::BBT_Time bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
double minutes_between_quarter_notes_locked (const Metrics& metrics, const double start_qn, const double end_qn) const;
- double quarter_notes_between_frames_locked (const Metrics& metrics, const framecnt_t start, const framecnt_t end) const;
+ double quarter_notes_between_samples_locked (const Metrics& metrics, const samplecnt_t start, const samplecnt_t end) const;
const TempoSection& tempo_section_at_minute_locked (const Metrics& metrics, double minute) const;
TempoSection& tempo_section_at_minute_locked (const Metrics& metrics, double minute);
@@ -568,18 +568,18 @@ private:
const MeterSection& meter_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
bool check_solved (const Metrics& metrics) const;
- bool set_active_tempi (const Metrics& metrics, const framepos_t frame);
+ bool set_active_tempi (const Metrics& metrics, const samplepos_t sample);
bool solve_map_minute (Metrics& metrics, TempoSection* section, const double& minute);
bool solve_map_pulse (Metrics& metrics, TempoSection* section, const double& pulse);
bool solve_map_minute (Metrics& metrics, MeterSection* section, const double& minute);
bool solve_map_bbt (Metrics& metrics, MeterSection* section, const Timecode::BBT_Time& bbt);
- double exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t sub_num) const;
- double exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t sub_num) const;
+ double exact_beat_at_sample_locked (const Metrics& metrics, const samplepos_t sample, const int32_t sub_num) const;
+ double exact_qn_at_sample_locked (const Metrics& metrics, const samplepos_t sample, const int32_t sub_num) const;
- double minute_at_frame (const framepos_t frame) const;
- framepos_t frame_at_minute (const double minute) const;
+ double minute_at_sample (const samplepos_t sample) const;
+ samplepos_t sample_at_minute (const double minute) const;
friend class ::BBTTest;
friend class ::FrameposPlusBeatsTest;
@@ -590,14 +590,14 @@ private:
static Meter _default_meter;
Metrics _metrics;
- framecnt_t _frame_rate;
+ samplecnt_t _sample_rate;
mutable Glib::Threads::RWLock lock;
void recompute_tempi (Metrics& metrics);
void recompute_meters (Metrics& metrics);
- void recompute_map (Metrics& metrics, framepos_t end = -1);
+ void recompute_map (Metrics& metrics, samplepos_t end = -1);
- MusicFrame round_to_type (framepos_t fr, RoundMode dir, BBTPointType);
+ MusicSample round_to_type (samplepos_t fr, RoundMode dir, BBTPointType);
const MeterSection& first_meter() const;
MeterSection& first_meter();
@@ -609,7 +609,7 @@ private:
TempoSection* add_tempo_locked (const Tempo&, double pulse, double minute
, PositionLockStyle pls, bool recompute, bool locked_to_meter = false, bool clamped = false);
- MeterSection* add_meter_locked (const Meter&, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls, bool recompute);
+ MeterSection* add_meter_locked (const Meter&, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls, bool recompute);
bool remove_tempo_locked (const TempoSection&);
bool remove_meter_locked (const MeterSection&);
diff --git a/libs/ardour/ardour/thread_buffers.h b/libs/ardour/ardour/thread_buffers.h
index 12e549fe55..cf8e31c692 100644
--- a/libs/ardour/ardour/thread_buffers.h
+++ b/libs/ardour/ardour/thread_buffers.h
@@ -50,7 +50,7 @@ public:
uint32_t npan_buffers;
private:
- void allocate_pan_automation_buffers (framecnt_t nframes, uint32_t howmany, bool force);
+ void allocate_pan_automation_buffers (samplecnt_t nframes, uint32_t howmany, bool force);
};
} // namespace
diff --git a/libs/ardour/ardour/ticker.h b/libs/ardour/ardour/ticker.h
index fbca0161d4..93d7a79041 100644
--- a/libs/ardour/ardour/ticker.h
+++ b/libs/ardour/ardour/ticker.h
@@ -42,7 +42,7 @@ public:
MidiClockTicker ();
virtual ~MidiClockTicker();
- void tick (const framepos_t& transport_frames, pframes_t nframes);
+ void tick (const samplepos_t& transport_samples, pframes_t nframes);
bool has_midi_port() const { return _midi_port != 0; }
@@ -74,7 +74,7 @@ public:
class Position;
boost::scoped_ptr<Position> _pos;
- double one_ppqn_in_frames (framepos_t transport_position);
+ double one_ppqn_in_samples (samplepos_t transport_position);
void send_midi_clock_event (pframes_t offset, pframes_t nframes);
void send_start_event (pframes_t offset, pframes_t nframes);
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h
index 055ac93707..9d00f812d3 100644
--- a/libs/ardour/ardour/track.h
+++ b/libs/ardour/ardour/track.h
@@ -69,17 +69,17 @@ class LIBARDOUR_API Track : public Route, public Recordable
bool set_processor_state (XMLNode const & node, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure);
- virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ virtual int no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
bool state_changing);
- virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ virtual int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
int declick, bool& need_butler) = 0;
bool needs_butler() const { return _needs_butler; }
bool can_record();
- void set_latency_compensation (framecnt_t);
+ void set_latency_compensation (samplecnt_t);
void update_latency_information ();
enum FreezeState {
NoFreeze,
@@ -117,9 +117,9 @@ class LIBARDOUR_API Track : public Route, public Recordable
* @param include_endpoint include the given processor in the bounced audio.
* @return a new audio region (or nil in case of error)
*/
- virtual boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo& itt,
+ virtual boost::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint, bool include_endpoint) = 0;
- virtual int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes,
+ virtual int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) = 0;
XMLNode& get_state();
@@ -150,27 +150,27 @@ class LIBARDOUR_API Track : public Route, public Recordable
int do_refill ();
int do_flush (RunContext, bool force = false);
void set_pending_overwrite (bool);
- int seek (framepos_t, bool complete_refill = false);
- int can_internal_playback_seek (framecnt_t);
- int internal_playback_seek (framecnt_t);
- void non_realtime_locate (framepos_t);
+ int seek (samplepos_t, bool complete_refill = false);
+ int can_internal_playback_seek (samplecnt_t);
+ int internal_playback_seek (samplecnt_t);
+ void non_realtime_locate (samplepos_t);
void realtime_handle_transport_stopped ();
void non_realtime_speed_change ();
int overwrite_existing_buffers ();
- framecnt_t get_captured_frames (uint32_t n = 0) const;
+ samplecnt_t get_captured_samples (uint32_t n = 0) const;
int set_loop (ARDOUR::Location *);
- void transport_looped (framepos_t);
+ void transport_looped (samplepos_t);
bool realtime_speed_change ();
void transport_stopped_wallclock (struct tm &, time_t, bool);
bool pending_overwrite () const;
- void prepare_to_stop (framepos_t, framepos_t);
+ void prepare_to_stop (samplepos_t, samplepos_t);
void set_slaved (bool);
ChanCount n_channels ();
- framepos_t get_capture_start_frame (uint32_t n = 0) const;
+ samplepos_t get_capture_start_sample (uint32_t n = 0) const;
AlignStyle alignment_style () const;
AlignChoice alignment_choice () const;
- framepos_t current_capture_start () const;
- framepos_t current_capture_end () const;
+ samplepos_t current_capture_start () const;
+ samplepos_t current_capture_end () const;
void set_align_style (AlignStyle, bool force=false);
void set_align_choice (AlignChoice, bool force=false);
void playlist_modified ();
@@ -228,7 +228,7 @@ class LIBARDOUR_API Track : public Route, public Recordable
XMLNode* pending_state;
bool _destructive;
- void maybe_declick (BufferSet&, framecnt_t, int);
+ void maybe_declick (BufferSet&, samplecnt_t, int);
boost::shared_ptr<AutomationControl> _record_enable_control;
boost::shared_ptr<AutomationControl> _record_safe_control;
@@ -236,7 +236,7 @@ class LIBARDOUR_API Track : public Route, public Recordable
virtual void record_enable_changed (bool, PBD::Controllable::GroupControlDisposition);
virtual void record_safe_changed (bool, PBD::Controllable::GroupControlDisposition);
- framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&);
+ samplecnt_t check_initial_delay (samplecnt_t nframes, samplepos_t&);
virtual void monitoring_changed (bool, PBD::Controllable::GroupControlDisposition);
AlignChoice _alignment_choice;
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index 3999c36aa3..d3ed94e552 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -65,27 +65,27 @@ namespace ARDOUR {
typedef uint64_t microseconds_t;
typedef uint32_t pframes_t;
- /* Any position measured in audio frames.
+ /* Any position measured in audio samples.
Assumed to be non-negative but not enforced.
*/
- typedef int64_t framepos_t;
+ typedef int64_t samplepos_t;
- /* Any distance from a given framepos_t.
+ /* Any distance from a given samplepos_t.
Maybe positive or negative.
*/
- typedef int64_t frameoffset_t;
+ typedef int64_t sampleoffset_t;
- /* Any count of audio frames.
+ /* Any count of audio samples.
Assumed to be positive but not enforced.
*/
- typedef int64_t framecnt_t;
+ typedef int64_t samplecnt_t;
- static const framepos_t max_framepos = INT64_MAX;
- static const framecnt_t max_framecnt = INT64_MAX;
+ static const samplepos_t max_samplepos = INT64_MAX;
+ static const samplecnt_t max_samplecnt = INT64_MAX;
static const layer_t max_layer = UINT32_MAX;
// a set of (time) intervals: first of pair is the offset of the start within the region, second is the offset of the end
- typedef std::list<std::pair<frameoffset_t, frameoffset_t> > AudioIntervalResult;
+ typedef std::list<std::pair<sampleoffset_t, sampleoffset_t> > AudioIntervalResult;
// associate a set of intervals with regions (e.g. for silence detection)
typedef std::map<boost::shared_ptr<ARDOUR::Region>,AudioIntervalResult> AudioIntervalMap;
@@ -251,7 +251,7 @@ namespace ARDOUR {
enum Type {
Timecode,
BBT,
- Frames,
+ Samples,
Seconds
};
@@ -261,11 +261,11 @@ namespace ARDOUR {
Timecode::BBT_Time bbt;
union {
- framecnt_t frames;
+ samplecnt_t samples;
double seconds;
};
- AnyTime() { type = Frames; frames = 0; }
+ AnyTime() { type = Samples; samples = 0; }
bool operator== (AnyTime const & other) const {
if (type != other.type) { return false; }
@@ -275,8 +275,8 @@ namespace ARDOUR {
return timecode == other.timecode;
case BBT:
return bbt == other.bbt;
- case Frames:
- return frames == other.frames;
+ case Samples:
+ return samples == other.samples;
case Seconds:
return seconds == other.seconds;
}
@@ -291,8 +291,8 @@ namespace ARDOUR {
timecode.seconds != 0 || timecode.frames != 0;
case BBT:
return bbt.bars != 0 || bbt.beats != 0 || bbt.ticks != 0;
- case Frames:
- return frames != 0;
+ case Samples:
+ return samples != 0;
case Seconds:
return seconds != 0;
}
@@ -302,38 +302,38 @@ namespace ARDOUR {
}
};
- /* used for translating audio frames to an exact musical position using a note divisor.
- an exact musical position almost never falls exactly on an audio frame, but for sub-sample
- musical accuracy we need to derive exact musical locations from a frame position
- the division follows TempoMap::exact_beat_at_frame().
+ /* used for translating audio samples to an exact musical position using a note divisor.
+ an exact musical position almost never falls exactly on an audio sample, but for sub-sample
+ musical accuracy we need to derive exact musical locations from a sample position
+ the division follows TempoMap::exact_beat_at_sample().
division
- -1 musical location is the bar closest to frame
- 0 musical location is the musical position of the frame
- 1 musical location is the BBT beat closest to frame
- n musical location is the quarter-note division n closest to frame
+ -1 musical location is the bar closest to sample
+ 0 musical location is the musical position of the sample
+ 1 musical location is the BBT beat closest to sample
+ n musical location is the quarter-note division n closest to sample
*/
- struct MusicFrame {
- framepos_t frame;
+ struct MusicSample {
+ samplepos_t sample;
int32_t division;
- MusicFrame (framepos_t f, int32_t d) : frame (f), division (d) {}
+ MusicSample (samplepos_t f, int32_t d) : sample (f), division (d) {}
- void set (framepos_t f, int32_t d) {frame = f; division = d; }
+ void set (samplepos_t f, int32_t d) {sample = f; division = d; }
- MusicFrame operator- (MusicFrame other) { return MusicFrame (frame - other.frame, 0); }
+ MusicSample operator- (MusicSample other) { return MusicSample (sample - other.sample, 0); }
};
/* XXX: slightly unfortunate that there is this and Evoral::Range<>,
but this has a uint32_t id which Evoral::Range<> does not.
*/
struct AudioRange {
- framepos_t start;
- framepos_t end;
+ samplepos_t start;
+ samplepos_t end;
uint32_t id;
- AudioRange (framepos_t s, framepos_t e, uint32_t i) : start (s), end (e) , id (i) {}
+ AudioRange (samplepos_t s, samplepos_t e, uint32_t i) : start (s), end (e) , id (i) {}
- framecnt_t length() const { return end - start + 1; }
+ samplecnt_t length() const { return end - start + 1; }
bool operator== (const AudioRange& other) const {
return start == other.start && end == other.end && id == other.id;
@@ -343,7 +343,7 @@ namespace ARDOUR {
return start == other.start && end == other.end;
}
- Evoral::OverlapType coverage (framepos_t s, framepos_t e) const {
+ Evoral::OverlapType coverage (samplepos_t s, samplepos_t e) const {
return Evoral::coverage (start, end, s, e);
}
};
@@ -570,7 +570,7 @@ namespace ARDOUR {
SrcFastest
};
- typedef std::list<framepos_t> AnalysisFeatureList;
+ typedef std::list<samplepos_t> AnalysisFeatureList;
typedef std::list<boost::shared_ptr<Route> > RouteList;
typedef std::list<boost::shared_ptr<Stripable> > StripableList;
@@ -712,38 +712,38 @@ namespace ARDOUR {
};
struct CaptureInfo {
- framepos_t start;
- framecnt_t frames;
+ samplepos_t start;
+ samplecnt_t samples;
};
typedef std::vector<CaptureInfo*> CaptureInfos;
} // namespace ARDOUR
-static inline ARDOUR::framepos_t
-session_frame_to_track_frame (ARDOUR::framepos_t session_frame, double speed)
+static inline ARDOUR::samplepos_t
+session_sample_to_track_sample (ARDOUR::samplepos_t session_sample, double speed)
{
- long double result = (long double) session_frame * (long double) speed;
+ long double result = (long double) session_sample * (long double) speed;
- if (result >= (long double) ARDOUR::max_framepos) {
- return ARDOUR::max_framepos;
- } else if (result <= (long double) (ARDOUR::max_framepos) * (ARDOUR::framepos_t)(-1)) {
- return (ARDOUR::max_framepos * (ARDOUR::framepos_t)(-1));
+ if (result >= (long double) ARDOUR::max_samplepos) {
+ return ARDOUR::max_samplepos;
+ } else if (result <= (long double) (ARDOUR::max_samplepos) * (ARDOUR::samplepos_t)(-1)) {
+ return (ARDOUR::max_samplepos * (ARDOUR::samplepos_t)(-1));
} else {
return result;
}
}
-static inline ARDOUR::framepos_t
-track_frame_to_session_frame (ARDOUR::framepos_t track_frame, double speed)
+static inline ARDOUR::samplepos_t
+track_sample_to_session_sample (ARDOUR::samplepos_t track_sample, double speed)
{
/* NB - do we need a check for speed == 0 ??? */
- long double result = (long double) track_frame / (long double) speed;
+ long double result = (long double) track_sample / (long double) speed;
- if (result >= (long double) ARDOUR::max_framepos) {
- return ARDOUR::max_framepos;
- } else if (result <= (long double) (ARDOUR::max_framepos) * (ARDOUR::framepos_t)(-1)) {
- return (ARDOUR::max_framepos * (ARDOUR::framepos_t)(-1));
+ if (result >= (long double) ARDOUR::max_samplepos) {
+ return ARDOUR::max_samplepos;
+ } else if (result <= (long double) (ARDOUR::max_samplepos) * (ARDOUR::samplepos_t)(-1)) {
+ return (ARDOUR::max_samplepos * (ARDOUR::samplepos_t)(-1));
} else {
return result;
}
@@ -751,7 +751,7 @@ track_frame_to_session_frame (ARDOUR::framepos_t track_frame, double speed)
/* for now, break the rules and use "using" to make this "global" */
-using ARDOUR::framepos_t;
+using ARDOUR::samplepos_t;
#endif /* __ardour_types_h__ */
diff --git a/libs/ardour/ardour/unknown_processor.h b/libs/ardour/ardour/unknown_processor.h
index 170be38042..33d32f5b34 100644
--- a/libs/ardour/ardour/unknown_processor.h
+++ b/libs/ardour/ardour/unknown_processor.h
@@ -46,7 +46,7 @@ public:
virtual ~UnknownProcessor ();
bool can_support_io_configuration (const ChanCount &, ChanCount &);
- void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/);
+ void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/);
XMLNode & state (bool);
diff --git a/libs/ardour/ardour/uri_map.h b/libs/ardour/ardour/uri_map.h
index de0999d94f..9c1aee30e9 100644
--- a/libs/ardour/ardour/uri_map.h
+++ b/libs/ardour/ardour/uri_map.h
@@ -78,7 +78,7 @@ public:
uint32_t time_beatUnit;
uint32_t time_beatsPerBar;
uint32_t time_beatsPerMinute;
- uint32_t time_frame;
+ uint32_t time_sample;
uint32_t time_speed;
uint32_t patch_Get;
uint32_t patch_Set;
diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h
index 77dc8236a7..3e5ff1b1a1 100644
--- a/libs/ardour/ardour/utils.h
+++ b/libs/ardour/ardour/utils.h
@@ -73,7 +73,7 @@ LIBARDOUR_API int cmp_nocase_utf8 (const std::string& s1, const std::string& s2)
LIBARDOUR_API std::string region_name_from_path (std::string path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0);
LIBARDOUR_API bool path_is_paired (std::string path, std::string& pair_base);
-LIBARDOUR_API void compute_equal_power_fades (ARDOUR::framecnt_t nframes, float* in, float* out);
+LIBARDOUR_API void compute_equal_power_fades (ARDOUR::samplecnt_t nframes, float* in, float* out);
LIBARDOUR_API const char* sync_source_to_string (ARDOUR::SyncSource src, bool sh = false);
LIBARDOUR_API ARDOUR::SyncSource string_to_sync_source (std::string str);
diff --git a/libs/ardour/ardour/vestige/aeffectx.h b/libs/ardour/ardour/vestige/aeffectx.h
index a9a168ed1d..40356d3455 100644
--- a/libs/ardour/ardour/vestige/aeffectx.h
+++ b/libs/ardour/ardour/vestige/aeffectx.h
@@ -159,7 +159,7 @@ struct _VstMidiEvent
// 04
int byteSize;
// 08
- int deltaFrames;
+ int deltaSamples;
// 0c?
int flags;
// 10?
diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h
index bb172d9efd..74c53ae812 100644
--- a/libs/ardour/ardour/vst_plugin.h
+++ b/libs/ardour/ardour/vst_plugin.h
@@ -58,7 +58,7 @@ public:
bool load_preset (PresetRecord);
int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
std::string describe_parameter (Evoral::Parameter);
- framecnt_t signal_latency() const;
+ samplecnt_t signal_latency() const;
std::set<Evoral::Parameter> automatable() const;
PBD::Signal0<void> LoadPresetProgram;
@@ -72,9 +72,9 @@ public:
uint32_t designated_bypass_port ();
int connect_and_run (BufferSet&,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset
+ pframes_t nframes, samplecnt_t offset
);
std::string unique_id () const;
@@ -98,7 +98,7 @@ public:
PluginInsert* plugin_insert () const { return _pi; }
uint32_t plugin_number () const { return _num; }
VstTimeInfo* timeinfo () { return &_timeInfo; }
- framepos_t transport_frame () const { return _transport_frame; }
+ samplepos_t transport_sample () const { return _transport_sample; }
float transport_speed () const { return _transport_speed; }
@@ -126,7 +126,7 @@ protected:
MidiBuffer* _midi_out_buf;
VstTimeInfo _timeInfo;
- framepos_t _transport_frame;
+ samplepos_t _transport_sample;
float _transport_speed;
mutable std::map <uint32_t, float> _parameter_defaults;
bool _eff_bypassed;
diff --git a/libs/ardour/async_midi_port.cc b/libs/ardour/async_midi_port.cc
index f7147676b0..c7117429fb 100644
--- a/libs/ardour/async_midi_port.cc
+++ b/libs/ardour/async_midi_port.cc
@@ -59,7 +59,7 @@ AsyncMIDIPort::~AsyncMIDIPort ()
}
void
-AsyncMIDIPort::set_timer (boost::function<MIDI::framecnt_t (void)>& f)
+AsyncMIDIPort::set_timer (boost::function<MIDI::samplecnt_t (void)>& f)
{
timer = f;
have_timer = true;
@@ -131,7 +131,7 @@ AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes)
if (ARDOUR::Port::receives_input()) {
MidiBuffer& mb (get_midi_buffer (nframes));
- framecnt_t when;
+ samplecnt_t when;
if (have_timer) {
when = timer ();
@@ -326,7 +326,7 @@ AsyncMIDIPort::read (MIDI::byte *, size_t)
}
void
-AsyncMIDIPort::parse (MIDI::framecnt_t)
+AsyncMIDIPort::parse (MIDI::samplecnt_t)
{
MIDI::byte buf[1];
diff --git a/libs/ardour/audio_buffer.cc b/libs/ardour/audio_buffer.cc
index 89e210c772..247b4cfebb 100644
--- a/libs/ardour/audio_buffer.cc
+++ b/libs/ardour/audio_buffer.cc
@@ -80,7 +80,7 @@ AudioBuffer::check_silence (pframes_t nframes, pframes_t& n) const
}
void
-AudioBuffer::silence (framecnt_t len, framecnt_t offset) {
+AudioBuffer::silence (samplecnt_t len, samplecnt_t offset) {
if (!_silent) {
assert(_capacity > 0);
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index 4f95bbdc8a..64d47491d7 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -63,13 +63,13 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, stri
{
}
-AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, framepos_t start, framecnt_t cnt, string name, bool hidden)
+AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, samplepos_t start, samplecnt_t cnt, string name, bool hidden)
: Playlist (other, start, cnt, name, hidden)
{
RegionReadLock rlock2 (const_cast<AudioPlaylist*> (other.get()));
in_set_state++;
- framepos_t const end = start + cnt - 1;
+ samplepos_t const end = start + cnt - 1;
/* Audio regions that have been created by the Playlist constructor
will currently have the same fade in/out as the regions that they
@@ -82,8 +82,8 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, fram
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (*i);
assert (region);
- framecnt_t fade_in = 64;
- framecnt_t fade_out = 64;
+ samplecnt_t fade_in = 64;
+ samplecnt_t fade_out = 64;
switch (region->coverage (start, end)) {
case Evoral::OverlapNone:
@@ -91,8 +91,8 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, fram
case Evoral::OverlapInternal:
{
- framecnt_t const offset = start - region->position ();
- framecnt_t const trim = region->last_frame() - end;
+ samplecnt_t const offset = start - region->position ();
+ samplecnt_t const trim = region->last_sample() - end;
if (region->fade_in()->back()->when > offset) {
fade_in = region->fade_in()->back()->when - offset;
}
@@ -105,13 +105,13 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, fram
case Evoral::OverlapStart: {
if (end > region->position() + region->fade_in()->back()->when)
fade_in = region->fade_in()->back()->when; //end is after fade-in, preserve the fade-in
- if (end > region->last_frame() - region->fade_out()->back()->when)
- fade_out = region->fade_out()->back()->when - ( region->last_frame() - end ); //end is inside the fadeout, preserve the fades endpoint
+ if (end > region->last_sample() - region->fade_out()->back()->when)
+ fade_out = region->fade_out()->back()->when - ( region->last_sample() - end ); //end is inside the fadeout, preserve the fades endpoint
break;
}
case Evoral::OverlapEnd: {
- if (start < region->last_frame() - region->fade_out()->back()->when) //start is before fade-out, preserve the fadeout
+ if (start < region->last_sample() - region->fade_out()->back()->when) //start is before fade-out, preserve the fadeout
fade_out = region->fade_out()->back()->when;
if (start < region->position() + region->fade_in()->back()->when)
@@ -151,18 +151,18 @@ struct ReadSorter {
/** A segment of region that needs to be read */
struct Segment {
- Segment (boost::shared_ptr<AudioRegion> r, Evoral::Range<framepos_t> a) : region (r), range (a) {}
+ Segment (boost::shared_ptr<AudioRegion> r, Evoral::Range<samplepos_t> a) : region (r), range (a) {}
boost::shared_ptr<AudioRegion> region; ///< the region
- Evoral::Range<framepos_t> range; ///< range of the region to read, in session frames
+ Evoral::Range<samplepos_t> range; ///< range of the region to read, in session samples
};
-/** @param start Start position in session frames.
- * @param cnt Number of frames to read.
+/** @param start Start position in session samples.
+ * @param cnt Number of samples to read.
*/
-ARDOUR::framecnt_t
-AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, framepos_t start,
- framecnt_t cnt, unsigned chan_n)
+ARDOUR::samplecnt_t
+AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, samplepos_t start,
+ samplecnt_t cnt, unsigned chan_n)
{
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Playlist %1 read @ %2 for %3, channel %4, regions %5 mixdown @ %6 gain @ %7\n",
name(), start, cnt, chan_n, regions.size(), mixdown_buffer, gain_buffer));
@@ -196,9 +196,9 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
/* This will be a list of the bits of our read range that we have
handled completely (ie for which no more regions need to be read).
- It is a list of ranges in session frames.
+ It is a list of ranges in session samples.
*/
- Evoral::RangeList<framepos_t> done;
+ Evoral::RangeList<samplepos_t> done;
/* This will be a list of the bits of regions that we need to read */
list<Segment> to_do;
@@ -214,27 +214,27 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
/* Work out which bits of this region need to be read;
first, trim to the range we are reading...
*/
- Evoral::Range<framepos_t> region_range = ar->range ();
+ Evoral::Range<samplepos_t> region_range = ar->range ();
region_range.from = max (region_range.from, start);
region_range.to = min (region_range.to, start + cnt - 1);
/* ... and then remove the bits that are already done */
- Evoral::RangeList<framepos_t> region_to_do = Evoral::subtract (region_range, done);
+ Evoral::RangeList<samplepos_t> region_to_do = Evoral::subtract (region_range, done);
/* Make a note to read those bits, adding their bodies (the parts between end-of-fade-in
and start-of-fade-out) to the `done' list.
*/
- Evoral::RangeList<framepos_t>::List t = region_to_do.get ();
+ Evoral::RangeList<samplepos_t>::List t = region_to_do.get ();
- for (Evoral::RangeList<framepos_t>::List::iterator j = t.begin(); j != t.end(); ++j) {
- Evoral::Range<framepos_t> d = *j;
+ for (Evoral::RangeList<samplepos_t>::List::iterator j = t.begin(); j != t.end(); ++j) {
+ Evoral::Range<samplepos_t> d = *j;
to_do.push_back (Segment (ar, d));
if (ar->opaque ()) {
/* Cut this range down to just the body and mark it done */
- Evoral::Range<framepos_t> body = ar->body_range ();
+ Evoral::Range<samplepos_t> body = ar->body_range ();
if (body.from < d.to && body.to > d.from) {
d.from = max (d.from, body.from);
d.to = min (d.to, body.to);
diff --git a/libs/ardour/audio_playlist_source.cc b/libs/ardour/audio_playlist_source.cc
index e7d3b0a344..7cc00a855f 100644
--- a/libs/ardour/audio_playlist_source.cc
+++ b/libs/ardour/audio_playlist_source.cc
@@ -42,14 +42,14 @@ using namespace ARDOUR;
using namespace PBD;
AudioPlaylistSource::AudioPlaylistSource (Session& s, const ID& orig, const std::string& name, boost::shared_ptr<AudioPlaylist> p,
- uint32_t chn, frameoffset_t begin, framecnt_t len, Source::Flag flags)
+ uint32_t chn, sampleoffset_t begin, samplecnt_t len, Source::Flag flags)
: Source (s, DataType::AUDIO, name)
, PlaylistSource (s, orig, name, p, DataType::AUDIO, begin, len, flags)
, AudioSource (s, name)
, _playlist_channel (chn)
{
AudioSource::_length = len;
- ensure_buffers_for_level (_level, _session.frame_rate());
+ ensure_buffers_for_level (_level, _session.sample_rate());
}
AudioPlaylistSource::AudioPlaylistSource (Session& s, const XMLNode& node)
@@ -106,7 +106,7 @@ AudioPlaylistSource::set_state (const XMLNode& node, int version, bool with_desc
}
}
- pair<framepos_t,framepos_t> extent = _playlist->get_extent();
+ pair<samplepos_t,samplepos_t> extent = _playlist->get_extent();
AudioSource::_length = extent.second - extent.first;
@@ -114,18 +114,18 @@ AudioPlaylistSource::set_state (const XMLNode& node, int version, bool with_desc
throw failed_constructor ();
}
- ensure_buffers_for_level (_level, _session.frame_rate());
+ ensure_buffers_for_level (_level, _session.sample_rate());
return 0;
}
-framecnt_t
-AudioPlaylistSource::read_unlocked (Sample* dst, framepos_t start, framecnt_t cnt) const
+samplecnt_t
+AudioPlaylistSource::read_unlocked (Sample* dst, samplepos_t start, samplecnt_t cnt) const
{
boost::shared_array<Sample> sbuf;
boost::shared_array<gain_t> gbuf;
- framecnt_t to_read;
- framecnt_t to_zero;
+ samplecnt_t to_read;
+ samplecnt_t to_zero;
/* we must be careful not to read beyond the end of our "section" of
* the playlist, because otherwise we may read data that exists, but
@@ -160,8 +160,8 @@ AudioPlaylistSource::read_unlocked (Sample* dst, framepos_t start, framecnt_t cn
return cnt;
}
-framecnt_t
-AudioPlaylistSource::write_unlocked (Sample *, framecnt_t)
+samplecnt_t
+AudioPlaylistSource::write_unlocked (Sample *, samplecnt_t)
{
fatal << string_compose (_("programming error: %1"), "AudioPlaylistSource::write() called - should be impossible") << endmsg;
abort(); /*NOTREACHED*/
@@ -195,7 +195,7 @@ AudioPlaylistSource::sample_rate () const
/* use just the first region to decide */
if (empty()) {
- _session.frame_rate ();
+ _session.sample_rate ();
}
boost::shared_ptr<Region> r = _playlist->region_list_property().front ();
diff --git a/libs/ardour/audio_region_importer.cc b/libs/ardour/audio_region_importer.cc
index 8fc5c53d6d..1b9263b026 100644
--- a/libs/ardour/audio_region_importer.cc
+++ b/libs/ardour/audio_region_importer.cc
@@ -127,7 +127,7 @@ AudioRegionImporter::~AudioRegionImporter ()
string
AudioRegionImporter::get_info () const
{
- framecnt_t length, position;
+ samplecnt_t length, position;
Timecode::Time length_time, position_time;
std::ostringstream oss;
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 22e2cb7356..403d48f5c0 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -226,7 +226,7 @@ AudioTrack::set_state_part_two ()
* or set to false.
*/
int
-AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
+AudioTrack::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
@@ -254,10 +254,10 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _disk_writer->record_enabled())) {
- _meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true);
+ _meter->run (bufs, start_sample, end_sample, 1.0 /*speed()*/, nframes, true);
}
- process_output_buffers (bufs, start_frame, end_frame, nframes, declick, (!_disk_writer->record_enabled() && _session.transport_rolling()));
+ process_output_buffers (bufs, start_sample, end_sample, nframes, declick, (!_disk_writer->record_enabled() && _session.transport_rolling()));
if (_disk_reader->need_butler() || _disk_writer->need_butler()) {
need_butler = true;
@@ -269,7 +269,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
}
int
-AudioTrack::export_stuff (BufferSet& buffers, framepos_t start, framecnt_t nframes,
+AudioTrack::export_stuff (BufferSet& buffers, samplepos_t start, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze)
{
boost::scoped_array<gain_t> gain_buffer (new gain_t[nframes]);
@@ -281,7 +281,7 @@ AudioTrack::export_stuff (BufferSet& buffers, framepos_t start, framecnt_t nfram
assert(apl);
assert(buffers.count().n_audio() >= 1);
- assert ((framecnt_t) buffers.get_audio(0).capacity() >= nframes);
+ assert ((samplecnt_t) buffers.get_audio(0).capacity() >= nframes);
if (apl->read (buffers.get_audio(0).data(), mix_buffer.get(), gain_buffer.get(), start, nframes) != nframes) {
return -1;
@@ -368,11 +368,11 @@ AudioTrack::bounceable (boost::shared_ptr<Processor> endpoint, bool include_endp
boost::shared_ptr<Region>
AudioTrack::bounce (InterThreadInfo& itt)
{
- return bounce_range (_session.current_start_frame(), _session.current_end_frame(), itt, main_outs(), false);
+ return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false);
}
boost::shared_ptr<Region>
-AudioTrack::bounce_range (framepos_t start, framepos_t end, InterThreadInfo& itt,
+AudioTrack::bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint, bool include_endpoint)
{
vector<boost::shared_ptr<Source> > srcs;
@@ -418,7 +418,7 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
boost::shared_ptr<Region> res;
- if ((res = _session.write_one_track (*this, _session.current_start_frame(), _session.current_end_frame(),
+ if ((res = _session.write_one_track (*this, _session.current_start_sample(), _session.current_end_sample(),
true, srcs, itt, main_outs(), false, false, true)) == 0) {
return;
}
@@ -469,7 +469,7 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
boost::shared_ptr<Region> region (RegionFactory::create (srcs, plist, false));
new_playlist->set_orig_track_id (id());
- new_playlist->add_region (region, _session.current_start_frame());
+ new_playlist->add_region (region, _session.current_start_sample());
new_playlist->set_frozen (true);
region->set_locked (true);
diff --git a/libs/ardour/audio_track_importer.cc b/libs/ardour/audio_track_importer.cc
index 500f1c1af7..af6d9a613a 100644
--- a/libs/ardour/audio_track_importer.cc
+++ b/libs/ardour/audio_track_importer.cc
@@ -377,7 +377,7 @@ AudioTrackImporter::rate_convert_events (XMLNode & node)
std::stringstream str (content_node->content());
std::ostringstream new_content;
- framecnt_t x;
+ samplecnt_t x;
double y;
bool ok = true;
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index da18b969f5..74b2591df9 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -163,11 +163,11 @@ _render_callback(void *userData,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
- UInt32 inNumberFrames,
+ UInt32 inNumberSamples,
AudioBufferList* ioData)
{
if (userData) {
- return ((AUPlugin*)userData)->render_callback (ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData);
+ return ((AUPlugin*)userData)->render_callback (ioActionFlags, inTimeStamp, inBusNumber, inNumberSamples, ioData);
}
return paramErr;
}
@@ -445,11 +445,11 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC
, cb_offsets (0)
, input_buffers (0)
, input_map (0)
- , frames_processed (0)
+ , samples_processed (0)
, audio_input_cnt (0)
, _parameter_listener (0)
, _parameter_listener_arg (0)
- , transport_frame (0)
+ , transport_sample (0)
, transport_speed (0)
, last_transport_speed (0.0)
{
@@ -486,10 +486,10 @@ AUPlugin::AUPlugin (const AUPlugin& other)
, cb_offsets (0)
, input_buffers (0)
, input_map (0)
- , frames_processed (0)
+ , samples_processed (0)
, _parameter_listener (0)
, _parameter_listener_arg (0)
- , transport_frame (0)
+ , transport_sample (0)
, transport_speed (0)
, last_transport_speed (0.0)
@@ -606,7 +606,7 @@ AUPlugin::init ()
DEBUG_TRACE (DEBUG::AudioUnits, "count output elements\n");
unit->GetElementCount (kAudioUnitScope_Output, output_elements);
- cb_offsets = (framecnt_t*) calloc (input_elements, sizeof(framecnt_t));
+ cb_offsets = (samplecnt_t*) calloc (input_elements, sizeof(samplecnt_t));
bus_inputs = (uint32_t*) calloc (input_elements, sizeof(uint32_t));
bus_outputs = (uint32_t*) calloc (output_elements, sizeof(uint32_t));
@@ -738,7 +738,7 @@ AUPlugin::discover_parameters ()
kAudioUnitParameterUnit_Boolean = 2
kAudioUnitParameterUnit_Percent = 3
kAudioUnitParameterUnit_Seconds = 4
- kAudioUnitParameterUnit_SampleFrames = 5
+ kAudioUnitParameterUnit_SampleSamples = 5
kAudioUnitParameterUnit_Phase = 6
kAudioUnitParameterUnit_Rate = 7
kAudioUnitParameterUnit_Hertz = 8
@@ -787,7 +787,7 @@ AUPlugin::discover_parameters ()
d.integer_step = (info.unit == kAudioUnitParameterUnit_Indexed);
d.toggled = (info.unit == kAudioUnitParameterUnit_Boolean) ||
(d.integer_step && ((d.upper - d.lower) == 1.0));
- d.sr_dependent = (info.unit == kAudioUnitParameterUnit_SampleFrames);
+ d.sr_dependent = (info.unit == kAudioUnitParameterUnit_SampleSamples);
d.automatable = /* !d.toggled && -- ardour can automate toggles, can AU ? */
!(info.flags & kAudioUnitParameterFlag_NonRealTime) &&
(info.flags & kAudioUnitParameterFlag_IsWritable);
@@ -950,12 +950,12 @@ AUPlugin::default_value (uint32_t port)
return 0;
}
-framecnt_t
+samplecnt_t
AUPlugin::signal_latency () const
{
guint lat = g_atomic_int_get (&_current_latency);;
if (lat == UINT_MAX) {
- lat = unit->Latency() * _session.frame_rate();
+ lat = unit->Latency() * _session.sample_rate();
g_atomic_int_set (&_current_latency, lat);
}
return lat;
@@ -1035,7 +1035,7 @@ AUPlugin::activate ()
if ((err = unit->Initialize()) != noErr) {
error << string_compose (_("AUPlugin: %1 cannot initialize plugin (err = %2)"), name(), err) << endmsg;
} else {
- frames_processed = 0;
+ samples_processed = 0;
initialized = true;
}
}
@@ -1067,17 +1067,17 @@ int
AUPlugin::set_block_size (pframes_t nframes)
{
bool was_initialized = initialized;
- UInt32 numFrames = nframes;
+ UInt32 numSamples = nframes;
OSErr err;
if (initialized) {
deactivate ();
}
- DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("set MaximumFramesPerSlice in global scope to %1\n", numFrames));
- if ((err = unit->SetProperty (kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global,
- 0, &numFrames, sizeof (numFrames))) != noErr) {
- error << string_compose (_("AU: cannot set max frames (err = %1)"), err) << endmsg;
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("set MaximumSamplesPerSlice in global scope to %1\n", numSamples));
+ if ((err = unit->SetProperty (kAudioUnitProperty_MaximumSamplesPerSlice, kAudioUnitScope_Global,
+ 0, &numSamples, sizeof (numSamples))) != noErr) {
+ error << string_compose (_("AU: cannot set max samples (err = %1)"), err) << endmsg;
return -1;
}
@@ -1110,7 +1110,7 @@ AUPlugin::configure_io (ChanCount in, ChanCount out)
}
}
- streamFormat.mSampleRate = _session.frame_rate();
+ streamFormat.mSampleRate = _session.sample_rate();
streamFormat.mFormatID = kAudioFormatLinearPCM;
streamFormat.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsPacked|kAudioFormatFlagIsNonInterleaved;
@@ -1121,7 +1121,7 @@ AUPlugin::configure_io (ChanCount in, ChanCount out)
#endif
streamFormat.mBitsPerChannel = 32;
- streamFormat.mFramesPerPacket = 1;
+ streamFormat.mSamplesPerPacket = 1;
/* apple says that for non-interleaved data, these
* values always refer to a single channel.
@@ -1582,13 +1582,13 @@ OSStatus
AUPlugin::render_callback(AudioUnitRenderActionFlags*,
const AudioTimeStamp*,
UInt32 bus,
- UInt32 inNumberFrames,
+ UInt32 inNumberSamples,
AudioBufferList* ioData)
{
/* not much to do with audio - the data is already in the buffers given to us in connect_and_run() */
- // DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1: render callback, frames %2 bus %3 bufs %4\n",
- // name(), inNumberFrames, bus, ioData->mNumberBuffers));
+ // DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1: render callback, samples %2 bus %3 bufs %4\n",
+ // name(), inNumberSamples, bus, ioData->mNumberBuffers));
if (input_maxbuf == 0) {
DEBUG_TRACE (DEBUG::AudioUnits, "AUPlugin: render callback called illegally!");
@@ -1611,7 +1611,7 @@ AUPlugin::render_callback(AudioUnitRenderActionFlags*,
for (uint32_t i = 0; i < limit; ++i) {
ioData->mBuffers[i].mNumberChannels = 1;
- ioData->mBuffers[i].mDataByteSize = sizeof (Sample) * inNumberFrames;
+ ioData->mBuffers[i].mDataByteSize = sizeof (Sample) * inNumberSamples;
bool valid = false;
uint32_t idx = input_map->get (DataType::AUDIO, i + busoff, &valid);
@@ -1621,19 +1621,19 @@ AUPlugin::render_callback(AudioUnitRenderActionFlags*,
ioData->mBuffers[i].mData = silent_bufs.get_audio(0).data (cb_offsets[bus] + input_offset);
}
}
- cb_offsets[bus] += inNumberFrames;
+ cb_offsets[bus] += inNumberSamples;
return noErr;
}
int
AUPlugin::connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in_map, ChanMapping out_map,
- pframes_t nframes, framecnt_t offset)
+ pframes_t nframes, samplecnt_t offset)
{
Plugin::connect_and_run(bufs, start, end, speed, in_map, out_map, nframes, offset);
- transport_frame = start;
+ transport_sample = start;
transport_speed = speed;
AudioUnitRenderActionFlags flags = 0;
@@ -1684,7 +1684,7 @@ AUPlugin::connect_and_run (BufferSet& bufs,
/* one MIDI port/buffer only */
MidiBuffer& m = bufs.get_midi (i);
for (MidiBuffer::iterator i = m.begin(); i != m.end(); ++i) {
- Evoral::Event<framepos_t> ev (*i);
+ Evoral::Event<samplepos_t> ev (*i);
if (ev.is_channel_event()) {
const uint8_t* b = ev.buffer();
DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1: MIDI event %2\n", name(), ev));
@@ -1736,11 +1736,11 @@ AUPlugin::connect_and_run (BufferSet& bufs,
}
/* does this really mean anything ? */
- ts.mSampleTime = frames_processed;
+ ts.mSampleTime = samples_processed;
ts.mFlags = kAudioTimeStampSampleTimeValid;
DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 render flags=%2 time=%3 nframes=%4 bus=%5 buffers=%6\n",
- name(), flags, frames_processed, nframes, bus, buffers->mNumberBuffers));
+ name(), flags, samples_processed, nframes, bus, buffers->mNumberBuffers));
if ((err = unit->Render (&flags, &ts, bus, nframes, buffers)) == noErr) {
@@ -1787,7 +1787,7 @@ AUPlugin::connect_and_run (BufferSet& bufs,
input_maxbuf = 0;
if (ok) {
- frames_processed += nframes;
+ samples_processed += nframes;
return 0;
}
return -1;
@@ -1802,11 +1802,11 @@ AUPlugin::get_beat_and_tempo_callback (Float64* outCurrentBeat,
DEBUG_TRACE (DEBUG::AudioUnits, "AU calls ardour beat&tempo callback\n");
if (outCurrentBeat) {
- *outCurrentBeat = tmap.quarter_note_at_frame (transport_frame + input_offset);
+ *outCurrentBeat = tmap.quarter_note_at_sample (transport_sample + input_offset);
}
if (outCurrentTempo) {
- *outCurrentTempo = tmap.tempo_at_frame (transport_frame + input_offset).quarter_notes_per_minute();
+ *outCurrentTempo = tmap.tempo_at_sample (transport_sample + input_offset).quarter_notes_per_minute();
}
return noErr;
@@ -1823,18 +1823,18 @@ AUPlugin::get_musical_time_location_callback (UInt32* outDeltaSampleOffsetToNe
DEBUG_TRACE (DEBUG::AudioUnits, "AU calls ardour music time location callback\n");
- TempoMetric metric = tmap.metric_at (transport_frame + input_offset);
- Timecode::BBT_Time bbt = _session.tempo_map().bbt_at_frame (transport_frame + input_offset);
+ TempoMetric metric = tmap.metric_at (transport_sample + input_offset);
+ Timecode::BBT_Time bbt = _session.tempo_map().bbt_at_sample (transport_sample + input_offset);
if (outDeltaSampleOffsetToNextBeat) {
if (bbt.ticks == 0) {
/* on the beat */
*outDeltaSampleOffsetToNextBeat = 0;
} else {
- double const next_beat = ceil (tmap.quarter_note_at_frame (transport_frame + input_offset));
- framepos_t const next_beat_frame = tmap.frame_at_quarter_note (next_beat);
+ double const next_beat = ceil (tmap.quarter_note_at_sample (transport_sample + input_offset));
+ samplepos_t const next_beat_sample = tmap.sample_at_quarter_note (next_beat);
- *outDeltaSampleOffsetToNextBeat = next_beat_frame - (transport_frame + input_offset);
+ *outDeltaSampleOffsetToNextBeat = next_beat_sample - (transport_sample + input_offset);
}
}
@@ -1894,7 +1894,7 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying,
/* this assumes that the AU can only call this host callback from render context,
where input_offset is valid.
*/
- *outCurrentSampleInTimeLine = transport_frame + input_offset;
+ *outCurrentSampleInTimeLine = transport_sample + input_offset;
}
if (outIsCycling) {
@@ -1912,11 +1912,11 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying,
Timecode::BBT_Time bbt;
if (outCycleStartBeat) {
- *outCycleStartBeat = tmap.quarter_note_at_frame (loc->start() + input_offset);
+ *outCycleStartBeat = tmap.quarter_note_at_sample (loc->start() + input_offset);
}
if (outCycleEndBeat) {
- *outCycleEndBeat = tmap.quarter_note_at_frame (loc->end() + input_offset);
+ *outCycleEndBeat = tmap.quarter_note_at_sample (loc->end() + input_offset);
}
}
}
@@ -3438,7 +3438,7 @@ AUPlugin::parameter_change_listener (void* /*arg*/, void* src, const AudioUnitEv
if (event->mEventType == kAudioUnitEvent_PropertyChange) {
if (event->mArgument.mProperty.mPropertyID == kAudioUnitProperty_Latency) {
DEBUG_TRACE (DEBUG::AudioUnits, string_compose("AU Latency Change Event %1 <> %2\n", new_value, unit->Latency()));
- guint lat = unit->Latency() * _session.frame_rate();
+ guint lat = unit->Latency() * _session.sample_rate();
g_atomic_int_set (&_current_latency, lat);
}
return;
diff --git a/libs/ardour/audioanalyser.cc b/libs/ardour/audioanalyser.cc
index f90edd380a..e08171c4a4 100644
--- a/libs/ardour/audioanalyser.cc
+++ b/libs/ardour/audioanalyser.cc
@@ -107,8 +107,8 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel)
int ret = -1;
bool done = false;
Sample* data = 0;
- framecnt_t len = src->readable_length();
- framepos_t pos = 0;
+ samplecnt_t len = src->readable_length();
+ samplepos_t pos = 0;
float* bufs[1] = { 0 };
data = new Sample[bufsize];
@@ -116,11 +116,11 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel)
while (!done) {
- framecnt_t to_read;
+ samplecnt_t to_read;
/* read from source */
- to_read = min ((len - pos), (framecnt_t) bufsize);
+ to_read = min ((len - pos), (samplecnt_t) bufsize);
if (src->read (data, pos, to_read, channel) != to_read) {
goto out;
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index f215eaae82..03c13e38fd 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -77,7 +77,7 @@ AudioEngine::AudioEngine ()
, _freewheeling (false)
, monitor_check_interval (INT32_MAX)
, last_monitor_check (0)
- , _processed_frames (0)
+ , _processed_samples (0)
, m_meter_thread (0)
, _main_thread (0)
, _mtdm (0)
@@ -85,7 +85,7 @@ AudioEngine::AudioEngine ()
, _measuring_latency (MeasureNone)
, _latency_input_port (0)
, _latency_output_port (0)
- , _latency_flush_frames (0)
+ , _latency_flush_samples (0)
, _latency_signal_latency (0)
, _stopped_for_latency (false)
, _started_for_latency (false)
@@ -155,7 +155,7 @@ AudioEngine::sample_rate_change (pframes_t nframes)
last_monitor_check = 0;
if (_session) {
- _session->set_frame_rate (nframes);
+ _session->set_sample_rate (nframes);
}
SampleRateChanged (nframes); /* EMIT SIGNAL */
@@ -181,7 +181,7 @@ AudioEngine::buffer_size_change (pframes_t bufsiz)
}
/** Method called by our ::process_thread when there is work to be done.
- * @param nframes Number of frames to process.
+ * @param nframes Number of samples to process.
*/
#ifdef __clang__
__attribute__((annotate("realtime")))
@@ -194,15 +194,15 @@ AudioEngine::process_callback (pframes_t nframes)
PT_TIMING_REF;
PT_TIMING_CHECK (1);
- /// The number of frames that will have been processed when we've finished
- pframes_t next_processed_frames;
+ /// The number of samples that will have been processed when we've finished
+ pframes_t next_processed_samples;
- /* handle wrap around of total frames counter */
+ /* handle wrap around of total samples counter */
- if (max_framepos - _processed_frames < nframes) {
- next_processed_frames = nframes - (max_framepos - _processed_frames);
+ if (max_samplepos - _processed_samples < nframes) {
+ next_processed_samples = nframes - (max_samplepos - _processed_samples);
} else {
- next_processed_frames = _processed_frames + nframes;
+ next_processed_samples = _processed_samples + nframes;
}
if (!tm.locked()) {
@@ -286,7 +286,7 @@ AudioEngine::process_callback (pframes_t nframes)
PortManager::cycle_end (nframes);
return_after_remove_check = true;
- } else if (_latency_flush_frames) {
+ } else if (_latency_flush_samples) {
/* wait for the appropriate duration for the MTDM signal to
* drain from the ports before we revert to normal behaviour.
@@ -296,10 +296,10 @@ AudioEngine::process_callback (pframes_t nframes)
PortManager::silence (nframes);
PortManager::cycle_end (nframes);
- if (_latency_flush_frames > nframes) {
- _latency_flush_frames -= nframes;
+ if (_latency_flush_samples > nframes) {
+ _latency_flush_samples -= nframes;
} else {
- _latency_flush_frames = 0;
+ _latency_flush_samples = 0;
}
return_after_remove_check = true;
@@ -352,7 +352,7 @@ AudioEngine::process_callback (pframes_t nframes)
PortManager::cycle_end (nframes);
}
- _processed_frames = next_processed_frames;
+ _processed_samples = next_processed_samples;
return 0;
}
@@ -382,14 +382,14 @@ AudioEngine::process_callback (pframes_t nframes)
}
if (!_running) {
- _processed_frames = next_processed_frames;
+ _processed_samples = next_processed_samples;
return 0;
}
- if (last_monitor_check + monitor_check_interval < next_processed_frames) {
+ if (last_monitor_check + monitor_check_interval < next_processed_samples) {
PortManager::check_monitoring ();
- last_monitor_check = next_processed_frames;
+ last_monitor_check = next_processed_samples;
}
#ifdef SILENCE_AFTER_SECONDS
@@ -432,7 +432,7 @@ AudioEngine::process_callback (pframes_t nframes)
PortManager::cycle_end (nframes);
- _processed_frames = next_processed_frames;
+ _processed_samples = next_processed_samples;
PT_TIMING_CHECK (2);
@@ -871,7 +871,7 @@ AudioEngine::start (bool for_latency)
return 0;
}
- _processed_frames = 0;
+ _processed_samples = 0;
last_monitor_check = 0;
int error_code = _backend->start (for_latency);
@@ -884,7 +884,7 @@ AudioEngine::start (bool for_latency)
_running = true;
if (_session) {
- _session->set_frame_rate (_backend->sample_rate());
+ _session->set_sample_rate (_backend->sample_rate());
if (_session->config.get_jack_time_master()) {
_backend->set_time_master (true);
@@ -952,7 +952,7 @@ AudioEngine::stop (bool for_latency)
_stopped_for_latency = true;
}
}
- _processed_frames = 0;
+ _processed_samples = 0;
_measuring_latency = MeasureNone;
_latency_output_port = 0;
_latency_input_port = 0;
@@ -1037,7 +1037,7 @@ AudioEngine::transport_state ()
}
void
-AudioEngine::transport_locate (framepos_t pos)
+AudioEngine::transport_locate (samplepos_t pos)
{
if (!_backend) {
return;
@@ -1045,16 +1045,16 @@ AudioEngine::transport_locate (framepos_t pos)
return _backend->transport_locate (pos);
}
-framepos_t
-AudioEngine::transport_frame()
+samplepos_t
+AudioEngine::transport_sample()
{
if (!_backend) {
return 0;
}
- return _backend->transport_frame ();
+ return _backend->transport_sample ();
}
-framecnt_t
+samplecnt_t
AudioEngine::sample_rate () const
{
if (!_backend) {
@@ -1090,7 +1090,7 @@ AudioEngine::raw_buffer_size (DataType t)
return _backend->raw_buffer_size (t);
}
-framepos_t
+samplepos_t
AudioEngine::sample_time ()
{
if (!_backend) {
@@ -1099,7 +1099,7 @@ AudioEngine::sample_time ()
return _backend->sample_time ();
}
-framepos_t
+samplepos_t
AudioEngine::sample_time_at_cycle_start ()
{
if (!_backend) {
@@ -1267,7 +1267,7 @@ AudioEngine::thread_init_callback (void* arg)
}
int
-AudioEngine::sync_callback (TransportState state, framepos_t position)
+AudioEngine::sync_callback (TransportState state, samplepos_t position)
{
if (_session) {
return _session->backend_sync_callback (state, position);
@@ -1452,7 +1452,7 @@ AudioEngine::start_latency_detection (bool for_midi)
_latency_signal_latency += lr.max;
/* all created and connected, lets go */
- _latency_flush_frames = samples_per_cycle();
+ _latency_flush_samples = samples_per_cycle();
_measuring_latency = for_midi ? MeasureMIDI : MeasureAudio;
return 0;
diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc
index ee8364212f..5a59ff339b 100644
--- a/libs/ardour/audiofilesource.cc
+++ b/libs/ardour/audiofilesource.cc
@@ -69,16 +69,16 @@ using namespace PBD;
using namespace Glib;
PBD::Signal0<void> AudioFileSource::HeaderPositionOffsetChanged;
-framecnt_t AudioFileSource::header_position_offset = 0;
+samplecnt_t AudioFileSource::header_position_offset = 0;
/* XXX maybe this too */
char AudioFileSource::bwf_serial_number[13] = "000000000000";
struct SizedSampleBuffer {
- framecnt_t size;
+ samplecnt_t size;
Sample* buf;
- SizedSampleBuffer (framecnt_t sz) : size (sz) {
+ SizedSampleBuffer (samplecnt_t sz) : size (sz) {
buf = new Sample[size];
}
@@ -249,7 +249,7 @@ AudioFileSource::move_dependents_to_trash()
}
void
-AudioFileSource::set_header_position_offset (framecnt_t offset)
+AudioFileSource::set_header_position_offset (samplecnt_t offset)
{
header_position_offset = offset;
HeaderPositionOffsetChanged ();
@@ -349,7 +349,7 @@ AudioFileSource::safe_audio_file_extension(const string& file)
}
Sample*
-AudioFileSource::get_interleave_buffer (framecnt_t size)
+AudioFileSource::get_interleave_buffer (samplecnt_t size)
{
SizedSampleBuffer* ssb;
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index def7e9dbfb..94b931982a 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -232,7 +232,7 @@ AudioRegion::init ()
}
/** Constructor for use by derived types only */
-AudioRegion::AudioRegion (Session& s, framepos_t start, framecnt_t len, std::string name)
+AudioRegion::AudioRegion (Session& s, samplepos_t start, samplecnt_t len, std::string name)
: Region (s, start, len, name, DataType::AUDIO)
, AUDIOREGION_STATE_DEFAULT
, _envelope (Properties::envelope, boost::shared_ptr<AutomationList> (new AutomationList (Evoral::Parameter(EnvelopeAutomation))))
@@ -279,13 +279,13 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other)
assert (_sources.size() == _master_sources.size());
}
-AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, MusicFrame offset)
+AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, MusicSample offset)
: Region (other, offset)
, AUDIOREGION_COPY_STATE (other)
/* As far as I can see, the _envelope's times are relative to region position, and have nothing
to do with sources (and hence _start). So when we copy the envelope, we just use the supplied offset.
*/
- , _envelope (Properties::envelope, boost::shared_ptr<AutomationList> (new AutomationList (*other->_envelope.val(), offset.frame, other->_length)))
+ , _envelope (Properties::envelope, boost::shared_ptr<AutomationList> (new AutomationList (*other->_envelope.val(), offset.sample, other->_length)))
, _automatable (other->session())
, _fade_in_suspended (0)
, _fade_out_suspended (0)
@@ -418,22 +418,22 @@ AudioRegion::set_envelope_active (bool yn)
* @param offset Start position, as an offset from the start of this region's source.
* @param cnt Number of samples to read.
* @param chan_n Channel.
- * @param frames_per_pixel Number of samples to use to generate one peak value.
+ * @param samples_per_pixel Number of samples to use to generate one peak value.
*/
-ARDOUR::framecnt_t
-AudioRegion::read_peaks (PeakData *buf, framecnt_t npeaks, framecnt_t offset, framecnt_t cnt, uint32_t chan_n, double frames_per_pixel) const
+ARDOUR::samplecnt_t
+AudioRegion::read_peaks (PeakData *buf, samplecnt_t npeaks, samplecnt_t offset, samplecnt_t cnt, uint32_t chan_n, double samples_per_pixel) const
{
if (chan_n >= _sources.size()) {
return 0;
}
- if (audio_source(chan_n)->read_peaks (buf, npeaks, offset, cnt, frames_per_pixel)) {
+ if (audio_source(chan_n)->read_peaks (buf, npeaks, offset, cnt, samples_per_pixel)) {
return 0;
}
if (_scale_amplitude != 1.0f) {
- for (framecnt_t n = 0; n < npeaks; ++n) {
+ for (samplecnt_t n = 0; n < npeaks; ++n) {
buf[n].max *= _scale_amplitude;
buf[n].min *= _scale_amplitude;
}
@@ -444,19 +444,19 @@ AudioRegion::read_peaks (PeakData *buf, framecnt_t npeaks, framecnt_t offset, fr
/** @param buf Buffer to write data to (existing data will be overwritten).
* @param pos Position to read from as an offset from the region position.
- * @param cnt Number of frames to read.
+ * @param cnt Number of samples to read.
* @param channel Channel to read from.
*/
-framecnt_t
-AudioRegion::read (Sample* buf, framepos_t pos, framecnt_t cnt, int channel) const
+samplecnt_t
+AudioRegion::read (Sample* buf, samplepos_t pos, samplecnt_t cnt, int channel) const
{
/* raw read, no fades, no gain, nada */
return read_from_sources (_sources, _length, buf, _position + pos, cnt, channel);
}
-framecnt_t
+samplecnt_t
AudioRegion::master_read_at (Sample *buf, Sample* /*mixdown_buffer*/, float* /*gain_buffer*/,
- framepos_t position, framecnt_t cnt, uint32_t chan_n) const
+ samplepos_t position, samplecnt_t cnt, uint32_t chan_n) const
{
/* do not read gain/scaling/fades and do not count this disk i/o in statistics */
@@ -471,13 +471,13 @@ AudioRegion::master_read_at (Sample *buf, Sample* /*mixdown_buffer*/, float* /*g
* @param mixdown_buffer Scratch buffer for audio data.
* @param gain_buffer Scratch buffer for gain data.
* @param position Position within the session to read from.
- * @param cnt Number of frames to read.
+ * @param cnt Number of samples to read.
* @param chan_n Channel number to read.
*/
-framecnt_t
+samplecnt_t
AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
- framepos_t position,
- framecnt_t cnt,
+ samplepos_t position,
+ samplecnt_t cnt,
uint32_t chan_n) const
{
/* We are reading data from this region into buf (possibly via mixdown_buffer).
@@ -496,10 +496,10 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
/* WORK OUT WHERE TO GET DATA FROM */
- framecnt_t to_read;
+ samplecnt_t to_read;
assert (position >= _position);
- frameoffset_t const internal_offset = position - _position;
+ sampleoffset_t const internal_offset = position - _position;
if (internal_offset >= _length) {
return 0; /* read nothing */
@@ -513,23 +513,23 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
/* COMPUTE DETAILS OF ANY FADES INVOLVED IN THIS READ */
/* Amount (length) of fade in that we are dealing with in this read */
- framecnt_t fade_in_limit = 0;
+ samplecnt_t fade_in_limit = 0;
/* Offset from buf / mixdown_buffer of the start
of any fade out that we are dealing with
*/
- frameoffset_t fade_out_offset = 0;
+ sampleoffset_t fade_out_offset = 0;
/* Amount (length) of fade out that we are dealing with in this read */
- framecnt_t fade_out_limit = 0;
+ samplecnt_t fade_out_limit = 0;
- framecnt_t fade_interval_start = 0;
+ samplecnt_t fade_interval_start = 0;
/* Fade in */
if (_fade_in_active && _session.config.get_use_region_fades()) {
- framecnt_t fade_in_length = (framecnt_t) _fade_in->back()->when;
+ samplecnt_t fade_in_length = (samplecnt_t) _fade_in->back()->when;
/* see if this read is within the fade in */
@@ -561,8 +561,8 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
*
*/
- fade_interval_start = max (internal_offset, _length - framecnt_t (_fade_out->back()->when));
- framecnt_t fade_interval_end = min(internal_offset + to_read, _length.val());
+ fade_interval_start = max (internal_offset, _length - samplecnt_t (_fade_out->back()->when));
+ samplecnt_t fade_interval_end = min(internal_offset + to_read, _length.val());
if (fade_interval_end > fade_interval_start) {
/* (part of the) the fade out is in this buffer */
@@ -587,11 +587,11 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
_envelope->curve().get_vector (internal_offset, internal_offset + to_read, gain_buffer, to_read);
if (_scale_amplitude != 1.0f) {
- for (framecnt_t n = 0; n < to_read; ++n) {
+ for (samplecnt_t n = 0; n < to_read; ++n) {
mixdown_buffer[n] *= gain_buffer[n] * _scale_amplitude;
}
} else {
- for (framecnt_t n = 0; n < to_read; ++n) {
+ for (samplecnt_t n = 0; n < to_read; ++n) {
mixdown_buffer[n] *= gain_buffer[n];
}
}
@@ -618,7 +618,7 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
_inverse_fade_in->curve().get_vector (internal_offset, internal_offset + fade_in_limit, gain_buffer, fade_in_limit);
/* Fade the data from lower layers out */
- for (framecnt_t n = 0; n < fade_in_limit; ++n) {
+ for (samplecnt_t n = 0; n < fade_in_limit; ++n) {
buf[n] *= gain_buffer[n];
}
@@ -634,7 +634,7 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
_fade_in->curve().get_vector (internal_offset, internal_offset + fade_in_limit, gain_buffer, fade_in_limit);
- for (framecnt_t n = 0; n < fade_in_limit; ++n) {
+ for (samplecnt_t n = 0; n < fade_in_limit; ++n) {
buf[n] *= 1 - gain_buffer[n];
}
}
@@ -643,14 +643,14 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
}
/* Mix our newly-read data in, with the fade */
- for (framecnt_t n = 0; n < fade_in_limit; ++n) {
+ for (samplecnt_t n = 0; n < fade_in_limit; ++n) {
buf[n] += mixdown_buffer[n] * gain_buffer[n];
}
}
if (fade_out_limit != 0) {
- framecnt_t const curve_offset = fade_interval_start - (_length - _fade_out->back()->when);
+ samplecnt_t const curve_offset = fade_interval_start - (_length - _fade_out->back()->when);
if (opaque()) {
if (_inverse_fade_out) {
@@ -658,7 +658,7 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
_inverse_fade_out->curve().get_vector (curve_offset, curve_offset + fade_out_limit, gain_buffer, fade_out_limit);
/* Fade the data from lower levels in */
- for (framecnt_t n = 0, m = fade_out_offset; n < fade_out_limit; ++n, ++m) {
+ for (samplecnt_t n = 0, m = fade_out_offset; n < fade_out_limit; ++n, ++m) {
buf[m] *= gain_buffer[n];
}
@@ -675,7 +675,7 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
_fade_out->curve().get_vector (curve_offset, curve_offset + fade_out_limit, gain_buffer, fade_out_limit);
- for (framecnt_t n = 0, m = fade_out_offset; n < fade_out_limit; ++n, ++m) {
+ for (samplecnt_t n = 0, m = fade_out_offset; n < fade_out_limit; ++n, ++m) {
buf[m] *= 1 - gain_buffer[n];
}
}
@@ -686,14 +686,14 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
/* Mix our newly-read data with whatever was already there,
with the fade out applied to our data.
*/
- for (framecnt_t n = 0, m = fade_out_offset; n < fade_out_limit; ++n, ++m) {
+ for (samplecnt_t n = 0, m = fade_out_offset; n < fade_out_limit; ++n, ++m) {
buf[m] += mixdown_buffer[m] * gain_buffer[n];
}
}
/* MIX OR COPY THE REGION BODY FROM mixdown_buffer INTO buf */
- framecnt_t const N = to_read - fade_in_limit - fade_out_limit;
+ samplecnt_t const N = to_read - fade_in_limit - fade_out_limit;
if (N > 0) {
if (opaque ()) {
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Region %1 memcpy into buf @ %2 + %3, from mixdown buffer @ %4 + %5, len = %6 cnt was %7\n",
@@ -713,21 +713,21 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
* @param srcs Source list to get our source from.
* @param limit Furthest that we should read, as an offset from the region position.
* @param buf Buffer to write data into (existing contents of the buffer will be overwritten)
- * @param position Position to read from, in session frames.
- * @param cnt Number of frames to read.
+ * @param position Position to read from, in session samples.
+ * @param cnt Number of samples to read.
* @param chan_n Channel to read from.
- * @return Number of frames read.
+ * @return Number of samples read.
*/
-framecnt_t
-AudioRegion::read_from_sources (SourceList const & srcs, framecnt_t limit, Sample* buf, framepos_t position, framecnt_t cnt, uint32_t chan_n) const
+samplecnt_t
+AudioRegion::read_from_sources (SourceList const & srcs, samplecnt_t limit, Sample* buf, samplepos_t position, samplecnt_t cnt, uint32_t chan_n) const
{
- frameoffset_t const internal_offset = position - _position;
+ sampleoffset_t const internal_offset = position - _position;
if (internal_offset >= limit) {
return 0;
}
- framecnt_t const to_read = min (cnt, limit - internal_offset);
+ samplecnt_t const to_read = min (cnt, limit - internal_offset);
if (to_read == 0) {
return 0;
}
@@ -953,9 +953,9 @@ AudioRegion::set_state (const XMLNode& node, int version)
}
void
-AudioRegion::fade_range (framepos_t start, framepos_t end)
+AudioRegion::fade_range (samplepos_t start, samplepos_t end)
{
- framepos_t s, e;
+ samplepos_t s, e;
switch (coverage (start, end)) {
case Evoral::OverlapStart:
@@ -985,13 +985,13 @@ AudioRegion::fade_range (framepos_t start, framepos_t end)
void
AudioRegion::set_fade_in_shape (FadeShape shape)
{
- set_fade_in (shape, (framecnt_t) _fade_in->back()->when);
+ set_fade_in (shape, (samplecnt_t) _fade_in->back()->when);
}
void
AudioRegion::set_fade_out_shape (FadeShape shape)
{
- set_fade_out (shape, (framecnt_t) _fade_out->back()->when);
+ set_fade_out (shape, (samplecnt_t) _fade_out->back()->when);
}
void
@@ -1006,7 +1006,7 @@ AudioRegion::set_fade_in (boost::shared_ptr<AutomationList> f)
}
void
-AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
+AudioRegion::set_fade_in (FadeShape shape, samplecnt_t len)
{
const ARDOUR::ParameterDescriptor desc(FadeInAutomation);
boost::shared_ptr<Evoral::ControlList> c1 (new Evoral::ControlList (FadeInAutomation, desc));
@@ -1089,7 +1089,7 @@ AudioRegion::set_fade_out (boost::shared_ptr<AutomationList> f)
}
void
-AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
+AudioRegion::set_fade_out (FadeShape shape, samplecnt_t len)
{
const ARDOUR::ParameterDescriptor desc(FadeOutAutomation);
boost::shared_ptr<Evoral::ControlList> c1 (new Evoral::ControlList (FadeOutAutomation, desc));
@@ -1156,7 +1156,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
}
void
-AudioRegion::set_fade_in_length (framecnt_t len)
+AudioRegion::set_fade_in_length (samplecnt_t len)
{
if (len > _length) {
len = _length - 1;
@@ -1179,7 +1179,7 @@ AudioRegion::set_fade_in_length (framecnt_t len)
}
void
-AudioRegion::set_fade_out_length (framecnt_t len)
+AudioRegion::set_fade_out_length (samplecnt_t len)
{
if (len > _length) {
len = _length - 1;
@@ -1368,8 +1368,8 @@ AudioRegion::separate_by_channel (vector<boost::shared_ptr<Region> >& v) const
return 0;
}
-framecnt_t
-AudioRegion::read_raw_internal (Sample* buf, framepos_t pos, framecnt_t cnt, int channel) const
+samplecnt_t
+AudioRegion::read_raw_internal (Sample* buf, samplepos_t pos, samplecnt_t cnt, int channel) const
{
return audio_source(channel)->read (buf, pos, cnt);
}
@@ -1395,18 +1395,18 @@ AudioRegion::set_scale_amplitude (gain_t g)
double
AudioRegion::maximum_amplitude (Progress* p) const
{
- framepos_t fpos = _start;
- framepos_t const fend = _start + _length;
+ samplepos_t fpos = _start;
+ samplepos_t const fend = _start + _length;
double maxamp = 0;
- framecnt_t const blocksize = 64 * 1024;
+ samplecnt_t const blocksize = 64 * 1024;
Sample buf[blocksize];
while (fpos < fend) {
uint32_t n;
- framecnt_t const to_read = min (fend - fpos, blocksize);
+ samplecnt_t const to_read = min (fend - fpos, blocksize);
for (n = 0; n < n_channels(); ++n) {
@@ -1434,27 +1434,27 @@ AudioRegion::maximum_amplitude (Progress* p) const
double
AudioRegion::rms (Progress* p) const
{
- framepos_t fpos = _start;
- framepos_t const fend = _start + _length;
+ samplepos_t fpos = _start;
+ samplepos_t const fend = _start + _length;
uint32_t const n_chan = n_channels ();
double rms = 0;
- framecnt_t const blocksize = 64 * 1024;
+ samplecnt_t const blocksize = 64 * 1024;
Sample buf[blocksize];
- framecnt_t total = 0;
+ samplecnt_t total = 0;
if (n_chan == 0 || fend == fpos) {
return 0;
}
while (fpos < fend) {
- framecnt_t const to_read = min (fend - fpos, blocksize);
+ samplecnt_t const to_read = min (fend - fpos, blocksize);
for (uint32_t c = 0; c < n_chan; ++c) {
if (read_raw_internal (buf, fpos, to_read, c) != to_read) {
return 0;
}
- for (framepos_t i = 0; i < to_read; ++i) {
+ for (samplepos_t i = 0; i < to_read; ++i) {
rms += buf[i] * buf[i];
}
}
@@ -1629,9 +1629,9 @@ AudioRegion::clear_transients () // yet unused
}
void
-AudioRegion::add_transient (framepos_t where)
+AudioRegion::add_transient (samplepos_t where)
{
- if (where < first_frame () || where >= last_frame ()) {
+ if (where < first_sample () || where >= last_sample ()) {
return;
}
where -= _position;
@@ -1640,7 +1640,7 @@ AudioRegion::add_transient (framepos_t where)
_transient_user_start = _start;
_valid_transients = true;
}
- frameoffset_t offset = _transient_user_start - _start;
+ sampleoffset_t offset = _transient_user_start - _start;
if (where < offset) {
if (offset <= 0) {
@@ -1654,17 +1654,17 @@ AudioRegion::add_transient (framepos_t where)
offset = 0;
}
- const framepos_t p = where - offset;
+ const samplepos_t p = where - offset;
_user_transients.push_back(p);
send_change (PropertyChange (Properties::valid_transients));
}
void
-AudioRegion::update_transient (framepos_t old_position, framepos_t new_position)
+AudioRegion::update_transient (samplepos_t old_position, samplepos_t new_position)
{
bool changed = false;
if (!_onsets.empty ()) {
- const framepos_t p = old_position - _position;
+ const samplepos_t p = old_position - _position;
AnalysisFeatureList::iterator x = std::find (_onsets.begin (), _onsets.end (), p);
if (x != _transients.end ()) {
(*x) = new_position - _position;
@@ -1673,8 +1673,8 @@ AudioRegion::update_transient (framepos_t old_position, framepos_t new_position)
}
if (_valid_transients) {
- const frameoffset_t offset = _position + _transient_user_start - _start;
- const framepos_t p = old_position - offset;
+ const sampleoffset_t offset = _position + _transient_user_start - _start;
+ const samplepos_t p = old_position - offset;
AnalysisFeatureList::iterator x = std::find (_user_transients.begin (), _user_transients.end (), p);
if (x != _transients.end ()) {
(*x) = new_position - offset;
@@ -1688,11 +1688,11 @@ AudioRegion::update_transient (framepos_t old_position, framepos_t new_position)
}
void
-AudioRegion::remove_transient (framepos_t where)
+AudioRegion::remove_transient (samplepos_t where)
{
bool changed = false;
if (!_onsets.empty ()) {
- const framepos_t p = where - _position;
+ const samplepos_t p = where - _position;
AnalysisFeatureList::iterator i = std::find (_onsets.begin (), _onsets.end (), p);
if (i != _transients.end ()) {
_onsets.erase (i);
@@ -1701,7 +1701,7 @@ AudioRegion::remove_transient (framepos_t where)
}
if (_valid_transients) {
- const framepos_t p = where - (_position + _transient_user_start - _start);
+ const samplepos_t p = where - (_position + _transient_user_start - _start);
AnalysisFeatureList::iterator i = std::find (_user_transients.begin (), _user_transients.end (), p);
if (i != _transients.end ()) {
_transients.erase (i);
@@ -1762,7 +1762,7 @@ AudioRegion::build_transients ()
_transients.insert (_transients.end(), low, high);
}
- TransientDetector::cleanup_transients (_transients, pl->session().frame_rate(), 3.0);
+ TransientDetector::cleanup_transients (_transients, pl->session().sample_rate(), 3.0);
/* translate all transients to current position */
for (AnalysisFeatureList::iterator x = _transients.begin(); x != _transients.end(); ++x) {
@@ -1795,7 +1795,7 @@ in this and future transient-detection operations.\n\
}
try {
- TransientDetector t (pl->session().frame_rate());
+ TransientDetector t (pl->session().sample_rate());
for (uint32_t i = 0; i < n_channels(); ++i) {
AnalysisFeatureList these_results;
@@ -1816,7 +1816,7 @@ in this and future transient-detection operations.\n\
return;
}
- TransientDetector::cleanup_transients (_transients, pl->session().frame_rate(), 3.0);
+ TransientDetector::cleanup_transients (_transients, pl->session().sample_rate(), 3.0);
_transient_analysis_start = _start;
_transient_analysis_end = _start + _length;
}
@@ -1872,40 +1872,40 @@ AudioRegion::get_transients (AnalysisFeatureList& results)
*/
AudioIntervalResult
-AudioRegion::find_silence (Sample threshold, framecnt_t min_length, framecnt_t fade_length, InterThreadInfo& itt) const
+AudioRegion::find_silence (Sample threshold, samplecnt_t min_length, samplecnt_t fade_length, InterThreadInfo& itt) const
{
- framecnt_t const block_size = 64 * 1024;
+ samplecnt_t const block_size = 64 * 1024;
boost::scoped_array<Sample> loudest (new Sample[block_size]);
boost::scoped_array<Sample> buf (new Sample[block_size]);
assert (fade_length >= 0);
assert (min_length > 0);
- framepos_t pos = _start;
- framepos_t const end = _start + _length;
+ samplepos_t pos = _start;
+ samplepos_t const end = _start + _length;
AudioIntervalResult silent_periods;
bool in_silence = true;
- frameoffset_t silence_start = _start;
+ sampleoffset_t silence_start = _start;
while (pos < end && !itt.cancel) {
- framecnt_t cur_samples = 0;
- framecnt_t const to_read = min (end - pos, block_size);
+ samplecnt_t cur_samples = 0;
+ samplecnt_t const to_read = min (end - pos, block_size);
/* fill `loudest' with the loudest absolute sample at each instant, across all channels */
memset (loudest.get(), 0, sizeof (Sample) * block_size);
for (uint32_t n = 0; n < n_channels(); ++n) {
cur_samples = read_raw_internal (buf.get(), pos, to_read, n);
- for (framecnt_t i = 0; i < cur_samples; ++i) {
+ for (samplecnt_t i = 0; i < cur_samples; ++i) {
loudest[i] = max (loudest[i], abs (buf[i]));
}
}
/* now look for silence */
- for (framecnt_t i = 0; i < cur_samples; ++i) {
+ for (samplecnt_t i = 0; i < cur_samples; ++i) {
bool const silence = abs (loudest[i]) < threshold;
if (silence && !in_silence) {
/* non-silence to silence */
@@ -1914,7 +1914,7 @@ AudioRegion::find_silence (Sample threshold, framecnt_t min_length, framecnt_t f
} else if (!silence && in_silence) {
/* silence to non-silence */
in_silence = false;
- frameoffset_t silence_end = pos + i - 1 - fade_length;
+ sampleoffset_t silence_end = pos + i - 1 - fade_length;
if (silence_end - silence_start >= min_length) {
silent_periods.push_back (std::make_pair (silence_start, silence_end));
@@ -1943,10 +1943,10 @@ AudioRegion::find_silence (Sample threshold, framecnt_t min_length, framecnt_t f
return silent_periods;
}
-Evoral::Range<framepos_t>
+Evoral::Range<samplepos_t>
AudioRegion::body_range () const
{
- return Evoral::Range<framepos_t> (first_frame() + _fade_in->back()->when + 1, last_frame() - _fade_out->back()->when);
+ return Evoral::Range<samplepos_t> (first_sample() + _fade_in->back()->when + 1, last_sample() - _fade_out->back()->when);
}
boost::shared_ptr<Region>
@@ -1966,7 +1966,7 @@ AudioRegion::get_single_other_xfade_region (bool start) const
if (start) {
rl = pl->regions_at (position());
} else {
- rl = pl->regions_at (last_frame());
+ rl = pl->regions_at (last_sample());
}
RegionList::iterator i;
@@ -1990,8 +1990,8 @@ AudioRegion::get_single_other_xfade_region (bool start) const
return other;
}
-framecnt_t
-AudioRegion::verify_xfade_bounds (framecnt_t len, bool start)
+samplecnt_t
+AudioRegion::verify_xfade_bounds (samplecnt_t len, bool start)
{
/* this is called from a UI to check on whether a new proposed
length for an xfade is legal or not. it returns the legal
@@ -2000,7 +2000,7 @@ AudioRegion::verify_xfade_bounds (framecnt_t len, bool start)
*/
boost::shared_ptr<Region> other = get_single_other_xfade_region (start);
- framecnt_t maxlen;
+ samplecnt_t maxlen;
if (!other) {
/* zero or > 2 regions here, don't care about len, but
@@ -2015,9 +2015,9 @@ AudioRegion::verify_xfade_bounds (framecnt_t len, bool start)
*/
if (start) {
- maxlen = other->latest_possible_frame() - position();
+ maxlen = other->latest_possible_sample() - position();
} else {
- maxlen = last_frame() - other->earliest_possible_position();
+ maxlen = last_sample() - other->earliest_possible_position();
}
return min (length(), min (maxlen, len));
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index 2db06230f6..aea0203394 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -152,14 +152,14 @@ AudioSource::empty () const
return _length == 0;
}
-framecnt_t
-AudioSource::length (framepos_t /*pos*/) const
+samplecnt_t
+AudioSource::length (samplepos_t /*pos*/) const
{
return _length;
}
void
-AudioSource::update_length (framecnt_t len)
+AudioSource::update_length (samplecnt_t len)
{
if (len > _length) {
_length = len;
@@ -308,8 +308,8 @@ AudioSource::initialize_peakfile (const string& audio_path, const bool in_sessio
return 0;
}
-framecnt_t
-AudioSource::read (Sample *dst, framepos_t start, framecnt_t cnt, int /*channel*/) const
+samplecnt_t
+AudioSource::read (Sample *dst, samplepos_t start, samplecnt_t cnt, int /*channel*/) const
{
assert (cnt >= 0);
@@ -317,8 +317,8 @@ AudioSource::read (Sample *dst, framepos_t start, framecnt_t cnt, int /*channel*
return read_unlocked (dst, start, cnt);
}
-framecnt_t
-AudioSource::write (Sample *dst, framecnt_t cnt)
+samplecnt_t
+AudioSource::write (Sample *dst, samplecnt_t cnt)
{
Glib::Threads::Mutex::Lock lm (_lock);
/* any write makes the file not removable */
@@ -327,7 +327,7 @@ AudioSource::write (Sample *dst, framecnt_t cnt)
}
int
-AudioSource::read_peaks (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt, double samples_per_visual_peak) const
+AudioSource::read_peaks (PeakData *peaks, samplecnt_t npeaks, samplepos_t start, samplecnt_t cnt, double samples_per_visual_peak) const
{
return read_peaks_with_fpp (peaks, npeaks, start, cnt, samples_per_visual_peak, _FPP);
}
@@ -337,8 +337,8 @@ AudioSource::read_peaks (PeakData *peaks, framecnt_t npeaks, framepos_t start, f
*/
int
-AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt,
- double samples_per_visual_peak, framecnt_t samples_per_file_peak) const
+AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos_t start, samplecnt_t cnt,
+ double samples_per_visual_peak, samplecnt_t samples_per_file_peak) const
{
Glib::Threads::Mutex::Lock lm (_lock);
double scale;
@@ -353,8 +353,8 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
#else
const int bufsize = sysconf(_SC_PAGESIZE);
#endif
- framecnt_t read_npeaks = npeaks;
- framecnt_t zero_fill = 0;
+ samplecnt_t read_npeaks = npeaks;
+ samplecnt_t zero_fill = 0;
GStatBuf statbuf;
@@ -413,7 +413,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
if (cnt > _length - start) {
// cerr << "too close to end @ " << _length << " given " << start << " + " << cnt << " (" << _length - start << ")" << endl;
cnt = _length - start;
- read_npeaks = min ((framecnt_t) floor (cnt / samples_per_visual_peak), npeaks);
+ read_npeaks = min ((samplecnt_t) floor (cnt / samples_per_visual_peak), npeaks);
zero_fill = npeaks - read_npeaks;
expected_peaks = (cnt / (double) samples_per_file_peak);
scale = npeaks/expected_peaks;
@@ -436,7 +436,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
return -1;
}
- for (framecnt_t i = 0; i < npeaks; ++i) {
+ for (samplecnt_t i = 0; i < npeaks; ++i) {
peaks[i].max = raw_staging[i];
peaks[i].min = raw_staging[i];
}
@@ -518,7 +518,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
/* the caller wants:
- - more frames-per-peak (lower resolution) than the peakfile, or to put it another way,
+ - more samples-per-peak (lower resolution) than the peakfile, or to put it another way,
- less peaks than the peakfile holds for the same range
So, read a block into a staging area, and then downsample from there.
@@ -526,15 +526,15 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
to avoid confusion, I'll refer to the requested peaks as visual_peaks and the peakfile peaks as stored_peaks
*/
- const framecnt_t chunksize = (framecnt_t) expected_peaks; // we read all the peaks we need in one hit.
+ const samplecnt_t chunksize = (samplecnt_t) expected_peaks; // we read all the peaks we need in one hit.
- /* compute the rounded up frame position */
+ /* compute the rounded up sample position */
- framepos_t current_stored_peak = (framepos_t) ceil (start / (double) samples_per_file_peak);
- framepos_t next_visual_peak = (framepos_t) ceil (start / samples_per_visual_peak);
- double next_visual_peak_frame = next_visual_peak * samples_per_visual_peak;
- framepos_t stored_peak_before_next_visual_peak = (framepos_t) next_visual_peak_frame / samples_per_file_peak;
- framecnt_t nvisual_peaks = 0;
+ samplepos_t current_stored_peak = (samplepos_t) ceil (start / (double) samples_per_file_peak);
+ samplepos_t next_visual_peak = (samplepos_t) ceil (start / samples_per_visual_peak);
+ double next_visual_peak_sample = next_visual_peak * samples_per_visual_peak;
+ samplepos_t stored_peak_before_next_visual_peak = (samplepos_t) next_visual_peak_sample / samples_per_file_peak;
+ samplecnt_t nvisual_peaks = 0;
uint32_t i = 0;
/* handle the case where the initial visual peak is on a pixel boundary */
@@ -608,8 +608,8 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
peak_cache[nvisual_peaks].max = xmax;
peak_cache[nvisual_peaks].min = xmin;
++nvisual_peaks;
- next_visual_peak_frame = min ((double) start + cnt, (next_visual_peak_frame + samples_per_visual_peak));
- stored_peak_before_next_visual_peak = (uint32_t) next_visual_peak_frame / samples_per_file_peak;
+ next_visual_peak_sample = min ((double) start + cnt, (next_visual_peak_sample + samples_per_visual_peak));
+ stored_peak_before_next_visual_peak = (uint32_t) next_visual_peak_sample / samples_per_file_peak;
}
if (zero_fill) {
@@ -630,35 +630,35 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
/* the caller wants
- - less frames-per-peak (more resolution)
+ - less samples-per-peak (more resolution)
- more peaks than stored in the Peakfile
So, fetch data from the raw source, and generate peak
data on the fly.
*/
- framecnt_t frames_read = 0;
- framepos_t current_frame = start;
- framecnt_t i = 0;
- framecnt_t nvisual_peaks = 0;
- framecnt_t chunksize = (framecnt_t) min (cnt, (framecnt_t) 4096);
+ samplecnt_t samples_read = 0;
+ samplepos_t current_sample = start;
+ samplecnt_t i = 0;
+ samplecnt_t nvisual_peaks = 0;
+ samplecnt_t chunksize = (samplecnt_t) min (cnt, (samplecnt_t) 4096);
boost::scoped_array<Sample> raw_staging(new Sample[chunksize]);
- framepos_t frame_pos = start;
- double pixel_pos = floor (frame_pos / samples_per_visual_peak);
- double next_pixel_pos = ceil (frame_pos / samples_per_visual_peak);
- double pixels_per_frame = 1.0 / samples_per_visual_peak;
+ samplepos_t sample_pos = start;
+ double pixel_pos = floor (sample_pos / samples_per_visual_peak);
+ double next_pixel_pos = ceil (sample_pos / samples_per_visual_peak);
+ double pixels_per_sample = 1.0 / samples_per_visual_peak;
xmin = 1.0;
xmax = -1.0;
while (nvisual_peaks < read_npeaks) {
- if (i == frames_read) {
+ if (i == samples_read) {
- to_read = min (chunksize, (framecnt_t)(_length - current_frame));
+ to_read = min (chunksize, (samplecnt_t)(_length - current_sample));
- if (current_frame >= _length) {
+ if (current_sample >= _length) {
/* hmm, error condition - we've reached the end of the file
without generating all the peak data. cook up a zero-filled
@@ -671,12 +671,12 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
} else {
- to_read = min (chunksize, (_length - current_frame));
+ to_read = min (chunksize, (_length - current_sample));
- if ((frames_read = read_unlocked (raw_staging.get(), current_frame, to_read)) == 0) {
+ if ((samples_read = read_unlocked (raw_staging.get(), current_sample, to_read)) == 0) {
error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3 of %4 (%5)"),
- _name, to_read, current_frame, _length, strerror (errno))
+ _name, to_read, current_sample, _length, strerror (errno))
<< endmsg;
return -1;
}
@@ -688,8 +688,8 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
xmax = max (xmax, raw_staging[i]);
xmin = min (xmin, raw_staging[i]);
++i;
- ++current_frame;
- pixel_pos += pixels_per_frame;
+ ++current_sample;
+ pixel_pos += pixels_per_sample;
if (pixel_pos >= next_pixel_pos) {
@@ -715,7 +715,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
int
AudioSource::build_peaks_from_scratch ()
{
- const framecnt_t bufsize = 65536; // 256kB per disk read for mono data is about ideal
+ const samplecnt_t bufsize = 65536; // 256kB per disk read for mono data is about ideal
DEBUG_TRACE (DEBUG::Peaks, "Building peaks from scratch\n");
@@ -730,18 +730,18 @@ AudioSource::build_peaks_from_scratch ()
goto out;
}
- framecnt_t current_frame = 0;
- framecnt_t cnt = _length;
+ samplecnt_t current_sample = 0;
+ samplecnt_t cnt = _length;
_peaks_built = false;
boost::scoped_array<Sample> buf(new Sample[bufsize]);
while (cnt) {
- framecnt_t frames_to_read = min (bufsize, cnt);
- framecnt_t frames_read;
+ samplecnt_t samples_to_read = min (bufsize, cnt);
+ samplecnt_t samples_read;
- if ((frames_read = read_unlocked (buf.get(), current_frame, frames_to_read)) != frames_to_read) {
+ if ((samples_read = read_unlocked (buf.get(), current_sample, samples_to_read)) != samples_to_read) {
error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg;
done_with_peakfile_writes (false);
goto out;
@@ -756,12 +756,12 @@ AudioSource::build_peaks_from_scratch ()
goto out;
}
- if (compute_and_write_peaks (buf.get(), current_frame, frames_read, true, false, _FPP)) {
+ if (compute_and_write_peaks (buf.get(), current_sample, samples_read, true, false, _FPP)) {
break;
}
- current_frame += frames_read;
- cnt -= frames_read;
+ current_sample += samples_read;
+ cnt -= samples_read;
lp.acquire();
}
@@ -840,24 +840,24 @@ AudioSource::done_with_peakfile_writes (bool done)
_peakfile_fd = -1;
}
-/** @param first_frame Offset from the source start of the first frame to
+/** @param first_sample Offset from the source start of the first sample to
* process. _lock MUST be held by caller.
*/
int
-AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
+AudioSource::compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt,
bool force, bool intermediate_peaks_ready)
{
- return compute_and_write_peaks (buf, first_frame, cnt, force, intermediate_peaks_ready, _FPP);
+ return compute_and_write_peaks (buf, first_sample, cnt, force, intermediate_peaks_ready, _FPP);
}
int
-AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
- bool force, bool intermediate_peaks_ready, framecnt_t fpp)
+AudioSource::compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt,
+ bool force, bool intermediate_peaks_ready, samplecnt_t fpp)
{
- framecnt_t to_do;
+ samplecnt_t to_do;
uint32_t peaks_computed;
- framepos_t current_frame;
- framecnt_t frames_done;
+ samplepos_t current_sample;
+ samplecnt_t samples_done;
const size_t blocksize = (128 * 1024);
off_t first_peak_byte;
boost::scoped_array<Sample> buf2;
@@ -871,7 +871,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
restart:
if (peak_leftover_cnt) {
- if (first_frame != peak_leftover_frame + peak_leftover_cnt) {
+ if (first_sample != peak_leftover_sample + peak_leftover_cnt) {
/* uh-oh, ::seek() since the last ::compute_and_write_peaks(),
and we have leftovers. flush a single peak (since the leftovers
@@ -883,7 +883,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
x.min = peak_leftovers[0];
x.max = peak_leftovers[0];
- off_t byte = (peak_leftover_frame / fpp) * sizeof (PeakData);
+ off_t byte = (peak_leftover_sample / fpp) * sizeof (PeakData);
off_t offset = lseek (_peakfile_fd, byte, SEEK_SET);
@@ -901,7 +901,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
{
Glib::Threads::Mutex::Lock lm (_peaks_ready_lock);
- PeakRangeReady (peak_leftover_frame, peak_leftover_cnt); /* EMIT SIGNAL */
+ PeakRangeReady (peak_leftover_sample, peak_leftover_cnt); /* EMIT SIGNAL */
if (intermediate_peaks_ready) {
PeaksReady (); /* EMIT SIGNAL */
}
@@ -936,7 +936,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
/* make sure that when we write into the peakfile, we startup where we left off */
- first_frame = peak_leftover_frame;
+ first_sample = peak_leftover_sample;
} else {
to_do = cnt;
@@ -944,12 +944,12 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
boost::scoped_array<PeakData> peakbuf(new PeakData[(to_do/fpp)+1]);
peaks_computed = 0;
- current_frame = first_frame;
- frames_done = 0;
+ current_sample = first_sample;
+ samples_done = 0;
while (to_do) {
- /* if some frames were passed in (i.e. we're not flushing leftovers)
+ /* if some samples were passed in (i.e. we're not flushing leftovers)
and there are less than fpp to do, save them till
next time
*/
@@ -964,14 +964,14 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
}
memcpy (peak_leftovers, buf, to_do * sizeof (Sample));
peak_leftover_cnt = to_do;
- peak_leftover_frame = current_frame;
+ peak_leftover_sample = current_sample;
/* done for now */
break;
}
- framecnt_t this_time = min (fpp, to_do);
+ samplecnt_t this_time = min (fpp, to_do);
peakbuf[peaks_computed].max = buf[0];
peakbuf[peaks_computed].min = buf[0];
@@ -981,11 +981,11 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
peaks_computed++;
buf += this_time;
to_do -= this_time;
- frames_done += this_time;
- current_frame += this_time;
+ samples_done += this_time;
+ current_sample += this_time;
}
- first_peak_byte = (first_frame / fpp) * sizeof (PeakData);
+ first_peak_byte = (first_sample / fpp) * sizeof (PeakData);
if (can_truncate_peaks()) {
@@ -1025,9 +1025,9 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
_peak_byte_max = max (_peak_byte_max, (off_t) (first_peak_byte + bytes_to_write));
- if (frames_done) {
+ if (samples_done) {
Glib::Threads::Mutex::Lock lm (_peaks_ready_lock);
- PeakRangeReady (first_frame, frames_done); /* EMIT SIGNAL */
+ PeakRangeReady (first_sample, samples_done); /* EMIT SIGNAL */
if (intermediate_peaks_ready) {
PeaksReady (); /* EMIT SIGNAL */
}
@@ -1058,7 +1058,7 @@ AudioSource::truncate_peakfile ()
}
}
-framecnt_t
+samplecnt_t
AudioSource::available_peaks (double zoom_factor) const
{
if (zoom_factor < _FPP) {
@@ -1087,7 +1087,7 @@ AudioSource::mark_streaming_write_completed (const Lock& lock)
}
void
-AudioSource::allocate_working_buffers (framecnt_t framerate)
+AudioSource::allocate_working_buffers (samplecnt_t framerate)
{
Glib::Threads::Mutex::Lock lm (_level_buffer_lock);
@@ -1104,18 +1104,18 @@ AudioSource::allocate_working_buffers (framecnt_t framerate)
}
void
-AudioSource::ensure_buffers_for_level (uint32_t level, framecnt_t frame_rate)
+AudioSource::ensure_buffers_for_level (uint32_t level, samplecnt_t sample_rate)
{
Glib::Threads::Mutex::Lock lm (_level_buffer_lock);
- ensure_buffers_for_level_locked (level, frame_rate);
+ ensure_buffers_for_level_locked (level, sample_rate);
}
void
-AudioSource::ensure_buffers_for_level_locked (uint32_t level, framecnt_t frame_rate)
+AudioSource::ensure_buffers_for_level_locked (uint32_t level, samplecnt_t sample_rate)
{
- framecnt_t nframes = (framecnt_t) floor (Config->get_audio_playback_buffer_seconds() * frame_rate);
+ samplecnt_t nframes = (samplecnt_t) floor (Config->get_audio_playback_buffer_seconds() * sample_rate);
- /* this may be called because either "level" or "frame_rate" have
+ /* this may be called because either "level" or "sample_rate" have
* changed. and it may be called with "level" smaller than the current
* number of buffers, because a new compound region has been created at
* a more shallow level than the deepest one we currently have.
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc
index cf03ecc2cc..0ea66aa387 100644
--- a/libs/ardour/auditioner.cc
+++ b/libs/ardour/auditioner.cc
@@ -47,10 +47,10 @@ using namespace PBD;
Auditioner::Auditioner (Session& s)
: Track (s, "auditioner", PresentationInfo::Auditioner)
- , current_frame (0)
+ , current_sample (0)
, _auditioning (0)
, length (0)
- , _seek_frame (-1)
+ , _seek_sample (-1)
, _seeking (false)
, _seek_complete (false)
, via_monitor (false)
@@ -217,7 +217,7 @@ Auditioner::data_type () const {
}
int
-Auditioner::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
+Auditioner::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
@@ -244,7 +244,7 @@ Auditioner::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
}
}
- process_output_buffers (bufs, start_frame, end_frame, nframes, declick, !_session.transport_stopped());
+ process_output_buffers (bufs, start_sample, end_sample, nframes, declick, !_session.transport_stopped());
/* note: auditioner never writes to disk, so we don't care about the
* disk writer status (it's buffers will always have no data in them).
@@ -363,11 +363,11 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
/* force a panner reset now that we have all channels */
_main_outs->reset_panner();
- _seek_frame = -1;
+ _seek_sample = -1;
_seeking = false;
int dir;
- framecnt_t offset;
+ samplecnt_t offset;
if (_midi_audition) {
length = midi_region->length();
@@ -384,16 +384,16 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
}
_disk_reader->seek (offset, true);
- current_frame = offset;
+ current_sample = offset;
g_atomic_int_set (&_auditioning, 1);
}
int
-Auditioner::play_audition (framecnt_t nframes)
+Auditioner::play_audition (samplecnt_t nframes)
{
bool need_butler = false;
- framecnt_t this_nframes;
+ samplecnt_t this_nframes;
int ret;
if (g_atomic_int_get (&_auditioning) == 0) {
@@ -404,7 +404,7 @@ Auditioner::play_audition (framecnt_t nframes)
#if 0 // TODO
if (_seeking && _seek_complete) {
// set FADE-IN
- } else if (_seek_frame >= 0 && _seek_frame < length && !_seeking) {
+ } else if (_seek_sample >= 0 && _seek_sample < length && !_seeking) {
// set FADE-OUT -- use/override amp? || use region-gain ?
}
#endif
@@ -412,26 +412,26 @@ Auditioner::play_audition (framecnt_t nframes)
if (_seeking && _seek_complete) {
_seek_complete = false;
_seeking = false;
- _seek_frame = -1;
+ _seek_sample = -1;
_disk_reader->reset_tracker();
}
if(!_seeking) {
/* process audio */
- this_nframes = min (nframes, length - current_frame + _import_position);
+ this_nframes = min (nframes, length - current_sample + _import_position);
- if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, need_butler)) != 0) {
+ if ((ret = roll (this_nframes, current_sample, current_sample + nframes, false, need_butler)) != 0) {
silence (nframes);
return ret;
}
- current_frame += this_nframes;
+ current_sample += this_nframes;
} else {
silence (nframes);
}
- if (_seek_frame >= 0 && _seek_frame < length && !_seeking) {
+ if (_seek_sample >= 0 && _seek_sample < length && !_seeking) {
_queue_panic = true;
_seek_complete = false;
_seeking = true;
@@ -439,10 +439,10 @@ Auditioner::play_audition (framecnt_t nframes)
}
if (!_seeking) {
- AuditionProgress(current_frame - _import_position, length); /* emit */
+ AuditionProgress(current_sample - _import_position, length); /* emit */
}
- if (current_frame >= length + _import_position) {
+ if (current_sample >= length + _import_position) {
_session.cancel_audition ();
return 0;
} else {
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index 8025386d1f..26961f633c 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -341,7 +341,7 @@ Automatable::protect_automation ()
}
void
-Automatable::non_realtime_locate (framepos_t now)
+Automatable::non_realtime_locate (samplepos_t now)
{
bool rolling = _a_session.transport_rolling ();
@@ -387,7 +387,7 @@ Automatable::non_realtime_locate (framepos_t now)
}
void
-Automatable::non_realtime_transport_stop (framepos_t now, bool /*flush_processors*/)
+Automatable::non_realtime_transport_stop (samplepos_t now, bool /*flush_processors*/)
{
for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) {
boost::shared_ptr<AutomationControl> c =
@@ -428,7 +428,7 @@ Automatable::non_realtime_transport_stop (framepos_t now, bool /*flush_processor
}
void
-Automatable::automation_run (framepos_t start, pframes_t nframes)
+Automatable::automation_run (samplepos_t start, pframes_t nframes)
{
for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) {
boost::shared_ptr<AutomationControl> c =
diff --git a/libs/ardour/automation.cc b/libs/ardour/automation.cc
index 931e2f45b8..d42ebeb045 100644
--- a/libs/ardour/automation.cc
+++ b/libs/ardour/automation.cc
@@ -21,7 +21,7 @@
template<class AutomatedObject>
struct AutomationEvent {
- uint32_t frame;
+ uint32_t sample;
AutomatedObject *object;
void (AutomatedObject::*function) (void *);
void *arg;
diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc
index 02bcbf4f65..5755e04aac 100644
--- a/libs/ardour/automation_control.cc
+++ b/libs/ardour/automation_control.cc
@@ -100,7 +100,7 @@ double
AutomationControl::get_value() const
{
bool from_list = alist() && alist()->automation_playback();
- return Control::get_double (from_list, _session.transport_frame());
+ return Control::get_double (from_list, _session.transport_sample());
}
double
@@ -158,7 +158,7 @@ AutomationControl::grouped_controls () const
}
void
-AutomationControl::automation_run (framepos_t start, pframes_t nframes)
+AutomationControl::automation_run (samplepos_t start, pframes_t nframes)
{
if (!automation_playback ()) {
return;
@@ -186,7 +186,7 @@ void
AutomationControl::actually_set_value (double value, PBD::Controllable::GroupControlDisposition gcd)
{
boost::shared_ptr<AutomationList> al = alist ();
- const framepos_t pos = _session.transport_frame();
+ const samplepos_t pos = _session.transport_sample();
bool to_list;
/* We cannot use ::get_value() here since that is virtual, and intended
@@ -255,8 +255,8 @@ AutomationControl::set_automation_state (AutoState as)
AutomationWatch::instance().add_automation_watch (shared_from_this());
} else if (as & (Touch | Latch)) {
if (alist()->empty()) {
- Control::set_double (val, _session.current_start_frame (), true);
- Control::set_double (val, _session.current_end_frame (), true);
+ Control::set_double (val, _session.current_start_sample (), true);
+ Control::set_double (val, _session.current_end_sample (), true);
Changed (true, Controllable::NoGroup);
}
if (!touching()) {
diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc
index a081418017..b3a727ff9e 100644
--- a/libs/ardour/automation_list.cc
+++ b/libs/ardour/automation_list.cc
@@ -24,7 +24,7 @@
#include <sstream>
#include <algorithm>
#include "ardour/automation_list.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/event_type_map.h"
#include "ardour/parameter_descriptor.h"
#include "ardour/parameter_types.h"
@@ -307,7 +307,7 @@ AutomationList::thaw ()
}
bool
-AutomationList::paste (const ControlList& alist, double pos, DoubleBeatsFramesConverter const& bfc)
+AutomationList::paste (const ControlList& alist, double pos, DoubleBeatsSamplesConverter const& bfc)
{
AutomationType src_type = (AutomationType)alist.parameter().type();
AutomationType dst_type = (AutomationType)_parameter.type();
@@ -315,13 +315,13 @@ AutomationList::paste (const ControlList& alist, double pos, DoubleBeatsFramesCo
if (parameter_is_midi (src_type) == parameter_is_midi (dst_type)) {
return ControlList::paste (alist, pos);
}
- bool to_frame = parameter_is_midi (src_type);
+ bool to_sample = parameter_is_midi (src_type);
ControlList cl (alist);
cl.clear ();
for (const_iterator i = alist.begin ();i != alist.end (); ++i) {
double when = (*i)->when;
- if (to_frame) {
+ if (to_sample) {
when = bfc.to ((*i)->when);
} else {
when = bfc.from ((*i)->when);
diff --git a/libs/ardour/automation_watch.cc b/libs/ardour/automation_watch.cc
index ad05f3ac69..0445d05d8a 100644
--- a/libs/ardour/automation_watch.cc
+++ b/libs/ardour/automation_watch.cc
@@ -82,9 +82,9 @@ AutomationWatch::add_automation_watch (boost::shared_ptr<AutomationControl> ac)
if (_session && _session->transport_rolling() && ac->alist()->automation_write()) {
DEBUG_TRACE (DEBUG::Automation, string_compose ("\ttransport is rolling @ %1, audible = %2so enter write pass\n",
- _session->transport_speed(), _session->audible_frame()));
+ _session->transport_speed(), _session->audible_sample()));
/* add a guard point since we are already moving */
- ac->list()->set_in_write_pass (true, true, _session->audible_frame());
+ ac->list()->set_in_write_pass (true, true, _session->audible_sample());
}
/* we can't store shared_ptr<Destructible> in connections because it
@@ -119,7 +119,7 @@ AutomationWatch::remove_automation_watch (boost::shared_ptr<AutomationControl> a
}
void
-AutomationWatch::transport_stop_automation_watches (framepos_t when)
+AutomationWatch::transport_stop_automation_watches (samplepos_t when)
{
DEBUG_TRACE (DEBUG::Automation, "clear all automation watches\n");
@@ -153,7 +153,7 @@ AutomationWatch::timer ()
{
Glib::Threads::Mutex::Lock lm (automation_watch_lock);
- framepos_t time = _session->audible_frame ();
+ samplepos_t time = _session->audible_sample ();
if (time > _last_time) { //we only write automation in the forward direction; this fixes automation-recording in a loop
for (AutomationWatches::iterator aw = automation_watches.begin(); aw != automation_watches.end(); ++aw) {
if ((*aw)->alist()->automation_write()) {
@@ -223,7 +223,7 @@ AutomationWatch::transport_state_change ()
bool rolling = _session->transport_rolling();
- _last_time = _session->audible_frame ();
+ _last_time = _session->audible_sample ();
{
Glib::Threads::Mutex::Lock lm (automation_watch_lock);
diff --git a/libs/ardour/beats_frames_converter.cc b/libs/ardour/beats_samples_converter.cc
index f35e2c757a..67b13cd05f 100644
--- a/libs/ardour/beats_frames_converter.cc
+++ b/libs/ardour/beats_samples_converter.cc
@@ -21,53 +21,53 @@
#include "pbd/stacktrace.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/tempo.h"
namespace ARDOUR {
/** Takes a positive duration in quarter-note beats and considers it as a distance from the origin
- * supplied to the constructor. Returns the equivalent number of frames,
+ * supplied to the constructor. Returns the equivalent number of samples,
* taking tempo changes into account.
*/
-framepos_t
-BeatsFramesConverter::to (Evoral::Beats beats) const
+samplepos_t
+BeatsSamplesConverter::to (Evoral::Beats beats) const
{
if (beats < Evoral::Beats()) {
std::cerr << "negative beats passed to BFC: " << beats << std::endl;
PBD::stacktrace (std::cerr, 30);
return 0;
}
- return _tempo_map.framepos_plus_qn (_origin_b, beats) - _origin_b;
+ return _tempo_map.samplepos_plus_qn (_origin_b, beats) - _origin_b;
}
-/** Takes a duration in frames and considers it as a distance from the origin
+/** Takes a duration in samples and considers it as a distance from the origin
* supplied to the constructor. Returns the equivalent number of quarter-note beats,
* taking tempo changes into account.
*/
Evoral::Beats
-BeatsFramesConverter::from (framepos_t frames) const
+BeatsSamplesConverter::from (samplepos_t samples) const
{
- return _tempo_map.framewalk_to_qn (_origin_b, frames);
+ return _tempo_map.framewalk_to_qn (_origin_b, samples);
}
/** As above, but with quarter-note beats in double instead (for GUI). */
-framepos_t
-DoubleBeatsFramesConverter::to (double beats) const
+samplepos_t
+DoubleBeatsSamplesConverter::to (double beats) const
{
if (beats < 0.0) {
std::cerr << "negative beats passed to BFC: " << beats << std::endl;
PBD::stacktrace (std::cerr, 30);
return 0;
}
- return _tempo_map.framepos_plus_qn (_origin_b, Evoral::Beats(beats)) - _origin_b;
+ return _tempo_map.samplepos_plus_qn (_origin_b, Evoral::Beats(beats)) - _origin_b;
}
/** As above, but with quarter-note beats in double instead (for GUI). */
double
-DoubleBeatsFramesConverter::from (framepos_t frames) const
+DoubleBeatsSamplesConverter::from (samplepos_t samples) const
{
- return _tempo_map.framewalk_to_qn (_origin_b, frames).to_double();
+ return _tempo_map.framewalk_to_qn (_origin_b, samples).to_double();
}
} /* namespace ARDOUR */
diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc
index 243c677754..54eb7fe62b 100644
--- a/libs/ardour/buffer_set.cc
+++ b/libs/ardour/buffer_set.cc
@@ -128,7 +128,7 @@ BufferSet::attach_buffers (PortSet& ports)
* the process() callback tree anyway, so this has to be called in RT context.
*/
void
-BufferSet::get_backend_port_addresses (PortSet& ports, framecnt_t nframes)
+BufferSet::get_backend_port_addresses (PortSet& ports, samplecnt_t nframes)
{
assert (_count == ports.count ());
assert (_available == ports.count ());
@@ -302,11 +302,11 @@ BufferSet::forward_lv2_midi(LV2_Evbuf* buf, size_t i, bool purge_ardour_buffer)
for (LV2_Evbuf_Iterator i = lv2_evbuf_begin(buf);
lv2_evbuf_is_valid(i);
i = lv2_evbuf_next(i)) {
- uint32_t frames, subframes, type, size;
+ uint32_t samples, subframes, type, size;
uint8_t* data;
- lv2_evbuf_get(i, &frames, &subframes, &type, &size, &data);
+ lv2_evbuf_get(i, &samples, &subframes, &type, &size, &data);
if (type == URIMap::instance().urids.midi_MidiEvent) {
- mbuf.push_back(frames, size, data);
+ mbuf.push_back(samples, size, data);
}
}
}
@@ -322,12 +322,12 @@ BufferSet::flush_lv2_midi(bool input, size_t i)
for (LV2_Evbuf_Iterator i = lv2_evbuf_begin(evbuf);
lv2_evbuf_is_valid(i);
i = lv2_evbuf_next(i)) {
- uint32_t frames;
+ uint32_t samples;
uint32_t subframes;
uint32_t type;
uint32_t size;
uint8_t* data;
- lv2_evbuf_get(i, &frames, &subframes, &type, &size, &data);
+ lv2_evbuf_get(i, &samples, &subframes, &type, &size, &data);
#ifndef NDEBUG
DEBUG_TRACE (PBD::DEBUG::LV2, string_compose ("(FLUSH) MIDI event of size %1\n", size));
for (uint16_t x = 0; x < size; ++x) {
@@ -336,7 +336,7 @@ BufferSet::flush_lv2_midi(bool input, size_t i)
#endif
if (type == URIMap::instance().urids.midi_MidiEvent) {
// TODO: Make Ardour event buffers generic so plugins can communicate
- mbuf.push_back(frames, size, data);
+ mbuf.push_back(samples, size, data);
}
}
}
@@ -401,7 +401,7 @@ BufferSet::VSTBuffer::clear ()
}
void
-BufferSet::VSTBuffer::push_back (Evoral::Event<framepos_t> const & ev)
+BufferSet::VSTBuffer::push_back (Evoral::Event<samplepos_t> const & ev)
{
if (ev.size() > 3) {
/* XXX: this will silently drop MIDI messages longer than 3 bytes, so
@@ -420,7 +420,7 @@ BufferSet::VSTBuffer::push_back (Evoral::Event<framepos_t> const & ev)
v->type = kVstMidiType;
v->byteSize = sizeof (VstMidiEvent);
- v->deltaFrames = ev.time ();
+ v->deltaSamples = ev.time ();
v->flags = 0;
v->detune = 0;
@@ -439,7 +439,7 @@ BufferSet::VSTBuffer::push_back (Evoral::Event<framepos_t> const & ev)
/** Copy buffers of one type from `in' to this BufferSet */
void
-BufferSet::read_from (const BufferSet& in, framecnt_t nframes, DataType type)
+BufferSet::read_from (const BufferSet& in, samplecnt_t nframes, DataType type)
{
assert (available().get (type) >= in.count().get (type));
@@ -453,7 +453,7 @@ BufferSet::read_from (const BufferSet& in, framecnt_t nframes, DataType type)
/** Copy buffers of all types from `in' to this BufferSet */
void
-BufferSet::read_from (const BufferSet& in, framecnt_t nframes)
+BufferSet::read_from (const BufferSet& in, samplecnt_t nframes)
{
assert(available() >= in.count());
@@ -464,7 +464,7 @@ BufferSet::read_from (const BufferSet& in, framecnt_t nframes)
}
void
-BufferSet::merge_from (const BufferSet& in, framecnt_t nframes)
+BufferSet::merge_from (const BufferSet& in, samplecnt_t nframes)
{
/* merge all input buffers into out existing buffers.
@@ -482,7 +482,7 @@ BufferSet::merge_from (const BufferSet& in, framecnt_t nframes)
}
void
-BufferSet::silence (framecnt_t nframes, framecnt_t offset)
+BufferSet::silence (samplecnt_t nframes, samplecnt_t offset)
{
for (std::vector<BufferVec>::iterator i = _buffers.begin(); i != _buffers.end(); ++i) {
for (BufferVec::iterator b = i->begin(); b != i->end(); ++b) {
diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc
index 76b74ac321..ea68f94806 100644
--- a/libs/ardour/butler.cc
+++ b/libs/ardour/butler.cc
@@ -80,7 +80,7 @@ Butler::config_changed (std::string p)
_session.adjust_playback_buffering ();
if (Config->get_buffering_preset() == Custom) {
/* size is in Samples, not bytes */
- audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.frame_rate());
+ audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.sample_rate());
_session.adjust_playback_buffering ();
} else {
#ifndef NDEBUG
@@ -89,7 +89,7 @@ Butler::config_changed (std::string p)
}
} else if (p == "capture-buffer-seconds") {
if (Config->get_buffering_preset() == Custom) {
- audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.frame_rate());
+ audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.sample_rate());
_session.adjust_capture_buffering ();
} else {
#ifndef NDEBUG
@@ -98,12 +98,12 @@ Butler::config_changed (std::string p)
}
} else if (p == "buffering-preset") {
DiskIOProcessor::set_buffering_parameters (Config->get_buffering_preset());
- audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.frame_rate());
- audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.frame_rate());
+ audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.sample_rate());
+ audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.sample_rate());
_session.adjust_capture_buffering ();
_session.adjust_playback_buffering ();
} else if (p == "midi-readahead") {
- DiskReader::set_midi_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * _session.frame_rate()));
+ DiskReader::set_midi_readahead_samples ((samplecnt_t) (Config->get_midi_readahead() * _session.sample_rate()));
}
}
@@ -114,7 +114,7 @@ Butler::start_thread()
DiskIOProcessor::set_buffering_parameters (Config->get_buffering_preset());
/* size is in Samples, not bytes */
- const float rate = (float)_session.frame_rate();
+ const float rate = (float)_session.sample_rate();
audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * rate);
audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * rate);
@@ -124,7 +124,7 @@ Butler::start_thread()
*/
midi_dstream_buffer_size = (uint32_t) floor (Config->get_midi_track_buffer_seconds() * rate);
- DiskReader::set_midi_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * rate));
+ DiskReader::set_midi_readahead_samples ((samplecnt_t) (Config->get_midi_readahead() * rate));
should_run = false;
@@ -215,8 +215,8 @@ Butler::thread_work ()
DEBUG_TRACE (DEBUG::Butler, string_compose ("\ttransport work complete @ %1, twr = %2\n", g_get_monotonic_time(), transport_work_requested()));
}
- frameoffset_t audition_seek;
- if (should_run && _session.is_auditioning() && (audition_seek = _session.the_auditioner()->seek_frame()) >= 0) {
+ sampleoffset_t audition_seek;
+ if (should_run && _session.is_auditioning() && (audition_seek = _session.the_auditioner()->seek_sample()) >= 0) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (_session.the_auditioner());
DEBUG_TRACE (DEBUG::Butler, "seek the auditioner\n");
tr->seek(audition_seek);
diff --git a/libs/ardour/caimportable.cc b/libs/ardour/caimportable.cc
index b9bd20ddc3..13721f8334 100644
--- a/libs/ardour/caimportable.cc
+++ b/libs/ardour/caimportable.cc
@@ -55,12 +55,12 @@ CAImportableSource::~CAImportableSource ()
{
}
-framecnt_t
-CAImportableSource::read (Sample* buffer, framecnt_t nframes)
+samplecnt_t
+CAImportableSource::read (Sample* buffer, samplecnt_t nframes)
{
- framecnt_t nread = 0;
+ samplecnt_t nread = 0;
AudioBufferList abl;
- framecnt_t per_channel;
+ samplecnt_t per_channel;
bool at_end = false;
abl.mNumberBuffers = 1;
@@ -104,13 +104,13 @@ CAImportableSource::channels () const
return af.GetFileDataFormat().NumberChannels();
}
-framecnt_t
+samplecnt_t
CAImportableSource::length () const
{
- return af.GetNumberFrames();
+ return af.GetNumberSamples();
}
-framecnt_t
+samplecnt_t
CAImportableSource::samplerate () const
{
CAStreamBasicDescription client_asbd;
@@ -126,7 +126,7 @@ CAImportableSource::samplerate () const
}
void
-CAImportableSource::seek (framepos_t pos)
+CAImportableSource::seek (samplepos_t pos)
{
try {
af.Seek (pos);
diff --git a/libs/ardour/capturing_processor.cc b/libs/ardour/capturing_processor.cc
index 6012f9ff37..496bfc53f2 100644
--- a/libs/ardour/capturing_processor.cc
+++ b/libs/ardour/capturing_processor.cc
@@ -26,7 +26,7 @@
namespace ARDOUR {
-CapturingProcessor::CapturingProcessor (Session & session, framecnt_t latency)
+CapturingProcessor::CapturingProcessor (Session & session, samplecnt_t latency)
: Processor (session, X_("capture point"))
, block_size (AudioEngine::instance()->samples_per_cycle())
, _latency (latency)
@@ -47,7 +47,7 @@ CapturingProcessor::set_block_size (pframes_t nframes)
}
void
-CapturingProcessor::run (BufferSet& bufs, framepos_t, framepos_t, double, pframes_t nframes, bool)
+CapturingProcessor::run (BufferSet& bufs, samplepos_t, samplepos_t, double, pframes_t nframes, bool)
{
if (!active()) {
_delaybuffers.flush ();
diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc
index 90ab07b86d..9544371738 100644
--- a/libs/ardour/coreaudiosource.cc
+++ b/libs/ardour/coreaudiosource.cc
@@ -85,7 +85,7 @@ CoreAudioSource::init_cafile ()
throw failed_constructor();
}
- _length = af.GetNumberFrames();
+ _length = af.GetNumberSamples();
CAStreamBasicDescription client_format (file_format);
@@ -115,9 +115,9 @@ CoreAudioSource::close ()
}
int
-CoreAudioSource::safe_read (Sample* dst, framepos_t start, framecnt_t cnt, AudioBufferList& abl) const
+CoreAudioSource::safe_read (Sample* dst, samplepos_t start, samplecnt_t cnt, AudioBufferList& abl) const
{
- framecnt_t nread = 0;
+ samplecnt_t nread = 0;
while (nread < cnt) {
@@ -160,10 +160,10 @@ CoreAudioSource::safe_read (Sample* dst, framepos_t start, framecnt_t cnt, Audio
}
-framecnt_t
-CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const
+samplecnt_t
+CoreAudioSource::read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const
{
- framecnt_t file_cnt;
+ samplecnt_t file_cnt;
AudioBufferList abl;
abl.mNumberBuffers = 1;
@@ -189,7 +189,7 @@ CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) c
}
if (file_cnt != cnt) {
- frameoffset_t delta = cnt - file_cnt;
+ sampleoffset_t delta = cnt - file_cnt;
memset (dst+file_cnt, 0, sizeof (Sample) * delta);
}
@@ -213,7 +213,7 @@ CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) c
/* stride through the interleaved data */
- for (framecnt_t n = 0; n < file_cnt; ++n) {
+ for (samplecnt_t n = 0; n < file_cnt; ++n) {
dst[n] = *ptr;
ptr += n_channels;
}
@@ -237,7 +237,7 @@ CoreAudioSource::sample_rate() const
}
int
-CoreAudioSource::update_header (framepos_t, struct tm&, time_t)
+CoreAudioSource::update_header (samplepos_t, struct tm&, time_t)
{
return 0;
}
@@ -282,7 +282,7 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string&)
_info.channels = absd.mChannelsPerFrame;
size = sizeof(_info.length);
- if (ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &size, &_info.length) != noErr) {
+ if (ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthSamples, &size, &_info.length) != noErr) {
goto out;
}
diff --git a/libs/ardour/default_click.cc b/libs/ardour/default_click.cc
index e9e7897e49..90a0d68524 100644
--- a/libs/ardour/default_click.cc
+++ b/libs/ardour/default_click.cc
@@ -2279,7 +2279,7 @@ const Sample Session::default_click_emphasis[] = {
};
-const framecnt_t Session::default_click_emphasis_length = sizeof (default_click_emphasis) / sizeof (default_click_emphasis[0]);
+const samplecnt_t Session::default_click_emphasis_length = sizeof (default_click_emphasis) / sizeof (default_click_emphasis[0]);
const Sample Session::default_click[] = {
@@ -4595,4 +4595,4 @@ const Sample Session::default_click[] = {
};
-const framecnt_t Session::default_click_length = sizeof (default_click) / sizeof (default_click[0]);
+const samplecnt_t Session::default_click_length = sizeof (default_click) / sizeof (default_click[0]);
diff --git a/libs/ardour/delayline.cc b/libs/ardour/delayline.cc
index 95ab075a12..689fd58c81 100644
--- a/libs/ardour/delayline.cc
+++ b/libs/ardour/delayline.cc
@@ -50,14 +50,14 @@ DelayLine::~DelayLine ()
#define FADE_LEN (16)
void
-DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end_frame */, double /* speed */, pframes_t nsamples, bool)
+DelayLine::run (BufferSet& bufs, samplepos_t /* start_sample */, samplepos_t /* end_sample */, double /* speed */, pframes_t nsamples, bool)
{
const uint32_t chn = _configured_output.n_audio();
pframes_t p0 = 0;
uint32_t c;
- const frameoffset_t pending_delay = _pending_delay;
- const frameoffset_t delay_diff = _delay - pending_delay;
+ const sampleoffset_t pending_delay = _pending_delay;
+ const sampleoffset_t delay_diff = _delay - pending_delay;
const bool pending_flush = _pending_flush;
_pending_flush = false;
@@ -72,12 +72,12 @@ DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end
const size_t boff = _pending_bsiz - _bsiz;
if (_bsiz > 0) {
/* write offset is retained. copy existing data to new buffer */
- frameoffset_t wl = _bsiz - _woff;
+ sampleoffset_t wl = _bsiz - _woff;
memcpy(_pending_buf.get(), _buf.get(), sizeof(Sample) * _woff * chn);
memcpy(_pending_buf.get() + (_pending_bsiz - wl) * chn, _buf.get() + _woff * chn, sizeof(Sample) * wl * chn);
/* new buffer is all zero by default, fade into the existing data copied above */
- frameoffset_t wo = _pending_bsiz - wl;
+ sampleoffset_t wo = _pending_bsiz - wl;
for (pframes_t pos = 0; pos < FADE_LEN; ++pos) {
const gain_t gain = (gain_t)pos / (gain_t)FADE_LEN;
for (c = 0; c < _configured_output.n_audio(); ++c) {
@@ -89,8 +89,8 @@ DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end
/* read-pointer will be moved and may up anywhere..
* copy current data for smooth fade-out below
*/
- frameoffset_t roold = _roff;
- frameoffset_t ro = _roff;
+ sampleoffset_t roold = _roff;
+ sampleoffset_t ro = _roff;
if (ro > _woff) {
ro += boff;
}
@@ -126,7 +126,7 @@ DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end
if (buf && _configured_output.n_audio() > 0) {
assert (_bsiz >= pending_delay);
- const framecnt_t rbs = _bsiz + 1;
+ const samplecnt_t rbs = _bsiz + 1;
if (pending_delay != _delay || pending_flush) {
const pframes_t fade_len = (nsamples >= FADE_LEN) ? FADE_LEN : nsamples / 2;
@@ -139,8 +139,8 @@ DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end
c = 0;
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end() && c <= chn; ++i, ++c) {
Sample * const data = i->data();
- frameoffset_t roff = _roff;
- frameoffset_t woff = _woff;
+ sampleoffset_t roff = _roff;
+ sampleoffset_t woff = _woff;
for (pframes_t pos = 0; pos < fade_len; ++pos) {
const gain_t gain = (gain_t)(fade_len - pos) / (gain_t)fade_len;
buf[ woff * chn + c ] = data[ pos ];
@@ -170,8 +170,8 @@ DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end
c = 0;
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end() && c <= chn; ++i, ++c) {
Sample * const data = i->data();
- frameoffset_t roff = _roff;
- frameoffset_t woff = _woff;
+ sampleoffset_t roff = _roff;
+ sampleoffset_t woff = _woff;
for (pframes_t pos = fade_len; pos < 2 * fade_len; ++pos) {
const gain_t gain = (gain_t)(pos - fade_len) / (gain_t)fade_len;
buf[ woff * chn + c ] = data[ pos ];
@@ -196,8 +196,8 @@ DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end
c = 0;
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end() && c <= chn; ++i, ++c) {
Sample * const data = i->data();
- frameoffset_t roff = _roff;
- frameoffset_t woff = _woff;
+ sampleoffset_t roff = _roff;
+ sampleoffset_t woff = _woff;
for (pframes_t pos = p0; pos < nsamples; ++pos) {
buf[ woff * chn + c ] = data[ pos ];
data[ pos ] = buf[ roff * chn + c ];
@@ -278,7 +278,7 @@ DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end
}
void
-DelayLine::set_delay(framecnt_t signal_delay)
+DelayLine::set_delay(samplecnt_t signal_delay)
{
if (signal_delay < 0) {
signal_delay = 0;
@@ -320,10 +320,10 @@ DelayLine::can_support_io_configuration (const ChanCount& in, ChanCount& out)
}
void
-DelayLine::allocate_pending_buffers (framecnt_t signal_delay)
+DelayLine::allocate_pending_buffers (samplecnt_t signal_delay)
{
assert (signal_delay >= 0);
- const framecnt_t rbs = signal_delay + 1;
+ const samplecnt_t rbs = signal_delay + 1;
if (_configured_output.n_audio() > 0 ) {
_pending_buf.reset(new Sample[_configured_output.n_audio() * rbs]);
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index 682c9fb7c4..88d735bd5e 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -233,7 +233,7 @@ Delivery::configure_io (ChanCount in, ChanCount out)
}
void
-Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double /*speed*/, pframes_t nframes, bool result_required)
+Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double /*speed*/, pframes_t nframes, bool result_required)
{
assert (_output);
@@ -266,7 +266,7 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, do
if (tgain != _current_gain) {
/* target gain has changed */
- _current_gain = Amp::apply_gain (bufs, _session.nominal_frame_rate(), nframes, _current_gain, tgain);
+ _current_gain = Amp::apply_gain (bufs, _session.nominal_sample_rate(), nframes, _current_gain, tgain);
} else if (tgain < GAIN_COEFF_SMALL) {
@@ -299,7 +299,7 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, do
// Use the panner to distribute audio to output port buffers
- _panshell->run (bufs, output_buffers(), start_frame, end_frame, nframes);
+ _panshell->run (bufs, output_buffers(), start_sample, end_sample, nframes);
// non-audio data will not have been delivered by the panner
@@ -482,7 +482,7 @@ Delivery::reset_panners ()
}
void
-Delivery::flush_buffers (framecnt_t nframes)
+Delivery::flush_buffers (samplecnt_t nframes)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
@@ -498,7 +498,7 @@ Delivery::flush_buffers (framecnt_t nframes)
}
void
-Delivery::non_realtime_transport_stop (framepos_t now, bool flush)
+Delivery::non_realtime_transport_stop (samplepos_t now, bool flush)
{
Processor::non_realtime_transport_stop (now, flush);
diff --git a/libs/ardour/disk_io.cc b/libs/ardour/disk_io.cc
index 58e8790942..60e7ea56bb 100644
--- a/libs/ardour/disk_io.cc
+++ b/libs/ardour/disk_io.cc
@@ -59,9 +59,9 @@ DiskIOProcessor::DiskIOProcessor (Session& s, string const & str, Flag f)
, speed_buffer_size (0)
, _need_butler (false)
, channels (new ChannelList)
- , _midi_buf (new MidiRingBuffer<framepos_t> (s.butler()->midi_diskstream_buffer_size()))
- , _frames_written_to_ringbuffer (0)
- , _frames_read_from_ringbuffer (0)
+ , _midi_buf (new MidiRingBuffer<samplepos_t> (s.butler()->midi_diskstream_buffer_size()))
+ , _samples_written_to_ringbuffer (0)
+ , _samples_read_from_ringbuffer (0)
{
midi_interpolation.add_channel_to (0,0);
set_display_to_user (false);
@@ -76,17 +76,17 @@ DiskIOProcessor::init ()
void
DiskIOProcessor::set_buffering_parameters (BufferingPreset bp)
{
- framecnt_t read_chunk_size;
- framecnt_t read_buffer_size;
- framecnt_t write_chunk_size;
- framecnt_t write_buffer_size;
+ samplecnt_t read_chunk_size;
+ samplecnt_t read_buffer_size;
+ samplecnt_t write_chunk_size;
+ samplecnt_t write_buffer_size;
if (!get_buffering_presets (bp, read_chunk_size, read_buffer_size, write_chunk_size, write_buffer_size)) {
return;
}
- DiskReader::set_chunk_frames (read_chunk_size);
- DiskWriter::set_chunk_frames (write_chunk_size);
+ DiskReader::set_chunk_samples (read_chunk_size);
+ DiskWriter::set_chunk_samples (write_chunk_size);
Config->set_audio_capture_buffer_seconds (write_buffer_size);
Config->set_audio_playback_buffer_seconds (read_buffer_size);
@@ -94,10 +94,10 @@ DiskIOProcessor::set_buffering_parameters (BufferingPreset bp)
bool
DiskIOProcessor::get_buffering_presets (BufferingPreset bp,
- framecnt_t& read_chunk_size,
- framecnt_t& read_buffer_size,
- framecnt_t& write_chunk_size,
- framecnt_t& write_buffer_size)
+ samplecnt_t& read_chunk_size,
+ samplecnt_t& read_buffer_size,
+ samplecnt_t& write_chunk_size,
+ samplecnt_t& write_buffer_size)
{
switch (bp) {
case Small:
@@ -168,13 +168,13 @@ DiskIOProcessor::configure_io (ChanCount in, ChanCount out)
if (in.n_midi() > 0 && !_midi_buf) {
const size_t size = _session.butler()->midi_diskstream_buffer_size();
- _midi_buf = new MidiRingBuffer<framepos_t>(size);
+ _midi_buf = new MidiRingBuffer<samplepos_t>(size);
midi_interpolation.add_channel_to (0,0);
changed = true;
}
if (changed) {
- seek (_session.transport_frame());
+ seek (_session.transport_sample());
}
return Processor::configure_io (in, out);
@@ -203,7 +203,7 @@ DiskIOProcessor::set_loop (Location *location)
}
void
-DiskIOProcessor::non_realtime_locate (framepos_t location)
+DiskIOProcessor::non_realtime_locate (samplepos_t location)
{
/* now refill channel buffers */
@@ -218,7 +218,7 @@ DiskIOProcessor::non_realtime_speed_change ()
}
if (_seek_required) {
- seek (_session.transport_frame(), true);
+ seek (_session.transport_sample(), true);
_seek_required = false;
}
}
@@ -226,7 +226,7 @@ DiskIOProcessor::non_realtime_speed_change ()
bool
DiskIOProcessor::realtime_speed_change ()
{
- const framecnt_t required_wrap_size = (framecnt_t) ceil (_session.get_block_size() * fabs (_session.transport_speed())) + 2;
+ const samplecnt_t required_wrap_size = (samplecnt_t) ceil (_session.get_block_size() * fabs (_session.transport_speed())) + 2;
bool _buffer_reallocation_required;
if (required_wrap_size > wrap_buffer_size) {
@@ -367,7 +367,7 @@ DiskIOProcessor::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist
return 0;
}
-DiskIOProcessor::ChannelInfo::ChannelInfo (framecnt_t bufsize)
+DiskIOProcessor::ChannelInfo::ChannelInfo (samplecnt_t bufsize)
{
buf = new RingBufferNPT<Sample> (bufsize);
@@ -382,7 +382,7 @@ DiskIOProcessor::ChannelInfo::ChannelInfo (framecnt_t bufsize)
}
void
-DiskIOProcessor::ChannelInfo::resize (framecnt_t bufsize)
+DiskIOProcessor::ChannelInfo::resize (samplecnt_t bufsize)
{
delete buf;
buf = new RingBufferNPT<Sample> (bufsize);
@@ -423,9 +423,9 @@ DiskIOProcessor::set_route (boost::shared_ptr<Route> r)
*/
void
DiskIOProcessor::get_location_times(const Location* location,
- framepos_t* start,
- framepos_t* end,
- framepos_t* length)
+ samplepos_t* start,
+ samplepos_t* end,
+ samplepos_t* length)
{
if (location) {
*start = location->start();
diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc
index b15e107102..6f559b6167 100644
--- a/libs/ardour/disk_reader.cc
+++ b/libs/ardour/disk_reader.cc
@@ -40,24 +40,24 @@ using namespace ARDOUR;
using namespace PBD;
using namespace std;
-ARDOUR::framecnt_t DiskReader::_chunk_frames = default_chunk_frames ();
+ARDOUR::samplecnt_t DiskReader::_chunk_samples = default_chunk_samples ();
PBD::Signal0<void> DiskReader::Underrun;
Sample* DiskReader::_mixdown_buffer = 0;
gain_t* DiskReader::_gain_buffer = 0;
-framecnt_t DiskReader::midi_readahead = 4096;
+samplecnt_t DiskReader::midi_readahead = 4096;
bool DiskReader::_no_disk_output = false;
DiskReader::DiskReader (Session& s, string const & str, DiskIOProcessor::Flag f)
: DiskIOProcessor (s, str, f)
, _roll_delay (0)
- , overwrite_frame (0)
+ , overwrite_sample (0)
, overwrite_offset (0)
, _pending_overwrite (false)
, overwrite_queued (false)
, _gui_feed_buffer (AudioEngine::instance()->raw_buffer_size (DataType::MIDI))
{
- file_frame[DataType::AUDIO] = 0;
- file_frame[DataType::MIDI] = 0;
+ file_sample[DataType::AUDIO] = 0;
+ file_sample[DataType::MIDI] = 0;
}
DiskReader::~DiskReader ()
@@ -107,8 +107,8 @@ DiskReader::free_working_buffers()
_gain_buffer = 0;
}
-framecnt_t
-DiskReader::default_chunk_frames()
+samplecnt_t
+DiskReader::default_chunk_samples()
{
return 65536;
}
@@ -127,7 +127,7 @@ DiskReader::set_name (string const & str)
}
void
-DiskReader::set_roll_delay (ARDOUR::framecnt_t nframes)
+DiskReader::set_roll_delay (ARDOUR::samplecnt_t nframes)
{
_roll_delay = nframes;
}
@@ -237,13 +237,13 @@ DiskReader::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist)
}
void
-DiskReader::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
+DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample,
double speed, pframes_t nframes, bool result_required)
{
uint32_t n;
boost::shared_ptr<ChannelList> c = channels.reader();
ChannelList::iterator chan;
- frameoffset_t disk_samples_to_consume;
+ sampleoffset_t disk_samples_to_consume;
MonitorState ms = _route->monitoring_state ();
if (_active) {
@@ -327,7 +327,7 @@ DiskReader::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
chaninfo->buf->get_read_vector (&(*chan)->rw_vector);
- if (disk_samples_to_consume <= (framecnt_t) chaninfo->rw_vector.len[0]) {
+ if (disk_samples_to_consume <= (samplecnt_t) chaninfo->rw_vector.len[0]) {
if (fabsf (speed) != 1.0f) {
(void) interpolation.interpolate (
@@ -340,7 +340,7 @@ DiskReader::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
} else {
- const framecnt_t total = chaninfo->rw_vector.len[0] + chaninfo->rw_vector.len[1];
+ const samplecnt_t total = chaninfo->rw_vector.len[0] + chaninfo->rw_vector.len[1];
if (disk_samples_to_consume <= total) {
@@ -424,9 +424,9 @@ DiskReader::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
butler_required = true;
}
} else {
- if ((framecnt_t) c->front()->buf->write_space() >= _chunk_frames) {
+ if ((samplecnt_t) c->front()->buf->write_space() >= _chunk_samples) {
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: write space = %2 of %3\n", name(), c->front()->buf->write_space(),
- _chunk_frames));
+ _chunk_samples));
butler_required = true;
}
}
@@ -436,16 +436,16 @@ DiskReader::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
if (_playlists[DataType::MIDI]) {
/* MIDI butler needed part */
- uint32_t frames_read = g_atomic_int_get(const_cast<gint*>(&_frames_read_from_ringbuffer));
- uint32_t frames_written = g_atomic_int_get(const_cast<gint*>(&_frames_written_to_ringbuffer));
+ uint32_t samples_read = g_atomic_int_get(const_cast<gint*>(&_samples_read_from_ringbuffer));
+ uint32_t samples_written = g_atomic_int_get(const_cast<gint*>(&_samples_written_to_ringbuffer));
/*
- cerr << name() << " MDS written: " << frames_written << " - read: " << frames_read <<
- " = " << frames_written - frames_read
+ cerr << name() << " MDS written: " << samples_written << " - read: " << samples_read <<
+ " = " << samples_written - samples_read
<< " + " << disk_samples_to_consume << " < " << midi_readahead << " = " << need_butler << ")" << endl;
*/
- /* frames_read will generally be less than frames_written, but
+ /* samples_read will generally be less than samples_written, but
* immediately after an overwrite, we can end up having read some data
* before we've written any. we don't need to trip an assert() on this,
* but we do need to check so that the decision on whether or not we
@@ -456,13 +456,13 @@ DiskReader::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
*
* Doing heavy GUI operations[1] can stall also the butler.
* The RT-thread meanwhile will happily continue and
- * ‘frames_read’ (from buffer to output) will become larger
- * than ‘frames_written’ (from disk to buffer).
+ * ‘samples_read’ (from buffer to output) will become larger
+ * than ‘samples_written’ (from disk to buffer).
*
* The disk-stream is now behind..
*
* In those cases the butler needs to be summed to refill the buffer (done now)
- * AND we need to skip (frames_read - frames_written). ie remove old events
+ * AND we need to skip (samples_read - samples_written). ie remove old events
* before playback_sample from the rinbuffer.
*
* [1] one way to do so is described at #6170.
@@ -473,8 +473,8 @@ DiskReader::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
* In both cases the root cause is that redrawing MIDI regions on the GUI is still very slow
* and can stall
*/
- if (frames_read <= frames_written) {
- if ((frames_written - frames_read) + disk_samples_to_consume < midi_readahead) {
+ if (samples_read <= samples_written) {
+ if ((samples_written - samples_read) + disk_samples_to_consume < midi_readahead) {
butler_required = true;
}
} else {
@@ -496,7 +496,7 @@ DiskReader::set_pending_overwrite (bool yn)
_pending_overwrite = yn;
- overwrite_frame = playback_sample;
+ overwrite_sample = playback_sample;
boost::shared_ptr<ChannelList> c = channels.reader ();
if (!c->empty ()) {
@@ -513,7 +513,7 @@ DiskReader::overwrite_existing_buffers ()
overwrite_queued = false;
- DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1 overwriting existing buffers at %2\n", overwrite_frame));
+ DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1 overwriting existing buffers at %2\n", overwrite_sample));
if (!c->empty ()) {
@@ -522,7 +522,7 @@ DiskReader::overwrite_existing_buffers ()
const bool reversed = _session.transport_speed() < 0.0f;
/* assume all are the same size */
- framecnt_t size = c->front()->buf->bufsize();
+ samplecnt_t size = c->front()->buf->bufsize();
std::auto_ptr<Sample> mixdown_buffer (new Sample[size]);
std::auto_ptr<float> gain_buffer (new float[size]);
@@ -533,12 +533,12 @@ DiskReader::overwrite_existing_buffers ()
size--;
uint32_t n=0;
- framepos_t start;
+ samplepos_t start;
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan, ++n) {
- start = overwrite_frame;
- framecnt_t cnt = size;
+ start = overwrite_sample;
+ samplecnt_t cnt = size;
/* to fill the buffer without resetting the playback sample, we need to
do it one or two chunks (normally two).
@@ -551,10 +551,10 @@ DiskReader::overwrite_existing_buffers ()
*/
- framecnt_t to_read = size - overwrite_offset;
+ samplecnt_t to_read = size - overwrite_offset;
if (audio_read ((*chan)->buf->buffer() + overwrite_offset, mixdown_buffer.get(), gain_buffer.get(), start, to_read, n, reversed)) {
- error << string_compose(_("DiskReader %1: when refilling, cannot read %2 from playlist at frame %3"),
+ error << string_compose(_("DiskReader %1: when refilling, cannot read %2 from playlist at sample %3"),
id(), size, playback_sample) << endmsg;
goto midi;
}
@@ -564,7 +564,7 @@ DiskReader::overwrite_existing_buffers ()
cnt -= to_read;
if (audio_read ((*chan)->buf->buffer(), mixdown_buffer.get(), gain_buffer.get(), start, cnt, n, reversed)) {
- error << string_compose(_("DiskReader %1: when refilling, cannot read %2 from playlist at frame %3"),
+ error << string_compose(_("DiskReader %1: when refilling, cannot read %2 from playlist at sample %3"),
id(), size, playback_sample) << endmsg;
goto midi;
}
@@ -585,18 +585,18 @@ DiskReader::overwrite_existing_buffers ()
_midi_buf->reset ();
_midi_buf->reset_tracker ();
- g_atomic_int_set (&_frames_read_from_ringbuffer, 0);
- g_atomic_int_set (&_frames_written_to_ringbuffer, 0);
+ g_atomic_int_set (&_samples_read_from_ringbuffer, 0);
+ g_atomic_int_set (&_samples_written_to_ringbuffer, 0);
/* Resolve all currently active notes in the playlist. This is more
aggressive than it needs to be: ideally we would only resolve what is
absolutely necessary, but this seems difficult and/or impossible without
having the old data or knowing what change caused the overwrite.
*/
- midi_playlist()->resolve_note_trackers (*_midi_buf, overwrite_frame);
+ midi_playlist()->resolve_note_trackers (*_midi_buf, overwrite_sample);
- midi_read (overwrite_frame, _chunk_frames, false);
- file_frame[DataType::MIDI] = overwrite_frame; // overwrite_frame was adjusted by ::midi_read() to the new position
+ midi_read (overwrite_sample, _chunk_samples, false);
+ file_sample[DataType::MIDI] = overwrite_sample; // overwrite_sample was adjusted by ::midi_read() to the new position
}
_pending_overwrite = false;
@@ -605,7 +605,7 @@ DiskReader::overwrite_existing_buffers ()
}
int
-DiskReader::seek (framepos_t frame, bool complete_refill)
+DiskReader::seek (samplepos_t sample, bool complete_refill)
{
uint32_t n;
int ret = -1;
@@ -616,7 +616,7 @@ DiskReader::seek (framepos_t frame, bool complete_refill)
(*chan)->buf->reset ();
}
- if (g_atomic_int_get (&_frames_read_from_ringbuffer) == 0) {
+ if (g_atomic_int_get (&_samples_read_from_ringbuffer) == 0) {
/* we haven't read anything since the last seek,
so flush all note trackers to prevent
wierdness
@@ -625,12 +625,12 @@ DiskReader::seek (framepos_t frame, bool complete_refill)
}
_midi_buf->reset();
- g_atomic_int_set(&_frames_read_from_ringbuffer, 0);
- g_atomic_int_set(&_frames_written_to_ringbuffer, 0);
+ g_atomic_int_set(&_samples_read_from_ringbuffer, 0);
+ g_atomic_int_set(&_samples_written_to_ringbuffer, 0);
- playback_sample = frame;
- file_frame[DataType::AUDIO] = frame;
- file_frame[DataType::MIDI] = frame;
+ playback_sample = sample;
+ file_sample[DataType::AUDIO] = sample;
+ file_sample[DataType::MIDI] = sample;
if (complete_refill) {
/* call _do_refill() to refill the entire buffer, using
@@ -649,7 +649,7 @@ DiskReader::seek (framepos_t frame, bool complete_refill)
}
int
-DiskReader::can_internal_playback_seek (framecnt_t distance)
+DiskReader::can_internal_playback_seek (samplecnt_t distance)
{
/* 1. Audio */
@@ -664,14 +664,14 @@ DiskReader::can_internal_playback_seek (framecnt_t distance)
/* 2. MIDI */
- uint32_t frames_read = g_atomic_int_get(&_frames_read_from_ringbuffer);
- uint32_t frames_written = g_atomic_int_get(&_frames_written_to_ringbuffer);
+ uint32_t samples_read = g_atomic_int_get(&_samples_read_from_ringbuffer);
+ uint32_t samples_written = g_atomic_int_get(&_samples_written_to_ringbuffer);
- return ((frames_written - frames_read) < distance);
+ return ((samples_written - samples_read) < distance);
}
int
-DiskReader::internal_playback_seek (framecnt_t distance)
+DiskReader::internal_playback_seek (samplecnt_t distance)
{
ChannelList::iterator chan;
boost::shared_ptr<ChannelList> c = channels.reader();
@@ -697,21 +697,21 @@ void swap_by_ptr (Sample *first, Sample *last)
/** Read some data for 1 channel from our playlist into a buffer.
* @param buf Buffer to write to.
- * @param start Session frame to start reading from; updated to where we end up
+ * @param start Session sample to start reading from; updated to where we end up
* after the read.
* @param cnt Count of samples to read.
* @param reversed true if we are running backwards, otherwise false.
*/
int
DiskReader::audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
- framepos_t& start, framecnt_t cnt,
+ samplepos_t& start, samplecnt_t cnt,
int channel, bool reversed)
{
- framecnt_t this_read = 0;
+ samplecnt_t this_read = 0;
bool reloop = false;
- framepos_t loop_end = 0;
- framepos_t loop_start = 0;
- framecnt_t offset = 0;
+ samplepos_t loop_end = 0;
+ samplepos_t loop_start = 0;
+ samplecnt_t offset = 0;
Location *loc = 0;
if (!_playlists[DataType::AUDIO]) {
@@ -723,7 +723,7 @@ DiskReader::audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
if (!reversed) {
- framecnt_t loop_length = 0;
+ samplecnt_t loop_length = 0;
/* Make the use of a Location atomic for this read operation.
@@ -739,7 +739,7 @@ DiskReader::audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
loop_length = loop_end - loop_start;
}
- /* if we are looping, ensure that the first frame we read is at the correct
+ /* if we are looping, ensure that the first sample we read is at the correct
position within the loop.
*/
@@ -776,7 +776,7 @@ DiskReader::audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
this_read = min(cnt,this_read);
if (audio_playlist()->read (buf+offset, mixdown_buffer, gain_buffer, start, this_read, channel) != this_read) {
- error << string_compose(_("DiskReader %1: cannot read %2 from playlist at frame %3"), id(), this_read,
+ error << string_compose(_("DiskReader %1: cannot read %2 from playlist at sample %3"), id(), this_read,
start) << endmsg;
return -1;
}
@@ -816,7 +816,7 @@ DiskReader::_do_refill_with_alloc (bool partial_fill)
std::auto_ptr<Sample> mix_buf (new Sample[2*1048576]);
std::auto_ptr<float> gain_buf (new float[2*1048576]);
- int ret = refill_audio (mix_buf.get(), gain_buf.get(), (partial_fill ? _chunk_frames : 0));
+ int ret = refill_audio (mix_buf.get(), gain_buf.get(), (partial_fill ? _chunk_samples : 0));
if (ret) {
return ret;
@@ -827,7 +827,7 @@ DiskReader::_do_refill_with_alloc (bool partial_fill)
}
int
-DiskReader::refill (Sample* mixdown_buffer, float* gain_buffer, framecnt_t fill_level)
+DiskReader::refill (Sample* mixdown_buffer, float* gain_buffer, samplecnt_t fill_level)
{
int ret = refill_audio (mixdown_buffer, gain_buffer, fill_level);
@@ -849,7 +849,7 @@ DiskReader::refill (Sample* mixdown_buffer, float* gain_buffer, framecnt_t fill_
*/
int
-DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t fill_level)
+DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, samplecnt_t fill_level)
{
/* do not read from disk while session is marked as Loading, to avoid
useless redundant I/O.
@@ -860,15 +860,15 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
}
int32_t ret = 0;
- framecnt_t to_read;
+ samplecnt_t to_read;
RingBufferNPT<Sample>::rw_vector vector;
bool const reversed = _session.transport_speed() < 0.0f;
- framecnt_t total_space;
- framecnt_t zero_fill;
+ samplecnt_t total_space;
+ samplecnt_t zero_fill;
uint32_t chan_n;
ChannelList::iterator i;
boost::shared_ptr<ChannelList> c = channels.reader();
- framecnt_t ts;
+ samplecnt_t ts;
if (c->empty()) {
return 0;
@@ -900,18 +900,18 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
}
/* if we're running close to normal speed and there isn't enough
- space to do disk_read_chunk_frames of I/O, then don't bother.
+ space to do disk_read_chunk_samples of I/O, then don't bother.
at higher speeds, just do it because the sync between butler
and audio thread may not be good enough.
- Note: it is a design assumption that disk_read_chunk_frames is smaller
+ Note: it is a design assumption that disk_read_chunk_samples is smaller
than the playback buffer size, so this check should never trip when
the playback buffer is empty.
*/
- DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: space to refill %2 vs. chunk %3 (speed = %4)\n", name(), total_space, _chunk_frames, _session.transport_speed()));
- if ((total_space < _chunk_frames) && fabs (_session.transport_speed()) < 2.0f) {
+ DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: space to refill %2 vs. chunk %3 (speed = %4)\n", name(), total_space, _chunk_samples, _session.transport_speed()));
+ if ((total_space < _chunk_samples) && fabs (_session.transport_speed()) < 2.0f) {
return 0;
}
@@ -920,12 +920,12 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
work with.
*/
- if (_slaved && total_space < (framecnt_t) (c->front()->buf->bufsize() / 2)) {
+ if (_slaved && total_space < (samplecnt_t) (c->front()->buf->bufsize() / 2)) {
DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: not enough to refill while slaved\n", this));
return 0;
}
- framepos_t ffa = file_frame[DataType::AUDIO];
+ samplepos_t ffa = file_sample[DataType::AUDIO];
if (reversed) {
@@ -962,7 +962,7 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
} else {
- if (ffa == max_framepos) {
+ if (ffa == max_samplepos) {
/* at end: nothing to do but fill with silence */
@@ -979,19 +979,19 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
return 0;
}
- if (ffa > max_framepos - total_space) {
+ if (ffa > max_samplepos - total_space) {
/* to close to the end: read what we can, and zero fill the rest */
- zero_fill = total_space - (max_framepos - ffa);
- total_space = max_framepos - ffa;
+ zero_fill = total_space - (max_samplepos - ffa);
+ total_space = max_samplepos - ffa;
} else {
zero_fill = 0;
}
}
- framepos_t file_frame_tmp = 0;
+ samplepos_t file_sample_tmp = 0;
/* total_space is in samples. We want to optimize read sizes in various sizes using bytes */
@@ -1008,7 +1008,7 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
/* now back to samples */
- framecnt_t samples_to_read = byte_size_for_read / (bits_per_sample / 8);
+ samplecnt_t samples_to_read = byte_size_for_read / (bits_per_sample / 8);
DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: will refill %2 channels with %3 samples\n", name(), c->size(), total_space));
@@ -1020,18 +1020,18 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
ChannelInfo* chan (*i);
Sample* buf1;
Sample* buf2;
- framecnt_t len1, len2;
+ samplecnt_t len1, len2;
chan->buf->get_write_vector (&vector);
- if ((framecnt_t) vector.len[0] > samples_to_read) {
+ if ((samplecnt_t) vector.len[0] > samples_to_read) {
/* we're not going to fill the first chunk, so certainly do not bother with the
other part. it won't be connected with the part we do fill, as in:
.... => writable space
++++ => readable space
- ^^^^ => 1 x disk_read_chunk_frames that would be filled
+ ^^^^ => 1 x disk_read_chunk_samples that would be filled
|......|+++++++++++++|...............................|
buf1 buf0
@@ -1048,7 +1048,7 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
}
ts = total_space;
- file_frame_tmp = ffa;
+ file_sample_tmp = ffa;
buf1 = vector.buf[0];
len1 = vector.len[0];
@@ -1056,13 +1056,13 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
len2 = vector.len[1];
to_read = min (ts, len1);
- to_read = min (to_read, (framecnt_t) samples_to_read);
+ to_read = min (to_read, (samplecnt_t) samples_to_read);
assert (to_read >= 0);
if (to_read) {
- if (audio_read (buf1, mixdown_buffer, gain_buffer, file_frame_tmp, to_read, chan_n, reversed)) {
+ if (audio_read (buf1, mixdown_buffer, gain_buffer, file_sample_tmp, to_read, chan_n, reversed)) {
ret = -1;
goto out;
}
@@ -1079,7 +1079,7 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
all of vector.len[1] as well.
*/
- if (audio_read (buf2, mixdown_buffer, gain_buffer, file_frame_tmp, to_read, chan_n, reversed)) {
+ if (audio_read (buf2, mixdown_buffer, gain_buffer, file_sample_tmp, to_read, chan_n, reversed)) {
ret = -1;
goto out;
}
@@ -1096,10 +1096,10 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
// elapsed = g_get_monotonic_time () - before;
// cerr << '\t' << name() << ": bandwidth = " << (byte_size_for_read / 1048576.0) / (elapsed/1000000.0) << "MB/sec\n";
- file_frame[DataType::AUDIO] = file_frame_tmp;
- assert (file_frame[DataType::AUDIO] >= 0);
+ file_sample[DataType::AUDIO] = file_sample_tmp;
+ assert (file_sample[DataType::AUDIO] >= 0);
- ret = ((total_space - samples_to_read) > _chunk_frames);
+ ret = ((total_space - samples_to_read) > _chunk_samples);
c->front()->buf->get_write_vector (&vector);
@@ -1108,7 +1108,7 @@ DiskReader::refill_audio (Sample* mixdown_buffer, float* gain_buffer, framecnt_t
}
void
-DiskReader::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const & movements_frames, bool from_undo)
+DiskReader::playlist_ranges_moved (list< Evoral::RangeMove<samplepos_t> > const & movements_samples, bool from_undo)
{
/* If we're coming from an undo, it will have handled
automation undo (it must, since automation-follows-regions
@@ -1125,8 +1125,8 @@ DiskReader::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const &
list< Evoral::RangeMove<double> > movements;
- for (list< Evoral::RangeMove<framepos_t> >::const_iterator i = movements_frames.begin();
- i != movements_frames.end();
+ for (list< Evoral::RangeMove<samplepos_t> >::const_iterator i = movements_samples.begin();
+ i != movements_samples.end();
++i) {
movements.push_back(Evoral::RangeMove<double>(i->from, i->length, i->to));
@@ -1153,11 +1153,11 @@ DiskReader::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const &
}
}
/* move processor automation */
- _route->foreach_processor (boost::bind (&DiskReader::move_processor_automation, this, _1, movements_frames));
+ _route->foreach_processor (boost::bind (&DiskReader::move_processor_automation, this, _1, movements_samples));
}
void
-DiskReader::move_processor_automation (boost::weak_ptr<Processor> p, list< Evoral::RangeMove<framepos_t> > const & movements_frames)
+DiskReader::move_processor_automation (boost::weak_ptr<Processor> p, list< Evoral::RangeMove<samplepos_t> > const & movements_samples)
{
boost::shared_ptr<Processor> processor (p.lock ());
if (!processor) {
@@ -1165,7 +1165,7 @@ DiskReader::move_processor_automation (boost::weak_ptr<Processor> p, list< Evora
}
list< Evoral::RangeMove<double> > movements;
- for (list< Evoral::RangeMove<framepos_t> >::const_iterator i = movements_frames.begin(); i != movements_frames.end(); ++i) {
+ for (list< Evoral::RangeMove<samplepos_t> >::const_iterator i = movements_samples.begin(); i != movements_samples.end(); ++i) {
movements.push_back(Evoral::RangeMove<double>(i->from, i->length, i->to));
}
@@ -1211,7 +1211,7 @@ DiskReader::reset_tracker ()
}
void
-DiskReader::resolve_tracker (Evoral::EventSink<framepos_t>& buffer, framepos_t time)
+DiskReader::resolve_tracker (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time)
{
_midi_buf->resolve_tracker(buffer, time);
@@ -1226,7 +1226,7 @@ DiskReader::resolve_tracker (Evoral::EventSink<framepos_t>& buffer, framepos_t t
* so that an event at playback_sample has time = 0
*/
void
-DiskReader::get_midi_playback (MidiBuffer& dst, framecnt_t nframes, MonitorState ms, BufferSet& scratch_bufs, double speed, framecnt_t disk_samples_to_consume)
+DiskReader::get_midi_playback (MidiBuffer& dst, samplecnt_t nframes, MonitorState ms, BufferSet& scratch_bufs, double speed, samplecnt_t disk_samples_to_consume)
{
MidiBuffer* target;
@@ -1254,9 +1254,9 @@ DiskReader::get_midi_playback (MidiBuffer& dst, framecnt_t nframes, MonitorState
size_t events_read = 0;
if (loc) {
- framepos_t effective_start;
+ samplepos_t effective_start;
- Evoral::Range<framepos_t> loop_range (loc->start(), loc->end() - 1);
+ Evoral::Range<samplepos_t> loop_range (loc->start(), loc->end() - 1);
effective_start = loop_range.squish (playback_sample);
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("looped, effective start adjusted to %1\n", effective_start));
@@ -1278,7 +1278,7 @@ DiskReader::get_midi_playback (MidiBuffer& dst, framecnt_t nframes, MonitorState
for the 2nd read
*/
- framecnt_t first, second;
+ samplecnt_t first, second;
first = loc->end() - effective_start;
second = nframes - first;
@@ -1319,7 +1319,7 @@ DiskReader::get_midi_playback (MidiBuffer& dst, framecnt_t nframes, MonitorState
_midi_buf->get_read_ptr(), _midi_buf->get_write_ptr()));
}
- g_atomic_int_add (&_frames_read_from_ringbuffer, nframes);
+ g_atomic_int_add (&_samples_read_from_ringbuffer, nframes);
/* vari-speed */
@@ -1339,23 +1339,23 @@ DiskReader::get_midi_playback (MidiBuffer& dst, framecnt_t nframes, MonitorState
//cerr << "----------------\n";
}
-/** @a start is set to the new frame position (TIME) read up to */
+/** @a start is set to the new sample position (TIME) read up to */
int
-DiskReader::midi_read (framepos_t& start, framecnt_t dur, bool reversed)
+DiskReader::midi_read (samplepos_t& start, samplecnt_t dur, bool reversed)
{
- framecnt_t this_read = 0;
- framepos_t loop_end = 0;
- framepos_t loop_start = 0;
- framecnt_t loop_length = 0;
+ samplecnt_t this_read = 0;
+ samplepos_t loop_end = 0;
+ samplepos_t loop_start = 0;
+ samplecnt_t loop_length = 0;
Location* loc = loop_location;
- framepos_t effective_start = start;
- Evoral::Range<framepos_t>* loop_range (0);
+ samplepos_t effective_start = start;
+ Evoral::Range<samplepos_t>* loop_range (0);
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("MDS::midi_read @ %1 cnt %2\n", start, dur));
boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack>(_route);
MidiChannelFilter* filter = mt ? &mt->playback_filter() : 0;
- frameoffset_t loop_offset = 0;
+ sampleoffset_t loop_offset = 0;
if (!reversed && loc) {
get_location_times (loc, &loop_start, &loop_end, &loop_length);
@@ -1368,10 +1368,10 @@ DiskReader::midi_read (framepos_t& start, framecnt_t dur, bool reversed)
if (loc && !reversed) {
if (!loop_range) {
- loop_range = new Evoral::Range<framepos_t> (loop_start, loop_end-1); // inclusive semantics require -1
+ loop_range = new Evoral::Range<samplepos_t> (loop_start, loop_end-1); // inclusive semantics require -1
}
- /* if we are (seamlessly) looping, ensure that the first frame we read is at the correct
+ /* if we are (seamlessly) looping, ensure that the first sample we read is at the correct
position within the loop.
*/
@@ -1400,12 +1400,12 @@ DiskReader::midi_read (framepos_t& start, framecnt_t dur, bool reversed)
if (midi_playlist()->read (*_midi_buf, effective_start, this_read, loop_range, 0, filter) != this_read) {
error << string_compose(
- _("MidiDiskstream %1: cannot read %2 from playlist at frame %3"),
+ _("MidiDiskstream %1: cannot read %2 from playlist at sample %3"),
id(), this_read, start) << endmsg;
return -1;
}
- g_atomic_int_add (&_frames_written_to_ringbuffer, this_read);
+ g_atomic_int_add (&_samples_written_to_ringbuffer, this_read);
if (reversed) {
@@ -1443,7 +1443,7 @@ DiskReader::refill_midi ()
const size_t write_space = _midi_buf->write_space();
const bool reversed = _session.transport_speed() < 0.0f;
- DEBUG_TRACE (DEBUG::DiskIO, string_compose ("MIDI refill, write space = %1 file frame = %2\n", write_space, file_frame[DataType::MIDI]));
+ DEBUG_TRACE (DEBUG::DiskIO, string_compose ("MIDI refill, write space = %1 file sample = %2\n", write_space, file_sample[DataType::MIDI]));
/* no space to write */
if (write_space == 0) {
@@ -1456,30 +1456,30 @@ DiskReader::refill_midi ()
/* at end: nothing to do */
- framepos_t ffm = file_frame[DataType::MIDI];
+ samplepos_t ffm = file_sample[DataType::MIDI];
- if (ffm == max_framepos) {
+ if (ffm == max_samplepos) {
return 0;
}
int ret = 0;
- const uint32_t frames_read = g_atomic_int_get (&_frames_read_from_ringbuffer);
- const uint32_t frames_written = g_atomic_int_get (&_frames_written_to_ringbuffer);
+ const uint32_t samples_read = g_atomic_int_get (&_samples_read_from_ringbuffer);
+ const uint32_t samples_written = g_atomic_int_get (&_samples_written_to_ringbuffer);
- if ((frames_read < frames_written) && (frames_written - frames_read) >= midi_readahead) {
+ if ((samples_read < samples_written) && (samples_written - samples_read) >= midi_readahead) {
return 0;
}
- framecnt_t to_read = midi_readahead - ((framecnt_t)frames_written - (framecnt_t)frames_read);
+ samplecnt_t to_read = midi_readahead - ((samplecnt_t)samples_written - (samplecnt_t)samples_read);
- to_read = min (to_read, (framecnt_t) (max_framepos - ffm));
- to_read = min (to_read, (framecnt_t) write_space);
+ to_read = min (to_read, (samplecnt_t) (max_samplepos - ffm));
+ to_read = min (to_read, (samplecnt_t) write_space);
if (midi_read (ffm, to_read, reversed)) {
ret = -1;
}
- file_frame[DataType::MIDI] = ffm;
+ file_sample[DataType::MIDI] = ffm;
return ret;
}
diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc
index a3dc3335d0..429eb1e7c9 100644
--- a/libs/ardour/disk_writer.cc
+++ b/libs/ardour/disk_writer.cc
@@ -40,20 +40,20 @@ using namespace ARDOUR;
using namespace PBD;
using namespace std;
-ARDOUR::framecnt_t DiskWriter::_chunk_frames = DiskWriter::default_chunk_frames ();
+ARDOUR::samplecnt_t DiskWriter::_chunk_samples = DiskWriter::default_chunk_samples ();
PBD::Signal0<void> DiskWriter::Overrun;
DiskWriter::DiskWriter (Session& s, string const & str, DiskIOProcessor::Flag f)
: DiskIOProcessor (s, str, f)
, _record_enabled (0)
, _record_safe (0)
- , capture_start_frame (0)
+ , capture_start_sample (0)
, capture_captured (0)
, was_recording (false)
, adjust_capture_position (0)
, _capture_offset (0)
- , first_recordable_frame (max_framepos)
- , last_recordable_frame (max_framepos)
+ , first_recordable_sample (max_samplepos)
+ , last_recordable_sample (max_samplepos)
, last_possibly_recording (0)
, _alignment_style (ExistingMaterial)
, _alignment_choice (Automatic)
@@ -75,8 +75,8 @@ DiskWriter::~DiskWriter ()
}
}
-framecnt_t
-DiskWriter::default_chunk_frames ()
+samplecnt_t
+DiskWriter::default_chunk_samples ()
{
return 65536;
}
@@ -89,7 +89,7 @@ DiskWriter::set_write_source_name (string const & str)
}
void
-DiskWriter::check_record_status (framepos_t transport_frame, bool can_record)
+DiskWriter::check_record_status (samplepos_t transport_sample, bool can_record)
{
int possibly_recording;
int rolling;
@@ -111,7 +111,7 @@ DiskWriter::check_record_status (framepos_t transport_frame, bool can_record)
return;
}
- const framecnt_t existing_material_offset = _session.worst_playback_latency();
+ const samplecnt_t existing_material_offset = _session.worst_playback_latency();
if (possibly_recording == fully_rec_enabled) {
@@ -119,27 +119,27 @@ DiskWriter::check_record_status (framepos_t transport_frame, bool can_record)
return;
}
- capture_start_frame = _session.transport_frame();
- first_recordable_frame = capture_start_frame + _capture_offset;
- last_recordable_frame = max_framepos;
+ capture_start_sample = _session.transport_sample();
+ first_recordable_sample = capture_start_sample + _capture_offset;
+ last_recordable_sample = max_samplepos;
DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1: @ %7 (%9) FRF = %2 CSF = %4 CO = %5, EMO = %6 RD = %8 WOL %10 WTL %11\n",
- name(), first_recordable_frame, last_recordable_frame, capture_start_frame,
+ name(), first_recordable_sample, last_recordable_sample, capture_start_sample,
_capture_offset,
existing_material_offset,
- transport_frame,
- _session.transport_frame(),
+ transport_sample,
+ _session.transport_sample(),
_session.worst_output_latency(),
_session.worst_track_latency()));
if (_alignment_style == ExistingMaterial) {
- first_recordable_frame += existing_material_offset;
+ first_recordable_sample += existing_material_offset;
DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("\tshift FRF by EMO %1\n",
- first_recordable_frame));
+ first_recordable_sample));
}
- prepare_record_status (capture_start_frame);
+ prepare_record_status (capture_start_sample);
} else {
@@ -149,7 +149,7 @@ DiskWriter::check_record_status (framepos_t transport_frame, bool can_record)
if (change & transport_rolling) {
- /* transport-change (stopped rolling): last_recordable_frame was set in ::prepare_to_stop(). We
+ /* transport-change (stopped rolling): last_recordable_sample was set in ::prepare_to_stop(). We
* had to set it there because we likely rolled past the stopping point to declick out,
* and then backed up.
*/
@@ -157,10 +157,10 @@ DiskWriter::check_record_status (framepos_t transport_frame, bool can_record)
} else {
/* punch out */
- last_recordable_frame = _session.transport_frame() + _capture_offset;
+ last_recordable_sample = _session.transport_sample() + _capture_offset;
if (_alignment_style == ExistingMaterial) {
- last_recordable_frame += existing_material_offset;
+ last_recordable_sample += existing_material_offset;
}
}
}
@@ -170,8 +170,8 @@ DiskWriter::check_record_status (framepos_t transport_frame, bool can_record)
}
void
-DiskWriter::calculate_record_range (Evoral::OverlapType ot, framepos_t transport_frame, framecnt_t nframes,
- framecnt_t & rec_nframes, framecnt_t & rec_offset)
+DiskWriter::calculate_record_range (Evoral::OverlapType ot, samplepos_t transport_sample, samplecnt_t nframes,
+ samplecnt_t & rec_nframes, samplecnt_t & rec_offset)
{
switch (ot) {
case Evoral::OverlapNone:
@@ -190,9 +190,9 @@ DiskWriter::calculate_record_range (Evoral::OverlapType ot, framepos_t transport
/* |--------| recrange
* -----| transrange
*/
- rec_nframes = transport_frame + nframes - first_recordable_frame;
+ rec_nframes = transport_sample + nframes - first_recordable_sample;
if (rec_nframes) {
- rec_offset = first_recordable_frame - transport_frame;
+ rec_offset = first_recordable_sample - transport_sample;
}
break;
@@ -200,7 +200,7 @@ DiskWriter::calculate_record_range (Evoral::OverlapType ot, framepos_t transport
/* |--------| recrange
* |-------- transrange
*/
- rec_nframes = last_recordable_frame - transport_frame;
+ rec_nframes = last_recordable_sample - transport_sample;
rec_offset = 0;
break;
@@ -208,34 +208,34 @@ DiskWriter::calculate_record_range (Evoral::OverlapType ot, framepos_t transport
/* |--------| recrange
* -------------- transrange
*/
- rec_nframes = last_recordable_frame - first_recordable_frame;
- rec_offset = first_recordable_frame - transport_frame;
+ rec_nframes = last_recordable_sample - first_recordable_sample;
+ rec_offset = first_recordable_sample - transport_sample;
break;
}
DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1 rec? %2 @ %3 (for %4) FRF %5 LRF %6 : rf %7 @ %8\n",
- _name, enum_2_string (ot), transport_frame, nframes,
- first_recordable_frame, last_recordable_frame, rec_nframes, rec_offset));
+ _name, enum_2_string (ot), transport_sample, nframes,
+ first_recordable_sample, last_recordable_sample, rec_nframes, rec_offset));
}
void
-DiskWriter::prepare_to_stop (framepos_t transport_frame, framepos_t audible_frame)
+DiskWriter::prepare_to_stop (samplepos_t transport_sample, samplepos_t audible_sample)
{
switch (_alignment_style) {
case ExistingMaterial:
- last_recordable_frame = transport_frame + _capture_offset;
- DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose("%1: prepare to stop sets last recordable frame to %2 + %3 = %4\n", _name, transport_frame, _capture_offset, last_recordable_frame));
+ last_recordable_sample = transport_sample + _capture_offset;
+ DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose("%1: prepare to stop sets last recordable sample to %2 + %3 = %4\n", _name, transport_sample, _capture_offset, last_recordable_sample));
break;
case CaptureTime:
- last_recordable_frame = audible_frame; // note that capture_offset is zero
- /* we may already have captured audio before the last_recordable_frame (audible frame),
+ last_recordable_sample = audible_sample; // note that capture_offset is zero
+ /* we may already have captured audio before the last_recordable_sample (audible sample),
so deal with this.
*/
- if (last_recordable_frame > capture_start_frame) {
- capture_captured = min (capture_captured, last_recordable_frame - capture_start_frame);
+ if (last_recordable_sample > capture_start_sample) {
+ capture_captured = min (capture_captured, last_recordable_sample - capture_start_sample);
}
- DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose("%1: prepare to stop sets last recordable frame to audible frame @ %2\n", _name, audible_frame));
+ DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose("%1: prepare to stop sets last recordable sample to audible sample @ %2\n", _name, audible_sample));
break;
}
@@ -265,9 +265,9 @@ DiskWriter::disengage_record_safe ()
g_atomic_int_set (&_record_safe, 0);
}
-/** Get the start position (in session frames) of the nth capture in the current pass */
-ARDOUR::framepos_t
-DiskWriter::get_capture_start_frame (uint32_t n) const
+/** Get the start position (in session samples) of the nth capture in the current pass */
+ARDOUR::samplepos_t
+DiskWriter::get_capture_start_sample (uint32_t n) const
{
Glib::Threads::Mutex::Lock lm (capture_info_lock);
@@ -276,18 +276,18 @@ DiskWriter::get_capture_start_frame (uint32_t n) const
return capture_info[n]->start;
} else {
/* this is the currently in-progress capture */
- return capture_start_frame;
+ return capture_start_sample;
}
}
-ARDOUR::framecnt_t
-DiskWriter::get_captured_frames (uint32_t n) const
+ARDOUR::samplecnt_t
+DiskWriter::get_captured_samples (uint32_t n) const
{
Glib::Threads::Mutex::Lock lm (capture_info_lock);
if (capture_info.size() > n) {
/* this is a completed capture */
- return capture_info[n]->frames;
+ return capture_info[n]->samples;
} else {
/* this is the currently in-progress capture */
return capture_captured;
@@ -295,7 +295,7 @@ DiskWriter::get_captured_frames (uint32_t n) const
}
void
-DiskWriter::set_input_latency (framecnt_t l)
+DiskWriter::set_input_latency (samplecnt_t l)
{
Processor::set_input_latency (l);
set_capture_offset ();
@@ -392,7 +392,7 @@ DiskWriter::set_state (const XMLNode& node, int version)
}
void
-DiskWriter::non_realtime_locate (framepos_t position)
+DiskWriter::non_realtime_locate (samplepos_t position)
{
if (_midi_write_source) {
_midi_write_source->set_timeline_position (position);
@@ -403,7 +403,7 @@ DiskWriter::non_realtime_locate (framepos_t position)
void
-DiskWriter::prepare_record_status(framepos_t capture_start_frame)
+DiskWriter::prepare_record_status(samplepos_t capture_start_sample)
{
if (recordable() && destructive()) {
boost::shared_ptr<ChannelList> c = channels.reader();
@@ -414,7 +414,7 @@ DiskWriter::prepare_record_status(framepos_t capture_start_frame)
if (transitions.len[0] > 0) {
transitions.buf[0]->type = CaptureStart;
- transitions.buf[0]->capture_val = capture_start_frame;
+ transitions.buf[0]->capture_val = capture_start_sample;
(*chan)->capture_transition_buf->increment_write_ptr(1);
} else {
// bad!
@@ -435,14 +435,14 @@ DiskWriter::prepare_record_status(framepos_t capture_start_frame)
* that someone can read playback_distance worth of data from.
*/
void
-DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
+DiskWriter::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample,
double speed, pframes_t nframes, bool result_required)
{
uint32_t n;
boost::shared_ptr<ChannelList> c = channels.reader();
ChannelList::iterator chan;
- framecnt_t rec_offset = 0;
- framecnt_t rec_nframes = 0;
+ samplecnt_t rec_offset = 0;
+ samplecnt_t rec_nframes = 0;
bool nominally_recording;
bool re = record_enabled ();
bool can_record = _session.actively_recording ();
@@ -462,7 +462,7 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
_need_butler = false;
- check_record_status (start_frame, can_record);
+ check_record_status (start_sample, can_record);
if (nframes == 0) {
return;
@@ -471,16 +471,16 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
nominally_recording = (can_record && re);
// Safeguard against situations where process() goes haywire when autopunching
- // and last_recordable_frame < first_recordable_frame
+ // and last_recordable_sample < first_recordable_sample
- if (last_recordable_frame < first_recordable_frame) {
- last_recordable_frame = max_framepos;
+ if (last_recordable_sample < first_recordable_sample) {
+ last_recordable_sample = max_samplepos;
}
const Location* const loop_loc = loop_location;
- framepos_t loop_start = 0;
- framepos_t loop_end = 0;
- framepos_t loop_length = 0;
+ samplepos_t loop_start = 0;
+ samplepos_t loop_end = 0;
+ samplepos_t loop_length = 0;
if (loop_loc) {
get_location_times (loop_loc, &loop_start, &loop_end, &loop_length);
@@ -490,12 +490,12 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
if (nominally_recording || (re && was_recording && _session.get_record_enabled() && (_session.config.get_punch_in() || _session.preroll_record_punch_enabled()))) {
- Evoral::OverlapType ot = Evoral::coverage (first_recordable_frame, last_recordable_frame, start_frame, end_frame);
- // XXX should this be transport_frame + nframes - 1 ? coverage() expects its parameter ranges to include their end points
- // XXX also, first_recordable_frame & last_recordable_frame may both be == max_framepos: coverage() will return OverlapNone in that case. Is thak OK?
- calculate_record_range (ot, start_frame, nframes, rec_nframes, rec_offset);
+ Evoral::OverlapType ot = Evoral::coverage (first_recordable_sample, last_recordable_sample, start_sample, end_sample);
+ // XXX should this be transport_sample + nframes - 1 ? coverage() expects its parameter ranges to include their end points
+ // XXX also, first_recordable_sample & last_recordable_sample may both be == max_samplepos: coverage() will return OverlapNone in that case. Is thak OK?
+ calculate_record_range (ot, start_sample, nframes, rec_nframes, rec_offset);
- DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1: this time record %2 of %3 frames, offset %4\n", _name, rec_nframes, nframes, rec_offset));
+ DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1: this time record %2 of %3 samples, offset %4\n", _name, rec_nframes, nframes, rec_offset));
if (rec_nframes && !was_recording) {
capture_captured = 0;
@@ -506,22 +506,22 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
at the loop start and can handle time wrapping around.
Otherwise, start the source right now as usual.
*/
- capture_captured = start_frame - loop_start;
- capture_start_frame = loop_start;
+ capture_captured = start_sample - loop_start;
+ capture_start_sample = loop_start;
}
if (_midi_write_source) {
- _midi_write_source->mark_write_starting_now (capture_start_frame, capture_captured, loop_length);
+ _midi_write_source->mark_write_starting_now (capture_start_sample, capture_captured, loop_length);
}
- g_atomic_int_set(const_cast<gint*> (&_frames_pending_write), 0);
+ g_atomic_int_set(const_cast<gint*> (&_samples_pending_write), 0);
g_atomic_int_set(const_cast<gint*> (&_num_captured_loops), 0);
was_recording = true;
}
- /* For audio: not writing frames to the capture ringbuffer offsets
+ /* For audio: not writing samples to the capture ringbuffer offsets
* the recording. For midi: we need to keep track of the record range
* and subtract the accumulated difference from the event time.
*/
@@ -550,14 +550,14 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
chaninfo->buf->get_write_vector (&chaninfo->rw_vector);
- if (rec_nframes <= (framecnt_t) chaninfo->rw_vector.len[0]) {
+ if (rec_nframes <= (samplecnt_t) chaninfo->rw_vector.len[0]) {
Sample *incoming = buf.data (rec_offset);
memcpy (chaninfo->rw_vector.buf[0], incoming, sizeof (Sample) * rec_nframes);
} else {
- framecnt_t total = chaninfo->rw_vector.len[0] + chaninfo->rw_vector.len[1];
+ samplecnt_t total = chaninfo->rw_vector.len[0] + chaninfo->rw_vector.len[1];
if (rec_nframes > total) {
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 overrun in %2, rec_nframes = %3 total space = %4\n",
@@ -567,7 +567,7 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
}
Sample *incoming = buf.data (rec_offset);
- framecnt_t first = chaninfo->rw_vector.len[0];
+ samplecnt_t first = chaninfo->rw_vector.len[0];
memcpy (chaninfo->rw_vector.buf[0], incoming, sizeof (Sample) * first);
memcpy (chaninfo->rw_vector.buf[1], incoming + first, sizeof (Sample) * (rec_nframes - first));
@@ -593,7 +593,7 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
if (DEBUG_ENABLED(DEBUG::MidiIO)) {
const uint8_t* __data = ev.buffer();
DEBUG_STR_DECL(a);
- DEBUG_STR_APPEND(a, string_compose ("mididiskstream %1 capture event @ %2 + %3 sz %4 ", this, ev.time(), start_frame, ev.size()));
+ DEBUG_STR_APPEND(a, string_compose ("mididiskstream %1 capture event @ %2 + %3 sz %4 ", this, ev.time(), start_sample, ev.size()));
for (size_t i=0; i < ev.size(); ++i) {
DEBUG_STR_APPEND(a,hex);
DEBUG_STR_APPEND(a,"0x");
@@ -604,7 +604,7 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
DEBUG_TRACE (DEBUG::MidiIO, DEBUG_STR(a).str());
}
#endif
- /* Write events to the capture buffer in frames from session start,
+ /* Write events to the capture buffer in samples from session start,
but ignoring looping so event time progresses monotonically.
The source knows the loop length so it knows exactly where the
event occurs in the series of recorded loops and can implement
@@ -613,9 +613,9 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
reconstruct their actual time; future clever MIDI looping should
probably be implemented in the source instead of here.
*/
- const framecnt_t loop_offset = _num_captured_loops * loop_length;
- const framepos_t event_time = start_frame + loop_offset - _accumulated_capture_offset + ev.time();
- if (event_time < 0 || event_time < first_recordable_frame) {
+ const samplecnt_t loop_offset = _num_captured_loops * loop_length;
+ const samplepos_t event_time = start_sample + loop_offset - _accumulated_capture_offset + ev.time();
+ if (event_time < 0 || event_time < first_recordable_sample) {
/* Event out of range, skip */
continue;
}
@@ -624,7 +624,7 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
_midi_buf->write (event_time, ev.event_type(), ev.size(), ev.buffer());
}
}
- g_atomic_int_add(const_cast<gint*>(&_frames_pending_write), nframes);
+ g_atomic_int_add(const_cast<gint*>(&_samples_pending_write), nframes);
if (buf.size() != 0) {
Glib::Threads::Mutex::Lock lm (_gui_feed_buffer_mutex, Glib::Threads::TRY_LOCK);
@@ -639,7 +639,7 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
/* This may fail if buf is larger than _gui_feed_buffer, but it's not really
the end of the world if it does.
*/
- _gui_feed_buffer.push_back ((*i).time() + start_frame, (*i).size(), (*i).buffer());
+ _gui_feed_buffer.push_back ((*i).time() + start_sample, (*i).size(), (*i).buffer());
}
}
@@ -662,7 +662,7 @@ DiskWriter::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
/* AUDIO BUTLER REQUIRED CODE */
if (_playlists[DataType::AUDIO] && !c->empty()) {
- if (((framecnt_t) c->front()->buf->read_space() >= _chunk_frames)) {
+ if (((samplecnt_t) c->front()->buf->read_space() >= _chunk_samples)) {
_need_butler = true;
}
}
@@ -680,8 +680,8 @@ void
DiskWriter::finish_capture (boost::shared_ptr<ChannelList> c)
{
was_recording = false;
- first_recordable_frame = max_framepos;
- last_recordable_frame = max_framepos;
+ first_recordable_sample = max_samplepos;
+ last_recordable_sample = max_samplepos;
if (capture_captured == 0) {
return;
@@ -708,10 +708,10 @@ DiskWriter::finish_capture (boost::shared_ptr<ChannelList> c)
CaptureInfo* ci = new CaptureInfo;
- ci->start = capture_start_frame;
- ci->frames = capture_captured;
+ ci->start = capture_start_sample;
+ ci->samples = capture_captured;
- DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("Finish capture, add new CI, %1 + %2\n", ci->start, ci->frames));
+ DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("Finish capture, add new CI, %1 + %2\n", ci->start, ci->samples));
/* XXX theoretical race condition here. Need atomic exchange ?
However, the circumstances when this is called right
@@ -725,8 +725,8 @@ DiskWriter::finish_capture (boost::shared_ptr<ChannelList> c)
capture_info.push_back (ci);
capture_captured = 0;
- /* now we've finished a capture, reset first_recordable_frame for next time */
- first_recordable_frame = max_framepos;
+ /* now we've finished a capture, reset first_recordable_sample for next time */
+ first_recordable_sample = max_samplepos;
}
void
@@ -738,7 +738,7 @@ DiskWriter::set_record_enabled (bool yn)
/* can't rec-enable in destructive mode if transport is before start */
- if (destructive() && yn && _session.transport_frame() < _session.current_start_frame()) {
+ if (destructive() && yn && _session.transport_sample() < _session.current_start_sample()) {
return;
}
@@ -767,7 +767,7 @@ DiskWriter::set_record_safe (bool yn)
/* can't rec-safe in destructive mode if transport is before start ????
REQUIRES REVIEW */
- if (destructive() && yn && _session.transport_frame() < _session.current_start_frame()) {
+ if (destructive() && yn && _session.transport_sample() < _session.current_start_sample()) {
return;
}
@@ -795,7 +795,7 @@ DiskWriter::prep_record_enable ()
/* can't rec-enable in destructive mode if transport is before start */
- if (destructive() && _session.transport_frame() < _session.current_start_frame()) {
+ if (destructive() && _session.transport_sample() < _session.current_start_sample()) {
return false;
}
@@ -848,7 +848,7 @@ DiskWriter::set_note_mode (NoteMode m)
}
int
-DiskWriter::seek (framepos_t frame, bool complete_refill)
+DiskWriter::seek (samplepos_t sample, bool complete_refill)
{
uint32_t n;
ChannelList::iterator chan;
@@ -859,16 +859,16 @@ DiskWriter::seek (framepos_t frame, bool complete_refill)
}
_midi_buf->reset ();
- g_atomic_int_set(&_frames_read_from_ringbuffer, 0);
- g_atomic_int_set(&_frames_written_to_ringbuffer, 0);
+ g_atomic_int_set(&_samples_read_from_ringbuffer, 0);
+ g_atomic_int_set(&_samples_written_to_ringbuffer, 0);
/* can't rec-enable in destructive mode if transport is before start */
- if (destructive() && record_enabled() && frame < _session.current_start_frame()) {
+ if (destructive() && record_enabled() && sample < _session.current_start_sample()) {
disengage_record_enable ();
}
- playback_sample = frame;
+ playback_sample = sample;
return 0;
}
@@ -880,7 +880,7 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
int32_t ret = 0;
RingBufferNPT<Sample>::rw_vector vector;
RingBufferNPT<CaptureTransition>::rw_vector transvec;
- framecnt_t total;
+ samplecnt_t total;
transvec.buf[0] = 0;
transvec.buf[1] = 0;
@@ -894,7 +894,7 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
total = vector.len[0] + vector.len[1];
- if (total == 0 || (total < _chunk_frames && !force_flush && was_recording)) {
+ if (total == 0 || (total < _chunk_samples && !force_flush && was_recording)) {
goto out;
}
@@ -909,11 +909,11 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
let the caller know too.
*/
- if (total >= 2 * _chunk_frames || ((force_flush || !was_recording) && total > _chunk_frames)) {
+ if (total >= 2 * _chunk_samples || ((force_flush || !was_recording) && total > _chunk_samples)) {
ret = 1;
}
- to_write = min (_chunk_frames, (framecnt_t) vector.len[0]);
+ to_write = min (_chunk_samples, (samplecnt_t) vector.len[0]);
// check the transition buffer when recording destructive
// important that we get this after the capture buf
@@ -934,7 +934,7 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
} else if (captrans.type == CaptureEnd) {
- // capture end, the capture_val represents total frames in capture
+ // capture end, the capture_val represents total samples in capture
if (captrans.capture_val <= (*chan)->curr_capture_cnt + to_write) {
@@ -973,14 +973,14 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
(*chan)->buf->increment_read_ptr (to_write);
(*chan)->curr_capture_cnt += to_write;
- if ((to_write == vector.len[0]) && (total > to_write) && (to_write < _chunk_frames) && !destructive()) {
+ if ((to_write == vector.len[0]) && (total > to_write) && (to_write < _chunk_samples) && !destructive()) {
/* we wrote all of vector.len[0] but it wasn't an entire
- disk_write_chunk_frames of data, so arrange for some part
+ disk_write_chunk_samples of data, so arrange for some part
of vector.len[1] to be flushed to disk as well.
*/
- to_write = min ((framecnt_t)(_chunk_frames - to_write), (framecnt_t) vector.len[1]);
+ to_write = min ((samplecnt_t)(_chunk_samples - to_write), (samplecnt_t) vector.len[1]);
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 additional write of %2\n", name(), to_write));
@@ -998,11 +998,11 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
if (_midi_write_source) {
- const framecnt_t total = g_atomic_int_get(const_cast<gint*> (&_frames_pending_write));
+ const samplecnt_t total = g_atomic_int_get(const_cast<gint*> (&_samples_pending_write));
if (total == 0 ||
_midi_buf->read_space() == 0 ||
- (!force_flush && (total < _chunk_frames) && was_recording)) {
+ (!force_flush && (total < _chunk_samples) && was_recording)) {
goto out;
}
@@ -1017,7 +1017,7 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
let the caller know too.
*/
- if (total >= 2 * _chunk_frames || ((force_flush || !was_recording) && total > _chunk_frames)) {
+ if (total >= 2 * _chunk_samples || ((force_flush || !was_recording) && total > _chunk_samples)) {
ret = 1;
}
@@ -1025,16 +1025,16 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
/* push out everything we have, right now */
to_write = UINT32_MAX;
} else {
- to_write = _chunk_frames;
+ to_write = _chunk_samples;
}
- if (record_enabled() && ((total > _chunk_frames) || force_flush)) {
+ if (record_enabled() && ((total > _chunk_samples) || force_flush)) {
Source::Lock lm(_midi_write_source->mutex());
- if (_midi_write_source->midi_write (lm, *_midi_buf, get_capture_start_frame (0), to_write) != to_write) {
+ if (_midi_write_source->midi_write (lm, *_midi_buf, get_capture_start_sample (0), to_write) != to_write) {
error << string_compose(_("MidiDiskstream %1: cannot write to disk"), id()) << endmsg;
return -1;
}
- g_atomic_int_add(const_cast<gint*> (&_frames_pending_write), -to_write);
+ g_atomic_int_add(const_cast<gint*> (&_samples_pending_write), -to_write);
}
}
@@ -1175,7 +1175,7 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
{
bool more_work = true;
int err = 0;
- framecnt_t total_capture;
+ samplecnt_t total_capture;
SourceList audio_srcs;
SourceList midi_srcs;
ChannelList::iterator chan;
@@ -1239,7 +1239,7 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
}
for (total_capture = 0, ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
- total_capture += (*ci)->frames;
+ total_capture += (*ci)->samples;
}
/* figure out the name for this take */
@@ -1298,7 +1298,7 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
/* set length in beats to entire capture length */
- BeatsFramesConverter converter (_session.tempo_map(), capture_info.front()->start);
+ BeatsSamplesConverter converter (_session.tempo_map(), capture_info.front()->start);
const Evoral::Beats total_capture_beats = converter.from (total_capture);
_midi_write_source->set_length_beats (total_capture_beats);
@@ -1330,11 +1330,11 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
}
capture_info.clear ();
- capture_start_frame = 0;
+ capture_start_sample = 0;
}
void
-DiskWriter::transport_looped (framepos_t transport_frame)
+DiskWriter::transport_looped (samplepos_t transport_sample)
{
if (was_recording) {
// all we need to do is finish this capture, with modified capture length
@@ -1345,9 +1345,9 @@ DiskWriter::transport_looped (framepos_t transport_frame)
// the next region will start recording via the normal mechanism
// we'll set the start position to the current transport pos
// no latency adjustment or capture offset needs to be made, as that already happened the first time
- capture_start_frame = transport_frame;
- first_recordable_frame = transport_frame; // mild lie
- last_recordable_frame = max_framepos;
+ capture_start_sample = transport_sample;
+ first_recordable_sample = transport_sample; // mild lie
+ last_recordable_sample = max_samplepos;
was_recording = true;
if (recordable() && destructive()) {
@@ -1358,7 +1358,7 @@ DiskWriter::transport_looped (framepos_t transport_frame)
if (transvec.len[0] > 0) {
transvec.buf[0]->type = CaptureStart;
- transvec.buf[0]->capture_val = capture_start_frame;
+ transvec.buf[0]->capture_val = capture_start_sample;
(*chan)->capture_transition_buf->increment_write_ptr(1);
}
else {
@@ -1400,7 +1400,7 @@ DiskWriter::setup_destructive_playlist ()
PropertyList plist;
plist.add (Properties::name, _name.val());
plist.add (Properties::start, 0);
- plist.add (Properties::length, max_framepos - srcs.front()->natural_position());
+ plist.add (Properties::length, max_samplepos - srcs.front()->natural_position());
boost::shared_ptr<Region> region (RegionFactory::create (srcs, plist));
_playlists[DataType::AUDIO]->add_region (region, srcs.front()->natural_position());
@@ -1441,7 +1441,7 @@ DiskWriter::use_destructive_playlist ()
/* be sure to stretch the region out to the maximum length (non-musical)*/
- region->set_length (max_framepos - region->position(), 0);
+ region->set_length (max_samplepos - region->position(), 0);
uint32_t n;
ChannelList::iterator chan;
diff --git a/libs/ardour/dsp_filter.cc b/libs/ardour/dsp_filter.cc
index a85e98fd55..cff1128aa1 100644
--- a/libs/ardour/dsp_filter.cc
+++ b/libs/ardour/dsp_filter.cc
@@ -75,7 +75,7 @@ ARDOUR::DSP::peaks (const float *data, float &min, float &max, uint32_t n_sample
}
void
-ARDOUR::DSP::process_map (BufferSet* bufs, const ChanMapping& in, const ChanMapping& out, pframes_t nframes, framecnt_t offset, const DataType& dt)
+ARDOUR::DSP::process_map (BufferSet* bufs, const ChanMapping& in, const ChanMapping& out, pframes_t nframes, samplecnt_t offset, const DataType& dt)
{
const ChanMapping::Mappings& im (in.mappings());
const ChanMapping::Mappings& om (out.mappings());
diff --git a/libs/ardour/ebur128_analysis.cc b/libs/ardour/ebur128_analysis.cc
index a329f877c1..1caf7a71c2 100644
--- a/libs/ardour/ebur128_analysis.cc
+++ b/libs/ardour/ebur128_analysis.cc
@@ -46,8 +46,8 @@ EBUr128Analysis::run (Readable* src)
{
int ret = -1;
bool done = false;
- framecnt_t len = src->readable_length();
- framepos_t pos = 0;
+ samplecnt_t len = src->readable_length();
+ samplepos_t pos = 0;
uint32_t n_channels = src->n_channels();
Plugin::FeatureSet features;
@@ -62,8 +62,8 @@ EBUr128Analysis::run (Readable* src)
}
while (!done) {
- framecnt_t to_read;
- to_read = min ((len - pos), (framecnt_t) bufsize);
+ samplecnt_t to_read;
+ to_read = min ((len - pos), (samplecnt_t) bufsize);
for (uint32_t c = 0; c < n_channels; ++c) {
if (src->read (bufs[c], pos, to_read, c) != to_read) {
diff --git a/libs/ardour/element_importer.cc b/libs/ardour/element_importer.cc
index 811880e44c..ace517f070 100644
--- a/libs/ardour/element_importer.cc
+++ b/libs/ardour/element_importer.cc
@@ -89,15 +89,15 @@ ElementImporter::timecode_to_string(Timecode::Time & time) const
return oss.str();
}
-framecnt_t
-ElementImporter::rate_convert_samples (framecnt_t samples) const
+samplecnt_t
+ElementImporter::rate_convert_samples (samplecnt_t samples) const
{
- if (sample_rate == session.frame_rate()) {
+ if (sample_rate == session.sample_rate()) {
return samples;
}
// +0.5 for proper rounding
- return static_cast<framecnt_t> (samples * (static_cast<double> (session.nominal_frame_rate()) / sample_rate) + 0.5);
+ return static_cast<samplecnt_t> (samples * (static_cast<double> (session.nominal_sample_rate()) / sample_rate) + 0.5);
}
string
diff --git a/libs/ardour/engine_slave.cc b/libs/ardour/engine_slave.cc
index 8b7c3ba510..7ac767c3e8 100644
--- a/libs/ardour/engine_slave.cc
+++ b/libs/ardour/engine_slave.cc
@@ -31,7 +31,7 @@ Engine_Slave::Engine_Slave (AudioEngine& e)
: engine (e)
{
double x;
- framepos_t p;
+ samplepos_t p;
/* call this to initialize things */
speed_and_position (x, p);
}
@@ -53,7 +53,7 @@ Engine_Slave::ok() const
}
bool
-Engine_Slave::speed_and_position (double& sp, framepos_t& position)
+Engine_Slave::speed_and_position (double& sp, samplepos_t& position)
{
boost::shared_ptr<AudioBackend> backend = engine.current_backend();
diff --git a/libs/ardour/engine_state_controller.cc b/libs/ardour/engine_state_controller.cc
index 06a4f465b2..a2a98bb5b7 100644
--- a/libs/ardour/engine_state_controller.cc
+++ b/libs/ardour/engine_state_controller.cc
@@ -557,7 +557,7 @@ EngineStateController::_validate_current_device_state ()
// check if session desired sample rate (if it's set) could be used with this device
if (_session != 0) {
- if ( !set_new_sample_rate_in_controller (_session->nominal_frame_rate ())) {
+ if ( !set_new_sample_rate_in_controller (_session->nominal_sample_rate ())) {
if ( !set_new_sample_rate_in_controller (backend->default_sample_rate ()) ) {
if (!set_new_sample_rate_in_controller (sample_rates.front ()) ) {
return false;
@@ -708,14 +708,14 @@ EngineStateController::enumerate_devices (std::vector<AudioBackend::DeviceStatus
}
-framecnt_t
+samplecnt_t
EngineStateController::get_current_sample_rate () const
{
return _current_state->sample_rate;
}
-framecnt_t
+samplecnt_t
EngineStateController::get_default_sample_rate () const
{
boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
@@ -870,7 +870,7 @@ EngineStateController::set_new_device_as_current (const std::string& device_name
bool
-EngineStateController::set_new_sample_rate_in_controller (framecnt_t sample_rate)
+EngineStateController::set_new_sample_rate_in_controller (samplecnt_t sample_rate)
{
boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
assert (backend);
@@ -1424,7 +1424,7 @@ EngineStateController::_on_session_loaded ()
// _session->reconnect_ltc_input ();
// _session->reconnect_ltc_output ();
- framecnt_t desired_sample_rate = _session->nominal_frame_rate ();
+ samplecnt_t desired_sample_rate = _session->nominal_sample_rate ();
if ( desired_sample_rate > 0 && set_new_sample_rate_in_controller (desired_sample_rate))
{
push_current_state_to_backend (false);
@@ -1434,15 +1434,15 @@ EngineStateController::_on_session_loaded ()
void
-EngineStateController::_on_sample_rate_change (framecnt_t new_sample_rate)
+EngineStateController::_on_sample_rate_change (samplecnt_t new_sample_rate)
{
if (_current_state->sample_rate != new_sample_rate) {
// if sample rate has been changed
- framecnt_t sample_rate_to_set = new_sample_rate;
+ samplecnt_t sample_rate_to_set = new_sample_rate;
if (AudioEngine::instance ()->session ()) {
// and we have current session we should restore it back to the one tracks uses
- sample_rate_to_set = AudioEngine::instance ()->session ()->frame_rate ();
+ sample_rate_to_set = AudioEngine::instance ()->session ()->sample_rate ();
}
if ( !set_new_sample_rate_in_controller (sample_rate_to_set)) {
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index 5c792f1b6d..09ae6db6b7 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -143,6 +143,12 @@ setup_enum_writer ()
#define REGISTER_ENUM(e) i.push_back (e); s.push_back (#e)
#define REGISTER_CLASS_ENUM(t,e) i.push_back (t::e); s.push_back (#e)
+ /* in mid-2017 the entire code base was changed to use "samples"
+ instead of frames, which included several enums. This hack table
+ entry will catch all of them.
+ */
+ enum_writer.add_to_hack_table ("Frames", "Samples");
+
REGISTER_ENUM (NullAutomation);
REGISTER_ENUM (GainAutomation);
REGISTER_ENUM (PanAzimuthAutomation);
@@ -544,7 +550,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (AnyTime, Timecode);
REGISTER_CLASS_ENUM (AnyTime, BBT);
- REGISTER_CLASS_ENUM (AnyTime, Frames);
+ REGISTER_CLASS_ENUM (AnyTime, Samples);
REGISTER_CLASS_ENUM (AnyTime, Seconds);
REGISTER (_AnyTime_Type);
@@ -627,7 +633,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (ExportProfileManager, Timecode);
REGISTER_CLASS_ENUM (ExportProfileManager, BBT);
REGISTER_CLASS_ENUM (ExportProfileManager, MinSec);
- REGISTER_CLASS_ENUM (ExportProfileManager, Frames);
+ REGISTER_CLASS_ENUM (ExportProfileManager, Samples);
REGISTER (_ExportProfileManager_TimeFormat);
REGISTER_CLASS_ENUM (RegionExportChannelFactory, None);
diff --git a/libs/ardour/export_channel.cc b/libs/ardour/export_channel.cc
index 5435d63c52..9a7e6a9ace 100644
--- a/libs/ardour/export_channel.cc
+++ b/libs/ardour/export_channel.cc
@@ -39,10 +39,10 @@ PortExportChannel::PortExportChannel ()
{
}
-void PortExportChannel::set_max_buffer_size(framecnt_t frames)
+void PortExportChannel::set_max_buffer_size(samplecnt_t samples)
{
- buffer_size = frames;
- buffer.reset (new Sample[frames]);
+ buffer_size = samples;
+ buffer.reset (new Sample[samples]);
}
bool
@@ -56,29 +56,29 @@ PortExportChannel::operator< (ExportChannel const & other) const
}
void
-PortExportChannel::read (Sample const *& data, framecnt_t frames) const
+PortExportChannel::read (Sample const *& data, samplecnt_t samples) const
{
assert(buffer);
- assert(frames <= buffer_size);
+ assert(samples <= buffer_size);
if (ports.size() == 1) {
boost::shared_ptr<AudioPort> p = ports.begin()->lock ();
- AudioBuffer& ab (p->get_audio_buffer(frames)); // unsets AudioBuffer::_written
+ AudioBuffer& ab (p->get_audio_buffer(samples)); // unsets AudioBuffer::_written
data = ab.data();
ab.set_written (true);
return;
}
- memset (buffer.get(), 0, frames * sizeof (Sample));
+ memset (buffer.get(), 0, samples * sizeof (Sample));
for (PortSet::const_iterator it = ports.begin(); it != ports.end(); ++it) {
boost::shared_ptr<AudioPort> p = it->lock ();
if (p) {
- AudioBuffer& ab (p->get_audio_buffer(frames)); // unsets AudioBuffer::_written
+ AudioBuffer& ab (p->get_audio_buffer(samples)); // unsets AudioBuffer::_written
Sample* port_buffer = ab.data();
ab.set_written (true);
- for (uint32_t i = 0; i < frames; ++i) {
+ for (uint32_t i = 0; i < samples; ++i) {
buffer[i] += (float) port_buffer[i];
}
}
@@ -120,7 +120,7 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio
: region (region)
, track (track)
, type (type)
- , frames_per_cycle (session->engine().samples_per_cycle ())
+ , samples_per_cycle (session->engine().samples_per_cycle ())
, buffers_up_to_date (false)
, region_start (region.position())
, position (region_start)
@@ -132,9 +132,9 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio
case Fades:
n_channels = region.n_channels();
- mixdown_buffer.reset (new Sample [frames_per_cycle]);
- gain_buffer.reset (new Sample [frames_per_cycle]);
- std::fill_n (gain_buffer.get(), frames_per_cycle, Sample (1.0));
+ mixdown_buffer.reset (new Sample [samples_per_cycle]);
+ gain_buffer.reset (new Sample [samples_per_cycle]);
+ std::fill_n (gain_buffer.get(), samples_per_cycle, Sample (1.0));
break;
case Processed:
@@ -146,7 +146,7 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio
session->ProcessExport.connect_same_thread (export_connection, boost::bind (&RegionExportChannelFactory::new_cycle_started, this, _1));
- buffers.ensure_buffers (DataType::AUDIO, n_channels, frames_per_cycle);
+ buffers.ensure_buffers (DataType::AUDIO, n_channels, samples_per_cycle);
buffers.set_count (ChanCount (DataType::AUDIO, n_channels));
}
@@ -162,13 +162,13 @@ RegionExportChannelFactory::create (uint32_t channel)
}
void
-RegionExportChannelFactory::read (uint32_t channel, Sample const *& data, framecnt_t frames_to_read)
+RegionExportChannelFactory::read (uint32_t channel, Sample const *& data, samplecnt_t samples_to_read)
{
assert (channel < n_channels);
- assert (frames_to_read <= frames_per_cycle);
+ assert (samples_to_read <= samples_per_cycle);
if (!buffers_up_to_date) {
- update_buffers(frames_to_read);
+ update_buffers(samples_to_read);
buffers_up_to_date = true;
}
@@ -176,32 +176,32 @@ RegionExportChannelFactory::read (uint32_t channel, Sample const *& data, framec
}
void
-RegionExportChannelFactory::update_buffers (framecnt_t frames)
+RegionExportChannelFactory::update_buffers (samplecnt_t samples)
{
- assert (frames <= frames_per_cycle);
+ assert (samples <= samples_per_cycle);
switch (type) {
case Raw:
for (size_t channel = 0; channel < n_channels; ++channel) {
- region.read (buffers.get_audio (channel).data(), position - region_start, frames, channel);
+ region.read (buffers.get_audio (channel).data(), position - region_start, samples, channel);
}
break;
case Fades:
assert (mixdown_buffer && gain_buffer);
for (size_t channel = 0; channel < n_channels; ++channel) {
- memset (mixdown_buffer.get(), 0, sizeof (Sample) * frames);
- buffers.get_audio (channel).silence(frames);
- region.read_at (buffers.get_audio (channel).data(), mixdown_buffer.get(), gain_buffer.get(), position, frames, channel);
+ memset (mixdown_buffer.get(), 0, sizeof (Sample) * samples);
+ buffers.get_audio (channel).silence(samples);
+ region.read_at (buffers.get_audio (channel).data(), mixdown_buffer.get(), gain_buffer.get(), position, samples, channel);
}
break;
case Processed:
- track.export_stuff (buffers, position, frames, track.main_outs(), true, true, false);
+ track.export_stuff (buffers, position, samples, track.main_outs(), true, true, false);
break;
default:
throw ExportFailed ("Unhandled type in ExportChannelFactory::update_buffers");
}
- position += frames;
+ position += samples;
}
@@ -231,22 +231,22 @@ RouteExportChannel::create_from_route(std::list<ExportChannelPtr> & result, boos
}
void
-RouteExportChannel::set_max_buffer_size(framecnt_t frames)
+RouteExportChannel::set_max_buffer_size(samplecnt_t samples)
{
if (processor) {
- processor->set_block_size (frames);
+ processor->set_block_size (samples);
}
}
void
-RouteExportChannel::read (Sample const *& data, framecnt_t frames) const
+RouteExportChannel::read (Sample const *& data, samplecnt_t samples) const
{
assert(processor);
AudioBuffer const & buffer = processor->get_capture_buffers().get_audio (channel);
#ifndef NDEBUG
- (void) frames;
+ (void) samples;
#else
- assert (frames <= (framecnt_t) buffer.capacity());
+ assert (samples <= (samplecnt_t) buffer.capacity());
#endif
data = buffer.data();
}
diff --git a/libs/ardour/export_format_base.cc b/libs/ardour/export_format_base.cc
index 1eda449915..589f75ea8f 100644
--- a/libs/ardour/export_format_base.cc
+++ b/libs/ardour/export_format_base.cc
@@ -178,7 +178,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation
}
ExportFormatBase::SampleRate
-ExportFormatBase::nearest_sample_rate (framecnt_t sample_rate)
+ExportFormatBase::nearest_sample_rate (samplecnt_t sample_rate)
{
int diff = 0;
int smallest_diff = INT_MAX;
diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc
index c63db4382c..5275ddba6c 100644
--- a/libs/ardour/export_format_specification.cc
+++ b/libs/ardour/export_format_specification.cc
@@ -57,11 +57,11 @@ ExportFormatSpecification::Time::operator= (AnyTime const & other)
return *this;
}
-framecnt_t
-ExportFormatSpecification::Time::get_frames_at (framepos_t position, framecnt_t target_rate) const
+samplecnt_t
+ExportFormatSpecification::Time::get_samples_at (samplepos_t position, samplecnt_t target_rate) const
{
- framecnt_t duration = session.any_duration_to_frames (position, *this);
- return ((double) target_rate / session.frame_rate()) * duration + 0.5;
+ samplecnt_t duration = session.any_duration_to_samples (position, *this);
+ return ((double) target_rate / session.sample_rate()) * duration + 0.5;
}
XMLNode &
@@ -77,15 +77,15 @@ ExportFormatSpecification::Time::get_state ()
node->set_property ("hours", timecode.hours);
node->set_property ("minutes", timecode.minutes);
node->set_property ("seconds", timecode.seconds);
- node->set_property ("frames", timecode.frames);
+ node->set_property ("samples", timecode.frames);
break;
case BBT:
node->set_property ("bars", bbt.bars);
node->set_property ("beats", bbt.beats);
node->set_property ("ticks", bbt.ticks);
break;
- case Frames:
- node->set_property ("frames", frames);
+ case Samples:
+ node->set_property ("samples", samples);
break;
case Seconds:
node->set_property ("seconds", seconds);
@@ -107,7 +107,7 @@ ExportFormatSpecification::Time::set_state (const XMLNode & node)
node.get_property ("hours", timecode.hours);
node.get_property ("minutes", timecode.minutes);
node.get_property ("seconds", timecode.seconds);
- node.get_property ("frames", timecode.frames);
+ node.get_property ("samples", timecode.frames);
break;
case BBT:
@@ -116,8 +116,8 @@ ExportFormatSpecification::Time::set_state (const XMLNode & node)
node.get_property ("ticks", bbt.ticks);
break;
- case Frames:
- node.get_property ("frames", frames);
+ case Samples:
+ node.get_property ("samples", samples);
break;
case Seconds:
diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc
index afcfd2ee5d..b89e73d0ed 100644
--- a/libs/ardour/export_graph_builder.cc
+++ b/libs/ardour/export_graph_builder.cc
@@ -60,7 +60,7 @@ ExportGraphBuilder::ExportGraphBuilder (Session const & session)
: session (session)
, thread_pool (hardware_concurrency())
{
- process_buffer_frames = session.engine().samples_per_cycle();
+ process_buffer_samples = session.engine().samples_per_cycle();
}
ExportGraphBuilder::~ExportGraphBuilder ()
@@ -68,14 +68,14 @@ ExportGraphBuilder::~ExportGraphBuilder ()
}
int
-ExportGraphBuilder::process (framecnt_t frames, bool last_cycle)
+ExportGraphBuilder::process (samplecnt_t samples, bool last_cycle)
{
- assert(frames <= process_buffer_frames);
+ assert(samples <= process_buffer_samples);
for (ChannelMap::iterator it = channels.begin(); it != channels.end(); ++it) {
Sample const * process_buffer = 0;
- it->first->read (process_buffer, frames);
- ConstProcessContext<Sample> context(process_buffer, frames, 1);
+ it->first->read (process_buffer, samples);
+ ConstProcessContext<Sample> context(process_buffer, samples, 1);
if (last_cycle) { context().set_flag (ProcessContext<Sample>::EndOfInput); }
it->second->process (context);
}
@@ -142,7 +142,7 @@ ExportGraphBuilder::add_config (FileSpec const & config, bool rt)
config.channel_config->get_channels();
for(ExportChannelConfiguration::ChannelList::const_iterator it = channels.begin();
it != channels.end(); ++it) {
- (*it)->set_max_buffer_size(process_buffer_frames);
+ (*it)->set_max_buffer_size(process_buffer_samples);
}
_realtime = rt;
@@ -152,7 +152,7 @@ ExportGraphBuilder::add_config (FileSpec const & config, bool rt)
FileSpec new_config (config);
new_config.format.reset(new ExportFormatSpecification(*new_config.format, false));
if(new_config.format->sample_rate() == ExportFormatBase::SR_Session) {
- framecnt_t session_rate = session.nominal_frame_rate();
+ samplecnt_t session_rate = session.nominal_sample_rate();
new_config.format->set_sample_rate(ExportFormatBase::nearest_sample_rate(session_rate));
}
@@ -305,7 +305,7 @@ ExportGraphBuilder::Encoder::copy_files (std::string orig_path)
/* SFC */
-ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_config, framecnt_t max_frames)
+ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_config, samplecnt_t max_samples)
: data_width(0)
{
config = new_config;
@@ -313,14 +313,14 @@ ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_c
unsigned channels = new_config.channel_config->get_n_chans();
_analyse = config.format->analyse();
if (_analyse) {
- framecnt_t sample_rate = parent.session.nominal_frame_rate();
- framecnt_t sb = config.format->silence_beginning_at (parent.timespan->get_start(), sample_rate);
- framecnt_t se = config.format->silence_end_at (parent.timespan->get_end(), sample_rate);
- framecnt_t duration = parent.timespan->get_length () + sb + se;
- max_frames = min ((framecnt_t) 8192 * channels, max ((framecnt_t) 4096 * channels, max_frames));
- chunker.reset (new Chunker<Sample> (max_frames));
- analyser.reset (new Analyser (config.format->sample_rate(), channels, max_frames,
- (framecnt_t) ceil (duration * config.format->sample_rate () / (double) sample_rate)));
+ samplecnt_t sample_rate = parent.session.nominal_sample_rate();
+ samplecnt_t sb = config.format->silence_beginning_at (parent.timespan->get_start(), sample_rate);
+ samplecnt_t se = config.format->silence_end_at (parent.timespan->get_end(), sample_rate);
+ samplecnt_t duration = parent.timespan->get_length () + sb + se;
+ max_samples = min ((samplecnt_t) 8192 * channels, max ((samplecnt_t) 4096 * channels, max_samples));
+ chunker.reset (new Chunker<Sample> (max_samples));
+ analyser.reset (new Analyser (config.format->sample_rate(), channels, max_samples,
+ (samplecnt_t) ceil (duration * config.format->sample_rate () / (double) sample_rate)));
chunker->add_output (analyser);
config.filename->set_channel_config (config.channel_config);
@@ -329,19 +329,19 @@ ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_c
if (data_width == 8 || data_width == 16) {
short_converter = ShortConverterPtr (new SampleFormatConverter<short> (channels));
- short_converter->init (max_frames, config.format->dither_type(), data_width);
+ short_converter->init (max_samples, config.format->dither_type(), data_width);
add_child (config);
if (_analyse) { analyser->add_output (short_converter); }
} else if (data_width == 24 || data_width == 32) {
int_converter = IntConverterPtr (new SampleFormatConverter<int> (channels));
- int_converter->init (max_frames, config.format->dither_type(), data_width);
+ int_converter->init (max_samples, config.format->dither_type(), data_width);
add_child (config);
if (_analyse) { analyser->add_output (int_converter); }
} else {
int actual_data_width = 8 * sizeof(Sample);
float_converter = FloatConverterPtr (new SampleFormatConverter<Sample> (channels));
- float_converter->init (max_frames, config.format->dither_type(), actual_data_width);
+ float_converter->init (max_samples, config.format->dither_type(), actual_data_width);
add_child (config);
if (_analyse) { analyser->add_output (float_converter); }
}
@@ -413,7 +413,7 @@ ExportGraphBuilder::SFC::operator== (FileSpec const & other_config) const
/* Intermediate (Normalizer, TmpFile) */
-ExportGraphBuilder::Intermediate::Intermediate (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames)
+ExportGraphBuilder::Intermediate::Intermediate (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples)
: parent (parent)
, use_loudness (false)
, use_peak (false)
@@ -426,22 +426,22 @@ ExportGraphBuilder::Intermediate::Intermediate (ExportGraphBuilder & parent, Fil
config = new_config;
uint32_t const channels = config.channel_config->get_n_chans();
- max_frames_out = 4086 - (4086 % channels); // TODO good chunk size
+ max_samples_out = 4086 - (4086 % channels); // TODO good chunk size
use_loudness = config.format->normalize_loudness ();
use_peak = config.format->normalize ();
- buffer.reset (new AllocatingProcessContext<Sample> (max_frames_out, channels));
+ buffer.reset (new AllocatingProcessContext<Sample> (max_samples_out, channels));
if (use_peak) {
peak_reader.reset (new PeakReader ());
}
if (use_loudness) {
- loudness_reader.reset (new LoudnessReader (config.format->sample_rate(), channels, max_frames));
+ loudness_reader.reset (new LoudnessReader (config.format->sample_rate(), channels, max_samples));
}
normalizer.reset (new AudioGrapher::Normalizer (use_loudness ? 0.0 : config.format->normalize_dbfs()));
threader.reset (new Threader<Sample> (parent.thread_pool));
- normalizer->alloc_buffer (max_frames_out);
+ normalizer->alloc_buffer (max_samples_out);
normalizer->add_output (threader);
int format = ExportFormatBase::F_RAW | ExportFormatBase::SF_Float;
@@ -487,7 +487,7 @@ ExportGraphBuilder::Intermediate::add_child (FileSpec const & new_config)
}
}
- children.push_back (new SFC (parent, new_config, max_frames_out));
+ children.push_back (new SFC (parent, new_config, max_samples_out));
threader->add_output (children.back().sink());
}
@@ -518,15 +518,15 @@ ExportGraphBuilder::Intermediate::operator== (FileSpec const & other_config) con
unsigned
ExportGraphBuilder::Intermediate::get_postprocessing_cycle_count() const
{
- return static_cast<unsigned>(std::ceil(static_cast<float>(tmp_file->get_frames_written()) /
- max_frames_out));
+ return static_cast<unsigned>(std::ceil(static_cast<float>(tmp_file->get_samples_written()) /
+ max_samples_out));
}
bool
ExportGraphBuilder::Intermediate::process()
{
- framecnt_t frames_read = tmp_file->read (*buffer);
- return frames_read != buffer->frames();
+ samplecnt_t samples_read = tmp_file->read (*buffer);
+ return samples_read != buffer->samples();
}
void
@@ -563,14 +563,14 @@ ExportGraphBuilder::Intermediate::start_post_processing()
/* SRC */
-ExportGraphBuilder::SRC::SRC (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames)
+ExportGraphBuilder::SRC::SRC (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples)
: parent (parent)
{
config = new_config;
converter.reset (new SampleRateConverter (new_config.channel_config->get_n_chans()));
ExportFormatSpecification & format = *new_config.format;
- converter->init (parent.session.nominal_frame_rate(), format.sample_rate(), format.src_quality());
- max_frames_out = converter->allocate_buffers (max_frames);
+ converter->init (parent.session.nominal_sample_rate(), format.sample_rate(), format.src_quality());
+ max_samples_out = converter->allocate_buffers (max_samples);
add_child (new_config);
}
@@ -623,7 +623,7 @@ ExportGraphBuilder::SRC::add_child_to_list (FileSpec const & new_config, boost::
}
}
- list.push_back (new T (parent, new_config, max_frames_out));
+ list.push_back (new T (parent, new_config, max_samples_out));
converter->add_output (list.back().sink ());
}
@@ -634,12 +634,12 @@ ExportGraphBuilder::SRC::operator== (FileSpec const & other_config) const
}
/* SilenceHandler */
-ExportGraphBuilder::SilenceHandler::SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames)
+ExportGraphBuilder::SilenceHandler::SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples)
: parent (parent)
{
config = new_config;
- max_frames_in = max_frames;
- framecnt_t sample_rate = parent.session.nominal_frame_rate();
+ max_samples_in = max_samples;
+ samplecnt_t sample_rate = parent.session.nominal_sample_rate();
/* work around partsing "-inf" config to "0" -- 7b1f97b
* silence trim 0dBFS makes no sense, anyway.
@@ -648,16 +648,16 @@ ExportGraphBuilder::SilenceHandler::SilenceHandler (ExportGraphBuilder & parent,
if (est >= 0.f) est = -INFINITY;
#ifdef MIXBUS
// Mixbus channelstrip always dithers the signal, cut above dither level
- silence_trimmer.reset (new SilenceTrimmer<Sample>(max_frames_in, std::max (-90.f, est)));
+ silence_trimmer.reset (new SilenceTrimmer<Sample>(max_samples_in, std::max (-90.f, est)));
#else
// TODO silence-threshold should be per export-preset, with Config->get_silence_threshold being the default
- silence_trimmer.reset (new SilenceTrimmer<Sample>(max_frames_in, est));
+ silence_trimmer.reset (new SilenceTrimmer<Sample>(max_samples_in, est));
#endif
silence_trimmer->set_trim_beginning (config.format->trim_beginning());
silence_trimmer->set_trim_end (config.format->trim_end());
- framecnt_t sb = config.format->silence_beginning_at (parent.timespan->get_start(), sample_rate);
- framecnt_t se = config.format->silence_end_at (parent.timespan->get_end(), sample_rate);
+ samplecnt_t sb = config.format->silence_beginning_at (parent.timespan->get_start(), sample_rate);
+ samplecnt_t se = config.format->silence_end_at (parent.timespan->get_end(), sample_rate);
silence_trimmer->add_silence_to_beginning (sb);
silence_trimmer->add_silence_to_end (se);
@@ -681,7 +681,7 @@ ExportGraphBuilder::SilenceHandler::add_child (FileSpec const & new_config)
}
}
- children.push_back (new SRC (parent, new_config, max_frames_in));
+ children.push_back (new SRC (parent, new_config, max_samples_in));
silence_trimmer->add_output (children.back().sink());
}
@@ -717,17 +717,17 @@ ExportGraphBuilder::ChannelConfig::ChannelConfig (ExportGraphBuilder & parent, F
config = new_config;
- framecnt_t max_frames = parent.session.engine().samples_per_cycle();
+ samplecnt_t max_samples = parent.session.engine().samples_per_cycle();
interleaver.reset (new Interleaver<Sample> ());
- interleaver->init (new_config.channel_config->get_n_chans(), max_frames);
+ interleaver->init (new_config.channel_config->get_n_chans(), max_samples);
// Make the chunk size divisible by the channel count
int chan_count = new_config.channel_config->get_n_chans();
- max_frames_out = 8192;
+ max_samples_out = 8192;
if (chan_count > 0) {
- max_frames_out -= max_frames_out % chan_count;
+ max_samples_out -= max_samples_out % chan_count;
}
- chunker.reset (new Chunker<Sample> (max_frames_out));
+ chunker.reset (new Chunker<Sample> (max_samples_out));
interleaver->add_output(chunker);
ChannelList const & channel_list = config.channel_config->get_channels();
@@ -758,7 +758,7 @@ ExportGraphBuilder::ChannelConfig::add_child (FileSpec const & new_config)
}
}
- children.push_back (new SilenceHandler (parent, new_config, max_frames_out));
+ children.push_back (new SilenceHandler (parent, new_config, max_samples_out));
chunker->add_output (children.back().sink ());
}
diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc
index 1f10aaa2d3..7301e12b68 100644
--- a/libs/ardour/export_handler.cc
+++ b/libs/ardour/export_handler.cc
@@ -66,7 +66,7 @@ ExportElementFactory::~ExportElementFactory ()
ExportTimespanPtr
ExportElementFactory::add_timespan ()
{
- return ExportTimespanPtr (new ExportTimespan (session.get_export_status(), session.frame_rate()));
+ return ExportTimespanPtr (new ExportTimespan (session.get_export_status(), session.sample_rate()));
}
ExportChannelConfigPtr
@@ -145,7 +145,7 @@ ExportHandler::do_export ()
for (ConfigMap::iterator it = config_map.begin(); it != config_map.end(); ++it) {
bool new_timespan = timespan_set.insert (it->first).second;
if (new_timespan) {
- export_status->total_frames += it->first->get_length();
+ export_status->total_samples += it->first->get_length();
}
}
export_status->total_timespans = timespan_set.size();
@@ -180,9 +180,9 @@ ExportHandler::start_timespan ()
*/
current_timespan = config_map.begin()->first;
- export_status->total_frames_current_timespan = current_timespan->get_length();
+ export_status->total_samples_current_timespan = current_timespan->get_length();
export_status->timespan_name = current_timespan->name();
- export_status->processed_frames_current_timespan = 0;
+ export_status->processed_samples_current_timespan = 0;
/* Register file configurations to graph builder */
@@ -270,7 +270,7 @@ ExportHandler::handle_duplicate_format_extensions()
}
int
-ExportHandler::process (framecnt_t frames)
+ExportHandler::process (samplecnt_t samples)
{
if (!export_status->running ()) {
return 0;
@@ -284,34 +284,34 @@ ExportHandler::process (framecnt_t frames)
}
} else {
Glib::Threads::Mutex::Lock l (export_status->lock());
- return process_timespan (frames);
+ return process_timespan (samples);
}
}
int
-ExportHandler::process_timespan (framecnt_t frames)
+ExportHandler::process_timespan (samplecnt_t samples)
{
export_status->active_job = ExportStatus::Exporting;
/* update position */
- framecnt_t frames_to_read = 0;
- framepos_t const end = current_timespan->get_end();
+ samplecnt_t samples_to_read = 0;
+ samplepos_t const end = current_timespan->get_end();
- bool const last_cycle = (process_position + frames >= end);
+ bool const last_cycle = (process_position + samples >= end);
if (last_cycle) {
- frames_to_read = end - process_position;
+ samples_to_read = end - process_position;
export_status->stop = true;
} else {
- frames_to_read = frames;
+ samples_to_read = samples;
}
- process_position += frames_to_read;
- export_status->processed_frames += frames_to_read;
- export_status->processed_frames_current_timespan += frames_to_read;
+ process_position += samples_to_read;
+ export_status->processed_samples += samples_to_read;
+ export_status->processed_samples_current_timespan += samples_to_read;
/* Do actual processing */
- int ret = graph_builder->process (frames_to_read, last_cycle);
+ int ret = graph_builder->process (samples_to_read, last_cycle);
/* Start post-processing/normalizing if necessary */
if (last_cycle) {
@@ -559,7 +559,7 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp
/* Start actual marker stuff */
- framepos_t last_end_time = timespan->get_start();
+ samplepos_t last_end_time = timespan->get_start();
status.track_position = 0;
for (i = temp.begin(); i != temp.end(); ++i) {
@@ -580,7 +580,7 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp
/* A track, defined by a cd range marker or a cd location marker outside of a cd range */
status.track_position = last_end_time - timespan->get_start();
- status.track_start_frame = (*i)->start() - timespan->get_start(); // everything before this is the pregap
+ status.track_start_sample = (*i)->start() - timespan->get_start(); // everything before this is the pregap
status.track_duration = 0;
if ((*i)->is_mark()) {
@@ -756,12 +756,12 @@ ExportHandler::write_track_info_cue (CDMarkerStatus & status)
status.out << " SONGWRITER " << cue_escape_cdtext (status.marker->cd_info["composer"]) << endl;
}
- if (status.track_position != status.track_start_frame) {
- frames_to_cd_frames_string (buf, status.track_position);
+ if (status.track_position != status.track_start_sample) {
+ samples_to_cd_samples_string (buf, status.track_position);
status.out << " INDEX 00" << buf << endl;
}
- frames_to_cd_frames_string (buf, status.track_start_frame);
+ samples_to_cd_samples_string (buf, status.track_start_sample);
status.out << " INDEX 01" << buf << endl;
status.index_number = 2;
@@ -814,13 +814,13 @@ ExportHandler::write_track_info_toc (CDMarkerStatus & status)
status.out << " }" << endl << "}" << endl;
- frames_to_cd_frames_string (buf, status.track_position);
+ samples_to_cd_samples_string (buf, status.track_position);
status.out << "FILE " << toc_escape_filename (status.filename) << ' ' << buf;
- frames_to_cd_frames_string (buf, status.track_duration);
+ samples_to_cd_samples_string (buf, status.track_duration);
status.out << buf << endl;
- frames_to_cd_frames_string (buf, status.track_start_frame - status.track_position);
+ samples_to_cd_samples_string (buf, status.track_start_sample - status.track_position);
status.out << "START" << buf << endl;
}
@@ -828,7 +828,7 @@ void ExportHandler::write_track_info_mp4ch (CDMarkerStatus & status)
{
gchar buf[18];
- frames_to_chapter_marks_string(buf, status.track_start_frame);
+ samples_to_chapter_marks_string(buf, status.track_start_sample);
status.out << buf << " " << status.marker->name() << endl;
}
@@ -839,7 +839,7 @@ ExportHandler::write_index_info_cue (CDMarkerStatus & status)
snprintf (buf, sizeof(buf), " INDEX %02d", cue_indexnum);
status.out << buf;
- frames_to_cd_frames_string (buf, status.index_position);
+ samples_to_cd_samples_string (buf, status.index_position);
status.out << buf << endl;
cue_indexnum++;
@@ -850,7 +850,7 @@ ExportHandler::write_index_info_toc (CDMarkerStatus & status)
{
gchar buf[18];
- frames_to_cd_frames_string (buf, status.index_position - status.track_position);
+ samples_to_cd_samples_string (buf, status.index_position - status.track_position);
status.out << "INDEX" << buf << endl;
}
@@ -860,25 +860,25 @@ ExportHandler::write_index_info_mp4ch (CDMarkerStatus & status)
}
void
-ExportHandler::frames_to_cd_frames_string (char* buf, framepos_t when)
+ExportHandler::samples_to_cd_samples_string (char* buf, samplepos_t when)
{
- framecnt_t remainder;
- framecnt_t fr = session.nominal_frame_rate();
- int mins, secs, frames;
+ samplecnt_t remainder;
+ samplecnt_t fr = session.nominal_sample_rate();
+ int mins, secs, samples;
mins = when / (60 * fr);
remainder = when - (mins * 60 * fr);
secs = remainder / fr;
remainder -= secs * fr;
- frames = remainder / (fr / 75);
- sprintf (buf, " %02d:%02d:%02d", mins, secs, frames);
+ samples = remainder / (fr / 75);
+ sprintf (buf, " %02d:%02d:%02d", mins, secs, samples);
}
void
-ExportHandler::frames_to_chapter_marks_string (char* buf, framepos_t when)
+ExportHandler::samples_to_chapter_marks_string (char* buf, samplepos_t when)
{
- framecnt_t remainder;
- framecnt_t fr = session.nominal_frame_rate();
+ samplecnt_t remainder;
+ samplecnt_t fr = session.nominal_sample_rate();
int hours, mins, secs, msecs;
hours = when / (3600 * fr);
diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc
index 8af3bdea3b..8d1eb81edb 100644
--- a/libs/ardour/export_profile_manager.cc
+++ b/libs/ardour/export_profile_manager.cc
@@ -353,7 +353,7 @@ ExportProfileManager::find_file (std::string const & pattern)
}
void
-ExportProfileManager::set_selection_range (framepos_t start, framepos_t end)
+ExportProfileManager::set_selection_range (samplepos_t start, samplepos_t end)
{
if (start || end) {
@@ -370,7 +370,7 @@ ExportProfileManager::set_selection_range (framepos_t start, framepos_t end)
}
std::string
-ExportProfileManager::set_single_range (framepos_t start, framepos_t end, string name)
+ExportProfileManager::set_single_range (samplepos_t start, samplepos_t end, string name)
{
single_range_mode = true;
diff --git a/libs/ardour/export_status.cc b/libs/ardour/export_status.cc
index 808d6f144c..d5ccedaf3f 100644
--- a/libs/ardour/export_status.cc
+++ b/libs/ardour/export_status.cc
@@ -44,11 +44,11 @@ ExportStatus::init ()
total_timespans = 0;
timespan = 0;
- total_frames = 0;
- processed_frames = 0;
+ total_samples = 0;
+ processed_samples = 0;
- total_frames_current_timespan = 0;
- processed_frames_current_timespan = 0;
+ total_samples_current_timespan = 0;
+ processed_samples_current_timespan = 0;
total_postprocessing_cycles = 0;
current_postprocessing_cycle = 0;
diff --git a/libs/ardour/export_timespan.cc b/libs/ardour/export_timespan.cc
index f8a06769e4..a3a7821cbe 100644
--- a/libs/ardour/export_timespan.cc
+++ b/libs/ardour/export_timespan.cc
@@ -23,12 +23,12 @@
namespace ARDOUR
{
-ExportTimespan::ExportTimespan (ExportStatusPtr status, framecnt_t frame_rate) :
+ExportTimespan::ExportTimespan (ExportStatusPtr status, samplecnt_t sample_rate) :
status (status),
- start_frame (0),
- end_frame (0),
+ start_sample (0),
+ end_sample (0),
position (0),
- frame_rate (frame_rate),
+ sample_rate (sample_rate),
_realtime (false)
{
@@ -39,11 +39,11 @@ ExportTimespan::~ExportTimespan ()
}
void
-ExportTimespan::set_range (framepos_t start, framepos_t end)
+ExportTimespan::set_range (samplepos_t start, samplepos_t end)
{
- start_frame = start;
- position = start_frame;
- end_frame = end;
+ start_sample = start;
+ position = start_sample;
+ end_sample = end;
}
} // namespace ARDOUR
diff --git a/libs/ardour/filter.cc b/libs/ardour/filter.cc
index 6ebf23102a..96e7cfa3d7 100644
--- a/libs/ardour/filter.cc
+++ b/libs/ardour/filter.cc
@@ -70,9 +70,9 @@ Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, s
}
try {
- framecnt_t sample_rate;
+ samplecnt_t sample_rate;
if (use_session_sample_rate) {
- sample_rate = session.frame_rate();
+ sample_rate = session.sample_rate();
} else {
boost::shared_ptr<AudioRegion> aregion = boost::dynamic_pointer_cast<AudioRegion>(region);
diff --git a/libs/ardour/fixed_delay.cc b/libs/ardour/fixed_delay.cc
index f4c8b981ab..d2361433ad 100644
--- a/libs/ardour/fixed_delay.cc
+++ b/libs/ardour/fixed_delay.cc
@@ -84,7 +84,7 @@ FixedDelay::flush()
}
void
-FixedDelay::configure (const ChanCount& count, framecnt_t max_delay, bool shrink)
+FixedDelay::configure (const ChanCount& count, samplecnt_t max_delay, bool shrink)
{
if (shrink) {
if (max_delay == _max_delay && count == _count) {
@@ -97,7 +97,7 @@ FixedDelay::configure (const ChanCount& count, framecnt_t max_delay, bool shrink
}
// max possible (with all engines and during export)
- static const framecnt_t max_block_length = 8192;
+ static const samplecnt_t max_block_length = 8192;
_buf_size = _max_delay + max_block_length;
for (DataType::iterator i = DataType::begin (); i != DataType::end (); ++i) {
ensure_buffers (*i, count.get (*i), _buf_size);
@@ -105,7 +105,7 @@ FixedDelay::configure (const ChanCount& count, framecnt_t max_delay, bool shrink
}
void
-FixedDelay::set (const ChanCount& count, framecnt_t delay)
+FixedDelay::set (const ChanCount& count, samplecnt_t delay)
{
configure (count, delay, false);
if (_delay != delay) {
@@ -118,11 +118,11 @@ void
FixedDelay::delay (
ARDOUR::DataType dt, uint32_t id,
Buffer& out, const Buffer& in,
- pframes_t n_frames,
- framecnt_t dst_offset, framecnt_t src_offset)
+ pframes_t n_samples,
+ samplecnt_t dst_offset, samplecnt_t src_offset)
{
if (_delay == 0) {
- out.read_from (in, n_frames, dst_offset, src_offset);
+ out.read_from (in, n_samples, dst_offset, src_offset);
return;
}
@@ -130,25 +130,25 @@ FixedDelay::delay (
assert (id < _buffers[dt].size ());
DelayBuffer *db = _buffers[dt][id];
- if (db->pos + n_frames > _buf_size) {
+ if (db->pos + n_samples > _buf_size) {
uint32_t w0 = _buf_size - db->pos;
- uint32_t w1 = db->pos + n_frames - _buf_size;
+ uint32_t w1 = db->pos + n_samples - _buf_size;
db->buf->read_from (in, w0, db->pos, src_offset);
db->buf->read_from (in, w1, 0, src_offset + w0);
} else {
- db->buf->read_from (in, n_frames, db->pos, src_offset);
+ db->buf->read_from (in, n_samples, db->pos, src_offset);
}
uint32_t rp = (db->pos + _buf_size - _delay) % _buf_size;
- if (rp + n_frames > _buf_size) {
+ if (rp + n_samples > _buf_size) {
uint32_t r0 = _buf_size - rp;
- uint32_t r1 = rp + n_frames - _buf_size;
+ uint32_t r1 = rp + n_samples - _buf_size;
out.read_from (*db->buf, r0, dst_offset, rp);
out.read_from (*db->buf, r1, dst_offset + r0, 0);
} else {
- out.read_from (*db->buf, n_frames, dst_offset, rp);
+ out.read_from (*db->buf, n_samples, dst_offset, rp);
}
- db->pos = (db->pos + n_frames) % _buf_size;
+ db->pos = (db->pos + n_samples) % _buf_size;
}
diff --git a/libs/ardour/gain_control.cc b/libs/ardour/gain_control.cc
index b734dedd01..1813586e09 100644
--- a/libs/ardour/gain_control.cc
+++ b/libs/ardour/gain_control.cc
@@ -69,12 +69,12 @@ GainControl::post_add_master (boost::shared_ptr<AutomationControl> m)
}
bool
-GainControl::get_masters_curve_locked (framepos_t start, framepos_t end, float* vec, framecnt_t veclen) const
+GainControl::get_masters_curve_locked (samplepos_t start, samplepos_t end, float* vec, samplecnt_t veclen) const
{
if (_masters.empty()) {
return list()->curve().rt_safe_get_vector (start, end, vec, veclen);
}
- for (framecnt_t i = 0; i < veclen; ++i) {
+ for (samplecnt_t i = 0; i < veclen; ++i) {
vec[i] = 1.f;
}
return SlavableAutomationControl::masters_curve_multiply (start, end, vec, veclen);
diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc
index 504491b9ab..eb9ebca682 100644
--- a/libs/ardour/graph.cc
+++ b/libs/ardour/graph.cc
@@ -513,15 +513,15 @@ Graph::dump (int chain)
}
int
-Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
+Graph::process_routes (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler)
{
- DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("graph execution from %1 to %2 = %3\n", start_frame, end_frame, nframes));
+ DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("graph execution from %1 to %2 = %3\n", start_sample, end_sample, nframes));
if (!_threads_active) return 0;
_process_nframes = nframes;
- _process_start_frame = start_frame;
- _process_end_frame = end_frame;
+ _process_start_sample = start_sample;
+ _process_end_sample = end_sample;
_process_declick = declick;
_process_noroll = false;
@@ -539,16 +539,16 @@ Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end
}
int
-Graph::routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+Graph::routes_no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
bool non_rt_pending, int declick)
{
- DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("no-roll graph execution from %1 to %2 = %3\n", start_frame, end_frame, nframes));
+ DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("no-roll graph execution from %1 to %2 = %3\n", start_sample, end_sample, nframes));
if (!_threads_active) return 0;
_process_nframes = nframes;
- _process_start_frame = start_frame;
- _process_end_frame = end_frame;
+ _process_start_sample = start_sample;
+ _process_end_sample = end_sample;
_process_declick = declick;
_process_non_rt_pending = non_rt_pending;
@@ -575,10 +575,10 @@ Graph::process_one_route (Route* route)
if (_process_noroll) {
route->set_pending_declick (_process_declick);
- retval = route->no_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_non_rt_pending);
+ retval = route->no_roll (_process_nframes, _process_start_sample, _process_end_sample, _process_non_rt_pending);
} else {
route->set_pending_declick (_process_declick);
- retval = route->roll (_process_nframes, _process_start_frame, _process_end_frame, _process_declick, need_butler);
+ retval = route->roll (_process_nframes, _process_start_sample, _process_end_sample, _process_declick, need_butler);
}
if (retval) {
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index 8a2c3ad9bb..1a83bd39d7 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -73,7 +73,7 @@ using namespace ARDOUR;
using namespace PBD;
static boost::shared_ptr<ImportableSource>
-open_importable_source (const string& path, framecnt_t samplerate, ARDOUR::SrcQuality quality)
+open_importable_source (const string& path, samplecnt_t samplerate, ARDOUR::SrcQuality quality)
{
/* try libsndfile first, because it can get BWF info from .wav, which ExtAudioFile cannot.
We don't necessarily need that information in an ImportableSource, but it keeps the
@@ -183,7 +183,7 @@ static bool
create_mono_sources_for_writing (const vector<string>& new_paths,
Session& sess, uint32_t samplerate,
vector<boost::shared_ptr<Source> >& newfiles,
- framepos_t timeline_position)
+ samplepos_t timeline_position)
{
for (vector<string>::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i) {
@@ -238,7 +238,7 @@ static void
write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
vector<boost::shared_ptr<Source> >& newfiles)
{
- const framecnt_t nframes = ResampledImportableSource::blocksize;
+ const samplecnt_t nframes = ResampledImportableSource::blocksize;
boost::shared_ptr<AudioFileSource> afs;
uint32_t channels = source->channels();
if (channels == 0) {
@@ -272,7 +272,7 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
uint32_t read_count = 0;
while (!status.cancel) {
- framecnt_t const nread = source->read (data.get(), nframes * channels);
+ samplecnt_t const nread = source->read (data.get(), nframes * channels);
if (nread == 0) {
break;
}
@@ -293,11 +293,11 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
progress_base = 0.5;
}
- framecnt_t read_count = 0;
+ samplecnt_t read_count = 0;
while (!status.cancel) {
- framecnt_t nread, nfread;
+ samplecnt_t nread, nfread;
uint32_t x;
uint32_t chn;
@@ -324,7 +324,7 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
for (chn = 0; chn < channels; ++chn) {
- framecnt_t n;
+ samplecnt_t n;
for (x = chn, n = 0; n < nfread; x += channels, ++n) {
channel_data[chn][n] = (Sample) data[x];
}
@@ -439,9 +439,9 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status,
/* we wrote something */
- const framepos_t pos = 0;
+ const samplepos_t pos = 0;
const Evoral::Beats length_beats = Evoral::Beats::ticks_at_rate(t, source->ppqn());
- BeatsFramesConverter converter(smfs->session().tempo_map(), pos);
+ BeatsSamplesConverter converter(smfs->session().tempo_map(), pos);
smfs->update_length(pos + converter.to(length_beats.round_up_to_beat()));
smfs->mark_streaming_write_completed (source_lock);
@@ -505,7 +505,7 @@ Session::import_files (ImportStatus& status)
if (type == DataType::AUDIO) {
try {
- source = open_importable_source (*p, frame_rate(), status.quality);
+ source = open_importable_source (*p, sample_rate(), status.quality);
channels = source->channels();
} catch (const failed_constructor& err) {
error << string_compose(_("Import: cannot open input sound file \"%1\""), (*p)) << endmsg;
@@ -550,14 +550,14 @@ Session::import_files (ImportStatus& status)
vector<string> new_paths = get_paths_for_new_sources (status.replace_existing_source, *p, channels, smf_names);
Sources newfiles;
- framepos_t natural_position = source ? source->natural_position() : 0;
+ samplepos_t natural_position = source ? source->natural_position() : 0;
if (status.replace_existing_source) {
fatal << "THIS IS NOT IMPLEMENTED YET, IT SHOULD NEVER GET CALLED!!! DYING!" << endmsg;
- status.cancel = !map_existing_mono_sources (new_paths, *this, frame_rate(), newfiles, this);
+ status.cancel = !map_existing_mono_sources (new_paths, *this, sample_rate(), newfiles, this);
} else {
- status.cancel = !create_mono_sources_for_writing (new_paths, *this, frame_rate(), newfiles, natural_position);
+ status.cancel = !create_mono_sources_for_writing (new_paths, *this, sample_rate(), newfiles, natural_position);
}
// copy on cancel/failure so that any files that were created will be removed below
@@ -575,7 +575,7 @@ Session::import_files (ImportStatus& status)
if (source) { // audio
status.doing_what = compose_status_message (*p, source->samplerate(),
- frame_rate(), status.current, status.total);
+ sample_rate(), status.current, status.total);
write_audio_data_to_new_files (source.get(), status, newfiles);
} else if (smf_reader.get()) { // midi
status.doing_what = string_compose(_("Loading MIDI file %1"), *p);
diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc
index 28089feef4..b56e9e6a2f 100644
--- a/libs/ardour/internal_return.cc
+++ b/libs/ardour/internal_return.cc
@@ -32,7 +32,7 @@ InternalReturn::InternalReturn (Session& s)
}
void
-InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
+InternalReturn::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
{
if (!_active && !_pending_active) {
return;
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index e7db47ca9d..8255d3dceb 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -141,7 +141,7 @@ InternalSend::send_to_going_away ()
}
void
-InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
+InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
{
if ((!_active && !_pending_active) || !_send_to) {
_meter->reset ();
@@ -153,7 +153,7 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
if (_panshell && !_panshell->bypassed() && role() != Listen) {
if (mixbufs.count ().n_audio () > 0) {
- _panshell->run (bufs, mixbufs, start_frame, end_frame, nframes);
+ _panshell->run (bufs, mixbufs, start_sample, end_sample, nframes);
}
/* non-audio data will not have been copied by the panner, do it now
@@ -230,7 +230,7 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
/* target gain has changed */
- _current_gain = Amp::apply_gain (mixbufs, _session.nominal_frame_rate(), nframes, _current_gain, tgain);
+ _current_gain = Amp::apply_gain (mixbufs, _session.nominal_sample_rate(), nframes, _current_gain, tgain);
} else if (tgain == GAIN_COEFF_ZERO) {
@@ -248,10 +248,10 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
}
_amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ());
- _amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (mixbufs, start_frame, end_frame, speed, nframes, true);
+ _amp->setup_gain_automation (start_sample, end_sample, nframes);
+ _amp->run (mixbufs, start_sample, end_sample, speed, nframes, true);
- _delayline->run (mixbufs, start_frame, end_frame, speed, nframes, true);
+ _delayline->run (mixbufs, start_sample, end_sample, speed, nframes, true);
/* consider metering */
@@ -259,7 +259,7 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
if (_amp->gain_control()->get_value() == GAIN_COEFF_ZERO) {
_meter->reset();
} else {
- _meter->run (mixbufs, start_frame, end_frame, speed, nframes, true);
+ _meter->run (mixbufs, start_sample, end_sample, speed, nframes, true);
}
}
diff --git a/libs/ardour/interpolation.cc b/libs/ardour/interpolation.cc
index 9eee53cc23..8d45c66a75 100644
--- a/libs/ardour/interpolation.cc
+++ b/libs/ardour/interpolation.cc
@@ -26,11 +26,11 @@
using namespace ARDOUR;
-framecnt_t
-LinearInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input, Sample *output)
+samplecnt_t
+LinearInterpolation::interpolate (int channel, samplecnt_t nframes, Sample *input, Sample *output)
{
// index in the input buffers
- framecnt_t i = 0;
+ samplecnt_t i = 0;
double acceleration = 0;
@@ -38,7 +38,7 @@ LinearInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input
acceleration = _target_speed - _speed;
}
- for (framecnt_t outsample = 0; outsample < nframes; ++outsample) {
+ for (samplecnt_t outsample = 0; outsample < nframes; ++outsample) {
double const d = phase[channel] + outsample * (_speed + acceleration);
i = floor(d);
Sample fractional_phase_part = d - i;
@@ -61,11 +61,11 @@ LinearInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input
return i;
}
-framecnt_t
-CubicInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input, Sample *output)
+samplecnt_t
+CubicInterpolation::interpolate (int channel, samplecnt_t nframes, Sample *input, Sample *output)
{
// index in the input buffers
- framecnt_t i = 0;
+ samplecnt_t i = 0;
double acceleration;
double distance = phase[channel];
@@ -97,7 +97,7 @@ CubicInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input,
*/
Sample inm1 = input[i] - (input[i+1] - input[i]);
- for (framecnt_t outsample = 0; outsample < nframes; ++outsample) {
+ for (samplecnt_t outsample = 0; outsample < nframes; ++outsample) {
/* get the index into the input we should start with */
i = floor (distance);
float fractional_phase_part = fmod (distance, 1.0);
@@ -121,7 +121,7 @@ CubicInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input,
/* used to calculate play-distance with acceleration (silent roll)
* (use same algorithm as real playback for identical rounding/floor'ing)
*/
- for (framecnt_t outsample = 0; outsample < nframes; ++outsample) {
+ for (samplecnt_t outsample = 0; outsample < nframes; ++outsample) {
distance += _speed + acceleration;
}
i = floor (distance);
@@ -134,12 +134,12 @@ CubicInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input,
/* CubicMidiInterpolation::distance is identical to
* return CubicInterpolation::interpolate (0, nframes, NULL, NULL);
*/
-framecnt_t
-CubicMidiInterpolation::distance (framecnt_t nframes, bool /*roll*/)
+samplecnt_t
+CubicMidiInterpolation::distance (samplecnt_t nframes, bool /*roll*/)
{
assert (phase.size () == 1);
- framecnt_t i = 0;
+ samplecnt_t i = 0;
double acceleration;
double distance = phase[0];
@@ -156,7 +156,7 @@ CubicMidiInterpolation::distance (framecnt_t nframes, bool /*roll*/)
acceleration = 0.0;
}
- for (framecnt_t outsample = 0; outsample < nframes; ++outsample) {
+ for (samplecnt_t outsample = 0; outsample < nframes; ++outsample) {
distance += _speed + acceleration;
}
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 5d1f39f968..90db95ad59 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -143,7 +143,7 @@ IO::increment_port_buffer_offset (pframes_t offset)
}
void
-IO::silence (framecnt_t nframes)
+IO::silence (samplecnt_t nframes)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
@@ -1216,11 +1216,11 @@ IO::apply_pretty_name ()
}
}
-framecnt_t
+samplecnt_t
IO::latency () const
{
- framecnt_t max_latency;
- framecnt_t latency;
+ samplecnt_t max_latency;
+ samplecnt_t latency;
max_latency = 0;
@@ -1604,7 +1604,7 @@ IO::connected_to (const string& str) const
* Caller must hold process lock.
*/
void
-IO::process_input (boost::shared_ptr<Processor> proc, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes)
+IO::process_input (boost::shared_ptr<Processor> proc, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes)
{
/* don't read the data into new buffers - just use the port buffers directly */
@@ -1615,7 +1615,7 @@ IO::process_input (boost::shared_ptr<Processor> proc, framepos_t start_frame, fr
_buffers.get_backend_port_addresses (_ports, nframes);
if (proc) {
- proc->run (_buffers, start_frame, end_frame, speed, nframes, true);
+ proc->run (_buffers, start_sample, end_sample, speed, nframes, true);
}
}
@@ -1648,7 +1648,7 @@ IO::collect_input (BufferSet& bufs, pframes_t nframes, ChanCount offset)
}
void
-IO::copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, framecnt_t offset)
+IO::copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, samplecnt_t offset)
{
PortSet::iterator o = _ports.begin(type);
BufferSet::iterator i = bufs.begin(type);
diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc
index ddd4ede1d8..85ae6f90f3 100644
--- a/libs/ardour/io_processor.cc
+++ b/libs/ardour/io_processor.cc
@@ -223,7 +223,7 @@ IOProcessor::set_state_2X (const XMLNode& node, int version)
}
void
-IOProcessor::silence (framecnt_t nframes, framepos_t /* start_frame */)
+IOProcessor::silence (samplecnt_t nframes, samplepos_t /* start_sample */)
{
if (_own_output && _output) {
_output->silence (nframes);
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 3100b0891f..570c5109ff 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -59,7 +59,7 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-LadspaPlugin::LadspaPlugin (string module_path, AudioEngine& e, Session& session, uint32_t index, framecnt_t rate)
+LadspaPlugin::LadspaPlugin (string module_path, AudioEngine& e, Session& session, uint32_t index, samplecnt_t rate)
: Plugin (e, session)
{
init (module_path, index, rate);
@@ -77,7 +77,7 @@ LadspaPlugin::LadspaPlugin (const LadspaPlugin &other)
}
void
-LadspaPlugin::init (string module_path, uint32_t index, framecnt_t rate)
+LadspaPlugin::init (string module_path, uint32_t index, samplecnt_t rate)
{
void* func;
LADSPA_Descriptor_Function dfunc;
@@ -469,7 +469,7 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des
if (LADSPA_IS_HINT_BOUNDED_BELOW(prh.HintDescriptor)) {
if (LADSPA_IS_HINT_SAMPLE_RATE(prh.HintDescriptor)) {
- desc.lower = prh.LowerBound * _session.frame_rate();
+ desc.lower = prh.LowerBound * _session.sample_rate();
} else {
desc.lower = prh.LowerBound;
}
@@ -480,7 +480,7 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des
if (LADSPA_IS_HINT_BOUNDED_ABOVE(prh.HintDescriptor)) {
if (LADSPA_IS_HINT_SAMPLE_RATE(prh.HintDescriptor)) {
- desc.upper = prh.UpperBound * _session.frame_rate();
+ desc.upper = prh.UpperBound * _session.sample_rate();
} else {
desc.upper = prh.UpperBound;
}
@@ -525,7 +525,7 @@ LadspaPlugin::describe_parameter (Evoral::Parameter which)
}
}
-ARDOUR::framecnt_t
+ARDOUR::samplecnt_t
LadspaPlugin::signal_latency () const
{
if (_user_latency) {
@@ -533,7 +533,7 @@ LadspaPlugin::signal_latency () const
}
if (_latency_control_port) {
- return (framecnt_t) floor (*_latency_control_port);
+ return (samplecnt_t) floor (*_latency_control_port);
} else {
return 0;
}
@@ -557,9 +557,9 @@ LadspaPlugin::automatable () const
int
LadspaPlugin::connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in_map, ChanMapping out_map,
- pframes_t nframes, framecnt_t offset)
+ pframes_t nframes, samplecnt_t offset)
{
Plugin::connect_and_run (bufs, start, end, speed, in_map, out_map, nframes, offset);
@@ -685,7 +685,7 @@ LadspaPlugin::latency_compute_run ()
uint32_t port_index = 0;
uint32_t in_index = 0;
uint32_t out_index = 0;
- const framecnt_t bufsize = 1024;
+ const samplecnt_t bufsize = 1024;
LADSPA_Data buffer[bufsize];
memset(buffer,0,sizeof(LADSPA_Data)*bufsize);
@@ -717,7 +717,7 @@ PluginPtr
LadspaPluginInfo::load (Session& session)
{
try {
- PluginPtr plugin (new LadspaPlugin (path, session.engine(), session, index, session.frame_rate()));
+ PluginPtr plugin (new LadspaPlugin (path, session.engine(), session, index, session.sample_rate()));
plugin->set_info(PluginInfoPtr(new LadspaPluginInfo(*this)));
return plugin;
}
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 3de9c562f3..04e36589ee 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -71,7 +71,7 @@ Location::Location (Session& s)
}
/** Construct a new Location, giving it the position lock style determined by glue-new-markers-to-bars-and-beats */
-Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end, const std::string &name, Flags bits, const uint32_t sub_num)
+Location::Location (Session& s, samplepos_t sample_start, samplepos_t sample_end, const std::string &name, Flags bits, const uint32_t sub_num)
: SessionHandleRef (s)
, _name (name)
, _start (sample_start)
@@ -81,7 +81,7 @@ Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end,
, _position_lock_style (s.config.get_glue_new_markers_to_bars_and_beats() ? MusicTime : AudioTime)
{
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
assert (_start >= 0);
assert (_end >= 0);
@@ -188,7 +188,7 @@ Location::set_name (const std::string& str)
* @param allow_beat_recompute True to recompute BEAT start time from the new given start time.
*/
int
-Location::set_start (framepos_t s, bool force, bool allow_beat_recompute, const uint32_t sub_num)
+Location::set_start (samplepos_t s, bool force, bool allow_beat_recompute, const uint32_t sub_num)
{
if (s < 0) {
return -1;
@@ -209,7 +209,7 @@ Location::set_start (framepos_t s, bool force, bool allow_beat_recompute, const
_start = s;
_end = s;
if (allow_beat_recompute) {
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
}
start_changed (this); /* EMIT SIGNAL */
@@ -239,11 +239,11 @@ Location::set_start (framepos_t s, bool force, bool allow_beat_recompute, const
if (s != _start) {
- framepos_t const old = _start;
+ samplepos_t const old = _start;
_start = s;
if (allow_beat_recompute) {
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
}
start_changed (this); /* EMIT SIGNAL */
StartChanged (); /* EMIT SIGNAL */
@@ -265,7 +265,7 @@ Location::set_start (framepos_t s, bool force, bool allow_beat_recompute, const
* @param allow_beat_recompute True to recompute BEAT end time from the new given end time.
*/
int
-Location::set_end (framepos_t e, bool force, bool allow_beat_recompute, const uint32_t sub_num)
+Location::set_end (samplepos_t e, bool force, bool allow_beat_recompute, const uint32_t sub_num)
{
if (e < 0) {
return -1;
@@ -286,7 +286,7 @@ Location::set_end (framepos_t e, bool force, bool allow_beat_recompute, const ui
_start = e;
_end = e;
if (allow_beat_recompute) {
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
}
//start_changed (this); /* EMIT SIGNAL */
//StartChanged (); /* EMIT SIGNAL */
@@ -307,11 +307,11 @@ Location::set_end (framepos_t e, bool force, bool allow_beat_recompute, const ui
if (e != _end) {
- framepos_t const old = _end;
+ samplepos_t const old = _end;
_end = e;
if (allow_beat_recompute) {
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
}
end_changed(this); /* EMIT SIGNAL */
@@ -328,7 +328,7 @@ Location::set_end (framepos_t e, bool force, bool allow_beat_recompute, const ui
}
int
-Location::set (framepos_t s, framepos_t e, bool allow_beat_recompute, const uint32_t sub_num)
+Location::set (samplepos_t s, samplepos_t e, bool allow_beat_recompute, const uint32_t sub_num)
{
if (s < 0 || e < 0) {
return -1;
@@ -349,7 +349,7 @@ Location::set (framepos_t s, framepos_t e, bool allow_beat_recompute, const uint
_end = s;
if (allow_beat_recompute) {
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
}
start_change = true;
@@ -368,11 +368,11 @@ Location::set (framepos_t s, framepos_t e, bool allow_beat_recompute, const uint
if (s != _start) {
- framepos_t const old = _start;
+ samplepos_t const old = _start;
_start = s;
if (allow_beat_recompute) {
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
}
start_change = true;
@@ -386,11 +386,11 @@ Location::set (framepos_t s, framepos_t e, bool allow_beat_recompute, const uint
if (e != _end) {
- framepos_t const old = _end;
+ samplepos_t const old = _end;
_end = e;
if (allow_beat_recompute) {
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
}
end_change = true;
@@ -418,7 +418,7 @@ Location::set (framepos_t s, framepos_t e, bool allow_beat_recompute, const uint
}
int
-Location::move_to (framepos_t pos, const uint32_t sub_num)
+Location::move_to (samplepos_t pos, const uint32_t sub_num)
{
if (pos < 0) {
return -1;
@@ -431,7 +431,7 @@ Location::move_to (framepos_t pos, const uint32_t sub_num)
if (_start != pos) {
_start = pos;
_end = _start + length();
- recompute_beat_from_frames (sub_num);
+ recompute_beat_from_samples (sub_num);
changed (this); /* EMIT SIGNAL */
Changed (); /* EMIT SIGNAL */
@@ -682,12 +682,12 @@ Location::set_state (const XMLNode& node, int version)
}
if (position_lock_style() == AudioTime) {
- recompute_beat_from_frames (0);
+ recompute_beat_from_samples (0);
} else{
/* music */
if (!node.get_property ("start-beat", _start_beat) ||
!node.get_property ("end-beat", _end_beat)) {
- recompute_beat_from_frames (0);
+ recompute_beat_from_samples (0);
}
}
@@ -711,7 +711,7 @@ Location::set_position_lock_style (PositionLockStyle ps)
_position_lock_style = ps;
if (ps == MusicTime) {
- recompute_beat_from_frames (0);
+ recompute_beat_from_samples (0);
}
position_lock_style_changed (this); /* EMIT SIGNAL */
@@ -719,21 +719,21 @@ Location::set_position_lock_style (PositionLockStyle ps)
}
void
-Location::recompute_beat_from_frames (const uint32_t sub_num)
+Location::recompute_beat_from_samples (const uint32_t sub_num)
{
- _start_beat = _session.tempo_map().exact_beat_at_frame (_start, sub_num);
- _end_beat = _session.tempo_map().exact_beat_at_frame (_end, sub_num);
+ _start_beat = _session.tempo_map().exact_beat_at_sample (_start, sub_num);
+ _end_beat = _session.tempo_map().exact_beat_at_sample (_end, sub_num);
}
void
-Location::recompute_frames_from_beat ()
+Location::recompute_samples_from_beat ()
{
if (_position_lock_style != MusicTime) {
return;
}
TempoMap& map (_session.tempo_map());
- set (map.frame_at_beat (_start_beat), map.frame_at_beat (_end_beat), false);
+ set (map.sample_at_beat (_start_beat), map.sample_at_beat (_end_beat), false);
}
void
@@ -1176,7 +1176,7 @@ Locations::set_state (const XMLNode& node, int version)
}
-typedef std::pair<framepos_t,Location*> LocationPair;
+typedef std::pair<samplepos_t,Location*> LocationPair;
struct LocationStartEarlierComparison
{
@@ -1192,8 +1192,8 @@ struct LocationStartLaterComparison
}
};
-framepos_t
-Locations::first_mark_before (framepos_t frame, bool include_special_ranges)
+samplepos_t
+Locations::first_mark_before (samplepos_t sample, bool include_special_ranges)
{
Glib::Threads::Mutex::Lock lm (lock);
vector<LocationPair> locs;
@@ -1217,7 +1217,7 @@ Locations::first_mark_before (framepos_t frame, bool include_special_ranges)
if (!include_special_ranges && ((*i).second->is_auto_loop() || (*i).second->is_auto_punch())) {
continue;
}
- if ((*i).first < frame) {
+ if ((*i).first < sample) {
return (*i).first;
}
}
@@ -1226,12 +1226,12 @@ Locations::first_mark_before (framepos_t frame, bool include_special_ranges)
}
Location*
-Locations::mark_at (framepos_t pos, framecnt_t slop) const
+Locations::mark_at (samplepos_t pos, samplecnt_t slop) const
{
Glib::Threads::Mutex::Lock lm (lock);
Location* closest = 0;
- frameoffset_t mindelta = max_framepos;
- frameoffset_t delta;
+ sampleoffset_t mindelta = max_samplepos;
+ sampleoffset_t delta;
/* locations are not necessarily stored in linear time order so we have
* to iterate across all of them to find the one closest to a give point.
@@ -1263,8 +1263,8 @@ Locations::mark_at (framepos_t pos, framecnt_t slop) const
return closest;
}
-framepos_t
-Locations::first_mark_after (framepos_t frame, bool include_special_ranges)
+samplepos_t
+Locations::first_mark_after (samplepos_t sample, bool include_special_ranges)
{
Glib::Threads::Mutex::Lock lm (lock);
vector<LocationPair> locs;
@@ -1288,7 +1288,7 @@ Locations::first_mark_after (framepos_t frame, bool include_special_ranges)
if (!include_special_ranges && ((*i).second->is_auto_loop() || (*i).second->is_auto_punch())) {
continue;
}
- if ((*i).first > frame) {
+ if ((*i).first > sample) {
return (*i).first;
}
}
@@ -1297,16 +1297,16 @@ Locations::first_mark_after (framepos_t frame, bool include_special_ranges)
}
/** Look for the `marks' (either locations which are marks, or start/end points of range markers) either
- * side of a frame. Note that if frame is exactly on a `mark', that mark will not be considered for returning
+ * side of a sample. Note that if sample is exactly on a `mark', that mark will not be considered for returning
* as before/after.
- * @param frame Frame to look for.
- * @param before Filled in with the position of the last `mark' before `frame' (or max_framepos if none exists)
- * @param after Filled in with the position of the next `mark' after `frame' (or max_framepos if none exists)
+ * @param sample Frame to look for.
+ * @param before Filled in with the position of the last `mark' before `sample' (or max_samplepos if none exists)
+ * @param after Filled in with the position of the next `mark' after `sample' (or max_samplepos if none exists)
*/
void
-Locations::marks_either_side (framepos_t const frame, framepos_t& before, framepos_t& after) const
+Locations::marks_either_side (samplepos_t const sample, samplepos_t& before, samplepos_t& after) const
{
- before = after = max_framepos;
+ before = after = max_samplepos;
LocationList locs;
@@ -1317,7 +1317,7 @@ Locations::marks_either_side (framepos_t const frame, framepos_t& before, framep
/* Get a list of positions; don't store any that are exactly on our requested position */
- std::list<framepos_t> positions;
+ std::list<samplepos_t> positions;
for (LocationList::const_iterator i = locs.begin(); i != locs.end(); ++i) {
if (((*i)->is_auto_loop() || (*i)->is_auto_punch())) {
@@ -1326,14 +1326,14 @@ Locations::marks_either_side (framepos_t const frame, framepos_t& before, framep
if (!(*i)->is_hidden()) {
if ((*i)->is_mark ()) {
- if ((*i)->start() != frame) {
+ if ((*i)->start() != sample) {
positions.push_back ((*i)->start ());
}
} else {
- if ((*i)->start() != frame) {
+ if ((*i)->start() != sample) {
positions.push_back ((*i)->start ());
}
- if ((*i)->end() != frame) {
+ if ((*i)->end() != sample) {
positions.push_back ((*i)->end ());
}
}
@@ -1346,8 +1346,8 @@ Locations::marks_either_side (framepos_t const frame, framepos_t& before, framep
positions.sort ();
- std::list<framepos_t>::iterator i = positions.begin ();
- while (i != positions.end () && *i < frame) {
+ std::list<samplepos_t>::iterator i = positions.begin ();
+ while (i != positions.end () && *i < sample) {
++i;
}
@@ -1426,7 +1426,7 @@ Locations::get_location_by_id(PBD::ID id)
}
void
-Locations::find_all_between (framepos_t start, framepos_t end, LocationList& ll, Location::Flags flags)
+Locations::find_all_between (samplepos_t start, samplepos_t end, LocationList& ll, Location::Flags flags)
{
Glib::Threads::Mutex::Lock lm (lock);
diff --git a/libs/ardour/location_importer.cc b/libs/ardour/location_importer.cc
index 87c304ff9e..b209e5f63f 100644
--- a/libs/ardour/location_importer.cc
+++ b/libs/ardour/location_importer.cc
@@ -104,7 +104,7 @@ LocationImporter::~LocationImporter ()
string
LocationImporter::get_info () const
{
- framepos_t start, end;
+ samplepos_t start, end;
Timecode::Time start_time, end_time;
// Get sample positions
diff --git a/libs/ardour/ltc_slave.cc b/libs/ardour/ltc_slave.cc
index fe188533e7..a25eb41dd3 100644
--- a/libs/ardour/ltc_slave.cc
+++ b/libs/ardour/ltc_slave.cc
@@ -40,12 +40,12 @@ using namespace MIDI;
using namespace PBD;
using namespace Timecode;
-#define FLYWHEEL_TIMEOUT ( 1 * session.frame_rate() )
+#define FLYWHEEL_TIMEOUT ( 1 * session.sample_rate() )
LTC_Slave::LTC_Slave (Session& s)
: session (s)
{
- frames_per_ltc_frame = session.samples_per_timecode_frame();
+ samples_per_ltc_frame = session.samples_per_timecode_frame();
timecode.rate = session.timecode_frames_per_second();
timecode.drop = session.timecode_drop_frames();
@@ -59,9 +59,9 @@ LTC_Slave::LTC_Slave (Session& s)
a3e_timecode = session.config.get_timecode_format();
printed_timecode_warning = false;
ltc_detect_fps_cnt = ltc_detect_fps_max = 0;
- memset(&prev_frame, 0, sizeof(LTCFrameExt));
+ memset(&prev_sample, 0, sizeof(LTCFrameExt));
- decoder = ltc_decoder_create((int) frames_per_ltc_frame, 128 /*queue size*/);
+ decoder = ltc_decoder_create((int) samples_per_ltc_frame, 128 /*queue size*/);
session.config.ParameterChanged.connect_same_thread (config_connection, boost::bind (&LTC_Slave::parameter_changed, this, _1));
parse_timecode_offset();
@@ -103,10 +103,10 @@ LTC_Slave::parameter_changed (std::string const & p)
}
}
-ARDOUR::framecnt_t
+ARDOUR::samplecnt_t
LTC_Slave::resolution () const
{
- return (framecnt_t) (session.frame_rate() / 1000);
+ return (samplecnt_t) (session.sample_rate() / 1000);
}
bool
@@ -159,7 +159,7 @@ LTC_Slave::reset (bool with_ts)
}
void
-LTC_Slave::parse_ltc(const ARDOUR::pframes_t nframes, const Sample* const in, const ARDOUR::framecnt_t posinfo)
+LTC_Slave::parse_ltc(const ARDOUR::pframes_t nframes, const Sample* const in, const ARDOUR::samplecnt_t posinfo)
{
pframes_t i;
unsigned char sound[8192];
@@ -179,7 +179,7 @@ LTC_Slave::parse_ltc(const ARDOUR::pframes_t nframes, const Sample* const in, co
}
bool
-LTC_Slave::equal_ltc_frame_time(LTCFrame *a, LTCFrame *b) {
+LTC_Slave::equal_ltc_sample_time(LTCFrame *a, LTCFrame *b) {
if ( a->frame_units != b->frame_units
|| a->frame_tens != b->frame_tens
|| a->dfbit != b->dfbit
@@ -196,27 +196,27 @@ LTC_Slave::equal_ltc_frame_time(LTCFrame *a, LTCFrame *b) {
}
bool
-LTC_Slave::detect_discontinuity(LTCFrameExt *frame, int fps, bool fuzzy) {
+LTC_Slave::detect_discontinuity(LTCFrameExt *sample, int fps, bool fuzzy) {
bool discontinuity_detected = false;
if (fuzzy && (
- ( frame->reverse && prev_frame.ltc.frame_units == 0)
- ||(!frame->reverse && frame->ltc.frame_units == 0)
+ ( sample->reverse && prev_sample.ltc.frame_units == 0)
+ ||(!sample->reverse && sample->ltc.frame_units == 0)
)) {
- memcpy(&prev_frame, frame, sizeof(LTCFrameExt));
+ memcpy(&prev_sample, sample, sizeof(LTCFrameExt));
return false;
}
- if (frame->reverse) {
- ltc_frame_decrement(&prev_frame.ltc, fps, LTC_TV_525_60, 0);
+ if (sample->reverse) {
+ ltc_frame_decrement(&prev_sample.ltc, fps, LTC_TV_525_60, 0);
} else {
- ltc_frame_increment(&prev_frame.ltc, fps, LTC_TV_525_60, 0);
+ ltc_frame_increment(&prev_sample.ltc, fps, LTC_TV_525_60, 0);
}
- if (!equal_ltc_frame_time(&prev_frame.ltc, &frame->ltc)) {
+ if (!equal_ltc_sample_time(&prev_sample.ltc, &sample->ltc)) {
discontinuity_detected = true;
}
- memcpy(&prev_frame, frame, sizeof(LTCFrameExt));
+ memcpy(&prev_sample, sample, sizeof(LTCFrameExt));
return discontinuity_detected;
}
@@ -256,9 +256,9 @@ LTC_Slave::detect_ltc_fps(int frameno, bool df)
if (detected_fps != 0 && (detected_fps != timecode.rate || df != timecode.drop)) {
timecode.rate = detected_fps;
timecode.drop = df;
- frames_per_ltc_frame = double(session.frame_rate()) / timecode.rate;
- DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC reset to FPS: %1%2 ; audio-frames per LTC: %3\n",
- detected_fps, df?"df":"ndf", frames_per_ltc_frame));
+ samples_per_ltc_frame = double(session.sample_rate()) / timecode.rate;
+ DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC reset to FPS: %1%2 ; audio-samples per LTC: %3\n",
+ detected_fps, df?"df":"ndf", samples_per_ltc_frame));
fps_changed=true;
}
@@ -303,26 +303,26 @@ LTC_Slave::detect_ltc_fps(int frameno, bool df)
}
void
-LTC_Slave::process_ltc(framepos_t const /*now*/)
+LTC_Slave::process_ltc(samplepos_t const /*now*/)
{
- LTCFrameExt frame;
+ LTCFrameExt sample;
enum LTC_TV_STANDARD tv_standard = LTC_TV_625_50;
- while (ltc_decoder_read(decoder, &frame)) {
+ while (ltc_decoder_read(decoder, &sample)) {
SMPTETimecode stime;
- ltc_frame_to_time(&stime, &frame.ltc, 0);
+ ltc_frame_to_time(&stime, &sample.ltc, 0);
timecode.negative = false;
timecode.subframes = 0;
/* set timecode.rate and timecode.drop: */
- bool ltc_is_static = equal_ltc_frame_time(&prev_frame.ltc, &frame.ltc);
+ bool ltc_is_static = equal_ltc_sample_time(&prev_sample.ltc, &sample.ltc);
- if (detect_discontinuity(&frame, ceil(timecode.rate), !fps_detected)) {
+ if (detect_discontinuity(&sample, ceil(timecode.rate), !fps_detected)) {
if (fps_detected) { ltc_detect_fps_cnt = ltc_detect_fps_max = 0; }
fps_detected=false;
}
- if (!ltc_is_static && detect_ltc_fps(stime.frame, (frame.ltc.dfbit)? true : false)) {
+ if (!ltc_is_static && detect_ltc_fps(stime.frame, (sample.ltc.dfbit)? true : false)) {
reset();
fps_detected=true;
}
@@ -332,18 +332,18 @@ LTC_Slave::process_ltc(framepos_t const /*now*/)
stime.hours,
stime.mins,
stime.secs,
- (frame.ltc.dfbit) ? '.' : ':',
+ (sample.ltc.dfbit) ? '.' : ':',
stime.frame,
- frame.off_start,
- frame.off_end,
- frame.reverse ? " R" : " "
+ sample.off_start,
+ sample.off_end,
+ sample.reverse ? " R" : " "
);
#endif
- /* when a full LTC frame is decoded, the timecode the LTC frame
+ /* when a full LTC sample is decoded, the timecode the LTC sample
* is referring has just passed.
* So we send the _next_ timecode which
- * is expected to start at the end of the current frame
+ * is expected to start at the end of the current sample
*/
int fps_i = ceil(timecode.rate);
@@ -363,17 +363,17 @@ LTC_Slave::process_ltc(framepos_t const /*now*/)
break;
}
- if (!frame.reverse) {
- ltc_frame_increment(&frame.ltc, fps_i, tv_standard, 0);
- ltc_frame_to_time(&stime, &frame.ltc, 0);
+ if (!sample.reverse) {
+ ltc_frame_increment(&sample.ltc, fps_i, tv_standard, 0);
+ ltc_frame_to_time(&stime, &sample.ltc, 0);
transport_direction = 1;
- frame.off_start -= ltc_frame_alignment(session.samples_per_timecode_frame(), tv_standard);
- frame.off_end -= ltc_frame_alignment(session.samples_per_timecode_frame(), tv_standard);
+ sample.off_start -= ltc_frame_alignment(session.samples_per_timecode_frame(), tv_standard);
+ sample.off_end -= ltc_frame_alignment(session.samples_per_timecode_frame(), tv_standard);
} else {
- ltc_frame_decrement(&frame.ltc, fps_i, tv_standard, 0);
- int off = frame.off_end - frame.off_start;
- frame.off_start += off - ltc_frame_alignment(session.samples_per_timecode_frame(), tv_standard);
- frame.off_end += off - ltc_frame_alignment(session.samples_per_timecode_frame(), tv_standard);
+ ltc_frame_decrement(&sample.ltc, fps_i, tv_standard, 0);
+ int off = sample.off_end - sample.off_start;
+ sample.off_start += off - ltc_frame_alignment(session.samples_per_timecode_frame(), tv_standard);
+ sample.off_end += off - ltc_frame_alignment(session.samples_per_timecode_frame(), tv_standard);
transport_direction = -1;
}
@@ -383,21 +383,21 @@ LTC_Slave::process_ltc(framepos_t const /*now*/)
timecode.frames = stime.frame;
/* map LTC timecode to session TC setting */
- framepos_t ltc_frame; ///< audio-frame corresponding to LTC frame
+ samplepos_t ltc_frame; ///< audio-sample corresponding to LTC sample
Timecode::timecode_to_sample (timecode, ltc_frame, true, false,
- double(session.frame_rate()),
+ double(session.sample_rate()),
session.config.get_subframes_per_frame(),
timecode_negative_offset, timecode_offset
);
ltc_frame += ltc_slave_latency.max + session.worst_playback_latency();
- framepos_t cur_timestamp = frame.off_end + 1;
- DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC F: %1 LF: %2 N: %3 L: %4\n", ltc_frame, last_ltc_frame, cur_timestamp, last_timestamp));
- if (frame.off_end + 1 <= last_timestamp || last_timestamp == 0) {
+ samplepos_t cur_timestamp = sample.off_end + 1;
+ DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC F: %1 LF: %2 N: %3 L: %4\n", ltc_frame, last_ltc_sample, cur_timestamp, last_timestamp));
+ if (sample.off_end + 1 <= last_timestamp || last_timestamp == 0) {
DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC speed: UNCHANGED: %1\n", ltc_speed));
} else {
- ltc_speed = double(ltc_frame - last_ltc_frame) / double(cur_timestamp - last_timestamp);
+ ltc_speed = double(ltc_frame - last_ltc_sample) / double(cur_timestamp - last_timestamp);
DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC speed: %1\n", ltc_speed));
}
@@ -405,15 +405,15 @@ LTC_Slave::process_ltc(framepos_t const /*now*/)
ltc_speed = 0;
}
- last_timestamp = frame.off_end + 1;
- last_ltc_frame = ltc_frame;
- } /* end foreach decoded LTC frame */
+ last_timestamp = sample.off_end + 1;
+ last_ltc_sample = ltc_frame;
+ } /* end foreach decoded LTC sample */
}
void
-LTC_Slave::init_engine_dll (framepos_t pos, int32_t inc)
+LTC_Slave::init_engine_dll (samplepos_t pos, int32_t inc)
{
- double omega = 2.0 * M_PI * double(inc) / double(session.frame_rate());
+ double omega = 2.0 * M_PI * double(inc) / double(session.sample_rate());
b = 1.4142135623730950488 * omega;
c = omega * omega;
@@ -428,12 +428,12 @@ LTC_Slave::init_engine_dll (framepos_t pos, int32_t inc)
* so it is OK to use get_buffer()
*/
bool
-LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
+LTC_Slave::speed_and_position (double& speed, samplepos_t& pos)
{
bool engine_init_called = false;
- framepos_t now = session.engine().sample_time_at_cycle_start();
- framepos_t sess_pos = session.transport_frame(); // corresponds to now
- framecnt_t nframes = session.engine().samples_per_cycle();
+ samplepos_t now = session.engine().sample_time_at_cycle_start();
+ samplepos_t sess_pos = session.transport_sample(); // corresponds to now
+ samplecnt_t nframes = session.engine().samples_per_cycle();
Sample* in;
@@ -441,7 +441,7 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
in = (Sample*) AudioEngine::instance()->port_engine().get_buffer (ltcport->port_handle(), nframes);
- frameoffset_t skip = now - (monotonic_cnt + nframes);
+ sampleoffset_t skip = now - (monotonic_cnt + nframes);
monotonic_cnt = now;
DEBUG_TRACE (DEBUG::LTC, string_compose ("speed_and_position - TID:%1 | latency: %2 | skip %3\n", pthread_name(), ltc_slave_latency.max, skip));
@@ -453,7 +453,7 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
ActiveChanged (true); /* EMIT SIGNAL */
engine_dll_initstate = transport_direction;
- init_engine_dll(last_ltc_frame + rint(ltc_speed * double(2 * nframes + now - last_timestamp)),
+ init_engine_dll(last_ltc_sample + rint(ltc_speed * double(2 * nframes + now - last_timestamp)),
session.engine().samples_per_cycle());
engine_init_called = true;
}
@@ -461,18 +461,18 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
if (in) {
DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC Process eng-tme: %1 eng-pos: %2\n", now, sess_pos));
/* when the jack-graph changes and if ardour performs
- * locates, the audioengine is stopped (skipping frames) while
+ * locates, the audioengine is stopped (skipping samples) while
* jack [time] moves along.
*/
if (skip > 0) {
- DEBUG_TRACE (DEBUG::LTC, string_compose("engine skipped %1 frames. Feeding silence to LTC parser.\n", skip));
+ DEBUG_TRACE (DEBUG::LTC, string_compose("engine skipped %1 samples. Feeding silence to LTC parser.\n", skip));
if (skip >= 8192) skip = 8192;
unsigned char sound[8192];
memset(sound, 0x80, sizeof(char) * skip);
ltc_decoder_write(decoder, sound, nframes, now);
} else if (skip != 0) {
/* this should never happen. it may if monotonic_cnt, now overflow on 64bit */
- DEBUG_TRACE (DEBUG::LTC, string_compose("engine skipped %1 frames\n", skip));
+ DEBUG_TRACE (DEBUG::LTC, string_compose("engine skipped %1 samples\n", skip));
reset();
}
@@ -483,7 +483,7 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
if (last_timestamp == 0) {
DEBUG_TRACE (DEBUG::LTC, "last timestamp == 0\n");
speed = 0;
- pos = session.transport_frame();
+ pos = session.transport_sample();
return true;
} else if (ltc_speed != 0) {
if (delayedlocked > 1) delayedlocked--;
@@ -494,7 +494,7 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
DEBUG_TRACE (DEBUG::LTC, "flywheel timeout\n");
reset();
speed = 0;
- pos = session.transport_frame();
+ pos = session.transport_sample();
ActiveChanged (false); /* EMIT SIGNAL */
return true;
}
@@ -510,7 +510,7 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
* DEBUG::Transport: realtime stop @ NNN
* DEBUG::Transport: Butler transport work, todo = PostTransportStop,PostTransportLocate,PostTransportClearSubstate
*
- * [engine skips frames to locate, jack time keeps rolling on]
+ * [engine skips samples to locate, jack time keeps rolling on]
*
* the second cycle:
*
@@ -523,16 +523,16 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
if (engine_dll_initstate == 0) {
DEBUG_TRACE (DEBUG::LTC, "engine DLL not initialized. ltc_speed\n");
speed = 0;
- pos = last_ltc_frame + rint(ltc_speed * double(2 * nframes + now - last_timestamp));
+ pos = last_ltc_sample + rint(ltc_speed * double(2 * nframes + now - last_timestamp));
return true;
}
- /* interpolate position according to speed and time since last LTC-frame*/
+ /* interpolate position according to speed and time since last LTC-sample*/
double speed_flt = ltc_speed;
double elapsed = (now - last_timestamp) * speed_flt;
if (!engine_init_called) {
- const double e = elapsed + double (last_ltc_frame - sess_pos);
+ const double e = elapsed + double (last_ltc_sample - sess_pos);
t0 = t1;
t1 += b * e + e2;
e2 += c * e;
@@ -544,11 +544,11 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
elapsed += 2.0 * nframes * ltc_speed; /* see note above */
}
- pos = last_ltc_frame + rint(elapsed);
+ pos = last_ltc_sample + rint(elapsed);
speed = speed_flt;
current_delta = (pos - sess_pos);
- if (((pos < 0) || (labs(current_delta) > 2 * session.frame_rate()))) {
+ if (((pos < 0) || (labs(current_delta) > 2 * session.sample_rate()))) {
DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC large drift: %1\n", current_delta));
reset();
speed = 0;
@@ -556,7 +556,7 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
}
DEBUG_TRACE (DEBUG::LTC, string_compose ("LTCsync spd: %1 pos: %2 | last-pos: %3 elapsed: %4 delta: %5\n",
- speed, pos, last_ltc_frame, elapsed, current_delta));
+ speed, pos, last_ltc_sample, elapsed, current_delta));
/* provide a .1% deadzone to lock the speed */
if (fabs(speed - 1.0) <= 0.001) {
@@ -583,7 +583,7 @@ LTC_Slave::apparent_timecode_format () const
else if (rint(timecode.rate * 100) == 2997 && timecode.drop)
return (Config->get_timecode_source_2997() ? timecode_2997000drop : timecode_2997drop);
else if (timecode.rate == 30 && timecode.drop)
- return timecode_2997drop; // timecode_30drop; // LTC counting to 30 frames w/DF *means* 29.97 df
+ return timecode_2997drop; // timecode_30drop; // LTC counting to 30 samples w/DF *means* 29.97 df
else if (timecode.rate == 30 && !timecode.drop)
return timecode_30;
@@ -606,7 +606,7 @@ LTC_Slave::approximate_current_delta() const
char delta[80];
if (last_timestamp == 0 || engine_dll_initstate == 0) {
snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012");
- } else if ((monotonic_cnt - last_timestamp) > 2 * frames_per_ltc_frame) {
+ } else if ((monotonic_cnt - last_timestamp) > 2 * samples_per_ltc_frame) {
snprintf(delta, sizeof(delta), "%s", _("flywheel"));
} else {
snprintf(delta, sizeof(delta), "\u0394<span foreground=\"%s\" face=\"monospace\" >%s%s%lld</span>sm",
diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc
index 98de768760..edfbfd44fa 100644
--- a/libs/ardour/lua_api.cc
+++ b/libs/ardour/lua_api.cc
@@ -343,7 +343,7 @@ ARDOUR::LuaAPI::sample_to_timecode_lua (lua_State *L)
sample, timecode, false, false,
s->timecode_frames_per_second (),
s->timecode_drop_frames (),
- s->frame_rate (),
+ s->sample_rate (),
0, false, 0);
luabridge::Stack<uint32_t>::push (L, timecode.hours);
@@ -379,7 +379,7 @@ ARDOUR::LuaAPI::timecode_to_sample_lua (lua_State *L)
Timecode::timecode_to_sample (
timecode, sample, false, false,
- s->frame_rate (),
+ s->sample_rate (),
0, false, 0);
luabridge::Stack<int64_t>::push (L, sample);
@@ -774,12 +774,12 @@ LuaAPI::Vamp::analyze (boost::shared_ptr<ARDOUR::Readable> r, uint32_t channel,
float* data = new float[_bufsize];
float* bufs[1] = { data };
- framecnt_t len = r->readable_length();
- framepos_t pos = 0;
+ samplecnt_t len = r->readable_length();
+ samplepos_t pos = 0;
int rv = 0;
while (1) {
- framecnt_t to_read = std::min ((len - pos), _bufsize);
+ samplecnt_t to_read = std::min ((len - pos), _bufsize);
if (r->read (data, pos, to_read, channel) != to_read) {
rv = -1;
break;
diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc
index a4ebf1427f..30beb08514 100644
--- a/libs/ardour/luabindings.cc
+++ b/libs/ardour/luabindings.cc
@@ -35,7 +35,7 @@
#include "ardour/audio_track.h"
#include "ardour/audioplaylist.h"
#include "ardour/buffer_set.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/chan_mapping.h"
#include "ardour/dB.h"
#include "ardour/dsp_filter.h"
@@ -170,8 +170,8 @@ CLASSKEYS(Selectable*);
CLASSKEYS(std::list<Selectable*>);
CLASSKEYS(ARDOUR::AudioEngine);
-CLASSKEYS(ARDOUR::BeatsFramesConverter);
-CLASSKEYS(ARDOUR::DoubleBeatsFramesConverter);
+CLASSKEYS(ARDOUR::BeatsSamplesConverter);
+CLASSKEYS(ARDOUR::DoubleBeatsSamplesConverter);
CLASSKEYS(ARDOUR::BufferSet);
CLASSKEYS(ARDOUR::ChanCount);
CLASSKEYS(ARDOUR::ChanMapping);
@@ -207,7 +207,7 @@ CLASSKEYS(PBD::PropertyChange);
CLASSKEYS(PBD::StatefulDestructible);
CLASSKEYS(Evoral::Beats);
-CLASSKEYS(Evoral::Event<framepos_t>);
+CLASSKEYS(Evoral::Event<samplepos_t>);
CLASSKEYS(Evoral::ControlEvent);
@@ -347,7 +347,7 @@ LuaBindings::stddef (lua_State* L)
.beginStdVector <float*> ("FloatArrayVector")
.endClass ()
- // framepos_t, frameoffset_t lists e.g. AnalysisFeatureList
+ // samplepos_t, sampleoffset_t lists e.g. AnalysisFeatureList
.beginStdList <int64_t> ("Int64List")
.endClass ()
@@ -508,12 +508,12 @@ LuaBindings::common (lua_State* L)
luabridge::getGlobalNamespace (L)
.beginNamespace ("Evoral")
- .beginClass <Evoral::Event<framepos_t> > ("Event")
- .addFunction ("clear", &Evoral::Event<framepos_t>::clear)
- .addFunction ("size", &Evoral::Event<framepos_t>::size)
- .addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_buffer)
- .addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
- .addFunction ("time", (framepos_t (Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::time)
+ .beginClass <Evoral::Event<samplepos_t> > ("Event")
+ .addFunction ("clear", &Evoral::Event<samplepos_t>::clear)
+ .addFunction ("size", &Evoral::Event<samplepos_t>::size)
+ .addFunction ("set_buffer", &Evoral::Event<samplepos_t>::set_buffer)
+ .addFunction ("buffer", (uint8_t*(Evoral::Event<samplepos_t>::*)())&Evoral::Event<samplepos_t>::buffer)
+ .addFunction ("time", (samplepos_t (Evoral::Event<samplepos_t>::*)())&Evoral::Event<samplepos_t>::time)
.endClass ()
.beginClass <Evoral::Beats> ("Beats")
@@ -564,10 +564,10 @@ LuaBindings::common (lua_State* L)
.addData ("logarithmic", &Evoral::ParameterDescriptor::logarithmic)
.endClass ()
- .beginClass <Evoral::Range<framepos_t> > ("Range")
- .addConstructor <void (*) (framepos_t, framepos_t)> ()
- .addData ("from", &Evoral::Range<framepos_t>::from)
- .addData ("to", &Evoral::Range<framepos_t>::to)
+ .beginClass <Evoral::Range<samplepos_t> > ("Range")
+ .addConstructor <void (*) (samplepos_t, samplepos_t)> ()
+ .addData ("from", &Evoral::Range<samplepos_t>::from)
+ .addData ("to", &Evoral::Range<samplepos_t>::to)
.endClass ()
.deriveWSPtrClass <Evoral::Sequence<Evoral::Beats>, Evoral::ControlSet> ("Sequence")
@@ -722,15 +722,15 @@ LuaBindings::common (lua_State* L)
.beginClass <Progress> ("Progress")
.endClass ()
- .beginClass <MusicFrame> ("MusicFrame")
- .addConstructor <void (*) (framepos_t, int32_t)> ()
- .addFunction ("set", &MusicFrame::set)
- .addData ("frame", &MusicFrame::frame)
- .addData ("division", &MusicFrame::division)
+ .beginClass <MusicSample> ("MusicSample")
+ .addConstructor <void (*) (samplepos_t, int32_t)> ()
+ .addFunction ("set", &MusicSample::set)
+ .addData ("frame", &MusicSample::sample)
+ .addData ("division", &MusicSample::division)
.endClass ()
.beginClass <AudioRange> ("AudioRange")
- .addConstructor <void (*) (framepos_t, framepos_t, uint32_t)> ()
+ .addConstructor <void (*) (samplepos_t, samplepos_t, uint32_t)> ()
.addFunction ("length", &AudioRange::length)
.addFunction ("equal", &AudioRange::equal)
.addData ("start", &AudioRange::start)
@@ -772,7 +772,7 @@ LuaBindings::common (lua_State* L)
// templated class definitions
.beginClass <PBD::PropertyDescriptor<bool> > ("BoolProperty").endClass ()
.beginClass <PBD::PropertyDescriptor<float> > ("FloatProperty").endClass ()
- .beginClass <PBD::PropertyDescriptor<framepos_t> > ("FrameposProperty").endClass ()
+ .beginClass <PBD::PropertyDescriptor<samplepos_t> > ("FrameposProperty").endClass ()
// actual references (TODO: also expose GQuark for std::set)
// ardour/region.h
.addConst ("Start", &ARDOUR::Properties::start)
@@ -787,7 +787,7 @@ LuaBindings::common (lua_State* L)
// expand templated PropertyDescriptor<T>
.addFunction ("containsBool", &PBD::PropertyChange::contains<bool>)
.addFunction ("containsFloat", &PBD::PropertyChange::contains<float>)
- .addFunction ("containsFramePos", &PBD::PropertyChange::contains<framepos_t>)
+ .addFunction ("containsFramePos", &PBD::PropertyChange::contains<samplepos_t>)
.endClass ()
.beginClass <PBD::PropertyList> ("PropertyList")
@@ -1067,7 +1067,7 @@ LuaBindings::common (lua_State* L)
.addFunction ("region_by_id", &Playlist::region_by_id)
.addFunction ("data_type", &Playlist::data_type)
.addFunction ("n_regions", &Playlist::n_regions)
- //.addFunction ("get_extent", &Playlist::get_extent) // pair<framepos_t, framepos_t>
+ //.addFunction ("get_extent", &Playlist::get_extent) // pair<samplepos_t, samplepos_t>
.addFunction ("region_list", &Playlist::region_list)
.addFunction ("add_region", &Playlist::add_region)
.addFunction ("remove_region", &Playlist::remove_region)
@@ -1085,13 +1085,13 @@ LuaBindings::common (lua_State* L)
.addFunction ("lower_region", &Playlist::lower_region)
.addFunction ("raise_region_to_top", &Playlist::raise_region_to_top)
.addFunction ("lower_region_to_bottom", &Playlist::lower_region_to_bottom)
- .addFunction ("duplicate", (void (Playlist::*)(boost::shared_ptr<Region>, framepos_t, framecnt_t, float))&Playlist::duplicate)
+ .addFunction ("duplicate", (void (Playlist::*)(boost::shared_ptr<Region>, samplepos_t, samplecnt_t, float))&Playlist::duplicate)
.addFunction ("duplicate_until", &Playlist::duplicate_until)
.addFunction ("duplicate_range", &Playlist::duplicate_range)
.addFunction ("combine", &Playlist::combine)
.addFunction ("uncombine", &Playlist::uncombine)
.addFunction ("split_region", &Playlist::split_region)
- .addFunction ("split", (void (Playlist::*)(framepos_t))&Playlist::split)
+ .addFunction ("split", (void (Playlist::*)(samplepos_t))&Playlist::split)
.addFunction ("cut", (boost::shared_ptr<Playlist> (Playlist::*)(std::list<AudioRange>&, bool))&Playlist::cut)
#if 0
.addFunction ("copy", &Playlist::copy)
@@ -1602,41 +1602,41 @@ LuaBindings::common (lua_State* L)
.addFunction ("note_type", &Tempo::note_type)
.addFunction ("note_types_per_minute", (double (Tempo::*)() const)&Tempo::note_types_per_minute)
.addFunction ("quarter_notes_per_minute", &Tempo::quarter_notes_per_minute)
- .addFunction ("frames_per_quarter_note", &Tempo::frames_per_quarter_note)
- .addFunction ("frames_per_note_type", &Tempo::frames_per_note_type)
+ .addFunction ("samples_per_quarter_note", &Tempo::samples_per_quarter_note)
+ .addFunction ("samples_per_note_type", &Tempo::samples_per_note_type)
.endClass ()
.beginClass <Meter> ("Meter")
.addConstructor <void (*) (double, double)> ()
.addFunction ("divisions_per_bar", &Meter::divisions_per_bar)
.addFunction ("note_divisor", &Meter::note_divisor)
- .addFunction ("frames_per_bar", &Meter::frames_per_bar)
- .addFunction ("frames_per_grid", &Meter::frames_per_grid)
+ .addFunction ("samples_per_bar", &Meter::samples_per_bar)
+ .addFunction ("samples_per_grid", &Meter::samples_per_grid)
.endClass ()
- .beginClass <BeatsFramesConverter> ("BeatsFramesConverter")
- .addConstructor <void (*) (const TempoMap&, framepos_t)> ()
- .addFunction ("to", &BeatsFramesConverter::to)
- .addFunction ("from", &BeatsFramesConverter::from)
+ .beginClass <BeatsSamplesConverter> ("BeatsSamplesConverter")
+ .addConstructor <void (*) (const TempoMap&, samplepos_t)> ()
+ .addFunction ("to", &BeatsSamplesConverter::to)
+ .addFunction ("from", &BeatsSamplesConverter::from)
.endClass ()
- .beginClass <DoubleBeatsFramesConverter> ("DoubleBeatsFramesConverter")
- .addConstructor <void (*) (const TempoMap&, framepos_t)> ()
- .addFunction ("to", &DoubleBeatsFramesConverter::to)
- .addFunction ("from", &DoubleBeatsFramesConverter::from)
+ .beginClass <DoubleBeatsSamplesConverter> ("DoubleBeatsSamplesConverter")
+ .addConstructor <void (*) (const TempoMap&, samplepos_t)> ()
+ .addFunction ("to", &DoubleBeatsSamplesConverter::to)
+ .addFunction ("from", &DoubleBeatsSamplesConverter::from)
.endClass ()
.beginClass <TempoMap> ("TempoMap")
.addFunction ("add_tempo", &TempoMap::add_tempo)
.addFunction ("add_meter", &TempoMap::add_meter)
- .addFunction ("tempo_section_at_frame", (TempoSection& (TempoMap::*)(framepos_t))&TempoMap::tempo_section_at_frame)
- .addFunction ("tempo_section_at_frame", (const TempoSection& (TempoMap::*)(framepos_t) const)&TempoMap::tempo_section_at_frame)
- .addFunction ("meter_section_at_frame", &TempoMap::meter_section_at_frame)
+ .addFunction ("tempo_section_at_frame", (TempoSection& (TempoMap::*)(samplepos_t))&TempoMap::tempo_section_at_sample)
+ .addFunction ("tempo_section_at_frame", (const TempoSection& (TempoMap::*)(samplepos_t) const)&TempoMap::tempo_section_at_sample)
+ .addFunction ("meter_section_at_frame", &TempoMap::meter_section_at_sample)
.addFunction ("meter_section_at_beat", &TempoMap::meter_section_at_beat)
- .addFunction ("bbt_at_frame", &TempoMap::bbt_at_frame)
- .addFunction ("exact_beat_at_frame", &TempoMap::exact_beat_at_frame)
- .addFunction ("exact_qn_at_frame", &TempoMap::exact_qn_at_frame)
- .addFunction ("framepos_plus_qn", &TempoMap::framepos_plus_qn)
+ .addFunction ("bbt_at_frame", &TempoMap::bbt_at_sample)
+ .addFunction ("exact_beat_at_frame", &TempoMap::exact_beat_at_sample)
+ .addFunction ("exact_qn_at_frame", &TempoMap::exact_qn_at_sample)
+ .addFunction ("samplepos_plus_qn", &TempoMap::samplepos_plus_qn)
.addFunction ("framewalk_to_qn", &TempoMap::framewalk_to_qn)
.endClass ()
@@ -2099,10 +2099,10 @@ LuaBindings::common (lua_State* L)
.addFunction ("scripts_changed", &Session::scripts_changed) // used internally
.addFunction ("transport_rolling", &Session::transport_rolling)
.addFunction ("request_transport_speed", &Session::request_transport_speed)
- .addFunction ("transport_frame", &Session::transport_frame)
+ .addFunction ("transport_frame", &Session::transport_sample)
.addFunction ("transport_speed", &Session::transport_speed)
- .addFunction ("frame_rate", &Session::frame_rate)
- .addFunction ("nominal_frame_rate", &Session::nominal_frame_rate)
+ .addFunction ("sample_rate", &Session::sample_rate)
+ .addFunction ("nominal_sample_rate", &Session::nominal_sample_rate)
.addFunction ("samples_per_timecode_frame", &Session::samples_per_timecode_frame)
.addFunction ("timecode_frames_per_hour", &Session::timecode_frames_per_hour)
.addFunction ("timecode_frames_per_second", &Session::timecode_frames_per_second)
@@ -2114,8 +2114,8 @@ LuaBindings::common (lua_State* L)
.addFunction ("last_transport_start", &Session::last_transport_start)
.addFunction ("goto_start", &Session::goto_start)
.addFunction ("goto_end", &Session::goto_end)
- .addFunction ("current_start_frame", &Session::current_start_frame)
- .addFunction ("current_end_frame", &Session::current_end_frame)
+ .addFunction ("current_start_frame", &Session::current_start_sample)
+ .addFunction ("current_end_frame", &Session::current_end_sample)
.addFunction ("actively_recording", &Session::actively_recording)
.addFunction ("new_audio_track", &Session::new_audio_track)
.addFunction ("new_audio_route", &Session::new_audio_route)
@@ -2320,11 +2320,11 @@ LuaBindings::dsp (lua_State* L)
.beginClass <AudioBuffer> ("AudioBuffer")
.addEqualCheck ()
- .addFunction ("data", (Sample*(AudioBuffer::*)(framecnt_t))&AudioBuffer::data)
+ .addFunction ("data", (Sample*(AudioBuffer::*)(samplecnt_t))&AudioBuffer::data)
.addFunction ("silence", &AudioBuffer::silence)
.addFunction ("apply_gain", &AudioBuffer::apply_gain)
.addFunction ("check_silence", &AudioBuffer::check_silence)
- .addFunction ("read_from", (void (AudioBuffer::*)(const Sample*, framecnt_t, framecnt_t, framecnt_t))&AudioBuffer::check_silence)
+ .addFunction ("read_from", (void (AudioBuffer::*)(const Sample*, samplecnt_t, samplecnt_t, samplecnt_t))&AudioBuffer::check_silence)
.endClass()
.beginClass <MidiBuffer> ("MidiBuffer")
@@ -2334,10 +2334,10 @@ LuaBindings::dsp (lua_State* L)
.addFunction ("empty", &MidiBuffer::empty)
.addFunction ("resize", &MidiBuffer::resize)
.addFunction ("copy", (void (MidiBuffer::*)(MidiBuffer const * const))&MidiBuffer::copy)
- .addFunction ("push_event", (bool (MidiBuffer::*)(const Evoral::Event<framepos_t>&))&MidiBuffer::push_back)
- .addFunction ("push_back", (bool (MidiBuffer::*)(framepos_t, size_t, const uint8_t*))&MidiBuffer::push_back)
+ .addFunction ("push_event", (bool (MidiBuffer::*)(const Evoral::Event<samplepos_t>&))&MidiBuffer::push_back)
+ .addFunction ("push_back", (bool (MidiBuffer::*)(samplepos_t, size_t, const uint8_t*))&MidiBuffer::push_back)
// TODO iterators..
- .addExtCFunction ("table", &luabridge::CFunc::listToTable<const Evoral::Event<framepos_t>, MidiBuffer>)
+ .addExtCFunction ("table", &luabridge::CFunc::listToTable<const Evoral::Event<samplepos_t>, MidiBuffer>)
.endClass()
.beginClass <BufferSet> ("BufferSet")
@@ -2350,12 +2350,12 @@ LuaBindings::dsp (lua_State* L)
luabridge::getGlobalNamespace (L)
.beginNamespace ("Evoral")
- .deriveClass <Evoral::Event<framepos_t>, Evoral::Event<framepos_t> > ("Event")
+ .deriveClass <Evoral::Event<samplepos_t>, Evoral::Event<samplepos_t> > ("Event")
// add Ctor?
- .addFunction ("type", &Evoral::Event<framepos_t>::type)
- .addFunction ("channel", &Evoral::Event<framepos_t>::channel)
- .addFunction ("set_type", &Evoral::Event<framepos_t>::set_type)
- .addFunction ("set_channel", &Evoral::Event<framepos_t>::set_channel)
+ .addFunction ("type", &Evoral::Event<samplepos_t>::type)
+ .addFunction ("channel", &Evoral::Event<samplepos_t>::channel)
+ .addFunction ("set_type", &Evoral::Event<samplepos_t>::set_type)
+ .addFunction ("set_channel", &Evoral::Event<samplepos_t>::set_channel)
.endClass ()
.endNamespace ();
diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc
index c1fd455cdf..6617e8582f 100644
--- a/libs/ardour/luaproc.cc
+++ b/libs/ardour/luaproc.cc
@@ -236,7 +236,7 @@ LuaProc::load_script ()
luabridge::LuaRef lua_dsp_init = luabridge::getGlobal (L, "dsp_init");
if (lua_dsp_init.type () == LUA_TFUNCTION) {
try {
- lua_dsp_init (_session.nominal_frame_rate ());
+ lua_dsp_init (_session.nominal_sample_rate ());
} catch (luabridge::LuaException const& e) {
} catch (...) { }
}
@@ -599,9 +599,9 @@ LuaProc::configure_io (ChanCount in, ChanCount out)
int
LuaProc::connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset)
+ pframes_t nframes, samplecnt_t offset)
{
if (!_lua_dsp) {
return 0;
@@ -673,7 +673,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
if (valid) {
for (MidiBuffer::iterator m = bufs.get_midi(idx).begin();
m != bufs.get_midi(idx).end(); ++m, ++e) {
- const Evoral::Event<framepos_t> ev(*m, false);
+ const Evoral::Event<samplepos_t> ev(*m, false);
luabridge::LuaRef lua_midi_data (luabridge::newTable (L));
const uint8_t* data = ev.buffer();
for (uint32_t i = 0; i < ev.size(); ++i) {
@@ -716,7 +716,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
if (!i.value ()["time"].isNumber ()) { continue; }
if (!i.value ()["data"].isTable ()) { continue; }
luabridge::LuaRef data_tbl (i.value ()["data"]);
- framepos_t tme = i.value ()["time"];
+ samplepos_t tme = i.value ()["time"];
if (tme < 1 || tme > nframes) { continue; }
uint8_t data[64];
size_t size = 0;
diff --git a/libs/ardour/lv2_evbuf.c b/libs/ardour/lv2_evbuf.c
index ae6d869b5f..b487e1fea9 100644
--- a/libs/ardour/lv2_evbuf.c
+++ b/libs/ardour/lv2_evbuf.c
@@ -183,13 +183,13 @@ lv2_evbuf_next(LV2_Evbuf_Iterator iter)
bool
lv2_evbuf_get(LV2_Evbuf_Iterator iter,
- uint32_t* frames,
+ uint32_t* samples,
uint32_t* subframes,
uint32_t* type,
uint32_t* size,
uint8_t** data)
{
- *frames = *subframes = *type = *size = 0;
+ *samples = *subframes = *type = *size = 0;
*data = NULL;
if (!lv2_evbuf_is_valid(iter)) {
@@ -204,7 +204,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter,
case LV2_EVBUF_EVENT:
ebuf = &iter.evbuf->buf.event;
ev = (LV2_Event*)((uintptr_t)((char*)ebuf->data + iter.offset));
- *frames = ev->frames;
+ *samples = ev->frames;
*subframes = ev->subframes;
*type = ev->type;
*size = ev->size;
@@ -215,7 +215,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter,
aev = (LV2_Atom_Event*)((uintptr_t)(
(char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, aseq)
+ iter.offset));
- *frames = aev->time.frames;
+ *samples = aev->time.frames;
*subframes = 0;
*type = aev->body.type;
*size = aev->body.size;
@@ -228,7 +228,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter,
bool
lv2_evbuf_write(LV2_Evbuf_Iterator* iter,
- uint32_t frames,
+ uint32_t samples,
uint32_t subframes,
uint32_t type,
uint32_t size,
@@ -246,7 +246,7 @@ lv2_evbuf_write(LV2_Evbuf_Iterator* iter,
}
ev = (LV2_Event*)((uintptr_t)(ebuf->data + iter->offset));
- ev->frames = frames;
+ ev->frames = samples;
ev->subframes = subframes;
ev->type = type;
ev->size = size;
@@ -267,7 +267,7 @@ lv2_evbuf_write(LV2_Evbuf_Iterator* iter,
aev = (LV2_Atom_Event*)((uintptr_t)(
(char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, aseq)
+ iter->offset));
- aev->time.frames = frames;
+ aev->time.frames = samples;
aev->body.type = type;
aev->body.size = size;
memcpy(LV2_ATOM_BODY(&aev->body), data, size);
diff --git a/libs/ardour/lv2_evbuf.h b/libs/ardour/lv2_evbuf.h
index 3700be8e02..000fb9c25f 100644
--- a/libs/ardour/lv2_evbuf.h
+++ b/libs/ardour/lv2_evbuf.h
@@ -142,7 +142,7 @@ lv2_evbuf_next(LV2_Evbuf_Iterator iter);
*/
bool
lv2_evbuf_get(LV2_Evbuf_Iterator iter,
- uint32_t* frames,
+ uint32_t* samples,
uint32_t* subframes,
uint32_t* type,
uint32_t* size,
@@ -157,7 +157,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter,
*/
bool
lv2_evbuf_write(LV2_Evbuf_Iterator* iter,
- uint32_t frames,
+ uint32_t samples,
uint32_t subframes,
uint32_t type,
uint32_t size,
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index b51db65485..46c80d5658 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -353,7 +353,7 @@ struct LV2Plugin::Impl {
LV2Plugin::LV2Plugin (AudioEngine& engine,
Session& session,
const void* c_plugin,
- framecnt_t rate)
+ samplecnt_t rate)
: Plugin (engine, session)
, Workee ()
, _impl(new Impl())
@@ -391,7 +391,7 @@ LV2Plugin::LV2Plugin (const LV2Plugin& other)
}
void
-LV2Plugin::init(const void* c_plugin, framecnt_t rate)
+LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
{
DEBUG_TRACE(DEBUG::LV2, "init\n");
@@ -407,7 +407,7 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
_bpm_control_port = 0;
_freewheel_control_port = 0;
_latency_control_port = 0;
- _next_cycle_start = std::numeric_limits<framepos_t>::max();
+ _next_cycle_start = std::numeric_limits<samplepos_t>::max();
_next_cycle_speed = 1.0;
_seq_size = _engine.raw_buffer_size(DataType::MIDI);
_state_version = 0;
@@ -788,7 +788,7 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
lilv_port_get_range(plugin, port, &def, NULL, NULL);
_defaults[i] = def ? lilv_node_as_float(def) : 0.0f;
if (lilv_port_has_property (plugin, port, _world.lv2_sampleRate)) {
- _defaults[i] *= _session.frame_rate ();
+ _defaults[i] *= _session.sample_rate ();
}
lilv_node_free(def);
@@ -901,7 +901,7 @@ LV2Plugin::requires_fixed_sized_buffers () const
*/
if (get_info()->n_inputs.n_midi() > 0) {
/* we don't yet implement midi buffer offsets (for split cycles).
- * Also connect_and_run() also uses _session.transport_frame() directly
+ * Also connect_and_run() also uses _session.transport_sample() directly
* (for BBT) which is not offset for plugin cycle split.
*/
return true;
@@ -1721,7 +1721,7 @@ LV2Plugin::write_from_ui(uint32_t index,
if (_atom_ev_buffers && _atom_ev_buffers[0]) {
bufsiz = lv2_evbuf_get_capacity(_atom_ev_buffers[0]);
}
- int fact = ceilf(_session.frame_rate () / 3000.f);
+ int fact = ceilf(_session.sample_rate () / 3000.f);
rbs = max((size_t) bufsiz * std::max (8, fact), rbs);
_from_ui = new RingBuffer<uint8_t>(rbs);
}
@@ -1825,19 +1825,19 @@ LV2Plugin::set_property(uint32_t key, const Variant& value)
// Set up forge to write to temporary buffer on the stack
LV2_Atom_Forge* forge = &_impl->ui_forge;
- LV2_Atom_Forge_Frame frame;
+ LV2_Atom_Forge_Frame sample;
uint8_t buf[PATH_MAX]; // Ought to be enough for anyone...
lv2_atom_forge_set_buffer(forge, buf, sizeof(buf));
// Serialize patch:Set message to set property
#ifdef HAVE_LV2_1_10_0
- lv2_atom_forge_object(forge, &frame, 0, _uri_map.urids.patch_Set);
+ lv2_atom_forge_object(forge, &sample, 0, _uri_map.urids.patch_Set);
lv2_atom_forge_key(forge, _uri_map.urids.patch_property);
lv2_atom_forge_urid(forge, key);
lv2_atom_forge_key(forge, _uri_map.urids.patch_value);
#else
- lv2_atom_forge_blank(forge, &frame, 0, _uri_map.urids.patch_Set);
+ lv2_atom_forge_blank(forge, &sample, 0, _uri_map.urids.patch_Set);
lv2_atom_forge_property_head(forge, _uri_map.urids.patch_property, 0);
lv2_atom_forge_urid(forge, key);
lv2_atom_forge_property_head(forge, _uri_map.urids.patch_value, 0);
@@ -1988,16 +1988,16 @@ LV2Plugin::announce_property_values()
// Set up forge to write to temporary buffer on the stack
LV2_Atom_Forge* forge = &_impl->ui_forge;
- LV2_Atom_Forge_Frame frame;
+ LV2_Atom_Forge_Frame sample;
uint8_t buf[PATH_MAX]; // Ought to be enough for anyone...
lv2_atom_forge_set_buffer(forge, buf, sizeof(buf));
// Serialize patch:Get message with no subject (implicitly plugin instance)
#ifdef HAVE_LV2_1_10_0
- lv2_atom_forge_object(forge, &frame, 0, _uri_map.urids.patch_Get);
+ lv2_atom_forge_object(forge, &sample, 0, _uri_map.urids.patch_Get);
#else
- lv2_atom_forge_blank(forge, &frame, 0, _uri_map.urids.patch_Get);
+ lv2_atom_forge_blank(forge, &sample, 0, _uri_map.urids.patch_Get);
#endif
// Write message to UI=>Plugin ring
@@ -2202,8 +2202,8 @@ LV2Plugin::get_parameter_descriptor(uint32_t which, ParameterDescriptor& desc) c
load_parameter_descriptor_units(_world.world, desc, portunits);
if (desc.sr_dependent) {
- desc.lower *= _session.frame_rate ();
- desc.upper *= _session.frame_rate ();
+ desc.lower *= _session.sample_rate ();
+ desc.upper *= _session.sample_rate ();
}
desc.enumeration = lilv_port_has_property(_impl->plugin, port, _world.lv2_enumeration);
@@ -2346,17 +2346,17 @@ LV2Plugin::describe_parameter(Evoral::Parameter which)
}
}
-framecnt_t
+samplecnt_t
LV2Plugin::max_latency () const
{
return _max_latency;
}
-framecnt_t
+samplecnt_t
LV2Plugin::signal_latency() const
{
if (_latency_control_port) {
- return (framecnt_t)floor(*_latency_control_port);
+ return (samplecnt_t)floor(*_latency_control_port);
} else {
return 0;
}
@@ -2498,17 +2498,17 @@ write_position(LV2_Atom_Forge* forge,
Timecode::BBT_Time& bbt,
double speed,
double bpm,
- framepos_t position,
- framecnt_t offset)
+ samplepos_t position,
+ samplecnt_t offset)
{
const URIMap::URIDs& urids = URIMap::instance().urids;
uint8_t pos_buf[256];
lv2_atom_forge_set_buffer(forge, pos_buf, sizeof(pos_buf));
- LV2_Atom_Forge_Frame frame;
+ LV2_Atom_Forge_Frame sample;
#ifdef HAVE_LV2_1_10_0
- lv2_atom_forge_object(forge, &frame, 0, urids.time_Position);
- lv2_atom_forge_key(forge, urids.time_frame);
+ lv2_atom_forge_object(forge, &sample, 0, urids.time_Position);
+ lv2_atom_forge_key(forge, urids.time_sample);
lv2_atom_forge_long(forge, position);
lv2_atom_forge_key(forge, urids.time_speed);
lv2_atom_forge_float(forge, speed);
@@ -2524,8 +2524,8 @@ write_position(LV2_Atom_Forge* forge,
lv2_atom_forge_key(forge, urids.time_beatsPerMinute);
lv2_atom_forge_float(forge, bpm);
#else
- lv2_atom_forge_blank(forge, &frame, 1, urids.time_Position);
- lv2_atom_forge_property_head(forge, urids.time_frame, 0);
+ lv2_atom_forge_blank(forge, &sample, 1, urids.time_Position);
+ lv2_atom_forge_property_head(forge, urids.time_sample, 0);
lv2_atom_forge_long(forge, position);
lv2_atom_forge_property_head(forge, urids.time_speed, 0);
lv2_atom_forge_float(forge, speed);
@@ -2550,9 +2550,9 @@ write_position(LV2_Atom_Forge* forge,
int
LV2Plugin::connect_and_run(BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in_map, ChanMapping out_map,
- pframes_t nframes, framecnt_t offset)
+ pframes_t nframes, samplecnt_t offset)
{
DEBUG_TRACE(DEBUG::LV2, string_compose("%1 run %2 offset %3\n", name(), nframes, offset));
Plugin::connect_and_run(bufs, start, end, speed, in_map, out_map, nframes, offset);
@@ -2568,7 +2568,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
}
if (_bpm_control_port) {
- *_bpm_control_port = tmap.tempo_at_frame (start).note_types_per_minute();
+ *_bpm_control_port = tmap.tempo_at_sample (start).note_types_per_minute();
}
#ifdef LV2_EXTENDED
@@ -2639,8 +2639,8 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
if (valid && (flags & PORT_INPUT)) {
if ((flags & PORT_POSITION)) {
- Timecode::BBT_Time bbt (tmap.bbt_at_frame (start));
- double bpm = tmap.tempo_at_frame (start).note_types_per_minute();
+ Timecode::BBT_Time bbt (tmap.bbt_at_sample (start));
+ double bpm = tmap.tempo_at_sample (start).note_types_per_minute();
double beatpos = (bbt.bars - 1) * tmetric.meter().divisions_per_bar()
+ (bbt.beats - 1)
+ (bbt.ticks / Timecode::BBT_Time::ticks_per_beat);
@@ -2665,14 +2665,14 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
// Now merge MIDI and any transport events into the buffer
const uint32_t type = _uri_map.urids.midi_MidiEvent;
- const framepos_t tend = end;
+ const samplepos_t tend = end;
++metric_i;
while (m != m_end || (metric_i != tmap.metrics_end() &&
- (*metric_i)->frame() < tend)) {
+ (*metric_i)->sample() < tend)) {
MetricSection* metric = (metric_i != tmap.metrics_end())
? *metric_i : NULL;
- if (m != m_end && (!metric || metric->frame() > (*m).time())) {
- const Evoral::Event<framepos_t> ev(*m, false);
+ if (m != m_end && (!metric || metric->sample() > (*m).time())) {
+ const Evoral::Event<samplepos_t> ev(*m, false);
if (ev.time() < nframes) {
LV2_Evbuf_Iterator eend = lv2_evbuf_end(_ev_buffers[port_index]);
lv2_evbuf_write(&eend, ev.time(), 0, type, ev.size(), ev.buffer());
@@ -2681,12 +2681,12 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
} else {
tmetric.set_metric(metric);
Timecode::BBT_Time bbt;
- bbt = tmap.bbt_at_frame (metric->frame());
- double bpm = tmap.tempo_at_frame (start/*XXX*/).note_types_per_minute();
+ bbt = tmap.bbt_at_sample (metric->sample());
+ double bpm = tmap.tempo_at_sample (start/*XXX*/).note_types_per_minute();
write_position(&_impl->forge, _ev_buffers[port_index],
tmetric, bbt, speed, bpm,
- metric->frame(),
- metric->frame() - start);
+ metric->sample(),
+ metric->sample() - start);
++metric_i;
}
}
@@ -2778,9 +2778,9 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
for (LV2_Evbuf_Iterator i = lv2_evbuf_begin(buf);
lv2_evbuf_is_valid(i);
i = lv2_evbuf_next(i)) {
- uint32_t frames, subframes, type, size;
+ uint32_t samples, subframes, type, size;
uint8_t* data;
- lv2_evbuf_get(i, &frames, &subframes, &type, &size, &data);
+ lv2_evbuf_get(i, &samples, &subframes, &type, &size, &data);
#ifdef LV2_EXTENDED
// Intercept Automation Write Events
@@ -2802,13 +2802,13 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
const float v = ((const LV2_Atom_Float*)value)->body;
// -> add automation event..
DEBUG_TRACE(DEBUG::LV2Automate,
- string_compose ("Event p: %1 t: %2 v: %3\n", p, frames, v));
+ string_compose ("Event p: %1 t: %2 v: %3\n", p, samples, v));
AutomationCtrlPtr c = get_automation_control (p);
if (c &&
(c->ac->automation_state() == Touch || c->ac->automation_state() == Write)
) {
- framepos_t when = std::max ((framepos_t) 0, start + frames - _current_latency);
- assert (start + frames - _current_latency >= 0);
+ samplepos_t when = std::max ((samplepos_t) 0, start + samples - _current_latency);
+ assert (start + samples - _current_latency >= 0);
if (c->guard) {
c->guard = false;
c->ac->list()->add (when, v, true, true);
@@ -2870,7 +2870,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
AutomationCtrlPtr c = get_automation_control (p);
DEBUG_TRACE(DEBUG::LV2Automate, string_compose ("Start Touch p: %1\n", p));
if (c) {
- c->ac->start_touch (std::max ((framepos_t)0, start - _current_latency));
+ c->ac->start_touch (std::max ((samplepos_t)0, start - _current_latency));
c->guard = true;
}
}
@@ -2885,7 +2885,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
AutomationCtrlPtr c = get_automation_control (p);
DEBUG_TRACE(DEBUG::LV2Automate, string_compose ("End Touch p: %1\n", p));
if (c) {
- c->ac->stop_touch (std::max ((framepos_t)0, start - _current_latency));
+ c->ac->stop_touch (std::max ((samplepos_t)0, start - _current_latency));
}
}
}
@@ -2955,17 +2955,17 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
* so it needs to be realative to that.
*/
TempoMetric t = tmap.metric_at(start);
- _current_bpm = tmap.tempo_at_frame (start).note_types_per_minute();
- Timecode::BBT_Time bbt (tmap.bbt_at_frame (start));
+ _current_bpm = tmap.tempo_at_sample (start).note_types_per_minute();
+ Timecode::BBT_Time bbt (tmap.bbt_at_sample (start));
double beatpos = (bbt.bars - 1) * t.meter().divisions_per_bar()
+ (bbt.beats - 1)
+ (bbt.ticks / Timecode::BBT_Time::ticks_per_beat);
beatpos *= tmetric.meter().note_divisor() / 4.0;
- _next_cycle_beat = beatpos + nframes * speed * _current_bpm / (60.f * _session.frame_rate());
+ _next_cycle_beat = beatpos + nframes * speed * _current_bpm / (60.f * _session.sample_rate());
}
if (_latency_control_port) {
- framecnt_t new_latency = signal_latency ();
+ samplecnt_t new_latency = signal_latency ();
_current_latency = new_latency;
}
return 0;
@@ -3120,7 +3120,7 @@ LV2Plugin::latency_compute_run()
uint32_t out_index = 0;
// this is done in the main thread. non realtime.
- const framecnt_t bufsize = _engine.samples_per_cycle();
+ const samplecnt_t bufsize = _engine.samples_per_cycle();
float *buffer = (float*) malloc(_engine.samples_per_cycle() * sizeof(float));
memset(buffer, 0, sizeof(float) * bufsize);
@@ -3356,7 +3356,7 @@ LV2PluginInfo::load(Session& session)
if (!uri) { throw failed_constructor(); }
const LilvPlugin* lp = lilv_plugins_get_by_uri(plugins, uri);
if (!lp) { throw failed_constructor(); }
- plugin.reset(new LV2Plugin(session.engine(), session, lp, session.frame_rate()));
+ plugin.reset(new LV2Plugin(session.engine(), session, lp, session.sample_rate()));
lilv_node_free(uri);
plugin->set_info(PluginInfoPtr(shared_from_this ()));
return plugin;
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index faedf34455..c0b029a158 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -38,10 +38,10 @@ using namespace ARDOUR;
PeakMeter::PeakMeter (Session& s, const std::string& name)
: Processor (s, string_compose ("meter-%1", name))
{
- Kmeterdsp::init(s.nominal_frame_rate());
- Iec1ppmdsp::init(s.nominal_frame_rate());
- Iec2ppmdsp::init(s.nominal_frame_rate());
- Vumeterdsp::init(s.nominal_frame_rate());
+ Kmeterdsp::init(s.nominal_sample_rate());
+ Iec1ppmdsp::init(s.nominal_sample_rate());
+ Iec2ppmdsp::init(s.nominal_sample_rate());
+ Vumeterdsp::init(s.nominal_sample_rate());
_pending_active = true;
_meter_type = MeterPeak;
_reset_dpm = true;
@@ -78,7 +78,7 @@ PeakMeter::~PeakMeter ()
* (runs in jack realtime context)
*/
void
-PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
+PeakMeter::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
{
if (!_active && !_pending_active) {
return;
@@ -96,8 +96,8 @@ PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_fr
uint32_t n = 0;
- const float falloff_dB = Config->get_meter_falloff() * nframes / _session.nominal_frame_rate();
- const uint32_t zoh = _session.nominal_frame_rate() * .021;
+ const float falloff_dB = Config->get_meter_falloff() * nframes / _session.nominal_sample_rate();
+ const uint32_t zoh = _session.nominal_sample_rate() * .021;
_bufcnt += nframes;
// Meter MIDI in to the first n_midi peaks
@@ -106,7 +106,7 @@ PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_fr
const MidiBuffer& buf (bufs.get_midi(i));
for (MidiBuffer::const_iterator e = buf.begin(); e != buf.end(); ++e) {
- const Evoral::Event<framepos_t> ev(*e, false);
+ const Evoral::Event<samplepos_t> ev(*e, false);
if (ev.is_note_on()) {
const float this_vel = ev.buffer()[2] / 127.0;
if (this_vel > val) {
diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc
index adad9c35dc..1be24ab801 100644
--- a/libs/ardour/midi_buffer.cc
+++ b/libs/ardour/midi_buffer.cc
@@ -95,7 +95,7 @@ MidiBuffer::copy(MidiBuffer const * const copy)
* Note that offset and nframes refer to sample time, NOT buffer offsets or event counts.
*/
void
-MidiBuffer::read_from (const Buffer& src, framecnt_t nframes, frameoffset_t dst_offset, frameoffset_t /* src_offset*/)
+MidiBuffer::read_from (const Buffer& src, samplecnt_t nframes, sampleoffset_t dst_offset, sampleoffset_t /* src_offset*/)
{
assert (src.type() == DataType::MIDI);
assert (&src != this);
@@ -136,7 +136,7 @@ MidiBuffer::read_from (const Buffer& src, framecnt_t nframes, frameoffset_t dst_
Shift first, then check it is within range of this
(split) cycle.
*/
- const framepos_t evtime = ev.time() + dst_offset;
+ const samplepos_t evtime = ev.time() + dst_offset;
if (evtime >= 0 && evtime < nframes) {
push_back (evtime, ev.size(), ev.buffer());
@@ -150,7 +150,7 @@ MidiBuffer::read_from (const Buffer& src, framecnt_t nframes, frameoffset_t dst_
}
void
-MidiBuffer::merge_from (const Buffer& src, framecnt_t /*nframes*/, frameoffset_t /*dst_offset*/, frameoffset_t /*src_offset*/)
+MidiBuffer::merge_from (const Buffer& src, samplecnt_t /*nframes*/, sampleoffset_t /*dst_offset*/, sampleoffset_t /*src_offset*/)
{
const MidiBuffer* mbuf = dynamic_cast<const MidiBuffer*>(&src);
assert (mbuf);
@@ -307,7 +307,7 @@ MidiBuffer::reserve(TimeType time, size_t size)
void
-MidiBuffer::silence (framecnt_t /*nframes*/, framecnt_t /*offset*/)
+MidiBuffer::silence (samplecnt_t /*nframes*/, samplecnt_t /*offset*/)
{
/* XXX iterate over existing events, find all in range given by offset & nframes,
and delete them.
diff --git a/libs/ardour/midi_channel_filter.cc b/libs/ardour/midi_channel_filter.cc
index f81c57fef7..c467f37bd6 100644
--- a/libs/ardour/midi_channel_filter.cc
+++ b/libs/ardour/midi_channel_filter.cc
@@ -42,7 +42,7 @@ MidiChannelFilter::filter(BufferSet& bufs)
MidiBuffer& buf = bufs.get_midi(0);
for (MidiBuffer::iterator e = buf.begin(); e != buf.end(); ) {
- Evoral::Event<framepos_t> ev(*e, false);
+ Evoral::Event<samplepos_t> ev(*e, false);
if (ev.is_channel_event()) {
switch (mode) {
diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc
index edc6e91e32..273c397733 100644
--- a/libs/ardour/midi_clock_slave.cc
+++ b/libs/ardour/midi_clock_slave.cc
@@ -80,38 +80,38 @@ MIDIClock_Slave::rebind (MidiPort& port)
}
void
-MIDIClock_Slave::calculate_one_ppqn_in_frames_at(framepos_t time)
+MIDIClock_Slave::calculate_one_ppqn_in_samples_at(samplepos_t time)
{
- const double frames_per_quarter_note = session->tempo_map().frames_per_quarter_note_at (time, session->frame_rate());
+ const double samples_per_quarter_note = session->tempo_map().samples_per_quarter_note_at (time, session->sample_rate());
- one_ppqn_in_frames = frames_per_quarter_note / double (ppqn);
- // DEBUG_TRACE (DEBUG::MidiClock, string_compose ("at %1, one ppqn = %2\n", time, one_ppqn_in_frames));
+ one_ppqn_in_samples = samples_per_quarter_note / double (ppqn);
+ // DEBUG_TRACE (DEBUG::MidiClock, string_compose ("at %1, one ppqn = %2\n", time, one_ppqn_in_samples));
}
-ARDOUR::framepos_t
+ARDOUR::samplepos_t
MIDIClock_Slave::calculate_song_position(uint16_t song_position_in_sixteenth_notes)
{
- framepos_t song_position_frames = 0;
+ samplepos_t song_position_samples = 0;
for (uint16_t i = 1; i <= song_position_in_sixteenth_notes; ++i) {
// one quarter note contains ppqn pulses, so a sixteenth note is ppqn / 4 pulses
- calculate_one_ppqn_in_frames_at(song_position_frames);
- song_position_frames += one_ppqn_in_frames * (framepos_t)(ppqn / 4);
+ calculate_one_ppqn_in_samples_at(song_position_samples);
+ song_position_samples += one_ppqn_in_samples * (samplepos_t)(ppqn / 4);
}
- return song_position_frames;
+ return song_position_samples;
}
void
MIDIClock_Slave::calculate_filter_coefficients()
{
- // omega = 2 * PI * Bandwidth / MIDI clock frame frequency in Hz
- omega = 2.0 * M_PI * bandwidth * one_ppqn_in_frames / session->frame_rate();
+ // omega = 2 * PI * Bandwidth / MIDI clock sample frequency in Hz
+ omega = 2.0 * M_PI * bandwidth * one_ppqn_in_samples / session->sample_rate();
b = 1.4142135623730950488 * omega;
c = omega * omega;
}
void
-MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, framepos_t timestamp)
+MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, samplepos_t timestamp)
{
// some pieces of hardware send MIDI Clock all the time
if ( (!_starting) && (!_started) ) {
@@ -120,9 +120,9 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, framepos_t timestamp)
pframes_t cycle_offset = timestamp - session->sample_time_at_cycle_start();
- calculate_one_ppqn_in_frames_at(should_be_position);
+ calculate_one_ppqn_in_samples_at(should_be_position);
- framepos_t elapsed_since_start = timestamp - first_timestamp;
+ samplepos_t elapsed_since_start = timestamp - first_timestamp;
double error = 0;
if (_starting || last_timestamp == 0) {
@@ -137,23 +137,23 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, framepos_t timestamp)
calculate_filter_coefficients();
// initialize DLL
- e2 = double(one_ppqn_in_frames) / double(session->frame_rate());
- t0 = double(elapsed_since_start) / double(session->frame_rate());
+ e2 = double(one_ppqn_in_samples) / double(session->sample_rate());
+ t0 = double(elapsed_since_start) / double(session->sample_rate());
t1 = t0 + e2;
// let ardour go after first MIDI Clock Event
_starting = false;
} else {
midi_clock_count++;
- should_be_position += one_ppqn_in_frames;
+ should_be_position += one_ppqn_in_samples;
calculate_filter_coefficients();
// calculate loop error
- // we use session->transport_frame() instead of t1 here
+ // we use session->transport_sample() instead of t1 here
// because t1 is used to calculate the transport speed,
// so the loop will compensate for accumulating rounding errors
- error = (double(should_be_position) - (double(session->transport_frame()) + double(cycle_offset)));
- e = error / double(session->frame_rate());
+ error = (double(should_be_position) - (double(session->transport_sample()) + double(cycle_offset)));
+ e = error / double(session->sample_rate());
current_delta = error;
// update DLL
@@ -167,16 +167,16 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, framepos_t timestamp)
midi_clock_count, // #
elapsed_since_start, // @
should_be_position, // should-be
- session->transport_frame(), // transport
+ session->transport_sample(), // transport
error, // error
- ((t1 - t0) * session->frame_rate()) / one_ppqn_in_frames, // appspeed
+ ((t1 - t0) * session->sample_rate()) / one_ppqn_in_samples, // appspeed
timestamp - last_timestamp, // read delta
- one_ppqn_in_frames, // should-be delta
- (t1 - t0) * session->frame_rate(), // t1-t0
- t0 * session->frame_rate(), // t0
- t1 * session->frame_rate(), // t1
- session->frame_rate(), // framerate
- session->frame_time()
+ one_ppqn_in_samples, // should-be delta
+ (t1 - t0) * session->sample_rate(), // t1-t0
+ t0 * session->sample_rate(), // t0
+ t1 * session->sample_rate(), // t1
+ session->sample_rate(), // framerate
+ session->sample_time()
));
@@ -184,9 +184,9 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, framepos_t timestamp)
}
void
-MIDIClock_Slave::start (Parser& /*parser*/, framepos_t timestamp)
+MIDIClock_Slave::start (Parser& /*parser*/, samplepos_t timestamp)
{
- DEBUG_TRACE (DEBUG::MidiClock, string_compose ("MIDIClock_Slave got start message at time %1 engine time %2 transport_frame %3\n", timestamp, session->frame_time(), session->transport_frame()));
+ DEBUG_TRACE (DEBUG::MidiClock, string_compose ("MIDIClock_Slave got start message at time %1 engine time %2 transport_sample %3\n", timestamp, session->sample_time(), session->transport_sample()));
if (!_started) {
reset();
@@ -194,16 +194,16 @@ MIDIClock_Slave::start (Parser& /*parser*/, framepos_t timestamp)
_started = true;
_starting = true;
- should_be_position = session->transport_frame();
+ should_be_position = session->transport_sample();
}
}
void
MIDIClock_Slave::reset ()
{
- DEBUG_TRACE (DEBUG::MidiClock, string_compose ("MidiClock_Slave reset(): calculated filter bandwidth is %1 for period size %2\n", bandwidth, session->frames_per_cycle()));
+ DEBUG_TRACE (DEBUG::MidiClock, string_compose ("MidiClock_Slave reset(): calculated filter bandwidth is %1 for period size %2\n", bandwidth, session->samples_per_cycle()));
- should_be_position = session->transport_frame();
+ should_be_position = session->transport_sample();
last_timestamp = 0;
_starting = true;
@@ -214,7 +214,7 @@ MIDIClock_Slave::reset ()
}
void
-MIDIClock_Slave::contineu (Parser& /*parser*/, framepos_t /*timestamp*/)
+MIDIClock_Slave::contineu (Parser& /*parser*/, samplepos_t /*timestamp*/)
{
DEBUG_TRACE (DEBUG::MidiClock, "MIDIClock_Slave got continue message\n");
@@ -226,7 +226,7 @@ MIDIClock_Slave::contineu (Parser& /*parser*/, framepos_t /*timestamp*/)
void
-MIDIClock_Slave::stop (Parser& /*parser*/, framepos_t /*timestamp*/)
+MIDIClock_Slave::stop (Parser& /*parser*/, samplepos_t /*timestamp*/)
{
DEBUG_TRACE (DEBUG::MidiClock, "MIDIClock_Slave got stop message\n");
@@ -243,11 +243,11 @@ MIDIClock_Slave::stop (Parser& /*parser*/, framepos_t /*timestamp*/)
// that is the position of the last MIDI Clock
// message and that is probably what the master
// expects where we are right now
- framepos_t stop_position = should_be_position;
+ samplepos_t stop_position = should_be_position;
// find out the last MIDI beat: go back #midi_clocks mod 6
// and lets hope the tempo didnt change in those last 6 beats :)
- stop_position -= (midi_clock_count % 6) * one_ppqn_in_frames;
+ stop_position -= (midi_clock_count % 6) * one_ppqn_in_samples;
session->request_locate(stop_position, false);
should_be_position = stop_position;
@@ -270,12 +270,12 @@ MIDIClock_Slave::position (Parser& /*parser*/, MIDI::byte* message, size_t size)
assert((lsb <= 0x7f) && (msb <= 0x7f));
uint16_t position_in_sixteenth_notes = (uint16_t(msb) << 7) | uint16_t(lsb);
- framepos_t position_in_frames = calculate_song_position(position_in_sixteenth_notes);
+ samplepos_t position_in_samples = calculate_song_position(position_in_sixteenth_notes);
- DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Song Position: %1 frames: %2\n", position_in_sixteenth_notes, position_in_frames));
+ DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Song Position: %1 samples: %2\n", position_in_sixteenth_notes, position_in_samples));
- session->request_locate(position_in_frames, false);
- should_be_position = position_in_frames;
+ session->request_locate(position_in_samples, false);
+ should_be_position = position_in_samples;
last_timestamp = 0;
}
@@ -299,13 +299,13 @@ MIDIClock_Slave::starting() const
}
bool
-MIDIClock_Slave::stop_if_no_more_clock_events(framepos_t& pos, framepos_t now)
+MIDIClock_Slave::stop_if_no_more_clock_events(samplepos_t& pos, samplepos_t now)
{
/* no timecode for 1/4 second ? conclude that its stopped */
if (last_timestamp &&
now > last_timestamp &&
- now - last_timestamp > session->frame_rate() / 4) {
- DEBUG_TRACE (DEBUG::MidiClock, "No MIDI Clock frames received for some time, stopping!\n");
+ now - last_timestamp > session->sample_rate() / 4) {
+ DEBUG_TRACE (DEBUG::MidiClock, "No MIDI Clock samples received for some time, stopping!\n");
pos = should_be_position;
session->request_transport_speed (0);
session->request_locate (should_be_position, false);
@@ -316,7 +316,7 @@ MIDIClock_Slave::stop_if_no_more_clock_events(framepos_t& pos, framepos_t now)
}
bool
-MIDIClock_Slave::speed_and_position (double& speed, framepos_t& pos)
+MIDIClock_Slave::speed_and_position (double& speed, samplepos_t& pos)
{
if (!_started || _starting) {
speed = 0.0;
@@ -324,14 +324,14 @@ MIDIClock_Slave::speed_and_position (double& speed, framepos_t& pos)
return true;
}
- framepos_t engine_now = session->frame_time();
+ samplepos_t engine_now = session->sample_time();
if (stop_if_no_more_clock_events(pos, engine_now)) {
return false;
}
// calculate speed
- speed = ((t1 - t0) * session->frame_rate()) / one_ppqn_in_frames;
+ speed = ((t1 - t0) * session->sample_rate()) / one_ppqn_in_samples;
// provide a 0.1% deadzone to lock the speed
if (fabs(speed - 1.0) <= 0.001)
@@ -341,23 +341,23 @@ MIDIClock_Slave::speed_and_position (double& speed, framepos_t& pos)
if (engine_now > last_timestamp) {
// we are in between MIDI clock messages
// so we interpolate position according to speed
- framecnt_t elapsed = engine_now - last_timestamp;
- pos = (framepos_t) (should_be_position + double(elapsed) * speed);
+ samplecnt_t elapsed = engine_now - last_timestamp;
+ pos = (samplepos_t) (should_be_position + double(elapsed) * speed);
} else {
// A new MIDI clock message has arrived this cycle
pos = should_be_position;
}
- DEBUG_TRACE (DEBUG::MidiClock, string_compose ("speed_and_position: speed %1 should-be %2 transport %3 \n", speed, pos, session->transport_frame()));
+ DEBUG_TRACE (DEBUG::MidiClock, string_compose ("speed_and_position: speed %1 should-be %2 transport %3 \n", speed, pos, session->transport_sample()));
return true;
}
-ARDOUR::framecnt_t
+ARDOUR::samplecnt_t
MIDIClock_Slave::resolution() const
{
// one beat
- return (framecnt_t) one_ppqn_in_frames * ppqn;
+ return (samplecnt_t) one_ppqn_in_samples * ppqn;
}
std::string
diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc
index 4d64a9ca19..6afde35427 100644
--- a/libs/ardour/midi_playlist.cc
+++ b/libs/ardour/midi_playlist.cc
@@ -26,7 +26,7 @@
#include "evoral/EventList.hpp"
#include "evoral/Control.hpp"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/debug.h"
#include "ardour/midi_model.h"
#include "ardour/midi_playlist.h"
@@ -78,8 +78,8 @@ MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, string
}
MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other,
- framepos_t start,
- framecnt_t dur,
+ samplepos_t start,
+ samplecnt_t dur,
string name,
bool hidden)
: Playlist (other, start, dur, name, hidden)
@@ -108,15 +108,15 @@ struct EventsSortByTimeAndType {
}
};
-framecnt_t
-MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst,
- framepos_t start,
- framecnt_t dur,
- Evoral::Range<framepos_t>* loop_range,
+samplecnt_t
+MidiPlaylist::read (Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t start,
+ samplecnt_t dur,
+ Evoral::Range<samplepos_t>* loop_range,
unsigned chan_n,
MidiChannelFilter* filter)
{
- typedef pair<MidiStateTracker*,framepos_t> TrackerInfo;
+ typedef pair<MidiStateTracker*,samplepos_t> TrackerInfo;
Playlist::RegionReadLock rl (this);
@@ -130,7 +130,7 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst,
}
/* Find relevant regions that overlap [start..end] */
- const framepos_t end = start + dur - 1;
+ const samplepos_t end = start + dur - 1;
std::vector< boost::shared_ptr<Region> > regs;
std::vector< boost::shared_ptr<Region> > ended;
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
@@ -163,8 +163,8 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst,
const bool direct_read = regs.size() == 1 &&
(ended.empty() || (ended.size() == 1 && ended.front() == regs.front()));
- Evoral::EventList<framepos_t> evlist;
- Evoral::EventSink<framepos_t>& tgt = direct_read ? dst : evlist;
+ Evoral::EventList<samplepos_t> evlist;
+ Evoral::EventSink<samplepos_t>& tgt = direct_read ? dst : evlist;
DEBUG_TRACE (DEBUG::MidiPlaylistIO,
string_compose ("\t%1 regions to read, direct: %2\n", regs.size(), direct_read));
@@ -184,12 +184,12 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst,
new_tracker = true;
DEBUG_TRACE (DEBUG::MidiPlaylistIO,
string_compose ("\tPre-read %1 (%2 .. %3): new tracker\n",
- mr->name(), mr->position(), mr->last_frame()));
+ mr->name(), mr->position(), mr->last_sample()));
} else {
tracker = t->second;
DEBUG_TRACE (DEBUG::MidiPlaylistIO,
string_compose ("\tPre-read %1 (%2 .. %3): %4 active notes\n",
- mr->name(), mr->position(), mr->last_frame(), tracker->tracker.on()));
+ mr->name(), mr->position(), mr->last_sample(), tracker->tracker.on()));
}
/* Read from region into target. */
@@ -209,7 +209,7 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst,
string_compose ("\t%1 ended, resolve notes and delete (%2) tracker\n",
mr->name(), ((new_tracker) ? "new" : "old")));
- tracker->tracker.resolve_notes (tgt, loop_range ? loop_range->squish ((*i)->last_frame()) : (*i)->last_frame());
+ tracker->tracker.resolve_notes (tgt, loop_range ? loop_range->squish ((*i)->last_sample()) : (*i)->last_sample());
tracker->cursor.invalidate (false);
if (!new_tracker) {
_note_trackers.erase (t);
@@ -226,12 +226,12 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst,
if (!direct_read && !evlist.empty()) {
/* We've read from multiple regions, sort the event list by time. */
- EventsSortByTimeAndType<framepos_t> cmp;
+ EventsSortByTimeAndType<samplepos_t> cmp;
evlist.sort (cmp);
/* Copy ordered events from event list to dst. */
- for (Evoral::EventList<framepos_t>::iterator e = evlist.begin(); e != evlist.end(); ++e) {
- Evoral::Event<framepos_t>* ev (*e);
+ for (Evoral::EventList<samplepos_t>::iterator e = evlist.begin(); e != evlist.end(); ++e) {
+ Evoral::Event<samplepos_t>* ev (*e);
dst.write (ev->time(), ev->event_type(), ev->size(), ev->buffer());
delete ev;
}
@@ -277,7 +277,7 @@ MidiPlaylist::reset_note_trackers ()
}
void
-MidiPlaylist::resolve_note_trackers (Evoral::EventSink<framepos_t>& dst, framepos_t time)
+MidiPlaylist::resolve_note_trackers (Evoral::EventSink<samplepos_t>& dst, samplepos_t time)
{
Playlist::RegionWriteLock rl (this, false);
@@ -384,14 +384,14 @@ MidiPlaylist::destroy_region (boost::shared_ptr<Region> region)
return changed;
}
void
-MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicFrame& playlist_position)
+MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicSample& playlist_position)
{
- if (!region->covers (playlist_position.frame)) {
+ if (!region->covers (playlist_position.sample)) {
return;
}
- if (region->position() == playlist_position.frame ||
- region->last_frame() == playlist_position.frame) {
+ if (region->position() == playlist_position.sample ||
+ region->last_sample() == playlist_position.sample) {
return;
}
@@ -406,10 +406,10 @@ MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicFrame&
string before_name;
string after_name;
- const double before_qn = _session.tempo_map().exact_qn_at_frame (playlist_position.frame, playlist_position.division) - region->quarter_note();
+ const double before_qn = _session.tempo_map().exact_qn_at_sample (playlist_position.sample, playlist_position.division) - region->quarter_note();
const double after_qn = mr->length_beats() - before_qn;
- MusicFrame before (playlist_position.frame - region->position(), playlist_position.division);
- MusicFrame after (region->length() - before.frame, playlist_position.division);
+ MusicSample before (playlist_position.sample - region->position(), playlist_position.division);
+ MusicSample after (region->length() - before.sample, playlist_position.division);
/* split doesn't change anything about length, so don't try to splice */
bool old_sp = _splicing;
@@ -420,7 +420,7 @@ MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicFrame&
{
PropertyList plist;
- plist.add (Properties::length, before.frame);
+ plist.add (Properties::length, before.sample);
plist.add (Properties::length_beats, before_qn);
plist.add (Properties::name, before_name);
plist.add (Properties::left_of_split, true);
@@ -431,7 +431,7 @@ MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicFrame&
since it supplies that offset to the Region constructor, which
is necessary to get audio region gain envelopes right.
*/
- left = RegionFactory::create (region, MusicFrame (0, 0), plist, true);
+ left = RegionFactory::create (region, MusicSample (0, 0), plist, true);
}
RegionFactory::region_name (after_name, region->name(), false);
@@ -439,7 +439,7 @@ MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicFrame&
{
PropertyList plist;
- plist.add (Properties::length, after.frame);
+ plist.add (Properties::length, after.sample);
plist.add (Properties::length_beats, after_qn);
plist.add (Properties::name, after_name);
plist.add (Properties::right_of_split, true);
@@ -451,7 +451,7 @@ MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicFrame&
}
add_region_internal (left, region->position(), 0, region->quarter_note(), true);
- add_region_internal (right, region->position() + before.frame, before.division, region->quarter_note() + before_qn, true);
+ add_region_internal (right, region->position() + before.sample, before.division, region->quarter_note() + before_qn, true);
remove_region_internal (region);
diff --git a/libs/ardour/midi_playlist_source.cc b/libs/ardour/midi_playlist_source.cc
index 8b7e87889e..80219cb9a3 100644
--- a/libs/ardour/midi_playlist_source.cc
+++ b/libs/ardour/midi_playlist_source.cc
@@ -54,7 +54,7 @@ on other ways to approach this issue.
********************************************************************************/
MidiPlaylistSource::MidiPlaylistSource (Session& s, const ID& orig, const std::string& name, boost::shared_ptr<MidiPlaylist> p,
- uint32_t /*chn*/, frameoffset_t begin, framecnt_t len, Source::Flag flags)
+ uint32_t /*chn*/, sampleoffset_t begin, samplecnt_t len, Source::Flag flags)
: Source (s, DataType::MIDI, name)
, MidiSource (s, name, flags)
, PlaylistSource (s, orig, name, p, DataType::MIDI, begin, len, flags)
@@ -114,20 +114,20 @@ MidiPlaylistSource::set_state (const XMLNode& node, int version, bool with_desce
return 0;
}
-framecnt_t
-MidiPlaylistSource::length (framepos_t) const
+samplecnt_t
+MidiPlaylistSource::length (samplepos_t) const
{
- pair<framepos_t,framepos_t> extent = _playlist->get_extent();
+ pair<samplepos_t,samplepos_t> extent = _playlist->get_extent();
return extent.second - extent.first;
}
-framecnt_t
+samplecnt_t
MidiPlaylistSource::read_unlocked (const Lock& lock,
- Evoral::EventSink<framepos_t>& dst,
- framepos_t /*position*/,
- framepos_t start,
- framecnt_t cnt,
- Evoral::Range<framepos_t>* loop_range,
+ Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t /*position*/,
+ samplepos_t start,
+ samplecnt_t cnt,
+ Evoral::Range<samplepos_t>* loop_range,
MidiStateTracker*,
MidiChannelFilter*) const
{
@@ -140,11 +140,11 @@ MidiPlaylistSource::read_unlocked (const Lock& lock,
return mp->read (dst, start, cnt, loop_range);
}
-framecnt_t
+samplecnt_t
MidiPlaylistSource::write_unlocked (const Lock&,
- MidiRingBuffer<framepos_t>&,
- framepos_t,
- framecnt_t)
+ MidiRingBuffer<samplepos_t>&,
+ samplepos_t,
+ samplecnt_t)
{
fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::write_unlocked() called - should be impossible") << endmsg;
abort(); /*NOTREACHED*/
@@ -159,9 +159,9 @@ MidiPlaylistSource::append_event_beats(const Glib::Threads::Mutex::Lock& /*lock*
}
void
-MidiPlaylistSource::append_event_frames(const Glib::Threads::Mutex::Lock& /*lock*/, const Evoral::Event<framepos_t>& /* ev */, framepos_t /*source_start*/)
+MidiPlaylistSource::append_event_samples(const Glib::Threads::Mutex::Lock& /*lock*/, const Evoral::Event<samplepos_t>& /* ev */, samplepos_t /*source_start*/)
{
- fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::append_event_frames() called - should be impossible") << endmsg;
+ fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::append_event_samples() called - should be impossible") << endmsg;
abort(); /*NOTREACHED*/
}
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index 7a87c4c273..a728ce2a44 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -59,7 +59,7 @@ MidiPort::~MidiPort()
void
MidiPort::cycle_start (pframes_t nframes)
{
- framepos_t now = AudioEngine::instance()->sample_time_at_cycle_start();
+ samplepos_t now = AudioEngine::instance()->sample_time_at_cycle_start();
Port::cycle_start (nframes);
@@ -240,7 +240,7 @@ MidiPort::flush_buffers (pframes_t nframes)
if (sends_output() && _trace_on) {
uint8_t const * const buf = ev.buffer();
- const framepos_t now = AudioEngine::instance()->sample_time_at_cycle_start();
+ const samplepos_t now = AudioEngine::instance()->sample_time_at_cycle_start();
_self_parser.set_timestamp (now + ev.time());
@@ -252,12 +252,12 @@ MidiPort::flush_buffers (pframes_t nframes)
}
- // event times are in frames, relative to cycle start
+ // event times are in samples, relative to cycle start
#ifndef NDEBUG
if (DEBUG_ENABLED (DEBUG::MidiIO)) {
const Session* s = AudioEngine::instance()->session();
- const framepos_t now = (s ? s->transport_frame() : 0);
+ const samplepos_t now = (s ? s->transport_sample() : 0);
DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a, string_compose ("MidiPort %8 %1 pop event @ %2 (global %4, within %5 gpbo %6 pbo %7 sz %3 ", _buffer, ev.time(), ev.size(),
now + ev.time(), nframes, _global_port_buffer_offset, _port_buffer_offset, name()));
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc
index 51b87bdced..cbb9f2d935 100644
--- a/libs/ardour/midi_region.cc
+++ b/libs/ardour/midi_region.cc
@@ -105,7 +105,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other)
}
/** Create a new MidiRegion that is part of an existing one */
-MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, MusicFrame offset)
+MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, MusicSample offset)
: Region (other, offset)
, _start_beats (Properties::start_beats, other->_start_beats)
, _length_beats (Properties::length_beats, other->_length_beats)
@@ -114,8 +114,8 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, MusicFrame of
register_properties ();
- const double offset_quarter_note = _session.tempo_map().exact_qn_at_frame (other->_position + offset.frame, offset.division) - other->_quarter_note;
- if (offset.frame != 0) {
+ const double offset_quarter_note = _session.tempo_map().exact_qn_at_sample (other->_position + offset.sample, offset.division) - other->_quarter_note;
+ if (offset.sample != 0) {
_start_beats = other->_start_beats + offset_quarter_note;
_length_beats = other->_length_beats - offset_quarter_note;
}
@@ -141,9 +141,9 @@ MidiRegion::do_export (string path) const
assert (!Glib::file_test (path, Glib::FILE_TEST_EXISTS));
newsrc = boost::dynamic_pointer_cast<MidiSource>(
SourceFactory::createWritable(DataType::MIDI, _session,
- path, false, _session.frame_rate()));
+ path, false, _session.sample_rate()));
- BeatsFramesConverter bfc (_session.tempo_map(), _position);
+ BeatsSamplesConverter bfc (_session.tempo_map(), _position);
Evoral::Beats const bbegin = bfc.from (_start);
Evoral::Beats const bend = bfc.from (_start + _length);
@@ -172,14 +172,14 @@ MidiRegion::clone (string path) const
assert (!Glib::file_test (path, Glib::FILE_TEST_EXISTS));
newsrc = boost::dynamic_pointer_cast<MidiSource>(
SourceFactory::createWritable(DataType::MIDI, _session,
- path, false, _session.frame_rate()));
+ path, false, _session.sample_rate()));
return clone (newsrc);
}
boost::shared_ptr<MidiRegion>
MidiRegion::clone (boost::shared_ptr<MidiSource> newsrc) const
{
- BeatsFramesConverter bfc (_session.tempo_map(), _position);
+ BeatsSamplesConverter bfc (_session.tempo_map(), _position);
Evoral::Beats const bbegin = bfc.from (_start);
Evoral::Beats const bend = bfc.from (_start + _length);
@@ -235,20 +235,20 @@ MidiRegion::post_set (const PropertyChange& pc)
}
if (pc.contains (Properties::start) && !pc.contains (Properties::start_beats)) {
- set_start_beats_from_start_frames ();
+ set_start_beats_from_start_samples ();
}
}
void
-MidiRegion::set_start_beats_from_start_frames ()
+MidiRegion::set_start_beats_from_start_samples ()
{
if (position_lock_style() == AudioTime) {
- _start_beats = quarter_note() - _session.tempo_map().quarter_note_at_frame (_position - _start);
+ _start_beats = quarter_note() - _session.tempo_map().quarter_note_at_sample (_position - _start);
}
}
void
-MidiRegion::set_length_internal (framecnt_t len, const int32_t sub_num)
+MidiRegion::set_length_internal (samplecnt_t len, const int32_t sub_num)
{
Region::set_length_internal (len, sub_num);
update_length_beats (sub_num);
@@ -263,9 +263,9 @@ MidiRegion::update_after_tempo_map_change (bool /* send */)
return;
}
- const framepos_t old_pos = _position;
- const framepos_t old_length = _length;
- const framepos_t old_start = _start;
+ const samplepos_t old_pos = _position;
+ const samplepos_t old_length = _length;
+ const samplepos_t old_start = _start;
PropertyChange s_and_l;
@@ -286,10 +286,10 @@ MidiRegion::update_after_tempo_map_change (bool /* send */)
For now, the musical position at the region start is retained, but subsequent events
will maintain their beat distance according to the map.
*/
- _start = _session.tempo_map().frames_between_quarter_notes (quarter_note() - start_beats(), quarter_note());
+ _start = _session.tempo_map().samples_between_quarter_notes (quarter_note() - start_beats(), quarter_note());
/* _length doesn't change for audio-locked regions. update length_beats to match. */
- _length_beats = _session.tempo_map().quarter_note_at_frame (_position + _length) - quarter_note();
+ _length_beats = _session.tempo_map().quarter_note_at_sample (_position + _length) - quarter_note();
s_and_l.add (Properties::start);
s_and_l.add (Properties::length_beats);
@@ -301,7 +301,7 @@ MidiRegion::update_after_tempo_map_change (bool /* send */)
Region::update_after_tempo_map_change (false);
/* _start has now been updated. */
- _length = max ((framecnt_t) 1, _session.tempo_map().frames_between_quarter_notes (quarter_note(), quarter_note() + _length_beats));
+ _length = max ((samplecnt_t) 1, _session.tempo_map().samples_between_quarter_notes (quarter_note(), quarter_note() + _length_beats));
if (old_start != _start) {
s_and_l.add (Properties::start);
@@ -319,11 +319,11 @@ MidiRegion::update_after_tempo_map_change (bool /* send */)
void
MidiRegion::update_length_beats (const int32_t sub_num)
{
- _length_beats = _session.tempo_map().exact_qn_at_frame (_position + _length, sub_num) - quarter_note();
+ _length_beats = _session.tempo_map().exact_qn_at_sample (_position + _length, sub_num) - quarter_note();
}
void
-MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute, const int32_t sub_num)
+MidiRegion::set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num)
{
Region::set_position_internal (pos, allow_bbt_recompute, sub_num);
@@ -333,7 +333,7 @@ MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute, con
}
/* set _start to new position in tempo map */
- _start = _session.tempo_map().frames_between_quarter_notes (quarter_note() - start_beats(), quarter_note());
+ _start = _session.tempo_map().samples_between_quarter_notes (quarter_note() - start_beats(), quarter_note());
/* in construction from src */
if (_length_beats == 0.0) {
@@ -341,12 +341,12 @@ MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute, con
}
if (position_lock_style() == AudioTime) {
- _length_beats = _session.tempo_map().quarter_note_at_frame (_position + _length) - quarter_note();
+ _length_beats = _session.tempo_map().quarter_note_at_sample (_position + _length) - quarter_note();
} else {
/* leave _length_beats alone, and change _length to reflect the state of things
- at the new position (tempo map may dictate a different number of frames).
+ at the new position (tempo map may dictate a different number of samples).
*/
- Region::set_length_internal (_session.tempo_map().frames_between_quarter_notes (quarter_note(), quarter_note() + length_beats()), sub_num);
+ Region::set_length_internal (_session.tempo_map().samples_between_quarter_notes (quarter_note(), quarter_note() + length_beats()), sub_num);
}
}
@@ -355,24 +355,24 @@ MidiRegion::set_position_music_internal (double qn)
{
Region::set_position_music_internal (qn);
/* set _start to new position in tempo map */
- _start = _session.tempo_map().frames_between_quarter_notes (quarter_note() - start_beats(), quarter_note());
+ _start = _session.tempo_map().samples_between_quarter_notes (quarter_note() - start_beats(), quarter_note());
if (position_lock_style() == AudioTime) {
- _length_beats = _session.tempo_map().quarter_note_at_frame (_position + _length) - quarter_note();
+ _length_beats = _session.tempo_map().quarter_note_at_sample (_position + _length) - quarter_note();
} else {
/* leave _length_beats alone, and change _length to reflect the state of things
- at the new position (tempo map may dictate a different number of frames).
+ at the new position (tempo map may dictate a different number of samples).
*/
- _length = _session.tempo_map().frames_between_quarter_notes (quarter_note(), quarter_note() + length_beats());
+ _length = _session.tempo_map().samples_between_quarter_notes (quarter_note(), quarter_note() + length_beats());
}
}
-framecnt_t
-MidiRegion::read_at (Evoral::EventSink<framepos_t>& out,
- framepos_t position,
- framecnt_t dur,
- Evoral::Range<framepos_t>* loop_range,
+samplecnt_t
+MidiRegion::read_at (Evoral::EventSink<samplepos_t>& out,
+ samplepos_t position,
+ samplecnt_t dur,
+ Evoral::Range<samplepos_t>* loop_range,
MidiCursor& cursor,
uint32_t chan_n,
NoteMode mode,
@@ -382,11 +382,11 @@ MidiRegion::read_at (Evoral::EventSink<framepos_t>& out,
return _read_at (_sources, out, position, dur, loop_range, cursor, chan_n, mode, tracker, filter);
}
-framecnt_t
-MidiRegion::master_read_at (MidiRingBuffer<framepos_t>& out,
- framepos_t position,
- framecnt_t dur,
- Evoral::Range<framepos_t>* loop_range,
+samplecnt_t
+MidiRegion::master_read_at (MidiRingBuffer<samplepos_t>& out,
+ samplepos_t position,
+ samplecnt_t dur,
+ Evoral::Range<samplepos_t>* loop_range,
MidiCursor& cursor,
uint32_t chan_n,
NoteMode mode) const
@@ -394,20 +394,20 @@ MidiRegion::master_read_at (MidiRingBuffer<framepos_t>& out,
return _read_at (_master_sources, out, position, dur, loop_range, cursor, chan_n, mode); /* no tracker */
}
-framecnt_t
+samplecnt_t
MidiRegion::_read_at (const SourceList& /*srcs*/,
- Evoral::EventSink<framepos_t>& dst,
- framepos_t position,
- framecnt_t dur,
- Evoral::Range<framepos_t>* loop_range,
+ Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t position,
+ samplecnt_t dur,
+ Evoral::Range<samplepos_t>* loop_range,
MidiCursor& cursor,
uint32_t chan_n,
NoteMode mode,
MidiStateTracker* tracker,
MidiChannelFilter* filter) const
{
- frameoffset_t internal_offset = 0;
- framecnt_t to_read = 0;
+ sampleoffset_t internal_offset = 0;
+ samplecnt_t to_read = 0;
/* precondition: caller has verified that we cover the desired section */
@@ -453,14 +453,14 @@ MidiRegion::_read_at (const SourceList& /*srcs*/,
<< endl;
#endif
- /* This call reads events from a source and writes them to `dst' timed in session frames */
+ /* This call reads events from a source and writes them to `dst' timed in session samples */
if (src->midi_read (
lm, // source lock
dst, // destination buffer
- _position - _start, // start position of the source in session frames
+ _position - _start, // start position of the source in session samples
_start + internal_offset, // where to start reading in the source
- to_read, // read duration in frames
+ to_read, // read duration in samples
loop_range,
cursor,
tracker,
@@ -602,7 +602,7 @@ MidiRegion::model_shifted (double qn_distance)
if (!_ignore_shift) {
PropertyChange what_changed;
_start_beats += qn_distance;
- framepos_t const new_start = _session.tempo_map().frames_between_quarter_notes (_quarter_note - _start_beats, _quarter_note);
+ samplepos_t const new_start = _session.tempo_map().samples_between_quarter_notes (_quarter_note - _start_beats, _quarter_note);
_start = new_start;
what_changed.add (Properties::start);
what_changed.add (Properties::start_beats);
@@ -643,7 +643,7 @@ MidiRegion::model_automation_state_changed (Evoral::Parameter const & p)
void
MidiRegion::fix_negative_start ()
{
- BeatsFramesConverter c (_session.tempo_map(), _position);
+ BeatsSamplesConverter c (_session.tempo_map(), _position);
_ignore_shift = true;
@@ -654,15 +654,15 @@ MidiRegion::fix_negative_start ()
}
void
-MidiRegion::set_start_internal (framecnt_t s, const int32_t sub_num)
+MidiRegion::set_start_internal (samplecnt_t s, const int32_t sub_num)
{
Region::set_start_internal (s, sub_num);
- set_start_beats_from_start_frames ();
+ set_start_beats_from_start_samples ();
}
void
-MidiRegion::trim_to_internal (framepos_t position, framecnt_t length, const int32_t sub_num)
+MidiRegion::trim_to_internal (samplepos_t position, samplecnt_t length, const int32_t sub_num)
{
if (locked()) {
return;
@@ -674,14 +674,14 @@ MidiRegion::trim_to_internal (framepos_t position, framecnt_t length, const int3
/* Set position before length, otherwise for MIDI regions this bad thing happens:
* 1. we call set_length_internal; length in beats is computed using the region's current
* (soon-to-be old) position
- * 2. we call set_position_internal; position is set and length in frames re-computed using
+ * 2. we call set_position_internal; position is set and length in samples re-computed using
* length in beats from (1) but at the new position, which is wrong if the region
* straddles a tempo/meter change.
*/
if (_position != position) {
- const double pos_qn = _session.tempo_map().exact_qn_at_frame (position, sub_num);
+ const double pos_qn = _session.tempo_map().exact_qn_at_sample (position, sub_num);
const double old_pos_qn = quarter_note();
/* sets _pulse to new position.*/
@@ -689,7 +689,7 @@ MidiRegion::trim_to_internal (framepos_t position, framecnt_t length, const int3
what_changed.add (Properties::position);
double new_start_qn = start_beats() + (pos_qn - old_pos_qn);
- framepos_t new_start = _session.tempo_map().frames_between_quarter_notes (pos_qn - new_start_qn, pos_qn);
+ samplepos_t new_start = _session.tempo_map().samples_between_quarter_notes (pos_qn - new_start_qn, pos_qn);
if (!verify_start_and_length (new_start, length)) {
return;
diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc
index 187de574b6..3b8f6fc39e 100644
--- a/libs/ardour/midi_ring_buffer.cc
+++ b/libs/ardour/midi_ring_buffer.cc
@@ -37,7 +37,7 @@ namespace ARDOUR {
*/
template<typename T>
size_t
-MidiRingBuffer<T>::read (MidiBuffer& dst, framepos_t start, framepos_t end, framecnt_t offset, bool stop_on_overflow_in_dst)
+MidiRingBuffer<T>::read (MidiBuffer& dst, samplepos_t start, samplepos_t end, samplecnt_t offset, bool stop_on_overflow_in_dst)
{
if (this->read_space() == 0) {
return 0;
@@ -129,7 +129,7 @@ MidiRingBuffer<T>::read (MidiBuffer& dst, framepos_t start, framepos_t end, fram
template<typename T>
size_t
-MidiRingBuffer<T>::skip_to(framepos_t start)
+MidiRingBuffer<T>::skip_to(samplepos_t start)
{
if (this->read_space() == 0) {
return 0;
@@ -194,7 +194,7 @@ MidiRingBuffer<T>::skip_to(framepos_t start)
template<typename T>
void
-MidiRingBuffer<T>::flush (framepos_t /*start*/, framepos_t end)
+MidiRingBuffer<T>::flush (samplepos_t /*start*/, samplepos_t end)
{
const size_t prefix_size = sizeof(T) + sizeof(Evoral::EventType) + sizeof(uint32_t);
@@ -309,18 +309,18 @@ MidiRingBuffer<T>::reset_tracker ()
template<typename T>
void
-MidiRingBuffer<T>::resolve_tracker (MidiBuffer& dst, framepos_t t)
+MidiRingBuffer<T>::resolve_tracker (MidiBuffer& dst, samplepos_t t)
{
_tracker.resolve_notes (dst, t);
}
template<typename T>
void
-MidiRingBuffer<T>::resolve_tracker (Evoral::EventSink<framepos_t>& dst, framepos_t t)
+MidiRingBuffer<T>::resolve_tracker (Evoral::EventSink<samplepos_t>& dst, samplepos_t t)
{
_tracker.resolve_notes(dst, t);
}
-template class MidiRingBuffer<framepos_t>;
+template class MidiRingBuffer<samplepos_t>;
} // namespace ARDOUR
diff --git a/libs/ardour/midi_scene_changer.cc b/libs/ardour/midi_scene_changer.cc
index ce2559180f..11805b6d13 100644
--- a/libs/ardour/midi_scene_changer.cc
+++ b/libs/ardour/midi_scene_changer.cc
@@ -94,7 +94,7 @@ MIDISceneChanger::gather (const Locations::LocationList& locations)
}
void
-MIDISceneChanger::rt_deliver (MidiBuffer& mbuf, framepos_t when, boost::shared_ptr<MIDISceneChange> msc)
+MIDISceneChanger::rt_deliver (MidiBuffer& mbuf, samplepos_t when, boost::shared_ptr<MIDISceneChange> msc)
{
if (!msc->active()) {
return;
@@ -157,7 +157,7 @@ MIDISceneChanger::non_rt_deliver (boost::shared_ptr<MIDISceneChange> msc)
}
void
-MIDISceneChanger::run (framepos_t start, framepos_t end)
+MIDISceneChanger::run (samplepos_t start, samplepos_t end)
{
if (!output_port || recording() || !_session.transport_rolling()) {
return;
@@ -187,7 +187,7 @@ MIDISceneChanger::run (framepos_t start, framepos_t end)
}
void
-MIDISceneChanger::locate (framepos_t pos)
+MIDISceneChanger::locate (samplepos_t pos)
{
boost::shared_ptr<MIDISceneChange> msc;
@@ -279,7 +279,7 @@ void
void
MIDISceneChanger::program_change_input (MIDI::Parser& parser, MIDI::byte program, int channel)
{
- framecnt_t time = parser.get_timestamp ();
+ samplecnt_t time = parser.get_timestamp ();
last_program_message_time = time;
@@ -302,7 +302,7 @@ MIDISceneChanger::program_change_input (MIDI::Parser& parser, MIDI::byte program
/* check for marker at current location */
- loc = locations->mark_at (time, Config->get_inter_scene_gap_frames());
+ loc = locations->mark_at (time, Config->get_inter_scene_gap_samples());
if (!loc) {
/* create a new marker at the desired position */
@@ -356,7 +356,7 @@ MIDISceneChanger::jump_to (int bank, int program)
{
const Locations::LocationList& locations (_session.locations()->list());
boost::shared_ptr<SceneChange> sc;
- framepos_t where = max_framepos;
+ samplepos_t where = max_samplepos;
for (Locations::LocationList::const_iterator l = locations.begin(); l != locations.end(); ++l) {
@@ -370,7 +370,7 @@ MIDISceneChanger::jump_to (int bank, int program)
}
}
- if (where != max_framepos) {
+ if (where != max_samplepos) {
_session.request_locate (where);
}
}
diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc
index 9af3009a73..02f24e730b 100644
--- a/libs/ardour/midi_source.cc
+++ b/libs/ardour/midi_source.cc
@@ -156,19 +156,19 @@ MidiSource::empty () const
return !_length_beats;
}
-framecnt_t
-MidiSource::length (framepos_t pos) const
+samplecnt_t
+MidiSource::length (samplepos_t pos) const
{
if (!_length_beats) {
return 0;
}
- BeatsFramesConverter converter(_session.tempo_map(), pos);
+ BeatsSamplesConverter converter(_session.tempo_map(), pos);
return converter.to(_length_beats);
}
void
-MidiSource::update_length (framecnt_t)
+MidiSource::update_length (samplecnt_t)
{
// You're not the boss of me!
}
@@ -179,13 +179,13 @@ MidiSource::invalidate (const Lock& lock)
Invalidated(_session.transport_rolling());
}
-framecnt_t
+samplecnt_t
MidiSource::midi_read (const Lock& lm,
- Evoral::EventSink<framepos_t>& dst,
- framepos_t source_start,
- framepos_t start,
- framecnt_t cnt,
- Evoral::Range<framepos_t>* loop_range,
+ Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t source_start,
+ samplepos_t start,
+ samplecnt_t cnt,
+ Evoral::Range<samplepos_t>* loop_range,
MidiCursor& cursor,
MidiStateTracker* tracker,
MidiChannelFilter* filter,
@@ -193,7 +193,7 @@ MidiSource::midi_read (const Lock& lm,
const double pos_beats,
const double start_beats) const
{
- BeatsFramesConverter converter(_session.tempo_map(), source_start);
+ BeatsSamplesConverter converter(_session.tempo_map(), source_start);
const double start_qn = pos_beats - start_beats;
@@ -227,18 +227,18 @@ MidiSource::midi_read (const Lock& lm,
// Offset by source start to convert event time to session time
- framepos_t time_frames = _session.tempo_map().frame_at_quarter_note (i->time().to_double() + start_qn);
+ samplepos_t time_samples = _session.tempo_map().sample_at_quarter_note (i->time().to_double() + start_qn);
- if (time_frames < start + source_start) {
+ if (time_samples < start + source_start) {
/* event too early */
continue;
- } else if (time_frames >= start + cnt + source_start) {
+ } else if (time_samples >= start + cnt + source_start) {
DEBUG_TRACE (DEBUG::MidiSourceIO,
string_compose ("%1: reached end with event @ %2 vs. %3\n",
- _name, time_frames, start+cnt));
+ _name, time_samples, start+cnt));
break;
} else {
@@ -246,7 +246,7 @@ MidiSource::midi_read (const Lock& lm,
/* in range */
if (loop_range) {
- time_frames = loop_range->squish (time_frames);
+ time_samples = loop_range->squish (time_samples);
}
const uint8_t status = i->buffer()[0];
@@ -258,21 +258,21 @@ MidiSource::midi_read (const Lock& lm,
destroying events in the model during read. */
Evoral::Event<Evoral::Beats> ev(*i, true);
if (!filter->filter(ev.buffer(), ev.size())) {
- dst.write(time_frames, ev.event_type(), ev.size(), ev.buffer());
+ dst.write(time_samples, ev.event_type(), ev.size(), ev.buffer());
} else {
DEBUG_TRACE (DEBUG::MidiSourceIO,
string_compose ("%1: filter event @ %2 type %3 size %4\n",
- _name, time_frames, i->event_type(), i->size()));
+ _name, time_samples, i->event_type(), i->size()));
}
} else {
- dst.write (time_frames, i->event_type(), i->size(), i->buffer());
+ dst.write (time_samples, i->event_type(), i->size(), i->buffer());
}
#ifndef NDEBUG
if (DEBUG_ENABLED(DEBUG::MidiSourceIO)) {
DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a, string_compose ("%1 added event @ %2 sz %3 within %4 .. %5 ",
- _name, time_frames, i->size(),
+ _name, time_samples, i->size(),
start + source_start, start + cnt + source_start));
for (size_t n=0; n < i->size(); ++n) {
DEBUG_STR_APPEND(a,hex);
@@ -294,15 +294,15 @@ MidiSource::midi_read (const Lock& lm,
return cnt;
}
-framecnt_t
+samplecnt_t
MidiSource::midi_write (const Lock& lm,
- MidiRingBuffer<framepos_t>& source,
- framepos_t source_start,
- framecnt_t cnt)
+ MidiRingBuffer<samplepos_t>& source,
+ samplepos_t source_start,
+ samplecnt_t cnt)
{
- const framecnt_t ret = write_unlocked (lm, source, source_start, cnt);
+ const samplecnt_t ret = write_unlocked (lm, source, source_start, cnt);
- if (cnt == max_framecnt) {
+ if (cnt == max_samplecnt) {
invalidate(lm);
} else {
_capture_length += cnt;
@@ -323,12 +323,12 @@ MidiSource::mark_streaming_midi_write_started (const Lock& lock, NoteMode mode)
}
void
-MidiSource::mark_write_starting_now (framecnt_t position,
- framecnt_t capture_length,
- framecnt_t loop_length)
+MidiSource::mark_write_starting_now (samplecnt_t position,
+ samplecnt_t capture_length,
+ samplecnt_t loop_length)
{
/* I'm not sure if this is the best way to approach this, but
- _capture_length needs to be set up with the transport frame
+ _capture_length needs to be set up with the transport sample
when a record actually starts, as it is used by
SMFSource::write_unlocked to decide whether incoming notes
are within the correct time range.
@@ -343,7 +343,7 @@ MidiSource::mark_write_starting_now (framecnt_t position,
_capture_loop_length = loop_length;
TempoMap& map (_session.tempo_map());
- BeatsFramesConverter converter(map, position);
+ BeatsSamplesConverter converter(map, position);
_length_beats = converter.from(capture_length);
}
diff --git a/libs/ardour/midi_state_tracker.cc b/libs/ardour/midi_state_tracker.cc
index 4374c06463..05312cf8bb 100644
--- a/libs/ardour/midi_state_tracker.cc
+++ b/libs/ardour/midi_state_tracker.cc
@@ -110,7 +110,7 @@ MidiStateTracker::track (const uint8_t* evbuf)
}
void
-MidiStateTracker::resolve_notes (MidiBuffer &dst, framepos_t time)
+MidiStateTracker::resolve_notes (MidiBuffer &dst, samplepos_t time)
{
DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 MB-resolve notes @ %2 on = %3\n", this, time, _on));
@@ -138,7 +138,7 @@ MidiStateTracker::resolve_notes (MidiBuffer &dst, framepos_t time)
}
void
-MidiStateTracker::resolve_notes (Evoral::EventSink<framepos_t> &dst, framepos_t time)
+MidiStateTracker::resolve_notes (Evoral::EventSink<samplepos_t> &dst, samplepos_t time)
{
uint8_t buf[3];
diff --git a/libs/ardour/midi_stretch.cc b/libs/ardour/midi_stretch.cc
index 70f44e19c1..bf7fbd752b 100644
--- a/libs/ardour/midi_stretch.cc
+++ b/libs/ardour/midi_stretch.cc
@@ -115,7 +115,7 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*)
const int ret = finish (region, nsrcs, new_name);
/* non-musical */
- results[0]->set_length((framecnt_t) floor (r->length() * _request.time_fraction), 0);
+ results[0]->set_length((samplecnt_t) floor (r->length() * _request.time_fraction), 0);
return ret;
}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 73a67a9389..91916bd914 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -34,7 +34,7 @@
#include "evoral/midi_util.h"
#include "ardour/amp.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/buffer_set.h"
#include "ardour/debug.h"
#include "ardour/delivery.h"
@@ -307,11 +307,11 @@ MidiTrack::update_controls(const BufferSet& bufs)
{
const MidiBuffer& buf = bufs.get_midi(0);
for (MidiBuffer::const_iterator e = buf.begin(); e != buf.end(); ++e) {
- const Evoral::Event<framepos_t>& ev = *e;
+ const Evoral::Event<samplepos_t>& ev = *e;
const Evoral::Parameter param = midi_parameter(ev.buffer(), ev.size());
const boost::shared_ptr<AutomationControl> control = automation_control (param);
if (control) {
- control->set_double(ev.value(), _session.transport_frame(), false);
+ control->set_double(ev.value(), _session.transport_sample(), false);
control->Changed (false, Controllable::NoGroup);
}
}
@@ -321,7 +321,7 @@ MidiTrack::update_controls(const BufferSet& bufs)
* or set to false.
*/
int
-MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
+MidiTrack::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
@@ -352,16 +352,16 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
_capture_filter.filter (bufs);
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _disk_writer->record_enabled())) {
- _meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true);
+ _meter->run (bufs, start_sample, end_sample, 1.0 /*speed()*/, nframes, true);
}
/* append immediate messages to the first MIDI buffer (thus sending it to the first output port) */
- write_out_of_band_data (bufs, start_frame, end_frame, nframes);
+ write_out_of_band_data (bufs, start_sample, end_sample, nframes);
/* final argument: don't waste time with automation if we're not recording or rolling */
- process_output_buffers (bufs, start_frame, end_frame, nframes, declick, (!_disk_writer->record_enabled() && !_session.transport_stopped()));
+ process_output_buffers (bufs, start_sample, end_sample, nframes, declick, (!_disk_writer->record_enabled() && !_session.transport_stopped()));
if (_disk_reader->need_butler() || _disk_writer->need_butler()) {
need_butler = true;
@@ -373,9 +373,9 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
}
int
-MidiTrack::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing)
+MidiTrack::no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool state_changing)
{
- int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing);
+ int ret = Track::no_roll (nframes, start_sample, end_sample, state_changing);
if (ret == 0 && _step_editing) {
push_midi_input_to_step_edit_ringbuffer (nframes);
@@ -401,7 +401,7 @@ MidiTrack::realtime_locate ()
}
void
-MidiTrack::non_realtime_locate (framepos_t pos)
+MidiTrack::non_realtime_locate (samplepos_t pos)
{
Track::non_realtime_locate(pos);
@@ -428,8 +428,8 @@ MidiTrack::non_realtime_locate (framepos_t pos)
}
/* Update track controllers based on its "automation". */
- const framepos_t origin = region->position() - region->start();
- BeatsFramesConverter bfc(_session.tempo_map(), origin);
+ const samplepos_t origin = region->position() - region->start();
+ BeatsSamplesConverter bfc(_session.tempo_map(), origin);
for (Controls::const_iterator c = _controls.begin(); c != _controls.end(); ++c) {
boost::shared_ptr<MidiTrack::MidiControl> tcontrol;
boost::shared_ptr<Evoral::Control> rcontrol;
@@ -444,7 +444,7 @@ MidiTrack::non_realtime_locate (framepos_t pos)
}
void
-MidiTrack::push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes)
+MidiTrack::push_midi_input_to_step_edit_ringbuffer (samplecnt_t nframes)
{
PortSet& ports (_input->ports());
@@ -456,7 +456,7 @@ MidiTrack::push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes)
for (MidiBuffer::const_iterator e = mb->begin(); e != mb->end(); ++e) {
- const Evoral::Event<framepos_t> ev(*e, false);
+ const Evoral::Event<samplepos_t> ev(*e, false);
/* note on, since for step edit, note length is determined
elsewhere
@@ -471,7 +471,7 @@ MidiTrack::push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes)
}
void
-MidiTrack::write_out_of_band_data (BufferSet& bufs, framepos_t /*start*/, framepos_t /*end*/, framecnt_t nframes)
+MidiTrack::write_out_of_band_data (BufferSet& bufs, samplepos_t /*start*/, samplepos_t /*end*/, samplecnt_t nframes)
{
MidiBuffer& buf (bufs.get_midi (0));
@@ -499,8 +499,8 @@ MidiTrack::write_out_of_band_data (BufferSet& bufs, framepos_t /*start*/, framep
int
MidiTrack::export_stuff (BufferSet& buffers,
- framepos_t start,
- framecnt_t nframes,
+ samplepos_t start,
+ samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint,
bool for_export,
@@ -530,12 +530,12 @@ MidiTrack::export_stuff (BufferSet& buffers,
boost::shared_ptr<Region>
MidiTrack::bounce (InterThreadInfo& itt)
{
- return bounce_range (_session.current_start_frame(), _session.current_end_frame(), itt, main_outs(), false);
+ return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false);
}
boost::shared_ptr<Region>
-MidiTrack::bounce_range (framepos_t start,
- framepos_t end,
+MidiTrack::bounce_range (samplepos_t start,
+ samplepos_t end,
InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint)
diff --git a/libs/ardour/midi_ui.cc b/libs/ardour/midi_ui.cc
index 11ab77a851..eb7d1cf763 100644
--- a/libs/ardour/midi_ui.cc
+++ b/libs/ardour/midi_ui.cc
@@ -99,7 +99,7 @@ MidiControlUI::midi_input_handler (IOCondition ioc, boost::weak_ptr<AsyncMIDIPor
port->clear ();
DEBUG_TRACE (DEBUG::MidiIO, string_compose ("data available on %1\n", boost::shared_ptr<ARDOUR::Port>(port)->name()));
- framepos_t now = _session.engine().sample_time();
+ samplepos_t now = _session.engine().sample_time();
port->parse (now);
}
diff --git a/libs/ardour/mididm.cc b/libs/ardour/mididm.cc
index 0b95fc1bd5..14684792fd 100644
--- a/libs/ardour/mididm.cc
+++ b/libs/ardour/mididm.cc
@@ -21,7 +21,7 @@
using namespace ARDOUR;
-MIDIDM::MIDIDM (framecnt_t sample_rate)
+MIDIDM::MIDIDM (samplecnt_t sample_rate)
: _sample_rate (sample_rate)
, _monotonic_cnt (sample_rate)
, _last_signal_tme (0)
@@ -78,7 +78,7 @@ int MIDIDM::process (pframes_t nframes, PortEngine &pe, void *midi_in, void *mid
obuf[1] = (_monotonic_cnt) & 0x7f;
obuf[2] = (_monotonic_cnt >> 7) & 0x7f;
pe.midi_event_put (midi_out, 0, obuf, 3);
-#else // sysex MTC frame
+#else // sysex MTC sample
uint8_t obuf[10];
obuf[0] = 0xf0;
obuf[1] = 0x7f;
diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc
index 1c6f7378c1..e035d6a346 100644
--- a/libs/ardour/monitor_processor.cc
+++ b/libs/ardour/monitor_processor.cc
@@ -257,7 +257,7 @@ MonitorProcessor::state (bool full)
}
void
-MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool /*result_required*/)
+MonitorProcessor::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool /*result_required*/)
{
uint32_t chn = 0;
gain_t target_gain;
@@ -290,7 +290,7 @@ MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /
if (target_gain != _channels[chn]->current_gain || target_gain != GAIN_COEFF_UNITY) {
- _channels[chn]->current_gain = Amp::apply_gain (*b, _session.nominal_frame_rate(), nframes, _channels[chn]->current_gain, target_gain);
+ _channels[chn]->current_gain = Amp::apply_gain (*b, _session.nominal_sample_rate(), nframes, _channels[chn]->current_gain, target_gain);
}
++chn;
diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc
index cbb97cf1ad..0f277a7f55 100644
--- a/libs/ardour/mtc_slave.cc
+++ b/libs/ardour/mtc_slave.cc
@@ -49,7 +49,7 @@ using namespace Timecode;
recently received position (and without the direction of timecode reversing too), we
will stop+locate+wait+chase.
*/
-const int MTC_Slave::frame_tolerance = 2;
+const int MTC_Slave::sample_tolerance = 2;
MTC_Slave::MTC_Slave (Session& s, MidiPort& p)
: session (s)
@@ -136,20 +136,20 @@ MTC_Slave::give_slave_full_control_over_transport_speed() const
// return false; // for Session-level computed varispeed
}
-ARDOUR::framecnt_t
+ARDOUR::samplecnt_t
MTC_Slave::resolution () const
{
- return (framecnt_t) quarter_frame_duration * 4.0;
+ return (samplecnt_t) quarter_frame_duration * 4.0;
}
-ARDOUR::framecnt_t
+ARDOUR::samplecnt_t
MTC_Slave::seekahead_distance () const
{
return quarter_frame_duration * 8 * transport_direction;
}
bool
-MTC_Slave::outside_window (framepos_t pos) const
+MTC_Slave::outside_window (samplepos_t pos) const
{
return ((pos < window_begin) || (pos > window_end));
}
@@ -249,9 +249,9 @@ MTC_Slave::read_current (SafeTime *st) const
}
void
-MTC_Slave::init_mtc_dll(framepos_t tme, double qtr)
+MTC_Slave::init_mtc_dll(samplepos_t tme, double qtr)
{
- omega = 2.0 * M_PI * qtr / 2.0 / double(session.frame_rate());
+ omega = 2.0 * M_PI * qtr / 2.0 / double(session.sample_rate());
b = 1.4142135623730950488 * omega;
c = omega * omega;
@@ -263,7 +263,7 @@ MTC_Slave::init_mtc_dll(framepos_t tme, double qtr)
/* called from MIDI parser */
void
-MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, framepos_t now)
+MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, samplepos_t now)
{
busy_guard1++;
const double qtr_d = quarter_frame_duration;
@@ -271,7 +271,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, framepos_t now)
mtc_frame_dll += qtr_d * (double) transport_direction;
mtc_frame = rint(mtc_frame_dll);
- DEBUG_TRACE (DEBUG::MTC, string_compose ("qtr frame %1 at %2 -> mtc_frame: %3\n", which_qtr, now, mtc_frame));
+ DEBUG_TRACE (DEBUG::MTC, string_compose ("qtr sample %1 at %2 -> mtc_frame: %3\n", which_qtr, now, mtc_frame));
double mtc_speed = 0;
if (first_mtc_timestamp != 0) {
@@ -282,7 +282,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, framepos_t now)
e2 += c * e;
mtc_speed = (t1 - t0) / qtr_d;
- DEBUG_TRACE (DEBUG::MTC, string_compose ("qtr frame DLL t0:%1 t1:%2 err:%3 spd:%4 ddt:%5\n", t0, t1, e, mtc_speed, e2 - qtr_d));
+ DEBUG_TRACE (DEBUG::MTC, string_compose ("qtr sample DLL t0:%1 t1:%2 err:%3 spd:%4 ddt:%5\n", t0, t1, e, mtc_speed, e2 - qtr_d));
current.guard1++;
current.position = mtc_frame;
@@ -302,7 +302,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, framepos_t now)
* when a full TC has been received
* OR on locate */
void
-MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, framepos_t now)
+MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, samplepos_t now)
{
busy_guard1++;
@@ -414,10 +414,10 @@ MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, framepos_t now
consideration.
*/
- quarter_frame_duration = (double(session.frame_rate()) / (double) timecode.rate / 4.0);
+ quarter_frame_duration = (double(session.sample_rate()) / (double) timecode.rate / 4.0);
Timecode::timecode_to_sample (timecode, mtc_frame, true, false,
- double(session.frame_rate()),
+ double(session.sample_rate()),
session.config.get_subframes_per_frame(),
timecode_negative_offset, timecode_offset
);
@@ -427,7 +427,7 @@ MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, framepos_t now
if (was_full || outside_window (mtc_frame)) {
DEBUG_TRACE (DEBUG::MTC, string_compose ("update_mtc_time: full TC %1 or outside window %2 MTC %3\n", was_full, outside_window (mtc_frame), mtc_frame));
- session.set_requested_return_frame (-1);
+ session.set_requested_return_sample (-1);
session.request_transport_speed (0);
session.request_locate (mtc_frame, false);
update_mtc_status (MIDI::MTC_Stopped);
@@ -435,15 +435,15 @@ MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, framepos_t now
reset_window (mtc_frame);
} else {
- /* we've had the first set of 8 qtr frame messages, determine position
- and allow continuing qtr frame messages to provide position
+ /* we've had the first set of 8 qtr sample messages, determine position
+ and allow continuing qtr sample messages to provide position
and speed information.
*/
/* We received the last quarter frame 7 quarter frames (1.75 mtc
- frames) after the instance when the contents of the mtc quarter
- frames were decided. Add time to compensate for the elapsed 1.75
- frames.
+ samples) after the instance when the contents of the mtc quarter
+ samples were decided. Add time to compensate for the elapsed 1.75
+ samples.
*/
double qtr = quarter_frame_duration;
long int mtc_off = (long) rint(7.0 * qtr);
@@ -526,14 +526,14 @@ MTC_Slave::update_mtc_status (MIDI::MTC_Status status)
}
void
-MTC_Slave::reset_window (framepos_t root)
+MTC_Slave::reset_window (samplepos_t root)
{
/* if we're waiting for the master to catch us after seeking ahead, keep the window
- of acceptable MTC frames wide open. otherwise, shrink it down to just 2 video frames
+ of acceptable MTC samples wide open. otherwise, shrink it down to just 2 video frames
ahead of the window root (taking direction into account).
*/
- framecnt_t const d = (quarter_frame_duration * 4 * frame_tolerance);
+ samplecnt_t const d = (quarter_frame_duration * 4 * sample_tolerance);
switch (port->self_parser().mtc_running()) {
case MTC_Forward:
@@ -562,7 +562,7 @@ MTC_Slave::reset_window (framepos_t root)
}
void
-MTC_Slave::init_engine_dll (framepos_t pos, framepos_t inc)
+MTC_Slave::init_engine_dll (samplepos_t pos, samplepos_t inc)
{
/* the bandwidth of the DLL is a trade-off,
* because the max-speed of the transport in ardour is
@@ -571,7 +571,7 @@ MTC_Slave::init_engine_dll (framepos_t pos, framepos_t inc)
* But this is only really a problem if the user performs manual
* seeks while transport is running and slaved to MTC.
*/
- oe = 2.0 * M_PI * double(inc) / 2.0 / double(session.frame_rate());
+ oe = 2.0 * M_PI * double(inc) / 2.0 / double(session.sample_rate());
be = 1.4142135623730950488 * oe;
ce = oe * oe;
@@ -584,14 +584,14 @@ MTC_Slave::init_engine_dll (framepos_t pos, framepos_t inc)
/* main entry point from session_process.cc
xo * in process callback context */
bool
-MTC_Slave::speed_and_position (double& speed, framepos_t& pos)
+MTC_Slave::speed_and_position (double& speed, samplepos_t& pos)
{
- framepos_t now = session.engine().sample_time_at_cycle_start();
- framepos_t sess_pos = session.transport_frame(); // corresponds to now
- //sess_pos -= session.engine().frames_since_cycle_start();
+ samplepos_t now = session.engine().sample_time_at_cycle_start();
+ samplepos_t sess_pos = session.transport_sample(); // corresponds to now
+ //sess_pos -= session.engine().samples_since_cycle_start();
SafeTime last;
- frameoffset_t elapsed;
+ sampleoffset_t elapsed;
bool engine_dll_reinitialized = false;
read_current (&last);
@@ -616,22 +616,22 @@ MTC_Slave::speed_and_position (double& speed, framepos_t& pos)
if (last.timestamp == 0) {
speed = 0;
- pos = session.transport_frame() ; // last.position;
+ pos = session.transport_sample() ; // last.position;
DEBUG_TRACE (DEBUG::MTC, string_compose ("first call to MTC_Slave::speed_and_position, pos = %1\n", pos));
return true;
}
- /* no timecode for two frames - conclude that it's stopped */
+ /* no timecode for two samples - conclude that it's stopped */
if (last_inbound_frame && now > last_inbound_frame && now - last_inbound_frame > labs(seekahead_distance())) {
speed = 0;
pos = last.position;
- session.set_requested_return_frame (-1);
+ session.set_requested_return_sample (-1);
session.request_locate (pos, false);
session.request_transport_speed (0);
engine_dll_initstate = 0;
queue_reset (false);
ActiveChanged (false);
- DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC not seen for 2 frames - reset pending, pos = %1\n", pos));
+ DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC not seen for 2 samples - reset pending, pos = %1\n", pos));
return false;
}
@@ -646,9 +646,9 @@ MTC_Slave::speed_and_position (double& speed, framepos_t& pos)
elapsed = 0;
} else {
/* scale elapsed time by the current MTC speed */
- elapsed = (framecnt_t) rint (speed_flt * (now - last.timestamp));
+ elapsed = (samplecnt_t) rint (speed_flt * (now - last.timestamp));
if (give_slave_full_control_over_transport_speed() && !engine_dll_reinitialized) {
- /* there is an engine vs MTC position frame-delta.
+ /* there is an engine vs MTC position sample-delta.
* This mostly due to quantization and rounding of (speed * nframes)
* but can also due to the session-process not calling
* speed_and_position() every cycle under some circumstances.
@@ -674,7 +674,7 @@ MTC_Slave::speed_and_position (double& speed, framepos_t& pos)
*/
if (!session.actively_recording()
&& speed != 0
- && ((pos < 0) || (labs(pos - sess_pos) > 3 * session.frame_rate()))) {
+ && ((pos < 0) || (labs(pos - sess_pos) > 3 * session.sample_rate()))) {
engine_dll_initstate = 0;
queue_reset (false);
}
@@ -707,7 +707,7 @@ MTC_Slave::approximate_current_position() const
}
return Timecode::timecode_format_sampletime(
last.position,
- double(session.frame_rate()),
+ double(session.sample_rate()),
Timecode::timecode_to_frames_per_second(mtc_timecode),
Timecode::timecode_has_drop_frames(mtc_timecode));
}
diff --git a/libs/ardour/mute_control.cc b/libs/ardour/mute_control.cc
index 89d18746f7..fb6c9f0140 100644
--- a/libs/ardour/mute_control.cc
+++ b/libs/ardour/mute_control.cc
@@ -180,7 +180,7 @@ MuteControl::muted_by_others_soloing () const
}
void
-MuteControl::automation_run (framepos_t start, pframes_t len)
+MuteControl::automation_run (samplepos_t start, pframes_t len)
{
boolean_automation_run (start, len);
diff --git a/libs/ardour/note_fixer.cc b/libs/ardour/note_fixer.cc
index 749d873779..a2d943f775 100644
--- a/libs/ardour/note_fixer.cc
+++ b/libs/ardour/note_fixer.cc
@@ -19,7 +19,7 @@
#include "evoral/EventList.hpp"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/midi_state_tracker.h"
#include "ardour/note_fixer.h"
#include "ardour/tempo.h"
@@ -42,13 +42,13 @@ NoteFixer::clear()
void
NoteFixer::prepare(TempoMap& tempo_map,
const MidiModel::NoteDiffCommand* cmd,
- const framepos_t origin,
- const framepos_t pos,
+ const samplepos_t origin,
+ const samplepos_t pos,
std::set< boost::weak_ptr<Note> >& active_notes)
{
typedef MidiModel::NoteDiffCommand Command;
- BeatsFramesConverter converter(tempo_map, origin);
+ BeatsSamplesConverter converter(tempo_map, origin);
for (Command::NoteList::const_iterator i = cmd->removed_notes().begin();
i != cmd->removed_notes().end(); ++i) {
@@ -113,8 +113,8 @@ NoteFixer::prepare(TempoMap& tempo_map,
}
void
-NoteFixer::emit(Evoral::EventSink<framepos_t>& dst,
- framepos_t pos,
+NoteFixer::emit(Evoral::EventSink<samplepos_t>& dst,
+ samplepos_t pos,
MidiStateTracker& tracker)
{
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
@@ -126,18 +126,18 @@ NoteFixer::emit(Evoral::EventSink<framepos_t>& dst,
}
NoteFixer::Event*
-NoteFixer::copy_event(framepos_t time, const Evoral::Event<Evoral::Beats>& ev)
+NoteFixer::copy_event(samplepos_t time, const Evoral::Event<Evoral::Beats>& ev)
{
return new Event(ev.event_type(), time, ev.size(), ev.buffer());
}
bool
-NoteFixer::note_is_active(const BeatsFramesConverter& converter,
+NoteFixer::note_is_active(const BeatsSamplesConverter& converter,
boost::shared_ptr<Note> note,
- framepos_t pos)
+ samplepos_t pos)
{
- const framepos_t start_time = converter.to(note->time());
- const framepos_t end_time = converter.to(note->end_time());
+ const samplepos_t start_time = converter.to(note->time());
+ const samplepos_t end_time = converter.to(note->end_time());
return (start_time < pos && end_time >= pos);
}
diff --git a/libs/ardour/onset_detector.cc b/libs/ardour/onset_detector.cc
index 7658bd86e8..73f94b061b 100644
--- a/libs/ardour/onset_detector.cc
+++ b/libs/ardour/onset_detector.cc
@@ -69,7 +69,7 @@ OnsetDetector::use_features (Plugin::FeatureSet& features, ostream* out)
(*out) << (*f).timestamp.toString() << endl;
}
- current_results->push_back (RealTime::realTime2Frame ((*f).timestamp, (framecnt_t) floor(sample_rate)));
+ current_results->push_back (RealTime::realTime2Frame ((*f).timestamp, (samplecnt_t) floor(sample_rate)));
}
}
@@ -123,7 +123,7 @@ OnsetDetector::cleanup_onsets (AnalysisFeatureList& t, float sr, float gap_msecs
AnalysisFeatureList::iterator i = t.begin();
AnalysisFeatureList::iterator f, b;
- const framecnt_t gap_frames = (framecnt_t) floor (gap_msecs * (sr / 1000.0));
+ const samplecnt_t gap_samples = (samplecnt_t) floor (gap_msecs * (sr / 1000.0));
while (i != t.end()) {
@@ -135,7 +135,7 @@ OnsetDetector::cleanup_onsets (AnalysisFeatureList& t, float sr, float gap_msecs
// move f until we find a new value that is far enough away
- while ((f != t.end()) && (((*f) - (*i)) < gap_frames)) {
+ while ((f != t.end()) && (((*f) - (*i)) < gap_samples)) {
++f;
}
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index a388b5fdc2..c70c8ea790 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -57,7 +57,7 @@ Panner::distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pfram
void
Panner::distribute_automated (BufferSet& ibufs, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes, pan_t** buffers)
+ samplepos_t start, samplepos_t end, pframes_t nframes, pan_t** buffers)
{
uint32_t which = 0;
diff --git a/libs/ardour/panner_shell.cc b/libs/ardour/panner_shell.cc
index e53c1d346c..d99e5068c1 100644
--- a/libs/ardour/panner_shell.cc
+++ b/libs/ardour/panner_shell.cc
@@ -340,7 +340,7 @@ PannerShell::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, pf
}
void
-PannerShell::run (BufferSet& inbufs, BufferSet& outbufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes)
+PannerShell::run (BufferSet& inbufs, BufferSet& outbufs, samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes)
{
if (inbufs.count().n_audio() == 0) {
/* Input has no audio buffers (e.g. Aux Send in a MIDI track at a
@@ -395,7 +395,7 @@ PannerShell::run (BufferSet& inbufs, BufferSet& outbufs, framepos_t start_frame,
i->silence(nframes);
}
- _panner->distribute_automated (inbufs, outbufs, start_frame, end_frame, nframes, _session.pan_automation_buffer());
+ _panner->distribute_automated (inbufs, outbufs, start_sample, end_sample, nframes, _session.pan_automation_buffer());
}
}
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 39a6dc77ed..b93ac55326 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -187,7 +187,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo
_frozen = other->_frozen;
}
-Playlist::Playlist (boost::shared_ptr<const Playlist> other, framepos_t start, framecnt_t cnt, string str, bool hide)
+Playlist::Playlist (boost::shared_ptr<const Playlist> other, samplepos_t start, samplecnt_t cnt, string str, bool hide)
: SessionObject(other->_session, str)
, regions (*this)
, _type(other->_type)
@@ -196,7 +196,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, framepos_t start, f
{
RegionReadLock rlock2 (const_cast<Playlist*> (other.get()));
- framepos_t end = start + cnt - 1;
+ samplepos_t end = start + cnt - 1;
init (hide);
@@ -206,9 +206,9 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, framepos_t start, f
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> new_region;
- frameoffset_t offset = 0;
- framepos_t position = 0;
- framecnt_t len = 0;
+ sampleoffset_t offset = 0;
+ samplepos_t position = 0;
+ samplecnt_t len = 0;
string new_name;
Evoral::OverlapType overlap;
@@ -482,7 +482,7 @@ Playlist::notify_region_removed (boost::shared_ptr<Region> r)
void
Playlist::notify_region_moved (boost::shared_ptr<Region> r)
{
- Evoral::RangeMove<framepos_t> const move (r->last_position (), r->length (), r->position ());
+ Evoral::RangeMove<samplepos_t> const move (r->last_position (), r->length (), r->position ());
if (holding_state ()) {
@@ -490,7 +490,7 @@ Playlist::notify_region_moved (boost::shared_ptr<Region> r)
} else {
- list< Evoral::RangeMove<framepos_t> > m;
+ list< Evoral::RangeMove<samplepos_t> > m;
m.push_back (move);
RangesMoved (m, false);
}
@@ -505,7 +505,7 @@ Playlist::notify_region_start_trimmed (boost::shared_ptr<Region> r)
return;
}
- Evoral::Range<framepos_t> const extra (r->position(), r->last_position());
+ Evoral::Range<samplepos_t> const extra (r->position(), r->last_position());
if (holding_state ()) {
@@ -513,7 +513,7 @@ Playlist::notify_region_start_trimmed (boost::shared_ptr<Region> r)
} else {
- list<Evoral::Range<framepos_t> > r;
+ list<Evoral::Range<samplepos_t> > r;
r.push_back (extra);
RegionsExtended (r);
@@ -527,7 +527,7 @@ Playlist::notify_region_end_trimmed (boost::shared_ptr<Region> r)
/* trimmed shorter */
}
- Evoral::Range<framepos_t> const extra (r->position() + r->last_length(), r->position() + r->length());
+ Evoral::Range<samplepos_t> const extra (r->position() + r->last_length(), r->position() + r->length());
if (holding_state ()) {
@@ -535,7 +535,7 @@ Playlist::notify_region_end_trimmed (boost::shared_ptr<Region> r)
} else {
- list<Evoral::Range<framepos_t> > r;
+ list<Evoral::Range<samplepos_t> > r;
r.push_back (extra);
RegionsExtended (r);
}
@@ -591,7 +591,7 @@ Playlist::flush_notifications (bool from_undo)
// RegionSortByLayer cmp;
// pending_bounds.sort (cmp);
- list<Evoral::Range<framepos_t> > crossfade_ranges;
+ list<Evoral::Range<samplepos_t> > crossfade_ranges;
for (RegionList::iterator r = pending_bounds.begin(); r != pending_bounds.end(); ++r) {
crossfade_ranges.push_back ((*r)->last_range ());
@@ -666,14 +666,14 @@ Playlist::clear_pending ()
/** Note: this calls set_layer (..., DBL_MAX) so it will reset the layering index of region */
void
-Playlist::add_region (boost::shared_ptr<Region> region, framepos_t position, float times, bool auto_partition, int32_t sub_num, double quarter_note, bool for_music)
+Playlist::add_region (boost::shared_ptr<Region> region, samplepos_t position, float times, bool auto_partition, int32_t sub_num, double quarter_note, bool for_music)
{
RegionWriteLock rlock (this);
times = fabs (times);
int itimes = (int) floor (times);
- framepos_t pos = position;
+ samplepos_t pos = position;
if (times == 1 && auto_partition){
RegionList thawlist;
@@ -702,10 +702,10 @@ Playlist::add_region (boost::shared_ptr<Region> region, framepos_t position, flo
pos += region->length();
}
- framecnt_t length = 0;
+ samplecnt_t length = 0;
if (floor (times) != times) {
- length = (framecnt_t) floor (region->length() * (times - floor (times)));
+ length = (samplecnt_t) floor (region->length() * (times - floor (times)));
string name;
RegionFactory::region_name (name, region->name(), false);
@@ -739,7 +739,7 @@ Playlist::set_region_ownership ()
}
bool
-Playlist::add_region_internal (boost::shared_ptr<Region> region, framepos_t position, int32_t sub_num, double quarter_note, bool for_music)
+Playlist::add_region_internal (boost::shared_ptr<Region> region, samplepos_t position, int32_t sub_num, double quarter_note, bool for_music)
{
if (region->data_type() != _type) {
return false;
@@ -778,7 +778,7 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, framepos_t posi
}
void
-Playlist::replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, framepos_t pos)
+Playlist::replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, samplepos_t pos)
{
RegionWriteLock rlock (this);
@@ -816,8 +816,8 @@ Playlist::remove_region_internal (boost::shared_ptr<Region> region)
for (i = regions.begin(); i != regions.end(); ++i) {
if (*i == region) {
- framepos_t pos = (*i)->position();
- framecnt_t distance = (*i)->length();
+ samplepos_t pos = (*i)->position();
+ samplecnt_t distance = (*i)->length();
regions.erase (i);
@@ -877,7 +877,7 @@ Playlist::get_source_equivalent_regions (boost::shared_ptr<Region> other, vector
}
void
-Playlist::partition (framepos_t start, framepos_t end, bool cut)
+Playlist::partition (samplepos_t start, samplepos_t end, bool cut)
{
RegionList thawlist;
{
@@ -894,13 +894,13 @@ Playlist::partition (framepos_t start, framepos_t end, bool cut)
* and _start is overwritten using Properties::start_beats in
* add_region_internal() -> Region::set_position() -> MidiRegion::set_position_internal()
*/
-static void maybe_add_start_beats (TempoMap const& tm, PropertyList& plist, boost::shared_ptr<Region> r, framepos_t start, framepos_t end)
+static void maybe_add_start_beats (TempoMap const& tm, PropertyList& plist, boost::shared_ptr<Region> r, samplepos_t start, samplepos_t end)
{
boost::shared_ptr<MidiRegion> mr = boost::dynamic_pointer_cast<MidiRegion>(r);
if (!mr) {
return;
}
- double delta_beats = tm.quarter_notes_between_frames (start, end);
+ double delta_beats = tm.quarter_notes_between_samples (start, end);
plist.add (Properties::start_beats, mr->start_beats () + delta_beats);
}
@@ -910,7 +910,7 @@ static void maybe_add_start_beats (TempoMap const& tm, PropertyList& plist, boos
*/
void
-Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, RegionList& thawlist)
+Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting, RegionList& thawlist)
{
RegionList new_regions;
@@ -921,7 +921,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
string new_name;
RegionList::iterator tmp;
Evoral::OverlapType overlap;
- framepos_t pos1, pos2, pos3, pos4;
+ samplepos_t pos1, pos2, pos3, pos4;
in_partition = true;
@@ -938,7 +938,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
current = *i;
- if (current->first_frame() >= start && current->last_frame() < end) {
+ if (current->first_sample() >= start && current->last_sample() < end) {
if (cutting) {
remove_region_internal (current);
@@ -952,7 +952,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
so catch this special case.
*/
- if (current->first_frame() >= end) {
+ if (current->first_sample() >= end) {
continue;
}
@@ -963,7 +963,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
pos1 = current->position();
pos2 = start;
pos3 = end;
- pos4 = current->last_frame();
+ pos4 = current->last_sample();
if (overlap == Evoral::OverlapInternal) {
/* split: we need 3 new regions, the front, middle and end.
@@ -999,9 +999,9 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
maybe_add_start_beats (_session.tempo_map(), plist, current, current->start(), current->start() + (pos2 - pos1));
/* see note in :_split_region()
- * for MusicFrame is needed to offset region-gain
+ * for MusicSample is needed to offset region-gain
*/
- region = RegionFactory::create (current, MusicFrame (pos2 - pos1, 0), plist);
+ region = RegionFactory::create (current, MusicSample (pos2 - pos1, 0), plist);
add_region_internal (region, start);
new_regions.push_back (region);
}
@@ -1021,7 +1021,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
plist.add (Properties::right_of_split, true);
maybe_add_start_beats (_session.tempo_map(), plist, current, current->start(), current->start() + (pos3 - pos1));
- region = RegionFactory::create (current, MusicFrame (pos3 - pos1, 0), plist);
+ region = RegionFactory::create (current, MusicSample (pos3 - pos1, 0), plist);
add_region_internal (region, end);
new_regions.push_back (region);
@@ -1062,7 +1062,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
plist.add (Properties::left_of_split, true);
maybe_add_start_beats (_session.tempo_map(), plist, current, current->start(), current->start() + (pos2 - pos1));
- region = RegionFactory::create (current, MusicFrame(pos2 - pos1, 0), plist);
+ region = RegionFactory::create (current, MusicSample(pos2 - pos1, 0), plist);
add_region_internal (region, start);
new_regions.push_back (region);
@@ -1150,16 +1150,16 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
}
//keep track of any dead space at end (for pasting into Ripple or Splice mode)
- framepos_t wanted_length = end-start;
+ samplepos_t wanted_length = end-start;
_end_space = wanted_length - _get_extent().second - _get_extent().first;
}
boost::shared_ptr<Playlist>
-Playlist::cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(framepos_t, framecnt_t,bool), list<AudioRange>& ranges, bool result_is_hidden)
+Playlist::cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(samplepos_t, samplecnt_t,bool), list<AudioRange>& ranges, bool result_is_hidden)
{
boost::shared_ptr<Playlist> ret;
boost::shared_ptr<Playlist> pl;
- framepos_t start;
+ samplepos_t start;
if (ranges.empty()) {
return boost::shared_ptr<Playlist>();
@@ -1190,19 +1190,19 @@ Playlist::cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(framepos_t, fra
boost::shared_ptr<Playlist>
Playlist::cut (list<AudioRange>& ranges, bool result_is_hidden)
{
- boost::shared_ptr<Playlist> (Playlist::*pmf)(framepos_t,framecnt_t,bool) = &Playlist::cut;
+ boost::shared_ptr<Playlist> (Playlist::*pmf)(samplepos_t,samplecnt_t,bool) = &Playlist::cut;
return cut_copy (pmf, ranges, result_is_hidden);
}
boost::shared_ptr<Playlist>
Playlist::copy (list<AudioRange>& ranges, bool result_is_hidden)
{
- boost::shared_ptr<Playlist> (Playlist::*pmf)(framepos_t,framecnt_t,bool) = &Playlist::copy;
+ boost::shared_ptr<Playlist> (Playlist::*pmf)(samplepos_t,samplecnt_t,bool) = &Playlist::copy;
return cut_copy (pmf, ranges, result_is_hidden);
}
boost::shared_ptr<Playlist>
-Playlist::cut (framepos_t start, framecnt_t cnt, bool result_is_hidden)
+Playlist::cut (samplepos_t start, samplecnt_t cnt, bool result_is_hidden)
{
boost::shared_ptr<Playlist> the_copy;
RegionList thawlist;
@@ -1230,7 +1230,7 @@ Playlist::cut (framepos_t start, framecnt_t cnt, bool result_is_hidden)
}
boost::shared_ptr<Playlist>
-Playlist::copy (framepos_t start, framecnt_t cnt, bool result_is_hidden)
+Playlist::copy (samplepos_t start, samplecnt_t cnt, bool result_is_hidden)
{
char buf[32];
@@ -1245,7 +1245,7 @@ Playlist::copy (framepos_t start, framecnt_t cnt, bool result_is_hidden)
}
int
-Playlist::paste (boost::shared_ptr<Playlist> other, framepos_t position, float times, const int32_t sub_num)
+Playlist::paste (boost::shared_ptr<Playlist> other, samplepos_t position, float times, const int32_t sub_num)
{
times = fabs (times);
@@ -1253,8 +1253,8 @@ Playlist::paste (boost::shared_ptr<Playlist> other, framepos_t position, float t
RegionReadLock rl2 (other.get());
int itimes = (int) floor (times);
- framepos_t pos = position;
- framecnt_t const shift = other->_get_extent().second;
+ samplepos_t pos = position;
+ samplecnt_t const shift = other->_get_extent().second;
layer_t top = top_layer ();
{
@@ -1280,14 +1280,14 @@ Playlist::paste (boost::shared_ptr<Playlist> other, framepos_t position, float t
void
-Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, float times)
+Playlist::duplicate (boost::shared_ptr<Region> region, samplepos_t position, float times)
{
duplicate(region, position, region->length(), times);
}
/** @param gap from the beginning of the region to the next beginning */
void
-Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, framecnt_t gap, float times)
+Playlist::duplicate (boost::shared_ptr<Region> region, samplepos_t position, samplecnt_t gap, float times)
{
times = fabs (times);
@@ -1302,7 +1302,7 @@ Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, fram
}
if (floor (times) != times) {
- framecnt_t length = (framecnt_t) floor (region->length() * (times - floor (times)));
+ samplecnt_t length = (samplecnt_t) floor (region->length() * (times - floor (times)));
string name;
RegionFactory::region_name (name, region->name(), false);
@@ -1321,9 +1321,9 @@ Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, fram
}
/** @param gap from the beginning of the region to the next beginning */
-/** @param end the first frame that does _not_ contain a duplicated frame */
+/** @param end the first sample that does _not_ contain a duplicated sample */
void
-Playlist::duplicate_until (boost::shared_ptr<Region> region, framepos_t position, framecnt_t gap, framepos_t end)
+Playlist::duplicate_until (boost::shared_ptr<Region> region, samplepos_t position, samplecnt_t gap, samplepos_t end)
{
RegionWriteLock rl (this);
@@ -1335,7 +1335,7 @@ Playlist::duplicate_until (boost::shared_ptr<Region> region, framepos_t position
}
if (position < end) {
- framecnt_t length = min (region->length(), end - position);
+ samplecnt_t length = min (region->length(), end - position);
string name;
RegionFactory::region_name (name, region->name(), false);
@@ -1357,7 +1357,7 @@ void
Playlist::duplicate_range (AudioRange& range, float times)
{
boost::shared_ptr<Playlist> pl = copy (range.start, range.length(), true);
- framecnt_t offset = range.end - range.start;
+ samplecnt_t offset = range.end - range.start;
paste (pl, range.start + offset, times, 0);
}
@@ -1368,8 +1368,8 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
return;
}
- framepos_t min_pos = max_framepos;
- framepos_t max_pos = 0;
+ samplepos_t min_pos = max_samplepos;
+ samplepos_t max_pos = 0;
for (std::list<AudioRange>::const_iterator i = ranges.begin();
i != ranges.end();
@@ -1378,7 +1378,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
max_pos = max (max_pos, (*i).end);
}
- framecnt_t offset = max_pos - min_pos;
+ samplecnt_t offset = max_pos - min_pos;
int count = 1;
int itimes = (int) floor (times);
@@ -1392,7 +1392,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
void
- Playlist::shift (framepos_t at, frameoffset_t distance, bool move_intersected, bool ignore_music_glue)
+ Playlist::shift (samplepos_t at, sampleoffset_t distance, bool move_intersected, bool ignore_music_glue)
{
RegionWriteLock rlock (this);
RegionList copy (regions.rlist());
@@ -1400,12 +1400,12 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
for (RegionList::iterator r = copy.begin(); r != copy.end(); ++r) {
- if ((*r)->last_frame() < at) {
+ if ((*r)->last_sample() < at) {
/* too early */
continue;
}
- if (at > (*r)->first_frame() && at < (*r)->last_frame()) {
+ if (at > (*r)->first_sample() && at < (*r)->last_sample()) {
/* intersected region */
if (!move_intersected) {
continue;
@@ -1431,7 +1431,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
void
- Playlist::split (const MusicFrame& at)
+ Playlist::split (const MusicSample& at)
{
RegionWriteLock rlock (this);
RegionList copy (regions.rlist());
@@ -1445,29 +1445,29 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
void
- Playlist::split_region (boost::shared_ptr<Region> region, const MusicFrame& playlist_position)
+ Playlist::split_region (boost::shared_ptr<Region> region, const MusicSample& playlist_position)
{
RegionWriteLock rl (this);
_split_region (region, playlist_position);
}
void
- Playlist::_split_region (boost::shared_ptr<Region> region, const MusicFrame& playlist_position)
+ Playlist::_split_region (boost::shared_ptr<Region> region, const MusicSample& playlist_position)
{
- if (!region->covers (playlist_position.frame)) {
+ if (!region->covers (playlist_position.sample)) {
return;
}
- if (region->position() == playlist_position.frame ||
- region->last_frame() == playlist_position.frame) {
+ if (region->position() == playlist_position.sample ||
+ region->last_sample() == playlist_position.sample) {
return;
}
boost::shared_ptr<Region> left;
boost::shared_ptr<Region> right;
- MusicFrame before (playlist_position.frame - region->position(), playlist_position.division);
- MusicFrame after (region->length() - before.frame, 0);
+ MusicSample before (playlist_position.sample - region->position(), playlist_position.division);
+ MusicSample after (region->length() - before.sample, 0);
string before_name;
string after_name;
@@ -1481,7 +1481,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
{
PropertyList plist;
- plist.add (Properties::length, before.frame);
+ plist.add (Properties::length, before.sample);
plist.add (Properties::name, before_name);
plist.add (Properties::left_of_split, true);
plist.add (Properties::layering_index, region->layering_index ());
@@ -1491,7 +1491,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
since it supplies that offset to the Region constructor, which
is necessary to get audio region gain envelopes right.
*/
- left = RegionFactory::create (region, MusicFrame (0, 0), plist, true);
+ left = RegionFactory::create (region, MusicSample (0, 0), plist, true);
}
RegionFactory::region_name (after_name, region->name(), false);
@@ -1499,7 +1499,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
{
PropertyList plist;
- plist.add (Properties::length, after.frame);
+ plist.add (Properties::length, after.sample);
plist.add (Properties::name, after_name);
plist.add (Properties::right_of_split, true);
plist.add (Properties::layering_index, region->layering_index ());
@@ -1510,7 +1510,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
add_region_internal (left, region->position(), 0);
- add_region_internal (right, region->position() + before.frame, before.division);
+ add_region_internal (right, region->position() + before.sample, before.division);
remove_region_internal (region);
@@ -1518,7 +1518,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
void
- Playlist::possibly_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude)
+ Playlist::possibly_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
{
if (_splicing || in_set_state) {
/* don't respond to splicing moves or state setting */
@@ -1531,7 +1531,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
void
- Playlist::possibly_splice_unlocked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude)
+ Playlist::possibly_splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
{
if (_splicing || in_set_state) {
/* don't respond to splicing moves or state setting */
@@ -1544,7 +1544,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
void
- Playlist::splice_locked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude)
+ Playlist::splice_locked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
{
{
RegionWriteLock rl (this);
@@ -1553,13 +1553,13 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
void
- Playlist::splice_unlocked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude)
+ Playlist::splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
{
core_splice (at, distance, exclude);
}
void
- Playlist::core_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude)
+ Playlist::core_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
{
_splicing = true;
@@ -1570,11 +1570,11 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
if ((*i)->position() >= at) {
- framepos_t new_pos = (*i)->position() + distance;
+ samplepos_t new_pos = (*i)->position() + distance;
if (new_pos < 0) {
new_pos = 0;
- } else if (new_pos >= max_framepos - (*i)->length()) {
- new_pos = max_framepos - (*i)->length();
+ } else if (new_pos >= max_samplepos - (*i)->length()) {
+ new_pos = max_samplepos - (*i)->length();
}
(*i)->set_position (new_pos);
@@ -1587,7 +1587,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
}
void
-Playlist::ripple_locked (framepos_t at, framecnt_t distance, RegionList *exclude)
+Playlist::ripple_locked (samplepos_t at, samplecnt_t distance, RegionList *exclude)
{
{
RegionWriteLock rl (this);
@@ -1596,13 +1596,13 @@ Playlist::ripple_locked (framepos_t at, framecnt_t distance, RegionList *exclude
}
void
-Playlist::ripple_unlocked (framepos_t at, framecnt_t distance, RegionList *exclude)
+Playlist::ripple_unlocked (samplepos_t at, samplecnt_t distance, RegionList *exclude)
{
core_ripple (at, distance, exclude);
}
void
-Playlist::core_ripple (framepos_t at, framecnt_t distance, RegionList *exclude)
+Playlist::core_ripple (samplepos_t at, samplecnt_t distance, RegionList *exclude)
{
if (distance == 0) {
return;
@@ -1620,8 +1620,8 @@ Playlist::core_ripple (framepos_t at, framecnt_t distance, RegionList *exclude)
}
if ((*i)->position() >= at) {
- framepos_t new_pos = (*i)->position() + distance;
- framepos_t limit = max_framepos - (*i)->length();
+ samplepos_t new_pos = (*i)->position() + distance;
+ samplepos_t limit = max_samplepos - (*i)->length();
if (new_pos < 0) {
new_pos = 0;
} else if (new_pos >= limit ) {
@@ -1668,7 +1668,7 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
if (what_changed.contains (Properties::position) || what_changed.contains (Properties::length)) {
- frameoffset_t delta = 0;
+ sampleoffset_t delta = 0;
if (what_changed.contains (Properties::position)) {
delta = region->position() - region->last_position();
@@ -1687,9 +1687,9 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
} else {
notify_contents_changed ();
relayer ();
- list<Evoral::Range<framepos_t> > xf;
- xf.push_back (Evoral::Range<framepos_t> (region->last_range()));
- xf.push_back (Evoral::Range<framepos_t> (region->range()));
+ list<Evoral::Range<samplepos_t> > xf;
+ xf.push_back (Evoral::Range<samplepos_t> (region->last_range()));
+ xf.push_back (Evoral::Range<samplepos_t> (region->range()));
coalesce_and_check_crossfades (xf);
}
}
@@ -1834,20 +1834,20 @@ Playlist::deep_sources (std::set<boost::shared_ptr<Source> >& sources) const
}
boost::shared_ptr<RegionList>
-Playlist::regions_at (framepos_t frame)
+Playlist::regions_at (samplepos_t sample)
{
RegionReadLock rlock (this);
- return find_regions_at (frame);
+ return find_regions_at (sample);
}
uint32_t
- Playlist::count_regions_at (framepos_t frame) const
+ Playlist::count_regions_at (samplepos_t sample) const
{
RegionReadLock rlock (const_cast<Playlist*>(this));
uint32_t cnt = 0;
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
- if ((*i)->covers (frame)) {
+ if ((*i)->covers (sample)) {
cnt++;
}
}
@@ -1856,11 +1856,11 @@ Playlist::regions_at (framepos_t frame)
}
boost::shared_ptr<Region>
- Playlist::top_region_at (framepos_t frame)
+ Playlist::top_region_at (samplepos_t sample)
{
RegionReadLock rlock (this);
- boost::shared_ptr<RegionList> rlist = find_regions_at (frame);
+ boost::shared_ptr<RegionList> rlist = find_regions_at (sample);
boost::shared_ptr<Region> region;
if (rlist->size()) {
@@ -1873,11 +1873,11 @@ Playlist::regions_at (framepos_t frame)
}
boost::shared_ptr<Region>
- Playlist::top_unmuted_region_at (framepos_t frame)
+ Playlist::top_unmuted_region_at (samplepos_t sample)
{
RegionReadLock rlock (this);
- boost::shared_ptr<RegionList> rlist = find_regions_at (frame);
+ boost::shared_ptr<RegionList> rlist = find_regions_at (sample);
for (RegionList::iterator i = rlist->begin(); i != rlist->end(); ) {
@@ -1904,14 +1904,14 @@ Playlist::regions_at (framepos_t frame)
}
boost::shared_ptr<RegionList>
-Playlist::find_regions_at (framepos_t frame)
+Playlist::find_regions_at (samplepos_t sample)
{
/* Caller must hold lock */
boost::shared_ptr<RegionList> rlist (new RegionList);
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
- if ((*i)->covers (frame)) {
+ if ((*i)->covers (sample)) {
rlist->push_back (*i);
}
}
@@ -1920,13 +1920,13 @@ Playlist::find_regions_at (framepos_t frame)
}
boost::shared_ptr<RegionList>
-Playlist::regions_with_start_within (Evoral::Range<framepos_t> range)
+Playlist::regions_with_start_within (Evoral::Range<samplepos_t> range)
{
RegionReadLock rlock (this);
boost::shared_ptr<RegionList> rlist (new RegionList);
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
- if ((*i)->first_frame() >= range.from && (*i)->first_frame() <= range.to) {
+ if ((*i)->first_sample() >= range.from && (*i)->first_sample() <= range.to) {
rlist->push_back (*i);
}
}
@@ -1935,13 +1935,13 @@ Playlist::regions_with_start_within (Evoral::Range<framepos_t> range)
}
boost::shared_ptr<RegionList>
-Playlist::regions_with_end_within (Evoral::Range<framepos_t> range)
+Playlist::regions_with_end_within (Evoral::Range<samplepos_t> range)
{
RegionReadLock rlock (this);
boost::shared_ptr<RegionList> rlist (new RegionList);
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
- if ((*i)->last_frame() >= range.from && (*i)->last_frame() <= range.to) {
+ if ((*i)->last_sample() >= range.from && (*i)->last_sample() <= range.to) {
rlist->push_back (*i);
}
}
@@ -1954,14 +1954,14 @@ Playlist::regions_with_end_within (Evoral::Range<framepos_t> range)
* @return regions which have some part within this range.
*/
boost::shared_ptr<RegionList>
-Playlist::regions_touched (framepos_t start, framepos_t end)
+Playlist::regions_touched (samplepos_t start, samplepos_t end)
{
RegionReadLock rlock (this);
return regions_touched_locked (start, end);
}
boost::shared_ptr<RegionList>
-Playlist::regions_touched_locked (framepos_t start, framepos_t end)
+Playlist::regions_touched_locked (samplepos_t start, samplepos_t end)
{
boost::shared_ptr<RegionList> rlist (new RegionList);
@@ -1974,8 +1974,8 @@ Playlist::regions_touched_locked (framepos_t start, framepos_t end)
return rlist;
}
-framepos_t
-Playlist::find_next_transient (framepos_t from, int dir)
+samplepos_t
+Playlist::find_next_transient (samplepos_t from, int dir)
{
RegionReadLock rlock (this);
AnalysisFeatureList points;
@@ -1983,20 +1983,20 @@ Playlist::find_next_transient (framepos_t from, int dir)
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
if (dir > 0) {
- if ((*i)->last_frame() < from) {
+ if ((*i)->last_sample() < from) {
continue;
}
} else {
- if ((*i)->first_frame() > from) {
+ if ((*i)->first_sample() > from) {
continue;
}
}
(*i)->get_transients (these_points);
- /* add first frame, just, err, because */
+ /* add first sample, just, err, because */
- these_points.push_back ((*i)->first_frame());
+ these_points.push_back ((*i)->first_sample());
points.insert (points.end(), these_points.begin(), these_points.end());
these_points.clear ();
@@ -2006,7 +2006,7 @@ Playlist::find_next_transient (framepos_t from, int dir)
return -1;
}
- TransientDetector::cleanup_transients (points, _session.frame_rate(), 3.0);
+ TransientDetector::cleanup_transients (points, _session.sample_rate(), 3.0);
bool reached = false;
if (dir > 0) {
@@ -2035,11 +2035,11 @@ Playlist::find_next_transient (framepos_t from, int dir)
}
boost::shared_ptr<Region>
-Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
+Playlist::find_next_region (samplepos_t sample, RegionPoint point, int dir)
{
RegionReadLock rlock (this);
boost::shared_ptr<Region> ret;
- framepos_t closest = max_framepos;
+ samplepos_t closest = max_samplepos;
bool end_iter = false;
@@ -2047,16 +2047,16 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
if(end_iter) break;
- frameoffset_t distance;
+ sampleoffset_t distance;
boost::shared_ptr<Region> r = (*i);
- framepos_t pos = 0;
+ samplepos_t pos = 0;
switch (point) {
case Start:
- pos = r->first_frame ();
+ pos = r->first_sample ();
break;
case End:
- pos = r->last_frame ();
+ pos = r->last_sample ();
break;
case SyncPoint:
pos = r->sync_position ();
@@ -2066,8 +2066,8 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
switch (dir) {
case 1: /* forwards */
- if (pos > frame) {
- if ((distance = pos - frame) < closest) {
+ if (pos > sample) {
+ if ((distance = pos - sample) < closest) {
closest = distance;
ret = r;
end_iter = true;
@@ -2078,8 +2078,8 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
default: /* backwards */
- if (pos < frame) {
- if ((distance = frame - pos) < closest) {
+ if (pos < sample) {
+ if ((distance = sample - pos) < closest) {
closest = distance;
ret = r;
}
@@ -2094,39 +2094,39 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
return ret;
}
- framepos_t
- Playlist::find_next_region_boundary (framepos_t frame, int dir)
+ samplepos_t
+ Playlist::find_next_region_boundary (samplepos_t sample, int dir)
{
RegionReadLock rlock (this);
- framepos_t closest = max_framepos;
- framepos_t ret = -1;
+ samplepos_t closest = max_samplepos;
+ samplepos_t ret = -1;
if (dir > 0) {
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
boost::shared_ptr<Region> r = (*i);
- frameoffset_t distance;
- const framepos_t first_frame = r->first_frame();
- const framepos_t last_frame = r->last_frame();
+ sampleoffset_t distance;
+ const samplepos_t first_sample = r->first_sample();
+ const samplepos_t last_sample = r->last_sample();
- if (first_frame > frame) {
+ if (first_sample > sample) {
- distance = first_frame - frame;
+ distance = first_sample - sample;
if (distance < closest) {
- ret = first_frame;
+ ret = first_sample;
closest = distance;
}
}
- if (last_frame > frame) {
+ if (last_sample > sample) {
- distance = last_frame - frame;
+ distance = last_sample - sample;
if (distance < closest) {
- ret = last_frame;
+ ret = last_sample;
closest = distance;
}
}
@@ -2137,26 +2137,26 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
for (RegionList::reverse_iterator i = regions.rbegin(); i != regions.rend(); ++i) {
boost::shared_ptr<Region> r = (*i);
- frameoffset_t distance;
- const framepos_t first_frame = r->first_frame();
- const framepos_t last_frame = r->last_frame();
+ sampleoffset_t distance;
+ const samplepos_t first_sample = r->first_sample();
+ const samplepos_t last_sample = r->last_sample();
- if (last_frame < frame) {
+ if (last_sample < sample) {
- distance = frame - last_frame;
+ distance = sample - last_sample;
if (distance < closest) {
- ret = last_frame;
+ ret = last_sample;
closest = distance;
}
}
- if (first_frame < frame) {
+ if (first_sample < sample) {
- distance = frame - first_frame;
+ distance = sample - first_sample;
if (distance < closest) {
- ret = first_frame;
+ ret = first_sample;
closest = distance;
}
}
@@ -2396,25 +2396,25 @@ Playlist::all_regions_empty() const
return all_regions.empty();
}
-pair<framepos_t, framepos_t>
+pair<samplepos_t, samplepos_t>
Playlist::get_extent () const
{
RegionReadLock rlock (const_cast<Playlist *>(this));
return _get_extent ();
}
-pair<framepos_t, framepos_t>
+pair<samplepos_t, samplepos_t>
Playlist::get_extent_with_endspace () const
{
- pair<framepos_t, framepos_t> l = get_extent();
+ pair<samplepos_t, samplepos_t> l = get_extent();
l.second += _end_space;
return l;
}
-pair<framepos_t, framepos_t>
+pair<samplepos_t, samplepos_t>
Playlist::_get_extent () const
{
- pair<framepos_t, framepos_t> ext (max_framepos, 0);
+ pair<samplepos_t, samplepos_t> ext (max_samplepos, 0);
if (regions.empty()) {
ext.first = 0;
@@ -2422,7 +2422,7 @@ Playlist::_get_extent () const
}
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
- pair<framepos_t, framepos_t> const e ((*i)->position(), (*i)->position() + (*i)->length());
+ pair<samplepos_t, samplepos_t> const e ((*i)->position(), (*i)->position() + (*i)->length());
if (e.first < ext.first) {
ext.first = e.first;
}
@@ -2538,8 +2538,8 @@ Playlist::relayer ()
int const divisions = 512;
/* find the start and end positions of the regions on this playlist */
- framepos_t start = INT64_MAX;
- framepos_t end = 0;
+ samplepos_t start = INT64_MAX;
+ samplepos_t end = 0;
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
start = min (start, (*i)->position());
end = max (end, (*i)->position() + (*i)->length());
@@ -2674,7 +2674,7 @@ Playlist::lower_region_to_bottom (boost::shared_ptr<Region> region)
}
void
-Playlist::nudge_after (framepos_t start, framecnt_t distance, bool forwards)
+Playlist::nudge_after (samplepos_t start, samplecnt_t distance, bool forwards)
{
RegionList::iterator i;
bool moved = false;
@@ -2688,12 +2688,12 @@ Playlist::nudge_after (framepos_t start, framecnt_t distance, bool forwards)
if ((*i)->position() >= start) {
- framepos_t new_pos;
+ samplepos_t new_pos;
if (forwards) {
- if ((*i)->last_frame() > max_framepos - distance) {
- new_pos = max_framepos - (*i)->length();
+ if ((*i)->last_sample() > max_samplepos - distance) {
+ new_pos = max_samplepos - (*i)->length();
} else {
new_pos = (*i)->position() + distance;
}
@@ -2865,9 +2865,9 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir)
break;
}
- framepos_t new_pos;
+ samplepos_t new_pos;
- if ((*next)->position() != region->last_frame() + 1) {
+ if ((*next)->position() != region->last_sample() + 1) {
/* they didn't used to touch, so after shuffle,
just have them swap positions.
*/
@@ -2908,8 +2908,8 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir)
break;
}
- framepos_t new_pos;
- if (region->position() != (*prev)->last_frame() + 1) {
+ samplepos_t new_pos;
+ if (region->position() != (*prev)->last_sample() + 1) {
/* they didn't used to touch, so after shuffle,
just have them swap positions.
*/
@@ -2962,7 +2962,7 @@ Playlist::region_is_shuffle_constrained (boost::shared_ptr<Region>)
}
void
-Playlist::ripple (framepos_t at, framecnt_t distance, RegionList *exclude)
+Playlist::ripple (samplepos_t at, samplecnt_t distance, RegionList *exclude)
{
ripple_locked (at, distance, exclude);
}
@@ -2992,7 +2992,7 @@ Playlist::foreach_region (boost::function<void(boost::shared_ptr<Region>)> s)
}
bool
-Playlist::has_region_at (framepos_t const p) const
+Playlist::has_region_at (samplepos_t const p) const
{
RegionReadLock (const_cast<Playlist *> (this));
@@ -3004,13 +3004,13 @@ Playlist::has_region_at (framepos_t const p) const
return (i != regions.end());
}
-/** Look from a session frame time and find the start time of the next region
+/** Look from a session sample time and find the start time of the next region
* which is on the top layer of this playlist.
* @param t Time to look from.
- * @return Position of next top-layered region, or max_framepos if there isn't one.
+ * @return Position of next top-layered region, or max_samplepos if there isn't one.
*/
-framepos_t
-Playlist::find_next_top_layer_position (framepos_t t) const
+samplepos_t
+Playlist::find_next_top_layer_position (samplepos_t t) const
{
RegionReadLock rlock (const_cast<Playlist *> (this));
@@ -3025,7 +3025,7 @@ Playlist::find_next_top_layer_position (framepos_t t) const
}
}
- return max_framepos;
+ return max_samplepos;
}
boost::shared_ptr<Region>
@@ -3034,7 +3034,7 @@ Playlist::combine (const RegionList& r)
PropertyList plist;
uint32_t channels = 0;
uint32_t layer = 0;
- framepos_t earliest_position = max_framepos;
+ samplepos_t earliest_position = max_samplepos;
vector<TwoRegions> old_and_new_regions;
vector<boost::shared_ptr<Region> > originals;
vector<boost::shared_ptr<Region> > copies;
@@ -3104,7 +3104,7 @@ Playlist::combine (const RegionList& r)
/* now create a new PlaylistSource for each channel in the new playlist */
SourceList sources;
- pair<framepos_t,framepos_t> extent = pl->get_extent();
+ pair<samplepos_t,samplepos_t> extent = pl->get_extent();
for (uint32_t chn = 0; chn < channels; ++chn) {
sources.push_back (SourceFactory::createFromPlaylist (_type, _session, pl, id(), parent_name, chn, 0, extent.second, false, false));
@@ -3174,8 +3174,8 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
pl = pls->playlist();
- framepos_t adjusted_start = 0; // gcc isn't smart enough
- framepos_t adjusted_end = 0; // gcc isn't smart enough
+ samplepos_t adjusted_start = 0; // gcc isn't smart enough
+ samplepos_t adjusted_end = 0; // gcc isn't smart enough
/* the leftmost (earliest) edge of the compound region
starts at zero in its source, or larger if it
@@ -3190,7 +3190,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
const RegionList& rl (pl->region_list_property().rlist());
RegionFactory::CompoundAssociations& cassocs (RegionFactory::compound_associations());
- frameoffset_t move_offset = 0;
+ sampleoffset_t move_offset = 0;
/* there are two possibilities here:
1) the playlist that the playlist source was based on
@@ -3225,7 +3225,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
}
if (!same_playlist) {
- framepos_t pos = original->position();
+ samplepos_t pos = original->position();
/* make a copy, but don't announce it */
original = RegionFactory::create (original, false);
/* the pure copy constructor resets position() to zero,
@@ -3409,7 +3409,7 @@ Playlist::reset_shares ()
* check_crossfades for each one.
*/
void
-Playlist::coalesce_and_check_crossfades (list<Evoral::Range<framepos_t> > ranges)
+Playlist::coalesce_and_check_crossfades (list<Evoral::Range<samplepos_t> > ranges)
{
/* XXX: it's a shame that this coalesce algorithm also exists in
TimeSelection::consolidate().
@@ -3418,8 +3418,8 @@ Playlist::coalesce_and_check_crossfades (list<Evoral::Range<framepos_t> > ranges
/* XXX: xfade: this is implemented in Evoral::RangeList */
restart:
- for (list<Evoral::Range<framepos_t> >::iterator i = ranges.begin(); i != ranges.end(); ++i) {
- for (list<Evoral::Range<framepos_t> >::iterator j = ranges.begin(); j != ranges.end(); ++j) {
+ for (list<Evoral::Range<samplepos_t> >::iterator i = ranges.begin(); i != ranges.end(); ++i) {
+ for (list<Evoral::Range<samplepos_t> >::iterator j = ranges.begin(); j != ranges.end(); ++j) {
if (i == j) {
continue;
diff --git a/libs/ardour/playlist_factory.cc b/libs/ardour/playlist_factory.cc
index 46f9910738..679e893cdc 100644
--- a/libs/ardour/playlist_factory.cc
+++ b/libs/ardour/playlist_factory.cc
@@ -109,7 +109,7 @@ PlaylistFactory::create (boost::shared_ptr<const Playlist> old, string name, boo
}
boost::shared_ptr<Playlist>
-PlaylistFactory::create (boost::shared_ptr<const Playlist> old, framepos_t start, framecnt_t cnt, string name, bool hidden)
+PlaylistFactory::create (boost::shared_ptr<const Playlist> old, samplepos_t start, samplecnt_t cnt, string name, bool hidden)
{
boost::shared_ptr<Playlist> pl;
boost::shared_ptr<const AudioPlaylist> apl;
diff --git a/libs/ardour/playlist_source.cc b/libs/ardour/playlist_source.cc
index c27652851b..0b76a3c3a9 100644
--- a/libs/ardour/playlist_source.cc
+++ b/libs/ardour/playlist_source.cc
@@ -41,7 +41,7 @@ using namespace ARDOUR;
using namespace PBD;
PlaylistSource::PlaylistSource (Session& s, const ID& orig, const std::string& name, boost::shared_ptr<Playlist> p, DataType type,
- frameoffset_t begin, framecnt_t len, Source::Flag /*flags*/)
+ sampleoffset_t begin, samplecnt_t len, Source::Flag /*flags*/)
: Source (s, type, name)
, _playlist (p)
, _original (orig)
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index 64f00cf1c4..e0ba0f00f7 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -358,9 +358,9 @@ Plugin::write_immediate_event (size_t size, const uint8_t* buf)
int
Plugin::connect_and_run (BufferSet& bufs,
- framepos_t /*start*/, framepos_t /*end*/, double /*speed*/,
+ samplepos_t /*start*/, samplepos_t /*end*/, double /*speed*/,
ChanMapping /*in_map*/, ChanMapping /*out_map*/,
- pframes_t nframes, framecnt_t /*offset*/)
+ pframes_t nframes, samplecnt_t /*offset*/)
{
if (bufs.count().n_midi() > 0) {
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index ce05d6c298..6094b963bb 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -264,7 +264,7 @@ PluginInsert::control_list_automation_state_changed (Evoral::Parameter which, Au
= boost::dynamic_pointer_cast<AutomationControl>(control (which));
if (c && s != Off) {
- _plugins[0]->set_parameter (which.id(), c->list()->eval (_session.transport_frame()));
+ _plugins[0]->set_parameter (which.id(), c->list()->eval (_session.transport_sample()));
}
}
@@ -395,7 +395,7 @@ PluginInsert::has_no_audio_inputs() const
return _plugins[0]->get_info()->n_inputs.n_audio() == 0;
}
-framecnt_t
+samplecnt_t
PluginInsert::plugin_latency () const {
return _plugins.front()->signal_latency ();
}
@@ -735,7 +735,7 @@ PluginInsert::preset_load_set_value (uint32_t p, float v)
}
void
-PluginInsert::inplace_silence_unconnected (BufferSet& bufs, const PinMappings& out_map, framecnt_t nframes, framecnt_t offset) const
+PluginInsert::inplace_silence_unconnected (BufferSet& bufs, const PinMappings& out_map, samplecnt_t nframes, samplecnt_t offset) const
{
// TODO optimize: store "unconnected" in a fixed set.
// it only changes on reconfiguration.
@@ -768,7 +768,7 @@ PluginInsert::inplace_silence_unconnected (BufferSet& bufs, const PinMappings& o
}
void
-PluginInsert::connect_and_run (BufferSet& bufs, framepos_t start, framepos_t end, double speed, pframes_t nframes, framecnt_t offset, bool with_auto)
+PluginInsert::connect_and_run (BufferSet& bufs, samplepos_t start, samplepos_t end, double speed, pframes_t nframes, samplecnt_t offset, bool with_auto)
{
// TODO: atomically copy maps & _no_inplace
PinMappings in_map (_in_map);
@@ -855,10 +855,10 @@ PluginInsert::connect_and_run (BufferSet& bufs, framepos_t start, framepos_t end
}
}
- /* Calculate if, and how many frames we need to collect for analysis */
- framecnt_t collect_signal_nframes = (_signal_analysis_collect_nframes_max -
+ /* Calculate if, and how many samples we need to collect for analysis */
+ samplecnt_t collect_signal_nframes = (_signal_analysis_collect_nframes_max -
_signal_analysis_collected_nframes);
- if (nframes < collect_signal_nframes) { // we might not get all frames now
+ if (nframes < collect_signal_nframes) { // we might not get all samples now
collect_signal_nframes = nframes;
}
@@ -866,7 +866,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, framepos_t start, framepos_t end
// collect input
//std::cerr << "collect input, bufs " << bufs.count().n_audio() << " count, " << bufs.available().n_audio() << " available" << std::endl;
//std::cerr << " streams " << internal_input_streams().n_audio() << std::endl;
- //std::cerr << "filling buffer with " << collect_signal_nframes << " frames at " << _signal_analysis_collected_nframes << std::endl;
+ //std::cerr << "filling buffer with " << collect_signal_nframes << " samples at " << _signal_analysis_collected_nframes << std::endl;
_signal_analysis_inputs.set_count(input_streams());
@@ -1142,9 +1142,9 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes)
}
void
-PluginInsert::silence (framecnt_t nframes, framepos_t start_frame)
+PluginInsert::silence (samplecnt_t nframes, samplepos_t start_sample)
{
- automation_run (start_frame, nframes); // evaluate automation only
+ automation_run (start_sample, nframes); // evaluate automation only
if (!active ()) {
// XXX delaybuffers need to be offset by nframes
@@ -1159,39 +1159,39 @@ PluginInsert::silence (framecnt_t nframes, framepos_t start_frame)
#ifdef MIXBUS
if (is_channelstrip ()) {
if (_configured_in.n_audio() > 0) {
- _plugins.front()->connect_and_run (_session.get_scratch_buffers (maxbuf, true), start_frame, start_frame + nframes, 1.0, in_map, out_map, nframes, 0);
+ _plugins.front()->connect_and_run (_session.get_scratch_buffers (maxbuf, true), start_sample, start_sample + nframes, 1.0, in_map, out_map, nframes, 0);
}
} else
#endif
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
- (*i)->connect_and_run (_session.get_scratch_buffers (maxbuf, true), start_frame, start_frame + nframes, 1.0, in_map, out_map, nframes, 0);
+ (*i)->connect_and_run (_session.get_scratch_buffers (maxbuf, true), start_sample, start_sample + nframes, 1.0, in_map, out_map, nframes, 0);
}
}
void
-PluginInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
+PluginInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
{
if (_sidechain) {
// collect sidechain input for complete cycle (!)
// TODO we need delaylines here for latency compensation
- _sidechain->run (bufs, start_frame, end_frame, speed, nframes, true);
+ _sidechain->run (bufs, start_sample, end_sample, speed, nframes, true);
}
if (_pending_active) {
/* run as normal if we are active or moving from inactive to active */
if (_session.transport_rolling() || _session.bounce_processing()) {
- automate_and_run (bufs, start_frame, end_frame, speed, nframes);
+ automate_and_run (bufs, start_sample, end_sample, speed, nframes);
} else {
Glib::Threads::Mutex::Lock lm (control_lock(), Glib::Threads::TRY_LOCK);
- connect_and_run (bufs, start_frame, end_frame, speed, nframes, 0, lm.locked());
+ connect_and_run (bufs, start_sample, end_sample, speed, nframes, 0, lm.locked());
}
} else {
// XXX should call ::silence() to run plugin(s) for consistent load.
// We'll need to change this anyway when bypass can be automated
bypass (bufs, nframes);
- automation_run (start_frame, nframes); // evaluate automation only
+ automation_run (start_sample, nframes); // evaluate automation only
_delaybuffers.flush ();
}
@@ -1203,10 +1203,10 @@ PluginInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
}
void
-PluginInsert::automate_and_run (BufferSet& bufs, framepos_t start, framepos_t end, double speed, pframes_t nframes)
+PluginInsert::automate_and_run (BufferSet& bufs, samplepos_t start, samplepos_t end, double speed, pframes_t nframes)
{
Evoral::ControlEvent next_event (0, 0.0f);
- framecnt_t offset = 0;
+ samplecnt_t offset = 0;
Glib::Threads::Mutex::Lock lm (control_lock(), Glib::Threads::TRY_LOCK);
@@ -1225,7 +1225,7 @@ PluginInsert::automate_and_run (BufferSet& bufs, framepos_t start, framepos_t en
while (nframes) {
- framecnt_t cnt = min (((framecnt_t) ceil (next_event.when) - start), (framecnt_t) nframes);
+ samplecnt_t cnt = min (((samplecnt_t) ceil (next_event.when) - start), (samplecnt_t) nframes);
connect_and_run (bufs, start, start + cnt, speed, cnt, offset, true); // XXX (start + cnt) * speed
@@ -2826,7 +2826,7 @@ PluginInsert::describe_parameter (Evoral::Parameter param)
return Automatable::describe_parameter(param);
}
-ARDOUR::framecnt_t
+ARDOUR::samplecnt_t
PluginInsert::signal_latency() const
{
if (!_pending_active) {
@@ -2985,7 +2985,7 @@ PluginInsert::get_impulse_analysis_plugin()
}
void
-PluginInsert::collect_signal_for_analysis (framecnt_t nframes)
+PluginInsert::collect_signal_for_analysis (samplecnt_t nframes)
{
// called from outside the audio thread, so this should be safe
// only do audio as analysis is (currently) only for audio plugins
@@ -3083,8 +3083,8 @@ PluginInsert::start_touch (uint32_t param_id)
{
boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, param_id));
if (ac) {
- // ToDo subtract _plugin_signal_latency from audible_frame() when rolling, assert > 0
- ac->start_touch (session().audible_frame());
+ // ToDo subtract _plugin_signal_latency from audible_sample() when rolling, assert > 0
+ ac->start_touch (session().audible_sample());
}
}
@@ -3093,8 +3093,8 @@ PluginInsert::end_touch (uint32_t param_id)
{
boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, param_id));
if (ac) {
- // ToDo subtract _plugin_signal_latency from audible_frame() when rolling, assert > 0
- ac->stop_touch (session().audible_frame());
+ // ToDo subtract _plugin_signal_latency from audible_sample() when rolling, assert > 0
+ ac->stop_touch (session().audible_sample());
}
}
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index 7427dda42c..ed165a6988 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -49,7 +49,7 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<Pannable> pannable, boost:
{
_mtdm = 0;
_latency_detect = false;
- _latency_flush_frames = 0;
+ _latency_flush_samples = 0;
_measured_latency = 0;
}
@@ -70,8 +70,8 @@ void
PortInsert::start_latency_detection ()
{
delete _mtdm;
- _mtdm = new MTDM (_session.frame_rate());
- _latency_flush_frames = 0;
+ _mtdm = new MTDM (_session.sample_rate());
+ _latency_flush_samples = 0;
_latency_detect = true;
_measured_latency = 0;
}
@@ -79,21 +79,21 @@ PortInsert::start_latency_detection ()
void
PortInsert::stop_latency_detection ()
{
- _latency_flush_frames = signal_latency() + _session.engine().samples_per_cycle();
+ _latency_flush_samples = signal_latency() + _session.engine().samples_per_cycle();
_latency_detect = false;
}
void
-PortInsert::set_measured_latency (framecnt_t n)
+PortInsert::set_measured_latency (samplecnt_t n)
{
_measured_latency = n;
}
-framecnt_t
+samplecnt_t
PortInsert::latency() const
{
/* because we deliver and collect within the same cycle,
- all I/O is necessarily delayed by at least frames_per_cycle().
+ all I/O is necessarily delayed by at least samples_per_cycle().
if the return port for insert has its own latency, we
need to take that into account too.
@@ -107,7 +107,7 @@ PortInsert::latency() const
}
void
-PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
+PortInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
{
if (_output->n_ports().n_total() == 0) {
return;
@@ -128,18 +128,18 @@ PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
return;
- } else if (_latency_flush_frames) {
+ } else if (_latency_flush_samples) {
/* wait for the entire input buffer to drain before picking up input again so that we can't
hear the remnants of whatever MTDM pumped into the pipeline.
*/
- silence (nframes, start_frame);
+ silence (nframes, start_sample);
- if (_latency_flush_frames > nframes) {
- _latency_flush_frames -= nframes;
+ if (_latency_flush_samples > nframes) {
+ _latency_flush_samples -= nframes;
} else {
- _latency_flush_frames = 0;
+ _latency_flush_samples = 0;
}
return;
@@ -147,11 +147,11 @@ PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
if (!_active && !_pending_active) {
/* deliver silence */
- silence (nframes, start_frame);
+ silence (nframes, start_sample);
goto out;
}
- _out->run (bufs, start_frame, end_frame, speed, nframes, true);
+ _out->run (bufs, start_sample, end_sample, speed, nframes, true);
_input->collect_input (bufs, nframes, ChanCount::ZERO);
out:
@@ -228,11 +228,11 @@ PortInsert::set_state (const XMLNode& node, int version)
return 0;
}
-ARDOUR::framecnt_t
+ARDOUR::samplecnt_t
PortInsert::signal_latency() const
{
/* because we deliver and collect within the same cycle,
- all I/O is necessarily delayed by at least frames_per_cycle().
+ all I/O is necessarily delayed by at least samples_per_cycle().
if the return port for insert has its own latency, we
need to take that into account too.
diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc
index 9529093edf..dfc1c64421 100644
--- a/libs/ardour/port_manager.cc
+++ b/libs/ardour/port_manager.cc
@@ -749,7 +749,7 @@ void
PortManager::cycle_start (pframes_t nframes)
{
Port::set_global_port_buffer_offset (0);
- Port::set_cycle_framecnt (nframes);
+ Port::set_cycle_samplecnt (nframes);
_cycle_ports = ports.reader ();
diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc
index 335bb0f019..507fa78554 100644
--- a/libs/ardour/processor.cc
+++ b/libs/ardour/processor.cc
@@ -292,7 +292,7 @@ Processor::owner() const
}
void
-Processor::set_input_latency (framecnt_t cnt)
+Processor::set_input_latency (samplecnt_t cnt)
{
_input_latency = cnt;
}
diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc
index cd597c6f56..23ffa94460 100644
--- a/libs/ardour/rb_effect.cc
+++ b/libs/ardour/rb_effect.cc
@@ -73,7 +73,7 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
SourceList nsrcs;
int ret = -1;
- const framecnt_t bufsize = 256;
+ const samplecnt_t bufsize = 256;
gain_t* gain_buffer = 0;
Sample** buffers = 0;
char suffix[32];
@@ -94,11 +94,11 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
1. The region has not been stretched before.
- In this case, we just want to read region->length() frames
+ In this case, we just want to read region->length() samples
from region->start().
We will create a new region of region->length() *
- tsr.time_fraction frames. The new region will have its
+ tsr.time_fraction samples. The new region will have its
start set to 0 (because it has a new audio file that begins
at the start of the stretched area) and its ancestral_start
set to region->start() (so that we know where to begin
@@ -106,25 +106,25 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
2. The region has been stretched before.
- The region starts at region->start() frames into its
+ The region starts at region->start() samples into its
(possibly previously stretched) source file. But we don't
want to read from its source file; we want to read from the
file it was originally stretched from.
The region's source begins at region->ancestral_start()
- frames into its master source file. Thus, we need to start
+ samples into its master source file. Thus, we need to start
reading at region->ancestral_start() + (region->start() /
- region->stretch()) frames into the master source. This
+ region->stretch()) samples into the master source. This
value will also become the ancestral_start for the new
region.
We cannot use region->ancestral_length() to establish how
- many frames to read, because it won't be up to date if the
+ many samples to read, because it won't be up to date if the
region has been trimmed since it was last stretched. We
- must read region->length() / region->stretch() frames and
+ must read region->length() / region->stretch() samples and
stretch them by tsr.time_fraction * region->stretch(), for
a new region of region->length() * tsr.time_fraction
- frames.
+ samples.
Case 1 is of course a special case of 2, where
region->ancestral_start() == 0 and region->stretch() == 1.
@@ -135,7 +135,7 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
region->start(). This calculation is used regardless of
whether we are reading from a master or
previously-stretched region. In order to read from a point
- n frames into the master source, we need to provide n -
+ n samples into the master source, we need to provide n -
region->start() + region->position() as our position
argument to master_read_at().
@@ -147,16 +147,16 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
double stretch = region->stretch() * tsr.time_fraction;
double shift = region->shift() * tsr.pitch_fraction;
- framecnt_t read_start = region->ancestral_start() +
- framecnt_t(region->start() / (double)region->stretch());
+ samplecnt_t read_start = region->ancestral_start() +
+ samplecnt_t(region->start() / (double)region->stretch());
- framecnt_t read_duration =
- framecnt_t(region->length() / (double)region->stretch());
+ samplecnt_t read_duration =
+ samplecnt_t(region->length() / (double)region->stretch());
uint32_t channels = region->n_channels();
RubberBandStretcher stretcher
- (session.frame_rate(), channels,
+ (session.sample_rate(), channels,
(RubberBandStretcher::Options) tsr.opts, stretch, shift);
progress->set_progress (0);
@@ -181,9 +181,9 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
/* create new sources */
- framepos_t pos = 0;
- framecnt_t avail = 0;
- framecnt_t done = 0;
+ samplepos_t pos = 0;
+ samplecnt_t avail = 0;
+ samplecnt_t done = 0;
if (make_new_sources (region, nsrcs, suffix)) {
goto out;
@@ -205,14 +205,14 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
try {
while (pos < read_duration && !tsr.cancel) {
- framecnt_t this_read = 0;
+ samplecnt_t this_read = 0;
for (uint32_t i = 0; i < channels; ++i) {
- framepos_t this_time;
+ samplepos_t this_time;
this_time = min(bufsize, read_duration - pos);
- framepos_t this_position;
+ samplepos_t this_position;
this_position = read_start + pos -
region->start() + region->position();
@@ -245,14 +245,14 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
while (pos < read_duration && !tsr.cancel) {
- framecnt_t this_read = 0;
+ samplecnt_t this_read = 0;
for (uint32_t i = 0; i < channels; ++i) {
- framepos_t this_time;
+ samplepos_t this_time;
this_time = min(bufsize, read_duration - pos);
- framepos_t this_position;
+ samplepos_t this_position;
this_position = read_start + pos -
region->start() + region->position();
@@ -279,7 +279,7 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
stretcher.process(buffers, this_read, pos == read_duration);
- framecnt_t avail = 0;
+ samplecnt_t avail = 0;
while ((avail = stretcher.available()) > 0) {
@@ -304,7 +304,7 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
while ((avail = stretcher.available()) >= 0) {
- framecnt_t this_read = min (bufsize, avail);
+ samplecnt_t this_read = min (bufsize, avail);
stretcher.retrieve(buffers, this_read);
diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc
index f5442f26e3..4651fa3341 100644
--- a/libs/ardour/rc_configuration.cc
+++ b/libs/ardour/rc_configuration.cc
@@ -236,8 +236,8 @@ RCConfiguration::set_state (const XMLNode& root, int version)
}
}
- DiskReader::set_chunk_frames (minimum_disk_read_bytes.get() / sizeof (Sample));
- DiskWriter::set_chunk_frames (minimum_disk_write_bytes.get() / sizeof (Sample));
+ DiskReader::set_chunk_samples (minimum_disk_read_bytes.get() / sizeof (Sample));
+ DiskWriter::set_chunk_samples (minimum_disk_write_bytes.get() / sizeof (Sample));
return 0;
}
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 9d82ff9395..37244c0634 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -63,14 +63,14 @@ namespace ARDOUR {
PBD::PropertyDescriptor<bool> hidden;
PBD::PropertyDescriptor<bool> position_locked;
PBD::PropertyDescriptor<bool> valid_transients;
- PBD::PropertyDescriptor<framepos_t> start;
- PBD::PropertyDescriptor<framecnt_t> length;
- PBD::PropertyDescriptor<framepos_t> position;
+ PBD::PropertyDescriptor<samplepos_t> start;
+ PBD::PropertyDescriptor<samplecnt_t> length;
+ PBD::PropertyDescriptor<samplepos_t> position;
PBD::PropertyDescriptor<double> beat;
- PBD::PropertyDescriptor<framecnt_t> sync_position;
+ PBD::PropertyDescriptor<samplecnt_t> sync_position;
PBD::PropertyDescriptor<layer_t> layer;
- PBD::PropertyDescriptor<framepos_t> ancestral_start;
- PBD::PropertyDescriptor<framecnt_t> ancestral_length;
+ PBD::PropertyDescriptor<samplepos_t> ancestral_start;
+ PBD::PropertyDescriptor<samplecnt_t> ancestral_length;
PBD::PropertyDescriptor<float> stretch;
PBD::PropertyDescriptor<float> shift;
PBD::PropertyDescriptor<PositionLockStyle> position_lock_style;
@@ -234,7 +234,7 @@ Region::register_properties ()
, _layering_index (Properties::layering_index, other->_layering_index)
/* derived-from-derived constructor (no sources in constructor) */
-Region::Region (Session& s, framepos_t start, framecnt_t length, const string& name, DataType type)
+Region::Region (Session& s, samplepos_t start, samplecnt_t length, const string& name, DataType type)
: SessionObject(s, name)
, _type(type)
, REGION_DEFAULT_STATE(start,length)
@@ -331,7 +331,7 @@ Region::Region (boost::shared_ptr<const Region> other)
the start within \a other is given by \a offset
(i.e. relative to the start of \a other's sources, the start is \a offset + \a other.start()
*/
-Region::Region (boost::shared_ptr<const Region> other, MusicFrame offset)
+Region::Region (boost::shared_ptr<const Region> other, MusicSample offset)
: SessionObject(other->session(), other->name())
, _type (other->data_type())
, REGION_COPY_STATE (other)
@@ -352,12 +352,12 @@ Region::Region (boost::shared_ptr<const Region> other, MusicFrame offset)
use_sources (other->_sources);
set_master_sources (other->_master_sources);
- _position = other->_position + offset.frame;
- _start = other->_start + offset.frame;
+ _position = other->_position + offset.sample;
+ _start = other->_start + offset.sample;
/* prevent offset of 0 from altering musical position */
- if (offset.frame != 0) {
- const double offset_qn = _session.tempo_map().exact_qn_at_frame (other->_position + offset.frame, offset.division)
+ if (offset.sample != 0) {
+ const double offset_qn = _session.tempo_map().exact_qn_at_sample (other->_position + offset.sample, offset.division)
- other->_quarter_note;
_quarter_note = other->_quarter_note + offset_qn;
@@ -439,7 +439,7 @@ Region::set_name (const std::string& str)
}
void
-Region::set_length (framecnt_t len, const int32_t sub_num)
+Region::set_length (samplecnt_t len, const int32_t sub_num)
{
//cerr << "Region::set_length() len = " << len << endl;
if (locked()) {
@@ -452,7 +452,7 @@ Region::set_length (framecnt_t len, const int32_t sub_num)
length impossible.
*/
- if (max_framepos - len < _position) {
+ if (max_samplepos - len < _position) {
return;
}
@@ -476,7 +476,7 @@ Region::set_length (framecnt_t len, const int32_t sub_num)
}
void
-Region::set_length_internal (framecnt_t len, const int32_t sub_num)
+Region::set_length_internal (samplecnt_t len, const int32_t sub_num)
{
_last_length = _length;
_length = len;
@@ -541,7 +541,7 @@ Region::move_to_natural_position ()
}
void
-Region::special_set_position (framepos_t pos)
+Region::special_set_position (samplepos_t pos)
{
/* this is used when creating a whole file region as
a way to store its "natural" or "captured" position.
@@ -580,8 +580,8 @@ Region::update_after_tempo_map_change (bool send)
}
/* prevent movement before 0 */
- const framepos_t pos = max ((framepos_t) 0, _session.tempo_map().frame_at_beat (_beat));
- /* we have _beat. update frame position non-musically */
+ const samplepos_t pos = max ((samplepos_t) 0, _session.tempo_map().sample_at_beat (_beat));
+ /* we have _beat. update sample position non-musically */
set_position_internal (pos, false, 0);
/* do this even if the position is the same. this helps out
@@ -594,7 +594,7 @@ Region::update_after_tempo_map_change (bool send)
}
void
-Region::set_position (framepos_t pos, int32_t sub_num)
+Region::set_position (samplepos_t pos, int32_t sub_num)
{
if (!can_move()) {
return;
@@ -611,7 +611,7 @@ Region::set_position (framepos_t pos, int32_t sub_num)
set_position_internal (pos, true, sub_num);
} else {
if (!_session.loading()) {
- _beat = _session.tempo_map().exact_beat_at_frame (pos, sub_num);
+ _beat = _session.tempo_map().exact_beat_at_sample (pos, sub_num);
_quarter_note = _session.tempo_map().quarter_note_at_beat (_beat);
}
@@ -627,7 +627,7 @@ Region::set_position (framepos_t pos, int32_t sub_num)
}
void
-Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute, const int32_t sub_num)
+Region::set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num)
{
/* We emit a change of Properties::position even if the position hasn't changed
(see Region::set_position), so we must always set this up so that
@@ -650,9 +650,9 @@ Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute, const i
XXX is this the right thing to do?
*/
- if (max_framepos - _length < _position) {
+ if (max_samplepos - _length < _position) {
_last_length = _length;
- _length = max_framepos - _position;
+ _length = max_samplepos - _position;
}
}
}
@@ -675,7 +675,7 @@ Region::set_position_music (double qn)
_beat = _session.tempo_map().beat_at_quarter_note (qn);
}
- /* will set frame accordingly */
+ /* will set sample accordingly */
set_position_music_internal (qn);
if (position_lock_style() == MusicTime) {
@@ -695,7 +695,7 @@ Region::set_position_music_internal (double qn)
_last_position = _position;
if (_quarter_note != qn) {
- _position = _session.tempo_map().frame_at_quarter_note (qn);
+ _position = _session.tempo_map().sample_at_quarter_note (qn);
_quarter_note = qn;
/* check that the new _position wouldn't make the current
@@ -703,9 +703,9 @@ Region::set_position_music_internal (double qn)
XXX is this the right thing to do?
*/
- if (max_framepos - _length < _position) {
+ if (max_samplepos - _length < _position) {
_last_length = _length;
- _length = max_framepos - _position;
+ _length = max_samplepos - _position;
}
}
}
@@ -716,7 +716,7 @@ Region::set_position_music_internal (double qn)
* _last_position to prevent an implied move.
*/
void
-Region::set_initial_position (framepos_t pos)
+Region::set_initial_position (samplepos_t pos)
{
if (!can_move()) {
return;
@@ -731,9 +731,9 @@ Region::set_initial_position (framepos_t pos)
XXX is this the right thing to do?
*/
- if (max_framepos - _length < _position) {
+ if (max_samplepos - _length < _position) {
_last_length = _length;
- _length = max_framepos - _position;
+ _length = max_samplepos - _position;
}
recompute_position_from_lock_style (0);
@@ -751,12 +751,12 @@ Region::set_initial_position (framepos_t pos)
void
Region::recompute_position_from_lock_style (const int32_t sub_num)
{
- _beat = _session.tempo_map().exact_beat_at_frame (_position, sub_num);
- _quarter_note = _session.tempo_map().exact_qn_at_frame (_position, sub_num);
+ _beat = _session.tempo_map().exact_beat_at_sample (_position, sub_num);
+ _quarter_note = _session.tempo_map().exact_qn_at_sample (_position, sub_num);
}
void
-Region::nudge_position (frameoffset_t n)
+Region::nudge_position (sampleoffset_t n)
{
if (locked() || video_locked()) {
return;
@@ -766,11 +766,11 @@ Region::nudge_position (frameoffset_t n)
return;
}
- framepos_t new_position = _position;
+ samplepos_t new_position = _position;
if (n > 0) {
- if (_position > max_framepos - n) {
- new_position = max_framepos;
+ if (_position > max_samplepos - n) {
+ new_position = max_samplepos;
} else {
new_position += n;
}
@@ -788,7 +788,7 @@ Region::nudge_position (frameoffset_t n)
}
void
-Region::set_ancestral_data (framepos_t s, framecnt_t l, float st, float sh)
+Region::set_ancestral_data (samplepos_t s, samplecnt_t l, float st, float sh)
{
_ancestral_length = l;
_ancestral_start = s;
@@ -797,7 +797,7 @@ Region::set_ancestral_data (framepos_t s, framecnt_t l, float st, float sh)
}
void
-Region::set_start (framepos_t pos)
+Region::set_start (samplepos_t pos)
{
if (locked() || position_locked() || video_locked()) {
return;
@@ -823,18 +823,18 @@ Region::set_start (framepos_t pos)
}
void
-Region::move_start (frameoffset_t distance, const int32_t sub_num)
+Region::move_start (sampleoffset_t distance, const int32_t sub_num)
{
if (locked() || position_locked() || video_locked()) {
return;
}
- framepos_t new_start;
+ samplepos_t new_start;
if (distance > 0) {
- if (_start > max_framepos - distance) {
- new_start = max_framepos; // makes no sense
+ if (_start > max_samplepos - distance) {
+ new_start = max_samplepos; // makes no sense
} else {
new_start = _start + distance;
}
@@ -868,32 +868,32 @@ Region::move_start (frameoffset_t distance, const int32_t sub_num)
}
void
-Region::trim_front (framepos_t new_position, const int32_t sub_num)
+Region::trim_front (samplepos_t new_position, const int32_t sub_num)
{
modify_front (new_position, false, sub_num);
}
void
-Region::cut_front (framepos_t new_position, const int32_t sub_num)
+Region::cut_front (samplepos_t new_position, const int32_t sub_num)
{
modify_front (new_position, true, sub_num);
}
void
-Region::cut_end (framepos_t new_endpoint, const int32_t sub_num)
+Region::cut_end (samplepos_t new_endpoint, const int32_t sub_num)
{
modify_end (new_endpoint, true, sub_num);
}
void
-Region::modify_front (framepos_t new_position, bool reset_fade, const int32_t sub_num)
+Region::modify_front (samplepos_t new_position, bool reset_fade, const int32_t sub_num)
{
if (locked()) {
return;
}
- framepos_t end = last_frame();
- framepos_t source_zero;
+ samplepos_t end = last_sample();
+ samplepos_t source_zero;
if (_position > _start) {
source_zero = _position - _start;
@@ -903,7 +903,7 @@ Region::modify_front (framepos_t new_position, bool reset_fade, const int32_t su
if (new_position < end) { /* can't trim it zero or negative length */
- framecnt_t newlen = 0;
+ samplecnt_t newlen = 0;
if (!can_trim_start_before_source_start ()) {
/* can't trim it back past where source position zero is located */
@@ -931,7 +931,7 @@ Region::modify_front (framepos_t new_position, bool reset_fade, const int32_t su
}
void
-Region::modify_end (framepos_t new_endpoint, bool reset_fade, const int32_t sub_num)
+Region::modify_end (samplepos_t new_endpoint, bool reset_fade, const int32_t sub_num)
{
if (locked()) {
return;
@@ -953,13 +953,13 @@ Region::modify_end (framepos_t new_endpoint, bool reset_fade, const int32_t sub_
*/
void
-Region::trim_end (framepos_t new_endpoint, const int32_t sub_num)
+Region::trim_end (samplepos_t new_endpoint, const int32_t sub_num)
{
modify_end (new_endpoint, false, sub_num);
}
void
-Region::trim_to (framepos_t position, framecnt_t length, const int32_t sub_num)
+Region::trim_to (samplepos_t position, samplecnt_t length, const int32_t sub_num)
{
if (locked()) {
return;
@@ -974,20 +974,20 @@ Region::trim_to (framepos_t position, framecnt_t length, const int32_t sub_num)
}
void
-Region::trim_to_internal (framepos_t position, framecnt_t length, const int32_t sub_num)
+Region::trim_to_internal (samplepos_t position, samplecnt_t length, const int32_t sub_num)
{
- framepos_t new_start;
+ samplepos_t new_start;
if (locked()) {
return;
}
- frameoffset_t const start_shift = position - _position;
+ sampleoffset_t const start_shift = position - _position;
if (start_shift > 0) {
- if (_start > max_framepos - start_shift) {
- new_start = max_framepos;
+ if (_start > max_samplepos - start_shift) {
+ new_start = max_samplepos;
} else {
new_start = _start + start_shift;
}
@@ -1019,7 +1019,7 @@ Region::trim_to_internal (framepos_t position, framecnt_t length, const int32_t
/* Set position before length, otherwise for MIDI regions this bad thing happens:
* 1. we call set_length_internal; length in beats is computed using the region's current
* (soon-to-be old) position
- * 2. we call set_position_internal; position is set and length in frames re-computed using
+ * 2. we call set_position_internal; position is set and length in samples re-computed using
* length in beats from (1) but at the new position, which is wrong if the region
* straddles a tempo/meter change.
*/
@@ -1128,10 +1128,10 @@ Region::set_position_locked (bool yn)
* @param absolute_pos Session time.
*/
void
-Region::set_sync_position (framepos_t absolute_pos)
+Region::set_sync_position (samplepos_t absolute_pos)
{
/* position within our file */
- framepos_t const file_pos = _start + (absolute_pos - _position);
+ samplepos_t const file_pos = _start + (absolute_pos - _position);
if (file_pos != _sync_position) {
_sync_marked = true;
@@ -1157,8 +1157,8 @@ Region::clear_sync_position ()
}
}
-/* @return the sync point relative the first frame of the region */
-frameoffset_t
+/* @return the sync point relative the first sample of the region */
+sampleoffset_t
Region::sync_offset (int& dir) const
{
if (sync_marked()) {
@@ -1175,11 +1175,11 @@ Region::sync_offset (int& dir) const
}
}
-framepos_t
-Region::adjust_to_sync (framepos_t pos) const
+samplepos_t
+Region::adjust_to_sync (samplepos_t pos) const
{
int sync_dir;
- frameoffset_t offset = sync_offset (sync_dir);
+ sampleoffset_t offset = sync_offset (sync_dir);
// cerr << "adjusting pos = " << pos << " to sync at " << _sync_position << " offset = " << offset << " with dir = " << sync_dir << endl;
@@ -1190,7 +1190,7 @@ Region::adjust_to_sync (framepos_t pos) const
pos = 0;
}
} else {
- if (max_framepos - pos > offset) {
+ if (max_samplepos - pos > offset) {
pos += offset;
}
}
@@ -1199,7 +1199,7 @@ Region::adjust_to_sync (framepos_t pos) const
}
/** @return Sync position in session time */
-framepos_t
+samplepos_t
Region::sync_position() const
{
if (sync_marked()) {
@@ -1367,7 +1367,7 @@ Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_c
&bbt_time.beats,
&bbt_time.ticks) != 3) {
_position_lock_style = AudioTime;
- _beat = _session.tempo_map().beat_at_frame (_position);
+ _beat = _session.tempo_map().beat_at_sample (_position);
} else {
_beat = _session.tempo_map().beat_at_bbt (bbt_time);
}
@@ -1453,7 +1453,7 @@ Region::send_change (const PropertyChange& what_changed)
bool
Region::overlap_equivalent (boost::shared_ptr<const Region> other) const
{
- return coverage (other->first_frame(), other->last_frame()) != Evoral::OverlapNone;
+ return coverage (other->first_sample(), other->last_sample()) != Evoral::OverlapNone;
}
bool
@@ -1669,7 +1669,7 @@ Region::uses_source (boost::shared_ptr<const Source> source, bool shallow) const
}
-framecnt_t
+samplecnt_t
Region::source_length(uint32_t n) const
{
assert (n < _sources.size());
@@ -1677,13 +1677,13 @@ Region::source_length(uint32_t n) const
}
bool
-Region::verify_length (framecnt_t& len)
+Region::verify_length (samplecnt_t& len)
{
if (source() && (source()->destructive() || source()->length_mutable())) {
return true;
}
- framecnt_t maxlen = 0;
+ samplecnt_t maxlen = 0;
for (uint32_t n = 0; n < _sources.size(); ++n) {
maxlen = max (maxlen, source_length(n) - _start);
@@ -1695,13 +1695,13 @@ Region::verify_length (framecnt_t& len)
}
bool
-Region::verify_start_and_length (framepos_t new_start, framecnt_t& new_length)
+Region::verify_start_and_length (samplepos_t new_start, samplecnt_t& new_length)
{
if (source() && (source()->destructive() || source()->length_mutable())) {
return true;
}
- framecnt_t maxlen = 0;
+ samplecnt_t maxlen = 0;
for (uint32_t n = 0; n < _sources.size(); ++n) {
maxlen = max (maxlen, source_length(n) - new_start);
@@ -1713,7 +1713,7 @@ Region::verify_start_and_length (framepos_t new_start, framecnt_t& new_length)
}
bool
-Region::verify_start (framepos_t pos)
+Region::verify_start (samplepos_t pos)
{
if (source() && (source()->destructive() || source()->length_mutable())) {
return true;
@@ -1728,7 +1728,7 @@ Region::verify_start (framepos_t pos)
}
bool
-Region::verify_start_mutable (framepos_t& new_start)
+Region::verify_start_mutable (samplepos_t& new_start)
{
if (source() && (source()->destructive() || source()->length_mutable())) {
return true;
@@ -1794,7 +1794,7 @@ Region::transients (AnalysisFeatureList& afl)
if (cnt > 1 ) {
afl.sort ();
// remove exact duplicates
- TransientDetector::cleanup_transients (afl, _session.frame_rate(), 0);
+ TransientDetector::cleanup_transients (afl, _session.sample_rate(), 0);
}
}
@@ -1812,11 +1812,11 @@ Region::has_transients () const
}
void
-Region::merge_features (AnalysisFeatureList& result, const AnalysisFeatureList& src, const frameoffset_t off) const
+Region::merge_features (AnalysisFeatureList& result, const AnalysisFeatureList& src, const sampleoffset_t off) const
{
for (AnalysisFeatureList::const_iterator x = src.begin(); x != src.end(); ++x) {
- const frameoffset_t p = (*x) + off;
- if (p < first_frame() || p > last_frame()) {
+ const sampleoffset_t p = (*x) + off;
+ if (p < first_sample() || p > last_sample()) {
continue;
}
result.push_back (p);
@@ -1913,12 +1913,12 @@ Region::post_set (const PropertyChange& pc)
}
void
-Region::set_start_internal (framecnt_t s, const int32_t sub_num)
+Region::set_start_internal (samplecnt_t s, const int32_t sub_num)
{
_start = s;
}
-framepos_t
+samplepos_t
Region::earliest_possible_position () const
{
if (_start > _position) {
@@ -1928,10 +1928,10 @@ Region::earliest_possible_position () const
}
}
-framecnt_t
-Region::latest_possible_frame () const
+samplecnt_t
+Region::latest_possible_sample () const
{
- framecnt_t minlen = max_framecnt;
+ samplecnt_t minlen = max_samplecnt;
for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
/* non-audio regions have a length that may vary based on their
@@ -1940,7 +1940,7 @@ Region::latest_possible_frame () const
minlen = min (minlen, (*i)->length (_position));
}
- /* the latest possible last frame is determined by the current
+ /* the latest possible last sample is determined by the current
* position, plus the shortest source extent past _start.
*/
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc
index c1f3ecf474..9ecc6e10da 100644
--- a/libs/ardour/region_factory.cc
+++ b/libs/ardour/region_factory.cc
@@ -54,7 +54,7 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bo
if ((ar = boost::dynamic_pointer_cast<const AudioRegion>(region)) != 0) {
- ret = boost::shared_ptr<Region> (new AudioRegion (ar, MusicFrame (0, 0)));
+ ret = boost::shared_ptr<Region> (new AudioRegion (ar, MusicSample (0, 0)));
} else if ((mr = boost::dynamic_pointer_cast<const MidiRegion>(region)) != 0) {
@@ -71,7 +71,7 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bo
source->set_ancestor_name(mr->sources().front()->name());
ret = mr->clone(source);
} else {
- ret = boost::shared_ptr<Region> (new MidiRegion (mr, MusicFrame (0, 0)));
+ ret = boost::shared_ptr<Region> (new MidiRegion (mr, MusicSample (0, 0)));
}
} else {
@@ -142,7 +142,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& pli
}
boost::shared_ptr<Region>
-RegionFactory::create (boost::shared_ptr<Region> region, MusicFrame offset, const PropertyList& plist, bool announce)
+RegionFactory::create (boost::shared_ptr<Region> region, MusicSample offset, const PropertyList& plist, bool announce)
{
boost::shared_ptr<Region> ret;
boost::shared_ptr<const AudioRegion> other_a;
diff --git a/libs/ardour/resampled_source.cc b/libs/ardour/resampled_source.cc
index 24eb12ad23..f3518537f6 100644
--- a/libs/ardour/resampled_source.cc
+++ b/libs/ardour/resampled_source.cc
@@ -32,7 +32,7 @@ const uint32_t ResampledImportableSource::blocksize = 524288U;
const uint32_t ResampledImportableSource::blocksize = 16384U;
#endif
-ResampledImportableSource::ResampledImportableSource (boost::shared_ptr<ImportableSource> src, framecnt_t rate, SrcQuality srcq)
+ResampledImportableSource::ResampledImportableSource (boost::shared_ptr<ImportableSource> src, samplecnt_t rate, SrcQuality srcq)
: source (src)
, _src_state (0)
{
@@ -69,8 +69,8 @@ ResampledImportableSource::~ResampledImportableSource ()
delete [] _input;
}
-framecnt_t
-ResampledImportableSource::read (Sample* output, framecnt_t nframes)
+samplecnt_t
+ResampledImportableSource::read (Sample* output, samplecnt_t nframes)
{
int err;
size_t bs = floor ((float)(blocksize / source->channels())) * source->channels();
@@ -120,7 +120,7 @@ ResampledImportableSource::read (Sample* output, framecnt_t nframes)
}
void
-ResampledImportableSource::seek (framepos_t pos)
+ResampledImportableSource::seek (samplepos_t pos)
{
source->seek (pos);
@@ -143,7 +143,7 @@ ResampledImportableSource::seek (framepos_t pos)
_end_of_input = false;
}
-framepos_t
+samplepos_t
ResampledImportableSource::natural_position () const
{
return source->natural_position() * ratio ();
diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc
index 29c3c01632..5bc0a695a5 100644
--- a/libs/ardour/return.cc
+++ b/libs/ardour/return.cc
@@ -113,7 +113,7 @@ Return::set_state (const XMLNode& node, int version)
}
void
-Return::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
+Return::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
{
if ((!_active && !_pending_active) || _input->n_ports() == ChanCount::ZERO) {
return;
@@ -124,14 +124,14 @@ Return::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, doub
// Can't automate gain for sends or returns yet because we need different buffers
// so that we don't overwrite the main automation data for the route amp
- // _amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (bufs, start_frame, end_frame, speed, nframes, true);
+ // _amp->setup_gain_automation (start_sample, end_sample, nframes);
+ _amp->run (bufs, start_sample, end_sample, speed, nframes, true);
if (_metering) {
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
- _meter->run (bufs, start_frame, end_frame, speed, nframes, true);
+ _meter->run (bufs, start_sample, end_sample, speed, nframes, true);
}
}
diff --git a/libs/ardour/reverse.cc b/libs/ardour/reverse.cc
index b2189cf67e..9f829ba0d6 100644
--- a/libs/ardour/reverse.cc
+++ b/libs/ardour/reverse.cc
@@ -43,11 +43,11 @@ Reverse::run (boost::shared_ptr<Region> r, Progress*)
{
SourceList nsrcs;
SourceList::iterator si;
- framecnt_t blocksize = 256 * 1024;
+ samplecnt_t blocksize = 256 * 1024;
Sample* buf = 0;
- framepos_t fpos;
- framepos_t fstart;
- framecnt_t to_read;
+ samplepos_t fpos;
+ samplepos_t fstart;
+ samplecnt_t to_read;
int ret = -1;
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion>(r);
@@ -87,7 +87,7 @@ Reverse::run (boost::shared_ptr<Region> r, Progress*)
/* swap memory order */
- for (framecnt_t i = 0; i < to_read/2; ++i) {
+ for (samplecnt_t i = 0; i < to_read/2; ++i) {
swap (buf[i],buf[to_read-1-i]);
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 741757691a..b972652bb3 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -293,7 +293,7 @@ Route::set_trim (gain_t val, Controllable::GroupControlDisposition /* group over
}
void
-Route::maybe_declick (BufferSet&, framecnt_t, int)
+Route::maybe_declick (BufferSet&, samplecnt_t, int)
{
/* this is the "bus" implementation and they never declick.
*/
@@ -303,16 +303,16 @@ Route::maybe_declick (BufferSet&, framecnt_t, int)
/** Process this route for one (sub) cycle (process thread)
*
* @param bufs Scratch buffers to use for the signal path
- * @param start_frame Initial transport frame
- * @param end_frame Final transport frame
- * @param nframes Number of frames to output (to ports)
+ * @param start_sample Initial transport sample
+ * @param end_sample Final transport sample
+ * @param nframes Number of samples to output (to ports)
*
- * Note that (end_frame - start_frame) may not be equal to nframes when the
+ * Note that (end_sample - start_sample) may not be equal to nframes when the
* transport speed isn't 1.0 (eg varispeed).
*/
void
Route::process_output_buffers (BufferSet& bufs,
- framepos_t start_frame, framepos_t end_frame, pframes_t nframes,
+ samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes,
int declick, bool gain_automation_ok)
{
/* Caller must hold process lock */
@@ -326,20 +326,20 @@ Route::process_output_buffers (BufferSet& bufs,
return;
}
- automation_run (start_frame, nframes);
+ automation_run (start_sample, nframes);
/* figure out if we're going to use gain automation */
if (gain_automation_ok) {
_amp->set_gain_automation_buffer (_session.gain_automation_buffer ());
_amp->setup_gain_automation (
- start_frame + _signal_latency_at_amp_position,
- end_frame + _signal_latency_at_amp_position,
+ start_sample + _signal_latency_at_amp_position,
+ end_sample + _signal_latency_at_amp_position,
nframes);
_trim->set_gain_automation_buffer (_session.trim_automation_buffer ());
_trim->setup_gain_automation (
- start_frame + _signal_latency_at_trim_position,
- end_frame + _signal_latency_at_trim_position,
+ start_sample + _signal_latency_at_trim_position,
+ end_sample + _signal_latency_at_trim_position,
nframes);
} else {
_amp->apply_gain_automation (false);
@@ -423,7 +423,7 @@ Route::process_output_buffers (BufferSet& bufs,
/* set this to be true if the meter will already have been ::run() earlier */
bool const meter_already_run = metering_state() == MeteringInput;
- framecnt_t latency = 0;
+ samplecnt_t latency = 0;
const double speed = (is_auditioner() ? 1.0 : _session.transport_speed ());
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
@@ -455,13 +455,13 @@ Route::process_output_buffers (BufferSet& bufs,
boost::dynamic_pointer_cast<Send>(*i)->set_delay_in(_signal_latency - latency);
}
if (boost::dynamic_pointer_cast<PluginInsert>(*i) != 0) {
- const framecnt_t longest_session_latency = _initial_delay + _signal_latency;
+ const samplecnt_t longest_session_latency = _initial_delay + _signal_latency;
boost::dynamic_pointer_cast<PluginInsert>(*i)->set_sidechain_latency (
_initial_delay + latency, longest_session_latency - latency);
}
//cerr << name() << " run " << (*i)->name() << endl;
- (*i)->run (bufs, start_frame - latency, end_frame - latency, speed, nframes, *i != _processors.back());
+ (*i)->run (bufs, start_sample - latency, end_sample - latency, speed, nframes, *i != _processors.back());
bufs.set_count ((*i)->output_streams());
if ((*i)->active ()) {
@@ -471,7 +471,7 @@ Route::process_output_buffers (BufferSet& bufs,
}
void
-Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
+Route::bounce_process (BufferSet& buffers, samplepos_t start, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint, bool for_export, bool for_freeze)
{
@@ -480,7 +480,7 @@ Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
return;
}
- framecnt_t latency = bounce_get_latency(_amp, false, for_export, for_freeze);
+ samplecnt_t latency = bounce_get_latency(_amp, false, for_export, for_freeze);
_amp->set_gain_automation_buffer (_session.gain_automation_buffer ());
_amp->setup_gain_automation (start - latency, start - latency + nframes, nframes);
@@ -531,11 +531,11 @@ Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
}
}
-framecnt_t
+samplecnt_t
Route::bounce_get_latency (boost::shared_ptr<Processor> endpoint,
bool include_endpoint, bool for_export, bool for_freeze) const
{
- framecnt_t latency = 0;
+ samplecnt_t latency = 0;
if (!endpoint && !include_endpoint) {
return latency;
}
@@ -595,16 +595,16 @@ Route::n_process_buffers ()
}
void
-Route::monitor_run (framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick)
+Route::monitor_run (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick)
{
assert (is_monitor());
BufferSet& bufs (_session.get_route_buffers (n_process_buffers()));
fill_buffers_with_input (bufs, _input, nframes);
- passthru (bufs, start_frame, end_frame, nframes, declick);
+ passthru (bufs, start_sample, end_sample, nframes, declick);
}
void
-Route::passthru (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick)
+Route::passthru (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick)
{
_silent = false;
@@ -618,18 +618,18 @@ Route::passthru (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
bufs.silence (nframes, 0);
}
- write_out_of_band_data (bufs, start_frame, end_frame, nframes);
- process_output_buffers (bufs, start_frame, end_frame, nframes, declick, true);
+ write_out_of_band_data (bufs, start_sample, end_sample, nframes);
+ process_output_buffers (bufs, start_sample, end_sample, nframes, declick, true);
}
void
-Route::passthru_silence (framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick)
+Route::passthru_silence (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick)
{
BufferSet& bufs (_session.get_route_buffers (n_process_buffers(), true));
bufs.set_count (_input->n_ports());
- write_out_of_band_data (bufs, start_frame, end_frame, nframes);
- process_output_buffers (bufs, start_frame, end_frame, nframes, declick, false);
+ write_out_of_band_data (bufs, start_sample, end_sample, nframes);
+ process_output_buffers (bufs, start_sample, end_sample, nframes, declick, false);
}
void
@@ -1809,7 +1809,7 @@ Route::configure_processors_unlocked (ProcessorStreams* err, Glib::Threads::RWLo
// TODO check for a potential ReaderLock after ReaderLock ??
Glib::Threads::RWLock::ReaderLock lr (_processor_lock);
- framecnt_t chain_latency = _input->latency ();
+ samplecnt_t chain_latency = _input->latency ();
list< pair<ChanCount,ChanCount> >::iterator c = configuration.begin();
for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p, ++c) {
@@ -2990,7 +2990,7 @@ Route::curve_reallocate ()
}
void
-Route::silence (framecnt_t nframes)
+Route::silence (samplecnt_t nframes)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
@@ -3001,11 +3001,11 @@ Route::silence (framecnt_t nframes)
}
void
-Route::silence_unlocked (framecnt_t nframes)
+Route::silence_unlocked (samplecnt_t nframes)
{
/* Must be called with the processor lock held */
- const framepos_t now = _session.transport_frame ();
+ const samplepos_t now = _session.transport_sample ();
if (!_silent) {
@@ -3335,7 +3335,7 @@ Route::feeds_according_to_graph (boost::shared_ptr<Route> other)
/** Called from the (non-realtime) butler thread when the transport is stopped */
void
-Route::non_realtime_transport_stop (framepos_t now, bool flush)
+Route::non_realtime_transport_stop (samplepos_t now, bool flush)
{
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
@@ -3529,7 +3529,7 @@ Route::pans_required () const
}
void
-Route::flush_processor_buffers_locked (framecnt_t nframes)
+Route::flush_processor_buffers_locked (samplecnt_t nframes)
{
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
boost::shared_ptr<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*i);
@@ -3545,7 +3545,7 @@ Route::flush_processor_buffers_locked (framecnt_t nframes)
}
int
-Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing)
+Route::no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool session_state_changing)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
@@ -3578,12 +3578,12 @@ Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput) {
- _meter->run (bufs, start_frame, end_frame, 0.0, nframes, true);
+ _meter->run (bufs, start_sample, end_sample, 0.0, nframes, true);
}
_amp->apply_gain_automation (false);
_trim->apply_gain_automation (false);
- passthru (bufs, start_frame, end_frame, nframes, 0);
+ passthru (bufs, start_sample, end_sample, nframes, 0);
flush_processor_buffers_locked (nframes);
@@ -3591,7 +3591,7 @@ Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
}
int
-Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& /* need_butler */)
+Route::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& /* need_butler */)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
@@ -3603,7 +3603,7 @@ Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, in
return 0;
}
- framepos_t unused = 0;
+ samplepos_t unused = 0;
if ((nframes = check_initial_delay (nframes, unused)) == 0) {
return 0;
@@ -3616,10 +3616,10 @@ Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, in
fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput) {
- _meter->run (bufs, start_frame, end_frame, 1.0, nframes, true);
+ _meter->run (bufs, start_sample, end_sample, 1.0, nframes, true);
}
- passthru (bufs, start_frame, end_frame, nframes, declick);
+ passthru (bufs, start_sample, end_sample, nframes, declick);
flush_processor_buffers_locked (nframes);
@@ -3627,7 +3627,7 @@ Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, in
}
int
-Route::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, bool& /* need_butler */)
+Route::silent_roll (pframes_t nframes, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, bool& /* need_butler */)
{
silence (nframes);
flush_processor_buffers_locked (nframes);
@@ -3862,13 +3862,13 @@ Route::add_export_point()
return _capturing_processor;
}
-framecnt_t
+samplecnt_t
Route::update_signal_latency ()
{
- framecnt_t l = _output->user_latency();
- framecnt_t lamp = 0;
+ samplecnt_t l = _output->user_latency();
+ samplecnt_t lamp = 0;
bool before_amp = true;
- framecnt_t ltrim = 0;
+ samplecnt_t ltrim = 0;
bool before_trim = true;
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
@@ -3904,16 +3904,16 @@ Route::update_signal_latency ()
}
void
-Route::set_user_latency (framecnt_t nframes)
+Route::set_user_latency (samplecnt_t nframes)
{
_output->set_user_latency (nframes);
_session.update_latency_compensation ();
}
void
-Route::set_latency_compensation (framecnt_t longest_session_latency)
+Route::set_latency_compensation (samplecnt_t longest_session_latency)
{
- framecnt_t old = _initial_delay;
+ samplecnt_t old = _initial_delay;
if (_signal_latency < longest_session_latency) {
_initial_delay = longest_session_latency - _signal_latency;
@@ -3972,18 +3972,18 @@ Route::set_pending_declick (int declick)
* Adds undo commands for any shifts that are performed.
*
* @param pos Position to start shifting from.
- * @param frames Amount to shift forwards by.
+ * @param samples Amount to shift forwards by.
*/
void
-Route::shift (framepos_t pos, framecnt_t frames)
+Route::shift (samplepos_t pos, samplecnt_t samples)
{
/* gain automation */
{
boost::shared_ptr<AutomationControl> gc = _amp->gain_control();
XMLNode &before = gc->alist()->get_state ();
- gc->alist()->shift (pos, frames);
+ gc->alist()->shift (pos, samples);
XMLNode &after = gc->alist()->get_state ();
_session.add_command (new MementoCommand<AutomationList> (*gc->alist().get(), &before, &after));
}
@@ -3993,7 +3993,7 @@ Route::shift (framepos_t pos, framecnt_t frames)
boost::shared_ptr<AutomationControl> gc = _trim->gain_control();
XMLNode &before = gc->alist()->get_state ();
- gc->alist()->shift (pos, frames);
+ gc->alist()->shift (pos, samples);
XMLNode &after = gc->alist()->get_state ();
_session.add_command (new MementoCommand<AutomationList> (*gc->alist().get(), &before, &after));
}
@@ -4009,7 +4009,7 @@ Route::shift (framepos_t pos, framecnt_t frames)
if (pc) {
boost::shared_ptr<AutomationList> al = pc->alist();
XMLNode& before = al->get_state ();
- al->shift (pos, frames);
+ al->shift (pos, samples);
XMLNode& after = al->get_state ();
_session.add_command (new MementoCommand<AutomationList> (*al.get(), &before, &after));
}
@@ -4028,7 +4028,7 @@ Route::shift (framepos_t pos, framecnt_t frames)
if (ac) {
boost::shared_ptr<AutomationList> al = ac->alist();
XMLNode &before = al->get_state ();
- al->shift (pos, frames);
+ al->shift (pos, samples);
XMLNode &after = al->get_state ();
_session.add_command (new MementoCommand<AutomationList> (*al.get(), &before, &after));
}
@@ -4396,8 +4396,8 @@ Route::unknown_processors () const
}
-framecnt_t
-Route::update_port_latencies (PortSet& from, PortSet& to, bool playback, framecnt_t our_latency) const
+samplecnt_t
+Route::update_port_latencies (PortSet& from, PortSet& to, bool playback, samplecnt_t our_latency) const
{
/* we assume that all our input ports feed all our output ports. its not
universally true, but the alternative is way too corner-case to worry about.
@@ -4445,10 +4445,10 @@ Route::update_port_latencies (PortSet& from, PortSet& to, bool playback, framecn
return all_connections.max;
}
-framecnt_t
+samplecnt_t
Route::set_private_port_latencies (bool playback) const
{
- framecnt_t own_latency = 0;
+ samplecnt_t own_latency = 0;
/* Processor list not protected by lock: MUST BE CALLED FROM PROCESS THREAD
OR LATENCY CALLBACK.
@@ -4477,7 +4477,7 @@ Route::set_private_port_latencies (bool playback) const
}
void
-Route::set_public_port_latencies (framecnt_t value, bool playback) const
+Route::set_public_port_latencies (samplecnt_t value, bool playback) const
{
/* this is called to set the JACK-visible port latencies, which take
latency compensation into account.
@@ -4859,7 +4859,7 @@ Route::the_instrument_unlocked () const
void
-Route::non_realtime_locate (framepos_t pos)
+Route::non_realtime_locate (samplepos_t pos)
{
Automatable::non_realtime_locate (pos);
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index f28142da4c..c5ad4d8ed7 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -130,7 +130,7 @@ Send::deactivate ()
}
void
-Send::set_delay_in(framecnt_t delay)
+Send::set_delay_in(samplecnt_t delay)
{
if (!_delayline) return;
if (_delay_in == delay) {
@@ -145,7 +145,7 @@ Send::set_delay_in(framecnt_t delay)
}
void
-Send::set_delay_out(framecnt_t delay)
+Send::set_delay_out(samplecnt_t delay)
{
if (!_delayline) return;
if (_delay_out == delay) {
@@ -159,7 +159,7 @@ Send::set_delay_out(framecnt_t delay)
}
void
-Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
+Send::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
{
if (_output->n_ports() == ChanCount::ZERO) {
_meter->reset ();
@@ -184,14 +184,14 @@ Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double
/* gain control */
_amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ());
- _amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (sendbufs, start_frame, end_frame, speed, nframes, true);
+ _amp->setup_gain_automation (start_sample, end_sample, nframes);
+ _amp->run (sendbufs, start_sample, end_sample, speed, nframes, true);
- _delayline->run (sendbufs, start_frame, end_frame, speed, nframes, true);
+ _delayline->run (sendbufs, start_sample, end_sample, speed, nframes, true);
/* deliver to outputs */
- Delivery::run (sendbufs, start_frame, end_frame, speed, nframes, true);
+ Delivery::run (sendbufs, start_sample, end_sample, speed, nframes, true);
/* consider metering */
@@ -199,7 +199,7 @@ Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
- _meter->run (*_output_buffers, start_frame, end_frame, speed, nframes, true);
+ _meter->run (*_output_buffers, start_sample, end_sample, speed, nframes, true);
}
}
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 47bb16b39a..33ed2c22d3 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -139,13 +139,13 @@ guint Session::_name_id_counter = 0;
PBD::Signal1<int,uint32_t> Session::AudioEngineSetupRequired;
PBD::Signal1<void,std::string> Session::Dialog;
PBD::Signal0<int> Session::AskAboutPendingState;
-PBD::Signal2<int, framecnt_t, framecnt_t> Session::AskAboutSampleRateMismatch;
-PBD::Signal2<void, framecnt_t, framecnt_t> Session::NotifyAboutSampleRateMismatch;
+PBD::Signal2<int, samplecnt_t, samplecnt_t> Session::AskAboutSampleRateMismatch;
+PBD::Signal2<void, samplecnt_t, samplecnt_t> Session::NotifyAboutSampleRateMismatch;
PBD::Signal0<void> Session::SendFeedback;
PBD::Signal3<int,Session*,std::string,DataType> Session::MissingFile;
-PBD::Signal1<void, framepos_t> Session::StartTimeChanged;
-PBD::Signal1<void, framepos_t> Session::EndTimeChanged;
+PBD::Signal1<void, samplepos_t> Session::StartTimeChanged;
+PBD::Signal1<void, samplepos_t> Session::EndTimeChanged;
PBD::Signal2<void,std::string, std::string> Session::Exported;
PBD::Signal1<int,boost::shared_ptr<Playlist> > Session::AskAboutPlaylistDeletion;
PBD::Signal0<void> Session::Quit;
@@ -153,7 +153,7 @@ PBD::Signal0<void> Session::FeedbackDetected;
PBD::Signal0<void> Session::SuccessfulGraphSort;
PBD::Signal2<void,std::string,std::string> Session::VersionMismatch;
-const framecnt_t Session::bounce_chunk_size = 8192;
+const samplecnt_t Session::bounce_chunk_size = 8192;
static void clean_up_session_event (SessionEvent* ev) { delete ev; }
const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
@@ -175,12 +175,12 @@ Session::Session (AudioEngine &eng,
, process_function (&Session::process_with_events)
, _bounce_processing_active (false)
, waiting_for_sync_offset (false)
- , _base_frame_rate (0)
- , _nominal_frame_rate (0)
- , _current_frame_rate (0)
+ , _base_sample_rate (0)
+ , _nominal_sample_rate (0)
+ , _current_sample_rate (0)
, transport_sub_state (0)
, _record_status (Disabled)
- , _transport_frame (0)
+ , _transport_sample (0)
, _seek_counter (0)
, _session_range_location (0)
, _session_range_end_is_free (true)
@@ -192,9 +192,9 @@ Session::Session (AudioEngine &eng,
, _signalled_varispeed (0)
, _target_transport_speed (0.0)
, auto_play_legal (false)
- , _last_slave_transport_frame (0)
+ , _last_slave_transport_sample (0)
, maximum_output_latency (0)
- , _requested_return_frame (-1)
+ , _requested_return_sample (-1)
, current_block_size (0)
, _worst_output_latency (0)
, _worst_input_latency (0)
@@ -242,7 +242,7 @@ Session::Session (AudioEngine &eng,
, _last_roll_or_reversal_location (0)
, _last_record_location (0)
, pending_locate_roll (false)
- , pending_locate_frame (0)
+ , pending_locate_sample (0)
, pending_locate_flush (false)
, pending_abort (false)
, pending_auto_loop (false)
@@ -364,7 +364,7 @@ Session::Session (AudioEngine &eng,
// set samplerate for plugins added early
// e.g from templates or MB channelstrip
set_block_size (_engine.samples_per_cycle());
- set_frame_rate (_engine.sample_rate());
+ set_sample_rate (_engine.sample_rate());
if (create (mix_template, bus_profile)) {
destroy ();
@@ -614,7 +614,7 @@ Session::immediately_post_engine ()
}
if (config.get_jack_time_master()) {
- _engine.transport_locate (_transport_frame);
+ _engine.transport_locate (_transport_sample);
}
try {
@@ -1659,7 +1659,7 @@ Session::auto_punch_start_changed (Location* location)
void
Session::auto_punch_end_changed (Location* location)
{
- framepos_t when_to_stop = location->end();
+ samplepos_t when_to_stop = location->end();
// when_to_stop += _worst_output_latency + _worst_input_latency;
replace_event (SessionEvent::PunchOut, when_to_stop);
}
@@ -1667,7 +1667,7 @@ Session::auto_punch_end_changed (Location* location)
void
Session::auto_punch_changed (Location* location)
{
- framepos_t when_to_stop = location->end();
+ samplepos_t when_to_stop = location->end();
replace_event (SessionEvent::PunchIn, location->start());
//when_to_stop += _worst_output_latency + _worst_input_latency;
@@ -1675,11 +1675,11 @@ Session::auto_punch_changed (Location* location)
}
/** @param loc A loop location.
- * @param pos Filled in with the start time of the required fade-out (in session frames).
+ * @param pos Filled in with the start time of the required fade-out (in session samples).
* @param length Filled in with the length of the required fade-out.
*/
void
-Session::auto_loop_declick_range (Location* loc, framepos_t & pos, framepos_t & length)
+Session::auto_loop_declick_range (Location* loc, samplepos_t & pos, samplepos_t & length)
{
pos = max (loc->start(), loc->end() - 64);
length = loc->end() - pos;
@@ -1689,17 +1689,17 @@ void
Session::auto_loop_changed (Location* location)
{
replace_event (SessionEvent::AutoLoop, location->end(), location->start());
- framepos_t dcp;
- framecnt_t dcl;
+ samplepos_t dcp;
+ samplecnt_t dcl;
auto_loop_declick_range (location, dcp, dcl);
if (transport_rolling() && play_loop) {
replace_event (SessionEvent::AutoLoopDeclick, dcp, dcl);
- // if (_transport_frame > location->end()) {
+ // if (_transport_sample > location->end()) {
- if (_transport_frame < location->start() || _transport_frame > location->end()) {
+ if (_transport_sample < location->start() || _transport_sample > location->end()) {
// relocate to beginning of loop
clear_events (SessionEvent::LocateRoll);
@@ -1728,7 +1728,7 @@ Session::auto_loop_changed (Location* location)
to the loop start on stop if that is appropriate.
*/
- framepos_t pos;
+ samplepos_t pos;
if (!transport_rolling() && select_playhead_priority_target (pos)) {
if (pos == location->start()) {
@@ -1779,7 +1779,7 @@ Session::set_auto_punch_location (Location* location)
}
void
-Session::set_session_extents (framepos_t start, framepos_t end)
+Session::set_session_extents (samplepos_t start, samplepos_t end)
{
Location* existing;
if ((existing = _locations->session_range_location()) == 0) {
@@ -1806,8 +1806,8 @@ Session::set_auto_loop_location (Location* location)
loop_connections.drop_connections ();
existing->set_auto_loop (false, this);
remove_event (existing->end(), SessionEvent::AutoLoop);
- framepos_t dcp;
- framecnt_t dcl;
+ samplepos_t dcp;
+ samplecnt_t dcl;
auto_loop_declick_range (existing, dcp, dcl);
remove_event (dcp, SessionEvent::AutoLoopDeclick);
auto_loop_location_changed (0);
@@ -2068,7 +2068,7 @@ Session::enable_record ()
if (g_atomic_int_compare_and_exchange (&_record_status, rs, Recording)) {
- _last_record_location = _transport_frame;
+ _last_record_location = _transport_sample;
send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordStrobe));
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
@@ -2162,12 +2162,12 @@ Session::maybe_enable_record (bool rt_context)
set_dirty();
}
-framepos_t
-Session::audible_frame (bool* latent_locate) const
+samplepos_t
+Session::audible_sample (bool* latent_locate) const
{
- framepos_t ret;
+ samplepos_t ret;
- frameoffset_t offset = worst_playback_latency (); // - _engine.samples_since_cycle_start ();
+ sampleoffset_t offset = worst_playback_latency (); // - _engine.samples_since_cycle_start ();
offset *= transport_speed ();
if (latent_locate) {
*latent_locate = false;
@@ -2175,18 +2175,18 @@ Session::audible_frame (bool* latent_locate) const
if (synced_to_engine()) {
/* Note: this is basically just sync-to-JACK */
- ret = _engine.transport_frame();
+ ret = _engine.transport_sample();
} else {
- ret = _transport_frame;
+ ret = _transport_sample;
}
if (transport_rolling()) {
ret -= offset;
/* Check to see if we have passed the first guaranteed
- * audible frame past our last start position. if not,
+ * audible sample past our last start position. if not,
* return that last start point because in terms
- * of audible frames, we have not moved yet.
+ * of audible samples, we have not moved yet.
*
* `Start position' in this context means the time we last
* either started, located, or changed transport direction.
@@ -2208,7 +2208,7 @@ Session::audible_frame (bool* latent_locate) const
* is still at the end of the loop.
*/
Location *location = _locations->auto_loop_location();
- frameoffset_t lo = location->start() - ret;
+ sampleoffset_t lo = location->start() - ret;
if (lo > 0) {
ret = location->end () - lo;
if (latent_locate) {
@@ -2227,42 +2227,42 @@ Session::audible_frame (bool* latent_locate) const
}
}
- return std::max ((framepos_t)0, ret);
+ return std::max ((samplepos_t)0, ret);
}
-framecnt_t
-Session::preroll_samples (framepos_t pos) const
+samplecnt_t
+Session::preroll_samples (samplepos_t pos) const
{
const float pr = Config->get_preroll_seconds();
if (pos >= 0 && pr < 0) {
- const Tempo& tempo = _tempo_map->tempo_at_frame (pos);
- const Meter& meter = _tempo_map->meter_at_frame (pos);
- return meter.frames_per_bar (tempo, frame_rate()) * -pr;
+ const Tempo& tempo = _tempo_map->tempo_at_sample (pos);
+ const Meter& meter = _tempo_map->meter_at_sample (pos);
+ return meter.samples_per_bar (tempo, sample_rate()) * -pr;
}
if (pr < 0) {
return 0;
}
- return pr * frame_rate();
+ return pr * sample_rate();
}
void
-Session::set_frame_rate (framecnt_t frames_per_second)
+Session::set_sample_rate (samplecnt_t frames_per_second)
{
- /** \fn void Session::set_frame_size(framecnt_t)
+ /** \fn void Session::set_sample_size(samplecnt_t)
the AudioEngine object that calls this guarantees
that it will not be called while we are also in
::process(). Its fine to do things that block
here.
*/
- if (_base_frame_rate == 0) {
- _base_frame_rate = frames_per_second;
+ if (_base_sample_rate == 0) {
+ _base_sample_rate = frames_per_second;
}
- else if (_base_frame_rate != frames_per_second && frames_per_second != _nominal_frame_rate) {
- NotifyAboutSampleRateMismatch (_base_frame_rate, frames_per_second);
+ else if (_base_sample_rate != frames_per_second && frames_per_second != _nominal_sample_rate) {
+ NotifyAboutSampleRateMismatch (_base_sample_rate, frames_per_second);
}
- _nominal_frame_rate = frames_per_second;
+ _nominal_sample_rate = frames_per_second;
sync_time_vars();
@@ -4687,7 +4687,7 @@ Session::playlist_region_added (boost::weak_ptr<Region> w)
/* If so, update the session range markers */
if (!in.empty ()) {
- maybe_update_session_range (r->position (), r->last_frame ());
+ maybe_update_session_range (r->position (), r->last_sample ());
}
}
@@ -4695,13 +4695,13 @@ Session::playlist_region_added (boost::weak_ptr<Region> w)
* b is after the current end.
*/
void
-Session::maybe_update_session_range (framepos_t a, framepos_t b)
+Session::maybe_update_session_range (samplepos_t a, samplepos_t b)
{
if (_state_of_the_state & Loading) {
return;
}
- framepos_t session_end_marker_shift_samples = session_end_shift * _nominal_frame_rate;
+ samplepos_t session_end_marker_shift_samples = session_end_shift * _nominal_sample_rate;
if (_session_range_location == 0) {
@@ -4726,17 +4726,17 @@ Session::set_end_is_free (bool yn)
}
void
-Session::playlist_ranges_moved (list<Evoral::RangeMove<framepos_t> > const & ranges)
+Session::playlist_ranges_moved (list<Evoral::RangeMove<samplepos_t> > const & ranges)
{
- for (list<Evoral::RangeMove<framepos_t> >::const_iterator i = ranges.begin(); i != ranges.end(); ++i) {
+ for (list<Evoral::RangeMove<samplepos_t> >::const_iterator i = ranges.begin(); i != ranges.end(); ++i) {
maybe_update_session_range (i->to, i->to + i->length);
}
}
void
-Session::playlist_regions_extended (list<Evoral::Range<framepos_t> > const & ranges)
+Session::playlist_regions_extended (list<Evoral::Range<samplepos_t> > const & ranges)
{
- for (list<Evoral::Range<framepos_t> >::const_iterator i = ranges.begin(); i != ranges.end(); ++i) {
+ for (list<Evoral::Range<samplepos_t> >::const_iterator i = ranges.begin(); i != ranges.end(); ++i) {
maybe_update_session_range (i->from, i->to);
}
}
@@ -5325,7 +5325,7 @@ Session::create_audio_source_for_session (size_t n_chans, string const & base, u
if (!path.empty()) {
return boost::dynamic_pointer_cast<AudioFileSource> (
- SourceFactory::createWritable (DataType::AUDIO, *this, path, destructive, frame_rate(), true, true));
+ SourceFactory::createWritable (DataType::AUDIO, *this, path, destructive, sample_rate(), true, true));
} else {
throw failed_constructor ();
}
@@ -5340,7 +5340,7 @@ Session::create_midi_source_for_session (string const & basic_name)
if (!path.empty()) {
return boost::dynamic_pointer_cast<SMFSource> (
SourceFactory::createWritable (
- DataType::MIDI, *this, path, false, frame_rate()));
+ DataType::MIDI, *this, path, false, sample_rate()));
} else {
throw failed_constructor ();
}
@@ -5385,7 +5385,7 @@ Session::create_midi_source_by_stealing_name (boost::shared_ptr<Track> track)
return boost::dynamic_pointer_cast<SMFSource> (
SourceFactory::createWritable (
- DataType::MIDI, *this, path, false, frame_rate()));
+ DataType::MIDI, *this, path, false, sample_rate()));
}
@@ -5745,16 +5745,16 @@ Session::graph_reordered ()
}
}
-/** @return Number of frames that there is disk space available to write,
+/** @return Number of samples that there is disk space available to write,
* if known.
*/
-boost::optional<framecnt_t>
+boost::optional<samplecnt_t>
Session::available_capture_duration ()
{
Glib::Threads::Mutex::Lock lm (space_lock);
if (_total_free_4k_blocks_uncertain) {
- return boost::optional<framecnt_t> ();
+ return boost::optional<samplecnt_t> ();
}
float sample_bytes_on_disk = 4.0; // keep gcc happy
@@ -5782,11 +5782,11 @@ Session::available_capture_duration ()
double scale = 4096.0 / sample_bytes_on_disk;
- if (_total_free_4k_blocks * scale > (double) max_framecnt) {
- return max_framecnt;
+ if (_total_free_4k_blocks * scale > (double) max_samplecnt) {
+ return max_samplecnt;
}
- return (framecnt_t) floor (_total_free_4k_blocks * scale);
+ return (samplecnt_t) floor (_total_free_4k_blocks * scale);
}
void
@@ -5858,7 +5858,7 @@ void
Session::update_locations_after_tempo_map_change (const Locations::LocationList& loc)
{
for (Locations::LocationList::const_iterator i = loc.begin(); i != loc.end(); ++i) {
- (*i)->recompute_frames_from_beat ();
+ (*i)->recompute_samples_from_beat ();
}
}
@@ -6106,7 +6106,7 @@ Session::freeze_all (InterThreadInfo& itt)
}
boost::shared_ptr<Region>
-Session::write_one_track (Track& track, framepos_t start, framepos_t end,
+Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
bool /*overwrite*/, vector<boost::shared_ptr<Source> >& srcs,
InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint, bool include_endpoint,
@@ -6116,12 +6116,12 @@ Session::write_one_track (Track& track, framepos_t start, framepos_t end,
boost::shared_ptr<Playlist> playlist;
boost::shared_ptr<Source> source;
ChanCount diskstream_channels (track.n_channels());
- framepos_t position;
- framecnt_t this_chunk;
- framepos_t to_do;
- framepos_t latency_skip;
+ samplepos_t position;
+ samplecnt_t this_chunk;
+ samplepos_t to_do;
+ samplepos_t latency_skip;
BufferSet buffers;
- framepos_t len = end - start;
+ samplepos_t len = end - start;
bool need_block_size_reset = false;
ChanCount const max_proc = track.max_processor_streams ();
string legal_playlist_name;
@@ -6175,7 +6175,7 @@ Session::write_one_track (Track& track, framepos_t start, framepos_t end,
}
try {
- source = SourceFactory::createWritable (track.data_type(), *this, path, false, frame_rate());
+ source = SourceFactory::createWritable (track.data_type(), *this, path, false, sample_rate());
}
catch (failed_constructor& err) {
@@ -6233,7 +6233,7 @@ Session::write_one_track (Track& track, framepos_t start, framepos_t end,
continue;
}
- const framecnt_t current_chunk = this_chunk - latency_skip;
+ const samplecnt_t current_chunk = this_chunk - latency_skip;
uint32_t n = 0;
for (vector<boost::shared_ptr<Source> >::iterator src=srcs.begin(); src != srcs.end(); ++src, ++n) {
@@ -6249,9 +6249,9 @@ Session::write_one_track (Track& track, framepos_t start, framepos_t end,
const MidiBuffer& buf = buffers.get_midi(0);
for (MidiBuffer::const_iterator i = buf.begin(); i != buf.end(); ++i) {
- Evoral::Event<framepos_t> ev = *i;
+ Evoral::Event<samplepos_t> ev = *i;
ev.set_time(ev.time() - position);
- ms->append_event_frames(lock, ev, ms->timeline_position());
+ ms->append_event_samples(lock, ev, ms->timeline_position());
}
}
}
@@ -6579,7 +6579,7 @@ Session::get_tracks () const
}
boost::shared_ptr<RouteList>
-Session::get_routes_with_regions_at (framepos_t const p) const
+Session::get_routes_with_regions_at (samplepos_t const p) const
{
boost::shared_ptr<RouteList> r = routes.reader ();
boost::shared_ptr<RouteList> rl (new RouteList);
@@ -6623,20 +6623,20 @@ Session::goto_start (bool and_roll)
}
}
-framepos_t
-Session::current_start_frame () const
+samplepos_t
+Session::current_start_sample () const
{
return _session_range_location ? _session_range_location->start() : 0;
}
-framepos_t
-Session::current_end_frame () const
+samplepos_t
+Session::current_end_sample () const
{
return _session_range_location ? _session_range_location->end() : 0;
}
void
-Session::set_session_range_location (framepos_t start, framepos_t end)
+Session::set_session_range_location (samplepos_t start, samplepos_t end)
{
_session_range_location = new Location (*this, start, end, _("session"), Location::IsSessionRange, 0);
_locations->add (_session_range_location);
@@ -6669,7 +6669,7 @@ Session::step_edit_status_change (bool yn)
void
-Session::start_time_changed (framepos_t old)
+Session::start_time_changed (samplepos_t old)
{
/* Update the auto loop range to match the session range
(unless the auto loop range has been changed by the user)
@@ -6689,7 +6689,7 @@ Session::start_time_changed (framepos_t old)
}
void
-Session::end_time_changed (framepos_t old)
+Session::end_time_changed (samplepos_t old)
{
/* Update the auto loop range to match the session range
(unless the auto loop range has been changed by the user)
@@ -6865,7 +6865,7 @@ Session::update_latency (bool playback)
}
boost::shared_ptr<RouteList> r = routes.reader ();
- framecnt_t max_latency = 0;
+ samplecnt_t max_latency = 0;
if (playback) {
/* reverse the list so that we work backwards from the last route to run to the first */
@@ -7025,7 +7025,7 @@ Session::update_latency_compensation (bool force_whole_graph)
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
assert (!(*i)->is_auditioner()); // XXX remove me
if ((*i)->active()) {
- framecnt_t tl;
+ samplecnt_t tl;
if ((*i)->signal_latency () != (tl = (*i)->update_signal_latency ())) {
some_track_latency_changed = true;
}
@@ -7139,18 +7139,18 @@ Session::reconnect_ltc_output ()
}
void
-Session::set_range_selection (framepos_t start, framepos_t end)
+Session::set_range_selection (samplepos_t start, samplepos_t end)
{
- _range_selection = Evoral::Range<framepos_t> (start, end);
+ _range_selection = Evoral::Range<samplepos_t> (start, end);
#ifdef USE_TRACKS_CODE_FEATURES
follow_playhead_priority ();
#endif
}
void
-Session::set_object_selection (framepos_t start, framepos_t end)
+Session::set_object_selection (samplepos_t start, samplepos_t end)
{
- _object_selection = Evoral::Range<framepos_t> (start, end);
+ _object_selection = Evoral::Range<samplepos_t> (start, end);
#ifdef USE_TRACKS_CODE_FEATURES
follow_playhead_priority ();
#endif
@@ -7159,7 +7159,7 @@ Session::set_object_selection (framepos_t start, framepos_t end)
void
Session::clear_range_selection ()
{
- _range_selection = Evoral::Range<framepos_t> (-1,-1);
+ _range_selection = Evoral::Range<samplepos_t> (-1,-1);
#ifdef USE_TRACKS_CODE_FEATURES
follow_playhead_priority ();
#endif
@@ -7168,7 +7168,7 @@ Session::clear_range_selection ()
void
Session::clear_object_selection ()
{
- _object_selection = Evoral::Range<framepos_t> (-1,-1);
+ _object_selection = Evoral::Range<samplepos_t> (-1,-1);
#ifdef USE_TRACKS_CODE_FEATURES
follow_playhead_priority ();
#endif
diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc
index fae442f6c5..b4b5283fd8 100644
--- a/libs/ardour/session_click.cc
+++ b/libs/ardour/session_click.cc
@@ -40,7 +40,7 @@ using namespace PBD;
Pool Click::pool ("click", sizeof (Click), 1024);
void
-Session::add_click (framepos_t pos, bool emphasis)
+Session::add_click (samplepos_t pos, bool emphasis)
{
if (emphasis) {
if (click_emphasis_data && Config->get_use_click_emphasis () == true) {
@@ -54,10 +54,10 @@ Session::add_click (framepos_t pos, bool emphasis)
}
void
-Session::click (framepos_t start, framecnt_t nframes)
+Session::click (samplepos_t start, samplecnt_t nframes)
{
vector<TempoMap::BBTPoint> points;
- framecnt_t click_distance;
+ samplecnt_t click_distance;
if (_click_io == 0) {
return;
@@ -86,9 +86,9 @@ Session::click (framepos_t start, framecnt_t nframes)
}
#endif
/* start could be negative at this point */
- const framepos_t end = start + nframes;
+ const samplepos_t end = start + nframes;
/* correct start, potentially */
- start = max (start, (framepos_t) 0);
+ start = max (start, (samplepos_t) 0);
_tempo_map->get_grid (points, start, end);
@@ -99,11 +99,11 @@ Session::click (framepos_t start, framecnt_t nframes)
for (vector<TempoMap::BBTPoint>::iterator i = points.begin(); i != points.end(); ++i) {
switch ((*i).beat) {
case 1:
- add_click ((*i).frame, true);
+ add_click ((*i).sample, true);
break;
default:
if (click_emphasis_data == 0 || (Config->get_use_click_emphasis () == false) || (click_emphasis_data && (*i).beat != 1)) { // XXX why is this check needed ??
- add_click ((*i).frame, false);
+ add_click ((*i).sample, false);
}
break;
}
@@ -115,7 +115,7 @@ Session::click (framepos_t start, framecnt_t nframes)
}
void
-Session::run_click (framepos_t start, framepos_t nframes)
+Session::run_click (samplepos_t start, samplepos_t nframes)
{
Glib::Threads::RWLock::ReaderLock clickm (click_lock, Glib::Threads::TRY_LOCK);
@@ -131,8 +131,8 @@ Session::run_click (framepos_t start, framepos_t nframes)
for (list<Click*>::iterator i = clicks.begin(); i != clicks.end(); ) {
- framecnt_t copy;
- framecnt_t internal_offset;
+ samplecnt_t copy;
+ samplecnt_t internal_offset;
Click *clk;
clk = *i;
@@ -169,7 +169,7 @@ Session::run_click (framepos_t start, framepos_t nframes)
}
void
-Session::setup_click_sounds (Sample** data, Sample const * default_data, framecnt_t* length, framecnt_t default_length, string const & path)
+Session::setup_click_sounds (Sample** data, Sample const * default_data, samplecnt_t* length, samplecnt_t default_length, string const & path)
{
if (*data != default_data) {
delete[] *data;
@@ -264,5 +264,5 @@ Session::clear_clicks ()
}
clicks.clear ();
- _clicks_cleared = _transport_frame;
+ _clicks_cleared = _transport_sample;
}
diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc
index a14405a9e5..3987351372 100644
--- a/libs/ardour/session_events.cc
+++ b/libs/ardour/session_events.cc
@@ -58,11 +58,11 @@ SessionEvent::create_per_thread_pool (const std::string& name, uint32_t nitems)
pool->create_per_thread_pool (name, sizeof (SessionEvent), nitems);
}
-SessionEvent::SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn, bool yn2, bool yn3)
+SessionEvent::SessionEvent (Type t, Action a, samplepos_t when, samplepos_t where, double spd, bool yn, bool yn2, bool yn3)
: type (t)
, action (a)
- , action_frame (when)
- , target_frame (where)
+ , action_sample (when)
+ , target_sample (where)
, speed (spd)
, yes_or_no (yn)
, second_yes_or_no (yn2)
@@ -108,23 +108,23 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/)
}
void
-SessionEventManager::add_event (framepos_t frame, SessionEvent::Type type, framepos_t target_frame)
+SessionEventManager::add_event (samplepos_t sample, SessionEvent::Type type, samplepos_t target_sample)
{
- SessionEvent* ev = new SessionEvent (type, SessionEvent::Add, frame, target_frame, 0);
+ SessionEvent* ev = new SessionEvent (type, SessionEvent::Add, sample, target_sample, 0);
queue_event (ev);
}
void
-SessionEventManager::remove_event (framepos_t frame, SessionEvent::Type type)
+SessionEventManager::remove_event (samplepos_t sample, SessionEvent::Type type)
{
- SessionEvent* ev = new SessionEvent (type, SessionEvent::Remove, frame, 0, 0);
+ SessionEvent* ev = new SessionEvent (type, SessionEvent::Remove, sample, 0, 0);
queue_event (ev);
}
void
-SessionEventManager::replace_event (SessionEvent::Type type, framepos_t frame, framepos_t target)
+SessionEventManager::replace_event (SessionEvent::Type type, samplepos_t sample, samplepos_t target)
{
- SessionEvent* ev = new SessionEvent (type, SessionEvent::Replace, frame, target, 0);
+ SessionEvent* ev = new SessionEvent (type, SessionEvent::Replace, sample, target, 0);
queue_event (ev);
}
@@ -160,20 +160,20 @@ SessionEventManager::dump_events () const
cerr << "EVENT DUMP" << endl;
for (Events::const_iterator i = events.begin(); i != events.end(); ++i) {
- cerr << "\tat " << (*i)->action_frame << ' ' << enum_2_string ((*i)->type) << " target = " << (*i)->target_frame << endl;
+ cerr << "\tat " << (*i)->action_sample << ' ' << enum_2_string ((*i)->type) << " target = " << (*i)->target_sample << endl;
}
cerr << "Next event: ";
if ((Events::const_iterator) next_event == events.end()) {
cerr << "none" << endl;
} else {
- cerr << "at " << (*next_event)->action_frame << ' '
+ cerr << "at " << (*next_event)->action_sample << ' '
<< enum_2_string ((*next_event)->type) << " target = "
- << (*next_event)->target_frame << endl;
+ << (*next_event)->target_sample << endl;
}
cerr << "Immediate events pending:\n";
for (Events::const_iterator i = immediate_events.begin(); i != immediate_events.end(); ++i) {
- cerr << "\tat " << (*i)->action_frame << ' ' << enum_2_string((*i)->type) << " target = " << (*i)->target_frame << endl;
+ cerr << "\tat " << (*i)->action_sample << ' ' << enum_2_string((*i)->type) << " target = " << (*i)->target_sample << endl;
}
cerr << "END EVENT_DUMP" << endl;
}
@@ -216,7 +216,7 @@ SessionEventManager::merge_event (SessionEvent* ev)
_clear_event_type (ev->type);
}
- if (ev->action_frame == SessionEvent::Immediate) {
+ if (ev->action_sample == SessionEvent::Immediate) {
process_event (ev);
return;
}
@@ -229,9 +229,9 @@ SessionEventManager::merge_event (SessionEvent* ev)
break;
default:
for (Events::iterator i = events.begin(); i != events.end(); ++i) {
- if ((*i)->type == ev->type && (*i)->action_frame == ev->action_frame) {
- error << string_compose(_("Session: cannot have two events of type %1 at the same frame (%2)."),
- enum_2_string (ev->type), ev->action_frame) << endmsg;
+ if ((*i)->type == ev->type && (*i)->action_sample == ev->action_sample) {
+ error << string_compose(_("Session: cannot have two events of type %1 at the same sample (%2)."),
+ enum_2_string (ev->type), ev->action_sample) << endmsg;
return;
}
}
@@ -254,8 +254,8 @@ SessionEventManager::_replace_event (SessionEvent* ev)
for (i = events.begin(); i != events.end(); ++i) {
if ((*i)->type == ev->type) {
- (*i)->action_frame = ev->action_frame;
- (*i)->target_frame = ev->target_frame;
+ (*i)->action_sample = ev->action_sample;
+ (*i)->target_sample = ev->target_sample;
if ((*i) == ev) {
ret = true;
}
@@ -283,7 +283,7 @@ SessionEventManager::_remove_event (SessionEvent* ev)
Events::iterator i;
for (i = events.begin(); i != events.end(); ++i) {
- if ((*i)->type == ev->type && (*i)->action_frame == ev->action_frame) {
+ if ((*i)->type == ev->type && (*i)->action_sample == ev->action_sample) {
if ((*i) == ev) {
ret = true;
}
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index 7276d631dd..4ef304eac7 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -86,7 +86,7 @@ Session::pre_export ()
/* no slaving */
post_export_sync = config.get_external_sync ();
- post_export_position = _transport_frame;
+ post_export_position = _transport_sample;
config.set_external_sync (false);
@@ -104,7 +104,7 @@ Session::pre_export ()
/** Called for each range that is being exported */
int
-Session::start_audio_export (framepos_t position, bool realtime, bool region_export, bool comensate_master_latency)
+Session::start_audio_export (samplepos_t position, bool realtime, bool region_export, bool comensate_master_latency)
{
if (!_exporting) {
pre_export ();
@@ -117,9 +117,9 @@ Session::start_audio_export (framepos_t position, bool realtime, bool region_exp
_export_preroll = 0;
}
else if (realtime) {
- _export_preroll = nominal_frame_rate ();
+ _export_preroll = nominal_sample_rate ();
} else {
- _export_preroll = Config->get_export_preroll() * nominal_frame_rate ();
+ _export_preroll = Config->get_export_preroll() * nominal_sample_rate ();
}
if (_export_preroll == 0) {
@@ -176,11 +176,11 @@ Session::start_audio_export (framepos_t position, bool realtime, bool region_exp
}
/* we just did the core part of a locate() call above, but
- for the sake of any GUI, put the _transport_frame in
+ for the sake of any GUI, put the _transport_sample in
the right place too.
*/
- _transport_frame = position;
+ _transport_sample = position;
export_status->stop = false;
/* get transport ready. note how this is calling butler functions
@@ -262,7 +262,7 @@ Session::process_export_fw (pframes_t nframes)
_engine.main_thread()->drop_buffers ();
}
- _export_preroll -= std::min ((framepos_t)nframes, _export_preroll);
+ _export_preroll -= std::min ((samplepos_t)nframes, _export_preroll);
if (_export_preroll > 0) {
// clear out buffers (reverb tails etc).
@@ -278,7 +278,7 @@ Session::process_export_fw (pframes_t nframes)
}
if (_export_latency > 0) {
- framepos_t remain = std::min ((framepos_t)nframes, _export_latency);
+ samplepos_t remain = std::min ((samplepos_t)nframes, _export_latency);
if (need_buffers) {
_engine.main_thread()->get_buffers ();
diff --git a/libs/ardour/session_ltc.cc b/libs/ardour/session_ltc.cc
index 8acb16dde3..ae18c43ac9 100644
--- a/libs/ardour/session_ltc.cc
+++ b/libs/ardour/session_ltc.cc
@@ -68,19 +68,19 @@ Session::ltc_tx_initialize()
ltc_enc_tcformat = config.get_timecode_format();
ltc_tx_parse_offset();
- DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX init sr: %1 fps: %2\n", nominal_frame_rate(), timecode_to_frames_per_second(ltc_enc_tcformat)));
- ltc_encoder = ltc_encoder_create(nominal_frame_rate(),
+ DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX init sr: %1 fps: %2\n", nominal_sample_rate(), timecode_to_frames_per_second(ltc_enc_tcformat)));
+ ltc_encoder = ltc_encoder_create(nominal_sample_rate(),
timecode_to_frames_per_second(ltc_enc_tcformat),
TV_STANDARD(ltc_enc_tcformat), 0);
- ltc_encoder_set_bufsize(ltc_encoder, nominal_frame_rate(), 23.0);
+ ltc_encoder_set_bufsize(ltc_encoder, nominal_sample_rate(), 23.0);
ltc_encoder_set_filter(ltc_encoder, LTC_RISE_TIME(1.0));
- /* buffersize for 1 LTC frame: (1 + sample-rate / fps) bytes
+ /* buffersize for 1 LTC sample: (1 + sample-rate / fps) bytes
* usually returned by ltc_encoder_get_buffersize(encoder)
*
* since the fps can change and A3's min fps: 24000/1001 */
- ltc_enc_buf = (ltcsnd_sample_t*) calloc((nominal_frame_rate() / 23), sizeof(ltcsnd_sample_t));
+ ltc_enc_buf = (ltcsnd_sample_t*) calloc((nominal_sample_rate() / 23), sizeof(ltcsnd_sample_t));
ltc_speed = 0;
ltc_prev_cycle = -1;
ltc_tx_reset();
@@ -153,7 +153,7 @@ Session::ltc_tx_recalculate_position()
a3tc.drop = timecode_has_drop_frames(ltc_enc_tcformat);
Timecode::timecode_to_sample (a3tc, ltc_enc_pos, true, false,
- (double)frame_rate(),
+ (double)sample_rate(),
config.get_subframes_per_frame(),
ltc_timecode_negative_offset, ltc_timecode_offset
);
@@ -161,7 +161,7 @@ Session::ltc_tx_recalculate_position()
}
void
-Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame,
+Session::ltc_tx_send_time_code_for_cycle (samplepos_t start_sample, samplepos_t end_sample,
double target_speed, double current_speed,
pframes_t nframes)
{
@@ -203,18 +203,18 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
/* range from libltc (38..218) || - 128.0 -> (-90..90) */
const float ltcvol = Config->get_ltc_output_volume()/(90.0); // pow(10, db/20.0)/(90.0);
- DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX %1 to %2 / %3 | lat: %4\n", start_frame, end_frame, nframes, ltc_out_latency.max));
+ DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX %1 to %2 / %3 | lat: %4\n", start_sample, end_sample, nframes, ltc_out_latency.max));
/* all systems go. Now here's the plan:
*
* 1) check if fps has changed
* 2) check direction of encoding, calc speed, re-sample existing buffer
- * 3) calculate frame and byte to send aligned to jack-period size
- * 4) check if it's the frame/byte that is already in the queue
- * 5) if (4) mismatch, re-calculate offset of LTC frame relative to period size
+ * 3) calculate sample and byte to send aligned to jack-period size
+ * 4) check if it's the sample/byte that is already in the queue
+ * 5) if (4) mismatch, re-calculate offset of LTC sample relative to period size
* 6) actual LTC audio output
- * 6a) send remaining part of already queued frame; break on nframes
- * 6b) encode new LTC-frame byte
+ * 6a) send remaining part of already queued sample; break on nframes
+ * 6b) encode new LTC-sample byte
* 6c) goto 6a
* 7) done
*/
@@ -222,8 +222,8 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
// (1) check fps
TimecodeFormat cur_timecode = config.get_timecode_format();
if (cur_timecode != ltc_enc_tcformat) {
- DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX1: TC format mismatch - reinit sr: %1 fps: %2\n", nominal_frame_rate(), timecode_to_frames_per_second(cur_timecode)));
- if (ltc_encoder_reinit(ltc_encoder, nominal_frame_rate(),
+ DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX1: TC format mismatch - reinit sr: %1 fps: %2\n", nominal_sample_rate(), timecode_to_frames_per_second(cur_timecode)));
+ if (ltc_encoder_reinit(ltc_encoder, nominal_sample_rate(),
timecode_to_frames_per_second(cur_timecode),
TV_STANDARD(cur_timecode), 0
)) {
@@ -245,7 +245,7 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
// (2) speed & direction
/* speed 0 aka transport stopped is interpreted as rolling forward.
- * keep repeating current frame
+ * keep repeating current sample
*/
#define SIGNUM(a) ( (a) < 0 ? -1 : 1)
bool speed_changed = false;
@@ -263,36 +263,36 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
* buffer.
*
* The timecode is generated directly in the Session process callback
- * using _transport_frame. It requires that the session has set the
+ * using _transport_sample. It requires that the session has set the
* port's playback latency to worst_playback_latency() prior to
* calling ltc_tx_send_time_code_for_cycle().
*/
- framepos_t cycle_start_frame;
+ samplepos_t cycle_start_sample;
if (current_speed < 0) {
- cycle_start_frame = (start_frame - ltc_out_latency.max + worst_playback_latency());
+ cycle_start_sample = (start_sample - ltc_out_latency.max + worst_playback_latency());
} else if (current_speed > 0) {
- cycle_start_frame = (start_frame + ltc_out_latency.max - worst_playback_latency());
+ cycle_start_sample = (start_sample + ltc_out_latency.max - worst_playback_latency());
} else {
/* There is no need to compensate for latency when not rolling
* rather send the accurate NOW timecode
* (LTC encoder compenates latency by sending earlier timecode)
*/
- cycle_start_frame = start_frame;
+ cycle_start_sample = start_sample;
}
/* LTC TV standard offset */
if (current_speed != 0) {
/* ditto - send "NOW" if not rolling */
- cycle_start_frame -= ltc_frame_alignment(samples_per_timecode_frame(), TV_STANDARD(cur_timecode));
+ cycle_start_sample -= ltc_frame_alignment(samples_per_timecode_frame(), TV_STANDARD(cur_timecode));
}
/* cycle-start may become negative due to latency compensation */
- if (cycle_start_frame < 0) { cycle_start_frame = 0; }
+ if (cycle_start_sample < 0) { cycle_start_sample = 0; }
- double new_ltc_speed = (double)(labs(end_frame - start_frame) * SIGNUM(current_speed)) / (double)nframes;
- if (nominal_frame_rate() != frame_rate()) {
- new_ltc_speed *= (double)nominal_frame_rate() / (double)frame_rate();
+ double new_ltc_speed = (double)(labs(end_sample - start_sample) * SIGNUM(current_speed)) / (double)nframes;
+ if (nominal_sample_rate() != sample_rate()) {
+ new_ltc_speed *= (double)nominal_sample_rate() / (double)sample_rate();
}
if (SIGNUM(new_ltc_speed) != SIGNUM (ltc_speed)) {
@@ -302,7 +302,7 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
if (ltc_speed != new_ltc_speed
/* but only once if, current_speed changes to 0. In that case
- * new_ltc_speed is > 0 because (end_frame - start_frame) == jack-period for no-roll
+ * new_ltc_speed is > 0 because (end_sample - start_sample) == jack-period for no-roll
* but ltc_speed will still be 0
*/
&& (current_speed != 0 || ltc_speed != current_speed)
@@ -312,8 +312,8 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
*
* However, currency in A3 target_speed == current_speed for each process cycle
* (except for the sign and if target_speed > 8.0).
- * Besides, above speed calculation uses the difference (end_frame - start_frame).
- * end_frame is calculated from 'frames_moved' which includes the interpolation.
+ * Besides, above speed calculation uses the difference (end_sample - start_sample).
+ * end_sample is calculated from 'samples_moved' which includes the interpolation.
* so we're good.
*/
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX2: speed change old: %1 cur: %2 tgt: %3 ctd: %4\n", ltc_speed, current_speed, target_speed, fabs(current_speed) - target_speed, new_ltc_speed));
@@ -321,9 +321,9 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
ltc_encoder_set_filter(ltc_encoder, LTC_RISE_TIME(new_ltc_speed));
}
- if (end_frame == start_frame || fabs(current_speed) < 0.1 ) {
+ if (end_sample == start_sample || fabs(current_speed) < 0.1 ) {
DEBUG_TRACE (DEBUG::LTC, "LTC TX2: transport is not rolling or absolute-speed < 0.1\n");
- /* keep repeating current frame
+ /* keep repeating current sample
*
* an LTC generator must be able to continue generating LTC when Ardours transport is in stop
* some machines do odd things if LTC goes away:
@@ -336,8 +336,8 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
ltc_speed = new_ltc_speed;
return;
}
- if (start_frame != ltc_prev_cycle) {
- DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX2: no-roll seek from %1 to %2 (%3)\n", ltc_prev_cycle, start_frame, cycle_start_frame));
+ if (start_sample != ltc_prev_cycle) {
+ DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX2: no-roll seek from %1 to %2 (%3)\n", ltc_prev_cycle, start_sample, cycle_start_sample));
ltc_tx_reset();
}
}
@@ -423,37 +423,37 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
}
}
- ltc_prev_cycle = start_frame;
+ ltc_prev_cycle = start_sample;
ltc_speed = new_ltc_speed;
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX2: transport speed %1.\n", ltc_speed));
// (3) bit/sample alignment
Timecode::Time tc_start;
- framepos_t tc_sample_start;
+ samplepos_t tc_sample_start;
/* calc timecode frame from current position - round down to nearest timecode */
- Timecode::sample_to_timecode(cycle_start_frame, tc_start, true, false,
+ Timecode::sample_to_timecode(cycle_start_sample, tc_start, true, false,
timecode_frames_per_second(),
timecode_drop_frames(),
- (double)frame_rate(),
+ (double)sample_rate(),
config.get_subframes_per_frame(),
ltc_timecode_negative_offset, ltc_timecode_offset
);
/* convert timecode back to sample-position */
Timecode::timecode_to_sample (tc_start, tc_sample_start, true, false,
- (double)frame_rate(),
+ (double)sample_rate(),
config.get_subframes_per_frame(),
ltc_timecode_negative_offset, ltc_timecode_offset
);
- /* difference between current frame and TC frame in samples */
- frameoffset_t soff = cycle_start_frame - tc_sample_start;
+ /* difference between current sample and TC sample in samples */
+ sampleoffset_t soff = cycle_start_sample - tc_sample_start;
if (current_speed == 0) {
soff = 0;
}
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX3: A3cycle: %1 = A3tc: %2 +off: %3\n",
- cycle_start_frame, tc_sample_start, soff));
+ cycle_start_sample, tc_sample_start, soff));
// (4) check if alignment matches
@@ -475,7 +475,7 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
maxdiff = slave()->resolution();
} else {
maxdiff = ceil(fabs(ltc_speed))*2.0;
- if (nominal_frame_rate() != frame_rate()) {
+ if (nominal_sample_rate() != sample_rate()) {
maxdiff *= 3.0;
}
if (ltc_enc_tcformat == Timecode::timecode_23976 || ltc_enc_tcformat == Timecode::timecode_24976) {
@@ -488,18 +488,18 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX4: enc-pos: %1 | d: %2\n",
ltc_enc_pos + ltc_enc_cnt - poff,
- rint(ltc_enc_pos + ltc_enc_cnt - poff) - cycle_start_frame
+ rint(ltc_enc_pos + ltc_enc_cnt - poff) - cycle_start_sample
));
- const framecnt_t wrap24h = 86400. * frame_rate();
+ const samplecnt_t wrap24h = 86400. * sample_rate();
if (ltc_enc_pos < 0
- || (ltc_speed != 0 && fabs(fmod(ceil(ltc_enc_pos + ltc_enc_cnt - poff), wrap24h) - (cycle_start_frame % wrap24h)) > maxdiff)
+ || (ltc_speed != 0 && fabs(fmod(ceil(ltc_enc_pos + ltc_enc_cnt - poff), wrap24h) - (cycle_start_sample % wrap24h)) > maxdiff)
) {
// (5) re-align
ltc_tx_reset();
- /* set frame to encode */
+ /* set sample to encode */
SMPTETimecode tc;
tc.hours = tc_start.hours % 24;
tc.mins = tc_start.minutes;
@@ -507,8 +507,8 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
tc.frame = tc_start.frames;
ltc_encoder_set_timecode(ltc_encoder, &tc);
- /* workaround for libltc recognizing 29.97 and 30000/1001 as drop-frame TC.
- * In A3 30000/1001 or 30 fps can be drop-frame.
+ /* workaround for libltc recognizing 29.97 and 30000/1001 as drop-sample TC.
+ * In A3 30000/1001 or 30 fps can be drop-sample.
*/
LTCFrame ltcframe;
ltc_encoder_get_frame(ltc_encoder, &ltcframe);
@@ -516,7 +516,7 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
ltc_encoder_set_frame(ltc_encoder, &ltcframe);
- DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX4: now: %1 trs: %2 toff %3\n", cycle_start_frame, tc_sample_start, soff));
+ DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX4: now: %1 trs: %2 toff %3\n", cycle_start_sample, tc_sample_start, soff));
int32_t cyc_off;
if (soff < 0 || soff >= fptcf) {
@@ -572,7 +572,7 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
else if (ltc_speed != 0 && (fptcf / ltc_speed / 80) > 3 ) {
/* reduce (low freq) jitter.
* The granularity of the LTC encoder speed is 1 byte =
- * (frames-per-timecode-frame / 10) audio-samples.
+ * (samples-per-timecode-sample / 10) audio-samples.
* Thus, tiny speed changes [as produced by some slaves]
* may not have any effect in the cycle when they occur,
* but they will add up over time.
@@ -582,12 +582,12 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
*
* However, for very fast speeds - when 1 LTC bit is
* <= 3 audio-sample - adjusting speed may lead to
- * invalid frames.
+ * invalid samples.
*
* To do better than this, resampling (or a rewrite of the
* encoder) is required.
*/
- ltc_speed -= fmod(((ltc_enc_pos + ltc_enc_cnt - poff) - cycle_start_frame), wrap24h) / engine().sample_rate();
+ ltc_speed -= fmod(((ltc_enc_pos + ltc_enc_cnt - poff) - cycle_start_sample), wrap24h) / engine().sample_rate();
}
@@ -626,14 +626,14 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
}
}
- int enc_frames;
+ int enc_samples;
if (restarting) {
- /* write zero bytes -- don't touch encoder until we're at a frame-boundary
+ /* write zero bytes -- don't touch encoder until we're at a sample-boundary
* otherwise the biphase polarity may be inverted.
*/
- enc_frames = fptcf / 10.0;
- memset(&ltc_enc_buf[ltc_buf_len], 127, enc_frames * sizeof(ltcsnd_sample_t));
+ enc_samples = fptcf / 10.0;
+ memset(&ltc_enc_buf[ltc_buf_len], 127, enc_samples * sizeof(ltcsnd_sample_t));
} else {
if (ltc_encoder_encode_byte(ltc_encoder, ltc_enc_byte, (ltc_speed==0)?1.0:(1.0/ltc_speed))) {
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX6.3 encoder error byte %1\n", ltc_enc_byte));
@@ -641,20 +641,20 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
ltc_tx_reset();
return;
}
- enc_frames = ltc_encoder_get_buffer(ltc_encoder, &(ltc_enc_buf[ltc_buf_len]));
+ enc_samples = ltc_encoder_get_buffer(ltc_encoder, &(ltc_enc_buf[ltc_buf_len]));
}
#ifdef LTC_GEN_FRAMEDBUG
- DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX6.3 encoded %1 bytes for LTC-byte %2 at spd %3\n", enc_frames, ltc_enc_byte, ltc_speed));
+ DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX6.3 encoded %1 bytes for LTC-byte %2 at spd %3\n", enc_samples, ltc_enc_byte, ltc_speed));
#endif
- if (enc_frames <=0) {
+ if (enc_samples <=0) {
DEBUG_TRACE (DEBUG::LTC, "LTC TX6.3 encoder empty buffer.\n");
ltc_encoder_buffer_flush(ltc_encoder);
ltc_tx_reset();
return;
}
- ltc_buf_len += enc_frames;
+ ltc_buf_len += enc_samples;
if (ltc_speed < 0)
ltc_enc_cnt -= fptcf/10.0;
else
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index 081db24d2a..b29cc0cd05 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -77,7 +77,7 @@ Session::setup_midi_control ()
outbound_mtc_timecode_frame = 0;
next_quarter_frame_to_send = 0;
- /* Set up the qtr frame message */
+ /* Set up the qtr sample message */
mtc_msg[0] = 0xf1;
mtc_msg[2] = 0xf1;
@@ -283,7 +283,7 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc)
return;
}
- framepos_t target_frame;
+ samplepos_t target_sample;
Timecode::Time timecode;
timecode.hours = mmc_tc[0] & 0xf;
@@ -294,13 +294,13 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc)
timecode.drop = timecode_drop_frames();
// Also takes timecode offset into account:
- timecode_to_sample( timecode, target_frame, true /* use_offset */, false /* use_subframes */ );
+ timecode_to_sample( timecode, target_sample, true /* use_offset */, false /* use_subframes */ );
- if (target_frame > max_framepos) {
- target_frame = max_framepos;
+ if (target_sample > max_samplepos) {
+ target_sample = max_samplepos;
}
- /* Some (all?) MTC/MMC devices do not send a full MTC frame
+ /* Some (all?) MTC/MMC devices do not send a full MTC sample
at the end of a locate, instead sending only an MMC
locate command. This causes the current position
of an MTC slave to become out of date. Catch this.
@@ -313,7 +313,7 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc)
mtcs->handle_locate (mmc_tc);
} else {
// cerr << "Locate without MTC slave\n";
- request_locate (target_frame, false);
+ request_locate (target_sample, false);
}
}
@@ -389,9 +389,9 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
* @param t time to send.
*/
int
-Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes)
+Session::send_full_time_code (samplepos_t const t, MIDI::pframes_t nframes)
{
- /* This function could easily send at a given frame offset, but would
+ /* This function could easily send at a given sample offset, but would
* that be useful? Does ardour do sub-block accurate locating? [DR] */
MIDI::byte msg[10];
@@ -410,26 +410,26 @@ Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes)
sample_to_timecode (t, timecode, true /* use_offset */, false /* no subframes */);
// sample-align outbound to rounded (no subframes) timecode
- framepos_t mtc_tc;
+ samplepos_t mtc_tc;
timecode_to_sample(timecode, mtc_tc, true, false);
outbound_mtc_timecode_frame = mtc_tc;
transmitting_timecode_time = timecode;
LatencyRange mtc_out_latency = {0, 0}; // TODO cache this, update on engine().GraphReordered()
_midi_ports->mtc_output_port ()->get_connected_latency_range (ltc_out_latency, true);
- frameoffset_t mtc_offset = worst_playback_latency() - mtc_out_latency.max;
+ sampleoffset_t mtc_offset = worst_playback_latency() - mtc_out_latency.max;
// only if rolling.. ?
outbound_mtc_timecode_frame += mtc_offset;
- // outbound_mtc_timecode_frame needs to be >= _transport_frame
+ // outbound_mtc_timecode_frame needs to be >= _transport_sample
// or a new full timecode will be queued next cycle.
while (outbound_mtc_timecode_frame < t) {
Timecode::increment (transmitting_timecode_time, config.get_subframes_per_frame());
outbound_mtc_timecode_frame += _samples_per_timecode_frame;
}
- double const quarter_frame_duration = ((framecnt_t) _samples_per_timecode_frame) / 4.0;
+ double const quarter_frame_duration = ((samplecnt_t) _samples_per_timecode_frame) / 4.0;
if (ceil((t - mtc_tc) / quarter_frame_duration) > 0) {
Timecode::increment (transmitting_timecode_time, config.get_subframes_per_frame());
outbound_mtc_timecode_frame += _samples_per_timecode_frame;
@@ -439,9 +439,9 @@ Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes)
// I don't understand this bit yet.. [DR]
// I do [rg]:
- // according to MTC spec 24, 30 drop and 30 non-drop TC, the frame-number represented by 8 quarter frames must be even.
+ // according to MTC spec 24, 30 drop and 30 non-drop TC, the sample-number represented by 8 quarter frames must be even.
if (((mtc_timecode_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_timecode_time.frames % 2)) {
- // start MTC quarter frame transmission on an even frame
+ // start MTC quarter frame transmission on an even sample
Timecode::increment (transmitting_timecode_time, config.get_subframes_per_frame());
outbound_mtc_timecode_frame += _samples_per_timecode_frame;
}
@@ -473,15 +473,15 @@ Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes)
/** Send MTC (quarter-frame) messages for this cycle.
* Must be called exactly once per cycle from the process thread. Realtime safe.
* This function assumes the state of full Timecode is sane, eg. the slave is
- * expecting quarter frame messages and has the right frame of reference (any
+ * expecting quarter frame messages and has the right sample of reference (any
* full MTC Timecode time messages that needed to be sent should have been sent
* earlier already this cycle by send_full_time_code)
*/
int
-Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame, ARDOUR::pframes_t nframes)
+Session::send_midi_time_code_for_cycle (samplepos_t start_sample, samplepos_t end_sample, ARDOUR::pframes_t nframes)
{
- // start_frame == start_frame for normal cycles
- // start_frame > _transport_frame for split cycles
+ // start_sample == start_sample for normal cycles
+ // start_sample > _transport_sample for split cycles
if (_engine.freewheeling() || !_send_qf_mtc || transmitting_timecode_time.negative || (next_quarter_frame_to_send < 0)) {
// cerr << "(MTC) Not sending MTC\n";
return 0;
@@ -510,23 +510,23 @@ Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_f
double const quarter_frame_duration = _samples_per_timecode_frame / 4.0;
DEBUG_TRACE (DEBUG::MTC, string_compose ("TF %1 SF %2 MT %3 QF %4 QD %5\n",
- _transport_frame, start_frame, outbound_mtc_timecode_frame,
+ _transport_sample, start_sample, outbound_mtc_timecode_frame,
next_quarter_frame_to_send, quarter_frame_duration));
- if (rint(outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration)) < _transport_frame) {
+ if (rint(outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration)) < _transport_sample) {
// send full timecode and set outbound_mtc_timecode_frame, next_quarter_frame_to_send
- send_full_time_code (_transport_frame, nframes);
+ send_full_time_code (_transport_sample, nframes);
}
- if (rint(outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration)) < start_frame) {
+ if (rint(outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration)) < start_sample) {
// no QF for this cycle
return 0;
}
/* Send quarter frames for this cycle */
- while (end_frame > rint(outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration))) {
+ while (end_sample > rint(outbound_mtc_timecode_frame + (next_quarter_frame_to_send * quarter_frame_duration))) {
- DEBUG_TRACE (DEBUG::MTC, string_compose ("next frame to send: %1\n", next_quarter_frame_to_send));
+ DEBUG_TRACE (DEBUG::MTC, string_compose ("next sample to send: %1\n", next_quarter_frame_to_send));
switch (next_quarter_frame_to_send) {
case 0:
@@ -555,14 +555,14 @@ Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_f
break;
}
- const framepos_t msg_time = rint(outbound_mtc_timecode_frame + (quarter_frame_duration * next_quarter_frame_to_send));
+ const samplepos_t msg_time = rint(outbound_mtc_timecode_frame + (quarter_frame_duration * next_quarter_frame_to_send));
// This message must fall within this block or something is broken
- assert (msg_time >= start_frame);
- assert (msg_time < end_frame);
+ assert (msg_time >= start_sample);
+ assert (msg_time < end_sample);
- /* convert from session frames back to JACK frames using the transport speed */
- ARDOUR::pframes_t const out_stamp = (msg_time - start_frame) / _transport_speed;
+ /* convert from session samples back to JACK samples using the transport speed */
+ ARDOUR::pframes_t const out_stamp = (msg_time - start_sample) / _transport_speed;
assert (out_stamp < nframes);
MidiBuffer& mb (_midi_ports->mtc_output_port()->get_midi_buffer(nframes));
@@ -649,7 +649,7 @@ Session::mmc_step_timeout ()
void
-Session::send_song_position_pointer (framepos_t)
+Session::send_song_position_pointer (samplepos_t)
{
if (midi_clock) {
/* Do nothing for the moment */
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index fc6a58b3cb..ca1f3b9b7a 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -53,13 +53,13 @@ using namespace PBD;
using namespace std;
/** Called by the audio engine when there is work to be done with JACK.
- * @param nframes Number of frames to process.
+ * @param nframes Number of samples to process.
*/
void
Session::process (pframes_t nframes)
{
- framepos_t transport_at_start = _transport_frame;
+ samplepos_t transport_at_start = _transport_sample;
_silent = false;
@@ -103,7 +103,7 @@ Session::process (pframes_t nframes)
_engine.main_thread()->drop_buffers ();
- /* deliver MIDI clock. Note that we need to use the transport frame
+ /* deliver MIDI clock. Note that we need to use the transport sample
* position at the start of process(), not the value at the end of
* it. We may already have ticked() because of a transport state
* change, for example.
@@ -134,7 +134,7 @@ Session::no_roll (pframes_t nframes)
{
PT_TIMING_CHECK (4);
- framepos_t end_frame = _transport_frame + nframes; // FIXME: varispeed + no_roll ??
+ samplepos_t end_sample = _transport_sample + nframes; // FIXME: varispeed + no_roll ??
int ret = 0;
int declick = (config.get_use_transport_fades() ? get_transport_declick_required() : false);
boost::shared_ptr<RouteList> r = routes.reader ();
@@ -143,16 +143,16 @@ Session::no_roll (pframes_t nframes)
_click_io->silence (nframes);
}
- ltc_tx_send_time_code_for_cycle (_transport_frame, end_frame, _target_transport_speed, _transport_speed, nframes);
+ ltc_tx_send_time_code_for_cycle (_transport_sample, end_sample, _target_transport_speed, _transport_speed, nframes);
VCAList v = _vca_manager->vcas ();
for (VCAList::const_iterator i = v.begin(); i != v.end(); ++i) {
- (*i)->automation_run (_transport_frame, nframes);
+ (*i)->automation_run (_transport_sample, nframes);
}
if (_process_graph) {
DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/no-roll\n");
- _process_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), declick);
+ _process_graph->routes_no_roll( nframes, _transport_sample, end_sample, non_realtime_work_pending(), declick);
} else {
PT_TIMING_CHECK (10);
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
@@ -163,7 +163,7 @@ Session::no_roll (pframes_t nframes)
(*i)->set_pending_declick (declick);
- if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending())) {
+ if ((*i)->no_roll (nframes, _transport_sample, end_sample, non_realtime_work_pending())) {
error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg;
ret = -1;
break;
@@ -185,19 +185,19 @@ Session::process_routes (pframes_t nframes, bool& need_butler)
int declick = (config.get_use_transport_fades() ? get_transport_declick_required() : false);
boost::shared_ptr<RouteList> r = routes.reader ();
- const framepos_t start_frame = _transport_frame;
- const framepos_t end_frame = _transport_frame + floor (nframes * _transport_speed);
+ const samplepos_t start_sample = _transport_sample;
+ const samplepos_t end_sample = _transport_sample + floor (nframes * _transport_speed);
VCAList v = _vca_manager->vcas ();
for (VCAList::const_iterator i = v.begin(); i != v.end(); ++i) {
- (*i)->automation_run (start_frame, nframes);
+ (*i)->automation_run (start_sample, nframes);
}
_global_locate_pending = locate_pending ();
if (_process_graph) {
DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/process-routes\n");
- if (_process_graph->process_routes (nframes, start_frame, end_frame, declick, need_butler) < 0) {
+ if (_process_graph->process_routes (nframes, start_sample, end_sample, declick, need_butler) < 0) {
stop_transport ();
return -1;
}
@@ -215,7 +215,7 @@ Session::process_routes (pframes_t nframes, bool& need_butler)
bool b = false;
- if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, b)) < 0) {
+ if ((ret = (*i)->roll (nframes, start_sample, end_sample, declick, b)) < 0) {
stop_transport ();
return -1;
}
@@ -265,9 +265,9 @@ Session::process_with_events (pframes_t nframes)
SessionEvent* ev;
pframes_t this_nframes;
- framepos_t end_frame;
+ samplepos_t end_sample;
bool session_needs_butler = false;
- framecnt_t frames_moved;
+ samplecnt_t samples_moved;
/* make sure the auditioner is silent */
@@ -298,10 +298,10 @@ Session::process_with_events (pframes_t nframes)
}
if (_count_in_samples > 0) {
- framecnt_t ns = std::min ((framecnt_t)nframes, _count_in_samples);
+ samplecnt_t ns = std::min ((samplecnt_t)nframes, _count_in_samples);
no_roll (ns);
- run_click (_transport_frame - _count_in_samples, ns);
+ run_click (_transport_sample - _count_in_samples, ns);
_count_in_samples -= ns;
nframes -= ns;
@@ -312,7 +312,7 @@ Session::process_with_events (pframes_t nframes)
Events::iterator the_next_one = next_event;
++the_next_one;
- while (this_event && this_event->action_frame == _transport_frame) {
+ while (this_event && this_event->action_sample == _transport_sample) {
process_event (this_event);
if (the_next_one == events.end()) {
this_event = 0;
@@ -350,7 +350,7 @@ Session::process_with_events (pframes_t nframes)
_send_timecode_update = true;
}
- if (Config->get_send_mtc() && !_send_qf_mtc && _pframes_since_last_mtc > (frame_rate () / 4)) {
+ if (Config->get_send_mtc() && !_send_qf_mtc && _pframes_since_last_mtc > (sample_rate () / 4)) {
/* we're sending MTC, but we're not sending QF MTC at the moment, and it's been
a quarter of a second since we sent anything at all, so send a full MTC update
this cycle.
@@ -368,7 +368,7 @@ Session::process_with_events (pframes_t nframes)
* and prepare for rolling)
*/
if (_send_timecode_update) {
- send_full_time_code (_transport_frame, nframes);
+ send_full_time_code (_transport_sample, nframes);
}
if (!process_can_proceed()) {
@@ -389,14 +389,14 @@ Session::process_with_events (pframes_t nframes)
}
if (_transport_speed == 1.0) {
- frames_moved = (framecnt_t) nframes;
+ samples_moved = (samplecnt_t) nframes;
} else {
interpolation.set_target_speed (_target_transport_speed);
interpolation.set_speed (_transport_speed);
- frames_moved = (framecnt_t) interpolation.interpolate (0, nframes, 0, 0);
+ samples_moved = (samplecnt_t) interpolation.interpolate (0, nframes, 0, 0);
}
- end_frame = _transport_frame + frames_moved;
+ end_sample = _transport_sample + samples_moved;
{
SessionEvent* this_event;
@@ -421,12 +421,12 @@ Session::process_with_events (pframes_t nframes)
}
if (!_exporting && !timecode_transmission_suspended()) {
- send_midi_time_code_for_cycle (_transport_frame, end_frame, nframes);
+ send_midi_time_code_for_cycle (_transport_sample, end_sample, nframes);
}
- ltc_tx_send_time_code_for_cycle (_transport_frame, end_frame, _target_transport_speed, _transport_speed, nframes);
+ ltc_tx_send_time_code_for_cycle (_transport_sample, end_sample, _target_transport_speed, _transport_speed, nframes);
- framepos_t stop_limit = compute_stop_limit ();
+ samplepos_t stop_limit = compute_stop_limit ();
if (maybe_stop (stop_limit)) {
cerr << "P-w-E: mebbe stop\n";
@@ -445,20 +445,20 @@ Session::process_with_events (pframes_t nframes)
while (nframes) {
this_nframes = nframes; /* real (jack) time relative */
- frames_moved = (framecnt_t) floor (_transport_speed * nframes); /* transport relative */
+ samples_moved = (samplecnt_t) floor (_transport_speed * nframes); /* transport relative */
/* running an event, position transport precisely to its time */
- if (this_event && this_event->action_frame <= end_frame && this_event->action_frame >= _transport_frame) {
+ if (this_event && this_event->action_sample <= end_sample && this_event->action_sample >= _transport_sample) {
/* this isn't quite right for reverse play */
- frames_moved = (framecnt_t) (this_event->action_frame - _transport_frame);
- this_nframes = abs (floor(frames_moved / _transport_speed));
+ samples_moved = (samplecnt_t) (this_event->action_sample - _transport_sample);
+ this_nframes = abs (floor(samples_moved / _transport_speed));
}
try_run_lua (this_nframes);
if (this_nframes) {
- click (_transport_frame, this_nframes);
+ click (_transport_sample, this_nframes);
if (process_routes (this_nframes, session_needs_butler)) {
cerr << "P-w-E: PR fail\n";
@@ -470,13 +470,13 @@ Session::process_with_events (pframes_t nframes)
nframes -= this_nframes;
- if (frames_moved < 0) {
- decrement_transport_position (-frames_moved);
- } else if (frames_moved) {
- increment_transport_position (frames_moved);
+ if (samples_moved < 0) {
+ decrement_transport_position (-samples_moved);
+ } else if (samples_moved) {
+ increment_transport_position (samples_moved);
}
- cerr << "P-w-E: ts now = " << _transport_frame << endl;
+ cerr << "P-w-E: ts now = " << _transport_sample << endl;
maybe_stop (stop_limit);
check_declick_out ();
@@ -488,7 +488,7 @@ Session::process_with_events (pframes_t nframes)
/* now handle this event and all others scheduled for the same time */
- while (this_event && this_event->action_frame == _transport_frame) {
+ while (this_event && this_event->action_sample == _transport_sample) {
process_event (this_event);
if (the_next_one == events.end()) {
@@ -508,14 +508,14 @@ Session::process_with_events (pframes_t nframes)
}
/* this is necessary to handle the case of seamless looping */
- end_frame = _transport_frame + floor (nframes * _transport_speed);
+ end_sample = _transport_sample + floor (nframes * _transport_speed);
}
set_next_event ();
} /* implicit release of route lock */
- cerr << "P-w-E: final ts = " << _transport_frame << endl;
+ cerr << "P-w-E: final ts = " << _transport_sample << endl;
if (session_needs_butler) {
DEBUG_TRACE (DEBUG::Butler, "p-with-events: session needs butler, call it\n");
@@ -549,8 +549,8 @@ bool
Session::follow_slave (pframes_t nframes)
{
double slave_speed;
- framepos_t slave_transport_frame;
- framecnt_t this_delta;
+ samplepos_t slave_transport_sample;
+ samplecnt_t this_delta;
int dir;
if (!_slave->ok()) {
@@ -559,20 +559,20 @@ Session::follow_slave (pframes_t nframes)
goto noroll;
}
- _slave->speed_and_position (slave_speed, slave_transport_frame);
+ _slave->speed_and_position (slave_speed, slave_transport_sample);
- DEBUG_TRACE (DEBUG::Slave, string_compose ("Slave position %1 speed %2\n", slave_transport_frame, slave_speed));
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("Slave position %1 speed %2\n", slave_transport_sample, slave_speed));
if (!_slave->locked()) {
DEBUG_TRACE (DEBUG::Slave, "slave not locked\n");
goto noroll;
}
- if (slave_transport_frame > _transport_frame) {
- this_delta = slave_transport_frame - _transport_frame;
+ if (slave_transport_sample > _transport_sample) {
+ this_delta = slave_transport_sample - _transport_sample;
dir = 1;
} else {
- this_delta = _transport_frame - slave_transport_frame;
+ this_delta = _transport_sample - slave_transport_sample;
dir = -1;
}
@@ -604,10 +604,10 @@ Session::follow_slave (pframes_t nframes)
}
}
- track_slave_state (slave_speed, slave_transport_frame, this_delta);
+ track_slave_state (slave_speed, slave_transport_sample, this_delta);
DEBUG_TRACE (DEBUG::Slave, string_compose ("slave state %1 @ %2 speed %3 cur delta %4 avg delta %5\n",
- _slave_state, slave_transport_frame, slave_speed, this_delta, average_slave_delta));
+ _slave_state, slave_transport_sample, slave_speed, this_delta, average_slave_delta));
if (_slave_state == Running && !_slave->is_always_synced() && !(Config->get_timecode_source_is_synced() && (dynamic_cast<TimecodeSlave*>(_slave)) != 0)) {
@@ -636,8 +636,8 @@ Session::follow_slave (pframes_t nframes)
(int) (dir * this_delta),
slave_speed,
_transport_speed,
- _transport_frame,
- slave_transport_frame,
+ _transport_sample,
+ slave_transport_sample,
average_slave_delta));
}
#endif
@@ -646,14 +646,14 @@ Session::follow_slave (pframes_t nframes)
set_transport_speed (slave_speed, 0, false, false);
//std::cout << "set speed = " << slave_speed << "\n";
} else {
- float adjusted_speed = slave_speed + (1.5 * (delta / float(_current_frame_rate)));
+ float adjusted_speed = slave_speed + (1.5 * (delta / float(_current_sample_rate)));
request_transport_speed (adjusted_speed);
DEBUG_TRACE (DEBUG::Slave, string_compose ("adjust using %1 towards %2 ratio %3 current %4 slave @ %5\n",
delta, adjusted_speed, adjusted_speed/slave_speed, _transport_speed,
slave_speed));
}
- if (!actively_recording() && (framecnt_t) average_slave_delta > _slave->resolution()) {
+ if (!actively_recording() && (samplecnt_t) average_slave_delta > _slave->resolution()) {
DEBUG_TRACE (DEBUG::Slave, string_compose ("average slave delta %1 greater than slave resolution %2 => no disk output\n", average_slave_delta, _slave->resolution()));
/* run routes as normal, but no disk output */
DiskReader::set_no_disk_output (true);
@@ -690,15 +690,15 @@ Session::follow_slave (pframes_t nframes)
}
void
-Session::calculate_moving_average_of_slave_delta (int dir, framecnt_t this_delta)
+Session::calculate_moving_average_of_slave_delta (int dir, samplecnt_t this_delta)
{
if (delta_accumulator_cnt >= delta_accumulator_size) {
have_first_delta_accumulator = true;
delta_accumulator_cnt = 0;
}
- if (delta_accumulator_cnt != 0 || this_delta < _current_frame_rate) {
- delta_accumulator[delta_accumulator_cnt++] = (framecnt_t) dir * (framecnt_t) this_delta;
+ if (delta_accumulator_cnt != 0 || this_delta < _current_sample_rate) {
+ delta_accumulator[delta_accumulator_cnt++] = (samplecnt_t) dir * (samplecnt_t) this_delta;
}
if (have_first_delta_accumulator) {
@@ -717,7 +717,7 @@ Session::calculate_moving_average_of_slave_delta (int dir, framecnt_t this_delta
}
void
-Session::track_slave_state (float slave_speed, framepos_t slave_transport_frame, framecnt_t /*this_delta*/)
+Session::track_slave_state (float slave_speed, samplepos_t slave_transport_sample, samplecnt_t /*this_delta*/)
{
if (slave_speed != 0.0f) {
@@ -726,7 +726,7 @@ Session::track_slave_state (float slave_speed, framepos_t slave_transport_frame,
switch (_slave_state) {
case Stopped:
if (_slave->requires_seekahead()) {
- slave_wait_end = slave_transport_frame + _slave->seekahead_distance ();
+ slave_wait_end = slave_transport_sample + _slave->seekahead_distance ();
DEBUG_TRACE (DEBUG::Slave, string_compose ("slave stopped, but running, requires seekahead to %1\n", slave_wait_end));
/* we can call locate() here because we are in process context */
locate (slave_wait_end, false, false);
@@ -734,21 +734,21 @@ Session::track_slave_state (float slave_speed, framepos_t slave_transport_frame,
} else {
- DEBUG_TRACE (DEBUG::Slave, string_compose ("slave stopped -> running at %1\n", slave_transport_frame));
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("slave stopped -> running at %1\n", slave_transport_sample));
memset (delta_accumulator, 0, sizeof (int32_t) * delta_accumulator_size);
average_slave_delta = 0L;
Location* al = _locations->auto_loop_location();
- if (al && play_loop && (slave_transport_frame < al->start() || slave_transport_frame > al->end())) {
+ if (al && play_loop && (slave_transport_sample < al->start() || slave_transport_sample > al->end())) {
// cancel looping
request_play_loop(false);
}
- if (slave_transport_frame != _transport_frame) {
- DEBUG_TRACE (DEBUG::Slave, string_compose ("require locate to run. eng: %1 -> sl: %2\n", _transport_frame, slave_transport_frame));
- locate (slave_transport_frame, false, false);
+ if (slave_transport_sample != _transport_sample) {
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("require locate to run. eng: %1 -> sl: %2\n", _transport_sample, slave_transport_sample));
+ locate (slave_transport_sample, false, false);
}
_slave_state = Running;
}
@@ -761,11 +761,11 @@ Session::track_slave_state (float slave_speed, framepos_t slave_transport_frame,
if (_slave_state == Waiting) {
- DEBUG_TRACE (DEBUG::Slave, string_compose ("slave waiting at %1\n", slave_transport_frame));
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("slave waiting at %1\n", slave_transport_sample));
- if (slave_transport_frame >= slave_wait_end) {
+ if (slave_transport_sample >= slave_wait_end) {
- DEBUG_TRACE (DEBUG::Slave, string_compose ("slave start at %1 vs %2\n", slave_transport_frame, _transport_frame));
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("slave start at %1 vs %2\n", slave_transport_sample, _transport_sample));
_slave_state = Running;
@@ -775,12 +775,12 @@ Session::track_slave_state (float slave_speed, framepos_t slave_transport_frame,
bool ok = true;
- framecnt_t frame_delta = slave_transport_frame - _transport_frame;
+ samplecnt_t sample_delta = slave_transport_sample - _transport_sample;
boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
- if (tr && !tr->can_internal_playback_seek (frame_delta)) {
+ if (tr && !tr->can_internal_playback_seek (sample_delta)) {
ok = false;
break;
}
@@ -790,10 +790,10 @@ Session::track_slave_state (float slave_speed, framepos_t slave_transport_frame,
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
- tr->internal_playback_seek (frame_delta);
+ tr->internal_playback_seek (sample_delta);
}
}
- _transport_frame += frame_delta;
+ _transport_sample += sample_delta;
} else {
cerr << "cannot micro-seek\n";
@@ -812,13 +812,13 @@ Session::track_slave_state (float slave_speed, framepos_t slave_transport_frame,
/* slave has stopped */
if (_transport_speed != 0.0f) {
- DEBUG_TRACE (DEBUG::Slave, string_compose ("slave stops transport: %1 frame %2 tf %3\n", slave_speed, slave_transport_frame, _transport_frame));
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("slave stops transport: %1 sample %2 tf %3\n", slave_speed, slave_transport_sample, _transport_sample));
stop_transport ();
}
- if (slave_transport_frame != _transport_frame) {
- DEBUG_TRACE (DEBUG::Slave, string_compose ("slave stopped, move to %1\n", slave_transport_frame));
- force_locate (slave_transport_frame, false);
+ if (slave_transport_sample != _transport_sample) {
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("slave stopped, move to %1\n", slave_transport_sample));
+ force_locate (slave_transport_sample, false);
}
reset_slave_state();
@@ -829,7 +829,7 @@ void
Session::process_without_events (pframes_t nframes)
{
bool session_needs_butler = false;
- framecnt_t frames_moved;
+ samplecnt_t samples_moved;
if (!process_can_proceed()) {
_silent = true;
@@ -838,7 +838,7 @@ Session::process_without_events (pframes_t nframes)
if (!_exporting && _slave) {
if (!follow_slave (nframes)) {
- ltc_tx_send_time_code_for_cycle (_transport_frame, _transport_frame, 0, 0 , nframes);
+ ltc_tx_send_time_code_for_cycle (_transport_sample, _transport_sample, 0, 0 , nframes);
return;
}
}
@@ -849,20 +849,20 @@ Session::process_without_events (pframes_t nframes)
}
if (_transport_speed == 1.0) {
- frames_moved = (framecnt_t) nframes;
+ samples_moved = (samplecnt_t) nframes;
} else {
interpolation.set_target_speed (_target_transport_speed);
interpolation.set_speed (_transport_speed);
- frames_moved = (framecnt_t) interpolation.interpolate (0, nframes, 0, 0);
+ samples_moved = (samplecnt_t) interpolation.interpolate (0, nframes, 0, 0);
}
if (!_exporting && !timecode_transmission_suspended()) {
- send_midi_time_code_for_cycle (_transport_frame, _transport_frame + frames_moved, nframes);
+ send_midi_time_code_for_cycle (_transport_sample, _transport_sample + samples_moved, nframes);
}
- ltc_tx_send_time_code_for_cycle (_transport_frame, _transport_frame + frames_moved, _target_transport_speed, _transport_speed, nframes);
+ ltc_tx_send_time_code_for_cycle (_transport_sample, _transport_sample + samples_moved, _target_transport_speed, _transport_speed, nframes);
- framepos_t const stop_limit = compute_stop_limit ();
+ samplepos_t const stop_limit = compute_stop_limit ();
if (maybe_stop (stop_limit)) {
no_roll (nframes);
@@ -873,7 +873,7 @@ Session::process_without_events (pframes_t nframes)
return;
}
- click (_transport_frame, nframes);
+ click (_transport_sample, nframes);
if (process_routes (nframes, session_needs_butler)) {
fail_roll (nframes);
@@ -882,10 +882,10 @@ Session::process_without_events (pframes_t nframes)
get_track_statistics ();
- if (frames_moved < 0) {
- decrement_transport_position (-frames_moved);
- } else if (frames_moved) {
- increment_transport_position (frames_moved);
+ if (samples_moved < 0) {
+ decrement_transport_position (-samples_moved);
+ } else if (samples_moved) {
+ increment_transport_position (samples_moved);
}
maybe_stop (stop_limit);
@@ -898,7 +898,7 @@ Session::process_without_events (pframes_t nframes)
}
/** Process callback used when the auditioner is active.
- * @param nframes number of frames to process.
+ * @param nframes number of samples to process.
*/
void
Session::process_audition (pframes_t nframes)
@@ -922,7 +922,7 @@ Session::process_audition (pframes_t nframes)
/* if using a monitor section, run it because otherwise we don't hear anything */
if (_monitor_out && auditioner->needs_monitor()) {
- _monitor_out->monitor_run (_transport_frame, _transport_frame + nframes, nframes, false);
+ _monitor_out->monitor_run (_transport_sample, _transport_sample + nframes, nframes, false);
}
/* handle pending events */
@@ -1019,12 +1019,12 @@ Session::set_next_event ()
next_event = events.begin();
}
- if ((*next_event)->action_frame > _transport_frame) {
+ if ((*next_event)->action_sample > _transport_sample) {
next_event = events.begin();
}
for (; next_event != events.end(); ++next_event) {
- if ((*next_event)->action_frame >= _transport_frame) {
+ if ((*next_event)->action_sample >= _transport_sample) {
break;
}
}
@@ -1053,7 +1053,7 @@ Session::process_event (SessionEvent* ev)
}
}
- DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("Processing event: %1 @ %2\n", enum_2_string (ev->type), _transport_frame));
+ DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("Processing event: %1 @ %2\n", enum_2_string (ev->type), _transport_sample));
switch (ev->type) {
case SessionEvent::SetLoop:
@@ -1065,7 +1065,7 @@ Session::process_event (SessionEvent* ev)
/* roll after locate, do not flush, set "with loop"
true only if we are seamless looping
*/
- start_locate (ev->target_frame, true, false, Config->get_seamless_loop());
+ start_locate (ev->target_sample, true, false, Config->get_seamless_loop());
}
remove = false;
del = false;
@@ -1085,10 +1085,10 @@ Session::process_event (SessionEvent* ev)
case SessionEvent::Locate:
if (ev->yes_or_no) { /* force locate */
/* args: do not roll after locate, do flush, not with loop */
- locate (ev->target_frame, false, true, false);
+ locate (ev->target_sample, false, true, false);
} else {
/* args: do not roll after locate, do flush, not with loop */
- start_locate (ev->target_frame, false, true, false);
+ start_locate (ev->target_sample, false, true, false);
}
_send_timecode_update = true;
break;
@@ -1096,17 +1096,17 @@ Session::process_event (SessionEvent* ev)
case SessionEvent::LocateRoll:
if (ev->yes_or_no) {
/* args: roll after locate, do flush, not with loop */
- locate (ev->target_frame, true, true, false);
+ locate (ev->target_sample, true, true, false);
} else {
/* args: roll after locate, do flush, not with loop */
- start_locate (ev->target_frame, true, true, false);
+ start_locate (ev->target_sample, true, true, false);
}
_send_timecode_update = true;
break;
case SessionEvent::Skip:
if (Config->get_skip_playback()) {
- start_locate (ev->target_frame, true, true, false);
+ start_locate (ev->target_sample, true, true, false);
_send_timecode_update = true;
}
remove = false;
@@ -1115,17 +1115,17 @@ Session::process_event (SessionEvent* ev)
case SessionEvent::LocateRollLocate:
// locate is handled by ::request_roll_at_and_return()
- _requested_return_frame = ev->target_frame;
- request_locate (ev->target2_frame, true);
+ _requested_return_sample = ev->target_sample;
+ request_locate (ev->target2_sample, true);
break;
case SessionEvent::SetTransportSpeed:
- set_transport_speed (ev->speed, ev->target_frame, ev->yes_or_no, ev->second_yes_or_no, ev->third_yes_or_no);
+ set_transport_speed (ev->speed, ev->target_sample, ev->yes_or_no, ev->second_yes_or_no, ev->third_yes_or_no);
break;
case SessionEvent::PunchIn:
- // cerr << "PunchIN at " << transport_frame() << endl;
+ // cerr << "PunchIN at " << transport_sample() << endl;
if (config.get_punch_in() && record_status() == Enabled && !preroll_record_punch_enabled()) {
enable_record ();
}
@@ -1134,7 +1134,7 @@ Session::process_event (SessionEvent* ev)
break;
case SessionEvent::PunchOut:
- // cerr << "PunchOUT at " << transport_frame() << endl;
+ // cerr << "PunchOUT at " << transport_sample() << endl;
if (config.get_punch_out() && !preroll_record_punch_enabled()) {
step_back_from_record ();
}
@@ -1169,7 +1169,7 @@ Session::process_event (SessionEvent* ev)
case SessionEvent::RangeLocate:
/* args: roll after locate, do flush, not with loop */
- start_locate (ev->target_frame, true, true, false);
+ start_locate (ev->target_sample, true, true, false);
remove = false;
del = false;
break;
@@ -1229,19 +1229,19 @@ Session::process_event (SessionEvent* ev)
}
}
-framepos_t
+samplepos_t
Session::compute_stop_limit () const
{
if (!Config->get_stop_at_session_end ()) {
- return max_framepos;
+ return max_samplepos;
}
if (_slave) {
- return max_framepos;
+ return max_samplepos;
}
if (preroll_record_punch_enabled ()) {
- return max_framepos;
+ return max_samplepos;
}
bool const punching_in = (config.get_punch_in () && _locations->auto_punch_location());
@@ -1249,16 +1249,16 @@ Session::compute_stop_limit () const
if (actively_recording ()) {
/* permanently recording */
- return max_framepos;
+ return max_samplepos;
} else if (punching_in && !punching_out) {
/* punching in but never out */
- return max_framepos;
- } else if (punching_in && punching_out && _locations->auto_punch_location()->end() > current_end_frame()) {
+ return max_samplepos;
+ } else if (punching_in && punching_out && _locations->auto_punch_location()->end() > current_end_sample()) {
/* punching in and punching out after session end */
- return max_framepos;
+ return max_samplepos;
}
- return current_end_frame ();
+ return current_end_sample ();
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index bc91049589..e822c7bc14 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -225,7 +225,7 @@ Session::post_engine_init ()
BootMessage (_("Set block size and sample rate"));
set_block_size (_engine.samples_per_cycle());
- set_frame_rate (_engine.sample_rate());
+ set_sample_rate (_engine.sample_rate());
BootMessage (_("Using configuration"));
@@ -237,7 +237,7 @@ Session::post_engine_init ()
msc->set_input_port (boost::dynamic_pointer_cast<MidiPort>(scene_input_port()));
msc->set_output_port (boost::dynamic_pointer_cast<MidiPort>(scene_output_port()));
- boost::function<framecnt_t(void)> timer_func (boost::bind (&Session::audible_frame, this, (bool*)(0)));
+ boost::function<samplecnt_t(void)> timer_func (boost::bind (&Session::audible_sample, this, (bool*)(0)));
boost::dynamic_pointer_cast<AsyncMIDIPort>(scene_input_port())->set_timer (timer_func);
setup_midi_machine_control ();
@@ -262,7 +262,7 @@ Session::post_engine_init ()
/* tempo map requires sample rate knowledge */
delete _tempo_map;
- _tempo_map = new TempoMap (_current_frame_rate);
+ _tempo_map = new TempoMap (_current_sample_rate);
_tempo_map->PropertyChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
_tempo_map->MetricPositionChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
} catch (std::exception const & e) {
@@ -282,7 +282,7 @@ Session::post_engine_init ()
/* crossfades require sample rate knowledge */
- SndFileSource::setup_standard_crossfades (*this, frame_rate());
+ SndFileSource::setup_standard_crossfades (*this, sample_rate());
_engine.GraphReordered.connect_same_thread (*this, boost::bind (&Session::graph_reordered, this));
_engine.MidiSelectionPortsChanged.connect_same_thread (*this, boost::bind (&Session::rewire_midi_selection_ports, this));
@@ -409,7 +409,7 @@ Session::post_engine_init ()
for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<Track> (*r);
if (trk && !trk->is_private_route()) {
- trk->seek (_transport_frame, true);
+ trk->seek (_transport_sample, true);
}
}
@@ -436,7 +436,7 @@ Session::session_loaded ()
/* Now, finally, we can fill the playback buffers */
BootMessage (_("Filling playback buffers"));
- force_locate (_transport_frame, false);
+ force_locate (_transport_sample, false);
}
string
@@ -1133,7 +1133,7 @@ Session::state (bool full_state, snapshot_t snapshot_type)
if (full_state) {
node->set_property ("name", _name);
- node->set_property ("sample-rate", _base_frame_rate);
+ node->set_property ("sample-rate", _base_sample_rate);
if (session_dirs.size() > 1) {
@@ -1334,7 +1334,7 @@ Session::state (bool full_state, snapshot_t snapshot_type)
// for a template, just create a new Locations, populate it
// with the default start and end, and get the state for that.
Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange, 0);
- range->set (max_framepos, 0);
+ range->set (max_samplepos, 0);
loc.add (range);
XMLNode& locations_state = loc.get_state();
@@ -1468,13 +1468,13 @@ Session::set_state (const XMLNode& node, int version)
node.get_property ("name", _name);
- if (node.get_property (X_("sample-rate"), _base_frame_rate)) {
+ if (node.get_property (X_("sample-rate"), _base_sample_rate)) {
- _nominal_frame_rate = _base_frame_rate;
+ _nominal_sample_rate = _base_sample_rate;
assert (AudioEngine::instance()->running ());
- if (_base_frame_rate != AudioEngine::instance()->sample_rate ()) {
- boost::optional<int> r = AskAboutSampleRateMismatch (_base_frame_rate, _current_frame_rate);
+ if (_base_sample_rate != AudioEngine::instance()->sample_rate ()) {
+ boost::optional<int> r = AskAboutSampleRateMismatch (_base_sample_rate, _current_sample_rate);
if (r.get_value_or (0)) {
goto out;
}
@@ -2346,7 +2346,7 @@ retry:
switch (err.type) {
case DataType::AUDIO:
- source = SourceFactory::createSilent (*this, **niter, max_framecnt, _current_frame_rate);
+ source = SourceFactory::createSilent (*this, **niter, max_samplecnt, _current_sample_rate);
break;
case DataType::MIDI:
@@ -2365,7 +2365,7 @@ retry:
return -1;
}
/* Note that we do not announce the source just yet - we need to reset its ID before we do that */
- source = SourceFactory::createWritable (DataType::MIDI, *this, fullpath, false, _current_frame_rate, false, false);
+ source = SourceFactory::createWritable (DataType::MIDI, *this, fullpath, false, _current_sample_rate, false, false);
/* reset ID to match the missing one */
source->set_id (**niter);
/* Now we can announce it */
@@ -4203,7 +4203,7 @@ Session::config_changed (std::string p, bool ours)
} else if (p == "timecode-offset" || p == "timecode-offset-negative") {
last_timecode_valid = false;
} else if (p == "playback-buffer-seconds") {
- AudioSource::allocate_working_buffers (frame_rate());
+ AudioSource::allocate_working_buffers (sample_rate());
} else if (p == "ltc-source-port") {
reconnect_ltc_input ();
} else if (p == "ltc-sink-port") {
diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc
index 64641e302b..e9c6d23a97 100644
--- a/libs/ardour/session_time.cc
+++ b/libs/ardour/session_time.cc
@@ -44,9 +44,9 @@ using namespace PBD;
/* BBT TIME*/
void
-Session::bbt_time (framepos_t when, Timecode::BBT_Time& bbt)
+Session::bbt_time (samplepos_t when, Timecode::BBT_Time& bbt)
{
- bbt = _tempo_map->bbt_at_frame (when);
+ bbt = _tempo_map->bbt_at_sample (when);
}
/* Timecode TIME */
@@ -66,8 +66,8 @@ Session::timecode_drop_frames() const
void
Session::sync_time_vars ()
{
- _current_frame_rate = (framecnt_t) round (_nominal_frame_rate * (1.0 + (config.get_video_pullup()/100.0)));
- _samples_per_timecode_frame = (double) _current_frame_rate / (double) timecode_frames_per_second();
+ _current_sample_rate = (samplecnt_t) round (_nominal_sample_rate * (1.0 + (config.get_video_pullup()/100.0)));
+ _samples_per_timecode_frame = (double) _current_sample_rate / (double) timecode_frames_per_second();
if (timecode_drop_frames()) {
_frames_per_hour = (int32_t)(107892 * _samples_per_timecode_frame);
} else {
@@ -99,13 +99,13 @@ Session::sync_time_vars ()
}
void
-Session::timecode_to_sample( Timecode::Time& timecode, framepos_t& sample, bool use_offset, bool use_subframes ) const
+Session::timecode_to_sample( Timecode::Time& timecode, samplepos_t& sample, bool use_offset, bool use_subframes ) const
{
timecode.rate = timecode_frames_per_second();
Timecode::timecode_to_sample(
timecode, sample, use_offset, use_subframes,
- _current_frame_rate,
+ _current_sample_rate,
config.get_subframes_per_frame(),
config.get_timecode_offset_negative(), config.get_timecode_offset()
);
@@ -113,14 +113,14 @@ Session::timecode_to_sample( Timecode::Time& timecode, framepos_t& sample, bool
}
void
-Session::sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes ) const
+Session::sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes ) const
{
Timecode::sample_to_timecode (
sample, timecode, use_offset, use_subframes,
timecode_frames_per_second(),
timecode_drop_frames(),
- double(_current_frame_rate),
+ double(_current_sample_rate),
config.get_subframes_per_frame(),
config.get_timecode_offset_negative(), config.get_timecode_offset()
@@ -128,7 +128,7 @@ Session::sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool u
}
void
-Session::timecode_time (framepos_t when, Timecode::Time& timecode)
+Session::timecode_time (samplepos_t when, Timecode::Time& timecode)
{
if (last_timecode_valid && when == last_timecode_when) {
timecode = last_timecode;
@@ -143,7 +143,7 @@ Session::timecode_time (framepos_t when, Timecode::Time& timecode)
}
void
-Session::timecode_time_subframes (framepos_t when, Timecode::Time& timecode)
+Session::timecode_time_subframes (samplepos_t when, Timecode::Time& timecode)
{
if (last_timecode_valid && when == last_timecode_when) {
timecode = last_timecode;
@@ -158,13 +158,13 @@ Session::timecode_time_subframes (framepos_t when, Timecode::Time& timecode)
}
void
-Session::timecode_duration (framecnt_t when, Timecode::Time& timecode) const
+Session::timecode_duration (samplecnt_t when, Timecode::Time& timecode) const
{
this->sample_to_timecode( when, timecode, false /* use_offset */, true /* use_subframes */ );
}
void
-Session::timecode_duration_string (char* buf, size_t len, framepos_t when) const
+Session::timecode_duration_string (char* buf, size_t len, samplepos_t when) const
{
Timecode::Time timecode;
@@ -176,14 +176,14 @@ void
Session::timecode_time (Timecode::Time &t)
{
- timecode_time (_transport_frame, t);
+ timecode_time (_transport_sample, t);
}
int
-Session::backend_sync_callback (TransportState state, framepos_t pos)
+Session::backend_sync_callback (TransportState state, samplepos_t pos)
{
bool slave = synced_to_engine();
- // cerr << "Session::backend_sync_callback() _transport_frame: " << _transport_frame << " pos: " << pos << " audible_frame: " << audible_frame() << endl;
+ // cerr << "Session::backend_sync_callback() _transport_sample: " << _transport_sample << " pos: " << pos << " audible_sample: " << audible_sample() << endl;
if (slave) {
// cerr << "Session::backend_sync_callback() emitting Located()" << endl;
@@ -192,9 +192,9 @@ Session::backend_sync_callback (TransportState state, framepos_t pos)
switch (state) {
case TransportStopped:
- if (slave && _transport_frame != pos && post_transport_work() == 0) {
+ if (slave && _transport_sample != pos && post_transport_work() == 0) {
request_locate (pos, false);
- // cerr << "SYNC: stopped, locate to " << pos << " from " << _transport_frame << endl;
+ // cerr << "SYNC: stopped, locate to " << pos << " from " << _transport_sample << endl;
return false;
} else {
// cerr << "SYNC: stopped, nothing to do" << endl;
@@ -202,9 +202,9 @@ Session::backend_sync_callback (TransportState state, framepos_t pos)
}
case TransportStarting:
- // cerr << "SYNC: starting @ " << pos << " a@ " << _transport_frame << " our work = " << post_transport_work() << " pos matches ? " << (_transport_frame == pos) << endl;
+ // cerr << "SYNC: starting @ " << pos << " a@ " << _transport_sample << " our work = " << post_transport_work() << " pos matches ? " << (_transport_sample == pos) << endl;
if (slave) {
- return _transport_frame == pos && post_transport_work() == 0;
+ return _transport_sample == pos && post_transport_work() == 0;
} else {
return true;
}
@@ -226,14 +226,14 @@ Session::backend_sync_callback (TransportState state, framepos_t pos)
}
-ARDOUR::framecnt_t
-Session::convert_to_frames (AnyTime const & position)
+ARDOUR::samplecnt_t
+Session::convert_to_samples (AnyTime const & position)
{
double secs;
switch (position.type) {
case AnyTime::BBT:
- return _tempo_map->frame_at_bbt (position.bbt);
+ return _tempo_map->sample_at_bbt (position.bbt);
break;
case AnyTime::Timecode:
@@ -243,32 +243,32 @@ Session::convert_to_frames (AnyTime const & position)
secs += position.timecode.seconds;
secs += position.timecode.frames / timecode_frames_per_second();
if (config.get_timecode_offset_negative()) {
- return (framecnt_t) floor (secs * frame_rate()) - config.get_timecode_offset();
+ return (samplecnt_t) floor (secs * sample_rate()) - config.get_timecode_offset();
} else {
- return (framecnt_t) floor (secs * frame_rate()) + config.get_timecode_offset();
+ return (samplecnt_t) floor (secs * sample_rate()) + config.get_timecode_offset();
}
break;
case AnyTime::Seconds:
- return (framecnt_t) floor (position.seconds * frame_rate());
+ return (samplecnt_t) floor (position.seconds * sample_rate());
break;
- case AnyTime::Frames:
- return position.frames;
+ case AnyTime::Samples:
+ return position.samples;
break;
}
- return position.frames;
+ return position.samples;
}
-ARDOUR::framecnt_t
-Session::any_duration_to_frames (framepos_t position, AnyTime const & duration)
+ARDOUR::samplecnt_t
+Session::any_duration_to_samples (samplepos_t position, AnyTime const & duration)
{
double secs;
switch (duration.type) {
case AnyTime::BBT:
- return (framecnt_t) ( _tempo_map->framepos_plus_bbt (position, duration.bbt) - position);
+ return (samplecnt_t) ( _tempo_map->samplepos_plus_bbt (position, duration.bbt) - position);
break;
case AnyTime::Timecode:
@@ -278,20 +278,20 @@ Session::any_duration_to_frames (framepos_t position, AnyTime const & duration)
secs += duration.timecode.seconds;
secs += duration.timecode.frames / timecode_frames_per_second();
if (config.get_timecode_offset_negative()) {
- return (framecnt_t) floor (secs * frame_rate()) - config.get_timecode_offset();
+ return (samplecnt_t) floor (secs * sample_rate()) - config.get_timecode_offset();
} else {
- return (framecnt_t) floor (secs * frame_rate()) + config.get_timecode_offset();
+ return (samplecnt_t) floor (secs * sample_rate()) + config.get_timecode_offset();
}
break;
case AnyTime::Seconds:
- return (framecnt_t) floor (duration.seconds * frame_rate());
+ return (samplecnt_t) floor (duration.seconds * sample_rate());
break;
- case AnyTime::Frames:
- return duration.frames;
+ case AnyTime::Samples:
+ return duration.samples;
break;
}
- return duration.frames;
+ return duration.samples;
}
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index dee6e97c17..95a6683a05 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -127,24 +127,24 @@ Session::request_transport_speed_nonzero (double speed, bool as_default)
void
Session::request_stop (bool abort, bool clear_state)
{
- SessionEvent* ev = new SessionEvent (SessionEvent::SetTransportSpeed, SessionEvent::Add, SessionEvent::Immediate, audible_frame(), 0.0, abort, clear_state);
- DEBUG_TRACE (DEBUG::Transport, string_compose ("Request transport stop, audible %3 transport %4 abort = %1, clear state = %2\n", abort, clear_state, audible_frame(), _transport_frame));
+ SessionEvent* ev = new SessionEvent (SessionEvent::SetTransportSpeed, SessionEvent::Add, SessionEvent::Immediate, audible_sample(), 0.0, abort, clear_state);
+ DEBUG_TRACE (DEBUG::Transport, string_compose ("Request transport stop, audible %3 transport %4 abort = %1, clear state = %2\n", abort, clear_state, audible_sample(), _transport_sample));
queue_event (ev);
}
void
-Session::request_locate (framepos_t target_frame, bool with_roll)
+Session::request_locate (samplepos_t target_sample, bool with_roll)
{
- SessionEvent *ev = new SessionEvent (with_roll ? SessionEvent::LocateRoll : SessionEvent::Locate, SessionEvent::Add, SessionEvent::Immediate, target_frame, 0, false);
- DEBUG_TRACE (DEBUG::Transport, string_compose ("Request locate to %1\n", target_frame));
+ SessionEvent *ev = new SessionEvent (with_roll ? SessionEvent::LocateRoll : SessionEvent::Locate, SessionEvent::Add, SessionEvent::Immediate, target_sample, 0, false);
+ DEBUG_TRACE (DEBUG::Transport, string_compose ("Request locate to %1\n", target_sample));
queue_event (ev);
}
void
-Session::force_locate (framepos_t target_frame, bool with_roll)
+Session::force_locate (samplepos_t target_sample, bool with_roll)
{
- SessionEvent *ev = new SessionEvent (with_roll ? SessionEvent::LocateRoll : SessionEvent::Locate, SessionEvent::Add, SessionEvent::Immediate, target_frame, 0, true);
- DEBUG_TRACE (DEBUG::Transport, string_compose ("Request forced locate to %1\n", target_frame));
+ SessionEvent *ev = new SessionEvent (with_roll ? SessionEvent::LocateRoll : SessionEvent::Locate, SessionEvent::Add, SessionEvent::Immediate, target_sample, 0, true);
+ DEBUG_TRACE (DEBUG::Transport, string_compose ("Request forced locate to %1\n", target_sample));
queue_event (ev);
}
@@ -164,14 +164,14 @@ Session::unset_preroll_record_trim ()
}
void
-Session::request_preroll_record_punch (framepos_t rec_in, framecnt_t preroll)
+Session::request_preroll_record_punch (samplepos_t rec_in, samplecnt_t preroll)
{
if (actively_recording ()) {
return;
}
unset_preroll_record_punch ();
unset_preroll_record_trim ();
- framepos_t start = std::max ((framepos_t)0, rec_in - preroll);
+ samplepos_t start = std::max ((samplepos_t)0, rec_in - preroll);
_preroll_record_punch_pos = rec_in;
if (_preroll_record_punch_pos >= 0) {
@@ -181,11 +181,11 @@ Session::request_preroll_record_punch (framepos_t rec_in, framecnt_t preroll)
}
maybe_enable_record ();
request_locate (start, true);
- set_requested_return_frame (rec_in);
+ set_requested_return_sample (rec_in);
}
void
-Session::request_preroll_record_trim (framepos_t rec_in, framecnt_t preroll)
+Session::request_preroll_record_trim (samplepos_t rec_in, samplecnt_t preroll)
{
if (actively_recording ()) {
return;
@@ -196,11 +196,11 @@ Session::request_preroll_record_trim (framepos_t rec_in, framecnt_t preroll)
config.set_punch_in (false);
config.set_punch_out (false);
- framepos_t pos = std::max ((framepos_t)0, rec_in - preroll);
+ samplepos_t pos = std::max ((samplepos_t)0, rec_in - preroll);
_preroll_record_trim_len = preroll;
maybe_enable_record ();
request_locate (pos, true);
- set_requested_return_frame (rec_in);
+ set_requested_return_sample (rec_in);
}
void
@@ -272,7 +272,7 @@ Session::request_play_loop (bool yn, bool change_transport_roll)
if (!change_transport_roll && Config->get_seamless_loop() && transport_rolling()) {
// request an immediate locate to refresh the tracks
// after disabling looping
- request_locate (_transport_frame-1, false);
+ request_locate (_transport_sample-1, false);
}
}
}
@@ -301,7 +301,7 @@ Session::request_cancel_play_range ()
void
Session::realtime_stop (bool abort, bool clear_state)
{
- DEBUG_TRACE (DEBUG::Transport, string_compose ("realtime stop @ %1\n", _transport_frame));
+ DEBUG_TRACE (DEBUG::Transport, string_compose ("realtime stop @ %1\n", _transport_sample));
PostTransportWork todo = PostTransportWork (0);
/* assume that when we start, we'll be moving forwards */
@@ -321,7 +321,7 @@ Session::realtime_stop (bool abort, bool clear_state)
(*i)->realtime_handle_transport_stopped ();
}
- DEBUG_TRACE (DEBUG::Transport, string_compose ("stop complete, auto-return scheduled for return to %1\n", _requested_return_frame));
+ DEBUG_TRACE (DEBUG::Transport, string_compose ("stop complete, auto-return scheduled for return to %1\n", _requested_return_sample));
/* the duration change is not guaranteed to have happened, but is likely */
@@ -436,11 +436,11 @@ Session::butler_transport_work ()
tr->adjust_playback_buffering ();
/* and refill those buffers ... */
}
- (*i)->non_realtime_locate (_transport_frame);
+ (*i)->non_realtime_locate (_transport_sample);
}
VCAList v = _vca_manager->vcas ();
for (VCAList::const_iterator i = v.begin(); i != v.end(); ++i) {
- (*i)->non_realtime_locate (_transport_frame);
+ (*i)->non_realtime_locate (_transport_sample);
}
}
@@ -473,7 +473,7 @@ Session::butler_transport_work ()
if (!(ptw & PostTransportLocate)) {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- (*i)->non_realtime_locate (_transport_frame);
+ (*i)->non_realtime_locate (_transport_sample);
if (on_entry != g_atomic_int_get (&_butler->should_do_transport_work)) {
/* new request, stop seeking, and start again */
@@ -483,7 +483,7 @@ Session::butler_transport_work ()
}
VCAList v = _vca_manager->vcas ();
for (VCAList::const_iterator i = v.begin(); i != v.end(); ++i) {
- (*i)->non_realtime_locate (_transport_frame);
+ (*i)->non_realtime_locate (_transport_sample);
}
}
}
@@ -515,7 +515,7 @@ Session::butler_transport_work ()
g_atomic_int_dec_and_test (&_butler->should_do_transport_work);
- DEBUG_TRACE (DEBUG::Transport, string_compose (X_("Butler transport work all done after %1 usecs @ %2 trw = %3\n"), g_get_monotonic_time() - before, _transport_frame, _butler->transport_work_requested()));
+ DEBUG_TRACE (DEBUG::Transport, string_compose (X_("Butler transport work all done after %1 usecs @ %2 trw = %3\n"), g_get_monotonic_time() - before, _transport_sample, _butler->transport_work_requested()));
}
void
@@ -550,21 +550,21 @@ Session::non_realtime_overwrite (int on_entry, bool& finished)
void
Session::non_realtime_locate ()
{
- DEBUG_TRACE (DEBUG::Transport, string_compose ("locate tracks to %1\n", _transport_frame));
+ DEBUG_TRACE (DEBUG::Transport, string_compose ("locate tracks to %1\n", _transport_sample));
if (Config->get_loop_is_mode() && get_play_loop()) {
Location *loc = _locations->auto_loop_location();
- if (!loc || (_transport_frame < loc->start() || _transport_frame >= loc->end())) {
+ if (!loc || (_transport_sample < loc->start() || _transport_sample >= loc->end())) {
/* jumped out of loop range: stop tracks from looping,
but leave loop (mode) enabled.
*/
set_track_loop (false);
} else if (loc && Config->get_seamless_loop() &&
- ((loc->start() <= _transport_frame) ||
- (loc->end() > _transport_frame) ) ) {
+ ((loc->start() <= _transport_sample) ||
+ (loc->end() > _transport_sample) ) ) {
/* jumping to start of loop. This might have been done before but it is
* idempotent and cheap. Doing it here ensures that when we start playback
@@ -583,14 +583,14 @@ Session::non_realtime_locate ()
}
- framepos_t tf;
+ samplepos_t tf;
{
boost::shared_ptr<RouteList> rl = routes.reader();
restart:
gint sc = g_atomic_int_get (&_seek_counter);
- tf = _transport_frame;
+ tf = _transport_sample;
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
(*i)->non_realtime_locate (tf);
@@ -603,7 +603,7 @@ Session::non_realtime_locate ()
{
/* VCAs are quick to locate because they have no data (except
automation) associated with them. Don't bother with a
- restart mechanism here, but do use the same transport frame
+ restart mechanism here, but do use the same transport sample
that the Routes used.
*/
VCAList v = _vca_manager->vcas ();
@@ -612,7 +612,7 @@ Session::non_realtime_locate ()
}
}
- _scene_changer->locate (_transport_frame);
+ _scene_changer->locate (_transport_sample);
/* XXX: it would be nice to generate the new clicks here (in the non-RT thread)
rather than clearing them so that the RT thread has to spend time constructing
@@ -623,7 +623,7 @@ Session::non_realtime_locate ()
#ifdef USE_TRACKS_CODE_FEATURES
bool
-Session::select_playhead_priority_target (framepos_t& jump_to)
+Session::select_playhead_priority_target (samplepos_t& jump_to)
{
jump_to = -1;
@@ -699,7 +699,7 @@ Session::select_playhead_priority_target (framepos_t& jump_to)
#else
bool
-Session::select_playhead_priority_target (framepos_t& jump_to)
+Session::select_playhead_priority_target (samplepos_t& jump_to)
{
if (config.get_external_sync() || !config.get_auto_return()) {
return false;
@@ -714,7 +714,7 @@ Session::select_playhead_priority_target (framepos_t& jump_to)
void
Session::follow_playhead_priority ()
{
- framepos_t target;
+ samplepos_t target;
if (select_playhead_priority_target (target)) {
request_locate (target);
@@ -736,7 +736,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
- if (tr && tr->get_captured_frames () != 0) {
+ if (tr && tr->get_captured_samples () != 0) {
did_record = true;
break;
}
@@ -799,11 +799,11 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
PostTransportWork ptw = post_transport_work ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- (*i)->non_realtime_transport_stop (_transport_frame, !(ptw & PostTransportLocate) || pending_locate_flush);
+ (*i)->non_realtime_transport_stop (_transport_sample, !(ptw & PostTransportLocate) || pending_locate_flush);
}
VCAList v = _vca_manager->vcas ();
for (VCAList::const_iterator i = v.begin(); i != v.end(); ++i) {
- (*i)->non_realtime_transport_stop (_transport_frame, !(ptw & PostTransportLocate) || pending_locate_flush);
+ (*i)->non_realtime_transport_stop (_transport_sample, !(ptw & PostTransportLocate) || pending_locate_flush);
}
update_latency_compensation ();
@@ -813,7 +813,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
if (auto_return_enabled ||
(ptw & PostTransportLocate) ||
- (_requested_return_frame >= 0) ||
+ (_requested_return_sample >= 0) ||
synced_to_engine()) {
if (pending_locate_flush) {
@@ -821,42 +821,42 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
}
// rg: what is the logic behind this case?
- // _requested_return_frame should be ignored when synced_to_engine/slaved.
- // currently worked around in MTC_Slave by forcing _requested_return_frame to -1
+ // _requested_return_sample should be ignored when synced_to_engine/slaved.
+ // currently worked around in MTC_Slave by forcing _requested_return_sample to -1
// 2016-01-10
- if ((auto_return_enabled || synced_to_engine() || _requested_return_frame >= 0) &&
+ if ((auto_return_enabled || synced_to_engine() || _requested_return_sample >= 0) &&
!(ptw & PostTransportLocate)) {
/* no explicit locate queued */
bool do_locate = false;
- if (_requested_return_frame >= 0) {
+ if (_requested_return_sample >= 0) {
/* explicit return request pre-queued in event list. overrides everything else */
- _transport_frame = _requested_return_frame;
+ _transport_sample = _requested_return_sample;
do_locate = true;
} else {
- framepos_t jump_to;
+ samplepos_t jump_to;
if (select_playhead_priority_target (jump_to)) {
- _transport_frame = jump_to;
+ _transport_sample = jump_to;
do_locate = true;
} else if (abort) {
- _transport_frame = _last_roll_location;
+ _transport_sample = _last_roll_location;
do_locate = true;
}
}
- _requested_return_frame = -1;
+ _requested_return_sample = -1;
if (do_locate) {
- _engine.transport_locate (_transport_frame);
+ _engine.transport_locate (_transport_sample);
}
}
@@ -881,7 +881,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: locate\n"));
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler PTW: locate on %1\n", (*i)->name()));
- (*i)->non_realtime_locate (_transport_frame);
+ (*i)->non_realtime_locate (_transport_sample);
if (on_entry != g_atomic_int_get (&_butler->should_do_transport_work)) {
finished = false;
@@ -894,7 +894,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
{
VCAList v = _vca_manager->vcas ();
for (VCAList::const_iterator i = v.begin(); i != v.end(); ++i) {
- (*i)->non_realtime_locate (_transport_frame);
+ (*i)->non_realtime_locate (_transport_sample);
}
}
@@ -917,7 +917,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
Something must be done. XXX
*/
- send_mmc_locate (_transport_frame);
+ send_mmc_locate (_transport_sample);
}
}
@@ -953,10 +953,10 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
}
}
- PositionChanged (_transport_frame); /* EMIT SIGNAL */
+ PositionChanged (_transport_sample); /* EMIT SIGNAL */
DEBUG_TRACE (DEBUG::Transport, string_compose ("send TSC with speed = %1\n", _transport_speed));
TransportStateChange (); /* EMIT SIGNAL */
- AutomationWatch::instance().transport_stop_automation_watches (_transport_frame);
+ AutomationWatch::instance().transport_stop_automation_watches (_transport_sample);
/* and start it up again if relevant */
@@ -985,7 +985,7 @@ Session::check_declick_out ()
if (transport_sub_state & PendingDeclickOut) {
if (locate_required) {
- start_locate (pending_locate_frame, pending_locate_roll, pending_locate_flush);
+ start_locate (pending_locate_sample, pending_locate_roll, pending_locate_flush);
transport_sub_state &= ~(PendingDeclickOut|PendingLocate);
} else {
if (!(transport_sub_state & StopPendingCapture)) {
@@ -1085,8 +1085,8 @@ Session::set_play_loop (bool yn, double speed)
in a fade-in when the loop restarts. The AutoLoop event will peform the actual loop.
*/
- framepos_t dcp;
- framecnt_t dcl;
+ samplepos_t dcp;
+ samplecnt_t dcl;
auto_loop_declick_range (loc, dcp, dcl);
merge_event (new SessionEvent (SessionEvent::AutoLoopDeclick, SessionEvent::Replace, dcp, dcl, 0.0f));
merge_event (new SessionEvent (SessionEvent::AutoLoop, SessionEvent::Replace, loc->end(), loc->start(), 0.0f));
@@ -1130,9 +1130,9 @@ Session::flush_all_inserts ()
}
void
-Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush, bool for_loop_enabled, bool force)
+Session::start_locate (samplepos_t target_sample, bool with_roll, bool with_flush, bool for_loop_enabled, bool force)
{
- if (target_frame < 0) {
+ if (target_sample < 0) {
error << _("Locate called for negative sample position - ignored") << endmsg;
return;
}
@@ -1140,25 +1140,25 @@ Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush,
if (synced_to_engine()) {
double sp;
- framepos_t pos;
+ samplepos_t pos;
_slave->speed_and_position (sp, pos);
- if (target_frame != pos) {
+ if (target_sample != pos) {
if (config.get_jack_time_master()) {
/* actually locate now, since otherwise jack_timebase_callback
- will use the incorrect _transport_frame and report an old
+ will use the incorrect _transport_sample and report an old
and incorrect time to Jack transport
*/
- locate (target_frame, with_roll, with_flush, for_loop_enabled, force);
+ locate (target_sample, with_roll, with_flush, for_loop_enabled, force);
}
/* tell JACK to change transport position, and we will
follow along later in ::follow_slave()
*/
- _engine.transport_locate (target_frame);
+ _engine.transport_locate (target_sample);
if (sp != 1.0f && with_roll) {
_engine.transport_start ();
@@ -1167,12 +1167,12 @@ Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush,
}
} else {
- locate (target_frame, with_roll, with_flush, for_loop_enabled, force);
+ locate (target_sample, with_roll, with_flush, for_loop_enabled, force);
}
}
int
-Session::micro_locate (framecnt_t distance)
+Session::micro_locate (samplecnt_t distance)
{
boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
@@ -1189,13 +1189,13 @@ Session::micro_locate (framecnt_t distance)
}
}
- _transport_frame += distance;
+ _transport_sample += distance;
return 0;
}
/** @param with_mmc true to send a MMC locate command when the locate is done */
void
-Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool for_loop_enabled, bool force, bool with_mmc)
+Session::locate (samplepos_t target_sample, bool with_roll, bool with_flush, bool for_loop_enabled, bool force, bool with_mmc)
{
bool need_butler = false;
@@ -1204,13 +1204,13 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
* already have the correct data in them, and thus there is no need to
* actually tell the tracks to locate. What does need to be done,
* though, is all the housekeeping that is associated with non-linear
- * changes in the value of _transport_frame.
+ * changes in the value of _transport_sample.
*/
DEBUG_TRACE (DEBUG::Transport, string_compose ("rt-locate to %1, roll %2 flush %3 loop-enabled %4 force %5 mmc %6\n",
- target_frame, with_roll, with_flush, for_loop_enabled, force, with_mmc));
+ target_sample, with_roll, with_flush, for_loop_enabled, force, with_mmc));
- if (!force && _transport_frame == target_frame && !loop_changing && !for_loop_enabled) {
+ if (!force && _transport_sample == target_sample && !loop_changing && !for_loop_enabled) {
/* already at the desired position. Not forced to locate,
the loop isn't changing, so unless we're told to
@@ -1234,7 +1234,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
if (!(transport_sub_state & PendingDeclickOut)) {
transport_sub_state |= (PendingDeclickOut|PendingLocate);
- pending_locate_frame = target_frame;
+ pending_locate_sample = target_sample;
pending_locate_roll = with_roll;
pending_locate_flush = with_flush;
cerr << "Declick scheduled ... back soon\n";
@@ -1245,12 +1245,12 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
cerr << "... now doing the actual locate\n";
// Update Timecode time
- _transport_frame = target_frame;
+ _transport_sample = target_sample;
// Bump seek counter so that any in-process locate in the butler
// thread(s?) can restart.
g_atomic_int_inc (&_seek_counter);
- _last_roll_or_reversal_location = target_frame;
- timecode_time(_transport_frame, transmitting_timecode_time);
+ _last_roll_or_reversal_location = target_sample;
+ timecode_time(_transport_sample, transmitting_timecode_time);
/* do "stopped" stuff if:
*
@@ -1317,7 +1317,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
Location* al = _locations->auto_loop_location();
if (al) {
- if (_transport_frame < al->start() || _transport_frame >= al->end()) {
+ if (_transport_sample < al->start() || _transport_sample >= al->end()) {
// located outside the loop: cancel looping directly, this is called from event handling context
@@ -1335,7 +1335,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
}
}
- } else if (_transport_frame == al->start()) {
+ } else if (_transport_sample == al->start()) {
// located to start of loop - this is looping, basically
@@ -1359,7 +1359,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
if (tr && tr->rec_enable_control()->get_value()) {
// tell it we've looped, so it can deal with the record state
- tr->transport_looped (_transport_frame);
+ tr->transport_looped (_transport_sample);
}
}
@@ -1378,11 +1378,11 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
_send_timecode_update = true;
if (with_mmc) {
- send_mmc_locate (_transport_frame);
+ send_mmc_locate (_transport_sample);
}
- _last_roll_location = _last_roll_or_reversal_location = _transport_frame;
- if (!synced_to_engine () || _transport_frame == _engine.transport_frame ()) {
+ _last_roll_location = _last_roll_or_reversal_location = _transport_sample;
+ if (!synced_to_engine () || _transport_sample == _engine.transport_sample ()) {
Located (); /* EMIT SIGNAL */
}
}
@@ -1392,10 +1392,10 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
* @param speed New speed
*/
void
-Session::set_transport_speed (double speed, framepos_t destination_frame, bool abort, bool clear_state, bool as_default)
+Session::set_transport_speed (double speed, samplepos_t destination_sample, bool abort, bool clear_state, bool as_default)
{
DEBUG_TRACE (DEBUG::Transport, string_compose ("@ %5 Set transport speed to %1, abort = %2 clear_state = %3, current = %4 as_default %6\n",
- speed, abort, clear_state, _transport_speed, _transport_frame, as_default));
+ speed, abort, clear_state, _transport_speed, _transport_sample, as_default));
if (_transport_speed == speed) {
if (as_default && speed == 0.0) { // => reset default transport speed. hacky or what?
@@ -1406,8 +1406,8 @@ Session::set_transport_speed (double speed, framepos_t destination_frame, bool a
if (actively_recording() && speed != 1.0 && speed != 0.0) {
/* no varispeed during recording */
- DEBUG_TRACE (DEBUG::Transport, string_compose ("No varispeed during recording cur_speed %1, frame %2\n",
- _transport_speed, _transport_frame));
+ DEBUG_TRACE (DEBUG::Transport, string_compose ("No varispeed during recording cur_speed %1, sample %2\n",
+ _transport_speed, _transport_sample));
return;
}
@@ -1445,7 +1445,7 @@ Session::set_transport_speed (double speed, framepos_t destination_frame, bool a
bool const auto_return_enabled = (!config.get_external_sync() && (Config->get_auto_return_target_list() || abort));
if (!auto_return_enabled) {
- _requested_return_frame = destination_frame;
+ _requested_return_sample = destination_sample;
}
stop_transport (abort);
@@ -1462,7 +1462,7 @@ Session::set_transport_speed (double speed, framepos_t destination_frame, bool a
Location *location = _locations->auto_loop_location();
if (location != 0) {
- if (_transport_frame != location->start()) {
+ if (_transport_sample != location->start()) {
if (Config->get_seamless_loop()) {
/* force tracks to do their thing */
@@ -1504,11 +1504,11 @@ Session::set_transport_speed (double speed, framepos_t destination_frame, bool a
return;
}
- if (speed > 0.0 && _transport_frame == current_end_frame()) {
+ if (speed > 0.0 && _transport_sample == current_end_sample()) {
return;
}
- if (speed < 0.0 && _transport_frame == 0) {
+ if (speed < 0.0 && _transport_sample == 0) {
return;
}
@@ -1522,7 +1522,7 @@ Session::set_transport_speed (double speed, framepos_t destination_frame, bool a
if ((_transport_speed && speed * _transport_speed < 0.0) || (_last_transport_speed * speed < 0.0) || (_last_transport_speed == 0.0 && speed < 0.0)) {
todo = PostTransportWork (todo | PostTransportReverse);
- _last_roll_or_reversal_location = _transport_frame;
+ _last_roll_or_reversal_location = _transport_sample;
}
_last_transport_speed = _transport_speed;
@@ -1588,12 +1588,12 @@ Session::stop_transport (bool abort, bool clear_state)
/* stop has not yet been scheduled */
boost::shared_ptr<RouteList> rl = routes.reader();
- framepos_t stop_target = audible_frame();
+ samplepos_t stop_target = audible_sample();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
- tr->prepare_to_stop (_transport_frame, stop_target);
+ tr->prepare_to_stop (_transport_sample, stop_target);
}
}
@@ -1613,12 +1613,12 @@ Session::stop_transport (bool abort, bool clear_state)
*/
DEBUG_TRACE (DEBUG::Transport, string_compose ("stop transport requested @ %1, scheduled for + %2 = %3, abort = %4\n",
- _transport_frame, _worst_input_latency,
- _transport_frame + _worst_input_latency,
+ _transport_sample, _worst_input_latency,
+ _transport_sample + _worst_input_latency,
abort));
SessionEvent *ev = new SessionEvent (SessionEvent::StopOnce, SessionEvent::Replace,
- _transport_frame + _worst_input_latency,
+ _transport_sample + _worst_input_latency,
0, 0, abort);
merge_event (ev);
@@ -1635,7 +1635,7 @@ Session::stop_transport (bool abort, bool clear_state)
/* Not recording, schedule a declick in the next process() cycle and then stop at its end */
new_bits = PendingDeclickOut;
- DEBUG_TRACE (DEBUG::Transport, string_compose ("stop scheduled for next process cycle @ %1\n", _transport_frame));
+ DEBUG_TRACE (DEBUG::Transport, string_compose ("stop scheduled for next process cycle @ %1\n", _transport_sample));
}
/* we'll be called again after the declick */
@@ -1664,8 +1664,8 @@ Session::start_transport ()
{
DEBUG_TRACE (DEBUG::Transport, "start_transport\n");
- _last_roll_location = _transport_frame;
- _last_roll_or_reversal_location = _transport_frame;
+ _last_roll_location = _transport_sample;
+ _last_roll_or_reversal_location = _transport_sample;
have_looped = false;
@@ -1705,7 +1705,7 @@ Session::start_transport ()
if (!_engine.freewheeling()) {
Timecode::Time time;
- timecode_time_subframes (_transport_frame, time);
+ timecode_time_subframes (_transport_sample, time);
if (!dynamic_cast<MTC_Slave*>(_slave)) {
send_immediate_mmc (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
}
@@ -1713,18 +1713,18 @@ Session::start_transport ()
if (actively_recording() && click_data && (config.get_count_in () || _count_in_once)) {
_count_in_once = false;
/* calculate count-in duration (in audio samples)
- * - use [fixed] tempo/meter at _transport_frame
- * - calc duration of 1 bar + time-to-beat before or at transport_frame
+ * - use [fixed] tempo/meter at _transport_sample
+ * - calc duration of 1 bar + time-to-beat before or at transport_sample
*/
- const Tempo& tempo = _tempo_map->tempo_at_frame (_transport_frame);
- const Meter& meter = _tempo_map->meter_at_frame (_transport_frame);
+ const Tempo& tempo = _tempo_map->tempo_at_sample (_transport_sample);
+ const Meter& meter = _tempo_map->meter_at_sample (_transport_sample);
const double num = meter.divisions_per_bar ();
const double den = meter.note_divisor ();
- const double barbeat = _tempo_map->exact_qn_at_frame (_transport_frame, 0) * den / (4. * num);
+ const double barbeat = _tempo_map->exact_qn_at_sample (_transport_sample, 0) * den / (4. * num);
const double bar_fract = fmod (barbeat, 1.0); // fraction of bar elapsed.
- _count_in_samples = meter.frames_per_bar (tempo, _current_frame_rate);
+ _count_in_samples = meter.samples_per_bar (tempo, _current_sample_rate);
double dt = _count_in_samples / num;
if (bar_fract == 0) {
@@ -1736,8 +1736,8 @@ Session::start_transport ()
}
int clickbeat = 0;
- framepos_t cf = _transport_frame - _count_in_samples;
- while (cf < _transport_frame) {
+ samplepos_t cf = _transport_sample - _count_in_samples;
+ while (cf < _transport_sample) {
add_click (cf - _worst_track_latency, clickbeat == 0);
cf += dt;
clickbeat = fmod (clickbeat + 1, num);
@@ -1788,15 +1788,15 @@ Session::post_transport ()
}
void
-Session::reset_rf_scale (framecnt_t motion)
+Session::reset_rf_scale (samplecnt_t motion)
{
cumulative_rf_motion += motion;
- if (cumulative_rf_motion < 4 * _current_frame_rate) {
+ if (cumulative_rf_motion < 4 * _current_sample_rate) {
rf_scale = 1;
- } else if (cumulative_rf_motion < 8 * _current_frame_rate) {
+ } else if (cumulative_rf_motion < 8 * _current_sample_rate) {
rf_scale = 4;
- } else if (cumulative_rf_motion < 16 * _current_frame_rate) {
+ } else if (cumulative_rf_motion < 16 * _current_sample_rate) {
rf_scale = 10;
} else {
rf_scale = 100;
@@ -2012,18 +2012,18 @@ Session::set_play_range (list<AudioRange>& range, bool leave_rolling)
/* locating/stopping is subject to delays for declicking.
*/
- framepos_t requested_frame = i->end;
+ samplepos_t requested_sample = i->end;
- if (requested_frame > current_block_size) {
- requested_frame -= current_block_size;
+ if (requested_sample > current_block_size) {
+ requested_sample -= current_block_size;
} else {
- requested_frame = 0;
+ requested_sample = 0;
}
if (next == range.end()) {
- ev = new SessionEvent (SessionEvent::RangeStop, SessionEvent::Add, requested_frame, 0, 0.0f);
+ ev = new SessionEvent (SessionEvent::RangeStop, SessionEvent::Add, requested_sample, 0, 0.0f);
} else {
- ev = new SessionEvent (SessionEvent::RangeLocate, SessionEvent::Add, requested_frame, (*next).start, 0.0f);
+ ev = new SessionEvent (SessionEvent::RangeLocate, SessionEvent::Add, requested_sample, (*next).start, 0.0f);
}
merge_event (ev);
@@ -2052,7 +2052,7 @@ Session::set_play_range (list<AudioRange>& range, bool leave_rolling)
}
void
-Session::request_bounded_roll (framepos_t start, framepos_t end)
+Session::request_bounded_roll (samplepos_t start, samplepos_t end)
{
AudioRange ar (start, end, 0);
list<AudioRange> lar;
@@ -2062,16 +2062,16 @@ Session::request_bounded_roll (framepos_t start, framepos_t end)
}
void
-Session::set_requested_return_frame (framepos_t return_to)
+Session::set_requested_return_sample (samplepos_t return_to)
{
- _requested_return_frame = return_to;
+ _requested_return_sample = return_to;
}
void
-Session::request_roll_at_and_return (framepos_t start, framepos_t return_to)
+Session::request_roll_at_and_return (samplepos_t start, samplepos_t return_to)
{
SessionEvent *ev = new SessionEvent (SessionEvent::LocateRollLocate, SessionEvent::Add, SessionEvent::Immediate, return_to, 1.0);
- ev->target2_frame = start;
+ ev->target2_sample = start;
queue_event (ev);
}
@@ -2105,7 +2105,7 @@ Session::xrun_recovery ()
{
++_xrun_count;
- Xrun (_transport_frame); /* EMIT SIGNAL */
+ Xrun (_transport_sample); /* EMIT SIGNAL */
if (Config->get_stop_recording_on_xrun() && actively_recording()) {
@@ -2147,9 +2147,9 @@ Session::allow_auto_play (bool yn)
}
bool
-Session::maybe_stop (framepos_t limit)
+Session::maybe_stop (samplepos_t limit)
{
- if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) {
+ if ((_transport_speed > 0.0f && _transport_sample >= limit) || (_transport_speed < 0.0f && _transport_sample == 0)) {
if (synced_to_engine () && config.get_jack_time_master ()) {
_engine.transport_stop ();
} else if (!synced_to_engine ()) {
@@ -2161,7 +2161,7 @@ Session::maybe_stop (framepos_t limit)
}
void
-Session::send_mmc_locate (framepos_t t)
+Session::send_mmc_locate (samplepos_t t)
{
if (t < 0) {
return;
diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc
index 3950a29478..1b25659cc9 100644
--- a/libs/ardour/session_vst.cc
+++ b/libs/ardour/session_vst.cc
@@ -172,18 +172,18 @@ intptr_t Session::vst_callback (
timeinfo->nanoSeconds = g_get_monotonic_time () * 1000;
if (plug && session) {
- framepos_t now = plug->transport_frame();
+ samplepos_t now = plug->transport_sample();
timeinfo->samplePos = now;
- timeinfo->sampleRate = session->frame_rate();
+ timeinfo->sampleRate = session->sample_rate();
if (value & (kVstTempoValid)) {
- const Tempo& t (session->tempo_map().tempo_at_frame (now));
+ const Tempo& t (session->tempo_map().tempo_at_sample (now));
timeinfo->tempo = t.quarter_notes_per_minute ();
newflags |= (kVstTempoValid);
}
if (value & (kVstTimeSigValid)) {
- const MeterSection& ms (session->tempo_map().meter_section_at_frame (now));
+ const MeterSection& ms (session->tempo_map().meter_section_at_sample (now));
timeinfo->timeSigNumerator = ms.divisions_per_bar ();
timeinfo->timeSigDenominator = ms.note_divisor ();
newflags |= (kVstTimeSigValid);
@@ -192,13 +192,13 @@ intptr_t Session::vst_callback (
Timecode::BBT_Time bbt;
try {
- bbt = session->tempo_map().bbt_at_frame_rt (now);
+ bbt = session->tempo_map().bbt_at_sample_rt (now);
bbt.beats = 1;
bbt.ticks = 0;
/* exact quarter note */
double ppqBar = session->tempo_map().quarter_note_at_bbt_rt (bbt);
- /* quarter note at frame position (not rounded to note subdivision) */
- double ppqPos = session->tempo_map().quarter_note_at_frame_rt (now);
+ /* quarter note at sample position (not rounded to note subdivision) */
+ double ppqPos = session->tempo_map().quarter_note_at_sample_rt (now);
if (value & (kVstPpqPosValid)) {
timeinfo->ppqPos = ppqPos;
newflags |= kVstPpqPosValid;
@@ -225,7 +225,7 @@ intptr_t Session::vst_callback (
(t.frames) +
(t.subframes);
- timeinfo->smpteOffset *= 80.0; /* VST spec is 1/80th frames */
+ timeinfo->smpteOffset *= 80.0; /* VST spec is 1/80th samples */
if (session->timecode_drop_frames()) {
if (session->timecode_frames_per_second() == 30.0) {
@@ -259,8 +259,8 @@ intptr_t Session::vst_callback (
newflags |= kVstTransportCycleActive;
Location * looploc = session->locations ()->auto_loop_location ();
if (looploc) try {
- timeinfo->cycleStartPos = session->tempo_map ().quarter_note_at_frame_rt (looploc->start ());
- timeinfo->cycleEndPos = session->tempo_map ().quarter_note_at_frame_rt (looploc->end ());
+ timeinfo->cycleStartPos = session->tempo_map ().quarter_note_at_sample_rt (looploc->start ());
+ timeinfo->cycleEndPos = session->tempo_map ().quarter_note_at_sample_rt (looploc->end ());
newflags |= kVstCyclePosValid;
} catch (...) { }
@@ -289,7 +289,7 @@ intptr_t Session::vst_callback (
for (int n = 0 ; n < v->numEvents; ++n) {
VstMidiEvent *vme = (VstMidiEvent*) (v->events[n]->dump);
if (vme->type == kVstMidiType) {
- plug->midi_buffer()->push_back(vme->deltaFrames, 3, (uint8_t*)vme->midiData);
+ plug->midi_buffer()->push_back(vme->deltaSamples, 3, (uint8_t*)vme->midiData);
}
}
}
@@ -301,9 +301,9 @@ intptr_t Session::vst_callback (
case audioMasterTempoAt:
SHOW_CALLBACK ("audioMasterTempoAt");
- // returns tempo (in bpm * 10000) at sample frame location passed in <value>
+ // returns tempo (in bpm * 10000) at sample sample location passed in <value>
if (session) {
- const Tempo& t (session->tempo_map().tempo_at_frame (value));
+ const Tempo& t (session->tempo_map().tempo_at_sample (value));
return t.quarter_notes_per_minute() * 1000;
} else {
return 0;
@@ -351,7 +351,7 @@ intptr_t Session::vst_callback (
case audioMasterGetSampleRate:
SHOW_CALLBACK ("audioMasterGetSampleRate");
if (session) {
- return session->frame_rate();
+ return session->sample_rate();
}
return 0;
diff --git a/libs/ardour/sidechain.cc b/libs/ardour/sidechain.cc
index eb4f4e1c8b..9ee902e5d6 100644
--- a/libs/ardour/sidechain.cc
+++ b/libs/ardour/sidechain.cc
@@ -61,7 +61,7 @@ SideChain::set_state (const XMLNode& node, int version)
}
void
-SideChain::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double /*speed*/, pframes_t nframes, bool)
+SideChain::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double /*speed*/, pframes_t nframes, bool)
{
if (_input->n_ports () == ChanCount::ZERO) {
// inplace pass-through
diff --git a/libs/ardour/slavable_automation_control.cc b/libs/ardour/slavable_automation_control.cc
index 491914747c..7d4d822529 100644
--- a/libs/ardour/slavable_automation_control.cc
+++ b/libs/ardour/slavable_automation_control.cc
@@ -83,7 +83,7 @@ SlavableAutomationControl::get_value_locked() const
/* read or write masters lock must be held */
if (_masters.empty()) {
- return Control::get_double (false, _session.transport_frame());
+ return Control::get_double (false, _session.transport_sample());
}
if (_desc.toggled) {
@@ -91,7 +91,7 @@ SlavableAutomationControl::get_value_locked() const
* enabled, this slave is enabled. So check our own value
* first, because if we are enabled, we can return immediately.
*/
- if (Control::get_double (false, _session.transport_frame())) {
+ if (Control::get_double (false, _session.transport_sample())) {
return _desc.upper;
}
}
@@ -113,12 +113,12 @@ SlavableAutomationControl::get_value() const
}
return get_value_locked ();
} else {
- return Control::get_double (true, _session.transport_frame()) * get_masters_value_locked();
+ return Control::get_double (true, _session.transport_sample()) * get_masters_value_locked();
}
}
bool
-SlavableAutomationControl::get_masters_curve_locked (framepos_t, framepos_t, float*, framecnt_t) const
+SlavableAutomationControl::get_masters_curve_locked (samplepos_t, samplepos_t, float*, samplecnt_t) const
{
/* Every AutomationControl needs to implement this as-needed.
*
@@ -130,13 +130,13 @@ SlavableAutomationControl::get_masters_curve_locked (framepos_t, framepos_t, flo
}
bool
-SlavableAutomationControl::masters_curve_multiply (framepos_t start, framepos_t end, float* vec, framecnt_t veclen) const
+SlavableAutomationControl::masters_curve_multiply (samplepos_t start, samplepos_t end, float* vec, samplecnt_t veclen) const
{
gain_t* scratch = _session.scratch_automation_buffer ();
bool from_list = _list && boost::dynamic_pointer_cast<AutomationList>(_list)->automation_playback();
bool rv = from_list && list()->curve().rt_safe_get_vector (start, end, scratch, veclen);
if (rv) {
- for (framecnt_t i = 0; i < veclen; ++i) {
+ for (samplecnt_t i = 0; i < veclen; ++i) {
vec[i] *= scratch[i];
}
} else {
@@ -526,7 +526,7 @@ SlavableAutomationControl::handle_master_change (boost::shared_ptr<AutomationCon
}
void
-SlavableAutomationControl::automation_run (framepos_t start, pframes_t nframes)
+SlavableAutomationControl::automation_run (samplepos_t start, pframes_t nframes)
{
if (!automation_playback ()) {
return;
@@ -548,7 +548,7 @@ SlavableAutomationControl::automation_run (framepos_t start, pframes_t nframes)
}
bool
-SlavableAutomationControl::boolean_automation_run_locked (framepos_t start, pframes_t len)
+SlavableAutomationControl::boolean_automation_run_locked (samplepos_t start, pframes_t len)
{
bool rv = false;
if (!_desc.toggled) {
@@ -583,7 +583,7 @@ SlavableAutomationControl::boolean_automation_run_locked (framepos_t start, pfra
}
bool
-SlavableAutomationControl::boolean_automation_run (framepos_t start, pframes_t len)
+SlavableAutomationControl::boolean_automation_run (samplepos_t start, pframes_t len)
{
bool change = false;
{
diff --git a/libs/ardour/slave.cc b/libs/ardour/slave.cc
index 4fbb75f623..47dd80f8b4 100644
--- a/libs/ardour/slave.cc
+++ b/libs/ardour/slave.cc
@@ -29,53 +29,53 @@ SlaveSessionProxy::tempo_map() const
return session.tempo_map();
}
-framecnt_t
-SlaveSessionProxy::frame_rate() const
+samplecnt_t
+SlaveSessionProxy::sample_rate() const
{
- return session.frame_rate();
+ return session.sample_rate();
}
pframes_t
-SlaveSessionProxy::frames_per_cycle() const
+SlaveSessionProxy::samples_per_cycle() const
{
return session.engine().samples_per_cycle();
}
-framepos_t
-SlaveSessionProxy::audible_frame() const
+samplepos_t
+SlaveSessionProxy::audible_sample() const
{
- return session.audible_frame();
+ return session.audible_sample();
}
-framepos_t
-SlaveSessionProxy::transport_frame() const
+samplepos_t
+SlaveSessionProxy::transport_sample() const
{
- return session.transport_frame();
+ return session.transport_sample();
}
pframes_t
-SlaveSessionProxy::frames_since_cycle_start() const
+SlaveSessionProxy::samples_since_cycle_start() const
{
return session.engine().samples_since_cycle_start();
}
-framepos_t
+samplepos_t
SlaveSessionProxy::sample_time_at_cycle_start() const
{
return session.engine().sample_time_at_cycle_start();
}
-framepos_t
-SlaveSessionProxy::frame_time() const
+samplepos_t
+SlaveSessionProxy::sample_time() const
{
return session.engine().sample_time();
}
void
-SlaveSessionProxy::request_locate(framepos_t frame, bool with_roll)
+SlaveSessionProxy::request_locate(samplepos_t sample, bool with_roll)
{
- session.request_locate(frame, with_roll);
+ session.request_locate(sample, with_roll);
}
void
diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc
index 76d379e947..d622c33978 100644
--- a/libs/ardour/smf_source.cc
+++ b/libs/ardour/smf_source.cc
@@ -62,7 +62,7 @@ SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags)
, Evoral::SMF()
, _open (false)
, _last_ev_time_beats(0.0)
- , _last_ev_time_frames(0)
+ , _last_ev_time_samples(0)
, _smf_last_read_end (0)
, _smf_last_read_time (0)
{
@@ -98,7 +98,7 @@ SMFSource::SMFSource (Session& s, const string& path)
, Evoral::SMF()
, _open (false)
, _last_ev_time_beats(0.0)
- , _last_ev_time_frames(0)
+ , _last_ev_time_samples(0)
, _smf_last_read_end (0)
, _smf_last_read_time (0)
{
@@ -130,7 +130,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist)
, FileSource(s, node, must_exist)
, _open (false)
, _last_ev_time_beats(0.0)
- , _last_ev_time_frames(0)
+ , _last_ev_time_samples(0)
, _smf_last_read_end (0)
, _smf_last_read_time (0)
{
@@ -208,14 +208,14 @@ SMFSource::close ()
/* nothing to do: file descriptor is never kept open */
}
-/** All stamps in audio frames */
-framecnt_t
+/** All stamps in audio samples */
+samplecnt_t
SMFSource::read_unlocked (const Lock& lock,
- Evoral::EventSink<framepos_t>& destination,
- framepos_t const source_start,
- framepos_t start,
- framecnt_t duration,
- Evoral::Range<framepos_t>* loop_range,
+ Evoral::EventSink<samplepos_t>& destination,
+ samplepos_t const source_start,
+ samplepos_t start,
+ samplecnt_t duration,
+ Evoral::Range<samplepos_t>* loop_range,
MidiStateTracker* tracker,
MidiChannelFilter* filter) const
{
@@ -236,7 +236,7 @@ SMFSource::read_unlocked (const Lock& lock,
size_t scratch_size = 0; // keep track of scratch to minimize reallocs
- BeatsFramesConverter converter(_session.tempo_map(), source_start);
+ BeatsSamplesConverter converter(_session.tempo_map(), source_start);
const uint64_t start_ticks = converter.from(start).to_ticks();
DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("SMF read_unlocked: start in ticks %1\n", start_ticks));
@@ -281,18 +281,18 @@ SMFSource::read_unlocked (const Lock& lock,
assert(time >= start_ticks);
- /* Note that we add on the source start time (in session frames) here so that ev_frame_time
- is in session frames.
+ /* Note that we add on the source start time (in session samples) here so that ev_sample_time
+ is in session samples.
*/
- const framepos_t ev_frame_time = converter.to(Evoral::Beats::ticks_at_rate(time, ppqn())) + source_start;
+ const samplepos_t ev_sample_time = converter.to(Evoral::Beats::ticks_at_rate(time, ppqn())) + source_start;
if (loop_range) {
- loop_range->squish (ev_frame_time);
+ loop_range->squish (ev_sample_time);
}
- if (ev_frame_time < start + duration) {
+ if (ev_sample_time < start + duration) {
if (!filter || !filter->filter(ev_buffer, ev_size)) {
- destination.write (ev_frame_time, Evoral::MIDI_EVENT, ev_size, ev_buffer);
+ destination.write (ev_sample_time, Evoral::MIDI_EVENT, ev_size, ev_buffer);
if (tracker) {
tracker->track(ev_buffer);
}
@@ -310,17 +310,17 @@ SMFSource::read_unlocked (const Lock& lock,
return duration;
}
-framecnt_t
+samplecnt_t
SMFSource::write_unlocked (const Lock& lock,
- MidiRingBuffer<framepos_t>& source,
- framepos_t position,
- framecnt_t cnt)
+ MidiRingBuffer<samplepos_t>& source,
+ samplepos_t position,
+ samplecnt_t cnt)
{
if (!_writing) {
mark_streaming_write_started (lock);
}
- framepos_t time;
+ samplepos_t time;
Evoral::EventType type;
uint32_t size;
@@ -331,16 +331,16 @@ SMFSource::write_unlocked (const Lock& lock,
_model->start_write();
}
- Evoral::Event<framepos_t> ev;
+ Evoral::Event<samplepos_t> ev;
while (true) {
- /* Get the event time, in frames since session start but ignoring looping. */
+ /* Get the event time, in samples since session start but ignoring looping. */
bool ret;
if (!(ret = source.peek ((uint8_t*)&time, sizeof (time)))) {
/* Ring is empty, no more events. */
break;
}
- if ((cnt != max_framecnt) &&
+ if ((cnt != max_samplecnt) &&
(time > position + _capture_length + cnt)) {
/* The diskstream doesn't want us to write everything, and this
event is past the end of this block, so we're done for now. */
@@ -381,7 +381,7 @@ SMFSource::write_unlocked (const Lock& lock,
continue;
}
- append_event_frames(lock, ev, position);
+ append_event_samples(lock, ev, position);
}
Evoral::SMF::flush ();
@@ -445,28 +445,28 @@ SMFSource::append_event_beats (const Glib::Threads::Mutex::Lock& lock,
_flags = Source::Flag (_flags & ~Empty);
}
-/** Append an event with a timestamp in frames (framepos_t) */
+/** Append an event with a timestamp in samples (samplepos_t) */
void
-SMFSource::append_event_frames (const Glib::Threads::Mutex::Lock& lock,
- const Evoral::Event<framepos_t>& ev,
- framepos_t position)
+SMFSource::append_event_samples (const Glib::Threads::Mutex::Lock& lock,
+ const Evoral::Event<samplepos_t>& ev,
+ samplepos_t position)
{
if (!_writing || ev.size() == 0) {
return;
}
- // printf("SMFSource: %s - append_event_frames ID = %d time = %u, size = %u, data = ",
+ // printf("SMFSource: %s - append_event_samples ID = %d time = %u, size = %u, data = ",
// name().c_str(), ev.id(), ev.time(), ev.size());
// for (size_t i=0; i < ev.size(); ++i) printf("%X ", ev.buffer()[i]); printf("\n");
- if (ev.time() < _last_ev_time_frames) {
- warning << string_compose(_("Skipping event with unordered frame time %1 < %2"),
- ev.time(), _last_ev_time_frames)
+ if (ev.time() < _last_ev_time_samples) {
+ warning << string_compose(_("Skipping event with unordered sample time %1 < %2"),
+ ev.time(), _last_ev_time_samples)
<< endmsg;
return;
}
- BeatsFramesConverter converter(_session.tempo_map(), position);
+ BeatsSamplesConverter converter(_session.tempo_map(), position);
const Evoral::Beats ev_time_beats = converter.from(ev.time());
Evoral::event_id_t event_id;
@@ -486,12 +486,12 @@ SMFSource::append_event_frames (const Glib::Threads::Mutex::Lock& lock,
_length_beats = max(_length_beats, ev_time_beats);
- const Evoral::Beats last_time_beats = converter.from (_last_ev_time_frames);
+ const Evoral::Beats last_time_beats = converter.from (_last_ev_time_samples);
const Evoral::Beats delta_time_beats = ev_time_beats - last_time_beats;
const uint32_t delta_time_ticks = delta_time_beats.to_ticks(ppqn());
Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id);
- _last_ev_time_frames = ev.time();
+ _last_ev_time_samples = ev.time();
_flags = Source::Flag (_flags & ~Empty);
}
@@ -533,7 +533,7 @@ SMFSource::mark_streaming_midi_write_started (const Lock& lock, NoteMode mode)
MidiSource::mark_streaming_midi_write_started (lock, mode);
Evoral::SMF::begin_write ();
_last_ev_time_beats = Evoral::Beats();
- _last_ev_time_frames = 0;
+ _last_ev_time_samples = 0;
}
void
diff --git a/libs/ardour/sndfileimportable.cc b/libs/ardour/sndfileimportable.cc
index 95b269a014..f900689f77 100644
--- a/libs/ardour/sndfileimportable.cc
+++ b/libs/ardour/sndfileimportable.cc
@@ -47,7 +47,7 @@ SndFileImportableSource::get_timecode_info (SNDFILE* sf, SF_BROADCAST_INFO* binf
* 0xffffffff 0xfffc5680
* seems to be a bug in Presonus Capture (which generated the file)
*
- * still since framepos_t is a signed int, ignore files that could
+ * still since samplepos_t is a signed int, ignore files that could
* lead to negative timestamps for now.
*/
@@ -97,10 +97,10 @@ SndFileImportableSource::~SndFileImportableSource ()
{
}
-framecnt_t
-SndFileImportableSource::read (Sample* buffer, framecnt_t nframes)
+samplecnt_t
+SndFileImportableSource::read (Sample* buffer, samplecnt_t nframes)
{
- framecnt_t per_channel = nframes / sf_info.channels;
+ samplecnt_t per_channel = nframes / sf_info.channels;
per_channel = sf_readf_float (in.get(), buffer, per_channel);
return per_channel * sf_info.channels;
}
@@ -111,28 +111,28 @@ SndFileImportableSource::channels () const
return sf_info.channels;
}
-framecnt_t
+samplecnt_t
SndFileImportableSource::length () const
{
- return (framecnt_t) sf_info.frames;
+ return (samplecnt_t) sf_info.frames;
}
-framecnt_t
+samplecnt_t
SndFileImportableSource::samplerate () const
{
return sf_info.samplerate;
}
void
-SndFileImportableSource::seek (framepos_t /*pos*/)
+SndFileImportableSource::seek (samplepos_t /*pos*/)
{
sf_seek (in.get(), 0, SEEK_SET);
}
-framepos_t
+samplepos_t
SndFileImportableSource::natural_position () const
{
- return (framepos_t) timecode;
+ return (samplepos_t) timecode;
}
bool
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 7436263cc3..9c49e1e1fb 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -51,7 +51,7 @@ using std::string;
gain_t* SndFileSource::out_coefficient = 0;
gain_t* SndFileSource::in_coefficient = 0;
-framecnt_t SndFileSource::xfade_frames = 64;
+samplecnt_t SndFileSource::xfade_samples = 64;
const Source::Flag SndFileSource::default_writable_flags = Source::Flag (
Source::Writable |
Source::Removable |
@@ -108,7 +108,7 @@ SndFileSource::SndFileSource (Session& s, const string& path, int chn, Flag flag
not open existing ones.
*/
SndFileSource::SndFileSource (Session& s, const string& path, const string& origin,
- SampleFormat sfmt, HeaderFormat hf, framecnt_t rate, Flag flags)
+ SampleFormat sfmt, HeaderFormat hf, samplecnt_t rate, Flag flags)
: Source(s, DataType::AUDIO, path, flags)
, AudioFileSource (s, path, origin, flags, sfmt, hf)
, _sndfile (0)
@@ -277,12 +277,12 @@ SndFileSource::SndFileSource (Session& s, const AudioFileSource& other, const st
}
Sample buf[8192];
- framecnt_t off = 0;
+ samplecnt_t off = 0;
float peak = 0;
float norm = 1.f;
/* normalize before converting to fixed point, calc gain factor */
- framecnt_t len = other.read (buf, off, 8192, /*channel*/0);
+ samplecnt_t len = other.read (buf, off, 8192, /*channel*/0);
while (len > 0) {
peak = compute_peak (buf, len, peak);
off += len;
@@ -302,7 +302,7 @@ SndFileSource::SndFileSource (Session& s, const AudioFileSource& other, const st
len = other.read (buf, off, 8192, /*channel*/0);
while (len > 0) {
if (norm != 1.f) {
- for (framecnt_t i = 0; i < len; ++i) {
+ for (samplecnt_t i = 0; i < len; ++i) {
buf[i] *= norm;
}
}
@@ -325,7 +325,7 @@ SndFileSource::init_sndfile ()
memset (&_info, 0, sizeof(_info));
if (destructive()) {
- xfade_buf = new Sample[xfade_frames];
+ xfade_buf = new Sample[xfade_samples];
_timeline_position = header_position_offset;
}
@@ -486,15 +486,15 @@ SndFileSource::sample_rate () const
return _info.samplerate;
}
-framecnt_t
-SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const
+samplecnt_t
+SndFileSource::read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const
{
assert (cnt >= 0);
- framecnt_t nread;
+ samplecnt_t nread;
float *ptr;
- framecnt_t real_cnt;
- framepos_t file_cnt;
+ samplecnt_t real_cnt;
+ samplepos_t file_cnt;
if (writable() && !_sndfile) {
/* file has not been opened yet - nothing written to it */
@@ -529,7 +529,7 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
assert (file_cnt >= 0);
if (file_cnt != cnt) {
- framepos_t delta = cnt - file_cnt;
+ samplepos_t delta = cnt - file_cnt;
memset (dst+file_cnt, 0, sizeof (Sample) * delta);
}
@@ -538,19 +538,19 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
if (sf_seek (_sndfile, (sf_count_t) start, SEEK_SET|SFM_READ) != (sf_count_t) start) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
- error << string_compose(_("SndFileSource: could not seek to frame %1 within %2 (%3)"), start, _name.val().substr (1), errbuf) << endmsg;
+ error << string_compose(_("SndFileSource: could not seek to sample %1 within %2 (%3)"), start, _name.val().substr (1), errbuf) << endmsg;
return 0;
}
if (_info.channels == 1) {
- framecnt_t ret = sf_read_float (_sndfile, dst, file_cnt);
+ samplecnt_t ret = sf_read_float (_sndfile, dst, file_cnt);
if (ret != file_cnt) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
error << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5, ret was %6)"), start, file_cnt, _name.val().substr (1), errbuf, _length, ret) << endl;
}
if (_gain != 1.f) {
- for (framecnt_t i = 0; i < ret; ++i) {
+ for (samplecnt_t i = 0; i < ret; ++i) {
dst[i] *= _gain;
}
}
@@ -569,12 +569,12 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
/* stride through the interleaved data */
if (_gain != 1.f) {
- for (framecnt_t n = 0; n < nread; ++n) {
+ for (samplecnt_t n = 0; n < nread; ++n) {
dst[n] = *ptr * _gain;
ptr += _info.channels;
}
} else {
- for (framecnt_t n = 0; n < nread; ++n) {
+ for (samplecnt_t n = 0; n < nread; ++n) {
dst[n] = *ptr;
ptr += _info.channels;
}
@@ -583,8 +583,8 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
return nread;
}
-framecnt_t
-SndFileSource::write_unlocked (Sample *data, framecnt_t cnt)
+samplecnt_t
+SndFileSource::write_unlocked (Sample *data, samplecnt_t cnt)
{
if (open()) {
return 0; // failure
@@ -597,8 +597,8 @@ SndFileSource::write_unlocked (Sample *data, framecnt_t cnt)
}
}
-framecnt_t
-SndFileSource::nondestructive_write_unlocked (Sample *data, framecnt_t cnt)
+samplecnt_t
+SndFileSource::nondestructive_write_unlocked (Sample *data, samplecnt_t cnt)
{
if (!writable()) {
warning << string_compose (_("attempt to write a non-writable audio file source (%1)"), _path) << endmsg;
@@ -611,23 +611,23 @@ SndFileSource::nondestructive_write_unlocked (Sample *data, framecnt_t cnt)
return 0;
}
- framepos_t frame_pos = _length;
+ samplepos_t sample_pos = _length;
- if (write_float (data, frame_pos, cnt) != cnt) {
+ if (write_float (data, sample_pos, cnt) != cnt) {
return 0;
}
update_length (_length + cnt);
if (_build_peakfiles) {
- compute_and_write_peaks (data, frame_pos, cnt, true, true);
+ compute_and_write_peaks (data, sample_pos, cnt, true, true);
}
return cnt;
}
-framecnt_t
-SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt)
+samplecnt_t
+SndFileSource::destructive_write_unlocked (Sample* data, samplecnt_t cnt)
{
if (!writable()) {
warning << string_compose (_("attempt to write a non-writable audio file source (%1)"), _path) << endmsg;
@@ -644,11 +644,11 @@ SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt)
_capture_end = false;
/* move to the correct location place */
- file_pos = capture_start_frame - _timeline_position;
+ file_pos = capture_start_sample - _timeline_position;
// split cnt in half
- framecnt_t subcnt = cnt / 2;
- framecnt_t ofilepos = file_pos;
+ samplecnt_t subcnt = cnt / 2;
+ samplecnt_t ofilepos = file_pos;
// fade in
if (crossfade (data, subcnt, 1) != subcnt) {
@@ -676,7 +676,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt)
_capture_end = false;
/* move to the correct location place */
- file_pos = capture_start_frame - _timeline_position;
+ file_pos = capture_start_sample - _timeline_position;
if (crossfade (data, cnt, 1) != cnt) {
return 0;
@@ -716,7 +716,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt)
}
int
-SndFileSource::update_header (framepos_t when, struct tm& now, time_t tnow)
+SndFileSource::update_header (samplepos_t when, struct tm& now, time_t tnow)
{
set_timeline_position (when);
@@ -765,7 +765,7 @@ SndFileSource::flush ()
}
int
-SndFileSource::setup_broadcast_info (framepos_t /*when*/, struct tm& now, time_t /*tnow*/)
+SndFileSource::setup_broadcast_info (samplepos_t /*when*/, struct tm& now, time_t /*tnow*/)
{
if (!writable()) {
warning << string_compose (_("attempt to store broadcast info in a non-writable audio file source (%1)"), _path) << endmsg;
@@ -811,16 +811,16 @@ SndFileSource::set_header_timeline_position ()
}
}
-framecnt_t
-SndFileSource::write_float (Sample* data, framepos_t frame_pos, framecnt_t cnt)
+samplecnt_t
+SndFileSource::write_float (Sample* data, samplepos_t sample_pos, samplecnt_t cnt)
{
if ((_info.format & SF_FORMAT_TYPEMASK ) == SF_FORMAT_FLAC) {
- assert (_length == frame_pos);
+ assert (_length == sample_pos);
}
- else if (_sndfile == 0 || sf_seek (_sndfile, frame_pos, SEEK_SET|SFM_WRITE) < 0) {
+ else if (_sndfile == 0 || sf_seek (_sndfile, sample_pos, SEEK_SET|SFM_WRITE) < 0) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
- error << string_compose (_("%1: cannot seek to %2 (libsndfile error: %3)"), _path, frame_pos, errbuf) << endmsg;
+ error << string_compose (_("%1: cannot seek to %2 (libsndfile error: %3)"), _path, sample_pos, errbuf) << endmsg;
return 0;
}
@@ -831,7 +831,7 @@ SndFileSource::write_float (Sample* data, framepos_t frame_pos, framecnt_t cnt)
return cnt;
}
-framepos_t
+samplepos_t
SndFileSource::natural_position() const
{
return _timeline_position;
@@ -844,16 +844,16 @@ SndFileSource::clear_capture_marks ()
_capture_end = false;
}
-/** @param pos Capture start position in session frames */
+/** @param pos Capture start position in session samples */
void
-SndFileSource::mark_capture_start (framepos_t pos)
+SndFileSource::mark_capture_start (samplepos_t pos)
{
if (destructive()) {
if (pos < _timeline_position) {
_capture_start = false;
} else {
_capture_start = true;
- capture_start_frame = pos;
+ capture_start_sample = pos;
}
}
}
@@ -866,15 +866,15 @@ SndFileSource::mark_capture_end()
}
}
-framecnt_t
-SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in)
+samplecnt_t
+SndFileSource::crossfade (Sample* data, samplecnt_t cnt, int fade_in)
{
- framecnt_t xfade = min (xfade_frames, cnt);
- framecnt_t nofade = cnt - xfade;
+ samplecnt_t xfade = min (xfade_samples, cnt);
+ samplecnt_t nofade = cnt - xfade;
Sample* fade_data = 0;
- framepos_t fade_position = 0; // in frames
+ samplepos_t fade_position = 0; // in samples
ssize_t retval;
- framecnt_t file_cnt;
+ samplecnt_t file_cnt;
if (fade_in) {
fade_position = file_pos;
@@ -918,7 +918,7 @@ SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in)
}
if (file_cnt != xfade) {
- framecnt_t delta = xfade - file_cnt;
+ samplecnt_t delta = xfade - file_cnt;
memset (xfade_buf+file_cnt, 0, sizeof (Sample) * delta);
}
@@ -929,9 +929,9 @@ SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in)
}
}
- if (xfade == xfade_frames) {
+ if (xfade == xfade_samples) {
- framecnt_t n;
+ samplecnt_t n;
/* use the standard xfade curve */
@@ -953,7 +953,7 @@ SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in)
}
}
- } else if (xfade < xfade_frames) {
+ } else if (xfade < xfade_samples) {
std::vector<gain_t> in(xfade);
std::vector<gain_t> out(xfade);
@@ -962,7 +962,7 @@ SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in)
compute_equal_power_fades (xfade, &in[0], &out[0]);
- for (framecnt_t n = 0; n < xfade; ++n) {
+ for (samplecnt_t n = 0; n < xfade; ++n) {
xfade_buf[n] = (xfade_buf[n] * out[n]) + (fade_data[n] * in[n]);
}
@@ -989,11 +989,11 @@ SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in)
return cnt;
}
-framepos_t
-SndFileSource::last_capture_start_frame () const
+samplepos_t
+SndFileSource::last_capture_start_sample () const
{
if (destructive()) {
- return capture_start_frame;
+ return capture_start_sample;
} else {
return 0;
}
@@ -1014,25 +1014,25 @@ SndFileSource::handle_header_position_change ()
}
void
-SndFileSource::setup_standard_crossfades (Session const & s, framecnt_t rate)
+SndFileSource::setup_standard_crossfades (Session const & s, samplecnt_t rate)
{
/* This static method is assumed to have been called by the Session
before any DFS's are created.
*/
- xfade_frames = (framecnt_t) floor ((s.config.get_destructive_xfade_msecs () / 1000.0) * rate);
+ xfade_samples = (samplecnt_t) floor ((s.config.get_destructive_xfade_msecs () / 1000.0) * rate);
delete [] out_coefficient;
delete [] in_coefficient;
- out_coefficient = new gain_t[xfade_frames];
- in_coefficient = new gain_t[xfade_frames];
+ out_coefficient = new gain_t[xfade_samples];
+ in_coefficient = new gain_t[xfade_samples];
- compute_equal_power_fades (xfade_frames, in_coefficient, out_coefficient);
+ compute_equal_power_fades (xfade_samples, in_coefficient, out_coefficient);
}
void
-SndFileSource::set_timeline_position (framepos_t pos)
+SndFileSource::set_timeline_position (samplepos_t pos)
{
// destructive track timeline postion does not change
// except at instantion or when header_position_offset
diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc
index 187eee8085..6ae1aca1ca 100644
--- a/libs/ardour/source.cc
+++ b/libs/ardour/source.cc
@@ -200,8 +200,8 @@ Source::load_transients (const string& path)
break;
}
- framepos_t frame = (framepos_t) floor (val * _session.frame_rate());
- transients.push_back (frame);
+ samplepos_t sample = (samplepos_t) floor (val * _session.sample_rate());
+ transients.push_back (sample);
}
::fclose (tf);
@@ -265,7 +265,7 @@ Source::mark_for_remove ()
}
void
-Source::set_timeline_position (framepos_t pos)
+Source::set_timeline_position (samplepos_t pos)
{
_timeline_position = pos;
}
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index 834014bd1f..e211564408 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -134,7 +134,7 @@ SourceFactory::setup_peakfile (boost::shared_ptr<Source> s, bool async)
}
boost::shared_ptr<Source>
-SourceFactory::createSilent (Session& s, const XMLNode& node, framecnt_t nframes, float sr)
+SourceFactory::createSilent (Session& s, const XMLNode& node, samplecnt_t nframes, float sr)
{
Source* src = new SilentFileSource (s, node, nframes, sr);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
@@ -309,7 +309,7 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
boost::shared_ptr<Source>
SourceFactory::createWritable (DataType type, Session& s, const std::string& path,
- bool destructive, framecnt_t rate, bool announce, bool defer_peaks)
+ bool destructive, samplecnt_t rate, bool announce, bool defer_peaks)
{
/* this might throw failed_constructor(), which is OK */
@@ -395,7 +395,7 @@ SourceFactory::createForRecovery (DataType type, Session& s, const std::string&
boost::shared_ptr<Source>
SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name,
- uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, bool defer_peaks)
+ uint32_t chn, sampleoffset_t start, samplecnt_t len, bool copy, bool defer_peaks)
{
if (type == DataType::AUDIO) {
try {
diff --git a/libs/ardour/srcfilesource.cc b/libs/ardour/srcfilesource.cc
index 98389bf33b..1a11970c79 100644
--- a/libs/ardour/srcfilesource.cc
+++ b/libs/ardour/srcfilesource.cc
@@ -64,7 +64,7 @@ SrcFileSource::SrcFileSource (Session& s, boost::shared_ptr<AudioFileSource> src
}
- _ratio = s.nominal_frame_rate() / _source->sample_rate();
+ _ratio = s.nominal_sample_rate() / _source->sample_rate();
_src_data.src_ratio = _ratio;
src_buffer_size = ceil((double)max_blocksize / _ratio) + 2;
@@ -93,8 +93,8 @@ SrcFileSource::close ()
}
}
-framecnt_t
-SrcFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const
+samplecnt_t
+SrcFileSource::read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const
{
int err;
const double srccnt = cnt / _ratio;
@@ -107,7 +107,7 @@ SrcFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
_target_position = start;
}
- const framecnt_t scnt = ceilf(srccnt - _fract_position);
+ const samplecnt_t scnt = ceilf(srccnt - _fract_position);
_fract_position += (scnt - srccnt);
#ifndef NDEBUG
@@ -120,7 +120,7 @@ SrcFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
_src_data.input_frames = _source->read (_src_buffer, _source_position, scnt);
- if ((framecnt_t) _src_data.input_frames * _ratio <= cnt
+ if ((samplecnt_t) _src_data.input_frames * _ratio <= cnt
&& _source_position + scnt >= _source->length(0)) {
_src_data.end_of_input = true;
DEBUG_TRACE (DEBUG::AudioPlayback, "SRC: END OF INPUT\n");
@@ -128,7 +128,7 @@ SrcFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
_src_data.end_of_input = false;
}
- if ((framecnt_t) _src_data.input_frames < scnt) {
+ if ((samplecnt_t) _src_data.input_frames < scnt) {
_target_position += _src_data.input_frames * _ratio;
} else {
_target_position += cnt;
@@ -149,12 +149,12 @@ SrcFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
_source_position += _src_data.input_frames_used;
- framepos_t saved_target = _target_position;
- framecnt_t generated = _src_data.output_frames_gen;
+ samplepos_t saved_target = _target_position;
+ samplecnt_t generated = _src_data.output_frames_gen;
while (generated < cnt) {
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("SRC: recurse for %1 samples\n", cnt - generated));
- framecnt_t g = read_unlocked(dst + generated, _target_position, cnt - generated);
+ samplecnt_t g = read_unlocked(dst + generated, _target_position, cnt - generated);
generated += g;
if (g == 0) break;
}
diff --git a/libs/ardour/st_stretch.cc b/libs/ardour/st_stretch.cc
index d12ceed706..70d7ca1fc7 100644
--- a/libs/ardour/st_stretch.cc
+++ b/libs/ardour/st_stretch.cc
@@ -47,7 +47,7 @@ STStretch::STStretch (Session& s, TimeFXRequest& req)
percentage = -tsr.time_fraction;
- st.setSampleRate (s.frame_rate());
+ st.setSampleRate (s.sample_rate());
st.setChannels (1);
st.setTempoChange (percentage);
st.setPitchSemiTones (0);
@@ -66,10 +66,10 @@ int
STStretch::run (boost::shared_ptr<Region> a_region, Progress* progress)
{
SourceList nsrcs;
- framecnt_t total_frames;
- framecnt_t done;
+ samplecnt_t total_samples;
+ samplecnt_t done;
int ret = -1;
- const framecnt_t bufsize = 16384;
+ const samplecnt_t bufsize = 16384;
gain_t *gain_buffer = 0;
Sample *buffer = 0;
char suffix[32];
@@ -81,7 +81,7 @@ STStretch::run (boost::shared_ptr<Region> a_region, Progress* progress)
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion>(a_region);
- total_frames = region->length() * region->n_channels();
+ total_samples = region->length() * region->n_channels();
done = 0;
/* the name doesn't need to be super-precise, but allow for 2 fractional
@@ -107,13 +107,13 @@ STStretch::run (boost::shared_ptr<Region> a_region, Progress* progress)
boost::shared_ptr<AudioSource> asrc
= boost::dynamic_pointer_cast<AudioSource>(nsrcs[i]);
- framepos_t pos = 0;
- framecnt_t this_read = 0;
+ samplepos_t pos = 0;
+ samplecnt_t this_read = 0;
st.clear();
while (!tsr.cancel && pos < region->length()) {
- framecnt_t this_time;
+ samplecnt_t this_time;
this_time = min (bufsize, region->length() - pos);
@@ -130,7 +130,7 @@ STStretch::run (boost::shared_ptr<Region> a_region, Progress* progress)
pos += this_read;
done += this_read;
- progress->set_progress ((float) done / total_frames);
+ progress->set_progress ((float) done / total_samples);
st.putSamples (buffer, this_read);
@@ -176,18 +176,18 @@ STStretch::run (boost::shared_ptr<Region> a_region, Progress* progress)
/* now reset ancestral data for each new region */
for (vector<boost::shared_ptr<Region> >::iterator x = results.begin(); x != results.end(); ++x) {
- framepos_t astart = (*x)->ancestral_start();
- framepos_t alength = (*x)->ancestral_length();
- framepos_t start;
- framecnt_t length;
+ samplepos_t astart = (*x)->ancestral_start();
+ samplepos_t alength = (*x)->ancestral_length();
+ samplepos_t start;
+ samplecnt_t length;
// note: tsr.fraction is a percentage of original length. 100 = no change,
// 50 is half as long, 200 is twice as long, etc.
float stretch = (*x)->stretch() * (tsr.time_fraction/100.0);
- start = (framepos_t) floor (astart + ((astart - (*x)->start()) / stretch));
- length = (framecnt_t) floor (alength / stretch);
+ start = (samplepos_t) floor (astart + ((astart - (*x)->start()) / stretch));
+ length = (samplecnt_t) floor (alength / stretch);
(*x)->set_ancestral_data (start, length, stretch, (*x)->shift());
}
diff --git a/libs/ardour/strip_silence.cc b/libs/ardour/strip_silence.cc
index 1cbb81a3ed..8aa703740b 100644
--- a/libs/ardour/strip_silence.cc
+++ b/libs/ardour/strip_silence.cc
@@ -32,7 +32,7 @@ using namespace ARDOUR;
* @param fade_length Length of fade in/out to apply to trimmed regions, in samples.
*/
-StripSilence::StripSilence (Session & s, const AudioIntervalMap& sm, framecnt_t fade_length)
+StripSilence::StripSilence (Session & s, const AudioIntervalMap& sm, samplecnt_t fade_length)
: Filter (s)
, _smap (sm)
, _fade_length (fade_length)
@@ -98,7 +98,7 @@ StripSilence::run (boost::shared_ptr<Region> r, Progress* progress)
AudioIntervalResult::const_iterator last_silence = silence.end ();
--last_silence;
- frameoffset_t const end_of_region = r->start() + r->length();
+ sampleoffset_t const end_of_region = r->start() + r->length();
if (last_silence->second < end_of_region - 1) {
audible.push_back (std::make_pair (last_silence->second, end_of_region - 1));
@@ -116,12 +116,12 @@ StripSilence::run (boost::shared_ptr<Region> r, Progress* progress)
plist.add (Properties::position, r->position() + (i->first - r->start()));
copy = boost::dynamic_pointer_cast<AudioRegion> (
- RegionFactory::create (region, MusicFrame (i->first - r->start(), 0), plist)
+ RegionFactory::create (region, MusicSample (i->first - r->start(), 0), plist)
);
copy->set_name (RegionFactory::new_region_name (region->name ()));
- framecnt_t const f = std::min (_fade_length, (i->second - i->first) / 2);
+ samplecnt_t const f = std::min (_fade_length, (i->second - i->first) / 2);
if (f > 0) {
copy->set_fade_in_active (true);
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 5d3be14964..4b9d2a9372 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -48,16 +48,16 @@ using Timecode::BBT_Time;
Meter TempoMap::_default_meter (4.0, 4.0);
Tempo TempoMap::_default_tempo (120.0, 4.0, 120.0);
-framepos_t
-MetricSection::frame_at_minute (const double& time) const
+samplepos_t
+MetricSection::sample_at_minute (const double& time) const
{
- return (framepos_t) floor ((time * 60.0 * _sample_rate) + 0.5);
+ return (samplepos_t) floor ((time * 60.0 * _sample_rate) + 0.5);
}
double
-MetricSection::minute_at_frame (const framepos_t frame) const
+MetricSection::minute_at_sample (const samplepos_t sample) const
{
- return (frame / (double) _sample_rate) / 60.0;
+ return (sample / (double) _sample_rate) / 60.0;
}
/***********************************************************************/
@@ -91,7 +91,7 @@ ARDOUR::string_to_bbt_time (const std::string& str, BBT_Time& bbt)
/***********************************************************************/
double
-Meter::frames_per_grid (const Tempo& tempo, framecnt_t sr) const
+Meter::samples_per_grid (const Tempo& tempo, samplecnt_t sr) const
{
/* This is tempo- and meter-sensitive. The number it returns
is based on the interval between any two lines in the
@@ -104,9 +104,9 @@ Meter::frames_per_grid (const Tempo& tempo, framecnt_t sr) const
}
double
-Meter::frames_per_bar (const Tempo& tempo, framecnt_t sr) const
+Meter::samples_per_bar (const Tempo& tempo, samplecnt_t sr) const
{
- return frames_per_grid (tempo, sr) * _divisions_per_bar;
+ return samples_per_grid (tempo, sr) * _divisions_per_bar;
}
/***********************************************************************/
@@ -115,7 +115,7 @@ void
MetricSection::add_state_to_node(XMLNode& node) const
{
node.set_property ("pulse", _pulse);
- node.set_property ("frame", frame());
+ node.set_property ("frame", sample());
node.set_property ("movable", !_initial);
node.set_property ("lock-style", _position_lock_style);
}
@@ -125,9 +125,9 @@ MetricSection::set_state (const XMLNode& node, int /*version*/)
{
node.get_property ("pulse", _pulse);
- framepos_t frame;
- if (node.get_property ("frame", frame)) {
- set_minute (minute_at_frame (frame));
+ samplepos_t sample;
+ if (node.get_property ("frame", sample)) {
+ set_minute (minute_at_sample (sample));
}
bool tmp;
@@ -151,7 +151,7 @@ MetricSection::set_state (const XMLNode& node, int /*version*/)
const string TempoSection::xml_state_node_name = "Tempo";
-TempoSection::TempoSection (const XMLNode& node, framecnt_t sample_rate)
+TempoSection::TempoSection (const XMLNode& node, samplecnt_t sample_rate)
: MetricSection (0.0, 0, MusicTime, true, sample_rate)
, Tempo (TempoMap::default_tempo())
, _c (0.0)
@@ -351,32 +351,32 @@ TempoSection::minute_at_pulse (const double& p) const
return _time_at_pulse (p - pulse()) + minute();
}
-/** returns thw whole-note pulse at session frame position f.
- * @param f the frame position.
+/** returns thw whole-note pulse at session sample position f.
+ * @param f the sample position.
* @return the position in whole-note pulses corresponding to f
*
- * for use with musical units whose granularity is coarser than frames (e.g. ticks)
+ * for use with musical units whose granularity is coarser than samples (e.g. ticks)
*/
double
-TempoSection::pulse_at_frame (const framepos_t f) const
+TempoSection::pulse_at_sample (const samplepos_t f) const
{
- const bool constant = type() == Constant || _c == 0.0 || (initial() && f < frame());
+ const bool constant = type() == Constant || _c == 0.0 || (initial() && f < sample());
if (constant) {
- return (minute_at_frame (f - frame()) * pulses_per_minute()) + pulse();
+ return (minute_at_sample (f - sample()) * pulses_per_minute()) + pulse();
}
- return _pulse_at_time (minute_at_frame (f - frame())) + pulse();
+ return _pulse_at_time (minute_at_sample (f - sample())) + pulse();
}
-framepos_t
-TempoSection::frame_at_pulse (const double& p) const
+samplepos_t
+TempoSection::sample_at_pulse (const double& p) const
{
const bool constant = type() == Constant || _c == 0.0 || (initial() && p < pulse());
if (constant) {
- return frame_at_minute (((p - pulse()) / pulses_per_minute()) + minute());
+ return sample_at_minute (((p - pulse()) / pulses_per_minute()) + minute());
}
- return frame_at_minute (_time_at_pulse (p - pulse()) + minute());
+ return sample_at_minute (_time_at_pulse (p - pulse()) + minute());
}
/*
@@ -545,7 +545,7 @@ TempoSection::_time_at_pulse (const double& pulse) const
const string MeterSection::xml_state_node_name = "Meter";
-MeterSection::MeterSection (const XMLNode& node, const framecnt_t sample_rate)
+MeterSection::MeterSection (const XMLNode& node, const samplecnt_t sample_rate)
: MetricSection (0.0, 0, MusicTime, false, sample_rate), Meter (TempoMap::default_meter())
{
pair<double, BBT_Time> start;
@@ -659,40 +659,40 @@ MeterSection::get_state() const
It is important to keep the _metrics in an order that makes sense.
Because ramped MusicTime and AudioTime tempos can interact with each other,
reordering is frequent. Care must be taken to keep _metrics in a solved state.
- Solved means ordered by frame or pulse with frame-accurate precision (see check_solved()).
+ Solved means ordered by sample or pulse with sample-accurate precision (see check_solved()).
Music and Audio
Music and audio-locked objects may seem interchangeable on the surface, but when translating
between audio samples and beat, remember that a sample is only a quantised approximation
of the actual time (in minutes) of a beat.
- Thus if a gui user points to the frame occupying the start of a music-locked object on 1|3|0, it does not
- mean that this frame is the actual location in time of 1|3|0.
+ Thus if a gui user points to the sample occupying the start of a music-locked object on 1|3|0, it does not
+ mean that this sample is the actual location in time of 1|3|0.
- You cannot use a frame measurement to determine beat distance except under special circumstances
- (e.g. where the user has requested that a beat lie on a SMPTE frame or if the tempo is known to be constant over the duration).
+ You cannot use a sample measurement to determine beat distance except under special circumstances
+ (e.g. where the user has requested that a beat lie on a SMPTE sample or if the tempo is known to be constant over the duration).
This means is that a user operating on a musical grid must supply the desired beat position and/or current beat quantization in order for the
sample space the user is operating at to be translated correctly to the object.
- The current approach is to interpret the supplied frame using the grid division the user has currently selected.
- If the user has no musical grid set, they are actually operating in sample space (even SMPTE frames are rounded to audio frame), so
- the supplied audio frame is interpreted as the desired musical location (beat_at_frame()).
+ The current approach is to interpret the supplied sample using the grid division the user has currently selected.
+ If the user has no musical grid set, they are actually operating in sample space (even SMPTE samples are rounded to audio sample), so
+ the supplied audio sample is interpreted as the desired musical location (beat_at_sample()).
tldr: Beat, being a function of time, has nothing to do with sample rate, but time quantization can get in the way of precision.
- When frame_at_beat() is called, the position calculation is performed in pulses and minutes.
- The result is rounded to audio frames.
- When beat_at_frame() is called, the frame is converted to minutes, with no rounding performed on the result.
+ When sample_at_beat() is called, the position calculation is performed in pulses and minutes.
+ The result is rounded to audio samples.
+ When beat_at_sample() is called, the sample is converted to minutes, with no rounding performed on the result.
So :
- frame_at_beat (beat_at_frame (frame)) == frame
+ sample_at_beat (beat_at_sample (sample)) == sample
but :
- beat_at_frame (frame_at_beat (beat)) != beat due to the time quantization of frame_at_beat().
+ beat_at_sample (sample_at_beat (beat)) != beat due to the time quantization of sample_at_beat().
Doing the second one will result in a beat distance error of up to 0.5 audio samples.
- frames_between_quarter_notes () eliminats this effect when determining time duration
- from Beats distance, or instead work in quarter-notes and/or beats and convert to frames last.
+ samples_between_quarter_notes () eliminats this effect when determining time duration
+ from Beats distance, or instead work in quarter-notes and/or beats and convert to samples last.
The above pointless example could instead do:
beat_at_quarter_note (quarter_note_at_beat (beat)) to avoid rounding.
@@ -709,13 +709,13 @@ struct MetricSectionSorter {
struct MetricSectionFrameSorter {
bool operator() (const MetricSection* a, const MetricSection* b) {
- return a->frame() < b->frame();
+ return a->sample() < b->sample();
}
};
-TempoMap::TempoMap (framecnt_t fr)
+TempoMap::TempoMap (samplecnt_t fr)
{
- _frame_rate = fr;
+ _sample_rate = fr;
BBT_Time start (1, 1, 0);
TempoSection *t = new TempoSection (0.0, 0.0, _default_tempo, AudioTime, fr);
@@ -726,7 +726,7 @@ TempoMap::TempoMap (framecnt_t fr)
m->set_initial (true);
- /* note: frame time is correct (zero) for both of these */
+ /* note: sample time is correct (zero) for both of these */
_metrics.push_back (t);
_metrics.push_back (m);
@@ -739,7 +739,7 @@ TempoMap::operator= (TempoMap const & other)
if (&other != this) {
Glib::Threads::RWLock::ReaderLock lr (other.lock);
Glib::Threads::RWLock::WriterLock lm (lock);
- _frame_rate = other._frame_rate;
+ _sample_rate = other._sample_rate;
Metrics::const_iterator d = _metrics.begin();
while (d != _metrics.end()) {
@@ -777,16 +777,16 @@ TempoMap::~TempoMap ()
_metrics.clear();
}
-framepos_t
-TempoMap::frame_at_minute (const double time) const
+samplepos_t
+TempoMap::sample_at_minute (const double time) const
{
- return (framepos_t) floor ((time * 60.0 * _frame_rate) + 0.5);
+ return (samplepos_t) floor ((time * 60.0 * _sample_rate) + 0.5);
}
double
-TempoMap::minute_at_frame (const framepos_t frame) const
+TempoMap::minute_at_sample (const samplepos_t sample) const
{
- return (frame / (double) _frame_rate) / 60.0;
+ return (sample / (double) _sample_rate) / 60.0;
}
void
@@ -815,7 +815,7 @@ TempoMap::remove_tempo_locked (const TempoSection& tempo)
for (i = _metrics.begin(); i != _metrics.end(); ++i) {
if (dynamic_cast<TempoSection*> (*i) != 0) {
- if (tempo.frame() == (*i)->frame()) {
+ if (tempo.sample() == (*i)->sample()) {
if (!(*i)->initial()) {
delete (*i);
_metrics.erase (i);
@@ -856,7 +856,7 @@ TempoMap::remove_meter_locked (const MeterSection& meter)
for (Metrics::iterator i = _metrics.begin(); i != _metrics.end(); ++i) {
TempoSection* t = 0;
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
- if (t->locked_to_meter() && meter.frame() == (*i)->frame()) {
+ if (t->locked_to_meter() && meter.sample() == (*i)->sample()) {
delete (*i);
_metrics.erase (i);
break;
@@ -867,7 +867,7 @@ TempoMap::remove_meter_locked (const MeterSection& meter)
for (Metrics::iterator i = _metrics.begin(); i != _metrics.end(); ++i) {
if (dynamic_cast<MeterSection*> (*i) != 0) {
- if (meter.frame() == (*i)->frame()) {
+ if (meter.sample() == (*i)->sample()) {
if (!(*i)->initial()) {
delete (*i);
_metrics.erase (i);
@@ -920,7 +920,7 @@ TempoMap::do_insert (MetricSection* section)
/* Tempo sections */
bool const ipm = insert_tempo->position_lock_style() == MusicTime;
- if ((ipm && tempo->pulse() == insert_tempo->pulse()) || (!ipm && tempo->frame() == insert_tempo->frame())) {
+ if ((ipm && tempo->pulse() == insert_tempo->pulse()) || (!ipm && tempo->sample() == insert_tempo->sample())) {
if (tempo->initial()) {
@@ -945,7 +945,7 @@ TempoMap::do_insert (MetricSection* section)
bool const ipm = insert_meter->position_lock_style() == MusicTime;
- if ((ipm && meter->beat() == insert_meter->beat()) || (!ipm && meter->frame() == insert_meter->frame())) {
+ if ((ipm && meter->beat() == insert_meter->beat()) || (!ipm && meter->sample() == insert_meter->sample())) {
if (meter->initial()) {
@@ -986,11 +986,11 @@ TempoMap::do_insert (MetricSection* section)
bool const ipm = insert_meter->position_lock_style() == MusicTime;
if (meter) {
- if ((ipm && meter->beat() > insert_meter->beat()) || (!ipm && meter->frame() > insert_meter->frame())) {
+ if ((ipm && meter->beat() > insert_meter->beat()) || (!ipm && meter->sample() > insert_meter->sample())) {
break;
}
} else {
- if (prev_t && prev_t->locked_to_meter() && (!ipm && prev_t->frame() == insert_meter->frame())) {
+ if (prev_t && prev_t->locked_to_meter() && (!ipm && prev_t->sample() == insert_meter->sample())) {
break;
}
@@ -1004,7 +1004,7 @@ TempoMap::do_insert (MetricSection* section)
if (tempo) {
bool const ipm = insert_tempo->position_lock_style() == MusicTime;
const bool lm = insert_tempo->locked_to_meter();
- if ((ipm && tempo->pulse() > insert_tempo->pulse()) || (!ipm && tempo->frame() > insert_tempo->frame())
+ if ((ipm && tempo->pulse() > insert_tempo->pulse()) || (!ipm && tempo->sample() > insert_tempo->sample())
|| (lm && tempo->pulse() > insert_tempo->pulse())) {
break;
}
@@ -1018,7 +1018,7 @@ TempoMap::do_insert (MetricSection* section)
}
/* user supplies the exact pulse if pls == MusicTime */
TempoSection*
-TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t frame, PositionLockStyle pls)
+TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const samplepos_t sample, PositionLockStyle pls)
{
if (tempo.note_types_per_minute() <= 0.0) {
warning << "Cannot add tempo. note types per minute must be greater than zero." << endmsg;
@@ -1029,7 +1029,7 @@ TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t f
{
Glib::Threads::RWLock::WriterLock lm (lock);
/* here we default to not clamped for a new tempo section. preference? */
- ts = add_tempo_locked (tempo, pulse, minute_at_frame (frame), pls, true, false, false);
+ ts = add_tempo_locked (tempo, pulse, minute_at_sample (sample), pls, true, false, false);
recompute_map (_metrics);
}
@@ -1040,7 +1040,7 @@ TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t f
}
void
-TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pulse, const framepos_t frame, PositionLockStyle pls)
+TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pulse, const samplepos_t sample, PositionLockStyle pls)
{
if (tempo.note_types_per_minute() <= 0.0) {
warning << "Cannot replace tempo. note types per minute must be greater than zero." << endmsg;
@@ -1063,7 +1063,7 @@ TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pul
}
} else {
remove_tempo_locked (ts);
- new_ts = add_tempo_locked (tempo, pulse, minute_at_frame (frame), pls, true, locked_to_meter, ts_clamped);
+ new_ts = add_tempo_locked (tempo, pulse, minute_at_sample (sample), pls, true, locked_to_meter, ts_clamped);
/* enforce clampedness of next tempo section */
TempoSection* next_t = next_tempo_section_locked (_metrics, new_ts);
if (next_t && next_t->clamped()) {
@@ -1073,7 +1073,7 @@ TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pul
} else {
first.set_pulse (0.0);
- first.set_minute (minute_at_frame (frame));
+ first.set_minute (minute_at_sample (sample));
first.set_position_lock_style (AudioTime);
first.set_locked_to_meter (true);
first.set_clamped (ts_clamped);
@@ -1092,7 +1092,7 @@ TempoSection*
TempoMap::add_tempo_locked (const Tempo& tempo, double pulse, double minute
, PositionLockStyle pls, bool recompute, bool locked_to_meter, bool clamped)
{
- TempoSection* t = new TempoSection (pulse, minute, tempo, pls, _frame_rate);
+ TempoSection* t = new TempoSection (pulse, minute, tempo, pls, _sample_rate);
t->set_locked_to_meter (locked_to_meter);
t->set_clamped (clamped);
@@ -1125,12 +1125,12 @@ TempoMap::add_tempo_locked (const Tempo& tempo, double pulse, double minute
}
MeterSection*
-TempoMap::add_meter (const Meter& meter, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls)
+TempoMap::add_meter (const Meter& meter, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls)
{
MeterSection* m = 0;
{
Glib::Threads::RWLock::WriterLock lm (lock);
- m = add_meter_locked (meter, where, frame, pls, true);
+ m = add_meter_locked (meter, where, sample, pls, true);
}
@@ -1145,14 +1145,14 @@ TempoMap::add_meter (const Meter& meter, const Timecode::BBT_Time& where, framep
}
void
-TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_Time& where, framepos_t frame, PositionLockStyle pls)
+TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_Time& where, samplepos_t sample, PositionLockStyle pls)
{
{
Glib::Threads::RWLock::WriterLock lm (lock);
if (!ms.initial()) {
remove_meter_locked (ms);
- add_meter_locked (meter, where, frame, pls, true);
+ add_meter_locked (meter, where, sample, pls, true);
} else {
MeterSection& first (first_meter());
TempoSection& first_t (first_tempo());
@@ -1160,7 +1160,7 @@ TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_T
*static_cast<Meter*>(&first) = meter;
first.set_position_lock_style (AudioTime);
first.set_pulse (0.0);
- first.set_minute (minute_at_frame (frame));
+ first.set_minute (minute_at_sample (sample));
pair<double, BBT_Time> beat = make_pair (0.0, BBT_Time (1, 1, 0));
first.set_beat (beat);
first_t.set_minute (first.minute());
@@ -1175,16 +1175,16 @@ TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_T
}
MeterSection*
-TempoMap::add_meter_locked (const Meter& meter, const BBT_Time& bbt, framepos_t frame, PositionLockStyle pls, bool recompute)
+TempoMap::add_meter_locked (const Meter& meter, const BBT_Time& bbt, samplepos_t sample, PositionLockStyle pls, bool recompute)
{
double const minute_at_bbt = minute_at_bbt_locked (_metrics, bbt);
- const MeterSection& prev_m = meter_section_at_minute_locked (_metrics, minute_at_bbt - minute_at_frame (1));
+ const MeterSection& prev_m = meter_section_at_minute_locked (_metrics, minute_at_bbt - minute_at_sample (1));
double const pulse = ((bbt.bars - prev_m.bbt().bars) * (prev_m.divisions_per_bar() / prev_m.note_divisor())) + prev_m.pulse();
/* the natural time of the BBT position */
double const time_minutes = minute_at_pulse_locked (_metrics, pulse);
if (pls == AudioTime) {
- /* add meter-locked tempo at the natural time in the current map (frame may differ). */
+ /* add meter-locked tempo at the natural time in the current map (sample may differ). */
Tempo const tempo_at_time = tempo_at_minute_locked (_metrics, time_minutes);
TempoSection* mlt = add_tempo_locked (tempo_at_time, pulse, time_minutes, AudioTime, true, true, false);
@@ -1193,7 +1193,7 @@ TempoMap::add_meter_locked (const Meter& meter, const BBT_Time& bbt, framepos_t
}
}
/* still using natural time for the position, ignoring lock style. */
- MeterSection* new_meter = new MeterSection (pulse, time_minutes, beat_at_bbt_locked (_metrics, bbt), bbt, meter.divisions_per_bar(), meter.note_divisor(), pls, _frame_rate);
+ MeterSection* new_meter = new MeterSection (pulse, time_minutes, beat_at_bbt_locked (_metrics, bbt), bbt, meter.divisions_per_bar(), meter.note_divisor(), pls, _sample_rate);
bool solved = false;
@@ -1202,13 +1202,13 @@ TempoMap::add_meter_locked (const Meter& meter, const BBT_Time& bbt, framepos_t
if (recompute) {
if (pls == AudioTime) {
- /* now set the audio locked meter's position to frame */
- solved = solve_map_minute (_metrics, new_meter, minute_at_frame (frame));
- /* we failed, most likely due to some impossible frame requirement wrt audio-locked tempi.
- fudge frame so that the meter ends up at its BBT position instead.
+ /* now set the audio locked meter's position to sample */
+ solved = solve_map_minute (_metrics, new_meter, minute_at_sample (sample));
+ /* we failed, most likely due to some impossible sample requirement wrt audio-locked tempi.
+ fudge sample so that the meter ends up at its BBT position instead.
*/
if (!solved) {
- solved = solve_map_minute (_metrics, new_meter, minute_at_frame (prev_m.frame() + 1));
+ solved = solve_map_minute (_metrics, new_meter, minute_at_sample (prev_m.sample() + 1));
}
} else {
solved = solve_map_bbt (_metrics, new_meter, bbt);
@@ -1254,7 +1254,7 @@ TempoMap::change_initial_tempo (double note_types_per_minute, double note_type,
}
void
-TempoMap::change_existing_tempo_at (framepos_t where, double note_types_per_minute, double note_type, double end_ntpm)
+TempoMap::change_existing_tempo_at (samplepos_t where, double note_types_per_minute, double note_type, double end_ntpm)
{
Tempo newtempo (note_types_per_minute, note_type, end_ntpm);
@@ -1267,7 +1267,7 @@ TempoMap::change_existing_tempo_at (framepos_t where, double note_types_per_minu
for (first = 0, i = _metrics.begin(), prev = 0; i != _metrics.end(); ++i) {
- if ((*i)->frame() > where) {
+ if ((*i)->sample() > where) {
break;
}
@@ -1426,7 +1426,7 @@ TempoMap::recompute_tempi (Metrics& metrics)
/* tempos must be positioned correctly.
the current approach is to use a meter's bbt time as its base position unit.
an audio-locked meter requires a recomputation of pulse and beat (but not bbt),
- while a music-locked meter requires recomputations of frame pulse and beat (but not bbt)
+ while a music-locked meter requires recomputations of sample pulse and beat (but not bbt)
*/
void
TempoMap::recompute_meters (Metrics& metrics)
@@ -1445,7 +1445,7 @@ TempoMap::recompute_meters (Metrics& metrics)
TempoSection* t;
if ((*ii)->is_tempo()) {
t = static_cast<TempoSection*> (*ii);
- if (t->locked_to_meter() && t->frame() == meter->frame()) {
+ if (t->locked_to_meter() && t->sample() == meter->sample()) {
meter_locked_tempo = t;
break;
}
@@ -1506,7 +1506,7 @@ TempoMap::recompute_meters (Metrics& metrics)
}
void
-TempoMap::recompute_map (Metrics& metrics, framepos_t end)
+TempoMap::recompute_map (Metrics& metrics, samplepos_t end)
{
/* CALLER MUST HOLD WRITE LOCK */
@@ -1523,7 +1523,7 @@ TempoMap::recompute_map (Metrics& metrics, framepos_t end)
}
TempoMetric
-TempoMap::metric_at (framepos_t frame, Metrics::const_iterator* last) const
+TempoMap::metric_at (samplepos_t sample, Metrics::const_iterator* last) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
TempoMetric m (first_meter(), first_tempo());
@@ -1541,7 +1541,7 @@ TempoMap::metric_at (framepos_t frame, Metrics::const_iterator* last) const
for (Metrics::const_iterator i = _metrics.begin(); i != _metrics.end(); ++i) {
- if ((*i)->frame() > frame) {
+ if ((*i)->sample() > sample) {
break;
}
@@ -1586,21 +1586,21 @@ TempoMap::metric_at (BBT_Time bbt) const
return m;
}
-/** Returns the BBT (meter-based) beat corresponding to the supplied frame, possibly returning a negative value.
- * @param frame The session frame position.
- * @return The beat duration according to the tempo map at the supplied frame.
+/** Returns the BBT (meter-based) beat corresponding to the supplied sample, possibly returning a negative value.
+ * @param sample The session sample position.
+ * @return The beat duration according to the tempo map at the supplied sample.
*
- * If the supplied frame lies before the first meter, the returned beat duration will be negative.
+ * If the supplied sample lies before the first meter, the returned beat duration will be negative.
* The returned beat is obtained using the first meter and the continuation of the tempo curve (backwards).
*
* This function uses both tempo and meter.
*/
double
-TempoMap::beat_at_frame (const framecnt_t frame) const
+TempoMap::beat_at_sample (const samplecnt_t sample) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return beat_at_minute_locked (_metrics, minute_at_frame (frame));
+ return beat_at_minute_locked (_metrics, minute_at_sample (sample));
}
/* This function uses both tempo and meter.*/
@@ -1631,18 +1631,18 @@ TempoMap::beat_at_minute_locked (const Metrics& metrics, const double& minute) c
return beat;
}
-/** Returns the frame corresponding to the supplied BBT (meter-based) beat.
+/** Returns the sample corresponding to the supplied BBT (meter-based) beat.
* @param beat The BBT (meter-based) beat.
- * @return The frame duration according to the tempo map at the supplied BBT (meter-based) beat.
+ * @return The sample duration according to the tempo map at the supplied BBT (meter-based) beat.
*
* This function uses both tempo and meter.
*/
-framepos_t
-TempoMap::frame_at_beat (const double& beat) const
+samplepos_t
+TempoMap::sample_at_beat (const double& beat) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return frame_at_minute (minute_at_beat_locked (_metrics, beat));
+ return sample_at_minute (minute_at_beat_locked (_metrics, beat));
}
/* meter & tempo section based */
@@ -1687,17 +1687,17 @@ TempoMap::minute_at_beat_locked (const Metrics& metrics, const double& beat) con
return prev_t->minute_at_pulse (((beat - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse());
}
-/** Returns a Tempo corresponding to the supplied frame position.
- * @param frame The audio frame.
- * @return a Tempo according to the tempo map at the supplied frame.
+/** Returns a Tempo corresponding to the supplied sample position.
+ * @param sample The audio sample.
+ * @return a Tempo according to the tempo map at the supplied sample.
*
*/
Tempo
-TempoMap::tempo_at_frame (const framepos_t frame) const
+TempoMap::tempo_at_sample (const samplepos_t sample) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return tempo_at_minute_locked (_metrics, minute_at_frame (frame));
+ return tempo_at_minute_locked (_metrics, minute_at_sample (sample));
}
Tempo
@@ -1714,7 +1714,7 @@ TempoMap::tempo_at_minute_locked (const Metrics& metrics, const double& minute)
continue;
}
if ((prev_t) && t->minute() > minute) {
- /* t is the section past frame */
+ /* t is the section past sample */
return prev_t->tempo_at_minute (minute);
}
prev_t = t;
@@ -1724,17 +1724,17 @@ TempoMap::tempo_at_minute_locked (const Metrics& metrics, const double& minute)
return Tempo (prev_t->note_types_per_minute(), prev_t->note_type(), prev_t->end_note_types_per_minute());
}
-/** returns the frame at which the supplied tempo occurs, or
- * the frame of the last tempo section (search exhausted)
+/** returns the sample at which the supplied tempo occurs, or
+ * the sample of the last tempo section (search exhausted)
* only the position of the first occurence will be returned
* (extend me)
*/
-framepos_t
-TempoMap::frame_at_tempo (const Tempo& tempo) const
+samplepos_t
+TempoMap::sample_at_tempo (const Tempo& tempo) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return frame_at_minute (minute_at_tempo_locked (_metrics, tempo));
+ return sample_at_minute (minute_at_tempo_locked (_metrics, tempo));
}
double
@@ -1791,7 +1791,7 @@ TempoMap::tempo_at_pulse_locked (const Metrics& metrics, const double& pulse) co
continue;
}
if ((prev_t) && t->pulse() > pulse) {
- /* t is the section past frame */
+ /* t is the section past sample */
return prev_t->tempo_at_pulse (pulse);
}
prev_t = t;
@@ -1924,7 +1924,7 @@ TempoMap::pulse_at_minute_locked (const Metrics& metrics, const double& minute)
continue;
}
if (prev_t && t->minute() > minute) {
- /*the previous ts is the one containing the frame */
+ /*the previous ts is the one containing the sample */
const double ret = prev_t->pulse_at_minute (minute);
/* audio locked section in new meter*/
if (t->pulse() < ret) {
@@ -2219,26 +2219,26 @@ TempoMap::bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) cons
return ret;
}
-/** Returns the BBT time corresponding to the supplied frame position.
- * @param frame the position in audio samples.
- * @return the BBT time at the frame position .
+/** Returns the BBT time corresponding to the supplied sample position.
+ * @param sample the position in audio samples.
+ * @return the BBT time at the sample position .
*
*/
BBT_Time
-TempoMap::bbt_at_frame (framepos_t frame)
+TempoMap::bbt_at_sample (samplepos_t sample)
{
- if (frame < 0) {
+ if (sample < 0) {
BBT_Time bbt;
bbt.bars = 1;
bbt.beats = 1;
bbt.ticks = 0;
#ifndef NDEBUG
- warning << string_compose (_("tempo map was asked for BBT time at frame %1\n"), frame) << endmsg;
+ warning << string_compose (_("tempo map was asked for BBT time at sample %1\n"), sample) << endmsg;
#endif
return bbt;
}
- const double minute = minute_at_frame (frame);
+ const double minute = minute_at_sample (sample);
Glib::Threads::RWLock::ReaderLock lm (lock);
@@ -2246,14 +2246,14 @@ TempoMap::bbt_at_frame (framepos_t frame)
}
BBT_Time
-TempoMap::bbt_at_frame_rt (framepos_t frame)
+TempoMap::bbt_at_sample_rt (samplepos_t sample)
{
- const double minute = minute_at_frame (frame);
+ const double minute = minute_at_sample (sample);
Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
- throw std::logic_error ("TempoMap::bbt_at_frame_rt() could not lock tempo map");
+ throw std::logic_error ("TempoMap::bbt_at_sample_rt() could not lock tempo map");
}
return bbt_at_minute_locked (_metrics, minute);
@@ -2289,7 +2289,7 @@ TempoMap::bbt_at_minute_locked (const Metrics& metrics, const double& minute) co
double beat = prev_m->beat() + (ts.pulse_at_minute (minute) - prev_m->pulse()) * prev_m->note_divisor();
- /* handle frame before first meter */
+ /* handle sample before first meter */
if (minute < prev_m->minute()) {
beat = 0.0;
}
@@ -2329,17 +2329,17 @@ TempoMap::bbt_at_minute_locked (const Metrics& metrics, const double& minute) co
return ret;
}
-/** Returns the frame position corresponding to the supplied BBT time.
+/** Returns the sample position corresponding to the supplied BBT time.
* @param bbt the position in BBT time.
- * @return the frame position at bbt.
+ * @return the sample position at bbt.
*
*/
-framepos_t
-TempoMap::frame_at_bbt (const BBT_Time& bbt)
+samplepos_t
+TempoMap::sample_at_bbt (const BBT_Time& bbt)
{
if (bbt.bars < 1) {
#ifndef NDEBUG
- warning << string_compose (_("tempo map asked for frame time at bar < 1 (%1)\n"), bbt) << endmsg;
+ warning << string_compose (_("tempo map asked for sample time at bar < 1 (%1)\n"), bbt) << endmsg;
#endif
return 0;
}
@@ -2354,7 +2354,7 @@ TempoMap::frame_at_bbt (const BBT_Time& bbt)
minute = minute_at_bbt_locked (_metrics, bbt);
}
- return frame_at_minute (minute);
+ return sample_at_minute (minute);
}
/* meter & tempo section based */
@@ -2368,16 +2368,16 @@ TempoMap::minute_at_bbt_locked (const Metrics& metrics, const BBT_Time& bbt) con
}
/**
- * Returns the quarter-note beat position corresponding to the supplied frame.
+ * Returns the quarter-note beat position corresponding to the supplied sample.
*
- * @param frame the position in frames.
- * @return The quarter-note position of the supplied frame. Ignores meter.
+ * @param sample the position in samples.
+ * @return The quarter-note position of the supplied sample. Ignores meter.
*
*/
double
-TempoMap::quarter_note_at_frame (const framepos_t frame) const
+TempoMap::quarter_note_at_sample (const samplepos_t sample) const
{
- const double minute = minute_at_frame (frame);
+ const double minute = minute_at_sample (sample);
Glib::Threads::RWLock::ReaderLock lm (lock);
@@ -2385,29 +2385,29 @@ TempoMap::quarter_note_at_frame (const framepos_t frame) const
}
double
-TempoMap::quarter_note_at_frame_rt (const framepos_t frame) const
+TempoMap::quarter_note_at_sample_rt (const samplepos_t sample) const
{
- const double minute = minute_at_frame (frame);
+ const double minute = minute_at_sample (sample);
Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
- throw std::logic_error ("TempoMap::quarter_note_at_frame_rt() could not lock tempo map");
+ throw std::logic_error ("TempoMap::quarter_note_at_sample_rt() could not lock tempo map");
}
return pulse_at_minute_locked (_metrics, minute) * 4.0;
}
/**
- * Returns the frame position corresponding to the supplied quarter-note beat.
+ * Returns the sample position corresponding to the supplied quarter-note beat.
*
* @param quarter_note the quarter-note position.
- * @return the frame position of the supplied quarter-note. Ignores meter.
+ * @return the sample position of the supplied quarter-note. Ignores meter.
*
*
*/
-framepos_t
-TempoMap::frame_at_quarter_note (const double quarter_note) const
+samplepos_t
+TempoMap::sample_at_quarter_note (const double quarter_note) const
{
double minute;
{
@@ -2416,7 +2416,7 @@ TempoMap::frame_at_quarter_note (const double quarter_note) const
minute = minute_at_pulse_locked (_metrics, quarter_note / 4.0);
}
- return frame_at_minute (minute);
+ return sample_at_minute (minute);
}
/** Returns the quarter-note beats corresponding to the supplied BBT (meter-based) beat.
@@ -2449,18 +2449,18 @@ TempoMap::beat_at_quarter_note (const double quarter_note) const
return beat_at_pulse_locked (_metrics, quarter_note / 4.0);
}
-/** Returns the duration in frames between two supplied quarter-note beat positions.
+/** Returns the duration in samples between two supplied quarter-note beat positions.
* @param start the first position in quarter-note beats.
* @param end the end position in quarter-note beats.
- * @return the frame distance ober the quarter-note beats duration.
+ * @return the sample distance ober the quarter-note beats duration.
*
* use this rather than e.g.
- * frame_at-quarter_note (end_beats) - frame_at_quarter_note (start_beats).
- * frames_between_quarter_notes() doesn't round to audio frames as an intermediate step,
+ * sample_at-quarter_note (end_beats) - sample_at_quarter_note (start_beats).
+ * samples_between_quarter_notes() doesn't round to audio samples as an intermediate step,
*
*/
-framecnt_t
-TempoMap::frames_between_quarter_notes (const double start, const double end) const
+samplecnt_t
+TempoMap::samples_between_quarter_notes (const double start, const double end) const
{
double minutes;
@@ -2469,7 +2469,7 @@ TempoMap::frames_between_quarter_notes (const double start, const double end) co
minutes = minutes_between_quarter_notes_locked (_metrics, start, end);
}
- return frame_at_minute (minutes);
+ return sample_at_minute (minutes);
}
double
@@ -2480,15 +2480,15 @@ TempoMap::minutes_between_quarter_notes_locked (const Metrics& metrics, const do
}
double
-TempoMap::quarter_notes_between_frames (const framecnt_t start, const framecnt_t end) const
+TempoMap::quarter_notes_between_samples (const samplecnt_t start, const samplecnt_t end) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return quarter_notes_between_frames_locked (_metrics, start, end);
+ return quarter_notes_between_samples_locked (_metrics, start, end);
}
double
-TempoMap::quarter_notes_between_frames_locked (const Metrics& metrics, const framecnt_t start, const framecnt_t end) const
+TempoMap::quarter_notes_between_samples_locked (const Metrics& metrics, const samplecnt_t start, const samplecnt_t end) const
{
const TempoSection* prev_t = 0;
@@ -2500,14 +2500,14 @@ TempoMap::quarter_notes_between_frames_locked (const Metrics& metrics, const fra
if (!t->active()) {
continue;
}
- if (prev_t && t->frame() > start) {
+ if (prev_t && t->sample() > start) {
break;
}
prev_t = t;
}
}
assert (prev_t);
- const double start_qn = prev_t->pulse_at_frame (start);
+ const double start_qn = prev_t->pulse_at_sample (start);
for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
TempoSection* t;
@@ -2517,13 +2517,13 @@ TempoMap::quarter_notes_between_frames_locked (const Metrics& metrics, const fra
if (!t->active()) {
continue;
}
- if (prev_t && t->frame() > end) {
+ if (prev_t && t->sample() > end) {
break;
}
prev_t = t;
}
}
- const double end_qn = prev_t->pulse_at_frame (end);
+ const double end_qn = prev_t->pulse_at_sample (end);
return (end_qn - start_qn) * 4.0;
}
@@ -2548,8 +2548,8 @@ TempoMap::check_solved (const Metrics& metrics) const
return false;
}
- /* precision check ensures tempo and frames align.*/
- if (t->frame() != frame_at_minute (prev_t->minute_at_ntpm (prev_t->end_note_types_per_minute(), t->pulse()))) {
+ /* precision check ensures tempo and samples align.*/
+ if (t->sample() != sample_at_minute (prev_t->minute_at_ntpm (prev_t->end_note_types_per_minute(), t->pulse()))) {
if (!t->locked_to_meter()) {
return false;
}
@@ -2569,11 +2569,11 @@ TempoMap::check_solved (const Metrics& metrics) const
if (!(*i)->is_tempo()) {
m = static_cast<MeterSection*> (*i);
if (prev_m && m->position_lock_style() == AudioTime) {
- const TempoSection* t = &tempo_section_at_minute_locked (metrics, minute_at_frame (m->frame() - 1));
- const framepos_t nascent_m_frame = frame_at_minute (t->minute_at_pulse (m->pulse()));
+ const TempoSection* t = &tempo_section_at_minute_locked (metrics, minute_at_sample (m->sample() - 1));
+ const samplepos_t nascent_m_sample = sample_at_minute (t->minute_at_pulse (m->pulse()));
/* Here we check that a preceding section of music doesn't overlap a subsequent one.
*/
- if (t && (nascent_m_frame > m->frame() || nascent_m_frame < 0)) {
+ if (t && (nascent_m_sample > m->sample() || nascent_m_sample < 0)) {
return false;
}
}
@@ -2587,7 +2587,7 @@ TempoMap::check_solved (const Metrics& metrics) const
}
bool
-TempoMap::set_active_tempi (const Metrics& metrics, const framepos_t frame)
+TempoMap::set_active_tempi (const Metrics& metrics, const samplepos_t sample)
{
for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
TempoSection* t;
@@ -2596,12 +2596,12 @@ TempoMap::set_active_tempi (const Metrics& metrics, const framepos_t frame)
if (t->locked_to_meter()) {
t->set_active (true);
} else if (t->position_lock_style() == AudioTime) {
- if (t->frame() < frame) {
+ if (t->sample() < sample) {
t->set_active (false);
t->set_pulse (-1.0);
- } else if (t->frame() > frame) {
+ } else if (t->sample() > sample) {
t->set_active (true);
- } else if (t->frame() == frame) {
+ } else if (t->sample() == sample) {
return false;
}
}
@@ -2651,7 +2651,7 @@ TempoMap::solve_map_minute (Metrics& imaginary, TempoSection* section, const dou
continue;
}
- if (t->frame() == frame_at_minute (minute)) {
+ if (t->sample() == sample_at_minute (minute)) {
return false;
}
@@ -2770,7 +2770,7 @@ TempoMap::solve_map_minute (Metrics& imaginary, MeterSection* section, const dou
if (section->initial()) {
/* lock the first tempo to our first meter */
- if (!set_active_tempi (imaginary, frame_at_minute (minute))) {
+ if (!set_active_tempi (imaginary, sample_at_minute (minute))) {
return false;
}
}
@@ -2781,7 +2781,7 @@ TempoMap::solve_map_minute (Metrics& imaginary, MeterSection* section, const dou
TempoSection* t;
if ((*ii)->is_tempo()) {
t = static_cast<TempoSection*> (*ii);
- if (t->locked_to_meter() && t->frame() == section->frame()) {
+ if (t->locked_to_meter() && t->sample() == section->sample()) {
meter_locked_tempo = t;
break;
}
@@ -2957,7 +2957,7 @@ TempoMap::solve_map_bbt (Metrics& imaginary, MeterSection* section, const BBT_Ti
TempoSection* t;
if ((*ii)->is_tempo()) {
t = static_cast<TempoSection*> (*ii);
- if (t->locked_to_meter() && t->frame() == m->frame()) {
+ if (t->locked_to_meter() && t->sample() == m->sample()) {
meter_locked_tempo = t;
break;
}
@@ -3122,17 +3122,17 @@ TempoMap::can_solve_bbt (TempoSection* ts, const BBT_Time& bbt)
}
/**
-* This is for a gui that needs to know the pulse or frame of a tempo section if it were to be moved to some bbt time,
+* This is for a gui that needs to know the pulse or sample of a tempo section if it were to be moved to some bbt time,
* taking any possible reordering as a consequence of this into account.
* @param section - the section to be altered
* @param bbt - the BBT time where the altered tempo will fall
-* @return returns - the position in pulses and frames (as a pair) where the new tempo section will lie.
+* @return returns - the position in pulses and samples (as a pair) where the new tempo section will lie.
*/
-pair<double, framepos_t>
+pair<double, samplepos_t>
TempoMap::predict_tempo_position (TempoSection* section, const BBT_Time& bbt)
{
Metrics future_map;
- pair<double, framepos_t> ret = make_pair (0.0, 0);
+ pair<double, samplepos_t> ret = make_pair (0.0, 0);
Glib::Threads::RWLock::ReaderLock lm (lock);
@@ -3146,10 +3146,10 @@ TempoMap::predict_tempo_position (TempoSection* section, const BBT_Time& bbt)
if (solve_map_pulse (future_map, tempo_copy, pulse_at_beat_locked (future_map, beat))) {
ret.first = tempo_copy->pulse();
- ret.second = tempo_copy->frame();
+ ret.second = tempo_copy->sample();
} else {
ret.first = section->pulse();
- ret.second = section->frame();
+ ret.second = section->sample();
}
Metrics::const_iterator d = future_map.begin();
@@ -3162,35 +3162,35 @@ TempoMap::predict_tempo_position (TempoSection* section, const BBT_Time& bbt)
/** moves a TempoSection to a specified position.
* @param ts - the section to be moved
- * @param frame - the new position in frames for the tempo
+ * @param sample - the new position in samples for the tempo
* @param sub_num - the snap division to use if using musical time.
*
- * if sub_num is non-zero, the frame position is used to calculate an exact
+ * if sub_num is non-zero, the sample position is used to calculate an exact
* musical position.
* sub_num | effect
* -1 | snap to bars (meter-based)
- * 0 | no snap - use audio frame for musical position
+ * 0 | no snap - use audio sample for musical position
* 1 | snap to meter-based (BBT) beat
* >1 | snap to quarter-note subdivision (i.e. 4 will snap to sixteenth notes)
*
* this follows the snap convention in the gui.
- * if sub_num is zero, the musical position will be taken from the supplied frame.
+ * if sub_num is zero, the musical position will be taken from the supplied sample.
*/
void
-TempoMap::gui_set_tempo_position (TempoSection* ts, const framepos_t frame, const int& sub_num)
+TempoMap::gui_set_tempo_position (TempoSection* ts, const samplepos_t sample, const int& sub_num)
{
Metrics future_map;
if (ts->position_lock_style() == MusicTime) {
{
- /* if we're snapping to a musical grid, set the pulse exactly instead of via the supplied frame. */
+ /* if we're snapping to a musical grid, set the pulse exactly instead of via the supplied sample. */
Glib::Threads::RWLock::WriterLock lm (lock);
TempoSection* tempo_copy = copy_metrics_and_point (_metrics, future_map, ts);
tempo_copy->set_position_lock_style (AudioTime);
- if (solve_map_minute (future_map, tempo_copy, minute_at_frame (frame))) {
- const double beat = exact_beat_at_frame_locked (future_map, frame, sub_num);
+ if (solve_map_minute (future_map, tempo_copy, minute_at_sample (sample))) {
+ const double beat = exact_beat_at_sample_locked (future_map, sample, sub_num);
const double pulse = pulse_at_beat_locked (future_map, beat);
if (solve_map_pulse (future_map, tempo_copy, pulse)) {
@@ -3209,12 +3209,12 @@ TempoMap::gui_set_tempo_position (TempoSection* ts, const framepos_t frame, cons
if (sub_num != 0) {
/* We're moving the object that defines the grid while snapping to it...
- * Placing the ts at the beat corresponding to the requested frame may shift the
+ * Placing the ts at the beat corresponding to the requested sample may shift the
* grid in such a way that the mouse is left hovering over a completerly different division,
* causing jittering when the mouse next moves (esp. large tempo deltas).
* We fudge around this by doing this in the musical domain and then swapping back for the recompute.
*/
- const double qn = exact_qn_at_frame_locked (_metrics, frame, sub_num);
+ const double qn = exact_qn_at_sample_locked (_metrics, sample, sub_num);
tempo_copy->set_position_lock_style (MusicTime);
if (solve_map_pulse (future_map, tempo_copy, qn / 4.0)) {
ts->set_position_lock_style (MusicTime);
@@ -3223,8 +3223,8 @@ TempoMap::gui_set_tempo_position (TempoSection* ts, const framepos_t frame, cons
recompute_meters (_metrics);
}
} else {
- if (solve_map_minute (future_map, tempo_copy, minute_at_frame (frame))) {
- solve_map_minute (_metrics, ts, minute_at_frame (frame));
+ if (solve_map_minute (future_map, tempo_copy, minute_at_sample (sample))) {
+ solve_map_minute (_metrics, ts, minute_at_sample (sample));
recompute_meters (_metrics);
}
}
@@ -3242,14 +3242,14 @@ TempoMap::gui_set_tempo_position (TempoSection* ts, const framepos_t frame, cons
/** moves a MeterSection to a specified position.
* @param ms - the section to be moved
- * @param frame - the new position in frames for the meter
+ * @param sample - the new position in samples for the meter
*
* as a meter cannot snap to anything but bars,
- * the supplied frame is rounded to the nearest bar, possibly
+ * the supplied sample is rounded to the nearest bar, possibly
* leaving the meter position unchanged.
*/
void
-TempoMap::gui_set_meter_position (MeterSection* ms, const framepos_t frame)
+TempoMap::gui_set_meter_position (MeterSection* ms, const samplepos_t sample)
{
Metrics future_map;
@@ -3259,8 +3259,8 @@ TempoMap::gui_set_meter_position (MeterSection* ms, const framepos_t frame)
Glib::Threads::RWLock::WriterLock lm (lock);
MeterSection* copy = copy_metrics_and_point (_metrics, future_map, ms);
- if (solve_map_minute (future_map, copy, minute_at_frame (frame))) {
- solve_map_minute (_metrics, ms, minute_at_frame (frame));
+ if (solve_map_minute (future_map, copy, minute_at_sample (sample))) {
+ solve_map_minute (_metrics, ms, minute_at_sample (sample));
recompute_tempi (_metrics);
}
}
@@ -3269,7 +3269,7 @@ TempoMap::gui_set_meter_position (MeterSection* ms, const framepos_t frame)
Glib::Threads::RWLock::WriterLock lm (lock);
MeterSection* copy = copy_metrics_and_point (_metrics, future_map, ms);
- const double beat = beat_at_minute_locked (_metrics, minute_at_frame (frame));
+ const double beat = beat_at_minute_locked (_metrics, minute_at_sample (sample));
const Timecode::BBT_Time bbt = bbt_at_beat_locked (_metrics, beat);
if (solve_map_bbt (future_map, copy, bbt)) {
@@ -3348,14 +3348,14 @@ TempoMap::gui_change_tempo (TempoSection* ts, const Tempo& bpm)
}
void
-TempoMap::gui_stretch_tempo (TempoSection* ts, const framepos_t frame, const framepos_t end_frame, const double start_qnote, const double end_qnote)
+TempoMap::gui_stretch_tempo (TempoSection* ts, const samplepos_t sample, const samplepos_t end_sample, const double start_qnote, const double end_qnote)
{
/*
Ts (future prev_t) Tnext
| |
| [drag^] |
|----------|----------
- e_f qn_beats(frame)
+ e_f qn_beats(sample)
*/
Metrics future_map;
@@ -3373,33 +3373,33 @@ TempoMap::gui_stretch_tempo (TempoSection* ts, const framepos_t frame, const fra
return;
}
- /* minimum allowed measurement distance in frames */
- framepos_t const min_dframe = 2;
+ /* minimum allowed measurement distance in samples */
+ samplepos_t const min_dframe = 2;
double new_bpm;
if (ts_copy->clamped()) {
TempoSection* next_t = next_tempo_section_locked (future_map, ts_copy);
TempoSection* prev_to_ts_copy = previous_tempo_section_locked (future_map, ts_copy);
- /* the change in frames is the result of changing the slope of at most 2 previous tempo sections.
+ /* the change in samples is the result of changing the slope of at most 2 previous tempo sections.
constant to constant is straightforward, as the tempo prev to ts_copy has constant slope.
*/ double contribution = 0.0;
if (next_t && prev_to_ts_copy && prev_to_ts_copy->type() == TempoSection::Ramp) {
contribution = (ts_copy->pulse() - prev_to_ts_copy->pulse()) / (double) (next_t->pulse() - prev_to_ts_copy->pulse());
}
- framepos_t const fr_off = end_frame - frame;
- frameoffset_t const ts_copy_frame_contribution = fr_off - (contribution * (double) fr_off);
+ samplepos_t const fr_off = end_sample - sample;
+ sampleoffset_t const ts_copy_sample_contribution = fr_off - (contribution * (double) fr_off);
- if (frame > prev_to_ts_copy->frame() + min_dframe && (frame + ts_copy_frame_contribution) > prev_to_ts_copy->frame() + min_dframe) {
+ if (sample > prev_to_ts_copy->sample() + min_dframe && (sample + ts_copy_sample_contribution) > prev_to_ts_copy->sample() + min_dframe) {
new_bpm = ts_copy->note_types_per_minute() * ((start_qnote - (prev_to_ts_copy->pulse() * 4.0))
/ (end_qnote - (prev_to_ts_copy->pulse() * 4.0)));
} else {
new_bpm = ts_copy->note_types_per_minute();
}
} else {
- if (frame > ts_copy->frame() + min_dframe && end_frame > ts_copy->frame() + min_dframe) {
+ if (sample > ts_copy->sample() + min_dframe && end_sample > ts_copy->sample() + min_dframe) {
- new_bpm = ts_copy->note_types_per_minute() * ((frame - ts_copy->frame())
- / (double) (end_frame - ts_copy->frame()));
+ new_bpm = ts_copy->note_types_per_minute() * ((sample - ts_copy->sample())
+ / (double) (end_sample - ts_copy->sample()));
} else {
new_bpm = ts_copy->note_types_per_minute();
}
@@ -3454,14 +3454,14 @@ out:
}
void
-TempoMap::gui_stretch_tempo_end (TempoSection* ts, const framepos_t frame, const framepos_t end_frame)
+TempoMap::gui_stretch_tempo_end (TempoSection* ts, const samplepos_t sample, const samplepos_t end_sample)
{
/*
Ts (future prev_t) Tnext
| |
| [drag^] |
|----------|----------
- e_f qn_beats(frame)
+ e_f qn_beats(sample)
*/
Metrics future_map;
@@ -3479,13 +3479,13 @@ TempoMap::gui_stretch_tempo_end (TempoSection* ts, const framepos_t frame, const
return;
}
- /* minimum allowed measurement distance in frames */
- framepos_t const min_dframe = 2;
+ /* minimum allowed measurement distance in samples */
+ samplepos_t const min_dframe = 2;
double new_bpm;
- if (frame > prev_t->frame() + min_dframe && end_frame > prev_t->frame() + min_dframe) {
- new_bpm = prev_t->end_note_types_per_minute() * ((prev_t->frame() - frame)
- / (double) (prev_t->frame() - end_frame));
+ if (sample > prev_t->sample() + min_dframe && end_sample > prev_t->sample() + min_dframe) {
+ new_bpm = prev_t->end_note_types_per_minute() * ((prev_t->sample() - sample)
+ / (double) (prev_t->sample() - end_sample));
} else {
new_bpm = prev_t->end_note_types_per_minute();
}
@@ -3535,15 +3535,15 @@ out:
}
bool
-TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const framepos_t frame, const framepos_t end_frame)
+TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const samplepos_t sample, const samplepos_t end_sample)
{
TempoSection* next_t = 0;
TempoSection* next_to_next_t = 0;
Metrics future_map;
bool can_solve = false;
- /* minimum allowed measurement distance in frames */
- framepos_t const min_dframe = 2;
+ /* minimum allowed measurement distance in samples */
+ samplepos_t const min_dframe = 2;
{
Glib::Threads::RWLock::WriterLock lm (lock);
@@ -3553,14 +3553,14 @@ TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const framepos_t
TempoSection* tempo_copy = copy_metrics_and_point (_metrics, future_map, ts);
TempoSection* prev_to_prev_t = 0;
- const frameoffset_t fr_off = end_frame - frame;
+ const sampleoffset_t fr_off = end_sample - sample;
if (!tempo_copy) {
return false;
}
if (tempo_copy->pulse() > 0.0) {
- prev_to_prev_t = const_cast<TempoSection*>(&tempo_section_at_minute_locked (future_map, minute_at_frame (tempo_copy->frame() - 1)));
+ prev_to_prev_t = const_cast<TempoSection*>(&tempo_section_at_minute_locked (future_map, minute_at_sample (tempo_copy->sample() - 1)));
}
for (Metrics::const_iterator i = future_map.begin(); i != future_map.end(); ++i) {
@@ -3588,13 +3588,13 @@ TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const framepos_t
double prev_contribution = 0.0;
if (next_t && prev_to_prev_t && prev_to_prev_t->type() == TempoSection::Ramp) {
- prev_contribution = (tempo_copy->frame() - prev_to_prev_t->frame()) / (double) (next_t->frame() - prev_to_prev_t->frame());
+ prev_contribution = (tempo_copy->sample() - prev_to_prev_t->sample()) / (double) (next_t->sample() - prev_to_prev_t->sample());
}
- const frameoffset_t tempo_copy_frame_contribution = fr_off - (prev_contribution * (double) fr_off);
+ const sampleoffset_t tempo_copy_sample_contribution = fr_off - (prev_contribution * (double) fr_off);
- framepos_t old_tc_minute = tempo_copy->minute();
+ samplepos_t old_tc_minute = tempo_copy->minute();
double old_next_minute = next_t->minute();
double old_next_to_next_minute = next_to_next_t->minute();
@@ -3602,9 +3602,9 @@ TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const framepos_t
double new_next_bpm;
double new_copy_end_bpm;
- if (frame > tempo_copy->frame() + min_dframe && (frame + tempo_copy_frame_contribution) > tempo_copy->frame() + min_dframe) {
- new_bpm = tempo_copy->note_types_per_minute() * ((frame - tempo_copy->frame())
- / (double) (end_frame - tempo_copy->frame()));
+ if (sample > tempo_copy->sample() + min_dframe && (sample + tempo_copy_sample_contribution) > tempo_copy->sample() + min_dframe) {
+ new_bpm = tempo_copy->note_types_per_minute() * ((sample - tempo_copy->sample())
+ / (double) (end_sample - tempo_copy->sample()));
} else {
new_bpm = tempo_copy->note_types_per_minute();
}
@@ -3643,7 +3643,7 @@ TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const framepos_t
}
if (next_t->type() == TempoSection::Constant || next_t->c() == 0.0) {
- if (frame > tempo_copy->frame() + min_dframe && end_frame > tempo_copy->frame() + min_dframe) {
+ if (sample > tempo_copy->sample() + min_dframe && end_sample > tempo_copy->sample() + min_dframe) {
new_next_bpm = next_t->note_types_per_minute() * ((next_to_next_t->minute() - old_next_minute)
/ (double) ((old_next_to_next_minute) - old_next_minute));
@@ -3671,17 +3671,17 @@ TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const framepos_t
can_solve = true;
}
} else {
- double next_frame_ratio = 1.0;
- double copy_frame_ratio = 1.0;
+ double next_sample_ratio = 1.0;
+ double copy_sample_ratio = 1.0;
if (next_to_next_t) {
- next_frame_ratio = (next_to_next_t->minute() - old_next_minute) / (old_next_to_next_minute - old_next_minute);
+ next_sample_ratio = (next_to_next_t->minute() - old_next_minute) / (old_next_to_next_minute - old_next_minute);
- copy_frame_ratio = ((old_tc_minute - next_t->minute()) / (double) (old_tc_minute - old_next_minute));
+ copy_sample_ratio = ((old_tc_minute - next_t->minute()) / (double) (old_tc_minute - old_next_minute));
}
- new_next_bpm = next_t->note_types_per_minute() * next_frame_ratio;
- new_copy_end_bpm = tempo_copy->end_note_types_per_minute() * copy_frame_ratio;
+ new_next_bpm = next_t->note_types_per_minute() * next_sample_ratio;
+ new_copy_end_bpm = tempo_copy->end_note_types_per_minute() * copy_sample_ratio;
tempo_copy->set_end_note_types_per_minute (new_copy_end_bpm);
@@ -3729,24 +3729,24 @@ TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const framepos_t
return can_solve;
}
-/** Returns the frame position of the musical position zero */
-framepos_t
+/** Returns the sample position of the musical position zero */
+samplepos_t
TempoMap::music_origin ()
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return first_tempo().frame();
+ return first_tempo().sample();
}
/** Returns the exact bbt-based beat corresponding to the bar, beat or quarter note subdivision nearest to
- * the supplied frame, possibly returning a negative value.
+ * the supplied sample, possibly returning a negative value.
*
- * @param frame The session frame position.
+ * @param sample The session sample position.
* @param sub_num The subdivision to use when rounding the beat.
* A value of -1 indicates rounding to BBT bar. 1 indicates rounding to BBT beats.
* Positive integers indicate quarter note (non BBT) divisions.
- * 0 indicates that the returned beat should not be rounded (equivalent to quarter_note_at_frame()).
- * @return The beat position of the supplied frame.
+ * 0 indicates that the returned beat should not be rounded (equivalent to quarter_note_at_sample()).
+ * @return The beat position of the supplied sample.
*
* when working to a musical grid, the use of sub_nom indicates that
* the position should be interpreted musically.
@@ -3754,66 +3754,66 @@ TempoMap::music_origin ()
* it effectively snaps to meter bars, meter beats or quarter note divisions
* (as per current gui convention) and returns a musical position independent of frame rate.
*
- * If the supplied frame lies before the first meter, the return will be negative,
+ * If the supplied sample lies before the first meter, the return will be negative,
* in which case the returned beat uses the first meter (for BBT subdivisions) and
* the continuation of the tempo curve (backwards).
*
* This function is sensitive to tempo and meter.
*/
double
-TempoMap::exact_beat_at_frame (const framepos_t frame, const int32_t sub_num) const
+TempoMap::exact_beat_at_sample (const samplepos_t sample, const int32_t sub_num) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return exact_beat_at_frame_locked (_metrics, frame, sub_num);
+ return exact_beat_at_sample_locked (_metrics, sample, sub_num);
}
double
-TempoMap::exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t divisions) const
+TempoMap::exact_beat_at_sample_locked (const Metrics& metrics, const samplepos_t sample, const int32_t divisions) const
{
- return beat_at_pulse_locked (_metrics, exact_qn_at_frame_locked (metrics, frame, divisions) / 4.0);
+ return beat_at_pulse_locked (_metrics, exact_qn_at_sample_locked (metrics, sample, divisions) / 4.0);
}
/** Returns the exact quarter note corresponding to the bar, beat or quarter note subdivision nearest to
- * the supplied frame, possibly returning a negative value.
+ * the supplied sample, possibly returning a negative value.
*
- * @param frame The session frame position.
+ * @param sample The session sample position.
* @param sub_num The subdivision to use when rounding the quarter note.
* A value of -1 indicates rounding to BBT bar. 1 indicates rounding to BBT beats.
* Positive integers indicate quarter note (non BBT) divisions.
- * 0 indicates that the returned quarter note should not be rounded (equivalent to quarter_note_at_frame()).
- * @return The quarter note position of the supplied frame.
+ * 0 indicates that the returned quarter note should not be rounded (equivalent to quarter_note_at_sample()).
+ * @return The quarter note position of the supplied sample.
*
* When working to a musical grid, the use of sub_nom indicates that
- * the frame position should be interpreted musically.
+ * the sample position should be interpreted musically.
*
* it effectively snaps to meter bars, meter beats or quarter note divisions
* (as per current gui convention) and returns a musical position independent of frame rate.
*
- * If the supplied frame lies before the first meter, the return will be negative,
+ * If the supplied sample lies before the first meter, the return will be negative,
* in which case the returned quarter note uses the first meter (for BBT subdivisions) and
* the continuation of the tempo curve (backwards).
*
* This function is tempo-sensitive.
*/
double
-TempoMap::exact_qn_at_frame (const framepos_t frame, const int32_t sub_num) const
+TempoMap::exact_qn_at_sample (const samplepos_t sample, const int32_t sub_num) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return exact_qn_at_frame_locked (_metrics, frame, sub_num);
+ return exact_qn_at_sample_locked (_metrics, sample, sub_num);
}
double
-TempoMap::exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t sub_num) const
+TempoMap::exact_qn_at_sample_locked (const Metrics& metrics, const samplepos_t sample, const int32_t sub_num) const
{
- double qn = pulse_at_minute_locked (metrics, minute_at_frame (frame)) * 4.0;
+ double qn = pulse_at_minute_locked (metrics, minute_at_sample (sample)) * 4.0;
if (sub_num > 1) {
qn = floor (qn) + (floor (((qn - floor (qn)) * (double) sub_num) + 0.5) / sub_num);
} else if (sub_num == 1) {
/* the gui requested exact musical (BBT) beat */
- qn = pulse_at_beat_locked (metrics, (floor (beat_at_minute_locked (metrics, minute_at_frame (frame)) + 0.5))) * 4.0;
+ qn = pulse_at_beat_locked (metrics, (floor (beat_at_minute_locked (metrics, minute_at_sample (sample)) + 0.5))) * 4.0;
} else if (sub_num == -1) {
/* snap to bar */
Timecode::BBT_Time bbt = bbt_at_pulse_locked (metrics, qn / 4.0);
@@ -3834,20 +3834,20 @@ TempoMap::exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t fra
return qn;
}
-/** returns the frame duration of the supplied BBT time at a specified frame position in the tempo map.
- * @param pos the frame position in the tempo map.
+/** returns the sample duration of the supplied BBT time at a specified sample position in the tempo map.
+ * @param pos the sample position in the tempo map.
* @param bbt the distance in BBT time from pos to calculate.
* @param dir the rounding direction..
- * @return the duration in frames between pos and bbt
+ * @return the duration in samples between pos and bbt
*/
-framecnt_t
-TempoMap::bbt_duration_at (framepos_t pos, const BBT_Time& bbt, int dir)
+samplecnt_t
+TempoMap::bbt_duration_at (samplepos_t pos, const BBT_Time& bbt, int dir)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- BBT_Time pos_bbt = bbt_at_minute_locked (_metrics, minute_at_frame (pos));
+ BBT_Time pos_bbt = bbt_at_minute_locked (_metrics, minute_at_sample (pos));
- const double divisions = meter_section_at_minute_locked (_metrics, minute_at_frame (pos)).divisions_per_bar();
+ const double divisions = meter_section_at_minute_locked (_metrics, minute_at_sample (pos)).divisions_per_bar();
if (dir > 0) {
pos_bbt.bars += bbt.bars;
@@ -3863,9 +3863,9 @@ TempoMap::bbt_duration_at (framepos_t pos, const BBT_Time& bbt, int dir)
pos_bbt.bars += 1;
pos_bbt.beats -= divisions;
}
- const framecnt_t pos_bbt_frame = frame_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
+ const samplecnt_t pos_bbt_sample = sample_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
- return pos_bbt_frame - pos;
+ return pos_bbt_sample - pos;
} else {
@@ -3903,29 +3903,29 @@ TempoMap::bbt_duration_at (framepos_t pos, const BBT_Time& bbt, int dir)
pos_bbt.beats -= bbt.beats;
}
- return pos - frame_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
+ return pos - sample_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
}
return 0;
}
-MusicFrame
-TempoMap::round_to_bar (framepos_t fr, RoundMode dir)
+MusicSample
+TempoMap::round_to_bar (samplepos_t fr, RoundMode dir)
{
return round_to_type (fr, dir, Bar);
}
-MusicFrame
-TempoMap::round_to_beat (framepos_t fr, RoundMode dir)
+MusicSample
+TempoMap::round_to_beat (samplepos_t fr, RoundMode dir)
{
return round_to_type (fr, dir, Beat);
}
-MusicFrame
-TempoMap::round_to_quarter_note_subdivision (framepos_t fr, int sub_num, RoundMode dir)
+MusicSample
+TempoMap::round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundMode dir)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- uint32_t ticks = (uint32_t) floor (max (0.0, pulse_at_minute_locked (_metrics, minute_at_frame (fr))) * BBT_Time::ticks_per_beat * 4.0);
+ uint32_t ticks = (uint32_t) floor (max (0.0, pulse_at_minute_locked (_metrics, minute_at_sample (fr))) * BBT_Time::ticks_per_beat * 4.0);
uint32_t beats = (uint32_t) floor (ticks / BBT_Time::ticks_per_beat);
uint32_t ticks_one_subdivisions_worth = (uint32_t) BBT_Time::ticks_per_beat / sub_num;
@@ -4002,7 +4002,7 @@ TempoMap::round_to_quarter_note_subdivision (framepos_t fr, int sub_num, RoundMo
if (rem > ticks) {
if (beats == 0) {
/* can't go backwards past zero, so ... */
- return MusicFrame (0, 0);
+ return MusicSample (0, 0);
}
/* step back to previous beat */
--beats;
@@ -4017,62 +4017,62 @@ TempoMap::round_to_quarter_note_subdivision (framepos_t fr, int sub_num, RoundMo
}
}
- MusicFrame ret (0, 0);
- ret.frame = frame_at_minute (minute_at_pulse_locked (_metrics, (beats + (ticks / BBT_Time::ticks_per_beat)) / 4.0));
+ MusicSample ret (0, 0);
+ ret.sample = sample_at_minute (minute_at_pulse_locked (_metrics, (beats + (ticks / BBT_Time::ticks_per_beat)) / 4.0));
ret.division = sub_num;
return ret;
}
-MusicFrame
-TempoMap::round_to_type (framepos_t frame, RoundMode dir, BBTPointType type)
+MusicSample
+TempoMap::round_to_type (samplepos_t sample, RoundMode dir, BBTPointType type)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- const double minute = minute_at_frame (frame);
- const double beat_at_framepos = max (0.0, beat_at_minute_locked (_metrics, minute));
- BBT_Time bbt (bbt_at_beat_locked (_metrics, beat_at_framepos));
- MusicFrame ret (0, 0);
+ const double minute = minute_at_sample (sample);
+ const double beat_at_samplepos = max (0.0, beat_at_minute_locked (_metrics, minute));
+ BBT_Time bbt (bbt_at_beat_locked (_metrics, beat_at_samplepos));
+ MusicSample ret (0, 0);
switch (type) {
case Bar:
ret.division = -1;
if (dir < 0) {
- /* find bar previous to 'frame' */
+ /* find bar previous to 'sample' */
if (bbt.bars > 0)
--bbt.bars;
bbt.beats = 1;
bbt.ticks = 0;
- ret.frame = frame_at_minute (minute_at_bbt_locked (_metrics, bbt));
+ ret.sample = sample_at_minute (minute_at_bbt_locked (_metrics, bbt));
return ret;
} else if (dir > 0) {
- /* find bar following 'frame' */
+ /* find bar following 'sample' */
++bbt.bars;
bbt.beats = 1;
bbt.ticks = 0;
- ret.frame = frame_at_minute (minute_at_bbt_locked (_metrics, bbt));
+ ret.sample = sample_at_minute (minute_at_bbt_locked (_metrics, bbt));
return ret;
} else {
/* true rounding: find nearest bar */
- framepos_t raw_ft = frame_at_minute (minute_at_bbt_locked (_metrics, bbt));
+ samplepos_t raw_ft = sample_at_minute (minute_at_bbt_locked (_metrics, bbt));
bbt.beats = 1;
bbt.ticks = 0;
- framepos_t prev_ft = frame_at_minute (minute_at_bbt_locked (_metrics, bbt));
+ samplepos_t prev_ft = sample_at_minute (minute_at_bbt_locked (_metrics, bbt));
++bbt.bars;
- framepos_t next_ft = frame_at_minute (minute_at_bbt_locked (_metrics, bbt));
+ samplepos_t next_ft = sample_at_minute (minute_at_bbt_locked (_metrics, bbt));
if ((raw_ft - prev_ft) > (next_ft - prev_ft) / 2) {
- ret.frame = next_ft;
+ ret.sample = next_ft;
return ret;
} else {
--bbt.bars;
- ret.frame = prev_ft;
+ ret.sample = prev_ft;
return ret;
}
@@ -4084,51 +4084,51 @@ TempoMap::round_to_type (framepos_t frame, RoundMode dir, BBTPointType type)
ret.division = 1;
if (dir < 0) {
- ret.frame = frame_at_minute (minute_at_beat_locked (_metrics, floor (beat_at_framepos)));
+ ret.sample = sample_at_minute (minute_at_beat_locked (_metrics, floor (beat_at_samplepos)));
return ret;
} else if (dir > 0) {
- ret.frame = frame_at_minute (minute_at_beat_locked (_metrics, ceil (beat_at_framepos)));
+ ret.sample = sample_at_minute (minute_at_beat_locked (_metrics, ceil (beat_at_samplepos)));
return ret;
} else {
- ret.frame = frame_at_minute (minute_at_beat_locked (_metrics, floor (beat_at_framepos + 0.5)));
+ ret.sample = sample_at_minute (minute_at_beat_locked (_metrics, floor (beat_at_samplepos + 0.5)));
return ret;
}
break;
}
- return MusicFrame (0, 0);
+ return MusicSample (0, 0);
}
void
TempoMap::get_grid (vector<TempoMap::BBTPoint>& points,
- framepos_t lower, framepos_t upper, uint32_t bar_mod)
+ samplepos_t lower, samplepos_t upper, uint32_t bar_mod)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- int32_t cnt = ceil (beat_at_minute_locked (_metrics, minute_at_frame (lower)));
- framecnt_t pos = 0;
+ int32_t cnt = ceil (beat_at_minute_locked (_metrics, minute_at_sample (lower)));
+ samplecnt_t pos = 0;
/* although the map handles negative beats, bbt doesn't. */
if (cnt < 0.0) {
cnt = 0.0;
}
- if (minute_at_beat_locked (_metrics, cnt) >= minute_at_frame (upper)) {
+ if (minute_at_beat_locked (_metrics, cnt) >= minute_at_sample (upper)) {
return;
}
if (bar_mod == 0) {
while (pos >= 0 && pos < upper) {
- pos = frame_at_minute (minute_at_beat_locked (_metrics, cnt));
- const MeterSection meter = meter_section_at_minute_locked (_metrics, minute_at_frame (pos));
+ pos = sample_at_minute (minute_at_beat_locked (_metrics, cnt));
+ const MeterSection meter = meter_section_at_minute_locked (_metrics, minute_at_sample (pos));
const BBT_Time bbt = bbt_at_beat_locked (_metrics, cnt);
const double qn = pulse_at_beat_locked (_metrics, cnt) * 4.0;
- points.push_back (BBTPoint (meter, tempo_at_minute_locked (_metrics, minute_at_frame (pos)), pos, bbt.bars, bbt.beats, qn));
+ points.push_back (BBTPoint (meter, tempo_at_minute_locked (_metrics, minute_at_sample (pos)), pos, bbt.bars, bbt.beats, qn));
++cnt;
}
} else {
- BBT_Time bbt = bbt_at_minute_locked (_metrics, minute_at_frame (lower));
+ BBT_Time bbt = bbt_at_minute_locked (_metrics, minute_at_sample (lower));
bbt.beats = 1;
bbt.ticks = 0;
@@ -4138,30 +4138,30 @@ TempoMap::get_grid (vector<TempoMap::BBTPoint>& points,
}
while (pos >= 0 && pos < upper) {
- pos = frame_at_minute (minute_at_bbt_locked (_metrics, bbt));
- const MeterSection meter = meter_section_at_minute_locked (_metrics, minute_at_frame (pos));
+ pos = sample_at_minute (minute_at_bbt_locked (_metrics, bbt));
+ const MeterSection meter = meter_section_at_minute_locked (_metrics, minute_at_sample (pos));
const double qn = pulse_at_bbt_locked (_metrics, bbt) * 4.0;
- points.push_back (BBTPoint (meter, tempo_at_minute_locked (_metrics, minute_at_frame (pos)), pos, bbt.bars, bbt.beats, qn));
+ points.push_back (BBTPoint (meter, tempo_at_minute_locked (_metrics, minute_at_sample (pos)), pos, bbt.bars, bbt.beats, qn));
bbt.bars += bar_mod;
}
}
}
const TempoSection&
-TempoMap::tempo_section_at_frame (framepos_t frame) const
+TempoMap::tempo_section_at_sample (samplepos_t sample) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return tempo_section_at_minute_locked (_metrics, minute_at_frame (frame));
+ return tempo_section_at_minute_locked (_metrics, minute_at_sample (sample));
}
TempoSection&
-TempoMap::tempo_section_at_frame (framepos_t frame)
+TempoMap::tempo_section_at_sample (samplepos_t sample)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return tempo_section_at_minute_locked (_metrics, minute_at_frame (frame));
+ return tempo_section_at_minute_locked (_metrics, minute_at_sample (sample));
}
const TempoSection&
@@ -4334,11 +4334,11 @@ TempoMap::next_tempo_section_locked (const Metrics& metrics, TempoSection* ts) c
return 0;
}
-/* don't use this to calculate length (the tempo is only correct for this frame).
- do that stuff based on the beat_at_frame and frame_at_beat api
+/* don't use this to calculate length (the tempo is only correct for this sample).
+ do that stuff based on the beat_at_sample and sample_at_beat api
*/
double
-TempoMap::frames_per_quarter_note_at (const framepos_t frame, const framecnt_t sr) const
+TempoMap::samples_per_quarter_note_at (const samplepos_t sample, const samplecnt_t sr) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
@@ -4354,7 +4354,7 @@ TempoMap::frames_per_quarter_note_at (const framepos_t frame, const framecnt_t s
if (!t->active()) {
continue;
}
- if (ts_at && (*i)->frame() > frame) {
+ if (ts_at && (*i)->sample() > sample) {
ts_after = t;
break;
}
@@ -4364,17 +4364,17 @@ TempoMap::frames_per_quarter_note_at (const framepos_t frame, const framecnt_t s
assert (ts_at);
if (ts_after) {
- return (60.0 * _frame_rate) / ts_at->tempo_at_minute (minute_at_frame (frame)).quarter_notes_per_minute();
+ return (60.0 * _sample_rate) / ts_at->tempo_at_minute (minute_at_sample (sample)).quarter_notes_per_minute();
}
/* must be treated as constant tempo */
- return ts_at->frames_per_quarter_note (_frame_rate);
+ return ts_at->samples_per_quarter_note (_sample_rate);
}
const MeterSection&
-TempoMap::meter_section_at_frame (framepos_t frame) const
+TempoMap::meter_section_at_sample (samplepos_t sample) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return meter_section_at_minute_locked (_metrics, minute_at_frame (frame));
+ return meter_section_at_minute_locked (_metrics, minute_at_sample (sample));
}
const MeterSection&
@@ -4433,9 +4433,9 @@ TempoMap::meter_section_at_beat (double beat) const
}
const Meter&
-TempoMap::meter_at_frame (framepos_t frame) const
+TempoMap::meter_at_sample (samplepos_t sample) const
{
- TempoMetric m (metric_at (frame));
+ TempoMetric m (metric_at (sample));
return m.meter();
}
@@ -4578,7 +4578,7 @@ TempoMap::set_state (const XMLNode& node, int /*version*/)
if (child->name() == TempoSection::xml_state_node_name) {
try {
- TempoSection* ts = new TempoSection (*child, _frame_rate);
+ TempoSection* ts = new TempoSection (*child, _sample_rate);
_metrics.push_back (ts);
}
@@ -4592,7 +4592,7 @@ TempoMap::set_state (const XMLNode& node, int /*version*/)
} else if (child->name() == MeterSection::xml_state_node_name) {
try {
- MeterSection* ms = new MeterSection (*child, _frame_rate);
+ MeterSection* ms = new MeterSection (*child, _sample_rate);
_metrics.push_back (ms);
}
@@ -4682,23 +4682,23 @@ TempoMap::dump (std::ostream& o) const
if ((t = dynamic_cast<const TempoSection*>(*i)) != 0) {
o << "Tempo @ " << *i << " start : " << t->note_types_per_minute() << " end : " << t->end_note_types_per_minute() << " BPM (pulse = 1/" << t->note_type()
<< " type= " << enum_2_string (t->type()) << ") " << " at pulse= " << t->pulse()
- << " minute= " << t->minute() << " frame= " << t->frame() << " (initial? " << t->initial() << ')'
+ << " minute= " << t->minute() << " sample= " << t->sample() << " (initial? " << t->initial() << ')'
<< " pos lock: " << enum_2_string (t->position_lock_style()) << std::endl;
if (prev_t) {
o << " current start : " << t->note_types_per_minute()
<< " current end : " << t->end_note_types_per_minute()
- << " | " << t->pulse() << " | " << t->frame() << " | " << t->minute() << std::endl;
+ << " | " << t->pulse() << " | " << t->sample() << " | " << t->minute() << std::endl;
o << " previous : " << prev_t->note_types_per_minute()
- << " | " << prev_t->pulse() << " | " << prev_t->frame() << " | " << prev_t->minute() << std::endl;
+ << " | " << prev_t->pulse() << " | " << prev_t->sample() << " | " << prev_t->minute() << std::endl;
o << " calculated : " << prev_t->tempo_at_pulse (t->pulse())
<< " | " << prev_t->pulse_at_ntpm (prev_t->end_note_types_per_minute(), t->minute())
- << " | " << frame_at_minute (prev_t->minute_at_ntpm (prev_t->end_note_types_per_minute(), t->pulse()))
+ << " | " << sample_at_minute (prev_t->minute_at_ntpm (prev_t->end_note_types_per_minute(), t->pulse()))
<< " | " << prev_t->minute_at_ntpm (prev_t->end_note_types_per_minute(), t->pulse()) << std::endl;
}
prev_t = t;
} else if ((m = dynamic_cast<const MeterSection*>(*i)) != 0) {
o << "Meter @ " << *i << ' ' << m->divisions_per_bar() << '/' << m->note_divisor() << " at " << m->bbt()
- << " frame= " << m->frame() << " pulse: " << m->pulse() << " beat : " << m->beat()
+ << " sample= " << m->sample() << " pulse: " << m->pulse() << " beat : " << m->beat()
<< " pos lock: " << enum_2_string (m->position_lock_style()) << " (initial? " << m->initial() << ')' << endl;
}
}
@@ -4736,19 +4736,19 @@ TempoMap::n_meters() const
}
void
-TempoMap::insert_time (framepos_t where, framecnt_t amount)
+TempoMap::insert_time (samplepos_t where, samplecnt_t amount)
{
for (Metrics::reverse_iterator i = _metrics.rbegin(); i != _metrics.rend(); ++i) {
- if ((*i)->frame() >= where && !(*i)->initial ()) {
+ if ((*i)->sample() >= where && !(*i)->initial ()) {
MeterSection* ms;
TempoSection* ts;
if ((ms = dynamic_cast <MeterSection*>(*i)) != 0) {
- gui_set_meter_position (ms, (*i)->frame() + amount);
+ gui_set_meter_position (ms, (*i)->sample() + amount);
}
if ((ts = dynamic_cast <TempoSection*>(*i)) != 0) {
- gui_set_tempo_position (ts, (*i)->frame() + amount, 0);
+ gui_set_tempo_position (ts, (*i)->sample() + amount, 0);
}
}
}
@@ -4757,7 +4757,7 @@ TempoMap::insert_time (framepos_t where, framecnt_t amount)
}
bool
-TempoMap::remove_time (framepos_t where, framecnt_t amount)
+TempoMap::remove_time (samplepos_t where, samplecnt_t amount)
{
bool moved = false;
@@ -4770,7 +4770,7 @@ TempoMap::remove_time (framepos_t where, framecnt_t amount)
{
Glib::Threads::RWLock::WriterLock lm (lock);
for (Metrics::iterator i = _metrics.begin(); i != _metrics.end(); ++i) {
- if ((*i)->frame() >= where && (*i)->frame() < where+amount) {
+ if ((*i)->sample() >= where && (*i)->sample() < where+amount) {
metric_kill_list.push_back(*i);
TempoSection *lt = dynamic_cast<TempoSection*> (*i);
if (lt)
@@ -4779,10 +4779,10 @@ TempoMap::remove_time (framepos_t where, framecnt_t amount)
if (lm)
last_meter = lm;
}
- else if ((*i)->frame() >= where) {
+ else if ((*i)->sample() >= where) {
// TODO: make sure that moved tempo/meter markers are rounded to beat/bar boundaries
- (*i)->set_minute ((*i)->minute() - minute_at_frame (amount));
- if ((*i)->frame() == where) {
+ (*i)->set_minute ((*i)->minute() - minute_at_sample (amount));
+ if ((*i)->sample() == where) {
// marker was immediately after end of range
tempo_after = dynamic_cast<TempoSection*> (*i);
meter_after = dynamic_cast<MeterSection*> (*i);
@@ -4794,12 +4794,12 @@ TempoMap::remove_time (framepos_t where, framecnt_t amount)
//find the last TEMPO and METER metric (if any) and move it to the cut point so future stuff is correct
if (last_tempo && !tempo_after) {
metric_kill_list.remove(last_tempo);
- last_tempo->set_minute (minute_at_frame (where));
+ last_tempo->set_minute (minute_at_sample (where));
moved = true;
}
if (last_meter && !meter_after) {
metric_kill_list.remove(last_meter);
- last_meter->set_minute (minute_at_frame (where));
+ last_meter->set_minute (minute_at_sample (where));
moved = true;
}
@@ -4817,24 +4817,24 @@ TempoMap::remove_time (framepos_t where, framecnt_t amount)
return moved;
}
-/** Add some (fractional) Beats to a session frame position, and return the result in frames.
+/** Add some (fractional) Beats to a session sample position, and return the result in samples.
* pos can be -ve, if required.
*/
-framepos_t
-TempoMap::framepos_plus_qn (framepos_t frame, Evoral::Beats beats) const
+samplepos_t
+TempoMap::samplepos_plus_qn (samplepos_t sample, Evoral::Beats beats) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- const double frame_qn = pulse_at_minute_locked (_metrics, minute_at_frame (frame)) * 4.0;
+ const double sample_qn = pulse_at_minute_locked (_metrics, minute_at_sample (sample)) * 4.0;
- return frame_at_minute (minute_at_pulse_locked (_metrics, (frame_qn + beats.to_double()) / 4.0));
+ return sample_at_minute (minute_at_pulse_locked (_metrics, (sample_qn + beats.to_double()) / 4.0));
}
-framepos_t
-TempoMap::framepos_plus_bbt (framepos_t pos, BBT_Time op) const
+samplepos_t
+TempoMap::samplepos_plus_bbt (samplepos_t pos, BBT_Time op) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- BBT_Time pos_bbt = bbt_at_beat_locked (_metrics, beat_at_minute_locked (_metrics, minute_at_frame (pos)));
+ BBT_Time pos_bbt = bbt_at_beat_locked (_metrics, beat_at_minute_locked (_metrics, minute_at_sample (pos)));
pos_bbt.ticks += op.ticks;
if (pos_bbt.ticks >= BBT_Time::ticks_per_beat) {
++pos_bbt.beats;
@@ -4850,18 +4850,18 @@ TempoMap::framepos_plus_bbt (framepos_t pos, BBT_Time op) const
}
pos_bbt.bars += op.bars;
- return frame_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
+ return sample_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
}
/** Count the number of beats that are equivalent to distance when going forward,
starting at pos.
*/
Evoral::Beats
-TempoMap::framewalk_to_qn (framepos_t pos, framecnt_t distance) const
+TempoMap::framewalk_to_qn (samplepos_t pos, samplecnt_t distance) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return Evoral::Beats (quarter_notes_between_frames_locked (_metrics, pos, pos + distance));
+ return Evoral::Beats (quarter_notes_between_samples_locked (_metrics, pos, pos + distance));
}
struct bbtcmp {
@@ -4883,7 +4883,7 @@ operator<< (std::ostream& o, const Tempo& t) {
std::ostream&
operator<< (std::ostream& o, const MetricSection& section) {
- o << "MetricSection @ " << section.frame() << ' ';
+ o << "MetricSection @ " << section.sample() << ' ';
const TempoSection* ts;
const MeterSection* ms;
diff --git a/libs/ardour/test/audio_region_read_test.cc b/libs/ardour/test/audio_region_read_test.cc
index c7ae50afd5..5dbe337de5 100644
--- a/libs/ardour/test/audio_region_read_test.cc
+++ b/libs/ardour/test/audio_region_read_test.cc
@@ -38,7 +38,7 @@ AudioRegionReadTest::readTest ()
int const P = 100;
- /* Simple read: 256 frames from start of region, no fades */
+ /* Simple read: 256 samples from start of region, no fades */
_ar[0]->set_position (P);
_ar[0]->set_length (1024);
@@ -50,11 +50,11 @@ AudioRegionReadTest::readTest ()
buf[i] = 0;
}
- /* Offset read: 256 frames from 128 frames into the region, no fades */
+ /* Offset read: 256 samples from 128 samples into the region, no fades */
_ar[0]->read_from_sources (_ar[0]->_sources, _ar[0]->_length, buf, P + 128, 256, 0);
check_staircase (buf, 128, 256);
- /* Simple read with a fade-in: 256 frames from start of region, with fades */
+ /* Simple read with a fade-in: 256 samples from start of region, with fades */
_ar[0]->set_default_fade_in ();
CPPUNIT_ASSERT_EQUAL (double (64), _ar[0]->_fade_in->back()->when);
@@ -71,7 +71,7 @@ AudioRegionReadTest::readTest ()
CPPUNIT_ASSERT_EQUAL (i, int (buf[i]));
}
- /* Offset read: 256 frames from 128 frames into the region, with fades
+ /* Offset read: 256 samples from 128 samples into the region, with fades
(though the fade should not affect it, as it is finished before the read starts)
*/
diff --git a/libs/ardour/test/audio_region_test.h b/libs/ardour/test/audio_region_test.h
index 29ea51caa6..a9a65c64b5 100644
--- a/libs/ardour/test/audio_region_test.h
+++ b/libs/ardour/test/audio_region_test.h
@@ -42,7 +42,7 @@ protected:
boost::shared_ptr<ARDOUR::AudioPlaylist> _audio_playlist;
boost::shared_ptr<ARDOUR::Source> _source;
/** 16 regions, of length 100, each referencing a source which is 4096
- * frames of a staircase waveform.
+ * samples of a staircase waveform.
*/
boost::shared_ptr<ARDOUR::Region> _r[16];
/** AudioRegion downcasts of _r[] */
diff --git a/libs/ardour/test/bbt_test.cc b/libs/ardour/test/bbt_test.cc
index f1a8934905..b6f3c07d46 100644
--- a/libs/ardour/test/bbt_test.cc
+++ b/libs/ardour/test/bbt_test.cc
@@ -16,7 +16,7 @@ BBTTest::addTest ()
Tempo tempo(120, 4.0);
Meter meter(4.0, 4.0);
- /* no need to supply the frame for a new music-locked meter */
+ /* no need to supply the sample for a new music-locked meter */
map.add_meter (meter, BBT_Time(2, 1, 0), 0, MusicTime);
/* add some good stuff here */
diff --git a/libs/ardour/test/combine_regions_test.cc b/libs/ardour/test/combine_regions_test.cc
index 5eee1d47d0..18bb79bee4 100644
--- a/libs/ardour/test/combine_regions_test.cc
+++ b/libs/ardour/test/combine_regions_test.cc
@@ -97,7 +97,7 @@ CombineRegionsTest::check_crossfade1 ()
void
CombineRegionsTest::crossfadeTest1 ()
{
- /* Two regions, both 256 frames in length, overlapping by 128 frames in the middle */
+ /* Two regions, both 256 samples in length, overlapping by 128 samples in the middle */
_ar[0]->set_default_fade_in ();
_ar[0]->set_default_fade_out ();
@@ -201,7 +201,7 @@ CombineRegionsTest::check_crossfade2 ()
void
CombineRegionsTest::crossfadeTest2 ()
{
- /* Two regions, both 256 frames in length, overlapping by 128 frames in the middle */
+ /* Two regions, both 256 samples in length, overlapping by 128 samples in the middle */
_ar[0]->set_default_fade_in ();
_ar[0]->set_default_fade_out ();
diff --git a/libs/ardour/test/framepos_minus_beats_test.cc b/libs/ardour/test/framepos_minus_beats_test.cc
index fcf20e9238..5d2d95ac74 100644
--- a/libs/ardour/test/framepos_minus_beats_test.cc
+++ b/libs/ardour/test/framepos_minus_beats_test.cc
@@ -1,4 +1,4 @@
-#include "framepos_minus_beats_test.h"
+#include "samplepos_minus_beats_test.h"
#include "ardour/tempo.h"
#include "timecode/bbt_time.h"
@@ -16,22 +16,22 @@ FrameposMinusBeatsTest::singleTempoTest ()
int const sampling_rate = 48000;
int const bpm = 120;
- double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate);
+ double const samples_per_beat = (60 / double (bpm)) * double (sampling_rate);
TempoMap map (sampling_rate);
Tempo tempo (bpm);
Meter meter (4, 4);
- map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), (framepos_t) 0, AudioTime);
+ map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), (samplepos_t) 0, AudioTime);
map.replace_tempo (map.first_tempo(), tempo, 0.0, 0, TempoSection::Constant, AudioTime);
/* Subtract 1 beat from beat 3 of the first bar */
- framepos_t r = map.framepos_minus_qn (frames_per_beat * 2, Beats(1));
- CPPUNIT_ASSERT_EQUAL (r, framepos_t (frames_per_beat * 1));
+ samplepos_t r = map.samplepos_minus_qn (samples_per_beat * 2, Beats(1));
+ CPPUNIT_ASSERT_EQUAL (r, samplepos_t (samples_per_beat * 1));
/* Subtract 4 beats from 3 beats in, to go beyond zero */
- r = map.framepos_minus_qn (frames_per_beat * 3, Beats(4));
- CPPUNIT_ASSERT_EQUAL (r, framepos_t (- frames_per_beat));
+ r = map.samplepos_minus_qn (samples_per_beat * 3, Beats(4));
+ CPPUNIT_ASSERT_EQUAL (r, samplepos_t (- samples_per_beat));
}
/* Test adding things that overlap a tempo change */
@@ -42,7 +42,7 @@ FrameposMinusBeatsTest::doubleTempoTest ()
TempoMap map (sampling_rate);
Meter meter (4, 4);
- map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), (framepos_t) 0, AudioTime);
+ map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), (samplepos_t) 0, AudioTime);
/*
120bpm at bar 1, 240bpm at bar 4
@@ -56,7 +56,7 @@ FrameposMinusBeatsTest::doubleTempoTest ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses 4 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 4.4 |
@@ -71,16 +71,16 @@ FrameposMinusBeatsTest::doubleTempoTest ()
/* Now some tests */
/* Subtract 1 beat from 1|2 */
- framepos_t r = map.framepos_minus_qn (24e3, Beats(1));
- CPPUNIT_ASSERT_EQUAL (r, framepos_t (0));
+ samplepos_t r = map.samplepos_minus_qn (24e3, Beats(1));
+ CPPUNIT_ASSERT_EQUAL (r, samplepos_t (0));
/* Subtract 2 beats from 4|2 (over the tempo change) */
- r = map.framepos_minus_qn (288e3 + 12e3, Beats(2));
- CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3));
+ r = map.samplepos_minus_qn (288e3 + 12e3, Beats(2));
+ CPPUNIT_ASSERT_EQUAL (r, samplepos_t (288e3 - 24e3));
/* Subtract 2.5 beats from 4|2 (over the tempo change) */
- r = map.framepos_minus_qn (288e3 + 12e3, Beats(2.5));
- CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3 - 12e3));
+ r = map.samplepos_minus_qn (288e3 + 12e3, Beats(2.5));
+ CPPUNIT_ASSERT_EQUAL (r, samplepos_t (288e3 - 24e3 - 12e3));
}
/* Same as doubleTempoTest () except put a meter change at the same time as the
@@ -95,7 +95,7 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest ()
TempoMap map (sampling_rate);
Meter meterA (4, 4);
- map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), (framepos_t) 0, AudioTime);
+ map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), (samplepos_t) 0, AudioTime);
/*
120bpm at bar 1, 240bpm at bar 4
@@ -109,7 +109,7 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses 3 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 |
@@ -126,16 +126,16 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest ()
/* Now some tests */
/* Subtract 1 beat from 1|2 */
- framepos_t r = map.framepos_minus_qn (24e3, Beats(1));
- CPPUNIT_ASSERT_EQUAL (r, framepos_t (0));
+ samplepos_t r = map.samplepos_minus_qn (24e3, Beats(1));
+ CPPUNIT_ASSERT_EQUAL (r, samplepos_t (0));
/* Subtract 2 beats from 4|2 (over the tempo change) */
- r = map.framepos_minus_qn (288e3 + 12e3, Beats(2));
- CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3));
+ r = map.samplepos_minus_qn (288e3 + 12e3, Beats(2));
+ CPPUNIT_ASSERT_EQUAL (r, samplepos_t (288e3 - 24e3));
/* Subtract 2.5 beats from 4|2 (over the tempo change) */
- r = map.framepos_minus_qn (288e3 + 12e3, Beats(2.5));
- CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3 - 12e3));
+ r = map.samplepos_minus_qn (288e3 + 12e3, Beats(2.5));
+ CPPUNIT_ASSERT_EQUAL (r, samplepos_t (288e3 - 24e3 - 12e3));
}
diff --git a/libs/ardour/test/framepos_plus_beats_test.cc b/libs/ardour/test/framepos_plus_beats_test.cc
index d52717bb60..d567f4691c 100644
--- a/libs/ardour/test/framepos_plus_beats_test.cc
+++ b/libs/ardour/test/framepos_plus_beats_test.cc
@@ -1,4 +1,4 @@
-#include "framepos_plus_beats_test.h"
+#include "samplepos_plus_beats_test.h"
#include "ardour/tempo.h"
#include "timecode/bbt_time.h"
@@ -15,7 +15,7 @@ FrameposPlusBeatsTest::singleTempoTest ()
int const sampling_rate = 48000;
int const bpm = 120;
- double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate);
+ double const samples_per_beat = (60 / double (bpm)) * double (sampling_rate);
TempoMap map (sampling_rate);
Tempo tempo (bpm, 4.0);
@@ -25,12 +25,12 @@ FrameposPlusBeatsTest::singleTempoTest ()
map.replace_tempo (map.first_tempo(), tempo, 0.0, 0, AudioTime);
/* Add 1 beat to beat 3 of the first bar */
- framepos_t r = map.framepos_plus_qn (frames_per_beat * 2, Evoral::Beats(1));
- CPPUNIT_ASSERT_EQUAL (framepos_t (frames_per_beat * 3), r);
+ samplepos_t r = map.samplepos_plus_qn (samples_per_beat * 2, Evoral::Beats(1));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (samples_per_beat * 3), r);
- /* Add 4 beats to a -ve frame of 1 beat before zero */
- r = map.framepos_plus_qn (-frames_per_beat * 1, Evoral::Beats(4));
- CPPUNIT_ASSERT_EQUAL (framepos_t (frames_per_beat * 3), r);
+ /* Add 4 beats to a -ve sample of 1 beat before zero */
+ r = map.samplepos_plus_qn (-samples_per_beat * 1, Evoral::Beats(4));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (samples_per_beat * 3), r);
}
/* Test adding things that overlap a tempo change */
@@ -55,7 +55,7 @@ FrameposPlusBeatsTest::doubleTempoTest ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses 3 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 4.4 |
@@ -70,16 +70,16 @@ FrameposPlusBeatsTest::doubleTempoTest ()
/* Now some tests */
/* Add 1 beat to 1|2 */
- framepos_t r = map.framepos_plus_qn (24e3, Evoral::Beats(1));
- CPPUNIT_ASSERT_EQUAL (framepos_t (48e3), r);
+ samplepos_t r = map.samplepos_plus_qn (24e3, Evoral::Beats(1));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (48e3), r);
/* Add 2 beats to 3|4 (over the tempo change) */
- r = map.framepos_plus_qn (264e3, Evoral::Beats(2));
- CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r);
+ r = map.samplepos_plus_qn (264e3, Evoral::Beats(2));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r);
/* Add 2.5 beats to 3|3|960 (over the tempo change) */
- r = map.framepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5));
- CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r);
+ r = map.samplepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r);
}
/* Same as doubleTempoTest () except put a meter change at the same time as the
@@ -108,7 +108,7 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses 3 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 |
@@ -125,16 +125,16 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest ()
/* Now some tests */
/* Add 1 beat to 1|2 */
- framepos_t r = map.framepos_plus_qn (24e3, Evoral::Beats(1));
- CPPUNIT_ASSERT_EQUAL (framepos_t (48e3), r);
+ samplepos_t r = map.samplepos_plus_qn (24e3, Evoral::Beats(1));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (48e3), r);
/* Add 2 beats to 3|4 (over the tempo change) */
- r = map.framepos_plus_qn (264e3, Evoral::Beats(2));
- CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r);
+ r = map.samplepos_plus_qn (264e3, Evoral::Beats(2));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r);
/* Add 2.5 beats to 3|3|960 (over the tempo change) */
- r = map.framepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5));
- CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r);
+ r = map.samplepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r);
}
/* Same as doubleTempoWithMeterTest () except use odd meter divisors
@@ -164,7 +164,7 @@ FrameposPlusBeatsTest::doubleTempoWithComplexMeterTest ()
120bpm 5/8 240bpm
0 beats 9 quarter note beats 12 quarter note beats
9 meter-based beat 15 meter-based beat
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses | 3 pulses
| | | | |
| 1.1 1.2 1.3 | 2.1 2.2 2.3 | 3.1 3.2 3.3 |4.14.24.34.44.5|5.15.2^5.35.45.5|
@@ -181,16 +181,16 @@ FrameposPlusBeatsTest::doubleTempoWithComplexMeterTest ()
/* Now some tests */
/* Add 1 beat to 1|2 */
- framepos_t r = map.framepos_plus_qn (24e3, Evoral::Beats(1));
- CPPUNIT_ASSERT_EQUAL (framepos_t (48e3), r);
+ samplepos_t r = map.samplepos_plus_qn (24e3, Evoral::Beats(1));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (48e3), r);
/* Add 2 beats to 5|1 (over the tempo change) */
- r = map.framepos_plus_qn (264e3, Evoral::Beats(2));
- CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r);
+ r = map.samplepos_plus_qn (264e3, Evoral::Beats(2));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r);
/* Add 2.5 beats to 4|5 (over the tempo change) */
- r = map.framepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5));
- CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r);
+ r = map.samplepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r);
}
diff --git a/libs/ardour/test/framewalk_to_beats_test.cc b/libs/ardour/test/framewalk_to_beats_test.cc
index 8c430b9230..3bf45050a7 100644
--- a/libs/ardour/test/framewalk_to_beats_test.cc
+++ b/libs/ardour/test/framewalk_to_beats_test.cc
@@ -14,29 +14,29 @@ FramewalkToBeatsTest::singleTempoTest ()
int const sampling_rate = 48000;
int const bpm = 120;
- double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate);
+ double const samples_per_beat = (60 / double (bpm)) * double (sampling_rate);
TempoMap map (sampling_rate);
Tempo tempo (bpm, 4.0);
Meter meter (4, 4);
- map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime);
- map.replace_tempo (map.tempo_section_at_frame (0), tempo, 0.0, 0, AudioTime);
+ map.replace_meter (map.meter_section_at_sample (0), meter, BBT_Time (1, 1, 0), 0, AudioTime);
+ map.replace_tempo (map.tempo_section_at_sample (0), tempo, 0.0, 0, AudioTime);
- /* Walk 1 beats-worth of frames from beat 3 */
- double r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1).to_double();
+ /* Walk 1 beats-worth of samples from beat 3 */
+ double r = map.framewalk_to_qn (samples_per_beat * 2, samples_per_beat * 1).to_double();
CPPUNIT_ASSERT_EQUAL (1.0, r);
- /* Walk 6 beats-worth of frames from beat 4 */
- r = map.framewalk_to_qn (frames_per_beat * 3, frames_per_beat * 6).to_double();
+ /* Walk 6 beats-worth of samples from beat 4 */
+ r = map.framewalk_to_qn (samples_per_beat * 3, samples_per_beat * 6).to_double();
CPPUNIT_ASSERT_EQUAL (6.0, r);
- /* Walk 1.5 beats-worth of frames from beat 3 */
- r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1.5).to_double();
+ /* Walk 1.5 beats-worth of samples from beat 3 */
+ r = map.framewalk_to_qn (samples_per_beat * 2, samples_per_beat * 1.5).to_double();
CPPUNIT_ASSERT_EQUAL (1.5, r);
- /* Walk 1.5 beats-worth of frames from beat 2.5 */
- r = map.framewalk_to_qn (frames_per_beat * 2.5, frames_per_beat * 1.5).to_double();
+ /* Walk 1.5 beats-worth of samples from beat 2.5 */
+ r = map.framewalk_to_qn (samples_per_beat * 2.5, samples_per_beat * 1.5).to_double();
CPPUNIT_ASSERT_EQUAL (1.5, r);
}
@@ -47,7 +47,7 @@ FramewalkToBeatsTest::doubleTempoTest ()
TempoMap map (sampling_rate);
Meter meter (4, 4);
- map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime);
+ map.replace_meter (map.meter_section_at_sample (0), meter, BBT_Time (1, 1, 0), 0, AudioTime);
/*
120bpm at bar 1, 240bpm at bar 4
@@ -61,8 +61,8 @@ FramewalkToBeatsTest::doubleTempoTest ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
- 24e3 frames per beat 12e3 frames per beat
+ 0 samples 288e3 samples
+ 24e3 samples per beat 12e3 samples per beat
0 pulses 4 pulses
| | | | |
1.1 1.2 1.3 1.4 2.1 2.2 2.3 2.4 3.1 3.2 3.3 3.4 4.1 4.2 4.3 4.4 5.1
@@ -71,7 +71,7 @@ FramewalkToBeatsTest::doubleTempoTest ()
*/
Tempo tempoA (120);
- map.replace_tempo (map.tempo_section_at_frame (0), tempoA, 0.0, 0, AudioTime);
+ map.replace_tempo (map.tempo_section_at_sample (0), tempoA, 0.0, 0, AudioTime);
Tempo tempoB (240);
map.add_tempo (tempoB, 12.0 / tempoB.note_type(), 0, MusicTime);
@@ -104,7 +104,7 @@ FramewalkToBeatsTest::tripleTempoTest ()
TempoMap map (sampling_rate);
Meter meter (4, 4);
- map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime);
+ map.replace_meter (map.meter_section_at_sample (0), meter, BBT_Time (1, 1, 0), 0, AudioTime);
/*
120bpm at bar 1, 240bpm at bar 2, 160bpm at bar 3
@@ -119,7 +119,7 @@ FramewalkToBeatsTest::tripleTempoTest ()
120bpm 240bpm 160bpm
0 beats 4 beats 8 beats
- 0 frames 96e3 frames 144e3 frames
+ 0 samples 96e3 samples 144e3 samples
0 pulses 1 pulse 2 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 4.4 |
@@ -127,7 +127,7 @@ FramewalkToBeatsTest::tripleTempoTest ()
*/
Tempo tempoA (120, 4.0);
- map.replace_tempo (map.tempo_section_at_frame (0), tempoA, 0.0, 0, AudioTime);
+ map.replace_tempo (map.tempo_section_at_sample (0), tempoA, 0.0, 0, AudioTime);
Tempo tempoB (240, 4.0);
map.add_tempo (tempoB, 4.0 / tempoB.note_type(), 0, MusicTime);
Tempo tempoC (160, 4.0);
@@ -144,28 +144,28 @@ FramewalkToBeatsTest::singleTempoMeterTest ()
int const sampling_rate = 48000;
int const bpm = 120;
- double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate);
+ double const samples_per_beat = (60 / double (bpm)) * double (sampling_rate);
TempoMap map (sampling_rate);
Tempo tempo (bpm, 4.0);
Meter meter (7, 8);
- map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime);
- map.replace_tempo (map.tempo_section_at_frame (0), tempo, 0.0, 0, AudioTime);
+ map.replace_meter (map.meter_section_at_sample (0), meter, BBT_Time (1, 1, 0), 0, AudioTime);
+ map.replace_tempo (map.tempo_section_at_sample (0), tempo, 0.0, 0, AudioTime);
- /* Walk 1 qn beats-worth of frames from beat 3 */
- double r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1).to_double();
+ /* Walk 1 qn beats-worth of samples from beat 3 */
+ double r = map.framewalk_to_qn (samples_per_beat * 2, samples_per_beat * 1).to_double();
CPPUNIT_ASSERT_EQUAL (1.0, r);
- /* Walk 6 qn beats-worth of frames from beat 4 */
- r = map.framewalk_to_qn (frames_per_beat * 3, frames_per_beat * 6).to_double();
+ /* Walk 6 qn beats-worth of samples from beat 4 */
+ r = map.framewalk_to_qn (samples_per_beat * 3, samples_per_beat * 6).to_double();
CPPUNIT_ASSERT_EQUAL (6.0, r);
- /* Walk 1.5 qn beats-worth of frames from beat 3 */
- r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1.5).to_double();
+ /* Walk 1.5 qn beats-worth of samples from beat 3 */
+ r = map.framewalk_to_qn (samples_per_beat * 2, samples_per_beat * 1.5).to_double();
CPPUNIT_ASSERT_EQUAL (1.5, r);
- /* Walk 1.5 qn beats-worth of frames from beat 2.5 */
- r = map.framewalk_to_qn (frames_per_beat * 2.5, frames_per_beat * 1.5).to_double();
+ /* Walk 1.5 qn beats-worth of samples from beat 2.5 */
+ r = map.framewalk_to_qn (samples_per_beat * 2.5, samples_per_beat * 1.5).to_double();
CPPUNIT_ASSERT_EQUAL (1.5, r);
}
diff --git a/libs/ardour/test/interpolation_test.cc b/libs/ardour/test/interpolation_test.cc
index 7a91160e7a..c9fae7e64f 100644
--- a/libs/ardour/test/interpolation_test.cc
+++ b/libs/ardour/test/interpolation_test.cc
@@ -9,7 +9,7 @@ using namespace ARDOUR;
void
InterpolationTest::linearInterpolationTest ()
{
- framecnt_t result = 0;
+ samplecnt_t result = 0;
// cout << "\nLinear Interpolation Test\n";
// cout << "\nSpeed: 1/3";
@@ -25,7 +25,7 @@ InterpolationTest::linearInterpolationTest ()
linear.set_speed (1.0);
linear.set_target_speed (linear.speed());
result = linear.interpolate (0, NUM_SAMPLES, input, output);
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result);
for (int i = 0; i < NUM_SAMPLES; i += INTERVAL) {
CPPUNIT_ASSERT_EQUAL (1.0f, output[i]);
}
@@ -35,7 +35,7 @@ InterpolationTest::linearInterpolationTest ()
linear.set_speed (0.5);
linear.set_target_speed (linear.speed());
result = linear.interpolate (0, NUM_SAMPLES, input, output);
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result);
for (int i = 0; i < NUM_SAMPLES; i += (INTERVAL / linear.speed() +0.5)) {
CPPUNIT_ASSERT_EQUAL (1.0f, output[i]);
}
@@ -45,14 +45,14 @@ InterpolationTest::linearInterpolationTest ()
linear.set_speed (0.2);
linear.set_target_speed (linear.speed());
result = linear.interpolate (0, NUM_SAMPLES, input, output);
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result);
// cout << "\nSpeed: 0.02";
linear.reset();
linear.set_speed (0.02);
linear.set_target_speed (linear.speed());
result = linear.interpolate (0, NUM_SAMPLES, input, output);
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result);
// cout << "\nSpeed: 0.002";
linear.reset();
@@ -60,14 +60,14 @@ InterpolationTest::linearInterpolationTest ()
linear.set_target_speed (linear.speed());
result = linear.interpolate (0, NUM_SAMPLES, input, output);
linear.speed();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result);
// cout << "\nSpeed: 2.0";
linear.reset();
linear.set_speed (2.0);
linear.set_target_speed (linear.speed());
result = linear.interpolate (0, NUM_SAMPLES / 2, input, output);
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES / 2 * linear.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES / 2 * linear.speed()), result);
for (int i = 0; i < NUM_SAMPLES / 2; i += (INTERVAL / linear.speed() +0.5)) {
CPPUNIT_ASSERT_EQUAL (1.0f, output[i]);
}
@@ -76,7 +76,7 @@ InterpolationTest::linearInterpolationTest ()
linear.set_speed (10.0);
linear.set_target_speed (linear.speed());
result = linear.interpolate (0, NUM_SAMPLES / 10, input, output);
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES / 10 * linear.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES / 10 * linear.speed()), result);
for (int i = 0; i < NUM_SAMPLES / 10; i += (INTERVAL / linear.speed() +0.5)) {
CPPUNIT_ASSERT_EQUAL (1.0f, output[i]);
}
@@ -90,7 +90,7 @@ InterpolationTest::linearInterpolationTest ()
void
InterpolationTest::cubicInterpolationTest ()
{
- framecnt_t result = 0;
+ samplecnt_t result = 0;
// cout << "\nCubic Interpolation Test\n";
// cout << "\nSpeed: 1/3";
@@ -107,7 +107,7 @@ InterpolationTest::cubicInterpolationTest ()
cubic.set_target_speed (cubic.speed());
result = cubic.interpolate (0, NUM_SAMPLES, input, output);
CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES, NULL, NULL));
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result);
for (int i = 0; i < NUM_SAMPLES; i += INTERVAL) {
CPPUNIT_ASSERT_EQUAL (1.0f, output[i]);
}
@@ -118,7 +118,7 @@ InterpolationTest::cubicInterpolationTest ()
cubic.set_target_speed (cubic.speed());
result = cubic.interpolate (0, NUM_SAMPLES, input, output);
CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES, NULL, NULL));
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result);
for (int i = 0; i < NUM_SAMPLES; i += (INTERVAL / cubic.speed() +0.5)) {
CPPUNIT_ASSERT_EQUAL (1.0f, output[i]);
}
@@ -129,7 +129,7 @@ InterpolationTest::cubicInterpolationTest ()
cubic.set_target_speed (cubic.speed());
result = cubic.interpolate (0, NUM_SAMPLES, input, output);
CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES, NULL, NULL));
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result);
// cout << "\nSpeed: 0.02";
cubic.reset();
@@ -137,7 +137,7 @@ InterpolationTest::cubicInterpolationTest ()
cubic.set_target_speed (cubic.speed());
result = cubic.interpolate (0, NUM_SAMPLES, input, output);
CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES, NULL, NULL));
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result);
/* This one fails due too error accumulation
cout << "\nSpeed: 0.002";
@@ -146,7 +146,7 @@ InterpolationTest::cubicInterpolationTest ()
cubic.set_target_speed (cubic.speed());
result = cubic.interpolate (0, NUM_SAMPLES, input, output);
cubic.speed();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result);
*/
// cout << "\nSpeed: 2.0";
@@ -155,7 +155,7 @@ InterpolationTest::cubicInterpolationTest ()
cubic.set_target_speed (cubic.speed());
result = cubic.interpolate (0, NUM_SAMPLES / 2, input, output);
CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES / 2, NULL, NULL));
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES / 2 * cubic.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES / 2 * cubic.speed()), result);
for (int i = 0; i < NUM_SAMPLES / 2; i += (INTERVAL / cubic.speed() +0.5)) {
CPPUNIT_ASSERT_EQUAL (1.0f, output[i]);
}
@@ -165,7 +165,7 @@ InterpolationTest::cubicInterpolationTest ()
cubic.set_target_speed (cubic.speed());
result = cubic.interpolate (0, NUM_SAMPLES / 10, input, output);
CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES / 10, NULL, NULL));
- CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES / 10 * cubic.speed()), result);
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES / 10 * cubic.speed()), result);
for (int i = 0; i < NUM_SAMPLES / 10; i += (INTERVAL / cubic.speed() +0.5)) {
CPPUNIT_ASSERT_EQUAL (1.0f, output[i]);
}
diff --git a/libs/ardour/test/midi_clock_slave_test.cc b/libs/ardour/test/midi_clock_slave_test.cc
index cea7a06ce9..93262483f1 100644
--- a/libs/ardour/test/midi_clock_slave_test.cc
+++ b/libs/ardour/test/midi_clock_slave_test.cc
@@ -10,24 +10,24 @@ void
MIDIClock_SlaveTest::testStepResponse ()
{
double speed = 1.0;
- framepos_t position = 0;
+ samplepos_t position = 0;
MIDI::Parser* parser = 0;
TestSlaveSessionProxy *sess = (TestSlaveSessionProxy *) session;
- framecnt_t period_size = 4096;
+ samplecnt_t period_size = 4096;
sess->set_period_size (period_size);
bandwidth = 1.0 / 60.0;
- framepos_t start_time = 1000000;
+ samplepos_t start_time = 1000000;
start (*parser, start_time);
update_midi_clock (*parser, start_time);
- for (framecnt_t i = 1; i<= 100 * period_size; i++) {
+ for (samplecnt_t i = 1; i<= 100 * period_size; i++) {
// simulate jitter
- framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_frames);
+ samplecnt_t input_delta = samplecnt_t (one_ppqn_in_samples + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_samples);
if (i % input_delta == 0) {
update_midi_clock (*parser, start_time + i);
diff --git a/libs/ardour/test/midi_clock_slave_test.h b/libs/ardour/test/midi_clock_slave_test.h
index 0996c6360d..5cb40db169 100644
--- a/libs/ardour/test/midi_clock_slave_test.h
+++ b/libs/ardour/test/midi_clock_slave_test.h
@@ -28,11 +28,11 @@ namespace ARDOUR {
class TestSlaveSessionProxy : public ISlaveSessionProxy {
#define FRAME_RATE 44100
- framecnt_t _period_size;
+ samplecnt_t _period_size;
double transport_speed;
- framepos_t _transport_frame;
- framepos_t _frame_time;
+ samplepos_t _transport_sample;
+ samplepos_t _sample_time;
TempoMap *_tempo_map;
Tempo tempo;
@@ -41,8 +41,8 @@ class TestSlaveSessionProxy : public ISlaveSessionProxy {
public:
TestSlaveSessionProxy() :
transport_speed (1.0),
- _transport_frame (0),
- _frame_time (1000000),
+ _transport_sample (0),
+ _sample_time (1000000),
_tempo_map (0),
tempo (120, 4.0),
meter (4.0, 4.0)
@@ -53,23 +53,23 @@ class TestSlaveSessionProxy : public ISlaveSessionProxy {
}
// Controlling the mock object
- void set_period_size (framecnt_t a_size) { _period_size = a_size; }
- framecnt_t period_size () const { return _period_size; }
+ void set_period_size (samplecnt_t a_size) { _period_size = a_size; }
+ samplecnt_t period_size () const { return _period_size; }
void next_period () {
- _transport_frame += double(_period_size) * double(transport_speed);
- _frame_time += _period_size;
+ _transport_sample += double(_period_size) * double(transport_speed);
+ _sample_time += _period_size;
}
// Implementation
TempoMap& tempo_map () const { return *_tempo_map; }
- framecnt_t frame_rate () const { return FRAME_RATE; }
- framepos_t audible_frame () const { return _transport_frame; }
- framepos_t transport_frame () const { return _transport_frame; }
- pframes_t frames_since_cycle_start () const { return 0; }
- framepos_t frame_time () const { return _frame_time; }
-
- void request_locate (framepos_t frame, bool with_roll = false) {
- _transport_frame = frame;
+ samplecnt_t sample_rate () const { return FRAME_RATE; }
+ samplepos_t audible_sample () const { return _transport_sample; }
+ samplepos_t transport_sample () const { return _transport_sample; }
+ pframes_t samples_since_cycle_start () const { return 0; }
+ samplepos_t sample_time () const { return _sample_time; }
+
+ void request_locate (samplepos_t sample, bool with_roll = false) {
+ _transport_sample = sample;
}
void request_transport_speed (const double speed) { transport_speed = speed; }
diff --git a/libs/ardour/test/playlist_read_test.cc b/libs/ardour/test/playlist_read_test.cc
index e87179fac6..f3003dfec9 100644
--- a/libs/ardour/test/playlist_read_test.cc
+++ b/libs/ardour/test/playlist_read_test.cc
@@ -83,7 +83,7 @@ PlaylistReadTest::singleReadTest ()
void
PlaylistReadTest::overlappingReadTest ()
{
- /* Overlapping read; _ar[0] and _ar[1] are both 1024 frames long, _ar[0] starts at 0,
+ /* Overlapping read; _ar[0] and _ar[1] are both 1024 samples long, _ar[0] starts at 0,
_ar[1] starts at 128. We test a read from 0 to 256, which should consist
of the start of _ar[0], with its fade in, followed by _ar[1]'s fade in (mixed with _ar[0]
faded out with the inverse gain), and some more of _ar[1].
diff --git a/libs/ardour/test/profiling/lots_of_regions.cc b/libs/ardour/test/profiling/lots_of_regions.cc
index 0e5a4c2ce6..afad346232 100644
--- a/libs/ardour/test/profiling/lots_of_regions.cc
+++ b/libs/ardour/test/profiling/lots_of_regions.cc
@@ -35,7 +35,7 @@ main (int argc, char* argv[])
/* Duplicate it a lot */
session->begin_reversible_command ("foo");
playlist->clear_changes ();
- playlist->duplicate (region, region->last_frame() + 1, 1000);
+ playlist->duplicate (region, region->last_sample() + 1, 1000);
session->add_command (new StatefulDiffCommand (playlist));
session->commit_reversible_command ();
@@ -45,7 +45,7 @@ main (int argc, char* argv[])
/* And do it again */
session->begin_reversible_command ("foo");
playlist->clear_changes ();
- playlist->duplicate (region, region->last_frame() + 1, 1000);
+ playlist->duplicate (region, region->last_sample() + 1, 1000);
session->add_command (new StatefulDiffCommand (playlist));
session->commit_reversible_command ();
}
diff --git a/libs/ardour/test/tempo_test.cc b/libs/ardour/test/tempo_test.cc
index c3ca93f86a..c8817028c0 100644
--- a/libs/ardour/test/tempo_test.cc
+++ b/libs/ardour/test/tempo_test.cc
@@ -28,7 +28,7 @@ TempoTest::recomputeMapTest48 ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses 3 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 |
@@ -43,13 +43,13 @@ TempoTest::recomputeMapTest48 ()
map.add_meter (meterB, BBT_Time (4, 1, 0), 0, MusicTime);
//map.dump (map._metrics, std::cout);
list<MetricSection*>::iterator i = map._metrics.begin();
- CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ());
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (0), (*i)->sample ());
i = map._metrics.end();
--i;
- CPPUNIT_ASSERT_EQUAL (framepos_t (288e3), (*i)->frame ());
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (288e3), (*i)->sample ());
/* check the tempo section for expected result (no map) */
- const TempoSection& tsa (map.tempo_section_at_frame (0));
+ const TempoSection& tsa (map.tempo_section_at_sample (0));
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_pulse (3.0), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1 / 2.0, tsa.minute_at_pulse (1.5), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1 / 3.0, tsa.minute_at_pulse (1.0), 1e-17);
@@ -58,7 +58,7 @@ TempoTest::recomputeMapTest48 ()
CPPUNIT_ASSERT_DOUBLES_EQUAL (1.5, tsa.pulse_at_minute (0.1 / 2.0), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.pulse_at_minute (0.1 / 3.0), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.minute_at_frame (60.0 * sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.minute_at_sample (60.0 * sampling_rate), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_ntpm (240.0, 3.0), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_ntpm (240.0, 3.0), 1e-17);
@@ -67,15 +67,15 @@ TempoTest::recomputeMapTest48 ()
/* quarter note */
- /* quarter note - frame*/
- CPPUNIT_ASSERT_EQUAL (framepos_t (288e3), map.frame_at_quarter_note (12.0));
- CPPUNIT_ASSERT_EQUAL (framepos_t (144e3), map.frame_at_quarter_note (6.0));
- CPPUNIT_ASSERT_EQUAL (framepos_t (96e3), map.frame_at_quarter_note (4.0));
+ /* quarter note - sample*/
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (288e3), map.sample_at_quarter_note (12.0));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (144e3), map.sample_at_quarter_note (6.0));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (96e3), map.sample_at_quarter_note (4.0));
- /* frame - quarter note*/
- CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, map.quarter_note_at_frame (288e3), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (6.0, map.quarter_note_at_frame (144e3), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, map.quarter_note_at_frame (96e3), 1e-17);
+ /* sample - quarter note*/
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, map.quarter_note_at_sample (288e3), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (6.0, map.quarter_note_at_sample (144e3), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, map.quarter_note_at_sample (96e3), 1e-17);
/* pulse - internal minute based interface */
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, map.minute_at_pulse_locked (map._metrics, 3.0), 1e-17);
@@ -83,10 +83,10 @@ TempoTest::recomputeMapTest48 ()
/* tempo */
- /* tempo - frame */
- CPPUNIT_ASSERT_EQUAL (framepos_t (288e3), map.frame_at_tempo (tempoB));
- CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_frame (288e3).note_types_per_minute(), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, map.tempo_at_frame (288e3 - 1).note_types_per_minute(), 1e-17);
+ /* tempo - sample */
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (288e3), map.sample_at_tempo (tempoB));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_sample (288e3).note_types_per_minute(), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, map.tempo_at_sample (288e3 - 1).note_types_per_minute(), 1e-17);
/* tempo - quarter note */
CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_quarter_note (24.0).note_types_per_minute(), 1e-17);
@@ -126,7 +126,7 @@ TempoTest::recomputeMapTest44 ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses 3 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 |
@@ -141,13 +141,13 @@ TempoTest::recomputeMapTest44 ()
map.add_meter (meterB, BBT_Time (4, 1, 0), 288e3, MusicTime);
list<MetricSection*>::iterator i = map._metrics.begin();
- CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ());
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (0), (*i)->sample ());
i = map._metrics.end();
--i;
- CPPUNIT_ASSERT_EQUAL (framepos_t (264600), (*i)->frame ());
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264600), (*i)->sample ());
/* check the tempo section for expected result (no map) */
- const TempoSection& tsa (map.tempo_section_at_frame (0));
+ const TempoSection& tsa (map.tempo_section_at_sample (0));
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_pulse (3.0), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1 / 2.0, tsa.minute_at_pulse (1.5), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1 / 3.0, tsa.minute_at_pulse (1.0), 1e-17);
@@ -156,7 +156,7 @@ TempoTest::recomputeMapTest44 ()
CPPUNIT_ASSERT_DOUBLES_EQUAL (1.5, tsa.pulse_at_minute (0.1 / 2.0), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.pulse_at_minute (0.1 / 3.0), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.minute_at_frame (60.0 * sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.minute_at_sample (60.0 * sampling_rate), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_ntpm (240.0, 3.0), 1e-17);
@@ -167,15 +167,15 @@ TempoTest::recomputeMapTest44 ()
/* quarter note */
- /* quarter note - frame */
- CPPUNIT_ASSERT_EQUAL (framepos_t (264600), map.frame_at_quarter_note (12.0));
- CPPUNIT_ASSERT_EQUAL (framepos_t (132300), map.frame_at_quarter_note (6.0));
- CPPUNIT_ASSERT_EQUAL (framepos_t (88200), map.frame_at_quarter_note (4.0));
+ /* quarter note - sample */
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264600), map.sample_at_quarter_note (12.0));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (132300), map.sample_at_quarter_note (6.0));
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (88200), map.sample_at_quarter_note (4.0));
- /* frame - quarter note */
- CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0 * 4.0, map.quarter_note_at_frame (264600), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (1.5 * 4.0, map.quarter_note_at_frame (132300), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0 * 4.0, map.quarter_note_at_frame (88200), 1e-17);
+ /* sample - quarter note */
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0 * 4.0, map.quarter_note_at_sample (264600), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (1.5 * 4.0, map.quarter_note_at_sample (132300), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0 * 4.0, map.quarter_note_at_sample (88200), 1e-17);
/* pulse - internal minute based interface */
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, map.minute_at_pulse_locked (map._metrics, 3.0), 1e-17);
@@ -183,10 +183,10 @@ TempoTest::recomputeMapTest44 ()
/* tempo */
- /* tempo - frame */
- CPPUNIT_ASSERT_EQUAL (framepos_t (264600), map.frame_at_tempo (tempoB));
- CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_frame (264600).note_types_per_minute(), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, map.tempo_at_frame (264600 - 1).note_types_per_minute(), 1e-17);
+ /* tempo - sample */
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (264600), map.sample_at_tempo (tempoB));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_sample (264600).note_types_per_minute(), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, map.tempo_at_sample (264600 - 1).note_types_per_minute(), 1e-17);
/* tempo - quarter note */
CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_quarter_note (24.0).note_types_per_minute(), 1e-17);
@@ -226,7 +226,7 @@ TempoTest::qnDistanceTestConstant ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses 3 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 |
@@ -248,42 +248,42 @@ TempoTest::qnDistanceTestConstant ()
Tempo tempoF (123.7, 4.0);
map.add_tempo (tempoF, 15.0, 0, MusicTime);
Tempo tempoG (111.8, 4.0);
- map.add_tempo (tempoG, 0.0, (framepos_t) 2 * 60 * sampling_rate, AudioTime);
+ map.add_tempo (tempoG, 0.0, (samplepos_t) 2 * 60 * sampling_rate, AudioTime);
Meter meterB (3, 4);
map.add_meter (meterB, BBT_Time (4, 1, 0), 288e3, MusicTime);
list<MetricSection*>::iterator i = map._metrics.begin();
- CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ());
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (0), (*i)->sample ());
i = map._metrics.end();
--i;
- CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, (*i)->pulse() * 4.0));
+ CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, (*i)->pulse() * 4.0));
--i;
/* tempoF */
- CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 15.0 * 4.0));
+ CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 15.0 * 4.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 15.0 * 4.0), 1e-17);
--i;
/* tempoE */
- CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 12.0 * 4.0));
+ CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 12.0 * 4.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 12.0 * 4.0), 1e-17);
--i;
- CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 9.0 * 4.0));
+ CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 9.0 * 4.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 9.0 * 4.0), 1e-17);
--i;
/* tempoC */
- CPPUNIT_ASSERT_EQUAL (framecnt_t (6 * sampling_rate), map.frames_between_quarter_notes (0.0, (*i)->pulse() * 4.0));
+ CPPUNIT_ASSERT_EQUAL (samplecnt_t (6 * sampling_rate), map.samples_between_quarter_notes (0.0, (*i)->pulse() * 4.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, map.minutes_between_quarter_notes_locked (map._metrics, 0.0, (*i)->pulse() * 4.0), 1e-17);
/* distance from beat 12.0 to 0.0 should be 6.0 seconds */
- CPPUNIT_ASSERT_EQUAL (framecnt_t (264600), map.frames_between_quarter_notes (0.0, 3.0 * 4.0));
- CPPUNIT_ASSERT_EQUAL (framecnt_t (-264600), map.frames_between_quarter_notes (3.0 * 4.0, 0.0));
- CPPUNIT_ASSERT_EQUAL (framecnt_t (396900), map.frames_between_quarter_notes (0.0, 24.0));
- CPPUNIT_ASSERT_EQUAL (framecnt_t (-396900), map.frames_between_quarter_notes (24.0, 0.0));
- CPPUNIT_ASSERT_EQUAL (framecnt_t (88200), map.frames_between_quarter_notes (2.0 * 4.0, 3.0 * 4.0));
+ CPPUNIT_ASSERT_EQUAL (samplecnt_t (264600), map.samples_between_quarter_notes (0.0, 3.0 * 4.0));
+ CPPUNIT_ASSERT_EQUAL (samplecnt_t (-264600), map.samples_between_quarter_notes (3.0 * 4.0, 0.0));
+ CPPUNIT_ASSERT_EQUAL (samplecnt_t (396900), map.samples_between_quarter_notes (0.0, 24.0));
+ CPPUNIT_ASSERT_EQUAL (samplecnt_t (-396900), map.samples_between_quarter_notes (24.0, 0.0));
+ CPPUNIT_ASSERT_EQUAL (samplecnt_t (88200), map.samples_between_quarter_notes (2.0 * 4.0, 3.0 * 4.0));
}
void
TempoTest::qnDistanceTestRamp ()
@@ -306,7 +306,7 @@ TempoTest::qnDistanceTestRamp ()
120bpm 240bpm
0 beats 12 beats
- 0 frames 288e3 frames
+ 0 samples 288e3 samples
0 pulses 3 pulses
| | | | | |
| 1.1 1.2 1.3 1.4 | -no music- | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 |
@@ -327,35 +327,35 @@ TempoTest::qnDistanceTestRamp ()
Tempo tempoF (123.9, 4.0, 111.8);
map.add_tempo (tempoF, 15.0, 0, MusicTime);
Tempo tempoG (111.8, 4.0);
- map.add_tempo (tempoG, 0.0, (framepos_t) 2 * 60 * sampling_rate, AudioTime);
+ map.add_tempo (tempoG, 0.0, (samplepos_t) 2 * 60 * sampling_rate, AudioTime);
Meter meterB (3, 4);
map.add_meter (meterB, BBT_Time (2, 1, 0), 288e3, AudioTime);
map.recompute_map (map._metrics, 1);
list<MetricSection*>::iterator i = map._metrics.begin();
- CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ());
+ CPPUNIT_ASSERT_EQUAL (samplepos_t (0), (*i)->sample ());
i = map._metrics.end();
--i;
/* tempoG */
- CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, (*i)->pulse() * 4.0));
+ CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, (*i)->pulse() * 4.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, (*i)->pulse() * 4.0), 1e-17);
--i;
- CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 60.0));
+ CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 60.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 60.0), 1e-17);
--i;
/* tempoE */
- CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 48.0));
+ CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 48.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 48.0), 1e-17);
--i;
- CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 36.0));
+ CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 36.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 36.0), 1e-17);
--i;
/* tempoC */
- CPPUNIT_ASSERT_EQUAL (framecnt_t (6 * sampling_rate), map.frames_between_quarter_notes (0.0, (*i)->pulse() * 4.0));
+ CPPUNIT_ASSERT_EQUAL (samplecnt_t (6 * sampling_rate), map.samples_between_quarter_notes (0.0, (*i)->pulse() * 4.0));
CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, map.minutes_between_quarter_notes_locked (map._metrics, 0.0, (*i)->pulse() * 4.0), 1e-17);
}
@@ -370,13 +370,13 @@ TempoTest::rampTest48 ()
Tempo tempoA (77.0, 4.0, 217.0);
Tempo tempoB (217.0, 4.0);
map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime);
- map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, AudioTime);
+ map.add_tempo (tempoB, 0.0, (samplepos_t) 60 * sampling_rate, AudioTime);
map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), 0, AudioTime);
/*
77bpm 217bpm
- 0 frames 60 * sample rate frames
+ 0 samples 60 * sample rate samples
| | | | |
| *|
| * |
@@ -393,7 +393,7 @@ TempoTest::rampTest48 ()
*/
TempoSection& tA = map.first_tempo();
- const TempoSection& tB = map.tempo_section_at_frame ((framepos_t) 60 * sampling_rate);
+ const TempoSection& tB = map.tempo_section_at_sample ((samplepos_t) 60 * sampling_rate);
CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tA.minute_at_ntpm (217.0, 300.0), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (217.0, tA.tempo_at_minute (1.0).note_types_per_minute(), 1e-17);
@@ -416,7 +416,7 @@ TempoTest::rampTest48 ()
CPPUNIT_ASSERT_DOUBLES_EQUAL (147.0, tA.tempo_at_pulse (tB.pulse() / 2.0).note_types_per_minute(), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL ((tB.pulse() - tA.pulse()) / 2.0, tA.pulse_at_ntpm (147.0, 0), 1e-17);
- /* self-check frame at pulse 20 seconds in. */
+ /* self-check sample at pulse 20 seconds in. */
const double target = 20.0 / 60.0;
const double result = tA.minute_at_pulse (tA.pulse_at_minute (target));
CPPUNIT_ASSERT_DOUBLES_EQUAL (target, result, 1e-14);
@@ -432,13 +432,13 @@ TempoTest::rampTest44 ()
Tempo tempoA (77.0, 4.0, 217.0);
Tempo tempoB (217.0, 4.0);
map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime);
- map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, AudioTime);
+ map.add_tempo (tempoB, 0.0, (samplepos_t) 60 * sampling_rate, AudioTime);
map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), 0, AudioTime);
/*
77bpm 217bpm
- 0 frames 60 * sample rate frames
+ 0 samples 60 * sample rate samples
| | | | |
| *|
| * |
@@ -455,7 +455,7 @@ TempoTest::rampTest44 ()
*/
TempoSection& tA = map.first_tempo();
- const TempoSection& tB = map.tempo_section_at_frame ((framepos_t) 60 * sampling_rate);
+ const TempoSection& tB = map.tempo_section_at_sample ((samplepos_t) 60 * sampling_rate);
CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tA.minute_at_ntpm (217.0, 300.0), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (217.0, tA.tempo_at_minute (1.0).note_types_per_minute(), 1e-17);
@@ -478,7 +478,7 @@ TempoTest::rampTest44 ()
CPPUNIT_ASSERT_DOUBLES_EQUAL (147.0, tA.tempo_at_pulse (tB.pulse() / 2.0).note_types_per_minute(), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL ((tB.pulse() - tA.pulse()) / 2.0, tA.pulse_at_ntpm (147.0, 0), 1e-17);
- /* self-check frame at pulse 20 seconds in. */
+ /* self-check sample at pulse 20 seconds in. */
const double target = 20.0 / 60.0;
const double result = tA.minute_at_pulse (tA.pulse_at_minute (target));
CPPUNIT_ASSERT_DOUBLES_EQUAL (target, result, 1e-14);
@@ -610,28 +610,28 @@ TempoTest::tempoFundamentalsTest ()
}
}
- CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tA->frames_per_quarter_note (sampling_rate), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tA->frames_per_note_type (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tA->samples_per_quarter_note (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tA->samples_per_note_type (sampling_rate), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, tA->quarter_notes_per_minute (), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (30.0, tA->pulses_per_minute (), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (48000.0, tB->frames_per_quarter_note (sampling_rate), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tB->frames_per_note_type (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (48000.0, tB->samples_per_quarter_note (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tB->samples_per_note_type (sampling_rate), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (60.0, tB->quarter_notes_per_minute (), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (15.0, tB->pulses_per_minute (), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (12000.0, tC->frames_per_quarter_note (sampling_rate), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tC->frames_per_note_type (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (12000.0, tC->samples_per_quarter_note (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tC->samples_per_note_type (sampling_rate), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, tC->quarter_notes_per_minute (), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (60.0, tC->pulses_per_minute (), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (9000.0, tD->frames_per_quarter_note (sampling_rate), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (18000.0, tD->frames_per_note_type (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (9000.0, tD->samples_per_quarter_note (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (18000.0, tD->samples_per_note_type (sampling_rate), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (320.0, tD->quarter_notes_per_minute (), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (80.0, tD->pulses_per_minute (), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (17560.975609756097, tE->frames_per_quarter_note (sampling_rate), 1e-17);
- CPPUNIT_ASSERT_DOUBLES_EQUAL (23414.634146341465, tE->frames_per_note_type (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (17560.975609756097, tE->samples_per_quarter_note (sampling_rate), 1e-17);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (23414.634146341465, tE->samples_per_note_type (sampling_rate), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (164.0, tE->quarter_notes_per_minute (), 1e-17);
CPPUNIT_ASSERT_DOUBLES_EQUAL (41.0, tE->pulses_per_minute (), 1e-17);
}
diff --git a/libs/ardour/thread_buffers.cc b/libs/ardour/thread_buffers.cc
index abd8e9d333..5aa90a0598 100644
--- a/libs/ardour/thread_buffers.cc
+++ b/libs/ardour/thread_buffers.cc
@@ -94,7 +94,7 @@ ThreadBuffers::ensure_buffers (ChanCount howmany, size_t custom)
}
void
-ThreadBuffers::allocate_pan_automation_buffers (framecnt_t nframes, uint32_t howmany, bool force)
+ThreadBuffers::allocate_pan_automation_buffers (samplecnt_t nframes, uint32_t howmany, bool force)
{
/* we always need at least 2 pan buffers */
diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc
index 80a413656e..b2c30fffc9 100644
--- a/libs/ardour/ticker.cc
+++ b/libs/ardour/ticker.cc
@@ -39,7 +39,7 @@ class MidiClockTicker::Position : public Timecode::BBT_Time
{
public:
- Position() : speed(0.0f), frame(0), midi_beats(0) { }
+ Position() : speed(0.0f), sample(0), midi_beats(0) { }
~Position() { }
/** Sync timing information taken from the given Session
@@ -51,24 +51,24 @@ public:
bool changed = false;
double sp = s->transport_speed();
- framecnt_t fr = s->transport_frame();
+ samplecnt_t fr = s->transport_sample();
if (speed != sp) {
speed = sp;
changed = true;
}
- if (frame != fr) {
- frame = fr;
+ if (sample != fr) {
+ sample = fr;
changed = true;
}
/* Midi beats and clocks always gets updated for now */
- s->bbt_time (this->frame, *this);
+ s->bbt_time (this->sample, *this);
const TempoMap& tempo = s->tempo_map();
- const Meter& meter = tempo.meter_at_frame (frame);
+ const Meter& meter = tempo.meter_at_sample (sample);
const double divisions = meter.divisions_per_bar();
const double divisor = meter.note_divisor();
@@ -93,12 +93,12 @@ public:
}
double speed;
- framecnt_t frame;
+ samplecnt_t sample;
double midi_beats;
double midi_clocks;
void print (std::ostream& s) {
- s << "frames: " << frame << " midi beats: " << midi_beats << " speed: " << speed;
+ s << "samples: " << sample << " midi beats: " << midi_beats << " speed: " << speed;
}
};
@@ -135,13 +135,13 @@ MidiClockTicker::set_session (Session* s)
void
MidiClockTicker::session_located()
{
- DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Session Located: %1, speed: %2\n", _session->transport_frame(), _session->transport_speed()));
+ DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Session Located: %1, speed: %2\n", _session->transport_sample(), _session->transport_speed()));
if (!_session || !_pos->sync (_session)) {
return;
}
- _last_tick = _pos->frame;
+ _last_tick = _pos->sample;
if (!Config->get_send_midi_clock()) {
return;
@@ -182,10 +182,10 @@ MidiClockTicker::transport_state_changed()
DEBUG_TRACE (DEBUG::MidiClock,
string_compose ("Transport state change @ %4, speed: %1 position: %2 play loop: %3\n",
- _pos->speed, _pos->frame, _session->get_play_loop(), _pos->frame)
+ _pos->speed, _pos->sample, _session->get_play_loop(), _pos->sample)
);
- _last_tick = _pos->frame;
+ _last_tick = _pos->sample;
if (! Config->get_send_midi_clock()) {
return;
@@ -193,7 +193,7 @@ MidiClockTicker::transport_state_changed()
_send_state = true;
- // tick (_pos->frame);
+ // tick (_pos->sample);
}
void
@@ -204,13 +204,13 @@ MidiClockTicker::transport_looped()
DEBUG_TRACE (DEBUG::MidiClock,
string_compose ("Transport looped, position: %1, loop start: %2, loop end: %3, play loop: %4\n",
- _session->transport_frame(), loop_location->start(), loop_location->end(), _session->get_play_loop())
+ _session->transport_sample(), loop_location->start(), loop_location->end(), _session->get_play_loop())
);
// adjust _last_tick, so that the next MIDI clock message is sent
// in due time (and the tick interval is still constant)
- framecnt_t elapsed_since_last_tick = loop_location->end() - _last_tick;
+ samplecnt_t elapsed_since_last_tick = loop_location->end() - _last_tick;
if (loop_location->start() > elapsed_since_last_tick) {
_last_tick = loop_location->start() - elapsed_since_last_tick;
@@ -220,7 +220,7 @@ MidiClockTicker::transport_looped()
}
void
-MidiClockTicker::tick (const framepos_t& /* transport_frame */, pframes_t nframes)
+MidiClockTicker::tick (const samplepos_t& /* transport_sample */, pframes_t nframes)
{
if (!Config->get_send_midi_clock() || _session == 0 || _midi_port == 0) {
return;
@@ -232,7 +232,7 @@ MidiClockTicker::tick (const framepos_t& /* transport_frame */, pframes_t nframe
} else if (_pos->speed == 1.0f) {
send_stop_event (0, nframes);
- if (_pos->frame == 0) {
+ if (_pos->sample == 0) {
send_start_event (0, nframes);
} else {
send_position_event (llrint (_pos->midi_beats), 0, nframes);
@@ -251,13 +251,13 @@ MidiClockTicker::tick (const framepos_t& /* transport_frame */, pframes_t nframe
if (_session->get_play_loop()) {
assert(_session->locations()->auto_loop_location());
- if (_pos->frame == _session->locations()->auto_loop_location()->start()) {
+ if (_pos->sample == _session->locations()->auto_loop_location()->start()) {
send_start_event (0, nframes);
} else {
send_continue_event (0, nframes);
}
- } else if (_pos->frame == 0) {
+ } else if (_pos->sample == 0) {
send_start_event (0, nframes);
} else {
send_continue_event (0, nframes);
@@ -278,13 +278,13 @@ MidiClockTicker::tick (const framepos_t& /* transport_frame */, pframes_t nframe
return;
}
- const framepos_t end = _pos->frame + nframes;
+ const samplepos_t end = _pos->sample + nframes;
double iter = _last_tick;
while (true) {
- double clock_delta = one_ppqn_in_frames (llrint (iter));
+ double clock_delta = one_ppqn_in_samples (llrint (iter));
double next_tick = iter + clock_delta;
- frameoffset_t next_tick_offset = llrint (next_tick) - end;
+ sampleoffset_t next_tick_offset = llrint (next_tick) - end;
DEBUG_TRACE (DEBUG::MidiClock,
string_compose ("Tick: iter: %1, last tick time: %2, next tick time: %3, offset: %4, cycle length: %5\n",
@@ -302,15 +302,15 @@ MidiClockTicker::tick (const framepos_t& /* transport_frame */, pframes_t nframe
}
_last_tick = iter;
- _pos->frame = end;
+ _pos->sample = end;
}
double
-MidiClockTicker::one_ppqn_in_frames (framepos_t transport_position)
+MidiClockTicker::one_ppqn_in_samples (samplepos_t transport_position)
{
- const double frames_per_quarter_note = _session->tempo_map().frames_per_quarter_note_at (transport_position, _session->nominal_frame_rate());
+ const double samples_per_quarter_note = _session->tempo_map().samples_per_quarter_note_at (transport_position, _session->nominal_sample_rate());
- return frames_per_quarter_note / double (_ppqn);
+ return samples_per_quarter_note / double (_ppqn);
}
void
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 3f81a64061..d925c2c40d 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -415,14 +415,14 @@ Track::set_name (const string& str)
}
void
-Track::set_latency_compensation (framecnt_t longest_session_latency)
+Track::set_latency_compensation (samplecnt_t longest_session_latency)
{
Route::set_latency_compensation (longest_session_latency);
_disk_reader->set_roll_delay (_roll_delay);
}
int
-Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing)
+Track::no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool session_state_changing)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
@@ -457,7 +457,7 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
XXX note the absurdity of ::no_roll() being called when we ARE rolling!
*/
- passthru_silence (start_frame, end_frame, nframes, 0);
+ passthru_silence (start_sample, end_sample, nframes, 0);
return 0;
}
/* we're really not rolling, so we're either delivery silence or actually
@@ -465,7 +465,7 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
*/
}
- _disk_writer->check_record_status (start_frame, can_record);
+ _disk_writer->check_record_status (start_sample, can_record);
bool be_silent;
@@ -529,14 +529,14 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
if (no_meter) {
BufferSet& bufs (_session.get_silent_buffers (n_process_buffers()));
- _meter->run (bufs, start_frame, end_frame, 1.0, nframes, true);
- _input->process_input (boost::shared_ptr<Processor>(), start_frame, end_frame, _session.transport_speed(), nframes);
+ _meter->run (bufs, start_sample, end_sample, 1.0, nframes, true);
+ _input->process_input (boost::shared_ptr<Processor>(), start_sample, end_sample, _session.transport_speed(), nframes);
} else {
- _input->process_input (_meter, start_frame, end_frame, _session.transport_speed(), nframes);
+ _input->process_input (_meter, start_sample, end_sample, _session.transport_speed(), nframes);
}
}
- passthru_silence (start_frame, end_frame, nframes, 0);
+ passthru_silence (start_sample, end_sample, nframes, 0);
} else {
@@ -545,10 +545,10 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput) {
- _meter->run (bufs, start_frame, end_frame, _session.transport_speed(), nframes, true);
+ _meter->run (bufs, start_sample, end_sample, _session.transport_speed(), nframes, true);
}
- passthru (bufs, start_frame, end_frame, nframes, false);
+ passthru (bufs, start_sample, end_sample, nframes, false);
}
flush_processor_buffers_locked (nframes);
@@ -594,7 +594,7 @@ void
Track::update_latency_information ()
{
Glib::Threads::RWLock::ReaderLock lr (_processor_lock);
- framecnt_t chain_latency = _input->latency ();
+ samplecnt_t chain_latency = _input->latency ();
for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p) {
(*p)->set_input_latency (chain_latency);
@@ -645,7 +645,7 @@ Track::set_pending_overwrite (bool o)
}
int
-Track::seek (framepos_t p, bool complete_refill)
+Track::seek (samplepos_t p, bool complete_refill)
{
if (_disk_reader->seek (p, complete_refill)) {
return -1;
@@ -654,19 +654,19 @@ Track::seek (framepos_t p, bool complete_refill)
}
int
-Track::can_internal_playback_seek (framecnt_t p)
+Track::can_internal_playback_seek (samplecnt_t p)
{
return _disk_reader->can_internal_playback_seek (p);
}
int
-Track::internal_playback_seek (framecnt_t p)
+Track::internal_playback_seek (samplecnt_t p)
{
return _disk_reader->internal_playback_seek (p);
}
void
-Track::non_realtime_locate (framepos_t p)
+Track::non_realtime_locate (samplepos_t p)
{
Route::non_realtime_locate (p);
@@ -691,10 +691,10 @@ Track::overwrite_existing_buffers ()
return _disk_reader->overwrite_existing_buffers ();
}
-framecnt_t
-Track::get_captured_frames (uint32_t n) const
+samplecnt_t
+Track::get_captured_samples (uint32_t n) const
{
- return _disk_writer->get_captured_frames (n);
+ return _disk_writer->get_captured_samples (n);
}
int
@@ -707,7 +707,7 @@ Track::set_loop (Location* l)
}
void
-Track::transport_looped (framepos_t p)
+Track::transport_looped (samplepos_t p)
{
return _disk_writer->transport_looped (p);
}
@@ -748,7 +748,7 @@ Track::pending_overwrite () const
}
void
-Track::prepare_to_stop (framepos_t t, framepos_t a)
+Track::prepare_to_stop (samplepos_t t, samplepos_t a)
{
_disk_writer->prepare_to_stop (t, a);
}
@@ -766,10 +766,10 @@ Track::n_channels ()
return _disk_reader->output_streams();
}
-framepos_t
-Track::get_capture_start_frame (uint32_t n) const
+samplepos_t
+Track::get_capture_start_sample (uint32_t n) const
{
- return _disk_writer->get_capture_start_frame (n);
+ return _disk_writer->get_capture_start_sample (n);
}
AlignStyle
@@ -784,13 +784,13 @@ Track::alignment_choice () const
return _disk_writer->alignment_choice ();
}
-framepos_t
+samplepos_t
Track::current_capture_start () const
{
return _disk_writer->current_capture_start ();
}
-framepos_t
+samplepos_t
Track::current_capture_end () const
{
return _disk_writer->current_capture_end ();
@@ -1128,7 +1128,7 @@ Track::monitoring_state () const
#endif
void
-Track::maybe_declick (BufferSet& bufs, framecnt_t nframes, int declick)
+Track::maybe_declick (BufferSet& bufs, samplecnt_t nframes, int declick)
{
/* never declick if there is an internal generator - we just want it to
keep generating sound without interruption.
@@ -1149,24 +1149,24 @@ Track::maybe_declick (BufferSet& bufs, framecnt_t nframes, int declick)
}
}
-framecnt_t
-Track::check_initial_delay (framecnt_t nframes, framepos_t& transport_frame)
+samplecnt_t
+Track::check_initial_delay (samplecnt_t nframes, samplepos_t& transport_sample)
{
if (_roll_delay > nframes) {
_roll_delay -= nframes;
silence_unlocked (nframes);
- /* transport frame is not legal for caller to use */
+ /* transport sample is not legal for caller to use */
return 0;
} else if (_roll_delay > 0) {
nframes -= _roll_delay;
silence_unlocked (_roll_delay);
- transport_frame += _roll_delay;
+ transport_sample += _roll_delay;
/* shuffle all the port buffers for things that lead "out" of this Route
- to reflect that we just wrote _roll_delay frames of silence.
+ to reflect that we just wrote _roll_delay samples of silence.
*/
Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
@@ -1269,10 +1269,10 @@ Track::use_captured_midi_sources (SourceList& srcs, CaptureInfos const & capture
return;
}
- framecnt_t total_capture = 0;
+ samplecnt_t total_capture = 0;
for (total_capture = 0, ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
- total_capture += (*ci)->frames;
+ total_capture += (*ci)->samples;
}
/* we will want to be able to keep (over)writing the source
@@ -1316,14 +1316,14 @@ Track::use_captured_midi_sources (SourceList& srcs, CaptureInfos const & capture
pl->clear_changes ();
pl->freeze ();
- /* Session frame time of the initial capture in this pass, which is where the source starts */
- framepos_t initial_capture = 0;
+ /* Session sample time of the initial capture in this pass, which is where the source starts */
+ samplepos_t initial_capture = 0;
if (!capture_info.empty()) {
initial_capture = capture_info.front()->start;
}
- BeatsFramesConverter converter (_session.tempo_map(), capture_info.front()->start);
- const framepos_t preroll_off = _session.preroll_record_trim_len ();
+ BeatsSamplesConverter converter (_session.tempo_map(), capture_info.front()->start);
+ const samplepos_t preroll_off = _session.preroll_record_trim_len ();
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
@@ -1332,18 +1332,18 @@ Track::use_captured_midi_sources (SourceList& srcs, CaptureInfos const & capture
RegionFactory::region_name (region_name, mfs->name(), false);
DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1 capture start @ %2 length %3 add new region %4\n",
- _name, (*ci)->start, (*ci)->frames, region_name));
+ _name, (*ci)->start, (*ci)->samples, region_name));
- // cerr << _name << ": based on ci of " << (*ci)->start << " for " << (*ci)->frames << " add a region\n";
+ // cerr << _name << ": based on ci of " << (*ci)->start << " for " << (*ci)->samples << " add a region\n";
try {
PropertyList plist;
/* start of this region is the offset between the start of its capture and the start of the whole pass */
plist.add (Properties::start, (*ci)->start - initial_capture);
- plist.add (Properties::length, (*ci)->frames);
- plist.add (Properties::length_beats, converter.from((*ci)->frames).to_double());
+ plist.add (Properties::length, (*ci)->samples);
+ plist.add (Properties::length_beats, converter.from((*ci)->samples).to_double());
plist.add (Properties::name, region_name);
boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
@@ -1408,7 +1408,7 @@ Track::use_captured_audio_sources (SourceList& srcs, CaptureInfos const & captur
try {
PropertyList plist;
- plist.add (Properties::start, afs->last_capture_start_frame());
+ plist.add (Properties::start, afs->last_capture_start_sample());
plist.add (Properties::length, afs->length(0));
plist.add (Properties::name, whole_file_region_name);
boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
@@ -1429,8 +1429,8 @@ Track::use_captured_audio_sources (SourceList& srcs, CaptureInfos const & captur
pl->set_capture_insertion_in_progress (true);
pl->freeze ();
- const framepos_t preroll_off = _session.preroll_record_trim_len ();
- framecnt_t buffer_position = afs->last_capture_start_frame ();
+ const samplepos_t preroll_off = _session.preroll_record_trim_len ();
+ samplecnt_t buffer_position = afs->last_capture_start_sample ();
CaptureInfos::const_iterator ci;
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
@@ -1440,14 +1440,14 @@ Track::use_captured_audio_sources (SourceList& srcs, CaptureInfos const & captur
RegionFactory::region_name (region_name, whole_file_region_name, false);
DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1 capture bufpos %5 start @ %2 length %3 add new region %4\n",
- _name, (*ci)->start, (*ci)->frames, region_name, buffer_position));
+ _name, (*ci)->start, (*ci)->samples, region_name, buffer_position));
try {
PropertyList plist;
plist.add (Properties::start, buffer_position);
- plist.add (Properties::length, (*ci)->frames);
+ plist.add (Properties::length, (*ci)->samples);
plist.add (Properties::name, region_name);
boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
@@ -1465,7 +1465,7 @@ Track::use_captured_audio_sources (SourceList& srcs, CaptureInfos const & captur
pl->add_region (region, (*ci)->start + preroll_off, 1, _disk_writer->non_layered());
pl->set_layer (region, DBL_MAX);
- buffer_position += (*ci)->frames;
+ buffer_position += (*ci)->samples;
}
pl->thaw ();
diff --git a/libs/ardour/transient_detector.cc b/libs/ardour/transient_detector.cc
index 6eed8369a7..4909e40741 100644
--- a/libs/ardour/transient_detector.cc
+++ b/libs/ardour/transient_detector.cc
@@ -72,7 +72,7 @@ TransientDetector::use_features (Plugin::FeatureSet& features, ostream* out)
(*out) << (*f).timestamp.toString() << endl;
}
- current_results->push_back (RealTime::realTime2Frame (f->timestamp, (framecnt_t) floor(sample_rate)));
+ current_results->push_back (RealTime::realTime2Frame (f->timestamp, (samplecnt_t) floor(sample_rate)));
}
}
@@ -111,7 +111,7 @@ TransientDetector::cleanup_transients (AnalysisFeatureList& t, float sr, float g
AnalysisFeatureList::iterator i = t.begin();
AnalysisFeatureList::iterator f, b;
- const framecnt_t gap_frames = (framecnt_t) floor (gap_msecs * (sr / 1000.0));
+ const samplecnt_t gap_samples = (samplecnt_t) floor (gap_msecs * (sr / 1000.0));
while (i != t.end()) {
@@ -123,7 +123,7 @@ TransientDetector::cleanup_transients (AnalysisFeatureList& t, float sr, float g
// move f until we find a new value that is far enough away
- while ((f != t.end()) && gap_frames > 0 && (((*f) - (*i)) < gap_frames)) {
+ while ((f != t.end()) && gap_samples > 0 && (((*f) - (*i)) < gap_samples)) {
++f;
}
@@ -150,7 +150,7 @@ TransientDetector::update_positions (Readable* src, uint32_t channel, AnalysisFe
while (i != positions.end()) {
/* read from source */
- framecnt_t const to_read = buff_size;
+ samplecnt_t const to_read = buff_size;
if (src->read (data, (*i) - buff_size, to_read, channel) != to_read) {
break;
diff --git a/libs/ardour/unknown_processor.cc b/libs/ardour/unknown_processor.cc
index 8fbb1787c7..7532d968df 100644
--- a/libs/ardour/unknown_processor.cc
+++ b/libs/ardour/unknown_processor.cc
@@ -111,7 +111,7 @@ UnknownProcessor::can_support_io_configuration (const ChanCount &in, ChanCount &
}
void
-UnknownProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
+UnknownProcessor::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
{
if (!have_ioconfig) {
return;
diff --git a/libs/ardour/uri_map.cc b/libs/ardour/uri_map.cc
index 9879fe22d1..cdbdbd564c 100644
--- a/libs/ardour/uri_map.cc
+++ b/libs/ardour/uri_map.cc
@@ -56,7 +56,7 @@ URIMap::URIDs::init(URIMap& uri_map)
time_beatUnit = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#beatUnit");
time_beatsPerBar = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#beatsPerBar");
time_beatsPerMinute = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#beatsPerMinute");
- time_frame = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#frame");
+ time_sample = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#frame");
time_speed = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#speed");
patch_Get = uri_map.uri_to_id("http://lv2plug.in/ns/ext/patch#Get");
patch_Set = uri_map.uri_to_id("http://lv2plug.in/ns/ext/patch#Set");
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc
index 17c1da0850..6a59d1b79b 100644
--- a/libs/ardour/utils.cc
+++ b/libs/ardour/utils.cc
@@ -383,7 +383,7 @@ ARDOUR::CFStringRefToStdString(CFStringRef stringRef)
#endif // __APPLE__
void
-ARDOUR::compute_equal_power_fades (framecnt_t nframes, float* in, float* out)
+ARDOUR::compute_equal_power_fades (samplecnt_t nframes, float* in, float* out)
{
double step;
@@ -391,7 +391,7 @@ ARDOUR::compute_equal_power_fades (framecnt_t nframes, float* in, float* out)
in[0] = 0.0f;
- for (framecnt_t i = 1; i < nframes - 1; ++i) {
+ for (samplecnt_t i = 1; i < nframes - 1; ++i) {
in[i] = in[i-1] + step;
}
@@ -400,7 +400,7 @@ ARDOUR::compute_equal_power_fades (framecnt_t nframes, float* in, float* out)
const float pan_law_attenuation = -3.0f;
const float scale = 2.0f - 4.0f * powf (10.0f,pan_law_attenuation/20.0f);
- for (framecnt_t n = 0; n < nframes; ++n) {
+ for (samplecnt_t n = 0; n < nframes; ++n) {
float inVal = in[n];
float outVal = 1 - inVal;
out[n] = outVal * (scale * outVal + 1.0f - scale);
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index be520ddc17..8e0053f778 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -47,7 +47,7 @@ VSTPlugin::VSTPlugin (AudioEngine& engine, Session& session, VSTHandle* handle)
, _plugin (0)
, _pi (0)
, _num (0)
- , _transport_frame (0)
+ , _transport_sample (0)
, _transport_speed (0.f)
, _eff_bypassed (false)
{
@@ -62,7 +62,7 @@ VSTPlugin::VSTPlugin (const VSTPlugin& other)
, _pi (other._pi)
, _num (other._num)
, _midi_out_buf (other._midi_out_buf)
- , _transport_frame (0)
+ , _transport_sample (0)
, _transport_speed (0.f)
, _parameter_defaults (other._parameter_defaults)
, _eff_bypassed (other._eff_bypassed)
@@ -89,7 +89,7 @@ void
VSTPlugin::init_plugin ()
{
/* set rate and blocksize */
- _plugin->dispatcher (_plugin, effSetSampleRate, 0, 0, NULL, (float) _session.frame_rate());
+ _plugin->dispatcher (_plugin, effSetSampleRate, 0, 0, NULL, (float) _session.sample_rate());
_plugin->dispatcher (_plugin, effSetBlockSize, 0, _session.get_block_size(), NULL, 0.0f);
}
@@ -606,7 +606,7 @@ VSTPlugin::describe_parameter (Evoral::Parameter param)
return name;
}
-framecnt_t
+samplecnt_t
VSTPlugin::signal_latency () const
{
if (_user_latency) {
@@ -634,9 +634,9 @@ VSTPlugin::automatable () const
int
VSTPlugin::connect_and_run (BufferSet& bufs,
- framepos_t start, framepos_t end, double speed,
+ samplepos_t start, samplepos_t end, double speed,
ChanMapping in_map, ChanMapping out_map,
- pframes_t nframes, framecnt_t offset)
+ pframes_t nframes, samplecnt_t offset)
{
Plugin::connect_and_run(bufs, start, end, speed, in_map, out_map, nframes, offset);
@@ -650,7 +650,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
return 0;
}
- _transport_frame = start;
+ _transport_sample = start;
_transport_speed = speed;
ChanCount bufs_count;
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index bca5dab8ce..a3ff5e74ea 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -45,7 +45,7 @@ libardour_sources = [
'automation_control.cc',
'automation_list.cc',
'automation_watch.cc',
- 'beats_frames_converter.cc',
+ 'beats_samples_converter.cc',
'broadcast_info.cc',
'buffer.cc',
'buffer_manager.cc',
diff --git a/libs/audiographer/audiographer/general/analyser.h b/libs/audiographer/audiographer/general/analyser.h
index 9bd49b33c8..c912664cf0 100644
--- a/libs/audiographer/audiographer/general/analyser.h
+++ b/libs/audiographer/audiographer/general/analyser.h
@@ -29,7 +29,7 @@ namespace AudioGrapher
class LIBAUDIOGRAPHER_API Analyser : public LoudnessReader
{
public:
- Analyser (float sample_rate, unsigned int channels, framecnt_t bufsize, framecnt_t n_samples);
+ Analyser (float sample_rate, unsigned int channels, samplecnt_t bufsize, samplecnt_t n_samples);
~Analyser ();
void process (ProcessContext<float> const & c);
ARDOUR::ExportAnalysisPtr result ();
@@ -48,10 +48,10 @@ class LIBAUDIOGRAPHER_API Analyser : public LoudnessReader
ARDOUR::ExportAnalysis _result;
- framecnt_t _n_samples;
- framecnt_t _pos;
- framecnt_t _spp;
- framecnt_t _fpp;
+ samplecnt_t _n_samples;
+ samplecnt_t _pos;
+ samplecnt_t _spp;
+ samplecnt_t _fpp;
float* _hann_window;
uint32_t _fft_data_size;
diff --git a/libs/audiographer/audiographer/general/chunker.h b/libs/audiographer/audiographer/general/chunker.h
index 466a333655..28ac79b603 100644
--- a/libs/audiographer/audiographer/general/chunker.h
+++ b/libs/audiographer/audiographer/general/chunker.h
@@ -10,7 +10,7 @@
namespace AudioGrapher
{
-/// A class that chunks process cycles into equal sized frames
+/// A class that chunks process cycles into equal sized samples
template<typename T = DefaultSampleType>
class /*LIBAUDIOGRAPHER_API*/ Chunker
: public ListedSource<T>
@@ -21,7 +21,7 @@ class /*LIBAUDIOGRAPHER_API*/ Chunker
/** Constructs a new Chunker with a constant chunk size.
* \n NOT RT safe
*/
- Chunker (framecnt_t chunk_size)
+ Chunker (samplecnt_t chunk_size)
: chunk_size (chunk_size)
, position (0)
{
@@ -42,29 +42,29 @@ class /*LIBAUDIOGRAPHER_API*/ Chunker
{
check_flags (*this, context);
- framecnt_t frames_left = context.frames();
- framecnt_t input_position = 0;
+ samplecnt_t samples_left = context.samples();
+ samplecnt_t input_position = 0;
- while (position + frames_left >= chunk_size) {
+ while (position + samples_left >= chunk_size) {
// Copy from context to buffer
- framecnt_t const frames_to_copy = chunk_size - position;
- TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], frames_to_copy);
+ samplecnt_t const samples_to_copy = chunk_size - position;
+ TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], samples_to_copy);
// Update counters
position = 0;
- input_position += frames_to_copy;
- frames_left -= frames_to_copy;
+ input_position += samples_to_copy;
+ samples_left -= samples_to_copy;
// Output whole buffer
ProcessContext<T> c_out (context, buffer, chunk_size);
- if (frames_left) { c_out.remove_flag(ProcessContext<T>::EndOfInput); }
+ if (samples_left) { c_out.remove_flag(ProcessContext<T>::EndOfInput); }
ListedSource<T>::output (c_out);
}
- if (frames_left) {
+ if (samples_left) {
// Copy the rest of the data
- TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], frames_left);
- position += frames_left;
+ TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], samples_left);
+ position += samples_left;
}
if (context.has_flag (ProcessContext<T>::EndOfInput) && position > 0) {
@@ -75,8 +75,8 @@ class /*LIBAUDIOGRAPHER_API*/ Chunker
using Sink<T>::process;
private:
- framecnt_t chunk_size;
- framecnt_t position;
+ samplecnt_t chunk_size;
+ samplecnt_t position;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/deinterleaver.h b/libs/audiographer/audiographer/general/deinterleaver.h
index 63b6c95589..491c07fcb6 100644
--- a/libs/audiographer/audiographer/general/deinterleaver.h
+++ b/libs/audiographer/audiographer/general/deinterleaver.h
@@ -26,7 +26,7 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
/// Constructor. \n RT safe
DeInterleaver()
: channels (0)
- , max_frames (0)
+ , max_samples (0)
, buffer (0)
{}
@@ -35,12 +35,12 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
typedef boost::shared_ptr<Source<T> > SourcePtr;
/// Inits the deinterleaver. Must be called before using. \n Not RT safe
- void init (unsigned int num_channels, framecnt_t max_frames_per_channel)
+ void init (unsigned int num_channels, samplecnt_t max_samples_per_channel)
{
reset();
channels = num_channels;
- max_frames = max_frames_per_channel;
- buffer = new T[max_frames];
+ max_samples = max_samples_per_channel;
+ buffer = new T[max_samples];
for (unsigned int i = 0; i < channels; ++i) {
outputs.push_back (OutputPtr (new IdentityVertex<T>));
@@ -60,28 +60,28 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
/// Deinterleaves data and outputs it to the outputs. \n RT safe
void process (ProcessContext<T> const & c)
{
- framecnt_t frames = c.frames();
+ samplecnt_t samples = c.samples();
T const * data = c.data();
- framecnt_t const frames_per_channel = frames / channels;
+ samplecnt_t const samples_per_channel = samples / channels;
if (throw_level (ThrowProcess) && c.channels() != channels) {
throw Exception (*this, "wrong amount of channels given to process()");
}
- if (throw_level (ThrowProcess) && frames_per_channel > max_frames) {
- throw Exception (*this, "too many frames given to process()");
+ if (throw_level (ThrowProcess) && samples_per_channel > max_samples) {
+ throw Exception (*this, "too many samples given to process()");
}
unsigned int channel = 0;
for (typename std::vector<OutputPtr>::iterator it = outputs.begin(); it != outputs.end(); ++it, ++channel) {
if (!*it) { continue; }
- for (unsigned int i = 0; i < frames_per_channel; ++i) {
+ for (unsigned int i = 0; i < samples_per_channel; ++i) {
buffer[i] = data[channel + (channels * i)];
}
- ProcessContext<T> c_out (c, buffer, frames_per_channel, 1);
+ ProcessContext<T> c_out (c, buffer, samples_per_channel, 1);
(*it)->process (c_out);
}
}
@@ -96,12 +96,12 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
delete [] buffer;
buffer = 0;
channels = 0;
- max_frames = 0;
+ max_samples = 0;
}
std::vector<OutputPtr> outputs;
unsigned int channels;
- framecnt_t max_frames;
+ samplecnt_t max_samples;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/interleaver.h b/libs/audiographer/audiographer/general/interleaver.h
index c1b5e92cfe..7ea1be1ab8 100644
--- a/libs/audiographer/audiographer/general/interleaver.h
+++ b/libs/audiographer/audiographer/general/interleaver.h
@@ -25,20 +25,20 @@ class /*LIBAUDIOGRAPHER_API*/ Interleaver
/// Constructs an interleaver \n RT safe
Interleaver()
: channels (0)
- , max_frames (0)
+ , max_samples (0)
, buffer (0)
{}
~Interleaver() { reset(); }
/// Inits the interleaver. Must be called before using. \n Not RT safe
- void init (unsigned int num_channels, framecnt_t max_frames_per_channel)
+ void init (unsigned int num_channels, samplecnt_t max_samples_per_channel)
{
reset();
channels = num_channels;
- max_frames = max_frames_per_channel;
+ max_samples = max_samples_per_channel;
- buffer = new T[channels * max_frames];
+ buffer = new T[channels * max_samples];
for (unsigned int i = 0; i < channels; ++i) {
inputs.push_back (InputPtr (new Input (*this, i)));
@@ -63,27 +63,27 @@ class /*LIBAUDIOGRAPHER_API*/ Interleaver
{
public:
Input (Interleaver & parent, unsigned int channel)
- : frames_written (0), parent (parent), channel (channel) {}
+ : samples_written (0), parent (parent), channel (channel) {}
void process (ProcessContext<T> const & c)
{
if (parent.throw_level (ThrowProcess) && c.channels() > 1) {
throw Exception (*this, "Data input has more than on channel");
}
- if (parent.throw_level (ThrowStrict) && frames_written) {
+ if (parent.throw_level (ThrowStrict) && samples_written) {
throw Exception (*this, "Input channels out of sync");
}
- frames_written = c.frames();
+ samples_written = c.samples();
parent.write_channel (c, channel);
}
using Sink<T>::process;
- framecnt_t frames() { return frames_written; }
- void reset() { frames_written = 0; }
+ samplecnt_t samples() { return samples_written; }
+ void reset() { samples_written = 0; }
private:
- framecnt_t frames_written;
+ samplecnt_t samples_written;
Interleaver & parent;
unsigned int channel;
};
@@ -94,7 +94,7 @@ class /*LIBAUDIOGRAPHER_API*/ Interleaver
delete [] buffer;
buffer = 0;
channels = 0;
- max_frames = 0;
+ max_samples = 0;
}
void reset_channels ()
@@ -107,44 +107,44 @@ class /*LIBAUDIOGRAPHER_API*/ Interleaver
void write_channel (ProcessContext<T> const & c, unsigned int channel)
{
- if (throw_level (ThrowProcess) && c.frames() > max_frames) {
+ if (throw_level (ThrowProcess) && c.samples() > max_samples) {
reset_channels();
- throw Exception (*this, "Too many frames given to an input");
+ throw Exception (*this, "Too many samples given to an input");
}
- for (unsigned int i = 0; i < c.frames(); ++i) {
+ for (unsigned int i = 0; i < c.samples(); ++i) {
buffer[channel + (channels * i)] = c.data()[i];
}
- framecnt_t const ready_frames = ready_to_output();
- if (ready_frames) {
- ProcessContext<T> c_out (c, buffer, ready_frames, channels);
+ samplecnt_t const ready_samples = ready_to_output();
+ if (ready_samples) {
+ ProcessContext<T> c_out (c, buffer, ready_samples, channels);
ListedSource<T>::output (c_out);
reset_channels ();
}
}
- framecnt_t ready_to_output()
+ samplecnt_t ready_to_output()
{
- framecnt_t ready_frames = inputs[0]->frames();
- if (!ready_frames) { return 0; }
+ samplecnt_t ready_samples = inputs[0]->samples();
+ if (!ready_samples) { return 0; }
for (unsigned int i = 1; i < channels; ++i) {
- framecnt_t const frames = inputs[i]->frames();
- if (!frames) { return 0; }
- if (throw_level (ThrowProcess) && frames != ready_frames) {
- init (channels, max_frames);
- throw Exception (*this, "Frames count out of sync");
+ samplecnt_t const samples = inputs[i]->samples();
+ if (!samples) { return 0; }
+ if (throw_level (ThrowProcess) && samples != ready_samples) {
+ init (channels, max_samples);
+ throw Exception (*this, "Samples count out of sync");
}
}
- return ready_frames * channels;
+ return ready_samples * channels;
}
typedef boost::shared_ptr<Input> InputPtr;
std::vector<InputPtr> inputs;
unsigned int channels;
- framecnt_t max_frames;
+ samplecnt_t max_samples;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/loudness_reader.h b/libs/audiographer/audiographer/general/loudness_reader.h
index c86fd521da..8c9ccb4149 100644
--- a/libs/audiographer/audiographer/general/loudness_reader.h
+++ b/libs/audiographer/audiographer/general/loudness_reader.h
@@ -32,7 +32,7 @@ namespace AudioGrapher
class LIBAUDIOGRAPHER_API LoudnessReader : public ListedSource<float>, public Sink<float>
{
public:
- LoudnessReader (float sample_rate, unsigned int channels, framecnt_t bufsize);
+ LoudnessReader (float sample_rate, unsigned int channels, samplecnt_t bufsize);
~LoudnessReader ();
void reset ();
@@ -52,8 +52,8 @@ class LIBAUDIOGRAPHER_API LoudnessReader : public ListedSource<float>, public Si
float _sample_rate;
unsigned int _channels;
- framecnt_t _bufsize;
- framecnt_t _pos;
+ samplecnt_t _bufsize;
+ samplecnt_t _pos;
float* _bufs[2];
};
diff --git a/libs/audiographer/audiographer/general/normalizer.h b/libs/audiographer/audiographer/general/normalizer.h
index e5f73a0f08..cd4e375db2 100644
--- a/libs/audiographer/audiographer/general/normalizer.h
+++ b/libs/audiographer/audiographer/general/normalizer.h
@@ -28,7 +28,7 @@ public:
* non-const ProcessContexts are given to \a process() .
* \n Not RT safe
*/
- void alloc_buffer(framecnt_t frames);
+ void alloc_buffer(samplecnt_t samples);
/// Process a const ProcessContext \see alloc_buffer() \n RT safe
void process (ProcessContext<float> const & c);
@@ -42,7 +42,7 @@ private:
float gain;
float * buffer;
- framecnt_t buffer_size;
+ samplecnt_t buffer_size;
};
diff --git a/libs/audiographer/audiographer/general/peak_reader.h b/libs/audiographer/audiographer/general/peak_reader.h
index 8bf0faa792..bb04239544 100644
--- a/libs/audiographer/audiographer/general/peak_reader.h
+++ b/libs/audiographer/audiographer/general/peak_reader.h
@@ -25,7 +25,7 @@ class /*LIBAUDIOGRAPHER_API*/ PeakReader : public ListedSource<float>, public Si
/// Finds peaks from the data \n RT safe
void process (ProcessContext<float> const & c)
{
- peak = Routines::compute_peak (c.data(), c.frames(), peak);
+ peak = Routines::compute_peak (c.data(), c.samples(), peak);
ListedSource<float>::output(c);
}
diff --git a/libs/audiographer/audiographer/general/sample_format_converter.h b/libs/audiographer/audiographer/general/sample_format_converter.h
index 96dd6aa72a..9a79fc927c 100644
--- a/libs/audiographer/audiographer/general/sample_format_converter.h
+++ b/libs/audiographer/audiographer/general/sample_format_converter.h
@@ -35,13 +35,13 @@ class LIBAUDIOGRAPHER_API SampleFormatConverter
~SampleFormatConverter ();
/** Initialize and allocate buffers for processing.
- * \param max_frames maximum number of frames that is allowed to be used in calls to \a process()
+ * \param max_samples maximum number of samples that is allowed to be used in calls to \a process()
* \param type dither type from \a DitherType
* \param data_width data with in bits
* \note If the non-const version of process() is used with floats,
* there is no need to call this function.
*/
- void init (framecnt_t max_frames, int type, int data_width);
+ void init (samplecnt_t max_samples, int type, int data_width);
/// Set whether or not clipping to [-1.0, 1.0] should occur when TOut = float. Clipping is off by default
void set_clip_floats (bool yn) { clip_floats = yn; }
@@ -54,12 +54,12 @@ class LIBAUDIOGRAPHER_API SampleFormatConverter
private:
void reset();
- void init_common (framecnt_t max_frames); // not-template-specialized part of init
- void check_frame_and_channel_count (framecnt_t frames, ChannelCount channels_);
+ void init_common (samplecnt_t max_samples); // not-template-specialized part of init
+ void check_sample_and_channel_count (samplecnt_t samples, ChannelCount channels_);
ChannelCount channels;
GDither dither;
- framecnt_t data_out_size;
+ samplecnt_t data_out_size;
TOut * data_out;
bool clip_floats;
diff --git a/libs/audiographer/audiographer/general/silence_trimmer.h b/libs/audiographer/audiographer/general/silence_trimmer.h
index 7cfa0658f1..e09c348c52 100644
--- a/libs/audiographer/audiographer/general/silence_trimmer.h
+++ b/libs/audiographer/audiographer/general/silence_trimmer.h
@@ -30,7 +30,7 @@ struct SilenceTester<float> {
};
-/// Removes and adds silent frames to beginning and/or end of stream
+/// Removes and adds silent samples to beginning and/or end of stream
template<typename T = DefaultSampleType>
class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
: public ListedSource<T>
@@ -41,7 +41,7 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
public:
/// Constructor, \see reset() \n Not RT safe
- SilenceTrimmer(framecnt_t silence_buffer_size_ = 1024, float thresh_dB = -INFINITY)
+ SilenceTrimmer(samplecnt_t silence_buffer_size_ = 1024, float thresh_dB = -INFINITY)
: silence_buffer_size (0)
, silence_buffer (0)
, tester (thresh_dB)
@@ -60,7 +60,7 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
* This also defines the maximum length of output process context
* which can be output during long intermediate silence.
*/
- void reset (framecnt_t silence_buffer_size_ = 1024)
+ void reset (samplecnt_t silence_buffer_size_ = 1024)
{
if (throw_level (ThrowObject) && silence_buffer_size_ == 0) {
throw Exception (*this,
@@ -78,34 +78,34 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
processing_finished = false;
trim_beginning = false;
trim_end = false;
- silence_frames = 0;
+ silence_samples = 0;
max_output_frames = 0;
add_to_beginning = 0;
add_to_end = 0;
}
- /** Tells that \a frames_per_channel frames of silence per channel should be added to beginning
+ /** Tells that \a samples_per_channel samples of silence per channel should be added to beginning
* Needs to be called before starting processing.
* \n RT safe
*/
- void add_silence_to_beginning (framecnt_t frames_per_channel)
+ void add_silence_to_beginning (samplecnt_t samples_per_channel)
{
if (throw_level (ThrowObject) && processed_data) {
throw Exception(*this, "Tried to add silence to beginning after processing started");
}
- add_to_beginning = frames_per_channel;
+ add_to_beginning = samples_per_channel;
}
- /** Tells that \a frames_per_channel frames of silence per channel should be added to end
+ /** Tells that \a samples_per_channel samples of silence per channel should be added to end
* Needs to be called before end is reached.
* \n RT safe
*/
- void add_silence_to_end (framecnt_t frames_per_channel)
+ void add_silence_to_end (samplecnt_t samples_per_channel)
{
if (throw_level (ThrowObject) && processed_data) {
throw Exception(*this, "Tried to add silence to end after processing started");
}
- add_to_end = frames_per_channel;
+ add_to_end = samples_per_channel;
}
/** Tells whether ot nor silence should be trimmed from the beginning
@@ -166,17 +166,17 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
* may lend itself for some inspiration.
*/
- framecnt_t output_start_index = 0;
- framecnt_t output_sample_count = c.frames();
+ samplecnt_t output_start_index = 0;
+ samplecnt_t output_sample_count = c.samples();
if (!processed_data) {
if (trim_beginning) {
- framecnt_t first_non_silent_frame_index = 0;
- if (find_first_non_silent_frame (c, first_non_silent_frame_index)) {
+ samplecnt_t first_non_silent_sample_index = 0;
+ if (find_first_non_silent_sample (c, first_non_silent_sample_index)) {
// output from start of non-silent data until end of buffer
// output_sample_count may also be altered in trim end
- output_start_index = first_non_silent_frame_index;
- output_sample_count = c.frames() - first_non_silent_frame_index;
+ output_start_index = first_non_silent_sample_index;
+ output_sample_count = c.samples() - first_non_silent_sample_index;
processed_data = true;
} else {
// keep entering this block until non-silence is found to trim
@@ -189,35 +189,35 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
// This block won't be called again so add silence to beginning
if (processed_data && add_to_beginning) {
add_to_beginning *= c.channels ();
- output_silence_frames (c, add_to_beginning);
+ output_silence_samples (c, add_to_beginning);
}
}
if (processed_data) {
if (trim_end) {
- framecnt_t first_non_silent_frame_index = 0;
- if (find_first_non_silent_frame (c, first_non_silent_frame_index)) {
+ samplecnt_t first_non_silent_sample_index = 0;
+ if (find_first_non_silent_sample (c, first_non_silent_sample_index)) {
// context buffer contains non-silent data, flush any intermediate silence
- output_silence_frames (c, silence_frames);
+ output_silence_samples (c, silence_samples);
- framecnt_t silent_frame_index = 0;
- find_last_silent_frame_reverse (c, silent_frame_index);
+ samplecnt_t silent_sample_index = 0;
+ find_last_silent_sample_reverse (c, silent_sample_index);
// Count of samples at end of block that are "silent", may be zero.
- framecnt_t silent_end_samples = c.frames () - silent_frame_index;
- framecnt_t samples_before_silence = c.frames() - silent_end_samples;
+ samplecnt_t silent_end_samples = c.samples () - silent_sample_index;
+ samplecnt_t samples_before_silence = c.samples() - silent_end_samples;
- assert (samples_before_silence + silent_end_samples == c.frames ());
+ assert (samples_before_silence + silent_end_samples == c.samples ());
// output_start_index may be non-zero if start trim occurred above
output_sample_count = samples_before_silence - output_start_index;
// keep track of any silent samples not output
- silence_frames = silent_end_samples;
+ silence_samples = silent_end_samples;
} else {
// whole context buffer is silent output nothing
- silence_frames += c.frames ();
+ silence_samples += c.samples ();
output_sample_count = 0;
}
}
@@ -230,7 +230,7 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
// Finally, if in last process call, add silence to end
if (processing_finished && processed_data && add_to_end) {
add_to_end *= c.channels();
- output_silence_frames (c, add_to_end);
+ output_silence_samples (c, add_to_end);
}
if (processing_finished) {
@@ -250,13 +250,13 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
private:
- bool find_first_non_silent_frame (ProcessContext<T> const & c, framecnt_t & result_frame)
+ bool find_first_non_silent_sample (ProcessContext<T> const & c, samplecnt_t & result_sample)
{
- for (framecnt_t i = 0; i < c.frames(); ++i) {
+ for (samplecnt_t i = 0; i < c.samples(); ++i) {
if (!tester.is_silent (c.data()[i])) {
- result_frame = i;
+ result_sample = i;
// Round down to nearest interleaved "frame" beginning
- result_frame -= result_frame % c.channels();
+ result_sample -= result_sample % c.channels();
return true;
}
}
@@ -264,43 +264,43 @@ private:
}
/**
- * Reverse find the last silent frame index. If the last sample in the
+ * Reverse find the last silent sample index. If the last sample in the
* buffer is non-silent the index will be one past the end of the buffer and
- * equal to c.frames(). e.g silent_end_samples = c.frames() - result_frame
+ * equal to c.samples(). e.g silent_end_samples = c.samples() - result_sample
*
- * @return true if result_frame index is valid, false if there were only
+ * @return true if result_sample index is valid, false if there were only
* silent samples in the context buffer
*/
- bool find_last_silent_frame_reverse (ProcessContext<T> const & c, framecnt_t & result_frame)
+ bool find_last_silent_sample_reverse (ProcessContext<T> const & c, samplecnt_t & result_sample)
{
- framecnt_t last_sample_index = c.frames() - 1;
+ samplecnt_t last_sample_index = c.samples() - 1;
- for (framecnt_t i = last_sample_index; i >= 0; --i) {
+ for (samplecnt_t i = last_sample_index; i >= 0; --i) {
if (!tester.is_silent (c.data()[i])) {
- result_frame = i;
+ result_sample = i;
// Round down to nearest interleaved "frame" beginning
- result_frame -= result_frame % c.channels();
- // Round up to return the "last" silent interleaved frame
- result_frame += c.channels();
+ result_sample -= result_sample % c.channels();
+ // Round up to return the "last" silent interleaved sample
+ result_sample += c.channels();
return true;
}
}
return false;
}
- void output_silence_frames (ProcessContext<T> const & c, framecnt_t & total_frames)
+ void output_silence_samples (ProcessContext<T> const & c, samplecnt_t & total_samples)
{
assert (!c.has_flag (ProcessContext<T>::EndOfInput));
- while (total_frames > 0) {
- framecnt_t frames = std::min (silence_buffer_size, total_frames);
+ while (total_samples > 0) {
+ samplecnt_t samples = std::min (silence_buffer_size, total_samples);
if (max_output_frames) {
- frames = std::min (frames, max_output_frames);
+ samples = std::min (samples, max_output_frames);
}
- frames -= frames % c.channels();
+ samples -= samples % c.channels();
- total_frames -= frames;
- ConstProcessContext<T> c_out (c, silence_buffer, frames);
+ total_samples -= samples;
+ ConstProcessContext<T> c_out (c, silence_buffer, samples);
ListedSource<T>::output (c_out);
}
}
@@ -311,13 +311,13 @@ private:
bool trim_beginning;
bool trim_end;
- framecnt_t silence_frames;
- framecnt_t max_output_frames;
+ samplecnt_t silence_samples;
+ samplecnt_t max_output_frames;
- framecnt_t add_to_beginning;
- framecnt_t add_to_end;
+ samplecnt_t add_to_beginning;
+ samplecnt_t add_to_end;
- framecnt_t silence_buffer_size;
+ samplecnt_t silence_buffer_size;
T * silence_buffer;
SilenceTester<T> tester;
diff --git a/libs/audiographer/audiographer/general/sr_converter.h b/libs/audiographer/audiographer/general/sr_converter.h
index a2e94d9bc0..8edc4b8c99 100644
--- a/libs/audiographer/audiographer/general/sr_converter.h
+++ b/libs/audiographer/audiographer/general/sr_converter.h
@@ -26,10 +26,10 @@ class LIBAUDIOGRAPHER_API SampleRateConverter
~SampleRateConverter ();
/// Init converter \n Not RT safe
- void init (framecnt_t in_rate, framecnt_t out_rate, int quality = 0);
+ void init (samplecnt_t in_rate, samplecnt_t out_rate, int quality = 0);
- /// Returns max amount of frames that will be output \n RT safe
- framecnt_t allocate_buffers (framecnt_t max_frames);
+ /// Returns max amount of samples that will be output \n RT safe
+ samplecnt_t allocate_buffers (samplecnt_t max_samples);
/** Does sample rate conversion.
* Note that outpt size may vary a lot.
@@ -47,14 +47,14 @@ class LIBAUDIOGRAPHER_API SampleRateConverter
bool active;
uint32_t channels;
- framecnt_t max_frames_in;
+ samplecnt_t max_samples_in;
float * leftover_data;
- framecnt_t leftover_frames;
- framecnt_t max_leftover_frames;
+ samplecnt_t leftover_samples;
+ samplecnt_t max_leftover_samples;
float * data_out;
- framecnt_t data_out_size;
+ samplecnt_t data_out_size;
SRC_DATA src_data;
SRC_STATE* src_state;
diff --git a/libs/audiographer/audiographer/process_context.h b/libs/audiographer/audiographer/process_context.h
index 16e637b85c..3b54accc06 100644
--- a/libs/audiographer/audiographer/process_context.h
+++ b/libs/audiographer/audiographer/process_context.h
@@ -41,45 +41,45 @@ public:
public:
- /// Basic constructor with data, frame and channel count
- ProcessContext (T * data, framecnt_t frames, ChannelCount channels)
- : _data (data), _frames (frames), _channels (channels)
+ /// Basic constructor with data, sample and channel count
+ ProcessContext (T * data, samplecnt_t samples, ChannelCount channels)
+ : _data (data), _samples (samples), _channels (channels)
{ validate_data(); }
/// Normal copy constructor
ProcessContext (ProcessContext<T> const & other)
- : Throwing<throwLevel>(), _data (other._data), _frames (other._frames), _channels (other._channels), _flags (other._flags)
+ : Throwing<throwLevel>(), _data (other._data), _samples (other._samples), _channels (other._channels), _flags (other._flags)
{ /* No need to validate data */ }
- /// "Copy constructor" with unique data, frame and channel count, but copies flags
+ /// "Copy constructor" with unique data, sample and channel count, but copies flags
template<typename Y>
- ProcessContext (ProcessContext<Y> const & other, T * data, framecnt_t frames, ChannelCount channels)
- : Throwing<throwLevel>(), _data (data), _frames (frames), _channels (channels), _flags (other.flags())
+ ProcessContext (ProcessContext<Y> const & other, T * data, samplecnt_t samples, ChannelCount channels)
+ : Throwing<throwLevel>(), _data (data), _samples (samples), _channels (channels), _flags (other.flags())
{ validate_data(); }
- /// "Copy constructor" with unique data and frame count, but copies channel count and flags
+ /// "Copy constructor" with unique data and sample count, but copies channel count and flags
template<typename Y>
- ProcessContext (ProcessContext<Y> const & other, T * data, framecnt_t frames)
- : Throwing<throwLevel>(), _data (data), _frames (frames), _channels (other.channels()), _flags (other.flags())
+ ProcessContext (ProcessContext<Y> const & other, T * data, samplecnt_t samples)
+ : Throwing<throwLevel>(), _data (data), _samples (samples), _channels (other.channels()), _flags (other.flags())
{ validate_data(); }
- /// "Copy constructor" with unique data, but copies frame and channel count + flags
+ /// "Copy constructor" with unique data, but copies sample and channel count + flags
template<typename Y>
ProcessContext (ProcessContext<Y> const & other, T * data)
- : Throwing<throwLevel>(), _data (data), _frames (other.frames()), _channels (other.channels()), _flags (other.flags())
+ : Throwing<throwLevel>(), _data (data), _samples (other.samples()), _channels (other.channels()), _flags (other.flags())
{ /* No need to validate data */ }
/// Make new Context out of the beginning of this context
- ProcessContext beginning (framecnt_t frames)
+ ProcessContext beginning (samplecnt_t samples)
{
- if (throw_level (ThrowProcess) && frames > _frames) {
+ if (throw_level (ThrowProcess) && samples > _samples) {
throw Exception (*this, boost::str (boost::format
- ("Trying to use too many frames of %1% for a new Context: %2% instead of %3%")
- % DebugUtils::demangled_name (*this) % frames % _frames));
+ ("Trying to use too many samples of %1% for a new Context: %2% instead of %3%")
+ % DebugUtils::demangled_name (*this) % samples % _samples));
}
validate_data ();
- return ProcessContext (*this, _data, frames);
+ return ProcessContext (*this, _data, samples);
}
virtual ~ProcessContext () {}
@@ -88,16 +88,16 @@ public:
inline T const * data() const { return _data; }
inline T * data() { return _data; }
- /// \a frames tells how many frames the array pointed by data contains
- inline framecnt_t const & frames() const { return _frames; }
+ /// \a samples tells how many samples the array pointed by data contains
+ inline samplecnt_t const & samples() const { return _samples; }
/** \a channels tells how many interleaved channels \a data contains
- * If \a channels is greater than 1, each channel contains \a frames / \a channels frames of data
+ * If \a channels is greater than 1, each channel contains \a samples / \a channels samples of data
*/
inline ChannelCount const & channels() const { return _channels; }
- /// Returns the amount of frames per channel
- inline framecnt_t frames_per_channel() const { return _frames / _channels; }
+ /// Returns the amount of samples per channel
+ inline samplecnt_t samples_per_channel() const { return _samples / _channels; }
/* Flags */
@@ -108,7 +108,7 @@ public:
protected:
T * const _data;
- framecnt_t _frames;
+ samplecnt_t _samples;
ChannelCount _channels;
mutable FlagField _flags;
@@ -116,10 +116,10 @@ protected:
private:
inline void validate_data()
{
- if (throw_level (ThrowProcess) && (_frames % _channels != 0)) {
+ if (throw_level (ThrowProcess) && (_samples % _channels != 0)) {
throw Exception (*this, boost::str (boost::format
- ("Number of frames given to %1% was not a multiple of channels: %2% frames with %3% channels")
- % DebugUtils::demangled_name (*this) % _frames % _channels));
+ ("Number of samples given to %1% was not a multiple of channels: %2% samples with %3% channels")
+ % DebugUtils::demangled_name (*this) % _samples % _channels));
}
}
};
@@ -130,33 +130,33 @@ class /*LIBAUDIOGRAPHER_API*/ AllocatingProcessContext : public ProcessContext<T
{
public:
/// Allocates uninitialized memory
- AllocatingProcessContext (framecnt_t frames, ChannelCount channels)
- : ProcessContext<T> (new T[frames], frames, channels) {}
+ AllocatingProcessContext (samplecnt_t samples, ChannelCount channels)
+ : ProcessContext<T> (new T[samples], samples, channels) {}
/// Allocates and copies data from raw buffer
- AllocatingProcessContext (T const * data, framecnt_t frames, ChannelCount channels)
- : ProcessContext<T> (new T[frames], frames, channels)
- { TypeUtils<float>::copy (data, ProcessContext<T>::_data, frames); }
+ AllocatingProcessContext (T const * data, samplecnt_t samples, ChannelCount channels)
+ : ProcessContext<T> (new T[samples], samples, channels)
+ { TypeUtils<float>::copy (data, ProcessContext<T>::_data, samples); }
/// Copy constructor, copies data from other ProcessContext
AllocatingProcessContext (ProcessContext<T> const & other)
- : ProcessContext<T> (other, new T[other._frames])
- { TypeUtils<float>::copy (ProcessContext<T>::_data, other._data, other._frames); }
+ : ProcessContext<T> (other, new T[other._samples])
+ { TypeUtils<float>::copy (ProcessContext<T>::_data, other._data, other._samples); }
- /// "Copy constructor" with uninitialized data, unique frame and channel count, but copies flags
+ /// "Copy constructor" with uninitialized data, unique sample and channel count, but copies flags
template<typename Y>
- AllocatingProcessContext (ProcessContext<Y> const & other, framecnt_t frames, ChannelCount channels)
- : ProcessContext<T> (other, new T[frames], frames, channels) {}
+ AllocatingProcessContext (ProcessContext<Y> const & other, samplecnt_t samples, ChannelCount channels)
+ : ProcessContext<T> (other, new T[samples], samples, channels) {}
- /// "Copy constructor" with uninitialized data, unique frame count, but copies channel count and flags
+ /// "Copy constructor" with uninitialized data, unique sample count, but copies channel count and flags
template<typename Y>
- AllocatingProcessContext (ProcessContext<Y> const & other, framecnt_t frames)
- : ProcessContext<T> (other, new T[frames], frames, other.channels()) {}
+ AllocatingProcessContext (ProcessContext<Y> const & other, samplecnt_t samples)
+ : ProcessContext<T> (other, new T[samples], samples, other.channels()) {}
- /// "Copy constructor" uninitialized data, that copies frame and channel count + flags
+ /// "Copy constructor" uninitialized data, that copies sample and channel count + flags
template<typename Y>
AllocatingProcessContext (ProcessContext<Y> const & other)
- : ProcessContext<T> (other, new T[other._frames]) {}
+ : ProcessContext<T> (other, new T[other._samples]) {}
~AllocatingProcessContext () { delete [] ProcessContext<T>::_data; }
};
@@ -166,25 +166,25 @@ template <typename T = DefaultSampleType>
class /*LIBAUDIOGRAPHER_API*/ ConstProcessContext
{
public:
- /// Basic constructor with data, frame and channel count
- ConstProcessContext (T const * data, framecnt_t frames, ChannelCount channels)
- : context (const_cast<T *>(data), frames, channels) {}
+ /// Basic constructor with data, sample and channel count
+ ConstProcessContext (T const * data, samplecnt_t samples, ChannelCount channels)
+ : context (const_cast<T *>(data), samples, channels) {}
/// Copy constructor from const ProcessContext
ConstProcessContext (ProcessContext<T> const & other)
: context (const_cast<ProcessContext<T> &> (other)) {}
- /// "Copy constructor", with unique data, frame and channel count, but copies flags
+ /// "Copy constructor", with unique data, sample and channel count, but copies flags
template<typename ProcessContext>
- ConstProcessContext (ProcessContext const & other, T const * data, framecnt_t frames, ChannelCount channels)
- : context (other, const_cast<T *>(data), frames, channels) {}
+ ConstProcessContext (ProcessContext const & other, T const * data, samplecnt_t samples, ChannelCount channels)
+ : context (other, const_cast<T *>(data), samples, channels) {}
- /// "Copy constructor", with unique data and frame count, but copies channel count and flags
+ /// "Copy constructor", with unique data and sample count, but copies channel count and flags
template<typename ProcessContext>
- ConstProcessContext (ProcessContext const & other, T const * data, framecnt_t frames)
- : context (other, const_cast<T *>(data), frames) {}
+ ConstProcessContext (ProcessContext const & other, T const * data, samplecnt_t samples)
+ : context (other, const_cast<T *>(data), samples) {}
- /// "Copy constructor", with unique data, but copies frame and channel count + flags
+ /// "Copy constructor", with unique data, but copies sample and channel count + flags
template<typename ProcessContext>
ConstProcessContext (ProcessContext const & other, T const * data)
: context (other, const_cast<T *>(data)) {}
diff --git a/libs/audiographer/audiographer/routines.h b/libs/audiographer/audiographer/routines.h
index d78fa602b6..468580807d 100644
--- a/libs/audiographer/audiographer/routines.h
+++ b/libs/audiographer/audiographer/routines.h
@@ -25,39 +25,39 @@ class LIBAUDIOGRAPHER_API Routines
/** Computes peak in float buffer
* \n RT safe
* \param data buffer from which the peak is computed
- * \param frames length of the portion of \a buffer that is checked
+ * \param samples length of the portion of \a buffer that is checked
* \param current_peak current peak of buffer, if calculated in several passes
- * \return maximum of values in [\a data, \a data + \a frames) and \a current_peak
+ * \return maximum of values in [\a data, \a data + \a samples) and \a current_peak
*/
- static inline float compute_peak (float const * data, uint_type frames, float current_peak)
+ static inline float compute_peak (float const * data, uint_type samples, float current_peak)
{
- return (*_compute_peak) (data, frames, current_peak);
+ return (*_compute_peak) (data, samples, current_peak);
}
/** Applies constant gain to buffer
* \n RT safe
* \param data data to which the gain is applied
- * \param frames length of data
+ * \param samples length of data
* \param gain gain that is applied
*/
- static inline void apply_gain_to_buffer (float * data, uint_type frames, float gain)
+ static inline void apply_gain_to_buffer (float * data, uint_type samples, float gain)
{
- (*_apply_gain_to_buffer) (data, frames, gain);
+ (*_apply_gain_to_buffer) (data, samples, gain);
}
private:
- static inline float default_compute_peak (float const * data, uint_type frames, float current_peak)
+ static inline float default_compute_peak (float const * data, uint_type samples, float current_peak)
{
- for (uint_type i = 0; i < frames; ++i) {
+ for (uint_type i = 0; i < samples; ++i) {
float abs = std::fabs(data[i]);
if (abs > current_peak) { current_peak = abs; }
}
return current_peak;
}
- static inline void default_apply_gain_to_buffer (float * data, uint_type frames, float gain)
+ static inline void default_apply_gain_to_buffer (float * data, uint_type samples, float gain)
{
- for (uint_type i = 0; i < frames; ++i) {
+ for (uint_type i = 0; i < samples; ++i) {
data[i] *= gain;
}
}
diff --git a/libs/audiographer/audiographer/sndfile/sndfile.h b/libs/audiographer/audiographer/sndfile/sndfile.h
index c48a0331ab..2fccfc458e 100644
--- a/libs/audiographer/audiographer/sndfile/sndfile.h
+++ b/libs/audiographer/audiographer/sndfile/sndfile.h
@@ -16,7 +16,7 @@ class Sndfile : public SndfileWriter<T>, public SndfileReader<T>
public:
Sndfile (std::string const & filename, SndfileBase::Mode mode = SndfileBase::ReadWrite, int format = 0,
- ChannelCount channels = 0, framecnt_t samplerate = 0)
+ ChannelCount channels = 0, samplecnt_t samplerate = 0)
: SndfileHandle (filename, mode, format, channels, samplerate)
{}
diff --git a/libs/audiographer/audiographer/sndfile/sndfile_reader.h b/libs/audiographer/audiographer/sndfile/sndfile_reader.h
index ea27470d77..b3e84ac40a 100644
--- a/libs/audiographer/audiographer/sndfile/sndfile_reader.h
+++ b/libs/audiographer/audiographer/sndfile/sndfile_reader.h
@@ -25,11 +25,11 @@ class SndfileReader
SndfileReader (SndfileReader const & other) : SndfileHandle (other) {}
using SndfileHandle::operator=;
- /** Read data into buffer in \a context, only the data is modified (not frame count)
+ /** Read data into buffer in \a context, only the data is modified (not sample count)
* Note that the data read is output to the outputs, as well as read into the context
- * \return number of frames read
+ * \return number of samples read
*/
- framecnt_t read (ProcessContext<T> & context)
+ samplecnt_t read (ProcessContext<T> & context)
{
if (throw_level (ThrowStrict) && context.channels() != channels() ) {
throw Exception (*this, boost::str (boost::format
@@ -37,14 +37,14 @@ class SndfileReader
% context.channels() % channels()));
}
- framecnt_t const frames_read = SndfileHandle::read (context.data(), context.frames());
- ProcessContext<T> c_out = context.beginning (frames_read);
+ samplecnt_t const samples_read = SndfileHandle::read (context.data(), context.samples());
+ ProcessContext<T> c_out = context.beginning (samples_read);
- if (frames_read < context.frames()) {
+ if (samples_read < context.samples()) {
c_out.set_flag (ProcessContext<T>::EndOfInput);
}
this->output (c_out);
- return frames_read;
+ return samples_read;
}
protected:
diff --git a/libs/audiographer/audiographer/sndfile/sndfile_writer.h b/libs/audiographer/audiographer/sndfile/sndfile_writer.h
index 81f0ddb497..d0049360d2 100644
--- a/libs/audiographer/audiographer/sndfile/sndfile_writer.h
+++ b/libs/audiographer/audiographer/sndfile/sndfile_writer.h
@@ -27,7 +27,7 @@ class SndfileWriter
, public FlagDebuggable<>
{
public:
- SndfileWriter (std::string const & path, int format, ChannelCount channels, framecnt_t samplerate, boost::shared_ptr<BroadcastInfo> broadcast_info)
+ SndfileWriter (std::string const & path, int format, ChannelCount channels, samplecnt_t samplerate, boost::shared_ptr<BroadcastInfo> broadcast_info)
: SndfileHandle (path, Write, format, channels, samplerate)
, path (path)
{
@@ -42,8 +42,8 @@ class SndfileWriter
using SndfileHandle::operator=;
- framecnt_t get_frames_written() const { return frames_written; }
- void reset_frames_written_count() { frames_written = 0; }
+ samplecnt_t get_samples_written() const { return samples_written; }
+ void reset_samples_written_count() { samples_written = 0; }
/// Writes data to file
virtual void process (ProcessContext<T> const & c)
@@ -56,10 +56,10 @@ class SndfileWriter
% c.channels() % channels()));
}
- framecnt_t const written = write (c.data(), c.frames());
- frames_written += written;
+ samplecnt_t const written = write (c.data(), c.samples());
+ samples_written += written;
- if (throw_level (ThrowProcess) && written != c.frames()) {
+ if (throw_level (ThrowProcess) && written != c.samples()) {
throw Exception (*this, boost::str (boost::format
("Could not write data to output file (%1%)")
% strError()));
@@ -84,13 +84,13 @@ class SndfileWriter
virtual void init()
{
- frames_written = 0;
+ samples_written = 0;
add_supported_flag (ProcessContext<T>::EndOfInput);
}
protected:
std::string path;
- framecnt_t frames_written;
+ samplecnt_t samples_written;
private:
SndfileWriter (SndfileWriter const & other) {}
diff --git a/libs/audiographer/audiographer/sndfile/tmp_file_rt.h b/libs/audiographer/audiographer/sndfile/tmp_file_rt.h
index 4207d3da75..1e2786252b 100644
--- a/libs/audiographer/audiographer/sndfile/tmp_file_rt.h
+++ b/libs/audiographer/audiographer/sndfile/tmp_file_rt.h
@@ -17,7 +17,7 @@
namespace AudioGrapher
{
- static const framecnt_t rb_chunksize = 8192; // samples
+ static const samplecnt_t rb_chunksize = 8192; // samples
/** A temporary file deleted after this class is destructed
* with realtime safe background thread writer.
@@ -29,7 +29,7 @@ class TmpFileRt
public:
/// \a filename_template must match the requirements for mkstemp, i.e. end in "XXXXXX"
- TmpFileRt (char * filename_template, int format, ChannelCount channels, framecnt_t samplerate)
+ TmpFileRt (char * filename_template, int format, ChannelCount channels, samplecnt_t samplerate)
: SndfileHandle (g_mkstemp(filename_template), true, SndfileBase::ReadWrite, format, channels, samplerate)
, filename (filename_template)
, _chunksize (rb_chunksize * channels)
@@ -65,13 +65,13 @@ class TmpFileRt
% c.channels() % SndfileHandle::channels()));
}
- if (SndfileWriter<T>::throw_level (ThrowProcess) && _rb.write_space() < c.frames()) {
+ if (SndfileWriter<T>::throw_level (ThrowProcess) && _rb.write_space() < c.samples()) {
throw Exception (*this, boost::str (boost::format
("Could not write data to ringbuffer/output file (%1%)")
% SndfileHandle::strError()));
}
- _rb.write (c.data(), c.frames());
+ _rb.write (c.data(), c.samples());
if (c.has_flag(ProcessContext<T>::EndOfInput)) {
_capture = false;
@@ -93,11 +93,11 @@ class TmpFileRt
pthread_mutex_lock (&_disk_thread_lock);
while (_capture) {
- if ((framecnt_t)_rb.read_space () >= _chunksize) {
+ if ((samplecnt_t)_rb.read_space () >= _chunksize) {
_rb.read (framebuf, _chunksize);
- framecnt_t const written = SndfileBase::write (framebuf, _chunksize);
+ samplecnt_t const written = SndfileBase::write (framebuf, _chunksize);
assert (written == _chunksize);
- SndfileWriter<T>::frames_written += written;
+ SndfileWriter<T>::samples_written += written;
}
if (!_capture) {
break;
@@ -107,10 +107,10 @@ class TmpFileRt
// flush ringbuffer
while (_rb.read_space () > 0) {
- size_t remain = std::min ((framecnt_t)_rb.read_space (), _chunksize);
+ size_t remain = std::min ((samplecnt_t)_rb.read_space (), _chunksize);
_rb.read (framebuf, remain);
- framecnt_t const written = SndfileBase::write (framebuf, remain);
- SndfileWriter<T>::frames_written += written;
+ samplecnt_t const written = SndfileBase::write (framebuf, remain);
+ SndfileWriter<T>::samples_written += written;
}
SndfileWriter<T>::writeSync();
@@ -123,7 +123,7 @@ class TmpFileRt
std::string filename;
bool _capture;
- framecnt_t _chunksize;
+ samplecnt_t _chunksize;
PBD::RingBuffer<T> _rb;
pthread_mutex_t _disk_thread_lock;
@@ -148,7 +148,7 @@ class TmpFileRt
void init()
{
- SndfileWriter<T>::frames_written = 0;
+ SndfileWriter<T>::samples_written = 0;
_capture = true;
SndfileWriter<T>::add_supported_flag (ProcessContext<T>::EndOfInput);
pthread_mutex_init (&_disk_thread_lock, 0);
diff --git a/libs/audiographer/audiographer/sndfile/tmp_file_sync.h b/libs/audiographer/audiographer/sndfile/tmp_file_sync.h
index 7807346935..8eab56a3a6 100644
--- a/libs/audiographer/audiographer/sndfile/tmp_file_sync.h
+++ b/libs/audiographer/audiographer/sndfile/tmp_file_sync.h
@@ -22,12 +22,12 @@ class TmpFileSync
public:
/// \a filename_template must match the requirements for mkstemp, i.e. end in "XXXXXX"
- TmpFileSync (char * filename_template, int format, ChannelCount channels, framecnt_t samplerate)
+ TmpFileSync (char * filename_template, int format, ChannelCount channels, samplecnt_t samplerate)
: SndfileHandle (g_mkstemp(filename_template), true, SndfileBase::ReadWrite, format, channels, samplerate)
, filename (filename_template)
{}
- TmpFileSync (int format, ChannelCount channels, framecnt_t samplerate)
+ TmpFileSync (int format, ChannelCount channels, samplecnt_t samplerate)
: SndfileHandle (fileno (tmpfile()), true, SndfileBase::ReadWrite, format, channels, samplerate)
{}
diff --git a/libs/audiographer/audiographer/type_utils.h b/libs/audiographer/audiographer/type_utils.h
index 4e12937165..c16b0f942a 100644
--- a/libs/audiographer/audiographer/type_utils.h
+++ b/libs/audiographer/audiographer/type_utils.h
@@ -19,12 +19,12 @@ class LIBAUDIOGRAPHER_API TypeUtilsBase
protected:
template<typename T, bool b>
- static void do_zero_fill(T * buffer, framecnt_t frames, const boost::integral_constant<bool, b>&)
- { std::uninitialized_fill_n (buffer, frames, T()); }
+ static void do_zero_fill(T * buffer, samplecnt_t samples, const boost::integral_constant<bool, b>&)
+ { std::uninitialized_fill_n (buffer, samples, T()); }
template<typename T>
- static void do_zero_fill(T * buffer, framecnt_t frames, const boost::true_type&)
- { memset (buffer, 0, frames * sizeof(T)); }
+ static void do_zero_fill(T * buffer, samplecnt_t samples, const boost::true_type&)
+ { memset (buffer, 0, samples * sizeof(T)); }
};
/// Utilities for initializing, copying, moving, etc. data
@@ -42,26 +42,26 @@ class /*LIBAUDIOGRAPHER_API*/ TypeUtils : private TypeUtilsBase
* if T is not a floating point or signed integer type
* \n RT safe
*/
- inline static void zero_fill (T * buffer, framecnt_t frames)
- { do_zero_fill(buffer, frames, zero_fillable()); }
+ inline static void zero_fill (T * buffer, samplecnt_t samples)
+ { do_zero_fill(buffer, samples, zero_fillable()); }
- /** Copies \a frames frames of data from \a source to \a destination
+ /** Copies \a samples frames of data from \a source to \a destination
* The source and destination may NOT overlap.
* \n RT safe
*/
- inline static void copy (T const * source, T * destination, framecnt_t frames)
- { std::uninitialized_copy (source, &source[frames], destination); }
+ inline static void copy (T const * source, T * destination, samplecnt_t samples)
+ { std::uninitialized_copy (source, &source[samples], destination); }
- /** Moves \a frames frames of data from \a source to \a destination
+ /** Moves \a samples frames of data from \a source to \a destination
* The source and destination may overlap in any way.
* \n RT safe
*/
- inline static void move (T const * source, T * destination, framecnt_t frames)
+ inline static void move (T const * source, T * destination, samplecnt_t samples)
{
if (destination < source) {
- std::copy (source, &source[frames], destination);
+ std::copy (source, &source[samples], destination);
} else if (destination > source) {
- std::copy_backward (source, &source[frames], destination + frames);
+ std::copy_backward (source, &source[samples], destination + samples);
}
}
};
diff --git a/libs/audiographer/audiographer/types.h b/libs/audiographer/audiographer/types.h
index 1ecf6360a0..faa3ad4f31 100644
--- a/libs/audiographer/audiographer/types.h
+++ b/libs/audiographer/audiographer/types.h
@@ -8,7 +8,7 @@
namespace AudioGrapher {
/* XXX: copied from libardour */
-typedef int64_t framecnt_t;
+typedef int64_t samplecnt_t;
typedef uint8_t ChannelCount;
diff --git a/libs/audiographer/src/general/analyser.cc b/libs/audiographer/src/general/analyser.cc
index 84120b6f53..05491c9da0 100644
--- a/libs/audiographer/src/general/analyser.cc
+++ b/libs/audiographer/src/general/analyser.cc
@@ -23,7 +23,7 @@ using namespace AudioGrapher;
const float Analyser::fft_range_db (120); // dB
-Analyser::Analyser (float sample_rate, unsigned int channels, framecnt_t bufsize, framecnt_t n_samples)
+Analyser::Analyser (float sample_rate, unsigned int channels, samplecnt_t bufsize, samplecnt_t n_samples)
: LoudnessReader (sample_rate, channels, bufsize)
, _n_samples (n_samples)
, _pos (0)
@@ -104,11 +104,11 @@ Analyser::~Analyser ()
void
Analyser::process (ProcessContext<float> const & ctx)
{
- const framecnt_t n_samples = ctx.frames () / ctx.channels ();
+ const samplecnt_t n_samples = ctx.samples () / ctx.channels ();
assert (ctx.channels () == _channels);
- assert (ctx.frames () % ctx.channels () == 0);
+ assert (ctx.samples () % ctx.channels () == 0);
assert (n_samples <= _bufsize);
- //printf ("PROC %p @%ld F: %ld, S: %ld C:%d\n", this, _pos, ctx.frames (), n_samples, ctx.channels ());
+ //printf ("PROC %p @%ld F: %ld, S: %ld C:%d\n", this, _pos, ctx.samples (), n_samples, ctx.channels ());
// allow 1 sample slack for resampling
if (_pos + n_samples > _n_samples + 1) {
@@ -118,11 +118,11 @@ Analyser::process (ProcessContext<float> const & ctx)
}
float const * d = ctx.data ();
- framecnt_t s;
+ samplecnt_t s;
const unsigned cmask = _result.n_channels - 1; // [0, 1]
for (s = 0; s < n_samples; ++s) {
_fft_data_in[s] = 0;
- const framecnt_t pbin = (_pos + s) / _spp;
+ const samplecnt_t pbin = (_pos + s) / _spp;
for (unsigned int c = 0; c < _channels; ++c) {
const float v = *d;
if (fabsf(v) > _result.peak) { _result.peak = fabsf(v); }
@@ -169,8 +169,8 @@ Analyser::process (ProcessContext<float> const & ctx)
#undef FIm
const size_t height = sizeof (_result.spectrum[0]) / sizeof (float);
- const framecnt_t x0 = _pos / _fpp;
- framecnt_t x1 = (_pos + n_samples) / _fpp;
+ const samplecnt_t x0 = _pos / _fpp;
+ samplecnt_t x1 = (_pos + n_samples) / _fpp;
if (x0 == x1) x1 = x0 + 1;
for (uint32_t i = 0; i < _fft_data_size - 1; ++i) {
@@ -212,9 +212,9 @@ Analyser::result ()
if (_pos + 1 < _n_samples) {
// crude re-bin (silence stripped version)
const size_t peaks = sizeof (_result.peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
- for (framecnt_t b = peaks - 1; b > 0; --b) {
+ for (samplecnt_t b = peaks - 1; b > 0; --b) {
for (unsigned int c = 0; c < _result.n_channels; ++c) {
- const framecnt_t sb = b * _pos / _n_samples;
+ const samplecnt_t sb = b * _pos / _n_samples;
_result.peaks[c][b].min = _result.peaks[c][sb].min;
_result.peaks[c][b].max = _result.peaks[c][sb].max;
}
@@ -223,9 +223,9 @@ Analyser::result ()
const size_t swh = sizeof (_result.spectrum) / sizeof (float);
const size_t height = sizeof (_result.spectrum[0]) / sizeof (float);
const size_t width = swh / height;
- for (framecnt_t b = width - 1; b > 0; --b) {
+ for (samplecnt_t b = width - 1; b > 0; --b) {
// TODO round down to prev _fft_data_size bin
- const framecnt_t sb = b * _pos / _n_samples;
+ const samplecnt_t sb = b * _pos / _n_samples;
for (unsigned int y = 0; y < height; ++y) {
_result.spectrum[b][y] = _result.spectrum[sb][y];
}
@@ -258,7 +258,7 @@ Analyser::result ()
for (std::vector<float>::const_iterator i = features[1][0].values.begin();
i != features[1][0].values.end(); ++i) {
- const framecnt_t pk = (*i) / _spp;
+ const samplecnt_t pk = (*i) / _spp;
const unsigned int cc = c & cmask;
_result.truepeakpos[cc].insert (pk);
}
diff --git a/libs/audiographer/src/general/loudness_reader.cc b/libs/audiographer/src/general/loudness_reader.cc
index 0c2e361fde..924a047561 100644
--- a/libs/audiographer/src/general/loudness_reader.cc
+++ b/libs/audiographer/src/general/loudness_reader.cc
@@ -21,7 +21,7 @@
using namespace AudioGrapher;
-LoudnessReader::LoudnessReader (float sample_rate, unsigned int channels, framecnt_t bufsize)
+LoudnessReader::LoudnessReader (float sample_rate, unsigned int channels, samplecnt_t bufsize)
: _ebur_plugin (0)
, _dbtp_plugin (0)
, _sample_rate (sample_rate)
@@ -91,17 +91,17 @@ LoudnessReader::reset ()
void
LoudnessReader::process (ProcessContext<float> const & ctx)
{
- const framecnt_t n_samples = ctx.frames () / ctx.channels ();
+ const samplecnt_t n_samples = ctx.samples () / ctx.channels ();
assert (ctx.channels () == _channels);
- assert (ctx.frames () % ctx.channels () == 0);
+ assert (ctx.samples () % ctx.channels () == 0);
assert (n_samples <= _bufsize);
- //printf ("PROC %p @%ld F: %ld, S: %ld C:%d\n", this, _pos, ctx.frames (), n_samples, ctx.channels ());
+ //printf ("PROC %p @%ld F: %ld, S: %ld C:%d\n", this, _pos, ctx.samples (), n_samples, ctx.channels ());
unsigned processed_channels = 0;
if (_ebur_plugin) {
assert (_channels <= 2);
processed_channels = _channels;
- framecnt_t s;
+ samplecnt_t s;
float const * d = ctx.data ();
for (s = 0; s < n_samples; ++s) {
for (unsigned int c = 0; c < _channels; ++c, ++d) {
@@ -126,7 +126,7 @@ LoudnessReader::process (ProcessContext<float> const & ctx)
if (!_dbtp_plugin[c]) {
continue;
}
- framecnt_t s;
+ samplecnt_t s;
float const * const d = ctx.data ();
for (s = 0; s < n_samples; ++s) {
_bufs[0][s] = d[s * _channels + c];
diff --git a/libs/audiographer/src/general/normalizer.cc b/libs/audiographer/src/general/normalizer.cc
index a10382031a..ae603ef946 100644
--- a/libs/audiographer/src/general/normalizer.cc
+++ b/libs/audiographer/src/general/normalizer.cc
@@ -54,23 +54,23 @@ float Normalizer::set_peak (float peak)
* non-const ProcessContexts are given to \a process() .
* \n Not RT safe
*/
-void Normalizer::alloc_buffer(framecnt_t frames)
+void Normalizer::alloc_buffer(samplecnt_t samples)
{
delete [] buffer;
- buffer = new float[frames];
- buffer_size = frames;
+ buffer = new float[samples];
+ buffer_size = samples;
}
/// Process a const ProcessContext \see alloc_buffer() \n RT safe
void Normalizer::process (ProcessContext<float> const & c)
{
- if (throw_level (ThrowProcess) && c.frames() > buffer_size) {
- throw Exception (*this, "Too many frames given to process()");
+ if (throw_level (ThrowProcess) && c.samples() > buffer_size) {
+ throw Exception (*this, "Too many samples given to process()");
}
if (enabled) {
- memcpy (buffer, c.data(), c.frames() * sizeof(float));
- Routines::apply_gain_to_buffer (buffer, c.frames(), gain);
+ memcpy (buffer, c.data(), c.samples() * sizeof(float));
+ Routines::apply_gain_to_buffer (buffer, c.samples(), gain);
}
ProcessContext<float> c_out (c, buffer);
@@ -81,7 +81,7 @@ void Normalizer::process (ProcessContext<float> const & c)
void Normalizer::process (ProcessContext<float> & c)
{
if (enabled) {
- Routines::apply_gain_to_buffer (c.data(), c.frames(), gain);
+ Routines::apply_gain_to_buffer (c.data(), c.samples(), gain);
}
ListedSource<float>::output(c);
}
diff --git a/libs/audiographer/src/general/sample_format_converter.cc b/libs/audiographer/src/general/sample_format_converter.cc
index 1f79818a8b..fbe509fca5 100644
--- a/libs/audiographer/src/general/sample_format_converter.cc
+++ b/libs/audiographer/src/general/sample_format_converter.cc
@@ -41,18 +41,18 @@ SampleFormatConverter<TOut>::SampleFormatConverter (ChannelCount channels) :
template <>
void
-SampleFormatConverter<float>::init (framecnt_t max_frames, int /* type */, int data_width)
+SampleFormatConverter<float>::init (samplecnt_t max_samples, int /* type */, int data_width)
{
if (throw_level (ThrowObject) && data_width != 32) {
throw Exception (*this, "Unsupported data width");
}
- init_common (max_frames);
+ init_common (max_samples);
dither = gdither_new (GDitherNone, channels, GDitherFloat, data_width);
}
template <>
void
-SampleFormatConverter<int32_t>::init (framecnt_t max_frames, int type, int data_width)
+SampleFormatConverter<int32_t>::init (samplecnt_t max_samples, int type, int data_width)
{
if(throw_level (ThrowObject) && data_width > 32) {
throw Exception (*this, "Trying to use SampleFormatConverter<int32_t> with a data width > 32");
@@ -62,47 +62,47 @@ SampleFormatConverter<int32_t>::init (framecnt_t max_frames, int type, int data_
// And since floats only have 24 bits of data, we are fine with this.
data_width = std::min(data_width, 24);
- init_common (max_frames);
+ init_common (max_samples);
dither = gdither_new ((GDitherType) type, channels, GDither32bit, data_width);
}
template <>
void
-SampleFormatConverter<int16_t>::init (framecnt_t max_frames, int type, int data_width)
+SampleFormatConverter<int16_t>::init (samplecnt_t max_samples, int type, int data_width)
{
if (throw_level (ThrowObject) && data_width > 16) {
throw Exception (*this, boost::str(boost::format
("Data width (%1%) too large for int16_t")
% data_width));
}
- init_common (max_frames);
+ init_common (max_samples);
dither = gdither_new ((GDitherType) type, channels, GDither16bit, data_width);
}
template <>
void
-SampleFormatConverter<uint8_t>::init (framecnt_t max_frames, int type, int data_width)
+SampleFormatConverter<uint8_t>::init (samplecnt_t max_samples, int type, int data_width)
{
if (throw_level (ThrowObject) && data_width > 8) {
throw Exception (*this, boost::str(boost::format
("Data width (%1%) too large for uint8_t")
% data_width));
}
- init_common (max_frames);
+ init_common (max_samples);
dither = gdither_new ((GDitherType) type, channels, GDither8bit, data_width);
}
template <typename TOut>
void
-SampleFormatConverter<TOut>::init_common (framecnt_t max_frames)
+SampleFormatConverter<TOut>::init_common (samplecnt_t max_samples)
{
reset();
- if (max_frames > data_out_size) {
+ if (max_samples > data_out_size) {
delete[] data_out;
- data_out = new TOut[max_frames];
- data_out_size = max_frames;
+ data_out = new TOut[max_samples];
+ data_out_size = max_samples;
}
}
@@ -135,12 +135,12 @@ SampleFormatConverter<TOut>::process (ProcessContext<float> const & c_in)
{
float const * const data = c_in.data();
- check_frame_and_channel_count (c_in.frames (), c_in.channels ());
+ check_sample_and_channel_count (c_in.samples (), c_in.channels ());
/* Do conversion */
for (uint32_t chn = 0; chn < c_in.channels(); ++chn) {
- gdither_runf (dither, chn, c_in.frames_per_channel (), data, data_out);
+ gdither_runf (dither, chn, c_in.samples_per_channel (), data, data_out);
}
/* Write forward */
@@ -162,11 +162,11 @@ template<>
void
SampleFormatConverter<float>::process (ProcessContext<float> & c_in)
{
- framecnt_t frames = c_in.frames();
+ samplecnt_t samples = c_in.samples();
float * data = c_in.data();
if (clip_floats) {
- for (framecnt_t x = 0; x < frames; ++x) {
+ for (samplecnt_t x = 0; x < samples; ++x) {
if (data[x] > 1.0f) {
data[x] = 1.0f;
} else if (data[x] < -1.0f) {
@@ -184,8 +184,8 @@ void
SampleFormatConverter<float>::process (ProcessContext<float> const & c_in)
{
// Make copy of data and pass it to non-const version
- check_frame_and_channel_count (c_in.frames(), c_in.channels());
- TypeUtils<float>::copy (c_in.data(), data_out, c_in.frames());
+ check_sample_and_channel_count (c_in.samples(), c_in.channels());
+ TypeUtils<float>::copy (c_in.data(), data_out, c_in.samples());
ProcessContext<float> c (c_in, data_out);
process (c);
@@ -193,7 +193,7 @@ SampleFormatConverter<float>::process (ProcessContext<float> const & c_in)
template<typename TOut>
void
-SampleFormatConverter<TOut>::check_frame_and_channel_count (framecnt_t frames, ChannelCount channels_)
+SampleFormatConverter<TOut>::check_sample_and_channel_count (samplecnt_t samples, ChannelCount channels_)
{
if (throw_level (ThrowStrict) && channels_ != channels) {
throw Exception (*this, boost::str (boost::format
@@ -201,10 +201,10 @@ SampleFormatConverter<TOut>::check_frame_and_channel_count (framecnt_t frames, C
% channels_ % channels));
}
- if (throw_level (ThrowProcess) && frames > data_out_size) {
+ if (throw_level (ThrowProcess) && samples > data_out_size) {
throw Exception (*this, boost::str (boost::format
- ("Too many frames given to process(), %1% instad of %2%")
- % frames % data_out_size));
+ ("Too many samples given to process(), %1% instad of %2%")
+ % samples % data_out_size));
}
}
diff --git a/libs/audiographer/src/general/sr_converter.cc b/libs/audiographer/src/general/sr_converter.cc
index 1468e6a734..a4d19593f0 100644
--- a/libs/audiographer/src/general/sr_converter.cc
+++ b/libs/audiographer/src/general/sr_converter.cc
@@ -34,10 +34,10 @@ using boost::str;
SampleRateConverter::SampleRateConverter (uint32_t channels)
: active (false)
, channels (channels)
- , max_frames_in(0)
+ , max_samples_in(0)
, leftover_data (0)
- , leftover_frames (0)
- , max_leftover_frames (0)
+ , leftover_samples (0)
+ , max_leftover_samples (0)
, data_out (0)
, data_out_size (0)
, src_state (0)
@@ -46,7 +46,7 @@ SampleRateConverter::SampleRateConverter (uint32_t channels)
}
void
-SampleRateConverter::init (framecnt_t in_rate, framecnt_t out_rate, int quality)
+SampleRateConverter::init (samplecnt_t in_rate, samplecnt_t out_rate, int quality)
{
reset();
@@ -72,31 +72,31 @@ SampleRateConverter::~SampleRateConverter ()
reset();
}
-framecnt_t
-SampleRateConverter::allocate_buffers (framecnt_t max_frames)
+samplecnt_t
+SampleRateConverter::allocate_buffers (samplecnt_t max_samples)
{
- if (!active) { return max_frames; }
+ if (!active) { return max_samples; }
- framecnt_t max_frames_out = (framecnt_t) ceil (max_frames * src_data.src_ratio);
- max_frames_out -= max_frames_out % channels;
+ samplecnt_t max_samples_out = (samplecnt_t) ceil (max_samples * src_data.src_ratio);
+ max_samples_out -= max_samples_out % channels;
- if (data_out_size < max_frames_out) {
+ if (data_out_size < max_samples_out) {
delete[] data_out;
- data_out = new float[max_frames_out];
+ data_out = new float[max_samples_out];
src_data.data_out = data_out;
- max_leftover_frames = 4 * max_frames;
- leftover_data = (float *) realloc (leftover_data, max_leftover_frames * sizeof (float));
+ max_leftover_samples = 4 * max_samples;
+ leftover_data = (float *) realloc (leftover_data, max_leftover_samples * sizeof (float));
if (throw_level (ThrowObject) && !leftover_data) {
throw Exception (*this, "A memory allocation error occurred");
}
- max_frames_in = max_frames;
- data_out_size = max_frames_out;
+ max_samples_in = max_samples;
+ data_out_size = max_samples_out;
}
- return max_frames_out;
+ return max_samples_out;
}
void
@@ -109,13 +109,13 @@ SampleRateConverter::process (ProcessContext<float> const & c)
return;
}
- framecnt_t frames = c.frames();
+ samplecnt_t samples = c.samples();
float * in = const_cast<float *> (c.data()); // TODO check if this is safe!
- if (throw_level (ThrowProcess) && frames > max_frames_in) {
+ if (throw_level (ThrowProcess) && samples > max_samples_in) {
throw Exception (*this, str (format (
- "process() called with too many frames, %1% instead of %2%")
- % frames % max_frames_in));
+ "process() called with too many samples, %1% instead of %2%")
+ % samples % max_samples_in));
}
int err;
@@ -125,7 +125,7 @@ SampleRateConverter::process (ProcessContext<float> const & c)
src_data.output_frames = data_out_size / channels;
src_data.data_out = data_out;
- if (leftover_frames > 0) {
+ if (leftover_samples > 0) {
/* input data will be in leftover_data rather than data_in */
@@ -135,8 +135,8 @@ SampleRateConverter::process (ProcessContext<float> const & c)
/* first time, append new data from data_in into the leftover_data buffer */
- TypeUtils<float>::copy (in, &leftover_data [leftover_frames * channels], frames);
- src_data.input_frames = frames / channels + leftover_frames;
+ TypeUtils<float>::copy (in, &leftover_data [leftover_samples * channels], samples);
+ src_data.input_frames = samples / channels + leftover_samples;
} else {
/* otherwise, just use whatever is still left in leftover_data; the contents
@@ -144,12 +144,12 @@ SampleRateConverter::process (ProcessContext<float> const & c)
below)
*/
- src_data.input_frames = leftover_frames;
+ src_data.input_frames = leftover_samples;
}
} else {
src_data.data_in = in;
- src_data.input_frames = frames / channels;
+ src_data.input_frames = samples / channels;
}
first_time = false;
@@ -168,18 +168,18 @@ SampleRateConverter::process (ProcessContext<float> const & c)
% src_strerror (err)));
}
- leftover_frames = src_data.input_frames - src_data.input_frames_used;
+ leftover_samples = src_data.input_frames - src_data.input_frames_used;
- if (leftover_frames > 0) {
- if (throw_level (ThrowProcess) && leftover_frames > max_leftover_frames) {
- throw Exception(*this, "leftover frames overflowed");
+ if (leftover_samples > 0) {
+ if (throw_level (ThrowProcess) && leftover_samples > max_leftover_samples) {
+ throw Exception(*this, "leftover samples overflowed");
}
TypeUtils<float>::move (&src_data.data_in[src_data.input_frames_used * channels],
- leftover_data, leftover_frames * channels);
+ leftover_data, leftover_samples * channels);
}
ProcessContext<float> c_out (c, data_out, src_data.output_frames_gen * channels);
- if (!src_data.end_of_input || leftover_frames) {
+ if (!src_data.end_of_input || leftover_samples) {
c_out.remove_flag (ProcessContext<float>::EndOfInput);
}
output (c_out);
@@ -187,16 +187,16 @@ SampleRateConverter::process (ProcessContext<float> const & c)
if (debug_level (DebugProcess)) {
debug_stream() <<
"src_data.output_frames_gen: " << src_data.output_frames_gen <<
- ", leftover_frames: " << leftover_frames << std::endl;
+ ", leftover_samples: " << leftover_samples << std::endl;
}
- if (throw_level (ThrowProcess) && src_data.output_frames_gen == 0 && leftover_frames) {
+ if (throw_level (ThrowProcess) && src_data.output_frames_gen == 0 && leftover_samples) {
throw Exception (*this, boost::str (boost::format
- ("No output frames generated with %1% leftover frames")
- % leftover_frames));
+ ("No output samples generated with %1% leftover samples")
+ % leftover_samples));
}
- } while (leftover_frames > frames);
+ } while (leftover_samples > samples);
// src_data.end_of_input has to be checked to prevent infinite recursion
if (!src_data.end_of_input && c.has_flag(ProcessContext<float>::EndOfInput)) {
@@ -224,15 +224,15 @@ void SampleRateConverter::set_end_of_input (ProcessContext<float> const & c)
void SampleRateConverter::reset ()
{
active = false;
- max_frames_in = 0;
+ max_samples_in = 0;
src_data.end_of_input = false;
if (src_state) {
src_delete (src_state);
}
- leftover_frames = 0;
- max_leftover_frames = 0;
+ leftover_samples = 0;
+ max_leftover_samples = 0;
if (leftover_data) {
free (leftover_data);
}
diff --git a/libs/audiographer/tests/general/chunker_test.cc b/libs/audiographer/tests/general/chunker_test.cc
index 12b5da5dbc..b7896e23e6 100644
--- a/libs/audiographer/tests/general/chunker_test.cc
+++ b/libs/audiographer/tests/general/chunker_test.cc
@@ -20,10 +20,10 @@ class ChunkerTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 128;
- random_data = TestUtils::init_random_data(frames);
+ samples = 128;
+ random_data = TestUtils::init_random_data(samples);
sink.reset (new VectorSink<float>());
- chunker.reset (new Chunker<float>(frames * 2));
+ chunker.reset (new Chunker<float>(samples * 2));
}
void tearDown()
@@ -34,119 +34,119 @@ class ChunkerTest : public CppUnit::TestFixture
void testSynchronousProcess()
{
chunker->add_output (sink);
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- ProcessContext<float> const context (random_data, frames, 1);
+ ProcessContext<float> const context (random_data, samples, 1);
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t) 0, samples_output);
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (2 * frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[frames], frames));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (2 * samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[samples], samples));
sink->reset();
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t) 0, samples_output);
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (2 * frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[frames], frames));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (2 * samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[samples], samples));
}
void testAsynchronousProcess()
{
- assert (frames % 2 == 0);
+ assert (samples % 2 == 0);
chunker->add_output (sink);
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- ProcessContext<float> const half_context (random_data, frames / 2, 1);
- ProcessContext<float> const context (random_data, frames, 1);
+ ProcessContext<float> const half_context (random_data, samples / 2, 1);
+ ProcessContext<float> const context (random_data, samples, 1);
// 0.5
chunker->process (half_context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t) 0, samples_output);
// 1.5
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t) 0, samples_output);
// 2.5
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (2 * frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), frames / 2));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[frames / 2], frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[ 3 * frames / 2], frames / 2));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (2 * samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), samples / 2));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[samples / 2], samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[ 3 * samples / 2], samples / 2));
sink->reset();
// 3.5
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t) 0, samples_output);
// 4.0
chunker->process (half_context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (2 * frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_equals (&random_data[frames / 2], sink->get_array(), frames / 2));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[frames / 2], frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[ 3 * frames / 2], frames / 2));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (2 * samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_equals (&random_data[samples / 2], sink->get_array(), samples / 2));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[samples / 2], samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[ 3 * samples / 2], samples / 2));
}
void testChoppingProcess()
{
sink.reset (new AppendingVectorSink<float>());
- assert (frames % 2 == 0);
- chunker.reset (new Chunker<float>(frames / 4));
+ assert (samples % 2 == 0);
+ chunker.reset (new Chunker<float>(samples / 4));
chunker->add_output (sink);
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- ProcessContext<float> const half_context (random_data, frames / 2, 1);
- ProcessContext<float> const context (random_data, frames, 1);
+ ProcessContext<float> const half_context (random_data, samples / 2, 1);
+ ProcessContext<float> const context (random_data, samples, 1);
// 0.5
chunker->process (half_context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t) frames / 2, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t) samples / 2, samples_output);
// 1.5
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t) frames / 2 * 3, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t) samples / 2 * 3, samples_output);
// 2.5
chunker->process (context);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames / 2 * 5, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), frames / 2));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[frames / 2], frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[ 3 * frames / 2], frames / 2));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples / 2 * 5, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), samples / 2));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[samples / 2], samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, &sink->get_array()[ 3 * samples / 2], samples / 2));
}
void testEndOfInputFlagHandling()
{
boost::shared_ptr<ProcessContextGrabber<float> > grabber(new ProcessContextGrabber<float>());
- assert (frames % 2 == 0);
- chunker.reset (new Chunker<float>(frames));
+ assert (samples % 2 == 0);
+ chunker.reset (new Chunker<float>(samples));
chunker->add_output (grabber);
- ProcessContext<float> const half_context (random_data, frames / 2, 1);
- ProcessContext<float> const context (random_data, frames, 1);
+ ProcessContext<float> const half_context (random_data, samples / 2, 1);
+ ProcessContext<float> const context (random_data, samples, 1);
context.set_flag(ProcessContext<>::EndOfInput);
// Process 0.5 then 1.0
@@ -158,12 +158,12 @@ class ChunkerTest : public CppUnit::TestFixture
ProcessContextGrabber<float>::ContextList::iterator it = grabber->contexts.begin();
// first 1.0 not end of input
- CPPUNIT_ASSERT_EQUAL(it->frames(), frames);
+ CPPUNIT_ASSERT_EQUAL(it->samples(), samples);
CPPUNIT_ASSERT(!it->has_flag(ProcessContext<>::EndOfInput));
// Then 0.5 with end of input
++it;
- CPPUNIT_ASSERT_EQUAL(it->frames(), frames / 2);
+ CPPUNIT_ASSERT_EQUAL(it->samples(), samples / 2);
CPPUNIT_ASSERT(it->has_flag(ProcessContext<>::EndOfInput));
}
@@ -172,7 +172,7 @@ class ChunkerTest : public CppUnit::TestFixture
boost::shared_ptr<VectorSink<float> > sink;
float * random_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (ChunkerTest);
diff --git a/libs/audiographer/tests/general/deinterleaver_test.cc b/libs/audiographer/tests/general/deinterleaver_test.cc
index f7e15459b3..66d5362d80 100644
--- a/libs/audiographer/tests/general/deinterleaver_test.cc
+++ b/libs/audiographer/tests/general/deinterleaver_test.cc
@@ -18,9 +18,9 @@ class DeInterleaverTest : public CppUnit::TestFixture
void setUp()
{
channels = 3;
- frames_per_channel = 128;
- total_frames = channels * frames_per_channel;
- random_data = TestUtils::init_random_data (total_frames, 1.0);
+ samples_per_channel = 128;
+ total_samples = channels * samples_per_channel;
+ random_data = TestUtils::init_random_data (total_samples, 1.0);
deinterleaver.reset (new DeInterleaver<float>());
sink_a.reset (new VectorSink<float>());
@@ -41,74 +41,74 @@ class DeInterleaverTest : public CppUnit::TestFixture
void testInvalidOutputIndex()
{
- deinterleaver->init (3, frames_per_channel);
+ deinterleaver->init (3, samples_per_channel);
CPPUNIT_ASSERT_THROW (deinterleaver->output(3)->add_output (sink_a), Exception);
}
void testInvalidInputSize()
{
- deinterleaver->init (channels, frames_per_channel);
+ deinterleaver->init (channels, samples_per_channel);
- ProcessContext<float> c (random_data, 2 * total_frames, channels);
+ ProcessContext<float> c (random_data, 2 * total_samples, channels);
- // Too many, frames % channels == 0
- CPPUNIT_ASSERT_THROW (deinterleaver->process (c.beginning (total_frames + channels)), Exception);
+ // Too many, samples % channels == 0
+ CPPUNIT_ASSERT_THROW (deinterleaver->process (c.beginning (total_samples + channels)), Exception);
- // Too many, frames % channels != 0
- CPPUNIT_ASSERT_THROW (deinterleaver->process (c.beginning (total_frames + 1)), Exception);
+ // Too many, samples % channels != 0
+ CPPUNIT_ASSERT_THROW (deinterleaver->process (c.beginning (total_samples + 1)), Exception);
- // Too few, frames % channels != 0
- CPPUNIT_ASSERT_THROW (deinterleaver->process (c.beginning (total_frames - 1)), Exception);
+ // Too few, samples % channels != 0
+ CPPUNIT_ASSERT_THROW (deinterleaver->process (c.beginning (total_samples - 1)), Exception);
}
- void assert_outputs (framecnt_t expected_frames)
+ void assert_outputs (samplecnt_t expected_samples)
{
- framecnt_t generated_frames = 0;
+ samplecnt_t generated_samples = 0;
- generated_frames = sink_a->get_data().size();
- CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
+ generated_samples = sink_a->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (expected_samples, generated_samples);
- generated_frames = sink_b->get_data().size();
- CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
+ generated_samples = sink_b->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (expected_samples, generated_samples);
- generated_frames = sink_c->get_data().size();
- CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
+ generated_samples = sink_c->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (expected_samples, generated_samples);
}
void testOutputSize()
{
- deinterleaver->init (channels, frames_per_channel);
+ deinterleaver->init (channels, samples_per_channel);
deinterleaver->output (0)->add_output (sink_a);
deinterleaver->output (1)->add_output (sink_b);
deinterleaver->output (2)->add_output (sink_c);
- // Test maximum frame input
- ProcessContext<float> c (random_data, total_frames, channels);
+ // Test maximum sample input
+ ProcessContext<float> c (random_data, total_samples, channels);
deinterleaver->process (c);
- assert_outputs (frames_per_channel);
+ assert_outputs (samples_per_channel);
- // Now with less frames
- framecnt_t const less_frames = frames_per_channel / 4;
- deinterleaver->process (c.beginning (less_frames * channels));
- assert_outputs (less_frames);
+ // Now with less samples
+ samplecnt_t const less_samples = samples_per_channel / 4;
+ deinterleaver->process (c.beginning (less_samples * channels));
+ assert_outputs (less_samples);
}
void testZeroInput()
{
- deinterleaver->init (channels, frames_per_channel);
+ deinterleaver->init (channels, samples_per_channel);
deinterleaver->output (0)->add_output (sink_a);
deinterleaver->output (1)->add_output (sink_b);
deinterleaver->output (2)->add_output (sink_c);
- // Input zero frames
- ProcessContext<float> c (random_data, total_frames, channels);
+ // Input zero samples
+ ProcessContext<float> c (random_data, total_samples, channels);
deinterleaver->process (c.beginning (0));
// ...and now test regular input
deinterleaver->process (c);
- assert_outputs (frames_per_channel);
+ assert_outputs (samples_per_channel);
}
@@ -120,8 +120,8 @@ class DeInterleaverTest : public CppUnit::TestFixture
boost::shared_ptr<VectorSink<float> > sink_c;
float * random_data;
- framecnt_t frames_per_channel;
- framecnt_t total_frames;
+ samplecnt_t samples_per_channel;
+ samplecnt_t total_samples;
unsigned int channels;
};
diff --git a/libs/audiographer/tests/general/interleaver_deinterleaver_test.cc b/libs/audiographer/tests/general/interleaver_deinterleaver_test.cc
index 4f46a83492..b16a47a795 100644
--- a/libs/audiographer/tests/general/interleaver_deinterleaver_test.cc
+++ b/libs/audiographer/tests/general/interleaver_deinterleaver_test.cc
@@ -16,12 +16,12 @@ class InterleaverDeInterleaverTest : public CppUnit::TestFixture
void setUp()
{
channels = 3;
- frames_per_channel = 128;
- total_frames = channels * frames_per_channel;
+ samples_per_channel = 128;
+ total_samples = channels * samples_per_channel;
- random_data_a = TestUtils::init_random_data (total_frames, 1.0);
- random_data_b = TestUtils::init_random_data (frames_per_channel, 1.0);
- random_data_c = TestUtils::init_random_data (frames_per_channel, 1.0);
+ random_data_a = TestUtils::init_random_data (total_samples, 1.0);
+ random_data_b = TestUtils::init_random_data (samples_per_channel, 1.0);
+ random_data_c = TestUtils::init_random_data (samples_per_channel, 1.0);
deinterleaver.reset (new DeInterleaver<float>());
interleaver.reset (new Interleaver<float>());
@@ -40,8 +40,8 @@ class InterleaverDeInterleaverTest : public CppUnit::TestFixture
void testInterleavedInput()
{
- deinterleaver->init (channels, frames_per_channel);
- interleaver->init (channels, frames_per_channel);
+ deinterleaver->init (channels, samples_per_channel);
+ interleaver->init (channels, samples_per_channel);
deinterleaver->output (0)->add_output (interleaver->input (0));
deinterleaver->output (1)->add_output (interleaver->input (1));
@@ -50,20 +50,20 @@ class InterleaverDeInterleaverTest : public CppUnit::TestFixture
interleaver->add_output (sink_a);
// Process and assert
- ProcessContext<float> c (random_data_a, total_frames, channels);
+ ProcessContext<float> c (random_data_a, total_samples, channels);
deinterleaver->process (c);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), total_frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), total_samples));
// And a second round...
- framecnt_t less_frames = (frames_per_channel / 10) * channels;
- deinterleaver->process (c.beginning (less_frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), less_frames));
+ samplecnt_t less_samples = (samples_per_channel / 10) * channels;
+ deinterleaver->process (c.beginning (less_samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), less_samples));
}
void testDeInterleavedInput()
{
- deinterleaver->init (channels, frames_per_channel);
- interleaver->init (channels, frames_per_channel);
+ deinterleaver->init (channels, samples_per_channel);
+ interleaver->init (channels, samples_per_channel);
interleaver->add_output (deinterleaver);
@@ -71,28 +71,28 @@ class InterleaverDeInterleaverTest : public CppUnit::TestFixture
deinterleaver->output (1)->add_output (sink_b);
deinterleaver->output (2)->add_output (sink_c);
- ProcessContext<float> c_a (random_data_a, frames_per_channel, 1);
- ProcessContext<float> c_b (random_data_b, frames_per_channel, 1);
- ProcessContext<float> c_c (random_data_c, frames_per_channel, 1);
+ ProcessContext<float> c_a (random_data_a, samples_per_channel, 1);
+ ProcessContext<float> c_b (random_data_b, samples_per_channel, 1);
+ ProcessContext<float> c_c (random_data_c, samples_per_channel, 1);
// Process and assert
interleaver->input (0)->process (c_a);
interleaver->input (1)->process (c_b);
interleaver->input (2)->process (c_c);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), frames_per_channel));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data_b, sink_b->get_array(), frames_per_channel));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data_c, sink_c->get_array(), frames_per_channel));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), samples_per_channel));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data_b, sink_b->get_array(), samples_per_channel));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data_c, sink_c->get_array(), samples_per_channel));
// And a second round...
- framecnt_t less_frames = frames_per_channel / 5;
- interleaver->input (0)->process (c_a.beginning (less_frames));
- interleaver->input (1)->process (c_b.beginning (less_frames));
- interleaver->input (2)->process (c_c.beginning (less_frames));
+ samplecnt_t less_samples = samples_per_channel / 5;
+ interleaver->input (0)->process (c_a.beginning (less_samples));
+ interleaver->input (1)->process (c_b.beginning (less_samples));
+ interleaver->input (2)->process (c_c.beginning (less_samples));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), less_frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data_b, sink_b->get_array(), less_frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data_c, sink_c->get_array(), less_frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), less_samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data_b, sink_b->get_array(), less_samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data_c, sink_c->get_array(), less_samples));
}
@@ -108,8 +108,8 @@ class InterleaverDeInterleaverTest : public CppUnit::TestFixture
float * random_data_b;
float * random_data_c;
- framecnt_t frames_per_channel;
- framecnt_t total_frames;
+ samplecnt_t samples_per_channel;
+ samplecnt_t total_samples;
unsigned int channels;
};
diff --git a/libs/audiographer/tests/general/interleaver_test.cc b/libs/audiographer/tests/general/interleaver_test.cc
index 0b8f8b6952..7adc0387a8 100644
--- a/libs/audiographer/tests/general/interleaver_test.cc
+++ b/libs/audiographer/tests/general/interleaver_test.cc
@@ -19,13 +19,13 @@ class InterleaverTest : public CppUnit::TestFixture
void setUp()
{
channels = 3;
- frames = 128;
- random_data = TestUtils::init_random_data (frames, 1.0);
+ samples = 128;
+ random_data = TestUtils::init_random_data (samples, 1.0);
interleaver.reset (new Interleaver<float>());
sink.reset (new VectorSink<float>());
- interleaver->init (channels, frames);
+ interleaver->init (channels, samples);
}
void tearDown()
@@ -36,59 +36,59 @@ class InterleaverTest : public CppUnit::TestFixture
void testUninitialized()
{
interleaver.reset (new Interleaver<float>());
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
CPPUNIT_ASSERT_THROW (interleaver->input(0)->process (c), Exception);
}
void testInvalidInputIndex()
{
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
CPPUNIT_ASSERT_THROW (interleaver->input (3)->process (c), Exception);
}
void testInvalidInputSize()
{
- ProcessContext<float> c (random_data, frames + 1, 1);
+ ProcessContext<float> c (random_data, samples + 1, 1);
CPPUNIT_ASSERT_THROW (interleaver->input (0)->process (c), Exception);
- interleaver->input (0)->process (c.beginning (frames));
- interleaver->input (1)->process (c.beginning (frames));
- CPPUNIT_ASSERT_THROW (interleaver->input (2)->process (c.beginning (frames - 1)), Exception);
+ interleaver->input (0)->process (c.beginning (samples));
+ interleaver->input (1)->process (c.beginning (samples));
+ CPPUNIT_ASSERT_THROW (interleaver->input (2)->process (c.beginning (samples - 1)), Exception);
- interleaver->input (0)->process (c.beginning (frames - 1));
- interleaver->input (1)->process (c.beginning (frames - 1));
- CPPUNIT_ASSERT_THROW (interleaver->input (2)->process (c.beginning (frames)), Exception);
+ interleaver->input (0)->process (c.beginning (samples - 1));
+ interleaver->input (1)->process (c.beginning (samples - 1));
+ CPPUNIT_ASSERT_THROW (interleaver->input (2)->process (c.beginning (samples)), Exception);
}
void testOutputSize()
{
interleaver->add_output (sink);
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
interleaver->input (0)->process (c);
interleaver->input (1)->process (c);
interleaver->input (2)->process (c);
- framecnt_t expected_frames = frames * channels;
- framecnt_t generated_frames = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
+ samplecnt_t expected_samples = samples * channels;
+ samplecnt_t generated_samples = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (expected_samples, generated_samples);
- framecnt_t less_frames = frames / 2;
- interleaver->input (0)->process (c.beginning (less_frames));
- interleaver->input (1)->process (c.beginning (less_frames));
- interleaver->input (2)->process (c.beginning (less_frames));
+ samplecnt_t less_samples = samples / 2;
+ interleaver->input (0)->process (c.beginning (less_samples));
+ interleaver->input (1)->process (c.beginning (less_samples));
+ interleaver->input (2)->process (c.beginning (less_samples));
- expected_frames = less_frames * channels;
- generated_frames = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
+ expected_samples = less_samples * channels;
+ generated_samples = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (expected_samples, generated_samples);
}
void testZeroInput()
{
interleaver->add_output (sink);
- // input zero frames to all inputs
- ProcessContext<float> c (random_data, frames, 1);
+ // input zero samples to all inputs
+ ProcessContext<float> c (random_data, samples, 1);
interleaver->input (0)->process (c.beginning (0));
interleaver->input (1)->process (c.beginning (0));
interleaver->input (2)->process (c.beginning (0));
@@ -100,15 +100,15 @@ class InterleaverTest : public CppUnit::TestFixture
interleaver->input (1)->process (c);
interleaver->input (2)->process (c);
- framecnt_t expected_frames = frames * channels;
- framecnt_t generated_frames = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
+ samplecnt_t expected_samples = samples * channels;
+ samplecnt_t generated_samples = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (expected_samples, generated_samples);
}
void testChannelSync()
{
interleaver->add_output (sink);
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
interleaver->input (0)->process (c);
CPPUNIT_ASSERT_THROW (interleaver->input (0)->process (c), Exception);
}
@@ -119,9 +119,9 @@ class InterleaverTest : public CppUnit::TestFixture
boost::shared_ptr<VectorSink<float> > sink;
- framecnt_t channels;
+ samplecnt_t channels;
float * random_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (InterleaverTest);
diff --git a/libs/audiographer/tests/general/normalizer_test.cc b/libs/audiographer/tests/general/normalizer_test.cc
index fb8cd617c2..74df980028 100644
--- a/libs/audiographer/tests/general/normalizer_test.cc
+++ b/libs/audiographer/tests/general/normalizer_test.cc
@@ -14,7 +14,7 @@ class NormalizerTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 1024;
+ samples = 1024;
}
void tearDown()
@@ -25,23 +25,23 @@ class NormalizerTest : public CppUnit::TestFixture
void testConstAmplify()
{
float target = 0.0;
- random_data = TestUtils::init_random_data(frames, 0.5);
+ random_data = TestUtils::init_random_data(samples, 0.5);
normalizer.reset (new Normalizer(target));
peak_reader.reset (new PeakReader());
sink.reset (new VectorSink<float>());
- ProcessContext<float> const c (random_data, frames, 1);
+ ProcessContext<float> const c (random_data, samples, 1);
peak_reader->process (c);
float peak = peak_reader->get_peak();
- normalizer->alloc_buffer (frames);
+ normalizer->alloc_buffer (samples);
normalizer->set_peak (peak);
normalizer->add_output (sink);
normalizer->process (c);
peak_reader->reset();
- ConstProcessContext<float> normalized (sink->get_array(), frames, 1);
+ ConstProcessContext<float> normalized (sink->get_array(), samples, 1);
peak_reader->process (normalized);
peak = peak_reader->get_peak();
@@ -54,7 +54,7 @@ class NormalizerTest : public CppUnit::TestFixture
boost::shared_ptr<VectorSink<float> > sink;
float * random_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (NormalizerTest);
diff --git a/libs/audiographer/tests/general/peak_reader_test.cc b/libs/audiographer/tests/general/peak_reader_test.cc
index a93d28a954..b5f7a6dad1 100644
--- a/libs/audiographer/tests/general/peak_reader_test.cc
+++ b/libs/audiographer/tests/general/peak_reader_test.cc
@@ -13,8 +13,8 @@ class PeakReaderTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 128;
- random_data = TestUtils::init_random_data(frames);
+ samples = 128;
+ random_data = TestUtils::init_random_data(samples);
}
void tearDown()
@@ -25,7 +25,7 @@ class PeakReaderTest : public CppUnit::TestFixture
void testProcess()
{
reader.reset (new PeakReader());
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
float peak = 1.5;
random_data[10] = peak;
@@ -48,7 +48,7 @@ class PeakReaderTest : public CppUnit::TestFixture
boost::shared_ptr<PeakReader> reader;
float * random_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (PeakReaderTest);
diff --git a/libs/audiographer/tests/general/sample_format_converter_test.cc b/libs/audiographer/tests/general/sample_format_converter_test.cc
index 734389a427..92a559aa33 100644
--- a/libs/audiographer/tests/general/sample_format_converter_test.cc
+++ b/libs/audiographer/tests/general/sample_format_converter_test.cc
@@ -20,8 +20,8 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 128;
- random_data = TestUtils::init_random_data(frames, 1.0);
+ samples = 128;
+ random_data = TestUtils::init_random_data(samples, 1.0);
}
void tearDown()
@@ -33,30 +33,30 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
// Float never uses dithering and should always use full 32 bits of data
boost::shared_ptr<SampleFormatConverter<float> > f_converter (new SampleFormatConverter<float>(1));
- f_converter->init (frames, D_Tri, 32); // Doesn't throw
- CPPUNIT_ASSERT_THROW (f_converter->init (frames, D_Tri, 24), Exception);
- CPPUNIT_ASSERT_THROW (f_converter->init (frames, D_Tri, 48), Exception);
+ f_converter->init (samples, D_Tri, 32); // Doesn't throw
+ CPPUNIT_ASSERT_THROW (f_converter->init (samples, D_Tri, 24), Exception);
+ CPPUNIT_ASSERT_THROW (f_converter->init (samples, D_Tri, 48), Exception);
/* Test that too large data widths throw.
We are fine with unnecessarily narrow data widths */
boost::shared_ptr<SampleFormatConverter<int32_t> > i_converter (new SampleFormatConverter<int32_t>(1));
- i_converter->init (frames, D_Tri, 32); // Doesn't throw
- i_converter->init (frames, D_Tri, 24); // Doesn't throw
- i_converter->init (frames, D_Tri, 8); // Doesn't throw
- i_converter->init (frames, D_Tri, 16); // Doesn't throw
- CPPUNIT_ASSERT_THROW (i_converter->init (frames, D_Tri, 48), Exception);
+ i_converter->init (samples, D_Tri, 32); // Doesn't throw
+ i_converter->init (samples, D_Tri, 24); // Doesn't throw
+ i_converter->init (samples, D_Tri, 8); // Doesn't throw
+ i_converter->init (samples, D_Tri, 16); // Doesn't throw
+ CPPUNIT_ASSERT_THROW (i_converter->init (samples, D_Tri, 48), Exception);
boost::shared_ptr<SampleFormatConverter<int16_t> > i16_converter (new SampleFormatConverter<int16_t>(1));
- i16_converter->init (frames, D_Tri, 16); // Doesn't throw
- i16_converter->init (frames, D_Tri, 8); // Doesn't throw
- CPPUNIT_ASSERT_THROW (i16_converter->init (frames, D_Tri, 32), Exception);
- CPPUNIT_ASSERT_THROW (i16_converter->init (frames, D_Tri, 48), Exception);
+ i16_converter->init (samples, D_Tri, 16); // Doesn't throw
+ i16_converter->init (samples, D_Tri, 8); // Doesn't throw
+ CPPUNIT_ASSERT_THROW (i16_converter->init (samples, D_Tri, 32), Exception);
+ CPPUNIT_ASSERT_THROW (i16_converter->init (samples, D_Tri, 48), Exception);
boost::shared_ptr<SampleFormatConverter<uint8_t> > ui_converter (new SampleFormatConverter<uint8_t>(1));
- ui_converter->init (frames, D_Tri, 8); // Doesn't throw
- ui_converter->init (frames, D_Tri, 4); // Doesn't throw
- CPPUNIT_ASSERT_THROW (ui_converter->init (frames, D_Tri, 16), Exception);
+ ui_converter->init (samples, D_Tri, 8); // Doesn't throw
+ ui_converter->init (samples, D_Tri, 4); // Doesn't throw
+ CPPUNIT_ASSERT_THROW (ui_converter->init (samples, D_Tri, 16), Exception);
}
void testFrameCount()
@@ -64,26 +64,26 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
boost::shared_ptr<SampleFormatConverter<int32_t> > converter (new SampleFormatConverter<int32_t>(1));
boost::shared_ptr<VectorSink<int32_t> > sink (new VectorSink<int32_t>());
- converter->init (frames, D_Tri, 32);
+ converter->init (samples, D_Tri, 32);
converter->add_output (sink);
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
{
- ProcessContext<float> pc(random_data, frames / 2, 1);
+ ProcessContext<float> pc(random_data, samples / 2, 1);
converter->process (pc);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames / 2, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples / 2, samples_output);
}
{
- ProcessContext<float> pc(random_data, frames, 1);
+ ProcessContext<float> pc(random_data, samples, 1);
converter->process (pc);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
}
{
- ProcessContext<float> pc(random_data, frames + 1, 1);
+ ProcessContext<float> pc(random_data, samples + 1, 1);
CPPUNIT_ASSERT_THROW(converter->process (pc), Exception);
}
}
@@ -92,17 +92,17 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
boost::shared_ptr<SampleFormatConverter<float> > converter (new SampleFormatConverter<float>(1));
boost::shared_ptr<VectorSink<float> > sink (new VectorSink<float>());
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- converter->init(frames, D_Tri, 32);
+ converter->init(samples, D_Tri, 32);
converter->add_output (sink);
converter->set_clip_floats (false);
- ProcessContext<float> const pc(random_data, frames, 1);
+ ProcessContext<float> const pc(random_data, samples, 1);
converter->process (pc);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_equals(sink->get_array(), random_data, frames));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_equals(sink->get_array(), random_data, samples));
// Make sure a few samples are < -1.0 and > 1.0
random_data[10] = -1.5;
@@ -110,11 +110,11 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
converter->set_clip_floats (true);
converter->process (pc);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), frames));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), samples));
- for (framecnt_t i = 0; i < frames; ++i) {
+ for (samplecnt_t i = 0; i < samples; ++i) {
// fp comparison needs a bit of tolerance, 1.01 << 1.5
CPPUNIT_ASSERT(sink->get_data()[i] < 1.01);
CPPUNIT_ASSERT(sink->get_data()[i] > -1.01);
@@ -125,89 +125,89 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
boost::shared_ptr<SampleFormatConverter<int32_t> > converter (new SampleFormatConverter<int32_t>(1));
boost::shared_ptr<VectorSink<int32_t> > sink (new VectorSink<int32_t>());
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- converter->init(frames, D_Tri, 32);
+ converter->init(samples, D_Tri, 32);
converter->add_output (sink);
- ProcessContext<float> pc(random_data, frames, 1);
+ ProcessContext<float> pc(random_data, samples, 1);
converter->process (pc);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), frames));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), samples));
}
void testInt24()
{
boost::shared_ptr<SampleFormatConverter<int32_t> > converter (new SampleFormatConverter<int32_t>(1));
boost::shared_ptr<VectorSink<int32_t> > sink (new VectorSink<int32_t>());
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- converter->init(frames, D_Tri, 24);
+ converter->init(samples, D_Tri, 24);
converter->add_output (sink);
- ProcessContext<float> pc(random_data, frames, 1);
+ ProcessContext<float> pc(random_data, samples, 1);
converter->process (pc);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), frames));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), samples));
}
void testInt16()
{
boost::shared_ptr<SampleFormatConverter<int16_t> > converter (new SampleFormatConverter<int16_t>(1));
boost::shared_ptr<VectorSink<int16_t> > sink (new VectorSink<int16_t>());
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- converter->init(frames, D_Tri, 16);
+ converter->init(samples, D_Tri, 16);
converter->add_output (sink);
- ProcessContext<float> pc(random_data, frames, 1);
+ ProcessContext<float> pc(random_data, samples, 1);
converter->process (pc);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), frames));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), samples));
}
void testUint8()
{
boost::shared_ptr<SampleFormatConverter<uint8_t> > converter (new SampleFormatConverter<uint8_t>(1));
boost::shared_ptr<VectorSink<uint8_t> > sink (new VectorSink<uint8_t>());
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- converter->init(frames, D_Tri, 8);
+ converter->init(samples, D_Tri, 8);
converter->add_output (sink);
- ProcessContext<float> pc(random_data, frames, 1);
+ ProcessContext<float> pc(random_data, samples, 1);
converter->process (pc);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), frames));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), samples));
}
void testChannelCount()
{
boost::shared_ptr<SampleFormatConverter<int32_t> > converter (new SampleFormatConverter<int32_t>(3));
boost::shared_ptr<VectorSink<int32_t> > sink (new VectorSink<int32_t>());
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- converter->init(frames, D_Tri, 32);
+ converter->init(samples, D_Tri, 32);
converter->add_output (sink);
ProcessContext<float> pc(random_data, 4, 1);
CPPUNIT_ASSERT_THROW (converter->process (pc), Exception);
- framecnt_t new_frame_count = frames - (frames % 3);
- converter->process (ProcessContext<float> (pc.data(), new_frame_count, 3));
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (new_frame_count, frames_output);
- CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), pc.frames()));
+ samplecnt_t new_sample_count = samples - (samples % 3);
+ converter->process (ProcessContext<float> (pc.data(), new_sample_count, 3));
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (new_sample_count, samples_output);
+ CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), pc.samples()));
}
private:
float * random_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (SampleFormatConverterTest);
diff --git a/libs/audiographer/tests/general/silence_trimmer_test.cc b/libs/audiographer/tests/general/silence_trimmer_test.cc
index be53c89978..c6662c92de 100644
--- a/libs/audiographer/tests/general/silence_trimmer_test.cc
+++ b/libs/audiographer/tests/general/silence_trimmer_test.cc
@@ -17,19 +17,19 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 128;
+ samples = 128;
- random_data = TestUtils::init_random_data(frames);
+ random_data = TestUtils::init_random_data(samples);
random_data[0] = 0.5;
- random_data[frames - 1] = 0.5;
+ random_data[samples - 1] = 0.5;
- zero_data = new float[frames];
- memset(zero_data, 0, frames * sizeof(float));
+ zero_data = new float[samples];
+ memset(zero_data, 0, samples * sizeof(float));
- half_random_data = TestUtils::init_random_data(frames);
- memset(half_random_data, 0, (frames / 2) * sizeof(float));
+ half_random_data = TestUtils::init_random_data(samples);
+ memset(half_random_data, 0, (samples / 2) * sizeof(float));
- trimmer.reset (new SilenceTrimmer<float> (frames / 2));
+ trimmer.reset (new SilenceTrimmer<float> (samples / 2));
sink.reset (new AppendingVectorSink<float>());
trimmer->set_trim_beginning (true);
@@ -48,73 +48,73 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
trimmer->add_output (sink);
{
- ProcessContext<float> c (zero_data, frames, 1);
+ ProcessContext<float> c (zero_data, samples, 1);
trimmer->process (c);
- framecnt_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_processed);
+ samplecnt_t samples_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((samplecnt_t) 0, samples_processed);
}
{
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
trimmer->process (c);
- framecnt_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_processed);
- CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, frames));
+ samplecnt_t samples_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_processed);
+ CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, samples));
}
{
- ProcessContext<float> c (zero_data, frames, 1);
+ ProcessContext<float> c (zero_data, samples, 1);
trimmer->process (c);
- framecnt_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_processed);
+ samplecnt_t samples_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_processed);
}
{
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
trimmer->process (c);
- framecnt_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (3 * frames, frames_processed);
- CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[frames], zero_data, frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[2 * frames], random_data, frames));
+ samplecnt_t samples_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (3 * samples, samples_processed);
+ CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[samples], zero_data, samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[2 * samples], random_data, samples));
}
{
- ProcessContext<float> c (zero_data, frames, 1);
+ ProcessContext<float> c (zero_data, samples, 1);
trimmer->process (c);
- framecnt_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (3 * frames, frames_processed);
+ samplecnt_t samples_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (3 * samples, samples_processed);
}
}
void testPartialBuffers()
{
trimmer->add_output (sink);
- trimmer->reset (frames / 4);
+ trimmer->reset (samples / 4);
trimmer->set_trim_beginning (true);
trimmer->set_trim_end (true);
{
- ProcessContext<float> c (half_random_data, frames, 1);
+ ProcessContext<float> c (half_random_data, samples, 1);
trimmer->process (c);
- framecnt_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames / 2, frames_processed);
- CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), &half_random_data[frames / 2], frames / 2));
+ samplecnt_t samples_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples / 2, samples_processed);
+ CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), &half_random_data[samples / 2], samples / 2));
}
{
- ProcessContext<float> c (zero_data, frames, 1);
+ ProcessContext<float> c (zero_data, samples, 1);
trimmer->process (c);
- framecnt_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames / 2, frames_processed);
+ samplecnt_t samples_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples / 2, samples_processed);
}
{
- ProcessContext<float> c (half_random_data, frames, 1);
+ ProcessContext<float> c (half_random_data, samples, 1);
trimmer->process (c);
- framecnt_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (2 * frames + frames / 2, frames_processed);
- CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[frames + frames / 2], half_random_data, frames));
+ samplecnt_t samples_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (2 * samples + samples / 2, samples_processed);
+ CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[samples + samples / 2], half_random_data, samples));
}
}
@@ -129,42 +129,42 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
{
trimmer->add_output (sink);
- framecnt_t silence = frames / 2;
+ samplecnt_t silence = samples / 2;
trimmer->add_silence_to_beginning (silence);
{
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
trimmer->process (c);
}
CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), zero_data, silence));
- CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[silence], random_data, frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[silence], random_data, samples));
}
void testAddSilenceEnd()
{
trimmer->add_output (sink);
- framecnt_t silence = frames / 3;
+ samplecnt_t silence = samples / 3;
trimmer->add_silence_to_end (silence);
{
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
trimmer->process (c);
}
{
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
c.set_flag (ProcessContext<float>::EndOfInput);
trimmer->process (c);
}
- framecnt_t frames_processed = sink->get_data().size();
- framecnt_t total_frames = 2 * frames + silence;
- CPPUNIT_ASSERT_EQUAL (total_frames, frames_processed);
- CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[frames], random_data, frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[frames * 2], zero_data, silence));
+ samplecnt_t samples_processed = sink->get_data().size();
+ samplecnt_t total_samples = 2 * samples + silence;
+ CPPUNIT_ASSERT_EQUAL (total_samples, samples_processed);
+ CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[samples], random_data, samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[samples * 2], zero_data, silence));
}
private:
@@ -174,7 +174,7 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
float * random_data;
float * zero_data;
float * half_random_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (SilenceTrimmerTest);
diff --git a/libs/audiographer/tests/general/sr_converter_test.cc b/libs/audiographer/tests/general/sr_converter_test.cc
index 4f5afbb620..b2b7193ff6 100644
--- a/libs/audiographer/tests/general/sr_converter_test.cc
+++ b/libs/audiographer/tests/general/sr_converter_test.cc
@@ -16,8 +16,8 @@ class SampleRateConverterTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 128;
- random_data = TestUtils::init_random_data(frames);
+ samples = 128;
+ random_data = TestUtils::init_random_data(samples);
sink.reset (new AppendingVectorSink<float>());
grabber.reset (new ProcessContextGrabber<float>());
converter.reset (new SampleRateConverter (1));
@@ -30,79 +30,79 @@ class SampleRateConverterTest : public CppUnit::TestFixture
void testNoConversion()
{
- assert (frames % 2 == 0);
- framecnt_t const half_frames = frames / 2;
- framecnt_t frames_output = 0;
+ assert (samples % 2 == 0);
+ samplecnt_t const half_samples = samples / 2;
+ samplecnt_t samples_output = 0;
converter->init (44100, 44100);
converter->add_output (sink);
- ProcessContext<float> c (random_data, half_frames, 1);
+ ProcessContext<float> c (random_data, half_samples, 1);
converter->process (c);
- ProcessContext<float> c2 (&random_data[half_frames], half_frames, 1);
+ ProcessContext<float> c2 (&random_data[half_samples], half_samples, 1);
c2.set_flag (ProcessContext<float>::EndOfInput);
converter->process (c2);
- frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
+ samples_output = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink->get_array(), samples));
}
void testUpsampleLength()
{
- assert (frames % 2 == 0);
- framecnt_t const half_frames = frames / 2;
- framecnt_t frames_output = 0;
+ assert (samples % 2 == 0);
+ samplecnt_t const half_samples = samples / 2;
+ samplecnt_t samples_output = 0;
converter->init (44100, 88200);
- converter->allocate_buffers (half_frames);
+ converter->allocate_buffers (half_samples);
converter->add_output (sink);
- ProcessContext<float> c (random_data, half_frames, 1);
+ ProcessContext<float> c (random_data, half_samples, 1);
converter->process (c);
- ProcessContext<float> c2 (&random_data[half_frames], half_frames, 1);
+ ProcessContext<float> c2 (&random_data[half_samples], half_samples, 1);
c2.set_flag (ProcessContext<float>::EndOfInput);
converter->process (c2);
- frames_output = sink->get_data().size();
- framecnt_t tolerance = 3;
- CPPUNIT_ASSERT (2 * frames - tolerance < frames_output && frames_output < 2 * frames + tolerance);
+ samples_output = sink->get_data().size();
+ samplecnt_t tolerance = 3;
+ CPPUNIT_ASSERT (2 * samples - tolerance < samples_output && samples_output < 2 * samples + tolerance);
}
void testDownsampleLength()
{
- assert (frames % 2 == 0);
- framecnt_t const half_frames = frames / 2;
- framecnt_t frames_output = 0;
+ assert (samples % 2 == 0);
+ samplecnt_t const half_samples = samples / 2;
+ samplecnt_t samples_output = 0;
converter->init (88200, 44100);
- converter->allocate_buffers (half_frames);
+ converter->allocate_buffers (half_samples);
converter->add_output (sink);
- ProcessContext<float> c (random_data, half_frames, 1);
+ ProcessContext<float> c (random_data, half_samples, 1);
converter->process (c);
- ProcessContext<float> c2 (&random_data[half_frames], half_frames, 1);
+ ProcessContext<float> c2 (&random_data[half_samples], half_samples, 1);
c2.set_flag (ProcessContext<float>::EndOfInput);
converter->process (c2);
- frames_output = sink->get_data().size();
- framecnt_t tolerance = 3;
- CPPUNIT_ASSERT (half_frames - tolerance < frames_output && frames_output < half_frames + tolerance);
+ samples_output = sink->get_data().size();
+ samplecnt_t tolerance = 3;
+ CPPUNIT_ASSERT (half_samples - tolerance < samples_output && samples_output < half_samples + tolerance);
}
void testRespectsEndOfInput()
{
- assert (frames % 2 == 0);
- framecnt_t const half_frames = frames / 2;
+ assert (samples % 2 == 0);
+ samplecnt_t const half_samples = samples / 2;
converter->init (44100, 48000);
- converter->allocate_buffers (half_frames);
+ converter->allocate_buffers (half_samples);
converter->add_output (grabber);
- ProcessContext<float> c (random_data, half_frames, 1);
+ ProcessContext<float> c (random_data, half_samples, 1);
converter->process (c);
- ProcessContext<float> c2 (&random_data[half_frames], half_frames / 2, 1);
+ ProcessContext<float> c2 (&random_data[half_samples], half_samples / 2, 1);
c2.set_flag (ProcessContext<float>::EndOfInput);
converter->process (c2);
@@ -123,7 +123,7 @@ class SampleRateConverterTest : public CppUnit::TestFixture
boost::shared_ptr<ProcessContextGrabber<float> > grabber;
float * random_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (SampleRateConverterTest);
diff --git a/libs/audiographer/tests/general/threader_test.cc b/libs/audiographer/tests/general/threader_test.cc
index cdb21a375b..8662d61a30 100644
--- a/libs/audiographer/tests/general/threader_test.cc
+++ b/libs/audiographer/tests/general/threader_test.cc
@@ -16,11 +16,11 @@ class ThreaderTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 128;
- random_data = TestUtils::init_random_data (frames, 1.0);
+ samples = 128;
+ random_data = TestUtils::init_random_data (samples, 1.0);
- zero_data = new float[frames];
- memset (zero_data, 0, frames * sizeof(float));
+ zero_data = new float[samples];
+ memset (zero_data, 0, samples * sizeof(float));
thread_pool = new Glib::ThreadPool (3);
threader.reset (new Threader<float> (*thread_pool));
@@ -53,15 +53,15 @@ class ThreaderTest : public CppUnit::TestFixture
threader->add_output (sink_e);
threader->add_output (sink_f);
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
threader->process (c);
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_a->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_b->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_c->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_d->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_e->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_f->get_array(), frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_a->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_b->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_c->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_d->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_e->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_f->get_array(), samples));
}
void testRemoveOutput()
@@ -73,7 +73,7 @@ class ThreaderTest : public CppUnit::TestFixture
threader->add_output (sink_e);
threader->add_output (sink_f);
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
threader->process (c);
// Remove a, b and f
@@ -81,15 +81,15 @@ class ThreaderTest : public CppUnit::TestFixture
threader->remove_output (sink_b);
threader->remove_output (sink_f);
- ProcessContext<float> zc (zero_data, frames, 1);
+ ProcessContext<float> zc (zero_data, samples, 1);
threader->process (zc);
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_a->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_b->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(zero_data, sink_c->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(zero_data, sink_d->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(zero_data, sink_e->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_f->get_array(), frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_a->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_b->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(zero_data, sink_c->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(zero_data, sink_d->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(zero_data, sink_e->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_f->get_array(), samples));
}
void testClearOutputs()
@@ -101,19 +101,19 @@ class ThreaderTest : public CppUnit::TestFixture
threader->add_output (sink_e);
threader->add_output (sink_f);
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
threader->process (c);
threader->clear_outputs();
- ProcessContext<float> zc (zero_data, frames, 1);
+ ProcessContext<float> zc (zero_data, samples, 1);
threader->process (zc);
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_a->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_b->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_c->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_d->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_e->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_f->get_array(), frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_a->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_b->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_c->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_d->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_e->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_f->get_array(), samples));
}
void testExceptions()
@@ -125,13 +125,13 @@ class ThreaderTest : public CppUnit::TestFixture
threader->add_output (sink_e);
threader->add_output (throwing_sink);
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
CPPUNIT_ASSERT_THROW (threader->process (c), Exception);
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_a->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_b->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_c->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_e->get_array(), frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_a->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_b->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_c->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals(random_data, sink_e->get_array(), samples));
}
private:
@@ -149,7 +149,7 @@ class ThreaderTest : public CppUnit::TestFixture
float * random_data;
float * zero_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (ThreaderTest);
diff --git a/libs/audiographer/tests/sndfile/tmp_file_test.cc b/libs/audiographer/tests/sndfile/tmp_file_test.cc
index 9748623f37..0d62796a02 100644
--- a/libs/audiographer/tests/sndfile/tmp_file_test.cc
+++ b/libs/audiographer/tests/sndfile/tmp_file_test.cc
@@ -12,8 +12,8 @@ class TmpFileTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 128;
- random_data = TestUtils::init_random_data(frames);
+ samples = 128;
+ random_data = TestUtils::init_random_data(samples);
}
void tearDown()
@@ -25,22 +25,22 @@ class TmpFileTest : public CppUnit::TestFixture
{
uint32_t channels = 2;
file.reset (new TmpFileSync<float>(SF_FORMAT_WAV | SF_FORMAT_FLOAT, channels, 44100));
- AllocatingProcessContext<float> c (random_data, frames, channels);
+ AllocatingProcessContext<float> c (random_data, samples, channels);
c.set_flag (ProcessContext<float>::EndOfInput);
file->process (c);
- TypeUtils<float>::zero_fill (c.data (), c.frames());
+ TypeUtils<float>::zero_fill (c.data (), c.samples());
file->seek (0, SEEK_SET);
file->read (c);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, c.data(), c.frames()));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, c.data(), c.samples()));
}
private:
boost::shared_ptr<TmpFileSync<float> > file;
float * random_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (TmpFileTest);
diff --git a/libs/audiographer/tests/type_utils_test.cc b/libs/audiographer/tests/type_utils_test.cc
index 1ae7b28451..a1197246bd 100644
--- a/libs/audiographer/tests/type_utils_test.cc
+++ b/libs/audiographer/tests/type_utils_test.cc
@@ -27,11 +27,11 @@ class TypeUtilsTest : public CppUnit::TestFixture
void testZeroFillPod()
{
- unsigned frames = 10;
- float buf[frames];
- TypeUtils<float>::zero_fill (buf, frames);
+ unsigned samples = 10;
+ float buf[samples];
+ TypeUtils<float>::zero_fill (buf, samples);
float zero = 0.0;
- for (unsigned i = 0; i < frames; ++i) {
+ for (unsigned i = 0; i < samples; ++i) {
CPPUNIT_ASSERT_EQUAL (zero, buf[i]);
}
}
@@ -39,11 +39,11 @@ class TypeUtilsTest : public CppUnit::TestFixture
void testZeroFillNonPod()
{
/* does not compile on OS X Lion
- unsigned frames = 10;
- NonPodType buf[frames];
- TypeUtils<NonPodType>::zero_fill (buf, frames);
+ unsigned samples = 10;
+ NonPodType buf[samples];
+ TypeUtils<NonPodType>::zero_fill (buf, samples);
NonPodType zero;
- for (unsigned i = 0; i < frames; ++i) {
+ for (unsigned i = 0; i < samples; ++i) {
CPPUNIT_ASSERT (zero == buf[i]);
}
*/
diff --git a/libs/audiographer/tests/utils.h b/libs/audiographer/tests/utils.h
index b6b9e0136c..9d400f6977 100644
--- a/libs/audiographer/tests/utils.h
+++ b/libs/audiographer/tests/utils.h
@@ -17,14 +17,14 @@
#include <cstdlib>
#include <ctime>
-using AudioGrapher::framecnt_t;
+using AudioGrapher::samplecnt_t;
struct TestUtils
{
template<typename T>
- static bool array_equals (T const * a, T const * b, framecnt_t frames)
+ static bool array_equals (T const * a, T const * b, samplecnt_t samples)
{
- for (framecnt_t i = 0; i < frames; ++i) {
+ for (samplecnt_t i = 0; i < samples; ++i) {
if (a[i] != b[i]) {
return false;
}
@@ -33,9 +33,9 @@ struct TestUtils
}
template<typename T>
- static bool array_filled (T const * array, framecnt_t frames)
+ static bool array_filled (T const * array, samplecnt_t samples)
{
- for (framecnt_t i = 0; i < frames; ++i) {
+ for (samplecnt_t i = 0; i < samples; ++i) {
if (array[i] == static_cast<T> (0.0)) {
return false;
}
@@ -44,13 +44,13 @@ struct TestUtils
}
/// Generate random data, all samples guaranteed not to be 0.0, 1.0 or -1.0
- static float * init_random_data (framecnt_t frames, float range = 1.0)
+ static float * init_random_data (samplecnt_t samples, float range = 1.0)
{
unsigned int const granularity = 4096;
- float * data = new float[frames];
+ float * data = new float[samples];
srand (std::time (NULL));
- for (framecnt_t i = 0; i < frames; ++i) {
+ for (samplecnt_t i = 0; i < samples; ++i) {
do {
int biased_int = (rand() % granularity) - (granularity / 2);
data[i] = (range * biased_int) / granularity;
@@ -66,8 +66,8 @@ class VectorSink : public AudioGrapher::Sink<T>
public:
virtual void process (AudioGrapher::ProcessContext<T> const & c)
{
- data.resize (c.frames());
- memcpy (&data[0], c.data(), c.frames() * sizeof(T));
+ data.resize (c.samples());
+ memcpy (&data[0], c.data(), c.samples() * sizeof(T));
}
void process (AudioGrapher::ProcessContext<T> & c) { AudioGrapher::Sink<T>::process (c); }
@@ -90,20 +90,20 @@ class AppendingVectorSink : public VectorSink<T>
void process (AudioGrapher::ProcessContext<T> const & c)
{
std::vector<T> & data (VectorSink<T>::data);
- data.resize (total_frames + c.frames());
- memcpy (&data[total_frames], c.data(), c.frames() * sizeof(T));
- total_frames += c.frames();
+ data.resize (total_samples + c.samples());
+ memcpy (&data[total_samples], c.data(), c.samples() * sizeof(T));
+ total_samples += c.samples();
}
using AudioGrapher::Sink<T>::process;
void reset ()
{
- total_frames = 0;
+ total_samples = 0;
VectorSink<T>::reset();
}
private:
- framecnt_t total_frames;
+ samplecnt_t total_samples;
};
diff --git a/libs/audiographer/tests/utils/identity_vertex_test.cc b/libs/audiographer/tests/utils/identity_vertex_test.cc
index 3c0fd71c70..81c4e498f2 100644
--- a/libs/audiographer/tests/utils/identity_vertex_test.cc
+++ b/libs/audiographer/tests/utils/identity_vertex_test.cc
@@ -15,11 +15,11 @@ class IdentityVertexTest : public CppUnit::TestFixture
public:
void setUp()
{
- frames = 128;
- random_data = TestUtils::init_random_data(frames);
+ samples = 128;
+ random_data = TestUtils::init_random_data(samples);
- zero_data = new float[frames];
- memset (zero_data, 0, frames * sizeof(float));
+ zero_data = new float[samples];
+ memset (zero_data, 0, samples * sizeof(float));
sink_a.reset (new VectorSink<float>());
sink_b.reset (new VectorSink<float>());
@@ -37,19 +37,19 @@ class IdentityVertexTest : public CppUnit::TestFixture
vertex->add_output (sink_a);
vertex->add_output (sink_b);
- framecnt_t frames_output = 0;
+ samplecnt_t samples_output = 0;
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
vertex->process (c);
- frames_output = sink_a->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
+ samples_output = sink_a->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
- frames_output = sink_b->get_data().size();
- CPPUNIT_ASSERT_EQUAL (frames, frames_output);
+ samples_output = sink_b->get_data().size();
+ CPPUNIT_ASSERT_EQUAL (samples, samples_output);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_a->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_b->get_array(), frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_a->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_b->get_array(), samples));
}
void testRemoveOutput()
@@ -58,15 +58,15 @@ class IdentityVertexTest : public CppUnit::TestFixture
vertex->add_output (sink_a);
vertex->add_output (sink_b);
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
vertex->process (c);
vertex->remove_output (sink_a);
- ProcessContext<float> zc (zero_data, frames, 1);
+ ProcessContext<float> zc (zero_data, samples, 1);
vertex->process (zc);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_a->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (zero_data, sink_b->get_array(), frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_a->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (zero_data, sink_b->get_array(), samples));
}
void testClearOutputs()
@@ -75,15 +75,15 @@ class IdentityVertexTest : public CppUnit::TestFixture
vertex->add_output (sink_a);
vertex->add_output (sink_b);
- ProcessContext<float> c (random_data, frames, 1);
+ ProcessContext<float> c (random_data, samples, 1);
vertex->process (c);
vertex->clear_outputs ();
- ProcessContext<float> zc (zero_data, frames, 1);
+ ProcessContext<float> zc (zero_data, samples, 1);
vertex->process (zc);
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_a->get_array(), frames));
- CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_b->get_array(), frames));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_a->get_array(), samples));
+ CPPUNIT_ASSERT (TestUtils::array_equals (random_data, sink_b->get_array(), samples));
}
private:
@@ -93,7 +93,7 @@ class IdentityVertexTest : public CppUnit::TestFixture
float * random_data;
float * zero_data;
- framecnt_t frames;
+ samplecnt_t samples;
};
CPPUNIT_TEST_SUITE_REGISTRATION (IdentityVertexTest);
diff --git a/libs/backends/alsa/alsa_audiobackend.cc b/libs/backends/alsa/alsa_audiobackend.cc
index 5abb471502..292875e6f9 100644
--- a/libs/backends/alsa/alsa_audiobackend.cc
+++ b/libs/backends/alsa/alsa_audiobackend.cc
@@ -1049,13 +1049,13 @@ AlsaAudioBackend::raw_buffer_size (DataType t)
}
/* Process time */
-framepos_t
+samplepos_t
AlsaAudioBackend::sample_time ()
{
return _processed_samples;
}
-framepos_t
+samplepos_t
AlsaAudioBackend::sample_time_at_cycle_start ()
{
return _processed_samples;
diff --git a/libs/backends/alsa/alsa_audiobackend.h b/libs/backends/alsa/alsa_audiobackend.h
index ad3bb41949..2cbc3b04a3 100644
--- a/libs/backends/alsa/alsa_audiobackend.h
+++ b/libs/backends/alsa/alsa_audiobackend.h
@@ -263,8 +263,8 @@ class AlsaAudioBackend : public AudioBackend {
size_t raw_buffer_size (DataType t);
/* Process time */
- framepos_t sample_time ();
- framepos_t sample_time_at_cycle_start ();
+ samplepos_t sample_time ();
+ samplepos_t sample_time_at_cycle_start ();
pframes_t samples_since_cycle_start ();
int create_process_thread (boost::function<void()> func);
@@ -395,7 +395,7 @@ class AlsaAudioBackend : public AudioBackend {
/* processing */
float _dsp_load;
ARDOUR::DSPLoadCalculator _dsp_load_calc;
- framecnt_t _processed_samples;
+ samplecnt_t _processed_samples;
pthread_t _main_thread;
/* DLL, track main process callback timing */
diff --git a/libs/backends/alsa/alsa_slave.cc b/libs/backends/alsa/alsa_slave.cc
index e1061ccc09..8863755f7a 100644
--- a/libs/backends/alsa/alsa_slave.cc
+++ b/libs/backends/alsa/alsa_slave.cc
@@ -237,14 +237,14 @@ AlsaAudioSlave::process_thread ()
}
/* possible samples at end of first buffer chunk,
- * incomplete audio-frame */
+ * incomplete audio-sample */
uint32_t s = vec.len[0] - k * nchn;
assert (s < nchn);
for (c = 0; c < s; ++c) {
_pcmi.capt_chan (c, vec.buf[0] + k * nchn + c, 1, nchn);
}
- /* cont'd audio-frame at second ringbuffer chunk */
+ /* cont'd audio-sample at second ringbuffer chunk */
for (; c < nchn; ++c) {
_pcmi.capt_chan (c, vec.buf[1] + c - s, spp - k, nchn);
}
diff --git a/libs/backends/coreaudio/coreaudio_backend.cc b/libs/backends/coreaudio/coreaudio_backend.cc
index c4e11ef700..0e0f33a5d9 100644
--- a/libs/backends/coreaudio/coreaudio_backend.cc
+++ b/libs/backends/coreaudio/coreaudio_backend.cc
@@ -756,13 +756,13 @@ CoreAudioBackend::raw_buffer_size (DataType t)
}
/* Process time */
-framepos_t
+samplepos_t
CoreAudioBackend::sample_time ()
{
return _processed_samples;
}
-framepos_t
+samplepos_t
CoreAudioBackend::sample_time_at_cycle_start ()
{
return _processed_samples;
diff --git a/libs/backends/coreaudio/coreaudio_backend.h b/libs/backends/coreaudio/coreaudio_backend.h
index 3d7b5be860..5d8c88c3db 100644
--- a/libs/backends/coreaudio/coreaudio_backend.h
+++ b/libs/backends/coreaudio/coreaudio_backend.h
@@ -309,8 +309,8 @@ class CoreAudioBackend : public AudioBackend {
size_t raw_buffer_size (DataType t);
/* Process time */
- framepos_t sample_time ();
- framepos_t sample_time_at_cycle_start ();
+ samplepos_t sample_time ();
+ samplepos_t sample_time_at_cycle_start ();
pframes_t samples_since_cycle_start ();
int create_process_thread (boost::function<void()> func);
diff --git a/libs/backends/coreaudio/coreaudio_pcmio.cc b/libs/backends/coreaudio/coreaudio_pcmio.cc
index 59c054a74a..8b2f9255d3 100644
--- a/libs/backends/coreaudio/coreaudio_pcmio.cc
+++ b/libs/backends/coreaudio/coreaudio_pcmio.cc
@@ -184,11 +184,11 @@ static OSStatus render_callback_ptr (
AudioUnitRenderActionFlags* ioActionFlags,
const AudioTimeStamp* inTimeStamp,
UInt32 inBusNumber,
- UInt32 inNumberFrames,
+ UInt32 inNumberSamples,
AudioBufferList* ioData)
{
CoreAudioPCM * d = static_cast<CoreAudioPCM*> (inRefCon);
- return d->render_callback(ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData);
+ return d->render_callback(ioActionFlags, inTimeStamp, inBusNumber, inNumberSamples, ioData);
}
@@ -752,7 +752,7 @@ static void PrintStreamDesc (AudioStreamBasicDescription *inDesc)
printf (" Format ID:%.*s\n", (int)sizeof(inDesc->mFormatID), (char*)&inDesc->mFormatID);
printf (" Format Flags:%X\n", (unsigned int)inDesc->mFormatFlags);
printf (" Bytes per Packet:%d\n", (int)inDesc->mBytesPerPacket);
- printf (" Frames per Packet:%d\n", (int)inDesc->mFramesPerPacket);
+ printf (" Samples per Packet:%d\n", (int)inDesc->mSamplesPerPacket);
printf (" Bytes per Frame:%d\n", (int)inDesc->mBytesPerFrame);
printf (" Channels per Frame:%d\n", (int)inDesc->mChannelsPerFrame);
printf (" Bits per Channel:%d\n", (int)inDesc->mBitsPerChannel);
@@ -895,7 +895,7 @@ CoreAudioPCM::pcm_start (
srcFormat.mFormatID = kAudioFormatLinearPCM;
srcFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
srcFormat.mBytesPerPacket = sizeof(float);
- srcFormat.mFramesPerPacket = 1;
+ srcFormat.mSamplesPerPacket = 1;
srcFormat.mBytesPerFrame = sizeof(float);
srcFormat.mChannelsPerFrame = chn_in;
srcFormat.mBitsPerChannel = 32;
@@ -903,8 +903,8 @@ CoreAudioPCM::pcm_start (
err = AudioUnitSetProperty(_auhal, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, AUHAL_INPUT_ELEMENT, &srcFormat, sizeof(AudioStreamBasicDescription));
if (err != noErr) { errorMsg="kAudioUnitProperty_StreamFormat, Output"; _state = -6; goto error; }
- err = AudioUnitSetProperty(_auhal, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, AUHAL_INPUT_ELEMENT, (UInt32*)&_samples_per_period, sizeof(UInt32));
- if (err != noErr) { errorMsg="kAudioUnitProperty_MaximumFramesPerSlice, Input"; _state = -6; goto error; }
+ err = AudioUnitSetProperty(_auhal, kAudioUnitProperty_MaximumSamplesPerSlice, kAudioUnitScope_Global, AUHAL_INPUT_ELEMENT, (UInt32*)&_samples_per_period, sizeof(UInt32));
+ if (err != noErr) { errorMsg="kAudioUnitProperty_MaximumSamplesPerSlice, Input"; _state = -6; goto error; }
}
if (chn_out > 0) {
@@ -912,7 +912,7 @@ CoreAudioPCM::pcm_start (
dstFormat.mFormatID = kAudioFormatLinearPCM;
dstFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
dstFormat.mBytesPerPacket = sizeof(float);
- dstFormat.mFramesPerPacket = 1;
+ dstFormat.mSamplesPerPacket = 1;
dstFormat.mBytesPerFrame = sizeof(float);
dstFormat.mChannelsPerFrame = chn_out;
dstFormat.mBitsPerChannel = 32;
@@ -920,8 +920,8 @@ CoreAudioPCM::pcm_start (
err = AudioUnitSetProperty(_auhal, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, AUHAL_OUTPUT_ELEMENT, &dstFormat, sizeof(AudioStreamBasicDescription));
if (err != noErr) { errorMsg="kAudioUnitProperty_StreamFormat Input"; _state = -5; goto error; }
- err = AudioUnitSetProperty(_auhal, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, AUHAL_OUTPUT_ELEMENT, (UInt32*)&_samples_per_period, sizeof(UInt32));
- if (err != noErr) { errorMsg="kAudioUnitProperty_MaximumFramesPerSlice, Output"; _state = -5; goto error; }
+ err = AudioUnitSetProperty(_auhal, kAudioUnitProperty_MaximumSamplesPerSlice, kAudioUnitScope_Global, AUHAL_OUTPUT_ELEMENT, (UInt32*)&_samples_per_period, sizeof(UInt32));
+ if (err != noErr) { errorMsg="kAudioUnitProperty_MaximumSamplesPerSlice, Output"; _state = -5; goto error; }
}
/* read back stream descriptions */
@@ -1111,19 +1111,19 @@ CoreAudioPCM::render_callback (
AudioUnitRenderActionFlags* ioActionFlags,
const AudioTimeStamp* inTimeStamp,
UInt32 inBusNumber,
- UInt32 inNumberFrames,
+ UInt32 inNumberSamples,
AudioBufferList* ioData)
{
OSStatus retVal = kAudioHardwareNoError;
- if (_samples_per_period < inNumberFrames) {
+ if (_samples_per_period < inNumberSamples) {
#ifndef NDEBUG
printf("samples per period exceeds configured value, cycle skipped (%u < %u)\n",
- (unsigned int)_samples_per_period, (unsigned int)inNumberFrames);
+ (unsigned int)_samples_per_period, (unsigned int)inNumberSamples);
#endif
for (uint32_t i = 0; _playback_channels > 0 && i < ioData->mNumberBuffers; ++i) {
float* ob = (float*) ioData->mBuffers[i].mData;
- memset(ob, 0, sizeof(float) * inNumberFrames);
+ memset(ob, 0, sizeof(float) * inNumberSamples);
}
return noErr;
}
@@ -1131,17 +1131,17 @@ CoreAudioPCM::render_callback (
assert(_playback_channels == 0 || ioData->mNumberBuffers == _playback_channels);
UInt64 cur_cycle_start = AudioGetCurrentHostTime ();
- _cur_samples_per_period = inNumberFrames;
+ _cur_samples_per_period = inNumberSamples;
if (_capture_channels > 0) {
_input_audio_buffer_list->mNumberBuffers = _capture_channels;
for (uint32_t i = 0; i < _capture_channels; ++i) {
_input_audio_buffer_list->mBuffers[i].mNumberChannels = 1;
- _input_audio_buffer_list->mBuffers[i].mDataByteSize = inNumberFrames * sizeof(float);
+ _input_audio_buffer_list->mBuffers[i].mDataByteSize = inNumberSamples * sizeof(float);
_input_audio_buffer_list->mBuffers[i].mData = NULL;
}
- retVal = AudioUnitRender(_auhal, ioActionFlags, inTimeStamp, AUHAL_INPUT_ELEMENT, inNumberFrames, _input_audio_buffer_list);
+ retVal = AudioUnitRender(_auhal, ioActionFlags, inTimeStamp, AUHAL_INPUT_ELEMENT, inNumberSamples, _input_audio_buffer_list);
}
if (retVal != kAudioHardwareNoError) {
@@ -1162,7 +1162,7 @@ CoreAudioPCM::render_callback (
int rv = -1;
if (_process_callback) {
- rv = _process_callback(_process_arg, inNumberFrames, cur_cycle_start);
+ rv = _process_callback(_process_arg, inNumberSamples, cur_cycle_start);
}
_in_process = false;
@@ -1171,7 +1171,7 @@ CoreAudioPCM::render_callback (
// clear output
for (uint32_t i = 0; i < ioData->mNumberBuffers; ++i) {
float* ob = (float*) ioData->mBuffers[i].mData;
- memset(ob, 0, sizeof(float) * inNumberFrames);
+ memset(ob, 0, sizeof(float) * inNumberSamples);
}
}
return noErr;
diff --git a/libs/backends/coreaudio/coreaudio_pcmio.h b/libs/backends/coreaudio/coreaudio_pcmio.h
index 5f9778e845..e6d82571f4 100644
--- a/libs/backends/coreaudio/coreaudio_pcmio.h
+++ b/libs/backends/coreaudio/coreaudio_pcmio.h
@@ -126,7 +126,7 @@ public:
AudioUnitRenderActionFlags* ioActionFlags,
const AudioTimeStamp* inTimeStamp,
UInt32 inBusNumber,
- UInt32 inNumberFrames,
+ UInt32 inNumberSamples,
AudioBufferList* ioData);
void xrun_callback ();
diff --git a/libs/backends/dummy/dummy_audiobackend.cc b/libs/backends/dummy/dummy_audiobackend.cc
index 9400d03bbe..825add2c94 100644
--- a/libs/backends/dummy/dummy_audiobackend.cc
+++ b/libs/backends/dummy/dummy_audiobackend.cc
@@ -524,13 +524,13 @@ DummyAudioBackend::raw_buffer_size (DataType t)
}
/* Process time */
-framepos_t
+samplepos_t
DummyAudioBackend::sample_time ()
{
return _processed_samples;
}
-framepos_t
+samplepos_t
DummyAudioBackend::sample_time_at_cycle_start ()
{
return _processed_samples;
diff --git a/libs/backends/dummy/dummy_audiobackend.h b/libs/backends/dummy/dummy_audiobackend.h
index 739a649407..4bd4078ec5 100644
--- a/libs/backends/dummy/dummy_audiobackend.h
+++ b/libs/backends/dummy/dummy_audiobackend.h
@@ -316,8 +316,8 @@ class DummyAudioBackend : public AudioBackend {
size_t raw_buffer_size (DataType t);
/* Process time */
- framepos_t sample_time ();
- framepos_t sample_time_at_cycle_start ();
+ samplepos_t sample_time ();
+ samplepos_t sample_time_at_cycle_start ();
pframes_t samples_since_cycle_start ();
int create_process_thread (boost::function<void()> func);
@@ -435,7 +435,7 @@ class DummyAudioBackend : public AudioBackend {
uint32_t _systemic_input_latency;
uint32_t _systemic_output_latency;
- framecnt_t _processed_samples;
+ samplecnt_t _processed_samples;
pthread_t _main_thread;
diff --git a/libs/backends/dummy/dummy_midi_seq.h b/libs/backends/dummy/dummy_midi_seq.h
index e809a47371..8dbfb660cc 100644
--- a/libs/backends/dummy/dummy_midi_seq.h
+++ b/libs/backends/dummy/dummy_midi_seq.h
@@ -780,7 +780,7 @@ static const MIDISequence s7[] = { // channel1, nonsense
};
static const MIDISequence s8[] = { // sysex
- { 0.00, 10, {0xf0, 0x7f, 0x7f, 0x01, 0x01, /*hour + tc */ 0x20, /*min*/ 0x00, /*sec*/ 0x00, /*frame*/ 0x00, 0xf7} }, // 25fps, 00:00:00:00
+ { 0.00, 10, {0xf0, 0x7f, 0x7f, 0x01, 0x01, /*hour + tc */ 0x20, /*min*/ 0x00, /*sec*/ 0x00, /*sample*/ 0x00, 0xf7} }, // 25fps, 00:00:00:00
// quarter frames spacing (in samples) at 25fps: SR / (25 * 4)
// DummyMidiPort::setup_generator uses 120bpm ie (SR / 2)
// hence the spacing is: SR / (25 * 4) / (SR / 2) = 0.2
diff --git a/libs/backends/jack/jack_audiobackend.cc b/libs/backends/jack/jack_audiobackend.cc
index 8b9e4af1dd..616964c3f2 100644
--- a/libs/backends/jack/jack_audiobackend.cc
+++ b/libs/backends/jack/jack_audiobackend.cc
@@ -633,14 +633,14 @@ JACKAudioBackend::transport_start ()
}
void
-JACKAudioBackend::transport_locate (framepos_t where)
+JACKAudioBackend::transport_locate (samplepos_t where)
{
GET_PRIVATE_JACK_POINTER (_priv_jack);
jack_transport_locate (_priv_jack, where);
}
-framepos_t
-JACKAudioBackend::transport_frame () const
+samplepos_t
+JACKAudioBackend::transport_sample () const
{
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 0);
return jack_get_current_transport_frame (_priv_jack);
@@ -693,14 +693,14 @@ JACKAudioBackend::get_sync_offset (pframes_t& offset) const
return false;
}
-framepos_t
+samplepos_t
JACKAudioBackend::sample_time ()
{
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 0);
return jack_frame_time (_priv_jack);
}
-framepos_t
+samplepos_t
JACKAudioBackend::sample_time_at_cycle_start ()
{
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 0);
@@ -1164,7 +1164,7 @@ JACKAudioBackend::set_midi_option (const string& opt)
}
bool
-JACKAudioBackend::speed_and_position (double& speed, framepos_t& position)
+JACKAudioBackend::speed_and_position (double& speed, samplepos_t& position)
{
jack_position_t pos;
jack_transport_state_t state;
diff --git a/libs/backends/jack/jack_audiobackend.h b/libs/backends/jack/jack_audiobackend.h
index 2c67dc72fd..eb66f7ca3f 100644
--- a/libs/backends/jack/jack_audiobackend.h
+++ b/libs/backends/jack/jack_audiobackend.h
@@ -100,8 +100,8 @@ class JACKAudioBackend : public AudioBackend {
float dsp_load() const;
- framepos_t sample_time ();
- framepos_t sample_time_at_cycle_start ();
+ samplepos_t sample_time ();
+ samplepos_t sample_time_at_cycle_start ();
pframes_t samples_since_cycle_start ();
size_t raw_buffer_size (DataType t);
@@ -113,9 +113,9 @@ class JACKAudioBackend : public AudioBackend {
void transport_start ();
void transport_stop ();
- void transport_locate (framepos_t /*pos*/);
+ void transport_locate (samplepos_t /*pos*/);
TransportState transport_state () const;
- framepos_t transport_frame() const;
+ samplepos_t transport_sample() const;
int set_time_master (bool /*yn*/);
bool get_sync_offset (pframes_t& /*offset*/) const;
@@ -207,7 +207,7 @@ class JACKAudioBackend : public AudioBackend {
/* transport sync */
- bool speed_and_position (double& sp, framepos_t& pos);
+ bool speed_and_position (double& sp, samplepos_t& pos);
private:
boost::shared_ptr<JackConnection> _jack_connection;
diff --git a/libs/backends/jack/jack_session.cc b/libs/backends/jack/jack_session.cc
index ce325321f3..b7d37a673f 100644
--- a/libs/backends/jack/jack_session.cc
+++ b/libs/backends/jack/jack_session.cc
@@ -114,14 +114,14 @@ JACKSession::timebase_callback (jack_transport_state_t /*state*/,
{
Timecode::BBT_Time bbt;
TempoMap& tempo_map (_session->tempo_map());
- framepos_t tf = _session->transport_frame ();
+ samplepos_t tf = _session->transport_sample ();
/* BBT info */
TempoMetric metric (tempo_map.metric_at (tf));
try {
- bbt = tempo_map.bbt_at_frame (tf);
+ bbt = tempo_map.bbt_at_sample (tf);
pos->bar = bbt.bars;
pos->beat = bbt.beats;
@@ -142,7 +142,7 @@ JACKSession::timebase_callback (jack_transport_state_t /*state*/,
#ifdef HAVE_JACK_VIDEO_SUPPORT
//poke audio video ratio so Ardour can track Video Sync
- pos->audio_frames_per_video_frame = _session->frame_rate() / _session->timecode_frames_per_second();
+ pos->audio_samples_per_video_frame = _session->sample_rate() / _session->timecode_frames_per_second();
pos->valid = jack_position_bits_t (pos->valid | JackAudioVideoRatio);
#endif
diff --git a/libs/backends/jack/weak_libjack.h b/libs/backends/jack/weak_libjack.h
index 88365dee7e..6af3e9c351 100644
--- a/libs/backends/jack/weak_libjack.h
+++ b/libs/backends/jack/weak_libjack.h
@@ -52,9 +52,9 @@ int have_libjack(void);
#define jack_get_client_name WJACK_get_client_name
#define jack_get_sample_rate WJACK_get_sample_rate
#define jack_get_buffer_size WJACK_get_buffer_size
-#define jack_frames_since_cycle_start WJACK_frames_since_cycle_start
-#define jack_frame_time WJACK_frame_time
-#define jack_last_frame_time WJACK_last_frame_time
+#define jack_frames_since_cycle_start WJACK_samples_since_cycle_start
+#define jack_frame_time WJACK_sample_time
+#define jack_last_frame_time WJACK_last_sample_time
#define jack_get_time WJACK_get_time
#define jack_cpu_load WJACK_cpu_load
#define jack_is_realtime WJACK_is_realtime
@@ -115,7 +115,7 @@ int have_libjack(void);
#define jack_set_thread_init_callback WJACK_set_thread_init_callback
/* <jack/transport.h> */
-#define jack_get_current_transport_frame WJACK_get_current_transport_frame
+#define jack_get_current_transport_frame WJACK_get_current_transport_sample
#define jack_transport_locate WJACK_transport_locate
#define jack_transport_start WJACK_transport_start
#define jack_transport_stop WJACK_transport_stop
diff --git a/libs/backends/portaudio/audio_utils.h b/libs/backends/portaudio/audio_utils.h
index 5e7d0a1a2a..8b7ab9d529 100644
--- a/libs/backends/portaudio/audio_utils.h
+++ b/libs/backends/portaudio/audio_utils.h
@@ -25,12 +25,12 @@ inline
void
deinterleave_audio_data(const float* interleaved_input,
float* output,
- uint32_t frame_count,
+ uint32_t sample_count,
uint32_t channel,
uint32_t channel_count)
{
const float* ptr = interleaved_input + channel;
- while (frame_count-- > 0) {
+ while (sample_count-- > 0) {
*output++ = *ptr;
ptr += channel_count;
}
@@ -40,12 +40,12 @@ inline
void
interleave_audio_data(float* input,
float* interleaved_output,
- uint32_t frame_count,
+ uint32_t sample_count,
uint32_t channel,
uint32_t channel_count)
{
float* ptr = interleaved_output + channel;
- while (frame_count-- > 0) {
+ while (sample_count-- > 0) {
*ptr = *input++;
ptr += channel_count;
}
diff --git a/libs/backends/portaudio/cycle_timer.h b/libs/backends/portaudio/cycle_timer.h
index 6fe665568c..b81a1ed234 100644
--- a/libs/backends/portaudio/cycle_timer.h
+++ b/libs/backends/portaudio/cycle_timer.h
@@ -25,7 +25,7 @@
// Could call it FrameTimer and make it more generic
// Could be an interface and or include clock source
-// include sample count/processed frames in iteration?
+// include sample count/processed samples in iteration?
class CycleTimer {
public:
CycleTimer ()
diff --git a/libs/backends/portaudio/portaudio_backend.cc b/libs/backends/portaudio/portaudio_backend.cc
index 46e508fba7..be43e67a62 100644
--- a/libs/backends/portaudio/portaudio_backend.cc
+++ b/libs/backends/portaudio/portaudio_backend.cc
@@ -716,7 +716,7 @@ PortAudioBackend::_start (bool for_latency_measurement)
int
PortAudioBackend::portaudio_callback(const void* input,
void* output,
- unsigned long frame_count,
+ unsigned long sample_count,
const PaStreamCallbackTimeInfo* time_info,
PaStreamCallbackFlags status_flags,
void* user_data)
@@ -725,7 +725,7 @@ PortAudioBackend::portaudio_callback(const void* input,
if (!pa_backend->process_callback((const float*)input,
(float*)output,
- frame_count,
+ sample_count,
time_info,
status_flags)) {
return paAbort;
@@ -737,7 +737,7 @@ PortAudioBackend::portaudio_callback(const void* input,
bool
PortAudioBackend::process_callback(const float* input,
float* output,
- uint32_t frame_count,
+ uint32_t sample_count,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags)
{
@@ -767,7 +767,7 @@ PortAudioBackend::process_callback(const float* input,
}
if (!_run || _freewheel) {
- memset(output, 0, frame_count * sizeof(float) * _system_outputs.size());
+ memset(output, 0, sample_count * sizeof(float) * _system_outputs.size());
return true;
}
@@ -1004,13 +1004,13 @@ PortAudioBackend::raw_buffer_size (DataType t)
}
/* Process time */
-framepos_t
+samplepos_t
PortAudioBackend::sample_time ()
{
return _processed_samples;
}
-framepos_t
+samplepos_t
PortAudioBackend::sample_time_at_cycle_start ()
{
return _processed_samples;
diff --git a/libs/backends/portaudio/portaudio_backend.h b/libs/backends/portaudio/portaudio_backend.h
index 8a1624796b..336621f4ff 100644
--- a/libs/backends/portaudio/portaudio_backend.h
+++ b/libs/backends/portaudio/portaudio_backend.h
@@ -243,8 +243,8 @@ class PortAudioBackend : public AudioBackend {
size_t raw_buffer_size (DataType t);
/* Process time */
- framepos_t sample_time ();
- framepos_t sample_time_at_cycle_start ();
+ samplepos_t sample_time ();
+ samplepos_t sample_time_at_cycle_start ();
pframes_t samples_since_cycle_start ();
int create_process_thread (boost::function<void()> func);
@@ -342,7 +342,7 @@ class PortAudioBackend : public AudioBackend {
bool process_callback(const float* input,
float* output,
- uint32_t frame_count,
+ uint32_t sample_count,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags);
@@ -407,7 +407,7 @@ class PortAudioBackend : public AudioBackend {
/* processing */
float _dsp_load;
- framecnt_t _processed_samples;
+ samplecnt_t _processed_samples;
/* blocking thread */
pthread_t _main_blocking_thread;
diff --git a/libs/backends/portaudio/portaudio_io.cc b/libs/backends/portaudio/portaudio_io.cc
index 9ec8f6d6fb..140de6cf97 100644
--- a/libs/backends/portaudio/portaudio_io.cc
+++ b/libs/backends/portaudio/portaudio_io.cc
@@ -170,9 +170,9 @@ PortAudioIO::available_sample_rates(int device_id, std::vector<float>& sampleRat
#ifdef WITH_ASIO
bool
PortAudioIO::get_asio_buffer_properties (int device_id,
- long& min_size_frames,
- long& max_size_frames,
- long& preferred_size_frames,
+ long& min_size_samples,
+ long& max_size_samples,
+ long& preferred_size_samples,
long& granularity)
{
// we shouldn't really need all these checks but it shouldn't hurt
@@ -191,9 +191,9 @@ PortAudioIO::get_asio_buffer_properties (int device_id,
}
PaError err = PaAsio_GetAvailableBufferSizes (device_id,
- &min_size_frames,
- &max_size_frames,
- &preferred_size_frames,
+ &min_size_samples,
+ &max_size_samples,
+ &preferred_size_samples,
&granularity);
if (err != paNoError) {
@@ -216,15 +216,15 @@ PortAudioIO::get_asio_buffer_sizes(int device_id,
std::vector<uint32_t>& buffer_sizes,
bool preferred_only)
{
- long min_size_frames = 0;
- long max_size_frames = 0;
- long preferred_size_frames = 0;
+ long min_size_samples = 0;
+ long max_size_samples = 0;
+ long preferred_size_samples = 0;
long granularity = 0;
if (!get_asio_buffer_properties (device_id,
- min_size_frames,
- max_size_frames,
- preferred_size_frames,
+ min_size_samples,
+ max_size_samples,
+ preferred_size_samples,
granularity)) {
DEBUG_AUDIO (string_compose (
"Unable to get device buffer properties from device index %1\n", device_id));
@@ -232,58 +232,58 @@ PortAudioIO::get_asio_buffer_sizes(int device_id,
}
DEBUG_AUDIO (string_compose ("ASIO buffer properties for device %1, "
- "min_size_frames: %2, max_size_frames: %3, "
- "preferred_size_frames: %4, granularity: %5\n",
+ "min_size_samples: %2, max_size_samples: %3, "
+ "preferred_size_samples: %4, granularity: %5\n",
device_id,
- min_size_frames,
- max_size_frames,
- preferred_size_frames,
+ min_size_samples,
+ max_size_samples,
+ preferred_size_samples,
granularity));
- bool driver_returns_one_size = (min_size_frames == max_size_frames) &&
- (min_size_frames == preferred_size_frames);
+ bool driver_returns_one_size = (min_size_samples == max_size_samples) &&
+ (min_size_samples == preferred_size_samples);
if (preferred_only || driver_returns_one_size) {
- buffer_sizes.push_back(preferred_size_frames);
+ buffer_sizes.push_back(preferred_size_samples);
return true;
}
- long buffer_size = min_size_frames;
+ long buffer_size = min_size_samples;
// If min size and granularity are power of two then just use values that
// are power of 2 even if the granularity allows for more values
bool use_power_of_two =
- is_power_of_two(min_size_frames) && is_power_of_two(granularity);
+ is_power_of_two(min_size_samples) && is_power_of_two(granularity);
if (granularity <= 0 || use_power_of_two) {
// driver uses buffer sizes that are power of 2
- while (buffer_size <= max_size_frames) {
+ while (buffer_size <= max_size_samples) {
buffer_sizes.push_back(buffer_size);
buffer_size *= 2;
}
} else {
- if (min_size_frames == max_size_frames) {
+ if (min_size_samples == max_size_samples) {
// The devices I have tested either return the same values for
// min/max/preferred and changing buffer size is intended to only be
// done via the control dialog or they return a range where min != max
// but I guess min == max could happen if a driver only supports a single
// buffer size
- buffer_sizes.push_back(min_size_frames);
+ buffer_sizes.push_back(min_size_samples);
return true;
}
- // If min_size_frames is not power of 2 use at most 8 of the possible
+ // If min_size_samples is not power of 2 use at most 8 of the possible
// buffer sizes spread evenly between min and max
long max_values = 8;
- while (((max_size_frames - min_size_frames) / granularity) > max_values) {
+ while (((max_size_samples - min_size_samples) / granularity) > max_values) {
granularity *= 2;
}
- while (buffer_size < max_size_frames) {
+ while (buffer_size < max_size_samples) {
buffer_sizes.push_back(buffer_size);
buffer_size += granularity;
}
- buffer_sizes.push_back(max_size_frames);
+ buffer_sizes.push_back(max_size_samples);
}
return true;
}
diff --git a/libs/backends/portaudio/portaudio_io.h b/libs/backends/portaudio/portaudio_io.h
index c67fdc1b19..34eef43186 100644
--- a/libs/backends/portaudio/portaudio_io.h
+++ b/libs/backends/portaudio/portaudio_io.h
@@ -58,9 +58,9 @@ public:
#ifdef WITH_ASIO
bool get_asio_buffer_properties (int device_id,
- long& min_size_frames,
- long& max_size_frames,
- long& preferred_size_frames,
+ long& min_size_samples,
+ long& max_size_samples,
+ long& preferred_size_samples,
long& granularity);
bool get_asio_buffer_sizes(int device_id,
diff --git a/libs/canvas/framed_curve.cc b/libs/canvas/framed_curve.cc
index 66145f7183..2d22387fa4 100644
--- a/libs/canvas/framed_curve.cc
+++ b/libs/canvas/framed_curve.cc
@@ -255,7 +255,7 @@ FramedCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) c
break;
case Inside:
context->stroke_preserve ();
- /* close the frame, possibly using the last _point's x rather than samples[right].x */
+ /* close the sample, possibly using the last _point's x rather than samples[right].x */
window_space = item_to_window (Duple (last_sample.x, draw.height()));
context->line_to (window_space.x, window_space.y);
window_space = item_to_window (Duple (first_sample.x, draw.height()));
diff --git a/libs/clearlooks-newer/clearlooks_draw.c b/libs/clearlooks-newer/clearlooks_draw.c
index 502d2e7786..d96587241b 100644
--- a/libs/clearlooks-newer/clearlooks_draw.c
+++ b/libs/clearlooks-newer/clearlooks_draw.c
@@ -1042,61 +1042,61 @@ clearlooks_draw_menubar (cairo_t *cr,
}
static void
-clearlooks_get_frame_gap_clip (int x, int y, int width, int height,
- const FrameParameters *frame,
+clearlooks_get_sample_gap_clip (int x, int y, int width, int height,
+ const FrameParameters *sample,
ClearlooksRectangle *bevel,
ClearlooksRectangle *border)
{
(void) x;
(void) y;
- if (frame->gap_side == CL_GAP_TOP)
+ if (sample->gap_side == CL_GAP_TOP)
{
- CLEARLOOKS_RECTANGLE_SET ((*bevel), 1.5 + frame->gap_x, -0.5,
- frame->gap_width - 3, 2.0);
- CLEARLOOKS_RECTANGLE_SET ((*border), 0.5 + frame->gap_x, -0.5,
- frame->gap_width - 2, 2.0);
+ CLEARLOOKS_RECTANGLE_SET ((*bevel), 1.5 + sample->gap_x, -0.5,
+ sample->gap_width - 3, 2.0);
+ CLEARLOOKS_RECTANGLE_SET ((*border), 0.5 + sample->gap_x, -0.5,
+ sample->gap_width - 2, 2.0);
}
- else if (frame->gap_side == CL_GAP_BOTTOM)
+ else if (sample->gap_side == CL_GAP_BOTTOM)
{
- CLEARLOOKS_RECTANGLE_SET ((*bevel), 1.5 + frame->gap_x, height - 2.5,
- frame->gap_width - 3, 2.0);
- CLEARLOOKS_RECTANGLE_SET ((*border), 0.5 + frame->gap_x, height - 1.5,
- frame->gap_width - 2, 2.0);
+ CLEARLOOKS_RECTANGLE_SET ((*bevel), 1.5 + sample->gap_x, height - 2.5,
+ sample->gap_width - 3, 2.0);
+ CLEARLOOKS_RECTANGLE_SET ((*border), 0.5 + sample->gap_x, height - 1.5,
+ sample->gap_width - 2, 2.0);
}
- else if (frame->gap_side == CL_GAP_LEFT)
+ else if (sample->gap_side == CL_GAP_LEFT)
{
- CLEARLOOKS_RECTANGLE_SET ((*bevel), -0.5, 1.5 + frame->gap_x,
- 2.0, frame->gap_width - 3);
- CLEARLOOKS_RECTANGLE_SET ((*border), -0.5, 0.5 + frame->gap_x,
- 1.0, frame->gap_width - 2);
+ CLEARLOOKS_RECTANGLE_SET ((*bevel), -0.5, 1.5 + sample->gap_x,
+ 2.0, sample->gap_width - 3);
+ CLEARLOOKS_RECTANGLE_SET ((*border), -0.5, 0.5 + sample->gap_x,
+ 1.0, sample->gap_width - 2);
}
- else if (frame->gap_side == CL_GAP_RIGHT)
+ else if (sample->gap_side == CL_GAP_RIGHT)
{
- CLEARLOOKS_RECTANGLE_SET ((*bevel), width - 2.5, 1.5 + frame->gap_x,
- 2.0, frame->gap_width - 3);
- CLEARLOOKS_RECTANGLE_SET ((*border), width - 1.5, 0.5 + frame->gap_x,
- 1.0, frame->gap_width - 2);
+ CLEARLOOKS_RECTANGLE_SET ((*bevel), width - 2.5, 1.5 + sample->gap_x,
+ 2.0, sample->gap_width - 3);
+ CLEARLOOKS_RECTANGLE_SET ((*border), width - 1.5, 0.5 + sample->gap_x,
+ 1.0, sample->gap_width - 2);
}
}
static void
-clearlooks_draw_frame (cairo_t *cr,
+clearlooks_draw_sample (cairo_t *cr,
const ClearlooksColors *colors,
const WidgetParameters *params,
- const FrameParameters *frame,
+ const FrameParameters *sample,
int x, int y, int width, int height)
{
- const CairoColor *border = frame->border;
+ const CairoColor *border = sample->border;
const CairoColor *dark = (const CairoColor*)&colors->shade[4];
ClearlooksRectangle bevel_clip = {0, 0, 0, 0};
- ClearlooksRectangle frame_clip = {0, 0, 0, 0};
+ ClearlooksRectangle sample_clip = {0, 0, 0, 0};
double radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
CairoColor hilight;
ge_shade_color (&colors->bg[GTK_STATE_NORMAL], 1.05, &hilight);
- if (frame->shadow == CL_SHADOW_NONE) {
+ if (sample->shadow == CL_SHADOW_NONE) {
const CairoColor *bg = &colors->bg[params->state_type];
ge_cairo_set_color (cr, bg);
cairo_rectangle (cr, x + 1.5, y + 1.5, width - 3, height - 3);
@@ -1105,9 +1105,9 @@ clearlooks_draw_frame (cairo_t *cr,
return;
}
- if (frame->gap_x != -1)
- clearlooks_get_frame_gap_clip (x, y, width, height,
- frame, &bevel_clip, &frame_clip);
+ if (sample->gap_x != -1)
+ clearlooks_get_sample_gap_clip (x, y, width, height,
+ sample, &bevel_clip, &sample_clip);
cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y+0.5);
@@ -1115,7 +1115,7 @@ clearlooks_draw_frame (cairo_t *cr,
/* save everything */
cairo_save (cr);
/* Set clip for the bevel */
- if (frame->gap_x != -1)
+ if (sample->gap_x != -1)
{
/* Set clip for gap */
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
@@ -1125,40 +1125,40 @@ clearlooks_draw_frame (cairo_t *cr,
}
/* Draw the bevel */
- if (frame->shadow == CL_SHADOW_ETCHED_IN || frame->shadow == CL_SHADOW_ETCHED_OUT)
+ if (sample->shadow == CL_SHADOW_ETCHED_IN || sample->shadow == CL_SHADOW_ETCHED_OUT)
{
ge_cairo_set_color (cr, &hilight);
- if (frame->shadow == CL_SHADOW_ETCHED_IN)
+ if (sample->shadow == CL_SHADOW_ETCHED_IN)
ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, params->corners);
else
ge_cairo_rounded_rectangle (cr, 0, 0, width-2, height-2, radius, params->corners);
cairo_stroke (cr);
}
- else if (frame->shadow != CL_SHADOW_NONE)
+ else if (sample->shadow != CL_SHADOW_NONE)
{
ShadowParameters shadow;
shadow.corners = params->corners;
- shadow.shadow = frame->shadow;
+ shadow.shadow = sample->shadow;
clearlooks_draw_highlight_and_shade (cr, colors, &shadow, width, height, 0);
}
/* restore the previous clip region */
cairo_restore (cr);
cairo_save (cr);
- if (frame->gap_x != -1)
+ if (sample->gap_x != -1)
{
/* Set clip for gap */
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_rectangle (cr, -0.5, -0.5, width, height);
- cairo_rectangle (cr, frame_clip.x, frame_clip.y, frame_clip.width, frame_clip.height);
+ cairo_rectangle (cr, sample_clip.x, sample_clip.y, sample_clip.width, sample_clip.height);
cairo_clip (cr);
}
- /* Draw frame */
- if (frame->shadow == CL_SHADOW_ETCHED_IN || frame->shadow == CL_SHADOW_ETCHED_OUT)
+ /* Draw sample */
+ if (sample->shadow == CL_SHADOW_ETCHED_IN || sample->shadow == CL_SHADOW_ETCHED_OUT)
{
ge_cairo_set_color (cr, dark);
- if (frame->shadow == CL_SHADOW_ETCHED_IN)
+ if (sample->shadow == CL_SHADOW_ETCHED_IN)
ge_cairo_rounded_rectangle (cr, 0, 0, width-2, height-2, radius, params->corners);
else
ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, params->corners);
@@ -1839,7 +1839,7 @@ clearlooks_draw_statusbar (cairo_t *cr,
}
static void
-clearlooks_draw_menu_frame (cairo_t *cr,
+clearlooks_draw_menu_sample (cairo_t *cr,
const ClearlooksColors *colors,
const WidgetParameters *widget,
int x, int y, int width, int height)
@@ -2283,7 +2283,7 @@ clearlooks_register_style_classic (ClearlooksStyleFunctions *functions)
functions->draw_inset = clearlooks_draw_inset;
functions->draw_menubar = clearlooks_draw_menubar;
functions->draw_tab = clearlooks_draw_tab;
- functions->draw_frame = clearlooks_draw_frame;
+ functions->draw_sample = clearlooks_draw_sample;
functions->draw_separator = clearlooks_draw_separator;
functions->draw_menu_item_separator = clearlooks_draw_menu_item_separator;
functions->draw_list_view_header = clearlooks_draw_list_view_header;
@@ -2295,7 +2295,7 @@ clearlooks_register_style_classic (ClearlooksStyleFunctions *functions)
functions->draw_scrollbar_slider = clearlooks_draw_scrollbar_slider;
functions->draw_scrollbar_trough = clearlooks_draw_scrollbar_trough;
functions->draw_statusbar = clearlooks_draw_statusbar;
- functions->draw_menu_frame = clearlooks_draw_menu_frame;
+ functions->draw_menu_sample = clearlooks_draw_menu_sample;
functions->draw_tooltip = clearlooks_draw_tooltip;
functions->draw_handle = clearlooks_draw_handle;
functions->draw_resize_grip = clearlooks_draw_resize_grip;
diff --git a/libs/clearlooks-newer/clearlooks_style.c b/libs/clearlooks-newer/clearlooks_style.c
index fb0ca33239..c5e588b74f 100644
--- a/libs/clearlooks-newer/clearlooks_style.c
+++ b/libs/clearlooks-newer/clearlooks_style.c
@@ -200,16 +200,16 @@ clearlooks_style_draw_shadow (DRAW_ARGS)
else if (DETAIL ("frame"))
{
WidgetParameters params;
- FrameParameters frame;
- frame.shadow = shadow_type;
- frame.gap_x = -1; /* No gap will be drawn */
- frame.border = &colors->shade[4];
+ FrameParameters sample;
+ sample.shadow = shadow_type;
+ sample.gap_x = -1; /* No gap will be drawn */
+ sample.border = &colors->shade[4];
clearlooks_set_widget_parameters (widget, style, state_type, &params);
params.corners = CR_CORNER_NONE;
if (widget && !g_str_equal ("XfcePanelWindow", gtk_widget_get_name (gtk_widget_get_toplevel (widget))))
- STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
+ STYLE_FUNCTION(draw_sample) (cr, colors, &params, &sample,
x, y, width, height);
}
else if (DETAIL ("scrolled_window") || DETAIL ("viewport") || detail == NULL)
@@ -223,15 +223,15 @@ clearlooks_style_draw_shadow (DRAW_ARGS)
else
{
WidgetParameters params;
- FrameParameters frame;
+ FrameParameters sample;
- frame.shadow = shadow_type;
- frame.gap_x = -1;
- frame.border = &colors->shade[5];
+ sample.shadow = shadow_type;
+ sample.gap_x = -1;
+ sample.border = &colors->shade[5];
clearlooks_set_widget_parameters (widget, style, state_type, &params);
params.corners = CR_CORNER_ALL;
- STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame, x, y, width, height);
+ STYLE_FUNCTION(draw_sample) (cr, colors, &params, &sample, x, y, width, height);
}
cairo_destroy (cr);
@@ -255,14 +255,14 @@ clearlooks_style_draw_box_gap (DRAW_ARGS,
if (DETAIL ("notebook"))
{
WidgetParameters params;
- FrameParameters frame;
+ FrameParameters sample;
gboolean start, end;
- frame.shadow = shadow_type;
- frame.gap_side = gap_side;
- frame.gap_x = gap_x;
- frame.gap_width = gap_width;
- frame.border = &colors->shade[5];
+ sample.shadow = shadow_type;
+ sample.gap_side = gap_side;
+ sample.gap_x = gap_x;
+ sample.gap_width = gap_width;
+ sample.border = &colors->shade[5];
clearlooks_set_widget_parameters (widget, style, state_type, &params);
@@ -315,7 +315,7 @@ clearlooks_style_draw_box_gap (DRAW_ARGS,
ge_cairo_set_color (cr, &colors->bg[GTK_STATE_NORMAL]);
cairo_fill (cr);
- STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
+ STYLE_FUNCTION(draw_sample) (cr, colors, &params, &sample,
x, y, width, height);
}
else
@@ -853,7 +853,7 @@ clearlooks_style_draw_box (DRAW_ARGS)
clearlooks_set_widget_parameters (widget, style, state_type, &params);
- STYLE_FUNCTION(draw_menu_frame) (cr, colors, &params, x, y, width, height);
+ STYLE_FUNCTION(draw_menu_sample) (cr, colors, &params, x, y, width, height);
}
else if (DETAIL ("hseparator") || DETAIL ("vseparator"))
{
@@ -1101,19 +1101,19 @@ clearlooks_style_draw_shadow_gap (DRAW_ARGS,
if (DETAIL ("frame"))
{
WidgetParameters params;
- FrameParameters frame;
+ FrameParameters sample;
- frame.shadow = shadow_type;
- frame.gap_side = gap_side;
- frame.gap_x = gap_x;
- frame.gap_width = gap_width;
- frame.border = &colors->shade[5];
+ sample.shadow = shadow_type;
+ sample.gap_side = gap_side;
+ sample.gap_x = gap_x;
+ sample.gap_width = gap_width;
+ sample.border = &colors->shade[5];
clearlooks_set_widget_parameters (widget, style, state_type, &params);
params.corners = CR_CORNER_ALL;
- STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
+ STYLE_FUNCTION(draw_sample) (cr, colors, &params, &sample,
x, y, width, height);
}
else
diff --git a/libs/clearlooks-newer/clearlooks_types.h b/libs/clearlooks-newer/clearlooks_types.h
index 893113cc9e..ccb9bb97ac 100644
--- a/libs/clearlooks-newer/clearlooks_types.h
+++ b/libs/clearlooks-newer/clearlooks_types.h
@@ -319,10 +319,10 @@ struct _ClearlooksStyleFunctions
const TabParameters *tab,
int x, int y, int width, int height);
- void (*draw_frame) (cairo_t *cr,
+ void (*draw_sample) (cairo_t *cr,
const ClearlooksColors *colors,
const WidgetParameters *widget,
- const FrameParameters *frame,
+ const FrameParameters *sample,
int x, int y, int width, int height);
void (*draw_separator) (cairo_t *cr,
@@ -388,7 +388,7 @@ struct _ClearlooksStyleFunctions
const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_menu_frame) (cairo_t *cr,
+ void (*draw_menu_sample) (cairo_t *cr,
const ClearlooksColors *colors,
const WidgetParameters *widget,
int x, int y, int width, int height);
diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc
index f29673722d..551fbfd9a3 100644
--- a/libs/midi++2/channel.cc
+++ b/libs/midi++2/channel.cc
@@ -53,7 +53,7 @@ Channel::connect_signals ()
}
void
-Channel::reset (timestamp_t timestamp, framecnt_t /*nframes*/, bool notes_off)
+Channel::reset (timestamp_t timestamp, samplecnt_t /*nframes*/, bool notes_off)
{
_program_number = _channel_number;
_bank_number = 0;
diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc
index fd5cb9a239..26bc0a324e 100644
--- a/libs/midi++2/ipmidi_port.cc
+++ b/libs/midi++2/ipmidi_port.cc
@@ -319,7 +319,7 @@ IPMIDIPort::read (MIDI::byte* /*buf*/, size_t /*bufsize*/)
}
void
-IPMIDIPort::parse (framecnt_t timestamp)
+IPMIDIPort::parse (samplecnt_t timestamp)
{
/* input was detected on the socket, so go get it and hand it to the
* parser. This will emit appropriate signals that will be handled
diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h
index 6bd08073b3..ba95958d26 100644
--- a/libs/midi++2/midi++/channel.h
+++ b/libs/midi++2/midi++/channel.h
@@ -165,7 +165,7 @@ class LIBMIDIPP_API Channel : public PBD::ScopedConnectionList {
RPNList rpns;
RPNList nrpns;
- void reset (timestamp_t timestamp, framecnt_t nframes, bool notes_off = true);
+ void reset (timestamp_t timestamp, samplecnt_t nframes, bool notes_off = true);
void process_note_off (Parser &, EventTwoBytes *);
void process_note_on (Parser &, EventTwoBytes *);
diff --git a/libs/midi++2/midi++/ipmidi_port.h b/libs/midi++2/midi++/ipmidi_port.h
index 8cefe09a40..d5a740f5a4 100644
--- a/libs/midi++2/midi++/ipmidi_port.h
+++ b/libs/midi++2/midi++/ipmidi_port.h
@@ -66,7 +66,7 @@ class LIBMIDIPP_API IPMIDIPort : public Port {
int write (const byte *msg, size_t msglen, timestamp_t timestamp);
int read (byte *buf, size_t bufsize);
- void parse (framecnt_t timestamp);
+ void parse (samplecnt_t timestamp);
int selectable () const;
static const int lowest_ipmidi_port_default = 21928;
diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h
index caf1605c29..bd8c19b6f9 100644
--- a/libs/midi++2/midi++/mmc.h
+++ b/libs/midi++2/midi++/mmc.h
@@ -178,7 +178,7 @@ class LIBMIDIPP_API MachineControl
/* The second argument points to a byte array containing
the locate target value in MMC Standard Time Code
- format (5 bytes, roughly: hrs/mins/secs/frames/subframes)
+ format (5 bytes, roughly: hrs/mins/secs/samples/subframes)
*/
PBD::Signal2<void,MachineControl &, const byte *> Locate;
diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h
index 7040e9b522..3b1dd47052 100644
--- a/libs/midi++2/midi++/parser.h
+++ b/libs/midi++2/midi++/parser.h
@@ -35,7 +35,7 @@ class Parser;
typedef PBD::Signal1<void,Parser&> ZeroByteSignal;
typedef PBD::Signal2<void,Parser&,unsigned short> BankSignal;
-typedef PBD::Signal2<void,Parser&,framecnt_t> TimestampedSignal;
+typedef PBD::Signal2<void,Parser&,samplecnt_t> TimestampedSignal;
typedef PBD::Signal2<void,Parser&, byte> OneByteSignal;
typedef PBD::Signal2<void,Parser &, EventTwoBytes *> TwoByteSignal;
typedef PBD::Signal2<void,Parser &, pitchbend_t> PitchBendSignal;
@@ -53,8 +53,8 @@ class LIBMIDIPP_API Parser {
therefore be set before every byte passed into ::scanner().
*/
- framecnt_t get_timestamp() const { return _timestamp; }
- void set_timestamp (const framecnt_t timestamp) { _timestamp = timestamp; }
+ samplecnt_t get_timestamp() const { return _timestamp; }
+ void set_timestamp (const samplecnt_t timestamp) { _timestamp = timestamp; }
/* signals that anyone can connect to */
@@ -131,8 +131,8 @@ class LIBMIDIPP_API Parser {
const byte *mtc_current() const { return _mtc_time; }
bool mtc_locked() const { return _mtc_locked; }
- PBD::Signal3<void, Parser &, int, framecnt_t> mtc_qtr;
- PBD::Signal3<void, const byte *, bool, framecnt_t> mtc_time;
+ PBD::Signal3<void, Parser &, int, samplecnt_t> mtc_qtr;
+ PBD::Signal3<void, const byte *, bool, samplecnt_t> mtc_time;
PBD::Signal1<void, MTC_Status> mtc_status;
PBD::Signal0<bool> mtc_skipped;
@@ -172,13 +172,13 @@ class LIBMIDIPP_API Parser {
int expected_mtc_quarter_frame_code;
byte _mtc_time[5];
byte _qtr_mtc_time[5];
- unsigned long consecutive_qtr_frame_cnt;
+ unsigned long consecutive_qtr_sample_cnt;
MTC_FPS _mtc_fps;
MTC_Status _mtc_running;
bool _mtc_locked;
- byte last_qtr_frame;
+ byte last_qtr_sample;
- framecnt_t _timestamp;
+ samplecnt_t _timestamp;
ParseState pre_variable_state;
MIDI::eventType pre_variable_msgtype;
diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h
index 02cc340194..049d3a0a92 100644
--- a/libs/midi++2/midi++/port.h
+++ b/libs/midi++2/midi++/port.h
@@ -57,7 +57,7 @@ class LIBMIDIPP_API Port {
/** Write a message to port.
* @param msg Raw MIDI message to send
* @param msglen Size of @a msg
- * @param timestamp Time stamp in frames of this message (relative to cycle start)
+ * @param timestamp Time stamp in samples of this message (relative to cycle start)
* @return number of bytes successfully written
*/
virtual int write (const byte *msg, size_t msglen, timestamp_t timestamp) = 0;
@@ -85,7 +85,7 @@ class LIBMIDIPP_API Port {
return !(write (msg, len, timestamp) == (int) len);
}
- virtual void parse (framecnt_t timestamp) = 0;
+ virtual void parse (samplecnt_t timestamp) = 0;
bool clock (timestamp_t timestamp);
diff --git a/libs/midi++2/midi++/types.h b/libs/midi++2/midi++/types.h
index c29ce1c767..8bcf36946f 100644
--- a/libs/midi++2/midi++/types.h
+++ b/libs/midi++2/midi++/types.h
@@ -33,7 +33,7 @@ namespace MIDI {
typedef uint32_t timestamp_t;
/** XXX: dupes from libardour */
- typedef int64_t framecnt_t;
+ typedef int64_t samplecnt_t;
typedef uint32_t pframes_t;
enum eventType {
diff --git a/libs/midi++2/mtc.cc b/libs/midi++2/mtc.cc
index 7f7506c344..8aa7556e46 100644
--- a/libs/midi++2/mtc.cc
+++ b/libs/midi++2/mtc.cc
@@ -46,7 +46,7 @@ Parser::possible_mtc (MIDI::byte *sysex_buf, size_t msglen)
/* full MTC */
- fake_mtc_time[0] = sysex_buf[8]; // frames
+ fake_mtc_time[0] = sysex_buf[8]; // samples
fake_mtc_time[1] = sysex_buf[7]; // minutes
fake_mtc_time[2] = sysex_buf[6]; // seconds
fake_mtc_time[3] = (sysex_buf[5] & 0x1f); // hours
@@ -86,8 +86,8 @@ Parser::reset_mtc_state ()
expected_mtc_quarter_frame_code = 0;
memset (_mtc_time, 0, sizeof (_mtc_time));
memset (_qtr_mtc_time, 0, sizeof (_mtc_time));
- consecutive_qtr_frame_cnt = 0;
- last_qtr_frame = 0;
+ consecutive_qtr_sample_cnt = 0;
+ last_qtr_sample = 0;
}
void
@@ -95,46 +95,46 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
{
int which_quarter_frame = (msg[1] & 0xf0) >> 4;
- /* Is it an expected frame?
- Remember, the first can be frame 7 or frame 0,
+ /* Is it an expected sample?
+ Remember, the first can be sample 7 or sample 0,
depending on the direction of the MTC generator ...
*/
#ifdef DEBUG_MTC
cerr << "MTC: (state = " << _mtc_running << ") "
<< which_quarter_frame << " vs. " << expected_mtc_quarter_frame_code
- << " consecutive ? " << consecutive_qtr_frame_cnt
+ << " consecutive ? " << consecutive_qtr_sample_cnt
<< endl;
#endif
if (_mtc_running == MTC_Stopped) {
- /* we are stopped but are seeing qtr frame messages */
+ /* we are stopped but are seeing qtr sample messages */
- if (consecutive_qtr_frame_cnt == 0) {
+ if (consecutive_qtr_sample_cnt == 0) {
/* first quarter frame */
if (which_quarter_frame != 0 && which_quarter_frame != 7) {
- last_qtr_frame = which_quarter_frame;
- consecutive_qtr_frame_cnt++;
+ last_qtr_sample = which_quarter_frame;
+ consecutive_qtr_sample_cnt++;
}
- // cerr << "first seen qframe = " << (int) last_qtr_frame << endl;
+ // cerr << "first seen qframe = " << (int) last_qtr_sample << endl;
return;
- } else if (consecutive_qtr_frame_cnt == 1) {
+ } else if (consecutive_qtr_sample_cnt == 1) {
/* third quarter frame */
#ifdef DEBUG_MTC
cerr << "second seen qframe = " << (int) which_quarter_frame << endl;
#endif
- if (last_qtr_frame < which_quarter_frame) {
+ if (last_qtr_sample < which_quarter_frame) {
_mtc_running = MTC_Forward;
- } else if (last_qtr_frame > which_quarter_frame) {
+ } else if (last_qtr_sample > which_quarter_frame) {
_mtc_running = MTC_Backward;
}
#ifdef DEBUG_MTC
@@ -174,7 +174,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
if (which_quarter_frame != expected_mtc_quarter_frame_code) {
- consecutive_qtr_frame_cnt = 0;
+ consecutive_qtr_sample_cnt = 0;
#ifdef DEBUG_MTC
cerr << "MTC: (state = " << _mtc_running << ") "
@@ -189,7 +189,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
if (res.get_value_or (false)) {
- /* no error, reset next expected frame */
+ /* no error, reset next expected sample */
switch (_mtc_running) {
case MTC_Forward:
@@ -219,10 +219,10 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
return;
}
- /* skip counts as an error ... go back to waiting for the first frame */
+ /* skip counts as an error ... go back to waiting for the first sample */
#ifdef DEBUG_MTC
- cerr << "Skipped MTC qtr frame, return to stopped state" << endl;
+ cerr << "Skipped MTC qtr sample, return to stopped state" << endl;
#endif
reset_mtc_state ();
mtc_status (MTC_Stopped);
@@ -231,8 +231,8 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
} else {
- /* received qtr frame matched expected */
- consecutive_qtr_frame_cnt++;
+ /* received qtr sample matched expected */
+ consecutive_qtr_sample_cnt++;
}
}
@@ -244,11 +244,11 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
#endif
switch (which_quarter_frame) {
- case 0: // frames LS nibble
+ case 0: // samples LS nibble
_qtr_mtc_time[0] |= msg[1] & 0xf;
break;
- case 1: // frames MS nibble
+ case 1: // samples MS nibble
_qtr_mtc_time[0] |= (msg[1] & 0xf)<<4;
break;
@@ -307,7 +307,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
and signal anyone who wants to know the time.
*/
- if (consecutive_qtr_frame_cnt >= 8) {
+ if (consecutive_qtr_sample_cnt >= 8) {
memcpy (_mtc_time, _qtr_mtc_time, sizeof (_mtc_time));
memset (_qtr_mtc_time, 0, sizeof (_qtr_mtc_time));
if (!_mtc_locked) {
@@ -331,7 +331,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
and signal anyone who wants to know the time.
*/
- if (consecutive_qtr_frame_cnt >= 8) {
+ if (consecutive_qtr_sample_cnt >= 8) {
memcpy (_mtc_time, _qtr_mtc_time, sizeof (_mtc_time));
memset (_qtr_mtc_time, 0, sizeof (_qtr_mtc_time));
if (!_mtc_locked) {
diff --git a/libs/panners/1in2out/panner_1in2out.cc b/libs/panners/1in2out/panner_1in2out.cc
index 753c3a2dae..b279914f94 100644
--- a/libs/panners/1in2out/panner_1in2out.cc
+++ b/libs/panners/1in2out/panner_1in2out.cc
@@ -155,7 +155,7 @@ Panner1in2out::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gai
if (fabsf ((delta = (left - desired_left))) > 0.002) { // about 1 degree of arc
/* we've moving the pan by an appreciable amount, so we must
- interpolate over 64 frames or nframes, whichever is smaller */
+ interpolate over 64 samples or nframes, whichever is smaller */
pframes_t const limit = min ((pframes_t) 64, nframes);
pframes_t n;
@@ -210,7 +210,7 @@ Panner1in2out::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gai
if (fabsf ((delta = (right - desired_right))) > 0.002) { // about 1 degree of arc
/* we're moving the pan by an appreciable amount, so we must
- interpolate over 64 frames or nframes, whichever is smaller */
+ interpolate over 64 samples or nframes, whichever is smaller */
pframes_t const limit = min ((pframes_t) 64, nframes);
pframes_t n;
@@ -261,7 +261,7 @@ Panner1in2out::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gai
void
Panner1in2out::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers, uint32_t which)
{
assert (obufs.count().n_audio() == 2);
diff --git a/libs/panners/1in2out/panner_1in2out.h b/libs/panners/1in2out/panner_1in2out.h
index 67543fd898..0818bdc918 100644
--- a/libs/panners/1in2out/panner_1in2out.h
+++ b/libs/panners/1in2out/panner_1in2out.h
@@ -72,7 +72,7 @@ class Panner1in2out : public Panner
void distribute_one (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which);
void distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers, uint32_t which);
void update ();
diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc
index 2b14f6458c..e9d9ced0ca 100644
--- a/libs/panners/2in2out/panner_2in2out.cc
+++ b/libs/panners/2in2out/panner_2in2out.cc
@@ -280,7 +280,7 @@ Panner2in2out::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gai
if (fabsf ((delta = (left[which] - desired_left[which]))) > 0.002) { // about 1 degree of arc
/* we've moving the pan by an appreciable amount, so we must
- interpolate over 64 frames or nframes, whichever is smaller */
+ interpolate over 64 samples or nframes, whichever is smaller */
pframes_t const limit = min ((pframes_t) 64, nframes);
pframes_t n;
@@ -336,7 +336,7 @@ Panner2in2out::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gai
if (fabsf ((delta = (right[which] - desired_right[which]))) > 0.002) { // about 1 degree of arc
/* we're moving the pan by an appreciable amount, so we must
- interpolate over 64 frames or nframes, whichever is smaller */
+ interpolate over 64 samples or nframes, whichever is smaller */
pframes_t const limit = min ((pframes_t) 64, nframes);
pframes_t n;
@@ -387,7 +387,7 @@ Panner2in2out::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gai
void
Panner2in2out::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers, uint32_t which)
{
assert (obufs.count().n_audio() == 2);
diff --git a/libs/panners/2in2out/panner_2in2out.h b/libs/panners/2in2out/panner_2in2out.h
index f67ac1081b..bb320cd619 100644
--- a/libs/panners/2in2out/panner_2in2out.h
+++ b/libs/panners/2in2out/panner_2in2out.h
@@ -85,7 +85,7 @@ class Panner2in2out : public Panner
void distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which);
void distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers, uint32_t which);
};
diff --git a/libs/panners/stereobalance/panner_balance.cc b/libs/panners/stereobalance/panner_balance.cc
index f7379f9d6d..ca668f2d1d 100644
--- a/libs/panners/stereobalance/panner_balance.cc
+++ b/libs/panners/stereobalance/panner_balance.cc
@@ -165,7 +165,7 @@ Pannerbalance::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gai
if (fabsf ((delta = (pos[which] - desired_pos[which]))) > 0.002) { // about 1 degree of arc
/* we've moving the pan by an appreciable amount, so we must
- interpolate over 64 frames or nframes, whichever is smaller */
+ interpolate over 64 samples or nframes, whichever is smaller */
pframes_t const limit = min ((pframes_t) 64, nframes);
pframes_t n;
@@ -213,7 +213,7 @@ Pannerbalance::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gai
void
Pannerbalance::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers, uint32_t which)
{
assert (obufs.count().n_audio() == 2);
diff --git a/libs/panners/stereobalance/panner_balance.h b/libs/panners/stereobalance/panner_balance.h
index dabb1da8a5..944a5fb48f 100644
--- a/libs/panners/stereobalance/panner_balance.h
+++ b/libs/panners/stereobalance/panner_balance.h
@@ -74,7 +74,7 @@ class Pannerbalance : public Panner
private:
void distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which);
void distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers, uint32_t which);
};
diff --git a/libs/panners/vbap/vbap.cc b/libs/panners/vbap/vbap.cc
index aba9641cb5..ec8d91591e 100644
--- a/libs/panners/vbap/vbap.cc
+++ b/libs/panners/vbap/vbap.cc
@@ -356,7 +356,7 @@ VBAPanner::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co
void
VBAPanner::distribute_one_automated (AudioBuffer& /*src*/, BufferSet& /*obufs*/,
- framepos_t /*start*/, framepos_t /*end*/,
+ samplepos_t /*start*/, samplepos_t /*end*/,
pframes_t /*nframes*/, pan_t** /*buffers*/, uint32_t /*which*/)
{
/* XXX to be implemented */
diff --git a/libs/panners/vbap/vbap.h b/libs/panners/vbap/vbap.h
index 993bbda9d2..96a872bc21 100644
--- a/libs/panners/vbap/vbap.h
+++ b/libs/panners/vbap/vbap.h
@@ -88,7 +88,7 @@ private:
void distribute_one (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which);
void distribute_one_automated (AudioBuffer& src, BufferSet& obufs,
- framepos_t start, framepos_t end, pframes_t nframes,
+ samplepos_t start, samplepos_t end, pframes_t nframes,
pan_t** buffers, uint32_t which);
};
diff --git a/libs/pbd/convert.cc b/libs/pbd/convert.cc
index c9af727504..3fdb8af71d 100644
--- a/libs/pbd/convert.cc
+++ b/libs/pbd/convert.cc
@@ -222,17 +222,17 @@ url_decode (string const & url)
#if 0
string
-length2string (const int32_t frames, const float sample_rate)
+length2string (const int32_t samples, const float sample_rate)
{
- int32_t secs = (int32_t) (frames / sample_rate);
+ int32_t secs = (int32_t) (samples / sample_rate);
int32_t hrs = secs / 3600;
secs -= (hrs * 3600);
int32_t mins = secs / 60;
secs -= (mins * 60);
int32_t total_secs = (hrs * 3600) + (mins * 60) + secs;
- int32_t frames_remaining = (int) floor (frames - (total_secs * sample_rate));
- float fractional_secs = (float) frames_remaining / sample_rate;
+ int32_t samples_remaining = (int) floor (samples - (total_secs * sample_rate));
+ float fractional_secs = (float) samples_remaining / sample_rate;
char duration_str[32];
sprintf (duration_str, "%02" PRIi32 ":%02" PRIi32 ":%05.2f", hrs, mins, (float) secs + fractional_secs);
@@ -242,17 +242,17 @@ length2string (const int32_t frames, const float sample_rate)
#endif
string
-length2string (const int64_t frames, const double sample_rate)
+length2string (const int64_t samples, const double sample_rate)
{
- int64_t secs = (int64_t) floor (frames / sample_rate);
+ int64_t secs = (int64_t) floor (samples / sample_rate);
int64_t hrs = secs / 3600LL;
secs -= (hrs * 3600LL);
int64_t mins = secs / 60LL;
secs -= (mins * 60LL);
int64_t total_secs = (hrs * 3600LL) + (mins * 60LL) + secs;
- int64_t frames_remaining = (int64_t) floor (frames - (total_secs * sample_rate));
- float fractional_secs = (float) frames_remaining / sample_rate;
+ int64_t samples_remaining = (int64_t) floor (samples - (total_secs * sample_rate));
+ float fractional_secs = (float) samples_remaining / sample_rate;
char duration_str[64];
sprintf (duration_str, "%02" PRIi64 ":%02" PRIi64 ":%05.2f", hrs, mins, (float) secs + fractional_secs);
diff --git a/libs/pbd/pbd/convert.h b/libs/pbd/pbd/convert.h
index 5adabe684d..f5a5056699 100644
--- a/libs/pbd/pbd/convert.h
+++ b/libs/pbd/pbd/convert.h
@@ -42,8 +42,8 @@ LIBPBD_API std::string capitalize (const std::string&);
LIBPBD_API std::string downcase (const std::string&);
LIBPBD_API const char* downcase (const char*);
-// std::string length2string (const int32_t frames, const float sample_rate);
-LIBPBD_API std::string length2string (const int64_t frames, const double sample_rate);
+// std::string length2string (const int32_t samples, const float sample_rate);
+LIBPBD_API std::string length2string (const int64_t samples, const double sample_rate);
LIBPBD_API std::vector<std::string> internationalize (const char *, const char **);
LIBPBD_API bool strings_equal_ignore_case (const std::string& a, const std::string& b);
diff --git a/libs/pbd/stacktrace.cc b/libs/pbd/stacktrace.cc
index 8a7cdfafca..3b308f7db2 100644
--- a/libs/pbd/stacktrace.cc
+++ b/libs/pbd/stacktrace.cc
@@ -78,8 +78,8 @@ PBD::stacktrace (std::ostream& out, int levels)
extern "C" {
__declspec(dllimport) USHORT WINAPI CaptureStackBackTrace (
- ULONG FramesToSkip,
- ULONG FramesToCapture,
+ ULONG SamplesToSkip,
+ ULONG SamplesToCapture,
PVOID *BackTrace,
PULONG BackTraceHash
);
@@ -93,7 +93,7 @@ PBD::stacktrace( std::ostream& out, int)
const size_t levels = 62; // does not support more then 62 levels of stacktrace
unsigned int i;
void * stack[ levels ];
- unsigned short frames;
+ unsigned short samples;
SYMBOL_INFO * symbol;
HANDLE process;
@@ -102,18 +102,18 @@ PBD::stacktrace( std::ostream& out, int)
SymInitialize( process, NULL, TRUE );
- frames = CaptureStackBackTrace( 0, levels, stack, NULL );
+ samples = CaptureStackBackTrace( 0, levels, stack, NULL );
- out << "+++++Backtrace frames: " << frames << std::endl;
+ out << "+++++Backtrace samples: " << samples << std::endl;
symbol = ( SYMBOL_INFO * )calloc( sizeof( SYMBOL_INFO ) + 256 * sizeof( char ), 1 );
symbol->MaxNameLen = 255;
symbol->SizeOfStruct = sizeof( SYMBOL_INFO );
- for( i = 0; i < frames; i++ )
+ for( i = 0; i < samples; i++ )
{
SymFromAddr( process, ( DWORD64 )( stack[ i ] ), 0, symbol );
- out << string_compose( "%1: %2 - %3\n", frames - i - 1, symbol->Name, symbol->Address );
+ out << string_compose( "%1: %2 - %3\n", samples - i - 1, symbol->Name, symbol->Address );
}
out.flush();
diff --git a/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc b/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc
index 0c3e20a888..e6cf1e29d3 100644
--- a/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc
+++ b/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.cc
@@ -133,7 +133,7 @@ typedef struct {
LV2_Log_Logger logger;
LV2_Worker_Schedule* schedule;
LV2_Atom_Forge forge;
- LV2_Atom_Forge_Frame frame;
+ LV2_Atom_Forge_Frame sample;
#ifdef LV2_EXTENDED
LV2_Midnam* midnam;
@@ -243,15 +243,15 @@ inform_ui (AFluidSynth* self)
return;
}
- LV2_Atom_Forge_Frame frame;
+ LV2_Atom_Forge_Frame sample;
lv2_atom_forge_frame_time (&self->forge, 0);
- x_forge_object (&self->forge, &frame, 1, self->patch_Set);
+ x_forge_object (&self->forge, &sample, 1, self->patch_Set);
lv2_atom_forge_property_head (&self->forge, self->patch_property, 0);
lv2_atom_forge_urid (&self->forge, self->afs_sf2file);
lv2_atom_forge_property_head (&self->forge, self->patch_value, 0);
lv2_atom_forge_path (&self->forge, self->current_sf2_file_path, strlen (self->current_sf2_file_path));
- lv2_atom_forge_pop (&self->forge, &frame);
+ lv2_atom_forge_pop (&self->forge, &sample);
}
static float
@@ -421,7 +421,7 @@ run (LV2_Handle instance, uint32_t n_samples)
const uint32_t capacity = self->notify->atom.size;
lv2_atom_forge_set_buffer (&self->forge, (uint8_t*)self->notify, capacity);
- lv2_atom_forge_sequence_head (&self->forge, &self->frame, 0);
+ lv2_atom_forge_sequence_head (&self->forge, &self->sample, 0);
if (!self->initialized || self->reinit_in_progress) {
memset (self->p_ports[FS_PORT_OUT_L], 0, n_samples * sizeof (float));
@@ -570,10 +570,10 @@ run (LV2_Handle instance, uint32_t n_samples)
self->inform_ui = false;
/* emit stateChanged */
- LV2_Atom_Forge_Frame frame;
+ LV2_Atom_Forge_Frame sample;
lv2_atom_forge_frame_time(&self->forge, 0);
- x_forge_object(&self->forge, &frame, 1, self->state_Changed);
- lv2_atom_forge_pop(&self->forge, &frame);
+ x_forge_object(&self->forge, &sample, 1, self->state_Changed);
+ lv2_atom_forge_pop(&self->forge, &sample);
/* send .sf2 filename */
inform_ui (self);
diff --git a/libs/surfaces/cc121/cc121.cc b/libs/surfaces/cc121/cc121.cc
index 8a8cfb6597..ac4acf3439 100644
--- a/libs/surfaces/cc121/cc121.cc
+++ b/libs/surfaces/cc121/cc121.cc
@@ -309,7 +309,7 @@ CC121::button_press_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb)
if (_current_stripable) {
boost::shared_ptr<AutomationControl> gain = _current_stripable->gain_control ();
if (gain) {
- framepos_t now = session->engine().sample_time();
+ samplepos_t now = session->engine().sample_time();
gain->start_touch (now);
}
}
@@ -356,7 +356,7 @@ CC121::button_release_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb)
if (_current_stripable) {
boost::shared_ptr<AutomationControl> gain = _current_stripable->gain_control ();
if (gain) {
- framepos_t now = session->engine().sample_time();
+ samplepos_t now = session->engine().sample_time();
gain->stop_touch (now);
}
}
@@ -694,7 +694,7 @@ CC121::midi_input_handler (Glib::IOCondition ioc, boost::shared_ptr<ARDOUR::Asyn
port->clear ();
DEBUG_TRACE (DEBUG::CC121, string_compose ("data available on %1\n", boost::shared_ptr<MIDI::Port>(port)->name()));
- framepos_t now = session->engine().sample_time();
+ samplepos_t now = session->engine().sample_time();
port->parse (now);
}
diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc
index df8a18b855..7836eef319 100644
--- a/libs/surfaces/control_protocol/basic_ui.cc
+++ b/libs/surfaces/control_protocol/basic_ui.cc
@@ -107,7 +107,7 @@ BasicUI::loop_toggle ()
}
void
-BasicUI::loop_location (framepos_t start, framepos_t end)
+BasicUI::loop_location (samplepos_t start, samplepos_t end)
{
Location* tll;
if ((tll = session->locations()->auto_loop_location()) == 0) {
@@ -141,7 +141,7 @@ BasicUI::goto_end ()
void
BasicUI::add_marker (const std::string& markername)
{
- framepos_t where = session->audible_frame();
+ samplepos_t where = session->audible_sample();
Location *location = new Location (*session, where, where, markername, Location::IsMark);
session->begin_reversible_command (_("add marker"));
XMLNode &before = session->locations()->get_state();
@@ -161,7 +161,7 @@ BasicUI::remove_marker_at_playhead ()
//find location(s) at this time
Locations::LocationList locs;
- session->locations()->find_all_between (session->audible_frame(), session->audible_frame()+1, locs, Location::Flags(0));
+ session->locations()->find_all_between (session->audible_sample(), session->audible_sample()+1, locs, Location::Flags(0));
for (Locations::LocationList::iterator i = locs.begin(); i != locs.end(); ++i) {
if ((*i)->is_mark()) {
session->locations()->remove (*i);
@@ -292,7 +292,7 @@ BasicUI::save_state ()
void
BasicUI::prev_marker ()
{
- framepos_t pos = session->locations()->first_mark_before (session->transport_frame());
+ samplepos_t pos = session->locations()->first_mark_before (session->transport_sample());
if (pos >= 0) {
session->request_locate (pos, session->transport_rolling());
@@ -304,7 +304,7 @@ BasicUI::prev_marker ()
void
BasicUI::next_marker ()
{
- framepos_t pos = session->locations()->first_mark_after (session->transport_frame());
+ samplepos_t pos = session->locations()->first_mark_after (session->transport_sample());
if (pos >= 0) {
session->request_locate (pos, session->transport_rolling());
@@ -375,14 +375,14 @@ BasicUI::set_record_enable (bool yn)
}
}
-framepos_t
-BasicUI::transport_frame ()
+samplepos_t
+BasicUI::transport_sample ()
{
- return session->transport_frame();
+ return session->transport_sample();
}
void
-BasicUI::locate (framepos_t where, bool roll_after_locate)
+BasicUI::locate (samplepos_t where, bool roll_after_locate)
{
session->request_locate (where, roll_after_locate);
}
@@ -390,14 +390,14 @@ BasicUI::locate (framepos_t where, bool roll_after_locate)
void
BasicUI::jump_by_seconds (double secs)
{
- framepos_t current = session->transport_frame();
- double s = (double) current / (double) session->nominal_frame_rate();
+ samplepos_t current = session->transport_sample();
+ double s = (double) current / (double) session->nominal_sample_rate();
s+= secs;
if (s < 0) {
s = 0;
}
- s = s * session->nominal_frame_rate();
+ s = s * session->nominal_sample_rate();
session->request_locate ( floor(s) );
}
@@ -406,7 +406,7 @@ void
BasicUI::jump_by_bars (double bars)
{
TempoMap& tmap (session->tempo_map());
- Timecode::BBT_Time bbt (tmap.bbt_at_frame (session->transport_frame()));
+ Timecode::BBT_Time bbt (tmap.bbt_at_sample (session->transport_sample()));
bars += bbt.bars;
if (bars < 0) {
@@ -417,7 +417,7 @@ BasicUI::jump_by_bars (double bars)
any.type = AnyTime::BBT;
any.bbt.bars = bars;
- session->request_locate ( session->convert_to_frames (any) );
+ session->request_locate ( session->convert_to_samples (any) );
}
void
@@ -535,26 +535,26 @@ BasicUI::locked ()
return session->transport_locked ();
}
-ARDOUR::framecnt_t
+ARDOUR::samplecnt_t
BasicUI::timecode_frames_per_hour ()
{
return session->timecode_frames_per_hour ();
}
void
-BasicUI::timecode_time (framepos_t where, Timecode::Time& timecode)
+BasicUI::timecode_time (samplepos_t where, Timecode::Time& timecode)
{
session->timecode_time (where, *((Timecode::Time *) &timecode));
}
void
-BasicUI::timecode_to_sample (Timecode::Time& timecode, framepos_t & sample, bool use_offset, bool use_subframes) const
+BasicUI::timecode_to_sample (Timecode::Time& timecode, samplepos_t & sample, bool use_offset, bool use_subframes) const
{
session->timecode_to_sample (*((Timecode::Time*)&timecode), sample, use_offset, use_subframes);
}
void
-BasicUI::sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const
+BasicUI::sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const
{
session->sample_to_timecode (sample, *((Timecode::Time*)&timecode), use_offset, use_subframes);
}
diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
index ebf864405e..6626564711 100644
--- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h
+++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
@@ -55,7 +55,7 @@ class LIBCONTROLCP_API BasicUI {
/* transport control */
void loop_toggle ();
- void loop_location (framepos_t start, framepos_t end);
+ void loop_location (samplepos_t start, samplepos_t end);
void access_action ( std::string action_path );
static PBD::Signal2<void,std::string,std::string> AccessAction;
void goto_zero ();
@@ -71,8 +71,8 @@ class LIBCONTROLCP_API BasicUI {
void jump_by_seconds( double sec );
void jump_by_bars(double bars);
- ARDOUR::framepos_t transport_frame ();
- void locate (ARDOUR::framepos_t frame, bool play = false);
+ ARDOUR::samplepos_t transport_sample ();
+ void locate (ARDOUR::samplepos_t sample, bool play = false);
bool locating ();
bool locked ();
@@ -142,11 +142,11 @@ class LIBCONTROLCP_API BasicUI {
void goto_nth_marker (int n);
- ARDOUR::framecnt_t timecode_frames_per_hour ();
+ ARDOUR::samplecnt_t timecode_frames_per_hour ();
- void timecode_time (framepos_t where, Timecode::Time&);
- void timecode_to_sample (Timecode::Time& timecode, framepos_t & sample, bool use_offset, bool use_subframes) const;
- void sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
+ void timecode_time (samplepos_t where, Timecode::Time&);
+ void timecode_to_sample (Timecode::Time& timecode, samplepos_t & sample, bool use_offset, bool use_subframes) const;
+ void sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
protected:
BasicUI ();
diff --git a/libs/surfaces/faderport/faderport.cc b/libs/surfaces/faderport/faderport.cc
index 72190c1e8a..962678735e 100644
--- a/libs/surfaces/faderport/faderport.cc
+++ b/libs/surfaces/faderport/faderport.cc
@@ -370,7 +370,7 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb)
if (_current_stripable) {
boost::shared_ptr<AutomationControl> gain = _current_stripable->gain_control ();
if (gain) {
- framepos_t now = session->engine().sample_time();
+ samplepos_t now = session->engine().sample_time();
if (tb->value) {
gain->start_touch (now);
} else {
@@ -761,7 +761,7 @@ FaderPort::midi_input_handler (Glib::IOCondition ioc, boost::weak_ptr<ARDOUR::As
port->clear ();
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("data available on %1\n", boost::shared_ptr<MIDI::Port>(port)->name()));
- framepos_t now = session->engine().sample_time();
+ samplepos_t now = session->engine().sample_time();
port->parse (now);
}
diff --git a/libs/surfaces/faderport8/actions.cc b/libs/surfaces/faderport8/actions.cc
index d17059d92d..07496e9912 100644
--- a/libs/surfaces/faderport8/actions.cc
+++ b/libs/surfaces/faderport8/actions.cc
@@ -332,7 +332,7 @@ FaderPort8::button_solo_clear ()
if (!ac) {
continue;
}
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
cl->push_back (ac);
}
if (!cl->empty()) {
@@ -357,7 +357,7 @@ FaderPort8::button_mute_clear ()
continue;
}
cl->push_back (ac);
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
}
if (!cl->empty()) {
session->set_controls (cl, 1.0, PBD::Controllable::NoGroup);
@@ -397,7 +397,7 @@ FaderPort8::handle_encoder_pan (int steps)
ac = s->pan_azimuth_control ();
}
if (ac) {
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
if (steps == 0) {
ac->set_value (ac->normal(), PBD::Controllable::UseGroup);
} else {
@@ -421,7 +421,7 @@ FaderPort8::handle_encoder_link (int steps)
}
double v = ac->internal_to_interface (ac->get_value());
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
if (steps == 0) {
ac->set_value (ac->normal(), PBD::Controllable::UseGroup);
@@ -528,7 +528,7 @@ FaderPort8::button_encoder ()
ac = session->master_out()->gain_control ();
}
if (ac) {
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
ac->set_value (ac->normal(), PBD::Controllable::NoGroup);
}
}
@@ -542,8 +542,8 @@ FaderPort8::button_encoder ()
/* Don't add another mark if one exists within 1/100th of a second of
* the current position and we're not rolling.
*/
- framepos_t where = session->audible_frame();
- if (session->transport_stopped() && session->locations()->mark_at (where, session->frame_rate() / 100.0)) {
+ samplepos_t where = session->audible_sample();
+ if (session->transport_stopped() && session->locations()->mark_at (where, session->sample_rate() / 100.0)) {
return;
}
@@ -608,7 +608,7 @@ FaderPort8::encoder_navigate (bool neg, int steps)
if (ac) {
double v = ac->internal_to_interface (ac->get_value());
v = std::max (0.0, std::min (1.0, v + steps * (neg ? -.01 : .01)));
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
ac->set_value (ac->interface_to_internal(v), PBD::Controllable::NoGroup);
}
}
diff --git a/libs/surfaces/faderport8/faderport8.cc b/libs/surfaces/faderport8/faderport8.cc
index 2603a12e34..c3e4a20a9a 100644
--- a/libs/surfaces/faderport8/faderport8.cc
+++ b/libs/surfaces/faderport8/faderport8.cc
@@ -230,7 +230,7 @@ FaderPort8::periodic ()
_timecode = Timecode::timecode_format_time(TC);
char buf[16];
- Timecode::BBT_Time BBT = session->tempo_map ().bbt_at_frame (session->transport_frame ());
+ Timecode::BBT_Time BBT = session->tempo_map ().bbt_at_sample (session->transport_sample ());
snprintf (buf, sizeof (buf),
" %02" PRIu32 "|%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32,
BBT.bars % 100, BBT.beats %100,
@@ -479,7 +479,7 @@ FaderPort8::midi_input_handler (Glib::IOCondition ioc, boost::weak_ptr<ARDOUR::A
#ifdef VERBOSE_DEBUG
DEBUG_TRACE (DEBUG::FaderPort8, string_compose ("data available on %1\n", boost::shared_ptr<MIDI::Port>(port)->name()));
#endif
- framepos_t now = session->engine().sample_time();
+ samplepos_t now = session->engine().sample_time();
port->parse (now);
}
@@ -1638,7 +1638,7 @@ FaderPort8::select_strip (boost::weak_ptr<Stripable> ws)
if (s == first_selected_stripable () && !shift_mod ()) {
if (_ctrls.fader_mode () == ModeTrack) {
boost::shared_ptr<AutomationControl> ac = s->gain_control ();
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
ac->set_value (ac->normal (), PBD::Controllable::UseGroup);
}
return;
diff --git a/libs/surfaces/faderport8/fp8_strip.cc b/libs/surfaces/faderport8/fp8_strip.cc
index eb6ec244b9..5de996a294 100644
--- a/libs/surfaces/faderport8/fp8_strip.cc
+++ b/libs/surfaces/faderport8/fp8_strip.cc
@@ -297,9 +297,9 @@ FP8Strip::midi_touch (bool t)
return false;
}
if (t) {
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
} else {
- ac->stop_touch (ac->session().transport_frame());
+ ac->stop_touch (ac->session().transport_sample());
}
return true;
}
@@ -315,7 +315,7 @@ FP8Strip::midi_fader (float val)
if (!ac) {
return false;
}
- ac->start_touch (ac->session().transport_frame());
+ ac->start_touch (ac->session().transport_sample());
ac->set_value (ac->interface_to_internal (val), group_mode ());
return true;
}
@@ -340,7 +340,7 @@ FP8Strip::set_mute (bool on)
if (!_mute_ctrl) {
return;
}
- _mute_ctrl->start_touch (_mute_ctrl->session().transport_frame());
+ _mute_ctrl->start_touch (_mute_ctrl->session().transport_sample());
_mute_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
}
@@ -350,7 +350,7 @@ FP8Strip::set_solo (bool on)
if (!_solo_ctrl) {
return;
}
- _solo_ctrl->start_touch (_solo_ctrl->session().transport_frame());
+ _solo_ctrl->start_touch (_solo_ctrl->session().transport_sample());
_solo_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
}
@@ -371,7 +371,7 @@ FP8Strip::set_select ()
assert (!_x_select_ctrl);
_select_plugin_functor ();
} else if (_x_select_ctrl) {
- _x_select_ctrl->start_touch (_x_select_ctrl->session().transport_frame());
+ _x_select_ctrl->start_touch (_x_select_ctrl->session().transport_sample());
const bool on = !select_button ().is_active();
_x_select_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
}
diff --git a/libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc b/libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc
index 5799ab682a..f41703c3de 100644
--- a/libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc
+++ b/libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc
@@ -110,7 +110,7 @@ TranzportControlProtocol::TranzportControlProtocol (Session& s)
_device_status = STATUS_OFFLINE;
udev = 0;
current_track_id = 0;
- last_where = max_frames;
+ last_where = max_samples;
wheel_mode = WheelTimeline;
wheel_shift_mode = WheelShiftGain;
wheel_increment = WheelIncrScreen;
@@ -555,7 +555,7 @@ TranzportControlProtocol::show_meter ()
}
void
-TranzportControlProtocol::show_bbt (framepos_t where)
+TranzportControlProtocol::show_bbt (samplepos_t where)
{
if ((where != last_where) || lcd_isdamaged(1,9,8)) {
char buf[16];
@@ -591,11 +591,11 @@ TranzportControlProtocol::show_bbt (framepos_t where)
void
TranzportControlProtocol::show_transport_time ()
{
- show_bbt (session->transport_frame ());
+ show_bbt (session->transport_sample ());
}
void
-TranzportControlProtocol::show_smpte (framepos_t where)
+TranzportControlProtocol::show_smpte (samplepos_t where)
{
if ((where != last_where) || lcd_isdamaged(1,9,10)) {
@@ -617,7 +617,7 @@ TranzportControlProtocol::show_smpte (framepos_t where)
sprintf (buf, "%02" PRIu32 ":", smpte.seconds);
print (1, 15, buf);
- sprintf (buf, "%02" PRIu32, smpte.frames);
+ sprintf (buf, "%02" PRIu32, smpte.samples);
print_noretry (1, 18, buf);
last_where = where;
diff --git a/libs/surfaces/frontier/tranzport/tranzport_control_protocol.h b/libs/surfaces/frontier/tranzport/tranzport_control_protocol.h
index 13df6915a2..e132361397 100644
--- a/libs/surfaces/frontier/tranzport/tranzport_control_protocol.h
+++ b/libs/surfaces/frontier/tranzport/tranzport_control_protocol.h
@@ -150,8 +150,8 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
uint32_t last_hrs;
uint32_t last_mins;
uint32_t last_secs;
- uint32_t last_frames;
- framepos_t last_where;
+ uint32_t last_samples;
+ samplepos_t last_where;
ARDOUR::gain_t last_track_gain;
uint32_t last_meter_fill;
uint64_t last_wheel_motion;
@@ -246,8 +246,8 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
void show_current_track ();
void show_track_gain ();
void show_transport_time ();
- void show_bbt (framepos_t where);
- void show_smpte (framepos_t where);
+ void show_bbt (samplepos_t where);
+ void show_smpte (samplepos_t where);
void show_wheel_mode ();
void show_gain ();
void show_pan ();
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
index 36047d262d..4d394e5082 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
@@ -1240,7 +1240,7 @@ GenericMidiControlProtocol::maybe_start_touch (Controllable* controllable)
{
AutomationControl *actl = dynamic_cast<AutomationControl*> (controllable);
if (actl) {
- actl->start_touch (session->audible_frame ());
+ actl->start_touch (session->audible_sample ());
}
}
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 064d763d1e..5b2109de34 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -111,7 +111,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
: ControlProtocol (session, X_("Mackie"))
, AbstractUI<MackieControlUIRequest> (name())
, _current_initial_bank (0)
- , _frame_last (0)
+ , _sample_last (0)
, _timecode_type (ARDOUR::AnyTime::BBT)
, _gui (0)
, _scrub_mode (false)
@@ -1098,11 +1098,11 @@ MackieControlProtocol::set_state (const XMLNode & node, int version)
}
string
-MackieControlProtocol::format_bbt_timecode (framepos_t now_frame)
+MackieControlProtocol::format_bbt_timecode (samplepos_t now_sample)
{
Timecode::BBT_Time bbt_time;
- session->bbt_time (now_frame, bbt_time);
+ session->bbt_time (now_sample, bbt_time);
// The Mackie protocol spec is built around a BBT time display of
//
@@ -1125,14 +1125,14 @@ MackieControlProtocol::format_bbt_timecode (framepos_t now_frame)
}
string
-MackieControlProtocol::format_timecode_timecode (framepos_t now_frame)
+MackieControlProtocol::format_timecode_timecode (samplepos_t now_sample)
{
Timecode::Time timecode;
- session->timecode_time (now_frame, timecode);
+ session->timecode_time (now_sample, timecode);
// According to the Logic docs
// digits: 888/88/88/888
- // Timecode mode: Hours/Minutes/Seconds/Frames
+ // Timecode mode: Hours/Minutes/Seconds/Samples
ostringstream os;
os << setw(2) << setfill('0') << timecode.hours;
os << ' ';
@@ -1159,23 +1159,23 @@ MackieControlProtocol::update_timecode_display()
return;
}
- // do assignment here so current_frame is fixed
- framepos_t current_frame = session->transport_frame();
+ // do assignment here so current_sample is fixed
+ samplepos_t current_sample = session->transport_sample();
string timecode;
// For large jumps in play head possition do full reset
- int moved = (current_frame - _frame_last) / session->frame_rate ();
+ int moved = (current_sample - _sample_last) / session->sample_rate ();
if (moved) {
DEBUG_TRACE (DEBUG::MackieControl, "Timecode reset\n");
_timecode_last = string (10, ' ');
}
- _frame_last = current_frame;
+ _sample_last = current_sample;
switch (_timecode_type) {
case ARDOUR::AnyTime::BBT:
- timecode = format_bbt_timecode (current_frame);
+ timecode = format_bbt_timecode (current_sample);
break;
case ARDOUR::AnyTime::Timecode:
- timecode = format_timecode_timecode (current_frame);
+ timecode = format_timecode_timecode (current_sample);
break;
default:
return;
@@ -1641,7 +1641,7 @@ MackieControlProtocol::midi_input_handler (IOCondition ioc, MIDI::Port* port)
}
// DEBUG_TRACE (DEBUG::MackieControl, string_compose ("data available on %1\n", port->name()));
- framepos_t now = session->engine().sample_time();
+ samplepos_t now = session->engine().sample_time();
port->parse (now);
}
@@ -1994,10 +1994,10 @@ MackieControlProtocol::update_fader_automation_state ()
}
}
-framepos_t
-MackieControlProtocol::transport_frame() const
+samplepos_t
+MackieControlProtocol::transport_sample() const
{
- return session->transport_frame();
+ return session->transport_sample();
}
void
diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h
index 9172716fe2..68e918d0e9 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.h
+++ b/libs/surfaces/mackie/mackie_control_protocol.h
@@ -219,7 +219,7 @@ class MackieControlProtocol
void update_global_led (int id, Mackie::LedState);
ARDOUR::Session & get_session() { return *session; }
- framepos_t transport_frame() const;
+ samplepos_t transport_sample() const;
int modifier_state() const { return _modifier_state; }
int main_modifier_state() const { return _modifier_state & MAIN_MODIFIER_MASK; }
@@ -269,8 +269,8 @@ class MackieControlProtocol
// also called from poll_automation to update timecode display
void update_timecode_display();
- std::string format_bbt_timecode (ARDOUR::framepos_t now_frame);
- std::string format_timecode_timecode (ARDOUR::framepos_t now_frame);
+ std::string format_bbt_timecode (ARDOUR::samplepos_t now_sample);
+ std::string format_timecode_timecode (ARDOUR::samplepos_t now_sample);
void do_request (MackieControlUIRequest*);
int stop ();
@@ -313,7 +313,7 @@ class MackieControlProtocol
Mackie::Timer _frm_left_last;
// last written timecode string
std::string _timecode_last;
- framepos_t _frame_last;
+ samplepos_t _sample_last;
// Which timecode are we displaying? BBT or Timecode
ARDOUR::AnyTime::Type _timecode_type;
// Bundle to represent our input ports
diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc
index a8998f960d..a4ab7d9099 100644
--- a/libs/surfaces/mackie/mcp_buttons.cc
+++ b/libs/surfaces/mackie/mcp_buttons.cc
@@ -457,9 +457,9 @@ MackieControlProtocol::marker_release (Button &)
* the current position and we're not rolling.
*/
- framepos_t where = session->audible_frame();
+ samplepos_t where = session->audible_sample();
- if (session->transport_stopped() && session->locations()->mark_at (where, session->frame_rate() / 100.0)) {
+ if (session->transport_stopped() && session->locations()->mark_at (where, session->sample_rate() / 100.0)) {
return off;
}
@@ -840,7 +840,7 @@ MackieControlProtocol::master_fader_touch_press (Mackie::Button &)
boost::shared_ptr<AutomationControl> ac = master_fader->control ();
master_fader->set_in_use (true);
- master_fader->start_touch (transport_frame());
+ master_fader->start_touch (transport_sample());
return none;
}
@@ -852,7 +852,7 @@ MackieControlProtocol::master_fader_touch_release (Mackie::Button &)
Fader* master_fader = _master_surface->master_fader();
master_fader->set_in_use (false);
- master_fader->stop_touch (transport_frame());
+ master_fader->stop_touch (transport_sample());
return none;
}
diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc
index 28a2fa22bb..64b60d4eea 100644
--- a/libs/surfaces/mackie/strip.cc
+++ b/libs/surfaces/mackie/strip.cc
@@ -790,7 +790,7 @@ Strip::fader_touch_event (Button&, ButtonState bs)
boost::shared_ptr<AutomationControl> ac = _fader->control ();
_fader->set_in_use (true);
- _fader->start_touch (_surface->mcp().transport_frame());
+ _fader->start_touch (_surface->mcp().transport_sample());
if (ac) {
do_parameter_display (ac->desc(), ac->get_value());
@@ -799,7 +799,7 @@ Strip::fader_touch_event (Button&, ButtonState bs)
} else {
_fader->set_in_use (false);
- _fader->stop_touch (_surface->mcp().transport_frame());
+ _fader->stop_touch (_surface->mcp().transport_sample());
}
}
@@ -947,9 +947,9 @@ void
Strip::handle_fader_touch (Fader& fader, bool touch_on)
{
if (touch_on) {
- fader.start_touch (_surface->mcp().transport_frame());
+ fader.start_touch (_surface->mcp().transport_sample());
} else {
- fader.stop_touch (_surface->mcp().transport_frame());
+ fader.stop_touch (_surface->mcp().transport_sample());
}
}
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc
index 335bfcc6ad..1ca0dff146 100644
--- a/libs/surfaces/osc/osc.cc
+++ b/libs/surfaces/osc/osc.cc
@@ -432,7 +432,7 @@ OSC::register_callbacks()
REGISTER_CALLBACK (serv, "/transport_stop", "f", transport_stop);
REGISTER_CALLBACK (serv, "/transport_play", "", transport_play);
REGISTER_CALLBACK (serv, "/transport_play", "f", transport_play);
- REGISTER_CALLBACK (serv, "/transport_frame", "", transport_frame);
+ REGISTER_CALLBACK (serv, "/transport_frame", "", transport_sample);
REGISTER_CALLBACK (serv, "/transport_speed", "", transport_speed);
REGISTER_CALLBACK (serv, "/record_enabled", "", record_enabled);
REGISTER_CALLBACK (serv, "/set_transport_speed", "f", set_transport_speed);
@@ -1187,37 +1187,37 @@ OSC::current_value (const char */*path*/, const char */*types*/, lo_arg **/*argv
if (strcmp (argv[0]->s, "transport_frame") == 0) {
if (session) {
- lo_send (addr, retpath, "i", session->transport_frame());
+ lo_send (addr, retpath, "i", session->transport_sample());
}
} else if (strcmp (argv[0]->s, "transport_speed") == 0) {
if (session) {
- lo_send (addr, retpath, "i", session->transport_frame());
+ lo_send (addr, retpath, "i", session->transport_sample());
}
} else if (strcmp (argv[0]->s, "transport_locked") == 0) {
if (session) {
- lo_send (addr, retpath, "i", session->transport_frame());
+ lo_send (addr, retpath, "i", session->transport_sample());
}
} else if (strcmp (argv[0]->s, "punch_in") == 0) {
if (session) {
- lo_send (addr, retpath, "i", session->transport_frame());
+ lo_send (addr, retpath, "i", session->transport_sample());
}
} else if (strcmp (argv[0]->s, "punch_out") == 0) {
if (session) {
- lo_send (addr, retpath, "i", session->transport_frame());
+ lo_send (addr, retpath, "i", session->transport_sample());
}
} else if (strcmp (argv[0]->s, "rec_enable") == 0) {
if (session) {
- lo_send (addr, retpath, "i", session->transport_frame());
+ lo_send (addr, retpath, "i", session->transport_sample());
}
} else {
@@ -1313,8 +1313,8 @@ OSC::routes_list (lo_message msg)
lo_message reply = lo_message_new ();
lo_message_add_string (reply, "end_route_list");
- lo_message_add_int64 (reply, session->frame_rate());
- lo_message_add_int64 (reply, session->current_end_frame());
+ lo_message_add_int64 (reply, session->sample_rate());
+ lo_message_add_int64 (reply, session->current_end_sample());
if (session->monitor_out()) {
// this session has a monitor section
lo_message_add_int32 (reply, 1);
@@ -2168,13 +2168,13 @@ OSC::_sel_plugin (int id, lo_address addr)
}
void
-OSC::transport_frame (lo_message msg)
+OSC::transport_sample (lo_message msg)
{
if (!session) {
return;
}
check_surface (msg);
- framepos_t pos = session->transport_frame ();
+ samplepos_t pos = session->transport_sample ();
lo_message reply = lo_message_new ();
lo_message_add_int64 (reply, pos);
@@ -2224,7 +2224,7 @@ OSC::scrub (float delta, lo_message msg)
if (!session) return -1;
check_surface (msg);
- scrub_place = session->transport_frame ();
+ scrub_place = session->transport_sample ();
float speed;
@@ -2871,11 +2871,11 @@ OSC::touch_detect (const char *path, const char* types, lo_arg **argv, int argc,
if (control) {
if (touch) {
//start touch
- control->start_touch (control->session().transport_frame());
+ control->start_touch (control->session().transport_sample());
ret = 0;
} else {
// end touch
- control->stop_touch (control->session().transport_frame());
+ control->stop_touch (control->session().transport_sample());
ret = 0;
}
// just in case some crazy surface starts sending control values before touch
@@ -2895,7 +2895,7 @@ OSC::fake_touch (boost::shared_ptr<ARDOUR::AutomationControl> ctrl)
if (ctrl) {
//start touch
if (ctrl->automation_state() == Touch && !ctrl->touching ()) {
- ctrl->start_touch (ctrl->session().transport_frame());
+ ctrl->start_touch (ctrl->session().transport_sample());
_touch_timeout[ctrl] = 10;
}
}
@@ -4892,7 +4892,7 @@ OSC::periodic (void)
if (!(*x).second) {
boost::shared_ptr<ARDOUR::AutomationControl> ctrl = (*x).first;
// turn touch off
- ctrl->stop_touch (ctrl->session().transport_frame());
+ ctrl->stop_touch (ctrl->session().transport_sample());
_touch_timeout.erase (x++);
} else {
x++;
diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h
index 79392a0008..0c19cea7b6 100644
--- a/libs/surfaces/osc/osc.h
+++ b/libs/surfaces/osc/osc.h
@@ -257,7 +257,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
int route_get_sends (lo_message msg);
int route_get_receives(lo_message msg);
void routes_list (lo_message msg);
- void transport_frame (lo_message msg);
+ void transport_sample (lo_message msg);
void transport_speed (lo_message msg);
void record_enabled (lo_message msg);
@@ -300,7 +300,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
PATH_CALLBACK_MSG(route_get_sends);
PATH_CALLBACK_MSG(route_get_receives);
PATH_CALLBACK_MSG(routes_list);
- PATH_CALLBACK_MSG(transport_frame);
+ PATH_CALLBACK_MSG(transport_sample);
PATH_CALLBACK_MSG(transport_speed);
PATH_CALLBACK_MSG(record_enabled);
PATH_CALLBACK_MSG(refresh_surface);
diff --git a/libs/surfaces/osc/osc_global_observer.cc b/libs/surfaces/osc/osc_global_observer.cc
index 0649626271..00f1b26a30 100644
--- a/libs/surfaces/osc/osc_global_observer.cc
+++ b/libs/surfaces/osc/osc_global_observer.cc
@@ -48,7 +48,7 @@ OSCGlobalObserver::OSCGlobalObserver (Session& s, ArdourSurface::OSC::OSCSurface
session = &s;
gainmode = sur->gainmode;
feedback = sur->feedback;
- _last_frame = -1;
+ _last_sample = -1;
if (feedback[4]) {
// connect to all the things we want to send feed back from
@@ -143,13 +143,13 @@ OSCGlobalObserver::tick ()
if (_init) {
return;
}
- framepos_t now_frame = session->transport_frame();
- if (now_frame != _last_frame) {
+ samplepos_t now_sample = session->transport_sample();
+ if (now_sample != _last_sample) {
if (feedback[6]) { // timecode enabled
Timecode::Time timecode;
- session->timecode_time (now_frame, timecode);
+ session->timecode_time (now_sample, timecode);
- // Timecode mode: Hours/Minutes/Seconds/Frames
+ // Timecode mode: Hours/Minutes/Seconds/Samples
ostringstream os;
os << setw(2) << setfill('0') << timecode.hours;
os << ':';
@@ -164,7 +164,7 @@ OSCGlobalObserver::tick ()
if (feedback[5]) { // Bar beat enabled
Timecode::BBT_Time bbt_time;
- session->bbt_time (now_frame, bbt_time);
+ session->bbt_time (now_sample, bbt_time);
// semantics: BBB/bb/tttt
ostringstream os;
@@ -178,14 +178,14 @@ OSCGlobalObserver::tick ()
text_message ("/position/bbt", os.str());
}
if (feedback[11]) { // minutes/seconds enabled
- framepos_t left = now_frame;
- int hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
- left -= (framecnt_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
- int mins = (int) floor (left / (session->frame_rate() * 60.0f));
- left -= (framecnt_t) floor (mins * session->frame_rate() * 60.0f);
- int secs = (int) floor (left / (float) session->frame_rate());
- left -= (framecnt_t) floor ((double)(secs * session->frame_rate()));
- int millisecs = floor (left * 1000.0 / (float) session->frame_rate());
+ samplepos_t left = now_sample;
+ int hrs = (int) floor (left / (session->sample_rate() * 60.0f * 60.0f));
+ left -= (samplecnt_t) floor (hrs * session->sample_rate() * 60.0f * 60.0f);
+ int mins = (int) floor (left / (session->sample_rate() * 60.0f));
+ left -= (samplecnt_t) floor (mins * session->sample_rate() * 60.0f);
+ int secs = (int) floor (left / (float) session->sample_rate());
+ left -= (samplecnt_t) floor ((double)(secs * session->sample_rate()));
+ int millisecs = floor (left * 1000.0 / (float) session->sample_rate());
// Min/sec mode: Hours/Minutes/Seconds/msec
ostringstream os;
@@ -201,10 +201,10 @@ OSCGlobalObserver::tick ()
}
if (feedback[10]) { // samples
ostringstream os;
- os << now_frame;
+ os << now_sample;
text_message ("/position/samples", os.str());
}
- _last_frame = now_frame;
+ _last_sample = now_sample;
}
if (feedback[3]) { //heart beat enabled
if (_heartbeat == 10) {
diff --git a/libs/surfaces/osc/osc_global_observer.h b/libs/surfaces/osc/osc_global_observer.h
index ea5a0702a5..86832a54e8 100644
--- a/libs/surfaces/osc/osc_global_observer.h
+++ b/libs/surfaces/osc/osc_global_observer.h
@@ -59,7 +59,7 @@ class OSCGlobalObserver
uint32_t gainmode;
std::bitset<32> feedback;
ARDOUR::Session* session;
- framepos_t _last_frame;
+ samplepos_t _last_sample;
uint32_t _heartbeat;
float _last_meter;
uint32_t master_timeout;
diff --git a/libs/surfaces/push2/canvas.cc b/libs/surfaces/push2/canvas.cc
index 6a8d046aa9..761c9d5880 100644
--- a/libs/surfaces/push2/canvas.cc
+++ b/libs/surfaces/push2/canvas.cc
@@ -47,26 +47,26 @@ Push2Canvas::Push2Canvas (Push2& pr, int c, int r)
: p2 (pr)
, _cols (c)
, _rows (r)
- , frame_buffer (Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, _cols, _rows))
+ , sample_buffer (Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, _cols, _rows))
{
- context = Cairo::Context::create (frame_buffer);
+ context = Cairo::Context::create (sample_buffer);
expose_region = Cairo::Region::create ();
- device_frame_buffer = new uint16_t[pixel_area()];
- memset (device_frame_buffer, 0, sizeof (uint16_t) * pixel_area());
+ device_sample_buffer = new uint16_t[pixel_area()];
+ memset (device_sample_buffer, 0, sizeof (uint16_t) * pixel_area());
- frame_header[0] = 0xef;
- frame_header[1] = 0xcd;
- frame_header[2] = 0xab;
- frame_header[3] = 0x89;
+ sample_header[0] = 0xef;
+ sample_header[1] = 0xcd;
+ sample_header[2] = 0xab;
+ sample_header[3] = 0x89;
- memset (&frame_header[4], 0, 12);
+ memset (&sample_header[4], 0, 12);
}
Push2Canvas::~Push2Canvas ()
{
- delete [] device_frame_buffer;
- device_frame_buffer = 0;
+ delete [] device_sample_buffer;
+ device_sample_buffer = 0;
}
bool
@@ -75,15 +75,15 @@ Push2Canvas::vblank ()
/* re-render dirty areas, if any */
if (expose ()) {
- /* something rendered, update device_frame_buffer */
- blit_to_device_frame_buffer ();
+ /* something rendered, update device_sample_buffer */
+ blit_to_device_sample_buffer ();
#undef RENDER_LAYOUTS
#ifdef RENDER_LAYOUTS
if (p2.current_layout()) {
std::string s = p2.current_layout()->name();
s += ".png";
- frame_buffer->write_to_png (s);
+ sample_buffer->write_to_png (s);
}
#endif
}
@@ -94,11 +94,11 @@ Push2Canvas::vblank ()
/* transfer to device */
- if ((err = libusb_bulk_transfer (p2.usb_handle(), 0x01, frame_header, sizeof (frame_header), &transferred, timeout_msecs))) {
+ if ((err = libusb_bulk_transfer (p2.usb_handle(), 0x01, sample_header, sizeof (sample_header), &transferred, timeout_msecs))) {
return false;
}
- if ((err = libusb_bulk_transfer (p2.usb_handle(), 0x01, (uint8_t*) device_frame_buffer, 2 * pixel_area (), &transferred, timeout_msecs))) {
+ if ((err = libusb_bulk_transfer (p2.usb_handle(), 0x01, (uint8_t*) device_sample_buffer, 2 * pixel_area (), &transferred, timeout_msecs))) {
return false;
}
@@ -170,24 +170,24 @@ Push2Canvas::expose ()
return true;
}
-/** render host-side frame buffer (a Cairo ImageSurface) to the current
- * device-side frame buffer. The device frame buffer will be pushed to the
+/** render host-side sample buffer (a Cairo ImageSurface) to the current
+ * device-side sample buffer. The device sample buffer will be pushed to the
* device on the next call to vblank()
*/
int
-Push2Canvas::blit_to_device_frame_buffer ()
+Push2Canvas::blit_to_device_sample_buffer ()
{
/* ensure that all drawing has been done before we fetch pixel data */
- frame_buffer->flush ();
+ sample_buffer->flush ();
const int stride = 3840; /* bytes per row for Cairo::FORMAT_ARGB32 */
- const uint8_t* data = frame_buffer->get_data ();
+ const uint8_t* data = sample_buffer->get_data ();
- /* fill frame buffer (320kB) */
+ /* fill sample buffer (320kB) */
- uint16_t* fb = (uint16_t*) device_frame_buffer;
+ uint16_t* fb = (uint16_t*) device_sample_buffer;
for (int row = 0; row < _rows; ++row) {
diff --git a/libs/surfaces/push2/canvas.h b/libs/surfaces/push2/canvas.h
index fe419f44ba..4250003ede 100644
--- a/libs/surfaces/push2/canvas.h
+++ b/libs/surfaces/push2/canvas.h
@@ -79,16 +79,16 @@ class Push2Canvas : public ArdourCanvas::Canvas
static const int pixels_per_row;
int pixel_area () const { return _rows * pixels_per_row; }
- uint8_t frame_header[16];
- uint16_t* device_frame_buffer;
+ uint8_t sample_header[16];
+ uint16_t* device_sample_buffer;
- Cairo::RefPtr<Cairo::ImageSurface> frame_buffer;
+ Cairo::RefPtr<Cairo::ImageSurface> sample_buffer;
Cairo::RefPtr<Cairo::Context> context;
Cairo::RefPtr<Cairo::Region> expose_region;
Glib::RefPtr<Pango::Context> pango_context;
bool expose ();
- int blit_to_device_frame_buffer ();
+ int blit_to_device_sample_buffer ();
};
} /* namespace ArdourSurface */
diff --git a/libs/surfaces/push2/mix.cc b/libs/surfaces/push2/mix.cc
index f012e91673..cb6239728d 100644
--- a/libs/surfaces/push2/mix.cc
+++ b/libs/surfaces/push2/mix.cc
@@ -435,9 +435,9 @@ MixLayout::strip_vpot_touch (int n, bool touching)
boost::shared_ptr<AutomationControl> ac = stripable[n]->gain_control();
if (ac) {
if (touching) {
- ac->start_touch (session.audible_frame());
+ ac->start_touch (session.audible_sample());
} else {
- ac->stop_touch (session.audible_frame());
+ ac->stop_touch (session.audible_sample());
}
}
}
diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc
index b7f721ff91..763a136270 100644
--- a/libs/surfaces/push2/push2.cc
+++ b/libs/surfaces/push2/push2.cc
@@ -181,7 +181,7 @@ Push2::begin_using_device ()
{
DEBUG_TRACE (DEBUG::Push2, "begin using device\n");
- /* set up periodic task used to push a frame buffer to the
+ /* set up periodic task used to push a sample buffer to the
* device (25fps). The device can handle 60fps, but we don't
* need that frame rate.
*/
@@ -560,7 +560,7 @@ Push2::midi_input_handler (IOCondition ioc, MIDI::Port* port)
DEBUG_TRACE (DEBUG::Push2, string_compose ("data available on %1\n", port->name()));
if (in_use) {
- framepos_t now = AudioEngine::instance()->sample_time();
+ samplepos_t now = AudioEngine::instance()->sample_time();
port->parse (now);
}
}
@@ -1076,9 +1076,9 @@ Push2::other_vpot_touch (int n, bool touching)
boost::shared_ptr<AutomationControl> ac = master->gain_control();
if (ac) {
if (touching) {
- ac->start_touch (session->audible_frame());
+ ac->start_touch (session->audible_sample());
} else {
- ac->stop_touch (session->audible_frame());
+ ac->stop_touch (session->audible_sample());
}
}
}
diff --git a/libs/surfaces/push2/track_mix.cc b/libs/surfaces/push2/track_mix.cc
index a12ca84cf0..a213e204ea 100644
--- a/libs/surfaces/push2/track_mix.cc
+++ b/libs/surfaces/push2/track_mix.cc
@@ -570,9 +570,9 @@ TrackMixLayout::strip_vpot_touch (int n, bool touching)
boost::shared_ptr<AutomationControl> ac = knobs[n]->controllable();
if (ac) {
if (touching) {
- ac->start_touch (session.audible_frame());
+ ac->start_touch (session.audible_sample());
} else {
- ac->stop_touch (session.audible_frame());
+ ac->stop_touch (session.audible_sample());
}
}
}
@@ -590,7 +590,7 @@ TrackMixLayout::update_meters ()
void
TrackMixLayout::update_clocks ()
{
- framepos_t pos = session.audible_frame();
+ samplepos_t pos = session.audible_sample();
bool negative = false;
if (pos < 0) {
@@ -599,7 +599,7 @@ TrackMixLayout::update_clocks ()
}
char buf[16];
- Timecode::BBT_Time BBT = session.tempo_map().bbt_at_frame (pos);
+ Timecode::BBT_Time BBT = session.tempo_map().bbt_at_sample (pos);
#define BBT_BAR_CHAR "|"
@@ -613,22 +613,22 @@ TrackMixLayout::update_clocks ()
bbt_text->set (buf);
- framecnt_t left;
+ samplecnt_t left;
int hrs;
int mins;
int secs;
int millisecs;
- const double frame_rate = session.frame_rate ();
+ const double sample_rate = session.sample_rate ();
left = pos;
- hrs = (int) floor (left / (frame_rate * 60.0f * 60.0f));
- left -= (framecnt_t) floor (hrs * frame_rate * 60.0f * 60.0f);
- mins = (int) floor (left / (frame_rate * 60.0f));
- left -= (framecnt_t) floor (mins * frame_rate * 60.0f);
- secs = (int) floor (left / (float) frame_rate);
- left -= (framecnt_t) floor ((double)(secs * frame_rate));
- millisecs = floor (left * 1000.0 / (float) frame_rate);
+ hrs = (int) floor (left / (sample_rate * 60.0f * 60.0f));
+ left -= (samplecnt_t) floor (hrs * sample_rate * 60.0f * 60.0f);
+ mins = (int) floor (left / (sample_rate * 60.0f));
+ left -= (samplecnt_t) floor (mins * sample_rate * 60.0f);
+ secs = (int) floor (left / (float) sample_rate);
+ left -= (samplecnt_t) floor ((double)(secs * sample_rate));
+ millisecs = floor (left * 1000.0 / (float) sample_rate);
if (negative) {
snprintf (buf, sizeof (buf), "-%02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs);
diff --git a/libs/surfaces/tranzport/button_events.cc b/libs/surfaces/tranzport/button_events.cc
index ebc00f95be..bac2a218e5 100644
--- a/libs/surfaces/tranzport/button_events.cc
+++ b/libs/surfaces/tranzport/button_events.cc
@@ -243,7 +243,7 @@ TranzportControlProtocol::button_event_prev_release (bool shifted)
}
// Note - add_marker should adhere to the snap to setting
-// maybe session->audible_frame does that
+// maybe session->audible_sample does that
void
TranzportControlProtocol::button_event_add_press (bool shifted)
diff --git a/libs/surfaces/tranzport/general.cc b/libs/surfaces/tranzport/general.cc
index 2b39aaa2d7..f92d6997be 100644
--- a/libs/surfaces/tranzport/general.cc
+++ b/libs/surfaces/tranzport/general.cc
@@ -181,7 +181,7 @@ TranzportControlProtocol::update_state ()
void
TranzportControlProtocol::prev_marker ()
{
- Location *location = session->locations()->first_location_before (session->transport_frame());
+ Location *location = session->locations()->first_location_before (session->transport_sample());
if (location) {
session->request_locate (location->start(), session->transport_rolling());
@@ -196,13 +196,13 @@ TranzportControlProtocol::prev_marker ()
void
TranzportControlProtocol::next_marker ()
{
- Location *location = session->locations()->first_location_after (session->transport_frame());
+ Location *location = session->locations()->first_location_after (session->transport_sample());
if (location) {
session->request_locate (location->start(), session->transport_rolling());
notify(location->name().c_str());
} else {
- session->request_locate (session->current_end_frame());
+ session->request_locate (session->current_end_sample());
notify("END ");
}
}
diff --git a/libs/surfaces/tranzport/init.cc b/libs/surfaces/tranzport/init.cc
index 96ff493c0e..56501b2c2c 100644
--- a/libs/surfaces/tranzport/init.cc
+++ b/libs/surfaces/tranzport/init.cc
@@ -123,7 +123,7 @@ TranzportControlProtocol::TranzportControlProtocol (Session& s)
_device_status = STATUS_OFFLINE;
udev = 0;
current_track_id = 0;
- last_where = max_frames;
+ last_where = max_samples;
wheel_mode = WheelTimeline;
wheel_shift_mode = WheelShiftGain;
wheel_increment = WheelIncrScreen;
diff --git a/libs/surfaces/tranzport/show.cc b/libs/surfaces/tranzport/show.cc
index 027665ef4a..027485b944 100644
--- a/libs/surfaces/tranzport/show.cc
+++ b/libs/surfaces/tranzport/show.cc
@@ -284,7 +284,7 @@ TranzportControlProtocol::show_meter ()
}
void
-TranzportControlProtocol::show_bbt (framepos_t where)
+TranzportControlProtocol::show_bbt (samplepos_t where)
{
if (where != last_where) {
char buf[16];
@@ -348,11 +348,11 @@ TranzportControlProtocol::show_bbt (framepos_t where)
void
TranzportControlProtocol::show_transport_time ()
{
- show_bbt (session->transport_frame ());
+ show_bbt (session->transport_sample ());
}
void
-TranzportControlProtocol::show_timecode (framepos_t where)
+TranzportControlProtocol::show_timecode (samplepos_t where)
{
if ((where != last_where) || lcd_isdamaged(1,9,10)) {
diff --git a/libs/surfaces/tranzport/tranzport_control_protocol.h b/libs/surfaces/tranzport/tranzport_control_protocol.h
index 32d88aaf5e..95def2bc6e 100644
--- a/libs/surfaces/tranzport/tranzport_control_protocol.h
+++ b/libs/surfaces/tranzport/tranzport_control_protocol.h
@@ -192,8 +192,8 @@ private:
uint32_t last_hrs;
uint32_t last_mins;
uint32_t last_secs;
- uint32_t last_frames;
- framepos_t last_where;
+ uint32_t last_samples;
+ samplepos_t last_where;
ARDOUR::gain_t last_track_gain;
uint32_t last_meter_fill;
struct timeval last_wheel_motion;
@@ -301,8 +301,8 @@ private:
void show_current_track ();
void show_track_gain ();
void show_transport_time ();
- void show_bbt (framepos_t where);
- void show_timecode (framepos_t where);
+ void show_bbt (samplepos_t where);
+ void show_timecode (samplepos_t where);
void show_wheel_mode ();
void show_gain ();
void show_pan ();
diff --git a/libs/timecode/src/time.cc b/libs/timecode/src/time.cc
index b833878255..7d3815f858 100644
--- a/libs/timecode/src/time.cc
+++ b/libs/timecode/src/time.cc
@@ -30,7 +30,7 @@ namespace Timecode {
double Time::default_rate = 30.0;
-/** Increment @a timecode by exactly one frame (keep subframes value).
+/** Increment @a timecode by exactly one sample (keep subframes value).
* Realtime safe.
* @return true if seconds wrap.
*/
@@ -117,7 +117,7 @@ increment (Time& timecode, uint32_t subframes_per_frame)
}
-/** Decrement @a timecode by exactly one frame (keep subframes value)
+/** Decrement @a timecode by exactly one sample (keep subframes value)
* Realtime safe.
* @return true if seconds wrap. */
Wrap
@@ -204,9 +204,9 @@ decrement (Time& timecode, uint32_t subframes_per_frame)
}
-/** Go to lowest absolute subframe value in this frame (set to 0 :-)) */
+/** Go to lowest absolute subframe value in this sample (set to 0 :-)) */
void
-frames_floor (Time& timecode)
+frames_floot (Time& timecode)
{
timecode.subframes = 0;
if (Timecode_IS_ZERO (timecode)) {
@@ -274,25 +274,25 @@ decrement_subframes (Time& timecode, uint32_t subframes_per_frame)
}
-/** Go to next whole second (frames == 0 or frames == 2) */
+/** Go to next whole second (samples == 0 or samples == 2) */
Wrap
increment_seconds (Time& timecode, uint32_t subframes_per_frame)
{
Wrap wrap = NONE;
// Clear subframes
- frames_floor (timecode);
+ frames_floot (timecode);
if (timecode.negative) {
// Wrap second if on second boundary
wrap = increment (timecode, subframes_per_frame);
- // Go to lowest absolute frame value
+ // Go to lowest absolute sample value
seconds_floor (timecode);
if (Timecode_IS_ZERO (timecode)) {
timecode.negative = false;
}
} else {
- // Go to highest possible frame in this second
+ // Go to highest possible sample in this second
switch ((int)ceil (timecode.rate)) {
case 24:
timecode.frames = 23;
@@ -308,7 +308,7 @@ increment_seconds (Time& timecode, uint32_t subframes_per_frame)
break;
}
- // Increment by one frame
+ // Increment by one sample
wrap = increment (timecode, subframes_per_frame);
}
@@ -316,15 +316,15 @@ increment_seconds (Time& timecode, uint32_t subframes_per_frame)
}
-/** Go to lowest (absolute) frame value in this second
+/** Go to lowest (absolute) sample value in this second
* Doesn't care about positive/negative */
void
seconds_floor (Time& timecode)
{
// Clear subframes
- frames_floor (timecode);
+ frames_floot (timecode);
- // Go to lowest possible frame in this second
+ // Go to lowest possible sample in this second
switch ((int)ceil (timecode.rate)) {
case 24:
case 25:
@@ -348,14 +348,14 @@ seconds_floor (Time& timecode)
}
-/** Go to next whole minute (seconds == 0, frames == 0 or frames == 2) */
+/** Go to next whole minute (seconds == 0, samples == 0 or samples == 2) */
Wrap
increment_minutes (Time& timecode, uint32_t subframes_per_frame)
{
Wrap wrap = NONE;
// Clear subframes
- frames_floor (timecode);
+ frames_floot (timecode);
if (timecode.negative) {
// Wrap if on minute boundary
@@ -379,7 +379,7 @@ minutes_floor (Time& timecode)
{
// Go to lowest possible second
timecode.seconds = 0;
- // Go to lowest possible frame
+ // Go to lowest possible sample
seconds_floor (timecode);
if (Timecode_IS_ZERO (timecode)) {
@@ -388,14 +388,14 @@ minutes_floor (Time& timecode)
}
-/** Go to next whole hour (minute = 0, second = 0, frame = 0) */
+/** Go to next whole hour (minute = 0, second = 0, sample = 0) */
Wrap
increment_hours (Time& timecode, uint32_t subframes_per_frame)
{
Wrap wrap = NONE;
// Clear subframes
- frames_floor (timecode);
+ frames_floot (timecode);
if (timecode.negative) {
// Wrap if on hour boundary
@@ -612,14 +612,14 @@ std::string timecode_format_time (Timecode::Time TC)
std::string timecode_format_sampletime (
int64_t sample,
- double sample_frame_rate,
+ double sample_sample_rate,
double timecode_frames_per_second, bool timecode_drop_frames)
{
Time t;
sample_to_timecode(
sample, t, false, false,
timecode_frames_per_second, timecode_drop_frames,
- sample_frame_rate,
+ sample_sample_rate,
80, false, 0);
return timecode_format_time(t);
}
@@ -647,30 +647,30 @@ timecode_to_sample(
Timecode::Time& timecode, int64_t& sample,
bool use_offset, bool use_subframes,
/* Note - framerate info is taken from Timecode::Time& */
- double sample_frame_rate /**< may include pull up/down */,
+ double sample_sample_rate /**< may include pull up/down */,
uint32_t subframes_per_frame,
/* optional offset - can be improved: function pointer to lazily query this*/
bool offset_is_negative, int64_t offset_samples
)
{
- const double samples_per_timecode_frame = (double) sample_frame_rate / (double) timecode.rate;
+ const double samples_per_timecode_frame = (double) sample_sample_rate / (double) timecode.rate;
if (timecode.drop) {
- // The drop frame format was created to better approximate the 30000/1001 = 29.97002997002997....
- // framerate of NTSC color TV. The used frame rate of drop frame is 29.97, which drifts by about
- // 0.108 frame per hour, or about 1.3 frames per 12 hours. This is not perfect, but a lot better
- // than using 30 non drop, which will drift with about 1.8 frame per minute.
- // Using 29.97, drop frame real time can be accurate only every 10th minute (10 minutes of 29.97 fps
- // is exactly 17982 frames). One minute is 1798.2 frames, but we count 30 frames per second
+ // The drop sample format was created to better approximate the 30000/1001 = 29.97002997002997....
+ // framerate of NTSC color TV. The used frame rate of drop sample is 29.97, which drifts by about
+ // 0.108 sample per hour, or about 1.3 samples per 12 hours. This is not perfect, but a lot better
+ // than using 30 non drop, which will drift with about 1.8 sample per minute.
+ // Using 29.97, drop sample real time can be accurate only every 10th minute (10 minutes of 29.97 fps
+ // is exactly 17982 samples). One minute is 1798.2 samples, but we count 30 samples per second
// (30 * 60 = 1800). This means that at the first minute boundary (at the end of 0:0:59:29) we
- // are 1.8 frames too late relative to real time. By dropping 2 frames (jumping to 0:1:0:2) we are
- // approx. 0.2 frames too early. This adds up with 0.2 too early for each minute until we are 1.8
- // frames too early at 0:9:0:2 (9 * 0.2 = 1.8). The 10th minute brings us 1.8 frames later again
+ // are 1.8 samples too late relative to real time. By dropping 2 samples (jumping to 0:1:0:2) we are
+ // approx. 0.2 samples too early. This adds up with 0.2 too early for each minute until we are 1.8
+ // samples too early at 0:9:0:2 (9 * 0.2 = 1.8). The 10th minute brings us 1.8 samples later again
// (at end of 0:9:59:29), which sums up to 0 (we are back to zero at 0:10:0:0 :-).
//
// In table form:
//
- // Timecode value frames offset subframes offset seconds (rounded) 44100 sample (rounded)
+ // Timecode value samples offset subframes offset seconds (rounded) 44100 sample (rounded)
// 0:00:00:00 0.0 0 0.000 0 (accurate)
// 0:00:59:29 1.8 144 60.027 2647177
// 0:01:00:02 -0.2 -16 60.060 2648648
@@ -707,13 +707,13 @@ timecode_to_sample(
+ fps_i * 60 * timecode.minutes
+ fps_i * timecode.seconds + timecode.frames
- 2 * (totalMinutes - totalMinutes / 10);
- sample = frameNumber * sample_frame_rate / (double) timecode.rate;
+ sample = frameNumber * sample_sample_rate / (double) timecode.rate;
} else {
/*
Non drop is easy.. just note the use of
rint(timecode.rate) * samples_per_timecode_frame
- (frames per Timecode second), which is larger than
- frame_rate() in the non-integer Timecode rate case.
+ (samples per Timecode second), which is larger than
+ sample_rate() in the non-integer Timecode rate case.
*/
sample = (int64_t) rint(
@@ -760,7 +760,7 @@ sample_to_timecode (
/* framerate info */
double timecode_frames_per_second,
bool timecode_drop_frames,
- double sample_frame_rate/**< can include pull up/down */,
+ double sample_sample_rate/**< can include pull up/down */,
uint32_t subframes_per_frame,
/* optional offset - can be improved: function pointer to lazily query this*/
bool offset_is_negative, int64_t offset_samples
@@ -787,14 +787,14 @@ sample_to_timecode (
}
if (timecode_drop_frames) {
- int64_t frameNumber = floor( (double)offset_sample * timecode_frames_per_second / sample_frame_rate);
+ int64_t frameNumber = floor( (double)offset_sample * timecode_frames_per_second / sample_sample_rate);
- /* there are 17982 frames in 10 min @ 29.97df */
+ /* there are 17982 samples in 10 min @ 29.97df */
const int64_t D = frameNumber / 17982;
const int64_t M = frameNumber % 17982;
timecode.subframes = rint(subframes_per_frame
- * ((double)offset_sample * timecode_frames_per_second / sample_frame_rate - (double)frameNumber));
+ * ((double)offset_sample * timecode_frames_per_second / sample_sample_rate - (double)frameNumber));
if (timecode.subframes == subframes_per_frame) {
timecode.subframes = 0;
@@ -812,7 +812,7 @@ sample_to_timecode (
double timecode_frames_left_exact;
double timecode_frames_fraction;
int64_t timecode_frames_left;
- const double samples_per_timecode_frame = sample_frame_rate / timecode_frames_per_second;
+ const double samples_per_timecode_frame = sample_sample_rate / timecode_frames_per_second;
const int64_t frames_per_hour = (int64_t)(3600. * rint(timecode_frames_per_second) * samples_per_timecode_frame);
timecode.hours = offset_sample / frames_per_hour;
@@ -839,7 +839,7 @@ sample_to_timecode (
if (!use_subframes) {
timecode.subframes = 0;
}
- /* set frame rate and drop frame */
+ /* set frame rate and drop sample */
timecode.rate = timecode_frames_per_second;
timecode.drop = timecode_drop_frames;
}
diff --git a/libs/timecode/timecode/time.h b/libs/timecode/timecode/time.h
index 100b5d30d8..556b73b625 100644
--- a/libs/timecode/timecode/time.h
+++ b/libs/timecode/timecode/time.h
@@ -55,7 +55,7 @@ struct LIBTIMECODE_API Time {
uint32_t hours;
uint32_t minutes;
uint32_t seconds;
- uint32_t frames; ///< Timecode frames (not audio samples)
+ uint32_t frames; ///< Timecode frames (not audio frames)
uint32_t subframes; ///< Typically unused
double rate; ///< Frame rate of this Time
static double default_rate; ///< Rate to use for default constructor
@@ -98,7 +98,7 @@ Wrap LIBTIMECODE_API decrement_subframes (Time& timecode, uint32_t);
Wrap LIBTIMECODE_API increment_seconds (Time& timecode, uint32_t);
Wrap LIBTIMECODE_API increment_minutes (Time& timecode, uint32_t);
Wrap LIBTIMECODE_API increment_hours (Time& timecode, uint32_t);
-void LIBTIMECODE_API frames_floor (Time& timecode);
+void LIBTIMECODE_API frames_floot (Time& timecode);
void LIBTIMECODE_API seconds_floor (Time& timecode);
void LIBTIMECODE_API minutes_floor (Time& timecode);
void LIBTIMECODE_API hours_floor (Time& timecode);
@@ -112,7 +112,7 @@ std::string LIBTIMECODE_API timecode_format_time (Timecode::Time const timecode)
std::string LIBTIMECODE_API timecode_format_sampletime (
int64_t sample,
- double sample_frame_rate,
+ double sample_sample_rate,
double timecode_frames_per_second, bool timecode_drop_frames
);
@@ -122,7 +122,7 @@ void LIBTIMECODE_API timecode_to_sample(
Timecode::Time& timecode, int64_t& sample,
bool use_offset, bool use_subframes,
/* Note - framerate info is taken from Timecode::Time& */
- double sample_frame_rate /**< may include pull up/down */,
+ double sample_sample_rate /**< may include pull up/down */,
uint32_t subframes_per_frame /**< must not be 0 if use_subframes==true */,
/* optional offset - can be improved: function pointer to lazily query this*/
bool offset_is_negative, int64_t offset_samples
@@ -134,7 +134,7 @@ void LIBTIMECODE_API sample_to_timecode (
/* framerate info */
double timecode_frames_per_second,
bool timecode_drop_frames,
- double sample_frame_rate/**< can include pull up/down */,
+ double sample_sample_rate/**< can include pull up/down */,
uint32_t subframes_per_frame,
/* optional offset - can be improved: function pointer to lazily query this*/
bool offset_is_negative, int64_t offset_samples
diff --git a/libs/waveview/wave_view.cc b/libs/waveview/wave_view.cc
index e794dd48a3..7b7f7c28eb 100644
--- a/libs/waveview/wave_view.cc
+++ b/libs/waveview/wave_view.cc
@@ -848,7 +848,7 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* peaks
context->fill ();
}
-framecnt_t
+samplecnt_t
WaveView::optimal_image_width_samples () const
{
/* Compute how wide the image should be in samples.
@@ -865,15 +865,15 @@ WaveView::optimal_image_width_samples () const
* the canvas that are the width of the canvas then we don't want to have to
* draw the images for them all at once as it will cause a spike in render
* time, or in threaded rendering mode it will mean all the draw requests will
- * the queued during the same frame/expose event. This issue can be
+ * the queued during the same sample/expose event. This issue can be
* alleviated by using an element of randomness in selecting the image width.
*
* If the value of samples per pixel is less than 1/10th of a second, use
* 1/10th of a second instead.
*/
- framecnt_t canvas_width_samples = _canvas->visible_area().width() * _props->samples_per_pixel;
- const framecnt_t one_tenth_of_second = _region->session().frame_rate() / 10;
+ samplecnt_t canvas_width_samples = _canvas->visible_area().width() * _props->samples_per_pixel;
+ const samplecnt_t one_tenth_of_second = _region->session().sample_rate() / 10;
/* If zoomed in where a canvas item interects with the canvas area but
* stretches for many pages either side, to avoid having draw all images when
@@ -904,11 +904,11 @@ WaveView::optimal_image_width_samples () const
const double cairo_image_limit = 32767.0;
const double max_image_width = cairo_image_limit / max_multiplier;
- framecnt_t max_width_samples = floor (max_image_width / _props->samples_per_pixel);
+ samplecnt_t max_width_samples = floor (max_image_width / _props->samples_per_pixel);
- const framecnt_t one_tenth_of_second_limited = std::min (one_tenth_of_second, max_width_samples);
+ const samplecnt_t one_tenth_of_second_limited = std::min (one_tenth_of_second, max_width_samples);
- framecnt_t new_sample_count = std::max (canvas_width_samples, one_tenth_of_second_limited);
+ samplecnt_t new_sample_count = std::max (canvas_width_samples, one_tenth_of_second_limited);
const double multiplier = g_random_double_range (min_multiplier, max_multiplier);
@@ -948,7 +948,7 @@ WaveView::process_draw_request (boost::shared_ptr<WaveViewDrawRequest> req)
the Region itself.
*/
- framecnt_t peaks_read =
+ samplecnt_t peaks_read =
region->read_peaks (peaks.get (), n_peaks, props.get_sample_start (),
props.get_length_samples (), props.channel, props.samples_per_pixel);
@@ -976,7 +976,7 @@ WaveView::process_draw_request (boost::shared_ptr<WaveViewDrawRequest> req)
const double amplitude_above_axis = props.amplitude_above_axis;
if (amplitude_above_axis != 1.0) {
- for (framecnt_t i = 0; i < n_peaks; ++i) {
+ for (samplecnt_t i = 0; i < n_peaks; ++i) {
peaks[i].max *= amplitude_above_axis;
peaks[i].min *= amplitude_above_axis;
}
@@ -1325,20 +1325,20 @@ WaveView::set_global_logscaled (bool yn)
}
}
-framecnt_t
+samplecnt_t
WaveView::region_length() const
{
return _region->length() - (_props->region_start - _region->start());
}
-framepos_t
+samplepos_t
WaveView::region_end() const
{
return _props->region_start + region_length();
}
void
-WaveView::set_region_start (frameoffset_t start)
+WaveView::set_region_start (sampleoffset_t start)
{
if (!_region) {
return;
diff --git a/libs/waveview/waveview/wave_view.h b/libs/waveview/waveview/wave_view.h
index 4b1c8eb42b..32fc97c85e 100644
--- a/libs/waveview/waveview/wave_view.h
+++ b/libs/waveview/waveview/wave_view.h
@@ -86,7 +86,7 @@ public:
void set_samples_per_pixel (double);
void set_height (ArdourCanvas::Distance);
void set_channel (int);
- void set_region_start (ARDOUR::frameoffset_t);
+ void set_region_start (ARDOUR::sampleoffset_t);
/** Change the first position drawn by @param pixels.
* @param pixels must be positive. This is used by
@@ -177,13 +177,13 @@ private:
* but if region_start has been reset, then we need to use this modified
* computation.
*/
- ARDOUR::framecnt_t region_length () const;
+ ARDOUR::samplecnt_t region_length () const;
/** Under almost conditions, this is going to return _region->start() +
* _region->length(), but if region_start has been reset, then we need to use
* this modified computation.
*/
- ARDOUR::framepos_t region_end () const;
+ ARDOUR::samplepos_t region_end () const;
/**
* _image stays non-null after the first time it is set
@@ -238,7 +238,7 @@ private:
boost::shared_ptr<WaveViewDrawRequest>);
static void draw_absent_image (Cairo::RefPtr<Cairo::ImageSurface>&, ARDOUR::PeakData*, int);
- ARDOUR::framecnt_t optimal_image_width_samples () const;
+ ARDOUR::samplecnt_t optimal_image_width_samples () const;
void set_image (boost::shared_ptr<WaveViewImage> img) const;
diff --git a/libs/waveview/waveview/wave_view_private.h b/libs/waveview/waveview/wave_view_private.h
index b1e5ace844..d3cf88c7e7 100644
--- a/libs/waveview/waveview/wave_view_private.h
+++ b/libs/waveview/waveview/wave_view_private.h
@@ -41,8 +41,8 @@ public: // ctors
public: // member variables
- framepos_t region_start;
- framepos_t region_end;
+ samplepos_t region_start;
+ samplepos_t region_end;
uint16_t channel;
double height;
double samples_per_pixel;
@@ -60,8 +60,8 @@ public: // member variables
private: // member variables
- framepos_t sample_start;
- framepos_t sample_end;
+ samplepos_t sample_start;
+ samplepos_t sample_end;
public: // methods
@@ -70,13 +70,13 @@ public: // methods
return (sample_end != 0 && samples_per_pixel != 0);
}
- void set_width_samples (ARDOUR::framecnt_t const width_samples)
+ void set_width_samples (ARDOUR::samplecnt_t const width_samples)
{
assert (is_valid());
assert (width_samples != 0);
- ARDOUR::framecnt_t half_width = width_samples / 2;
- framepos_t new_sample_start = std::max (region_start, get_center_sample () - half_width);
- framepos_t new_sample_end = std::min (get_center_sample () + half_width, region_end);
+ ARDOUR::samplecnt_t half_width = width_samples / 2;
+ samplepos_t new_sample_start = std::max (region_start, get_center_sample () - half_width);
+ samplepos_t new_sample_end = std::min (get_center_sample () + half_width, region_end);
assert (new_sample_start <= new_sample_end);
sample_start = new_sample_start;
sample_end = new_sample_end;
@@ -88,7 +88,7 @@ public: // methods
}
- void set_sample_offsets (framepos_t const start, framepos_t const end)
+ void set_sample_offsets (samplepos_t const start, samplepos_t const end)
{
assert (start <= end);
@@ -112,12 +112,12 @@ public: // methods
assert (sample_start <= sample_end);
}
- framepos_t get_sample_start () const
+ samplepos_t get_sample_start () const
{
return sample_start;
}
- framepos_t get_sample_end () const
+ samplepos_t get_sample_end () const
{
return sample_end;
}
@@ -129,18 +129,18 @@ public: // methods
* It is possible for the new sample positions to be past the region_end,
* so we have to do bounds checking/adjustment for this in set_sample_offsets.
*/
- framepos_t new_sample_start = region_start + (start_pixel * samples_per_pixel);
- framepos_t new_sample_end = region_start + (end_pixel * samples_per_pixel);
+ samplepos_t new_sample_start = region_start + (start_pixel * samples_per_pixel);
+ samplepos_t new_sample_end = region_start + (end_pixel * samples_per_pixel);
set_sample_offsets (new_sample_start, new_sample_end);
}
- ARDOUR::framecnt_t get_length_samples () const
+ ARDOUR::samplecnt_t get_length_samples () const
{
assert (sample_start <= sample_end);
return sample_end - sample_start;
}
- framepos_t get_center_sample ()
+ samplepos_t get_center_sample ()
{
return sample_start + (get_length_samples() / 2);
}
@@ -158,7 +158,7 @@ public: // methods
// region_start && start_shift??
}
- bool contains (framepos_t start, framepos_t end)
+ bool contains (samplepos_t start, samplepos_t end)
{
return (sample_start <= start && end <= sample_end);
}
diff --git a/nutemp/t.cc b/nutemp/t.cc
index 59d4dd5f9a..1b8b449d6f 100644
--- a/nutemp/t.cc
+++ b/nutemp/t.cc
@@ -154,13 +154,13 @@ TempoMetric::superclock_per_note_type_at_superclock (superclock_t sc) const
}
superclock_t
-TempoMetric::superclocks_per_grid (framecnt_t sr) const
+TempoMetric::superclocks_per_grid (samplecnt_t sr) const
{
return (superclock_ticks_per_second * Meter::note_value()) / (note_types_per_minute() / Tempo::note_type());
}
superclock_t
-TempoMetric::superclocks_per_bar (framecnt_t sr) const
+TempoMetric::superclocks_per_bar (samplecnt_t sr) const
{
return superclocks_per_grid (sr) * _divisions_per_bar;
}
@@ -275,7 +275,7 @@ It would be more accurate to substitute the work 'pulse' for 'beat' above.
*/
void
-TempoMetric::compute_c_superclock (framecnt_t sr, superclock_t end_scpqn, superclock_t superclock_duration)
+TempoMetric::compute_c_superclock (samplecnt_t sr, superclock_t end_scpqn, superclock_t superclock_duration)
{
if ((superclocks_per_quarter_note() == end_scpqn) || !ramped()) {
_c_per_superclock = 0.0;
@@ -285,7 +285,7 @@ TempoMetric::compute_c_superclock (framecnt_t sr, superclock_t end_scpqn, superc
_c_per_superclock = log ((double) superclocks_per_quarter_note () / end_scpqn) / superclock_duration;
}
void
-TempoMetric::compute_c_quarters (framecnt_t sr, superclock_t end_scpqn, Evoral::Beats const & quarter_duration)
+TempoMetric::compute_c_quarters (samplecnt_t sr, superclock_t end_scpqn, Evoral::Beats const & quarter_duration)
{
if ((superclocks_per_quarter_note () == end_scpqn) || !ramped()) {
_c_per_quarter = 0.0;
@@ -354,7 +354,7 @@ TempoMapPoint::bbt_at (Evoral::Beats const & qn) const
return metric().bbt_add (_bbt, Timecode::BBT_Offset (0, 0, ticks_delta));
}
-TempoMap::TempoMap (Tempo const & initial_tempo, Meter const & initial_meter, framecnt_t sr)
+TempoMap::TempoMap (Tempo const & initial_tempo, Meter const & initial_meter, samplecnt_t sr)
: _sample_rate (sr)
, _dirty (false)
{
@@ -1099,7 +1099,7 @@ TempoMap::superclock_at_locked (Timecode::BBT_Time const & bbt) const
}
void
-TempoMap::set_sample_rate (framecnt_t new_sr)
+TempoMap::set_sample_rate (samplecnt_t new_sr)
{
//Glib::Threads::RWLock::ReaderLock lm (_lock);
double ratio = new_sr / (double) _sample_rate;
diff --git a/nutemp/t.h b/nutemp/t.h
index b734dcead8..1004f46a4c 100644
--- a/nutemp/t.h
+++ b/nutemp/t.h
@@ -117,11 +117,11 @@ class LIBARDOUR_API TempoMetric : public Tempo, public Meter {
double c_per_superclock () const { return _c_per_superclock; }
double c_per_quarter () const { return _c_per_quarter; }
- void compute_c_superclock (framecnt_t sr, superclock_t end_superclocks_per_note_type, superclock_t duration);
- void compute_c_quarters (framecnt_t sr, superclock_t end_superclocks_per_note_type, Evoral::Beats const & duration);
+ void compute_c_superclock (samplecnt_t sr, superclock_t end_superclocks_per_note_type, superclock_t duration);
+ void compute_c_quarters (samplecnt_t sr, superclock_t end_superclocks_per_note_type, Evoral::Beats const & duration);
- superclock_t superclocks_per_bar (framecnt_t sr) const;
- superclock_t superclocks_per_grid (framecnt_t sr) const;
+ superclock_t superclocks_per_bar (samplecnt_t sr) const;
+ superclock_t superclocks_per_grid (samplecnt_t sr) const;
superclock_t superclock_at_qn (Evoral::Beats const & qn) const;
superclock_t superclock_per_note_type_at_superclock (superclock_t) const;
@@ -224,8 +224,8 @@ class LIBARDOUR_API TempoMapPoint
TempoMetric const & metric() const { return is_explicit() ? _explicit.metric : _reference->metric(); }
PositionLockStyle lock_style() const { return is_explicit() ? _explicit.lock_style : _reference->lock_style(); }
- void compute_c_superclock (framecnt_t sr, superclock_t end_superclocks_per_note_type, superclock_t duration) { if (is_explicit()) { _explicit.metric.compute_c_superclock (sr, end_superclocks_per_note_type, duration); } }
- void compute_c_quarters (framecnt_t sr, superclock_t end_superclocks_per_note_type, Evoral::Beats const & duration) { if (is_explicit()) { _explicit.metric.compute_c_quarters (sr, end_superclocks_per_note_type, duration); } }
+ void compute_c_superclock (samplecnt_t sr, superclock_t end_superclocks_per_note_type, superclock_t duration) { if (is_explicit()) { _explicit.metric.compute_c_superclock (sr, end_superclocks_per_note_type, duration); } }
+ void compute_c_quarters (samplecnt_t sr, superclock_t end_superclocks_per_note_type, Evoral::Beats const & duration) { if (is_explicit()) { _explicit.metric.compute_c_quarters (sr, end_superclocks_per_note_type, duration); } }
/* None of these properties can be set for an Implicit point, because
* they are determined by the TempoMapPoint pointed to by _reference.
@@ -301,12 +301,12 @@ typedef std::list<TempoMapPoint> TempoMapPoints;
class LIBARDOUR_API TempoMap
{
public:
- TempoMap (Tempo const & initial_tempo, Meter const & initial_meter, framecnt_t sr);
+ TempoMap (Tempo const & initial_tempo, Meter const & initial_meter, samplecnt_t sr);
void set_dirty (bool yn);
- void set_sample_rate (framecnt_t sr);
- framecnt_t sample_rate() const { return _sample_rate; }
+ void set_sample_rate (samplecnt_t sr);
+ samplecnt_t sample_rate() const { return _sample_rate; }
void remove_explicit_point (superclock_t);
@@ -367,7 +367,7 @@ class LIBARDOUR_API TempoMap
private:
TempoMapPoints _points;
- framecnt_t _sample_rate;
+ samplecnt_t _sample_rate;
mutable Glib::Threads::RWLock _lock;
bool _dirty;
diff --git a/session_utils/export.cc b/session_utils/export.cc
index eae41fced8..5b89434cb6 100644
--- a/session_utils/export.cc
+++ b/session_utils/export.cc
@@ -90,13 +90,13 @@ static int export_session (Session *session,
" <Start>"
" <Trim enabled=\"false\"/>"
" <Add enabled=\"false\">"
-" <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" frames=\"0\"/>"
+" <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" samples=\"0\"/>"
" </Add>"
" </Start>"
" <End>"
" <Trim enabled=\"false\"/>"
" <Add enabled=\"false\">"
-" <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" frames=\"0\"/>"
+" <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" samples=\"0\"/>"
" </Add>"
" </End>"
" </Silence>"
@@ -107,9 +107,9 @@ static int export_session (Session *session,
boost::shared_ptr<ExportFormatSpecification> fmp = session->get_export_handler()->add_format(*tree.root());
/* set up range */
- framepos_t start, end;
- start = session->current_start_frame();
- end = session->current_end_frame();
+ samplepos_t start, end;
+ start = session->current_start_sample();
+ end = session->current_end_sample();
tsp->set_range (start, end);
tsp->set_range_id ("session");
@@ -172,7 +172,7 @@ static int export_session (Session *session,
printf ("* Normalizing %.1f%% \r", 100. * progress); fflush (stdout);
break;
case ExportStatus::Exporting:
- progress = ((float) status->processed_frames_current_timespan) / status->total_frames_current_timespan;
+ progress = ((float) status->processed_samples_current_timespan) / status->total_samples_current_timespan;
printf ("* Exporting Audio %.1f%% \r", 100. * progress); fflush (stdout);
break;
default:
@@ -310,7 +310,7 @@ int main (int argc, char* argv[])
s = SessionUtils::load_session (argv[optind], argv[optind+1]);
if (settings._samplerate == 0) {
- settings._samplerate = s->nominal_frame_rate ();
+ settings._samplerate = s->nominal_sample_rate ();
}
export_session (s, outfile, settings);
diff --git a/session_utils/fix_bbtppq.cc b/session_utils/fix_bbtppq.cc
index a5842ac700..443c1317c1 100644
--- a/session_utils/fix_bbtppq.cc
+++ b/session_utils/fix_bbtppq.cc
@@ -119,7 +119,7 @@ ensure_per_region_source (Session* session, boost::shared_ptr<MidiRegion> region
} else {
newsrc = boost::dynamic_pointer_cast<MidiSource>(
SourceFactory::createWritable(DataType::MIDI, *session,
- newsrc_path, false, session->frame_rate()));
+ newsrc_path, false, session->sample_rate()));
if (!newsrc) {
cout << UTILNAME << ":" << endl
@@ -174,7 +174,7 @@ ensure_per_source_source (Session* session, boost::shared_ptr<MidiRegion> region
newsrc = boost::dynamic_pointer_cast<MidiSource>(
SourceFactory::createWritable(DataType::MIDI, *session,
- newsrc_path, false, session->frame_rate()));
+ newsrc_path, false, session->sample_rate()));
if (!newsrc) {
cout << UTILNAME << ":" << endl
<<" An error occurred creating writeable source " << newsrc_path << " exiting." << endl;
@@ -211,8 +211,8 @@ reset_start (Session* session, boost::shared_ptr<MidiRegion> region)
/* force a change to start and start_beats */
PositionLockStyle old_pls = region->position_lock_style();
region->set_position_lock_style (AudioTime);
- region->set_start (tmap.frame_at_quarter_note (region->quarter_note()) - tmap.frame_at_quarter_note (region->quarter_note() - new_start_qn) + 1);
- region->set_start (tmap.frame_at_quarter_note (region->quarter_note()) - tmap.frame_at_quarter_note (region->quarter_note() - new_start_qn));
+ region->set_start (tmap.sample_at_quarter_note (region->quarter_note()) - tmap.sample_at_quarter_note (region->quarter_note() - new_start_qn) + 1);
+ region->set_start (tmap.sample_at_quarter_note (region->quarter_note()) - tmap.sample_at_quarter_note (region->quarter_note() - new_start_qn));
region->set_position_lock_style (old_pls);
}
@@ -228,8 +228,8 @@ reset_length (Session* session, boost::shared_ptr<MidiRegion> region)
/* force a change to length and length_beats */
PositionLockStyle old_pls = region->position_lock_style();
region->set_position_lock_style (AudioTime);
- region->set_length (tmap.frame_at_quarter_note (region->quarter_note() + new_length_qn) + 1 - region->position(), 0);
- region->set_length (tmap.frame_at_quarter_note (region->quarter_note() + new_length_qn)- region->position(), 0);
+ region->set_length (tmap.sample_at_quarter_note (region->quarter_note() + new_length_qn) + 1 - region->position(), 0);
+ region->set_length (tmap.sample_at_quarter_note (region->quarter_note() + new_length_qn)- region->position(), 0);
region->set_position_lock_style (old_pls);
}
diff --git a/tools/bb/bb.cc b/tools/bb/bb.cc
index 472edb19c5..cfeca9a7af 100644
--- a/tools/bb/bb.cc
+++ b/tools/bb/bb.cc
@@ -178,13 +178,13 @@ BeatBox::process (int nsamples)
clear_pending = false;
}
- framepos_t last_output_time = 0;
+ samplepos_t last_output_time = 0;
for (Events::iterator ee = _current_events.begin(); ee != _current_events.end(); ++ee) {
Event* e = (*ee);
if (e->size && (e->time >= process_start && e->time < process_end)) {
- framepos_t sample_offset_in_buffer = superclock_to_samples (offset + e->time - process_start, _sample_rate);
+ samplepos_t sample_offset_in_buffer = superclock_to_samples (offset + e->time - process_start, _sample_rate);
if ((buffer = jack_midi_event_reserve (out_buf, sample_offset_in_buffer, e->size)) != 0) {
memcpy (buffer, e->buf, e->size);
outbound_tracker.track (e->buf);
diff --git a/tools/omf/omftool.cc b/tools/omf/omftool.cc
index 68fc6bd83c..fc207fb6ce 100644
--- a/tools/omf/omftool.cc
+++ b/tools/omf/omftool.cc
@@ -68,7 +68,7 @@ OMF::OMF ()
session_name = "omfsession";
base_dir = ".";
sample_rate = 0;
- frame_rate = 0;
+ sample_rate = 0;
version = 3000;
db = 0;
file = 0;
@@ -675,15 +675,15 @@ OMF::create_xml ()
fread(&num, 4, 1, file);
num = e32(num);
INFO ("Rate = %d / %d\n", num, denom);
- if (frame_rate == 0) {
- frame_rate = (double) num / (double) denom;
+ if (sample_rate == 0) {
+ sample_rate = (double) num / (double) denom;
}
if (sample_rate == 0) {
sample_rate = denom;
}
} else {
INFO ("OMF file is missing frame rate information for track %d\n", i);
- frame_rate = 0.04; // 25FPS
+ sample_rate = 0.04; // 25FPS
if (sample_rate == 0) {
sample_rate = 44100;
}
@@ -706,7 +706,7 @@ OMF::create_xml ()
char **len;
int lenCount;
double length = 0.0;
- int lenFrames = 0;
+ int lenSamples = 0;
region = 0;
@@ -728,8 +728,8 @@ OMF::create_xml ()
continue;
}
- lenFrames = atoi(len[1]);
- length = lenFrames * frame_rate;
+ lenSamples = atoi(len[1]);
+ length = lenSamples * sample_rate;
if (!strcmp(type[1], "TRAN")) {
@@ -837,7 +837,7 @@ OMF::create_xml ()
region->add_property ("position", sbuf);
snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (length * sample_rate));
region->add_property ("length", sbuf);
- snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (start * frame_rate * sample_rate));
+ snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (start * sample_rate * sample_rate));
region->add_property ("start", sbuf);
set_region_sources (region, sinfo);
@@ -913,7 +913,7 @@ OMF::create_xml ()
region->add_property ("position", sbuf);
snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (length * sample_rate));
region->add_property ("length", sbuf);
- snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (start * frame_rate * sample_rate));
+ snprintf (sbuf, sizeof (sbuf), "%" PRId64, llrintf (start * sample_rate * sample_rate));
region->add_property ("start", sbuf);
set_region_sources (region, sinfo);
diff --git a/tools/omf/omftool.h b/tools/omf/omftool.h
index 9f16aec94f..f33bb5cb77 100644
--- a/tools/omf/omftool.h
+++ b/tools/omf/omftool.h
@@ -43,7 +43,7 @@ private:
std::string session_name;
std::vector<std::string> audiofile_path_vector;
int sample_rate; /* audio samples per second */
- double frame_rate; /* time per video frame */
+ double sample_rate; /* time per video frame */
XMLNode* session;
XMLNode* sources;
XMLNode* routes;
diff --git a/tools/sftest.cc b/tools/sftest.cc
index 0823277c60..aa9412cfa0 100644
--- a/tools/sftest.cc
+++ b/tools/sftest.cc
@@ -252,7 +252,7 @@ main (int argc, char* argv[])
cout << " all used " << (direct ? "without" : "with") << " OS buffer cache";
#endif
cout << endl;
- cout << "Format is " << suffix << ' ' << channels << " channel" << (channels > 1 ? "s" : "") << " written in chunks of " << block_size << " frames, synced ? " << (with_sync ? "yes" : "no") << endl;
+ cout << "Format is " << suffix << ' ' << channels << " channel" << (channels > 1 ? "s" : "") << " written in chunks of " << block_size << " samples, synced ? " << (with_sync ? "yes" : "no") << endl;
}
data = new float[block_size*channels];
@@ -286,7 +286,7 @@ main (int argc, char* argv[])
min_bandwidth = min (min_bandwidth, bandwidth);
if (!quiet) {
- cout << "BW @ " << written << " frames (" << ds.str() << " minutes) = " << (bandwidth/1048576.0) << " MB/sec " << bandwidth / data_rate << " x faster than necessary " << endl;
+ cout << "BW @ " << written << " samples (" << ds.str() << " minutes) = " << (bandwidth/1048576.0) << " MB/sec " << bandwidth / data_rate << " x faster than necessary " << endl;
}
}