@@ -1359,15 +1359,15 @@ extern SDL_DECLSPEC Sint64 SDLCALL MIX_GetTrackRemaining(MIX_Track *track);
1359
1359
* mid-stream (for example, if decoding a file that is two MP3s concatenated
1360
1360
* together).
1361
1361
*
1362
- * If the track has no input, this returns 0.
1363
- *
1364
1362
* On various errors (MIX_Init() was not called, the track is NULL), this
1365
- * returns 0, but there is no mechanism to distinguish errors from tracks
1366
- * without a valid input.
1363
+ * returns -1.
1364
+ * If the track has no input, this returns -1.
1365
+ * If `ms` is < 0, this returns -1.
1367
1366
*
1368
1367
* \param track the track to query.
1369
1368
* \param ms the milliseconds to convert to track-specific sample frames.
1370
- * \returns Converted number of sample frames, or zero for errors/no input.
1369
+ * \returns Converted number of sample frames, or -1 for errors/no input; call
1370
+ * SDL_GetError() for details.
1371
1371
*
1372
1372
* \threadsafety It is safe to call this function from any thread.
1373
1373
*
@@ -1388,15 +1388,15 @@ extern SDL_DECLSPEC Sint64 SDLCALL MIX_TrackMSToFrames(MIX_Track *track, Sint64
1388
1388
* Sample frames are more precise than milliseconds, so out of necessity, this
1389
1389
* function will approximate by rounding down to the closest full millisecond.
1390
1390
*
1391
- * If the track has no input, this returns 0.
1392
- *
1393
1391
* On various errors (MIX_Init() was not called, the track is NULL), this
1394
- * returns 0, but there is no mechanism to distinguish errors from tracks
1395
- * without a valid input.
1392
+ * returns -1.
1393
+ * If the track has no input, this returns -1.
1394
+ * If `frames` is < 0, this returns -1.
1396
1395
*
1397
1396
* \param track the track to query.
1398
1397
* \param frames the track-specific sample frames to convert to milliseconds.
1399
- * \returns Converted number of milliseconds, or zero for errors/no input.
1398
+ * \returns Converted number of milliseconds, or -1 for errors/no input; call
1399
+ * SDL_GetError() for details.
1400
1400
*
1401
1401
* \threadsafety It is safe to call this function from any thread.
1402
1402
*
@@ -1412,9 +1412,12 @@ extern SDL_DECLSPEC Sint64 SDLCALL MIX_TrackFramesToMS(MIX_Track *track, Sint64
1412
1412
* This calculates time based on the audio's initial format, even if the
1413
1413
* format would change mid-stream.
1414
1414
*
1415
+ * If `ms` is < 0, this returns -1.
1416
+ *
1415
1417
* \param audio the audio to query.
1416
1418
* \param ms the milliseconds to convert to audio-specific sample frames.
1417
- * \returns Converted number of sample frames, or zero for errors/no input.
1419
+ * \returns Converted number of sample frames, or -1 for errors/no input; call
1420
+ * SDL_GetError() for details.
1418
1421
*
1419
1422
* \threadsafety It is safe to call this function from any thread.
1420
1423
*
@@ -1433,9 +1436,12 @@ extern SDL_DECLSPEC Sint64 SDLCALL MIX_AudioMSToFrames(MIX_Audio *audio, Sint64
1433
1436
* Sample frames are more precise than milliseconds, so out of necessity, this
1434
1437
* function will approximate by rounding down to the closest full millisecond.
1435
1438
*
1439
+ * If `frames` is < 0, this returns -1.
1440
+ *
1436
1441
* \param audio the audio to query.
1437
1442
* \param frames the audio-specific sample frames to convert to milliseconds.
1438
- * \returns Converted number of milliseconds, or zero for errors/no input.
1443
+ * \returns Converted number of milliseconds, or -1 for errors/no input; call
1444
+ * SDL_GetError() for details.
1439
1445
*
1440
1446
* \threadsafety It is safe to call this function from any thread.
1441
1447
*
@@ -1448,11 +1454,13 @@ extern SDL_DECLSPEC Sint64 SDLCALL MIX_AudioFramesToMS(MIX_Audio *audio, Sint64
1448
1454
/**
1449
1455
* Convert milliseconds to sample frames at a specific sample rate.
1450
1456
*
1451
- * If `sample_rate` is <= 0, this returns 0. No error is set.
1457
+ * If `sample_rate` is <= 0, this returns -1.
1458
+ * If `ms` is < 0, this returns -1.
1452
1459
*
1453
1460
* \param sample_rate the sample rate to use for conversion.
1454
1461
* \param ms the milliseconds to convert to rate-specific sample frames.
1455
- * \returns Converted number of sample frames, or zero for errors.
1462
+ * \returns Converted number of sample frames, or -1 for errors; call
1463
+ * SDL_GetError() for details.
1456
1464
*
1457
1465
* \threadsafety It is safe to call this function from any thread.
1458
1466
*
@@ -1465,14 +1473,16 @@ extern SDL_DECLSPEC Sint64 SDLCALL MIX_MSToFrames(int sample_rate, Sint64 ms);
1465
1473
/**
1466
1474
* Convert sample frames, at a specific sample rate, to milliseconds.
1467
1475
*
1468
- * If `sample_rate` is <= 0, this returns 0. No error is set.
1469
- *
1470
1476
* Sample frames are more precise than milliseconds, so out of necessity, this
1471
1477
* function will approximate by rounding down to the closest full millisecond.
1472
1478
*
1479
+ * If `sample_rate` is <= 0, this returns -1.
1480
+ * If `frames` is < 0, this returns -1.
1481
+ *
1473
1482
* \param sample_rate the sample rate to use for conversion.
1474
1483
* \param frames the rate-specific sample frames to convert to milliseconds.
1475
- * \returns Converted number of milliseconds, or zero for errors.
1484
+ * \returns Converted number of milliseconds, or -1 for errors; call
1485
+ * SDL_GetError() for details.
1476
1486
*
1477
1487
* \threadsafety It is safe to call this function from any thread.
1478
1488
*
0 commit comments