Ardour  9.0-pre0-582-g084a23a80d
coreaudiosource.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2009 Taybin Rutkin <taybin@taybin.com>
3  * Copyright (C) 2006-2011 David Robillard <d@drobilla.net>
4  * Copyright (C) 2006-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2013 John Emmas <john@creativepost.co.uk>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #pragma once
23 
24 #include "CAExtAudioFile.h"
25 
26 #include "ardour/audiofilesource.h"
27 #include <string>
28 
29 namespace ARDOUR {
30 
32  public:
34  CoreAudioSource (ARDOUR::Session&, const std::string& path, int chn, Flag);
36 
37  void set_path (const std::string& p);
38 
39  float sample_rate() const;
40  int update_header (samplepos_t when, struct tm&, time_t);
41 
42  uint32_t channel_count () const { return n_channels; }
43 
44  int flush_header () {return 0;};
46  bool clamped_at_unity () const { return false; }
47 
48  void flush () {}
49 
50  static int get_soundfile_info (std::string path, SoundFileInfo& _info, std::string& error_msg);
51 
52  protected:
53  void close ();
55  samplecnt_t write_unlocked (Sample const * src, samplecnt_t) { return 0; }
56 
57  private:
58  mutable CAExtAudioFile af;
59  uint16_t n_channels;
60 
61  void init_cafile ();
62  int safe_read (Sample*, samplepos_t start, samplecnt_t cnt, AudioBufferList&) const;
63 };
64 
65 }; /* namespace ARDOUR */
66 
67 
uint32_t channel_count() const
void set_path(const std::string &p)
CoreAudioSource(ARDOUR::Session &, const std::string &path, int chn, Flag)
float sample_rate() const
int safe_read(Sample *, samplepos_t start, samplecnt_t cnt, AudioBufferList &) const
CoreAudioSource(ARDOUR::Session &, const XMLNode &)
samplecnt_t read_unlocked(Sample *dst, samplepos_t start, samplecnt_t cnt) const
static int get_soundfile_info(std::string path, SoundFileInfo &_info, std::string &error_msg)
int update_header(samplepos_t when, struct tm &, time_t)
samplecnt_t write_unlocked(Sample const *src, samplecnt_t)
bool clamped_at_unity() const
Definition: xml++.h:114
#define LIBARDOUR_API
PBD::PropertyDescriptor< timepos_t > start
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t