Merge pull request #3264 from Toondad/master
No QtAudio device issue solved
This commit is contained in:
commit
c7ce1288f4
5 changed files with 59 additions and 25 deletions
|
@ -17,7 +17,7 @@ Building OpenToonz from source requires the following dependencies:
|
|||
### Installing Dependencies on Debian / Ubuntu
|
||||
|
||||
```
|
||||
$ sudo apt-get install build-essential git cmake pkg-config libboost-all-dev qt5-default qtbase5-dev libqt5svg5-dev qtscript5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtmultimedia5-dev libsuperlu-dev liblz4-dev libusb-1.0-0-dev liblzo2-dev libpng-dev libjpeg-dev libglew-dev freeglut3-dev libfreetype6-dev libjson-c-dev qtwayland5
|
||||
$ sudo apt-get install build-essential git cmake pkg-config libboost-all-dev qt5-default qtbase5-dev libqt5svg5-dev qtscript5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtmultimedia5-dev libsuperlu-dev liblz4-dev libusb-1.0-0-dev liblzo2-dev libpng-dev libjpeg-dev libglew-dev freeglut3-dev libfreetype6-dev libjson-c-dev qtwayland5 libqt5multimedia5-plugins
|
||||
```
|
||||
|
||||
For newest versions of OS you may install libmypaint from repository and don't need to build it from source:
|
||||
|
@ -33,7 +33,7 @@ Notes:
|
|||
(it may include some useless packages)
|
||||
|
||||
```
|
||||
$ sudo dnf install gcc gcc-c++ automake git cmake boost boost-devel SuperLU SuperLU-devel lz4-devel lzma libusb-devel lzo-devel libjpeg-turbo-devel libGLEW glew-devel freeglut-devel freeglut freetype-devel libpng-devel qt5-qtbase-devel qt5-qtsvg qt5-qtsvg-devel qt5-qtscript qt5-qtscript-devel qt5-qttools qt5-qttools-devel qt5-qtmultimedia-devel blas blas-devel json-c-devel libtool intltool make
|
||||
$ sudo dnf install gcc gcc-c++ automake git cmake boost boost-devel SuperLU SuperLU-devel lz4-devel lzma libusb-devel lzo-devel libjpeg-turbo-devel libGLEW glew-devel freeglut-devel freeglut freetype-devel libpng-devel qt5-qtbase-devel qt5-qtsvg qt5-qtsvg-devel qt5-qtscript qt5-qtscript-devel qt5-qttools qt5-qttools-devel qt5-qtmultimedia-devel blas blas-devel json-c-devel libtool intltool make qt5-qtmultimedia
|
||||
```
|
||||
|
||||
For newest versions of OS you may install libmypaint from repository and don't need to build it from source:
|
||||
|
@ -60,7 +60,7 @@ Notes:
|
|||
### Installing Dependencies on openSUSE
|
||||
|
||||
```
|
||||
$ zypper in boost-devel cmake freeglut-devel freetype2-devel gcc-c++ glew-devel libQt5OpenGL-devel libjpeg-devel liblz4-devel libpng16-compat-devel libqt5-linguist-devel libqt5-qtbase-devel libqt5-qtmultimedia-devel libqt5-qtscript-devel libqt5-qtsvg-devel libtiff-devel libusb-devel lzo-devel openblas-devel pkgconfig sed superlu-devel zlib-devel json-c-devel
|
||||
$ zypper in boost-devel cmake freeglut-devel freetype2-devel gcc-c++ glew-devel libQt5OpenGL-devel libjpeg-devel liblz4-devel libpng16-compat-devel libqt5-linguist-devel libqt5-qtbase-devel libqt5-qtmultimedia-devel libqt5-qtscript-devel libqt5-qtsvg-devel libtiff-devel libusb-devel lzo-devel openblas-devel pkgconfig sed superlu-devel zlib-devel json-c-devel libqt5-qtmultimedia
|
||||
```
|
||||
|
||||
For newest versions of OS you may install libmypaint from repository and don't need to build it from source:
|
||||
|
|
|
@ -248,6 +248,7 @@ Range in seconds
|
|||
class TSoundDeviceException final : public TException {
|
||||
public:
|
||||
enum Type {
|
||||
NoDevice, // no device found
|
||||
FailedInit, // fallimento del costruttore
|
||||
UnableOpenDevice,
|
||||
UnableCloseDevice,
|
||||
|
|
|
@ -808,7 +808,15 @@ bool SceneViewerPanel::hasSoundtrack() {
|
|||
TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet();
|
||||
TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
|
||||
if (!m_sceneViewer->isPreviewEnabled()) prop->m_isPreview = true;
|
||||
try {
|
||||
m_sound = xsheetHandle->getXsheet()->makeSound(prop);
|
||||
} catch (TSoundDeviceException &e) {
|
||||
if (e.getType() == TSoundDeviceException::NoDevice) {
|
||||
std::cout << ::to_string(e.getMessage()) << std::endl;
|
||||
} else {
|
||||
throw TSoundDeviceException(e.getType(), e.getMessage());
|
||||
}
|
||||
}
|
||||
if (m_sound == NULL) {
|
||||
m_hasSoundtrack = false;
|
||||
return false;
|
||||
|
|
|
@ -1475,6 +1475,7 @@ TSoundTrack *TXsheet::makeSound(SoundProperties *properties) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TXsheet::scrub(int frame, bool isPreview) {
|
||||
try {
|
||||
double fps =
|
||||
getScene()->getProperties()->getOutputProperties()->getFrameRate();
|
||||
|
||||
|
@ -1489,6 +1490,13 @@ void TXsheet::scrub(int frame, bool isPreview) {
|
|||
double s0 = frame * samplePerFrame, s1 = s0 + samplePerFrame;
|
||||
|
||||
play(st, s0, s1, false);
|
||||
} catch (TSoundDeviceException &e) {
|
||||
if (e.getType() == TSoundDeviceException::NoDevice) {
|
||||
std::cout << ::to_string(e.getMessage()) << std::endl;
|
||||
} else {
|
||||
throw TSoundDeviceException(e.getType(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -845,6 +845,7 @@ void TXshSoundColumn::play(ColumnLevel *columnLevel, int currentFrame) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TXshSoundColumn::play(int currentFrame) {
|
||||
try {
|
||||
TSoundTrackP soundTrack = getOverallSoundTrack(currentFrame);
|
||||
|
||||
if (!soundTrack) return;
|
||||
|
@ -856,6 +857,13 @@ void TXshSoundColumn::play(int currentFrame) {
|
|||
int s1 = getMaxFrame() * spf;
|
||||
|
||||
play(soundTrack, s0, s1, false);
|
||||
} catch (TSoundDeviceException &e) {
|
||||
if (e.getType() == TSoundDeviceException::NoDevice) {
|
||||
std::cout << ::to_string(e.getMessage()) << std::endl;
|
||||
} else {
|
||||
throw TSoundDeviceException(e.getType(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -943,10 +951,17 @@ void TXshSoundColumn::onTimerOut() {
|
|||
|
||||
void TXshSoundColumn::scrub(int fromFrame, int toFrame) {
|
||||
if (!isCamstandVisible()) return;
|
||||
try {
|
||||
TSoundTrackP soundTrack = getOverallSoundTrack(fromFrame, toFrame + 1);
|
||||
if (!soundTrack) return;
|
||||
|
||||
play(soundTrack, 0, soundTrack->getSampleCount(), false);
|
||||
} catch (TSoundDeviceException &e) {
|
||||
if (e.getType() == TSoundDeviceException::NoDevice) {
|
||||
std::cout << ::to_string(e.getMessage()) << std::endl;
|
||||
} else {
|
||||
throw TSoundDeviceException(e.getType(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1006,6 +1021,8 @@ TSoundTrackP TXshSoundColumn::getOverallSoundTrack(int fromFrame, int toFrame,
|
|||
if (format.m_sampleRate >= 44100) format.m_sampleRate = 22050;
|
||||
#else
|
||||
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
|
||||
if (info.deviceName().length() == 0) throw TSoundDeviceException(TSoundDeviceException::NoDevice,
|
||||
"No device found, check QAudio backends");
|
||||
QList<int> ssrs = info.supportedSampleRates();
|
||||
if (!ssrs.contains(format.m_sampleRate)) format.m_sampleRate = 44100;
|
||||
QAudioFormat qFormat;
|
||||
|
|
Loading…
Reference in a new issue