Skip to content

Commit

Permalink
Desktop AudioDevice#getLatency() now returns values in samples and no…
Browse files Browse the repository at this point in the history
…t milliseconds (libgdx#6978)

* Desktop AudioDevice#getLatency should return in samples, not ms

* Update CHANGES file

* Remove spaces between casts to fit code style

* Move AudioDevice#getLatency() change in CHANGES to a breaking change
  • Loading branch information
chrislo27 authored Feb 2, 2023
1 parent 494f56e commit 4b1ca87
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [BREAKING CHANGE] MeshPartBuilder#lastIndex now returns int instead of short.
- [BREAKING CHANGE] 3D API - max bone weights is now configurable and limited to 4 by default. Change this value if you need less or more. See #6522.
- [BREAKING CHANGE] Mesh#getVerticesBuffer, Mesh#getIndicesBuffer, VertexData#getBuffer, and IndexData#getBuffer are deprecated in favor to new methods with boolean parameter. If you subclassed some of these classes, you need to implement the new methods.
- [BREAKING CHANGE] Desktop: The return value of AudioDevice#getLatency() is now in samples, and not milliseconds
- iOS: Add new MobiVM MetalANGLE backend
- API Addition: Added Haptics API with 4 different Input#vibrate() methods with complete Android and iOS implementations.
- Fix: Fixed Android and iOS touch cancelled related issues, see #6871.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public boolean isMono () {
}

public int getLatency () {
return (int)(secondsPerBuffer * bufferCount * 1000);
return (int)((float)bufferSize / bytesPerSample / channels * bufferCount);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public boolean isMono () {
}

public int getLatency () {
return (int)(secondsPerBuffer * bufferCount * 1000);
return (int)((float)bufferSize / bytesPerSample / channels * bufferCount);
}

@Override
Expand Down

0 comments on commit 4b1ca87

Please sign in to comment.