[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src core/AudioClip.cpp core/AudioClip....
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src core/AudioClip.cpp core/AudioClip.... |
Date: |
Tue, 05 Jun 2007 12:47:10 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/06/05 12:47:09
Modified files:
src/core : AudioClip.cpp AudioClip.h AudioSource.cpp
AudioSource.h ReadSource.cpp ReadSource.h
src/traverso/widgets: ResourcesWidget.cpp ResourcesWidget.h
Log message:
* some header cleanups, removal of unused functions
* emit signal when setting file for ReadSource
* catch clip/readsource signals to update resources bin after file
change, recording finished
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.106&r2=1.107
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.h?cvsroot=traverso&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioSource.cpp?cvsroot=traverso&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioSource.h?cvsroot=traverso&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.cpp?cvsroot=traverso&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.h?cvsroot=traverso&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/widgets/ResourcesWidget.cpp?cvsroot=traverso&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/widgets/ResourcesWidget.h?cvsroot=traverso&r1=1.8&r2=1.9
Patches:
Index: core/AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -b -r1.106 -r1.107
--- core/AudioClip.cpp 4 Jun 2007 19:08:00 -0000 1.106
+++ core/AudioClip.cpp 5 Jun 2007 12:47:09 -0000 1.107
@@ -65,7 +65,7 @@
{
PENTERCONS;
m_length = sourceStartFrame = sourceEndFrame = trackEndFrame = 0;
- isMuted=false;
+ m_isMuted=false;
m_id = create_id();
m_readSourceId = m_songId = 0;
init();
@@ -86,7 +86,7 @@
m_readSourceId = e.attribute("source", "").toLongLong();
m_songId = e.attribute("sheet", "0").toLongLong();
m_name = e.attribute( "clipname", "" ) ;
- isMuted = e.attribute( "mute", "" ).toInt();
+ m_isMuted = e.attribute( "mute", "" ).toInt();
m_length = e.attribute( "length", "0" ).toUInt();
sourceStartFrame = e.attribute( "sourcestart", "" ).toUInt();
sourceEndFrame = sourceStartFrame + m_length;
@@ -110,11 +110,10 @@
m_track = 0;
m_readSource = 0;
m_recordingStatus = NO_RECORDING;
- isSelected = m_invalidReadSource = false;
- isLocked = config().get_property("AudioClip", "LockByDefault",
false).toBool();
+ m_isSelected = m_invalidReadSource = false;
+ m_isLocked = config().get_property("AudioClip", "LockByDefault",
false).toBool();
fadeIn = 0;
fadeOut = 0;
- m_refcount = 0;
m_pluginChain = new PluginChain(this);
m_fader = m_pluginChain->get_fader();
m_fader->automate_port(0, true);
@@ -129,9 +128,9 @@
QDomElement e = node.toElement();
- isTake = e.attribute( "take", "").toInt();
+ m_isTake = e.attribute( "take", "").toInt();
set_gain( e.attribute( "gain", "" ).toFloat() );
- isLocked = e.attribute( "locked", "0" ).toInt();
+ m_isLocked = e.attribute( "locked", "0" ).toInt();
if (e.attribute("selected", "0").toInt() == 1) {
m_song->get_audioclip_manager()->select_clip(this);
@@ -139,7 +138,7 @@
m_readSourceId = e.attribute("source", "").toLongLong();
m_songId = e.attribute("sheet", "0").toLongLong();
- isMuted = e.attribute( "mute", "" ).toInt();
+ m_isMuted = e.attribute( "mute", "" ).toInt();
sourceStartFrame = e.attribute( "sourcestart", "" ).toUInt();
m_length = e.attribute( "length", "0" ).toUInt();
@@ -176,13 +175,13 @@
node.setAttribute("trackstart", trackStartFrame);
node.setAttribute("sourcestart", sourceStartFrame);
node.setAttribute("length", m_length);
- node.setAttribute("mute", isMuted);
- node.setAttribute("take", isTake);
+ node.setAttribute("mute", m_isMuted);
+ node.setAttribute("take", m_isTake);
node.setAttribute("clipname", m_name );
- node.setAttribute("selected", isSelected );
+ node.setAttribute("selected", m_isSelected );
node.setAttribute("id", m_id );
node.setAttribute("sheet", m_songId );
- node.setAttribute("locked", isLocked);
+ node.setAttribute("locked", m_isLocked);
node.setAttribute("source", m_readSourceId);
@@ -203,14 +202,14 @@
void AudioClip::toggle_mute()
{
PENTER;
- isMuted=!isMuted;
+ m_isMuted=!m_isMuted;
set_sources_active_state();
emit muteChanged();
}
void AudioClip::toggle_lock()
{
- isLocked = !isLocked;
+ m_isLocked = !m_isLocked;
emit lockChanged();
}
@@ -373,7 +372,7 @@
void AudioClip::set_selected(bool selected)
{
- isSelected = selected;
+ m_isSelected = selected;
emit stateChanged();
}
@@ -393,7 +392,7 @@
return -1;
}
- if (isMuted || (get_gain() == 0.0f) ) {
+ if (m_isMuted || (get_gain() == 0.0f) ) {
return 0;
}
@@ -558,7 +557,7 @@
}
sourceStartFrame = 0;
- isTake = 1;
+ m_isTake = 1;
m_recordingStatus = RECORDING;
connect(m_song, SIGNAL(transferStopped()), this,
SLOT(finish_recording()));
@@ -600,18 +599,6 @@
return group;
}
-AudioClip * AudioClip::prev_clip( )
-{
- Q_ASSERT(m_track);
- return m_track->get_cliplist().prev(this);
-}
-
-AudioClip * AudioClip::next_clip( )
-{
- Q_ASSERT(m_track);
- return m_track->get_cliplist().next(this);
-}
-
AudioClip* AudioClip::create_copy( )
{
PENTER;
@@ -777,22 +764,22 @@
bool AudioClip::is_selected( ) const
{
- return isSelected;
+ return m_isSelected;
}
bool AudioClip::is_take( ) const
{
- return isTake;
+ return m_isTake;
}
bool AudioClip::is_muted( ) const
{
- return isMuted;
+ return m_isMuted;
}
bool AudioClip::is_locked( ) const
{
- return isLocked;
+ return m_isLocked;
}
QString AudioClip::get_name( ) const
@@ -922,12 +909,12 @@
set_gain(target/maxamp);
}
-FadeCurve * AudioClip::get_fade_in( )
+FadeCurve * AudioClip::get_fade_in( ) const
{
return fadeIn;
}
-FadeCurve * AudioClip::get_fade_out( )
+FadeCurve * AudioClip::get_fade_out( ) const
{
return fadeOut;
}
Index: core/AudioClip.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- core/AudioClip.h 30 May 2007 13:57:36 -0000 1.53
+++ core/AudioClip.h 5 Jun 2007 12:47:09 -0000 1.54
@@ -34,16 +34,13 @@
class Song;
-class AudioSource;
class ReadSource;
class WriteSource;
class Track;
class Peak;
class AudioBus;
class FadeCurve;
-class Curve;
class PluginChain;
-struct ExportSpecification;
class AudioClip : public ContextItem, public Snappable
{
@@ -70,9 +67,6 @@
FINISHING_RECORDING
};
- void create_fade_in();
- void create_fade_out();
-
void set_audio_source(ReadSource* source);
int init_recording(QByteArray bus);
int process(nframes_t nframes, audio_sample_t* channelBuffer, uint
channel);
@@ -87,15 +81,13 @@
void set_selected(bool selected);
int set_state( const QDomNode& node );
- AudioClip* prev_clip();
- AudioClip* next_clip();
AudioClip* create_copy();
Track* get_track() const;
Song* get_song() const;
Peak* get_peak_for_channel(int chan) const;
QDomNode get_state(QDomDocument doc);
- FadeCurve* get_fade_in();
- FadeCurve* get_fade_out();
+ FadeCurve* get_fade_in() const;
+ FadeCurve* get_fade_out() const;
PluginChain* get_plugin_chain() const {return m_pluginChain;}
nframes_t get_length() const;
@@ -135,7 +127,6 @@
private:
Track* m_track;
Song* m_song;
- AudioSource* audioSource;
ReadSource* m_readSource;
QList<WriteSource* > writeSources;
QList<FadeCurve* > m_fades;
@@ -155,24 +146,24 @@
nframes_t sourceLength;
nframes_t m_length;
- int isSelected;
- bool isTake;
- bool isMuted;
- bool isLocked;
+ int m_isSelected;
+ bool m_isTake;
+ bool m_isMuted;
+ bool m_isLocked;
bool m_invalidReadSource;
RecordingStatus m_recordingStatus;
qint64 m_readSourceId;
qint64 m_songId;
- int m_refcount;
+ void create_fade_in();
+ void create_fade_out();
void init();
void set_source_end_frame(nframes_t frame);
void set_source_start_frame(nframes_t frame);
void set_track_end_frame(nframes_t endFrame);
void set_sources_active_state();
void process_capture(nframes_t nframes, uint channel);
- int ref() {return m_refcount++;}
void calculate_normalization_factor(float targetdB = 0.0);
Index: core/AudioSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioSource.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- core/AudioSource.cpp 4 Jun 2007 18:33:06 -0000 1.23
+++ core/AudioSource.cpp 5 Jun 2007 12:47:09 -0000 1.24
@@ -91,7 +91,6 @@
set_dir( e.attribute("dir", "" ));
m_id = e.attribute("id", "").toLongLong();
m_length = e.attribute("length", "0").toUInt();
- set_name( e.attribute("name", "No name supplied?" ));
m_origBitDepth = e.attribute("origbitdepth", "0").toInt();
m_wasRecording = e.attribute("wasrecording", "0").toInt();
@@ -102,11 +101,7 @@
m_wasRecording = true;
}
- if (m_wasRecording) {
- m_shortName = m_name.left(m_name.length() - 20);
- } else {
- m_shortName = m_name;
- }
+ set_name( e.attribute("name", "No name supplied?" ));
return 1;
}
@@ -115,7 +110,11 @@
void AudioSource::set_name(const QString& name)
{
m_name = name;
- m_shortName = name;
+ if (m_wasRecording) {
+ m_shortName = m_name.left(m_name.length() - 20);
+ } else {
+ m_shortName = m_name;
+ }
m_fileName = m_dir + m_name;
}
@@ -142,11 +141,6 @@
m_origSongId = id;
}
-void AudioSource::set_sample_rate( int rate )
-{
- m_rate = rate;
-}
-
QString AudioSource::get_filename( ) const
{
return m_fileName;
Index: core/AudioSource.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioSource.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- core/AudioSource.h 4 Jun 2007 18:33:07 -0000 1.18
+++ core/AudioSource.h 5 Jun 2007 12:47:09 -0000 1.19
@@ -44,7 +44,6 @@
void set_dir(const QString& name);
void set_original_bit_depth(uint bitDepth);
void set_created_by_song(qint64 id);
- void set_sample_rate(int rate);
int set_state( const QDomNode& node );
Index: core/ReadSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- core/ReadSource.cpp 4 Jun 2007 18:22:53 -0000 1.35
+++ core/ReadSource.cpp 5 Jun 2007 12:47:09 -0000 1.36
@@ -277,6 +277,8 @@
set_audio_clip(m_clip);
+ emit stateChanged();
+
return 1;
}
Index: core/ReadSource.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- core/ReadSource.h 4 Jun 2007 18:33:07 -0000 1.27
+++ core/ReadSource.h 5 Jun 2007 12:47:09 -0000 1.28
@@ -73,6 +73,9 @@
friend class MonoReader;
friend class ResourcesManager;
+
+signals:
+ void stateChanged();
};
#endif
Index: traverso/widgets/ResourcesWidget.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/widgets/ResourcesWidget.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- traverso/widgets/ResourcesWidget.cpp 5 Jun 2007 07:43:20 -0000
1.24
+++ traverso/widgets/ResourcesWidget.cpp 5 Jun 2007 12:47:09 -0000
1.25
@@ -354,17 +354,12 @@
SourceTreeItem* item = m_sourceindices.value(source->get_id());
if (! item) {
- SourceTreeItem* item = new SourceTreeItem(sourcesTreeWidget,
source);
+ item = new SourceTreeItem(sourcesTreeWidget, source);
m_sourceindices.insert(source->get_id(), item);
- QString duration = frame_to_ms(source->get_nframes(), 44100);
- item->setText(0, source->get_short_name());
- item->setText(1, duration);
- item->setText(2, "");
- item->setText(3, "");
- item->setData(0, Qt::UserRole, source->get_id());
- item->setToolTip(0, source->get_short_name() + " " +
duration);
}
+ item->source_state_changed();
+
update_source_state(source->get_id());
}
@@ -386,16 +381,7 @@
{
SourceTreeItem* item = m_sourceindices.value(id);
Q_ASSERT(item);
-
- if (resources_manager()->is_source_in_use(id)) {
- for (int i=0; i<5; ++i) {
- item->setForeground(i, QColor(Qt::black));
- }
- } else {
- for (int i=0; i<5; ++i) {
- item->setForeground(i, QColor(Qt::lightGray));
- }
- }
+ item->source_state_changed();
}
ClipTreeItem::ClipTreeItem(SourceTreeItem * parent, AudioClip * clip)
@@ -403,6 +389,7 @@
, m_clip(clip)
{
setData(0, Qt::UserRole, clip->get_id());
+ connect(clip, SIGNAL(recordingFinished()), this,
SLOT(clip_state_changed()));
}
void ClipTreeItem::clip_state_changed()
@@ -442,6 +429,7 @@
: QTreeWidgetItem(parent)
, m_source(source)
{
+ connect(m_source, SIGNAL(stateChanged()), this,
SLOT(source_state_changed()));
}
void SourceTreeItem::apply_filter(Song * song)
@@ -467,3 +455,27 @@
}
}
+void SourceTreeItem::source_state_changed()
+{
+ if (resources_manager()->is_source_in_use(m_source->get_id())) {
+ for (int i=0; i<5; ++i) {
+ setForeground(i, QColor(Qt::black));
+ }
+ } else {
+ for (int i=0; i<5; ++i) {
+ setForeground(i, QColor(Qt::lightGray));
+ }
+ }
+
+ int rate = m_source->get_rate();
+ if (rate == 0) rate = pm().get_project()->get_rate();
+ QString duration = frame_to_ms(m_source->get_nframes(), rate);
+ setText(0, m_source->get_short_name());
+ setText(1, duration);
+ setText(2, "");
+ setText(3, "");
+ setData(0, Qt::UserRole, m_source->get_id());
+ setToolTip(0, m_source->get_short_name() + " " + duration);
+
+}
+
Index: traverso/widgets/ResourcesWidget.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/widgets/ResourcesWidget.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- traverso/widgets/ResourcesWidget.h 24 May 2007 17:45:20 -0000 1.8
+++ traverso/widgets/ResourcesWidget.h 5 Jun 2007 12:47:09 -0000 1.9
@@ -61,6 +61,9 @@
private:
ReadSource* m_source;
+
+public slots:
+ void source_state_changed();
};
class ResourcesWidget : public QWidget, protected Ui::ResourcesWidget
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src core/AudioClip.cpp core/AudioClip....,
Remon Sijrier <=