From 30b087ab3d28f1585987fa3f6ae006562ae192e3 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 18 Sep 2017 12:39:17 -0400 Subject: 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 --- libs/ardour/export_channel.cc | 60 +++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'libs/ardour/export_channel.cc') 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 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 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 & 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(); } -- cgit v1.2.3