mirror of
https://github.com/alexkay/spek.git
synced 2025-04-18 17:37:39 +03:00
parent
6cda85e118
commit
928dd723ca
@ -59,6 +59,9 @@ On OS X use the Command key instead of Ctrl.
|
|||||||
`p`, `P`
|
`p`, `P`
|
||||||
: Change the palette.
|
: Change the palette.
|
||||||
|
|
||||||
|
`s`, `S`
|
||||||
|
: Change the audio stream.
|
||||||
|
|
||||||
`u`, `U`
|
`u`, `U`
|
||||||
: Change the upper limit of the dynamic range in dBFS.
|
: Change the upper limit of the dynamic range in dBFS.
|
||||||
|
|
||||||
|
@ -278,6 +278,11 @@ std::string spek_pipeline_desc(const struct spek_pipeline *pipeline)
|
|||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int spek_pipeline_streams(const struct spek_pipeline *pipeline)
|
||||||
|
{
|
||||||
|
return pipeline->file->get_streams();
|
||||||
|
}
|
||||||
|
|
||||||
int spek_pipeline_channels(const struct spek_pipeline *pipeline)
|
int spek_pipeline_channels(const struct spek_pipeline *pipeline)
|
||||||
{
|
{
|
||||||
return pipeline->file->get_channels();
|
return pipeline->file->get_channels();
|
||||||
|
@ -31,6 +31,7 @@ void spek_pipeline_start(struct spek_pipeline *pipeline);
|
|||||||
void spek_pipeline_close(struct spek_pipeline *pipeline);
|
void spek_pipeline_close(struct spek_pipeline *pipeline);
|
||||||
|
|
||||||
std::string spek_pipeline_desc(const struct spek_pipeline *pipeline);
|
std::string spek_pipeline_desc(const struct spek_pipeline *pipeline);
|
||||||
|
int spek_pipeline_streams(const struct spek_pipeline *pipeline);
|
||||||
int spek_pipeline_channels(const struct spek_pipeline *pipeline);
|
int spek_pipeline_channels(const struct spek_pipeline *pipeline);
|
||||||
double spek_pipeline_duration(const struct spek_pipeline *pipeline);
|
double spek_pipeline_duration(const struct spek_pipeline *pipeline);
|
||||||
int spek_pipeline_sample_rate(const struct spek_pipeline *pipeline);
|
int spek_pipeline_sample_rate(const struct spek_pipeline *pipeline);
|
||||||
|
@ -47,6 +47,8 @@ SpekSpectrogram::SpekSpectrogram(wxFrame *parent) :
|
|||||||
audio(new Audio()), // TODO: refactor
|
audio(new Audio()), // TODO: refactor
|
||||||
fft(new FFT()),
|
fft(new FFT()),
|
||||||
pipeline(NULL),
|
pipeline(NULL),
|
||||||
|
streams(0),
|
||||||
|
stream(0),
|
||||||
channels(0),
|
channels(0),
|
||||||
channel(0),
|
channel(0),
|
||||||
window_function(WINDOW_DEFAULT),
|
window_function(WINDOW_DEFAULT),
|
||||||
@ -74,6 +76,7 @@ SpekSpectrogram::~SpekSpectrogram()
|
|||||||
void SpekSpectrogram::open(const wxString& path)
|
void SpekSpectrogram::open(const wxString& path)
|
||||||
{
|
{
|
||||||
this->path = path;
|
this->path = path;
|
||||||
|
this->stream = 0;
|
||||||
this->channel = 0;
|
this->channel = 0;
|
||||||
start();
|
start();
|
||||||
Refresh();
|
Refresh();
|
||||||
@ -92,10 +95,14 @@ void SpekSpectrogram::on_char(wxKeyEvent& evt)
|
|||||||
{
|
{
|
||||||
switch (evt.GetKeyCode()) {
|
switch (evt.GetKeyCode()) {
|
||||||
case 'c':
|
case 'c':
|
||||||
this->channel = (this->channel + 1) % this->channels;
|
if (this->channels) {
|
||||||
|
this->channel = (this->channel + 1) % this->channels;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
this->channel = (this->channel - 1 + this->channels) % this->channels;
|
if (this->channels) {
|
||||||
|
this->channel = (this->channel - 1 + this->channels) % this->channels;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
this->window_function = (enum window_function) ((this->window_function + 1) % WINDOW_COUNT);
|
this->window_function = (enum window_function) ((this->window_function + 1) % WINDOW_COUNT);
|
||||||
@ -118,6 +125,16 @@ void SpekSpectrogram::on_char(wxKeyEvent& evt)
|
|||||||
this->palette = (enum palette) ((this->palette - 1 + PALETTE_COUNT) % PALETTE_COUNT);
|
this->palette = (enum palette) ((this->palette - 1 + PALETTE_COUNT) % PALETTE_COUNT);
|
||||||
this->create_palette();
|
this->create_palette();
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
if (this->streams) {
|
||||||
|
this->stream = (this->stream + 1) % this->streams;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'S':
|
||||||
|
if (this->streams) {
|
||||||
|
this->stream = (this->stream - 1 + this->streams) % this->streams;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
this->urange = spek_min(this->urange + 1, MAX_RANGE);
|
this->urange = spek_min(this->urange + 1, MAX_RANGE);
|
||||||
break;
|
break;
|
||||||
@ -374,7 +391,7 @@ void SpekSpectrogram::start()
|
|||||||
if (samples > 0) {
|
if (samples > 0) {
|
||||||
this->image.Create(samples, bits_to_bands(this->fft_bits));
|
this->image.Create(samples, bits_to_bands(this->fft_bits));
|
||||||
this->pipeline = spek_pipeline_open(
|
this->pipeline = spek_pipeline_open(
|
||||||
this->audio->open(std::string(this->path.utf8_str()), 0),
|
this->audio->open(std::string(this->path.utf8_str()), this->stream),
|
||||||
this->fft->create(this->fft_bits),
|
this->fft->create(this->fft_bits),
|
||||||
this->channel,
|
this->channel,
|
||||||
this->window_function,
|
this->window_function,
|
||||||
@ -385,6 +402,7 @@ void SpekSpectrogram::start()
|
|||||||
spek_pipeline_start(this->pipeline);
|
spek_pipeline_start(this->pipeline);
|
||||||
// TODO: extract conversion into a utility function.
|
// TODO: extract conversion into a utility function.
|
||||||
this->desc = wxString::FromUTF8(spek_pipeline_desc(this->pipeline).c_str());
|
this->desc = wxString::FromUTF8(spek_pipeline_desc(this->pipeline).c_str());
|
||||||
|
this->streams = spek_pipeline_streams(this->pipeline);
|
||||||
this->channels = spek_pipeline_channels(this->pipeline);
|
this->channels = spek_pipeline_channels(this->pipeline);
|
||||||
this->duration = spek_pipeline_duration(this->pipeline);
|
this->duration = spek_pipeline_duration(this->pipeline);
|
||||||
this->sample_rate = spek_pipeline_sample_rate(this->pipeline);
|
this->sample_rate = spek_pipeline_sample_rate(this->pipeline);
|
||||||
|
@ -35,6 +35,8 @@ private:
|
|||||||
std::unique_ptr<Audio> audio;
|
std::unique_ptr<Audio> audio;
|
||||||
std::unique_ptr<FFT> fft;
|
std::unique_ptr<FFT> fft;
|
||||||
spek_pipeline *pipeline;
|
spek_pipeline *pipeline;
|
||||||
|
int streams;
|
||||||
|
int stream;
|
||||||
int channels;
|
int channels;
|
||||||
int channel;
|
int channel;
|
||||||
enum window_function window_function;
|
enum window_function window_function;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user