finalize PROGRAM_NAME change for ardour3
[ardour.git] / libs / audiographer / audiographer / sndfile_reader.h
1 #ifndef AUDIOGRAPHER_SNDFILE_READER_H
2 #define AUDIOGRAPHER_SNDFILE_READER_H
3
4 #include "sndfile_base.h"
5 #include "listed_source.h"
6 #include "process_context.h"
7
8 namespace AudioGrapher
9 {
10
11 /** Reader for audio files using libsndfile.
12   * Once again only short, int and float are valid template parameters
13   */
14 template<typename T>
15 class SndfileReader : public virtual SndfileBase, public ListedSource<T>
16 {
17   public:
18           
19         enum SeekType {
20                 SeekBeginning = SEEK_SET, //< Seek from beginning of file
21                 SeekCurrent = SEEK_CUR, //< Seek from current position
22                 SeekEnd = SEEK_END //< Seek from end
23         };
24         
25   public:
26
27         SndfileReader (ChannelCount channels, nframes_t samplerate, int format, std::string path);
28         
29         nframes_t seek (nframes_t frames, SeekType whence);
30         nframes_t read (ProcessContext<T> & context);
31         
32   private:
33
34         void init(); // init read function
35         sf_count_t (*read_func)(SNDFILE *, T *, sf_count_t);
36 };
37
38 } // namespace
39
40 #endif // AUDIOGRAPHER_SNDFILE_READER_H