Bugzilla – Bug 2443
Mac/Linux: Old (PowerPC) projects open flat-lined or with corrupted display on Intel machines
Last modified: 2020-05-24 12:51:40 UTC
Is an endian problem. The .au files that show the problem are big endian. If you amplify a section by 0dB, those .au files are converted to little endian and show fine. Only happens if inlining functions, -finlinefunction, so does not happen in debug builds. Not seen on Windows. Seen by Bill originally, and also reported on forum. https://forum.audacityteam.org/viewtopic.php?f=47&t=111123&p=395690#p395688
I can reproduce the symptoms by making the '==' comparison that compares two floats fail in these lines in BlockfFile.cpp ComputeMinMax256(summary256, &min, &max, &bad); if (min == summary64K[0] && max == summary64K[1] && bad == 0) { Since inlining can change the values of floats (see this stack overflow question) perhaps this is a clue. https://stackoverflow.com/questions/55590324/inline-version-of-a-function-returns-different-value-than-non-inline-version Plan to test this by using __attribute__((noinline)) for the function I think is causing this.
(In reply to James Crook from comment #1) > I can reproduce the symptoms by making the '==' comparison that compares two > floats fail in these lines in BlockfFile.cpp > > ComputeMinMax256(summary256, &min, &max, &bad); > if (min == summary64K[0] && max == summary64K[1] && bad == 0) { > > Since inlining can change the values of floats (see this stack overflow > question) perhaps this is a clue. > > https://stackoverflow.com/questions/55590324/inline-version-of-a-function- > returns-different-value-than-non-inline-version > > Plan to test this by using __attribute__((noinline)) for the function I > think is causing this. WOW! I never knew that "==" didn't work in some cases. That in absolutely unreal. If your tests prove it out, then I think dropping back to -O2 optimization or using -fno-inline-functions is warranted.
DEVEL - FIX MADE https://github.com/audacity/audacity/commit/00084a8f382980bc174a988209b05a85c9fa6435
Tested on macOS 10.15.4 and W10 with Audacity 2.4.2 00084a8 Tested using the "Old" project that Bill supplied by email/Dropbox that failed for me previously on Mac 1) Mac All looks good here now - with the latest Audacity 2.4.2 00084a8 alpha the waveform is shown correctly and plays properly With the former alpha for Mac I had and for 2.4.1 the waveform showed as a flatline (but played correctly) 2) Windows, W10 All remains good here - with the latest Audacity 2.4.2 00084a8 alpha the waveform is shown correctly and plays properly - but that was also the case with the previous Win alpha that I had and 2.4.1 I would like to see Bill test this on the two projects that he has that previously fell foul of this flat-lining. Plus, of course, it needs a Linux test.
(In reply to Peter Sampson from comment #4) Audacity_00084a8 works fine for me on Mohave and Catalina.
Looks good on Linux as well. Great digging James. I don't believe I'd have ever found it and would have taken the easy way out. :-)
(In reply to Leland Lucius from comment #6) >Great digging James. Yes great forensic and insightful analysis James.