summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-06-06 17:46:25 +0000
committerFlorian Jung <flo@windfisch.org>2011-06-06 17:46:25 +0000
commit2359a1c010c298eb66b5b03e0e23f55b4fd9ff4b (patch)
tree38d8848dd96085f9e8851d7af13a9676751157d8
parent6c8a1eb61743e3fa83925d40c14d3a6754c8359f (diff)
only cleaned up code
-rw-r--r--muse2/muse/app.cpp455
-rw-r--r--muse2/muse/app.h20
-rw-r--r--muse2/muse/event.cpp71
-rw-r--r--muse2/muse/event.h14
-rw-r--r--muse2/muse/part.cpp4
-rw-r--r--muse2/muse/part.h15
6 files changed, 7 insertions, 572 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 6b9f2b5b..fb07955f 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -106,13 +106,6 @@ int watchAudio, watchAudioPrefetch, watchMidi;
pthread_t splashThread;
-//PyScript *pyscript;
-// void MusE::runPythonScript()
-// {
-// QString script("test.py");
-// // pyscript->runPythonScript(script);
-// }
-
void MusE::clearScoreMenuMappers()
{
@@ -138,127 +131,12 @@ void microSleep(long msleep)
sleepOk=usleep(msleep);
}
-// Removed p3.3.17
-/*
-//---------------------------------------------------------
-// watchdog thread
-//---------------------------------------------------------
-
-static void* watchdog(void*)
- {
- doSetuid();
-
- struct sched_param rt_param;
- memset(&rt_param, 0, sizeof(rt_param));
- rt_param.sched_priority = sched_get_priority_max(SCHED_FIFO);
- int rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param);
- if (rv != 0)
- perror("Set realtime scheduler");
-
- int policy;
- if (pthread_getschedparam(pthread_self(), &policy, &rt_param)!= 0) {
- printf("Cannot get current client scheduler: %s\n", strerror(errno));
- }
- if (policy != SCHED_FIFO)
- printf("watchdog process %d _NOT_ running SCHED_FIFO\n", getpid());
- else if (debugMsg)
- printf("watchdog set to SCHED_FIFO priority %d\n",
- sched_get_priority_max(SCHED_FIFO));
-
- undoSetuid();
- int fatal = 0;
- for (;;) {
- watchAudio = 0;
- watchMidi = 0;
- static const int WD_TIMEOUT = 3;
-
- // sleep can be interrpted by signals:
- int to = WD_TIMEOUT;
- while (to > 0)
- to = sleep(to);
-
- bool timeout = false;
- if (midiSeqRunning && watchMidi == 0)
- {
- printf("midiSeqRunning = %i watchMidi %i\n", midiSeqRunning, watchMidi);
- timeout = true;
- }
- if (watchAudio == 0)
- timeout = true;
- if (watchAudio > 500000)
- timeout = true;
- if (timeout)
- ++fatal;
- else
- fatal = 0;
- if (fatal >= 3) {
- printf("WatchDog: fatal error, realtime task timeout\n");
- printf(" (%d,%d-%d) - stopping all services\n",
- watchMidi, watchAudio, fatal);
- break;
- }
-// printf("wd %d %d %d\n", watchMidi, watchAudio, fatal);
- }
- audio->stop(true);
- audioPrefetch->stop(true);
- printf("watchdog exit\n");
- exit(-1);
- }
-*/
-
//---------------------------------------------------------
// seqStart
//---------------------------------------------------------
bool MusE::seqStart()
{
- // Changed by Tim. p3.3.17
-
- /*
- if (audio->isRunning()) {
- printf("seqStart(): already running\n");
- return true;
- }
-
- if (realTimeScheduling) {
- //
- // create watchdog thread with max priority
- //
- doSetuid();
- struct sched_param rt_param;
- memset(&rt_param, 0, sizeof(rt_param));
- rt_param.sched_priority = realTimePriority +1;//sched_get_priority_max(SCHED_FIFO);
-
- pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
- pthread_attr_init(attributes);
-
-// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
-// printf("MusE: cannot set FIFO scheduling class for RT thread\n");
-// }
-// if (pthread_attr_setschedparam (attributes, &rt_param)) {
-// // printf("Cannot set scheduling priority for RT thread (%s)\n", strerror(errno));
-// }
-// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
-// printf("MusE: Cannot set scheduling scope for RT thread\n");
-// }
- if (pthread_create(&watchdogThread, attributes, ::watchdog, 0))
- perror("MusE: creating watchdog thread failed:");
- pthread_attr_destroy(attributes);
- undoSetuid();
- }
- audioPrefetch->start();
- audioPrefetch->msgSeek(0, true); // force
- midiSeqRunning = !midiSeq->start();
-
- if (!audio->start()) {
- QMessageBox::critical( muse, tr(QString("Failed to start audio!")),
- tr(QString("Was not able to start audio, check if jack is running.\n")));
- return false;
- }
-
- return true;
- */
-
if (audio->isRunning()) {
printf("seqStart(): already running\n");
return true;
@@ -275,12 +153,10 @@ bool MusE::seqStart()
//
for(int i = 0; i < 60; ++i)
{
- //if (audioState == AUDIO_START2)
if(audio->isRunning())
break;
sleep(1);
}
- //if (audioState != AUDIO_START2) {
if(!audio->isRunning())
{
QMessageBox::critical( muse, tr("Failed to start audio!"),
@@ -294,66 +170,6 @@ bool MusE::seqStart()
if(debugMsg)
printf("MusE::seqStart: getting audio driver realTimePriority:%d\n", realTimePriority);
- // Disabled by Tim. p3.3.22
- /*
- if(realTimeScheduling)
- {
- //
- // create watchdog thread with max priority
- //
- doSetuid();
- struct sched_param rt_param;
- memset(&rt_param, 0, sizeof(rt_param));
- rt_param.sched_priority = realTimePriority + 1;//sched_get_priority_max(SCHED_FIFO);
-
- pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
- pthread_attr_init(attributes);
-
-// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) {
-// printf("MusE: cannot set FIFO scheduling class for RT thread\n");
-// }
-// if (pthread_attr_setschedparam (attributes, &rt_param)) {
-// // printf("Cannot set scheduling priority for RT thread (%s)\n", strerror(errno));
-// }
-// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) {
-// printf("MusE: Cannot set scheduling scope for RT thread\n");
-// }
- if (pthread_create(&watchdogThread, attributes, ::watchdog, 0))
- perror("MusE: creating watchdog thread failed");
- pthread_attr_destroy(attributes);
- undoSetuid();
- }
- */
-
- //int policy;
- //if ((policy = sched_getscheduler (0)) < 0) {
- // printf("Cannot get current client scheduler: %s\n", strerror(errno));
- // }
- //if (policy != SCHED_FIFO)
- // printf("midi thread %d _NOT_ running SCHED_FIFO\n", getpid());
-
-
- //audioState = AUDIO_RUNNING;
- // Changed by Tim. p3.3.22
- /*
- //if(realTimePriority)
- if(realTimeScheduling)
- {
- int pr = realTimePriority;
- if(pr > 5)
- pr -= 5;
- else
- pr = 0;
- audioPrefetch->start(pr);
- //audioWriteback->start(realTimePriority - 5);
- }
- else
- {
- audioPrefetch->start(0);
- //audioWriteback->start(0);
- }
- */
-
int pfprio = 0;
int midiprio = 0;
@@ -363,52 +179,6 @@ bool MusE::seqStart()
// in JackAudioDevice::realtimePriority() which is a bit flawed - it reports there's no RT...
if(realTimeScheduling)
{
- //if(realTimePriority < 5)
- // printf("MusE: WARNING: Recommend setting audio realtime priority to a higher value!\n");
- /*
- if(realTimePriority == 0)
- {
- pfprio = 1;
- midiprio = 2;
- }
- else
- if(realTimePriority == 1)
- {
- pfprio = 2;
- midiprio = 3;
- }
- else
- if(realTimePriority == 2)
- {
- pfprio = 1;
- midiprio = 3;
- }
- else
- if(realTimePriority == 3)
- {
- pfprio = 1;
- //midiprio = 2;
- // p3.3.37
- midiprio = 4;
- }
- else
- if(realTimePriority == 4)
- {
- pfprio = 1;
- //midiprio = 3;
- // p3.3.37
- midiprio = 5;
- }
- else
- if(realTimePriority == 5)
- {
- pfprio = 1;
- //midiprio = 3;
- // p3.3.37
- midiprio = 6;
- }
- else
- */
{
//pfprio = realTimePriority - 5;
// p3.3.40
@@ -537,16 +307,6 @@ void addProject(const QString& name)
// populateAddSynth
//---------------------------------------------------------
-/*
-struct addSynth_cmp_str
-{
- bool operator()(std::string a, std::string b)
- {
- return (a < b);
- }
-};
-*/
-
// ORCAN - CHECK
QMenu* populateAddSynth(QWidget* parent)
{
@@ -1326,12 +1086,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
// Popups
//---------------------------------------------------
-// QPopupMenu *foo = new QPopupMenu(this);
-// testAction = new QAction(foo,"testPython");
-// testAction->addTo(foo);
-// menuBar()->insertItem(tr("&testpython"), foo);
-// connect(testAction, SIGNAL(activated()), this, SLOT(runPythonScript()));
-
//-------------------------------------------------------------
// popup File
@@ -1405,20 +1159,14 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
menuEdit->addMenu(midiEdit);
-#if 0 // TODO FINDMICH delete!
- midiEdit->insertItem(tr("Modify Gate Time"), this, SLOT(modifyGateTime()));
- midiEdit->insertItem(tr("Modify Velocity"), this, SLOT(modifyVelocity()));
- midiEdit->insertItem(tr("Crescendo"), this, SLOT(crescendo()));
- midiEdit->insertItem(tr("Thin Out"), this, SLOT(thinOut()));
- midiEdit->insertItem(tr("Erase Event"), this, SLOT(eraseEvent()));
- midiEdit->insertItem(tr("Note Shift"), this, SLOT(noteShift()));
- midiEdit->insertItem(tr("Move Clock"), this, SLOT(moveClock()));
- midiEdit->insertItem(tr("Copy Measure"), this, SLOT(copyMeasure()));
+/* commented out by flo: these are not implemented,
+ but maybe will be in future (state: revision 988)
+ midiEdit->insertItem(tr("Copy Measure"), this, SLOT(copyMeasure()));
midiEdit->insertItem(tr("Erase Measure"), this, SLOT(eraseMeasure()));
midiEdit->insertItem(tr("Delete Measure"), this, SLOT(deleteMeasure()));
midiEdit->insertItem(tr("Create Measure"), this, SLOT(createMeasure()));
midiEdit->insertItem(tr("Mix Track"), this, SLOT(mixTrack()));
-#endif
+*/
midiEdit->addAction(midiTransformerAction);
menuEdit->addAction(editSongInfoAction);
@@ -1638,9 +1386,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
MusE::~MusE()
{
- //printf("MusE::~MusE\n");
- //if(transport)
- // delete transport;
}
//---------------------------------------------------------
@@ -1964,37 +1709,6 @@ void MusE::setUntitledProject()
void MusE::setConfigDefaults()
{
readConfiguration(); // used for reading midi files
-#if 0
- if (readConfiguration()) {
- //
- // failed to load config file
- // set buildin defaults
- //
- configTransportVisible = false;
- configBigTimeVisible = false;
-
- for (int channel = 0; channel < 2; ++channel)
- song->addTrack(Track::AUDIO_GROUP);
- AudioTrack* out = (AudioTrack*)song->addTrack(Track::AUDIO_OUTPUT);
- AudioTrack* in = (AudioTrack*)song->addTrack(Track::AUDIO_INPUT);
-
- // set some default routes
- std::list<QString> il = audioDevice->inputPorts();
- int channel = 0;
- for (std::list<QString>::iterator i = il.begin(); i != il.end(); ++i, ++channel) {
- if (channel == 2)
- break;
- audio->msgAddRoute(Route(out,channel), Route(*i,channel));
- }
- channel = 0;
- std::list<QString> ol = audioDevice->outputPorts();
- for (std::list<QString>::iterator i = ol.begin(); i != ol.end(); ++i, ++channel) {
- if (channel == 2)
- break;
- audio->msgAddRoute(Route(*i, channel), Route(in,channel));
- }
- }
-#endif
song->dirty = false;
}
@@ -3101,113 +2815,6 @@ void MusE::selectionChanged()
}
-//---------------------------------------------------------
-// modifyGateTime
-//---------------------------------------------------------
-
-void MusE::modifyGateTime()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// modifyVelocity
-//---------------------------------------------------------
-
-void MusE::modifyVelocity()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// crescendo
-//---------------------------------------------------------
-
-void MusE::crescendo()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// thinOut
-//---------------------------------------------------------
-
-void MusE::thinOut()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// eraseEvent
-//---------------------------------------------------------
-
-void MusE::eraseEvent()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// noteShift
-//---------------------------------------------------------
-
-void MusE::noteShift()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// moveClock
-//---------------------------------------------------------
-
-void MusE::moveClock()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// copyMeasure
-//---------------------------------------------------------
-
-void MusE::copyMeasure()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// eraseMeasure
-//---------------------------------------------------------
-
-void MusE::eraseMeasure()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// deleteMeasure
-//---------------------------------------------------------
-
-void MusE::deleteMeasure()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// createMeasure
-//---------------------------------------------------------
-
-void MusE::createMeasure()
- {
- printf("not implemented\n");
- }
-
-//---------------------------------------------------------
-// mixTrack
-//---------------------------------------------------------
-
-void MusE::mixTrack()
- {
- printf("not implemented\n");
- }
//---------------------------------------------------------
// configAppearance
@@ -3807,19 +3414,6 @@ void MusE::updateConfiguration()
//menuSettings->setAccel(shortcuts[SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]);
//menu_help->setAccel(menu_ids[CMD_START_WHATSTHIS], shortcuts[SHRT_START_WHATSTHIS].key);
- // Just in case, but no, app kb handler takes care of these.
- /*
- loopAction->setShortcut(shortcuts[].key);
- punchinAction->setShortcut(shortcuts[].key);
- punchoutAction->setShortcut(shortcuts[].key);
- startAction->setShortcut(shortcuts[].key);
- rewindAction->setShortcut(shortcuts[].key);
- forwardAction->setShortcut(shortcuts[].key);
- stopAction->setShortcut(shortcuts[].key);
- playAction->setShortcut(shortcuts[].key);
- recordAction->setShortcut(shortcuts[].key);
- panicAction->setShortcut(shortcuts[].key);
- */
}
//---------------------------------------------------------
@@ -3860,24 +3454,6 @@ void MusE::bigtimeClosed()
viewBigtimeAction->setChecked(false);
}
-//---------------------------------------------------------
-// showMixer
-//---------------------------------------------------------
-
-/*
-void MusE::showMixer(bool on)
- {
- if (on && audioMixer == 0) {
- audioMixer = new AudioMixerApp(this);
- connect(audioMixer, SIGNAL(closed()), SLOT(mixerClosed()));
- audioMixer->resize(config.geometryMixer.size());
- audioMixer->move(config.geometryMixer.topLeft());
- }
- if (audioMixer)
- audioMixer->setVisible(on);
- menuView->setItemChecked(aid1, on);
- }
-*/
//---------------------------------------------------------
// showMixer1
@@ -3914,17 +3490,6 @@ void MusE::showMixer2(bool on)
}
//---------------------------------------------------------
-// toggleMixer
-//---------------------------------------------------------
-
-/*
-void MusE::toggleMixer()
- {
- showMixer(!menuView->isItemChecked(aid1));
- }
-*/
-
-//---------------------------------------------------------
// toggleMixer1
//---------------------------------------------------------
@@ -3943,17 +3508,6 @@ void MusE::toggleMixer2(bool checked)
}
//---------------------------------------------------------
-// mixerClosed
-//---------------------------------------------------------
-
-/*
-void MusE::mixerClosed()
- {
- menuView->setItemChecked(aid1, false);
- }
-*/
-
-//---------------------------------------------------------
// mixer1Closed
//---------------------------------------------------------
@@ -3972,7 +3526,6 @@ void MusE::mixer2Closed()
}
-//QWidget* MusE::mixerWindow() { return audioMixer; }
QWidget* MusE::mixer1Window() { return mixer1; }
QWidget* MusE::mixer2Window() { return mixer2; }
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index 3f539196..3fd93fc8 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -11,7 +11,6 @@
#include "config.h"
#include "cobject.h"
-//#include "tools.h"
#include <QFileInfo>
@@ -97,8 +96,6 @@ class MusE : public QMainWindow
CMD_AUDIO_BOUNCE_TO_FILE, CMD_AUDIO_BOUNCE_TO_TRACK, CMD_AUDIO_RESTART,
CMD_LAST };
- //int menu_ids[CMD_LAST];
-
// File menu actions
QAction *fileSaveAction, *fileOpenAction, *fileNewAction, *testAction;
QAction *fileSaveAsAction, *fileImportMidiAction, *fileExportMidiAction;
@@ -228,7 +225,6 @@ class MusE : public QMainWindow
void configChanged();
private slots:
- //void runPythonScript();
void loadProject();
bool save();
void configGlobalSettings();
@@ -248,7 +244,6 @@ class MusE : public QMainWindow
void toggleTransport(bool);
void toggleMarker(bool);
void toggleBigTime(bool);
- //void toggleMixer();
void toggleMixer1(bool);
void toggleMixer2(bool);
@@ -290,18 +285,12 @@ class MusE : public QMainWindow
void cmd(int);
void clipboardChanged();
void selectionChanged();
- void modifyGateTime();
- void modifyVelocity();
- void crescendo();
- void thinOut();
- void eraseEvent();
- void noteShift();
- void moveClock();
- void copyMeasure();
- void eraseMeasure();
+/* void copyMeasure(); // commented out by flo: these are not implemented,
+ void eraseMeasure(); // but maybe will be in future (state: revision 988)
void deleteMeasure();
void createMeasure();
void mixTrack();
+*/
void startMidiInputPlugin(int);
void hideMitPluginTranspose();
void hideMidiInputTransform();
@@ -323,7 +312,6 @@ class MusE : public QMainWindow
void takeAutomationSnapshot();
void clearAutomation();
void bigtimeClosed();
- //void mixerClosed();
void mixer1Closed();
void mixer2Closed();
void markerClosed();
@@ -345,7 +333,6 @@ class MusE : public QMainWindow
bool seqRestart();
void loadTemplate();
void showBigtime(bool);
- //void showMixer(bool);
void showMixer1(bool);
void showMixer2(bool);
void showMarker(bool);
@@ -369,7 +356,6 @@ class MusE : public QMainWindow
void setHeartBeat();
void importController(int, MidiPort*, int);
QString projectName() { return project.fileName(); }
- //QWidget* mixerWindow();
QWidget* mixer1Window();
QWidget* mixer2Window();
QWidget* transportWindow();
diff --git a/muse2/muse/event.cpp b/muse2/muse/event.cpp
index 5d16fde9..77b66359 100644
--- a/muse2/muse/event.cpp
+++ b/muse2/muse/event.cpp
@@ -7,16 +7,10 @@
//=========================================================
#include <stdio.h>
-// #include <memory.h>
-//#include "audioconvert.h"
#include "event.h"
#include "eventbase.h"
#include "waveevent.h"
#include "midievent.h"
-//#include "globals.h"
-
-// Added by Tim. p3.3.20
-//#define USE_SAMPLERATE
//---------------------------------------------------------
// Event
@@ -65,11 +59,6 @@ void EventBase::dump(int n) const
Event Event::clone()
{
- // p3.3.31
- //printf("Event::clone() this:%p\n", this);
-
- // p3.3.31
- //return Event(ev->clone());
#ifdef USE_SAMPLERATE
return Event(ev->clone(), _audConv);
#else
@@ -80,14 +69,9 @@ Event Event::clone()
Event::Event()
{
ev = 0;
- //_sfCurFrame = 0;
- //_audConv = 0;
}
Event::Event(EventType t) {
- //_sfCurFrame = 0;
- //_audConv = 0;
-
if (t == Wave)
ev = new WaveEventBase(t);
else
@@ -95,30 +79,21 @@ Event::Event(EventType t) {
++(ev->refCount);
}
Event::Event(const Event& e) {
- //_sfCurFrame = 0;
- //_audConv = 0;
-
ev = e.ev;
if(ev)
++(ev->refCount);
#ifdef USE_SAMPLERATE
- //_audConv = AudioConverter::getAudioConverter(e._audConv);
if(e._audConv)
_audConv = e._audConv->reference();
#endif
}
Event::Event(EventBase* eb) {
- //_sfCurFrame = 0;
- //_audConv = 0;
-
ev = eb;
++(ev->refCount);
#ifdef USE_SAMPLERATE
if(!ev->sndFile().isNull())
- //_audConv = AudioConverter::getAudioConverter(eb, SRC_SINC_MEDIUM_QUALITY);
- //_audConv = new AudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
_audConv = new SRCAudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
#endif
}
@@ -162,19 +137,6 @@ void Event::setType(EventType t) {
}
Event& Event::operator=(const Event& e) {
- /*
- if (ev == e.ev)
- return *this;
- if (ev && --(ev->refCount) == 0) {
- delete ev;
- ev = 0;
- }
- ev = e.ev;
- if (ev)
- ++(ev->refCount);
- return *this;
- */
-
if (ev != e.ev)
{
if (ev && --(ev->refCount) == 0) {
@@ -191,7 +153,6 @@ Event& Event::operator=(const Event& e) {
{
if(_audConv)
AudioConverter::release(_audConv);
- //_audConv = AudioConverter::getAudioConverter(e._audConv);
_audConv = e._audConv->reference();
}
#endif
@@ -207,7 +168,6 @@ bool Event::selected() const { return ev->_selected; }
void Event::setSelected(bool val) { ev->_selected = val; }
void Event::move(int offset) { ev->move(offset); }
-//void Event::read(Xml& xml) { ev->read(xml); }
void Event::read(Xml& xml)
{
ev->read(xml);
@@ -216,27 +176,14 @@ void Event::read(Xml& xml)
if(!ev->sndFile().isNull())
{
if(_audConv)
- {
_audConv->setChannels(ev->sndFile().channels());
- }
else
- {
- //int srcerr;
- //if(debugMsg)
- // printf("Event::read Creating samplerate converter with %d channels\n", ev->sndFile().channels());
- //_src_state = src_new(SRC_SINC_MEDIUM_QUALITY, ev->sndFile().channels(), &srcerr);
-// _audConv = new AudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
_audConv = new SRCAudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY);
- //if(!_src_state)
- //if(!_audConv)
- // printf("Event::read Creation of samplerate converter with %d channels failed:%s\n", ev->sndFile().channels(), src_strerror(srcerr));
- }
}
#endif
}
-//void Event::write(int a, Xml& xml, const Pos& o) const { ev->write(a, xml, o); }
void Event::write(int a, Xml& xml, const Pos& o, bool forceWavePaths) const { ev->write(a, xml, o, forceWavePaths); }
void Event::dump(int n) const { ev->dump(n); }
Event Event::mid(unsigned a, unsigned b) { return Event(ev->mid(a, b)); }
@@ -268,22 +215,11 @@ int Event::spos() const { return ev->spos(); }
void Event::setSpos(int s) { ev->setSpos(s); }
SndFileR Event::sndFile() const { return ev->sndFile(); }
-//void Event::setSndFile(SndFileR& sf) { ev->setSndFile(sf); }
void Event::setSndFile(SndFileR& sf)
{
ev->setSndFile(sf);
#ifdef USE_SAMPLERATE
- //if(_audConv)
-// if(_audConv && !sf.isNull())
-// {
- //_audConv->setSndFile(sf);
- //if(sf.isNull())
- // AudioConverter::release(_audConv);
- //else
-// _audConv->setChannels(sf.channels());
-// }
-
if(_audConv)
{
// Do we release? Or keep the converter around, while gaining speed since no rapid creation/destruction.
@@ -302,15 +238,8 @@ void Event::setSndFile(SndFileR& sf)
#endif
}
-//void Event::read(unsigned offset, float** bpp, int channels, int nn, bool overwrite)
-//void Event::readAudio(unsigned offset, float** bpp, int channels, int nn, bool doSeek, bool overwrite)
-// p3.3.33
void Event::readAudio(WavePart* part, unsigned offset, float** bpp, int channels, int nn, bool doSeek, bool overwrite)
{
- //ev->read(offset, bpp, channels, nn, overwrite);
- //ev->readAudio(offset, bpp, channels, nn, doSeek, overwrite);
- //_sfCurFrame = ev->readAudio(_src_state, _sfCurFrame, offset, bpp, channels, nn, doSeek, overwrite);
- // p3.3.33
ev->readAudio(part, offset, bpp, channels, nn, doSeek, overwrite);
}
void Event::setTick(unsigned val) { ev->setTick(val); }
diff --git a/muse2/muse/event.h b/muse2/muse/event.h
index 5a8a74f8..b450d1fd 100644
--- a/muse2/muse/event.h
+++ b/muse2/muse/event.h
@@ -10,7 +10,6 @@
#define __EVENT_H__
#include <map>
-//#include <samplerate.h>
#include <sys/types.h>
#include "wave.h" // wg. SndFile
@@ -23,7 +22,6 @@ class QString;
class Xml;
class EventBase;
-//class AudioConverter;
class WavePart;
//---------------------------------------------------------
@@ -33,20 +31,12 @@ class WavePart;
class Event {
EventBase* ev;
- //off_t _sfCurFrame;
- //AudioConverter* _audConv;
-
public:
- //Event() { ev = 0; }
Event();
Event(EventType t);
Event(const Event& e);
Event(EventBase* eb);
- //#ifdef USE_SAMPLERATE
- //Event(EventBase* eb, AudioConverter* cv);
- //#endif
-
virtual ~Event();
bool empty() const;
@@ -62,7 +52,6 @@ class Event {
void move(int offset);
void read(Xml& xml);
- //void write(int a, Xml& xml, const Pos& offset) const;
void write(int a, Xml& xml, const Pos& offset, bool ForceWavePaths = false) const;
void dump(int n = 0) const;
Event clone();
@@ -93,12 +82,9 @@ class Event {
void setName(const QString& s);
int spos() const;
void setSpos(int s);
- //AudioConverter* audioConverter() { return _audConv;}
SndFileR sndFile() const;
virtual void setSndFile(SndFileR& sf);
- //virtual void read(unsigned offset, float** bpp, int channels, int nn, bool overwrite = true);
- //virtual void readAudio(unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/);
virtual void readAudio(WavePart* /*part*/, unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/);
void setTick(unsigned val);
diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp
index 231b947b..398720af 100644
--- a/muse2/muse/part.cpp
+++ b/muse2/muse/part.cpp
@@ -827,7 +827,6 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len)
WavePart* nPart = new WavePart(*(WavePart*)oPart);
EventList* el = nPart->events();
unsigned new_partlength = tempomap.deltaTick2frame(oPart->tick(), oPart->tick() + len);
- //printf("new partlength in frames: %d\n", new_partlength);
// If new nr of frames is less than previous what can happen is:
// - 0 or more events are beginning after the new final position. Those are removed from the part
@@ -839,7 +838,6 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len)
Event e = i->second;
unsigned event_startframe = e.frame();
unsigned event_endframe = event_startframe + e.lenFrame();
- //printf("Event frame=%d, length=%d\n", event_startframe, event_length);
if (event_endframe < new_partlength)
continue;
if (event_startframe > new_partlength) { // If event start was after the new length, remove it from part
@@ -879,7 +877,6 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len)
unsigned clipframes = (file.samples() - last.spos());// / file.channels();
Event newEvent = last.clone();
- //printf("SndFileR samples=%d channels=%d event samplepos=%d clipframes=%d\n", file.samples(), file.channels(), last.spos(), clipframes);
unsigned new_eventlength = new_partlength - last_start;
if (new_eventlength > clipframes) // Shrink event length if new partlength exceeds last clip
@@ -967,7 +964,6 @@ void Track::splitPart(Part* part, int tickpos, Part*& p1, Part*& p2)
p2 = newPart(part); // new right part
// Added by Tim. p3.3.6
- //printf("Track::splitPart part ev %p sz:%d ref:%d p1 %p sz:%d ref:%d p2 %p sz:%d ref:%d\n", part->events(), part->events()->size(), part->events()->arefCount(), p1->events(), p1->events()->size(), p1->events()->arefCount(), p2->events(), p2->events()->size(), p2->events()->arefCount());
switch (type()) {
case WAVE:
diff --git a/muse2/muse/part.h b/muse2/muse/part.h
index f7a864e5..9b037edd 100644
--- a/muse2/muse/part.h
+++ b/muse2/muse/part.h
@@ -24,17 +24,11 @@ class MidiTrack;
class WaveTrack;
class Xml;
class Part;
-//class AudioConvertMap;
-
-// typedef std::multimap<unsigned, Event*, std::less<unsigned> >::iterator iEvent;
struct ClonePart {
- //const EventList* el;
const Part* cp;
int id;
uuid_t uuid;
- //ClonePart(const EventList* e, int i) : el(e), id(i) {}
- //ClonePart(const Part* p, int i) : cp(p), id(i) {}
ClonePart(const Part*, int i = -1);
};
@@ -90,12 +84,8 @@ class Part : public PosLen {
iEvent addEvent(Event& p);
- //virtual void read(Xml&, int newPartOffset=0, bool toTrack = true);
- //virtual void write(int, Xml&) const;
- //virtual void write(int, Xml&, bool isCopy = false) const;
virtual void write(int, Xml&, bool isCopy = false, bool forceWavePaths = false) const;
-// virtual Event* newEvent() const = 0;
virtual void dump(int n = 0) const;
};
@@ -113,7 +103,6 @@ class MidiPart : public Part {
virtual MidiPart* clone() const;
MidiTrack* track() const { return (MidiTrack*)Part::track(); }
-// virtual Event* newEvent() const;
virtual void dump(int n = 0) const;
};
@@ -134,7 +123,6 @@ class WavePart : public Part {
virtual WavePart* clone() const;
WaveTrack* track() const { return (WaveTrack*)Part::track(); }
-// virtual Event* newEvent() const;
virtual void dump(int n = 0) const;
};
@@ -167,9 +155,6 @@ extern void addPortCtrlEvents(Event& event, Part* part, bool doClones);
extern void removePortCtrlEvents(Part* part, bool doClones);
extern void removePortCtrlEvents(Event& event, Part* part, bool doClones);
extern CloneList cloneList;
-//extern CloneList copyCloneList;
-//extern void updateCloneList(Part* oPart, Part* nPart);
-//extern void clearClipboardAndCloneList();
extern Part* readXmlPart(Xml&, Track*, bool doClone = false, bool toTrack = true);
#endif