Removed now unused Spectrum Invert Selection option (it should possibly be replaced with something else)
Fixed scaling of spectrum to also take FFT size into account Fixed selection drawing in karaoke mode for spectrum Moved syllable texts to top of audio display in karaoke mode Originally committed to SVN as r733.
This commit is contained in:
parent
a88feab986
commit
b3ac7e40cb
6 changed files with 18 additions and 18 deletions
|
@ -368,7 +368,7 @@ void AudioDisplay::UpdateImage(bool weak) {
|
||||||
temptext.Trim(true);
|
temptext.Trim(true);
|
||||||
temptext.Trim(false);
|
temptext.Trim(false);
|
||||||
GetTextExtent(temptext,&tw,&th,NULL,NULL,&curFont);
|
GetTextExtent(temptext,&tw,&th,NULL,NULL,&curFont);
|
||||||
dc.DrawText(temptext,(pos1+pos2-tw)/2,h-th-4);
|
dc.DrawText(temptext,(pos1+pos2-tw)/2,4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) {
|
||||||
|
|
||||||
if (hasSel && spectrumDisplaySelected && selStartCap < selEndCap) {
|
if (hasSel && spectrumDisplaySelected && selStartCap < selEndCap) {
|
||||||
dc.SelectObject(*spectrumDisplaySelected);
|
dc.SelectObject(*spectrumDisplaySelected);
|
||||||
finaldc.Blit(selStart, 0, selEnd-selStart, h, &dc, selStart, 0);
|
finaldc.Blit(selStartCap, 0, selEndCap-selStartCap, h, &dc, selStartCap, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
float *out_r = new float[line_length*2];
|
float *out_r = new float[line_length*2];
|
||||||
float *out_i = new float[line_length*2];
|
float *out_i = new float[line_length*2];
|
||||||
|
|
||||||
FFT fft; // TODO: use FFTW instead?
|
FFT fft; // TODO: use FFTW instead? A wavelet?
|
||||||
|
|
||||||
for (unsigned long i = 0; i < length; ++i) {
|
for (unsigned long i = 0; i < length; ++i) {
|
||||||
provider->GetAudio(raw_sample_data, sample, line_length*2);
|
provider->GetAudio(raw_sample_data, sample, line_length*2);
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
{
|
{
|
||||||
if (i >= start && i-start <= length) {
|
if (i >= start && i-start <= length) {
|
||||||
// Determine which sub-cache this line resides in
|
// Determine which sub-cache this line resides in
|
||||||
int subcache = (i-start) / subcache_length;
|
size_t subcache = (i-start) / subcache_length;
|
||||||
assert(subcache >= 0 && subcache < sub_caches.size());
|
assert(subcache >= 0 && subcache < sub_caches.size());
|
||||||
|
|
||||||
if (!sub_caches[subcache]) {
|
if (!sub_caches[subcache]) {
|
||||||
|
@ -243,6 +243,13 @@ void AudioSpectrum::RenderRange(__int64 range_start, __int64 range_end, bool sel
|
||||||
else
|
else
|
||||||
palette = colours_normal;
|
palette = colours_normal;
|
||||||
|
|
||||||
|
// Some scaling constants
|
||||||
|
const int maxpower = (1 << (16 - 1))*256;
|
||||||
|
|
||||||
|
const double upscale = power_scale * 16384 / line_length;
|
||||||
|
const double onethirdmaxpower = maxpower / 3, twothirdmaxpower = maxpower * 2/3;
|
||||||
|
const double logoverscale = log(maxpower*upscale - twothirdmaxpower);
|
||||||
|
|
||||||
for (unsigned long i = first_line; i <= last_line; ++i) {
|
for (unsigned long i = first_line; i <= last_line; ++i) {
|
||||||
// Handle horizontal compression and don't unneededly re-render columns
|
// Handle horizontal compression and don't unneededly re-render columns
|
||||||
int imgcol = imgleft + imgwidth * (i - first_line) / (last_line - first_line + 1);
|
int imgcol = imgleft + imgwidth * (i - first_line) / (last_line - first_line + 1);
|
||||||
|
@ -251,15 +258,11 @@ void AudioSpectrum::RenderRange(__int64 range_start, __int64 range_end, bool sel
|
||||||
|
|
||||||
AudioSpectrumCache::CacheLine &line = cache->GetLine(i);
|
AudioSpectrumCache::CacheLine &line = cache->GetLine(i);
|
||||||
|
|
||||||
int maxpower = (1 << (16 - 1))*256;
|
|
||||||
|
|
||||||
// Calculate the signal power over frequency
|
// Calculate the signal power over frequency
|
||||||
// "Compressed" scale
|
// "Compressed" scale
|
||||||
double onethirdmaxpower = maxpower / 3, twothirdmaxpower = maxpower * 2/3;
|
for (unsigned int j = 0; j < line_length; j++) {
|
||||||
double logoverscale = log(maxpower*8*power_scale - twothirdmaxpower);
|
|
||||||
for (int j = 0; j < line_length; j++) {
|
|
||||||
// First do a simple linear scale power calculation -- 8 gives a reasonable default scaling
|
// First do a simple linear scale power calculation -- 8 gives a reasonable default scaling
|
||||||
power[j] = line[j] * 8 * power_scale;
|
power[j] = line[j] * upscale;
|
||||||
if (power[j] > maxpower * 2/3) {
|
if (power[j] > maxpower * 2/3) {
|
||||||
double p = power[j] - twothirdmaxpower;
|
double p = power[j] - twothirdmaxpower;
|
||||||
p = log(p) * onethirdmaxpower / logoverscale;
|
p = log(p) * onethirdmaxpower / logoverscale;
|
||||||
|
@ -272,6 +275,7 @@ void AudioSpectrum::RenderRange(__int64 range_start, __int64 range_end, bool sel
|
||||||
img[((imgheight-y-1)*imgpitch+x)*3 + 1] = palette[intensity*3+1]; \
|
img[((imgheight-y-1)*imgpitch+x)*3 + 1] = palette[intensity*3+1]; \
|
||||||
img[((imgheight-y-1)*imgpitch+x)*3 + 2] = palette[intensity*3+2];
|
img[((imgheight-y-1)*imgpitch+x)*3 + 2] = palette[intensity*3+2];
|
||||||
|
|
||||||
|
// Handle horizontal expansion
|
||||||
int next_line_imgcol = imgleft + imgwidth * (i - first_line + 1) / (last_line - first_line + 1);
|
int next_line_imgcol = imgleft + imgwidth * (i - first_line + 1) / (last_line - first_line + 1);
|
||||||
if (next_line_imgcol >= imgpitch)
|
if (next_line_imgcol >= imgpitch)
|
||||||
next_line_imgcol = imgpitch-1;
|
next_line_imgcol = imgpitch-1;
|
||||||
|
|
|
@ -78,6 +78,7 @@ Please visit http://aegisub.net to download latest version
|
||||||
- Fixed loading of SRT and TXT files, which were causing an empty line to appear at the start of the file. (AMZ)
|
- Fixed loading of SRT and TXT files, which were causing an empty line to appear at the start of the file. (AMZ)
|
||||||
- Added options to toggle the display of the audio timeline and of the time over the mouse cursor. (AMZ)
|
- Added options to toggle the display of the audio timeline and of the time over the mouse cursor. (AMZ)
|
||||||
- Destination of screenshots can now be set in the options dialog. (AMZ)
|
- Destination of screenshots can now be set in the options dialog. (AMZ)
|
||||||
|
- Moved karaoke syllable text in audio display to the top instead of bottom, since it often covers important information in spectrum mode (jfs)
|
||||||
|
|
||||||
|
|
||||||
= 1.10 beta - 2006.08.07 ===========================
|
= 1.10 beta - 2006.08.07 ===========================
|
||||||
|
|
|
@ -487,9 +487,9 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
||||||
wxFlexGridSizer *displaySizer4 = new wxFlexGridSizer(14,2,2,2);
|
wxFlexGridSizer *displaySizer4 = new wxFlexGridSizer(14,2,2,2);
|
||||||
|
|
||||||
// First sizer
|
// First sizer
|
||||||
wxString labels1[5] = { _("Spectrum Invert Selection"), _("Draw Secondary Lines"), _("Draw Selection Background"), _("Draw Timeline"), _("Draw Cursor Time") };
|
wxString labels1[4] = { _("Draw Secondary Lines"), _("Draw Selection Background"), _("Draw Timeline"), _("Draw Cursor Time") };
|
||||||
wxString options1[5] = { _T("Spectrum invert selection"), _T("Draw Secondary Lines"), _T("Draw Selection Background") , _T("Draw Timeline"), _T("Draw Cursor Time")};
|
wxString options1[4] = { _T("Draw Secondary Lines"), _T("Draw Selection Background") , _T("Draw Timeline"), _T("Draw Cursor Time")};
|
||||||
for (int i=0;i<5;i++) {
|
for (int i=0;i<4;i++) {
|
||||||
wxCheckBox *control = new wxCheckBox(displayPage,-1,labels1[i]);
|
wxCheckBox *control = new wxCheckBox(displayPage,-1,labels1[i]);
|
||||||
Bind(control,_T("Audio ") + options1[i]);
|
Bind(control,_T("Audio ") + options1[i]);
|
||||||
displaySizer3->Add(control,1,wxEXPAND | wxALL,5);
|
displaySizer3->Add(control,1,wxEXPAND | wxALL,5);
|
||||||
|
|
|
@ -214,7 +214,6 @@ void OptionsManager::LoadDefaults() {
|
||||||
// Audio Cosmetic
|
// Audio Cosmetic
|
||||||
SetModificationType(MOD_AUDIO);
|
SetModificationType(MOD_AUDIO);
|
||||||
SetInt(_T("Audio Line boundaries Thickness"), 2);
|
SetInt(_T("Audio Line boundaries Thickness"), 2);
|
||||||
SetBool(_T("Audio Spectrum invert selection"), true);
|
|
||||||
SetBool(_T("Audio Draw Secondary Lines"), true);
|
SetBool(_T("Audio Draw Secondary Lines"), true);
|
||||||
SetBool(_T("Audio Draw Selection Background"), true);
|
SetBool(_T("Audio Draw Selection Background"), true);
|
||||||
SetBool(_T("Audio Draw Timeline"),true);
|
SetBool(_T("Audio Draw Timeline"),true);
|
||||||
|
|
|
@ -81,8 +81,6 @@ void ToggleBitmap::SetValue(bool _state) {
|
||||||
//////////////
|
//////////////
|
||||||
// Draw image
|
// Draw image
|
||||||
void ToggleBitmap::DrawImage(wxDC &dc) {
|
void ToggleBitmap::DrawImage(wxDC &dc) {
|
||||||
dc.BeginDrawing();
|
|
||||||
|
|
||||||
// Get size
|
// Get size
|
||||||
int w,h;
|
int w,h;
|
||||||
GetClientSize(&w,&h);
|
GetClientSize(&w,&h);
|
||||||
|
@ -105,8 +103,6 @@ void ToggleBitmap::DrawImage(wxDC &dc) {
|
||||||
|
|
||||||
// Draw bitmap
|
// Draw bitmap
|
||||||
dc.DrawBitmap(img,(w-img.GetWidth())/2,(h-img.GetHeight())/2,true);
|
dc.DrawBitmap(img,(w-img.GetWidth())/2,(h-img.GetHeight())/2,true);
|
||||||
|
|
||||||
dc.EndDrawing();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue