Merge branch 'stable-1.2'
# Conflicts: # cmake/modules/BuildPlugin.cmake # plugins/CMakeLists.txt # plugins/LadspaEffect/swh/CMakeLists.txt # plugins/LadspaEffect/tap/CMakeLists.txt # plugins/zynaddsubfx/zynaddsubfx # plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp # src/gui/MainWindow.cpp
This commit is contained in:
@@ -139,7 +139,7 @@ SET(LMMS_REQUIRED_LIBS ${LMMS_REQUIRED_LIBS}
|
||||
${SDL2_LIBRARY}
|
||||
${PORTAUDIO_LIBRARIES}
|
||||
${SOUNDIO_LIBRARY}
|
||||
${SNDIO_LIBRARY}
|
||||
${SNDIO_LIBRARIES}
|
||||
${PULSEAUDIO_LIBRARIES}
|
||||
${JACK_LIBRARIES}
|
||||
${OGGVORBIS_LIBRARIES}
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
|
||||
#include "DrumSynth.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
|
||||
#include <math.h> //sin(), exp(), etc.
|
||||
|
||||
#include <QFile>
|
||||
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
#define powf pow
|
||||
#endif
|
||||
@@ -117,7 +119,7 @@ void DrumSynth::UpdateEnv(int e, long t)
|
||||
}
|
||||
|
||||
|
||||
void DrumSynth::GetEnv(int env, const char *sec, const char *key, const char *ini)
|
||||
void DrumSynth::GetEnv(int env, const char *sec, const char *key, QString ini)
|
||||
{
|
||||
char en[256], s[8];
|
||||
int i=0, o=0, ep=0;
|
||||
@@ -167,9 +169,9 @@ float DrumSynth::waveform(float ph, int form)
|
||||
}
|
||||
|
||||
|
||||
int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const char *def, char *buffer, int size, const char *file)
|
||||
int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const char *def, char *buffer, int size, QString file)
|
||||
{
|
||||
ifstream is;
|
||||
stringstream is;
|
||||
bool inSection = false;
|
||||
char *line;
|
||||
char *k, *b;
|
||||
@@ -177,7 +179,12 @@ int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const c
|
||||
|
||||
line = (char*)malloc(200);
|
||||
|
||||
is.open (file, ifstream::in);
|
||||
// Use QFile to handle unicode file name on Windows
|
||||
// Previously we used ifstream directly
|
||||
QFile f(file);
|
||||
f.open(QIODevice::ReadOnly);
|
||||
QByteArray dat = f.readAll().constData();
|
||||
is.str(string(dat.constData(), dat.size()));
|
||||
|
||||
while (is.good()) {
|
||||
if (!inSection) {
|
||||
@@ -223,13 +230,12 @@ int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const c
|
||||
strncpy(buffer, def, size);
|
||||
}
|
||||
|
||||
is.close();
|
||||
free(line);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int DrumSynth::GetPrivateProfileInt(const char *sec, const char *key, int def, const char *file)
|
||||
int DrumSynth::GetPrivateProfileInt(const char *sec, const char *key, int def, QString file)
|
||||
{
|
||||
char tmp[16];
|
||||
int i=0;
|
||||
@@ -240,7 +246,7 @@ int DrumSynth::GetPrivateProfileInt(const char *sec, const char *key, int def, c
|
||||
return i;
|
||||
}
|
||||
|
||||
float DrumSynth::GetPrivateProfileFloat(const char *sec, const char *key, float def, const char *file)
|
||||
float DrumSynth::GetPrivateProfileFloat(const char *sec, const char *key, float def, QString file)
|
||||
{
|
||||
char tmp[16];
|
||||
float f=0.f;
|
||||
@@ -257,7 +263,7 @@ float DrumSynth::GetPrivateProfileFloat(const char *sec, const char *key, float
|
||||
// an associative array or something once we have a datastructure to load in to.
|
||||
// llama
|
||||
|
||||
int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels, sample_rate_t Fs)
|
||||
int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sample_rate_t Fs)
|
||||
{
|
||||
//input file
|
||||
char sec[32];
|
||||
|
||||
@@ -175,11 +175,6 @@ void SampleBuffer::update( bool _keep_settings )
|
||||
else if( !m_audioFile.isEmpty() )
|
||||
{
|
||||
QString file = tryToMakeAbsolute( m_audioFile );
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
char * f = qstrdup( file.toLocal8Bit().constData() );
|
||||
#else
|
||||
char * f = qstrdup( file.toUtf8().constData() );
|
||||
#endif
|
||||
int_sample_t * buf = NULL;
|
||||
sample_t * fbuf = NULL;
|
||||
ch_cnt_t channels = DEFAULT_CHANNELS;
|
||||
@@ -193,10 +188,13 @@ void SampleBuffer::update( bool _keep_settings )
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use QFile to handle unicode file names on Windows
|
||||
QFile f(file);
|
||||
f.open(QIODevice::ReadOnly);
|
||||
SNDFILE * snd_file;
|
||||
SF_INFO sf_info;
|
||||
sf_info.format = 0;
|
||||
if( ( snd_file = sf_open( f, SFM_READ, &sf_info ) ) != NULL )
|
||||
if( ( snd_file = sf_open_fd( f.handle(), SFM_READ, &sf_info, false ) ) != NULL )
|
||||
{
|
||||
f_cnt_t frames = sf_info.frames;
|
||||
int rate = sf_info.samplerate;
|
||||
@@ -206,6 +204,7 @@ void SampleBuffer::update( bool _keep_settings )
|
||||
}
|
||||
sf_close( snd_file );
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
|
||||
if( !fileLoadError )
|
||||
@@ -216,28 +215,26 @@ void SampleBuffer::update( bool _keep_settings )
|
||||
// decoder first if filename extension matches "ogg"
|
||||
if( m_frames == 0 && fileInfo.suffix() == "ogg" )
|
||||
{
|
||||
m_frames = decodeSampleOGGVorbis( f, buf, channels, samplerate );
|
||||
m_frames = decodeSampleOGGVorbis( file, buf, channels, samplerate );
|
||||
}
|
||||
#endif
|
||||
if( m_frames == 0 )
|
||||
{
|
||||
m_frames = decodeSampleSF( f, fbuf, channels,
|
||||
m_frames = decodeSampleSF( file, fbuf, channels,
|
||||
samplerate );
|
||||
}
|
||||
#ifdef LMMS_HAVE_OGGVORBIS
|
||||
if( m_frames == 0 )
|
||||
{
|
||||
m_frames = decodeSampleOGGVorbis( f, buf, channels,
|
||||
m_frames = decodeSampleOGGVorbis( file, buf, channels,
|
||||
samplerate );
|
||||
}
|
||||
#endif
|
||||
if( m_frames == 0 )
|
||||
{
|
||||
m_frames = decodeSampleDS( f, buf, channels,
|
||||
m_frames = decodeSampleDS( file, buf, channels,
|
||||
samplerate );
|
||||
}
|
||||
|
||||
delete[] f;
|
||||
}
|
||||
|
||||
if ( m_frames == 0 || fileLoadError ) // if still no frames, bail
|
||||
@@ -393,7 +390,7 @@ void SampleBuffer::normalizeSampleRate( const sample_rate_t _src_sr,
|
||||
|
||||
|
||||
|
||||
f_cnt_t SampleBuffer::decodeSampleSF( const char * _f,
|
||||
f_cnt_t SampleBuffer::decodeSampleSF(QString _f,
|
||||
sample_t * & _buf,
|
||||
ch_cnt_t & _channels,
|
||||
sample_rate_t & _samplerate )
|
||||
@@ -404,7 +401,11 @@ f_cnt_t SampleBuffer::decodeSampleSF( const char * _f,
|
||||
f_cnt_t frames = 0;
|
||||
bool sf_rr = false;
|
||||
|
||||
if( ( snd_file = sf_open( _f, SFM_READ, &sf_info ) ) != NULL )
|
||||
|
||||
// Use QFile to handle unicode file names on Windows
|
||||
QFile f(_f);
|
||||
f.open(QIODevice::ReadOnly);
|
||||
if( ( snd_file = sf_open_fd( f.handle(), SFM_READ, &sf_info, false ) ) != NULL )
|
||||
{
|
||||
frames = sf_info.frames;
|
||||
|
||||
@@ -430,6 +431,8 @@ f_cnt_t SampleBuffer::decodeSampleSF( const char * _f,
|
||||
"sample %s: %s", _f, sf_strerror( NULL ) );
|
||||
#endif
|
||||
}
|
||||
f.close();
|
||||
|
||||
//write down either directly or convert i->f depending on file type
|
||||
|
||||
if ( frames > 0 && _buf != NULL )
|
||||
@@ -495,7 +498,7 @@ long qfileTellCallback( void * _udata )
|
||||
|
||||
|
||||
|
||||
f_cnt_t SampleBuffer::decodeSampleOGGVorbis( const char * _f,
|
||||
f_cnt_t SampleBuffer::decodeSampleOGGVorbis( QString _f,
|
||||
int_sample_t * & _buf,
|
||||
ch_cnt_t & _channels,
|
||||
sample_rate_t & _samplerate )
|
||||
@@ -591,7 +594,7 @@ f_cnt_t SampleBuffer::decodeSampleOGGVorbis( const char * _f,
|
||||
|
||||
|
||||
|
||||
f_cnt_t SampleBuffer::decodeSampleDS( const char * _f,
|
||||
f_cnt_t SampleBuffer::decodeSampleDS( QString _f,
|
||||
int_sample_t * & _buf,
|
||||
ch_cnt_t & _channels,
|
||||
sample_rate_t & _samplerate )
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#include "endian_handling.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
AudioFileWave::AudioFileWave( OutputSettings const & outputSettings,
|
||||
const ch_cnt_t channels, bool & successful,
|
||||
@@ -72,13 +75,15 @@ bool AudioFileWave::startEncoding()
|
||||
m_si.format |= SF_FORMAT_PCM_16;
|
||||
break;
|
||||
}
|
||||
m_sf = sf_open(
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
outputFile().toLocal8Bit().constData(),
|
||||
#else
|
||||
outputFile().toUtf8().constData(),
|
||||
#endif
|
||||
SFM_WRITE, &m_si );
|
||||
|
||||
// Use file handle to handle unicode file name on Windows
|
||||
m_sf = sf_open_fd( outputFileHandle(), SFM_WRITE, &m_si, false );
|
||||
|
||||
if (!m_sf)
|
||||
{
|
||||
qWarning("Error: AudioFileWave::startEncoding: %s", sf_strerror(nullptr));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent fold overs when encountering clipped data
|
||||
sf_command(m_sf, SFC_SET_CLIPPING, NULL, SF_TRUE);
|
||||
|
||||
@@ -248,9 +248,13 @@ void MidiWinMM::closeDevices()
|
||||
m_outputSubs.clear();
|
||||
|
||||
QMapIterator<HMIDIIN, QString> i( m_inputDevices );
|
||||
|
||||
HMIDIIN hInDev;
|
||||
while( i.hasNext() )
|
||||
{
|
||||
midiInClose( i.next().key() );
|
||||
hInDev = i.next().key();
|
||||
midiInReset( hInDev );
|
||||
midiInClose( hInDev );
|
||||
}
|
||||
|
||||
QMapIterator<HMIDIOUT, QString> o( m_outputDevices );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2017-2017 Tres Finocchiaro <tres.finocchiaro/at/gmail.com>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
|
||||
@@ -75,7 +75,7 @@ void disableAutoKeyAccelerators(QWidget* mainWindow)
|
||||
{
|
||||
using DisablerFunc = void(*)(QWidget*);
|
||||
QLibrary kf5WidgetsAddon("KF5WidgetsAddons", 5);
|
||||
DisablerFunc setNoAccelerators =
|
||||
DisablerFunc setNoAccelerators =
|
||||
reinterpret_cast<DisablerFunc>(kf5WidgetsAddon.resolve("_ZN19KAcceleratorManager10setNoAccelEP7QWidget"));
|
||||
if(setNoAccelerators)
|
||||
{
|
||||
@@ -720,7 +720,7 @@ void MainWindow::clearKeyModifiers()
|
||||
|
||||
void MainWindow::saveWidgetState( QWidget * _w, QDomElement & _de )
|
||||
{
|
||||
// If our widget is the main content of a window (e.g. piano roll, FxMixer, etc),
|
||||
// If our widget is the main content of a window (e.g. piano roll, FxMixer, etc),
|
||||
// we really care about the position of the *window* - not the position of the widget within its window
|
||||
if( _w->parentWidget() != NULL &&
|
||||
_w->parentWidget()->inherits( "QMdiSubWindow" ) )
|
||||
@@ -728,7 +728,7 @@ void MainWindow::saveWidgetState( QWidget * _w, QDomElement & _de )
|
||||
_w = _w->parentWidget();
|
||||
}
|
||||
|
||||
// If the widget is a SubWindow, then we can make use of the getTrueNormalGeometry() method that
|
||||
// If the widget is a SubWindow, then we can make use of the getTrueNormalGeometry() method that
|
||||
// performs the same as normalGeometry, but isn't broken on X11 ( see https://bugreports.qt.io/browse/QTBUG-256 )
|
||||
SubWindow *asSubWindow = qobject_cast<SubWindow*>(_w);
|
||||
QRect normalGeom = asSubWindow != nullptr ? asSubWindow->getTrueNormalGeometry() : _w->normalGeometry();
|
||||
@@ -757,7 +757,7 @@ void MainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
|
||||
qMax( _w->minimumHeight(), _de.attribute( "height" ).toInt() ) );
|
||||
if( _de.hasAttribute( "visible" ) && !r.isNull() )
|
||||
{
|
||||
// If our widget is the main content of a window (e.g. piano roll, FxMixer, etc),
|
||||
// If our widget is the main content of a window (e.g. piano roll, FxMixer, etc),
|
||||
// we really care about the position of the *window* - not the position of the widget within its window
|
||||
if ( _w->parentWidget() != NULL &&
|
||||
_w->parentWidget()->inherits( "QMdiSubWindow" ) )
|
||||
@@ -856,7 +856,7 @@ void MainWindow::updateRecentlyOpenedProjectsMenu()
|
||||
for( QStringList::iterator it = rup.begin(); it != rup.end(); ++it )
|
||||
{
|
||||
QFileInfo recentFile( *it );
|
||||
if ( recentFile.exists() &&
|
||||
if ( recentFile.exists() &&
|
||||
*it != ConfigManager::inst()->recoveryFile() )
|
||||
{
|
||||
if( recentFile.suffix().toLower() == "mpt" )
|
||||
@@ -901,15 +901,15 @@ bool MainWindow::saveProject()
|
||||
{
|
||||
return( saveProjectAs() );
|
||||
}
|
||||
else
|
||||
else if( this->guiSaveProject() )
|
||||
{
|
||||
this->guiSaveProject();
|
||||
if( getSession() == Recover )
|
||||
{
|
||||
sessionCleanup();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return( true );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -955,14 +955,16 @@ bool MainWindow::saveProjectAs()
|
||||
}
|
||||
}
|
||||
}
|
||||
this->guiSaveProjectAs( fname );
|
||||
if( getSession() == Recover )
|
||||
if( this->guiSaveProjectAs( fname ) )
|
||||
{
|
||||
sessionCleanup();
|
||||
if( getSession() == Recover )
|
||||
{
|
||||
sessionCleanup();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
return( false );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -980,8 +982,7 @@ bool MainWindow::saveProjectAsNewVersion()
|
||||
do VersionedSaveDialog::changeFileNameVersion( fileName, true );
|
||||
while ( QFile( fileName ).exists() );
|
||||
|
||||
this->guiSaveProjectAs( fileName );
|
||||
return true;
|
||||
return this->guiSaveProjectAs( fileName );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user