mirror of https://github.com/odrling/Aegisub
Get color scheme names from the config rather than hardcoding it
Originally committed to SVN as r5948.
This commit is contained in:
parent
598a85c6cd
commit
9cb7b23345
|
@ -763,7 +763,7 @@ void AudioDisplay::ReloadRenderingSettings()
|
|||
{
|
||||
if (OPT_GET("Audio/Spectrum")->GetBool())
|
||||
{
|
||||
AudioSpectrumRenderer *audio_spectrum_renderer = new AudioSpectrumRenderer;
|
||||
AudioSpectrumRenderer *audio_spectrum_renderer = new AudioSpectrumRenderer(OPT_GET("Colour/Audio Display/Spectrum")->GetString());
|
||||
|
||||
int64_t spectrum_quality = OPT_GET("Audio/Renderer/Spectrum/Quality")->GetInt();
|
||||
#ifdef WITH_FFTW
|
||||
|
@ -784,7 +784,7 @@ void AudioDisplay::ReloadRenderingSettings()
|
|||
}
|
||||
else
|
||||
{
|
||||
audio_renderer_provider.reset(new AudioWaveformRenderer);
|
||||
audio_renderer_provider.reset(new AudioWaveformRenderer(OPT_GET("Colour/Audio Display/Waveform")->GetString()));
|
||||
}
|
||||
|
||||
audio_renderer->SetRenderer(audio_renderer_provider.get());
|
||||
|
@ -1199,6 +1199,9 @@ void AudioDisplay::OnAudioOpen(AudioProvider *provider)
|
|||
connections.push_back(controller->AddSelectionChangedListener(&AudioDisplay::OnSelectionChanged, this));
|
||||
connections.push_back(controller->AddStyleRangesChangedListener(&AudioDisplay::OnStyleRangesChanged, this));
|
||||
connections.push_back(OPT_SUB("Audio/Spectrum", &AudioDisplay::ReloadRenderingSettings, this));
|
||||
connections.push_back(OPT_SUB("Colour/Audio Display/Spectrum", &AudioDisplay::ReloadRenderingSettings, this));
|
||||
connections.push_back(OPT_SUB("Colour/Audio Display/Waveform", &AudioDisplay::ReloadRenderingSettings, this));
|
||||
connections.push_back(OPT_SUB("Audio/Renderer/Spectrum/Quality", &AudioDisplay::ReloadRenderingSettings, this));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "fft.h"
|
||||
#endif
|
||||
#include "include/aegisub/audio_provider.h"
|
||||
#include "main.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <libaegisub/log.h>
|
||||
|
@ -105,10 +104,10 @@ public:
|
|||
};
|
||||
|
||||
|
||||
AudioSpectrumRenderer::AudioSpectrumRenderer()
|
||||
: colors_normal(new AudioColorScheme(12, "Icy Blue", AudioStyle_Normal))
|
||||
, colors_selected(new AudioColorScheme(12, "Icy Blue", AudioStyle_Selected))
|
||||
, colors_inactive(new AudioColorScheme(12, "Icy Blue", AudioStyle_Inactive))
|
||||
AudioSpectrumRenderer::AudioSpectrumRenderer(std::string const& color_scheme_name)
|
||||
: colors_normal(new AudioColorScheme(12, color_scheme_name, AudioStyle_Normal))
|
||||
, colors_selected(new AudioColorScheme(12, color_scheme_name, AudioStyle_Selected))
|
||||
, colors_inactive(new AudioColorScheme(12, color_scheme_name, AudioStyle_Inactive))
|
||||
, derivation_size(8)
|
||||
, derivation_dist(8)
|
||||
#ifdef WITH_FFTW
|
||||
|
|
|
@ -121,7 +121,8 @@ class AudioSpectrumRenderer : public AudioRendererBitmapProvider {
|
|||
|
||||
public:
|
||||
/// @brief Constructor
|
||||
AudioSpectrumRenderer();
|
||||
/// @param color_scheme_name Name of the color scheme to use
|
||||
AudioSpectrumRenderer(std::string const& color_scheme_name);
|
||||
|
||||
/// @brief Destructor
|
||||
~AudioSpectrumRenderer();
|
||||
|
|
|
@ -36,24 +36,23 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "audio_renderer_waveform.h"
|
||||
|
||||
#ifndef AGI_PRE
|
||||
#include <algorithm>
|
||||
|
||||
#include <wx/dcmemory.h>
|
||||
#endif
|
||||
|
||||
#include "block_cache.h"
|
||||
#include "include/aegisub/audio_provider.h"
|
||||
#include "audio_colorscheme.h"
|
||||
#include "audio_renderer.h"
|
||||
#include "audio_renderer_waveform.h"
|
||||
#include "block_cache.h"
|
||||
#include "colorspace.h"
|
||||
#include "include/aegisub/audio_provider.h"
|
||||
|
||||
AudioWaveformRenderer::AudioWaveformRenderer()
|
||||
: AudioRendererBitmapProvider()
|
||||
, colors_normal(6, "Icy Blue", AudioStyle_Normal)
|
||||
, colors_selected(6, "Icy Blue", AudioStyle_Selected)
|
||||
, colors_inactive(6, "Icy Blue", AudioStyle_Inactive)
|
||||
AudioWaveformRenderer::AudioWaveformRenderer(std::string const& color_scheme_name)
|
||||
: colors_normal(new AudioColorScheme(6, color_scheme_name, AudioStyle_Normal))
|
||||
, colors_selected(new AudioColorScheme(6, color_scheme_name, AudioStyle_Selected))
|
||||
, colors_inactive(new AudioColorScheme(6, color_scheme_name, AudioStyle_Inactive))
|
||||
, audio_buffer(0)
|
||||
{
|
||||
}
|
||||
|
@ -169,8 +168,8 @@ const AudioColorScheme *AudioWaveformRenderer::GetColorScheme(AudioRenderingStyl
|
|||
{
|
||||
switch (style)
|
||||
{
|
||||
case AudioStyle_Selected: return &colors_selected;
|
||||
case AudioStyle_Inactive: return &colors_inactive;
|
||||
default: return &colors_normal;
|
||||
case AudioStyle_Selected: return colors_selected.get();
|
||||
case AudioStyle_Inactive: return colors_inactive.get();
|
||||
default: return colors_normal.get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,15 +39,21 @@
|
|||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <libaegisub/scoped_ptr.h>
|
||||
|
||||
class AudioColorScheme;
|
||||
|
||||
#include "audio_renderer.h"
|
||||
|
||||
class AudioWaveformRenderer : public AudioRendererBitmapProvider {
|
||||
/// Colour table used for regular rendering
|
||||
AudioColorScheme colors_normal;
|
||||
agi::scoped_ptr<AudioColorScheme> colors_normal;
|
||||
|
||||
/// Colour table used for rendering the audio selection
|
||||
AudioColorScheme colors_selected;
|
||||
agi::scoped_ptr<AudioColorScheme> colors_selected;
|
||||
|
||||
/// Colour table used for rendering inactive lines
|
||||
AudioColorScheme colors_inactive;
|
||||
agi::scoped_ptr<AudioColorScheme> colors_inactive;
|
||||
|
||||
/// Pre-allocated buffer for audio fetched from provider
|
||||
char *audio_buffer;
|
||||
|
@ -60,7 +66,8 @@ class AudioWaveformRenderer : public AudioRendererBitmapProvider {
|
|||
|
||||
public:
|
||||
/// @brief Constructor
|
||||
AudioWaveformRenderer();
|
||||
/// @param color_scheme_name Name of the color scheme to use
|
||||
AudioWaveformRenderer(std::string const& color_scheme_name);
|
||||
|
||||
/// @brief Destructor
|
||||
~AudioWaveformRenderer();
|
||||
|
|
Loading…
Reference in New Issue