Ardour  9.0-pre0-582-g084a23a80d
sndfileimportable.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
4  * Copyright (C) 2010-2012 Carl Hetherington <carl@carlh.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
23 #include <memory>
24 
25 #include <sndfile.h>
27 #include "ardour/types.h"
29 
30 namespace ARDOUR {
31 
33 public:
34  SndFileImportableSource (const std::string& path);
36 
37  samplecnt_t read (Sample* buffer, samplecnt_t nframes);
38  uint32_t channels() const;
41  void seek (samplepos_t pos);
42  bool clamped_at_unity () const;
44 
45 protected:
46  SF_INFO sf_info;
47  std::shared_ptr<SNDFILE> in;
48 
49  /* these are int64_t so as to be independent of whatever
50  * types Ardour may use for samplepos_t, samplecnt_t etc.
51  */
52  int64_t timecode;
53  int64_t get_timecode_info (SNDFILE*, SF_BROADCAST_INFO*, bool&);
54 };
55 
56 }
57 
void seek(samplepos_t pos)
std::shared_ptr< SNDFILE > in
samplepos_t natural_position() const
int64_t get_timecode_info(SNDFILE *, SF_BROADCAST_INFO *, bool &)
samplecnt_t read(Sample *buffer, samplecnt_t nframes)
samplecnt_t samplerate() const
SndFileImportableSource(const std::string &path)
samplecnt_t length() const
#define LIBARDOUR_API
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t