changeset 40:b2d1a61ab916

* A bit more work on main window / document / commands stuff. This is still pretty unstable. * Enable CSV file reader also to read files with other separators (e.g. .lab files with space separators) * Show "(R)" on waveform display when resampling during playback * Add ability to import additional audio files (can't process them yet) * Fixes to spectrogram cache for multiple views * Fix to avoid floating-point exception in sparse model when resolution not set yet
author Chris Cannam
date Mon, 06 Mar 2006 17:20:25 +0000
parents e1a0cf2dcc79
children 2b6412c1e724
files base/AudioPlaySource.h base/Layer.h base/ViewManager.cpp base/ViewManager.h
diffstat 4 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/base/AudioPlaySource.h	Fri Mar 03 17:52:21 2006 +0000
+++ b/base/AudioPlaySource.h	Mon Mar 06 17:20:25 2006 +0000
@@ -50,6 +50,12 @@
      * 0.0 -> 1.0, for metering purposes.
      */
     virtual bool getOutputLevels(float &left, float &right) = 0;
+
+    /**
+     * Return the sample rate set by the target audio device (or the
+     * source sample rate if the target hasn't set one).
+     */
+    virtual size_t getTargetSampleRate() const = 0;
 };
 
 #endif
--- a/base/Layer.h	Fri Mar 03 17:52:21 2006 +0000
+++ b/base/Layer.h	Mon Mar 06 17:20:25 2006 +0000
@@ -198,9 +198,8 @@
      * view and is not expected to become visible in the near future
      * (for example because the user has explicitly removed or hidden
      * it).  The layer may respond by (for example) freeing any cache
-     * memory it is using, until next time its paint method is called.
-     * It does not need to remember not to draw itself; the view will
-     * handle that.
+     * memory it is using, until next time its paint method is called,
+     * when it should set itself un-dormant again.
      */
     virtual void setLayerDormant(const View *v, bool dormant) {
 	m_dormancy[v] = dormant;
@@ -230,7 +229,7 @@
     void layerNameChanged();
 
 protected:
-    std::map<const void *, bool> m_dormancy;
+    mutable std::map<const void *, bool> m_dormancy;
 };
 
 #endif
--- a/base/ViewManager.cpp	Fri Mar 03 17:52:21 2006 +0000
+++ b/base/ViewManager.cpp	Mon Mar 06 17:20:25 2006 +0000
@@ -174,6 +174,15 @@
     emit playSelectionModeChanged();
 }
 
+size_t
+ViewManager::getPlaybackSampleRate() const
+{
+    if (m_playSource) {
+	return m_playSource->getTargetSampleRate();
+    }
+    return 0;
+}
+
 void
 ViewManager::setAudioPlaySource(AudioPlaySource *source)
 {
--- a/base/ViewManager.h	Fri Mar 03 17:52:21 2006 +0000
+++ b/base/ViewManager.h	Mon Mar 06 17:20:25 2006 +0000
@@ -83,6 +83,8 @@
     bool getPlaySelectionMode() const { return m_playSelectionMode; }
     void setPlaySelectionMode(bool on);
 
+    size_t getPlaybackSampleRate() const;
+
 signals:
     /** Emitted when a widget pans.  The originator identifies the widget. */
     void centreFrameChanged(void *originator, unsigned long frame, bool locked);