mirror of https://github.com/odrling/Aegisub
Kill a lot of old wxLogDebug statements, unused and unloved, and occasionally causing problems for Mac builds.
Originally committed to SVN as r6157.
This commit is contained in:
parent
a8df963b8b
commit
b74b437f08
|
@ -648,7 +648,6 @@ void AssOverrideTag::ParseParameters(const wxString &text) {
|
|||
work = text.SubString(start, i-1);
|
||||
work.Trim(true).Trim(false);
|
||||
paramList.Add(work);
|
||||
//wxLogDebug(_T("Got parameter: %s"), work.c_str());
|
||||
}
|
||||
|
||||
if (i+1 < textlen) {
|
||||
|
|
|
@ -230,7 +230,6 @@ AudioBox::~AudioBox() {
|
|||
////////////
|
||||
// Set file
|
||||
void AudioBox::SetFile(wxString file,bool FromVideo) {
|
||||
wxLogDebug(_T("AudioBox::SetFile(file=%s, FromVideo=%d)"), file.c_str(), FromVideo?1:0);
|
||||
loaded = false;
|
||||
|
||||
if (FromVideo) {
|
||||
|
@ -245,9 +244,7 @@ void AudioBox::SetFile(wxString file,bool FromVideo) {
|
|||
audioName = file;
|
||||
}
|
||||
|
||||
wxLogDebug(_T("AudioBox::SetFile: setting up accelerators in frameMain"));
|
||||
frameMain->SetAccelerators();
|
||||
wxLogDebug(_T("AudioBox::SetFile: returning"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -497,21 +494,16 @@ void AudioBox::OnPlayToEnd(wxCommandEvent &event) {
|
|||
//////////////////
|
||||
// Commit changes
|
||||
void AudioBox::OnCommit(wxCommandEvent &event) {
|
||||
wxLogDebug(_T("AudioBox::OnCommit"));
|
||||
audioDisplay->SetFocus();
|
||||
wxLogDebug(_T("AudioBox::OnCommit: has set focus, now committing changes"));
|
||||
audioDisplay->CommitChanges(true);
|
||||
wxLogDebug(_T("AudioBox::OnCommit: returning"));
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// Toggle karaoke
|
||||
void AudioBox::OnKaraoke(wxCommandEvent &event) {
|
||||
wxLogDebug(_T("AudioBox::OnKaraoke"));
|
||||
audioDisplay->SetFocus();
|
||||
if (karaokeMode) {
|
||||
wxLogDebug(_T("AudioBox::OnKaraoke: karaoke enabled, disabling"));
|
||||
if (audioKaraoke->splitting) {
|
||||
audioKaraoke->EndSplit(false);
|
||||
}
|
||||
|
@ -522,14 +514,12 @@ void AudioBox::OnKaraoke(wxCommandEvent &event) {
|
|||
}
|
||||
|
||||
else {
|
||||
wxLogDebug(_T("AudioBox::OnKaraoke: karaoke disabled, enabling"));
|
||||
karaokeMode = true;
|
||||
audioKaraoke->enabled = true;
|
||||
audioDisplay->SetDialogue();
|
||||
}
|
||||
SetKaraokeButtons();
|
||||
|
||||
wxLogDebug(_T("AudioBox::OnKaraoke: returning"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -564,7 +554,6 @@ void AudioBox::SetKaraokeButtons() {
|
|||
///////////////
|
||||
// Join button
|
||||
void AudioBox::OnJoin(wxCommandEvent &event) {
|
||||
wxLogDebug(_T("AudioBox::OnJoin"));
|
||||
audioDisplay->SetFocus();
|
||||
if (!audioKaraoke->splitting) {
|
||||
audioKaraoke->Join();
|
||||
|
@ -577,7 +566,6 @@ void AudioBox::OnJoin(wxCommandEvent &event) {
|
|||
////////////////
|
||||
// Split button
|
||||
void AudioBox::OnSplit(wxCommandEvent &event) {
|
||||
wxLogDebug(_T("AudioBox::OnSplit"));
|
||||
audioDisplay->SetFocus();
|
||||
if (!audioKaraoke->splitting) {
|
||||
audioKaraoke->BeginSplit();
|
||||
|
|
|
@ -150,7 +150,6 @@ AudioDisplay::~AudioDisplay() {
|
|||
/////////
|
||||
// Reset
|
||||
void AudioDisplay::Reset() {
|
||||
wxLogDebug(_T("AudioDisplay::Reset"));
|
||||
hasSel = false;
|
||||
diagUpdated = false;
|
||||
NeedCommit = false;
|
||||
|
@ -726,7 +725,6 @@ void AudioDisplay::RecreateImage() {
|
|||
/////////////////////////
|
||||
// Make dialogue visible
|
||||
void AudioDisplay::MakeDialogueVisible(bool force) {
|
||||
wxLogDebug(_T("AudioDisplay::MakeDialogueVisible(force=%d)"), force?1:0);
|
||||
// Variables
|
||||
int startShow=0, endShow=0;
|
||||
if (karaoke->enabled) {
|
||||
|
@ -760,7 +758,6 @@ void AudioDisplay::MakeDialogueVisible(bool force) {
|
|||
////////////////
|
||||
// Set position
|
||||
void AudioDisplay::SetPosition(int pos) {
|
||||
wxLogDebug(_T("AudioDisplay::SetPosition(pos=%d)"), pos);
|
||||
Position = pos;
|
||||
PositionSample = pos * samples;
|
||||
UpdateImage();
|
||||
|
@ -849,10 +846,8 @@ void AudioDisplay::SetScale(float _scale) {
|
|||
//////////////////
|
||||
// Load from file
|
||||
void AudioDisplay::SetFile(wxString file) {
|
||||
wxLogDebug(_T("AudioDisplay::SetFile(file=%s)"), file.c_str());
|
||||
// Unload
|
||||
if (file.IsEmpty()) try {
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: file is empty, just closing audio"));
|
||||
try {
|
||||
if (player) player->CloseStream();
|
||||
}
|
||||
|
@ -888,11 +883,9 @@ void AudioDisplay::SetFile(wxString file) {
|
|||
|
||||
// Load
|
||||
else {
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: unloading old file"));
|
||||
SetFile(_T(""));
|
||||
try {
|
||||
// Get provider
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: get audio provider"));
|
||||
bool is_dummy = false;
|
||||
#ifdef _DEBUG
|
||||
if (file == _T("?dummy")) {
|
||||
|
@ -909,7 +902,6 @@ void AudioDisplay::SetFile(wxString file) {
|
|||
#endif
|
||||
|
||||
// Get player
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: get audio player"));
|
||||
player = AudioPlayerFactoryManager::GetAudioPlayer();
|
||||
player->SetDisplayTimer(&UpdateTimer);
|
||||
player->SetProvider(provider);
|
||||
|
@ -918,7 +910,6 @@ void AudioDisplay::SetFile(wxString file) {
|
|||
|
||||
// Add to recent
|
||||
if (!is_dummy) {
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: add to recent"));
|
||||
Options.AddToRecentList(file,_T("Recent aud"));
|
||||
wxFileName fn(file);
|
||||
StandardPaths::SetPathValue(_T("?audio"),fn.GetPath());
|
||||
|
@ -930,7 +921,6 @@ void AudioDisplay::SetFile(wxString file) {
|
|||
catch (AudioProvider::CancelAudioLoadException &) {
|
||||
if (player) { delete player; player = 0; }
|
||||
if (provider) { delete provider; provider = 0; }
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: audio load cancelled"));
|
||||
}
|
||||
catch (const wxChar *e) {
|
||||
if (player) { delete player; player = 0; }
|
||||
|
@ -940,7 +930,6 @@ void AudioDisplay::SetFile(wxString file) {
|
|||
catch (wxString &err) {
|
||||
if (player) { delete player; player = 0; }
|
||||
if (provider) { delete provider; provider = 0; }
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: gotcha!"));
|
||||
wxMessageBox(err,_T("Error loading audio"),wxICON_ERROR | wxOK);
|
||||
}
|
||||
catch (...) {
|
||||
|
@ -955,17 +944,14 @@ void AudioDisplay::SetFile(wxString file) {
|
|||
assert(loaded == (provider != NULL));
|
||||
|
||||
// Set default selection
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: set default selection"));
|
||||
int n = grid->editBox->linen;
|
||||
SetDialogue(grid,grid->GetDialogue(n),n);
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: returning"));
|
||||
}
|
||||
|
||||
|
||||
///////////////////
|
||||
// Load from video
|
||||
void AudioDisplay::SetFromVideo() {
|
||||
wxLogDebug(_T("AudioDisplay::SetFromVideo"));
|
||||
if (VideoContext::Get()->IsLoaded()) {
|
||||
wxString extension = VideoContext::Get()->videoName.Right(4);
|
||||
extension.LowerCase();
|
||||
|
@ -978,7 +964,6 @@ void AudioDisplay::SetFromVideo() {
|
|||
////////////////
|
||||
// Reload audio
|
||||
void AudioDisplay::Reload() {
|
||||
wxLogDebug(_T("AudioDisplay::Reload"));
|
||||
if (provider) SetFile(provider->GetFilename());
|
||||
}
|
||||
|
||||
|
@ -1039,17 +1024,14 @@ int64_t AudioDisplay::GetSampleAtMS(int64_t ms) {
|
|||
////////
|
||||
// Play
|
||||
void AudioDisplay::Play(int start,int end) {
|
||||
wxLogDebug(_T("AudioDisplay::Play"));
|
||||
Stop();
|
||||
|
||||
// Check provider
|
||||
if (!provider) {
|
||||
wxLogDebug(_T("AudioDisplay::Play: no audio provider"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Set defaults
|
||||
wxLogDebug(_T("AudioDisplay::Play: initialising playback"));
|
||||
playingToEnd = end < 0;
|
||||
int64_t num_samples = provider->GetNumSamples();
|
||||
start = GetSampleAtMS(start);
|
||||
|
@ -1068,14 +1050,12 @@ void AudioDisplay::Play(int start,int end) {
|
|||
|
||||
// Call play
|
||||
player->Play(start,end-start);
|
||||
wxLogDebug(_T("AudioDisplay::Play: playback started, returning"));
|
||||
}
|
||||
|
||||
|
||||
////////
|
||||
// Stop
|
||||
void AudioDisplay::Stop() {
|
||||
wxLogDebug(_T("AudioDisplay::Stop"));
|
||||
if (VideoContext::Get()->IsPlaying()) VideoContext::Get()->Stop();
|
||||
if (player) player->Stop();
|
||||
}
|
||||
|
@ -1084,7 +1064,6 @@ void AudioDisplay::Stop() {
|
|||
///////////////////////////
|
||||
// Get samples of dialogue
|
||||
void AudioDisplay::GetTimesDialogue(int &start,int &end) {
|
||||
wxLogDebug(_T("AudioDisplay::GetTimesDialogue"));
|
||||
if (!dialogue) {
|
||||
start = 0;
|
||||
end = 0;
|
||||
|
@ -1099,7 +1078,6 @@ void AudioDisplay::GetTimesDialogue(int &start,int &end) {
|
|||
////////////////////////////
|
||||
// Get samples of selection
|
||||
void AudioDisplay::GetTimesSelection(int &start,int &end) {
|
||||
wxLogDebug(_T("AudioDisplay::GetTimesSelection"));
|
||||
start = 0;
|
||||
end = 0;
|
||||
if (!dialogue) return;
|
||||
|
@ -1123,7 +1101,6 @@ void AudioDisplay::GetTimesSelection(int &start,int &end) {
|
|||
/////////////////////////////
|
||||
// Set the current selection
|
||||
void AudioDisplay::SetSelection(int start, int end) {
|
||||
wxLogDebug(_T("AudioDisplay::SetSelection(start=%d, end=%d)"), start, end);
|
||||
curStartMS = start;
|
||||
curEndMS = end;
|
||||
Update();
|
||||
|
@ -1133,10 +1110,8 @@ void AudioDisplay::SetSelection(int start, int end) {
|
|||
////////////////
|
||||
// Set dialogue
|
||||
void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
||||
wxLogDebug(_T("AudioDisplay::SetDialogue"));
|
||||
// Actual parameters
|
||||
if (_grid) {
|
||||
wxLogDebug(_T("AudioDisplay::SetDialogue: has grid"));
|
||||
// Set variables
|
||||
grid = _grid;
|
||||
line_n = n;
|
||||
|
@ -1148,7 +1123,6 @@ void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
|||
|
||||
// Set times
|
||||
if (dialogue && !dontReadTimes && Options.AsBool(_T("Audio grab times on select"))) {
|
||||
wxLogDebug(_T("AudioDisplay::SetDialogue: grabbing times"));
|
||||
int s = dialogue->Start.GetMS();
|
||||
int e = dialogue->End.GetMS();
|
||||
|
||||
|
@ -1162,25 +1136,21 @@ void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
|||
|
||||
// Read karaoke data
|
||||
if (dialogue && karaoke->enabled) {
|
||||
wxLogDebug(_T("AudioDisplay::SetDialogue: in karaoke mode, loading new line into karaoke control"));
|
||||
NeedCommit = karaoke->LoadFromDialogue(dialogue);
|
||||
|
||||
// Reset karaoke pos
|
||||
wxLogDebug(_T("AudioDisplay::SetDialogue: resetting karaoke position"));
|
||||
if (karaoke->curSyllable == -1) karaoke->SetSyllable((int)karaoke->syllables.size()-1);
|
||||
else karaoke->SetSyllable(0);
|
||||
}
|
||||
|
||||
// Update
|
||||
Update();
|
||||
wxLogDebug(_T("AudioDisplay::SetDialogue: returning"));
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// Commit changes
|
||||
void AudioDisplay::CommitChanges (bool nextLine) {
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges(nextLine=%d)"), nextLine?1:0);
|
||||
// Loaded?
|
||||
if (!loaded) return;
|
||||
|
||||
|
@ -1197,7 +1167,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
|||
// Update karaoke
|
||||
int karaSelStart = 0, karaSelEnd = -1;
|
||||
if (karaoke->enabled) {
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges: karaoke enabled, committing it"));
|
||||
wasKaraSplitting = karaoke->splitting;
|
||||
karaoke->Commit();
|
||||
// Get karaoke selection
|
||||
|
@ -1208,7 +1177,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
|||
if ((signed)k > karaSelEnd) karaSelEnd = k;
|
||||
}
|
||||
}
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges: karaSelStart=%d karaSelEnd=%d"), karaSelStart, karaSelEnd);
|
||||
}
|
||||
|
||||
// Get selected rows
|
||||
|
@ -1216,7 +1184,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
|||
|
||||
// Commit ok?
|
||||
if (validCommit) {
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges: valid commit"));
|
||||
// Reset flags
|
||||
diagUpdated = false;
|
||||
NeedCommit = false;
|
||||
|
@ -1241,13 +1208,11 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
|||
}
|
||||
|
||||
// Update edit box
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges: updating time edit boxes"));
|
||||
grid->editBox->StartTime->Update();
|
||||
grid->editBox->EndTime->Update();
|
||||
grid->editBox->Duration->Update();
|
||||
|
||||
// Update grid
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges: update grid"));
|
||||
grid->editBox->Update(!karaoke->enabled);
|
||||
grid->ass->FlagAsModified(_T(""));
|
||||
grid->CommitChanges();
|
||||
|
@ -1257,11 +1222,9 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
|||
|
||||
// Next line (ugh what a condition, can this be simplified?)
|
||||
if (nextLine && !karaoke->enabled && Options.AsBool(_T("Audio Next Line on Commit")) && !wasKaraSplitting) {
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges: going to next line"));
|
||||
// Insert a line if it doesn't exist
|
||||
int nrows = grid->GetRows();
|
||||
if (nrows == line_n + 1) {
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges: was on last line, inserting new"));
|
||||
AssDialogue *def = new AssDialogue;
|
||||
def->Start = grid->GetDialogue(line_n)->End;
|
||||
def->End = grid->GetDialogue(line_n)->End;
|
||||
|
@ -1287,7 +1250,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
|||
}
|
||||
|
||||
Update();
|
||||
wxLogDebug(_T("AudioDisplay::CommitChanges: returning"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2247,9 +2209,7 @@ void AudioDisplay::OnKeyDown(wxKeyEvent &event) {
|
|||
///////////////
|
||||
// Change line
|
||||
void AudioDisplay::ChangeLine(int delta, bool block) {
|
||||
wxLogDebug(_T("AudioDisplay::ChangeLine(delta=%d)"), delta);
|
||||
if (dialogue) {
|
||||
wxLogDebug(_T("AudioDisplay::ChangeLine: has dialogue"));
|
||||
// Get next line number and make sure it's within bounds
|
||||
int next;
|
||||
if (block && grid->IsInSelection(line_n)) next = grid->GetLastSelRow()+delta;
|
||||
|
@ -2257,7 +2217,6 @@ void AudioDisplay::ChangeLine(int delta, bool block) {
|
|||
|
||||
if (next == -1) next = 0;
|
||||
if (next == grid->GetRows()) next = grid->GetRows() - 1;
|
||||
wxLogDebug(_T("AudioDisplay::ChangeLine: next=%i"), next);
|
||||
|
||||
// Set stuff
|
||||
NeedCommit = false;
|
||||
|
@ -2269,40 +2228,33 @@ void AudioDisplay::ChangeLine(int delta, bool block) {
|
|||
else UpdateImage(false);
|
||||
line_n = next;
|
||||
}
|
||||
wxLogDebug(_T("AudioDisplay::ChangeLine: returning"));
|
||||
}
|
||||
|
||||
|
||||
////////
|
||||
// Next
|
||||
void AudioDisplay::Next(bool play) {
|
||||
wxLogDebug(_T("AudioDisplay::Next"));
|
||||
// Karaoke
|
||||
if (karaoke->enabled) {
|
||||
wxLogDebug(_T("AudioDisplay::Next: karaoke enables, going to next syllable"));
|
||||
int nextSyl = karaoke->curSyllable+1;
|
||||
bool needsUpdate = true;
|
||||
|
||||
// Last syllable; jump to next
|
||||
if (nextSyl >= (signed int)karaoke->syllables.size()) {
|
||||
wxLogDebug(_T("AudioDisplay::Next: last syllable on line"));
|
||||
// Already last?
|
||||
if (line_n == grid->GetRows()-1) return;
|
||||
|
||||
if (NeedCommit) {
|
||||
wxLogDebug(_T("AudioDisplay::Next: uncommitted karaoke changes"));
|
||||
int result = wxMessageBox(_("Do you want to commit your changes? If you choose No, they will be discarded."),_("Commit?"),wxYES_NO | wxCANCEL | wxICON_QUESTION);
|
||||
//int result = wxNO;
|
||||
if (result == wxYES) {
|
||||
CommitChanges();
|
||||
}
|
||||
else if (result == wxCANCEL) {
|
||||
wxLogDebug(_T("AudioDisplay::Next: cancelled, returning"));
|
||||
karaoke->curSyllable = (int)karaoke->syllables.size()-1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
wxLogDebug(_T("AudioDisplay::Next: going to next line"));
|
||||
nextSyl = 0;
|
||||
karaoke->curSyllable = 0;
|
||||
ChangeLine(1);
|
||||
|
@ -2310,7 +2262,6 @@ void AudioDisplay::Next(bool play) {
|
|||
}
|
||||
|
||||
// Set syllable
|
||||
wxLogDebug(_T("AudioDisplay::Next: set syllable"));
|
||||
karaoke->SetSyllable(nextSyl);
|
||||
if (needsUpdate) Update();
|
||||
int start=0,end=0;
|
||||
|
@ -2320,50 +2271,40 @@ void AudioDisplay::Next(bool play) {
|
|||
|
||||
// Plain mode
|
||||
else {
|
||||
wxLogDebug(_T("AudioDisplay::Next: going to next line"));
|
||||
ChangeLine(1);
|
||||
}
|
||||
|
||||
wxLogDebug(_T("AudioDisplay::Next: returning"));
|
||||
}
|
||||
|
||||
|
||||
////////////
|
||||
// Previous
|
||||
void AudioDisplay::Prev(bool play) {
|
||||
wxLogDebug(_T("AudioDisplay::Prev"));
|
||||
// Karaoke
|
||||
if (karaoke->enabled) {
|
||||
wxLogDebug(_T("AudioDisplay::Prev: karaoke enabled, going to prev syllable"));
|
||||
int nextSyl = karaoke->curSyllable-1;
|
||||
bool needsUpdate = true;
|
||||
|
||||
// First syllable; jump line
|
||||
if (nextSyl < 0) {
|
||||
wxLogDebug(_T("AudioDisplay::Prev: prev syllable on prev line"));
|
||||
// Already first?
|
||||
if (line_n == 0) return;
|
||||
|
||||
if (NeedCommit) {
|
||||
wxLogDebug(_T("AudioDisplay::Prev: uncommitted karaoke changes"));
|
||||
int result = wxMessageBox(_("Do you want to commit your changes? If you choose No, they will be discarded."),_("Commit?"),wxYES_NO | wxCANCEL);
|
||||
if (result == wxYES) {
|
||||
CommitChanges();
|
||||
}
|
||||
else if (result == wxCANCEL) {
|
||||
karaoke->curSyllable = 0;
|
||||
wxLogDebug(_T("AudioDisplay::Prev: cancelled, returning"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
wxLogDebug(_T("AudioDisplay::Prev: going to prev line"));
|
||||
karaoke->curSyllable = -1;
|
||||
ChangeLine(-1);
|
||||
needsUpdate = false;
|
||||
}
|
||||
|
||||
// Set syllable
|
||||
wxLogDebug(_T("AudioDisplay::Prev: set syllable"));
|
||||
karaoke->SetSyllable(nextSyl);
|
||||
if (needsUpdate) Update();
|
||||
int start=0,end=0;
|
||||
|
@ -2373,11 +2314,8 @@ void AudioDisplay::Prev(bool play) {
|
|||
|
||||
// Plain mode
|
||||
else {
|
||||
wxLogDebug(_T("AudioDisplay::Prev: going to prev line"));
|
||||
ChangeLine(-1);
|
||||
}
|
||||
|
||||
wxLogDebug(_T("AudioDisplay::Prev: returning"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ AudioKaraokeSyllable::AudioKaraokeSyllable(const AssKaraokeSyllable &base)
|
|||
AudioKaraoke::AudioKaraoke(wxWindow *parent)
|
||||
: wxWindow (parent,-1,wxDefaultPosition,wxSize(10,5),wxTAB_TRAVERSAL|wxBORDER_SUNKEN)
|
||||
{
|
||||
wxLogDebug(_T("AudioKaraoke constructor"));
|
||||
enabled = false;
|
||||
splitting = false;
|
||||
split_cursor_syl = -1;
|
||||
|
@ -96,10 +95,8 @@ AudioKaraoke::~AudioKaraoke() {
|
|||
//////////////////////
|
||||
// Load from dialogue
|
||||
bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
|
||||
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue(diag=%p)"), _diag);
|
||||
// Make sure we're not in splitting-mode
|
||||
if (splitting) {
|
||||
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: is splitting, discarding splits"));
|
||||
// Discard any splits and leave split-mode
|
||||
EndSplit(false);
|
||||
}
|
||||
|
@ -108,13 +105,11 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
|
|||
delete workDiag;
|
||||
diag = _diag;
|
||||
if (!diag) {
|
||||
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: no diag, refreshing and returning false"));
|
||||
Refresh(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Split
|
||||
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: split"));
|
||||
workDiag = new AssDialogue(diag->GetEntryData(), false);
|
||||
workDiag->ParseASSTags();
|
||||
must_rebuild = false;
|
||||
|
@ -122,16 +117,10 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
|
|||
|
||||
// No karaoke, autosplit
|
||||
if (!hasKar) {
|
||||
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: no existing karaoke, auto-splitting"));
|
||||
AutoSplit();
|
||||
}
|
||||
|
||||
// Done
|
||||
//if (curSyllable < 0) curSyllable = syllables.size()-1;
|
||||
//if (curSyllable >= (signed) syllables.size()) curSyllable = 0;
|
||||
//SetSelection(curSyllable);
|
||||
//Refresh(false);
|
||||
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: returning %d"), hasKar?0:1);
|
||||
return !hasKar;
|
||||
}
|
||||
|
||||
|
@ -139,17 +128,13 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
|
|||
////////////////////
|
||||
// Writes line back
|
||||
void AudioKaraoke::Commit() {
|
||||
wxLogDebug(_T("AudioKaraoke::Commit"));
|
||||
if (splitting) {
|
||||
wxLogDebug(_T("AudioKaraoke::Commit: splitting, ending split"));
|
||||
EndSplit(true);
|
||||
}
|
||||
wxString finalText = _T("");
|
||||
AudioKaraokeSyllable *syl;
|
||||
size_t n = syllables.size();
|
||||
wxLogDebug(_T("AudioKaraoke::Commit: syllables.size() = %u"), n);
|
||||
if (must_rebuild) {
|
||||
wxLogDebug(_T("AudioKaraoke::Commit: must_rebuild"));
|
||||
workDiag->ClearBlocks();
|
||||
for (size_t i=0;i<n;i++) {
|
||||
syl = &syllables.at(i);
|
||||
|
@ -159,11 +144,8 @@ void AudioKaraoke::Commit() {
|
|||
workDiag->ParseASSTags();
|
||||
diag->Text = finalText;
|
||||
} else {
|
||||
wxLogDebug(_T("AudioKaraoke::Commit: Updating karaoke without rebuild"));
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
wxLogDebug(_T("AudioKaraoke::Commit: Updating syllable %d"), i);
|
||||
syl = &syllables.at(i);
|
||||
wxLogDebug(_T("AudioKaraoke::Commit: Syllable pointer: %p; tagdata pointer: %p; length: %d"), syl, syl->tag, syl->duration);
|
||||
// Some weird people have text before the first karaoke tag on a line.
|
||||
// Check that a karaoke tag actually exists for the (non-)syllable to avoid a crash.
|
||||
if (syl->tag && syl->tag->Params.size()>0)
|
||||
|
@ -171,21 +153,17 @@ void AudioKaraoke::Commit() {
|
|||
// Of course, if the user changed the duration of such a non-syllable, its timing can't be updated and will stay zero.
|
||||
// There is no way to check for that right now, and I can't bother to fix it.
|
||||
}
|
||||
wxLogDebug(_T("AudioKaraoke::Commit: Done updating syllables"));
|
||||
workDiag->UpdateText();
|
||||
workDiag->ClearBlocks();
|
||||
workDiag->ParseASSTags();
|
||||
diag->Text = workDiag->Text;
|
||||
}
|
||||
wxLogDebug(_T("AudioKaraoke::Commit: returning"));
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// Autosplit line
|
||||
void AudioKaraoke::AutoSplit() {
|
||||
wxLogDebug(_T("AudioKaraoke::AutoSplit"));
|
||||
|
||||
// Get lengths
|
||||
int timeLen = (diag->End.GetMS() - diag->Start.GetMS())/10;
|
||||
int letterlen = diag->Text.Length();
|
||||
|
@ -231,8 +209,6 @@ void AudioKaraoke::AutoSplit() {
|
|||
newDiag.Text = newText;
|
||||
newDiag.ParseASSTags();
|
||||
ParseDialogue(&newDiag);
|
||||
|
||||
wxLogDebug(_T("AudioKaraoke::AutoSplit: returning"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,14 +246,12 @@ bool AudioKaraoke::ParseDialogue(AssDialogue *curDiag) {
|
|||
////////////////
|
||||
// Set syllable
|
||||
void AudioKaraoke::SetSyllable(int n) {
|
||||
wxLogDebug(_T("AudioKaraoke::SetSyllable(n=%d)"), n);
|
||||
if (n == -1) n = syllables.size()-1;
|
||||
if (n >= (signed) syllables.size()) n = 0;
|
||||
curSyllable = n;
|
||||
startClickSyl = n;
|
||||
SetSelection(n);
|
||||
Refresh(false);
|
||||
wxLogDebug(_T("AudioKaraoke::SetSyllable: returning"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -481,15 +455,12 @@ void AudioKaraoke::OnMouse(wxMouseEvent &event) {
|
|||
int lastx = 0;
|
||||
split_cursor_syl = syli;
|
||||
for (unsigned int i = 0; i < widths.size(); i++) {
|
||||
//wxLogDebug(_T("rx=%d, lastx=%d, widths[i]=%d, i=%d, widths.size()=%d, syli=%d"), rx, lastx, widths[i], i, widths.size(), syli);
|
||||
if (lastx - rx < widths[i] - rx) {
|
||||
if (rx - lastx < widths[i] - rx) {
|
||||
//wxLogDebug(_T("Found at PREV!"));
|
||||
split_cursor_x = lastx;
|
||||
split_cursor_char = i - 1;
|
||||
break;
|
||||
} else if (rx < widths[i]) {
|
||||
//wxLogDebug(_T("Found at CURRENT!"));
|
||||
split_cursor_x = widths[i];
|
||||
split_cursor_char = i;
|
||||
break;
|
||||
|
@ -500,7 +471,6 @@ void AudioKaraoke::OnMouse(wxMouseEvent &event) {
|
|||
// If no split-point was caught by the for-loop, it must be over the last character,
|
||||
// ie. split at next-to-last position
|
||||
if (split_cursor_x < 0) {
|
||||
//wxLogDebug(_T("Emergency picking LAST!"));
|
||||
split_cursor_x = widths[widths.size()-1];
|
||||
split_cursor_char = widths.size() - 1;
|
||||
}
|
||||
|
@ -508,12 +478,10 @@ void AudioKaraoke::OnMouse(wxMouseEvent &event) {
|
|||
|
||||
// Do something if there was a click and we're at a valid position
|
||||
if (event.LeftDown() && split_cursor_char >= -1) {
|
||||
//wxLogDebug(_T("A click!"));
|
||||
int num_removed = 0;
|
||||
std::vector<int>::iterator i = syl.pending_splits.begin();
|
||||
while (i != syl.pending_splits.end()) {
|
||||
if (split_cursor_char == *i) {
|
||||
//wxLogDebug(_T("Erasing entry"));
|
||||
num_removed++;
|
||||
syl.pending_splits.erase(i);
|
||||
break;
|
||||
|
@ -560,7 +528,6 @@ int AudioKaraoke::GetSylAtX(int x) {
|
|||
/////////////////
|
||||
// Set selection
|
||||
void AudioKaraoke::SetSelection(int start,int end) {
|
||||
wxLogDebug(_T("AudioKaraoke::SetSelection(start=%d, end=%d)"), start, end);
|
||||
// Default end
|
||||
if (end == -1) end = start;
|
||||
|
||||
|
@ -572,7 +539,6 @@ void AudioKaraoke::SetSelection(int start,int end) {
|
|||
max = min;
|
||||
min = temp;
|
||||
}
|
||||
wxLogDebug(_T("AudioKaraoke::SetSelection: min=%d, max=%d"), min, max);
|
||||
|
||||
// Set values
|
||||
bool state;
|
||||
|
@ -585,7 +551,6 @@ void AudioKaraoke::SetSelection(int start,int end) {
|
|||
}
|
||||
curSyllable = min;
|
||||
selectionCount = max-min+1;
|
||||
wxLogDebug(_T("AudioKaraoke::SetSelection: new curSyllable=%d, selectionCount=%d"), curSyllable, selectionCount);
|
||||
|
||||
// Set box buttons
|
||||
box->SetKaraokeButtons();
|
||||
|
@ -595,7 +560,6 @@ void AudioKaraoke::SetSelection(int start,int end) {
|
|||
//////////////////
|
||||
// Join syllables
|
||||
void AudioKaraoke::Join() {
|
||||
wxLogDebug(_T("AudioKaraoke::Join"));
|
||||
// Variables
|
||||
bool gotOne = false;
|
||||
size_t syls = syllables.size();
|
||||
|
@ -605,7 +569,6 @@ void AudioKaraoke::Join() {
|
|||
// Loop
|
||||
for (size_t i=0;i<syls;i++) {
|
||||
curSyl = &syllables.at(i);
|
||||
wxLogDebug(_T("AudioKaraoke::Join: syllable %d, text='%s', unstripped_text='%s', duration=%d"), i, curSyl->text.c_str(), curSyl->unstripped_text.c_str(), curSyl->duration);
|
||||
if (curSyl->selected) {
|
||||
if (!gotOne) {
|
||||
gotOne = true;
|
||||
|
@ -613,7 +576,6 @@ void AudioKaraoke::Join() {
|
|||
}
|
||||
else {
|
||||
AudioKaraokeSyllable &work = syllables.at(first);
|
||||
wxLogDebug(_T("AudioKaraoke::Join: worksyl %d, text='%s', unstripped_text='%s', duration=%d"), i, work.text.c_str(), work.unstripped_text.c_str(), work.duration);
|
||||
work.duration += curSyl->duration;
|
||||
work.text += curSyl->text;
|
||||
work.unstripped_text += curSyl->unstripped_text;
|
||||
|
@ -632,15 +594,12 @@ void AudioKaraoke::Join() {
|
|||
display->NeedCommit = true;
|
||||
display->Update();
|
||||
Refresh(false);
|
||||
|
||||
wxLogDebug(_T("AudioKaraoke::Join: returning"));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Enter splitting-mode
|
||||
void AudioKaraoke::BeginSplit() {
|
||||
wxLogDebug(_T("AudioKaraoke::BeginSplit"));
|
||||
splitting = true;
|
||||
split_cursor_syl = -1;
|
||||
split_cursor_x = -1;
|
||||
|
@ -652,7 +611,6 @@ void AudioKaraoke::BeginSplit() {
|
|||
////////////////////////////////////////////
|
||||
// Leave splitting-mode, committing changes
|
||||
void AudioKaraoke::EndSplit(bool commit) {
|
||||
wxLogDebug(_T("AudioKaraoke::EndSplit(commit=%d)"), commit?1:0);
|
||||
splitting = false;
|
||||
bool hasSplit = false;
|
||||
size_t first_sel = ~0U;
|
||||
|
@ -671,7 +629,6 @@ void AudioKaraoke::EndSplit(bool commit) {
|
|||
|
||||
// Update
|
||||
if (hasSplit) {
|
||||
wxLogDebug(_T("AudioKaraoke::EndSplit: hasSplit"));
|
||||
must_rebuild = true;
|
||||
display->NeedCommit = true;
|
||||
SetSelection(first_sel);
|
||||
|
@ -680,22 +637,17 @@ void AudioKaraoke::EndSplit(bool commit) {
|
|||
// Always redraw, since the display is different in splitting mode
|
||||
box->SetKaraokeButtons();
|
||||
Refresh(false);
|
||||
|
||||
wxLogDebug(_T("AudioKaraoke::EndSplit: returning"));
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Split a syllable using the pending_slits data
|
||||
int AudioKaraoke::SplitSyl (unsigned int n) {
|
||||
wxLogDebug(_T("AudioKaraoke::SplitSyl(n=%u)"), n);
|
||||
|
||||
// Avoid multiple vector resizes (this must be first)
|
||||
syllables.reserve(syllables.size() + syllables[n].pending_splits.size());
|
||||
|
||||
// The syllable we're splitting
|
||||
AudioKaraokeSyllable &basesyl = syllables[n];
|
||||
wxLogDebug(_T("AudioKaraoke::SplitSyl: basesyl. contents='%s' selected=%d"), basesyl.unstripped_text.c_str(), basesyl.selected?1:0);
|
||||
|
||||
// Start by sorting the split points
|
||||
std::sort(basesyl.pending_splits.begin(), basesyl.pending_splits.end());
|
||||
|
@ -725,7 +677,6 @@ int AudioKaraoke::SplitSyl (unsigned int n) {
|
|||
newsyl.start_time = curpos;
|
||||
newsyl.type = basesyl.type;
|
||||
newsyl.selected = false;//basesyl.selected;
|
||||
wxLogDebug(_T("AudioKaraoke::SplitSyl: newsyl. contents='%s' selected=%d"), newsyl.text.c_str(), newsyl.selected?1:0);
|
||||
curpos += newsyl.duration;
|
||||
syllables.insert(syllables.begin()+n+i+1, newsyl);
|
||||
}
|
||||
|
@ -757,7 +708,6 @@ int AudioKaraoke::SplitSyl (unsigned int n) {
|
|||
//////////////////////////////////
|
||||
// Apply delta length to syllable
|
||||
bool AudioKaraoke::SyllableDelta(int n,int delta,int mode) {
|
||||
wxLogDebug(_T("AudioKaraoke::SyllableDelta(n=%d, delta=%d, mode=%d)"), n, delta, mode);
|
||||
// Get syllable and next
|
||||
AudioKaraokeSyllable *curSyl=NULL,*nextSyl=NULL;
|
||||
curSyl = &syllables.at(n);
|
||||
|
@ -774,33 +724,26 @@ bool AudioKaraoke::SyllableDelta(int n,int delta,int mode) {
|
|||
if (len + delta < minLen) delta = minLen-len;
|
||||
if (mode == 0 && nextSyl && (nextSyl->duration - delta) < minLen) delta = nextSyl->duration - minLen;
|
||||
|
||||
wxLogDebug(_T("AudioKaraoke::SyllableDelta: nkar=%d, len=%d, minLen=%d, delta=%d"), nkar, len, minLen, delta);
|
||||
|
||||
// Apply
|
||||
if (delta != 0) {
|
||||
wxLogDebug(_T("AudioKaraoke::SyllableDelta: delta != 0"));
|
||||
curSyl->duration += delta;
|
||||
|
||||
// Normal mode
|
||||
if (mode == 0 && nextSyl) {
|
||||
wxLogDebug(_T("AudioKaraoke::SyllableDelta: normal mode"));
|
||||
nextSyl->duration -= delta;
|
||||
nextSyl->start_time += delta;
|
||||
}
|
||||
|
||||
// Shift mode
|
||||
if (mode == 1) {
|
||||
wxLogDebug(_T("AudioKaraoke::SyllableDelta: shift mode"));
|
||||
for (int i=n+1;i<nkar;i++) {
|
||||
syllables.at(i).start_time += delta;
|
||||
}
|
||||
}
|
||||
|
||||
// Flag update
|
||||
wxLogDebug(_T("AudioKaraoke::SyllableDelta: return true"));
|
||||
return true;
|
||||
}
|
||||
wxLogDebug(_T("AudioKaraoke::SyllableDelta: return false"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -241,8 +241,6 @@ void DirectSoundPlayer2Thread::Run()
|
|||
bfr7->Release();
|
||||
bfr7 = 0;
|
||||
|
||||
//wxLogDebug(_T("DirectSoundPlayer2: Created buffer of %d bytes, supposed to be %d milliseconds or %d frames"), bufSize, WANTED_LATENCY*BUFFER_LENGTH, bufSize/provider->GetBytesPerSample());
|
||||
|
||||
|
||||
// Now we're ready to roll!
|
||||
SetEvent(thread_running);
|
||||
|
@ -292,7 +290,6 @@ void DirectSoundPlayer2Thread::Run()
|
|||
if (SUCCEEDED(bfr->Restore()) &&
|
||||
SUCCEEDED(bfr->Lock(buffer_offset, 0, &buf, &buf_size, 0, 0, DSBLOCK_ENTIREBUFFER)))
|
||||
{
|
||||
//wxLogDebug(_T("DirectSoundPlayer2: Lost and restored buffer"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -222,7 +222,6 @@ void OpenALPlayer::Stop(bool timerToo)
|
|||
|
||||
void OpenALPlayer::FillBuffers(ALsizei count)
|
||||
{
|
||||
wxLogDebug(_T("FillBuffers: count=%d, buffers_free=%d"), count, buffers_free);
|
||||
if (count > buffers_free) count = buffers_free;
|
||||
if (count < 1) count = 1;
|
||||
|
||||
|
@ -235,7 +234,6 @@ void OpenALPlayer::FillBuffers(ALsizei count)
|
|||
ALsizei fill_len = buffer_length;
|
||||
if (fill_len > (ALsizei)(end_frame - cur_frame)) fill_len = (ALsizei)(end_frame - cur_frame);
|
||||
if (fill_len < 0) fill_len = 0;
|
||||
wxLogDebug(_T("buffer_length=%d, fill_len=%d, end_frame-cur_frame=%d"), (int)buffer_length, (int)fill_len, (int)(end_frame-cur_frame));
|
||||
|
||||
if (fill_len > 0)
|
||||
// Get fill_len frames of audio
|
||||
|
@ -263,8 +261,6 @@ void OpenALPlayer::Notify()
|
|||
ALsizei newplayed;
|
||||
alGetSourcei(source, AL_BUFFERS_PROCESSED, &newplayed);
|
||||
|
||||
wxLogDebug(_T("OpenAL Player notify: buffers_played=%d, newplayed=%d, playeddiff=%d"), buffers_played, newplayed);
|
||||
|
||||
if (newplayed > 0) {
|
||||
// Reclaim buffers
|
||||
ALuint *bufs = new ALuint[newplayed];
|
||||
|
@ -285,7 +281,6 @@ void OpenALPlayer::Notify()
|
|||
FillBuffers(newplayed);
|
||||
}
|
||||
|
||||
wxLogDebug(_T("frames played=%d, num frames=%d"), (int)((buffers_played - num_buffers) * buffer_length), (int)(end_frame - start_frame));
|
||||
// Check that all of the selected audio plus one full set of buffers has been queued
|
||||
if ((buffers_played - num_buffers) * buffer_length > (ALsizei)(end_frame - start_frame)) {
|
||||
// Then stop
|
||||
|
|
|
@ -280,8 +280,6 @@ int64_t OSSPlayer::GetCurrentPosition()
|
|||
#else
|
||||
played_frames = pos.samples + pos.fifo_samples;
|
||||
#endif
|
||||
wxLogDebug(_T("OSS player: played_frames %d fifo %d"), played_frames,
|
||||
pos.fifo_samples);
|
||||
if (start_frame + played_frames >= end_frame) {
|
||||
if (displayTimer)
|
||||
displayTimer->Stop();
|
||||
|
@ -294,7 +292,6 @@ int64_t OSSPlayer::GetCurrentPosition()
|
|||
int delay = 0;
|
||||
if (ioctl(dspdev, SNDCTL_DSP_GETODELAY, &delay) >= 0) {
|
||||
delay /= bpf;
|
||||
wxLogDebug(_T("OSS player: cur_frame %d delay %d"), cur_frame, delay);
|
||||
// delay can jitter a bit at the end, detect that
|
||||
if (cur_frame == end_frame && delay < rate / 20) {
|
||||
if (displayTimer)
|
||||
|
@ -338,7 +335,6 @@ wxThread::ExitCode OSSPlayerThread::Entry() {
|
|||
free(buf);
|
||||
parent->cur_frame = parent->end_frame;
|
||||
|
||||
wxLogDebug(_T("OSS player thread dead"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,10 +97,8 @@ void PortAudioPlayer::OpenStream() {
|
|||
|
||||
if (pa_config_default < 0) {
|
||||
pa_device = Pa_GetDefaultOutputDevice();
|
||||
wxLogDebug(_T("PortAudioPlayer::OpenStream Using Default Output Device: %d"), pa_device);
|
||||
} else {
|
||||
pa_device = pa_config_default;
|
||||
wxLogDebug(_T("PortAudioPlayer::OpenStream Using Config Device: %d"), pa_device);
|
||||
}
|
||||
|
||||
pa_output_p.device = pa_device;
|
||||
|
@ -109,7 +107,6 @@ void PortAudioPlayer::OpenStream() {
|
|||
pa_output_p.suggestedLatency = Pa_GetDeviceInfo(pa_device)->defaultLowOutputLatency;
|
||||
pa_output_p.hostApiSpecificStreamInfo = NULL;
|
||||
|
||||
wxLogDebug(_T("PortAudioPlayer::OpenStream Output channels: %d, Latency: %f Sample Rate: %ld\n"),
|
||||
pa_output_p.channelCount, pa_output_p.suggestedLatency, pa_output_p.sampleFormat);
|
||||
|
||||
PaError err = Pa_OpenStream(&stream, NULL, &pa_output_p, provider->GetSampleRate(), 256, paPrimeOutputBuffersUsingStreamCallback, paCallback, this);
|
||||
|
@ -118,7 +115,6 @@ void PortAudioPlayer::OpenStream() {
|
|||
|
||||
const PaHostErrorInfo *pa_err = Pa_GetLastHostErrorInfo();
|
||||
if (pa_err->errorCode != 0) {
|
||||
wxLogDebug(_T("PortAudioPlayer::OpenStream HostError: API: %d, %s (%ld)\n"), pa_err->hostApiType, pa_err->errorText, pa_err->errorCode);
|
||||
}
|
||||
throw wxString(_T("Failed initializing PortAudio stream with error: ") + wxString(Pa_GetErrorText(err),wxConvLocal));
|
||||
}
|
||||
|
@ -143,8 +139,6 @@ void PortAudioPlayer::paStreamFinishedCallback(void *userData) {
|
|||
if (player->displayTimer) {
|
||||
player->displayTimer->Stop();
|
||||
}
|
||||
|
||||
wxLogDebug(_T("PortAudioPlayer::paStreamFinishedCallback Stopping stream."));
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,7 +161,6 @@ void PortAudioPlayer::Play(int64_t start,int64_t count) {
|
|||
err = Pa_SetStreamFinishedCallback(stream, paStreamFinishedCallback);
|
||||
|
||||
if (err != paNoError) {
|
||||
wxLogDebug(_T("PortAudioPlayer::Play Could not set FinishedCallback\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -543,7 +543,6 @@ AudioProvider *CreatePCMAudioProvider(const wxString &filename)
|
|||
}
|
||||
catch (const wxChar *msg) {
|
||||
provider = 0;
|
||||
wxLogDebug(_T("Creating PCM WAV reader failed with message: %s\nProceeding to try other providers."), msg);
|
||||
}
|
||||
|
||||
// Try Sony Wave64
|
||||
|
@ -553,7 +552,6 @@ AudioProvider *CreatePCMAudioProvider(const wxString &filename)
|
|||
}
|
||||
catch (const wxChar *msg) {
|
||||
provider = 0;
|
||||
wxLogDebug(_T("Creating Wave64 reader failed with message: %s\nProceeding to try other providers."), msg);
|
||||
}
|
||||
|
||||
// no providers could be created
|
||||
|
|
|
@ -339,7 +339,6 @@ public:
|
|||
|
||||
void Age()
|
||||
{
|
||||
wxLogDebug(_T("AudioSpectrumCacheManager stats: hits=%u, misses=%u, misses%%=%f, managed lines=%u (max=%u)"), cache_hits, cache_misses, cache_misses/float(cache_hits+cache_misses)*100, cache_root->GetManagedLineCount(), max_lines_cached);
|
||||
|
||||
// 0 means no limit
|
||||
if (max_lines_cached == 0)
|
||||
|
@ -363,7 +362,6 @@ public:
|
|||
// Find the point where we have too many lines cached
|
||||
while (cumulative_lines < max_lines_cached) {
|
||||
if (it == ages.rend()) {
|
||||
wxLogDebug(_T("AudioSpectrumCacheManager done aging did not exceed max_lines_cached"));
|
||||
return;
|
||||
}
|
||||
cumulative_lines += it->num_lines;
|
||||
|
@ -378,7 +376,6 @@ public:
|
|||
cache_root->KillLine(it->first_line);
|
||||
}
|
||||
|
||||
wxLogDebug(_T("AudioSpectrumCacheManager done aging, managed lines now=%u (max=%u)"), cache_root->GetManagedLineCount(), max_lines_cached);
|
||||
assert(cache_root->GetManagedLineCount() < max_lines_cached);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@ namespace Automation4 {
|
|||
|
||||
// LuaStackcheck
|
||||
|
||||
//#ifdef _DEBUG
|
||||
#if 0
|
||||
struct LuaStackcheck {
|
||||
lua_State *L;
|
||||
|
|
|
@ -759,7 +759,6 @@ namespace Automation4 {
|
|||
{
|
||||
LuaAssFile *laf = GetObjPointer(L, 1);
|
||||
delete laf;
|
||||
wxLogDebug(_T(">>gc<< Garbage collected LuaAssFile"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,8 +120,6 @@ namespace Automation4 {
|
|||
hint = _T("");
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
wxLogDebug(_T("created control: '%s', (%d,%d)(%d,%d), '%s'"), name.c_str(), x, y, width, height, hint.c_str());
|
||||
}
|
||||
|
||||
namespace LuaControl {
|
||||
|
@ -570,7 +568,6 @@ nospin:
|
|||
LuaConfigDialog::LuaConfigDialog(lua_State *L, bool include_buttons)
|
||||
: use_buttons(include_buttons)
|
||||
{
|
||||
wxLogDebug(_T("creating LuaConfigDialog, this addr is %p"), this);
|
||||
button_pushed = 0;
|
||||
if (include_buttons) {
|
||||
|
||||
|
@ -676,13 +673,10 @@ badcontrol:
|
|||
if (use_buttons) {
|
||||
wxStdDialogButtonSizer *bs = new wxStdDialogButtonSizer();
|
||||
if (buttons.size() > 0) {
|
||||
wxLogDebug(_T("creating user buttons"));
|
||||
for (size_t i = 0; i < buttons.size(); ++i) {
|
||||
wxLogDebug(_T("button '%s' gets id %d"), buttons[i].c_str(), 1001+(wxWindowID)i);
|
||||
bs->Add(new wxButton(w, 1001+(wxWindowID)i, buttons[i]));
|
||||
}
|
||||
} else {
|
||||
wxLogDebug(_T("creating default buttons"));
|
||||
bs->Add(new wxButton(w, wxID_OK));
|
||||
bs->Add(new wxButton(w, wxID_CANCEL));
|
||||
}
|
||||
|
@ -692,7 +686,6 @@ badcontrol:
|
|||
button_event->button_pushed = &button_pushed;
|
||||
// passing button_event as userdata because wx will then delete it
|
||||
w->Connect(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(LuaConfigDialog::ButtonEventHandler::OnButtonPush), button_event, button_event);
|
||||
wxLogDebug(_T("set event handler, this addr is %p"), this);
|
||||
|
||||
wxBoxSizer *ms = new wxBoxSizer(wxVERTICAL);
|
||||
ms->Add(s, 0, wxBOTTOM, 5);
|
||||
|
@ -709,17 +702,13 @@ badcontrol:
|
|||
{
|
||||
// First read back which button was pressed, if any
|
||||
if (use_buttons) {
|
||||
wxLogDebug(_T("reading back button_pushed"));
|
||||
int btn = button_pushed;
|
||||
if (btn == 0) {
|
||||
wxLogDebug(_T("was zero, cancelled"));
|
||||
// Always cancel/closed
|
||||
lua_pushboolean(L, 0);
|
||||
} else if (buttons.size() == 0 && btn == 1) {
|
||||
wxLogDebug(_T("default buttons, button 1 pushed, Ok button"));
|
||||
lua_pushboolean(L, 1);
|
||||
} else {
|
||||
wxLogDebug(_T("user button: %s"), buttons.at(btn-1).c_str());
|
||||
// button_pushed is index+1 to reserve 0 for Cancel
|
||||
lua_pushstring(L, buttons.at(btn-1).mb_str(wxConvUTF8));
|
||||
}
|
||||
|
@ -793,13 +782,10 @@ badcontrol:
|
|||
// Let button_pushed == 0 mean "cancelled", such that pushing Cancel or closing the dialog
|
||||
// will both result in button_pushed == 0
|
||||
if (evt.GetId() == wxID_OK) {
|
||||
wxLogDebug(_T("was wxID_OK"));
|
||||
*button_pushed = 1;
|
||||
} else if (evt.GetId() == wxID_CANCEL) {
|
||||
wxLogDebug(_T("was wxID_CANCEL"));
|
||||
*button_pushed = 0;
|
||||
} else {
|
||||
wxLogDebug(_T("was user button"));
|
||||
// Therefore, when buttons are numbered from 1001 to 1000+n, make sure to set it to i+1
|
||||
*button_pushed = evt.GetId() - 1000;
|
||||
|
||||
|
@ -809,7 +795,6 @@ badcontrol:
|
|||
if (button) return;
|
||||
evt.SetId(wxID_OK);
|
||||
}
|
||||
wxLogDebug(_T("button_pushed set to %d"), *button_pushed);
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
|
|
|
@ -232,24 +232,19 @@ wxString FFmpegSourceProvider::GetCacheFilename(const wxString& filename)
|
|||
/////////////////////
|
||||
// fire and forget cleaning thread (well, almost)
|
||||
bool FFmpegSourceProvider::CleanCache() {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: attempting to start thread"));
|
||||
|
||||
FFmpegSourceCacheCleaner *CleaningThread = new FFmpegSourceCacheCleaner(this);
|
||||
|
||||
if (CleaningThread->Create() != wxTHREAD_NO_ERROR) {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: thread creation failed"));
|
||||
delete CleaningThread;
|
||||
CleaningThread = NULL;
|
||||
return false;
|
||||
}
|
||||
if (CleaningThread->Run() != wxTHREAD_NO_ERROR) {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: failed to start thread"));
|
||||
delete CleaningThread;
|
||||
CleaningThread = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: thread started successfully"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -265,14 +260,12 @@ FFmpegSourceCacheCleaner::FFmpegSourceCacheCleaner(FFmpegSourceProvider *par) :
|
|||
wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
||||
wxMutexLocker lock(FFmpegSourceProvider::CleaningInProgress);
|
||||
if (!lock.IsOk()) {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: cleaning already in progress, thread exiting"));
|
||||
return (wxThread::ExitCode)1;
|
||||
}
|
||||
|
||||
wxString cachedirname = StandardPaths::DecodePath(_T("?user/ffms2cache/"));
|
||||
wxDir cachedir;
|
||||
if (!cachedir.Open(cachedirname)) {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: couldn't open cache directory %s"), cachedirname.c_str());
|
||||
return (wxThread::ExitCode)1;
|
||||
}
|
||||
|
||||
|
@ -286,7 +279,6 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
|||
int maxfiles = Options.AsInt(_T("FFmpegSource max cache files"));
|
||||
|
||||
if (!cachedir.HasFiles(_T("*.ffindex"))) {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: no index files in cache folder, exiting"));
|
||||
return (wxThread::ExitCode)0;
|
||||
}
|
||||
|
||||
|
@ -300,7 +292,6 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
|||
// unusually paranoid sanity check
|
||||
// (someone might have deleted the file(s) after we did HasFiles() above; does wxDir.Open() lock the dir?)
|
||||
if (!cachedir.GetFirst(&curfn_str, _T("*.ffindex"), wxDIR_FILES)) {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: insanity/race condition/index dir fuckery detected, exiting"));
|
||||
return (wxThread::ExitCode)1;
|
||||
}
|
||||
|
||||
|
@ -320,8 +311,6 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
|||
}
|
||||
|
||||
if (numfiles <= maxfiles && cursize <= maxsize) {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: cache does not need cleaning (maxsize=%d, cursize=%d; maxfiles=%d, numfiles=%d), exiting"),
|
||||
(int)maxsize, (int)cursize, maxfiles, numfiles);
|
||||
return (wxThread::ExitCode)0;
|
||||
}
|
||||
|
||||
|
@ -332,7 +321,6 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
|||
|
||||
int64_t fsize = i->second.GetSize().GetValue();
|
||||
if (!wxRemoveFile(i->second.GetFullPath())) {
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: failed to remove file %s"),i->second.GetFullPath().c_str());
|
||||
continue;
|
||||
}
|
||||
cursize -= fsize;
|
||||
|
@ -342,9 +330,6 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
|||
wxThread::This()->Sleep(250);
|
||||
}
|
||||
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: deleted %d files"), deleted);
|
||||
wxLogDebug(_T("FFmpegSourceCacheCleaner: done, exiting"));
|
||||
|
||||
return (wxThread::ExitCode)0;
|
||||
}
|
||||
|
||||
|
|
|
@ -248,8 +248,6 @@ void HunspellSpellChecker::SetLanguage(wxString language) {
|
|||
dicpath = path + language + _T(".dic");
|
||||
usrdicpath = userPath + language + _T(".dic");
|
||||
|
||||
wxLogDebug(_T("Using dictionary %ls for spellchecking"), dicpath.c_str());
|
||||
|
||||
// Check if language is available
|
||||
if (!wxFileExists(affpath) || !wxFileExists(dicpath)) return;
|
||||
|
||||
|
|
|
@ -150,8 +150,6 @@ void MySpellThesaurus::SetLanguage(wxString language) {
|
|||
// Check if language is available
|
||||
if (!wxFileExists(idxpath) || !wxFileExists(datpath)) return;
|
||||
|
||||
wxLogDebug(_T("Using dictionary %ls for thesaurus"), datpath.c_str());
|
||||
|
||||
// Load
|
||||
mythes = new MyThes(idxpath.mb_str(wxConvLocal),datpath.mb_str(wxConvLocal));
|
||||
conv = NULL;
|
||||
|
|
|
@ -442,7 +442,6 @@ void RestartAegisub() {
|
|||
char *support_path = OSX_GetBundleSupportFilesDirectory();
|
||||
if (!bundle_path || !support_path) return; // oops
|
||||
wxString exec = wxString::Format(_T("\"%s/MacOS/restart-helper\" /usr/bin/open -n \"%s\"'"), wxString(support_path, wxConvUTF8).c_str(), wxString(bundle_path, wxConvUTF8).c_str());
|
||||
wxLogDebug("RestartAegisub: (%s)", exec);
|
||||
wxExecute(exec);
|
||||
free(bundle_path);
|
||||
free(support_path);
|
||||
|
|
Loading…
Reference in New Issue