mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-31 16:09:28 +02:00
Bug 2099 - 24-bit WAV (and AIFF) export is wrongly limited to 3GB
Bug 2100 - AIFF exports GT 4GB are trapped but error message is only "WAV"
This commit is contained in:
parent
1f6e4ce037
commit
53eb72103d
@ -202,6 +202,29 @@ bool sf_subtype_is_integer(unsigned int format)
|
||||
subtype == SF_FORMAT_PCM_32);
|
||||
}
|
||||
|
||||
int sf_subtype_bytes_per_sample(unsigned int format){
|
||||
unsigned int subtype = format & SF_FORMAT_SUBMASK;
|
||||
if( subtype == SF_FORMAT_PCM_S8 )
|
||||
return 1;
|
||||
if( subtype == SF_FORMAT_PCM_U8 )
|
||||
return 1;
|
||||
if( subtype == SF_FORMAT_PCM_16 )
|
||||
return 2;
|
||||
if( subtype == SF_FORMAT_PCM_24 )
|
||||
return 3;
|
||||
if( subtype == SF_FORMAT_PCM_32 )
|
||||
return 4;
|
||||
if( subtype == SF_FORMAT_FLOAT )
|
||||
return 4;
|
||||
if( subtype == SF_FORMAT_DOUBLE )
|
||||
return 8;
|
||||
|
||||
// might be different to 2, but this is good enough for
|
||||
// WAV and AIFF file size error trapping.
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
FileExtensions sf_get_all_extensions()
|
||||
{
|
||||
FileExtensions exts;
|
||||
|
@ -96,6 +96,7 @@ SF_FORMAT_INFO *sf_simple_format(int i);
|
||||
|
||||
bool sf_subtype_more_than_16_bits(unsigned int format);
|
||||
bool sf_subtype_is_integer(unsigned int format);
|
||||
int sf_subtype_bytes_per_sample(unsigned int format);
|
||||
|
||||
extern FileExtensions sf_get_all_extensions();
|
||||
|
||||
|
@ -396,22 +396,12 @@ ExportPCM::ExportPCM()
|
||||
SetMaxChannels(255, format);
|
||||
}
|
||||
|
||||
// Bug 2057
|
||||
// This function is not yet called anywhere.
|
||||
// It is provided to get the translation strings.
|
||||
// We can hook it in properly whilst translation happens.
|
||||
void ExportPCM::ReportTooBigError(wxWindow * pParent)
|
||||
{
|
||||
//Temporary translation hack, to say 'WAV or AIFF' rather than 'WAV'
|
||||
wxString message =
|
||||
_("You have attempted to Export a WAV file which would be greater than 4GB.\n"
|
||||
_("You have attempted to Export a WAV or AIFF file which would be greater than 4GB.\n"
|
||||
"Audacity cannot do this, the Export was abandoned.");
|
||||
if( message ==
|
||||
"You have attempted to Export a WAV file which would be greater than 4GB.\n"
|
||||
"Audacity cannot do this, the Export was abandoned.")
|
||||
{
|
||||
message.Replace( "WAV", "WAV or AIFF");
|
||||
}
|
||||
|
||||
ShowErrorDialog(pParent, _("Error Exporting"), message,
|
||||
wxT("Size_limits_for_WAV_and_AIFF_files"));
|
||||
@ -521,8 +511,7 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
|
||||
format = int16Sample;
|
||||
|
||||
float sampleCount = (float)(t1-t0)*rate*info.channels;
|
||||
// floatSamples are always 4 byte, even if processor uses more.
|
||||
float byteCount = sampleCount * ((format==int16Sample)?2:4);
|
||||
float byteCount = sampleCount * sf_subtype_bytes_per_sample( info.format);
|
||||
// Test for 4 Gibibytes, rather than 4 Gigabytes
|
||||
if( byteCount > 4.295e9)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user