Hi Gerald,
Thank you! Do you mind if we talk about this a little? FYI, I took
your sources and created a patch (see below).
First, your code is based on version 0.006. Meanwhile trunk is
>0.008, and I have more or less `rm -rf src/composite-gui/` in trunk.
I.e. we're rebooting the GUI.
Second, the part that's pretty critical is how we do the audio
backend... and it looks like you didn't do anything other than create
an empty class or two. That's OK... but how do you envision the audio
loops being integrated into the main audio loop?
(Tritium::EnginePrivate::audioEngine_process())
The idea of that loop is documented in Documentation/NEW_DESIGN.txt:
int Sequencer::process(uint32_t nframes)
{
UPDATE TRANSPORT POSITION;
PROCESS INPUTS;
PROCESS OUTPUTS;
DO MIXER PROCESSING;
NOTIFY TRANSPORT NUMBER OF FRAMES PROCESSED;
return 0;
}
(Don't let 'Sequencer' fool you... the Engine is essentially a sequencer.)
Finally, one last thing... your composite repository needs to be an
actual clone of mine in order for it to be useful. Please do this:
1. Log in to gitorious
2. Go to http://gitorious.org/composite/composite
3. Click the button `Clone repository` and follow the
instructions they give you.
4. Use that. Delete the composite-gerald repos.
Note that I've created a branch for 0.006, but DO NOT use it. It's
reserved for bug fixes. Please make all your changes against the
`master` branch. Feel free to leave it named `master`, or create a
branch called `topic/audio-loops` or something.
Peace,
Gabriel
[PATCH] Commit Pieces of Audio Loop playing/editing.
Code contributed by Gerald Mwangi <gerald...@gmx.de>
---
src/Tritium/Tritium/AudioLoop.hpp | 16 ++++
src/Tritium/Tritium/AudioLoopPlayer.hpp | 19 +++++
src/Tritium/Tritium/Instrument.hpp | 2 +-
src/Tritium/Tritium/InstrumentLayer.hpp | 2 +-
src/Tritium/Tritium/Sampler.hpp | 2 +-
src/Tritium/src/AudioLoop.cpp | 13 +++
src/Tritium/src/AudioLoopPlayer.cpp | 9 ++
src/Tritium/src/Song.cpp | 2 +-
src/composite-gui/CompositeApp.cpp | 36 +++++----
src/composite-gui/CompositeApp.hpp | 15 ++--
src/composite-gui/InstrumentEditor/WaveDisplay.cpp | 28 +++++--
src/composite-gui/InstrumentEditor/WaveDisplay.hpp | 8 ++
src/composite-gui/LoopEditor/LoopEditorPanel.cpp | 86 ++++++++++++++++++++
src/composite-gui/LoopEditor/LoopEditorPanel.hpp | 39 +++++++++
src/composite-gui/LoopEditor/LoopPlayerLine.cpp | 55 +++++++++++++
src/composite-gui/LoopEditor/LoopPlayerLine.hpp | 36 ++++++++
.../LoopEditor/LoopPlayerLinePanel.cpp | 42 ++++++++++
.../LoopEditor/LoopPlayerLinePanel.hpp | 27 ++++++
src/composite-gui/MainForm.cpp | 69 ++++++++++++----
src/composite-gui/MainForm.hpp | 1 +
src/composite-gui/PatternEditor/EditorPanel.cpp | 72 ++++++++++++++++
src/composite-gui/PatternEditor/EditorPanel.hpp | 34 ++++++++
.../PatternEditor/PatternEditorInstrumentList.cpp | 8 +-
src/composite-gui/PlayerControl.cpp | 7 +-
.../PlaylistEditor/PlaylistDialog.cpp | 3 +-
src/composite-gui/SongEditor/SongEditor.cpp | 9 +-
.../SoundLibrary/SoundLibraryImportDialog.cpp | 10 +-
.../SoundLibrary/SoundLibraryPanel.cpp | 3 +-
.../SoundLibrary/SoundLibraryPropertiesDialog.cpp | 5 +-
29 files changed, 591 insertions(+), 67 deletions(-)
create mode 100644 src/Tritium/Tritium/AudioLoop.hpp
create mode 100644 src/Tritium/Tritium/AudioLoopPlayer.hpp
create mode 100644 src/Tritium/src/AudioLoop.cpp
create mode 100644 src/Tritium/src/AudioLoopPlayer.cpp
create mode 100644 src/composite-gui/LoopEditor/LoopEditorPanel.cpp
create mode 100644 src/composite-gui/LoopEditor/LoopEditorPanel.hpp
create mode 100644 src/composite-gui/LoopEditor/LoopPlayerLine.cpp
create mode 100644 src/composite-gui/LoopEditor/LoopPlayerLine.hpp
create mode 100644 src/composite-gui/LoopEditor/LoopPlayerLinePanel.cpp
create mode 100644 src/composite-gui/LoopEditor/LoopPlayerLinePanel.hpp
create mode 100644 src/composite-gui/PatternEditor/EditorPanel.cpp
create mode 100644 src/composite-gui/PatternEditor/EditorPanel.hpp
diff --git a/src/Tritium/Tritium/AudioLoop.hpp b/src/Tritium/Tritium/AudioLoop.hpp
new file mode 100644
index 0000000..ad7e868
--- /dev/null
+++ b/src/Tritium/Tritium/AudioLoop.hpp
@@ -0,0 +1,16 @@
+#ifndef AUDIOLOOP_HPP
+#define AUDIOLOOP_HPP
+#include <Tritium/InstrumentLayer.hpp>;
+
+namespace Tritium
+{
+ class AudioLoop : public InstrumentLayer
+ {
+ public:
+ AudioLoop( T<Sample>::shared_ptr sample );
+ ~AudioLoop();
+
+ };
+}
+
+#endif // AUDIOLOOP_HPP
diff --git a/src/Tritium/Tritium/AudioLoopPlayer.hpp b/src/Tritium/Tritium/AudioLoopPlayer.hpp
new file mode 100644
index 0000000..66e3983
--- /dev/null
+++ b/src/Tritium/Tritium/AudioLoopPlayer.hpp
@@ -0,0 +1,19 @@
+#ifndef AUDIOLOOPPLAYER_HPP
+#define AUDIOLOOPPLAYER_HPP
+#include <Tritium/Instrument.hpp>
+
+namespace Tritium
+{
+ class AudioLoopPlayer : public Instrument
+ {
+ public:
+ AudioLoopPlayer(
+ const QString& id,
+ const QString& name,
+ ADSR* adsr
+ );
+ ~AudioLoopPlayer(){};
+ };
+}
+
+#endif // AUDIOLOOPPLAYER_HPP
diff --git a/src/Tritium/Tritium/Instrument.hpp b/src/Tritium/Tritium/Instrument.hpp
index 8402e08..dc3deb4 100644
--- a/src/Tritium/Tritium/Instrument.hpp
+++ b/src/Tritium/Tritium/Instrument.hpp
@@ -52,7 +52,7 @@ namespace Tritium
);
static T<Instrument>::shared_ptr create_empty();
- ~Instrument();
+ virtual ~Instrument();
static T<Instrument>::shared_ptr load_instrument(
Engine* engine,
diff --git a/src/Tritium/Tritium/InstrumentLayer.hpp b/src/Tritium/Tritium/InstrumentLayer.hpp
index 07a0687..463265a 100644
--- a/src/Tritium/Tritium/InstrumentLayer.hpp
+++ b/src/Tritium/Tritium/InstrumentLayer.hpp
@@ -43,7 +43,7 @@ namespace Tritium
typedef std::pair<float, float> velocity_range_t;
InstrumentLayer( T<Sample>::shared_ptr sample );
- ~InstrumentLayer();
+ virtual ~InstrumentLayer();
void set_velocity_range(float min, float max);
void set_velocity_range(velocity_range_t range);
diff --git a/src/Tritium/Tritium/Sampler.hpp b/src/Tritium/Tritium/Sampler.hpp
index ac74cd5..69ecca4 100644
--- a/src/Tritium/Tritium/Sampler.hpp
+++ b/src/Tritium/Tritium/Sampler.hpp
@@ -51,7 +51,7 @@ struct TransportPosition;
class Sampler
{
public:
- Sampler(T<AudioPortManager>::shared_ptr apm);
+ Sampler(T<AudioPortManager>::shared_ptr apm);
~Sampler();
void process( SeqScriptConstIterator beg,
diff --git a/src/Tritium/src/AudioLoop.cpp b/src/Tritium/src/AudioLoop.cpp
new file mode 100644
index 0000000..ff74809
--- /dev/null
+++ b/src/Tritium/src/AudioLoop.cpp
@@ -0,0 +1,13 @@
+#include <Tritium/AudioLoop.hpp>
+#include <Tritium/Engine.hpp>
+
+using namespace Tritium;
+AudioLoop::AudioLoop( T<Sample>::shared_ptr sample ):InstrumentLayer(sample)
+{
+ //Engine::getS
+}
+
+AudioLoop::~AudioLoop()
+{
+
+}
diff --git a/src/Tritium/src/AudioLoopPlayer.cpp b/src/Tritium/src/AudioLoopPlayer.cpp
new file mode 100644
index 0000000..f63a408
--- /dev/null
+++ b/src/Tritium/src/AudioLoopPlayer.cpp
@@ -0,0 +1,9 @@
+#include <Tritium/AudioLoopPlayer.hpp>
+
+using namespace Tritium;
+AudioLoopPlayer::AudioLoopPlayer(
+ const QString& id,
+ const QString& name,
+ ADSR* adsr
+ ):Instrument(id,name,adsr){
+}
diff --git a/src/Tritium/src/Song.cpp b/src/Tritium/src/Song.cpp
index 4c437e0..44ad663 100644
--- a/src/Tritium/src/Song.cpp
+++ b/src/Tritium/src/Song.cpp
@@ -439,7 +439,7 @@ namespace Tritium
song->set_humanize_velocity_value( 0.0 );
song->set_swing_factor( 0.0 );
- T<Instrument>::shared_ptr inst( new Instrument( QString(0), "New instrument", new ADSR ) );
+ T<Instrument>::shared_ptr inst( new Instrument( QString((char*)0), "New instrument", new ADSR ) );
T<Sampler>::shared_ptr sampler = engine->get_sampler();
sampler->clear();
sampler->add_instrument( inst );
diff --git a/src/composite-gui/CompositeApp.cpp b/src/composite-gui/CompositeApp.cpp
index 69df30b..f87500d 100644
--- a/src/composite-gui/CompositeApp.cpp
+++ b/src/composite-gui/CompositeApp.cpp
@@ -30,6 +30,7 @@
#include "HelpBrowser.hpp"
#include "LadspaFXProperties.hpp"
#include "InstrumentRack.hpp"
+#include "PatternEditor/EditorPanel.hpp"
#include "PatternEditor/PatternEditorPanel.hpp"
#include "InstrumentEditor/InstrumentEditorPanel.hpp"
@@ -71,7 +72,7 @@ public:
void selection_changed() {
if(q) {
- q->getInstrumentRack()
+ q->getEditorPanel()->getInstrumentRack()
->getSoundLibraryPanel()
->update_background_color();
}
@@ -87,7 +88,7 @@ public:
CompositeApp::CompositeApp( MainForm *pMainForm, T<Song>::shared_ptr pFirstSong )
: m_pMainForm( pMainForm )
, m_pMixer( NULL )
- , m_pPatternEditorPanel( NULL )
+ , m_pEditorPanel( NULL )
, m_pAudioEngineInfoForm( NULL )
, m_pSongEditorPanel( NULL )
, m_pHelpBrowser( NULL )
@@ -209,16 +210,20 @@ void CompositeApp::setupSinglePanedInterface()
pSouthPanel->setLayout( pEditorHBox );
// INSTRUMENT RACK
- m_pInstrumentRack = new InstrumentRack( NULL );
-
- // PATTERN EDITOR
- m_pPatternEditorPanel = new PatternEditorPanel( NULL );
- WindowProperties patternEditorProp = pPref->getPatternEditorProperties();
- m_pPatternEditorPanel->resize( patternEditorProp.width, patternEditorProp.height );
-
- pEditorHBox->addWidget( m_pPatternEditorPanel );
- pEditorHBox->addWidget( m_pInstrumentRack );
-
+ //m_pInstrumentRack = new InstrumentRack( NULL );
+
+ // PATTERN EDITOR
+ //m_pPatternEditorPanel = new PatternEditorPanel( NULL );
+ WindowProperties patternEditorProp = pPref->getPatternEditorProperties();
+ //m_pPatternEditorPanel->resize( patternEditorProp.width, patternEditorProp.height );
+
+ //EDITOR PANEL
+ m_pEditorPanel =new EditorPanel(NULL);
+ //pEditorHBox->addWidget( m_pPatternEditorPanel );
+ //pEditorHBox->addWidget( m_pInstrumentRack );
+ m_pEditorPanel->getPatternEditorPanel()->resize( patternEditorProp.width, patternEditorProp.height );
+ m_pEditorPanel->resize( patternEditorProp.width, patternEditorProp.height );
+ pEditorHBox->addWidget(m_pEditorPanel);
// PLayer control
m_pPlayerControl = new PlayerControl( NULL );
@@ -298,8 +303,8 @@ void CompositeApp::setSong(T<Song>::shared_ptr song)
g_engine->get_preferences()->setLastSongFilename( song->get_filename() );
m_pSongEditorPanel->updateAll();
- m_pPatternEditorPanel->updateSLnameLabel();
-
+ //m_pPatternEditorPanel->updateSLnameLabel();
+ m_pEditorPanel->getPatternEditorPanel()->updateSLnameLabel();
QString songName( song->get_name() );
if( songName == "Untitled Song" && !song->get_filename().isEmpty() ){
songName = song->get_filename();
@@ -401,7 +406,8 @@ void CompositeApp::showInfoSplash()
void CompositeApp::onDrumkitLoad( QString name ){
setStatusBarMessage( trUtf8( "Drumkit loaded: [%1]" ).arg( name ), 2000 );
- m_pPatternEditorPanel->updateSLnameLabel( );
+ //m_pPatternEditorPanel->updateSLnameLabel( );
+ m_pEditorPanel->getPatternEditorPanel()->updateSLnameLabel();
}
void CompositeApp::onEventQueueTimer()
diff --git a/src/composite-gui/CompositeApp.hpp b/src/composite-gui/CompositeApp.hpp
index 7e8c7cf..c699dce 100644
--- a/src/composite-gui/CompositeApp.hpp
+++ b/src/composite-gui/CompositeApp.hpp
@@ -41,7 +41,7 @@ namespace Tritium
class SongEditorPanel;
class MainForm;
class PlayerControl;
-class PatternEditorPanel;
+//class PatternEditorPanel;
class InstrumentEditorPanel;
class SongEditor;
class Mixer;
@@ -50,9 +50,10 @@ class SimpleHTMLBrowser;
class LadspaFXProperties;
class LadspaFXInfo;
class LadspaFXGroup;
-class InstrumentRack;
+//class InstrumentRack;
class PlaylistDialog;
class AppPlaylistListener;
+class EditorPanel;
//class AudioFileBrowser;
class CompositeApp : public QObject
@@ -84,9 +85,10 @@ class CompositeApp : public QObject
PlaylistDialog* getPlayListDialog() { return m_pPlaylistDialog; }
// AudioFileBrowser* getAudioFileBrowser() { return m_pAudioFileBrowser; }
SimpleHTMLBrowser* getHelpBrowser() { return m_pHelpBrowser; }
- PatternEditorPanel* getPatternEditorPanel() { return m_pPatternEditorPanel; }
+// PatternEditorPanel* getPatternEditorPanel() { return m_pPatternEditorPanel; }
+ EditorPanel* getEditorPanel() { return m_pEditorPanel; }
PlayerControl* getPlayerControl() { return m_pPlayerControl; }
- InstrumentRack* getInstrumentRack(){ return m_pInstrumentRack; }
+// InstrumentRack* getInstrumentRack(){ return m_pInstrumentRack; }
void setStatusBarMessage( const QString& msg, int msec = 0 );
@@ -114,12 +116,13 @@ class CompositeApp : public QObject
MainForm *m_pMainForm;
::Mixer *m_pMixer;
- PatternEditorPanel* m_pPatternEditorPanel;
+ EditorPanel* m_pEditorPanel;
+// PatternEditorPanel* m_pPatternEditorPanel;
AudioEngineInfoForm *m_pAudioEngineInfoForm;
SongEditorPanel *m_pSongEditorPanel;
SimpleHTMLBrowser *m_pHelpBrowser;
SimpleHTMLBrowser *m_pFirstTimeInfo;
- InstrumentRack* m_pInstrumentRack;
+// InstrumentRack* m_pInstrumentRack;
PlayerControl *m_pPlayerControl;
PlaylistDialog *m_pPlaylistDialog;
AppPlaylistListener *m_pAppPlaylistListener;
diff --git a/src/composite-gui/InstrumentEditor/WaveDisplay.cpp b/src/composite-
gui/InstrumentEditor/WaveDisplay.cpp
index 63a2101..da0b4f5 100644
--- a/src/composite-gui/InstrumentEditor/WaveDisplay.cpp
+++ b/src/composite-gui/InstrumentEditor/WaveDisplay.cpp
@@ -38,16 +38,21 @@ WaveDisplay::WaveDisplay(QWidget* pParent)
setAttribute(Qt::WA_NoBackground);
//DEBUGLOG( "INIT" );
- int w = 277;
+ int w = 277;
int h = 58;
+ m_pPeakData=0;
resize( w, h );
- bool ok = m_background.load( Skin::getImagePath() + "/waveDisplay/background.png" );
- if( ok == false ){
+ bool ok = m_background_orig.load( Skin::getImagePath() + "/waveDisplay/background.png" );
+
+ if( ok == false ){
ERRORLOG( "Error loading pixmap" );
}
+ m_background=m_background_orig.copy();
+ if(!m_pPeakData)
+ m_pPeakData = new int[ w ];
+ memset(m_pPeakData,0,w*sizeof(int));
- m_pPeakData = new int[ w ];
}
@@ -57,8 +62,8 @@ WaveDisplay::WaveDisplay(QWidget* pParent)
WaveDisplay::~WaveDisplay()
{
//DEBUGLOG( "DESTROY" );
-
- delete[] m_pPeakData;
+ if(m_pPeakData)
+ delete[] m_pPeakData;
}
@@ -128,3 +133,14 @@ void WaveDisplay::updateDisplay( Tritium::InstrumentLayer *pLayer )
update();
}
+void WaveDisplay::resizeEvent(QResizeEvent *ev)
+{
+ QSize size=ev->size();
+ if(m_pPeakData)
+ delete[] m_pPeakData;
+ m_pPeakData = new int[ size.width() ];
+ memset(m_pPeakData,0,size.width()*sizeof(int));
+ m_background=m_background_orig.scaled(size);
+ emit resizeSignal(size);
+}
+
diff --git a/src/composite-gui/InstrumentEditor/WaveDisplay.hpp b/src/composite-
gui/InstrumentEditor/WaveDisplay.hpp
index d37688d..0953024 100644
--- a/src/composite-gui/InstrumentEditor/WaveDisplay.hpp
+++ b/src/composite-gui/InstrumentEditor/WaveDisplay.hpp
@@ -41,7 +41,15 @@ class WaveDisplay : public QWidget
void paintEvent(QPaintEvent *ev);
+ void resizeEvent(QResizeEvent *ev);
+
+ signals:
+ void resizeSignal(QSize size);
+
+
+
private:
+ QPixmap m_background_orig;
QPixmap m_background;
QString m_sSampleName;
int *m_pPeakData;
diff --git a/src/composite-gui/LoopEditor/LoopEditorPanel.cpp b/src/composite-gui/LoopEditor/LoopEditorPanel.cpp
new file mode 100644
index 0000000..5a45e21
--- /dev/null
+++ b/src/composite-gui/LoopEditor/LoopEditorPanel.cpp
@@ -0,0 +1,86 @@
+#include "LoopEditorPanel.hpp"
+#include "LoopPlayerLinePanel.hpp"
+#include "LoopPlayerLine.hpp"
+#include "InstrumentEditor/WaveDisplay.hpp"
+
+#include <QGridLayout>
+#include <QVBoxLayout>
+#include "widgets/PixmapWidget.hpp"
+#include "CompositeApp.hpp"
+#include "LoopPlayerLine.hpp"
+#include "Tritium/Engine.hpp"
+#include "Tritium/Sampler.hpp"
+#include "Tritium/InstrumentList.hpp"
+#include "Tritium/Instrument.hpp"
+#include "Tritium/AudioLoopPlayer.hpp"
+
+#include "InstrumentEditor/WaveDisplay.hpp"
+
+using namespace Tritium;
+LoopEditorPanel::LoopEditorPanel(QWidget *parent) :
+ QTableWidget(parent)
+{
+ m_pUpdateTimer = new QTimer( this );
+ connect( m_pUpdateTimer, SIGNAL( timeout() ), this, SLOT( updateLoopLines() ) );
+ m_pUpdateTimer->start(50);
+ setColumnCount(2);
+ this->setColumnWidth(0,181);
+ this->setColumnWidth(1,this->width()-181);
+ this->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+ //this->setSizePolicy();
+ m_lLoopLines.clear();
+ updateLoopLines();
+}
+LoopEditorPanel::~LoopEditorPanel()
+{
+ delete m_pUpdateTimer;
+}
+
+void LoopEditorPanel::updateLoopLines()
+{
+ //DEBUGLOG( "Update lines" );
+
+ Engine *pEngine = g_engine;
+ //T<Song>::shared_ptr pSong = pEngine->getSong();
+ T<InstrumentList>::shared_ptr pInstrList = g_engine->get_sampler()->get_instrument_list();
+ ::Mixer * mixer = CompositeApp::get_instance()->getMixer();
+
+ for ( unsigned nInstr = 0; nInstr < MAX_INSTRUMENTS; ++nInstr )
+ {
+ T<Instrument>::shared_ptr pInst=pInstrList->get(nInstr);
+ T<AudioLoopPlayer>::shared_ptr pPlayer=boost::dynamic_pointer_cast<AudioLoopPlayer>(pInst);
+ if(pPlayer!=0){
+ bool bPlayerExists=false;
+ for(int i=0;i<m_lLoopLines.size();i++)
+ {
+ if(m_lLoopLines[i]->isPlayer(pPlayer))
+ {
+ bPlayerExists=true;
+ break;
+ }
+ }
+
+ if(!bPlayerExists){
+ addNewLoopLine(pPlayer);
+ }
+
+ }
+ }
+
+
+
+
+
+
+
+}
+
+void LoopEditorPanel::addNewLoopLine(T<AudioLoopPlayer>::shared_ptr pPlayer)
+{
+ setRowCount(rowCount()+1);
+ LoopPlayerLine* pPlayerLine=new LoopPlayerLine(pPlayer,this);
+ setCellWidget(rowCount()-1,0,pPlayerLine->getPanel());
+ setCellWidget(rowCount()-1,1,pPlayerLine->getDisplay());
+ m_lLoopLines.append(pPlayerLine);
+}
+
diff --git a/src/composite-gui/LoopEditor/LoopEditorPanel.hpp b/src/composite-gui/LoopEditor/LoopEditorPanel.hpp
new file mode 100644
index 0000000..ff090c8
--- /dev/null
+++ b/src/composite-gui/LoopEditor/LoopEditorPanel.hpp
@@ -0,0 +1,39 @@
+#ifndef LOOPEDITOR_HPP
+#define LOOPEDITOR_HPP
+
+#include <QTableWidget>
+#include <QtGui>
+#include <QList>
+#include "Tritium/memory.hpp"
+#include "EventListener.hpp"
+namespace Tritium
+{
+ class Mixer;
+ class InstrumentList;
+ class AudioLoopPlayer;
+}
+
+class LoopPlayerLine;
+
+using namespace Tritium;
+class LoopEditorPanel: public QTableWidget, public EventListener
+{
+ Q_OBJECT
+public:
+ LoopEditorPanel(QWidget *parent=0);
+ ~LoopEditorPanel();
+ void addNewLoopLine(T<AudioLoopPlayer>::shared_ptr pPlayer);
+
+
+
+public slots:
+ void updateLoopLines();
+private:
+ QTimer* m_pUpdateTimer;
+ QList<LoopPlayerLine*> m_lLoopLines;
+
+
+};
+
+
+#endif // LOOPEDITOR_HPP
diff --git a/src/composite-gui/LoopEditor/LoopPlayerLine.cpp b/src/composite-gui/LoopEditor/LoopPlayerLine.cpp
new file mode 100644
index 0000000..7128e10
--- /dev/null
+++ b/src/composite-gui/LoopEditor/LoopPlayerLine.cpp
@@ -0,0 +1,55 @@
+#include "LoopPlayerLine.hpp"
+#include "Tritium/InstrumentLayer.hpp"
+#include "Tritium/AudioLoopPlayer.hpp"
+#include "Tritium/Sample.hpp"
+#include "Tritium/memory.hpp"
+#include "LoopPlayerLinePanel.hpp"
+#include "InstrumentEditor/WaveDisplay.hpp"
+
+using namespace Tritium;
+LoopPlayerLine::LoopPlayerLine(T<AudioLoopPlayer>::shared_ptr pPlayer,QWidget *parent) :
+ QWidget(parent)
+{
+ m_pPanel=new LoopPlayerLinePanel(parent);
+ m_pWaveDisplay=new WaveDisplay(parent);
+ connect(m_pPanel,SIGNAL(loadClicked(QString)),this,SLOT(onLoadLoop(QString)));
+ connect(m_pWaveDisplay,SIGNAL(resizeSignal(QSize)),this,SLOT(onDisplayResize(QSize)));
+ m_pPlayer=pPlayer;
+ // pLayer=new Tritium::InstrumentLayer(pLoop);
+ // m_pPlayer->set_layer(pLayer,0);
+}
+
+LoopPlayerLine::~LoopPlayerLine()
+{
+
+}
+
+void LoopPlayerLine::onLoadLoop(QString file)
+{
+ T<Sample>::shared_ptr pLoop=Sample::load(file);
+
+
+
+ InstrumentLayer *pLayer=m_pPlayer->get_layer(0);
+
+ if(pLayer!=0){
+ pLayer->set_sample(pLoop);
+ }
+ else {
+ pLayer=new Tritium::InstrumentLayer(pLoop);
+ m_pPlayer->set_layer(pLayer,0);
+ }
+
+ m_pWaveDisplay->updateDisplay(pLayer);
+
+}
+
+void LoopPlayerLine::onDisplayResize(QSize size)
+{
+ m_pWaveDisplay->updateDisplay(m_pPlayer->get_layer(0));
+}
+
+bool LoopPlayerLine::isPlayer(T<Tritium::AudioLoopPlayer>::shared_ptr pPlayer)
+{
+ return (pPlayer==m_pPlayer);
+}
diff --git a/src/composite-gui/LoopEditor/LoopPlayerLine.hpp b/src/composite-gui/LoopEditor/LoopPlayerLine.hpp
new file mode 100644
index 0000000..9ec2f90
--- /dev/null
+++ b/src/composite-gui/LoopEditor/LoopPlayerLine.hpp
@@ -0,0 +1,36 @@
+#ifndef LOOPPLAYERLINE_HPP
+#define LOOPPLAYERLINE_HPP
+
+#include <QWidget>
+#include <Tritium/memory.hpp>
+
+class LoopPlayerLinePanel;
+class WaveDisplay;
+namespace Tritium
+{
+ class AudioLoopPlayer;
+}
+using namespace Tritium;
+class LoopPlayerLine : public QWidget
+{
+ Q_OBJECT
+public:
+ LoopPlayerLine(T<AudioLoopPlayer>::shared_ptr pPlayer,QWidget *parent = 0);
+ ~LoopPlayerLine();
+
+ LoopPlayerLinePanel* getPanel(){ return m_pPanel; }
+ WaveDisplay* getDisplay(){ return m_pWaveDisplay; }
+ bool isPlayer(T<Tritium::AudioLoopPlayer>::shared_ptr pPlayer);
+signals:
+
+public slots:
+ void onLoadLoop(QString file);
+ void onDisplayResize(QSize size);
+private:
+ LoopPlayerLinePanel *m_pPanel;
+ WaveDisplay *m_pWaveDisplay;
+ T<AudioLoopPlayer>::shared_ptr m_pPlayer;
+
+};
+
+#endif // LOOPPLAYERLINE_HPP
diff --git a/src/composite-gui/LoopEditor/LoopPlayerLinePanel.cpp b/src/composite-
gui/LoopEditor/LoopPlayerLinePanel.cpp
new file mode 100644
index 0000000..d034ba8
--- /dev/null
+++ b/src/composite-gui/LoopEditor/LoopPlayerLinePanel.cpp
@@ -0,0 +1,42 @@
+#include "LoopPlayerLinePanel.hpp"
+
+#include "widgets/Button.hpp"
+#include "widgets/LCD.hpp"
+#include <QFileDialog>
+#include <QVBoxLayout>
+
+LoopPlayerLinePanel::LoopPlayerLinePanel(QWidget *parent) :
+ QWidget(parent)
+{
+ m_pLoadLoopBtn=new Button(
+ this,
+ "/instrumentEditor/loadLayer_on.png",
+ "/instrumentEditor/loadLayer_off.png",
+ "/instrumentEditor/loadLayer_over.png",
+ QSize( 94, 13 )
+ );
+ m_pLoopNameDisp= new LCDDisplay( this, LCDDigit::SMALL_BLUE, 10 );
+ connect(m_pLoadLoopBtn,SIGNAL(clicked(Button*)),this,SLOT(onLoadLoopBtn()));
+ QVBoxLayout* pVBox=new QVBoxLayout();
+ pVBox->addWidget(m_pLoadLoopBtn);
+ pVBox->addWidget(m_pLoopNameDisp);
+ this->setLayout(pVBox);
+
+
+}
+
+LoopPlayerLinePanel::~LoopPlayerLinePanel()
+{
+
+}
+
+void LoopPlayerLinePanel::onLoadLoopBtn()
+{
+ m_sfile=QFileDialog::getOpenFileName(0,tr("Open a soundfile"),QDir::homePath(),tr("Soundfiles (*.wav)"));
+ QString name=m_sfile.split(QDir::separator()).last();
+
+
+ m_pLoopNameDisp->setText(name);
+ emit loadClicked(m_sfile);
+
+}
diff --git a/src/composite-gui/LoopEditor/LoopPlayerLinePanel.hpp b/src/composite-
gui/LoopEditor/LoopPlayerLinePanel.hpp
new file mode 100644
index 0000000..feef56f
--- /dev/null
+++ b/src/composite-gui/LoopEditor/LoopPlayerLinePanel.hpp
@@ -0,0 +1,27 @@
+#ifndef LOOPPLAYERLINEPANEL_HPP
+#define LOOPPLAYERLINEPANEL_HPP
+
+#include <QWidget>
+
+class Button;
+class LCDDisplay;
+class LoopPlayerLinePanel : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit LoopPlayerLinePanel(QWidget *parent = 0);
+ ~LoopPlayerLinePanel();
+signals:
+ void loadClicked(QString file);
+
+public slots:
+ void onLoadLoopBtn();
+
+private:
+ Button* m_pLoadLoopBtn;
+ LCDDisplay* m_pLoopNameDisp;
+ QString m_sfile;
+};
+
+#endif // LOOPPLAYERLINEPANEL_HPP
diff --git a/src/composite-gui/MainForm.cpp b/src/composite-gui/MainForm.cpp
index 4076602..f19674a 100644
--- a/src/composite-gui/MainForm.cpp
+++ b/src/composite-gui/MainForm.cpp
@@ -33,6 +33,8 @@
#include <Tritium/Logger.hpp>
#include <Tritium/InstrumentLayer.hpp>
#include <Tritium/InstrumentList.hpp>
+#include <Tritium/AudioLoopPlayer.hpp>
+#include <Tritium/AudioLoop.hpp>
#include <Tritium/memory.hpp>
using namespace Tritium;
@@ -51,7 +53,9 @@ using namespace Tritium;
#include "Mixer/Mixer.hpp"
#include "InstrumentEditor/InstrumentEditorPanel.hpp"
+#include "PatternEditor/EditorPanel.hpp"
#include "PatternEditor/PatternEditorPanel.hpp"
+
#include "SongEditor/SongEditor.hpp"
#include "SongEditor/SongEditorPanel.hpp"
#include "SoundLibrary/SoundLibraryPanel.hpp"
@@ -121,7 +125,8 @@ MainForm::MainForm( QApplication *app, const QString& songFilename )
// we need to do all this to support the keyboard playing
// for all the window modes
h2app->getMixer()->installEventFilter (this);
- h2app->getPatternEditorPanel()->installEventFilter (this);
+ //h2app->getPatternEditorPanel()->installEventFilter (this);
+ h2app->getEditorPanel()->getPatternEditorPanel()->installEventFilter(this);
h2app->getSongEditorPanel()->installEventFilter (this);
h2app->getPlayerControl()->installEventFilter(this);
InstrumentEditorPanel::get_instance()->installEventFilter(this);
@@ -221,7 +226,9 @@ void MainForm::createMenuBar()
// INSTRUMENTS MENU
QMenu *m_pInstrumentsMenu = m_pMenubar->addMenu( trUtf8( "I&nstruments" ) );
m_pInstrumentsMenu->addAction( trUtf8( "&Add instrument" ), this, SLOT(
action_instruments_addInstrument() ), QKeySequence( "" ) );
- m_pInstrumentsMenu->addAction( trUtf8( "&Clear all" ), this, SLOT( action_instruments_clearAll() ),
QKeySequence( "" ) );
+ m_pInstrumentsMenu->addAction( trUtf8( "&Add loop player" ), this, SLOT(
action_instruments_addLoopPlayer() ), QKeySequence( "" ) );
+
+ m_pInstrumentsMenu->addAction( trUtf8( "&Clear all" ), this, SLOT( action_instruments_clearAll() ),
QKeySequence( "" ) );
m_pInstrumentsMenu->addAction( trUtf8( "&Save library" ), this, SLOT( action_instruments_saveLibrary() ),
QKeySequence( "" ) );
m_pInstrumentsMenu->addAction( trUtf8( "&Export library" ), this, SLOT(
action_instruments_exportLibrary() ), QKeySequence( "" ) );
m_pInstrumentsMenu->addAction( trUtf8( "&Import library" ), this, SLOT(
action_instruments_importLibrary() ), QKeySequence( "" ) );
@@ -288,7 +295,7 @@ void MainForm::action_file_new()
song->set_filename( "" );
h2app->setSong(song);
g_engine->setSelectedPatternNumber( 0 );
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->update_background_color();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>update_background_color();
}
@@ -462,8 +469,8 @@ void MainForm::action_file_export_pattern_as()
h2app->setStatusBarMessage ( trUtf8 ( "Pattern saved." ), 10000 );
//update SoundlibraryPanel
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->test_expandedItems();
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->updateDrumkitList();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>test_expandedItems();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>updateDrumkitList();
}
@@ -504,7 +511,7 @@ void MainForm::action_file_open()
openSongFile( filename );
}
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->update_background_color();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>update_background_color();
}
@@ -665,6 +672,36 @@ void MainForm::action_instruments_addInstrument()
}
+void MainForm::action_instruments_addLoopPlayer()
+{
+ g_engine->lock( RIGHT_HERE );
+ T<InstrumentList>::shared_ptr pList = g_engine->get_sampler()->get_instrument_list();
+
+ // create a new valid ID for this instrument
+ int nID = -1;
+ for ( uint i = 0; i < pList->get_size(); ++i ) {
+ T<Instrument>::shared_ptr pInstr = pList->get( i );
+ if ( pInstr->get_id().toInt() > nID ) {
+ nID = pInstr->get_id().toInt();
+ }
+ }
+ ++nID;
+
+ T<AudioLoopPlayer>::shared_ptr pNewInstr( new AudioLoopPlayer(QString( nID ), "New AudioLoop", new
ADSR()) );
+ pList->add( pNewInstr );
+
+ #ifdef JACK_SUPPORT
+ g_engine->renameJackPorts();
+ #endif
+
+ g_engine->unlock();
+
+ g_engine->setSelectedInstrumentNumber( pList->get_size() - 1 );
+
+ // Force an update
+ //g_engine->get_event_queue()->pushEvent( EVENT_SELECTED_PATTERN_CHANGED, -1 );
+}
+
void MainForm::action_instruments_clearAll()
{
@@ -725,8 +762,8 @@ void MainForm::action_instruments_saveLibrary()
{
SoundLibrarySaveDialog dialog( this );
dialog.exec();
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->test_expandedItems();
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->updateDrumkitList();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>test_expandedItems();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>updateDrumkitList();
}
@@ -764,7 +801,7 @@ void MainForm::action_file_export()
void MainForm::action_window_showDrumkitManagerPanel()
{
- InstrumentRack *pPanel = CompositeApp::get_instance()->getInstrumentRack();
+ InstrumentRack *pPanel = CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack();
pPanel->setHidden( pPanel->isVisible() );
}
@@ -794,11 +831,11 @@ void MainForm::closeAll() {
// save pattern editor properties
WindowProperties patternEditorProp;
- patternEditorProp.x = h2app->getPatternEditorPanel()->x();
- patternEditorProp.y = h2app->getPatternEditorPanel()->y();
- patternEditorProp.width = h2app->getPatternEditorPanel()->width();
- patternEditorProp.height = h2app->getPatternEditorPanel()->height();
- patternEditorProp.visible = h2app->getPatternEditorPanel()->isVisible();
+ patternEditorProp.x = h2app->getEditorPanel()->getPatternEditorPanel()->x();
+ patternEditorProp.y = h2app->getEditorPanel()->getPatternEditorPanel()->y();
+ patternEditorProp.width = h2app->getEditorPanel()->getPatternEditorPanel()->width();
+ patternEditorProp.height = h2app->getEditorPanel()->getPatternEditorPanel()->height();
+ patternEditorProp.visible = h2app->getEditorPanel()->getPatternEditorPanel()->isVisible();
pref->setPatternEditorProperties( patternEditorProp );
// save song editor properties
@@ -1316,8 +1353,8 @@ void MainForm::action_file_songProperties()
void MainForm::action_window_showPatternEditor()
{
- bool isVisible = CompositeApp::get_instance()->getPatternEditorPanel()->isVisible();
- CompositeApp::get_instance()->getPatternEditorPanel()->setHidden( isVisible );
+ bool isVisible = CompositeApp::get_instance()->getEditorPanel()->getPatternEditorPanel()->isVisible();
+ CompositeApp::get_instance()->getEditorPanel()->getPatternEditorPanel()->setHidden( isVisible );
}
QString MainForm::getAutoSaveFilename()
diff --git a/src/composite-gui/MainForm.hpp b/src/composite-gui/MainForm.hpp
index 8606666..0b8a7f9 100644
--- a/src/composite-gui/MainForm.hpp
+++ b/src/composite-gui/MainForm.hpp
@@ -69,6 +69,7 @@ class MainForm : public QMainWindow, public EventListener
void action_help_about();
void action_instruments_addInstrument();
+ void action_instruments_addLoopPlayer();
void action_instruments_clearAll();
void action_instruments_saveLibrary();
void action_instruments_exportLibrary();
diff --git a/src/composite-gui/PatternEditor/EditorPanel.cpp b/src/composite-gui/PatternEditor/EditorPanel.cpp
new file mode 100644
index 0000000..9493aa1
--- /dev/null
+++ b/src/composite-gui/PatternEditor/EditorPanel.cpp
@@ -0,0 +1,72 @@
+#include "EditorPanel.hpp"
+#include "LoopEditor/LoopEditorPanel.hpp"
+#include "PatternEditorPanel.hpp"
+#include "InstrumentRack.hpp"
+#include "widgets/Button.hpp"
+#include <QGridLayout>
+
+EditorPanel::EditorPanel(QWidget *parent) :
+ QWidget(parent)
+{
+ m_pPatternEditorPanel=new PatternEditorPanel(0);
+ m_pInstrumentRack=new InstrumentRack(0);
+ m_pLoopEditor= new LoopEditorPanel(0);
+
+ QGridLayout* pEditorGrid= new QGridLayout();
+
+ pEditorGrid->addWidget(m_pPatternEditorPanel,0,0);
+ pEditorGrid->addWidget(m_pInstrumentRack,0,2);
+ pEditorGrid->addWidget(m_pLoopEditor,0,0);
+ show();
+ QWidget *pTabButtonsPanel = new QWidget( NULL );
+ pTabButtonsPanel->setFixedHeight( 24 );
+ pTabButtonsPanel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+
+ m_pPatternEditorButton = new ToggleButton(
+ pTabButtonsPanel,
+ "/instrumentEditor/instrument_show_on.png",
+ "/instrumentEditor/instrument_show_off.png",
+ "/instrumentEditor/instrument_show_off.png",
+ QSize( 130, 24 )
+ );
+ m_pLoopEditorButton = new ToggleButton(
+ pTabButtonsPanel,
+ "/instrumentEditor/instrument_show_on.png",
+ "/instrumentEditor/instrument_show_off.png",
+ "/instrumentEditor/instrument_show_off.png",
+ QSize( 130, 24 )
+ );
+ connect(m_pPatternEditorButton,SIGNAL(clicked(Button*)),this,SLOT(onShowPatternEditor()));
+ connect(m_pLoopEditorButton,SIGNAL(clicked(Button*)),this,SLOT(onShowLoopEditor()));
+ m_pPatternEditorButton->setText(trUtf8("Pattern Editor"));
+ m_pLoopEditorButton->setText(trUtf8("Loop Editor"));
+ QHBoxLayout *pTabHBox = new QHBoxLayout();
+ pTabHBox->setSpacing( 0 );
+ pTabHBox->setMargin( 0 );
+ pTabHBox->addWidget( m_pPatternEditorButton );
+ pTabHBox->addWidget( m_pLoopEditorButton );
+ //pTabButtonsPanel->setLayout(pTabHBox);
+ QVBoxLayout *pEditorVBox = new QVBoxLayout();
+ pEditorVBox->addLayout(pTabHBox);
+ pEditorVBox->addLayout(pEditorGrid);
+ this->setLayout(pEditorVBox);
+ onShowPatternEditor();
+}
+
+void EditorPanel::onShowPatternEditor()
+{
+ m_pPatternEditorPanel->show();
+ m_pInstrumentRack->show();
+ m_pLoopEditor->hide();
+}
+
+
+void EditorPanel::onShowLoopEditor()
+{
+ m_pPatternEditorPanel->hide();
+ m_pInstrumentRack->hide();
+ m_pLoopEditor->show();
+
+}
+
+
diff --git a/src/composite-gui/PatternEditor/EditorPanel.hpp b/src/composite-gui/PatternEditor/EditorPanel.hpp
new file mode 100644
index 0000000..41249fb
--- /dev/null
+++ b/src/composite-gui/PatternEditor/EditorPanel.hpp
@@ -0,0 +1,34 @@
+#ifndef EDITORPANEL_H
+#define EDITORPANEL_H
+
+#include <QWidget>
+
+class PatternEditorPanel;
+class InstrumentRack;
+class ToggleButton;
+class LoopEditorPanel;
+class EditorPanel : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit EditorPanel(QWidget *parent = 0);
+
+ InstrumentRack* getInstrumentRack(){return m_pInstrumentRack;}
+ PatternEditorPanel* getPatternEditorPanel(){return m_pPatternEditorPanel;}
+
+signals:
+
+public slots:
+ void onShowLoopEditor();
+ void onShowPatternEditor();
+
+private:
+ ToggleButton* m_pPatternEditorButton;
+ ToggleButton* m_pLoopEditorButton;
+ PatternEditorPanel* m_pPatternEditorPanel;
+ InstrumentRack* m_pInstrumentRack;
+ LoopEditorPanel* m_pLoopEditor;
+
+};
+
+#endif // EDITORPANEL_H
diff --git a/src/composite-gui/PatternEditor/PatternEditorInstrumentList.cpp b/src/composite-
gui/PatternEditor/PatternEditorInstrumentList.cpp
index 078d213..ebf3c4a 100644
--- a/src/composite-gui/PatternEditor/PatternEditorInstrumentList.cpp
+++ b/src/composite-gui/PatternEditor/PatternEditorInstrumentList.cpp
@@ -34,7 +34,7 @@
#include <Tritium/memory.hpp>
using namespace Tritium;
-
+#include "PatternEditor/EditorPanel.hpp"
#include "PatternEditorPanel.hpp"
#include "DrumPatternEditor.hpp"
#include "../CompositeApp.hpp"
@@ -251,7 +251,7 @@ void InstrumentLine::functionFillNotes()
const float fPitch = 0.0f;
const int nLength = -1;
- PatternEditorPanel *pPatternEditorPanel = CompositeApp::get_instance()->getPatternEditorPanel();
+ PatternEditorPanel *pPatternEditorPanel = CompositeApp::get_instance()->getEditorPanel()-
>getPatternEditorPanel();
DrumPatternEditor *pPatternEditor = pPatternEditorPanel->getDrumPatternEditor();
int nBase;
if ( pPatternEditor->isUsingTriplets() ) {
@@ -313,7 +313,7 @@ void InstrumentLine::functionRandomizeVelocity()
{
Engine *pEngine = g_engine;
- PatternEditorPanel *pPatternEditorPanel = CompositeApp::get_instance()->getPatternEditorPanel();
+ PatternEditorPanel *pPatternEditorPanel = CompositeApp::get_instance()->getEditorPanel()-
>getPatternEditorPanel();
DrumPatternEditor *pPatternEditor = pPatternEditorPanel->getDrumPatternEditor();
g_engine->lock( RIGHT_HERE ); // lock the audio engine
@@ -489,7 +489,7 @@ void PatternEditorInstrumentList::updateInstrumentLines()
//DEBUGLOG( "Update lines" );
Engine *pEngine = g_engine;
- T<Song>::shared_ptr pSong = pEngine->getSong();
+ //T<Song>::shared_ptr pSong = pEngine->getSong();
T<InstrumentList>::shared_ptr pInstrList = g_engine->get_sampler()->get_instrument_list();
::Mixer * mixer = CompositeApp::get_instance()->getMixer();
diff --git a/src/composite-gui/PlayerControl.cpp b/src/composite-gui/PlayerControl.cpp
index faafebc..bbd23d9 100644
--- a/src/composite-gui/PlayerControl.cpp
+++ b/src/composite-gui/PlayerControl.cpp
@@ -23,6 +23,7 @@
#include "Skin.hpp"
#include "PlayerControl.hpp"
#include "InstrumentRack.hpp"
+#include "PatternEditor/EditorPanel.hpp"
#include "CompositeApp.hpp"
#include "widgets/LCD.hpp"
@@ -458,7 +459,7 @@ void PlayerControl::updatePlayerControl()
T<Preferences>::shared_ptr pPref = g_engine->get_preferences();
CompositeApp *pH2App = CompositeApp::get_instance();
m_pShowMixerBtn->setPressed( pH2App->getMixer()->isVisible() );
- m_pShowInstrumentRackBtn->setPressed( pH2App->getInstrumentRack()->isVisible() );
+ m_pShowInstrumentRackBtn->setPressed( pH2App->getEditorPanel()->getInstrumentRack()->isVisible() );
TransportPosition::State state = m_pEngine->get_transport()->get_state();
if (state == TransportPosition::ROLLING ) {
@@ -951,8 +952,8 @@ void PlayerControl::showButtonClicked( Button* pRef )
pH2App->showMixer( !isVisible );
}
else if ( pRef == m_pShowInstrumentRackBtn ) {
- bool isVisible = pH2App->getInstrumentRack()->isVisible();
- pH2App->getInstrumentRack()->setHidden( isVisible );
+ bool isVisible = pH2App->getEditorPanel()->getInstrumentRack()->isVisible();
+ pH2App->getEditorPanel()->getInstrumentRack()->setHidden( isVisible );
}
}
diff --git a/src/composite-gui/PlaylistEditor/PlaylistDialog.cpp b/src/composite-
gui/PlaylistEditor/PlaylistDialog.cpp
index bbd3c1a..2000113 100644
--- a/src/composite-gui/PlaylistEditor/PlaylistDialog.cpp
+++ b/src/composite-gui/PlaylistEditor/PlaylistDialog.cpp
@@ -22,6 +22,7 @@
#include "PlaylistDialog.hpp"
#include "../CompositeApp.hpp"
+#include "PatternEditor/EditorPanel.hpp"
#include "../InstrumentRack.hpp"
#include "SoundLibrary/SoundLibraryPanel.hpp"
#include "widgets/PixmapWidget.hpp"
@@ -862,7 +863,7 @@ void PlaylistDialog::on_m_pPlaylistTree_itemDoubleClicked ()
pH2App->setStatusBarMessage( trUtf8( "Playlist: Set song No. %1" ).arg( index +1 ), 5000 );
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->update_background_color();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>update_background_color();
///exec script
///this is very very simple and only an experiment
diff --git a/src/composite-gui/SongEditor/SongEditor.cpp b/src/composite-gui/SongEditor/SongEditor.cpp
index f8a495b..69736c5 100644
--- a/src/composite-gui/SongEditor/SongEditor.cpp
+++ b/src/composite-gui/SongEditor/SongEditor.cpp
@@ -39,6 +39,7 @@ using namespace Tritium;
#include "SongEditor.hpp"
#include "SongEditorPanel.hpp"
#include "SoundLibrary/SoundLibraryPanel.hpp"
+#include "PatternEditor/EditorPanel.hpp"
#include "../PatternEditor/PatternEditorPanel.hpp"
#include "../CompositeApp.hpp"
#include "../InstrumentRack.hpp"
@@ -1004,16 +1005,16 @@ void SongEditorPatternList::patternPopup_save()
#else
usleep ( 10000 );
#endif
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->test_expandedItems();
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->updateDrumkitList();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>test_expandedItems();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>updateDrumkitList();
}
void SongEditorPatternList::patternPopup_edit()
{
- CompositeApp::get_instance()->getPatternEditorPanel()->show();
- CompositeApp::get_instance()->getPatternEditorPanel()->setFocus();
+ CompositeApp::get_instance()->getEditorPanel()->getPatternEditorPanel()->show();
+ CompositeApp::get_instance()->getEditorPanel()->getPatternEditorPanel()->setFocus();
}
diff --git a/src/composite-gui/SoundLibrary/SoundLibraryImportDialog.cpp b/src/composite-
gui/SoundLibrary/SoundLibraryImportDialog.cpp
index 92863d1..70d3cf3 100644
--- a/src/composite-gui/SoundLibrary/SoundLibraryImportDialog.cpp
+++ b/src/composite-gui/SoundLibrary/SoundLibraryImportDialog.cpp
@@ -27,7 +27,7 @@
#include "../widgets/DownloadWidget.hpp"
#include "../CompositeApp.hpp"
#include "../InstrumentRack.hpp"
-
+#include "PatternEditor/EditorPanel.hpp"
#include <Tritium/LocalFileMng.hpp>
#include <Tritium/H2Exception.hpp>
#include <Tritium/SoundLibrary.hpp>
@@ -398,8 +398,8 @@ void SoundLibraryImportDialog::on_DownloadBtn_clicked()
}
// update the drumkit list
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()-
>test_expandedItems();
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()-
>updateDrumkitList();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()-
>getSoundLibraryPanel()->test_expandedItems();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()-
>getSoundLibraryPanel()->updateDrumkitList();
updateSoundLibraryList();
QApplication::restoreOverrideCursor();
return;
@@ -445,8 +445,8 @@ void SoundLibraryImportDialog::on_InstallBtn_clicked()
Tritium::Drumkit::install( Tritium::g_engine, SoundLibraryPathTxt->text() );
QMessageBox::information( this, "Composite", QString( trUtf8( "SoundLibrary imported in %1"
).arg( dataDir ) ) );
// update the drumkit list
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->test_expandedItems();
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->updateDrumkitList();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>test_expandedItems();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>updateDrumkitList();
QApplication::restoreOverrideCursor();
}
catch( Tritium::H2Exception ex ) {
diff --git a/src/composite-gui/SoundLibrary/SoundLibraryPanel.cpp b/src/composite-
gui/SoundLibrary/SoundLibraryPanel.cpp
index dceb7b3..141c078 100644
--- a/src/composite-gui/SoundLibrary/SoundLibraryPanel.cpp
+++ b/src/composite-gui/SoundLibrary/SoundLibraryPanel.cpp
@@ -29,6 +29,7 @@
#include "SoundLibrarySaveDialog.hpp"
#include "SoundLibraryPropertiesDialog.hpp"
#include "SoundLibraryExportDialog.hpp"
+#include "PatternEditor/EditorPanel.hpp"
#include "../CompositeApp.hpp"
#include "../widgets/Button.hpp"
@@ -523,7 +524,7 @@ void SoundLibraryPanel::on_drumkitLoadAction()
g_engine->loadDrumkit( drumkitInfo );
g_engine->getSong()->set_modified( true );
CompositeApp::get_instance()->onDrumkitLoad( drumkitInfo->getName() );
- CompositeApp::get_instance()->getPatternEditorPanel()->getDrumPatternEditor()->updateEditor();
+ CompositeApp::get_instance()->getEditorPanel()->getPatternEditorPanel()->getDrumPatternEditor()-
>updateEditor();
InstrumentEditorPanel::get_instance()->updateInstrumentEditor();
diff --git a/src/composite-gui/SoundLibrary/SoundLibraryPropertiesDialog.cpp b/src/composite-
gui/SoundLibrary/SoundLibraryPropertiesDialog.cpp
index 2072dab..493f55c 100644
--- a/src/composite-gui/SoundLibrary/SoundLibraryPropertiesDialog.cpp
+++ b/src/composite-gui/SoundLibrary/SoundLibraryPropertiesDialog.cpp
@@ -22,6 +22,7 @@
#include <QtGui>
#include "../CompositeApp.hpp"
+#include "PatternEditor/EditorPanel.hpp"
#include "SoundLibraryPropertiesDialog.hpp"
#include "../InstrumentRack.hpp"
#include "SoundLibraryPanel.hpp"
@@ -132,8 +133,8 @@ void SoundLibraryPropertiesDialog::on_saveBtn_clicked()
//reload if necessary
if ( reload == true ){
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->test_expandedItems();
- CompositeApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->updateDrumkitList();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>test_expandedItems();
+ CompositeApp::get_instance()->getEditorPanel()->getInstrumentRack()->getSoundLibraryPanel()-
>updateDrumkitList();
}
accept();
--
1.7.0.4
Finally, one last thing... your composite repository needs to be an actual clone of mine in order for it to be useful. Please do this: 1. Log in to gitorious 2. Go to http://gitorious.org/composite/composite 3. Click the button `Clone repository` and follow the instructions they give you. 4. Use that. Delete the composite-gerald repos. Note that I've created a branch for 0.006, but DO NOT use it. It's reserved for bug fixes. Please make all your changes against the `master` branch. Feel free to leave it named `master`, or create a branch called `topic/audio-loops` or something. Peace, Gabriel
On Friday, April 22, 2011 02:32:28 pm Gerald Mwangi wrote:
> My Idea is to put the processing of the loops into the
> Sampler::process (where the Note objects are processed).
> class AudioLoopPlayer intentionally inherites class
> Instrument, so that the Note objects can carry pointers
> to AudioLoopPlayer (after dynamic_cast).
Currently the Note carries a pointer to the instrument.
This pointer gets carried all the way through the system and
lands in the Sampler. The Sampler then uses that pointer to
render the sampler.
I absolutely hate this (I don't know who did it). Notes
should be lightweight, midi-like events and the Instrument
(and its samples and envelopes) should be owned/operated by
the Sampler. Thus, my goal is for the Sampler to resemble
an actual hardware sampler/synth.
I had expected that time-stretch audio loops would be its
own separate sub-engine (like Sampler). It would be
controlled by Midi-like messages... but the loops themselves
get loaded and unloaded by the actual looper engine.
The reason I think this would be a Good Way is that: (a) it
keeps the sampler simple and focused, (b) there's not a
whole lot that the sampler has to offer the looper, and (c)
the way it's controlled and operated is totally different
from a sampler.
> That's why my Idea is to implement a
> AudioLoopPlayer::process(nFrames,port_buffers, note)
> which, after a cast from Instrument to AudioLoopPlayer,
> is called instead of render_note. This way we also have
Yeah, this isn't bad. Still, this gets cleaner if the audio
looping is its own engine.
> a quick and clean way of not only implementing realtime
> stretching, but also, you name it, a scratching
> algorithm (I know very well scratching is not on the
> priority list). Both can be done per loop in
I welcome a scratching API in the back-end. It would be
awesome. Really.
On the front-end GUI, that's where it's not a priority.
> I hope all this is still valid for 0.008 .
It is. Only the GUI code died.
-gabriel