forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoundsourcesndfile.h
53 lines (38 loc) · 1.24 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
#ifndef MIXXX_SOUNDSOURCESNDFILE_H
#define MIXXX_SOUNDSOURCESNDFILE_H
#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(
WritableSampleFrames sampleFrames) override;
private:
OpenResult tryOpen(
OpenMode mode,
const OpenParams& params) override;
SNDFILE* m_pSndFile;
SINT m_curFrameIndex;
};
class SoundSourceProviderSndFile : public SoundSourceProvider {
public:
QString getName() const override;
QStringList getSupportedFileExtensions() const override;
SoundSourceProviderPriority getPriorityHint(
const QString& supportedFileExtension) const override;
SoundSourcePointer newSoundSource(const QUrl& url) override {
return newSoundSourceFromUrl<SoundSourceSndFile>(url);
}
};
} // namespace mixxx
#endif // MIXXX_SOUNDSOURCESNDFILE_H