Mercurial > hg > svcore
comparison plugin/plugins/SamplePlayer.cpp @ 1359:1c9bbbb6116a 3.0-integration
Use W64 instead of WAV for decoded files; use Ogg reader in preference to WAV one for Ogg files (WAV reader works, via libsndfile, but doesn't load metadata); fix Ogg reader to use QFile open instead of non-Win32-compatible API; add more encoder tests, audio writer test, midi reader test
author | Chris Cannam |
---|---|
date | Tue, 10 Jan 2017 10:58:25 +0000 |
parents | 63b73a21bccd |
children | 49b43306778b |
comparison
equal
deleted
inserted
replaced
1358:b7be05d57f0a | 1359:1c9bbbb6116a |
---|---|
26 #include <cstdlib> | 26 #include <cstdlib> |
27 | 27 |
28 #include <QMutexLocker> | 28 #include <QMutexLocker> |
29 #include <QDir> | 29 #include <QDir> |
30 #include <QFileInfo> | 30 #include <QFileInfo> |
31 | |
32 #ifdef Q_OS_WIN | |
33 #include <windows.h> | |
34 #define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1 | |
35 #endif | |
31 | 36 |
32 #include <sndfile.h> | 37 #include <sndfile.h> |
33 #include <samplerate.h> | 38 #include <samplerate.h> |
34 #include <iostream> | 39 #include <iostream> |
35 | 40 |
393 size_t samples = 0; | 398 size_t samples = 0; |
394 float *tmpFrames, *tmpSamples, *tmpResamples, *tmpOld; | 399 float *tmpFrames, *tmpSamples, *tmpResamples, *tmpOld; |
395 size_t i; | 400 size_t i; |
396 | 401 |
397 info.format = 0; | 402 info.format = 0; |
403 #ifdef Q_OS_WIN | |
404 file = sf_wchar_open((LPCWSTR)path.utf16(), SFM_READ, &m_fileInfo); | |
405 #else | |
398 file = sf_open(path.toLocal8Bit().data(), SFM_READ, &info); | 406 file = sf_open(path.toLocal8Bit().data(), SFM_READ, &info); |
407 #endif | |
399 if (!file) { | 408 if (!file) { |
400 cerr << "SamplePlayer::loadSampleData: Failed to open file " | 409 cerr << "SamplePlayer::loadSampleData: Failed to open file " |
401 << path << ": " | 410 << path << ": " |
402 << sf_strerror(file) << endl; | 411 << sf_strerror(file) << endl; |
403 return; | 412 return; |