blob: 1958398ebf4fd8f37d853a93d553da19eb8b4ad6 (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#pragma once
#include "sources/soundsourceprovider.h"
#ifdef Q_OS_WIN
//Enable unicode in libsndfile on Windows
//(sf_open uses UTF-8 otherwise)
#include <windows.h>
#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
#endif
#include <sndfile.h>
namespace mixxx {
class SoundSourceSndFile final : public SoundSource {
public:
explicit SoundSourceSndFile(const QUrl& url);
~SoundSourceSndFile() override;
void close() override;
protected:
ReadableSampleFrames readSampleFramesClamped(
const WritableSampleFrames& sampleFrames) override;
private:
OpenResult tryOpen(
OpenMode mode,
const OpenParams& params) override;
SNDFILE* m_pSndFile;
SINT m_curFrameIndex;
};
class SoundSourceProviderSndFile : public SoundSourceProvider {
public:
static const QString kDisplayName;
SoundSourceProviderSndFile();
QString getDisplayName() const override {
return kDisplayName;
}
QStringList getSupportedFileExtensions() const override;
SoundSourceProviderPriority getPriorityHint(
const QString& supportedFileExtension) const override;
SoundSourcePointer newSoundSource(const QUrl& url) override {
return newSoundSourceFromUrl<SoundSourceSndFile>(url);
}
private:
const QStringList m_supportedFileExtensions;
};
} // namespace mixxx
|