patman, reworked resampling, sample extensions
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@471 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* engine.h - engine-system of LMMS
|
||||
*
|
||||
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -30,6 +30,16 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QtCore/QMap>
|
||||
|
||||
#else
|
||||
|
||||
#include <qmap.h>
|
||||
|
||||
#endif
|
||||
|
||||
class automationEditor;
|
||||
class bbEditor;
|
||||
class projectJournal;
|
||||
@@ -124,6 +134,11 @@ public:
|
||||
}
|
||||
void updateFramesPerTact64th( void );
|
||||
|
||||
const QMap<QString, QString> & sampleExtensions( void )
|
||||
{
|
||||
return( m_sample_extensions );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
bool m_hasGUI;
|
||||
@@ -141,7 +156,11 @@ private:
|
||||
#ifdef LADSPA_SUPPORT
|
||||
ladspa2LMMS * m_ladspaManager;
|
||||
#endif
|
||||
|
||||
|
||||
QMap<QString, QString> m_sample_extensions;
|
||||
|
||||
void load_extensions( void );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -133,13 +133,15 @@ private:
|
||||
|
||||
|
||||
|
||||
class directory : public Q3ListViewItem
|
||||
class directory : public Q3ListViewItem, public engineObject
|
||||
{
|
||||
public:
|
||||
directory( Q3ListView * _parent, const QString & _filename,
|
||||
const QString & _path, const QString & _filter );
|
||||
const QString & _path, const QString & _filter,
|
||||
engine * _engine );
|
||||
directory( directory * _parent, const QString & _filename,
|
||||
const QString & _path, const QString & _filter );
|
||||
const QString & _path, const QString & _filter,
|
||||
engine * _engine );
|
||||
|
||||
void setOpen( bool );
|
||||
void setup( void );
|
||||
@@ -187,13 +189,15 @@ private:
|
||||
|
||||
|
||||
|
||||
class fileItem : public Q3ListViewItem
|
||||
class fileItem : public Q3ListViewItem, public engineObject
|
||||
{
|
||||
public:
|
||||
fileItem( Q3ListView * _parent, const QString & _name,
|
||||
const QString & _path );
|
||||
const QString & _path,
|
||||
engine * _engine );
|
||||
fileItem( Q3ListViewItem * _parent, const QString & _name,
|
||||
const QString & _path );
|
||||
const QString & _path,
|
||||
engine * _engine );
|
||||
|
||||
inline QString fullName( void ) const
|
||||
{
|
||||
@@ -216,6 +220,9 @@ public:
|
||||
return( m_type );
|
||||
}
|
||||
|
||||
QString extension( void );
|
||||
static QString extension( const QString & _file );
|
||||
|
||||
|
||||
private:
|
||||
void initPixmapStuff( void );
|
||||
|
||||
@@ -144,6 +144,8 @@ private:
|
||||
|
||||
void finalize( void );
|
||||
|
||||
bool have_www_browser( void );
|
||||
|
||||
|
||||
QWorkspace * m_workspace;
|
||||
|
||||
@@ -169,8 +171,6 @@ private:
|
||||
QMenu * m_tools_menu;
|
||||
vlist<tool *> m_tools;
|
||||
|
||||
bool have_www_browser( void );
|
||||
|
||||
|
||||
friend class engine;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* pattern.h - declaration of class pattern, which contains all informations
|
||||
* about a pattern
|
||||
*
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -144,12 +144,6 @@ public:
|
||||
return( m_frozenPattern );
|
||||
}
|
||||
|
||||
// if channel-track recognizes that this pattern is frozen, it calls
|
||||
// this instead of playing all the notes
|
||||
void FASTCALL playFrozenData( sampleFrame * _ab,
|
||||
const f_cnt_t _start_frame,
|
||||
const fpab_t _frames );
|
||||
|
||||
// settings-management
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
|
||||
@@ -144,6 +144,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual const QStringList & supportedExtensions( void )
|
||||
{
|
||||
static QStringList no_extensions;
|
||||
return( no_extensions );
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
const plugin::pluginTypes m_type;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,26 @@ public:
|
||||
DOTS
|
||||
} ;
|
||||
|
||||
|
||||
class handleState
|
||||
{
|
||||
public:
|
||||
handleState( bool _varying_pitch = FALSE );
|
||||
virtual ~handleState();
|
||||
|
||||
|
||||
private:
|
||||
f_cnt_t m_frame_index;
|
||||
const bool m_varying_pitch;
|
||||
#ifdef HAVE_SAMPLERATE_H
|
||||
SRC_STATE * m_resampling_data;
|
||||
#endif
|
||||
|
||||
friend class sampleBuffer;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
// constructor which either loads sample _audio_file or decodes
|
||||
// base64-data out of string
|
||||
sampleBuffer( engine * _engine, const QString & _audio_file = "",
|
||||
@@ -80,11 +100,10 @@ public:
|
||||
|
||||
virtual ~sampleBuffer();
|
||||
|
||||
bool FASTCALL play( sampleFrame * _ab, const f_cnt_t _start_frame,
|
||||
bool FASTCALL play( sampleFrame * _ab, handleState * _state,
|
||||
const fpab_t _frames,
|
||||
const float _freq = BASE_FREQ,
|
||||
const bool _looped = FALSE,
|
||||
void * * _resampling_data = NULL );
|
||||
const bool _looped = FALSE );
|
||||
|
||||
void FASTCALL visualize( QPainter & _p, const QRect & _dr,
|
||||
const QRect & _clip,
|
||||
@@ -110,6 +129,16 @@ public:
|
||||
return( m_endFrame );
|
||||
}
|
||||
|
||||
void setLoopStartFrame( f_cnt_t _start )
|
||||
{
|
||||
m_loop_startFrame = _start;
|
||||
}
|
||||
|
||||
void setLoopEndFrame( f_cnt_t _end )
|
||||
{
|
||||
m_loop_endFrame = _end;
|
||||
}
|
||||
|
||||
inline f_cnt_t frames( void ) const
|
||||
{
|
||||
return( m_frames );
|
||||
@@ -125,13 +154,21 @@ public:
|
||||
return( m_reversed );
|
||||
}
|
||||
|
||||
inline float frequency( void ) const
|
||||
{
|
||||
return( m_frequency );
|
||||
}
|
||||
|
||||
inline void setFrequency( float _freq )
|
||||
{
|
||||
m_frequency = _freq;
|
||||
}
|
||||
|
||||
inline const sampleFrame * data( void ) const
|
||||
{
|
||||
return( m_data );
|
||||
}
|
||||
|
||||
static void FASTCALL deleteResamplingData( void * * _ptr );
|
||||
|
||||
QString openAudioFile( void ) const;
|
||||
|
||||
QString & toBase64( QString & _dst ) const;
|
||||
@@ -152,6 +189,9 @@ public:
|
||||
_dst_sr, _buf->eng() ) );
|
||||
}
|
||||
|
||||
void normalize_sample_rate( const sample_rate_t _src_sr,
|
||||
bool _keep_settings = FALSE );
|
||||
|
||||
inline sample_t userWaveSample( const float _sample )
|
||||
{
|
||||
// Precise implementation
|
||||
@@ -182,6 +222,9 @@ public:
|
||||
m_dataMutex.unlock();
|
||||
}
|
||||
|
||||
static QString tryToMakeRelative( const QString & _file );
|
||||
static QString tryToMakeAbsolute( const QString & _file );
|
||||
|
||||
|
||||
public slots:
|
||||
void setAudioFile( const QString & _audio_file );
|
||||
@@ -195,8 +238,6 @@ public slots:
|
||||
private:
|
||||
void FASTCALL update( bool _keep_settings = FALSE );
|
||||
|
||||
static QString tryToMakeRelative( const QString & _file );
|
||||
|
||||
|
||||
#ifdef SDL_SDL_SOUND_H
|
||||
f_cnt_t FASTCALL decodeSampleSDL( const char * _f,
|
||||
@@ -224,20 +265,24 @@ private:
|
||||
f_cnt_t m_frames;
|
||||
f_cnt_t m_startFrame;
|
||||
f_cnt_t m_endFrame;
|
||||
f_cnt_t m_loop_startFrame;
|
||||
f_cnt_t m_loop_endFrame;
|
||||
float m_amplification;
|
||||
bool m_reversed;
|
||||
float m_frequency;
|
||||
QMutex m_dataMutex;
|
||||
|
||||
#ifdef HAVE_SAMPLERATE_H
|
||||
void initResampling( void );
|
||||
void quitResampling( void );
|
||||
SRC_STATE * createResamplingContext( void );
|
||||
static void FASTCALL destroyResamplingContext( SRC_STATE * _context );
|
||||
|
||||
SRC_DATA m_srcData;
|
||||
SRC_STATE * m_srcState;
|
||||
#endif
|
||||
|
||||
sampleFrame * m_sample_fragment;
|
||||
sampleFrame * getSampleFragment( f_cnt_t _start, f_cnt_t _frames,
|
||||
bool _looped );
|
||||
f_cnt_t getLoopedIndex( f_cnt_t _index );
|
||||
|
||||
|
||||
signals:
|
||||
void sampleUpdated( void );
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* sample_play_handle.h - play-handle for playing a sample
|
||||
*
|
||||
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -29,12 +29,12 @@
|
||||
#include <qobject.h>
|
||||
|
||||
#include "play_handle.h"
|
||||
#include "sample_buffer.h"
|
||||
#include "types.h"
|
||||
#include "engine.h"
|
||||
|
||||
class bbTrack;
|
||||
class pattern;
|
||||
class sampleBuffer;
|
||||
class sampleTCO;
|
||||
class track;
|
||||
class audioPort;
|
||||
@@ -79,6 +79,7 @@ private:
|
||||
bool m_doneMayReturnTrue;
|
||||
|
||||
f_cnt_t m_frame;
|
||||
sampleBuffer::handleState m_state;
|
||||
|
||||
audioPort * m_audioPort;
|
||||
const bool m_ownAudioPort;
|
||||
|
||||
Reference in New Issue
Block a user