add channel_count() to audio source API
This commit is contained in:
parent
9c95a8bdea
commit
04b2d34362
@ -73,7 +73,11 @@ class LIBARDOUR_API AudioRegion : public Region
|
||||
bool speed_mismatch (float) const;
|
||||
|
||||
boost::shared_ptr<AudioSource> audio_source (uint32_t n=0) const;
|
||||
|
||||
|
||||
// if several audio files associated with a region,
|
||||
// information about file with MAX channel count will be provided
|
||||
uint32_t get_related_audio_file_channel_count () const;
|
||||
|
||||
void set_scale_amplitude (gain_t);
|
||||
gain_t scale_amplitude() const { return _scale_amplitude; }
|
||||
|
||||
|
@ -39,6 +39,8 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource {
|
||||
float sample_rate() const;
|
||||
int update_header (framepos_t when, struct tm&, time_t);
|
||||
|
||||
uint32_t channel_count () const { return n_channels; }
|
||||
|
||||
int flush_header () {return 0;};
|
||||
void set_header_timeline_position () {};
|
||||
bool clamped_at_unity () const { return false; }
|
||||
|
@ -66,6 +66,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
|
||||
bool set_destructive (bool yn);
|
||||
|
||||
bool one_of_several_channels () const;
|
||||
uint32_t channel_count () const { return _info.channels; }
|
||||
|
||||
bool clamped_at_unity () const;
|
||||
|
||||
|
@ -49,6 +49,9 @@
|
||||
#include "ardour/parameter_descriptor.h"
|
||||
#include "ardour/progress.h"
|
||||
|
||||
#include "ardour/sndfilesource.h"
|
||||
#include "ardour/coreaudiosource.h"
|
||||
|
||||
#include "i18n.h"
|
||||
#include <locale.h>
|
||||
|
||||
@ -1562,6 +1565,34 @@ AudioRegion::audio_source (uint32_t n) const
|
||||
return boost::dynamic_pointer_cast<AudioSource>(source(n));
|
||||
}
|
||||
|
||||
uint32_t
|
||||
AudioRegion::get_related_audio_file_channel_count () const
|
||||
{
|
||||
uint32_t chan_count = 0;
|
||||
for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
|
||||
|
||||
boost::shared_ptr<SndFileSource> sndf = dynamic_pointer_cast<SndFileSource>(*i);
|
||||
if (sndf ) {
|
||||
|
||||
if (sndf->channel_count() > chan_count) {
|
||||
chan_count = sndf->channel_count();
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_COREAUDIO
|
||||
else {
|
||||
boost::shared_ptr<CoreAudioSource> cauf = dynamic_pointer_cast<CoreAudioSource>(*i);
|
||||
if (cauf) {
|
||||
if (cauf->channel_count() > chan_count) {
|
||||
chan_count = cauf->channel_count();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // HAVE_COREAUDIO
|
||||
}
|
||||
|
||||
return chan_count;
|
||||
}
|
||||
|
||||
int
|
||||
AudioRegion::adjust_transients (frameoffset_t delta)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user