made quality-settings (internal processing samplerate, interpolation and so on) independent of audio-devices (final output) and added new qualitySettings-structure to mixer - might be still buggy and HQ-mode is currently not working, this is going to be fixed tomorrow, anyways important preparation for new project-export-dialog
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@957 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
64
ChangeLog
64
ChangeLog
@@ -1,3 +1,67 @@
|
||||
2008-05-05 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/ladspa_effect/ladspa_effect.cpp:
|
||||
* plugins/organic/organic.cpp:
|
||||
* plugins/lb302/lb302.cpp:
|
||||
* plugins/bit_invader/bit_invader.cpp:
|
||||
* plugins/vibed/vibrating_string.cpp:
|
||||
* plugins/vibed/vibed.cpp:
|
||||
* plugins/triple_oscillator/triple_oscillator.cpp:
|
||||
* plugins/live_tool/live_tool.cpp:
|
||||
* plugins/audio_file_processor/audio_file_processor.cpp:
|
||||
* plugins/stk/mallets/mallets.cpp:
|
||||
* plugins/sf2_player/sf2_player.cpp:
|
||||
* plugins/vst_base/lvsl_client.cpp:
|
||||
* plugins/ladspa_browser/ladspa_port_dialog.cpp:
|
||||
* plugins/kicker/kicker.cpp:
|
||||
* include/effect.h:
|
||||
* include/controller.h:
|
||||
* include/mixer.h:
|
||||
* include/sample_buffer.h:
|
||||
* include/audio_dummy.h:
|
||||
* include/audio_sdl.h:
|
||||
* include/song.h:
|
||||
* include/audio_file_device.h:
|
||||
* include/audio_jack.h:
|
||||
* include/audio_device.h:
|
||||
* include/audio_oss.h:
|
||||
* include/audio_sample_recorder.h:
|
||||
* include/audio_alsa.h:
|
||||
* src/gui/piano_roll.cpp:
|
||||
* src/gui/song_editor.cpp:
|
||||
* src/gui/setup_dialog.cpp:
|
||||
* src/gui/file_browser.cpp:
|
||||
* src/gui/widgets/envelope_and_lfo_view.cpp:
|
||||
* src/gui/automation_editor.cpp:
|
||||
* src/gui/export_project_dialog.cpp:
|
||||
* src/gui/bb_editor.cpp:
|
||||
* src/tracks/instrument_track.cpp:
|
||||
* src/tracks/pattern.cpp:
|
||||
* src/core/song.cpp:
|
||||
* src/core/bb_track_container.cpp:
|
||||
* src/core/audio/audio_file_device.cpp:
|
||||
* src/core/audio/audio_device.cpp:
|
||||
* src/core/audio/audio_alsa.cpp:
|
||||
* src/core/audio/audio_sdl.cpp:
|
||||
* src/core/audio/audio_oss.cpp:
|
||||
* src/core/audio/audio_sample_recorder.cpp:
|
||||
* src/core/audio/audio_jack.cpp:
|
||||
* src/core/sample_play_handle.cpp:
|
||||
* src/core/envelope_and_lfo_parameters.cpp:
|
||||
* src/core/mixer.cpp:
|
||||
* src/core/instrument_sound_shaping.cpp:
|
||||
* src/core/instrument_functions.cpp:
|
||||
* src/core/engine.cpp:
|
||||
* src/core/sample_buffer.cpp:
|
||||
* src/core/oscillator.cpp:
|
||||
* src/core/controller.cpp:
|
||||
* src/core/lfo_controller.cpp:
|
||||
made quality-settings (internal processing samplerate, interpolation
|
||||
and so on) independent of audio-devices (final output) and added new
|
||||
qualitySettings-structure to mixer - might be still buggy and HQ-mode
|
||||
is currently not working, this is going to be fixed tomorrow, anyways
|
||||
important preparation for new project-export-dialog
|
||||
|
||||
2008-05-04 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* src/gui/fx_mixer_view.cpp:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* audio_alsa.h - device-class that implements ALSA-PCM-output
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -51,8 +51,7 @@ class QLineEdit;
|
||||
class audioALSA : public audioDevice, public QThread
|
||||
{
|
||||
public:
|
||||
audioALSA( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer );
|
||||
audioALSA( bool & _success_ful, mixer * _mixer );
|
||||
virtual ~audioALSA();
|
||||
|
||||
inline static QString name( void )
|
||||
@@ -84,11 +83,9 @@ private:
|
||||
virtual void stopProcessing( void );
|
||||
virtual void run( void );
|
||||
|
||||
int FASTCALL setHWParams( const sample_rate_t _sample_rate,
|
||||
const ch_cnt_t _channels,
|
||||
snd_pcm_access_t _access );
|
||||
int setHWParams( const ch_cnt_t _channels, snd_pcm_access_t _access );
|
||||
int setSWParams( void );
|
||||
int FASTCALL handleError( int _err );
|
||||
int handleError( int _err );
|
||||
|
||||
|
||||
snd_pcm_t * m_handle;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* audio_device.h - base-class for audio-devices, used by LMMS-mixer
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -34,13 +34,6 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef USE_3RDPARTY_LIBSRC
|
||||
#include <samplerate.h>
|
||||
#else
|
||||
#include "src/3rdparty/samplerate/samplerate.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "mixer.h"
|
||||
#include "tab_widget.h"
|
||||
|
||||
@@ -53,8 +46,7 @@ class audioPort;
|
||||
class audioDevice
|
||||
{
|
||||
public:
|
||||
audioDevice( const sample_rate_t _sample_rate,
|
||||
const ch_cnt_t _channels, mixer * _mixer );
|
||||
audioDevice( const ch_cnt_t _channels, mixer * _mixer );
|
||||
virtual ~audioDevice();
|
||||
|
||||
inline void lock( void )
|
||||
@@ -128,29 +120,29 @@ public:
|
||||
protected:
|
||||
// subclasses can re-implement this for being used in conjunction with
|
||||
// processNextBuffer()
|
||||
virtual void FASTCALL writeBuffer( const surroundSampleFrame * _ab,
|
||||
virtual void writeBuffer( const surroundSampleFrame * _ab,
|
||||
const fpp_t _frames,
|
||||
const float _master_gain )
|
||||
{
|
||||
}
|
||||
|
||||
// called by according driver for fetching new sound-data
|
||||
fpp_t FASTCALL getNextBuffer( surroundSampleFrame * _ab );
|
||||
fpp_t getNextBuffer( surroundSampleFrame * _ab );
|
||||
|
||||
// convert a given audio-buffer to a buffer in signed 16-bit samples
|
||||
// returns num of bytes in outbuf
|
||||
Uint32 FASTCALL convertToS16( const surroundSampleFrame * _ab,
|
||||
Uint32 convertToS16( const surroundSampleFrame * _ab,
|
||||
const fpp_t _frames,
|
||||
const float _master_gain,
|
||||
int_sample_t * _output_buffer,
|
||||
const bool _convert_endian = FALSE );
|
||||
|
||||
// clear given signed-int-16-buffer
|
||||
void FASTCALL clearS16Buffer( int_sample_t * _outbuf,
|
||||
void clearS16Buffer( int_sample_t * _outbuf,
|
||||
const fpp_t _frames );
|
||||
|
||||
// resample given buffer from samplerate _src_sr to samplerate _dst_sr
|
||||
void FASTCALL resample( const surroundSampleFrame * _src,
|
||||
void resample( const surroundSampleFrame * _src,
|
||||
const fpp_t _frames,
|
||||
surroundSampleFrame * _dst,
|
||||
const sample_rate_t _src_sr,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* audio_dummy.h - dummy-audio-device
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -33,9 +33,8 @@
|
||||
class audioDummy : public audioDevice, public QThread
|
||||
{
|
||||
public:
|
||||
audioDummy( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer ) :
|
||||
audioDevice( _sample_rate, DEFAULT_CHANNELS, _mixer )
|
||||
audioDummy( bool & _success_ful, mixer * _mixer ) :
|
||||
audioDevice( DEFAULT_CHANNELS, _mixer )
|
||||
{
|
||||
_success_ful = TRUE;
|
||||
}
|
||||
@@ -48,7 +47,7 @@ public:
|
||||
inline static QString name( void )
|
||||
{
|
||||
return( QT_TRANSLATE_NOOP( "setupWidget",
|
||||
"Dummy (no sound output)" ) );
|
||||
"Dummy (no sound output)" ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +109,8 @@ private:
|
||||
|
||||
const Sint32 microseconds = static_cast<Sint32>(
|
||||
getMixer()->framesPerPeriod() *
|
||||
1000000.0f / getMixer()->sampleRate() -
|
||||
1000000.0f /
|
||||
getMixer()->processingSampleRate() -
|
||||
timer.elapsed() );
|
||||
if( microseconds > 0 )
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* audio_file_device.h - base-class for audio-device-classes which write
|
||||
* their output into a file
|
||||
*
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* audio_jack.h - support for JACK-transport
|
||||
*
|
||||
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -52,8 +52,7 @@ class lcdSpinBox;
|
||||
class audioJACK : public audioDevice
|
||||
{
|
||||
public:
|
||||
audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer );
|
||||
audioJACK( bool & _success_ful, mixer * _mixer );
|
||||
virtual ~audioJACK();
|
||||
|
||||
inline static QString name( void )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* audio_oss.h - device-class that implements OSS-PCM-output
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -46,8 +46,7 @@ class QLineEdit;
|
||||
class audioOSS : public audioDevice, public QThread
|
||||
{
|
||||
public:
|
||||
audioOSS( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer );
|
||||
audioOSS( bool & _success_ful, mixer * _mixer );
|
||||
virtual ~audioOSS();
|
||||
|
||||
inline static QString name( void )
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* surround-audio-buffers into RAM, maybe later
|
||||
* also harddisk
|
||||
*
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -41,17 +41,16 @@ class sampleBuffer;
|
||||
class audioSampleRecorder : public audioDevice
|
||||
{
|
||||
public:
|
||||
audioSampleRecorder( const sample_rate_t _sample_rate,
|
||||
const ch_cnt_t _channels, bool & _success_ful,
|
||||
audioSampleRecorder( const ch_cnt_t _channels, bool & _success_ful,
|
||||
mixer * _mixer );
|
||||
virtual ~audioSampleRecorder();
|
||||
|
||||
f_cnt_t framesRecorded( void ) const;
|
||||
void FASTCALL createSampleBuffer( sampleBuffer * * _sample_buf );
|
||||
void createSampleBuffer( sampleBuffer * * _sample_buf );
|
||||
|
||||
|
||||
private:
|
||||
virtual void FASTCALL writeBuffer( const surroundSampleFrame * _ab,
|
||||
virtual void writeBuffer( const surroundSampleFrame * _ab,
|
||||
const fpp_t _frames,
|
||||
const float _master_gain );
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* audio_sdl.h - device-class that performs PCM-output via SDL
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -50,14 +50,13 @@ class QLineEdit;
|
||||
class audioSDL : public audioDevice
|
||||
{
|
||||
public:
|
||||
audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer );
|
||||
audioSDL( bool & _success_ful, mixer * _mixer );
|
||||
virtual ~audioSDL();
|
||||
|
||||
inline static QString name( void )
|
||||
{
|
||||
return( QT_TRANSLATE_NOOP( "setupWidget",
|
||||
"SDL (Simple DirectMedia Layer)" ) );
|
||||
"SDL (Simple DirectMedia Layer)" ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,9 @@ public:
|
||||
|
||||
inline bool isSampleExact( void ) const
|
||||
{
|
||||
return m_sampleExact || engine::getMixer()->highQuality();
|
||||
return m_sampleExact ||
|
||||
engine::getMixer()->qualitySettings().
|
||||
sampleExactControllers;
|
||||
}
|
||||
|
||||
void setSampleExact( bool _exact )
|
||||
|
||||
@@ -109,7 +109,8 @@ public:
|
||||
|
||||
inline f_cnt_t getTimeout( void ) const
|
||||
{
|
||||
const float samples = engine::getMixer()->sampleRate() *
|
||||
const float samples =
|
||||
engine::getMixer()->processingSampleRate() *
|
||||
m_autoQuitModel.value() / 1000.0f;
|
||||
return( 1 + ( static_cast<Uint32>( samples ) /
|
||||
engine::getMixer()->framesPerPeriod() ) );
|
||||
|
||||
135
include/mixer.h
135
include/mixer.h
@@ -30,6 +30,13 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef USE_3RDPARTY_LIBSRC
|
||||
#include <samplerate.h>
|
||||
#else
|
||||
#include "src/3rdparty/samplerate/samplerate.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QSemaphore>
|
||||
#include <QtCore/QThread>
|
||||
@@ -58,16 +65,6 @@ const ch_cnt_t SURROUND_CHANNELS =
|
||||
#endif
|
||||
|
||||
|
||||
enum qualityLevels
|
||||
{
|
||||
DEFAULT_QUALITY_LEVEL,
|
||||
HIGH_QUALITY_LEVEL,
|
||||
QUALITY_LEVELS
|
||||
} ;
|
||||
|
||||
extern sample_rate_t SAMPLE_RATES[QUALITY_LEVELS];
|
||||
const sample_rate_t DEFAULT_SAMPLE_RATE = 44100;
|
||||
|
||||
|
||||
typedef sample_t sampleFrame[DEFAULT_CHANNELS];
|
||||
typedef sample_t surroundSampleFrame[SURROUND_CHANNELS];
|
||||
@@ -96,8 +93,103 @@ class mixer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
struct qualitySettings
|
||||
{
|
||||
enum Mode
|
||||
{
|
||||
Mode_Draft,
|
||||
Mode_HighQuality,
|
||||
Mode_FinalMix
|
||||
} ;
|
||||
enum Interpolation
|
||||
{
|
||||
Interpolation_Linear,
|
||||
Interpolation_SincFastest,
|
||||
Interpolation_SincMedium,
|
||||
Interpolation_SincBest
|
||||
} ;
|
||||
|
||||
enum Oversampling
|
||||
{
|
||||
Oversampling_None,
|
||||
Oversampling_2x,
|
||||
Oversampling_4x,
|
||||
Oversampling_8x,
|
||||
Oversampling_16x
|
||||
} ;
|
||||
|
||||
Interpolation interpolation;
|
||||
Oversampling oversampling;
|
||||
bool sampleExactControllers;
|
||||
bool aliasFreeOscillators;
|
||||
|
||||
qualitySettings( Mode _m )
|
||||
{
|
||||
switch( _m )
|
||||
{
|
||||
case Mode_Draft:
|
||||
interpolation = Interpolation_Linear;
|
||||
oversampling = Oversampling_None;
|
||||
sampleExactControllers = FALSE;
|
||||
aliasFreeOscillators = FALSE;
|
||||
break;
|
||||
case Mode_HighQuality:
|
||||
interpolation =
|
||||
Interpolation_SincFastest;
|
||||
oversampling = Oversampling_2x;
|
||||
sampleExactControllers = TRUE;
|
||||
aliasFreeOscillators = FALSE;
|
||||
break;
|
||||
case Mode_FinalMix:
|
||||
interpolation = Interpolation_SincBest;
|
||||
oversampling = Oversampling_8x;
|
||||
sampleExactControllers = TRUE;
|
||||
aliasFreeOscillators = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qualitySettings( Interpolation _i, Oversampling _o, bool _sec,
|
||||
bool _afo ) :
|
||||
interpolation( _i ),
|
||||
oversampling( _o ),
|
||||
sampleExactControllers( _sec ),
|
||||
aliasFreeOscillators( _afo )
|
||||
{
|
||||
}
|
||||
|
||||
int sampleRateMultiplier( void ) const
|
||||
{
|
||||
switch( oversampling )
|
||||
{
|
||||
case Oversampling_None: return 1;
|
||||
case Oversampling_2x: return 2;
|
||||
case Oversampling_4x: return 4;
|
||||
case Oversampling_8x: return 8;
|
||||
case Oversampling_16x: return 16;
|
||||
}
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
int libsrcInterpolation( void ) const
|
||||
{
|
||||
switch( interpolation )
|
||||
{
|
||||
case Interpolation_Linear:
|
||||
return( SRC_LINEAR );
|
||||
case Interpolation_SincFastest:
|
||||
return( SRC_SINC_FASTEST );
|
||||
case Interpolation_SincMedium:
|
||||
return( SRC_SINC_MEDIUM_QUALITY );
|
||||
case Interpolation_SincBest:
|
||||
return( SRC_SINC_BEST_QUALITY );
|
||||
}
|
||||
return( SRC_LINEAR );
|
||||
}
|
||||
} ;
|
||||
|
||||
void initDevices( void );
|
||||
void FASTCALL clear( void );
|
||||
void clear( void );
|
||||
|
||||
|
||||
// audio-device-stuff
|
||||
@@ -106,7 +198,7 @@ public:
|
||||
return( m_audioDevName );
|
||||
}
|
||||
|
||||
void FASTCALL setAudioDevice( audioDevice * _dev, bool _hq );
|
||||
void setAudioDevice( audioDevice * _dev );
|
||||
void restoreAudioDevice( void );
|
||||
inline audioDevice * audioDev( void )
|
||||
{
|
||||
@@ -199,16 +291,15 @@ public:
|
||||
return( m_cpuLoad );
|
||||
}
|
||||
|
||||
inline bool highQuality( void ) const
|
||||
const qualitySettings & qualitySettings( void ) const
|
||||
{
|
||||
return( m_qualityLevel > DEFAULT_QUALITY_LEVEL );
|
||||
return( m_qualitySettings );
|
||||
}
|
||||
|
||||
|
||||
inline sample_rate_t sampleRate( void ) const
|
||||
{
|
||||
return( SAMPLE_RATES[m_qualityLevel] );
|
||||
}
|
||||
sample_rate_t baseSampleRate( void ) const;
|
||||
sample_rate_t outputSampleRate( void ) const;
|
||||
sample_rate_t processingSampleRate( void ) const;
|
||||
|
||||
|
||||
inline float masterGain( void ) const
|
||||
@@ -268,7 +359,7 @@ public:
|
||||
}
|
||||
|
||||
// audio-buffer-mgm
|
||||
void FASTCALL bufferToPort( const sampleFrame * _buf,
|
||||
void bufferToPort( const sampleFrame * _buf,
|
||||
const fpp_t _frames,
|
||||
const f_cnt_t _offset,
|
||||
stereoVolumeVector _volume_vector,
|
||||
@@ -295,11 +386,11 @@ public:
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
void setHighQuality( bool _hq_on = FALSE );
|
||||
void changeQuality( const struct qualitySettings & _qs );
|
||||
|
||||
|
||||
signals:
|
||||
void qualitySettingsChanged( void );
|
||||
void sampleRateChanged( void );
|
||||
void nextAudioBuffer( void );
|
||||
|
||||
@@ -371,7 +462,7 @@ private:
|
||||
playHandleVector m_playHandles;
|
||||
constPlayHandleVector m_playHandlesToRemove;
|
||||
|
||||
qualityLevels m_qualityLevel;
|
||||
struct qualitySettings m_qualitySettings;
|
||||
float m_masterGain;
|
||||
|
||||
|
||||
|
||||
@@ -80,13 +80,12 @@ public:
|
||||
|
||||
virtual ~sampleBuffer();
|
||||
|
||||
bool FASTCALL play( sampleFrame * _ab, handleState * _state,
|
||||
bool play( sampleFrame * _ab, handleState * _state,
|
||||
const fpp_t _frames,
|
||||
const float _freq = BaseFreq,
|
||||
const bool _looped = FALSE ) const;
|
||||
|
||||
void FASTCALL visualize( QPainter & _p, const QRect & _dr,
|
||||
const QRect & _clip );
|
||||
void visualize( QPainter & _p, const QRect & _dr, const QRect & _clip );
|
||||
inline void visualize( QPainter & _p, const QRect & _dr )
|
||||
{
|
||||
visualize( _p, _dr, _dr );
|
||||
@@ -157,13 +156,12 @@ public:
|
||||
QString & toBase64( QString & _dst ) const;
|
||||
|
||||
|
||||
static sampleBuffer * FASTCALL resample( sampleFrame * _data,
|
||||
static sampleBuffer * resample( sampleFrame * _data,
|
||||
const f_cnt_t _frames,
|
||||
const sample_rate_t _src_sr,
|
||||
const sample_rate_t _dst_sr );
|
||||
|
||||
static inline sampleBuffer * FASTCALL resample(
|
||||
sampleBuffer * _buf,
|
||||
static inline sampleBuffer * resample( sampleBuffer * _buf,
|
||||
const sample_rate_t _src_sr,
|
||||
const sample_rate_t _dst_sr )
|
||||
{
|
||||
@@ -171,7 +169,7 @@ public:
|
||||
_dst_sr ) );
|
||||
}
|
||||
|
||||
void normalize_sample_rate( const sample_rate_t _src_sr,
|
||||
void normalizeSampleRate( const sample_rate_t _src_sr,
|
||||
bool _keep_settings = FALSE );
|
||||
|
||||
inline sample_t userWaveSample( const float _sample ) const
|
||||
@@ -209,29 +207,25 @@ public slots:
|
||||
|
||||
|
||||
private:
|
||||
void FASTCALL update( bool _keep_settings = FALSE );
|
||||
void update( bool _keep_settings = FALSE );
|
||||
|
||||
|
||||
#ifdef SDL_SDL_SOUND_H
|
||||
f_cnt_t FASTCALL decodeSampleSDL( const char * _f,
|
||||
int_sample_t * & _buf,
|
||||
f_cnt_t decodeSampleSDL( const char * _f, int_sample_t * & _buf,
|
||||
ch_cnt_t _channels,
|
||||
sample_rate_t _sample_rate );
|
||||
#endif
|
||||
#ifdef HAVE_SNDFILE_H
|
||||
f_cnt_t FASTCALL decodeSampleSF( const char * _f,
|
||||
int_sample_t * & _buf,
|
||||
f_cnt_t decodeSampleSF( const char * _f, int_sample_t * & _buf,
|
||||
ch_cnt_t & _channels,
|
||||
sample_rate_t & _sample_rate );
|
||||
#endif
|
||||
#ifdef HAVE_VORBIS_VORBISFILE_H
|
||||
f_cnt_t FASTCALL decodeSampleOGGVorbis( const char * _f,
|
||||
int_sample_t * & _buf,
|
||||
f_cnt_t decodeSampleOGGVorbis( const char * _f, int_sample_t * & _buf,
|
||||
ch_cnt_t & _channels,
|
||||
sample_rate_t & _sample_rate );
|
||||
#endif
|
||||
f_cnt_t FASTCALL decodeSampleDS( const char * _f,
|
||||
int_sample_t * & _buf,
|
||||
f_cnt_t decodeSampleDS( const char * _f, int_sample_t * & _buf,
|
||||
ch_cnt_t & _channels,
|
||||
sample_rate_t & _sample_rate );
|
||||
|
||||
|
||||
@@ -95,24 +95,24 @@ public:
|
||||
void processNextBuffer( void );
|
||||
|
||||
|
||||
inline bool paused( void ) const
|
||||
inline bool isPaused( void ) const
|
||||
{
|
||||
return( m_paused );
|
||||
}
|
||||
|
||||
inline bool playing( void ) const
|
||||
inline bool isPlaying( void ) const
|
||||
{
|
||||
return( m_playing && m_exporting == FALSE );
|
||||
}
|
||||
|
||||
inline bool exporting( void ) const
|
||||
inline bool isExporting( void ) const
|
||||
{
|
||||
return( m_exporting );
|
||||
}
|
||||
|
||||
bool realTimeTask( void ) const;
|
||||
|
||||
inline bool exportDone( void ) const
|
||||
inline bool isExportDone( void ) const
|
||||
{
|
||||
return( m_exporting == TRUE &&
|
||||
m_playPos[Mode_PlaySong].getTact() >= length() + 1 );
|
||||
@@ -194,7 +194,7 @@ public slots:
|
||||
void exportProject( void );
|
||||
|
||||
void startExport( void );
|
||||
void stopExport( void );
|
||||
void cancelExport( void );
|
||||
|
||||
|
||||
void setModified( void );
|
||||
|
||||
@@ -206,7 +206,8 @@ QString audioFileProcessor::nodeName( void ) const
|
||||
Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const
|
||||
{
|
||||
const float freq_factor = BaseFreq / _n->frequency() *
|
||||
engine::getMixer()->sampleRate() / DEFAULT_SAMPLE_RATE;
|
||||
engine::getMixer()->processingSampleRate() /
|
||||
engine::getMixer()->baseSampleRate();
|
||||
|
||||
return( static_cast<Uint32>( floorf( ( m_sampleBuffer.endFrame() -
|
||||
m_sampleBuffer.startFrame() ) *
|
||||
|
||||
@@ -246,7 +246,7 @@ void bitInvader::normalize( void )
|
||||
// analyze
|
||||
float max = 0;
|
||||
const float* samples = m_graph.samples();
|
||||
for (int i=0; i < m_graph.length(); i++)
|
||||
for (unsigned int i=0; i < m_graph.length(); i++)
|
||||
{
|
||||
if (fabsf(samples[i]) > max) { max = fabs(samples[i]); }
|
||||
}
|
||||
@@ -277,10 +277,12 @@ void bitInvader::playNote( notePlayHandle * _n, bool,
|
||||
factor = normalizeFactor;
|
||||
}
|
||||
|
||||
_n->m_pluginData = new bSynth( const_cast<float*>( m_graph.samples() ),
|
||||
_n->m_pluginData = new bSynth(
|
||||
const_cast<float*>( m_graph.samples() ),
|
||||
m_graph.length(),
|
||||
_n->frequency(), m_interpolation.value(), factor,
|
||||
engine::getMixer()->sampleRate() );
|
||||
_n->frequency(),
|
||||
m_interpolation.value(), factor,
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
}
|
||||
|
||||
const fpp_t frames = _n->framesLeftForCurrentPeriod();
|
||||
|
||||
@@ -123,7 +123,7 @@ void kickerInstrument::playNote( notePlayHandle * _n, bool,
|
||||
sampleFrame * _working_buffer )
|
||||
{
|
||||
const float decfr = m_decayModel.value() *
|
||||
engine::getMixer()->sampleRate() / 1000.0f;
|
||||
engine::getMixer()->processingSampleRate() / 1000.0f;
|
||||
const f_cnt_t tfp = _n->totalFramesPlayed();
|
||||
|
||||
if ( tfp == 0 )
|
||||
@@ -152,7 +152,7 @@ void kickerInstrument::playNote( notePlayHandle * _n, bool,
|
||||
|
||||
sweepOsc * so = static_cast<sweepOsc *>( _n->m_pluginData );
|
||||
so->update( _working_buffer, frames, f1, f2,
|
||||
engine::getMixer()->sampleRate() );
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
|
||||
if( _n->released() )
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ladspa_port_dialog.cpp - dialog to test a LADSPA plugin
|
||||
*
|
||||
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
|
||||
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -95,11 +95,11 @@ ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key )
|
||||
{
|
||||
if( min != NOHINT )
|
||||
{
|
||||
min *= engine::getMixer()->sampleRate();
|
||||
min *= engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
if( max != NOHINT )
|
||||
{
|
||||
max *= engine::getMixer()->sampleRate();
|
||||
max *= engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ void ladspaEffect::pluginInstantiation( void )
|
||||
if( manager->areHintsSampleRateDependent(
|
||||
m_key, port ) )
|
||||
{
|
||||
p->max *= engine::getMixer()->sampleRate();
|
||||
p->max *= engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
|
||||
p->min = manager->getLowerBound( m_key, port );
|
||||
@@ -239,7 +239,7 @@ void ladspaEffect::pluginInstantiation( void )
|
||||
if( manager->areHintsSampleRateDependent(
|
||||
m_key, port ) )
|
||||
{
|
||||
p->min *= engine::getMixer()->sampleRate();
|
||||
p->min *= engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
|
||||
p->def = manager->getDefaultSetting( m_key, port );
|
||||
@@ -296,7 +296,7 @@ void ladspaEffect::pluginInstantiation( void )
|
||||
for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ )
|
||||
{
|
||||
LADSPA_Handle effect = manager->instantiate( m_key,
|
||||
engine::getMixer()->sampleRate() );
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
if( effect == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect",
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
//
|
||||
|
||||
|
||||
//#define engine::getMixer()->sampleRate() 44100.0f
|
||||
//#define engine::getMixer()->processingSampleRate() 44100.0f
|
||||
|
||||
|
||||
extern "C"
|
||||
@@ -110,8 +110,8 @@ void lb302Filter::recalc()
|
||||
{
|
||||
vcf_e1 = exp(6.109 + 1.5876*(fs->envmod) + 2.1553*(fs->cutoff) - 1.2*(1.0-(fs->reso)));
|
||||
vcf_e0 = exp(5.613 - 0.8*(fs->envmod) + 2.1553*(fs->cutoff) - 0.7696*(1.0-(fs->reso)));
|
||||
vcf_e0*=M_PI/engine::getMixer()->sampleRate();
|
||||
vcf_e1*=M_PI/engine::getMixer()->sampleRate();
|
||||
vcf_e0*=M_PI/engine::getMixer()->processingSampleRate();
|
||||
vcf_e1*=M_PI/engine::getMixer()->processingSampleRate();
|
||||
vcf_e1 -= vcf_e0;
|
||||
|
||||
vcf_rescoeff = exp(-1.20 + 3.455*(fs->reso));
|
||||
@@ -249,14 +249,14 @@ void lb302Filter3Pole::envRecalc()
|
||||
w = vcf_e0 + vcf_c0;
|
||||
k = (fs->cutoff > 0.975)?0.975:fs->cutoff;
|
||||
kfco = 50.f + (k)*((2300.f-1600.f*(fs->envmod))+(w) *
|
||||
(700.f+1500.f*(k)+(1500.f+(k)*(engine::getMixer()->sampleRate()/2.f-6000.f)) *
|
||||
(700.f+1500.f*(k)+(1500.f+(k)*(engine::getMixer()->processingSampleRate()/2.f-6000.f)) *
|
||||
(fs->envmod)) );
|
||||
//+iacc*(.3+.7*kfco*kenvmod)*kaccent*kaccurve*2000
|
||||
|
||||
|
||||
#ifdef LB_24_IGNORE_ENVELOPE
|
||||
// kfcn = fs->cutoff;
|
||||
kfcn = 2.0 * kfco / engine::getMixer()->sampleRate();
|
||||
kfcn = 2.0 * kfco / engine::getMixer()->processingSampleRate();
|
||||
#else
|
||||
kfcn = w;
|
||||
#endif
|
||||
@@ -490,7 +490,7 @@ void lb302Synth::filterChanged( void )
|
||||
|
||||
float d = 0.2 + (2.3*vcf_dec_knob.value());
|
||||
|
||||
d *= engine::getMixer()->sampleRate(); // d *= smpl rate
|
||||
d *= engine::getMixer()->processingSampleRate(); // d *= smpl rate
|
||||
fs.envdecay = pow(0.1, 1.0/d * ENVINC); // decay is 0.1 to the 1/d * ENVINC
|
||||
// vcf_envdecay is now adjusted for both
|
||||
// sampling rate and ENVINC
|
||||
@@ -513,15 +513,15 @@ void lb302Synth::db24Toggled( void )
|
||||
|
||||
void lb302Synth::detuneChanged( void )
|
||||
{
|
||||
float freq = vco_inc*engine::getMixer()->sampleRate()/vco_detune;
|
||||
float freq = vco_inc*engine::getMixer()->processingSampleRate()/vco_detune;
|
||||
float slidebase_freq=0;
|
||||
|
||||
if(vco_slide) {
|
||||
slidebase_freq = vco_slidebase*engine::getMixer()->sampleRate()/vco_detune;
|
||||
slidebase_freq = vco_slidebase*engine::getMixer()->processingSampleRate()/vco_detune;
|
||||
}
|
||||
|
||||
vco_detune = powf(2.0f, (float)vco_fine_detune_knob.value()/1200.0f);
|
||||
vco_inc = freq*vco_detune/engine::getMixer()->sampleRate();
|
||||
vco_inc = freq*vco_detune/engine::getMixer()->processingSampleRate();
|
||||
|
||||
// If a slide note is pending,
|
||||
if(vco_slideinc)
|
||||
@@ -530,7 +530,7 @@ void lb302Synth::detuneChanged( void )
|
||||
// If currently sliding,
|
||||
// May need to rescale vco_slide as well
|
||||
if(vco_slide)
|
||||
vco_slidebase = slidebase_freq*vco_detune/engine::getMixer()->sampleRate();
|
||||
vco_slidebase = slidebase_freq*vco_detune/engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ void lb302Synth::recalcFilter()
|
||||
// THIS IS OLD 3pole/24dB code, I may reintegrate it. Don't need it
|
||||
// right now. Should be toggled by LB_24_RES_TRICK at the moment.
|
||||
|
||||
/*kfcn = 2.0 * (((vcf_cutoff*3000))) / engine::getMixer()->sampleRate();
|
||||
/*kfcn = 2.0 * (((vcf_cutoff*3000))) / engine::getMixer()->processingSampleRate();
|
||||
kp = ((-2.7528*kfcn + 3.0429)*kfcn + 1.718)*kfcn - 0.9984;
|
||||
kp1 = kp+1.0;
|
||||
kp1h = 0.5*kp1;
|
||||
@@ -708,7 +708,7 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size)
|
||||
// Handle Envelope
|
||||
if(vca_mode==0) {
|
||||
vca_a+=(vca_a0-vca_a)*vca_attack;
|
||||
if(sample_cnt>=0.5*engine::getMixer()->sampleRate())
|
||||
if(sample_cnt>=0.5*engine::getMixer()->processingSampleRate())
|
||||
vca_mode = 2;
|
||||
}
|
||||
else if(vca_mode == 1) {
|
||||
@@ -925,14 +925,14 @@ void lb302Synth::playNote( notePlayHandle * _n, bool,
|
||||
// END NOT SURE OF
|
||||
|
||||
// Reserve this note for retrigger in process()
|
||||
hold_note.vco_inc = _n->frequency()*vco_detune/engine::getMixer()->sampleRate(); // TODO: Use actual sampling rate.
|
||||
hold_note.vco_inc = _n->frequency()*vco_detune/engine::getMixer()->processingSampleRate(); // TODO: Use actual sampling rate.
|
||||
hold_note.dead = deadToggle->value();
|
||||
use_hold_note = true;
|
||||
catch_decay = 1;
|
||||
}
|
||||
#else
|
||||
lb302Note note;
|
||||
note.vco_inc = _n->frequency()*vco_detune/engine::getMixer()->sampleRate(); // TODO: Use actual sampling rate.
|
||||
note.vco_inc = _n->frequency()*vco_detune/engine::getMixer()->processingSampleRate(); // TODO: Use actual sampling rate.
|
||||
note.dead = deadToggle.value();
|
||||
initNote(¬e);
|
||||
vca_mode=0;
|
||||
@@ -943,7 +943,7 @@ void lb302Synth::playNote( notePlayHandle * _n, bool,
|
||||
/// Start a new note.
|
||||
else {
|
||||
lb302Note note;
|
||||
note.vco_inc = _n->frequency()*vco_detune/engine::getMixer()->sampleRate(); // TODO: Use actual sampling rate.
|
||||
note.vco_inc = _n->frequency()*vco_detune/engine::getMixer()->processingSampleRate(); // TODO: Use actual sampling rate.
|
||||
note.dead = deadToggle.value();
|
||||
initNote(¬e);
|
||||
use_hold_note = false;
|
||||
|
||||
@@ -140,11 +140,11 @@ void liveToolView::keyPressEvent( QKeyEvent * _ke )
|
||||
switch( _ke->key() )
|
||||
{
|
||||
case Qt::Key_Space:
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
engine::getSong()->pause();
|
||||
}
|
||||
else if( engine::getSong()->paused() &&
|
||||
else if( engine::getSong()->isPaused() &&
|
||||
engine::getSong()->playMode() ==
|
||||
song::Mode_PlaySong )
|
||||
{
|
||||
|
||||
@@ -572,11 +572,11 @@ void oscillatorObject::updateVolume( void )
|
||||
void oscillatorObject::updateDetuning( void )
|
||||
{
|
||||
m_detuningLeft = powf( 2.0f, m_harmonic
|
||||
+ (float)m_detuneModel.value() / 100.0f )
|
||||
/ engine::getMixer()->sampleRate();
|
||||
+ (float)m_detuneModel.value() / 100.0f ) /
|
||||
engine::getMixer()->processingSampleRate();
|
||||
m_detuningRight = powf( 2.0f, m_harmonic
|
||||
- (float)m_detuneModel.value() / 100.0f )
|
||||
/ engine::getMixer()->sampleRate();
|
||||
- (float)m_detuneModel.value() / 100.0f ) /
|
||||
engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -386,7 +386,8 @@ void sf2Instrument::updateSampleRate( void )
|
||||
double tempRate;
|
||||
|
||||
// Set & get, returns the true sample rate
|
||||
fluid_settings_setnum( m_settings, "synth.sample-rate", engine::getMixer()->sampleRate() );
|
||||
fluid_settings_setnum( m_settings, "synth.sample-rate",
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
fluid_settings_getnum( m_settings, "synth.sample-rate", &tempRate );
|
||||
m_internalSampleRate = static_cast<int>( tempRate );
|
||||
|
||||
@@ -414,7 +415,7 @@ void sf2Instrument::updateSampleRate( void )
|
||||
m_synthMutex.unlock();
|
||||
}
|
||||
|
||||
if( m_internalSampleRate < engine::getMixer()->sampleRate() )
|
||||
if( m_internalSampleRate < engine::getMixer()->processingSampleRate() )
|
||||
{
|
||||
m_synthMutex.lock();
|
||||
if( m_srcState != NULL )
|
||||
@@ -480,11 +481,11 @@ void sf2Instrument::play( bool _try_parallelizing,
|
||||
|
||||
m_synthMutex.lock();
|
||||
|
||||
if( m_internalSampleRate < engine::getMixer()->sampleRate() &&
|
||||
if( m_internalSampleRate < engine::getMixer()->processingSampleRate() &&
|
||||
m_srcState != NULL )
|
||||
{
|
||||
const fpp_t f = frames * m_internalSampleRate /
|
||||
engine::getMixer()->sampleRate();
|
||||
engine::getMixer()->processingSampleRate();
|
||||
sampleFrame * tmp = new sampleFrame[f];
|
||||
fluid_synth_write_float( m_synth, f, tmp, 0, 2, tmp, 1, 2 );
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ void malletsInstrument::playNote( notePlayHandle * _n, bool,
|
||||
m_vibratoFreqModel.value(),
|
||||
p,
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->sampleRate() );
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
}
|
||||
else if( p == 9 )
|
||||
{
|
||||
@@ -245,7 +245,7 @@ void malletsInstrument::playNote( notePlayHandle * _n, bool,
|
||||
m_lfoSpeedModel.value(),
|
||||
m_adsrModel.value(),
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->sampleRate() );
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -258,7 +258,7 @@ void malletsInstrument::playNote( notePlayHandle * _n, bool,
|
||||
m_strikeModel.value() * 128.0,
|
||||
m_velocityModel.value(),
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->sampleRate() );
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ void oscillatorObject::updateDetuningLeft( void )
|
||||
{
|
||||
m_detuningLeft = powf( 2.0f, ( (float)m_coarseModel.value() * 100.0f
|
||||
+ (float)m_fineLeftModel.value() ) / 1200.0f )
|
||||
/ engine::getMixer()->sampleRate();
|
||||
/ engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ void oscillatorObject::updateDetuningRight( void )
|
||||
{
|
||||
m_detuningRight = powf( 2.0f, ( (float)m_coarseModel.value() * 100.0f
|
||||
+ (float)m_fineRightModel.value() ) / 1200.0f )
|
||||
/ engine::getMixer()->sampleRate();
|
||||
/ engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ void vibed::playNote( notePlayHandle * _n, bool, sampleFrame * _working_buffer )
|
||||
if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )
|
||||
{
|
||||
_n->m_pluginData = new stringContainer( _n->frequency(),
|
||||
engine::getMixer()->sampleRate(),
|
||||
engine::getMixer()->processingSampleRate(),
|
||||
m_sampleLength );
|
||||
|
||||
for( Uint8 i = 0; i < 9; ++i )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* vibrating_sring.h - model of a vibrating string lifted from pluckedSynth
|
||||
*
|
||||
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/yahoo/com>
|
||||
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/yahoo/com>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "templates.h"
|
||||
#include "interpolation.h"
|
||||
#include "mixer.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
vibratingString::vibratingString( float _pitch,
|
||||
float _pick,
|
||||
@@ -39,7 +41,8 @@ vibratingString::vibratingString( float _pitch,
|
||||
float _string_loss,
|
||||
float _detune,
|
||||
bool _state ) :
|
||||
m_oversample( 2 * _oversample / (int)( _sample_rate / SAMPLE_RATES[0] ) ),
|
||||
m_oversample( 2 * _oversample / (int)( _sample_rate /
|
||||
engine::getMixer()->baseSampleRate() ) ),
|
||||
m_randomize( _randomize ),
|
||||
m_stringLoss( 1.0f - _string_loss ),
|
||||
m_state( 0.1f )
|
||||
|
||||
@@ -422,7 +422,8 @@ void remoteVSTPlugin::updateSampleRate( void )
|
||||
{
|
||||
lock();
|
||||
writeValueS<Sint16>( VST_SAMPLE_RATE );
|
||||
writeValueS<sample_rate_t>( engine::getMixer()->sampleRate() );
|
||||
writeValueS<sample_rate_t>(
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
unlock();
|
||||
}
|
||||
|
||||
@@ -530,7 +531,7 @@ Sint16 remoteVSTPlugin::processNextMessage( void )
|
||||
writeValueS<Sint16>( VST_SAMPLE_RATE );
|
||||
// handle is the same
|
||||
writeValueS<sample_rate_t>(
|
||||
engine::getMixer()->sampleRate() );
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
break;
|
||||
|
||||
case VST_GET_BUFFER_SIZE:
|
||||
|
||||
@@ -43,9 +43,8 @@
|
||||
|
||||
|
||||
|
||||
audioALSA::audioALSA( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer ) :
|
||||
audioDevice( _sample_rate, tLimit<ch_cnt_t>(
|
||||
audioALSA::audioALSA( bool & _success_ful, mixer * _mixer ) :
|
||||
audioDevice( tLimit<ch_cnt_t>(
|
||||
configManager::inst()->value( "audioalsa", "channels" ).toInt(),
|
||||
DEFAULT_CHANNELS, SURROUND_CHANNELS ),
|
||||
_mixer ),
|
||||
@@ -70,7 +69,7 @@ audioALSA::audioALSA( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
snd_pcm_hw_params_malloc( &m_hwParams );
|
||||
snd_pcm_sw_params_malloc( &m_swParams );
|
||||
|
||||
if( ( err = setHWParams( _sample_rate, channels(),
|
||||
if( ( err = setHWParams( channels(),
|
||||
SND_PCM_ACCESS_RW_INTERLEAVED ) ) < 0 )
|
||||
{
|
||||
printf( "Setting of hwparams failed: %s\n",
|
||||
@@ -267,9 +266,7 @@ void audioALSA::run( void )
|
||||
|
||||
|
||||
|
||||
int audioALSA::setHWParams( const sample_rate_t _sample_rate,
|
||||
const ch_cnt_t _channels,
|
||||
snd_pcm_access_t _access )
|
||||
int audioALSA::setHWParams( const ch_cnt_t _channels, snd_pcm_access_t _access )
|
||||
{
|
||||
int err, dir;
|
||||
|
||||
@@ -320,32 +317,20 @@ int audioALSA::setHWParams( const sample_rate_t _sample_rate,
|
||||
|
||||
// set the sample rate
|
||||
if( ( err = snd_pcm_hw_params_set_rate( m_handle, m_hwParams,
|
||||
_sample_rate, 0 ) ) < 0 )
|
||||
sampleRate(), 0 ) ) < 0 )
|
||||
{
|
||||
int q = 0;
|
||||
if( sampleRate() == SAMPLE_RATES[1] )
|
||||
{
|
||||
q = 1;
|
||||
}
|
||||
if( sampleRate() == 44100 || sampleRate() == 88200 )
|
||||
{
|
||||
SAMPLE_RATES[0] = 48000;
|
||||
SAMPLE_RATES[1] = 96000;
|
||||
}
|
||||
else
|
||||
{
|
||||
SAMPLE_RATES[0] = 44100;
|
||||
SAMPLE_RATES[1] = 88200;
|
||||
}
|
||||
setSampleRate( SAMPLE_RATES[q] );
|
||||
if( ( err = snd_pcm_hw_params_set_rate( m_handle, m_hwParams,
|
||||
SAMPLE_RATES[q], 0 ) ) < 0 )
|
||||
getMixer()->baseSampleRate(), 0 ) ) < 0 )
|
||||
{
|
||||
printf( "Could not set sample rate: %s\n",
|
||||
snd_strerror( err ) );
|
||||
return( err );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setSampleRate( getMixer()->processingSampleRate() );
|
||||
}
|
||||
|
||||
m_periodSize = getMixer()->framesPerPeriod();
|
||||
m_bufferSize = m_periodSize * 8;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* audio_device.cpp - base-class for audio-devices used by LMMS-mixer
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -37,20 +37,15 @@
|
||||
|
||||
|
||||
|
||||
audioDevice::audioDevice( const sample_rate_t _sample_rate,
|
||||
const ch_cnt_t _channels, mixer * _mixer ) :
|
||||
m_sampleRate( _sample_rate ),
|
||||
audioDevice::audioDevice( const ch_cnt_t _channels, mixer * _mixer ) :
|
||||
m_sampleRate( _mixer->processingSampleRate() ),
|
||||
m_channels( _channels ),
|
||||
m_mixer( _mixer ),
|
||||
m_buffer( new surroundSampleFrame[getMixer()->framesPerPeriod()] )
|
||||
{
|
||||
int error;
|
||||
if( ( m_srcState = src_new(
|
||||
#ifdef HQ_SINC
|
||||
SRC_SINC_BEST_QUALITY,
|
||||
#else
|
||||
SRC_SINC_FASTEST,
|
||||
#endif
|
||||
getMixer()->qualitySettings().libsrcInterpolation(),
|
||||
SURROUND_CHANNELS, &error ) ) == NULL )
|
||||
{
|
||||
printf( "Error: src_new() failed in audio_device.cpp!\n" );
|
||||
@@ -102,11 +97,12 @@ fpp_t audioDevice::getNextBuffer( surroundSampleFrame * _ab )
|
||||
lock();
|
||||
|
||||
// now were safe to access the device
|
||||
if( getMixer()->sampleRate() != m_sampleRate )
|
||||
if( getMixer()->processingSampleRate() != m_sampleRate )
|
||||
{
|
||||
resample( b, frames, _ab, getMixer()->sampleRate(),
|
||||
resample( b, frames, _ab, getMixer()->processingSampleRate(),
|
||||
m_sampleRate );
|
||||
frames = frames * m_sampleRate / getMixer()->sampleRate();
|
||||
frames = frames * m_sampleRate /
|
||||
getMixer()->processingSampleRate();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -156,7 +152,7 @@ void audioDevice::renamePort( audioPort * )
|
||||
|
||||
|
||||
|
||||
void FASTCALL audioDevice::resample( const surroundSampleFrame * _src,
|
||||
void audioDevice::resample( const surroundSampleFrame * _src,
|
||||
const fpp_t _frames,
|
||||
surroundSampleFrame * _dst,
|
||||
const sample_rate_t _src_sr,
|
||||
@@ -183,7 +179,7 @@ void FASTCALL audioDevice::resample( const surroundSampleFrame * _src,
|
||||
|
||||
|
||||
|
||||
Uint32 FASTCALL audioDevice::convertToS16( const surroundSampleFrame * _ab,
|
||||
Uint32 audioDevice::convertToS16( const surroundSampleFrame * _ab,
|
||||
const fpp_t _frames,
|
||||
const float _master_gain,
|
||||
int_sample_t * _output_buffer,
|
||||
@@ -228,8 +224,7 @@ Uint32 FASTCALL audioDevice::convertToS16( const surroundSampleFrame * _ab,
|
||||
|
||||
|
||||
|
||||
void FASTCALL audioDevice::clearS16Buffer( int_sample_t * _outbuf,
|
||||
const fpp_t _frames )
|
||||
void audioDevice::clearS16Buffer( int_sample_t * _outbuf, const fpp_t _frames )
|
||||
{
|
||||
#ifdef LMMS_DEBUG
|
||||
assert( _outbuf != NULL );
|
||||
|
||||
@@ -40,13 +40,15 @@ audioFileDevice::audioFileDevice( const sample_rate_t _sample_rate,
|
||||
const bitrate_t _min_bitrate,
|
||||
const bitrate_t _max_bitrate,
|
||||
mixer * _mixer ) :
|
||||
audioDevice( _sample_rate, _channels, _mixer ),
|
||||
audioDevice( _channels, _mixer ),
|
||||
m_outputFile( _file ),
|
||||
m_useVbr( _use_vbr ),
|
||||
m_nomBitrate( _nom_bitrate ),
|
||||
m_minBitrate( _min_bitrate ),
|
||||
m_maxBitrate( _max_bitrate )
|
||||
{
|
||||
setSampleRate( _sample_rate );
|
||||
|
||||
if( m_outputFile.open( QFile::WriteOnly | QFile::Truncate ) == FALSE )
|
||||
{
|
||||
QMessageBox::critical( NULL,
|
||||
|
||||
@@ -48,9 +48,8 @@
|
||||
|
||||
|
||||
|
||||
audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer ) :
|
||||
audioDevice( _sample_rate, tLimit<int>( configManager::inst()->value(
|
||||
audioJACK::audioJACK( bool & _success_ful, mixer * _mixer ) :
|
||||
audioDevice( tLimit<int>( configManager::inst()->value(
|
||||
"audiojack", "channels" ).toInt(),
|
||||
DEFAULT_CHANNELS, SURROUND_CHANNELS ),
|
||||
_mixer ),
|
||||
@@ -114,9 +113,7 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
|
||||
if( jack_get_sample_rate( m_client ) != sampleRate() )
|
||||
{
|
||||
SAMPLE_RATES[0] = jack_get_sample_rate( m_client );
|
||||
SAMPLE_RATES[1] = 2 * SAMPLE_RATES[0];
|
||||
setSampleRate( SAMPLE_RATES[0] );
|
||||
setSampleRate( jack_get_sample_rate( m_client ) );
|
||||
}
|
||||
|
||||
for( Uint8 ch = 0; ch < channels(); ++ch )
|
||||
|
||||
@@ -79,9 +79,8 @@
|
||||
|
||||
|
||||
|
||||
audioOSS::audioOSS( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer ) :
|
||||
audioDevice( _sample_rate, tLimit<ch_cnt_t>(
|
||||
audioOSS::audioOSS( bool & _success_ful, mixer * _mixer ) :
|
||||
audioDevice( tLimit<ch_cnt_t>(
|
||||
configManager::inst()->value( "audiooss", "channels" ).toInt(),
|
||||
DEFAULT_CHANNELS, SURROUND_CHANNELS ),
|
||||
_mixer ),
|
||||
@@ -180,31 +179,14 @@ audioOSS::audioOSS( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
}
|
||||
if( value != sampleRate() )
|
||||
{
|
||||
//printf( "Soundcard uses different sample-rate than LMMS "
|
||||
// "does!\n" );
|
||||
int q = 0;
|
||||
if( sampleRate() == SAMPLE_RATES[1] )
|
||||
{
|
||||
q = 1;
|
||||
}
|
||||
if( sampleRate() == 44100 || sampleRate() == 88200 )
|
||||
{
|
||||
SAMPLE_RATES[0] = 48000;
|
||||
SAMPLE_RATES[1] = 96000;
|
||||
}
|
||||
else
|
||||
{
|
||||
SAMPLE_RATES[0] = 44100;
|
||||
SAMPLE_RATES[1] = 88200;
|
||||
}
|
||||
setSampleRate( SAMPLE_RATES[q] );
|
||||
value = sampleRate();
|
||||
value = getMixer()->baseSampleRate();
|
||||
if ( ioctl( m_audioFD, SNDCTL_DSP_SPEED, &value ) < 0 )
|
||||
{
|
||||
perror( "SNDCTL_DSP_SPEED" );
|
||||
printf( "Couldn't set audio frequency\n" );
|
||||
return;
|
||||
}
|
||||
setSampleRate( value );
|
||||
}
|
||||
|
||||
_success_ful = TRUE;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* surround-audio-buffers into RAM, maybe later
|
||||
* also harddisk
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -34,11 +34,10 @@
|
||||
|
||||
|
||||
|
||||
audioSampleRecorder::audioSampleRecorder( const sample_rate_t _sample_rate,
|
||||
const ch_cnt_t _channels,
|
||||
audioSampleRecorder::audioSampleRecorder( const ch_cnt_t _channels,
|
||||
bool & _success_ful,
|
||||
mixer * _mixer ) :
|
||||
audioDevice( _sample_rate, _channels, _mixer ),
|
||||
audioDevice( _channels, _mixer ),
|
||||
m_buffers()
|
||||
{
|
||||
_success_ful = TRUE;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* audio_sdl.cpp - device-class that performs PCM-output via SDL
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -41,9 +41,8 @@
|
||||
|
||||
|
||||
|
||||
audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
mixer * _mixer ) :
|
||||
audioDevice( _sample_rate, DEFAULT_CHANNELS, _mixer ),
|
||||
audioSDL::audioSDL( bool & _success_ful, mixer * _mixer ) :
|
||||
audioDevice( DEFAULT_CHANNELS, _mixer ),
|
||||
m_outBuf( new surroundSampleFrame[getMixer()->framesPerPeriod()] ),
|
||||
m_convertedBuf_pos( 0 ),
|
||||
m_convertEndian( FALSE ),
|
||||
@@ -62,7 +61,7 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
|
||||
return;
|
||||
}
|
||||
|
||||
m_audioHandle.freq = _sample_rate;
|
||||
m_audioHandle.freq = sampleRate();
|
||||
m_audioHandle.format = AUDIO_S16SYS; // we want it in byte-order
|
||||
// of system, so we don't have
|
||||
// to convert the buffers
|
||||
|
||||
@@ -170,7 +170,7 @@ void bbTrackContainer::updateBBTrack( trackContentObject * _tco )
|
||||
|
||||
void bbTrackContainer::play( void )
|
||||
{
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
if( engine::getSong()->playMode() != song::Mode_PlayBB )
|
||||
{
|
||||
@@ -182,7 +182,7 @@ void bbTrackContainer::play( void )
|
||||
engine::getSong()->pause();
|
||||
}
|
||||
}
|
||||
else if( engine::getSong()->paused() )
|
||||
else if( engine::getSong()->isPaused() )
|
||||
{
|
||||
engine::getSong()->resumeFromPause();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* controller.cpp - implementation of class controller which handles remote-control
|
||||
* of automatableModels
|
||||
* controller.cpp - implementation of class controller which handles
|
||||
* remote-control of automatableModels
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
|
||||
*
|
||||
@@ -82,8 +82,7 @@ unsigned int controller::runningFrames()
|
||||
// Get position in seconds
|
||||
float controller::runningTime()
|
||||
{
|
||||
return s_frames /
|
||||
engine::getMixer()->sampleRate() ;
|
||||
return s_frames / engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ void engine::destroy( void )
|
||||
|
||||
void engine::updateFramesPerTick( void )
|
||||
{
|
||||
s_framesPerTick = s_mixer->sampleRate() * 60.0f * 4 /
|
||||
s_framesPerTick = s_mixer->processingSampleRate() * 60.0f * 4 /
|
||||
DefaultTicksPerTact / s_song->getTempo();
|
||||
}
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ void envelopeAndLFOParameters::updateSampleVars( void )
|
||||
engine::getMixer()->lock();
|
||||
|
||||
const float frames_per_env_seg = SECS_PER_ENV_SEGMENT *
|
||||
engine::getMixer()->sampleRate();
|
||||
engine::getMixer()->processingSampleRate();
|
||||
// TODO: Remove the expKnobVals, time should be linear
|
||||
const f_cnt_t predelay_frames = static_cast<f_cnt_t>(
|
||||
frames_per_env_seg *
|
||||
@@ -464,7 +464,7 @@ void envelopeAndLFOParameters::updateSampleVars( void )
|
||||
|
||||
|
||||
const float frames_per_lfo_oscillation = SECS_PER_LFO_OSCILLATION *
|
||||
engine::getMixer()->sampleRate();
|
||||
engine::getMixer()->processingSampleRate();
|
||||
m_lfoPredelayFrames = static_cast<f_cnt_t>( frames_per_lfo_oscillation *
|
||||
expKnobVal( m_lfoPredelayModel.value() ) );
|
||||
m_lfoAttackFrames = static_cast<f_cnt_t>( frames_per_lfo_oscillation *
|
||||
|
||||
@@ -364,7 +364,7 @@ void arpeggiator::processNote( notePlayHandle * _n )
|
||||
|
||||
// number of frames that every note should be played
|
||||
const f_cnt_t arp_frames = (f_cnt_t)( m_arpTimeModel.value() / 1000.0f *
|
||||
engine::getMixer()->sampleRate() );
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
const f_cnt_t gated_frames = (f_cnt_t)( m_arpGateModel.value() *
|
||||
arp_frames / 100.0f );
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ void instrumentSoundShaping::processAudioBuffer( sampleFrame * _ab,
|
||||
if( _n->m_filter == NULL )
|
||||
{
|
||||
_n->m_filter = new basicFilters<>(
|
||||
engine::getMixer()->sampleRate() );
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
}
|
||||
_n->m_filter->setFilterType( m_filterModel.value() );
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* lfo_controller.cpp - implementation of class controller which handles remote-control
|
||||
* of automatableModels
|
||||
* lfo_controller.cpp - implementation of class controller which handles
|
||||
* remote-control of automatableModels
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
|
||||
*
|
||||
@@ -79,7 +79,8 @@ float lfoController::value( int _offset )
|
||||
|
||||
// The new duration in frames
|
||||
// (Samples/Second) / (periods/second) = (Samples/cycle)
|
||||
int newDuration = engine::getMixer()->sampleRate() / m_lfoSpeedModel.value();
|
||||
int newDuration = engine::getMixer()->processingSampleRate() /
|
||||
m_lfoSpeedModel.value();
|
||||
|
||||
m_phaseOffset = m_lfoPhaseModel.value() * newDuration / 360.0;
|
||||
|
||||
@@ -117,8 +118,9 @@ float lfoController::value( int _offset )
|
||||
|
||||
// 44100 frames/sec
|
||||
return m_lfoBaseModel.value() + ( m_lfoAmountModel.value() *
|
||||
sinf( TWO_PI * float( ( frame+m_phaseOffset ) * m_lfoSpeedModel.value() ) /
|
||||
engine::getMixer()->sampleRate() ) / 2.0f );
|
||||
sinf( TWO_PI * float( ( frame+m_phaseOffset ) *
|
||||
m_lfoSpeedModel.value() ) /
|
||||
engine::getMixer()->processingSampleRate() ) / 2.0f );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -65,8 +65,6 @@
|
||||
|
||||
|
||||
|
||||
sample_rate_t SAMPLE_RATES[QUALITY_LEVELS] = { 44100, 44100*2 } ;
|
||||
|
||||
|
||||
|
||||
#define ALIGN_SIZE 64
|
||||
@@ -255,8 +253,12 @@ mixer::mixer( void ) :
|
||||
m_multiThreaded( QThread::idealThreadCount() > 1 ),
|
||||
m_workers(),
|
||||
m_numWorkers( m_multiThreaded ? QThread::idealThreadCount() : 0 ),
|
||||
m_workerSem( m_numWorkers ),
|
||||
m_qualityLevel( DEFAULT_QUALITY_LEVEL ),
|
||||
m_workerSem( m_numWorkers ),
|
||||
m_qualitySettings( qualitySettings::Interpolation_Linear,
|
||||
qualitySettings::Oversampling_None,
|
||||
FALSE, // sample-exact controllers
|
||||
FALSE // alias-free oscillators
|
||||
),
|
||||
m_masterGain( 1.0f ),
|
||||
m_audioDev( NULL ),
|
||||
m_oldAudioDev( NULL ),
|
||||
@@ -372,6 +374,37 @@ void mixer::stopProcessing( void )
|
||||
|
||||
|
||||
|
||||
sample_rate_t mixer::baseSampleRate( void ) const
|
||||
{
|
||||
sample_rate_t sr =
|
||||
configManager::inst()->value( "mixer", "samplerate" ).toInt();
|
||||
if( sr < 44100 )
|
||||
{
|
||||
sr = 44100;
|
||||
}
|
||||
return( sr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sample_rate_t mixer::outputSampleRate( void ) const
|
||||
{
|
||||
return( m_audioDev != NULL ? m_audioDev->sampleRate() :
|
||||
baseSampleRate() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sample_rate_t mixer::processingSampleRate( void ) const
|
||||
{
|
||||
return( outputSampleRate() * m_qualitySettings.sampleRateMultiplier() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool mixer::criticalXRuns( void ) const
|
||||
{
|
||||
return( ( m_cpuLoad >= 99 &&
|
||||
@@ -610,8 +643,8 @@ if( COND_NPH )
|
||||
envelopeAndLFOParameters::triggerLFO();
|
||||
controller::triggerFrameCounter();
|
||||
|
||||
const float new_cpu_load = timer.elapsed() / 10000.0f * sampleRate() /
|
||||
m_framesPerPeriod;
|
||||
const float new_cpu_load = timer.elapsed() / 10000.0f *
|
||||
processingSampleRate() / m_framesPerPeriod;
|
||||
m_cpuLoad = tLimit( (int) ( new_cpu_load * 0.1f + m_cpuLoad * 0.9f ), 0,
|
||||
100 );
|
||||
|
||||
@@ -643,7 +676,7 @@ void mixer::clear( void )
|
||||
|
||||
|
||||
|
||||
void FASTCALL mixer::bufferToPort( const sampleFrame * _buf,
|
||||
void mixer::bufferToPort( const sampleFrame * _buf,
|
||||
const fpp_t _frames,
|
||||
const f_cnt_t _offset,
|
||||
stereoVolumeVector _vv,
|
||||
@@ -695,8 +728,7 @@ void FASTCALL mixer::bufferToPort( const sampleFrame * _buf,
|
||||
|
||||
|
||||
|
||||
void FASTCALL mixer::clearAudioBuffer( sampleFrame * _ab,
|
||||
const f_cnt_t _frames,
|
||||
void mixer::clearAudioBuffer( sampleFrame * _ab, const f_cnt_t _frames,
|
||||
const f_cnt_t _offset )
|
||||
{
|
||||
memset( _ab+_offset, 0, sizeof( *_ab ) * _frames );
|
||||
@@ -705,8 +737,7 @@ void FASTCALL mixer::clearAudioBuffer( sampleFrame * _ab,
|
||||
|
||||
|
||||
#ifndef DISABLE_SURROUND
|
||||
void FASTCALL mixer::clearAudioBuffer( surroundSampleFrame * _ab,
|
||||
const f_cnt_t _frames,
|
||||
void mixer::clearAudioBuffer( surroundSampleFrame * _ab, const f_cnt_t _frames,
|
||||
const f_cnt_t _offset )
|
||||
{
|
||||
memset( _ab+_offset, 0, sizeof( *_ab ) * _frames );
|
||||
@@ -756,25 +787,23 @@ float mixer::peakValueRight( sampleFrame * _ab, const f_cnt_t _frames )
|
||||
|
||||
|
||||
|
||||
void mixer::setHighQuality( bool _hq_on )
|
||||
void mixer::changeQuality( const struct qualitySettings & _qs )
|
||||
{
|
||||
// don't delete the audio-device
|
||||
stopProcessing();
|
||||
|
||||
// set new quality-level...
|
||||
m_qualityLevel = ( _hq_on == TRUE ) ? HIGH_QUALITY_LEVEL :
|
||||
DEFAULT_QUALITY_LEVEL;
|
||||
m_qualitySettings = _qs;
|
||||
|
||||
startProcessing();
|
||||
|
||||
emit( sampleRateChanged() );
|
||||
|
||||
emit sampleRateChanged();
|
||||
emit qualitySettingsChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FASTCALL mixer::setAudioDevice( audioDevice * _dev, bool _hq )
|
||||
void mixer::setAudioDevice( audioDevice * _dev )
|
||||
{
|
||||
stopProcessing();
|
||||
|
||||
@@ -791,7 +820,6 @@ void FASTCALL mixer::setAudioDevice( audioDevice * _dev, bool _hq )
|
||||
m_audioDev = _dev;
|
||||
}
|
||||
|
||||
m_qualityLevel = _hq ? HIGH_QUALITY_LEVEL : DEFAULT_QUALITY_LEVEL;
|
||||
emit sampleRateChanged();
|
||||
|
||||
startProcessing();
|
||||
@@ -808,17 +836,8 @@ void mixer::restoreAudioDevice( void )
|
||||
delete m_audioDev;
|
||||
|
||||
m_audioDev = m_oldAudioDev;
|
||||
for( Uint8 qli = DEFAULT_QUALITY_LEVEL;
|
||||
qli < QUALITY_LEVELS; ++qli )
|
||||
{
|
||||
if( SAMPLE_RATES[qli] == m_audioDev->sampleRate() )
|
||||
{
|
||||
m_qualityLevel =
|
||||
static_cast<qualityLevels>( qli );
|
||||
emit sampleRateChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
emit sampleRateChanged();
|
||||
|
||||
m_oldAudioDev = NULL;
|
||||
startProcessing();
|
||||
}
|
||||
@@ -849,7 +868,6 @@ void mixer::removePlayHandles( track * _track )
|
||||
|
||||
|
||||
|
||||
|
||||
audioDevice * mixer::tryAudioDevices( void )
|
||||
{
|
||||
bool success_ful = FALSE;
|
||||
@@ -859,8 +877,7 @@ audioDevice * mixer::tryAudioDevices( void )
|
||||
#ifdef ALSA_SUPPORT
|
||||
if( dev_name == audioALSA::name() || dev_name == "" )
|
||||
{
|
||||
dev = new audioALSA( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL],
|
||||
success_ful, this );
|
||||
dev = new audioALSA( success_ful, this );
|
||||
if( success_ful )
|
||||
{
|
||||
m_audioDevName = audioALSA::name();
|
||||
@@ -874,8 +891,7 @@ audioDevice * mixer::tryAudioDevices( void )
|
||||
#ifdef OSS_SUPPORT
|
||||
if( dev_name == audioOSS::name() || dev_name == "" )
|
||||
{
|
||||
dev = new audioOSS( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL],
|
||||
success_ful, this );
|
||||
dev = new audioOSS( success_ful, this );
|
||||
if( success_ful )
|
||||
{
|
||||
m_audioDevName = audioOSS::name();
|
||||
@@ -889,8 +905,7 @@ audioDevice * mixer::tryAudioDevices( void )
|
||||
#ifdef JACK_SUPPORT
|
||||
if( dev_name == audioJACK::name() || dev_name == "" )
|
||||
{
|
||||
dev = new audioJACK( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL],
|
||||
success_ful, this );
|
||||
dev = new audioJACK( success_ful, this );
|
||||
if( success_ful )
|
||||
{
|
||||
m_audioDevName = audioJACK::name();
|
||||
@@ -904,8 +919,7 @@ audioDevice * mixer::tryAudioDevices( void )
|
||||
#ifdef SDL_AUDIO_SUPPORT
|
||||
if( dev_name == audioSDL::name() || dev_name == "" )
|
||||
{
|
||||
dev = new audioSDL( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL],
|
||||
success_ful, this );
|
||||
dev = new audioSDL( success_ful, this );
|
||||
if( success_ful )
|
||||
{
|
||||
m_audioDevName = audioSDL::name();
|
||||
@@ -929,8 +943,7 @@ audioDevice * mixer::tryAudioDevices( void )
|
||||
|
||||
m_audioDevName = audioDummy::name();
|
||||
|
||||
return( new audioDummy( SAMPLE_RATES[m_qualityLevel], success_ful,
|
||||
this ) );
|
||||
return( new audioDummy( success_ful, this ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ oscillator::oscillator( const intModel & _wave_shape_model,
|
||||
void oscillator::update( sampleFrame * _ab, const fpp_t _frames,
|
||||
const ch_cnt_t _chnl )
|
||||
{
|
||||
if( m_freq >= engine::getMixer()->sampleRate()/2 )
|
||||
if( m_freq >= engine::getMixer()->processingSampleRate() / 2 )
|
||||
{
|
||||
mixer::clearAudioBuffer( _ab, _frames );
|
||||
return;
|
||||
|
||||
@@ -88,7 +88,7 @@ sampleBuffer::sampleBuffer( const QString & _audio_file,
|
||||
m_amplification( 1.0f ),
|
||||
m_reversed( FALSE ),
|
||||
m_frequency( BaseFreq ),
|
||||
m_sampleRate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
|
||||
m_sampleRate( engine::getMixer()->baseSampleRate() )
|
||||
{
|
||||
#ifdef SDL_SDL_SOUND_H
|
||||
// init sound-file-system of SDL
|
||||
@@ -117,7 +117,7 @@ sampleBuffer::sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ) :
|
||||
m_amplification( 1.0f ),
|
||||
m_reversed( FALSE ),
|
||||
m_frequency( BaseFreq ),
|
||||
m_sampleRate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
|
||||
m_sampleRate( engine::getMixer()->baseSampleRate() )
|
||||
{
|
||||
if( _frames > 0 )
|
||||
{
|
||||
@@ -148,7 +148,7 @@ sampleBuffer::sampleBuffer( const f_cnt_t _frames ) :
|
||||
m_amplification( 1.0f ),
|
||||
m_reversed( FALSE ),
|
||||
m_frequency( BaseFreq ),
|
||||
m_sampleRate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
|
||||
m_sampleRate( engine::getMixer()->baseSampleRate() )
|
||||
{
|
||||
if( _frames > 0 )
|
||||
{
|
||||
@@ -205,7 +205,7 @@ void sampleBuffer::update( bool _keep_settings )
|
||||
char * f = qstrdup( file.toAscii().constData() );
|
||||
int_sample_t * buf = NULL;
|
||||
ch_cnt_t channels = DEFAULT_CHANNELS;
|
||||
sample_rate_t samplerate = SAMPLE_RATES[DEFAULT_QUALITY_LEVEL];
|
||||
sample_rate_t samplerate = engine::getMixer()->baseSampleRate();
|
||||
|
||||
m_frames = 0;
|
||||
|
||||
@@ -279,7 +279,7 @@ m_data[frame][chnl] = buf[idx] * fac;
|
||||
|
||||
delete[] buf;
|
||||
|
||||
normalize_sample_rate( samplerate, _keep_settings );
|
||||
normalizeSampleRate( samplerate, _keep_settings );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -314,14 +314,14 @@ m_data[frame][chnl] = buf[idx] * fac;
|
||||
|
||||
|
||||
|
||||
void sampleBuffer::normalize_sample_rate( const sample_rate_t _src_sr,
|
||||
void sampleBuffer::normalizeSampleRate( const sample_rate_t _src_sr,
|
||||
bool _keep_settings )
|
||||
{
|
||||
// do samplerate-conversion to our default-samplerate
|
||||
if( _src_sr != SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
|
||||
if( _src_sr != engine::getMixer()->baseSampleRate() )
|
||||
{
|
||||
sampleBuffer * resampled = resample( this, _src_sr,
|
||||
SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] );
|
||||
engine::getMixer()->baseSampleRate() );
|
||||
delete[] m_data;
|
||||
m_frames = resampled->frames();
|
||||
m_data = new sampleFrame[m_frames];
|
||||
@@ -588,8 +588,8 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, handleState * _state,
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
const double freq_factor = (double) _freq / (double) m_frequency
|
||||
* m_sampleRate / engine::getMixer()->sampleRate();
|
||||
const double freq_factor = (double) _freq / (double) m_frequency *
|
||||
m_sampleRate / engine::getMixer()->processingSampleRate();
|
||||
|
||||
// calculate how many frames we have in requested pitch
|
||||
const f_cnt_t total_frames_for_current_pitch = static_cast<f_cnt_t>( (
|
||||
|
||||
@@ -161,8 +161,8 @@ bool samplePlayHandle::isFromTrack( const track * _track ) const
|
||||
f_cnt_t samplePlayHandle::totalFrames( void ) const
|
||||
{
|
||||
return( ( m_sampleBuffer->endFrame() - m_sampleBuffer->startFrame() ) *
|
||||
( engine::getMixer()->sampleRate() /
|
||||
SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] ) );
|
||||
( engine::getMixer()->processingSampleRate() /
|
||||
engine::getMixer()->baseSampleRate() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -607,7 +607,7 @@ void song::startExport( void )
|
||||
|
||||
|
||||
|
||||
void song::stopExport( void )
|
||||
void song::cancelExport( void )
|
||||
{
|
||||
stop();
|
||||
m_exporting = FALSE;
|
||||
|
||||
@@ -614,7 +614,7 @@ void automationEditor::keyPressEvent( QKeyEvent * _ke )
|
||||
break;
|
||||
|
||||
case Qt::Key_Space:
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
stop();
|
||||
}
|
||||
@@ -1641,12 +1641,12 @@ void automationEditor::play( void )
|
||||
m_playButton->setIcon( embed::getIconPixmap(
|
||||
"pause" ) );
|
||||
}
|
||||
else if( engine::getSong()->playing() )
|
||||
else if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
engine::getSong()->pause();
|
||||
m_playButton->setIcon( embed::getIconPixmap( "play" ) );
|
||||
}
|
||||
else if( engine::getSong()->paused() )
|
||||
else if( engine::getSong()->isPaused() )
|
||||
{
|
||||
engine::getSong()->resumeFromPause();
|
||||
m_playButton->setIcon( embed::getIconPixmap(
|
||||
@@ -1662,7 +1662,7 @@ void automationEditor::play( void )
|
||||
}
|
||||
else if( inBBEditor() )
|
||||
{
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
m_playButton->setIcon( embed::getIconPixmap( "play" ) );
|
||||
}
|
||||
@@ -1675,12 +1675,12 @@ void automationEditor::play( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
engine::getSong()->pause();
|
||||
m_playButton->setIcon( embed::getIconPixmap( "play" ) );
|
||||
}
|
||||
else if( engine::getSong()->paused() )
|
||||
else if( engine::getSong()->isPaused() )
|
||||
{
|
||||
engine::getSong()->resumeFromPause();
|
||||
m_playButton->setIcon( embed::getIconPixmap(
|
||||
@@ -1979,7 +1979,7 @@ void automationEditor::deleteSelectedValues( void )
|
||||
|
||||
void automationEditor::updatePosition( const midiTime & _t )
|
||||
{
|
||||
if( ( engine::getSong()->playing() &&
|
||||
if( ( engine::getSong()->isPlaying() &&
|
||||
engine::getSong()->playMode() ==
|
||||
song::Mode_PlayAutomationPattern ) ||
|
||||
m_scrollBack == TRUE )
|
||||
|
||||
@@ -162,7 +162,7 @@ void bbEditor::removeBBView( int _bb )
|
||||
|
||||
void bbEditor::play( void )
|
||||
{
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
if( engine::getSong()->playMode() != song::Mode_PlayBB )
|
||||
{
|
||||
@@ -178,7 +178,7 @@ void bbEditor::play( void )
|
||||
"play" ) );
|
||||
}
|
||||
}
|
||||
else if( engine::getSong()->paused() )
|
||||
else if( engine::getSong()->isPaused() )
|
||||
{
|
||||
engine::getSong()->resumeFromPause();
|
||||
m_playButton->setIcon( embed::getIconPixmap( "pause" ) );
|
||||
@@ -217,7 +217,7 @@ void bbEditor::keyPressEvent( QKeyEvent * _ke )
|
||||
{
|
||||
if ( _ke->key() == Qt::Key_Space )
|
||||
{
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ void exportProjectDialog::keyPressEvent( QKeyEvent * _ke )
|
||||
{
|
||||
if( _ke->key() == Qt::Key_Escape )
|
||||
{
|
||||
if( engine::getSong()->exporting() == FALSE )
|
||||
if( engine::getSong()->isExporting() == FALSE )
|
||||
{
|
||||
accept();
|
||||
}
|
||||
@@ -258,7 +258,7 @@ void exportProjectDialog::keyPressEvent( QKeyEvent * _ke )
|
||||
|
||||
void exportProjectDialog::closeEvent( QCloseEvent * _ce )
|
||||
{
|
||||
if( engine::getSong()->exporting() == TRUE )
|
||||
if( engine::getSong()->isExporting() == TRUE )
|
||||
{
|
||||
abortProjectExport();
|
||||
_ce->ignore();
|
||||
@@ -308,7 +308,7 @@ void exportProjectDialog::exportBtnClicked( void )
|
||||
|
||||
bool success_ful = FALSE;
|
||||
audioFileDevice * dev = fileEncodeDevices[idx].m_getDevInst(
|
||||
DEFAULT_SAMPLE_RATE,
|
||||
44100,
|
||||
DEFAULT_CHANNELS,
|
||||
success_ful,
|
||||
m_fileName,
|
||||
@@ -357,7 +357,7 @@ void exportProjectDialog::exportBtnClicked( void )
|
||||
|
||||
|
||||
|
||||
engine::getMixer()->setAudioDevice( dev, m_hqmCb->model()->value() );
|
||||
engine::getMixer()->setAudioDevice( dev );//, m_hqmCb->model()->value() );
|
||||
engine::getSong()->startExport();
|
||||
|
||||
delete m_hqmCb;
|
||||
@@ -365,8 +365,8 @@ void exportProjectDialog::exportBtnClicked( void )
|
||||
song::playPos & pp = engine::getSong()->getPlayPos(
|
||||
song::Mode_PlaySong );
|
||||
|
||||
while( engine::getSong()->exportDone() == FALSE &&
|
||||
engine::getSong()->exporting() == TRUE
|
||||
while( engine::getSong()->isExportDone() == FALSE &&
|
||||
engine::getSong()->isExporting() == TRUE
|
||||
&& !m_deleteFile )
|
||||
{
|
||||
dev->processNextBuffer();
|
||||
@@ -392,7 +392,7 @@ void exportProjectDialog::exportBtnClicked( void )
|
||||
void exportProjectDialog::cancelBtnClicked( void )
|
||||
{
|
||||
// is song-export-thread active?
|
||||
if( engine::getSong()->exporting() == TRUE )
|
||||
if( engine::getSong()->isExporting() == TRUE )
|
||||
{
|
||||
// then dispose abort of export
|
||||
abortProjectExport();
|
||||
@@ -429,7 +429,7 @@ void exportProjectDialog::finishProjectExport( void )
|
||||
engine::getMainWindow()->resetWindowTitle();
|
||||
}
|
||||
|
||||
engine::getSong()->stopExport();
|
||||
engine::getSong()->cancelExport();
|
||||
|
||||
// if we rendered file from command line, quit after export
|
||||
if( file_to_render != "" )
|
||||
|
||||
@@ -542,8 +542,8 @@ void listView::mouseReleaseEvent( QMouseEvent * _me )
|
||||
samplePlayHandle * s = dynamic_cast<samplePlayHandle *>(
|
||||
m_previewPlayHandle );
|
||||
if( s->totalFrames() - s->framesDone() <=
|
||||
static_cast<f_cnt_t>(
|
||||
engine::getMixer()->sampleRate() * 3 ) )
|
||||
static_cast<f_cnt_t>( engine::getMixer()->
|
||||
processingSampleRate() * 3 ) )
|
||||
{
|
||||
s->setDoneMayReturnTrue( TRUE );
|
||||
m_previewPlayHandle = NULL;
|
||||
|
||||
@@ -779,7 +779,7 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
|
||||
break;
|
||||
|
||||
case Qt::Key_Space:
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
stop();
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
// was there an action where should be played the note?
|
||||
if( play_note == TRUE && m_recording == FALSE &&
|
||||
engine::getSong()->playing() == FALSE )
|
||||
engine::getSong()->isPlaying() == FALSE )
|
||||
{
|
||||
m_lastKey = key_num;
|
||||
m_pattern->getInstrumentTrack()->processInEvent(
|
||||
@@ -1165,7 +1165,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
m_action != SELECT_NOTES &&
|
||||
m_action != MOVE_SELECTION &&
|
||||
m_recording == FALSE &&
|
||||
engine::getSong()->playing() == FALSE )
|
||||
engine::getSong()->isPlaying() == FALSE )
|
||||
{
|
||||
m_lastKey = key_num;
|
||||
m_pattern->getInstrumentTrack()->processInEvent(
|
||||
@@ -1217,7 +1217,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
}
|
||||
|
||||
if( shortNote != m_currentNote &&
|
||||
engine::getSong()->playing() == FALSE )
|
||||
engine::getSong()->isPlaying() == FALSE )
|
||||
{
|
||||
if( m_currentNote != NULL ) {
|
||||
m_pattern->getInstrumentTrack()->processInEvent(
|
||||
@@ -2139,7 +2139,7 @@ void pianoRoll::play( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
if( engine::getSong()->playMode() != song::Mode_PlayPattern )
|
||||
{
|
||||
@@ -2154,7 +2154,7 @@ void pianoRoll::play( void )
|
||||
m_playButton->setIcon( embed::getIconPixmap( "play" ) );
|
||||
}
|
||||
}
|
||||
else if( engine::getSong()->paused() )
|
||||
else if( engine::getSong()->isPaused() )
|
||||
{
|
||||
engine::getSong()->resumeFromPause();
|
||||
m_playButton->setIcon( embed::getIconPixmap( "pause" ) );
|
||||
@@ -2171,7 +2171,7 @@ void pianoRoll::play( void )
|
||||
|
||||
void pianoRoll::record( void )
|
||||
{
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
stop();
|
||||
}
|
||||
@@ -2526,7 +2526,7 @@ void pianoRoll::deleteSelectedNotes( void )
|
||||
|
||||
void pianoRoll::updatePosition( const midiTime & _t )
|
||||
{
|
||||
if( ( engine::getSong()->playing() &&
|
||||
if( ( engine::getSong()->isPlaying() &&
|
||||
engine::getSong()->playMode() ==
|
||||
song::Mode_PlayPattern ) ||
|
||||
m_scrollBack == TRUE )
|
||||
|
||||
@@ -748,7 +748,7 @@ void setupDialog::setBufferSize( int _value )
|
||||
m_bufSizeLbl->setText( tr( "Frames: %1\nLatency: %2 ms" ).arg(
|
||||
m_bufferSize ).arg(
|
||||
1000.0f * m_bufferSize /
|
||||
engine::getMixer()->sampleRate(),
|
||||
engine::getMixer()->processingSampleRate(),
|
||||
0, 'f', 1 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +429,7 @@ void songEditor::keyPressEvent( QKeyEvent * _ke )
|
||||
}
|
||||
else if( _ke->key() == Qt::Key_Space )
|
||||
{
|
||||
if( m_s->playing() )
|
||||
if( m_s->isPlaying() )
|
||||
{
|
||||
m_s->stop();
|
||||
}
|
||||
@@ -598,7 +598,7 @@ void songEditor::masterPitchReleased( void )
|
||||
|
||||
void songEditor::updatePosition( const midiTime & _t )
|
||||
{
|
||||
if( ( m_s->m_playing && m_s->m_playMode == song::Mode_PlaySong ) ||
|
||||
if( ( m_s->isPlaying() && m_s->m_playMode == song::Mode_PlaySong ) ||
|
||||
m_scrollBack == TRUE )
|
||||
{
|
||||
const int w = width() - DEFAULT_SETTINGS_WIDGET_WIDTH
|
||||
|
||||
@@ -501,7 +501,7 @@ void envelopeAndLFOView::paintEvent( QPaintEvent * )
|
||||
int graph_y_base = LFO_GRAPH_Y + 3 + LFO_GRAPH_H / 2;
|
||||
|
||||
const float frames_for_graph = SECS_PER_LFO_OSCILLATION *
|
||||
engine::getMixer()->sampleRate() / 10;
|
||||
engine::getMixer()->baseSampleRate() / 10;
|
||||
|
||||
const float lfo_gray_amount = 1.0f - fabsf( m_lfoAmountKnob->value() );
|
||||
p.setPen( QPen( QColor( static_cast<int>( 96 * lfo_gray_amount ),
|
||||
|
||||
@@ -551,7 +551,7 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start,
|
||||
{
|
||||
cur_start -= p->startPosition();
|
||||
}
|
||||
if( p->frozen() && engine::getSong()->exporting() == FALSE )
|
||||
if( p->frozen() && !engine::getSong()->isExporting() )
|
||||
{
|
||||
if( cur_start > 0 )
|
||||
{
|
||||
|
||||
@@ -397,7 +397,7 @@ void pattern::clear( void )
|
||||
|
||||
void pattern::freeze( void )
|
||||
{
|
||||
if( engine::getSong()->playing() )
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
QMessageBox::information( 0, tr( "Cannot freeze pattern" ),
|
||||
tr( "The pattern currently "
|
||||
@@ -663,11 +663,9 @@ void patternFreezeThread::run( void )
|
||||
// mixer::restoreAudioDevice(...) deletes old audio-dev and thus
|
||||
// audioSampleRecorder would be destroyed two times...
|
||||
audioSampleRecorder * freeze_recorder = new audioSampleRecorder(
|
||||
engine::getMixer()->sampleRate(),
|
||||
DEFAULT_CHANNELS, b,
|
||||
engine::getMixer() );
|
||||
engine::getMixer()->setAudioDevice( freeze_recorder,
|
||||
engine::getMixer()->highQuality() );
|
||||
engine::getMixer()->setAudioDevice( freeze_recorder );
|
||||
|
||||
// prepare stuff for playing correct things later
|
||||
engine::getSong()->playPattern( m_pattern, FALSE );
|
||||
@@ -777,7 +775,7 @@ patternView::~patternView()
|
||||
engine::getPianoRoll()->setCurrentPattern( NULL );
|
||||
// we have to have the song-editor to stop playing if it played
|
||||
// us before
|
||||
if( engine::getSong()->playing() &&
|
||||
if( engine::getSong()->isPlaying() &&
|
||||
engine::getSong()->playMode() ==
|
||||
song::Mode_PlayPattern )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user