comparison layer/SpectrogramLayer.cpp @ 80:d99d67a5b93a

* Fix crash in spectrogram layer when replacing model * Change sample player's sample path to a single sample directory. This makes it immune to OS path separator differences, and ensures it can reject configure calls that try to set a nonexistent directory. Reloading play parameters (e.g. sample program) should now work. * some win32 fixes.
author Chris Cannam
date Wed, 26 Apr 2006 16:00:13 +0000
parents 19bf27e4fb29
children 82482231b6b1
comparison
equal deleted inserted replaced
79:19bf27e4fb29 80:d99d67a5b93a
112 std::cerr << "SpectrogramLayer(" << this << "): setModel(" << model << ")" << std::endl; 112 std::cerr << "SpectrogramLayer(" << this << "): setModel(" << model << ")" << std::endl;
113 113
114 m_mutex.lock(); 114 m_mutex.lock();
115 m_cacheInvalid = true; 115 m_cacheInvalid = true;
116 m_model = model; 116 m_model = model;
117 delete m_cache; //!!! hang on, this isn't safe to do here is it?
118 // we need some sort of guard against the fill
119 // thread trying to read the defunct model too.
120 // should we use a scavenger?
121 m_cache = 0;
122 m_mutex.unlock(); 117 m_mutex.unlock();
123 118
124 if (!m_model || !m_model->isOK()) return; 119 if (!m_model || !m_model->isOK()) return;
125 120
126 connect(m_model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged())); 121 connect(m_model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged()));
1373 // the width and height of the cache and the FFT 1368 // the width and height of the cache and the FFT
1374 // parameters known before we unlock, in case they change 1369 // parameters known before we unlock, in case they change
1375 // in the model while we aren't holding a lock. It's safe 1370 // in the model while we aren't holding a lock. It's safe
1376 // for us to continue to use the "old" values if that 1371 // for us to continue to use the "old" values if that
1377 // happens, because they will continue to match the 1372 // happens, because they will continue to match the
1378 // dimensions of the actual cache (which we manage, not 1373 // dimensions of the actual cache (which this thread
1379 // the model). 1374 // manages, not the layer's).
1380 m_layer.m_mutex.unlock(); 1375 m_layer.m_mutex.unlock();
1381 1376
1382 double *input = (double *) 1377 double *input = (double *)
1383 fftw_malloc(windowSize * sizeof(double)); 1378 fftw_malloc(windowSize * sizeof(double));
1384 1379