comparison src/vamp-hostsdk/PluginInputDomainAdapter.cpp @ 421:35fa4733bc5d

Fix compiler warnings, and fix potential mangling of utf8 when downcasing (this is still a nasty and incomplete way to do it though)
author Chris Cannam
date Thu, 14 Apr 2016 11:49:12 +0100
parents e0697515163f
children 9a2998401bbe
comparison
equal deleted inserted replaced
420:99868cd95acb 421:35fa4733bc5d
331 m_window = new Window<double>(convertType(m_windowType), m_blockSize); 331 m_window = new Window<double>(convertType(m_windowType), m_blockSize);
332 332
333 #ifdef HAVE_FFTW3 333 #ifdef HAVE_FFTW3
334 m_ri = (double *)fftw_malloc(blockSize * sizeof(double)); 334 m_ri = (double *)fftw_malloc(blockSize * sizeof(double));
335 m_cbuf = (fftw_complex *)fftw_malloc((blockSize/2 + 1) * sizeof(fftw_complex)); 335 m_cbuf = (fftw_complex *)fftw_malloc((blockSize/2 + 1) * sizeof(fftw_complex));
336 m_plan = fftw_plan_dft_r2c_1d(blockSize, m_ri, m_cbuf, FFTW_MEASURE); 336 m_plan = fftw_plan_dft_r2c_1d(int(blockSize), m_ri, m_cbuf, FFTW_MEASURE);
337 #else 337 #else
338 m_ri = new double[m_blockSize]; 338 m_ri = new double[m_blockSize];
339 m_ro = new double[m_blockSize]; 339 m_ro = new double[m_blockSize];
340 m_io = new double[m_blockSize]; 340 m_io = new double[m_blockSize];
341 #endif 341 #endif
505 505
506 Plugin::FeatureSet 506 Plugin::FeatureSet
507 PluginInputDomainAdapter::Impl::processShiftingTimestamp(const float *const *inputBuffers, 507 PluginInputDomainAdapter::Impl::processShiftingTimestamp(const float *const *inputBuffers,
508 RealTime timestamp) 508 RealTime timestamp)
509 { 509 {
510 unsigned int roundedRate = 1;
511 if (m_inputSampleRate > 0.f) {
512 roundedRate = (unsigned int)round(m_inputSampleRate);
513 }
514
510 if (m_method == ShiftTimestamp) { 515 if (m_method == ShiftTimestamp) {
511 // we may need to add one nsec if timestamp + 516 // we may need to add one nsec if timestamp +
512 // getTimestampAdjustment() rounds down 517 // getTimestampAdjustment() rounds down
513 timestamp = timestamp + getTimestampAdjustment(); 518 timestamp = timestamp + getTimestampAdjustment();
514 RealTime nsec(0, 1); 519 RealTime nsec(0, 1);
515 if (RealTime::realTime2Frame(timestamp, m_inputSampleRate) < 520 if (RealTime::realTime2Frame(timestamp, roundedRate) <
516 RealTime::realTime2Frame(timestamp + nsec, m_inputSampleRate)) { 521 RealTime::realTime2Frame(timestamp + nsec, roundedRate)) {
517 timestamp = timestamp + nsec; 522 timestamp = timestamp + nsec;
518 } 523 }
519 } 524 }
520 525
521 for (int c = 0; c < m_channels; ++c) { 526 for (int c = 0; c < m_channels; ++c) {