Changeset 89342 in vbox for trunk/include
- Timestamp:
- May 28, 2021 10:27:05 AM (4 years ago)
- Location:
- trunk/include/VBox/vmm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r89341 r89342 254 254 255 255 /** 256 * Audio format in signed or unsigned variants.257 */258 typedef enum PDMAUDIOFMT259 {260 /** Invalid format, do not use. */261 PDMAUDIOFMT_INVALID = 0,262 /** 8-bit, unsigned. */263 PDMAUDIOFMT_U8,264 /** 8-bit, signed. */265 PDMAUDIOFMT_S8,266 /** 16-bit, unsigned. */267 PDMAUDIOFMT_U16,268 /** 16-bit, signed. */269 PDMAUDIOFMT_S16,270 /** 32-bit, unsigned. */271 PDMAUDIOFMT_U32,272 /** 32-bit, signed. */273 PDMAUDIOFMT_S32,274 /** End of valid values. */275 PDMAUDIOFMT_END,276 /** Hack to blow the type up to 32-bit. */277 PDMAUDIOFMT_32BIT_HACK = 0x7fffffff278 } PDMAUDIOFMT;279 280 /**281 256 * Audio direction. 282 257 */ -
trunk/include/VBox/vmm/pdmaudioinline.h
r89326 r89342 137 137 AssertMsgFailedReturn(("Unknown enmPath=%d\n", enmPath), "bad"); 138 138 } 139 140 /**141 * Checks whether the audio format is signed.142 *143 * @returns @c true for signed format, @c false for unsigned.144 * @param enmFmt The audio format.145 */146 DECLINLINE(bool) PDMAudioFormatIsSigned(PDMAUDIOFMT enmFmt)147 {148 switch (enmFmt)149 {150 case PDMAUDIOFMT_S8:151 case PDMAUDIOFMT_S16:152 case PDMAUDIOFMT_S32:153 return true;154 155 case PDMAUDIOFMT_U8:156 case PDMAUDIOFMT_U16:157 case PDMAUDIOFMT_U32:158 return false;159 160 /* no default */161 case PDMAUDIOFMT_INVALID:162 case PDMAUDIOFMT_END:163 case PDMAUDIOFMT_32BIT_HACK:164 break;165 }166 AssertMsgFailedReturn(("Bogus audio format %ld\n", enmFmt), false);167 }168 169 /**170 * Gets the encoding width in bits of the give audio format.171 *172 * @returns Bit count. 0 if invalid input.173 * @param enmFmt The audio format.174 */175 DECLINLINE(uint8_t) PDMAudioFormatGetBits(PDMAUDIOFMT enmFmt)176 {177 switch (enmFmt)178 {179 case PDMAUDIOFMT_S8:180 case PDMAUDIOFMT_U8:181 return 8;182 183 case PDMAUDIOFMT_U16:184 case PDMAUDIOFMT_S16:185 return 16;186 187 case PDMAUDIOFMT_U32:188 case PDMAUDIOFMT_S32:189 return 32;190 191 /* no default */192 case PDMAUDIOFMT_INVALID:193 case PDMAUDIOFMT_END:194 case PDMAUDIOFMT_32BIT_HACK:195 break;196 }197 AssertMsgFailedReturn(("Bogus audio format %ld\n", enmFmt), 0);198 }199 200 /**201 * Gets the name of an audio format enum value.202 *203 * @returns Pointer to read-only name on success, returns "bad" on if204 * invalid enum value.205 * @param enmFmt The audio format to name.206 */207 DECLINLINE(const char *) PDMAudioFormatGetName(PDMAUDIOFMT enmFmt)208 {209 switch (enmFmt)210 {211 case PDMAUDIOFMT_U8: return "U8";212 case PDMAUDIOFMT_U16: return "U16";213 case PDMAUDIOFMT_U32: return "U32";214 case PDMAUDIOFMT_S8: return "S8";215 case PDMAUDIOFMT_S16: return "S16";216 case PDMAUDIOFMT_S32: return "S32";217 /* no default */218 case PDMAUDIOFMT_INVALID:219 case PDMAUDIOFMT_END:220 case PDMAUDIOFMT_32BIT_HACK:221 break;222 }223 AssertMsgFailedReturn(("Bogus audio format %d\n", enmFmt), "bad");224 }225 226 139 227 140
Note:
See TracChangeset
for help on using the changeset viewer.