From 4d978bcefb5ea289ddb8b9249d85419129ee769f Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 9 Oct 2017 00:37:10 -0400 Subject: [PATCH] Use wxPrintf not printf --- src/AudacityApp.cpp | 4 +- src/AudioIO.cpp | 48 +++++++++++----------- src/BlockFile.cpp | 2 +- src/DeviceChange.cpp | 18 ++++---- src/Envelope.cpp | 4 +- src/FFmpeg.cpp | 2 +- src/Mix.cpp | 8 ++-- src/Project.cpp | 2 +- src/TimeTrack.cpp | 6 +-- src/WaveTrack.cpp | 32 +++++++-------- src/blockfile/ODDecodeBlockFile.cpp | 2 +- src/blockfile/ODPCMAliasBlockFile.cpp | 4 +- src/effects/audiounits/AudioUnitEffect.cpp | 25 +++++------ src/import/FormatClassifier.cpp | 2 +- src/import/ImportFFmpeg.cpp | 2 +- src/import/ImportMP3.cpp | 16 ++++---- src/import/ImportPCM.cpp | 10 ++--- src/import/ImportRaw.cpp | 5 ++- src/ondemand/ODDecodeFFmpegTask.cpp | 32 +++++++-------- src/ondemand/ODDecodeFlacTask.cpp | 8 ++-- src/ondemand/ODManager.cpp | 10 ++--- src/ondemand/ODTask.cpp | 6 +-- src/widgets/ExpandingToolBar.cpp | 4 +- src/widgets/Meter.cpp | 4 +- src/widgets/NumericTextCtrl.cpp | 10 ++--- 25 files changed, 134 insertions(+), 132 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 2887cf198..7f32e6a2e 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -249,9 +249,9 @@ DEFINE_EVENT_TYPE(EVT_LANGUAGE_CHANGE); static void wxOnAssert(const wxChar *fileName, int lineNumber, const wxChar *msg) { if (msg) - printf("ASSERTION FAILED: %s\n%s: %d\n", (const char *)wxString(msg).mb_str(), (const char *)wxString(fileName).mb_str(), lineNumber); + wxPrintf("ASSERTION FAILED: %s\n%s: %d\n", (const char *)wxString(msg).mb_str(), (const char *)wxString(fileName).mb_str(), lineNumber); else - printf("ASSERTION FAILED!\n%s: %d\n", (const char *)wxString(fileName).mb_str(), lineNumber); + wxPrintf("ASSERTION FAILED!\n%s: %d\n", (const char *)wxString(fileName).mb_str(), lineNumber); // Force core dump int *i = 0; diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index 5b28481a3..8becc433a 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -1611,7 +1611,7 @@ void AudioIO::HandleDeviceChange() #if 0 - printf("PortMixer: Playback: %s Recording: %s\n", + wxPrintf("PortMixer: Playback: %s Recording: %s\n", mEmulateMixerOutputVol? "emulated": "native", mInputMixerWorks? "hardware": "no control"); #endif @@ -2399,7 +2399,7 @@ bool AudioIO::StartPortMidiStream() if (nTracks == 0) return false; - //printf("StartPortMidiStream: mT0 %g mTime %g\n", + //wxPrintf("StartPortMidiStream: mT0 %g mTime %g\n", // gAudioIO->mT0, gAudioIO->mTime); /* get midi playback device */ @@ -4212,7 +4212,7 @@ void AudioIO::OutputEvent() Pm_WriteShort(mMidiStream, timestamp, Pm_Message((int) (command + channel), (long) data1, (long) data2)); - /* printf("Pm_WriteShort %lx (%p) @ %d, advance %d\n", + /* wxPrintf("Pm_WriteShort %lx (%p) @ %d, advance %d\n", Pm_Message((int) (command + channel), (long) data1, (long) data2), mNextEvent, timestamp, timestamp - Pt_Time()); */ @@ -4362,7 +4362,7 @@ PmTimestamp AudioIO::MidiTime() ts = (PmTimestamp) ((unsigned long) (1000 * (now + 1.0005 - mSystemMinusAudioTimePlusLatency))); - // printf("AudioIO::MidiTime() %d time %g sys-aud %g\n", + // wxPrintf("AudioIO::MidiTime() %d time %g sys-aud %g\n", // ts, now, mSystemMinusAudioTime); return ts + MIDI_MINIMAL_LATENCY_MS; } @@ -4454,7 +4454,7 @@ bool AudioIO::AILAIsActive() { void AudioIO::AILASetStartTime() { mAILAAbsolutStartTime = Pa_GetStreamTime(mPortStreamV19); - printf("START TIME %f\n\n", mAILAAbsolutStartTime); + wxPrintf("START TIME %f\n\n", mAILAAbsolutStartTime); } double AudioIO::AILAGetLastDecisionTime() { @@ -4466,7 +4466,7 @@ void AudioIO::AILAProcess(double maxPeak) { if (proj && mAILAActive) { if (mInputMeter->IsClipping()) { mAILAClipped = true; - printf("clipped"); + wxPrintf("clipped"); } mAILAMax = max(mAILAMax, maxPeak); @@ -4476,17 +4476,17 @@ void AudioIO::AILAProcess(double maxPeak) { mAILAMax = mInputMeter->ToLinearIfDB(mAILAMax); double iv = (double) Px_GetInputVolume(mPortMixer); unsigned short changetype = 0; //0 - no change, 1 - increase change, 2 - decrease change - printf("mAILAAnalysisCounter:%d\n", mAILAAnalysisCounter); - printf("\tmAILAClipped:%d\n", mAILAClipped); - printf("\tmAILAMax (linear):%f\n", mAILAMax); - printf("\tmAILAGoalPoint:%f\n", mAILAGoalPoint); - printf("\tmAILAGoalDelta:%f\n", mAILAGoalDelta); - printf("\tiv:%f\n", iv); - printf("\tmAILAChangeFactor:%f\n", mAILAChangeFactor); + wxPrintf("mAILAAnalysisCounter:%d\n", mAILAAnalysisCounter); + wxPrintf("\tmAILAClipped:%d\n", mAILAClipped); + wxPrintf("\tmAILAMax (linear):%f\n", mAILAMax); + wxPrintf("\tmAILAGoalPoint:%f\n", mAILAGoalPoint); + wxPrintf("\tmAILAGoalDelta:%f\n", mAILAGoalDelta); + wxPrintf("\tiv:%f\n", iv); + wxPrintf("\tmAILAChangeFactor:%f\n", mAILAChangeFactor); if (mAILAClipped || mAILAMax > mAILAGoalPoint + mAILAGoalDelta) { - printf("too high:\n"); + wxPrintf("too high:\n"); mAILATopLevel = min(mAILATopLevel, iv); - printf("\tmAILATopLevel:%f\n", mAILATopLevel); + wxPrintf("\tmAILATopLevel:%f\n", mAILATopLevel); //if clipped or too high if (iv <= LOWER_BOUND) { //we can't improve it more now @@ -4494,7 +4494,7 @@ void AudioIO::AILAProcess(double maxPeak) { mAILAActive = false; proj->TP_DisplayStatusMessage(_("Automated Recording Level Adjustment stopped. It was not possible to optimize it more. Still too high.")); } - printf("\talready min vol:%f\n", iv); + wxPrintf("\talready min vol:%f\n", iv); } else { float vol = (float) max(LOWER_BOUND, iv+(mAILAGoalPoint-mAILAMax)*mAILAChangeFactor); @@ -4503,36 +4503,36 @@ void AudioIO::AILAProcess(double maxPeak) { msg.Printf(_("Automated Recording Level Adjustment decreased the volume to %f."), vol); proj->TP_DisplayStatusMessage(msg); changetype = 1; - printf("\tnew vol:%f\n", vol); + wxPrintf("\tnew vol:%f\n", vol); float check = Px_GetInputVolume(mPortMixer); - printf("\tverified %f\n", check); + wxPrintf("\tverified %f\n", check); } } else if ( mAILAMax < mAILAGoalPoint - mAILAGoalDelta ) { //if too low - printf("too low:\n"); + wxPrintf("too low:\n"); if (iv >= UPPER_BOUND || iv + 0.005 > mAILATopLevel) { //condition for too low volumes and/or variable volumes that cause mAILATopLevel to decrease too much //we can't improve it more if (mAILATotalAnalysis != 0) { mAILAActive = false; proj->TP_DisplayStatusMessage(_("Automated Recording Level Adjustment stopped. It was not possible to optimize it more. Still too low.")); } - printf("\talready max vol:%f\n", iv); + wxPrintf("\talready max vol:%f\n", iv); } else { float vol = (float) min(UPPER_BOUND, iv+(mAILAGoalPoint-mAILAMax)*mAILAChangeFactor); if (vol > mAILATopLevel) { vol = (iv + mAILATopLevel)/2.0; - printf("\tTruncated vol:%f\n", vol); + wxPrintf("\tTruncated vol:%f\n", vol); } Px_SetInputVolume(mPortMixer, vol); wxString msg; msg.Printf(_("Automated Recording Level Adjustment increased the volume to %.2f."), vol); proj->TP_DisplayStatusMessage(msg); changetype = 2; - printf("\tnew vol:%f\n", vol); + wxPrintf("\tnew vol:%f\n", vol); float check = Px_GetInputVolume(mPortMixer); - printf("\tverified %f\n", check); + wxPrintf("\tverified %f\n", check); } } @@ -4544,7 +4544,7 @@ void AudioIO::AILAProcess(double maxPeak) { //mAILAAnalysisEndTime = mTime+latency; mAILAAnalysisEndTime = Pa_GetStreamTime(mPortStreamV19) - mAILAAbsolutStartTime; mAILAMax = 0; - printf("\tA decision was made @ %f\n", mAILAAnalysisEndTime); + wxPrintf("\tA decision was made @ %f\n", mAILAAnalysisEndTime); mAILAClipped = false; mAILALastStartTime = mTime; diff --git a/src/BlockFile.cpp b/src/BlockFile.cpp index de4bb2c9c..9817a6848 100644 --- a/src/BlockFile.cpp +++ b/src/BlockFile.cpp @@ -56,7 +56,7 @@ out. #include "FileFormats.h" #include "AudacityApp.h" -// msmeyer: Define this to add debug output via printf() +// msmeyer: Define this to add debug output via wxPrintf() //#define DEBUG_BLOCKFILE #ifdef DEBUG_BLOCKFILE diff --git a/src/DeviceChange.cpp b/src/DeviceChange.cpp index 4aa0b84d3..e6f1d9be0 100644 --- a/src/DeviceChange.cpp +++ b/src/DeviceChange.cpp @@ -244,11 +244,11 @@ public: if (dev) { #if 0 - printf("Got Device\n"); - printf(" Node: %s\n", udev_device_get_devnode(dev)); - printf(" Subsystem: %s\n", udev_device_get_subsystem(dev)); - printf(" Devtype: %s\n", udev_device_get_devtype(dev)); - printf(" Action: %s\n", udev_device_get_action(dev)); + wxPrintf("Got Device\n"); + wxPrintf(" Node: %s\n", udev_device_get_devnode(dev)); + wxPrintf(" Subsystem: %s\n", udev_device_get_subsystem(dev)); + wxPrintf(" Devtype: %s\n", udev_device_get_devtype(dev)); + wxPrintf(" Action: %s\n", udev_device_get_action(dev)); #endif if (This->mEnabled) { @@ -339,10 +339,10 @@ public: for (int i = 0; i < numberAddresses; i++) { #if 0 - printf("address %d\n", i); - printf("selector %08x\n", inAddresses[i].mSelector); - printf("scope %08x\n", inAddresses[i].mScope); - printf("element %08x\n", inAddresses[i].mElement); + wxPrintf("address %d\n", i); + wxPrintf("selector %08x\n", inAddresses[i].mSelector); + wxPrintf("scope %08x\n", inAddresses[i].mScope); + wxPrintf("element %08x\n", inAddresses[i].mElement); #endif if (This->mEnabled) { diff --git a/src/Envelope.cpp b/src/Envelope.cpp index e675d43a5..37676e138 100644 --- a/src/Envelope.cpp +++ b/src/Envelope.cpp @@ -1728,14 +1728,14 @@ double Envelope::SolveIntegralOfInverse( double t0, double area ) const void Envelope::print() const { for( unsigned int i = 0; i < mEnv.size(); i++ ) - printf( "(%.2f, %.2f)\n", mEnv[i].GetT(), mEnv[i].GetVal() ); + wxPrintf( "(%.2f, %.2f)\n", mEnv[i].GetT(), mEnv[i].GetVal() ); } static void checkResult( int n, double a, double b ) { if( (a-b > 0 ? a-b : b-a) > 0.0000001 ) { - printf( "Envelope: Result #%d is: %f, should be %f\n", n, a, b ); + wxPrintf( "Envelope: Result #%d is: %f, should be %f\n", n, a, b ); //exit( -1 ); } } diff --git a/src/FFmpeg.cpp b/src/FFmpeg.cpp index 9c64f13f5..9cb845b2a 100644 --- a/src/FFmpeg.cpp +++ b/src/FFmpeg.cpp @@ -158,7 +158,7 @@ void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl) //will crash. //TODO:find some workaround for the log. perhaps use ODManager as a bridge. for now just print if(!wxThread::IsMain()) - printf("%s: %s\n",(char*)cpt.char_str(),(char*)printstring.char_str()); + wxPrintf("%s: %s\n",(char*)cpt.char_str(),(char*)printstring.char_str()); else #endif wxLogDebug(wxT("%s: %s"),cpt.c_str(),printstring.c_str()); diff --git a/src/Mix.cpp b/src/Mix.cpp index 1fba6f2fe..eb48b8ba9 100644 --- a/src/Mix.cpp +++ b/src/Mix.cpp @@ -212,10 +212,10 @@ void MixAndRender(TrackList *tracks, TrackFactory *trackFactory, // Note: these shouldn't be translated - they're for debugging // and profiling only. - printf(" Tracks: %d\n", numWaves); - printf(" Mix length: %f sec\n", totalTime); - printf("Elapsed time: %f sec\n", elapsedTime); - printf("Max number of tracks to mix in real time: %f\n", maxTracks); + wxPrintf(" Tracks: %d\n", numWaves); + wxPrintf(" Mix length: %f sec\n", totalTime); + wxPrintf("Elapsed time: %f sec\n", elapsedTime); + wxPrintf("Max number of tracks to mix in real time: %f\n", maxTracks); #endif } } diff --git a/src/Project.cpp b/src/Project.cpp index 1e40ad73e..0ff601c1f 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -3323,7 +3323,7 @@ void AudacityProject::EnqueueODTasks() createdODTasks= createdODTasks | ODTask::eODPCMSummary; } else { - printf("unrecognized OD Flag in block file.\n"); + wxPrintf("unrecognized OD Flag in block file.\n"); //TODO:ODTODO: display to user. This can happen when we build audacity on a system that doesnt have libFLAC break; } diff --git a/src/TimeTrack.cpp b/src/TimeTrack.cpp index 4307f8b5f..3862cabaf 100644 --- a/src/TimeTrack.cpp +++ b/src/TimeTrack.cpp @@ -331,11 +331,11 @@ void TimeTrack::testMe() double expected2 = (5.0 - 2.0) / 0.2 + (13.0 - 5.0) / 1.3; if( fabs(value1 - expected1) > 0.01 ) { - printf( "TimeTrack: Integral failed! expected %f got %f\n", expected1, value1); + wxPrintf( "TimeTrack: Integral failed! expected %f got %f\n", expected1, value1); } if( fabs(value2 - expected2) > 0.01 ) { - printf( "TimeTrack: IntegralOfInverse failed! expected %f got %f\n", expected2, value2); + wxPrintf( "TimeTrack: IntegralOfInverse failed! expected %f got %f\n", expected2, value2); } /*double reqt0 = 10.0 - .1; @@ -344,7 +344,7 @@ void TimeTrack::testMe() double t1 = warp( reqt1 ); if( t0 > t1 ) { - printf( "TimeTrack: Warping reverses an interval! [%.2f,%.2f] -> [%.2f,%.2f]\n", + wxPrintf( "TimeTrack: Warping reverses an interval! [%.2f,%.2f] -> [%.2f,%.2f]\n", reqt0, reqt1, t0, t1 ); }*/ diff --git a/src/WaveTrack.cpp b/src/WaveTrack.cpp index 3bd5fec25..6e656df3c 100644 --- a/src/WaveTrack.cpp +++ b/src/WaveTrack.cpp @@ -583,18 +583,18 @@ bool WaveTrack::IsEmpty(double t0, double t1) const if (t0 > t1) return true; - //printf("Searching for overlap in %.6f...%.6f\n", t0, t1); + //wxPrintf("Searching for overlap in %.6f...%.6f\n", t0, t1); for (const auto &clip : mClips) { if (!clip->BeforeClip(t1) && !clip->AfterClip(t0)) { - //printf("Overlapping clip: %.6f...%.6f\n", + //wxPrintf("Overlapping clip: %.6f...%.6f\n", // clip->GetStartTime(), // clip->GetEndTime()); // We found a clip that overlaps this region return false; } } - //printf("No overlap found\n"); + //wxPrintf("No overlap found\n"); // Otherwise, no clips overlap this region return true; @@ -708,7 +708,7 @@ Track::Holder WaveTrack::Copy(double t0, double t1, bool forClipboard) const if (t0 <= clip->GetStartTime() && t1 >= clip->GetEndTime()) { // Whole clip is in copy region - //printf("copy: clip %i is in copy region\n", (int)clip); + //wxPrintf("copy: clip %i is in copy region\n", (int)clip); newTrack->mClips.push_back (make_movable(*clip, mDirManager, ! forClipboard)); @@ -718,7 +718,7 @@ Track::Holder WaveTrack::Copy(double t0, double t1, bool forClipboard) const else if (t1 > clip->GetStartTime() && t0 < clip->GetEndTime()) { // Clip is affected by command - //printf("copy: clip %i is affected by command\n", (int)clip); + //wxPrintf("copy: clip %i is affected by command\n", (int)clip); const double clip_t0 = std::max(t0, clip->GetStartTime()); const double clip_t1 = std::min(t1, clip->GetEndTime()); @@ -726,7 +726,7 @@ Track::Holder WaveTrack::Copy(double t0, double t1, bool forClipboard) const auto newClip = make_movable (*clip, mDirManager, ! forClipboard, clip_t0, clip_t1); - //printf("copy: clip_t0=%f, clip_t1=%f\n", clip_t0, clip_t1); + //wxPrintf("copy: clip_t0=%f, clip_t1=%f\n", clip_t0, clip_t1); newClip->Offset(-t0); if (newClip->GetOffset() < 0) @@ -1299,7 +1299,7 @@ void WaveTrack::Paste(double t0, const Track *src) if (other->GetNumClips() == 0) return; - //printf("paste: we have at least one clip\n"); + //wxPrintf("paste: we have at least one clip\n"); bool singleClipMode = (other->GetNumClips() == 1 && other->GetStartTime() == 0.0); @@ -1312,7 +1312,7 @@ void WaveTrack::Paste(double t0, const Track *src) // a new clip. return; - //printf("Check if we need to make room for the pasted data\n"); + //wxPrintf("Check if we need to make room for the pasted data\n"); // Make room for the pasted data if (editClipCanMove) { @@ -1338,7 +1338,7 @@ void WaveTrack::Paste(double t0, const Track *src) if (singleClipMode) { // Single clip mode - // printf("paste: checking for single clip mode!\n"); + // wxPrintf("paste: checking for single clip mode!\n"); WaveClip *insideClip = NULL; @@ -1348,7 +1348,7 @@ void WaveTrack::Paste(double t0, const Track *src) { if (clip->WithinClip(t0)) { - //printf("t0=%.6f: inside clip is %.6f ... %.6f\n", + //wxPrintf("t0=%.6f: inside clip is %.6f ... %.6f\n", // t0, clip->GetStartTime(), clip->GetEndTime()); insideClip = clip.get(); break; @@ -1369,7 +1369,7 @@ void WaveTrack::Paste(double t0, const Track *src) if (insideClip) { // Exhibit traditional behaviour - //printf("paste: traditional behaviour\n"); + //wxPrintf("paste: traditional behaviour\n"); if (!editClipCanMove) { // We did not move other clips out of the way already, so @@ -1395,7 +1395,7 @@ void WaveTrack::Paste(double t0, const Track *src) } // Insert NEW clips - //printf("paste: multi clip mode!\n"); + //wxPrintf("paste: multi clip mode!\n"); if (!editClipCanMove && !IsEmpty(t0, t0+insertDuration-1.0/mRate)) // STRONG-GUARANTEE in case of this path @@ -1589,7 +1589,7 @@ void WaveTrack::Join(double t0, double t1) for (; it != end; ++it) if ((*it)->GetStartTime() > clip->GetStartTime()) break; - //printf("Insert clip %.6f at position %d\n", clip->GetStartTime(), i); + //wxPrintf("Insert clip %.6f at position %d\n", clip->GetStartTime(), i); clipsToDelete.insert(it, clip.get()); } } @@ -1603,19 +1603,19 @@ void WaveTrack::Join(double t0, double t1) newClip->SetOffset(t); for (const auto &clip : clipsToDelete) { - //printf("t=%.6f adding clip (offset %.6f, %.6f ... %.6f)\n", + //wxPrintf("t=%.6f adding clip (offset %.6f, %.6f ... %.6f)\n", // t, clip->GetOffset(), clip->GetStartTime(), clip->GetEndTime()); if (clip->GetOffset() - t > (1.0 / mRate)) { double addedSilence = (clip->GetOffset() - t); - //printf("Adding %.6f seconds of silence\n"); + //wxPrintf("Adding %.6f seconds of silence\n"); auto offset = clip->GetOffset(); auto value = clip->GetEnvelope()->GetValue( offset ); newClip->AppendSilence( addedSilence, value ); t += addedSilence; } - //printf("Pasting at %.6f\n", t); + //wxPrintf("Pasting at %.6f\n", t); newClip->Paste(t, clip); t = newClip->GetEndTime(); diff --git a/src/blockfile/ODDecodeBlockFile.cpp b/src/blockfile/ODDecodeBlockFile.cpp index 5fbd3a413..78d573529 100644 --- a/src/blockfile/ODDecodeBlockFile.cpp +++ b/src/blockfile/ODDecodeBlockFile.cpp @@ -344,7 +344,7 @@ int ODDecodeBlockFile::WriteODDecodeBlockFile() ret = mDecoder->Decode(sampleData, mFormat, mAliasStart, mLen, mAliasChannel); if(ret < 0) { - printf("ODDecodeBlockFile Decode failure\n"); + wxPrintf("ODDecodeBlockFile Decode failure\n"); return ret; //failure } } diff --git a/src/blockfile/ODPCMAliasBlockFile.cpp b/src/blockfile/ODPCMAliasBlockFile.cpp index 015fb30f3..e3d08b682 100644 --- a/src/blockfile/ODPCMAliasBlockFile.cpp +++ b/src/blockfile/ODPCMAliasBlockFile.cpp @@ -411,7 +411,7 @@ void ODPCMAliasBlockFile::WriteSummary() // Never silence the Log w.r.t write errors; they always count //however, this is going to be called from a non-main thread, //and wxLog calls are not thread safe. - printf("Unable to write summary data to file: %s", fileNameChar.get()); + wxPrintf("Unable to write summary data to file: %s", fileNameChar.get()); throw FileException{ FileException::Cause::Read, wxFileName{ fileNameChar.get() } }; @@ -426,7 +426,7 @@ void ODPCMAliasBlockFile::WriteSummary() fclose(summaryFile); - // printf("write successful. filename: %s\n", fileNameChar); + // wxPrintf("write successful. filename: %s\n", fileNameChar); mSummaryAvailableMutex.Lock(); mSummaryAvailable=true; diff --git a/src/effects/audiounits/AudioUnitEffect.cpp b/src/effects/audiounits/AudioUnitEffect.cpp index 3d78c90d5..03f312032 100644 --- a/src/effects/audiounits/AudioUnitEffect.cpp +++ b/src/effects/audiounits/AudioUnitEffect.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef __WXMAC__ #include @@ -1266,7 +1267,7 @@ bool AudioUnitEffect::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelN sizeof(AURenderCallbackStruct)); if (result != noErr) { - printf("Setting input render callback failed.\n"); + wxPrintf("Setting input render callback failed.\n"); return false; } @@ -1320,7 +1321,7 @@ size_t AudioUnitEffect::ProcessBlock(float **inBlock, float **outBlock, size_t b mOutputList.get()); if (result != noErr) { - printf("Render failed: %d %4.4s\n", (int)result, (char *)&result); + wxPrintf("Render failed: %d %4.4s\n", (int)result, (char *)&result); return 0; } @@ -1948,7 +1949,7 @@ bool AudioUnitEffect::SetRateAndChannels() sizeof(Float64)); if (result != noErr) { - printf("%ls Didn't accept sample rate on global\n", GetName().wx_str()); + wxPrintf("%ls Didn't accept sample rate on global\n", GetName().wx_str()); return false; } @@ -1962,7 +1963,7 @@ bool AudioUnitEffect::SetRateAndChannels() sizeof(Float64)); if (result != noErr) { - printf("%ls Didn't accept sample rate on input\n", GetName().wx_str()); + wxPrintf("%ls Didn't accept sample rate on input\n", GetName().wx_str()); return false; } @@ -1974,7 +1975,7 @@ bool AudioUnitEffect::SetRateAndChannels() sizeof(AudioStreamBasicDescription)); if (result != noErr) { - printf("%ls didn't accept stream format on input\n", GetName().wx_str()); + wxPrintf("%ls didn't accept stream format on input\n", GetName().wx_str()); return false; } } @@ -1989,7 +1990,7 @@ bool AudioUnitEffect::SetRateAndChannels() sizeof(Float64)); if (result != noErr) { - printf("%ls Didn't accept sample rate on output\n", GetName().wx_str()); + wxPrintf("%ls Didn't accept sample rate on output\n", GetName().wx_str()); return false; } @@ -2003,7 +2004,7 @@ bool AudioUnitEffect::SetRateAndChannels() if (result != noErr) { - printf("%ls didn't accept stream format on output\n", GetName().wx_str()); + wxPrintf("%ls didn't accept stream format on output\n", GetName().wx_str()); return false; } } @@ -2011,7 +2012,7 @@ bool AudioUnitEffect::SetRateAndChannels() result = AudioUnitInitialize(mUnit); if (result != noErr) { - printf("Couldn't initialize audio unit\n"); + wxPrintf("Couldn't initialize audio unit\n"); return false; } @@ -2038,7 +2039,7 @@ bool AudioUnitEffect::CopyParameters(AudioUnit srcUnit, AudioUnit dstUnit) &size); if (result != 0) { - printf("Couldn't get number of parameters\n"); + wxPrintf("Couldn't get number of parameters\n"); return false; } @@ -2054,7 +2055,7 @@ bool AudioUnitEffect::CopyParameters(AudioUnit srcUnit, AudioUnit dstUnit) &size); if (result != 0) { - printf("Couldn't get parameter list\n"); + wxPrintf("Couldn't get parameter list\n"); return false; } @@ -2070,7 +2071,7 @@ bool AudioUnitEffect::CopyParameters(AudioUnit srcUnit, AudioUnit dstUnit) ¶meterValue); if (result != 0) { - printf("Couldn't get parameter %d: ID=%d\n", i, (int)parameters[i]); + wxPrintf("Couldn't get parameter %d: ID=%d\n", i, (int)parameters[i]); continue; } @@ -2082,7 +2083,7 @@ bool AudioUnitEffect::CopyParameters(AudioUnit srcUnit, AudioUnit dstUnit) 0); if (result != 0) { - printf("Couldn't set parameter %d: ID=%d\n", i, (int)parameters[i]); + wxPrintf("Couldn't set parameter %d: ID=%d\n", i, (int)parameters[i]); } } diff --git a/src/import/FormatClassifier.cpp b/src/import/FormatClassifier.cpp index 380057b90..c7e16a35a 100644 --- a/src/import/FormatClassifier.cpp +++ b/src/import/FormatClassifier.cpp @@ -82,7 +82,7 @@ FormatClassifier::FormatClassifier(const char* filename) : #ifdef FORMATCLASSIFIER_SIGNAL_DEBUG for (unsigned int n = 0; n < mClasses.size(); n++) { - printf("Class [%i] Machine [%i]: Mono: %3.7f Stereo: %3.7f\n", mClasses[n].format, mClasses[n].endian, mMonoFeat[n], mStereoFeat[n]); + wxPrintf("Class [%i] Machine [%i]: Mono: %3.7f Stereo: %3.7f\n", mClasses[n].format, mClasses[n].endian, mMonoFeat[n], mStereoFeat[n]); } #endif diff --git a/src/import/ImportFFmpeg.cpp b/src/import/ImportFFmpeg.cpp index adb67ff08..e39cdfefa 100644 --- a/src/import/ImportFFmpeg.cpp +++ b/src/import/ImportFFmpeg.cpp @@ -596,7 +596,7 @@ ProgressResult FFmpegImportFileHandle::Import(TrackFactory *trackFactory, else sampleDuration = ((sampleCount)mFormatContext->duration *sc->m_stream->codec->sample_rate) / AV_TIME_BASE; - // printf(" OD duration samples %qi, sr %d, secs %d\n",sampleDuration, (int)sc->m_stream->codec->sample_rate, (int)sampleDuration/sc->m_stream->codec->sample_rate); + // wxPrintf(" OD duration samples %qi, sr %d, secs %d\n",sampleDuration, (int)sc->m_stream->codec->sample_rate, (int)sampleDuration/sc->m_stream->codec->sample_rate); //for each wavetrack within the stream add coded blockfiles for (int c = 0; c < sc->m_stream->codec->channels; c++) { diff --git a/src/import/ImportMP3.cpp b/src/import/ImportMP3.cpp index 6941f8138..8c21afca5 100644 --- a/src/import/ImportMP3.cpp +++ b/src/import/ImportMP3.cpp @@ -240,12 +240,12 @@ ProgressResult MP3ImportFileHandle::Import(TrackFactory *trackFactory, TrackHold if (!res) { /* failure */ - /* printf("failure\n"); */ + /* wxPrintf("failure\n"); */ return (privateData.updateResult); } /* success */ - /* printf("success\n"); */ + /* wxPrintf("success\n"); */ /* copy the WaveTrack pointers into the Track pointer list that * we are expected to fill */ @@ -299,14 +299,14 @@ void MP3ImportFileHandle::ImportID3(Tags *tags) for (int i = 0; i < (int) tp->nframes; i++) { struct id3_frame *frame = tp->frames[i]; - // printf("ID: %08x '%4s'\n", (int) *(int *)frame->id, frame->id); - // printf("Desc: %s\n", frame->description); - // printf("Num fields: %d\n", frame->nfields); + // wxPrintf("ID: %08x '%4s'\n", (int) *(int *)frame->id, frame->id); + // wxPrintf("Desc: %s\n", frame->description); + // wxPrintf("Num fields: %d\n", frame->nfields); // for (int j = 0; j < (int) frame->nfields; j++) { - // printf("field %d type %d\n", j, frame->fields[j].type ); + // wxPrintf("field %d type %d\n", j, frame->fields[j].type ); // if (frame->fields[j].type == ID3_FIELD_TYPE_STRINGLIST) { - // printf("num strings %d\n", frame->fields[j].stringlist.nstrings); + // wxPrintf("num strings %d\n", frame->fields[j].stringlist.nstrings); // } // } @@ -550,7 +550,7 @@ enum mad_flow error_cb(void * WXUNUSED(_data), struct mad_stream * WXUNUSED(stre MAD_FLOW_IGNORE = 0x0020 }; */ /* - printf("decoding error 0x%04x (%s)\n", + wxPrintf("decoding error 0x%04x (%s)\n", stream->error, mad_stream_errorstr(stream)); */ diff --git a/src/import/ImportPCM.cpp b/src/import/ImportPCM.cpp index a81182579..c28001855 100644 --- a/src/import/ImportPCM.cpp +++ b/src/import/ImportPCM.cpp @@ -615,14 +615,14 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory, for (int i = 0; i < (int) tp->nframes; i++) { struct id3_frame *frame = tp->frames[i]; - // printf("ID: %08x '%4s'\n", (int) *(int *)frame->id, frame->id); - // printf("Desc: %s\n", frame->description); - // printf("Num fields: %d\n", frame->nfields); + // wxPrintf("ID: %08x '%4s'\n", (int) *(int *)frame->id, frame->id); + // wxPrintf("Desc: %s\n", frame->description); + // wxPrintf("Num fields: %d\n", frame->nfields); // for (int j = 0; j < (int) frame->nfields; j++) { - // printf("field %d type %d\n", j, frame->fields[j].type ); + // wxPrintf("field %d type %d\n", j, frame->fields[j].type ); // if (frame->fields[j].type == ID3_FIELD_TYPE_STRINGLIST) { - // printf("num strings %d\n", frame->fields[j].stringlist.nstrings); + // wxPrintf("num strings %d\n", frame->fields[j].stringlist.nstrings); // } // } diff --git a/src/import/ImportRaw.cpp b/src/import/ImportRaw.cpp index 7a762e3f3..cdcfe2340 100644 --- a/src/import/ImportRaw.cpp +++ b/src/import/ImportRaw.cpp @@ -40,6 +40,7 @@ and sample size to help you importing data of an unknown format. #include #include +#include #include #include #include @@ -165,7 +166,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName, if (!sndFile){ char str[1000]; sf_error_str((SNDFILE *)NULL, str, 1000); - printf("%s\n", str); + wxPrintf("%s\n", str); throw FileException{ FileException::Cause::Open, fileName }; } @@ -174,7 +175,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName, if (result != 0) { char str[1000]; sf_error_str(sndFile.get(), str, 1000); - printf("%s\n", str); + wxPrintf("%s\n", str); throw FileException{ FileException::Cause::Read, fileName }; } diff --git a/src/ondemand/ODDecodeFFmpegTask.cpp b/src/ondemand/ODDecodeFFmpegTask.cpp index 19830940b..d180d5182 100644 --- a/src/ondemand/ODDecodeFFmpegTask.cpp +++ b/src/ondemand/ODDecodeFFmpegTask.cpp @@ -298,7 +298,7 @@ int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCo samplePtr bufStart = data.ptr(); streamContext* sc = NULL; - // printf("start %llu len %lu\n", start, len); + // wxPrintf("start %llu len %lu\n", start, len); //TODO update this to work with seek - this only works linearly now. if(mCurrentPos > start && mCurrentPos <= start+len + kDecodeSampleAllowance) { @@ -314,7 +314,7 @@ int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCo int stindex = -1; uint64_t targetts; - //printf("attempting seek to %llu\n", start); + //wxPrintf("attempting seek to %llu\n", start); //we have to find the index for this stream. for (unsigned int i = 0; i < mFormatContext->nb_streams; i++) { if (mFormatContext->streams[i] == sc->m_stream ) @@ -334,7 +334,7 @@ int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCo if(targetts<0) targetts=0; - //printf("attempting seek to %llu, attempts %d\n", targetts, numAttempts); + //wxPrintf("attempting seek to %llu, attempts %d\n", targetts, numAttempts); if(av_seek_frame(mFormatContext,stindex,targetts,0) >= 0){ //find out the dts we've seekd to. sampleCount actualDecodeStart { 0.5 + st->codec->sample_rate * st->cur_dts * ((double)st->time_base.num/st->time_base.den) }; //this is mostly safe because den is usually 1 or low number but check for high values. @@ -343,16 +343,16 @@ int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCo seeking = true; //if the seek was past our desired position, rewind a bit. - //printf("seek ok to %llu samps, float: %f\n",actualDecodeStart,actualDecodeStartDouble); + //wxPrintf("seek ok to %llu samps, float: %f\n",actualDecodeStart,actualDecodeStartDouble); } else { - printf("seek failed"); + wxPrintf("seek failed"); break; } } if(mCurrentPos>start){ mSeekingAllowedStatus = (bool)ODFFMPEG_SEEKING_TEST_FAILED; // url_fseek(mFormatContext->pb,sc->m_pkt.pos,SEEK_SET); - printf("seek fail, reverting to previous pos\n"); + wxPrintf("seek fail, reverting to previous pos\n"); return -1; } } @@ -384,7 +384,7 @@ int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCo seeking = false; } if(actualDecodeStart != mCurrentPos) - printf("ts not matching - now:%llu , last:%llu, lastlen:%lu, start %llu, len %lu\n",actualDecodeStart.as_long_long(), mCurrentPos.as_long_long(), mCurrentLen, start.as_long_long(), len); + wxPrintf("ts not matching - now:%llu , last:%llu, lastlen:%lu, start %llu, len %lu\n",actualDecodeStart.as_long_long(), mCurrentPos.as_long_long(), mCurrentLen, start.as_long_long(), len); //if we've skipped over some samples, fill the gap with silence. This could happen often in the beginning of the file. if(actualDecodeStart>start && firstpass) { // find the number of samples for the leading silence @@ -396,7 +396,7 @@ int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCo auto amt = (actualDecodeStart - start).as_size_t(); auto cache = make_movable(); - //printf("skipping/zeroing %i samples. - now:%llu (%f), last:%llu, lastlen:%lu, start %llu, len %lu\n",amt,actualDecodeStart, actualDecodeStartdouble, mCurrentPos, mCurrentLen, start, len); + //wxPrintf("skipping/zeroing %i samples. - now:%llu (%f), last:%llu, lastlen:%lu, start %llu, len %lu\n",amt,actualDecodeStart, actualDecodeStartdouble, mCurrentPos, mCurrentLen, start, len); //put it in the cache so the other channels can use it. // wxASSERT(sc->m_stream->codec->channels > 0); @@ -533,32 +533,32 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat, switch (mDecodeCache[i]->samplefmt) { case AV_SAMPLE_FMT_U8: - //printf("u8 in %lu out %lu cachelen %lu outLen %lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); + //wxPrintf("u8 in %lu out %lu cachelen %lu outLen %lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((int16_t *)outBuf)[outIndex] = (int16_t) (((uint8_t*)mDecodeCache[i]->samplePtr.get())[inIndex] - 0x80) << 8; break; case AV_SAMPLE_FMT_S16: - //printf("u16 in %lu out %lu cachelen %lu outLen % lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); + //wxPrintf("u16 in %lu out %lu cachelen %lu outLen % lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((int16_t *)outBuf)[outIndex] = ((int16_t*)mDecodeCache[i]->samplePtr.get())[inIndex]; break; case AV_SAMPLE_FMT_S32: - //printf("s32 in %lu out %lu cachelen %lu outLen %lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); + //wxPrintf("s32 in %lu out %lu cachelen %lu outLen %lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((float *)outBuf)[outIndex] = (float) ((int32_t*)mDecodeCache[i]->samplePtr.get())[inIndex] * (1.0 / (1u << 31)); break; case AV_SAMPLE_FMT_FLT: - //printf("f in %lu out %lu cachelen %lu outLen %lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); + //wxPrintf("f in %lu out %lu cachelen %lu outLen %lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((float *)outBuf)[outIndex] = (float) ((float*)mDecodeCache[i]->samplePtr.get())[inIndex]; break; case AV_SAMPLE_FMT_DBL: - //printf("dbl in %lu out %lu cachelen %lu outLen %lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); + //wxPrintf("dbl in %lu out %lu cachelen %lu outLen %lu\n", inIndex, outIndex, mDecodeCache[i]->len, len); ((float *)outBuf)[outIndex] = (float) ((double*)mDecodeCache[i]->samplePtr.get())[inIndex]; break; default: - printf("ODDecodeFFMPEG TASK unrecognized sample format\n"); + wxPrintf("ODDecodeFFMPEG TASK unrecognized sample format\n"); return 1; break; } @@ -630,14 +630,14 @@ void ODFFmpegDecoder::InsertCache(movable_ptr &&cache) { //first just guess that the cache is contiguous and we can just use math to figure it out like a dictionary //by guessing where our hit will be. -// printf("inserting cache start %llu, mCurrentPos %llu\n", cache->start, mCurrentPos); +// wxPrintf("inserting cache start %llu, mCurrentPos %llu\n", cache->start, mCurrentPos); while(searchStartstart - mDecodeCache[searchStart]->start )/mDecodeCache[searchEnd]->start; //check greater than OR equals because we want to insert infront of old dupes. if(mDecodeCache[guess]->start>= cache->start) { // if(mDecodeCache[guess]->start == cache->start) { -// printf("dupe! start cache %llu start NEW cache %llu, mCurrentPos %llu\n",mDecodeCache[guess]->start, cache->start, mCurrentPos); +// wxPrintf("dupe! start cache %llu start NEW cache %llu, mCurrentPos %llu\n",mDecodeCache[guess]->start, cache->start, mCurrentPos); // } searchEnd = guess; } diff --git a/src/ondemand/ODDecodeFlacTask.cpp b/src/ondemand/ODDecodeFlacTask.cpp index 2431ed753..a6cade170 100644 --- a/src/ondemand/ODDecodeFlacTask.cpp +++ b/src/ondemand/ODDecodeFlacTask.cpp @@ -96,16 +96,16 @@ void ODFLACFile::error_callback(FLAC__StreamDecoderErrorStatus status) switch (status) { case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC: - printf("Flac Error: Lost sync\n"); + wxPrintf("Flac Error: Lost sync\n"); break; case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH: - printf("Flac Error: Crc mismatch\n"); + wxPrintf("Flac Error: Crc mismatch\n"); break; case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER: - printf("Flac Error: Bad Header\n"); + wxPrintf("Flac Error: Bad Header\n"); break; default: - printf("Flac Error: Unknown error code\n"); + wxPrintf("Flac Error: Unknown error code\n"); break; } } diff --git a/src/ondemand/ODManager.cpp b/src/ondemand/ODManager.cpp index 5d3b17493..0f39a8b47 100644 --- a/src/ondemand/ODManager.cpp +++ b/src/ondemand/ODManager.cpp @@ -224,10 +224,10 @@ void ODManager::Init() // startThread->SetPriority(0);//default of 50. startThread->Create(); -// printf("starting thread from init\n"); +// wxPrintf("starting thread from init\n"); startThread->Run(); -// printf("started thread from init\n"); +// wxPrintf("started thread from init\n"); //destruction of thread is taken care of by thread library } @@ -248,14 +248,14 @@ void ODManager::Start() mNeedsDraw=0; //wxLog calls not threadsafe. are printfs? thread-messy for sure, but safe? -// printf("ODManager thread strating \n"); +// wxPrintf("ODManager thread strating \n"); //TODO: Figure out why this has no effect at all. //wxThread::This()->SetPriority(30); mTerminateMutex.Lock(); while(!mTerminate) { mTerminateMutex.Unlock(); -// printf("ODManager thread running \n"); +// wxPrintf("ODManager thread running \n"); //we should look at our WaveTrack queues to see if we can process a NEW task to the running queue. UpdateQueues(); @@ -331,7 +331,7 @@ void ODManager::Start() mTerminatedMutex.Unlock(); //wxLogDebug Not thread safe. - //printf("ODManager thread terminating\n"); + //wxPrintf("ODManager thread terminating\n"); } //static function that prevents ODTasks from being scheduled diff --git a/src/ondemand/ODTask.cpp b/src/ondemand/ODTask.cpp index aab684f88..75006334d 100644 --- a/src/ondemand/ODTask.cpp +++ b/src/ondemand/ODTask.cpp @@ -71,7 +71,7 @@ void ODTask::DoSome(float amountWork) SetIsRunning(true); mBlockUntilTerminateMutex.Lock(); -// printf("%s %i subtask starting on NEW thread with priority\n", GetTaskName(),GetTaskNumber()); +// wxPrintf("%s %i subtask starting on NEW thread with priority\n", GetTaskName(),GetTaskNumber()); mDoingTask=mTaskStarted=true; @@ -139,7 +139,7 @@ void ODTask::DoSome(float amountWork) } -// printf("%s %i is %f done\n", GetTaskName(),GetTaskNumber(),PercentComplete()); +// wxPrintf("%s %i is %f done\n", GetTaskName(),GetTaskNumber(),PercentComplete()); } else { @@ -164,7 +164,7 @@ void ODTask::DoSome(float amountWork) } } -// printf("%s %i complete\n", GetTaskName(),GetTaskNumber()); +// wxPrintf("%s %i complete\n", GetTaskName(),GetTaskNumber()); } mTerminateMutex.Unlock(); SetIsRunning(false); diff --git a/src/widgets/ExpandingToolBar.cpp b/src/widgets/ExpandingToolBar.cpp index 9119437fc..b175d7a3a 100644 --- a/src/widgets/ExpandingToolBar.cpp +++ b/src/widgets/ExpandingToolBar.cpp @@ -955,7 +955,7 @@ void ToolBarArea::LayoutOne(int childIndex) wxPoint p = mChildArray[childIndex]->GetPosition(); wxSize s = mChildArray[childIndex]->GetSize(); - printf("ToolBar %d moved to row %d at (%d, %d), size (%d x %d)\n", + wxPrintf("ToolBar %d moved to row %d at (%d, %d), size (%d x %d)\n", childIndex, mRowArray[childIndex], p.x, p.y, s.x, s.y); #endif @@ -1007,7 +1007,7 @@ void ToolBarArea::LayoutOne(int childIndex) wxPoint p = mChildArray[childIndex]->GetPosition(); wxSize s = mChildArray[childIndex]->GetSize(); - printf("ToolBar %d moved to row %d at (%d, %d), size (%d x %d)\n", + wxPrintf("ToolBar %d moved to row %d at (%d, %d), size (%d x %d)\n", childIndex, mRowArray[childIndex], p.x, p.y, s.x, s.y); #endif diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index 02dfa160c..6a38ca951 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -1075,11 +1075,11 @@ void Meter::OnMeterUpdate(wxTimerEvent & WXUNUSED(event)) if (mT > gAudioIO->AILAGetLastDecisionTime()) { discarded = false; maxPeak = msg.peak[j] > maxPeak ? msg.peak[j] : maxPeak; - printf("%f@%f ", msg.peak[j], mT); + wxPrintf("%f@%f ", msg.peak[j], mT); } else { discarded = true; - printf("%f@%f discarded\n", msg.peak[j], mT); + wxPrintf("%f@%f discarded\n", msg.peak[j], mT); } #endif } diff --git a/src/widgets/NumericTextCtrl.cpp b/src/widgets/NumericTextCtrl.cpp index c0195f953..ab732aa16 100644 --- a/src/widgets/NumericTextCtrl.cpp +++ b/src/widgets/NumericTextCtrl.cpp @@ -149,7 +149,7 @@ in sanpping without having a window created each time. \class BuiltinFormatString \brief BuiltinFormatString is a structure used in the NumericTextCtrl and holds both a descriptive name for the string format and a -printf inspired style format string, optimised for displaying time in +wxPrintf inspired style format string, optimised for displaying time in different formats. *//****************************************************************//** @@ -803,25 +803,25 @@ void NumericConverter::PrintDebugInfo() { unsigned int i; - printf("%s", (const char *)mPrefix.mb_str()); + wxPrintf("%s", (const char *)mPrefix.mb_str()); for(i=0; i