* Remove all instances of wxLogDebug and replace them with LOG_W, LOG_D, LOG_E and LOG_D_IF as required.

* Add LOG_(D|W|I)_IF for conditional logging.

Originally committed to SVN as r4465.
This commit is contained in:
Amar Takhar 2010-06-08 23:21:39 +00:00
parent 653ce8b13d
commit 931cc7f461
21 changed files with 203 additions and 149 deletions

View file

@ -44,6 +44,9 @@
#define LOG_I(section) LOG_SINK(section, agi::log::Info) #define LOG_I(section) LOG_SINK(section, agi::log::Info)
#define LOG_D(section) LOG_SINK(section, agi::log::Debug) #define LOG_D(section) LOG_SINK(section, agi::log::Debug)
#define LOG_W_IF(cond, section) if (cond) LOG_SINK(section, agi::log::Warning)
#define LOG_I_IF(cond, section) if (cond) LOG_SINK(section, agi::log::Info)
#define LOG_D_IF(cond, section) if (cond) LOG_SINK(section, agi::log::Debug)
namespace agi { namespace agi {
namespace log { namespace log {

View file

@ -41,6 +41,8 @@
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#endif #endif
#include <libaegisub/log.h>
#include "ass_dialogue.h" #include "ass_dialogue.h"
#include "ass_override.h" #include "ass_override.h"
@ -620,7 +622,7 @@ void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::
work = text.SubString(start, i-1); work = text.SubString(start, i-1);
work.Trim(true).Trim(false); work.Trim(true).Trim(false);
paramList.Add(work); paramList.Add(work);
//wxLogDebug(_T("Got parameter: %s"), work.c_str()); //LOG_D("subtitle/ass/override" << "Got parameter: << work.c_str();
} }
if (i+1 < textlen) { if (i+1 < textlen) {

View file

@ -48,6 +48,8 @@
#include <wx/laywin.h> // Keep this last so wxSW_3D is set. #include <wx/laywin.h> // Keep this last so wxSW_3D is set.
#endif #endif
#include <libaegisub/log.h>
#include "audio_box.h" #include "audio_box.h"
#include "audio_display.h" #include "audio_display.h"
#include "audio_karaoke.h" #include "audio_karaoke.h"
@ -261,7 +263,7 @@ AudioBox::~AudioBox() {
/// @return /// @return
/// ///
void AudioBox::SetFile(wxString file,bool FromVideo) { void AudioBox::SetFile(wxString file,bool FromVideo) {
wxLogDebug(_T("AudioBox::SetFile(file=%s, FromVideo=%d)"), file.c_str(), FromVideo?1:0); LOG_D("audio/box") << "file=" << file << " FromVideo: " << FromVideo;
loaded = false; loaded = false;
if (FromVideo) { if (FromVideo) {
@ -276,9 +278,9 @@ void AudioBox::SetFile(wxString file,bool FromVideo) {
audioName = file; audioName = file;
} }
wxLogDebug(_T("AudioBox::SetFile: setting up accelerators in frameMain")); LOG_D("audio/box") << "setting up acceleraters in frameMain";
frameMain->SetAccelerators(); frameMain->SetAccelerators();
wxLogDebug(_T("AudioBox::SetFile: returning")); LOG_D("audio/box") << "finished setting up accelerators in frameMain";
} }
@ -564,11 +566,11 @@ void AudioBox::OnPlayToEnd(wxCommandEvent &event) {
/// @return /// @return
/// ///
void AudioBox::OnCommit(wxCommandEvent &event) { void AudioBox::OnCommit(wxCommandEvent &event) {
wxLogDebug(_T("AudioBox::OnCommit")); LOG_D("audio/box") << "OnCommit";
audioDisplay->SetFocus(); audioDisplay->SetFocus();
wxLogDebug(_T("AudioBox::OnCommit: has set focus, now committing changes")); LOG_D("audio/box") << "has set focus, now committing changes";
audioDisplay->CommitChanges(true); audioDisplay->CommitChanges(true);
wxLogDebug(_T("AudioBox::OnCommit: returning")); LOG_D("audio/box") << "returning";
} }
@ -578,10 +580,10 @@ void AudioBox::OnCommit(wxCommandEvent &event) {
/// @return /// @return
/// ///
void AudioBox::OnKaraoke(wxCommandEvent &event) { void AudioBox::OnKaraoke(wxCommandEvent &event) {
wxLogDebug(_T("AudioBox::OnKaraoke")); LOG_D("audio/box") << "OnKaraoke";
audioDisplay->SetFocus(); audioDisplay->SetFocus();
if (karaokeMode) { if (karaokeMode) {
wxLogDebug(_T("AudioBox::OnKaraoke: karaoke enabled, disabling")); LOG_D("audio/box") << "karaoke enabled, disabling";
if (audioKaraoke->splitting) { if (audioKaraoke->splitting) {
audioKaraoke->EndSplit(false); audioKaraoke->EndSplit(false);
} }
@ -592,7 +594,7 @@ void AudioBox::OnKaraoke(wxCommandEvent &event) {
} }
else { else {
wxLogDebug(_T("AudioBox::OnKaraoke: karaoke disabled, enabling")); LOG_D("audio/box") << "karaoke disabled, enabling";
karaokeMode = true; karaokeMode = true;
audioKaraoke->enabled = true; audioKaraoke->enabled = true;
audioDisplay->SetDialogue(); audioDisplay->SetDialogue();
@ -600,7 +602,7 @@ void AudioBox::OnKaraoke(wxCommandEvent &event) {
SetKaraokeButtons(); SetKaraokeButtons();
wxLogDebug(_T("AudioBox::OnKaraoke: returning")); LOG_D("audio/box") << "returning";
} }
@ -634,7 +636,7 @@ void AudioBox::SetKaraokeButtons() {
/// @param event wxEvent /// @param event wxEvent
/// ///
void AudioBox::OnJoin(wxCommandEvent &event) { void AudioBox::OnJoin(wxCommandEvent &event) {
wxLogDebug(_T("AudioBox::OnJoin")); LOG_D("audio/box") << "join";
audioDisplay->SetFocus(); audioDisplay->SetFocus();
audioKaraoke->Join(); audioKaraoke->Join();
} }
@ -643,7 +645,7 @@ void AudioBox::OnJoin(wxCommandEvent &event) {
/// @param event wxEvent /// @param event wxEvent
/// ///
void AudioBox::OnSplit(wxCommandEvent &event) { void AudioBox::OnSplit(wxCommandEvent &event) {
wxLogDebug(_T("AudioBox::OnSplit")); LOG_D("audio/box") << "split";
audioDisplay->SetFocus(); audioDisplay->SetFocus();
audioKaraoke->BeginSplit(); audioKaraoke->BeginSplit();
} }
@ -652,7 +654,7 @@ void AudioBox::OnSplit(wxCommandEvent &event) {
/// @param event wxEvent /// @param event wxEvent
/// ///
void AudioBox::OnCancel(wxCommandEvent &event) { void AudioBox::OnCancel(wxCommandEvent &event) {
wxLogDebug(_T("AudioBox::OnCancel")); LOG_D("audio/box") << "cancel";
audioDisplay->SetFocus(); audioDisplay->SetFocus();
audioKaraoke->EndSplit(true); audioKaraoke->EndSplit(true);
} }
@ -661,7 +663,7 @@ void AudioBox::OnCancel(wxCommandEvent &event) {
/// @param event wxEvent /// @param event wxEvent
/// ///
void AudioBox::OnAccept(wxCommandEvent &event) { void AudioBox::OnAccept(wxCommandEvent &event) {
wxLogDebug(_T("AudioBox::OnAccept")); LOG_D("audio/box") << "accept";
audioDisplay->SetFocus(); audioDisplay->SetFocus();
audioKaraoke->EndSplit(false); audioKaraoke->EndSplit(false);
} }

View file

@ -86,7 +86,7 @@ AudioKaraokeSyllable::AudioKaraokeSyllable(const AssKaraokeSyllable &base)
AudioKaraoke::AudioKaraoke(wxWindow *parent) AudioKaraoke::AudioKaraoke(wxWindow *parent)
: wxWindow (parent,-1,wxDefaultPosition,wxSize(10,5),wxTAB_TRAVERSAL|wxBORDER_SUNKEN) : wxWindow (parent,-1,wxDefaultPosition,wxSize(10,5),wxTAB_TRAVERSAL|wxBORDER_SUNKEN)
{ {
LOG_D("karaoke") << "Constructor"; LOG_D("karaoke/audio") << "Constructor";
enabled = false; enabled = false;
splitting = false; splitting = false;
split_cursor_syl = -1; split_cursor_syl = -1;
@ -110,10 +110,10 @@ AudioKaraoke::~AudioKaraoke() {
/// @return /// @return
/// ///
bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) { bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue(diag=%p)"), _diag); LOG_D("karaoke/audio") << "diag=" << _diag;
// Make sure we're not in splitting-mode // Make sure we're not in splitting-mode
if (splitting) { if (splitting) {
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: is splitting, discarding splits")); LOG_D("karaoke/audio") << "is splitting, discarding splits";
// Discard any splits and leave split-mode // Discard any splits and leave split-mode
EndSplit(false); EndSplit(false);
} }
@ -122,13 +122,13 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
delete workDiag; delete workDiag;
diag = _diag; diag = _diag;
if (!diag) { if (!diag) {
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: no diag, refreshing and returning false")); LOG_D("karaoke/audio") << "no diag, refreshing and returning flase";
Refresh(false); Refresh(false);
return false; return false;
} }
// Split // Split
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: split")); LOG_D("karaoke/audio") << "split";
workDiag = new AssDialogue(diag->GetEntryData(), false); workDiag = new AssDialogue(diag->GetEntryData(), false);
workDiag->ParseASSTags(); workDiag->ParseASSTags();
must_rebuild = false; must_rebuild = false;
@ -136,7 +136,7 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
// No karaoke, autosplit // No karaoke, autosplit
if (!hasKar) { if (!hasKar) {
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: no existing karaoke, auto-splitting")); LOG_D("karaoke/audio") << "no existing karaoke, auto-splitting";
AutoSplit(); AutoSplit();
} }
@ -145,7 +145,7 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
//if (curSyllable >= (signed) syllables.size()) curSyllable = 0; //if (curSyllable >= (signed) syllables.size()) curSyllable = 0;
//SetSelection(curSyllable); //SetSelection(curSyllable);
//Refresh(false); //Refresh(false);
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: returning %d"), hasKar?0:1); LOG_D("karaoke/audio") << "returning " << hasKar;
return !hasKar; return !hasKar;
} }
@ -155,17 +155,17 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
/// @return /// @return
/// ///
void AudioKaraoke::Commit() { void AudioKaraoke::Commit() {
wxLogDebug(_T("AudioKaraoke::Commit")); LOG_D("karaoke/audio") << "commit";
if (splitting) { if (splitting) {
wxLogDebug(_T("AudioKaraoke::Commit: splitting, ending split")); LOG_D("karaoke/audio") << "splitting, ending split";
EndSplit(true); EndSplit(true);
} }
wxString finalText = _T(""); wxString finalText = _T("");
AudioKaraokeSyllable *syl; AudioKaraokeSyllable *syl;
size_t n = syllables.size(); size_t n = syllables.size();
wxLogDebug(_T("AudioKaraoke::Commit: syllables.size() = %u"), n); LOG_D("karaoke/audio") << "syllabels.size() = " << n;
if (must_rebuild) { if (must_rebuild) {
wxLogDebug(_T("AudioKaraoke::Commit: must_rebuild")); LOG_D("karaoke/audio") << "must_rebuild";
workDiag->ClearBlocks(); workDiag->ClearBlocks();
for (size_t i=0;i<n;i++) { for (size_t i=0;i<n;i++) {
syl = &syllables.at(i); syl = &syllables.at(i);
@ -175,11 +175,11 @@ void AudioKaraoke::Commit() {
workDiag->ParseASSTags(); workDiag->ParseASSTags();
diag->Text = finalText; diag->Text = finalText;
} else { } else {
wxLogDebug(_T("AudioKaraoke::Commit: Updating karaoke without rebuild")); LOG_D("karaoke/audio") << "updating karaoke without rebuild";
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
wxLogDebug(_T("AudioKaraoke::Commit: Updating syllable %d"), i); LOG_D("karaoke/audio") << "updating syllabel: " << i;
syl = &syllables.at(i); syl = &syllables.at(i);
wxLogDebug(_T("AudioKaraoke::Commit: Syllable pointer: %p; tagdata pointer: %p; length: %d"), syl, syl->tag, syl->duration); LOG_D("karaoke/audio") << "syllabel pointer: " << syl << "; tagdata pointer: " << syl->tag << "; length: " << syl->duration;
// Some weird people have text before the first karaoke tag on a line. // 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. // Check that a karaoke tag actually exists for the (non-)syllable to avoid a crash.
if (syl->tag && syl->tag->Params.size()>0) if (syl->tag && syl->tag->Params.size()>0)
@ -187,13 +187,13 @@ 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. // 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. // 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")); LOG_D("karaoke/audio") << "done updating syllabels";
workDiag->UpdateText(); workDiag->UpdateText();
workDiag->ClearBlocks(); workDiag->ClearBlocks();
workDiag->ParseASSTags(); workDiag->ParseASSTags();
diag->Text = workDiag->Text; diag->Text = workDiag->Text;
} }
wxLogDebug(_T("AudioKaraoke::Commit: returning")); LOG_D("karaoke/audio") << "returning";
} }
@ -202,7 +202,7 @@ void AudioKaraoke::Commit() {
/// @return /// @return
/// ///
void AudioKaraoke::AutoSplit() { void AudioKaraoke::AutoSplit() {
wxLogDebug(_T("AudioKaraoke::AutoSplit")); LOG_D("karaoke/audio") << "autosplit";
// Get lengths // Get lengths
int timeLen = (diag->End.GetMS() - diag->Start.GetMS())/10; int timeLen = (diag->End.GetMS() - diag->Start.GetMS())/10;
@ -250,7 +250,7 @@ void AudioKaraoke::AutoSplit() {
newDiag.ParseASSTags(); newDiag.ParseASSTags();
ParseDialogue(&newDiag); ParseDialogue(&newDiag);
wxLogDebug(_T("AudioKaraoke::AutoSplit: returning")); LOG_D("karaoke/audio") << "returning";
} }
@ -294,14 +294,14 @@ bool AudioKaraoke::ParseDialogue(AssDialogue *curDiag) {
/// @return /// @return
/// ///
void AudioKaraoke::SetSyllable(int n) { void AudioKaraoke::SetSyllable(int n) {
wxLogDebug(_T("AudioKaraoke::SetSyllable(n=%d)"), n); LOG_D("karaoke/audio") << "n=" << n;
if (n == -1) n = syllables.size()-1; if (n == -1) n = syllables.size()-1;
if (n >= (signed) syllables.size()) n = 0; if (n >= (signed) syllables.size()) n = 0;
curSyllable = n; curSyllable = n;
startClickSyl = n; startClickSyl = n;
SetSelection(n); SetSelection(n);
Refresh(false); Refresh(false);
wxLogDebug(_T("AudioKaraoke::SetSyllable: returning")); LOG_D("karaoke/audio") << "returning";
} }
@ -597,7 +597,7 @@ int AudioKaraoke::GetSylAtX(int x) {
/// @param end /// @param end
/// ///
void AudioKaraoke::SetSelection(int start,int end) { void AudioKaraoke::SetSelection(int start,int end) {
wxLogDebug(_T("AudioKaraoke::SetSelection(start=%d, end=%d)"), start, end); LOG_D("karaoke/audio") << "start=" << start << " end=" << end;
// Default end // Default end
if (end == -1) end = start; if (end == -1) end = start;
@ -609,7 +609,7 @@ void AudioKaraoke::SetSelection(int start,int end) {
max = min; max = min;
min = temp; min = temp;
} }
wxLogDebug(_T("AudioKaraoke::SetSelection: min=%d, max=%d"), min, max); LOG_D("karaoke/audio") << "min=" << min << ", max=" << max;
// Set values // Set values
bool state; bool state;
@ -622,7 +622,7 @@ void AudioKaraoke::SetSelection(int start,int end) {
} }
curSyllable = min; curSyllable = min;
selectionCount = max-min+1; selectionCount = max-min+1;
wxLogDebug(_T("AudioKaraoke::SetSelection: new curSyllable=%d, selectionCount=%d"), curSyllable, selectionCount); LOG_D("karaoke/audio") << "new curSyllabel=" << curSyllable << ", selectionCount=" << selectionCount;
// Set box buttons // Set box buttons
box->SetKaraokeButtons(); box->SetKaraokeButtons();
@ -634,7 +634,7 @@ void AudioKaraoke::SetSelection(int start,int end) {
/// @return /// @return
/// ///
void AudioKaraoke::Join() { void AudioKaraoke::Join() {
wxLogDebug(_T("AudioKaraoke::Join")); LOG_D("karaoke/audio") << "join";
// Variables // Variables
bool gotOne = false; bool gotOne = false;
size_t syls = syllables.size(); size_t syls = syllables.size();
@ -644,7 +644,7 @@ void AudioKaraoke::Join() {
// Loop // Loop
for (size_t i=0;i<syls;i++) { for (size_t i=0;i<syls;i++) {
curSyl = &syllables.at(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); LOG_D("karaoke/audio") << "syllabel " << i << ", text='" << curSyl->text.c_str() << "', unstripped_text='" << curSyl->unstripped_text.c_str() << "', duration=" << curSyl->duration;
if (curSyl->selected) { if (curSyl->selected) {
if (!gotOne) { if (!gotOne) {
gotOne = true; gotOne = true;
@ -652,7 +652,7 @@ void AudioKaraoke::Join() {
} }
else { else {
AudioKaraokeSyllable &work = syllables.at(first); 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); LOG_D("karaoke/audio") << "worksyl " << work.text.c_str() << ", text='" << work.text.c_str() << ", unstripped_text='" << work.unstripped_text.c_str() << "', duration=" << work.duration;
work.duration += curSyl->duration; work.duration += curSyl->duration;
work.text += curSyl->text; work.text += curSyl->text;
work.unstripped_text += curSyl->unstripped_text; work.unstripped_text += curSyl->unstripped_text;
@ -672,7 +672,7 @@ void AudioKaraoke::Join() {
display->Update(); display->Update();
Refresh(false); Refresh(false);
wxLogDebug(_T("AudioKaraoke::Join: returning")); LOG_D("karaoke/audio") << "returning";
} }
@ -680,7 +680,7 @@ void AudioKaraoke::Join() {
/// @brief Enter splitting-mode /// @brief Enter splitting-mode
/// ///
void AudioKaraoke::BeginSplit() { void AudioKaraoke::BeginSplit() {
wxLogDebug(_T("AudioKaraoke::BeginSplit")); LOG_D("karaoke/audio") << "beginsplit";
splitting = true; splitting = true;
split_cursor_syl = -1; split_cursor_syl = -1;
split_cursor_x = -1; split_cursor_x = -1;
@ -695,7 +695,7 @@ void AudioKaraoke::BeginSplit() {
/// @return /// @return
/// ///
void AudioKaraoke::EndSplit(bool commit) { void AudioKaraoke::EndSplit(bool commit) {
wxLogDebug(_T("AudioKaraoke::EndSplit(commit=%d)"), commit?1:0); LOG_D("karaoke/audio") << "endsplit, commit=" << commit;
splitting = false; splitting = false;
bool hasSplit = false; bool hasSplit = false;
size_t first_sel = ~0U; size_t first_sel = ~0U;
@ -714,7 +714,7 @@ void AudioKaraoke::EndSplit(bool commit) {
// Update // Update
if (hasSplit) { if (hasSplit) {
wxLogDebug(_T("AudioKaraoke::EndSplit: hasSplit")); LOG_D("karaoke/audio") << "hassplit";
must_rebuild = true; must_rebuild = true;
display->NeedCommit = true; display->NeedCommit = true;
SetSelection(first_sel); SetSelection(first_sel);
@ -724,7 +724,7 @@ void AudioKaraoke::EndSplit(bool commit) {
box->SetKaraokeButtons(); box->SetKaraokeButtons();
Refresh(false); Refresh(false);
wxLogDebug(_T("AudioKaraoke::EndSplit: returning")); LOG_D("karaoke/audio") << "returning";
} }
@ -734,14 +734,14 @@ void AudioKaraoke::EndSplit(bool commit) {
/// @return /// @return
/// ///
int AudioKaraoke::SplitSyl (unsigned int n) { int AudioKaraoke::SplitSyl (unsigned int n) {
wxLogDebug(_T("AudioKaraoke::SplitSyl(n=%u)"), n); LOG_D("karaoke/audio") << "splitsyl, n=" << n;
// Avoid multiple vector resizes (this must be first) // Avoid multiple vector resizes (this must be first)
syllables.reserve(syllables.size() + syllables[n].pending_splits.size()); syllables.reserve(syllables.size() + syllables[n].pending_splits.size());
// The syllable we're splitting // The syllable we're splitting
AudioKaraokeSyllable &basesyl = syllables[n]; AudioKaraokeSyllable &basesyl = syllables[n];
wxLogDebug(_T("AudioKaraoke::SplitSyl: basesyl. contents='%s' selected=%d"), basesyl.unstripped_text.c_str(), basesyl.selected?1:0); LOG_D("karaoke/audio") << "basesyl, contents='" << basesyl.unstripped_text.c_str() << "', selected=" << basesyl.selected;
// Start by sorting the split points // Start by sorting the split points
std::sort(basesyl.pending_splits.begin(), basesyl.pending_splits.end()); std::sort(basesyl.pending_splits.begin(), basesyl.pending_splits.end());
@ -771,7 +771,7 @@ int AudioKaraoke::SplitSyl (unsigned int n) {
newsyl.start_time = curpos; newsyl.start_time = curpos;
newsyl.type = basesyl.type; newsyl.type = basesyl.type;
newsyl.selected = false;//basesyl.selected; newsyl.selected = false;//basesyl.selected;
wxLogDebug(_T("AudioKaraoke::SplitSyl: newsyl. contents='%s' selected=%d"), newsyl.text.c_str(), newsyl.selected?1:0); LOG_D("karaoke/audio") << "splitsyl: newsyl, contents='" << newsyl.text.c_str() << "', selected=" << newsyl.selected;
curpos += newsyl.duration; curpos += newsyl.duration;
syllables.insert(syllables.begin()+n+i+1, newsyl); syllables.insert(syllables.begin()+n+i+1, newsyl);
} }
@ -808,7 +808,7 @@ int AudioKaraoke::SplitSyl (unsigned int n) {
/// @return /// @return
/// ///
bool AudioKaraoke::SyllableDelta(int n,int delta,int mode) { bool AudioKaraoke::SyllableDelta(int n,int delta,int mode) {
wxLogDebug(_T("AudioKaraoke::SyllableDelta(n=%d, delta=%d, mode=%d)"), n, delta, mode); LOG_D("karaoke/audio") << "n=" << n << ", delta=" << delta << ", mode=" << mode;
// Get syllable and next // Get syllable and next
AudioKaraokeSyllable *curSyl=NULL,*nextSyl=NULL; AudioKaraokeSyllable *curSyl=NULL,*nextSyl=NULL;
curSyl = &syllables.at(n); curSyl = &syllables.at(n);
@ -825,33 +825,33 @@ bool AudioKaraoke::SyllableDelta(int n,int delta,int mode) {
if (len + delta < minLen) delta = minLen-len; if (len + delta < minLen) delta = minLen-len;
if (mode == 0 && nextSyl && (nextSyl->duration - delta) < minLen) delta = nextSyl->duration - minLen; 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); LOG_D("karaoke/audio") << "nkar=" << nkar << ", len=" << len << ", minLen=" << minLen << ", delta=" << delta;
// Apply // Apply
if (delta != 0) { if (delta != 0) {
wxLogDebug(_T("AudioKaraoke::SyllableDelta: delta != 0")); LOG_D("karaoke/audio") << "delta != 0";
curSyl->duration += delta; curSyl->duration += delta;
// Normal mode // Normal mode
if (mode == 0 && nextSyl) { if (mode == 0 && nextSyl) {
wxLogDebug(_T("AudioKaraoke::SyllableDelta: normal mode")); LOG_D("karaoke/audio") << "normal mode";
nextSyl->duration -= delta; nextSyl->duration -= delta;
nextSyl->start_time += delta; nextSyl->start_time += delta;
} }
// Shift mode // Shift mode
if (mode == 1) { if (mode == 1) {
wxLogDebug(_T("AudioKaraoke::SyllableDelta: shift mode")); LOG_D("karaoke/audio") << "shift mode";
for (int i=n+1;i<nkar;i++) { for (int i=n+1;i<nkar;i++) {
syllables.at(i).start_time += delta; syllables.at(i).start_time += delta;
} }
} }
// Flag update // Flag update
wxLogDebug(_T("AudioKaraoke::SyllableDelta: return true")); LOG_D("karaoke/audio") << "return true";
return true; return true;
} }
wxLogDebug(_T("AudioKaraoke::SyllableDelta: return false")); LOG_D("karaoke/audio") << "return false";
return false; return false;
} }

View file

@ -37,11 +37,14 @@
#include "config.h" #include "config.h"
#ifdef WITH_ALSA #ifdef WITH_ALSA
/////////// ///////////
// Headers // Headers
#include <libaegisub/log.h>
#include "audio_player_alsa.h" #include "audio_player_alsa.h"
#include "audio_player_manager.h" #include "audio_player_manager.h"
#include "audio_provider_manager.h" #include "audio_provider_manager.h"
@ -151,12 +154,11 @@ void AlsaPlayer::SetUpHardware()
if (snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &real_rate, 0) < 0) { if (snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &real_rate, 0) < 0) {
throw _T("ALSA player: Could not set sample rate"); throw _T("ALSA player: Could not set sample rate");
} }
if (rate != real_rate) { LOG_D_IF(rate != real_rate, "player/audio/alsa") << "ALSA player: Could not set ideal sample rate " << rate << "using " << real_rate << "instead";
wxLogDebug(_T("ALSA player: Could not set ideal sample rate %d, using %d instead"), rate, real_rate);
}
// Set number of channels // Set number of channels
if (snd_pcm_hw_params_set_channels(pcm_handle, hwparams, provider->GetChannels()) < 0) { if (snd_pcm_hw_params_set_channels(pcm_handle, hwparams, provider->GetChannels()) < 0) {
LOG_E("player/audio/alsa") << "Could not set number of channels";
throw _T("ALSA player: Could not set number of channels"); throw _T("ALSA player: Could not set number of channels");
} }
printf("ALSA player: Set sample rate %u (wanted %u)\n", real_rate, rate); printf("ALSA player: Set sample rate %u (wanted %u)\n", real_rate, rate);
@ -165,12 +167,13 @@ void AlsaPlayer::SetUpHardware()
unsigned int wanted_buflen = 1000000; // microseconds unsigned int wanted_buflen = 1000000; // microseconds
buflen = wanted_buflen; buflen = wanted_buflen;
if (snd_pcm_hw_params_set_buffer_time_near(pcm_handle, hwparams, &buflen, &dir) < 0) { if (snd_pcm_hw_params_set_buffer_time_near(pcm_handle, hwparams, &buflen, &dir) < 0) {
LOG_E("player/audio/alsa") << "Couldn't set buffer length";
throw _T("ALSA player: Couldn't set buffer length"); throw _T("ALSA player: Couldn't set buffer length");
} }
if (buflen != wanted_buflen) { LOG_D_IF(buflen != wanted_buflen, "player/audio/alsa") << "Couldn't get wanted buffer size of " << wanted_buflen << ", got " << buflen << "instead";
wxLogDebug(_T("ALSA player: Couldn't get wanted buffer size of %u, got %u instead"), wanted_buflen, buflen);
}
if (snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize) < 0) { if (snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize) < 0) {
LOG_E("player/audio/alsa") << "Couldn't get buffer size";
throw _T("ALSA player: Couldn't get buffer size"); throw _T("ALSA player: Couldn't get buffer size");
} }
printf("ALSA player: Buffer size: %lu\n", bufsize); printf("ALSA player: Buffer size: %lu\n", bufsize);
@ -182,16 +185,17 @@ void AlsaPlayer::SetUpHardware()
if (snd_pcm_hw_params_set_period_time_near(pcm_handle, hwparams, &period_len, &dir) < 0) { if (snd_pcm_hw_params_set_period_time_near(pcm_handle, hwparams, &period_len, &dir) < 0) {
throw _T("ALSA player: Couldn't set period length"); throw _T("ALSA player: Couldn't set period length");
} }
if (period_len != wanted_period) { LOG_D_IF(period_len != wanted_period, "player/audio/alsa") << Couldn't get wanted period size of " << wanted_period" << ", got " << period_len << " instead";
wxLogDebug(_T("ALSA player: Couldn't get wanted period size of %d, got %d instead"), wanted_period, period_len);
}
if (snd_pcm_hw_params_get_period_size(hwparams, &period, &dir) < 0) { if (snd_pcm_hw_params_get_period_size(hwparams, &period, &dir) < 0) {
LOG_E("player/audio/alsa") << "Couldn't get period size";
throw _T("ALSA player: Couldn't get period size"); throw _T("ALSA player: Couldn't get period size");
} }
printf("ALSA player: Period size: %lu\n", period); printf("ALSA player: Period size: %lu\n", period);
// Apply parameters // Apply parameters
if (snd_pcm_hw_params(pcm_handle, hwparams) < 0) { if (snd_pcm_hw_params(pcm_handle, hwparams) < 0) {
LOG_E("player/audio/alsa") << "Failed applying sound hardware settings";
throw _T("ALSA player: Failed applying sound hardware settings"); throw _T("ALSA player: Failed applying sound hardware settings");
} }
@ -211,21 +215,25 @@ void AlsaPlayer::SetUpAsync()
// Get current parameters // Get current parameters
if (snd_pcm_sw_params_current(pcm_handle, sw_params) < 0) { if (snd_pcm_sw_params_current(pcm_handle, sw_params) < 0) {
LOG_E("player/audio/alsa") << "Couldn't get current SW params";
throw _T("ALSA player: Couldn't get current SW params"); throw _T("ALSA player: Couldn't get current SW params");
} }
// How full the buffer must be before playback begins // How full the buffer must be before playback begins
if (snd_pcm_sw_params_set_start_threshold(pcm_handle, sw_params, bufsize - period) < 0) { if (snd_pcm_sw_params_set_start_threshold(pcm_handle, sw_params, bufsize - period) < 0) {
LOG_E("player/audio/alsa") << "Failed setting start threshold";
throw _T("ALSA player: Failed setting start threshold"); throw _T("ALSA player: Failed setting start threshold");
} }
// The the largest write guaranteed never to block // The the largest write guaranteed never to block
if (snd_pcm_sw_params_set_avail_min(pcm_handle, sw_params, period) < 0) { if (snd_pcm_sw_params_set_avail_min(pcm_handle, sw_params, period) < 0) {
LOG_E("player/audio/alsa") << "Failed setting min available buffer";
throw _T("ALSA player: Failed setting min available buffer"); throw _T("ALSA player: Failed setting min available buffer");
} }
// Apply settings // Apply settings
if (snd_pcm_sw_params(pcm_handle, sw_params) < 0) { if (snd_pcm_sw_params(pcm_handle, sw_params) < 0) {
LOG_E("player/audio/alsa") << "Failed applying SW params";
throw _T("ALSA player: Failed applying SW params"); throw _T("ALSA player: Failed applying SW params");
} }
@ -237,6 +245,7 @@ void AlsaPlayer::SetUpAsync()
// Attach async handler // Attach async handler
if (snd_async_add_pcm_handler(&pcm_callback, pcm_handle, async_write_handler, this) < 0) { if (snd_async_add_pcm_handler(&pcm_callback, pcm_handle, async_write_handler, this) < 0) {
LOG_E("player/audio/alsa") << "Failed attaching async handler";
throw _T("ALSA player: Failed attaching async handler"); throw _T("ALSA player: Failed attaching async handler");
} }
} }

View file

@ -41,6 +41,7 @@
#ifdef WITH_DIRECTSOUND #ifdef WITH_DIRECTSOUND
#include <libaegisub/log.h>
#include "audio_player_dsound.h" #include "audio_player_dsound.h"
#include "frame_main.h" #include "frame_main.h"
@ -206,7 +207,7 @@ RetryLock:
// Buffer lost? // Buffer lost?
if (res == DSERR_BUFFERLOST) { if (res == DSERR_BUFFERLOST) {
wxLogDebug(_T("Lost DSound buffer")); LOG_D("audio/player/dsound1") << "lost dsound buffer";
buffer->Restore(); buffer->Restore();
goto RetryLock; goto RetryLock;
} }
@ -218,9 +219,9 @@ RetryLock:
unsigned long int count1 = size1 / bytesps; unsigned long int count1 = size1 / bytesps;
unsigned long int count2 = size2 / bytesps; unsigned long int count2 = size2 / bytesps;
if (count1) wxLogDebug(_T("DS fill: %05lu -> %05lu"), (unsigned long)playPos, (unsigned long)playPos+count1); LOG_D_IF(count1, "audio/player/dsound1") << "DS fill: " << (unsigned long)playPos << " -> " << (unsigned long)playPos+count1;
if (count2) wxLogDebug(_T("DS fill: %05lu => %05lu"), (unsigned long)playPos+count1, (unsigned long)playPos+count1+count2); LOG_D_IF(count2, "audio/player/dsound1") << "DS fill: " << (unsigned long)playPos+count1 << " -> " << (unsigned long)playPos+count1+count2;
if (!count1 && !count2) wxLogDebug(_T("DS fill: nothing")); LOG_D_IF(!count1 && !count2, "audio/player/dsound1") << "DS fill: nothing";
// Get source wave // Get source wave
if (count1) provider->GetAudioWithVolume(ptr1, playPos, count1, volume); if (count1) provider->GetAudioWithVolume(ptr1, playPos, count1, volume);
@ -378,7 +379,7 @@ wxThread::ExitCode DirectSoundPlayerThread::Entry() {
while (WaitForSingleObject(stopnotify, 50) == WAIT_TIMEOUT) { while (WaitForSingleObject(stopnotify, 50) == WAIT_TIMEOUT) {
if (!parent->FillBuffer(false)) { if (!parent->FillBuffer(false)) {
// FillBuffer returns false when end of stream is reached // FillBuffer returns false when end of stream is reached
wxLogDebug(_T("DS thread hit end of stream")); LOG_D("audio/player/dsound1") << "DS thread hit end of stream";
break; break;
} }
} }
@ -398,8 +399,8 @@ wxThread::ExitCode DirectSoundPlayerThread::Entry() {
if (FAILED(res)) break; if (FAILED(res)) break;
if (size1) memset(buf1, 0, size1); if (size1) memset(buf1, 0, size1);
if (size2) memset(buf2, 0, size2); if (size2) memset(buf2, 0, size2);
if (size1) wxLogDebug(_T("DS blnk: %05ld -> %05ld"), (unsigned long)parent->playPos+bytesFilled, (unsigned long)parent->playPos+bytesFilled+size1); LOG_D_IF(size1, "audio/player/dsound1") << "DS blnk:" << (unsigned long)parent->playPos+bytesFilled << " -> " << (unsigned long)parent->playPos+bytesFilled+size1;
if (size2) wxLogDebug(_T("DS blnk: %05ld => %05ld"), (unsigned long)parent->playPos+bytesFilled+size1, (unsigned long)parent->playPos+bytesFilled+size1+size2); LOG_D_IF(size2, "audio/player/dsound1") << "DS blnk:" << (unsigned long)parent->playPos+bytesFilled+size1 << " -> " << (unsigned long)parent->playPos+bytesFilled+size1+size2;
bytesFilled += size1 + size2; bytesFilled += size1 + size2;
parent->buffer->Unlock(buf1, size1, buf2, size2); parent->buffer->Unlock(buf1, size1, buf2, size2);
if (bytesFilled > parent->bufSize) break; if (bytesFilled > parent->bufSize) break;
@ -408,7 +409,7 @@ wxThread::ExitCode DirectSoundPlayerThread::Entry() {
WaitForSingleObject(stopnotify, 150); WaitForSingleObject(stopnotify, 150);
wxLogDebug(_T("DS thread dead")); LOG_D("audio/player/dsound1") << "DS thread dead";
parent->playing = false; parent->playing = false;
parent->buffer->Stop(); parent->buffer->Stop();

View file

@ -47,6 +47,8 @@
#include <process.h> #include <process.h>
#include <dsound.h> #include <dsound.h>
#include <libaegisub/log.h>
#include "audio_player_dsound2.h" #include "audio_player_dsound2.h"
#include "frame_main.h" #include "frame_main.h"
#include "include/aegisub/audio_provider.h" #include "include/aegisub/audio_provider.h"
@ -501,7 +503,7 @@ do_fill_buffer:
SUCCEEDED(bfr->Lock(0, bufSize, &buf1, &buf1sz, &buf2, &buf2sz, 0)) && SUCCEEDED(bfr->Lock(0, bufSize, &buf1, &buf1sz, &buf2, &buf2sz, 0)) &&
SUCCEEDED(bfr->Play(0, 0, DSBPLAY_LOOPING))) SUCCEEDED(bfr->Play(0, 0, DSBPLAY_LOOPING)))
{ {
wxLogDebug(_T("DirectSoundPlayer2: Lost and restored buffer")); LOG_D("audio/player/dsound") << "Lost and restored buffer";
break; break;
} }
REPORT_ERROR("Lost buffer and could not restore it.") REPORT_ERROR("Lost buffer and could not restore it.")
@ -914,6 +916,7 @@ void DirectSoundPlayer2::OpenStream()
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
thread = 0; thread = 0;
} }
@ -932,6 +935,7 @@ void DirectSoundPlayer2::CloseStream()
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
} }
thread = 0; thread = 0;
@ -957,6 +961,7 @@ void DirectSoundPlayer2::SetProvider(AudioProvider *provider)
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
} }
} }
@ -977,6 +982,7 @@ void DirectSoundPlayer2::Play(int64_t start,int64_t count)
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
} }
} }
@ -998,6 +1004,7 @@ void DirectSoundPlayer2::Stop(bool timerToo)
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
} }
} }
@ -1015,6 +1022,7 @@ bool DirectSoundPlayer2::IsPlaying()
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
return false; return false;
} }
@ -1035,6 +1043,7 @@ int64_t DirectSoundPlayer2::GetStartPosition()
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
return 0; return 0;
} }
@ -1055,6 +1064,7 @@ int64_t DirectSoundPlayer2::GetEndPosition()
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
return 0; return 0;
} }
@ -1075,6 +1085,7 @@ int64_t DirectSoundPlayer2::GetCurrentPosition()
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
return 0; return 0;
} }
@ -1092,6 +1103,7 @@ void DirectSoundPlayer2::SetEndPosition(int64_t pos)
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
} }
} }
@ -1110,6 +1122,7 @@ void DirectSoundPlayer2::SetCurrentPosition(int64_t pos)
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
} }
} }
@ -1126,6 +1139,7 @@ void DirectSoundPlayer2::SetVolume(double vol)
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
} }
} }
@ -1143,6 +1157,7 @@ double DirectSoundPlayer2::GetVolume()
} }
catch (const wxChar *msg) catch (const wxChar *msg)
{ {
LOG_E("audio/player/dsound") << msg;
wxLogError(msg); wxLogError(msg);
return 0; return 0;
} }

View file

@ -42,6 +42,8 @@
/////////// ///////////
// Headers // Headers
#include <libaegisub/log.h>
#include "audio_player_manager.h" #include "audio_player_manager.h"
#include "audio_player_openal.h" #include "audio_player_openal.h"
#include "audio_provider_manager.h" #include "audio_provider_manager.h"
@ -236,7 +238,7 @@ void OpenALPlayer::Stop(bool timerToo)
/// ///
void OpenALPlayer::FillBuffers(ALsizei count) void OpenALPlayer::FillBuffers(ALsizei count)
{ {
wxLogDebug(_T("FillBuffers: count=%d, buffers_free=%d"), count, buffers_free); LOG_D("player/audio/openal") << "count=" << count << " " << "buffers_free=" << buffers_free;
if (count > buffers_free) count = buffers_free; if (count > buffers_free) count = buffers_free;
if (count < 1) count = 1; if (count < 1) count = 1;
@ -249,7 +251,7 @@ void OpenALPlayer::FillBuffers(ALsizei count)
ALsizei fill_len = buffer_length; ALsizei fill_len = buffer_length;
if (fill_len > (ALsizei)(end_frame - cur_frame)) fill_len = (ALsizei)(end_frame - cur_frame); if (fill_len > (ALsizei)(end_frame - cur_frame)) fill_len = (ALsizei)(end_frame - cur_frame);
if (fill_len < 0) fill_len = 0; if (fill_len < 0) fill_len = 0;
wxLogDebug(_T("buffer_length=%d, fill_len=%d, end_frame-cur_frame=%d"), buffer_length, fill_len, end_frame-cur_frame); LOG_D("player/audio/openal") << "buffer_length=" << buffer_length << " fill_len=" << fill_len << " end_frame-cur-frame=" << end_frame-cur_frame;
if (fill_len > 0) if (fill_len > 0)
// Get fill_len frames of audio // Get fill_len frames of audio
@ -280,7 +282,7 @@ void OpenALPlayer::Notify()
ALsizei newplayed; ALsizei newplayed;
alGetSourcei(source, AL_BUFFERS_PROCESSED, &newplayed); alGetSourcei(source, AL_BUFFERS_PROCESSED, &newplayed);
wxLogDebug(_T("OpenAL Player notify: buffers_played=%d, newplayed=%d, playeddiff=%d"), buffers_played, newplayed); LOG_D("player/audio/openal") << "buffers_played=" << buffers_played << " newplayed=" << newplayed;
if (newplayed > 0) { if (newplayed > 0) {
// Reclaim buffers // Reclaim buffers
@ -302,7 +304,7 @@ void OpenALPlayer::Notify()
FillBuffers(newplayed); FillBuffers(newplayed);
} }
wxLogDebug(_T("frames played=%d, num frames=%d"), (buffers_played - num_buffers) * buffer_length, end_frame - start_frame); LOG_D("player/audio/openal") << "frames played=" << (buffers_played - num_buffers) * buffer_length << " num frames=" << end_frame - start_frame;
// Check that all of the selected audio plus one full set of buffers has been queued // 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)) { if ((buffers_played - num_buffers) * buffer_length > (ALsizei)(end_frame - start_frame)) {
// Then stop // Then stop

View file

@ -39,6 +39,8 @@
/////////// ///////////
// Headers // Headers
#include <libaegisub/log.h>
#include "audio_player_manager.h" #include "audio_player_manager.h"
#include "audio_player_oss.h" #include "audio_player_oss.h"
#include "audio_provider_manager.h" #include "audio_provider_manager.h"
@ -279,8 +281,7 @@ int64_t OSSPlayer::GetCurrentPosition()
#else #else
played_frames = pos.samples + pos.fifo_samples; played_frames = pos.samples + pos.fifo_samples;
#endif #endif
wxLogDebug("OSS player: played_frames %d fifo %d", played_frames, LOG_D("player/audio/oss") << "played_frames: " << played_frames << " fifo " << pos.fifo_samples;
pos.fifo_samples);
if (start_frame + played_frames >= end_frame) { if (start_frame + played_frames >= end_frame) {
if (displayTimer) if (displayTimer)
displayTimer->Stop(); displayTimer->Stop();
@ -293,7 +294,8 @@ int64_t OSSPlayer::GetCurrentPosition()
int delay = 0; int delay = 0;
if (ioctl(dspdev, SNDCTL_DSP_GETODELAY, &delay) >= 0) { if (ioctl(dspdev, SNDCTL_DSP_GETODELAY, &delay) >= 0) {
delay /= bpf; delay /= bpf;
wxLogDebug("OSS player: cur_frame %d delay %d", cur_frame, delay);
LOG_D("player/audio/oss") << "cur_frame: " << cur_frame << " delay " << delay;
// delay can jitter a bit at the end, detect that // delay can jitter a bit at the end, detect that
if (cur_frame == end_frame && delay < rate / 20) { if (cur_frame == end_frame && delay < rate / 20) {
if (displayTimer) if (displayTimer)
@ -337,7 +339,7 @@ wxThread::ExitCode OSSPlayerThread::Entry() {
free(buf); free(buf);
parent->cur_frame = parent->end_frame; parent->cur_frame = parent->end_frame;
wxLogDebug(_T("OSS player thread dead")); LOG_D("player/audio/oss") << "Thread dead";
return 0; return 0;
} }

View file

@ -41,6 +41,8 @@
// Headers // Headers
#include <libaegisub/log.h>
#include "audio_player_portaudio.h" #include "audio_player_portaudio.h"
#include "audio_provider_manager.h" #include "audio_provider_manager.h"
#include "charset_conv.h" #include "charset_conv.h"
@ -90,10 +92,10 @@ void PortAudioPlayer::OpenStream() {
if (pa_config_default < 0) { if (pa_config_default < 0) {
pa_device = Pa_GetDefaultOutputDevice(); pa_device = Pa_GetDefaultOutputDevice();
wxLogDebug(_T("PortAudioPlayer::OpenStream Using Default Output Device: %d"), pa_device); LOG_D("audio/player/portaudio") << "using default output device:" << pa_device;
} else { } else {
pa_device = pa_config_default; pa_device = pa_config_default;
wxLogDebug(_T("PortAudioPlayer::OpenStream Using Config Device: %d"), pa_device); LOG_D("audio/player/portaudio") << "using config device: " << pa_device;
} }
pa_output_p.device = pa_device; pa_output_p.device = pa_device;
@ -102,17 +104,15 @@ void PortAudioPlayer::OpenStream() {
pa_output_p.suggestedLatency = Pa_GetDeviceInfo(pa_device)->defaultLowOutputLatency; pa_output_p.suggestedLatency = Pa_GetDeviceInfo(pa_device)->defaultLowOutputLatency;
pa_output_p.hostApiSpecificStreamInfo = NULL; pa_output_p.hostApiSpecificStreamInfo = NULL;
wxLogDebug(_T("PortAudioPlayer::OpenStream Output channels: %d, Latency: %f Sample Rate: %ld\n"), LOG_D("audio/player/portaudio") << "output channels: " << pa_output_p.channelCount << ", latency: " << pa_output_p.suggestedLatency << " sample rate: " << pa_output_p.sampleFormat;
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); PaError err = Pa_OpenStream(&stream, NULL, &pa_output_p, provider->GetSampleRate(), 256, paPrimeOutputBuffersUsingStreamCallback, paCallback, this);
if (err != paNoError) { if (err != paNoError) {
const PaHostErrorInfo *pa_err = Pa_GetLastHostErrorInfo(); const PaHostErrorInfo *pa_err = Pa_GetLastHostErrorInfo();
if (pa_err->errorCode != 0) { LOG_D_IF(pa_err->errorCode != 0, "audio/player/portaudio") << "HostError: API: " << pa_err->hostApiType << ", " << pa_err->errorText << ", " << pa_err->errorCode;
wxLogDebug(_T("PortAudioPlayer::OpenStream HostError: API: %d, %s (%ld)\n"), pa_err->hostApiType, pa_err->errorText, pa_err->errorCode); LOG_D("audio/player/portaudio") << "Failed initializing PortAudio stream with error: " << Pa_GetErrorText(err);
}
throw wxString(_T("Failed initializing PortAudio stream with error: ") + wxString(Pa_GetErrorText(err),csConvLocal)); throw wxString(_T("Failed initializing PortAudio stream with error: ") + wxString(Pa_GetErrorText(err),csConvLocal));
} }
} }
@ -133,8 +133,7 @@ void PortAudioPlayer::paStreamFinishedCallback(void *userData) {
if (player->displayTimer) { if (player->displayTimer) {
player->displayTimer->Stop(); player->displayTimer->Stop();
} }
LOG_D("audio/player/portaudio") << "stopping stream";
wxLogDebug(_T("PortAudioPlayer::paStreamFinishedCallback Stopping stream."));
} }
@ -155,14 +154,14 @@ void PortAudioPlayer::Play(int64_t start,int64_t count) {
err = Pa_SetStreamFinishedCallback(stream, paStreamFinishedCallback); err = Pa_SetStreamFinishedCallback(stream, paStreamFinishedCallback);
if (err != paNoError) { if (err != paNoError) {
wxLogDebug(_T("PortAudioPlayer::Play Could not set FinishedCallback.\n")); LOG_D("audio/player/portaudio") << "could not set FinishedCallback";
return; return;
} }
err = Pa_StartStream(stream); err = Pa_StartStream(stream);
if (err != paNoError) { if (err != paNoError) {
wxLogDebug(_T("PortAudioPlayer::Play Error playing stream.\n")); LOG_D("audio/player/portaudio") << "error playing stream";
return; return;
} }
} }

View file

@ -51,6 +51,8 @@
#include <wx/log.h> #include <wx/log.h>
#endif #endif
#include <libaegisub/log.h>
#include "aegisub_endian.h" #include "aegisub_endian.h"
#include "audio_provider_pcm.h" #include "audio_provider_pcm.h"
#include "utils.h" #include "utils.h"
@ -681,8 +683,8 @@ AudioProvider *CreatePCMAudioProvider(const wxString &filename)
return provider; return provider;
} }
catch (const wxChar *msg) { catch (const wxChar *msg) {
LOG_E("audio/provider/pcm") << "Creating PCM WAV reader failed with message: '" << msg << "' Trying other providers";
provider = 0; provider = 0;
wxLogDebug(_T("Creating PCM WAV reader failed with message: %s\nProceeding to try other providers."), msg);
} }
// Try Sony Wave64 // Try Sony Wave64
@ -691,8 +693,8 @@ AudioProvider *CreatePCMAudioProvider(const wxString &filename)
return provider; return provider;
} }
catch (const wxChar *msg) { catch (const wxChar *msg) {
LOG_E("audio/provider/pcm") << "Creating Wave64 reader failed with message: '" << msg << "' Trying other providers";
provider = 0; provider = 0;
wxLogDebug(_T("Creating Wave64 reader failed with message: %s\nProceeding to try other providers."), msg);
} }
// no providers could be created // no providers could be created

View file

@ -39,6 +39,8 @@
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
#include <libaegisub/log.h>
#include "audio_provider_quicktime.h" #include "audio_provider_quicktime.h"
@ -194,9 +196,7 @@ void QuickTimeAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) {
qt_status = MovieAudioExtractionFillBuffer(extract_ref, &decode_count, &dst_buflist, &flags); qt_status = MovieAudioExtractionFillBuffer(extract_ref, &decode_count, &dst_buflist, &flags);
QTCheckError(qt_status, wxString(_T("QuickTime audio provider: Failed to decode audio"))); QTCheckError(qt_status, wxString(_T("QuickTime audio provider: Failed to decode audio")));
if (count != decode_count) LOG_W_IF(count != decode_count, "audio/provider/quicktime") << "decoded samplecount " << decode_count << "not same as requested count" << (uint32_t)count);
wxLogDebug(_T("QuickTime audio provider: GetAudio: Warning: decoded samplecount %d not same as requested count %d"),
decode_count, (uint32_t)count);
} }

View file

@ -51,6 +51,8 @@
#include <wx/log.h> #include <wx/log.h>
#endif #endif
#include <libaegisub/log.h>
#include "audio_renderer_spectrum.h" #include "audio_renderer_spectrum.h"
#include "colorspace.h" #include "colorspace.h"
#include "fft.h" #include "fft.h"
@ -507,7 +509,7 @@ public:
/// until the total number of lines stored in the tree is less than the maximum. /// until the total number of lines stored in the tree is less than the maximum.
void Age() 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); LOG_D("audio/renderer/spectrum/cache") << "stats: hits=" << cache_hits << " misses=" << cache_misses << " misses%=" << cache_misses/float(cache_hits+cache_misses)*100 << " managed lines=" << cache_root->GetManagedLineCount() << "(max=" << max_lines_cached << ")";
// 0 means no limit // 0 means no limit
if (max_lines_cached == 0) if (max_lines_cached == 0)
@ -531,7 +533,7 @@ public:
// Find the point where we have too many lines cached // Find the point where we have too many lines cached
while (cumulative_lines < max_lines_cached) { while (cumulative_lines < max_lines_cached) {
if (it == ages.rend()) { if (it == ages.rend()) {
wxLogDebug(_T("AudioSpectrumCacheManager done aging did not exceed max_lines_cached")); LOG_D("audio/renderer/spectrum/") << "done aging did not exeed max_lines_cached";
return; return;
} }
cumulative_lines += it->num_lines; cumulative_lines += it->num_lines;
@ -546,7 +548,7 @@ public:
cache_root->KillLine(it->first_line); cache_root->KillLine(it->first_line);
} }
wxLogDebug(_T("AudioSpectrumCacheManager done aging, managed lines now=%u (max=%u)"), cache_root->GetManagedLineCount(), max_lines_cached); LOG_D("audio/renderer/spectrum/") << "done aging, managed lines now=" << cache_root->GetManagedLineCount() << " (max=" << max_lines_cached << ")";
assert(cache_root->GetManagedLineCount() < max_lines_cached); assert(cache_root->GetManagedLineCount() < max_lines_cached);
} }

View file

@ -51,6 +51,8 @@
#include <wx/window.h> #include <wx/window.h>
#endif #endif
#include <libaegisub/log.h>
#include "ass_dialogue.h" #include "ass_dialogue.h"
#include "ass_file.h" #include "ass_file.h"
#include "ass_override.h" #include "ass_override.h"
@ -89,7 +91,7 @@ namespace Automation4 {
{ {
int top = lua_gettop(L); int top = lua_gettop(L);
if (top - additional != startstack) { if (top - additional != startstack) {
wxLogDebug(_T("Lua stack size mismatch.")); LOG_D("automation/lua") << "lua stack size mismatch.";
dump(); dump();
assert(top - additional == startstack); assert(top - additional == startstack);
} }
@ -97,18 +99,18 @@ namespace Automation4 {
void dump() void dump()
{ {
int top = lua_gettop(L); int top = lua_gettop(L);
wxLogDebug(_T("Dumping Lua stack...")); LOG_D("automation/lua/stackdump") << "--- dumping lua stack...";
for (int i = top; i > 0; i--) { for (int i = top; i > 0; i--) {
lua_pushvalue(L, i); lua_pushvalue(L, i);
wxString type(lua_typename(L, lua_type(L, -1)), wxConvUTF8); wxString type(lua_typename(L, lua_type(L, -1)), wxConvUTF8);
if (lua_isstring(L, i)) { if (lua_isstring(L, i)) {
wxLogDebug(type + _T(": ") + wxString(lua_tostring(L, -1), wxConvUTF8)); LOG_D("automation/lua/stackdump") << type << ": " << luatostring(L, -1);
} else { } else {
wxLogDebug(type); LOG_D("automation/lua/stackdump") << type;
} }
lua_pop(L, 1); lua_pop(L, 1);
} }
wxLogDebug(_T("--- end dump")); LOG_D("automation/lua") << "--- end dump";
} }
LuaStackcheck(lua_State *_L) : L(_L) { startstack = lua_gettop(L); } LuaStackcheck(lua_State *_L) : L(_L) { startstack = lua_gettop(L); }
~LuaStackcheck() { check_stack(0); } ~LuaStackcheck() { check_stack(0); }

View file

@ -46,6 +46,8 @@
#include <wx/log.h> #include <wx/log.h>
#endif #endif
#include <libaegisub/log.h>
#include "ass_dialogue.h" #include "ass_dialogue.h"
#include "ass_file.h" #include "ass_file.h"
#include "ass_override.h" #include "ass_override.h"
@ -822,7 +824,7 @@ namespace Automation4 {
{ {
LuaAssFile *laf = GetObjPointer(L, 1); LuaAssFile *laf = GetObjPointer(L, 1);
delete laf; delete laf;
wxLogDebug(_T(">>gc<< Garbage collected LuaAssFile")); LOG_D("automation/lua") << "Garbage collected LuaAssFile";
return 0; return 0;
} }

View file

@ -54,6 +54,8 @@
#include <wx/window.h> #include <wx/window.h>
#endif #endif
#include <libaegisub/log.h>
#include "ass_style.h" #include "ass_style.h"
#include "auto4_lua.h" #include "auto4_lua.h"
#include "colour_button.h" #include "colour_button.h"
@ -136,7 +138,7 @@ namespace Automation4 {
} }
lua_pop(L, 1); lua_pop(L, 1);
wxLogDebug(_T("created control: '%s', (%d,%d)(%d,%d), '%s'"), name.c_str(), x, y, width, height, hint.c_str()); LOG_D("automation/lua/dialog") << "created control: '" << name.c_str() << "', (" << x << "," << y << ")(" << width << "," << height << ", "<< hint.c_str();
} }
@ -889,7 +891,7 @@ nospin:
LuaConfigDialog::LuaConfigDialog(lua_State *L, bool include_buttons) LuaConfigDialog::LuaConfigDialog(lua_State *L, bool include_buttons)
: use_buttons(include_buttons) : use_buttons(include_buttons)
{ {
wxLogDebug(_T("creating LuaConfigDialog, this addr is %p"), this); LOG_D("automation/lua/dialog") << "creating LuaConfigDialoug, addr: " << this;
button_pushed = 0; button_pushed = 0;
if (include_buttons) { if (include_buttons) {
@ -1003,13 +1005,14 @@ badcontrol:
if (use_buttons) { if (use_buttons) {
wxStdDialogButtonSizer *bs = new wxStdDialogButtonSizer(); wxStdDialogButtonSizer *bs = new wxStdDialogButtonSizer();
if (buttons.size() > 0) { if (buttons.size() > 0) {
wxLogDebug(_T("creating user buttons")); LOG_D("automation/lua/dialog") << "creating user buttons";
for (size_t i = 0; i < buttons.size(); ++i) { for (size_t i = 0; i < buttons.size(); ++i) {
wxLogDebug(_T("button '%s' gets id %d"), buttons[i].c_str(), 1001+(wxWindowID)i); LOG_D("automation/lua/dialog") << "button '" << buttons[i].c_str() << "' gets id " << 1001+(wxWindowID)i;
bs->Add(new wxButton(w, 1001+(wxWindowID)i, buttons[i])); bs->Add(new wxButton(w, 1001+(wxWindowID)i, buttons[i]));
} }
} else { } else {
wxLogDebug(_T("creating default buttons")); LOG_D("automation/lua/dialog") << "creating default buttons";
bs->Add(new wxButton(w, wxID_OK)); bs->Add(new wxButton(w, wxID_OK));
bs->Add(new wxButton(w, wxID_CANCEL)); bs->Add(new wxButton(w, wxID_CANCEL));
} }
@ -1019,7 +1022,7 @@ badcontrol:
button_event->button_pushed = &button_pushed; button_event->button_pushed = &button_pushed;
// passing button_event as userdata because wx will then delete it // 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); 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); LOG_D("automation/lua/dialog") << "set event handler, addr: " << this;
wxBoxSizer *ms = new wxBoxSizer(wxVERTICAL); wxBoxSizer *ms = new wxBoxSizer(wxVERTICAL);
ms->Add(s, 0, wxBOTTOM, 5); ms->Add(s, 0, wxBOTTOM, 5);
@ -1041,17 +1044,17 @@ badcontrol:
{ {
// First read back which button was pressed, if any // First read back which button was pressed, if any
if (use_buttons) { if (use_buttons) {
wxLogDebug(_T("reading back button_pushed")); LOG_D("automation/lua/dialog") << "reading back button_pushed";
int btn = button_pushed; int btn = button_pushed;
if (btn == 0) { if (btn == 0) {
wxLogDebug(_T("was zero, cancelled")); LOG_D("automation/lua/dialog") << "was zero, cancelled";
// Always cancel/closed // Always cancel/closed
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
} else if (buttons.size() == 0 && btn == 1) { } else if (buttons.size() == 0 && btn == 1) {
wxLogDebug(_T("default buttons, button 1 pushed, Ok button")); LOG_D("automation/lua/dialog") << "default buttons, button 1 bushed, Ok button";
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
} else { } else {
wxLogDebug(_T("user button: %s"), buttons.at(btn-1).c_str()); LOG_D("automation/lua/dialog") << "user button: " << buttons.at(btn-1).c_str();
// button_pushed is index+1 to reserve 0 for Cancel // button_pushed is index+1 to reserve 0 for Cancel
lua_pushstring(L, buttons.at(btn-1).mb_str(wxConvUTF8)); lua_pushstring(L, buttons.at(btn-1).mb_str(wxConvUTF8));
} }
@ -1140,13 +1143,13 @@ badcontrol:
// Let button_pushed == 0 mean "cancelled", such that pushing Cancel or closing the dialog // Let button_pushed == 0 mean "cancelled", such that pushing Cancel or closing the dialog
// will both result in button_pushed == 0 // will both result in button_pushed == 0
if (evt.GetId() == wxID_OK) { if (evt.GetId() == wxID_OK) {
wxLogDebug(_T("was wxID_OK")); LOG_D("automation/lua/dialog") << "was wxID_OK";
*button_pushed = 1; *button_pushed = 1;
} else if (evt.GetId() == wxID_CANCEL) { } else if (evt.GetId() == wxID_CANCEL) {
wxLogDebug(_T("was wxID_CANCEL")); LOG_D("automation/lua/dialog") << "was wxID_CANCEL";
*button_pushed = 0; *button_pushed = 0;
} else { } else {
wxLogDebug(_T("was user button")); LOG_D("automation/lua/dialog") << "was user button";
// Therefore, when buttons are numbered from 1001 to 1000+n, make sure to set it to i+1 // Therefore, when buttons are numbered from 1001 to 1000+n, make sure to set it to i+1
*button_pushed = evt.GetId() - 1000; *button_pushed = evt.GetId() - 1000;
@ -1156,7 +1159,7 @@ badcontrol:
if (button) return; if (button) return;
evt.SetId(wxID_OK); evt.SetId(wxID_OK);
} }
wxLogDebug(_T("button_pushed set to %d"), *button_pushed); LOG_D("automation/lua/dialog") << "button_pushed set to: " << *button_pushed;
evt.Skip(); evt.Skip();
} }

View file

@ -46,6 +46,8 @@
#include <wx/choicdlg.h> // Keep this last so wxUSE_CHOICEDLG is set. #include <wx/choicdlg.h> // Keep this last so wxUSE_CHOICEDLG is set.
#endif #endif
#include <libaegisub/log.h>
#include "compat.h" #include "compat.h"
#include "ffmpegsource_common.h" #include "ffmpegsource_common.h"
#include "frame_main.h" #include "frame_main.h"
@ -260,24 +262,24 @@ wxString FFmpegSourceProvider::GetCacheFilename(const wxString& _filename)
/// @brief Starts the cache cleaner thread /// @brief Starts the cache cleaner thread
/// @return True on success, false if the thread could not be started. /// @return True on success, false if the thread could not be started.
bool FFmpegSourceProvider::CleanCache() { bool FFmpegSourceProvider::CleanCache() {
wxLogDebug(_T("FFmpegSourceCacheCleaner: attempting to start thread")); LOG_D("provider/ffmpegsource/cache") << "attempting to start thread";
FFmpegSourceCacheCleaner *CleaningThread = new FFmpegSourceCacheCleaner(this); FFmpegSourceCacheCleaner *CleaningThread = new FFmpegSourceCacheCleaner(this);
if (CleaningThread->Create() != wxTHREAD_NO_ERROR) { if (CleaningThread->Create() != wxTHREAD_NO_ERROR) {
wxLogDebug(_T("FFmpegSourceCacheCleaner: thread creation failed")); LOG_D("provider/ffmpegsource/cache") << "thread creation failed";
delete CleaningThread; delete CleaningThread;
CleaningThread = NULL; CleaningThread = NULL;
return false; return false;
} }
if (CleaningThread->Run() != wxTHREAD_NO_ERROR) { if (CleaningThread->Run() != wxTHREAD_NO_ERROR) {
wxLogDebug(_T("FFmpegSourceCacheCleaner: failed to start thread")); LOG_D("provider/ffmpegsource/cache") << "failed to start thread";
delete CleaningThread; delete CleaningThread;
CleaningThread = NULL; CleaningThread = NULL;
return false; return false;
} }
wxLogDebug(_T("FFmpegSourceCacheCleaner: thread started successfully")); LOG_D("provider/ffmpegsource/cache") << "thread started successfully";
return true; return true;
} }
@ -295,14 +297,14 @@ FFmpegSourceCacheCleaner::FFmpegSourceCacheCleaner(FFmpegSourceProvider *par) :
wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() { wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
wxMutexLocker lock(FFmpegSourceProvider::CleaningInProgress); wxMutexLocker lock(FFmpegSourceProvider::CleaningInProgress);
if (!lock.IsOk()) { if (!lock.IsOk()) {
wxLogDebug(_T("FFmpegSourceCacheCleaner: cleaning already in progress, thread exiting")); LOG_D("provider/ffmpegsource/cache") << "cleaning already in progress, thread exiting";
return (wxThread::ExitCode)1; return (wxThread::ExitCode)1;
} }
wxString cachedirname = StandardPaths::DecodePath(_T("?user/ffms2cache/")); wxString cachedirname = StandardPaths::DecodePath(_T("?user/ffms2cache/"));
wxDir cachedir; wxDir cachedir;
if (!cachedir.Open(cachedirname)) { if (!cachedir.Open(cachedirname)) {
wxLogDebug(_T("FFmpegSourceCacheCleaner: couldn't open cache directory %s"), cachedirname.c_str()); LOG_D("provider/ffmpegsource/cache") << "couldn't open cache directory " << cachedirname.c_str();
return (wxThread::ExitCode)1; return (wxThread::ExitCode)1;
} }
@ -316,7 +318,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
int maxfiles = OPT_GET("Provider/FFmpegSource/Cache/Files")->GetInt(); int maxfiles = OPT_GET("Provider/FFmpegSource/Cache/Files")->GetInt();
if (!cachedir.HasFiles(_T("*.ffindex"))) { if (!cachedir.HasFiles(_T("*.ffindex"))) {
wxLogDebug(_T("FFmpegSourceCacheCleaner: no index files in cache folder, exiting")); LOG_D("provider/ffmpegsource/cache") << "no index files in cache folder, exiting";
return (wxThread::ExitCode)0; return (wxThread::ExitCode)0;
} }
@ -330,7 +332,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
// unusually paranoid sanity check // unusually paranoid sanity check
// (someone might have deleted the file(s) after we did HasFiles() above; does wxDir.Open() lock the dir?) // (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)) { if (!cachedir.GetFirst(&curfn_str, _T("*.ffindex"), wxDIR_FILES)) {
wxLogDebug(_T("FFmpegSourceCacheCleaner: insanity/race condition/index dir fuckery detected, exiting")); LOG_D("provider/ffmpegsource/cache") << "undefined error";
return (wxThread::ExitCode)1; return (wxThread::ExitCode)1;
} }
@ -350,8 +352,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
} }
if (numfiles <= maxfiles && cursize <= maxsize) { if (numfiles <= maxfiles && cursize <= maxsize) {
wxLogDebug(_T("FFmpegSourceCacheCleaner: cache does not need cleaning (maxsize=%d, cursize=%d; maxfiles=%d, numfiles=%d), exiting"), LOG_D("provider/ffmpegsource/cache") << "cache does not need cleaning (maxsize=" << (int)maxsize << ", cursize=" << (int)cursize << "; maxfiles=" << maxfiles << "numfiles=" << numfiles << ",exiting";
(int)maxsize, (int)cursize, maxfiles, numfiles);
return (wxThread::ExitCode)0; return (wxThread::ExitCode)0;
} }
@ -362,7 +363,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
int64_t fsize = i->second.GetSize().GetValue(); int64_t fsize = i->second.GetSize().GetValue();
if (!wxRemoveFile(i->second.GetFullPath())) { if (!wxRemoveFile(i->second.GetFullPath())) {
wxLogDebug(_T("FFmpegSourceCacheCleaner: failed to remove file %s"),i->second.GetFullPath().c_str()); LOG_D("provider/ffmpegsource/cache") << "failed to remove file " << i->second.GetFullPath().c_str();
continue; continue;
} }
cursize -= fsize; cursize -= fsize;
@ -372,8 +373,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
wxThread::This()->Sleep(250); wxThread::This()->Sleep(250);
} }
wxLogDebug(_T("FFmpegSourceCacheCleaner: deleted %d files"), deleted); LOG_D("provider/ffmpegsource/cache") << "deleted " << deleted << " files, exiting";
wxLogDebug(_T("FFmpegSourceCacheCleaner: done, exiting"));
return (wxThread::ExitCode)0; return (wxThread::ExitCode)0;
} }

View file

@ -45,6 +45,8 @@
#include <wx/log.h> #include <wx/log.h>
#endif #endif
#include <libaegisub/log.h>
#include "compat.h" #include "compat.h"
#include "mythes.hxx" #include "mythes.hxx"
#include "main.h" #include "main.h"
@ -164,7 +166,7 @@ void MySpellThesaurus::SetLanguage(wxString language) {
// Check if language is available // Check if language is available
if (!wxFileExists(idxpath) || !wxFileExists(datpath)) return; if (!wxFileExists(idxpath) || !wxFileExists(datpath)) return;
wxLogDebug(_("Using thesarus: %ls"), datpath.c_str()); LOG_I("thesaurus/file") << "Using thesaurus: " << datpath.c_str();
// Load // Load
mythes = new MyThes(idxpath.mb_str(wxConvLocal),datpath.mb_str(wxConvLocal)); mythes = new MyThes(idxpath.mb_str(wxConvLocal),datpath.mb_str(wxConvLocal));

View file

@ -44,6 +44,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <libaegisub/log.h>
#include <wx/dcmemory.h> #include <wx/dcmemory.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/log.h> #include <wx/log.h>
@ -459,7 +461,7 @@ void RestartAegisub() {
char *support_path = OSX_GetBundleSupportFilesDirectory(); char *support_path = OSX_GetBundleSupportFilesDirectory();
if (!bundle_path || !support_path) return; // oops 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()); 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); LOG_I("util/restart/exec") << exec;
wxExecute(exec); wxExecute(exec);
free(bundle_path); free(bundle_path);
free(support_path); free(support_path);

View file

@ -39,6 +39,8 @@
// Headers // Headers
#include "config.h" #include "config.h"
#include <libaegisub/log.h>
#include "compat.h" #include "compat.h"
#include "main.h" #include "main.h"
#include "options.h" #include "options.h"
@ -75,10 +77,10 @@ VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video) {
return y4m_provider; return y4m_provider;
} }
catch (wxString temp) { catch (wxString temp) {
wxLogDebug(_T("YUV4MPEG provider creation failed with reason: %s; trying other providers"), temp.c_str()); LOG_E("manager/video/provider/yuv4mpeg") << "Provider creation failed with reason: "<< temp.c_str() << " trying other providers";
} }
catch (...) { catch (...) {
wxLogDebug(_T("YUV4MPEG provider creation failed for unknown reasons, trying other providers")); LOG_E("manager/video/provider/yuv4mpeg") << "Provider creation failed (uknown reason) trying other providers";
} }
// List of providers // List of providers

View file

@ -36,6 +36,8 @@
#include "config.h" #include "config.h"
#include <libaegisub/log.h>
#include "video_provider_yuv4mpeg.h" #include "video_provider_yuv4mpeg.h"
// All of this cstdio bogus is because of one reason and one reason only: // All of this cstdio bogus is because of one reason and one reason only:
@ -113,7 +115,7 @@ void YUV4MPEGVideoProvider::LoadVideo(const wxString _filename) {
if (fps_rat.num <= 0 || fps_rat.den <= 0) { if (fps_rat.num <= 0 || fps_rat.den <= 0) {
fps_rat.num = 25; fps_rat.num = 25;
fps_rat.den = 1; fps_rat.den = 1;
wxLogDebug(_T("YUV4MPEG video provider: framerate info unavailable, assuming 25fps")); LOG_D("provider/video/yuv4mpeg") << "framerate info unavailable, assuming 25fps";
} }
if (pixfmt == Y4M_PIXFMT_NONE) if (pixfmt == Y4M_PIXFMT_NONE)
pixfmt = Y4M_PIXFMT_420JPEG; pixfmt = Y4M_PIXFMT_420JPEG;
@ -187,7 +189,7 @@ std::vector<wxString> YUV4MPEGVideoProvider::ReadHeader(int64_t startpos, bool r
if (feof(sf)) { if (feof(sf)) {
// you know, this is one of the places where it would be really nice // you know, this is one of the places where it would be really nice
// to be able to throw an exception object that tells the caller that EOF was reached // to be able to throw an exception object that tells the caller that EOF was reached
wxLogDebug(_T("YUV4MPEG video provider: ReadHeader: Reached EOF, returning")); LOG_D("provider/video/yuv4mpeg") << "ReadHeader: Reached EOF, returning";
break; break;
} }
@ -281,7 +283,7 @@ void YUV4MPEGVideoProvider::ParseFileHeader(const std::vector<wxString>& tags) {
throw wxString(_T("ParseFileHeader: invalid or unknown interlacing mode")); throw wxString(_T("ParseFileHeader: invalid or unknown interlacing mode"));
} }
else else
wxLogDebug(_T("ParseFileHeader: unparsed tag: %s"), tags.at(i).c_str()); LOG_D("provider/video/yuv4mpeg") << "Unparsed tag: " << tags.at(i).c_str();
} }
// The point of all this is to allow multiple YUV4MPEG2 headers in a single file // The point of all this is to allow multiple YUV4MPEG2 headers in a single file