forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoundsourcesndfile.h
59 lines (42 loc) · 1.32 KB
/
soundsourcesndfile.h
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 getSupportedFileTypes() const override;
SoundSourceProviderPriority getPriorityHint(
const QString& supportedFileType) const override;
SoundSourcePointer newSoundSource(const QUrl& url) override {
return newSoundSourceFromUrl<SoundSourceSndFile>(url);
}
private:
const QStringList m_supportedFileTypes;
};
} // namespace mixxx