@@ -1294,7 +1294,32 @@ class Converter
12941294
12951295 bool convert_sfx (const QString&, const QString& in_path, const QString& out_path)
12961296 {
1297- if (!m_audioCvt.openInFile (in_path.toStdString ()))
1297+ MDAudioFileSpecWanted spec_wanted;
1298+
1299+ switch (m_spec.target_platform )
1300+ {
1301+ default :
1302+ spec_wanted.m_sample_rate = 44100 ;
1303+ break ;
1304+
1305+ case TargetPlatform::T3X :
1306+ spec_wanted.m_sample_rate = 44100 ;
1307+ spec_wanted.m_channels = 2 ;
1308+ break ;
1309+
1310+ case TargetPlatform::TPL :
1311+ spec_wanted.m_sample_format = AUDIO_S16MSB ;
1312+ spec_wanted.m_sample_rate = 32000 ;
1313+ spec_wanted.m_channels = 2 ;
1314+ break ;
1315+
1316+ case TargetPlatform::DSG :
1317+ spec_wanted.m_sample_rate = 16384 ;
1318+ spec_wanted.m_channels = 1 ;
1319+ break ;
1320+ }
1321+
1322+ if (!m_audioCvt.openInFile (in_path.toStdString (), std::string (), nullptr , &spec_wanted))
12981323 {
12991324 log_file (LogCategory::SkippedInvalid, in_path);
13001325 m_audioCvt.close ();
@@ -1353,7 +1378,32 @@ class Converter
13531378
13541379 bool convert_music_xqoa (const QString&, const QString& in_path, const QString& out_path, const QString &musicArgs = QString())
13551380 {
1356- if (!m_audioCvt.openInFile (in_path.toStdString (), musicArgs.toStdString ()))
1381+ MDAudioFileSpecWanted spec_wanted;
1382+
1383+ switch (m_spec.target_platform )
1384+ {
1385+ default :
1386+ spec_wanted.m_sample_rate = 44100 ;
1387+ break ;
1388+
1389+ case TargetPlatform::T3X :
1390+ spec_wanted.m_sample_rate = 44100 ;
1391+ spec_wanted.m_channels = 2 ;
1392+ break ;
1393+
1394+ case TargetPlatform::TPL :
1395+ spec_wanted.m_sample_format = AUDIO_S16MSB ;
1396+ spec_wanted.m_sample_rate = 32000 ;
1397+ spec_wanted.m_channels = 2 ;
1398+ break ;
1399+
1400+ case TargetPlatform::DSG :
1401+ spec_wanted.m_sample_rate = 16384 ;
1402+ spec_wanted.m_channels = 1 ;
1403+ break ;
1404+ }
1405+
1406+ if (!m_audioCvt.openInFile (in_path.toStdString (), musicArgs.toStdString (), nullptr , &spec_wanted))
13571407 {
13581408 log_file (LogCategory::SkippedInvalid, in_path);
13591409 m_audioCvt.close ();
0 commit comments