spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit 5b24d780ba4e9638f29f22ee5a62c0a2749a8c77
parent 928dd723ca3f98aa9b013f2f6b0dd7776db61d0c
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Sun, 24 Apr 2016 19:35:54 -0700

Show the stream number in the description

Closes #18.

Diffstat:
Msrc/spek-pipeline.cc | 12++++++++++++
Msrc/spek-pipeline.h | 1+
Msrc/spek-spectrogram.cc | 1+
3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/spek-pipeline.cc b/src/spek-pipeline.cc @@ -25,6 +25,7 @@ struct spek_pipeline { std::unique_ptr<AudioFile> file; std::unique_ptr<FFTPlan> fft; + int stream; int channel; enum window_function window_function; int samples; @@ -62,6 +63,7 @@ static void reader_sync(struct spek_pipeline *p, int pos); struct spek_pipeline * spek_pipeline_open( std::unique_ptr<AudioFile> file, std::unique_ptr<FFTPlan> fft, + int stream, int channel, enum window_function window_function, int samples, @@ -72,6 +74,7 @@ struct spek_pipeline * spek_pipeline_open( spek_pipeline *p = new spek_pipeline(); p->file = std::move(file); p->fft = std::move(fft); + p->stream = stream; p->channel = channel; p->window_function = window_function; p->samples = samples; @@ -268,6 +271,15 @@ std::string spek_pipeline_desc(const struct spek_pipeline *pipeline) auto error_string = std::string(error.utf8_str()); if (desc.empty()) { desc = error_string; + } else if (pipeline->stream < pipeline->file->get_streams()) { + desc = std::string( + wxString::Format( + // TRANSLATORS: first %d is the stream number, second %d is the + // total number of streams, %s is the stream description. + _("Stream %d / %d: %s"), + pipeline->stream + 1, pipeline->file->get_streams(), desc.c_str() + ).utf8_str() + ); } else if (!error_string.empty()) { desc = std::string( // TRANSLATORS: first %s is the error message, second %s is stream description. diff --git a/src/spek-pipeline.h b/src/spek-pipeline.h @@ -20,6 +20,7 @@ typedef void (*spek_pipeline_cb)(int bands, int sample, float *values, void *cb_ struct spek_pipeline * spek_pipeline_open( std::unique_ptr<AudioFile> file, std::unique_ptr<FFTPlan> fft, + int stream, int channel, enum window_function window_function, int samples, diff --git a/src/spek-spectrogram.cc b/src/spek-spectrogram.cc @@ -393,6 +393,7 @@ void SpekSpectrogram::start() this->pipeline = spek_pipeline_open( this->audio->open(std::string(this->path.utf8_str()), this->stream), this->fft->create(this->fft_bits), + this->stream, this->channel, this->window_function, samples,