File: sox_audio_source.h

package info (click to toggle)
chromaprint 0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,312 kB
  • sloc: cpp: 5,218; ansic: 632; python: 164; sh: 79; makefile: 14
file content (29 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef FP_SOX_AUDIO_SOURCE_H_
#define FP_SOX_AUDIO_SOURCE_H_

extern "C" {
#include <sox.h>
}
#include <string>

class SoxAudioSource {
public:
	SoxAudioSource(const std::string &file_name);
	virtual ~SoxAudioSource();

	bool Open();
	void Close();

	virtual int SampleRate();
	virtual int Channels();
	virtual std::size_t Length() { return format_->signal.length; }
	virtual std::size_t Read(short *buffer, std::size_t size);

private:
	static bool initialized_;
	std::string file_name_;
	sox_format_t *format_;
	sox_sample_t *buffer_;
};

#endif