Changeset 89326 in vbox for trunk/include/VBox/vmm
- Timestamp:
- May 28, 2021 12:17:20 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioinline.h
r89301 r89326 683 683 * Converts nanoseconds to frames. 684 684 * 685 * @returns Number of frames 685 * @returns Number of frames. 686 686 * @param pProps The PCM properties to use. 687 687 * @param cNs The number of nanoseconds to convert. … … 707 707 708 708 /** 709 * Converts nanoseconds to frames, 64-bit return. 710 * 711 * @returns Number of frames (64-bit). 712 * @param pProps The PCM properties to use. 713 * @param cNs The number of nanoseconds to convert. 714 * 715 * @note The result is floored! 716 */ 717 DECLINLINE(uint64_t) PDMAudioPropsNanoToFrames64(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs) 718 { 719 AssertPtrReturn(pProps, 0); 720 721 uint32_t const uHz = pProps->uHz; 722 uint64_t cFrames; 723 if (cNs < RT_NS_1SEC) 724 cFrames = 0; 725 else 726 { 727 cFrames = cNs / RT_NS_1SEC * uHz; 728 cNs %= RT_NS_1SEC; 729 } 730 cFrames += ASMMult2xU32RetU64(uHz, (uint32_t)cNs) / RT_NS_1SEC; 731 return cFrames; 732 } 733 734 /** 709 735 * Converts nanoseconds to bytes. 710 736 * … … 716 742 */ 717 743 DECLINLINE(uint32_t) PDMAudioPropsNanoToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs) 744 { 745 return PDMAUDIOPCMPROPS_F2B(pProps, PDMAudioPropsNanoToFrames(pProps, cNs)); 746 } 747 748 /** 749 * Converts nanoseconds to bytes, 64-bit version. 750 * 751 * @returns Number of bytes (frame aligned), 64-bit. 752 * @param pProps The PCM properties to use. 753 * @param cNs The number of nanoseconds to convert. 754 * 755 * @note The result is floored. 756 */ 757 DECLINLINE(uint64_t) PDMAudioPropsNanoToBytes64(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs) 718 758 { 719 759 return PDMAUDIOPCMPROPS_F2B(pProps, PDMAudioPropsNanoToFrames(pProps, cNs));
Note:
See TracChangeset
for help on using the changeset viewer.