Changeset 89338 in vbox
- Timestamp:
- May 28, 2021 8:57:49 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144687
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixBuffer.cpp
r89337 r89338 793 793 pMixBuf->Volume.uRight = AUDIOMIXBUF_VOL_0DB; 794 794 795 /* Prevent division by zero.796 * Do a 1:1 conversion according to AUDIOMIXBUF_S2B_RATIO. */797 pMixBuf->iFreqRatio = 1 << 20;798 799 795 pMixBuf->Props = *pProps; 800 796 -
trunk/src/VBox/Devices/Audio/AudioMixBuffer.h
r89337 r89338 143 143 /** Magic value (AUDIOMIXBUF_MAGIC). */ 144 144 uint32_t uMagic; 145 uint8_t abPadding[4]; 146 /* ???Undocumented??? */ 147 RTLISTNODE Node; 148 /** Name of the buffer. */ 149 char *pszName; 145 /** Size of the frame buffer (in audio frames). */ 146 uint32_t cFrames; 150 147 /** Frame buffer. */ 151 148 PPDMAUDIOFRAME pFrames; 152 /** Size of the frame buffer (in audio frames). */153 uint32_t cFrames;154 149 /** The current read position (in frames). */ 155 150 uint32_t offRead; … … 165 160 * @note This also is known as the distance in ring buffer terms. */ 166 161 uint32_t cUsed; 162 /** Audio properties for the buffer content - for frequency and channel count. 163 * (This is the guest side PCM properties.) */ 164 PDMAUDIOPCMPROPS Props; 167 165 /** Internal representation of current volume used for mixing. */ 168 166 AUDMIXBUFVOL Volume; 169 /** Audio input properties. 170 * @note There is only one set of audio properties here because we have one 171 * mixer buffer for the guest side and a separate one for the host side. 172 * @todo r=bird: Why exactly do we need to use separate mixer buffers? 173 * Couldn't we just have different conversion fuctions and save the 174 * extra copying? */ 175 PDMAUDIOPCMPROPS Props; 176 177 /** Ratio of the associated parent stream's frequency by this stream's 178 * frequency (1<<32), represented as a signed 64 bit integer. 179 * 180 * For example, if the parent stream has a frequency of 44 khZ, and this 181 * stream has a frequency of 11 kHz, the ration then would be 182 * (44/11 * (1 << 32)). 183 * 184 * Currently this does not get changed once assigned. */ 185 int64_t iFreqRatio; 167 /** Name of the buffer. */ 168 char *pszName; 186 169 } AUDIOMIXBUF; 187 170 … … 196 179 * @note Does *not* take the conversion ratio into account. */ 197 180 #define AUDIOMIXBUF_B2F(a_pMixBuf, a_cb) PDMAUDIOPCMPROPS_B2F(&(a_pMixBuf)->Props, a_cb) 198 199 /** Converts frames to bytes, respecting the conversion ratio to200 * a linked buffer. */201 #define AUDIOMIXBUF_F2B_RATIO(a_pMixBuf, a_cFrames) AUDIOMIXBUF_F2B(a_pMixBuf, AUDIOMIXBUF_F2F_RATIO(a_pMixBuf, a_cFrames))202 /** Converts number of frames according to the buffer's ratio.203 * @todo r=bird: Why the *signed* cast? */204 #define AUDIOMIXBUF_F2F_RATIO(a_pMixBuf, a_cFrames) (((int64_t)(a_cFrames) << 32) / (a_pMixBuf)->iFreqRatio)205 181 206 182
Note:
See TracChangeset
for help on using the changeset viewer.