sv1-commits Mailing List for Sonic Visualiser (Page 2)
Brought to you by:
cannam
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(25) |
Oct
(57) |
Nov
(25) |
Dec
(11) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(36) |
Feb
(34) |
Mar
(55) |
Apr
(41) |
May
(25) |
Jun
(27) |
Jul
(22) |
Aug
(16) |
Sep
(33) |
Oct
(52) |
Nov
(79) |
Dec
(28) |
2008 |
Jan
(27) |
Feb
(56) |
Mar
(38) |
Apr
(32) |
May
(22) |
Jun
(55) |
Jul
(48) |
Aug
(10) |
Sep
(23) |
Oct
(32) |
Nov
(56) |
Dec
(71) |
2009 |
Jan
(35) |
Feb
(61) |
Mar
(52) |
Apr
(3) |
May
(18) |
Jun
(24) |
Jul
(13) |
Aug
(20) |
Sep
(27) |
Oct
(29) |
Nov
|
Dec
(1) |
2010 |
Jan
(3) |
Feb
(5) |
Mar
(8) |
Apr
(1) |
May
(20) |
Jun
(15) |
Jul
(8) |
Aug
(4) |
Sep
(3) |
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
(9) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
(3) |
Nov
(2) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ca...@us...> - 2010-09-24 10:40:50
|
Revision: 1739 http://sv1.svn.sourceforge.net/sv1/?rev=1739&view=rev Author: cannam Date: 2010-09-24 10:40:43 +0000 (Fri, 24 Sep 2010) Log Message: ----------- * Add -v option to print version Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp sonic-annotator/trunk/runner/main.cpp sonic-annotator/trunk/version.h Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2010-09-22 14:31:12 UTC (rev 1738) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2010-09-24 10:40:43 UTC (rev 1739) @@ -651,6 +651,7 @@ int index; int fc = (int)frames.size(); + if (m_channels == 1) { // only case in which we can sensibly mix down for (int j = 0; j < m_blockSize; ++j) { data[0][j] = 0.f; Modified: sonic-annotator/trunk/runner/main.cpp =================================================================== --- sonic-annotator/trunk/runner/main.cpp 2010-09-22 14:31:12 UTC (rev 1738) +++ sonic-annotator/trunk/runner/main.cpp 2010-09-24 10:40:43 UTC (rev 1739) @@ -157,7 +157,7 @@ cerr << " " << myname.toStdString() << " -s <transform>" << endl; cerr << " " << myname.toStdString() - << " [-lh]" << endl; + << " [-lhv]" << endl; cerr << endl; cerr << "Where <audio> is an audio file or URL to use as input: either a local file" << endl; cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL." << endl; @@ -256,11 +256,12 @@ cerr << " -s, --skeleton <I> Generate a skeleton transform file for transform id <I>" << endl; cerr << " and write it to standard output." << endl; cerr << endl; + cerr << " -v, --version Show the version number and exit." << endl; cerr << " -h, --help Show this help." << endl; cerr << endl; - cerr << "If no -w (or --writer) options are supplied, either the -l -s or -h option (or" << endl; - cerr << "long equivalent) must be given instead." << endl; + cerr << "If no -w (or --writer) options are supplied, either the -l -s -v or -h option" << endl; + cerr << "(or long equivalent) must be given instead." << endl; for (set<string>::const_iterator i = writers.begin(); i != writers.end(); ++i) { @@ -385,6 +386,11 @@ usage(myname); } + if (arg == "-v" || arg == "--version") { + std::cout << RUNNER_VERSION << std::endl; + return 0; + } + if (arg == "-w" || arg == "--writer") { if (last || args[i+1].startsWith("-")) { cerr << myname.toStdString() << ": argument expected for \"" Modified: sonic-annotator/trunk/version.h =================================================================== --- sonic-annotator/trunk/version.h 2010-09-22 14:31:12 UTC (rev 1738) +++ sonic-annotator/trunk/version.h 2010-09-24 10:40:43 UTC (rev 1739) @@ -1 +1 @@ -#define RUNNER_VERSION "0.5" +#define RUNNER_VERSION "0.6svn" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-09-22 14:31:18
|
Revision: 1738 http://sv1.svn.sourceforge.net/sv1/?rev=1738&view=rev Author: cannam Date: 2010-09-22 14:31:12 +0000 (Wed, 22 Sep 2010) Log Message: ----------- * Pick up default sample rate and channel count from first audio file (formerly they were hardcoded to 44100 and 1...) Modified Paths: -------------- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp sonic-annotator/trunk/runner/FeatureExtractionManager.h sonic-annotator/trunk/runner/main.cpp Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.cpp =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2010-09-22 14:22:47 UTC (rev 1737) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.cpp 2010-09-22 14:31:12 UTC (rev 1738) @@ -59,7 +59,7 @@ m_blockSize(16384), m_defaultSampleRate(0), m_sampleRate(0), - m_channels(1) + m_channels(0) { } @@ -69,6 +69,9 @@ pi != m_plugins.end(); ++pi) { delete pi->first; } + foreach (AudioFileReader *r, m_readyReaders) { + delete r; + } } void FeatureExtractionManager::setChannels(int channels) @@ -379,29 +382,22 @@ return addFeatureExtractor(transform, writers); } -void FeatureExtractionManager::extractFeatures(QString audioSource) +void FeatureExtractionManager::addSource(QString audioSource) { - if (m_plugins.empty()) return; - - testOutputFiles(audioSource); - - ProgressPrinter retrievalProgress("Retrieving audio data..."); - - FileSource source(audioSource, &retrievalProgress); - if (!source.isAvailable()) { - cerr << "ERROR: File or URL \"" << audioSource.toStdString() - << "\" could not be located" << endl; - throw FileNotFound(audioSource); - } - - source.waitForData(); - if (QFileInfo(audioSource).suffix().toLower() == "m3u") { + ProgressPrinter retrievalProgress("Opening playlist file..."); + FileSource source(audioSource, &retrievalProgress); + if (!source.isAvailable()) { + cerr << "ERROR: File or URL \"" << audioSource.toStdString() + << "\" could not be located" << endl; + throw FileNotFound(audioSource); + } + source.waitForData(); PlaylistFileReader reader(source); if (reader.isOK()) { vector<QString> files = reader.load(); for (int i = 0; i < (int)files.size(); ++i) { - extractFeatures(files[i]); + addSource(files[i]); } return; } else { @@ -411,33 +407,106 @@ } } + std::cerr << "Have audio source: \"" << audioSource.toStdString() << "\"" << std::endl; + + // We don't actually do anything with it here, unless it's the + // first audio source and we need it to establish default channel + // count and sample rate + + if (m_channels == 0 || m_defaultSampleRate == 0) { + + ProgressPrinter retrievalProgress("Determining default rate and channel count from first input file..."); + + FileSource source(audioSource, &retrievalProgress); + if (!source.isAvailable()) { + cerr << "ERROR: File or URL \"" << audioSource.toStdString() + << "\" could not be located" << endl; + throw FileNotFound(audioSource); + } + + source.waitForData(); + + // Open to determine validity, channel count, sample rate only + // (then close, and open again later with actual desired rate &c) + + AudioFileReader *reader = + AudioFileReaderFactory::createReader(source, 0, &retrievalProgress); + + if (!reader) { + throw FailedToOpenFile(audioSource); + } + + retrievalProgress.done(); + + cerr << "File or URL \"" << audioSource.toStdString() << "\" opened successfully" << endl; + + if (m_channels == 0) { + m_channels = reader->getChannelCount(); + cerr << "Taking default channel count of " + << reader->getChannelCount() << " from file" << endl; + } + + if (m_defaultSampleRate == 0) { + m_defaultSampleRate = reader->getNativeRate(); + cerr << "Taking default sample rate of " + << reader->getNativeRate() << "Hz from file" << endl; + cerr << "(Note: Default may be overridden by transforms)" << endl; + } + + m_readyReaders[audioSource] = reader; + } +} + +void FeatureExtractionManager::extractFeatures(QString audioSource) +{ + if (m_plugins.empty()) return; + + testOutputFiles(audioSource); + if (m_sampleRate == 0) { - cerr << "ERROR: Internal error in FeatureExtractionManager::extractFeatures: Plugin list is non-empty, but no sample rate set" << endl; - exit(1); + throw FileOperationFailed + (audioSource, "internal error: have sources and plugins, but no sample rate"); } + if (m_channels == 0) { + throw FileOperationFailed + (audioSource, "internal error: have sources and plugins, but no channel count"); + } - AudioFileReader *reader = - AudioFileReaderFactory::createReader(source, m_sampleRate, &retrievalProgress); - + AudioFileReader *reader = 0; + + if (m_readyReaders.contains(audioSource)) { + reader = m_readyReaders[audioSource]; + m_readyReaders.remove(audioSource); + if (reader->getChannelCount() != m_channels || + reader->getSampleRate() != m_sampleRate) { + // can't use this; open it again + delete reader; + reader = 0; + } + } if (!reader) { + ProgressPrinter retrievalProgress("Retrieving audio data..."); + FileSource source(audioSource, &retrievalProgress); + source.waitForData(); + reader = AudioFileReaderFactory::createReader + (source, m_sampleRate, &retrievalProgress); + retrievalProgress.done(); + } + + if (!reader) { throw FailedToOpenFile(audioSource); } - size_t channels = reader->getChannelCount(); + cerr << "Audio file \"" << audioSource.toStdString() << "\": " + << reader->getChannelCount() << "ch at " + << reader->getNativeRate() << "Hz" << endl; + if (reader->getChannelCount() != m_channels || + reader->getNativeRate() != m_sampleRate) { + cerr << "NOTE: File will be mixed or resampled for processing: " + << m_channels << "ch at " + << m_sampleRate << "Hz" << endl; + } - retrievalProgress.done(); - - cerr << "Opened " << channels << "-channel file or URL \"" << audioSource.toStdString() << "\"" << endl; - - // reject file if it has too few channels - if ((int)channels < m_channels) { - delete reader; - throw FileOperationFailed - (audioSource, - QString("read sufficient channels (found %1, require %2)") - .arg(channels).arg(m_channels)); - } - // allocate audio buffers float **data = new float *[m_channels]; for (int c = 0; c < m_channels; ++c) { Modified: sonic-annotator/trunk/runner/FeatureExtractionManager.h =================================================================== --- sonic-annotator/trunk/runner/FeatureExtractionManager.h 2010-09-22 14:22:47 UTC (rev 1737) +++ sonic-annotator/trunk/runner/FeatureExtractionManager.h 2010-09-22 14:31:12 UTC (rev 1738) @@ -20,6 +20,8 @@ #include <set> #include <string> +#include <QMap> + #include <vamp-hostsdk/Plugin.h> #include <vamp-hostsdk/PluginSummarisingAdapter.h> #include <transform/Transform.h> @@ -31,6 +33,7 @@ using std::map; class FeatureWriter; +class AudioFileReader; class FeatureExtractionManager { @@ -54,6 +57,7 @@ bool addDefaultFeatureExtractor(TransformId transformId, const vector<FeatureWriter*> &writers); + void addSource(QString audioSource); void extractFeatures(QString audioSource); private: @@ -105,6 +109,8 @@ int m_defaultSampleRate; int m_sampleRate; int m_channels; + + QMap<QString, AudioFileReader *> m_readyReaders; void print(Transform transform) const; }; Modified: sonic-annotator/trunk/runner/main.cpp =================================================================== --- sonic-annotator/trunk/runner/main.cpp 2010-09-22 14:22:47 UTC (rev 1737) +++ sonic-annotator/trunk/runner/main.cpp 2010-09-22 14:31:12 UTC (rev 1738) @@ -23,6 +23,7 @@ #include <QString> #include <QFileInfo> #include <QDir> +#include <QSet> using std::cout; using std::cerr; @@ -587,17 +588,6 @@ } } - // the manager dictates the sample rate and number of channels - // to work at - files with too few channels are rejected, - // too many channels are handled as usual by the Vamp plugin - - //!!! Review this: although we probably do want to fix the channel - // count here, we don't necessarily want to fix the rate: it's - // specified in the Transform file. - - manager.setDefaultSampleRate(44100); - manager.setChannels(1); - vector<FeatureWriter *> writers; for (set<string>::const_iterator i = requestedWriterTags.begin(); @@ -682,27 +672,6 @@ } } - bool haveFeatureExtractor = false; - - for (set<string>::const_iterator i = requestedTransformFiles.begin(); - i != requestedTransformFiles.end(); ++i) { - if (manager.addFeatureExtractorFromFile(i->c_str(), writers)) { - haveFeatureExtractor = true; - } - } - - for (set<string>::const_iterator i = requestedDefaultTransforms.begin(); - i != requestedDefaultTransforms.end(); ++i) { - if (manager.addDefaultFeatureExtractor(i->c_str(), writers)) { - haveFeatureExtractor = true; - } - } - - if (!haveFeatureExtractor) { - cerr << myname.toStdString() << ": no feature extractors added" << endl; - exit(2); - } - QStringList sources; if (!recursive) { sources = otherArgs; @@ -721,17 +690,16 @@ } bool good = true; + QSet<QString> badSources; for (QStringList::const_iterator i = sources.begin(); i != sources.end(); ++i) { - std::cerr << "Extracting features for: \"" << i->toStdString() << "\"" << std::endl; try { - manager.extractFeatures(*i); + manager.addSource(*i); } catch (const std::exception &e) { + badSources.insert(*i); cerr << "ERROR: Failed to process file \"" << i->toStdString() << "\": " << e.what() << endl; - cerr << "NOTE: If you want to continue with processing any further files after an" << endl - << "error like this, use the --force option" << endl; if (force) { // print a note only if we have more files to process QStringList::const_iterator j = i; @@ -739,12 +707,64 @@ cerr << "NOTE: \"--force\" option was provided, continuing (more errors may occur)" << endl; } } else { + cerr << "NOTE: If you want to continue with processing any further files after an" << endl + << "error like this, use the --force option" << endl; good = false; break; } } } + + if (good) { + bool haveFeatureExtractor = false; + + for (set<string>::const_iterator i = requestedTransformFiles.begin(); + i != requestedTransformFiles.end(); ++i) { + if (manager.addFeatureExtractorFromFile(i->c_str(), writers)) { + haveFeatureExtractor = true; + } + } + + for (set<string>::const_iterator i = requestedDefaultTransforms.begin(); + i != requestedDefaultTransforms.end(); ++i) { + if (manager.addDefaultFeatureExtractor(i->c_str(), writers)) { + haveFeatureExtractor = true; + } + } + + if (!haveFeatureExtractor) { + cerr << myname.toStdString() << ": no feature extractors added" << endl; + good = false; + } + } + + if (good) { + for (QStringList::const_iterator i = sources.begin(); + i != sources.end(); ++i) { + if (badSources.contains(*i)) continue; + std::cerr << "Extracting features for: \"" << i->toStdString() << "\"" << std::endl; + try { + manager.extractFeatures(*i); + } catch (const std::exception &e) { + cerr << "ERROR: Feature extraction failed for \"" << i->toStdString() + << "\": " << e.what() << endl; + if (force) { + // print a note only if we have more files to process + QStringList::const_iterator j = i; + if (++j != sources.end()) { + cerr << "NOTE: \"--force\" option was provided, continuing (more errors may occur)" << endl; + } + } else { + cerr << "NOTE: If you want to continue with processing any further files after an" << endl + << "error like this, use the --force option" << endl; + good = false; + break; + } + } + } + } + for (int i = 0; i < writers.size(); ++i) delete writers[i]; #ifdef HAVE_FFTW3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-09-22 14:22:54
|
Revision: 1737 http://sv1.svn.sourceforge.net/sv1/?rev=1737&view=rev Author: cannam Date: 2010-09-22 14:22:47 +0000 (Wed, 22 Sep 2010) Log Message: ----------- * getNativeRate needs to be virtual! Modified Paths: -------------- sonic-visualiser/trunk/data/fileio/AudioFileReader.h Modified: sonic-visualiser/trunk/data/fileio/AudioFileReader.h =================================================================== --- sonic-visualiser/trunk/data/fileio/AudioFileReader.h 2010-08-24 10:25:39 UTC (rev 1736) +++ sonic-visualiser/trunk/data/fileio/AudioFileReader.h 2010-09-22 14:22:47 UTC (rev 1737) @@ -38,8 +38,9 @@ size_t getFrameCount() const { return m_frameCount; } size_t getChannelCount() const { return m_channelCount; } size_t getSampleRate() const { return m_sampleRate; } - size_t getNativeRate() const { return m_sampleRate; } // if resampled + virtual size_t getNativeRate() const { return m_sampleRate; } // if resampled + /** * Return the location of the audio data in the reader (as passed * in to the FileSource constructor, for example). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-08-24 10:25:45
|
Revision: 1736 http://sv1.svn.sourceforge.net/sv1/?rev=1736&view=rev Author: cannam Date: 2010-08-24 10:25:39 +0000 (Tue, 24 Aug 2010) Log Message: ----------- * Add test for output destination when input filename has more than one dot Modified Paths: -------------- sonic-annotator/trunk/tests/test-csv-destinations.sh sonic-annotator/trunk/tests/test-rdf-destinations.sh Modified: sonic-annotator/trunk/tests/test-csv-destinations.sh =================================================================== --- sonic-annotator/trunk/tests/test-csv-destinations.sh 2010-08-10 14:46:38 UTC (rev 1735) +++ sonic-annotator/trunk/tests/test-csv-destinations.sh 2010-08-24 10:25:39 UTC (rev 1736) @@ -9,13 +9,16 @@ outfile1=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.csv outfile2=$mypath/audio/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.csv +infile1dot=$mypath/audio/3.clicks.8.wav +outfile1dot=$mypath/audio/3.clicks.8_vamp_vamp-example-plugins_percussiononsets_onsets.csv + outfile3=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.csv outfile4=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.csv testplug=vamp:vamp-example-plugins:percussiononsets tmpcsv=$mypath/tmp_1_$$.csv -trap "rm -f $tmpcsv $outfile1 $outfile2 $outfile3 $outfile4" 0 +trap "rm -f $tmpcsv $outfile1 $outfile2 $outfile3 $outfile4 $infile1dot $outfile1dot" 0 fail() { echo "Test failed: $1" @@ -46,6 +49,20 @@ check_csv $outfile1 "$ctx" +ctx="onsets transform, one audio file with dots in filename, default CSV writer destination" + +rm -f $outfile1 + +cp $infile1 $infile1dot + +$r -t $transformpfx-onsets.n3 -w csv $infile1dot 2>/dev/null || \ + fail "Fails to run with $ctx" + +check_csv $outfile1dot "$ctx" + +rm -f $infile1dot $outfile1dot + + ctx="onsets and df transforms, one audio file, default CSV writer destination" rm -f $outfile1 Modified: sonic-annotator/trunk/tests/test-rdf-destinations.sh =================================================================== --- sonic-annotator/trunk/tests/test-rdf-destinations.sh 2010-08-10 14:46:38 UTC (rev 1735) +++ sonic-annotator/trunk/tests/test-rdf-destinations.sh 2010-08-24 10:25:39 UTC (rev 1736) @@ -9,6 +9,9 @@ outfile1=$mypath/audio/3clicks8.n3 outfile2=$mypath/audio/6clicks8.n3 +infile1dot=$mypath/audio/3.clicks.8.wav +outfile1dot=$mypath/audio/3.clicks.8.n3 + outfile3=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 outfile4=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 outfile5=$mypath/audio/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 @@ -17,7 +20,7 @@ testplug=vamp:vamp-example-plugins:percussiononsets tmpttl=$mypath/tmp_1_$$.ttl -trap "rm -f $tmpttl $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6" 0 +trap "rm -f $tmpttl $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6 $infile1dot $outfile1dot" 0 fail() { echo "Test failed: $1" @@ -47,6 +50,20 @@ check_rdf $outfile1 "$ctx" +ctx="onsets transform, one audio file with dots in filename, default RDF writer destination" + +rm -f $outfile1 + +cp $infile1 $infile1dot + +$r -t $transformpfx-onsets.n3 -w rdf $infile1dot 2>/dev/null || \ + fail "Fails to run with $ctx" + +check_rdf $outfile1dot "$ctx" + +rm -f $infile1dot $outfile1dot + + ctx="onsets and df transforms, one audio file, default RDF writer destination" rm -f $outfile1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-08-10 14:46:44
|
Revision: 1735 http://sv1.svn.sourceforge.net/sv1/?rev=1735&view=rev Author: cannam Date: 2010-08-10 14:46:38 +0000 (Tue, 10 Aug 2010) Log Message: ----------- * Fix csv-one-file option Modified Paths: -------------- sonic-visualiser/trunk/transform/FileFeatureWriter.cpp Modified: sonic-visualiser/trunk/transform/FileFeatureWriter.cpp =================================================================== --- sonic-visualiser/trunk/transform/FileFeatureWriter.cpp 2010-08-10 14:45:54 UTC (rev 1734) +++ sonic-visualiser/trunk/transform/FileFeatureWriter.cpp 2010-08-10 14:46:38 UTC (rev 1735) @@ -90,7 +90,11 @@ if (m_support & SupportOneFileTotal) { if (m_support & ~SupportOneFileTotal) { // not only option p.name = "one-file"; - p.description = "Write all transform results for all input files into the single named output file."; + if (m_support & SupportOneFilePerTrack) { + p.description = "Write all transform results for all input files into the single named output file. (The default is to create one output file per input audio file, and write all transform results for that input into it.)"; + } else { + p.description = "Write all transform results for all input files into the single named output file. (The default is to create a separate output file for each combination of input audio file and transform.)"; + } p.hasArg = true; pl.push_back(p); } @@ -132,11 +136,16 @@ } else if (i->first == "one-file") { if (m_support & SupportOneFileTotal) { if (m_support & ~SupportOneFileTotal) { // not only option - if (m_manyFiles) { - cerr << "FileFeatureWriter::setParameters: WARNING: Both many-files and one-file parameters provided, ignoring one-file" << endl; - } else { + // No, we cannot do this test because m_manyFiles + // may be on by default (for any FileFeatureWriter + // that supports OneFilePerTrackTransform but not + // OneFilePerTrack), so we need to be able to + // override it +// if (m_manyFiles) { +// cerr << "FileFeatureWriter::setParameters: WARNING: Both many-files and one-file parameters provided, ignoring one-file" << endl; +// } else { m_singleFileName = i->second.c_str(); - } +// } } } } else if (i->first == "stdout") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-08-10 14:46:00
|
Revision: 1734 http://sv1.svn.sourceforge.net/sv1/?rev=1734&view=rev Author: cannam Date: 2010-08-10 14:45:54 +0000 (Tue, 10 Aug 2010) Log Message: ----------- * Fix csv-one-file option, add unit test for it Modified Paths: -------------- sonic-annotator/trunk/tests/test.sh Added Paths: ----------- sonic-annotator/trunk/tests/test-csv-destinations.sh Added: sonic-annotator/trunk/tests/test-csv-destinations.sh =================================================================== --- sonic-annotator/trunk/tests/test-csv-destinations.sh (rev 0) +++ sonic-annotator/trunk/tests/test-csv-destinations.sh 2010-08-10 14:45:54 UTC (rev 1734) @@ -0,0 +1,105 @@ +#!/bin/bash + +mypath=`dirname $0` +r=$mypath/../runner/sonic-annotator + +infile1=$mypath/audio/3clicks8.wav +infile2=$mypath/audio/6clicks8.wav + +outfile1=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.csv +outfile2=$mypath/audio/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.csv + +outfile3=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.csv +outfile4=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.csv + +testplug=vamp:vamp-example-plugins:percussiononsets +tmpcsv=$mypath/tmp_1_$$.csv + +trap "rm -f $tmpcsv $outfile1 $outfile2 $outfile3 $outfile4" 0 + +fail() { + echo "Test failed: $1" + exit 1 +} + +transformpfx=$mypath/transforms/transforms-rdf-writer-percussiononsets + +check_csv() { + test -f $1 || \ + fail "Fails to write output to expected location $1 for $2" + # every line must contain the same number of commas + formats=`awk -F, '{ print NF; }' $1 | sort | uniq | wc | awk '{ print $1 }'` + if [ "$formats" != "1" ]; then + fail "Output is not consistently formatted comma-separated file for $2" + fi + rm -f $1 +} + + +ctx="onsets transform, one audio file, default CSV writer destination" + +rm -f $outfile1 + +$r -t $transformpfx-onsets.n3 -w csv $infile1 2>/dev/null || \ + fail "Fails to run with $ctx" + +check_csv $outfile1 "$ctx" + + +ctx="onsets and df transforms, one audio file, default CSV writer destination" + +rm -f $outfile1 + +$r -t $transformpfx-onsets.n3 -t $transformpfx-detectionfunction.n3 -w csv $infile1 2>/dev/null || \ + fail "Fails to run with $ctx" + +check_csv $outfile1 "$ctx" + + +ctx="onsets transform, two audio files, default CSV writer destination" + +rm -f $outfile1 +rm -f $outfile2 + +$r -t $transformpfx-onsets.n3 -w csv $infile1 $infile2 2>/dev/null || \ + fail "Fails to run with $ctx" + +check_csv $outfile1 "$ctx" +check_csv $outfile2 "$ctx" + + +ctx="onsets transform, two audio files, one-file CSV writer" + +$r -t $transformpfx-onsets.n3 -w csv --csv-one-file $tmpcsv $infile1 $infile2 2>/dev/null || \ + fail "Fails to run with $ctx" + +check_csv $tmpcsv "$ctx" + + +ctx="onsets transform, two audio files, stdout CSV writer" + +$r -t $transformpfx-onsets.n3 -w csv --csv-stdout $infile1 $infile2 2>/dev/null >$tmpcsv || \ + fail "Fails to run with $ctx" + +check_csv $tmpcsv "$ctx" + + +ctx="existing output file and no --csv-force" + +touch $outfile1 + +$r -t $transformpfx-onsets.n3 -w csv $infile1 2>/dev/null && \ + fail "Fails by completing successfully when output file already exists (should refuse and bail out)" + + +ctx="existing output file and --csv-force" + +touch $outfile1 + +$r -t $transformpfx-onsets.n3 -w csv --csv-force $infile1 2>/dev/null || \ + fail "Fails to run with $ctx" + +check_csv $outfile1 "$ctx" + + +exit 0 Modified: sonic-annotator/trunk/tests/test.sh =================================================================== --- sonic-annotator/trunk/tests/test.sh 2010-08-05 11:02:24 UTC (rev 1733) +++ sonic-annotator/trunk/tests/test.sh 2010-08-10 14:45:54 UTC (rev 1734) @@ -10,6 +10,7 @@ as-advertised \ rdf-writer \ rdf-destinations \ + csv-destinations \ summaries \ ; do This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-08-05 11:02:33
|
Revision: 1733 http://sv1.svn.sourceforge.net/sv1/?rev=1733&view=rev Author: cannam Date: 2010-08-05 11:02:24 +0000 (Thu, 05 Aug 2010) Log Message: ----------- * Add Czech translation from Pavel Fric <pav...@se...> Modified Paths: -------------- sonic-visualiser/trunk/misc/update-i18n.sh sonic-visualiser/trunk/sonic-visualiser.pro sonic-visualiser/trunk/sv/i18n/sonic-visualiser_en_GB.qm sonic-visualiser/trunk/sv/i18n/sonic-visualiser_en_GB.ts sonic-visualiser/trunk/sv/i18n/sonic-visualiser_en_US.qm sonic-visualiser/trunk/sv/i18n/sonic-visualiser_en_US.ts sonic-visualiser/trunk/sv/i18n/sonic-visualiser_ru.qm sonic-visualiser/trunk/sv/i18n/sonic-visualiser_ru.ts sonic-visualiser/trunk/sv/sonic-visualiser.qrc Added Paths: ----------- sonic-visualiser/trunk/sv/i18n/sonic-visualiser_cs_CZ.qm sonic-visualiser/trunk/sv/i18n/sonic-visualiser_cs_CZ.ts Modified: sonic-visualiser/trunk/misc/update-i18n.sh =================================================================== --- sonic-visualiser/trunk/misc/update-i18n.sh 2010-07-22 13:21:51 UTC (rev 1732) +++ sonic-visualiser/trunk/misc/update-i18n.sh 2010-08-05 11:02:24 UTC (rev 1733) @@ -1,10 +1,15 @@ #!/bin/sh -LUPDATE="lupdate-qt4" -LRELEASE="lrelease-qt4" +LUPDATE="lupdate" +LRELEASE="lrelease" -LANGUAGES="ru en_GB en_US" +if lupdate-qt4 -version >/dev/null 2>&1; then + LUPDATE="lupdate-qt4" + LRELEASE="lrelease-qt4" +fi +LANGUAGES="ru en_GB en_US cs_CZ" + for LANG in $LANGUAGES; do $LUPDATE */*.h */*/*.h */*.cpp */*/*.cpp \ -ts sv/i18n/sonic-visualiser_$LANG.ts Modified: sonic-visualiser/trunk/sonic-visualiser.pro =================================================================== --- sonic-visualiser/trunk/sonic-visualiser.pro 2010-07-22 13:21:51 UTC (rev 1732) +++ sonic-visualiser/trunk/sonic-visualiser.pro 2010-08-05 11:02:24 UTC (rev 1733) @@ -4,5 +4,5 @@ SUBDIRS = audioio base data framework layer plugin transform rdf view widgets system sv CONFIG += ordered -TRANSLATIONS += i18n/sonic-visualiser_ru.ts i18n/sonic-visualiser_en_GB.ts i18n/sonic-visualiser_en_US.ts +TRANSLATIONS += i18n/sonic-visualiser_ru.ts i18n/sonic-visualiser_en_GB.ts i18n/sonic-visualiser_en_US.ts i18n/sonic-visualiser_cs_CZ.ts Added: sonic-visualiser/trunk/sv/i18n/sonic-visualiser_cs_CZ.qm =================================================================== (Binary files differ) Property changes on: sonic-visualiser/trunk/sv/i18n/sonic-visualiser_cs_CZ.qm ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: sonic-visualiser/trunk/sv/i18n/sonic-visualiser_cs_CZ.ts =================================================================== --- sonic-visualiser/trunk/sv/i18n/sonic-visualiser_cs_CZ.ts (rev 0) +++ sonic-visualiser/trunk/sv/i18n/sonic-visualiser_cs_CZ.ts 2010-08-05 11:02:24 UTC (rev 1733) @@ -0,0 +1,7909 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="cs_CZ"> +<context> + <name>ActivityLog</name> + <message> + <location filename="../../widgets/ActivityLog.cpp" line="30"/> + <source>Activity Log</source> + <translation>Zápis činnosti</translation> + </message> + <message> + <location filename="../../widgets/ActivityLog.cpp" line="35"/> + <source><p>Activity Log lists your interactions and other events within %1.</p></source> + <translation><p>Zápis činností uvádí vaši spolupráci a další události uvnitř %1.</p></translation> + </message> + <message> + <location filename="../../widgets/ActivityLog.cpp" line="63"/> + <source>%1: %2</source> + <translation>%1: %2</translation> + </message> +</context> +<context> + <name>AddLayerCommand</name> + <message> + <location filename="../../framework/Document.cpp" line="951"/> + <source>Add %1 Layer</source> + <translation>Přidat %1 vrstvu</translation> + </message> +</context> +<context> + <name>AggregateWaveModel</name> + <message> + <location filename="../../data/model/AggregateWaveModel.h" line="45"/> + <source>Aggregate Wave</source> + <translation>Úhrnná vlna</translation> + </message> +</context> +<context> + <name>AlignmentModel</name> + <message> + <location filename="../../data/model/AlignmentModel.h" line="47"/> + <source>Alignment</source> + <translation>Zarovnání</translation> + </message> +</context> +<context> + <name>AudioCallbackPlaySource</name> + <message> + <location filename="../../audioio/AudioCallbackPlaySource.cpp" line="447"/> + <source>Play from %1</source> + <translation>Přehrát od %1</translation> + </message> + <message> + <location filename="../../audioio/AudioCallbackPlaySource.cpp" line="462"/> + <source>Stop at %1</source> + <translation>Zastavit na %1</translation> + </message> + <message> + <location filename="../../audioio/AudioCallbackPlaySource.cpp" line="1040"/> + <source>Change time-stretch factor to %1</source> + <translation>Změnit násobek roztažení času na %1</translation> + </message> +</context> +<context> + <name>AudioDial</name> + <message> + <location filename="../../widgets/AudioDial.cpp" line="416"/> + <source>%1: %2%3</source> + <translation>%1: %2%3</translation> + </message> + <message> + <location filename="../../widgets/AudioDial.cpp" line="418"/> + <source>%2%3</source> + <translation>%2%3</translation> + </message> + <message> + <location filename="../../widgets/AudioDial.cpp" line="481"/> + <source>New value for %1, from %2 to %3 %4:</source> + <translation>Nová hodnota pro %1, od %2 do %3 %4:</translation> + </message> + <message> + <location filename="../../widgets/AudioDial.cpp" line="484"/> + <source>New value for %1, from %2 to %3:</source> + <translation>Nová hodnota pro %1, od %2 do %3:</translation> + </message> + <message> + <location filename="../../widgets/AudioDial.cpp" line="489"/> + <source>Enter a new value from %1 to %2 %3:</source> + <translation>Zadejte novou hodnotu od %1, do %2 %3:</translation> + </message> + <message> + <location filename="../../widgets/AudioDial.cpp" line="492"/> + <location filename="../../widgets/AudioDial.cpp" line="516"/> + <source>Enter a new value from %1 to %2:</source> + <translation>Zadejte novou hodnotu od %1 do %2:</translation> + </message> + <message> + <location filename="../../widgets/AudioDial.cpp" line="499"/> + <location filename="../../widgets/AudioDial.cpp" line="515"/> + <source>Enter new value</source> + <translation>Zadat novou hodnotu</translation> + </message> +</context> +<context> + <name>AudioTargetFactory</name> + <message> + <location filename="../../audioio/AudioTargetFactory.cpp" line="72"/> + <source>(auto)</source> + <translation>(auto)</translation> + </message> + <message> + <location filename="../../audioio/AudioTargetFactory.cpp" line="76"/> + <source>JACK Audio Connection Kit</source> + <translation>Spojovací sada pro zvuk JACK</translation> + </message> + <message> + <location filename="../../audioio/AudioTargetFactory.cpp" line="80"/> + <source>PulseAudio Server</source> + <translation>Server PulseAudio</translation> + </message> + <message> + <location filename="../../audioio/AudioTargetFactory.cpp" line="84"/> + <source>Core Audio Device</source> + <translation>Jaderné zvukové zařízení</translation> + </message> + <message> + <location filename="../../audioio/AudioTargetFactory.cpp" line="88"/> + <source>Default Soundcard Device</source> + <translation>Výchozí zařízení zvukové karty</translation> + </message> +</context> +<context> + <name>BZipFileDevice</name> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="49"/> + <source>File is already open</source> + <translation>Soubor je již otevřen</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="54"/> + <source>Append mode not supported</source> + <translation>Režim připojení není podporován</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="60"/> + <source>File access mode not specified</source> + <translation>Režim přístupu k souborům není zadán</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="66"/> + <source>Read and write modes both specified</source> + <translation>Režimy pro čtení a zápis jsou zadány</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="75"/> + <source>Failed to open file for writing</source> + <translation>Otevření souboru pro zápis se nezdařilo</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="86"/> + <source>Failed to open bzip2 stream for writing</source> + <translation>Otevření proudu bzip2 pro zápis se nezdařilo</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="102"/> + <source>Failed to open file for reading</source> + <translation>Otevření souboru pro čtení se nezdařilo</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="113"/> + <source>Failed to open bzip2 stream for reading</source> + <translation>Otevření proudu bzip2 pro čtení se nezdařilo</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="127"/> + <source>Internal error (open for neither read nor write)</source> + <translation>Vnitřní chyba (otevření ani pro čtení, ani pro zápis)</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="136"/> + <source>File not open</source> + <translation>Soubor neotevřen</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="148"/> + <source>bzip2 stream write close error</source> + <translation>Chyba závěru zápisu proudu bzip2</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="160"/> + <source>bzip2 stream read close error</source> + <translation>Chyba závěru čtení proudu bzip2</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="169"/> + <source>Internal error (close for neither read nor write)</source> + <translation>Vnitřní chyba (závěr ani pro čtení, ani pro zápis)</translation> + </message> + <message> + <location filename="../../data/fileio/BZipFileDevice.cpp" line="186"/> + <source>bzip2 stream read error</source> + <translation>Chyba čtení proudu bzip2</translation> + </message> +</context> +<context> + <name>BundleCommand</name> + <message numerus="yes"> + <location filename="../../base/Command.cpp" line="98"/> + <source>%1 (%n change(s))</source> + <translation> + <numerusform>%1 (jedna změna)</numerusform> + <numerusform>%1 (%n změny)</numerusform> + <numerusform>%1 (%n změn)</numerusform> + </translation> + </message> +</context> +<context> + <name>CSVFileWriter</name> + <message> + <location filename="../../data/fileio/CSVFileWriter.cpp" line="56"/> + <source>Failed to open file %1 for writing</source> + <translation>Otevření souboru %1 pro zápis se nezdařilo</translation> + </message> +</context> +<context> + <name>CSVFormatDialog</name> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="37"/> + <source>Select Data Format</source> + <translation>Vybrat datový formát</translation> + </message> + <message> + <source><b>Select Data Format</b><p>Please select the correct data format for this file.</source> + <translation type="obsolete"><b>Vybrat datový formát</b><p> Vyberte, prosím, správný datový formát pro tento soubor.</translation> + </message> + <message> + <source>Each row specifies:</source> + <translation type="obsolete">Každý řádek určuje:</translation> + </message> + <message> + <source>A point in time</source> + <translation type="obsolete">Bod v čase</translation> + </message> + <message> + <source>A value at a time</source> + <translation type="obsolete">Hodnotu v čase</translation> + </message> + <message> + <source>A set of values</source> + <translation type="obsolete">Soubor hodnot</translation> + </message> + <message> + <source>The first column contains:</source> + <translation type="obsolete">První sloupec obsahuje:</translation> + </message> + <message> + <source>Time, in seconds</source> + <translation type="obsolete">Čas, v sekundách</translation> + </message> + <message> + <source>Time, in audio sample frames</source> + <translation type="obsolete">Čas, ve snímcích vzorků zvuku</translation> + </message> + <message> + <source>Data (rows are consecutive in time)</source> + <translation type="obsolete">Data (řádky po sobě následují v čase)</translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="43"/> + <source>Please select the correct data format for this file.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="73"/> + <source><ignore></source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="74"/> + <source>Time</source> + <translation type="unfinished">Čas</translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="75"/> + <source>End time</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="76"/> + <source>Duration</source> + <translation type="unfinished">Doba trvání</translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="77"/> + <source>Value</source> + <translation type="unfinished">Hodnota</translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="78"/> + <source>Label</source> + <translation type="unfinished">Štítek</translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="99"/> + <source>Timing is specified:</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="102"/> + <source>Explicitly, in seconds</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="103"/> + <source>Explicitly, in audio sample frames</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="104"/> + <source>Implicitly: rows are equally spaced in time</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="112"/> + <source>Audio sample rate (Hz):</source> + <translation>Vzorkovací kmitočet zvuku (Hz):</translation> + </message> + <message> + <location filename="../../widgets/CSVFormatDialog.cpp" line="135"/> + <source>Frame increment between rows:</source> + <translation>Nárůst snímků mezi řádky:</translation> + </message> + <message> + <source> +Example data from file:</source> + <translation type="obsolete"> +Data s příkladem ze souboru:</translation> + </message> +</context> +<context> + <name>Colour3DPlotLayer</name> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="170"/> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="216"/> + <source>Colour</source> + <translation>Barva</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="171"/> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="211"/> + <source>Scale</source> + <translation>Stupnice</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="172"/> + <source>Normalize Columns</source> + <translation>Normalizovat sloupce</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="173"/> + <source>Normalize Visible Area</source> + <translation>Normalizovat viditelnou oblast</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="174"/> + <source>Invert Vertical Scale</source> + <translation>Obrátit svislou stupnici</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="175"/> + <source>Gain</source> + <translation>Zesílení signálu</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="176"/> + <source>Always Opaque</source> + <translation>Vždý neprůhledná</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="177"/> + <source>Smooth</source> + <translation>Jemná</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="178"/> + <source>Bin Scale</source> + <translation>Stupnice koše</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="213"/> + <source>Bins</source> + <translation>Koše</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="309"/> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="318"/> + <source>Linear</source> + <translation>Čárový</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="310"/> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="319"/> + <source>Log</source> + <translation>Zápis</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="311"/> + <source>+/-1</source> + <translation>+/-1</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="312"/> + <source>Absolute</source> + <translation>Naprostý</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="322"/> + <source><unknown></source> + <translation><neznámý></translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="329"/> + <source>dB</source> + <translation>dB</translation> + </message> + <message> + <location filename="../../layer/Colour3DPlotLayer.cpp" line="698"/> + <source>Time: %1 - %2 +Bin: %3 +Value: %4</source> + <translation>Čas: %1 - %2 +Koš: %3 +Hodnota: %4</translation> + </message> +</context> +<context> + <name>ColourMapper</name> + <message> + <location filename="../../layer/ColourMapper.cpp" line="48"/> + <location filename="../../layer/ColourMapper.cpp" line="66"/> + <source><unknown></source> + <translation><neznámý></translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="52"/> + <source>Default</source> + <translation>Výchozí</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="53"/> + <source>White on Black</source> + <translation>Bílá na černé</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="54"/> + <source>Black on White</source> + <translation>Černá na bílé</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="55"/> + <source>Red on Blue</source> + <translation>Červená na modré</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="56"/> + <source>Yellow on Black</source> + <translation>Žlutá na černé</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="57"/> + <source>Blue on Black</source> + <translation>Modrá na černé</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="58"/> + <source>Sunset</source> + <translation>Západ slunce</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="59"/> + <source>Fruit Salad</source> + <translation>Ovocný salát</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="60"/> + <source>Banded</source> + <translation>Pruhovaný</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="61"/> + <source>Highlight</source> + <translation>Zvýraznění</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="62"/> + <source>Printer</source> + <translation>Tiskárna</translation> + </message> + <message> + <location filename="../../layer/ColourMapper.cpp" line="63"/> + <source>High Gain</source> + <translation>Zesílení výšek</translation> + </message> +</context> +<context> + <name>CommandHistory</name> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="56"/> + <location filename="../../widgets/CommandHistory.cpp" line="61"/> + <location filename="../../widgets/CommandHistory.cpp" line="64"/> + <source>&Undo</source> + <translation>&Zpět</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="57"/> + <source>Ctrl+Z</source> + <translation>Ctrl+Z</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="58"/> + <source>Undo the last editing operation</source> + <translation>Poslední krok úprav vrátit zpět</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="69"/> + <location filename="../../widgets/CommandHistory.cpp" line="74"/> + <location filename="../../widgets/CommandHistory.cpp" line="77"/> + <source>Re&do</source> + <translation>&Znovu</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="70"/> + <source>Ctrl+Shift+Z</source> + <translation>Ctrl+Shift+Z</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="71"/> + <source>Redo the last operation that was undone</source> + <translation>Opakovat poslední krok úprav, který byl vrácen zpět</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="344"/> + <source>Undo %1</source> + <translation>Zpět %1</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="370"/> + <source>Redo %1</source> + <translation>Znovu %1</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="503"/> + <source>Nothing to undo</source> + <translation>Neexistuje nic, co by se dalo vrátit zpět</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="503"/> + <source>Nothing to redo</source> + <translation>Neexistuje nic, u čeho by šlo zrušit vrácení zpět</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="519"/> + <location filename="../../widgets/CommandHistory.cpp" line="541"/> + <source>&Undo %1</source> + <translation>&Zpět %1</translation> + </message> + <message> + <location filename="../../widgets/CommandHistory.cpp" line="519"/> + <location filename="../../widgets/CommandHistory.cpp" line="542"/> + <source>Re&do %1</source> + <translation>&Znovu %1</translation> + </message> +</context> +<context> + <name>Dense3DModelPeakCache</name> + <message> + <location filename="../../data/model/Dense3DModelPeakCache.h" line="86"/> + <source>Dense 3-D Peak Cache</source> + <translation>Vyrovnávací paměť hustého trojrozměrného vrcholu</translation> + </message> +</context> +<context> + <name>DenseThreeDimensionalModel</name> + <message> + <source>Dense 3-D</source> + <translation type="obsolete">Hustý trojrozměrný</translation> + </message> + <message> + <source>Time</source> + <translation type="obsolete">Čas</translation> + </message> + <message> + <source>Frame</source> + <translation type="obsolete">Snímek</translation> + </message> +</context> +<context> + <name>DenseTimeValueModel</name> + <message> + <source>Dense Time-Value</source> + <translation type="obsolete">Hustá hodnota času</translation> + </message> +</context> +<context> + <name>Document</name> + <message> + <location filename="../../framework/Document.cpp" line="269"/> + <source>Set main model to %1</source> + <translation>Nastavit hlavní model na %1</translation> + </message> + <message> + <location filename="../../framework/Document.cpp" line="271"/> + <source>Clear main model</source> + <translation>Smazat hlavní model</translation> + </message> +</context> +<context> + <name>EditableDenseThreeDimensionalModel</name> + <message> + <source>Editable Dense 3-D</source> + <translation type="obsolete">Upravovatelný hustý trojrozměrný</translation> + </message> +</context> +<context> + <name>FFTModel</name> + <message> + <location filename="../../data/model/FFTModel.h" line="187"/> + <source>FFT</source> + <translation>FFT</translation> + </message> + <message> + <location filename="../../data/model/FFTModel.cpp" line="203"/> + <source>%1 Hz</source> + <translation>%1 Hz</translation> + </message> +</context> +<context> + <name>Fader</name> + <message> + <location filename="../../widgets/Fader.cpp" line="141"/> + <source>Enter new fader level</source> + <translation>Zadat novou úroveň prolínače</translation> + </message> + <message> + <location filename="../../widgets/Fader.cpp" line="142"/> + <source>New fader level, from %1 to %2 dBFS:</source> + <translation>Nová úroveň prolínače, od %1 do %2 dBFS:</translation> + </message> + <message> + <location filename="../../widgets/Fader.cpp" line="217"/> + <source>Level: Off</source> + <translation>Úroveň: Vypnuto</translation> + </message> + <message> + <location filename="../../widgets/Fader.cpp" line="219"/> + <source>Level: %1%2.%3%4 dB</source> + <translation>Úroveň: %1%2.%3%4 dB</translation> + </message> +</context> +<context> + <name>FeatureExtractionModelTransformer</name> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="54"/> + <source>No factory available for feature extraction plugin id "%1" (unknown plugin type, or internal error?)</source> + <translation>Není dostupný žádný závod pro ID přídavného modulu vytažení funkce "%1" (neznámý typ přídavného modulu, nebo vnitřní chyba?)</translation> + </message> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="60"/> + <source>Input model for feature extraction plugin "%1" is of wrong type (internal error?)</source> + <translation>Vstupní model pro přídavný modul vytažení funkce "%1" je chybného typu (vnitřní chyba?)</translation> + </message> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="66"/> + <source>Failed to instantiate plugin "%1"</source> + <translation>Přídavný modul "%1" se nepodařilo doložit příkladem</translation> + </message> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="81"/> + <source>Cannot provide enough channels to feature extraction plugin "%1" (plugin min is %2, max %3; input model has %4)</source> + <translation>Nelze poskytnout dostatek kanálů pro přídavný modul vytažení funkce "%1" (minimum pro přídavný modul je %2, maximum pro přídavný modul je %3; vstupní model has %4)</translation> + </message> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="112"/> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="127"/> + <source>Failed to initialise feature extraction plugin "%1"</source> + <translation>Přídavný modul vytažení funkce se nepodařilo spustit "%1"</translation> + </message> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="117"/> + <source>Feature extraction plugin "%1" rejected the given step and block sizes (%2 and %3); using plugin defaults (%4 and %5) instead</source> + <translation>Přídavný modul vytažení funkce "%1" odmítl daný krok a velikosti bloků (%2 a %3); používají se výchozí nastavení přídavného modulu (%4 a %5)</translation> + </message> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="135"/> + <source>Transform was configured for version %1 of plugin "%2", but the plugin being used is version %3</source> + <translation>Proměna byla nastavena pro verzi %1 přídavného modulu "%2", ale používaný přídavný modul je ve verzi %3</translation> + </message> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="150"/> + <source>Plugin "%1" has no outputs</source> + <translation>Přídavný modul "%1" nemá žádné výstupy</translation> + </message> + <message> + <location filename="../../transform/FeatureExtractionModelTransformer.cpp" line="165"/> + <source>Plugin "%1" has no output named "%2"</source> + <translation>Přídavný modul "%1" nemá žádný výstup pojmenovaný jako "%2"</translation> + </message> +</context> +<context> + <name>FileSource</name> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="93"/> + <location filename="../../data/fileio/FileSource.cpp" line="171"/> + <location filename="../../data/fileio/FileSource.cpp" line="203"/> + <source>Unsupported scheme in URL</source> + <translation>Nepodporované schéma v adrese (URL)</translation> + </message> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="360"/> + <source>Downloading %1...</source> + <translation>Stahuje se %1...</translation> + </message> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="687"/> + <source>Failed to connect to FTP server</source> + <translation>Připojení k FTP serveru se nezdařilo</translation> + </message> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="689"/> + <source>Login failed</source> + <translation>Přihlášení se nezdařilo</translation> + </message> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="691"/> + <source>Failed to change to correct directory</source> + <translation>Změna na správný adresář se nepodařila</translation> + </message> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="693"/> + <source>FTP download aborted</source> + <translation>FTP stahování zrušeno</translation> + </message> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="713"/> + <source>Download cancelled</source> + <translation>Stahování zrušeno</translation> + </message> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="744"/> + <source>Failed to create local file %1</source> + <translation>Vytvoření místního souboru %1 se nezdařilo</translation> + </message> + <message> + <location filename="../../data/fileio/FileSource.cpp" line="747"/> + <source>File contains no data!</source> + <translation>Soubor neobsahuje žádné údaje!</translation> + </message> +</context> +<context> + <name>I</name> + <message> + <location filename="../../data/model/IntervalModel.h" line="103"/> + <source>Edit Data</source> + <translation>Upravit data</translation> + </message> +</context> +<context> + <name>ImageDialog</name> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="49"/> + <source>Image</source> + <translation>Obrázek</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="56"/> + <source>Label:</source> + <translation>Štítek:</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="63"/> + <source>File or URL:</source> + <translation>Soubor nebo adresa (URL):</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="73"/> + <source>Browse...</source> + <translation>Procházet...</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="79"/> + <source>Preview</source> + <translation>Náhled</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="187"/> + <source>Unsupported scheme in URL</source> + <translation>Nepodporované schéma v adrese (URL)</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="188"/> + <source>The URL scheme "%1" is not supported</source> + <translation>Schéma adresy (URL) "%1" není podporována</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="192"/> + <source>Opening image URL...</source> + <translation>Otevírá se adresa obrázku (URL)...</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="196"/> + <source>File download failed</source> + <translation>Stažení souboru se nezdařilo</translation> + </message> + <message> + <location filename="../../widgets/ImageDialog.cpp" line="197"/> + <source>Failed to download URL "%1": %2</source> + <translation>Nepodařilo se stáhnout adresu (URL) "%1": %2</translation> + </message> +</context> +<context> + <name>ImageLayer</name> + <message> + <location filename="../../layer/ImageLayer.cpp" line="182"/> + <source>In progress</source> + <translation>Probíhá</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="606"/> + <location filename="../../layer/ImageLayer.cpp" line="711"/> + <source>Select image</source> + <translation>Vybrat obrázek</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="678"/> + <source>Move Image</source> + <translation>Přesunout obrázek</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="735"/> + <source>Drag Selection</source> + <translation>Táhnout výběr</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="760"/> + <source>Resize Selection</source> + <translation>Změnit velikost výběru</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="794"/> + <source>Delete Selection</source> + <translation>Smazat výběr</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="837"/> + <source>Re-align pasted items?</source> + <translation>Zarovnat vložené položky znovu?</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="838"/> + <source>The items you are pasting came from a layer with different source material from this one. Do you want to re-align them in time, to match the source material for this layer?</source> + <translation>Položky, které vkládáte, přišly z vrstvy s odlišným zdrojovým materiálem, než má tento. Chcete je zarovnat znovu v čase, aby se hodily ke zdrojovému materiálu pro tuto vrstvu?</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="852"/> + <source>Paste</source> + <translation>Vložit</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="884"/> + <source>New Point</source> + <translation>Nový bod</translation> + </message> + <message> + <location filename="../../layer/ImageLayer.cpp" line="915"/> + <source>Opening image URL...</source> + <translation>Otevírá se adresa obrázku (URL)...</translation> + </message> +</context> +<context> + <name>ImageModel</name> + <message> + <location filename="../../data/model/ImageModel.h" line="96"/> + <location filename="../../data/model/ImageModel.h" line="154"/> + <source>Image</source> + <translation>Obrázek</translation> + </message> + <message> + <location filename="../../data/model/ImageModel.h" line="124"/> + <source>Edit Image</source> + <translation>Upravit obrázek</translation> + </message> + <message> + <location filename="../../data/model/ImageModel.h" line="152"/> + <source>Time</source> + <translation>Čas</translation> + </message> + <message> + <location filename="../../data/model/ImageModel.h" line="153"/> + <source>Frame</source> + <translation>Snímek</translation> + </message> + <message> + <location filename="../../data/model/ImageModel.h" line="155"/> + <source>Label</source> + <translation>Štítek</translation> + </message> + <message> + <location filename="../../data/model/ImageModel.h" line="156"/> + <source>Unknown</source> + <translation>Neznámý</translation> + </message> + <message> + <location filename="../../data/model/ImageModel.h" line="187"/> + <source>Edit Data</source> + <translation>Upravit data</translation> + </message> +</context> +<context> + <name>InteractiveFileFinder</name> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="52"/> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="192"/> + <source>Select file</source> + <translation>Vybrat soubor</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="53"/> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="193"/> + <source>All files (*.*)</source> + <translation>Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="59"/> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="199"/> + <source>Select a session file</source> + <translation>Vybrat soubor se sezením</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="60"/> + <source>Sonic Visualiser session files (*.sv) +RDF files (%1) +All files (*.*)</source> + <translation>Soubory se sezením programu Sonic Visualiser (*.sv) +Soubory RDF (%1) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="66"/> + <source>Audio files (%1) +All files (*.*)</source> + <translation>Zvukové soubory (%1) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="72"/> + <source>All supported files (%1 %2) +Sonic Visualiser Layer XML files (*.svl) +Comma-separated data files (*.csv) +Space-separated .lab files (*.lab) +RDF files (%2) +MIDI files (*.mid) +Text files (*.txt) +All files (*.*)</source> + <translation>Všechny podporované soubory (%1 %2) +Soubory XML Sonic Visualiser Layer (*.svl) +Čárkou oddělené datové soubory (*.csv) +Mezerou oddělené soubory .lab (*.lab) +Soubory RDF (%2) +Soubory MIDI (*.mid) +Textové soubory (*.txt) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="79"/> + <source>All supported files (%1 %2) +Sonic Visualiser Layer XML files (*.svl) +Comma-separated data files (*.csv) +Space-separated .lab files (*.lab) +RDF files (%2) +Text files (*.txt) +All files (*.*)</source> + <translation>Všechny podporované soubory (%1 %2) +Soubory XML Sonic Visualiser Layer (*.svl) +Čárkou oddělené datové soubory (*.csv) +Mezerou oddělené soubory .lab (*.lab) +Soubory RDF (%2) +Textové soubory (*.txt) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="86"/> + <source>All supported files (*.sv %1 %2) +Sonic Visualiser session files (*.sv) +Audio files (%2) +RDF files (%1) +All files (*.*)</source> + <translation>Všechny podporované soubory (%1 %2) +Soubory XML Sonic Visualiser Layer (*.svl) +Zvukové soubory (%2) +Soubory RDF (%1) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="101"/> + <source>Image files (%1) +All files (*.*)</source> + <translation>Obrázkové soubory (%1) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="107"/> + <source>All supported files (*.sv %1 %2 %3) +Sonic Visualiser session files (*.sv) +Audio files (%1) +Layer files (%2) +RDF files (%3) +All files (*.*)</source> + <translation>Všechny podporované soubory (*.sv %1 %2 %3) +Soubory XML Sonic Visualiser Layer (*.svl) +Zvukové soubory (%1) +Soubory Layer (%2) +Soubory RDF (%3) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="148"/> + <source>File does not exist</source> + <translation>Soubor neexistuje</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="149"/> + <source><b>File not found</b><p>File "%1" does not exist</source> + <translation><b>Soubor nenalezen</b><p>Soubor "%1" neexistuje</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="154"/> + <source>File is not readable</source> + <translation>Soubor není čitelný</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="155"/> + <source><b>File is not readable</b><p>File "%1" can not be read</source> + <translation><b>Soubor není čitelný</b><p>Soubor "%1" nelze přečíst</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="160"/> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="312"/> + <source>Directory selected</source> + <translation>Adresář vybrán</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="161"/> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="313"/> + <source><b>Directory selected</b><p>File "%1" is a directory</source> + <translation><b>Soubor vybrán</b><p>Soubor "%1" je adresář</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="166"/> + <source>Non-file selected</source> + <translation>Vybrán ne-soubor</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="167"/> + <source><b>Not a file</b><p>Path "%1" is not a file</source> + <translation><b>Není soubor</b><p>Cesta "%1" není soubor</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="172"/> + <source>File is empty</source> + <translation>Soubor je prázdný</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="173"/> + <source><b>File is empty</b><p>File "%1" is empty</source> + <translation><b>Soubor je prázdný</b><p>Soubor "%1" je prázdný</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="200"/> + <source>Sonic Visualiser session files (*.sv) +All files (*.*)</source> + <translation>Soubory se sezením programu Sonic Visualiser (*.sv) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="206"/> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="212"/> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="218"/> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="228"/> + <source>Select a file to export to</source> + <translation>Vybrat soubor, do kterého se má provést vyvedení</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="207"/> + <source>WAV audio files (*.wav) +All files (*.*)</source> + <translation>Zvukové soubory WAV (*.wav) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="213"/> + <source>Sonic Visualiser Layer XML files (*.svl) +Comma-separated data files (*.csv) +RDF/Turtle files (%1) +MIDI files (*.mid) +Text files (*.txt) +All files (*.*)</source> + <translation>Soubory XML Sonic Visualiser Layer (*.svl) +Čárkou oddělené datové soubory (*.csv) +Soubory RDF/Turtle (%1) +Soubory MIDI (*.mid) +Textové soubory (*.txt) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="219"/> + <source>Sonic Visualiser Layer XML files (*.svl) +Comma-separated data files (*.csv) +RDF/Turtle files (%1) +Text files (*.txt) +All files (*.*)</source> + <translation>Soubory XML Sonic Visualiser Layer (*.svl) +Čárkou oddělené datové soubory (*.csv) +Soubory RDF/Turtle (%1) +Textové soubory (*.txt) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="229"/> + <source>Portable Network Graphics files (*.png) +All files (*.*)</source> + <translation>Soubory PNG (Portable Network Graphics) (*.png) +Všechny soubory (*.*)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="318"/> + <source>File exists</source> + <translation>Soubor již existuje</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="319"/> + <source><b>File exists</b><p>The file "%1" already exists. +Do you want to overwrite it?</source> + <translation><b>Soubor existuje</b><p>Soubor "%1" již existuje. +Chcete jej přepsat?</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="451"/> + <source><b>File not found</b><p>Audio file "%1" could not be opened. +Do you want to locate it?</source> + <translation><b>Soubor nenalezen</b><p>Zvukový soubor "%1" se nepodařilo otevřít. +Chcete jej najít?</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="453"/> + <source><b>File not found</b><p>File "%1" could not be opened. +Do you want to locate it?</source> + <translation><b>Soubor nenalezen</b><p>Soubor "%1" se nepodařilo otevřít. +Chcete jej najít?</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="463"/> + <source>Failed to open file</source> + <translation>Soubor se nepodařilo otevřít</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="465"/> + <source>Locate file...</source> + <translation>Najít soubor...</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="466"/> + <source>Use URL...</source> + <translation>Použít adresu (URL)...</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="467"/> + <source>Cancel</source> + <translation>Zrušit</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="486"/> + <source>Use URL</source> + <translation>Použít adresu (URL)</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="487"/> + <source>Please enter the URL to use for this file:</source> + <translation>Zadejte, prosím, adresu (URL), která se má použít pro tento soubor:</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="495"/> + <source>Failed to open location</source> + <translation>Umístění se nepodařilo otevřít</translation> + </message> + <message> + <location filename="../../widgets/InteractiveFileFinder.cpp" line="496"/> + <source><b>Failed to open location</b><p>URL "%1" could not be opened</source> + <translation><b>Umístění se nepodařilo otevřít</b><p>Adresu (URL) "%1" se nepodařilo otevřít</translation> + </message> +</context> +<context> + <name>ItemEditDialog</name> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="58"/> + <source>Timing</source> + <translation>Načasování</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="69"/> + <source>Time:</source> + <translation>Čas:</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="73"/> + <location filename="../../widgets/ItemEditDialog.cpp" line="104"/> + <source> frames</source> + <translation> snímky</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="82"/> + <location filename="../../widgets/ItemEditDialog.cpp" line="113"/> + <source> sec</source> + <translation> sek</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="89"/> + <location filename="../../widgets/ItemEditDialog.cpp" line="120"/> + <source> usec</source> + <translation> usek</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="100"/> + <source>Duration:</source> + <translation>Doba trvání:</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="132"/> + <source>Properties</source> + <translation>Vlastnosti</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="145"/> + <source>Value:</source> + <translation>Hodnota:</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="161"/> + <source>Text:</source> + <translation>Text:</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="180"/> + <source>OK</source> + <translation>OK</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="181"/> + <source>Reset</source> + <translation>Nastavit znovu</translation> + </message> + <message> + <location filename="../../widgets/ItemEditDialog.cpp" line="182"/> + <source>Cancel</source> + <translation>Zrušit</translation> + </message> +</context> +<context> + <name>KeyReference</name> + <message> + <location filename="../../widgets/KeyReference.cpp" line="61"/> + <location filename="../../widgets/KeyReference.cpp" line="92"/> + <source>&</source> + <translation>&</translation> + </message> + <message> + <location filename="../../widgets/KeyReference.cpp" line="145"/> + <source><i>or</i>&nbsp;<b>%1</b></source> + <translation><i>nebo</i>&nbsp;<b>%1</b></translation> + </message> + <message> + <location filename="../../widgets/KeyReference.cpp" line="147"/> + <source></b>&nbsp;(%1)<b></source> + <translation></b>&nbsp;(%1)<b></translation> + </message> + <message> + <location filename="../../widgets/KeyReference.cpp" line="162"/> + <source>Sonic Visualiser: Key and Mouse Reference</source> + <translation>Sonic Visualiser: Odkaz na klávesy a myš</translation> + </message> +</context> +<context> + <name>LabelCounterInputDialog</name> + <message> + <location filename="../../widgets/LabelCounterInputDialog.cpp" line="29"/> + <source>Set Counters</source> + <translation>Nastavit počítadla</translation> + </message> + <message> + <location filename="../../widgets/LabelCounterInputDialog.cpp" line="33"/> + <source>Fine counter (beats):</source> + <translation>Citlivé počítadlo (doby):</translation> + </message> + <message> + <location filename="../../widgets/LabelCounterInputDialog.cpp" line="36"/> + <source>Coarse counter (bars):</source> + <translation>Hrubé počítadlo (doby):</translation> + </message> +</context> +<context> + <name>Labeller</name> + <message> + <location filename="../../data/model/Labeller.h" line="89"/> + <source>No numbering</source> + <translation>Žádné číslování</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="91"/> + <source>Simple counter</source> + <translation>Jednoduché počítadlo</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="93"/> + <source>Cyclical counter</source> + <translation>Cyklické počítadlo</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="95"/> + <source>Cyclical two-level counter (bar/beat)</source> + <translation>Cyklické dvouúrovňové počítadlo (takt/doba)</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="97"/> + <source>Audio sample frame number</source> + <translation>Číslo snímku zvukového vzorku</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="99"/> + <source>Time in seconds</source> + <translation>Čas v sekundách</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="101"/> + <source>Duration to the following item</source> + <translation>Doba trvání po následující položku</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="103"/> + <source>Tempo (bpm) based on duration to following item</source> + <translation>Tempo (počet úderů za minutu; úzm: bpm) založené na době trvání po následující položku</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="105"/> + <source>Duration since the previous item</source> + <translation>Doba trvání od předchozí položky</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="107"/> + <source>Tempo (bpm) based on duration since previous item</source> + <translation>Tempo (počet úderů za minutu; úzm: bpm) založené na době trvání od předchozí položky</translation> + </message> + <message> + <location filename="../../data/model/Labeller.h" line="109"/> + <source>Same as the nearest previous item</source> + <translation>Stejné jako nejbližš... [truncated message content] |
From: <ca...@us...> - 2010-07-22 13:21:58
|
Revision: 1732 http://sv1.svn.sourceforge.net/sv1/?rev=1732&view=rev Author: cannam Date: 2010-07-22 13:21:51 +0000 (Thu, 22 Jul 2010) Log Message: ----------- * Move sonic-annotator.spec to package/ Added Paths: ----------- sonic-annotator/trunk/package/ sonic-annotator/trunk/package/sonic-annotator.spec Removed Paths: ------------- sonic-annotator/trunk/sonic-annotator.spec Copied: sonic-annotator/trunk/package/sonic-annotator.spec (from rev 1724, sonic-annotator/trunk/sonic-annotator.spec) =================================================================== --- sonic-annotator/trunk/package/sonic-annotator.spec (rev 0) +++ sonic-annotator/trunk/package/sonic-annotator.spec 2010-07-22 13:21:51 UTC (rev 1732) @@ -0,0 +1,42 @@ +%define _topdir /home/cannam/rpm/sonic-annotator +%define name sonic-annotator +%define version 0.6 +%define release svn20100629 + +BuildRoot: %{_tmppath}/%{name}-buildroot +Summary: Sonic Annotator +License: GPL +Name: %{name} +Group: Sound +Version: %{version} +Release: %{release} + +%description +Sonic Annotator is a utility program for batch feature extraction +from audio files. It runs Vamp audio analysis plugins on audio files, +and can write the result features in a selection of formats including +CSV and RDF/Turtle. + +%prep +svn co http://sv1.svn.sourceforge.net/svnroot/sv1/sonic-annotator/trunk . +#%{name}-%{version}-%{release} + +%build +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig +#cd %{name}-%{version}-%{release} +/home/cannam/qt-4.6.2-static/bin/qmake -r "LIBS += -Wl,-Bstatic" "DEFINES += BUILD_STATIC" +make + +%install +#cd %{name}-%{version}-%{release} +mkdir -p $RPM_BUILD_ROOT/usr/bin +install runner/sonic-annotator $RPM_BUILD_ROOT/usr/bin + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%{_bindir}/sonic-annotator +%doc README COPYING CHANGELOG + Deleted: sonic-annotator/trunk/sonic-annotator.spec =================================================================== --- sonic-annotator/trunk/sonic-annotator.spec 2010-07-19 17:08:56 UTC (rev 1731) +++ sonic-annotator/trunk/sonic-annotator.spec 2010-07-22 13:21:51 UTC (rev 1732) @@ -1,42 +0,0 @@ -%define _topdir /home/cannam/rpm/sonic-annotator -%define name sonic-annotator -%define version 0.6 -%define release svn20100629 - -BuildRoot: %{_tmppath}/%{name}-buildroot -Summary: Sonic Annotator -License: GPL -Name: %{name} -Group: Sound -Version: %{version} -Release: %{release} - -%description -Sonic Annotator is a utility program for batch feature extraction -from audio files. It runs Vamp audio analysis plugins on audio files, -and can write the result features in a selection of formats including -CSV and RDF/Turtle. - -%prep -svn co http://sv1.svn.sourceforge.net/svnroot/sv1/sonic-annotator/trunk . -#%{name}-%{version}-%{release} - -%build -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig -#cd %{name}-%{version}-%{release} -/home/cannam/qt-4.6.2-static/bin/qmake -r "LIBS += -Wl,-Bstatic" "DEFINES += BUILD_STATIC" -make - -%install -#cd %{name}-%{version}-%{release} -mkdir -p $RPM_BUILD_ROOT/usr/bin -install runner/sonic-annotator $RPM_BUILD_ROOT/usr/bin - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%{_bindir}/sonic-annotator -%doc README COPYING CHANGELOG - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-07-19 17:09:03
|
Revision: 1731 http://sv1.svn.sourceforge.net/sv1/?rev=1731&view=rev Author: cannam Date: 2010-07-19 17:08:56 +0000 (Mon, 19 Jul 2010) Log Message: ----------- * Complete the overhaul of CSV file import; now you can pick the purpose for each column in the file, and SV should do the rest. The most significant practical improvement here is that we can now handle files in which time and duration do not necessarily appear in known columns. Modified Paths: -------------- sonic-visualiser/trunk/data/fileio/CSVFileReader.cpp sonic-visualiser/trunk/data/fileio/CSVFileReader.h sonic-visualiser/trunk/data/fileio/CSVFormat.cpp sonic-visualiser/trunk/data/fileio/CSVFormat.h sonic-visualiser/trunk/data/model/RegionModel.h sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp sonic-visualiser/trunk/widgets/CSVFormatDialog.h Modified: sonic-visualiser/trunk/data/fileio/CSVFileReader.cpp =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFileReader.cpp 2010-07-16 16:53:14 UTC (rev 1730) +++ sonic-visualiser/trunk/data/fileio/CSVFileReader.cpp 2010-07-19 17:08:56 UTC (rev 1731) @@ -17,6 +17,7 @@ #include "model/Model.h" #include "base/RealTime.h" +#include "base/StringBits.h" #include "model/SparseOneDimensionalModel.h" #include "model/SparseTimeValueModel.h" #include "model/EditableDenseThreeDimensionalModel.h" @@ -36,6 +37,7 @@ size_t mainModelSampleRate) : m_format(format), m_file(0), + m_warnings(0), m_mainModelSampleRate(mainModelSampleRate) { m_file = new QFile(path); @@ -78,28 +80,64 @@ return m_error; } +size_t +CSVFileReader::convertTimeValue(QString s, int lineno, size_t sampleRate, + size_t windowSize) const +{ + QRegExp nonNumericRx("[^0-9eE.,+-]"); + unsigned int warnLimit = 10; + + CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); + + size_t calculatedFrame = 0; + + bool ok = false; + QString numeric = s; + numeric.remove(nonNumericRx); + + if (timeUnits == CSVFormat::TimeSeconds) { + + double time = numeric.toDouble(&ok); + if (!ok) time = StringBits::stringToDoubleLocaleFree(numeric, &ok); + calculatedFrame = int(time * sampleRate + 0.5); + + } else { + + long n = numeric.toLong(&ok); + if (n >= 0) calculatedFrame = n; + + if (timeUnits == CSVFormat::TimeWindows) { + calculatedFrame *= windowSize; + } + } + + if (!ok) { + if (m_warnings < warnLimit) { + std::cerr << "WARNING: CSVFileReader::load: " + << "Bad time format (\"" << s.toStdString() + << "\") in data line " + << lineno+1 << std::endl; + } else if (m_warnings == warnLimit) { + std::cerr << "WARNING: Too many warnings" << std::endl; + } + ++m_warnings; + } + + return calculatedFrame; +} + Model * CSVFileReader::load() const { if (!m_file) return 0; -/*!!! - CSVFormatDialog *dialog = new CSVFormatDialog - (0, m_file, m_mainModelSampleRate); - if (dialog->exec() == QDialog::Rejected) { - delete dialog; - throw DataFileReaderFactory::ImportCancelled; - } -*/ - CSVFormat::ModelType modelType = m_format.getModelType(); CSVFormat::TimingType timingType = m_format.getTimingType(); - CSVFormat::DurationType durationType = m_format.getDurationType(); CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); - QString separator = m_format.getSeparator(); - QString::SplitBehavior behaviour = m_format.getSplitBehaviour(); size_t sampleRate = m_format.getSampleRate(); size_t windowSize = m_format.getWindowSize(); + QChar separator = m_format.getSeparator(); + bool allowQuoting = m_format.getAllowQuoting(); if (timingType == CSVFormat::ExplicitTiming) { if (modelType == CSVFormat::ThreeDimensionalModel) { @@ -131,11 +169,16 @@ size_t frameNo = 0; size_t duration = 0; + size_t endFrame = 0; + + bool haveAnyValue = false; + bool haveEndTime = false; + size_t startFrame = 0; // for calculation of dense model resolution + bool firstEverValue = true; - std::map<QString, float> labelValueMap; - float syntheticMax = 0.f; - + std::map<QString, int> labelCountMap; + while (!in.atEnd()) { // QTextStream's readLine doesn't cope with old-style Mac @@ -158,8 +201,7 @@ if (line.startsWith("#")) continue; - QStringList list = line.split(separator, behaviour); - + QStringList list = StringBits::split(line, separator, allowQuoting); if (!model) { switch (modelType) { @@ -190,152 +232,94 @@ } } - QStringList tidyList; - QRegExp nonNumericRx("[^0-9eE.,+-]"); - float value = 0.f; + QString label = ""; + duration = 0.f; + haveEndTime = false; + for (int i = 0; i < list.size(); ++i) { - - QString s(list[i].trimmed()); - if (s.length() >= 2 && s.startsWith("\"") && s.endsWith("\"")) { - s = s.mid(1, s.length() - 2); - } else if (s.length() >= 2 && s.startsWith("'") && s.endsWith("'")) { - s = s.mid(1, s.length() - 2); - } + QString s = list[i]; - if (timingType == CSVFormat::ExplicitTiming) { + CSVFormat::ColumnPurpose purpose = m_format.getColumnPurpose(i); - size_t calculatedFrame = 0; + switch (purpose) { - if (i == 0 || - (i == 1 && - modelType == CSVFormat::TwoDimensionalModelWithDuration)) { + case CSVFormat::ColumnUnknown: + break; - bool ok = false; - QString numeric = s; - numeric.remove(nonNumericRx); + case CSVFormat::ColumnStartTime: + frameNo = convertTimeValue(s, lineno, sampleRate, windowSize); + break; + + case CSVFormat::ColumnEndTime: + endFrame = convertTimeValue(s, lineno, sampleRate, windowSize); + haveEndTime = true; + break; - if (timeUnits == CSVFormat::TimeSeconds) { + case CSVFormat::ColumnDuration: + duration = convertTimeValue(s, lineno, sampleRate, windowSize); + break; - double time = numeric.toDouble(&ok); - calculatedFrame = int(time * sampleRate + 0.5); + case CSVFormat::ColumnValue: + value = s.toFloat(); + haveAnyValue = true; + break; - } else { - - calculatedFrame = numeric.toInt(&ok); - - if (timeUnits == CSVFormat::TimeWindows) { - calculatedFrame *= windowSize; - } - } - - if (!ok) { - if (warnings < warnLimit) { - std::cerr << "WARNING: CSVFileReader::load: " - << "Bad time format (\"" << s.toStdString() - << "\") in data line " - << lineno+1 << ":" << std::endl; - std::cerr << line.toStdString() << std::endl; - } else if (warnings == warnLimit) { - std::cerr << "WARNING: Too many warnings" << std::endl; - } - ++warnings; - } - - if (i == 0) frameNo = calculatedFrame; - else { - if (durationType == CSVFormat::EndTimes) { - duration = calculatedFrame - frameNo; - } else { - duration = calculatedFrame; - } - } - - continue; - } + case CSVFormat::ColumnLabel: + label = s; + ++labelCountMap[label]; + break; } + } - if ((i == 1 && - modelType == CSVFormat::TwoDimensionalModel) || - (i == 2 && - modelType == CSVFormat::TwoDimensionalModelWithDuration)) { - bool ok = false; - value = s.toFloat(&ok); - if (!ok) { - // cf. RDFImporter::fillModel - if (labelValueMap.find(s) == labelValueMap.end()) { - syntheticMax = syntheticMax + 1.f; - labelValueMap[s] = syntheticMax; - } - value = labelValueMap[s]; - } else { - if (value > syntheticMax) syntheticMax = value; - } - if (i + 1 == list.size()) { - // keep text around for use as label (none other given) - tidyList.push_back(s); - } - continue; + if (haveEndTime) { // ... calculate duration now all cols read + if (endFrame > frameNo) { + duration = endFrame - frameNo; } - - tidyList.push_back(s); } if (modelType == CSVFormat::OneDimensionalModel) { - SparseOneDimensionalModel::Point point - (frameNo, - tidyList.size() > 0 ? tidyList[tidyList.size()-1] : - QString("%1").arg(lineno+1)); - + SparseOneDimensionalModel::Point point(frameNo, label); model1->addPoint(point); } else if (modelType == CSVFormat::TwoDimensionalModel) { - SparseTimeValueModel::Point point - (frameNo, - value, - tidyList.size() > 0 ? tidyList[0] : QString("%1").arg(lineno+1)); - + SparseTimeValueModel::Point point(frameNo, value, label); model2->addPoint(point); } else if (modelType == CSVFormat::TwoDimensionalModelWithDuration) { - RegionModel::Point point - (frameNo, - value, - duration, - tidyList.size() > 0 ? tidyList[0] : QString("%1").arg(lineno+1)); - + RegionModel::Point point(frameNo, value, duration, label); model2a->addPoint(point); } else if (modelType == CSVFormat::ThreeDimensionalModel) { DenseThreeDimensionalModel::Column values; - for (int i = 0; i < tidyList.size(); ++i) { + for (int i = 0; i < list.size(); ++i) { bool ok = false; float value = list[i].toFloat(&ok); - if (i > 0 || timingType != CSVFormat::ExplicitTiming) { + if (m_format.getColumnPurpose(i) == CSVFormat::ColumnValue) { values.push_back(value); } - bool firstEver = (lineno == 0 && i == 0); + if (firstEverValue || value < min) min = value; + if (firstEverValue || value > max) max = value; - if (firstEver || value < min) min = value; - if (firstEver || value > max) max = value; - - if (firstEver) { + if (firstEverValue) { startFrame = frameNo; model3->setStartFrame(startFrame); } else if (lineno == 1 && timingType == CSVFormat::ExplicitTiming) { model3->setResolution(frameNo - startFrame); } + + firstEverValue = false; if (!ok) { if (warnings < warnLimit) { @@ -366,6 +350,47 @@ } } + if (!haveAnyValue) { + if (model2a) { + // assign values for regions based on label frequency; we + // have this in our labelCountMap, sort of + + std::map<int, std::map<QString, float> > countLabelValueMap; + for (std::map<QString, int>::iterator i = labelCountMap.begin(); + i != labelCountMap.end(); ++i) { + countLabelValueMap[i->second][i->first] = 0.f; + } + + float v = 0.f; + for (std::map<int, std::map<QString, float> >::iterator i = + countLabelValueMap.end(); i != countLabelValueMap.begin(); ) { + --i; + for (std::map<QString, float>::iterator j = i->second.begin(); + j != i->second.end(); ++j) { + j->second = v; + v = v + 1.f; + } + } + + std::map<RegionModel::Point, RegionModel::Point, + RegionModel::Point::Comparator> pointMap; + for (RegionModel::PointList::const_iterator i = + model2a->getPoints().begin(); + i != model2a->getPoints().end(); ++i) { + RegionModel::Point p(*i); + v = countLabelValueMap[labelCountMap[p.label]][p.label]; + RegionModel::Point pp(p.frame, v, p.duration, p.label); + pointMap[p] = pp; + } + + for (std::map<RegionModel::Point, RegionModel::Point>::iterator i = + pointMap.begin(); i != pointMap.end(); ++i) { + model2a->deletePoint(i->first); + model2a->addPoint(i->second); + } + } + } + if (modelType == CSVFormat::ThreeDimensionalModel) { model3->setMinimumLevel(min); model3->setMaximumLevel(max); Modified: sonic-visualiser/trunk/data/fileio/CSVFileReader.h =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFileReader.h 2010-07-16 16:53:14 UTC (rev 1730) +++ sonic-visualiser/trunk/data/fileio/CSVFileReader.h 2010-07-19 17:08:56 UTC (rev 1731) @@ -39,7 +39,11 @@ CSVFormat m_format; QFile *m_file; QString m_error; + mutable int m_warnings; size_t m_mainModelSampleRate; + + size_t convertTimeValue(QString, int lineno, size_t sampleRate, + size_t windowSize) const; }; Modified: sonic-visualiser/trunk/data/fileio/CSVFormat.cpp =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFormat.cpp 2010-07-16 16:53:14 UTC (rev 1730) +++ sonic-visualiser/trunk/data/fileio/CSVFormat.cpp 2010-07-19 17:08:56 UTC (rev 1731) @@ -39,9 +39,7 @@ { m_modelType = TwoDimensionalModel; m_timingType = ExplicitTiming; - m_durationType = Durations; m_timeUnits = TimeSeconds; - m_behaviour = QString::KeepEmptyParts; m_maxExampleCols = 0; m_columnCount = 0; @@ -186,10 +184,6 @@ void CSVFormat::guessPurposes() { - while (m_columnPurposes.size() <= m_columnCount) { - m_columnPurposes.push_back(ColumnUnknown); - } - m_timingType = CSVFormat::ImplicitTiming; m_timeUnits = CSVFormat::TimeWindows; @@ -229,7 +223,6 @@ if (timingColumnCount == 2 && m_timingType == ExplicitTiming) { purpose = ColumnEndTime; - m_durationType = EndTimes; } } } @@ -242,7 +235,7 @@ } } - m_columnPurposes[i] = purpose; + setColumnPurpose(i, purpose); } int valueCount = 0; @@ -281,12 +274,16 @@ } } - if (valueCount == 0) { - m_modelType = OneDimensionalModel; - } else if (valueCount == 1) { - m_modelType = TwoDimensionalModel; + if (timingColumnCount > 1) { + m_modelType = TwoDimensionalModelWithDuration; } else { - m_modelType = ThreeDimensionalModel; + if (valueCount == 0) { + m_modelType = OneDimensionalModel; + } else if (valueCount == 1) { + m_modelType = TwoDimensionalModel; + } else { + m_modelType = ThreeDimensionalModel; + } } std::cerr << "Estimated column purposes: "; @@ -297,8 +294,33 @@ std::cerr << "Estimated model type: " << m_modelType << std::endl; std::cerr << "Estimated timing type: " << m_timingType << std::endl; - std::cerr << "Estimated duration type: " << m_durationType << std::endl; std::cerr << "Estimated units: " << m_timeUnits << std::endl; } +CSVFormat::ColumnPurpose +CSVFormat::getColumnPurpose(int i) +{ + while (m_columnPurposes.size() <= i) { + m_columnPurposes.push_back(ColumnUnknown); + } + return m_columnPurposes[i]; +} +CSVFormat::ColumnPurpose +CSVFormat::getColumnPurpose(int i) const +{ + return m_columnPurposes[i]; +} + +void +CSVFormat::setColumnPurpose(int i, ColumnPurpose p) +{ + while (m_columnPurposes.size() <= i) { + m_columnPurposes.push_back(ColumnUnknown); + } + m_columnPurposes[i] = p; +} + + + + Modified: sonic-visualiser/trunk/data/fileio/CSVFormat.h =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFormat.h 2010-07-16 16:53:14 UTC (rev 1730) +++ sonic-visualiser/trunk/data/fileio/CSVFormat.h 2010-07-19 17:08:56 UTC (rev 1731) @@ -34,11 +34,6 @@ ImplicitTiming }; - enum DurationType { - Durations, - EndTimes - }; - enum TimeUnits { TimeSeconds, TimeAudioFrames, @@ -65,14 +60,12 @@ CSVFormat() : // arbitrary defaults m_modelType(TwoDimensionalModel), m_timingType(ExplicitTiming), - m_durationType(Durations), m_timeUnits(TimeSeconds), m_separator(","), m_sampleRate(44100), m_windowSize(1024), m_columnCount(0), m_variableColumnCount(false), - m_behaviour(QString::KeepEmptyParts), m_allowQuoting(true), m_maxExampleCols(0) { } @@ -90,43 +83,42 @@ ModelType getModelType() const { return m_modelType; } TimingType getTimingType() const { return m_timingType; } - DurationType getDurationType() const { return m_durationType; } TimeUnits getTimeUnits() const { return m_timeUnits; } - QString getSeparator() const { return m_separator; } size_t getSampleRate() const { return m_sampleRate; } size_t getWindowSize() const { return m_windowSize; } int getColumnCount() const { return m_columnCount; } - - QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; } - QList<ColumnPurpose> getColumnPurposes() const { return m_columnPurposes; } + bool getAllowQuoting() const { return m_allowQuoting; } + QChar getSeparator() const { + if (m_separator == "") return ' '; + else return m_separator[0]; + } - ColumnPurpose getColumnPurpose(int i) { return m_columnPurposes[i]; } - void setModelType(ModelType t) { m_modelType = t; } void setTimingType(TimingType t) { m_timingType = t; } - void setDurationType(DurationType t) { m_durationType = t; } void setTimeUnits(TimeUnits t) { m_timeUnits = t; } - void setSeparator(QString s) { m_separator = s; } + void setSeparator(QChar s) { m_separator = s; } void setSampleRate(size_t r) { m_sampleRate = r; } void setWindowSize(size_t s) { m_windowSize = s; } void setColumnCount(int c) { m_columnCount = c; } + void setAllowQuoting(bool q) { m_allowQuoting = q; } - void setSplitBehaviour(QString::SplitBehavior b) { m_behaviour = b; } + QList<ColumnPurpose> getColumnPurposes() const { return m_columnPurposes; } void setColumnPurposes(QList<ColumnPurpose> cl) { m_columnPurposes = cl; } - - void setColumnPurpose(int i, ColumnPurpose p) { m_columnPurposes[i] = p; } + ColumnPurpose getColumnPurpose(int i); + ColumnPurpose getColumnPurpose(int i) const; + void setColumnPurpose(int i, ColumnPurpose p); + // read-only; only valid if format has been guessed: QList<ColumnQualities> getColumnQualities() const { return m_columnQualities; } // read-only; only valid if format has been guessed: QList<QStringList> getExample() const { return m_example; } int getMaxExampleCols() const { return m_maxExampleCols; } - + protected: ModelType m_modelType; TimingType m_timingType; - DurationType m_durationType; TimeUnits m_timeUnits; QString m_separator; size_t m_sampleRate; @@ -140,7 +132,6 @@ QList<float> m_prevValues; - QString::SplitBehavior m_behaviour; bool m_allowQuoting; QList<QStringList> m_example; Modified: sonic-visualiser/trunk/data/model/RegionModel.h =================================================================== --- sonic-visualiser/trunk/data/model/RegionModel.h 2010-07-16 16:53:14 UTC (rev 1730) +++ sonic-visualiser/trunk/data/model/RegionModel.h 2010-07-19 17:08:56 UTC (rev 1731) @@ -36,6 +36,7 @@ struct RegionRec { public: + RegionRec() : frame(0), value(0.f), duration(0) { } RegionRec(long _frame) : frame(_frame), value(0.0f), duration(0) { } RegionRec(long _frame, float _value, size_t _duration, QString _label) : frame(_frame), value(_value), duration(_duration), label(_label) { } Modified: sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp =================================================================== --- sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp 2010-07-16 16:53:14 UTC (rev 1730) +++ sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp 2010-07-19 17:08:56 UTC (rev 1731) @@ -15,6 +15,8 @@ #include "CSVFormatDialog.h" +#include "layer/LayerFactory.h" + #include <QFrame> #include <QGridLayout> #include <QPushButton> @@ -45,6 +47,7 @@ exampleFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); exampleFrame->setLineWidth(2); QGridLayout *exampleLayout = new QGridLayout; + exampleLayout->setSpacing(4); exampleFrame->setLayout(exampleLayout); QPalette palette = exampleFrame->palette(); @@ -52,9 +55,10 @@ exampleFrame->setPalette(palette); QFont fp; - fp.setFixedPitch(true); - fp.setStyleHint(QFont::TypeWriter); - fp.setFamily("Monospaced"); + fp.setPointSize(fp.pointSize() * 0.9); +// fp.setFixedPitch(true); +// fp.setStyleHint(QFont::TypeWriter); +// fp.setFamily("Monospaced"); int columns = format.getColumnCount(); QList<QStringList> example = m_format.getExample(); @@ -82,6 +86,7 @@ label->setText(example[j][i]); label->setFont(fp); label->setPalette(palette); + label->setIndent(8); exampleLayout->addWidget(label, j+1, i); } } @@ -91,18 +96,6 @@ layout->setColumnStretch(3, 10); layout->setRowStretch(row++, 10); - layout->addWidget(new QLabel(tr("Each row describes:")), row, 0); - - m_modelTypeCombo = new QComboBox; - m_modelTypeCombo->addItem(tr("A point in time")); - m_modelTypeCombo->addItem(tr("A value at a time")); - m_modelTypeCombo->addItem(tr("A value across a time range")); - m_modelTypeCombo->addItem(tr("A set of values")); - layout->addWidget(m_modelTypeCombo, row++, 1, 1, 2); - connect(m_modelTypeCombo, SIGNAL(activated(int)), - this, SLOT(modelTypeChanged(int))); - m_modelTypeCombo->setCurrentIndex(int(m_format.getModelType())); - layout->addWidget(new QLabel(tr("Timing is specified:")), row, 0); m_timingTypeCombo = new QComboBox; @@ -158,6 +151,12 @@ connect(m_windowSizeCombo, SIGNAL(editTextChanged(QString)), this, SLOT(windowSizeChanged(QString))); + m_modelLabel = new QLabel; + QFont f(m_modelLabel->font()); + f.setItalic(true); + m_modelLabel->setFont(f); + layout->addWidget(m_modelLabel, row++, 0, 1, 4); + QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); layout->addWidget(bb, row++, 0, 1, 4); @@ -166,8 +165,8 @@ setLayout(layout); - modelTypeChanged(m_modelTypeCombo->currentIndex()); timingTypeChanged(m_timingTypeCombo->currentIndex()); + updateModelLabel(); } CSVFormatDialog::~CSVFormatDialog() @@ -181,9 +180,27 @@ } void -CSVFormatDialog::modelTypeChanged(int type) +CSVFormatDialog::updateModelLabel() { - m_format.setModelType((CSVFormat::ModelType)type); + LayerFactory *f = LayerFactory::getInstance(); + + QString s; + switch (m_format.getModelType()) { + case CSVFormat::OneDimensionalModel: + s = f->getLayerPresentationName(LayerFactory::TimeInstants); + break; + case CSVFormat::TwoDimensionalModel: + s = f->getLayerPresentationName(LayerFactory::TimeValues); + break; + case CSVFormat::TwoDimensionalModelWithDuration: + s = f->getLayerPresentationName(LayerFactory::Regions); + break; + case CSVFormat::ThreeDimensionalModel: + s = f->getLayerPresentationName(LayerFactory::Colour3DPlot); + break; + } + + m_modelLabel->setText("\n" + QString("Data will be displayed in a %1 layer.").arg(s)); } void @@ -237,23 +254,87 @@ } void -CSVFormatDialog::columnPurposeChanged(int purpose) +CSVFormatDialog::columnPurposeChanged(int p) { QObject *o = sender(); + QComboBox *cb = qobject_cast<QComboBox *>(o); if (!cb) return; - int changedCol = -1; + + CSVFormat::ColumnPurpose purpose = (CSVFormat::ColumnPurpose)p; + + bool haveStartTime = false; + bool haveDuration = false; + int valueCount = 0; + for (int i = 0; i < m_columnPurposeCombos.size(); ++i) { - if (cb == m_columnPurposeCombos[i]) { - changedCol = i; - break; + + CSVFormat::ColumnPurpose cp = m_format.getColumnPurpose(i); + + bool thisChanged = (cb == m_columnPurposeCombos[i]); + + if (thisChanged) { + + cp = purpose; + + } else { + + // We can only have one ColumnStartTime column, and only + // one of either ColumnDuration or ColumnEndTime + + if (purpose == CSVFormat::ColumnStartTime) { + if (cp == purpose) { + cp = CSVFormat::ColumnValue; + } + } else if (purpose == CSVFormat::ColumnDuration || + purpose == CSVFormat::ColumnEndTime) { + if (cp == CSVFormat::ColumnDuration || + cp == CSVFormat::ColumnEndTime) { + cp = CSVFormat::ColumnValue; + } + } + + // And we can only have one label + if (purpose == CSVFormat::ColumnLabel) { + if (cp == purpose) { + cp = CSVFormat::ColumnUnknown; + } + } } + + if (cp == CSVFormat::ColumnStartTime) { + haveStartTime = true; + } + if (cp == CSVFormat::ColumnEndTime || + cp == CSVFormat::ColumnDuration) { + haveDuration = true; + } + if (cp == CSVFormat::ColumnValue) { + ++valueCount; + } + + m_columnPurposeCombos[i]->setCurrentIndex(int(cp)); + m_format.setColumnPurpose(i, cp); } - if (changedCol < 0) { - std::cerr << "Hm, some problem here -- column combo changed, but cannot locate column" << std::endl; - return; + + if (!haveStartTime) { + m_timingTypeCombo->setCurrentIndex(2); + timingTypeChanged(2); } - + + if (haveStartTime && haveDuration) { + m_format.setModelType(CSVFormat::TwoDimensionalModelWithDuration); + } else { + if (valueCount > 1) { + m_format.setModelType(CSVFormat::ThreeDimensionalModel); + } else if (valueCount > 0) { + m_format.setModelType(CSVFormat::TwoDimensionalModel); + } else { + m_format.setModelType(CSVFormat::OneDimensionalModel); + } + } + + updateModelLabel(); } Modified: sonic-visualiser/trunk/widgets/CSVFormatDialog.h =================================================================== --- sonic-visualiser/trunk/widgets/CSVFormatDialog.h 2010-07-16 16:53:14 UTC (rev 1730) +++ sonic-visualiser/trunk/widgets/CSVFormatDialog.h 2010-07-19 17:08:56 UTC (rev 1731) @@ -35,21 +35,21 @@ CSVFormat getFormat() const; protected slots: - void modelTypeChanged(int type); void timingTypeChanged(int type); void sampleRateChanged(QString); void windowSizeChanged(QString); void columnPurposeChanged(int purpose); + void updateModelLabel(); protected: CSVFormat m_format; - QComboBox *m_modelTypeCombo; QComboBox *m_timingTypeCombo; QLabel *m_sampleRateLabel; QComboBox *m_sampleRateCombo; QLabel *m_windowSizeLabel; QComboBox *m_windowSizeCombo; + QLabel *m_modelLabel; QList<QComboBox *> m_columnPurposeCombos; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-07-16 16:53:20
|
Revision: 1730 http://sv1.svn.sourceforge.net/sv1/?rev=1730&view=rev Author: cannam Date: 2010-07-16 16:53:14 +0000 (Fri, 16 Jul 2010) Log Message: ----------- * Patch from Dan Stowell to provide shortcuts to add layers (additionally to the existing ones to add panes) Modified Paths: -------------- sonic-visualiser/trunk/sv/main/MainWindow.cpp Modified: sonic-visualiser/trunk/sv/main/MainWindow.cpp =================================================================== --- sonic-visualiser/trunk/sv/main/MainWindow.cpp 2010-07-16 16:51:39 UTC (rev 1729) +++ sonic-visualiser/trunk/sv/main/MainWindow.cpp 2010-07-16 16:53:14 UTC (rev 1730) @@ -1013,6 +1013,7 @@ shortcutText = tr("W"); tipText = tr("Add a new pane showing a waveform view"); } else { + shortcutText = tr("Shift+W"); tipText = tr("Add a new layer showing a waveform view"); } mono = false; @@ -1025,6 +1026,7 @@ shortcutText = tr("G"); tipText = tr("Add a new pane showing a spectrogram"); } else { + shortcutText = tr("Shift+G"); tipText = tr("Add a new layer showing a spectrogram"); } break; @@ -1036,6 +1038,7 @@ shortcutText = tr("M"); tipText = tr("Add a new pane showing a spectrogram set up for an overview of note pitches"); } else { + shortcutText = tr("Shift+M"); tipText = tr("Add a new layer showing a spectrogram set up for an overview of note pitches"); } break; @@ -1047,6 +1050,7 @@ shortcutText = tr("K"); tipText = tr("Add a new pane showing a spectrogram set up for tracking frequencies"); } else { + shortcutText = tr("Shift+K"); tipText = tr("Add a new layer showing a spectrogram set up for tracking frequencies"); } break; @@ -1058,6 +1062,7 @@ shortcutText = tr("U"); tipText = tr("Add a new pane showing a frequency spectrum"); } else { + shortcutText = tr("Shift+U"); tipText = tr("Add a new layer showing a frequency spectrum"); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-07-16 16:51:48
|
Revision: 1729 http://sv1.svn.sourceforge.net/sv1/?rev=1729&view=rev Author: cannam Date: 2010-07-16 16:51:39 +0000 (Fri, 16 Jul 2010) Log Message: ----------- * Start revamping the CSV import dialog so as to show a "purpose" for each column. These are estimated from the file now, but changing them does not actually do anything yet. Modified Paths: -------------- sonic-visualiser/trunk/data/fileio/CSVFormat.cpp sonic-visualiser/trunk/data/fileio/CSVFormat.h sonic-visualiser/trunk/framework/MainWindowBase.cpp sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp sonic-visualiser/trunk/widgets/CSVFormatDialog.h Modified: sonic-visualiser/trunk/data/fileio/CSVFormat.cpp =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFormat.cpp 2010-07-15 15:27:21 UTC (rev 1728) +++ sonic-visualiser/trunk/data/fileio/CSVFormat.cpp 2010-07-16 16:51:39 UTC (rev 1729) @@ -250,6 +250,37 @@ if (m_columnPurposes[i] == ColumnValue) ++valueCount; } + if (valueCount == 2 && timingColumnCount == 1) { + // If we have exactly two apparent value columns and only one + // timing column, but one value column is integral and the + // other is not, guess that whichever one matches the integral + // status of the time column is either duration or end time + if (m_timingType == ExplicitTiming) { + int a = -1, b = -1; + for (int i = 0; i < m_columnCount; ++i) { + if (m_columnPurposes[i] == ColumnValue) { + if (a == -1) a = i; + else b = i; + } + } + if ((m_columnQualities[a] & ColumnIntegral) != + (m_columnQualities[b] & ColumnIntegral)) { + int timecol = a; + if ((m_columnQualities[a] & ColumnIntegral) != + (m_columnQualities[0] & ColumnIntegral)) { + timecol = b; + } + if (m_columnQualities[timecol] & ColumnIncreasing) { + // This shouldn't happen; should have been settled above + m_columnPurposes[timecol] = ColumnEndTime; + } else { + m_columnPurposes[timecol] = ColumnDuration; + } + --valueCount; + } + } + } + if (valueCount == 0) { m_modelType = OneDimensionalModel; } else if (valueCount == 1) { Modified: sonic-visualiser/trunk/data/fileio/CSVFormat.h =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFormat.h 2010-07-15 15:27:21 UTC (rev 1728) +++ sonic-visualiser/trunk/data/fileio/CSVFormat.h 2010-07-16 16:51:39 UTC (rev 1729) @@ -95,9 +95,12 @@ QString getSeparator() const { return m_separator; } size_t getSampleRate() const { return m_sampleRate; } size_t getWindowSize() const { return m_windowSize; } + int getColumnCount() const { return m_columnCount; } QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; } QList<ColumnPurpose> getColumnPurposes() const { return m_columnPurposes; } + + ColumnPurpose getColumnPurpose(int i) { return m_columnPurposes[i]; } void setModelType(ModelType t) { m_modelType = t; } void setTimingType(TimingType t) { m_timingType = t; } @@ -106,10 +109,13 @@ void setSeparator(QString s) { m_separator = s; } void setSampleRate(size_t r) { m_sampleRate = r; } void setWindowSize(size_t s) { m_windowSize = s; } + void setColumnCount(int c) { m_columnCount = c; } void setSplitBehaviour(QString::SplitBehavior b) { m_behaviour = b; } void setColumnPurposes(QList<ColumnPurpose> cl) { m_columnPurposes = cl; } + void setColumnPurpose(int i, ColumnPurpose p) { m_columnPurposes[i] = p; } + // read-only; only valid if format has been guessed: QList<ColumnQualities> getColumnQualities() const { return m_columnQualities; } Modified: sonic-visualiser/trunk/framework/MainWindowBase.cpp =================================================================== --- sonic-visualiser/trunk/framework/MainWindowBase.cpp 2010-07-15 15:27:21 UTC (rev 1728) +++ sonic-visualiser/trunk/framework/MainWindowBase.cpp 2010-07-16 16:51:39 UTC (rev 1729) @@ -1369,8 +1369,9 @@ (path, &midiDlg, getMainModel()->getSampleRate()); if (!model) { - CSVFormatDialog *dialog = new CSVFormatDialog - (this, CSVFormat(path), getMainModel()->getSampleRate()); + CSVFormat format(path); + format.setSampleRate(getMainModel()->getSampleRate()); + CSVFormatDialog *dialog = new CSVFormatDialog(this, format); if (dialog->exec() == QDialog::Accepted) { model = DataFileReaderFactory::loadCSV (path, dialog->getFormat(), Modified: sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp =================================================================== --- sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp 2010-07-15 15:27:21 UTC (rev 1728) +++ sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp 2010-07-16 16:51:39 UTC (rev 1729) @@ -25,73 +25,99 @@ #include <QLabel> #include <QDialogButtonBox> +#include <iostream> -CSVFormatDialog::CSVFormatDialog(QWidget *parent, CSVFormat format, - size_t defaultSampleRate) : +CSVFormatDialog::CSVFormatDialog(QWidget *parent, CSVFormat format) : QDialog(parent), - m_modelType(CSVFormat::OneDimensionalModel), - m_timingType(CSVFormat::ExplicitTiming), - m_durationType(CSVFormat::Durations), - m_timeUnits(CSVFormat::TimeAudioFrames), - m_separator(""), - m_behaviour(QString::KeepEmptyParts) + m_format(format) { setModal(true); setWindowTitle(tr("Select Data Format")); - m_modelType = format.getModelType(); - m_timingType = format.getTimingType(); - m_durationType = format.getDurationType(); - m_timeUnits = format.getTimeUnits(); - m_separator = format.getSeparator(); - m_sampleRate = format.getSampleRate(); - m_windowSize = format.getWindowSize(); - m_behaviour = format.getSplitBehaviour(); - m_example = format.getExample(); - m_maxExampleCols = format.getMaxExampleCols(); - QGridLayout *layout = new QGridLayout; - layout->addWidget(new QLabel(tr("<b>Select Data Format</b><p>Please select the correct data format for this file.")), - 0, 0, 1, 4); + int row = 0; - layout->addWidget(new QLabel(tr("Each row specifies:")), 1, 0); + layout->addWidget(new QLabel(tr("Please select the correct data format for this file.")), + row++, 0, 1, 4); + QFrame *exampleFrame = new QFrame; + exampleFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); + exampleFrame->setLineWidth(2); + QGridLayout *exampleLayout = new QGridLayout; + exampleFrame->setLayout(exampleLayout); + + QPalette palette = exampleFrame->palette(); + palette.setColor(QPalette::Window, palette.color(QPalette::Base)); + exampleFrame->setPalette(palette); + + QFont fp; + fp.setFixedPitch(true); + fp.setStyleHint(QFont::TypeWriter); + fp.setFamily("Monospaced"); + + int columns = format.getColumnCount(); + QList<QStringList> example = m_format.getExample(); + + for (int i = 0; i < columns; ++i) { + + QComboBox *cpc = new QComboBox; + m_columnPurposeCombos.push_back(cpc); + exampleLayout->addWidget(cpc, 0, i); + + // NB must be in the same order as the CSVFormat::ColumnPurpose enum + cpc->addItem(tr("<ignore>")); // ColumnUnknown + cpc->addItem(tr("Time")); // ColumnStartTime + cpc->addItem(tr("End time")); // ColumnEndTime + cpc->addItem(tr("Duration")); // ColumnDuration + cpc->addItem(tr("Value")); // ColumnValue + cpc->addItem(tr("Label")); // ColumnLabel + cpc->setCurrentIndex(int(m_format.getColumnPurpose(i))); + connect(cpc, SIGNAL(activated(int)), this, SLOT(columnPurposeChanged(int))); + + if (i < m_format.getMaxExampleCols()) { + for (int j = 0; j < example.size() && j < 6; ++j) { + QLabel *label = new QLabel; + label->setTextFormat(Qt::PlainText); + label->setText(example[j][i]); + label->setFont(fp); + label->setPalette(palette); + exampleLayout->addWidget(label, j+1, i); + } + } + } + + layout->addWidget(exampleFrame, row, 0, 1, 4); + layout->setColumnStretch(3, 10); + layout->setRowStretch(row++, 10); + + layout->addWidget(new QLabel(tr("Each row describes:")), row, 0); + m_modelTypeCombo = new QComboBox; m_modelTypeCombo->addItem(tr("A point in time")); m_modelTypeCombo->addItem(tr("A value at a time")); m_modelTypeCombo->addItem(tr("A value across a time range")); m_modelTypeCombo->addItem(tr("A set of values")); - layout->addWidget(m_modelTypeCombo, 1, 1, 1, 2); + layout->addWidget(m_modelTypeCombo, row++, 1, 1, 2); connect(m_modelTypeCombo, SIGNAL(activated(int)), this, SLOT(modelTypeChanged(int))); - m_modelTypeCombo->setCurrentIndex(int(m_modelType)); + m_modelTypeCombo->setCurrentIndex(int(m_format.getModelType())); - layout->addWidget(new QLabel(tr("The first column contains:")), 2, 0); + layout->addWidget(new QLabel(tr("Timing is specified:")), row, 0); m_timingTypeCombo = new QComboBox; - m_timingTypeCombo->addItem(tr("Time, in seconds")); - m_timingTypeCombo->addItem(tr("Time, in audio sample frames")); - m_timingTypeCombo->addItem(tr("Data (rows are consecutive in time)")); - layout->addWidget(m_timingTypeCombo, 2, 1, 1, 2); + m_timingTypeCombo->addItem(tr("Explicitly, in seconds")); + m_timingTypeCombo->addItem(tr("Explicitly, in audio sample frames")); + m_timingTypeCombo->addItem(tr("Implicitly: rows are equally spaced in time")); + layout->addWidget(m_timingTypeCombo, row++, 1, 1, 2); connect(m_timingTypeCombo, SIGNAL(activated(int)), this, SLOT(timingTypeChanged(int))); - m_timingTypeCombo->setCurrentIndex(m_timingType == CSVFormat::ExplicitTiming ? - m_timeUnits == CSVFormat::TimeSeconds ? 0 : 1 : 2); + m_timingTypeCombo->setCurrentIndex + (m_format.getTimingType() == CSVFormat::ExplicitTiming ? + m_format.getTimeUnits() == CSVFormat::TimeSeconds ? 0 : 1 : 2); - m_durationTypeLabel = new QLabel(tr("The second column contains:")); - layout->addWidget(m_durationTypeLabel, 3, 0); - - m_durationTypeCombo = new QComboBox; - m_durationTypeCombo->addItem(tr("Duration")); - m_durationTypeCombo->addItem(tr("End time")); - layout->addWidget(m_durationTypeCombo, 3, 1, 1, 2); - connect(m_durationTypeCombo, SIGNAL(activated(int)), - this, SLOT(durationTypeChanged(int))); - m_durationTypeCombo->setCurrentIndex(int(m_durationType)); - m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):")); - layout->addWidget(m_sampleRateLabel, 4, 0); + layout->addWidget(m_sampleRateLabel, row, 0); size_t sampleRates[] = { 8000, 11025, 12000, 22050, 24000, 32000, @@ -99,49 +125,42 @@ }; m_sampleRateCombo = new QComboBox; - m_sampleRate = defaultSampleRate; for (size_t i = 0; i < sizeof(sampleRates) / sizeof(sampleRates[0]); ++i) { m_sampleRateCombo->addItem(QString("%1").arg(sampleRates[i])); - if (sampleRates[i] == m_sampleRate) m_sampleRateCombo->setCurrentIndex(i); + if (sampleRates[i] == m_format.getSampleRate()) { + m_sampleRateCombo->setCurrentIndex(i); + } } m_sampleRateCombo->setEditable(true); - layout->addWidget(m_sampleRateCombo, 4, 1); + layout->addWidget(m_sampleRateCombo, row++, 1); connect(m_sampleRateCombo, SIGNAL(activated(QString)), this, SLOT(sampleRateChanged(QString))); connect(m_sampleRateCombo, SIGNAL(editTextChanged(QString)), this, SLOT(sampleRateChanged(QString))); m_windowSizeLabel = new QLabel(tr("Frame increment between rows:")); - layout->addWidget(m_windowSizeLabel, 5, 0); + layout->addWidget(m_windowSizeLabel, row, 0); m_windowSizeCombo = new QComboBox; - m_windowSize = 1024; for (int i = 0; i <= 16; ++i) { int value = 1 << i; m_windowSizeCombo->addItem(QString("%1").arg(value)); - if (value == int(m_windowSize)) m_windowSizeCombo->setCurrentIndex(i); + if (value == int(m_format.getWindowSize())) { + m_windowSizeCombo->setCurrentIndex(i); + } } m_windowSizeCombo->setEditable(true); - layout->addWidget(m_windowSizeCombo, 5, 1); + layout->addWidget(m_windowSizeCombo, row++, 1); connect(m_windowSizeCombo, SIGNAL(activated(QString)), this, SLOT(windowSizeChanged(QString))); connect(m_windowSizeCombo, SIGNAL(editTextChanged(QString)), this, SLOT(windowSizeChanged(QString))); - layout->addWidget(new QLabel(tr("\nExample data from file:")), 6, 0, 1, 4); - - m_exampleWidget = new QTableWidget - (std::min(10, m_example.size()), m_maxExampleCols); - - layout->addWidget(m_exampleWidget, 7, 0, 1, 4); - layout->setColumnStretch(3, 10); - layout->setRowStretch(6, 10); - QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - layout->addWidget(bb, 8, 0, 1, 4); + layout->addWidget(bb, row++, 0, 1, 4); connect(bb, SIGNAL(accepted()), this, SLOT(accept())); connect(bb, SIGNAL(rejected()), this, SLOT(reject())); @@ -149,7 +168,6 @@ modelTypeChanged(m_modelTypeCombo->currentIndex()); timingTypeChanged(m_timingTypeCombo->currentIndex()); - durationTypeChanged(m_durationTypeCombo->currentIndex()); } CSVFormatDialog::~CSVFormatDialog() @@ -159,63 +177,13 @@ CSVFormat CSVFormatDialog::getFormat() const { - CSVFormat format; - format.setModelType(m_modelType); - format.setTimingType(m_timingType); - format.setDurationType(m_durationType); - format.setTimeUnits(m_timeUnits); - format.setSeparator(m_separator); - format.setSampleRate(m_sampleRate); - format.setWindowSize(m_windowSize); - format.setSplitBehaviour(m_behaviour); - return format; + return m_format; } void -CSVFormatDialog::populateExample() -{ - m_exampleWidget->setColumnCount - (m_timingType == CSVFormat::ExplicitTiming ? - m_maxExampleCols - 1 : m_maxExampleCols); - - m_exampleWidget->setHorizontalHeaderLabels(QStringList()); - - for (int i = 0; i < m_example.size(); ++i) { - for (int j = 0; j < m_example[i].size(); ++j) { - - QTableWidgetItem *item = new QTableWidgetItem(m_example[i][j]); - - if (j == 0) { - if (m_timingType == CSVFormat::ExplicitTiming) { - m_exampleWidget->setVerticalHeaderItem(i, item); - continue; - } else { - QTableWidgetItem *header = - new QTableWidgetItem(QString("%1").arg(i)); - header->setFlags(Qt::ItemIsEnabled); - m_exampleWidget->setVerticalHeaderItem(i, header); - } - } - int index = j; - if (m_timingType == CSVFormat::ExplicitTiming) --index; - item->setFlags(Qt::ItemIsEnabled); - m_exampleWidget->setItem(i, index, item); - } - } -} - -void CSVFormatDialog::modelTypeChanged(int type) { - m_modelType = (CSVFormat::ModelType)type; - - if (m_modelType == CSVFormat::TwoDimensionalModelWithDuration) { - m_durationTypeCombo->setEnabled(true); - m_durationTypeLabel->setEnabled(true); - } else { - m_durationTypeCombo->setEnabled(false); - m_durationTypeLabel->setEnabled(false); - } + m_format.setModelType((CSVFormat::ModelType)type); } void @@ -224,8 +192,8 @@ switch (type) { case 0: - m_timingType = CSVFormat::ExplicitTiming; - m_timeUnits = CSVFormat::TimeSeconds; + m_format.setTimingType(CSVFormat::ExplicitTiming); + m_format.setTimeUnits(CSVFormat::TimeSeconds); m_sampleRateCombo->setEnabled(false); m_sampleRateLabel->setEnabled(false); m_windowSizeCombo->setEnabled(false); @@ -233,8 +201,8 @@ break; case 1: - m_timingType = CSVFormat::ExplicitTiming; - m_timeUnits = CSVFormat::TimeAudioFrames; + m_format.setTimingType(CSVFormat::ExplicitTiming); + m_format.setTimeUnits(CSVFormat::TimeAudioFrames); m_sampleRateCombo->setEnabled(true); m_sampleRateLabel->setEnabled(true); m_windowSizeCombo->setEnabled(false); @@ -242,30 +210,22 @@ break; case 2: - m_timingType = CSVFormat::ImplicitTiming; - m_timeUnits = CSVFormat::TimeWindows; + m_format.setTimingType(CSVFormat::ImplicitTiming); + m_format.setTimeUnits(CSVFormat::TimeWindows); m_sampleRateCombo->setEnabled(true); m_sampleRateLabel->setEnabled(true); m_windowSizeCombo->setEnabled(true); m_windowSizeLabel->setEnabled(true); break; } - - populateExample(); } void -CSVFormatDialog::durationTypeChanged(int type) -{ - m_durationType = (CSVFormat::DurationType)type; -} - -void CSVFormatDialog::sampleRateChanged(QString rateString) { bool ok = false; int sampleRate = rateString.toInt(&ok); - if (ok) m_sampleRate = sampleRate; + if (ok) m_format.setSampleRate(sampleRate); } void @@ -273,5 +233,27 @@ { bool ok = false; int size = sizeString.toInt(&ok); - if (ok) m_windowSize = size; + if (ok) m_format.setWindowSize(size); } + +void +CSVFormatDialog::columnPurposeChanged(int purpose) +{ + QObject *o = sender(); + QComboBox *cb = qobject_cast<QComboBox *>(o); + if (!cb) return; + int changedCol = -1; + for (int i = 0; i < m_columnPurposeCombos.size(); ++i) { + if (cb == m_columnPurposeCombos[i]) { + changedCol = i; + break; + } + } + if (changedCol < 0) { + std::cerr << "Hm, some problem here -- column combo changed, but cannot locate column" << std::endl; + return; + } + +} + + Modified: sonic-visualiser/trunk/widgets/CSVFormatDialog.h =================================================================== --- sonic-visualiser/trunk/widgets/CSVFormatDialog.h 2010-07-15 15:27:21 UTC (rev 1728) +++ sonic-visualiser/trunk/widgets/CSVFormatDialog.h 2010-07-16 16:51:39 UTC (rev 1729) @@ -29,8 +29,7 @@ Q_OBJECT public: - CSVFormatDialog(QWidget *parent, CSVFormat initialFormat, - size_t defaultSampleRate); + CSVFormatDialog(QWidget *parent, CSVFormat initialFormat); ~CSVFormatDialog(); CSVFormat getFormat() const; @@ -38,36 +37,21 @@ protected slots: void modelTypeChanged(int type); void timingTypeChanged(int type); - void durationTypeChanged(int type); void sampleRateChanged(QString); void windowSizeChanged(QString); + void columnPurposeChanged(int purpose); protected: - CSVFormat::ModelType m_modelType; - CSVFormat::TimingType m_timingType; - CSVFormat::DurationType m_durationType; - CSVFormat::TimeUnits m_timeUnits; - - QString m_separator; - size_t m_sampleRate; - size_t m_windowSize; - - QString::SplitBehavior m_behaviour; + CSVFormat m_format; - QList<QStringList> m_example; - int m_maxExampleCols; - QTableWidget *m_exampleWidget; - QComboBox *m_modelTypeCombo; QComboBox *m_timingTypeCombo; - QLabel *m_durationTypeLabel; - QComboBox *m_durationTypeCombo; QLabel *m_sampleRateLabel; QComboBox *m_sampleRateCombo; QLabel *m_windowSizeLabel; QComboBox *m_windowSizeCombo; - void populateExample(); + QList<QComboBox *> m_columnPurposeCombos; }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-07-15 15:27:27
|
Revision: 1728 http://sv1.svn.sourceforge.net/sv1/?rev=1728&view=rev Author: cannam Date: 2010-07-15 15:27:21 +0000 (Thu, 15 Jul 2010) Log Message: ----------- * Start overhauling CSV parser to associate purposes with columns en route to its guesses; add some string manipulation code Modified Paths: -------------- sonic-visualiser/trunk/base/base.pro sonic-visualiser/trunk/data/fileio/CSVFormat.cpp sonic-visualiser/trunk/data/fileio/CSVFormat.h Added Paths: ----------- sonic-visualiser/trunk/base/StringBits.cpp sonic-visualiser/trunk/base/StringBits.h Added: sonic-visualiser/trunk/base/StringBits.cpp =================================================================== --- sonic-visualiser/trunk/base/StringBits.cpp (rev 0) +++ sonic-visualiser/trunk/base/StringBits.cpp 2010-07-15 15:27:21 UTC (rev 1728) @@ -0,0 +1,211 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +/* + This is a modified version of a source file from the + Rosegarden MIDI and audio sequencer and notation editor. + This file copyright 2000-2010 Chris Cannam. +*/ + +#include "StringBits.h" + +double +StringBits::stringToDoubleLocaleFree(QString s, bool *ok) +{ + int dp = 0; + int sign = 1; + int i = 0; + double result = 0.0; + int len = s.length(); + + result = 0.0; + + if (ok) *ok = true; + + while (i < len && s[i].isSpace()) ++i; + if (i < len && s[i] == '-') sign = -1; + + while (i < len) { + + QChar c = s[i]; + + if (c.isDigit()) { + + double d = c.digitValue(); + + if (dp > 0) { + for (int p = dp; p > 0; --p) d /= 10.0; + ++dp; + } else { + result *= 10.0; + } + + result += d; + + } else if (c == '.') { + + dp = 1; + + } else if (ok) { + *ok = false; + } + + ++i; + } + + return result * sign; +} + +QStringList +StringBits::splitQuoted(QString s, QChar separator) +{ + QStringList tokens; + QString tok; + + enum { sep, unq, q1, q2 } mode = sep; + + for (int i = 0; i < s.length(); ++i) { + + QChar c = s[i]; + + if (c == '\'') { + switch (mode) { + case sep: mode = q1; break; + case unq: case q2: tok += c; break; + case q1: mode = sep; tokens << tok; tok = ""; break; + } + + } else if (c == '"') { + switch (mode) { + case sep: mode = q2; break; + case unq: case q1: tok += c; break; + case q2: mode = sep; tokens << tok; tok = ""; break; + } + + } else if (c == separator || (separator == ' ' && c.isSpace())) { + switch (mode) { + case sep: if (separator != ' ') tokens << ""; break; + case unq: mode = sep; tokens << tok; tok = ""; break; + case q1: case q2: tok += c; break; + } + + } else if (c == '\\') { + if (++i < s.length()) { + c = s[i]; + switch (mode) { + case sep: mode = unq; tok += c; break; + default: tok += c; break; + } + } + + } else { + switch (mode) { + case sep: mode = unq; tok += c; break; + default: tok += c; break; + } + } + } + + if (tok != "" || mode != sep) tokens << tok; + return tokens; +} + +/* + +void testSplit() +{ + QStringList tests; + tests << "a b c d"; + tests << "a \"b c\" d"; + tests << "a 'b c' d"; + tests << "a \"b c\\\" d\""; + tests << "a 'b c\\' d'"; + tests << "a \"b c' d\""; + tests << "a 'b c\" d'"; + tests << "aa 'bb cc\" dd'"; + tests << "a'a 'bb' \\\"cc\" dd\\\""; + tests << " a'a \\\' 'bb' \' \\\"cc\" ' dd\\\" '"; + + for (int j = 0; j < tests.size(); ++j) { + cout << endl; + cout << tests[j].toStdString() << endl; + cout << "->" << endl << "("; + QStringList l = splitQuoted(tests[j], ' '); + for (int i = 0; i < l.size(); ++i) { + if (i > 0) cout << ";"; + cout << l[i].toStdString(); + } + cout << ")" << endl; + } +} + +*/ + +/* + Results: + +a b c d +-> +(a;b;c;d) + +a "b c" d +-> +(a;b c;d) + +a 'b c' d +-> +(a;b c;d) + +a "b c\" d" +-> +(a;b c" d) + +a 'b c\' d' +-> +(a;b c' d) + +a "b c' d" +-> +(a;b c' d) + +a 'b c" d' +-> +(a;b c" d) + +aa 'bb cc" dd' +-> +(aa;bb cc" dd) + +a'a 'bb' \"cc" dd\" +-> +(a'a;bb;"cc";dd") + + a'a \' 'bb' ' \"cc" ' dd\" ' +-> +(a'a;';bb; "cc" ;dd";) + +*/ + +QStringList +StringBits::split(QString line, QChar separator, bool quoted) +{ + if (quoted) { + return splitQuoted(line, separator); + } else { + return line.split(separator, + separator == ' ' ? QString::SkipEmptyParts : + QString::KeepEmptyParts); + } +} + Added: sonic-visualiser/trunk/base/StringBits.h =================================================================== --- sonic-visualiser/trunk/base/StringBits.h (rev 0) +++ sonic-visualiser/trunk/base/StringBits.h 2010-07-15 15:27:21 UTC (rev 1728) @@ -0,0 +1,60 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +/* + This is a modified version of a source file from the + Rosegarden MIDI and audio sequencer and notation editor. + This file copyright 2000-2010 Chris Cannam. +*/ + +#ifndef _STRING_BITS_H_ +#define _STRING_BITS_H_ + +#include <QString> +#include <QStringList> +#include <QChar> + +class StringBits +{ +public: + /** + * Convert a string to a double using basic "C"-locale syntax, + * i.e. always using '.' as a decimal point. We use this as a + * fallback when parsing files from an unknown source, if + * locale-specific conversion fails. Does not support e notation. + * If ok is non-NULL, *ok will be set to true if conversion + * succeeds or false otherwise. + */ + static double stringToDoubleLocaleFree(QString s, bool *ok = 0); + + /** + * Split a string at the given separator character, allowing + * quoted sections that contain the separator. If the separator + * is ' ', any (amount of) whitespace will be considered as a + * single separator. If the separator is another whitespace + * character such as '\t', it will be used literally. + */ + static QStringList splitQuoted(QString s, QChar separator); + + /** + * Split a string at the given separator character. If quoted is + * true, do so by calling splitQuoted (above). If quoted is + * false, use QString::split; if separator is ' ', use + * SkipEmptyParts behaviour, otherwise use KeepEmptyParts (this is + * analogous to the behaviour of splitQuoted). + */ + static QStringList split(QString s, QChar separator, bool quoted); +}; + +#endif Modified: sonic-visualiser/trunk/base/base.pro =================================================================== --- sonic-visualiser/trunk/base/base.pro 2010-07-15 15:25:59 UTC (rev 1727) +++ sonic-visualiser/trunk/base/base.pro 2010-07-15 15:27:21 UTC (rev 1728) @@ -39,6 +39,7 @@ Selection.h \ Serialiser.h \ StorageAdviser.h \ + StringBits.h \ TempDirectory.h \ TextMatcher.h \ Thread.h \ @@ -67,6 +68,7 @@ Selection.cpp \ Serialiser.cpp \ StorageAdviser.cpp \ + StringBits.cpp \ TempDirectory.cpp \ TextMatcher.cpp \ Thread.cpp \ Modified: sonic-visualiser/trunk/data/fileio/CSVFormat.cpp =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFormat.cpp 2010-07-15 15:25:59 UTC (rev 1727) +++ sonic-visualiser/trunk/data/fileio/CSVFormat.cpp 2010-07-15 15:27:21 UTC (rev 1728) @@ -15,6 +15,8 @@ #include "CSVFormat.h" +#include "base/StringBits.h" + #include <QFile> #include <QString> #include <QRegExp> @@ -23,40 +25,42 @@ #include <iostream> -CSVFormat::CSVFormat(QString filename) : - m_modelType(TwoDimensionalModel), - m_timingType(ExplicitTiming), - m_durationType(Durations), - m_timeUnits(TimeSeconds), - m_separator(","), +CSVFormat::CSVFormat(QString path) : + m_separator(""), m_sampleRate(44100), m_windowSize(1024), - m_behaviour(QString::KeepEmptyParts), - m_maxExampleCols(0) + m_allowQuoting(true) { - QFile file(filename); + guessFormatFor(path); +} + +void +CSVFormat::guessFormatFor(QString path) +{ + m_modelType = TwoDimensionalModel; + m_timingType = ExplicitTiming; + m_durationType = Durations; + m_timeUnits = TimeSeconds; + m_behaviour = QString::KeepEmptyParts; + + m_maxExampleCols = 0; + m_columnCount = 0; + m_variableColumnCount = false; + + m_example.clear(); + m_columnQualities.clear(); + m_columnPurposes.clear(); + m_prevValues.clear(); + + QFile file(path); if (!file.exists()) return; if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; QTextStream in(&file); in.seek(0); - unsigned int lineno = 0; + int lineno = 0; - bool nonIncreasingPrimaries = false; - bool nonIncreasingSecondaries = false; - bool nonNumericPrimaries = false; - bool floatPrimaries = false; - bool variableItemCount = false; - int itemCount = 1; - int earliestNonNumericItem = -1; - - float prevPrimary = 0.0; - float prevSecondary = 0.0; - - m_maxExampleCols = 0; - m_separator = ""; - while (!in.atEnd()) { // See comment about line endings in CSVFileReader::load() @@ -67,152 +71,203 @@ for (size_t li = 0; li < lines.size(); ++li) { QString line = lines[li]; + if (line.startsWith("#") || line == "") continue; - if (line.startsWith("#")) continue; + guessQualities(line, lineno); - m_behaviour = QString::KeepEmptyParts; + if (++lineno == 50) break; + } + } - if (m_separator == "") { - //!!! to do: ask the user - if (line.split(",").size() >= 2) m_separator = ","; - else if (line.split("\t").size() >= 2) m_separator = "\t"; - else if (line.split("|").size() >= 2) m_separator = "|"; - else if (line.split("/").size() >= 2) m_separator = "/"; - else if (line.split(":").size() >= 2) m_separator = ":"; - else { - m_separator = " "; - m_behaviour = QString::SkipEmptyParts; - } - } + guessPurposes(); +} -// std::cerr << "separator = \"" << m_separator.toStdString() << "\"" << std::endl; +void +CSVFormat::guessSeparator(QString line) +{ + char candidates[] = { ',', '\t', ' ', '|', '/', ':' }; + for (int i = 0; i < sizeof(candidates)/sizeof(candidates[0]); ++i) { + if (StringBits::split(line, candidates[i], m_allowQuoting).size() >= 2) { + m_separator = candidates[i]; + return; + } + } + m_separator = " "; +} - QStringList list = line.split(m_separator, m_behaviour); - QStringList tidyList; +void +CSVFormat::guessQualities(QString line, int lineno) +{ + if (m_separator == "") guessSeparator(line); - for (int i = 0; i < list.size(); ++i) { - - QString s(list[i]); - bool numeric = false; + QStringList list = StringBits::split(line, m_separator[0], m_allowQuoting); - if (s.length() >= 2 && s.startsWith("\"") && s.endsWith("\"")) { - s = s.mid(1, s.length() - 2); - } else if (s.length() >= 2 && s.startsWith("'") && s.endsWith("'")) { - s = s.mid(1, s.length() - 2); - } else { - float f = s.toFloat(&numeric); -// std::cerr << "converted \"" << s.toStdString() << "\" to float, got " << f << " and success = " << numeric << std::endl; - } + int cols = list.size(); + if (lineno == 0 || (cols < m_columnCount)) m_columnCount = cols; + if (cols != m_columnCount) m_variableColumnCount = true; - tidyList.push_back(s); + // All columns are regarded as having these qualities until we see + // something that indicates otherwise: - if (lineno == 0 || (list.size() < itemCount)) { - itemCount = list.size(); - } else { - if (itemCount != list.size()) { - variableItemCount = true; - } - } + ColumnQualities defaultQualities = + ColumnNumeric | ColumnIntegral | ColumnIncreasing; + + for (int i = 0; i < cols; ++i) { - if (i == 0) { // primary + while (m_columnQualities.size() <= i) { + m_columnQualities.push_back(defaultQualities); + m_prevValues.push_back(0.f); + } - if (numeric) { + QString s(list[i]); + bool ok = false; - float primary = s.toFloat(); + ColumnQualities qualities = m_columnQualities[i]; - if (lineno > 0 && primary <= prevPrimary) { - nonIncreasingPrimaries = true; - } + bool numeric = (qualities & ColumnNumeric); + bool integral = (qualities & ColumnIntegral); + bool increasing = (qualities & ColumnIncreasing); + bool large = (qualities & ColumnLarge); // this one defaults to off - if (s.contains(".") || s.contains(",")) { - floatPrimaries = true; - } + float value = 0.f; - prevPrimary = primary; + //!!! how to take into account headers? - } else { - nonNumericPrimaries = true; - } - } else { // secondary + if (numeric) { + value = s.toFloat(&ok); + if (!ok) { + value = (float)StringBits::stringToDoubleLocaleFree(s, &ok); + } + if (ok) { + if (lineno < 2 && value > 1000.f) large = true; + } else { + numeric = false; + } + } - if (!numeric) { - if (earliestNonNumericItem < 0 || - i < earliestNonNumericItem) { - earliestNonNumericItem = i; - } - } else if (i == 1) { - float secondary = s.toFloat(); - if (lineno > 0 && secondary <= prevSecondary) { - nonIncreasingSecondaries = true; - } - prevSecondary = secondary; - } + if (numeric) { + + if (integral) { + if (s.contains('.') || s.contains(',')) { + integral = false; } } - if (lineno < 10) { - m_example.push_back(tidyList); - if (lineno == 0 || tidyList.size() > m_maxExampleCols) { - m_maxExampleCols = tidyList.size(); + if (increasing) { + if (lineno > 0 && value <= m_prevValues[i]) { + increasing = false; } } - ++lineno; + m_prevValues[i] = value; + } - if (lineno == 50) break; + m_columnQualities[i] = + (numeric ? ColumnNumeric : 0) | + (integral ? ColumnIntegral : 0) | + (increasing ? ColumnIncreasing : 0) | + (large ? ColumnLarge : 0); + } + + if (lineno < 10) { + m_example.push_back(list); + if (lineno == 0 || cols > m_maxExampleCols) { + m_maxExampleCols = cols; } } - if (nonNumericPrimaries || nonIncreasingPrimaries) { - - // Primaries are probably not a series of times + std::cerr << "Estimated column qualities: "; + for (int i = 0; i < m_columnCount; ++i) { + std::cerr << int(m_columnQualities[i]) << " "; + } + std::cerr << std::endl; +} - m_timingType = CSVFormat::ImplicitTiming; - m_timeUnits = CSVFormat::TimeWindows; +void +CSVFormat::guessPurposes() +{ + while (m_columnPurposes.size() <= m_columnCount) { + m_columnPurposes.push_back(ColumnUnknown); + } + + m_timingType = CSVFormat::ImplicitTiming; + m_timeUnits = CSVFormat::TimeWindows; - if (nonNumericPrimaries) { - m_modelType = CSVFormat::OneDimensionalModel; - } else if (itemCount == 1 || variableItemCount || - (earliestNonNumericItem != -1)) { - m_modelType = CSVFormat::TwoDimensionalModel; - } else { - m_modelType = CSVFormat::ThreeDimensionalModel; - } + int timingColumnCount = 0; + + for (int i = 0; i < m_columnCount; ++i) { + + ColumnPurpose purpose = ColumnUnknown; + bool primary = (i == 0); - } else { + ColumnQualities qualities = m_columnQualities[i]; - // Increasing numeric primaries -- likely to be time + bool numeric = (qualities & ColumnNumeric); + bool integral = (qualities & ColumnIntegral); + bool increasing = (qualities & ColumnIncreasing); + bool large = (qualities & ColumnLarge); - m_timingType = CSVFormat::ExplicitTiming; + bool timingColumn = (numeric && increasing); - if (floatPrimaries) { - m_timeUnits = CSVFormat::TimeSeconds; - } else { - m_timeUnits = CSVFormat::TimeAudioFrames; - } + if (timingColumn) { - if (itemCount == 1) { - m_modelType = CSVFormat::OneDimensionalModel; - } else if (variableItemCount || (earliestNonNumericItem != -1)) { - if (earliestNonNumericItem != -1 && earliestNonNumericItem < 2) { - m_modelType = CSVFormat::OneDimensionalModel; - } else { - m_modelType = CSVFormat::TwoDimensionalModel; - } - } else { - m_modelType = CSVFormat::ThreeDimensionalModel; - } + ++timingColumnCount; + + if (primary) { - if (nonIncreasingSecondaries) { - m_durationType = Durations; - } else { - m_durationType = EndTimes; + purpose = ColumnStartTime; + + m_timingType = ExplicitTiming; + + if (integral && large) { + m_timeUnits = TimeAudioFrames; + } else { + m_timeUnits = TimeSeconds; + } + + } else { + + if (timingColumnCount == 2 && m_timingType == ExplicitTiming) { + purpose = ColumnEndTime; + m_durationType = EndTimes; + } + } } + + if (purpose == ColumnUnknown) { + if (numeric) { + purpose = ColumnValue; + } else { + purpose = ColumnLabel; + } + } + + m_columnPurposes[i] = purpose; + } + + int valueCount = 0; + for (int i = 0; i < m_columnCount; ++i) { + if (m_columnPurposes[i] == ColumnValue) ++valueCount; } + if (valueCount == 0) { + m_modelType = OneDimensionalModel; + } else if (valueCount == 1) { + m_modelType = TwoDimensionalModel; + } else { + m_modelType = ThreeDimensionalModel; + } + + std::cerr << "Estimated column purposes: "; + for (int i = 0; i < m_columnCount; ++i) { + std::cerr << int(m_columnPurposes[i]) << " "; + } + std::cerr << std::endl; + std::cerr << "Estimated model type: " << m_modelType << std::endl; std::cerr << "Estimated timing type: " << m_timingType << std::endl; std::cerr << "Estimated duration type: " << m_durationType << std::endl; std::cerr << "Estimated units: " << m_timeUnits << std::endl; } + Modified: sonic-visualiser/trunk/data/fileio/CSVFormat.h =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFormat.h 2010-07-15 15:25:59 UTC (rev 1727) +++ sonic-visualiser/trunk/data/fileio/CSVFormat.h 2010-07-15 15:27:21 UTC (rev 1728) @@ -45,8 +45,23 @@ TimeWindows }; - CSVFormat(QString path); // guess format + enum ColumnPurpose { + ColumnUnknown, + ColumnStartTime, + ColumnEndTime, + ColumnDuration, + ColumnValue, + ColumnLabel + }; + enum ColumnQuality { + ColumnNumeric = 0x1, + ColumnIntegral = 0x2, + ColumnIncreasing = 0x4, + ColumnLarge = 0x8 + }; + typedef unsigned int ColumnQualities; + CSVFormat() : // arbitrary defaults m_modelType(TwoDimensionalModel), m_timingType(ExplicitTiming), @@ -55,8 +70,23 @@ m_separator(","), m_sampleRate(44100), m_windowSize(1024), - m_behaviour(QString::KeepEmptyParts) + m_columnCount(0), + m_variableColumnCount(false), + m_behaviour(QString::KeepEmptyParts), + m_allowQuoting(true), + m_maxExampleCols(0) { } + + CSVFormat(QString path); // guess format + + /** + * Guess the format of the given CSV file, setting the fields in + * this object accordingly. If the current separator is the empty + * string, the separator character will also be guessed; otherwise + * the current separator will be used. The other properties of + * this object will be set according to guesses from the file. + */ + void guessFormatFor(QString path); ModelType getModelType() const { return m_modelType; } TimingType getTimingType() const { return m_timingType; } @@ -65,8 +95,9 @@ QString getSeparator() const { return m_separator; } size_t getSampleRate() const { return m_sampleRate; } size_t getWindowSize() const { return m_windowSize; } - + QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; } + QList<ColumnPurpose> getColumnPurposes() const { return m_columnPurposes; } void setModelType(ModelType t) { m_modelType = t; } void setTimingType(TimingType t) { m_timingType = t; } @@ -77,8 +108,12 @@ void setWindowSize(size_t s) { m_windowSize = s; } void setSplitBehaviour(QString::SplitBehavior b) { m_behaviour = b; } + void setColumnPurposes(QList<ColumnPurpose> cl) { m_columnPurposes = cl; } - // only valid if constructor that guesses format was used: + // read-only; only valid if format has been guessed: + QList<ColumnQualities> getColumnQualities() const { return m_columnQualities; } + + // read-only; only valid if format has been guessed: QList<QStringList> getExample() const { return m_example; } int getMaxExampleCols() const { return m_maxExampleCols; } @@ -91,10 +126,26 @@ size_t m_sampleRate; size_t m_windowSize; + int m_columnCount; + bool m_variableColumnCount; + + QList<ColumnQualities> m_columnQualities; + QList<ColumnPurpose> m_columnPurposes; + + QList<float> m_prevValues; + QString::SplitBehavior m_behaviour; + bool m_allowQuoting; QList<QStringList> m_example; int m_maxExampleCols; + + void guessSeparator(QString line); + void guessQualities(QString line, int lineno); + void guessPurposes(); + + void guessFormatFor_Old(QString path); + }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-07-15 15:26:05
|
Revision: 1727 http://sv1.svn.sourceforge.net/sv1/?rev=1727&view=rev Author: cannam Date: 2010-07-15 15:25:59 +0000 (Thu, 15 Jul 2010) Log Message: ----------- * Some debug, turn off PulseAudio autospawn Modified Paths: -------------- sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.cpp sonic-visualiser/trunk/audioio/AudioPortAudioTarget.cpp sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp Modified: sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.cpp =================================================================== --- sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.cpp 2010-07-08 14:22:28 UTC (rev 1726) +++ sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.cpp 2010-07-15 15:25:59 UTC (rev 1727) @@ -1456,10 +1456,12 @@ } else { // space must be a multiple of generatorBlockSize - space = (space / generatorBlockSize) * generatorBlockSize; + size_t reqSpace = space; + space = (reqSpace / generatorBlockSize) * generatorBlockSize; if (space == 0) { #ifdef DEBUG_AUDIO_PLAY_SOURCE - std::cout << "requested fill is less than generator block size of " + std::cout << "requested fill of " << reqSpace + << " is less than generator block size of " << generatorBlockSize << ", leaving it" << std::endl; #endif return false; Modified: sonic-visualiser/trunk/audioio/AudioPortAudioTarget.cpp =================================================================== --- sonic-visualiser/trunk/audioio/AudioPortAudioTarget.cpp 2010-07-08 14:22:28 UTC (rev 1726) +++ sonic-visualiser/trunk/audioio/AudioPortAudioTarget.cpp 2010-07-15 15:25:59 UTC (rev 1727) @@ -77,6 +77,7 @@ if (err != paNoError) { std::cerr << "ERROR: AudioPortAudioTarget: Failed to open PortAudio stream: " << Pa_GetErrorText(err) << std::endl; + std::cerr << "Note: device ID was " << op.device << std::endl; m_stream = 0; Pa_Terminate(); return; Modified: sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp =================================================================== --- sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp 2010-07-08 14:22:28 UTC (rev 1726) +++ sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp 2010-07-15 15:25:59 UTC (rev 1727) @@ -24,7 +24,8 @@ #include <cassert> #include <cmath> -//#define DEBUG_AUDIO_PULSE_AUDIO_TARGET 1 +#define DEBUG_AUDIO_PULSE_AUDIO_TARGET 1 +//#define DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY 1 AudioPulseAudioTarget::AudioPulseAudioTarget(AudioCallbackPlaySource *source) : AudioCallbackPlayTarget(source), @@ -62,6 +63,10 @@ m_spec.channels = 2; m_spec.format = PA_SAMPLE_FLOAT32NE; +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET + std::cerr << "AudioPulseAudioTarget: Creating context" << std::endl; +#endif + m_context = pa_context_new(m_api, source->getClientName().toLocal8Bit().data()); if (!m_context) { std::cerr << "ERROR: AudioPulseAudioTarget: Failed to create context object" << std::endl; @@ -70,8 +75,17 @@ pa_context_set_state_callback(m_context, contextStateChangedStatic, this); - pa_context_connect(m_context, 0, (pa_context_flags_t)0, 0); // default server +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET + std::cerr << "AudioPulseAudioTarget: Connecting to default server..." << std::endl; +#endif + pa_context_connect(m_context, 0, // default server + (pa_context_flags_t)PA_CONTEXT_NOAUTOSPAWN, 0); + +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET + std::cerr << "AudioPulseAudioTarget: Starting main loop" << std::endl; +#endif + m_loopThread = new MainLoopThread(m_loop); m_loopThread->start(); @@ -151,7 +165,7 @@ void AudioPulseAudioTarget::streamWrite(size_t requested) { -#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY std::cout << "AudioPulseAudioTarget::streamWrite(" << requested << ")" << std::endl; #endif if (m_done) return; @@ -181,7 +195,7 @@ std::cerr << "WARNING: AudioPulseAudioTarget::streamWrite: nframes " << nframes << " > m_bufferSize " << m_bufferSize << std::endl; } -#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY std::cout << "AudioPulseAudioTarget::streamWrite: nframes = " << nframes << std::endl; #endif @@ -211,7 +225,7 @@ size_t received = m_source->getSourceSamples(nframes, tmpbuf); -#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY std::cerr << "requested " << nframes << ", received " << received << std::endl; if (received < nframes) { @@ -260,7 +274,7 @@ if (ch > 0 || sourceChannels == 1) peakRight = peak; } -#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY std::cerr << "calling pa_stream_write with " << nframes * tmpbufch * sizeof(float) << " bytes" << std::endl; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-07-08 14:22:35
|
Revision: 1726 http://sv1.svn.sourceforge.net/sv1/?rev=1726&view=rev Author: cannam Date: 2010-07-08 14:22:28 +0000 (Thu, 08 Jul 2010) Log Message: ----------- * Add option to import time+duration (or time+endtime) from CSV files (importing to Region layers) * Fix ffwd/rwd in Region layers so as to behave like time-value layers Modified Paths: -------------- sonic-visualiser/trunk/data/fileio/CSVFileReader.cpp sonic-visualiser/trunk/data/fileio/CSVFormat.cpp sonic-visualiser/trunk/data/fileio/CSVFormat.h sonic-visualiser/trunk/framework/MainWindowBase.cpp sonic-visualiser/trunk/layer/RegionLayer.cpp sonic-visualiser/trunk/layer/RegionLayer.h sonic-visualiser/trunk/layer/TimeValueLayer.cpp sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp sonic-visualiser/trunk/widgets/CSVFormatDialog.h Modified: sonic-visualiser/trunk/data/fileio/CSVFileReader.cpp =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFileReader.cpp 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/data/fileio/CSVFileReader.cpp 2010-07-08 14:22:28 UTC (rev 1726) @@ -20,6 +20,7 @@ #include "model/SparseOneDimensionalModel.h" #include "model/SparseTimeValueModel.h" #include "model/EditableDenseThreeDimensionalModel.h" +#include "model/RegionModel.h" #include "DataFileReaderFactory.h" #include <QFile> @@ -29,6 +30,7 @@ #include <QTextStream> #include <iostream> +#include <map> CSVFileReader::CSVFileReader(QString path, CSVFormat format, size_t mainModelSampleRate) : @@ -90,9 +92,10 @@ } */ - CSVFormat::ModelType modelType = m_format.getModelType(); + CSVFormat::ModelType modelType = m_format.getModelType(); CSVFormat::TimingType timingType = m_format.getTimingType(); - CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); + CSVFormat::DurationType durationType = m_format.getDurationType(); + CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); QString separator = m_format.getSeparator(); QString::SplitBehavior behaviour = m_format.getSplitBehaviour(); size_t sampleRate = m_format.getSampleRate(); @@ -114,6 +117,7 @@ SparseOneDimensionalModel *model1 = 0; SparseTimeValueModel *model2 = 0; + RegionModel *model2a = 0; EditableDenseThreeDimensionalModel *model3 = 0; Model *model = 0; @@ -126,8 +130,12 @@ float min = 0.0, max = 0.0; size_t frameNo = 0; + size_t duration = 0; size_t startFrame = 0; // for calculation of dense model resolution + std::map<QString, float> labelValueMap; + float syntheticMax = 0.f; + while (!in.atEnd()) { // QTextStream's readLine doesn't cope with old-style Mac @@ -166,6 +174,11 @@ model = model2; break; + case CSVFormat::TwoDimensionalModelWithDuration: + model2a = new RegionModel(sampleRate, windowSize, false); + model = model2a; + break; + case CSVFormat::ThreeDimensionalModel: model3 = new EditableDenseThreeDimensionalModel (sampleRate, @@ -180,6 +193,8 @@ QStringList tidyList; QRegExp nonNumericRx("[^0-9eE.,+-]"); + float value = 0.f; + for (int i = 0; i < list.size(); ++i) { QString s(list[i].trimmed()); @@ -190,41 +205,82 @@ s = s.mid(1, s.length() - 2); } - if (i == 0 && timingType == CSVFormat::ExplicitTiming) { + if (timingType == CSVFormat::ExplicitTiming) { - bool ok = false; - QString numeric = s; - numeric.remove(nonNumericRx); + size_t calculatedFrame = 0; - if (timeUnits == CSVFormat::TimeSeconds) { + if (i == 0 || + (i == 1 && + modelType == CSVFormat::TwoDimensionalModelWithDuration)) { - double time = numeric.toDouble(&ok); - frameNo = int(time * sampleRate + 0.5); + bool ok = false; + QString numeric = s; + numeric.remove(nonNumericRx); - } else { + if (timeUnits == CSVFormat::TimeSeconds) { - frameNo = numeric.toInt(&ok); + double time = numeric.toDouble(&ok); + calculatedFrame = int(time * sampleRate + 0.5); - if (timeUnits == CSVFormat::TimeWindows) { - frameNo *= windowSize; + } else { + + calculatedFrame = numeric.toInt(&ok); + + if (timeUnits == CSVFormat::TimeWindows) { + calculatedFrame *= windowSize; + } } + + if (!ok) { + if (warnings < warnLimit) { + std::cerr << "WARNING: CSVFileReader::load: " + << "Bad time format (\"" << s.toStdString() + << "\") in data line " + << lineno+1 << ":" << std::endl; + std::cerr << line.toStdString() << std::endl; + } else if (warnings == warnLimit) { + std::cerr << "WARNING: Too many warnings" << std::endl; + } + ++warnings; + } + + if (i == 0) frameNo = calculatedFrame; + else { + if (durationType == CSVFormat::EndTimes) { + duration = calculatedFrame - frameNo; + } else { + duration = calculatedFrame; + } + } + + continue; } - + } + + if ((i == 1 && + modelType == CSVFormat::TwoDimensionalModel) || + (i == 2 && + modelType == CSVFormat::TwoDimensionalModelWithDuration)) { + bool ok = false; + value = s.toFloat(&ok); if (!ok) { - if (warnings < warnLimit) { - std::cerr << "WARNING: CSVFileReader::load: " - << "Bad time format (\"" << s.toStdString() - << "\") in data line " - << lineno+1 << ":" << std::endl; - std::cerr << line.toStdString() << std::endl; - } else if (warnings == warnLimit) { - std::cerr << "WARNING: Too many warnings" << std::endl; + // cf. RDFImporter::fillModel + if (labelValueMap.find(s) == labelValueMap.end()) { + syntheticMax = syntheticMax + 1.f; + labelValueMap[s] = syntheticMax; } - ++warnings; + value = labelValueMap[s]; + } else { + if (value > syntheticMax) syntheticMax = value; } - } else { - tidyList.push_back(s); + if (i + 1 == list.size()) { + // keep text around for use as label (none other given) + tidyList.push_back(s); + } + continue; } + + tidyList.push_back(s); } if (modelType == CSVFormat::OneDimensionalModel) { @@ -240,11 +296,21 @@ SparseTimeValueModel::Point point (frameNo, - tidyList.size() > 0 ? tidyList[0].toFloat() : 0.0, - tidyList.size() > 1 ? tidyList[1] : QString("%1").arg(lineno+1)); + value, + tidyList.size() > 0 ? tidyList[0] : QString("%1").arg(lineno+1)); model2->addPoint(point); + } else if (modelType == CSVFormat::TwoDimensionalModelWithDuration) { + + RegionModel::Point point + (frameNo, + value, + duration, + tidyList.size() > 0 ? tidyList[0] : QString("%1").arg(lineno+1)); + + model2a->addPoint(point); + } else if (modelType == CSVFormat::ThreeDimensionalModel) { DenseThreeDimensionalModel::Column values; Modified: sonic-visualiser/trunk/data/fileio/CSVFormat.cpp =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFormat.cpp 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/data/fileio/CSVFormat.cpp 2010-07-08 14:22:28 UTC (rev 1726) @@ -26,6 +26,7 @@ CSVFormat::CSVFormat(QString filename) : m_modelType(TwoDimensionalModel), m_timingType(ExplicitTiming), + m_durationType(Durations), m_timeUnits(TimeSeconds), m_separator(","), m_sampleRate(44100), @@ -43,6 +44,7 @@ unsigned int lineno = 0; bool nonIncreasingPrimaries = false; + bool nonIncreasingSecondaries = false; bool nonNumericPrimaries = false; bool floatPrimaries = false; bool variableItemCount = false; @@ -50,6 +52,7 @@ int earliestNonNumericItem = -1; float prevPrimary = 0.0; + float prevSecondary = 0.0; m_maxExampleCols = 0; m_separator = ""; @@ -137,6 +140,12 @@ i < earliestNonNumericItem) { earliestNonNumericItem = i; } + } else if (i == 1) { + float secondary = s.toFloat(); + if (lineno > 0 && secondary <= prevSecondary) { + nonIncreasingSecondaries = true; + } + prevSecondary = secondary; } } } @@ -193,10 +202,17 @@ } else { m_modelType = CSVFormat::ThreeDimensionalModel; } + + if (nonIncreasingSecondaries) { + m_durationType = Durations; + } else { + m_durationType = EndTimes; + } } std::cerr << "Estimated model type: " << m_modelType << std::endl; std::cerr << "Estimated timing type: " << m_timingType << std::endl; + std::cerr << "Estimated duration type: " << m_durationType << std::endl; std::cerr << "Estimated units: " << m_timeUnits << std::endl; } Modified: sonic-visualiser/trunk/data/fileio/CSVFormat.h =================================================================== --- sonic-visualiser/trunk/data/fileio/CSVFormat.h 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/data/fileio/CSVFormat.h 2010-07-08 14:22:28 UTC (rev 1726) @@ -25,6 +25,7 @@ enum ModelType { OneDimensionalModel, TwoDimensionalModel, + TwoDimensionalModelWithDuration, ThreeDimensionalModel }; @@ -32,6 +33,11 @@ ExplicitTiming, ImplicitTiming }; + + enum DurationType { + Durations, + EndTimes + }; enum TimeUnits { TimeSeconds, @@ -44,28 +50,31 @@ CSVFormat() : // arbitrary defaults m_modelType(TwoDimensionalModel), m_timingType(ExplicitTiming), + m_durationType(Durations), m_timeUnits(TimeSeconds), m_separator(","), m_sampleRate(44100), m_windowSize(1024), m_behaviour(QString::KeepEmptyParts) { } + + ModelType getModelType() const { return m_modelType; } + TimingType getTimingType() const { return m_timingType; } + DurationType getDurationType() const { return m_durationType; } + TimeUnits getTimeUnits() const { return m_timeUnits; } + QString getSeparator() const { return m_separator; } + size_t getSampleRate() const { return m_sampleRate; } + size_t getWindowSize() const { return m_windowSize; } - ModelType getModelType() const { return m_modelType; } - TimingType getTimingType() const { return m_timingType; } - TimeUnits getTimeUnits() const { return m_timeUnits; } - QString getSeparator() const { return m_separator; } - size_t getSampleRate() const { return m_sampleRate; } - size_t getWindowSize() const { return m_windowSize; } - QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; } - void setModelType(ModelType t) { m_modelType = t; } - void setTimingType(TimingType t) { m_timingType = t; } - void setTimeUnits(TimeUnits t) { m_timeUnits = t; } - void setSeparator(QString s) { m_separator = s; } - void setSampleRate(size_t r) { m_sampleRate = r; } - void setWindowSize(size_t s) { m_windowSize = s; } + void setModelType(ModelType t) { m_modelType = t; } + void setTimingType(TimingType t) { m_timingType = t; } + void setDurationType(DurationType t) { m_durationType = t; } + void setTimeUnits(TimeUnits t) { m_timeUnits = t; } + void setSeparator(QString s) { m_separator = s; } + void setSampleRate(size_t r) { m_sampleRate = r; } + void setWindowSize(size_t s) { m_windowSize = s; } void setSplitBehaviour(QString::SplitBehavior b) { m_behaviour = b; } @@ -74,12 +83,13 @@ int getMaxExampleCols() const { return m_maxExampleCols; } protected: - ModelType m_modelType; - TimingType m_timingType; - TimeUnits m_timeUnits; - QString m_separator; - size_t m_sampleRate; - size_t m_windowSize; + ModelType m_modelType; + TimingType m_timingType; + DurationType m_durationType; + TimeUnits m_timeUnits; + QString m_separator; + size_t m_sampleRate; + size_t m_windowSize; QString::SplitBehavior m_behaviour; Modified: sonic-visualiser/trunk/framework/MainWindowBase.cpp =================================================================== --- sonic-visualiser/trunk/framework/MainWindowBase.cpp 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/framework/MainWindowBase.cpp 2010-07-08 14:22:28 UTC (rev 1726) @@ -2327,6 +2327,7 @@ if (!dynamic_cast<TimeInstantLayer *>(layer) && !dynamic_cast<TimeValueLayer *>(layer) && + !dynamic_cast<RegionLayer *>(layer) && !dynamic_cast<TimeRulerLayer *>(layer)) { layer = 0; Modified: sonic-visualiser/trunk/layer/RegionLayer.cpp =================================================================== --- sonic-visualiser/trunk/layer/RegionLayer.cpp 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/layer/RegionLayer.cpp 2010-07-08 14:22:28 UTC (rev 1726) @@ -517,6 +517,79 @@ return found; } +bool +RegionLayer::snapToSimilarFeature(View *v, int &frame, + size_t &resolution, + SnapType snap) const +{ + if (!m_model) { + return Layer::snapToSimilarFeature(v, frame, resolution, snap); + } + + resolution = m_model->getResolution(); + + const RegionModel::PointList &points = m_model->getPoints(); + RegionModel::PointList close = m_model->getPoints(frame, frame); + + RegionModel::PointList::const_iterator i; + + int matchframe = frame; + float matchvalue = 0.f; + + for (i = close.begin(); i != close.end(); ++i) { + if (i->frame > frame) break; + matchvalue = i->value; + matchframe = i->frame; + } + + int snapped = frame; + bool found = false; + bool distant = false; + float epsilon = 0.0001; + + i = close.begin(); + + // Scan through the close points first, then the more distant ones + // if no suitable close one is found + + while (i != points.end()) { + + if (i == close.end()) { + i = points.begin(); + distant = true; + } + + if (snap == SnapRight) { + + if (i->frame > matchframe && + fabsf(i->value - matchvalue) < epsilon) { + snapped = i->frame; + found = true; + break; + } + + } else if (snap == SnapLeft) { + + if (i->frame < matchframe) { + if (fabsf(i->value - matchvalue) < epsilon) { + snapped = i->frame; + found = true; // don't break, as the next may be better + } + } else if (found || distant) { + break; + } + + } else { + // no other snap types supported + } + + ++i; + } + + frame = snapped; + return found; +} + void RegionLayer::getScaleExtents(View *v, float &min, float &max, bool &log) const { @@ -847,6 +920,7 @@ RegionModel::Point::Comparator()(illuminatePoint, p) || RegionModel::Point::Comparator()(p, illuminatePoint)) { + paint.setPen(QPen(getForegroundQColor(v), 1)); paint.drawLine(x, 0, x, v->height()); paint.setPen(Qt::NoPen); @@ -854,7 +928,7 @@ paint.setPen(QPen(getForegroundQColor(v), 2)); } - paint.drawRect(x, 0, ex - x, v->height() + 1); + paint.drawRect(x, -1, ex - x, v->height() + 2); } else { Modified: sonic-visualiser/trunk/layer/RegionLayer.h =================================================================== --- sonic-visualiser/trunk/layer/RegionLayer.h 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/layer/RegionLayer.h 2010-07-08 14:22:28 UTC (rev 1726) @@ -42,6 +42,9 @@ virtual bool snapToFeatureFrame(View *v, int &frame, size_t &resolution, SnapType snap) const; + virtual bool snapToSimilarFeature(View *v, int &frame, + size_t &resolution, + SnapType snap) const; virtual void drawStart(View *v, QMouseEvent *); virtual void drawDrag(View *v, QMouseEvent *); Modified: sonic-visualiser/trunk/layer/TimeValueLayer.cpp =================================================================== --- sonic-visualiser/trunk/layer/TimeValueLayer.cpp 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/layer/TimeValueLayer.cpp 2010-07-08 14:22:28 UTC (rev 1726) @@ -1072,6 +1072,8 @@ if (nx <= x) continue; + paint.setPen(QPen(getForegroundQColor(v), 2)); + if (illuminateFrame != p.frame) { if (!m_drawSegmentDivisions || nx < x + 5 || Modified: sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp =================================================================== --- sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/widgets/CSVFormatDialog.cpp 2010-07-08 14:22:28 UTC (rev 1726) @@ -31,6 +31,7 @@ QDialog(parent), m_modelType(CSVFormat::OneDimensionalModel), m_timingType(CSVFormat::ExplicitTiming), + m_durationType(CSVFormat::Durations), m_timeUnits(CSVFormat::TimeAudioFrames), m_separator(""), m_behaviour(QString::KeepEmptyParts) @@ -40,6 +41,7 @@ m_modelType = format.getModelType(); m_timingType = format.getTimingType(); + m_durationType = format.getDurationType(); m_timeUnits = format.getTimeUnits(); m_separator = format.getSeparator(); m_sampleRate = format.getSampleRate(); @@ -58,6 +60,7 @@ m_modelTypeCombo = new QComboBox; m_modelTypeCombo->addItem(tr("A point in time")); m_modelTypeCombo->addItem(tr("A value at a time")); + m_modelTypeCombo->addItem(tr("A value across a time range")); m_modelTypeCombo->addItem(tr("A set of values")); layout->addWidget(m_modelTypeCombo, 1, 1, 1, 2); connect(m_modelTypeCombo, SIGNAL(activated(int)), @@ -76,8 +79,19 @@ m_timingTypeCombo->setCurrentIndex(m_timingType == CSVFormat::ExplicitTiming ? m_timeUnits == CSVFormat::TimeSeconds ? 0 : 1 : 2); + m_durationTypeLabel = new QLabel(tr("The second column contains:")); + layout->addWidget(m_durationTypeLabel, 3, 0); + + m_durationTypeCombo = new QComboBox; + m_durationTypeCombo->addItem(tr("Duration")); + m_durationTypeCombo->addItem(tr("End time")); + layout->addWidget(m_durationTypeCombo, 3, 1, 1, 2); + connect(m_durationTypeCombo, SIGNAL(activated(int)), + this, SLOT(durationTypeChanged(int))); + m_durationTypeCombo->setCurrentIndex(int(m_durationType)); + m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):")); - layout->addWidget(m_sampleRateLabel, 3, 0); + layout->addWidget(m_sampleRateLabel, 4, 0); size_t sampleRates[] = { 8000, 11025, 12000, 22050, 24000, 32000, @@ -92,14 +106,14 @@ } m_sampleRateCombo->setEditable(true); - layout->addWidget(m_sampleRateCombo, 3, 1); + layout->addWidget(m_sampleRateCombo, 4, 1); connect(m_sampleRateCombo, SIGNAL(activated(QString)), this, SLOT(sampleRateChanged(QString))); connect(m_sampleRateCombo, SIGNAL(editTextChanged(QString)), this, SLOT(sampleRateChanged(QString))); m_windowSizeLabel = new QLabel(tr("Frame increment between rows:")); - layout->addWidget(m_windowSizeLabel, 4, 0); + layout->addWidget(m_windowSizeLabel, 5, 0); m_windowSizeCombo = new QComboBox; m_windowSize = 1024; @@ -110,30 +124,32 @@ } m_windowSizeCombo->setEditable(true); - layout->addWidget(m_windowSizeCombo, 4, 1); + layout->addWidget(m_windowSizeCombo, 5, 1); connect(m_windowSizeCombo, SIGNAL(activated(QString)), this, SLOT(windowSizeChanged(QString))); connect(m_windowSizeCombo, SIGNAL(editTextChanged(QString)), this, SLOT(windowSizeChanged(QString))); - layout->addWidget(new QLabel(tr("\nExample data from file:")), 5, 0, 1, 4); + layout->addWidget(new QLabel(tr("\nExample data from file:")), 6, 0, 1, 4); m_exampleWidget = new QTableWidget (std::min(10, m_example.size()), m_maxExampleCols); - layout->addWidget(m_exampleWidget, 6, 0, 1, 4); + layout->addWidget(m_exampleWidget, 7, 0, 1, 4); layout->setColumnStretch(3, 10); layout->setRowStretch(6, 10); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - layout->addWidget(bb, 7, 0, 1, 4); + layout->addWidget(bb, 8, 0, 1, 4); connect(bb, SIGNAL(accepted()), this, SLOT(accept())); connect(bb, SIGNAL(rejected()), this, SLOT(reject())); setLayout(layout); + modelTypeChanged(m_modelTypeCombo->currentIndex()); timingTypeChanged(m_timingTypeCombo->currentIndex()); + durationTypeChanged(m_durationTypeCombo->currentIndex()); } CSVFormatDialog::~CSVFormatDialog() @@ -146,6 +162,7 @@ CSVFormat format; format.setModelType(m_modelType); format.setTimingType(m_timingType); + format.setDurationType(m_durationType); format.setTimeUnits(m_timeUnits); format.setSeparator(m_separator); format.setSampleRate(m_sampleRate); @@ -192,12 +209,13 @@ { m_modelType = (CSVFormat::ModelType)type; -// if (m_modelType == CSVFormat::ThreeDimensionalModel) { - // We can't load 3d models with explicit timing, because the 3d - // model is dense so we need a fixed sample increment -// m_timingTypeCombo->setCurrentIndex(2); -// timingTypeChanged(2); -// } + if (m_modelType == CSVFormat::TwoDimensionalModelWithDuration) { + m_durationTypeCombo->setEnabled(true); + m_durationTypeLabel->setEnabled(true); + } else { + m_durationTypeCombo->setEnabled(false); + m_durationTypeLabel->setEnabled(false); + } } void @@ -212,10 +230,6 @@ m_sampleRateLabel->setEnabled(false); m_windowSizeCombo->setEnabled(false); m_windowSizeLabel->setEnabled(false); -// if (m_modelType == CSVFormat::ThreeDimensionalModel) { -// m_modelTypeCombo->setCurrentIndex(1); -// modelTypeChanged(1); -// } break; case 1: @@ -225,10 +239,6 @@ m_sampleRateLabel->setEnabled(true); m_windowSizeCombo->setEnabled(false); m_windowSizeLabel->setEnabled(false); -// if (m_modelType == CSVFormat::ThreeDimensionalModel) { -// m_modelTypeCombo->setCurrentIndex(1); -// modelTypeChanged(1); -// } break; case 2: @@ -245,6 +255,12 @@ } void +CSVFormatDialog::durationTypeChanged(int type) +{ + m_durationType = (CSVFormat::DurationType)type; +} + +void CSVFormatDialog::sampleRateChanged(QString rateString) { bool ok = false; Modified: sonic-visualiser/trunk/widgets/CSVFormatDialog.h =================================================================== --- sonic-visualiser/trunk/widgets/CSVFormatDialog.h 2010-07-05 11:54:19 UTC (rev 1725) +++ sonic-visualiser/trunk/widgets/CSVFormatDialog.h 2010-07-08 14:22:28 UTC (rev 1726) @@ -38,12 +38,14 @@ protected slots: void modelTypeChanged(int type); void timingTypeChanged(int type); + void durationTypeChanged(int type); void sampleRateChanged(QString); void windowSizeChanged(QString); protected: CSVFormat::ModelType m_modelType; CSVFormat::TimingType m_timingType; + CSVFormat::DurationType m_durationType; CSVFormat::TimeUnits m_timeUnits; QString m_separator; @@ -58,6 +60,8 @@ QComboBox *m_modelTypeCombo; QComboBox *m_timingTypeCombo; + QLabel *m_durationTypeLabel; + QComboBox *m_durationTypeCombo; QLabel *m_sampleRateLabel; QComboBox *m_sampleRateCombo; QLabel *m_windowSizeLabel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-07-05 11:54:25
|
Revision: 1725 http://sv1.svn.sourceforge.net/sv1/?rev=1725&view=rev Author: cannam Date: 2010-07-05 11:54:19 +0000 (Mon, 05 Jul 2010) Log Message: ----------- * Fix failure to encode entities in label texts Modified Paths: -------------- sonic-visualiser/trunk/data/model/NoteModel.h sonic-visualiser/trunk/data/model/RegionModel.h Modified: sonic-visualiser/trunk/data/model/NoteModel.h =================================================================== --- sonic-visualiser/trunk/data/model/NoteModel.h 2010-06-29 16:32:30 UTC (rev 1724) +++ sonic-visualiser/trunk/data/model/NoteModel.h 2010-07-05 11:54:19 UTC (rev 1725) @@ -56,7 +56,8 @@ { stream << QString("%1<point frame=\"%2\" value=\"%3\" duration=\"%4\" level=\"%5\" label=\"%6\" %7/>\n") - .arg(indent).arg(frame).arg(value).arg(duration).arg(level).arg(label).arg(extraAttributes); + .arg(indent).arg(frame).arg(value).arg(duration).arg(level) + .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes); } QString toDelimitedDataString(QString delimiter, size_t sampleRate) const Modified: sonic-visualiser/trunk/data/model/RegionModel.h =================================================================== --- sonic-visualiser/trunk/data/model/RegionModel.h 2010-06-29 16:32:30 UTC (rev 1724) +++ sonic-visualiser/trunk/data/model/RegionModel.h 2010-07-05 11:54:19 UTC (rev 1725) @@ -55,7 +55,8 @@ { stream << QString("%1<point frame=\"%2\" value=\"%3\" duration=\"%4\" label=\"%5\" %6/>\n") - .arg(indent).arg(frame).arg(value).arg(duration).arg(label).arg(extraAttributes); + .arg(indent).arg(frame).arg(value).arg(duration) + .arg(XmlExportable::encodeEntities(label)).arg(extraAttributes); } QString toDelimitedDataString(QString delimiter, size_t sampleRate) const This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-29 16:32:36
|
Revision: 1724 http://sv1.svn.sourceforge.net/sv1/?rev=1724&view=rev Author: cannam Date: 2010-06-29 16:32:30 +0000 (Tue, 29 Jun 2010) Log Message: ----------- * Update spec file Modified Paths: -------------- sonic-annotator/trunk/sonic-annotator.spec Modified: sonic-annotator/trunk/sonic-annotator.spec =================================================================== --- sonic-annotator/trunk/sonic-annotator.spec 2010-06-29 12:38:32 UTC (rev 1723) +++ sonic-annotator/trunk/sonic-annotator.spec 2010-06-29 16:32:30 UTC (rev 1724) @@ -1,7 +1,7 @@ %define _topdir /home/cannam/rpm/sonic-annotator %define name sonic-annotator %define version 0.6 -%define release svn +%define release svn20100629 BuildRoot: %{_tmppath}/%{name}-buildroot Summary: Sonic Annotator @@ -18,19 +18,25 @@ CSV and RDF/Turtle. %prep -svn co http://sv1.svn.sourceforge.net/svnroot/sv1/sonic-annotator/trunk %{name}-%{version}-%{release} +svn co http://sv1.svn.sourceforge.net/svnroot/sv1/sonic-annotator/trunk . +#%{name}-%{version}-%{release} %build -cd %{name}-%{version}-%{release} -/home/cannam/qt-4.6.3-static-release-nogui/bin/qmake -r +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig +#cd %{name}-%{version}-%{release} +/home/cannam/qt-4.6.2-static/bin/qmake -r "LIBS += -Wl,-Bstatic" "DEFINES += BUILD_STATIC" make %install -cd %{name}-%{version}-%{release} +#cd %{name}-%{version}-%{release} mkdir -p $RPM_BUILD_ROOT/usr/bin install runner/sonic-annotator $RPM_BUILD_ROOT/usr/bin -%files +%clean +rm -rf $RPM_BUILD_ROOT + +%files %defattr(-,root,root) %{_bindir}/sonic-annotator +%doc README COPYING CHANGELOG This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-29 12:43:11
|
Revision: 1723 http://sv1.svn.sourceforge.net/sv1/?rev=1723&view=rev Author: cannam Date: 2010-06-29 12:38:32 +0000 (Tue, 29 Jun 2010) Log Message: ----------- * Add rather flimsy spec file Added Paths: ----------- sonic-annotator/trunk/sonic-annotator.spec Added: sonic-annotator/trunk/sonic-annotator.spec =================================================================== --- sonic-annotator/trunk/sonic-annotator.spec (rev 0) +++ sonic-annotator/trunk/sonic-annotator.spec 2010-06-29 12:38:32 UTC (rev 1723) @@ -0,0 +1,36 @@ +%define _topdir /home/cannam/rpm/sonic-annotator +%define name sonic-annotator +%define version 0.6 +%define release svn + +BuildRoot: %{_tmppath}/%{name}-buildroot +Summary: Sonic Annotator +License: GPL +Name: %{name} +Group: Sound +Version: %{version} +Release: %{release} + +%description +Sonic Annotator is a utility program for batch feature extraction +from audio files. It runs Vamp audio analysis plugins on audio files, +and can write the result features in a selection of formats including +CSV and RDF/Turtle. + +%prep +svn co http://sv1.svn.sourceforge.net/svnroot/sv1/sonic-annotator/trunk %{name}-%{version}-%{release} + +%build +cd %{name}-%{version}-%{release} +/home/cannam/qt-4.6.3-static-release-nogui/bin/qmake -r +make + +%install +cd %{name}-%{version}-%{release} +mkdir -p $RPM_BUILD_ROOT/usr/bin +install runner/sonic-annotator $RPM_BUILD_ROOT/usr/bin + +%files +%defattr(-,root,root) +%{_bindir}/sonic-annotator + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-22 13:48:07
|
Revision: 1722 http://sv1.svn.sourceforge.net/sv1/?rev=1722&view=rev Author: cannam Date: 2010-06-22 13:48:00 +0000 (Tue, 22 Jun 2010) Log Message: ----------- * Fix problems playing back when the target block size is close to, or greater than, the default ring-buffer size Modified Paths: -------------- sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.cpp sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.h sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp Modified: sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.cpp =================================================================== --- sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.cpp 2010-06-22 09:46:27 UTC (rev 1721) +++ sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.cpp 2010-06-22 13:48:00 UTC (rev 1722) @@ -37,7 +37,7 @@ //#define DEBUG_AUDIO_PLAY_SOURCE 1 //#define DEBUG_AUDIO_PLAY_SOURCE_PLAYING 1 -const size_t AudioCallbackPlaySource::m_ringBufferSize = 131071; +static const size_t DEFAULT_RING_BUFFER_SIZE = 131071; AudioCallbackPlaySource::AudioCallbackPlaySource(ViewManagerBase *manager, QString clientName) : @@ -62,6 +62,7 @@ m_playing(false), m_exiting(false), m_lastModelEndFrame(0), + m_ringBufferSize(DEFAULT_RING_BUFFER_SIZE), m_outputLeft(0.0), m_outputRight(0.0), m_auditioningPlugin(0), @@ -529,9 +530,20 @@ AudioCallbackPlaySource::setTarget(AudioCallbackPlayTarget *target, size_t size) { m_target = target; -// std::cout << "AudioCallbackPlaySource::setTargetBlockSize() -> " << size << std::endl; - assert(size < m_ringBufferSize); - m_blockSize = size; + std::cout << "AudioCallbackPlaySource::setTarget: Block size -> " << size << std::endl; + if (size != 0) { + m_blockSize = size; + } + if (size * 4 > m_ringBufferSize) { + std::cerr << "AudioCallbackPlaySource::setTarget: Buffer size " + << size << " > a quarter of ring buffer size " + << m_ringBufferSize << ", calling for more ring buffer" + << std::endl; + m_ringBufferSize = size * 4; + if (m_writeBuffers && !m_writeBuffers->empty()) { + clearRingBuffers(); + } + } } size_t @@ -684,6 +696,7 @@ RealTime playing_t = bufferedto_t - latency_t - stretchlat_t - lastretrieved_t - inbuffer_t + sincerequest_t; + if (playing_t < RealTime::zeroTime) playing_t = RealTime::zeroTime; size_t frame = RealTime::realTime2Frame(playing_t, sourceRate); return m_viewManager->alignPlaybackFrameToReference(frame); } @@ -1033,6 +1046,9 @@ int count = ucount; if (!m_playing) { +#ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING + std::cerr << "AudioCallbackPlaySource::getSourceSamples: Not playing" << std::endl; +#endif for (size_t ch = 0; ch < getTargetChannelCount(); ++ch) { for (int i = 0; i < count; ++i) { buffer[ch][i] = 0.0; @@ -1061,7 +1077,9 @@ #ifdef DEBUG_AUDIO_PLAY_SOURCE std::cerr << "WARNING: AudioCallbackPlaySource::getSourceSamples: " << "Ring buffer for channel " << ch << " has only " - << rs << " (of " << count << ") samples available, " + << rs << " (of " << count << ") samples available (" + << "ring buffer size is " << rb->getSize() << ", write " + << "space " << rb->getWriteSpace() << "), " << "reducing request size" << std::endl; #endif count = rs; @@ -1297,6 +1315,9 @@ bool readWriteEqual = (m_readBuffers == m_writeBuffers); #ifdef DEBUG_AUDIO_PLAY_SOURCE + if (!readWriteEqual) { + std::cout << "AudioCallbackPlaySourceFillThread: note read buffers != write buffers" << std::endl; + } std::cout << "AudioCallbackPlaySourceFillThread: filling " << space << " frames" << std::endl; #endif @@ -1665,6 +1686,9 @@ m_lastModelEndFrame) { // OK, we don't have enough and there's more to // read -- don't unify until we can do better +#ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING + std::cerr << "AudioCallbackPlaySource::unifyRingBuffers: Not unifying: write buffer has less (" << wb->getReadSpace() << ") than " << m_blockSize*2 << " to read and write buffer fill (" << m_writeBufferFill << ") is not close to end frame (" << m_lastModelEndFrame << ")" << std::endl; +#endif return; } } @@ -1682,7 +1706,9 @@ else rf = 0; } - //std::cout << "m_readBufferFill = " << m_readBufferFill << ", rf = " << rf << ", m_writeBufferFill = " << m_writeBufferFill << std::endl; +#ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING + std::cerr << "AudioCallbackPlaySource::unifyRingBuffers: m_readBufferFill = " << m_readBufferFill << ", rf = " << rf << ", m_writeBufferFill = " << m_writeBufferFill << std::endl; +#endif size_t wf = m_writeBufferFill; size_t skip = 0; @@ -1710,7 +1736,9 @@ m_bufferScavenger.claim(m_readBuffers); m_readBuffers = m_writeBuffers; m_readBufferFill = m_writeBufferFill; -// std::cout << "unified" << std::endl; +#ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING + std::cerr << "unified" << std::endl; +#endif } void @@ -1746,7 +1774,8 @@ float ms = 100; if (s.getSourceSampleRate() > 0) { - ms = float(m_ringBufferSize) / float(s.getSourceSampleRate()) * 1000.0; + ms = float(s.m_ringBufferSize) / + float(s.getSourceSampleRate()) * 1000.0; } if (s.m_playing) ms /= 10; Modified: sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.h =================================================================== --- sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.h 2010-06-22 09:46:27 UTC (rev 1721) +++ sonic-visualiser/trunk/audioio/AudioCallbackPlaySource.h 2010-06-22 13:48:00 UTC (rev 1722) @@ -296,7 +296,7 @@ bool m_playing; bool m_exiting; size_t m_lastModelEndFrame; - static const size_t m_ringBufferSize; + size_t m_ringBufferSize; float m_outputLeft; float m_outputRight; RealTimePluginInstance *m_auditioningPlugin; Modified: sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp =================================================================== --- sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp 2010-06-22 09:46:27 UTC (rev 1721) +++ sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp 2010-06-22 13:48:00 UTC (rev 1722) @@ -158,19 +158,11 @@ QMutexLocker locker(&m_mutex); - if (m_source->getTargetPlayLatency() == 0) { //!!! need better test - //!!! - pa_usec_t latency = 0; - int negative = 0; - if (pa_stream_get_latency(m_stream, &latency, &negative)) { - std::cerr << "AudioPulseAudioTarget::streamWrite: Failed to query latency" << std::endl; - } -// std::cerr << "Latency = " << latency << " usec" << std::endl; - int latframes = (latency / 1000000.f) * float(m_sampleRate); -// std::cerr << "that's " << latframes << " frames" << std::endl; - if (latframes > 0) { - m_source->setTargetPlayLatency(latframes); //!!! buh - } + pa_usec_t latency = 0; + int negative = 0; + if (!pa_stream_get_latency(m_stream, &latency, &negative)) { + int latframes = (latency / 1000000.f) * float(m_sampleRate); + if (latframes > 0) m_source->setTargetPlayLatency(latframes); } static float *output = 0; @@ -324,13 +316,14 @@ std::cerr << "AudioPulseAudioTarget::streamStateChanged: Cannot query stream buffer attributes" << std::endl; m_source->setTarget(this, m_bufferSize); m_source->setTargetSampleRate(m_sampleRate); - m_source->setTargetPlayLatency(latframes); + if (latframes != 0) m_source->setTargetPlayLatency(latframes); } else { - std::cerr << "AudioPulseAudioTarget::streamStateChanged: stream max length = " << attr->maxlength << std::endl; - int latency = attr->tlength; - std::cerr << "latency = " << latency << std::endl; - m_source->setTarget(this, attr->maxlength); + int targetLength = attr->tlength; + std::cerr << "AudioPulseAudioTarget::streamStateChanged: stream target length = " << targetLength << std::endl; + m_source->setTarget(this, targetLength); m_source->setTargetSampleRate(m_sampleRate); + if (latframes == 0) latframes = targetLength; + std::cerr << "latency = " << latframes << std::endl; m_source->setTargetPlayLatency(latframes); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-22 09:46:33
|
Revision: 1721 http://sv1.svn.sourceforge.net/sv1/?rev=1721&view=rev Author: cannam Date: 2010-06-22 09:46:27 +0000 (Tue, 22 Jun 2010) Log Message: ----------- * Separator in RMB layer menu Modified Paths: -------------- sonic-visualiser/trunk/sv/main/MainWindow.cpp Modified: sonic-visualiser/trunk/sv/main/MainWindow.cpp =================================================================== --- sonic-visualiser/trunk/sv/main/MainWindow.cpp 2010-06-22 09:46:00 UTC (rev 1720) +++ sonic-visualiser/trunk/sv/main/MainWindow.cpp 2010-06-22 09:46:27 UTC (rev 1721) @@ -1187,6 +1187,8 @@ } } + m_rightButtonLayerMenu->addSeparator(); + menu = m_paneMenu; menu->addSeparator(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-22 09:46:06
|
Revision: 1720 http://sv1.svn.sourceforge.net/sv1/?rev=1720&view=rev Author: cannam Date: 2010-06-22 09:46:00 +0000 (Tue, 22 Jun 2010) Log Message: ----------- * Another necessary library Modified Paths: -------------- sonic-visualiser/trunk/INSTALL.ubuntu Modified: sonic-visualiser/trunk/INSTALL.ubuntu =================================================================== --- sonic-visualiser/trunk/INSTALL.ubuntu 2010-06-22 09:45:42 UTC (rev 1719) +++ sonic-visualiser/trunk/INSTALL.ubuntu 2010-06-22 09:46:00 UTC (rev 1720) @@ -11,7 +11,7 @@ $ cd sonic-visualiser $ sudo apt-get update -$ sudo apt-get install build-essential libqt4-dev libsndfile-dev libsamplerate-dev fftw3-dev libbz2-dev libjack-dev libasound-dev libmad0-dev liboggz-dev libfishsound-dev liblo-dev liblrdf-dev portaudio19-dev libpulse-dev librdf-dev librubberband-dev vamp-plugin-sdk +$ sudo apt-get install build-essential libqt4-dev libsndfile-dev libsamplerate-dev fftw3-dev libbz2-dev libjack-dev libasound-dev libmad0-dev libid3tag0-dev liboggz-dev libfishsound-dev liblo-dev liblrdf-dev portaudio19-dev libpulse-dev librdf-dev librubberband-dev vamp-plugin-sdk $ qmake-qt4 $ make This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-22 09:45:48
|
Revision: 1719 http://sv1.svn.sourceforge.net/sv1/?rev=1719&view=rev Author: cannam Date: 2010-06-22 09:45:42 +0000 (Tue, 22 Jun 2010) Log Message: ----------- * Avoid warnings for out of range pixel set at edges Modified Paths: -------------- sonic-visualiser/trunk/layer/SpectrogramLayer.cpp Modified: sonic-visualiser/trunk/layer/SpectrogramLayer.cpp =================================================================== --- sonic-visualiser/trunk/layer/SpectrogramLayer.cpp 2010-06-22 09:45:19 UTC (rev 1718) +++ sonic-visualiser/trunk/layer/SpectrogramLayer.cpp 2010-06-22 09:45:42 UTC (rev 1719) @@ -2582,9 +2582,10 @@ float y = v->getYForFrequency (freq, displayMinFreq, displayMaxFreq, logarithmic); - if (y < 0 || y >= h) continue; + int iy = int(y + 0.5); + if (iy < 0 || iy >= h) continue; - m_drawBuffer.setPixel(x, y, getDisplayValue(v, value)); + m_drawBuffer.setPixel(x, iy, getDisplayValue(v, value)); } if (mag.isSet()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-22 09:45:25
|
Revision: 1718 http://sv1.svn.sourceforge.net/sv1/?rev=1718&view=rev Author: cannam Date: 2010-06-22 09:45:19 +0000 (Tue, 22 Jun 2010) Log Message: ----------- * Avoid setting zero latency on source Modified Paths: -------------- sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp Modified: sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp =================================================================== --- sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp 2010-06-15 14:40:54 UTC (rev 1717) +++ sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp 2010-06-22 09:45:19 UTC (rev 1718) @@ -163,12 +163,14 @@ pa_usec_t latency = 0; int negative = 0; if (pa_stream_get_latency(m_stream, &latency, &negative)) { - std::cerr << "AudioPulseAudioTarget::contextStateChanged: Failed to query latency" << std::endl; + std::cerr << "AudioPulseAudioTarget::streamWrite: Failed to query latency" << std::endl; } // std::cerr << "Latency = " << latency << " usec" << std::endl; int latframes = (latency / 1000000.f) * float(m_sampleRate); // std::cerr << "that's " << latframes << " frames" << std::endl; - m_source->setTargetPlayLatency(latframes); //!!! buh + if (latframes > 0) { + m_source->setTargetPlayLatency(latframes); //!!! buh + } } static float *output = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-15 14:41:06
|
Revision: 1717 http://sv1.svn.sourceforge.net/sv1/?rev=1717&view=rev Author: cannam Date: 2010-06-15 14:40:54 +0000 (Tue, 15 Jun 2010) Log Message: ----------- * Add the spectrogram (etc) layer options (back) to the right-button menu; make them add the relevant layer based on audio data in whichever pane the menu was called up from Modified Paths: -------------- sonic-visualiser/trunk/sv/main/MainWindow.cpp Modified: sonic-visualiser/trunk/sv/main/MainWindow.cpp =================================================================== --- sonic-visualiser/trunk/sv/main/MainWindow.cpp 2010-06-15 14:39:12 UTC (rev 1716) +++ sonic-visualiser/trunk/sv/main/MainWindow.cpp 2010-06-15 14:40:54 UTC (rev 1717) @@ -339,6 +339,17 @@ m_rightButtonMenu->addSeparator(); } + // This will be created (if not found) or cleared (if found) in + // setupPaneAndLayerMenus, but we want to ensure it's created + // sooner so it can go nearer the top of the right button menu + if (m_rightButtonLayerMenu) { + m_rightButtonLayerMenu->clear(); + } else { + m_rightButtonLayerMenu = m_rightButtonMenu->addMenu(tr("&Layer")); + m_rightButtonLayerMenu->setTearOffEnabled(true); + m_rightButtonMenu->addSeparator(); + } + if (!m_mainMenusCreated) { CommandHistory::getInstance()->registerMenu(m_rightButtonMenu); m_rightButtonMenu->addSeparator(); @@ -1054,12 +1065,7 @@ default: break; } - std::vector<Model *> candidateModels; -// if (menuType == paneMenuType) { - candidateModels = models; -// } else { -// candidateModels.push_back(0); -// } + std::vector<Model *> candidateModels = models; for (std::vector<Model *>::iterator mi = candidateModels.begin(); @@ -1084,19 +1090,10 @@ bool isDefault = (c == 0); bool isOnly = (isDefault && (channels == 1)); -// if (menuType == layerMenuType) { -// if (isDefault) isOnly = true; -// else continue; -// } + if (isOnly && !plural) { - if (isOnly && (!plural /*|| menuType == layerMenuType*/)) { + action = new QAction(icon, mainText, this); -// if (menuType == layerMenuType && type != LayerFactory::Waveform) { -// action = new QAction(mainText, this); -// } else { - action = new QAction(icon, mainText, this); -// } - action->setShortcut(shortcutText); action->setStatusTip(tipText); if (menuType == paneMenuType) { @@ -1104,13 +1101,15 @@ this, SLOT(addPane())); connect(this, SIGNAL(canAddPane(bool)), action, SLOT(setEnabled(bool))); - m_paneActions[action] = LayerConfiguration(type); + m_paneActions[action] = + LayerConfiguration(type, model); } else { connect(action, SIGNAL(triggered()), this, SLOT(addLayer())); connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool))); - m_layerActions[action] = LayerConfiguration(type); + m_layerActions[action] = + LayerConfiguration(type, model); } if (shortcutText != "") { m_keyReference->registerShortcut(action); @@ -1172,6 +1171,17 @@ submenu->addAction(action); } + + if (isDefault && menuType == layerMenuType) { + action = new QAction(icon, mainText, this); + action->setStatusTip(tipText); + connect(action, SIGNAL(triggered()), + this, SLOT(addLayer())); + connect(this, SIGNAL(canAddLayer(bool)), + action, SLOT(setEnabled(bool))); + m_layerActions[action] = LayerConfiguration(type, 0, 0); + m_rightButtonLayerMenu->addAction(action); + } } } } @@ -3078,7 +3088,9 @@ } } - if (!model) model = m_document->getMainModel(); + if (!model) { + model = m_document->getMainModel(); + } m_document->setModel(newLayer, model); @@ -3173,19 +3185,39 @@ } else { - if (!i->second.sourceModel) { - // e.g. time ruler - newLayer = m_document->createMainModelLayer(type); - } else { + Model *model = i->second.sourceModel; + + if (!model) { + if (type == LayerFactory::TimeRuler) { + newLayer = m_document->createMainModelLayer(type); + } else { + // if model is unspecified and this is not a + // time-ruler layer, use the topmost plausible + // model from the current pane (if any) -- this is + // the case for right-button menu layer additions + for (int i = pane->getLayerCount(); i > 0; --i) { + Layer *el = pane->getLayer(i-1); + if (el && + el->getModel() && + dynamic_cast<RangeSummarisableTimeValueModel *> + (el->getModel())) { + model = el->getModel(); + } + } + if (!model) model = getMainModel(); + } + } + + if (model) { newLayer = m_document->createLayer(type); - if (m_document->isKnownModel(i->second.sourceModel)) { + if (m_document->isKnownModel(model)) { m_document->setChannel(newLayer, i->second.channel); - m_document->setModel(newLayer, i->second.sourceModel); + m_document->setModel(newLayer, model); } else { std::cerr << "WARNING: MainWindow::addLayer: unknown model " - << i->second.sourceModel + << model << " (\"" - << (i->second.sourceModel ? i->second.sourceModel->objectName().toStdString() : "") + << (model ? model->objectName().toStdString() : "") << "\") in layer action map" << std::endl; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-15 14:39:19
|
Revision: 1716 http://sv1.svn.sourceforge.net/sv1/?rev=1716&view=rev Author: cannam Date: 2010-06-15 14:39:12 +0000 (Tue, 15 Jun 2010) Log Message: ----------- * Add some more dependencies Modified Paths: -------------- sonic-visualiser/trunk/INSTALL.ubuntu Modified: sonic-visualiser/trunk/INSTALL.ubuntu =================================================================== --- sonic-visualiser/trunk/INSTALL.ubuntu 2010-06-15 11:36:02 UTC (rev 1715) +++ sonic-visualiser/trunk/INSTALL.ubuntu 2010-06-15 14:39:12 UTC (rev 1716) @@ -11,7 +11,7 @@ $ cd sonic-visualiser $ sudo apt-get update -$ sudo apt-get install build-essential libqt4-dev libsndfile-dev libsamplerate-dev fftw3-dev libbz2-dev libjack-dev libasound-dev libmad0-dev liboggz-dev libfishsound-dev liblo-dev liblrdf-dev librdf-dev librubberband-dev vamp-plugin-sdk +$ sudo apt-get install build-essential libqt4-dev libsndfile-dev libsamplerate-dev fftw3-dev libbz2-dev libjack-dev libasound-dev libmad0-dev liboggz-dev libfishsound-dev liblo-dev liblrdf-dev portaudio19-dev libpulse-dev librdf-dev librubberband-dev vamp-plugin-sdk $ qmake-qt4 $ make This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ca...@us...> - 2010-06-15 11:36:08
|
Revision: 1715 http://sv1.svn.sourceforge.net/sv1/?rev=1715&view=rev Author: cannam Date: 2010-06-15 11:36:02 +0000 (Tue, 15 Jun 2010) Log Message: ----------- * Move query for latency and other stream attributes from contextStateChanged to streamStateChanged (they did not work previously, as they were trying to query the stream too soon) Modified Paths: -------------- sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp Modified: sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp =================================================================== --- sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp 2010-06-15 10:54:15 UTC (rev 1714) +++ sonic-visualiser/trunk/audioio/AudioPulseAudioTarget.cpp 2010-06-15 11:36:02 UTC (rev 1715) @@ -305,7 +305,33 @@ break; case PA_STREAM_READY: + { std::cerr << "AudioPulseAudioTarget::streamStateChanged: Ready" << std::endl; + + pa_usec_t latency = 0; + int negative = 0; + if (pa_stream_get_latency(m_stream, &latency, &negative)) { + std::cerr << "AudioPulseAudioTarget::streamStateChanged: Failed to query latency" << std::endl; + } + std::cerr << "Latency = " << latency << " usec" << std::endl; + int latframes = (latency / 1000000.f) * float(m_sampleRate); + std::cerr << "that's " << latframes << " frames" << std::endl; + + const pa_buffer_attr *attr; + if (!(attr = pa_stream_get_buffer_attr(m_stream))) { + std::cerr << "AudioPulseAudioTarget::streamStateChanged: Cannot query stream buffer attributes" << std::endl; + m_source->setTarget(this, m_bufferSize); + m_source->setTargetSampleRate(m_sampleRate); + m_source->setTargetPlayLatency(latframes); + } else { + std::cerr << "AudioPulseAudioTarget::streamStateChanged: stream max length = " << attr->maxlength << std::endl; + int latency = attr->tlength; + std::cerr << "latency = " << latency << std::endl; + m_source->setTarget(this, attr->maxlength); + m_source->setTargetSampleRate(m_sampleRate); + m_source->setTargetPlayLatency(latframes); + } + } break; case PA_STREAM_FAILED: @@ -344,7 +370,6 @@ break; case PA_CONTEXT_READY: - { std::cerr << "AudioPulseAudioTarget::contextStateChanged: Ready" << std::endl; @@ -355,7 +380,6 @@ pa_stream_set_write_callback(m_stream, streamWriteStatic, this); pa_stream_set_overflow_callback(m_stream, streamOverflowStatic, this); pa_stream_set_underflow_callback(m_stream, streamUnderflowStatic, this); - if (pa_stream_connect_playback (m_stream, 0, 0, pa_stream_flags_t(PA_STREAM_INTERPOLATE_TIMING | @@ -364,32 +388,7 @@ std::cerr << "AudioPulseAudioTarget: Failed to connect playback stream" << std::endl; } - pa_usec_t latency = 0; - int negative = 0; - if (pa_stream_get_latency(m_stream, &latency, &negative)) { - std::cerr << "AudioPulseAudioTarget::contextStateChanged: Failed to query latency" << std::endl; - } - std::cerr << "Latency = " << latency << " usec" << std::endl; - int latframes = (latency / 1000000.f) * float(m_sampleRate); - std::cerr << "that's " << latframes << " frames" << std::endl; - - const pa_buffer_attr *attr; - if (!(attr = pa_stream_get_buffer_attr(m_stream))) { - std::cerr << "AudioPulseAudioTarget::contextStateChanged: Cannot query stream buffer attributes" << std::endl; - m_source->setTarget(this, 4096); - m_source->setTargetSampleRate(m_sampleRate); - m_source->setTargetPlayLatency(latframes); - } else { - std::cerr << "AudioPulseAudioTarget::contextStateChanged: stream max length = " << attr->maxlength << std::endl; - int latency = attr->tlength; - std::cerr << "latency = " << latency << std::endl; - m_source->setTarget(this, attr->maxlength); - m_source->setTargetSampleRate(m_sampleRate); - m_source->setTargetPlayLatency(latframes); - } - break; - } case PA_CONTEXT_TERMINATED: std::cerr << "AudioPulseAudioTarget::contextStateChanged: Terminated" << std::endl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |