Changeset 82252 in vbox for trunk/include
- Timestamp:
- Nov 27, 2019 9:31:53 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r76861 r82252 194 194 195 195 #ifndef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH 196 # if def RT_OS_WINDOWS196 # if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 197 197 # define VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "c:\\temp\\" 198 198 # else … … 216 216 { 217 217 /** Invalid format, do not use. */ 218 PDMAUDIOFMT_INVALID ,218 PDMAUDIOFMT_INVALID = 0, 219 219 /** 8-bit, unsigned. */ 220 220 PDMAUDIOFMT_U8, … … 238 238 typedef enum PDMAUDIODIR 239 239 { 240 /** Invalid zero value as per usual (guards against using unintialized values). */ 241 PDMAUDIODIR_INVALID = 0, 240 242 /** Unknown direction. */ 241 PDMAUDIODIR_UNKNOWN = 0,243 PDMAUDIODIR_UNKNOWN, 242 244 /** Input. */ 243 PDMAUDIODIR_IN = 1,245 PDMAUDIODIR_IN, 244 246 /** Output. */ 245 PDMAUDIODIR_OUT = 2,247 PDMAUDIODIR_OUT, 246 248 /** Duplex handling. */ 247 PDMAUDIODIR_ANY = 3,249 PDMAUDIODIR_ANY, 248 250 /** Hack to blow the type up to 32-bit. */ 249 251 PDMAUDIODIR_32BIT_HACK = 0x7fffffff … … 256 258 typedef uint32_t PDMAUDIODEVLATSPECSEC; 257 259 258 /** Audio device flags. Use with PDMAUDIODEV_FLAG_ flags. */ 259 typedef uint32_t PDMAUDIODEVFLAG; 260 260 /** @name PDMAUDIODEV_FLAGS_XXX 261 * @{ */ 261 262 /** No flags set. */ 262 #define PDMAUDIODEV_FLAGS_NONE 0263 #define PDMAUDIODEV_FLAGS_NONE UINT32_C(0) 263 264 /** The device marks the default device within the host OS. */ 264 #define PDMAUDIODEV_FLAGS_DEFAULT RT_BIT (0)265 #define PDMAUDIODEV_FLAGS_DEFAULT RT_BIT_32(0) 265 266 /** The device can be removed at any time and we have to deal with it. */ 266 #define PDMAUDIODEV_FLAGS_HOTPLUG RT_BIT (1)267 #define PDMAUDIODEV_FLAGS_HOTPLUG RT_BIT_32(1) 267 268 /** The device is known to be buggy and needs special treatment. */ 268 #define PDMAUDIODEV_FLAGS_BUGGY RT_BIT (2)269 #define PDMAUDIODEV_FLAGS_BUGGY RT_BIT_32(2) 269 270 /** Ignore the device, no matter what. */ 270 #define PDMAUDIODEV_FLAGS_IGNORE RT_BIT (3)271 #define PDMAUDIODEV_FLAGS_IGNORE RT_BIT_32(3) 271 272 /** The device is present but marked as locked by some other application. */ 272 #define PDMAUDIODEV_FLAGS_LOCKED RT_BIT (4)273 #define PDMAUDIODEV_FLAGS_LOCKED RT_BIT_32(4) 273 274 /** The device is present but not in an alive state (dead). */ 274 #define PDMAUDIODEV_FLAGS_DEAD RT_BIT(5) 275 #define PDMAUDIODEV_FLAGS_DEAD RT_BIT_32(5) 276 /** @} */ 275 277 276 278 /** … … 279 281 typedef enum PDMAUDIODEVICETYPE 280 282 { 283 /** Invalid zero value as per usual (guards against using unintialized values). */ 284 PDMAUDIODEVICETYPE_INVALID = 0, 281 285 /** Unknown device type. This is the default. */ 282 PDMAUDIODEVICETYPE_UNKNOWN = 0,286 PDMAUDIODEVICETYPE_UNKNOWN, 283 287 /** Dummy device; for backends which are not able to report 284 288 * actual device information (yet). */ … … 293 297 294 298 /** 295 * Audio device instance data. 299 * Audio device info (enumeration result). 300 * @sa PDMAUDIODEVICEENUM, PDMIHOSTAUDIO::pfnGetDevices 296 301 */ 297 302 typedef struct PDMAUDIODEVICE 298 303 { 299 304 /** List node. */ 300 RTLISTNODE Node; 301 /** Friendly name of the device, if any. */ 302 char szName[64]; 305 RTLISTNODE Node; 306 /** Additional data which might be relevant for the current context. 307 * @todo r=bird: I would do this C++ style, having the host specific bits 308 * appended after this structure and downcast. */ 309 void *pvData; 310 /** Size of the additional data. */ 311 size_t cbData; 303 312 /** The device type. */ 304 PDMAUDIODEVICETYPE enmType; 313 PDMAUDIODEVICETYPE enmType; 314 /** Usage of the device. */ 315 PDMAUDIODIR enmUsage; 316 /** Device flags, PDMAUDIODEV_FLAGS_XXX. */ 317 uint32_t fFlags; 305 318 /** Reference count indicating how many audio streams currently are relying on this device. */ 306 uint8_t cRefCount; 307 /** Usage of the device. */ 308 PDMAUDIODIR enmUsage; 309 /** Device flags. */ 310 PDMAUDIODEVFLAG fFlags; 319 uint8_t cRefCount; 311 320 /** Maximum number of input audio channels the device supports. */ 312 uint8_t cMaxInputChannels;321 uint8_t cMaxInputChannels; 313 322 /** Maximum number of output audio channels the device supports. */ 314 uint8_t cMaxOutputChannels; 315 /** Additional data which might be relevant for the current context. */ 316 void *pvData; 317 /** Size of the additional data. */ 318 size_t cbData; 323 uint8_t cMaxOutputChannels; 319 324 /** Device type union, based on enmType. */ 320 325 union … … 323 328 struct 324 329 { 325 /** Vendor ID. */ 326 int16_t VID; 330 /** Vendor ID. 331 * @todo r=bird: Why signed?? VUSB uses uint16_t for idVendor and idProduct! */ 332 int16_t VID; 327 333 /** Product ID. */ 328 int16_t PID;334 int16_t PID; 329 335 } USB; 330 336 } Type; 331 } PDMAUDIODEVICE, *PPDMAUDIODEVICE; 332 333 /** 334 * Structure for keeping an audio device enumeration. 337 /** Friendly name of the device, if any. */ 338 char szName[64]; 339 } PDMAUDIODEVICE; 340 /** Pointer to audio device info (enum result). */ 341 typedef PDMAUDIODEVICE *PPDMAUDIODEVICE; 342 343 /** 344 * An audio device enumeration result. 345 * @sa PDMIHOSTAUDIO::pfnGetDevices 335 346 */ 336 347 typedef struct PDMAUDIODEVICEENUM … … 340 351 /** List of audio devices. */ 341 352 RTLISTANCHOR lstDevices; 342 } PDMAUDIODEVICEENUM, *PPDMAUDIODEVICEENUM; 343 344 /** 345 * Audio (static) configuration of an audio host backend. 353 } PDMAUDIODEVICEENUM; 354 /** Pointer to an audio device enumeration result. */ 355 typedef PDMAUDIODEVICEENUM *PPDMAUDIODEVICEENUM; 356 357 /** 358 * Audio configuration (static) of an audio host backend. 346 359 */ 347 360 typedef struct PDMAUDIOBACKENDCFG 348 361 { 349 362 /** The backend's friendly name. */ 350 char szName[32];363 char szName[32]; 351 364 /** Size (in bytes) of the host backend's audio output stream structure. */ 352 size_t cbStreamOut;365 size_t cbStreamOut; 353 366 /** Size (in bytes) of the host backend's audio input stream structure. */ 354 size_t cbStreamIn;367 size_t cbStreamIn; 355 368 /** Number of concurrent output (playback) streams supported on the host. 356 369 * UINT32_MAX for unlimited concurrent streams, 0 if no concurrent input streams are supported. */ 357 uint32_t cMaxStreamsOut;370 uint32_t cMaxStreamsOut; 358 371 /** Number of concurrent input (recording) streams supported on the host. 359 372 * UINT32_MAX for unlimited concurrent streams, 0 if no concurrent input streams are supported. */ 360 uint32_t cMaxStreamsIn; 361 } PDMAUDIOBACKENDCFG, *PPDMAUDIOBACKENDCFG; 373 uint32_t cMaxStreamsIn; 374 } PDMAUDIOBACKENDCFG; 375 /** Pointer to a static host audio audio configuration. */ 376 typedef PDMAUDIOBACKENDCFG *PPDMAUDIOBACKENDCFG; 362 377 363 378 /** … … 366 381 * Currently only two (2) channels, left and right, are supported. 367 382 * 368 * Note:When changing this structure, make sure to also handle383 * @note When changing this structure, make sure to also handle 369 384 * VRDP's input / output processing in DrvAudioVRDE, as VRDP 370 385 * expects audio data in st_sample_t format (historical reasons) … … 374 389 { 375 390 /** Left channel. */ 376 int64_t i64LSample;391 int64_t i64LSample; 377 392 /** Right channel. */ 378 int64_t i64RSample;393 int64_t i64RSample; 379 394 } PDMAUDIOFRAME; 380 395 /** Pointer to a single (stereo) audio frame. */ … … 385 400 typedef enum PDMAUDIOENDIANNESS 386 401 { 387 /** The usual invalid endian. */388 PDMAUDIOENDIANNESS_INVALID ,402 /** The usual invalid value. */ 403 PDMAUDIOENDIANNESS_INVALID = 0, 389 404 /** Little endian. */ 390 405 PDMAUDIOENDIANNESS_LITTLE, … … 399 414 } PDMAUDIOENDIANNESS; 400 415 416 /** @def PDMAUDIOHOSTENDIANNESS 417 * The PDMAUDIOENDIANNESS value for the host. */ 418 #if defined(RT_LITTLE_ENDIAN) 419 # define PDMAUDIOHOSTENDIANNESS PDMAUDIOENDIANNESS_LITTLE 420 #elif defined(RT_BIG_ENDIAN) 421 # define PDMAUDIOHOSTENDIANNESS PDMAUDIOENDIANNESS_BIG 422 #else 423 # error "Port me!" 424 #endif 425 401 426 /** 402 427 * Audio playback destinations. 403 428 */ 404 typedef enum PDMAUDIOPLAYBACKDEST 405 { 429 typedef enum PDMAUDIOPLAYBACKDST 430 { 431 /** Invalid zero value as per usual (guards against using unintialized values). */ 432 PDMAUDIOPLAYBACKDST_INVALID = 0, 406 433 /** Unknown destination. */ 407 PDMAUDIOPLAYBACKD EST_UNKNOWN = 0,434 PDMAUDIOPLAYBACKDST_UNKNOWN, 408 435 /** Front channel. */ 409 PDMAUDIOPLAYBACKD EST_FRONT,436 PDMAUDIOPLAYBACKDST_FRONT, 410 437 /** Center / LFE (Subwoofer) channel. */ 411 PDMAUDIOPLAYBACKD EST_CENTER_LFE,438 PDMAUDIOPLAYBACKDST_CENTER_LFE, 412 439 /** Rear channel. */ 413 PDMAUDIOPLAYBACKD EST_REAR,440 PDMAUDIOPLAYBACKDST_REAR, 414 441 /** Hack to blow the type up to 32-bit. */ 415 PDMAUDIOPLAYBACKD EST_32BIT_HACK = 0x7fffffff416 } PDMAUDIOPLAYBACKD EST;442 PDMAUDIOPLAYBACKDST_32BIT_HACK = 0x7fffffff 443 } PDMAUDIOPLAYBACKDST; 417 444 418 445 /** 419 446 * Audio recording sources. 420 */ 421 typedef enum PDMAUDIORECSOURCE 447 * 448 * @note Because this is almost exclusively used in PDMAUDIODSTSRCUNION where it 449 * overlaps with PDMAUDIOPLAYBACKDST, the values starts at 64 instead of 0. 450 */ 451 typedef enum PDMAUDIORECSRC 422 452 { 423 453 /** Unknown recording source. */ 424 PDMAUDIORECS OURCE_UNKNOWN = 0,454 PDMAUDIORECSRC_UNKNOWN = 64, 425 455 /** Microphone-In. */ 426 PDMAUDIORECS OURCE_MIC,456 PDMAUDIORECSRC_MIC, 427 457 /** CD. */ 428 PDMAUDIORECS OURCE_CD,458 PDMAUDIORECSRC_CD, 429 459 /** Video-In. */ 430 PDMAUDIORECS OURCE_VIDEO,460 PDMAUDIORECSRC_VIDEO, 431 461 /** AUX. */ 432 PDMAUDIORECS OURCE_AUX,462 PDMAUDIORECSRC_AUX, 433 463 /** Line-In. */ 434 PDMAUDIORECS OURCE_LINE,464 PDMAUDIORECSRC_LINE, 435 465 /** Phone-In. */ 436 PDMAUDIORECS OURCE_PHONE,466 PDMAUDIORECSRC_PHONE, 437 467 /** Hack to blow the type up to 32-bit. */ 438 PDMAUDIORECSOURCE_32BIT_HACK = 0x7fffffff 439 } PDMAUDIORECSOURCE; 468 PDMAUDIORECSRC_32BIT_HACK = 0x7fffffff 469 } PDMAUDIORECSRC; 470 471 /** 472 * Union for keeping an audio stream destination or source. 473 */ 474 typedef union PDMAUDIODSTSRCUNION 475 { 476 /** Desired playback destination (for an output stream). */ 477 PDMAUDIOPLAYBACKDST enmDst; 478 /** Desired recording source (for an input stream). */ 479 PDMAUDIORECSRC enmSrc; 480 } PDMAUDIODSTSRCUNION; 481 /** Pointer to an audio stream src/dst union. */ 482 typedef PDMAUDIODSTSRCUNION *PPDMAUDIODSTSRCUNION; 440 483 441 484 /** … … 444 487 typedef enum PDMAUDIOSTREAMLAYOUT 445 488 { 446 /** Unknown access type; do not use. */ 447 PDMAUDIOSTREAMLAYOUT_UNKNOWN = 0, 489 /** Invalid zero value as per usual (guards against using unintialized values). */ 490 PDMAUDIOSTREAMLAYOUT_INVALID = 0, 491 /** Unknown access type; do not use (hdaR3StreamMapReset uses it). */ 492 PDMAUDIOSTREAMLAYOUT_UNKNOWN, 448 493 /** Non-interleaved access, that is, consecutive 449 494 * access to the data. */ … … 462 507 /** Hack to blow the type up to 32-bit. */ 463 508 PDMAUDIOSTREAMLAYOUT_32BIT_HACK = 0x7fffffff 464 } PDMAUDIOSTREAMLAYOUT, *PPDMAUDIOSTREAMLAYOUT; 465 509 } PDMAUDIOSTREAMLAYOUT; 510 511 /** 512 * Stream channel data block. 513 */ 514 typedef struct PDMAUDIOSTREAMCHANNELDATA 515 { 516 /** Circular buffer for the channel data. */ 517 PRTCIRCBUF pCircBuf; 518 /** Amount of audio data (in bytes) acquired for reading. */ 519 size_t cbAcq; 520 /** Channel data flags, PDMAUDIOSTREAMCHANNELDATA_FLAGS_XXX. */ 521 uint32_t fFlags; 522 } PDMAUDIOSTREAMCHANNELDATA; 523 /** Pointer to audio stream channel data buffer. */ 524 typedef PDMAUDIOSTREAMCHANNELDATA *PPDMAUDIOSTREAMCHANNELDATA; 525 526 /** @name PDMAUDIOSTREAMCHANNELDATA_FLAGS_XXX 527 * @{ */ 466 528 /** No stream channel data flags defined. */ 467 #define PDMAUDIOSTREAMCHANNELDATA_FLAG_NONE 0 468 469 /** 470 * Structure for keeping a stream channel data block around. 471 */ 472 typedef struct PDMAUDIOSTREAMCHANNELDATA 473 { 474 /** Circular buffer for the channel data. */ 475 PRTCIRCBUF pCircBuf; 476 /** Amount of audio data (in bytes) acquired for reading. */ 477 size_t cbAcq; 478 /** Channel data flags. */ 479 uint32_t fFlags; 480 } PDMAUDIOSTREAMCHANNELDATA, *PPDMAUDIOSTREAMCHANNELDATA; 481 482 /** 483 * Enumeration for standard speaker channel IDs. 529 #define PDMAUDIOSTREAMCHANNELDATA_FLAGS_NONE UINT32_C(0) 530 /** @} */ 531 532 /** 533 * Standard speaker channel IDs. 534 * 484 535 * This can cover up to 11.0 surround sound. 485 536 * 486 * Note: Any of those channels can be marked / used as the LFE channel (played through the subwoofer). 537 * @note Any of those channels can be marked / used as the LFE channel (played 538 * through the subwoofer). 487 539 */ 488 540 typedef enum PDMAUDIOSTREAMCHANNELID 489 541 { 542 /** Invalid zero value as per usual (guards against using unintialized values). */ 543 PDMAUDIOSTREAMCHANNELID_INVALID = 0, 490 544 /** Unknown / not set channel ID. */ 491 PDMAUDIOSTREAMCHANNELID_UNKNOWN = 0,545 PDMAUDIOSTREAMCHANNELID_UNKNOWN, 492 546 /** Front left channel. */ 493 547 PDMAUDIOSTREAMCHANNELID_FRONT_LEFT, … … 521 575 522 576 /** 523 * Structure for mapping a single (mono) channel or dual (stereo) channels of an audio stream (aka stream profile). 524 * 525 * An audio stream consists of one or multiple channels (e.g. 1 for mono, 2 for stereo), 526 * depending on the configuration. 577 * Structure for mapping a single (mono) channel or dual (stereo) channels onto 578 * an audio stream (aka stream profile). 579 * 580 * An audio stream consists of one or multiple channels (e.g. 1 for mono, 2 for 581 * stereo), depending on the configuration. 527 582 */ 528 583 typedef struct PDMAUDIOSTREAMMAP 529 584 { 530 585 /** Array of channel IDs being handled. 531 * Note:The first (zero-based) index specifies the leftmost channel. */532 PDMAUDIOSTREAMCHANNELID aID[2];586 * @note The first (zero-based) index specifies the leftmost channel. */ 587 PDMAUDIOSTREAMCHANNELID aID[2]; 533 588 /** Step size (in bytes) to the channel's next frame. */ 534 size_t cbSize;589 uint32_t cbStep; 535 590 /** Frame size (in bytes) of this channel. */ 536 size_tcbFrame;537 /** Offset (in bytes) tofirst frame in the data block. */538 size_t cbFirst;539 /** Offset (in bytes)to the next frame in the data block. */540 size_t cbOff;591 uint32_t cbFrame; 592 /** Byte offset to the first frame in the data block. */ 593 uint32_t offFirst; 594 /** Byte offset to the next frame in the data block. */ 595 uint32_t offNext; 541 596 /** Associated data buffer. */ 542 PDMAUDIOSTREAMCHANNELDATA Data; 543 } PDMAUDIOSTREAMMAP, *PPDMAUDIOSTREAMMAP; 544 545 /** 546 * Union for keeping an audio stream destination or source. 547 */ 548 typedef union PDMAUDIODESTSOURCE 549 { 550 /** Desired playback destination (for an output stream). */ 551 PDMAUDIOPLAYBACKDEST Dest; 552 /** Desired recording source (for an input stream). */ 553 PDMAUDIORECSOURCE Source; 554 } PDMAUDIODESTSOURCE, *PPDMAUDIODESTSOURCE; 597 PDMAUDIOSTREAMCHANNELDATA Data; 598 } PDMAUDIOSTREAMMAP; 599 /** Pointer to an audio stream channel mapping. */ 600 typedef PDMAUDIOSTREAMMAP *PPDMAUDIOSTREAMMAP; 555 601 556 602 /** … … 560 606 { 561 607 /** Sample width (in bytes). */ 562 uint8_t c Bytes;608 uint8_t cbSample; 563 609 /** Number of audio channels. */ 564 610 uint8_t cChannels; 565 /** Shift count used for faster calculation of various 566 * values, such as the alignment, bytes to frames and so on. 567 * Depends on number of stream channels and the stream format 568 * being used. 569 * 570 ** @todo Use some RTAsmXXX functions instead? 571 */ 611 /** Shift count used with PDMAUDIOPCMPROPS_F2B and PDMAUDIOPCMPROPS_B2F. 612 * Depends on number of stream channels and the stream format being used, calc 613 * value using PDMAUDIOPCMPROPS_MAKE_SHIFT. 614 * @sa PDMAUDIOSTREAMCFG_B2F, PDMAUDIOSTREAMCFG_F2B 615 * @todo r=bird: The original brief description: "Shift count used 616 * for faster calculation of various values, such as the alignment, bytes 617 * to frames and so on." I cannot make heads or tails from that. 618 * @todo Use some RTAsmXXX functions instead? */ 572 619 uint8_t cShift; 573 620 /** Signed or unsigned sample. */ … … 578 625 uint32_t uHz; 579 626 } PDMAUDIOPCMPROPS; 627 AssertCompileSize(PDMAUDIOPCMPROPS, 8); 580 628 AssertCompileSizeAlignment(PDMAUDIOPCMPROPS, 8); 581 629 /** Pointer to audio stream properties. */ 582 630 typedef PDMAUDIOPCMPROPS *PPDMAUDIOPCMPROPS; 583 631 632 /** @name Macros for use with PDMAUDIOPCMPROPS 633 * @{ */ 584 634 /** Initializor for PDMAUDIOPCMPROPS. */ 585 635 #define PDMAUDIOPCMPROPS_INITIALIZOR(a_cBytes, a_fSigned, a_cCannels, a_uHz, a_cShift, a_fSwapEndian) \ … … 589 639 #define PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(cBytes, cChannels) ((cChannels == 2) + (cBytes / 2)) 590 640 /** Calculates the cShift value of a PDMAUDIOPCMPROPS structure. */ 591 #define PDMAUDIOPCMPROPS_MAKE_SHIFT(pProps) PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS((pProps)->cBytes, (pProps)->cChannels)641 #define PDMAUDIOPCMPROPS_MAKE_SHIFT(pProps) PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS((pProps)->cbSample, (pProps)->cChannels) 592 642 /** Converts (audio) frames to bytes. 593 643 * Needs the cShift value set correctly, using PDMAUDIOPCMPROPS_MAKE_SHIFT. */ 594 #define PDMAUDIOPCMPROPS_F2B(pProps, frames) 644 #define PDMAUDIOPCMPROPS_F2B(pProps, frames) ((frames) << (pProps)->cShift) 595 645 /** Converts bytes to (audio) frames. 596 646 * Needs the cShift value set correctly, using PDMAUDIOPCMPROPS_MAKE_SHIFT. */ 597 #define PDMAUDIOPCMPROPS_B2F(pProps, cb) (cb >> (pProps)->cShift) 647 #define PDMAUDIOPCMPROPS_B2F(pProps, cb) ((cb) >> (pProps)->cShift) 648 /** @} */ 598 649 599 650 /** … … 602 653 typedef struct PDMAUDIOSTREAMCFG 603 654 { 604 /** Friendly name of the stream. */605 char szName[64];606 655 /** Direction of the stream. */ 607 PDMAUDIODIR 656 PDMAUDIODIR enmDir; 608 657 /** Destination / source indicator, depending on enmDir. */ 609 PDMAUDIOD ESTSOURCE DestSource;658 PDMAUDIODSTSRCUNION u; 610 659 /** The stream's PCM properties. */ 611 PDMAUDIOPCMPROPS 660 PDMAUDIOPCMPROPS Props; 612 661 /** The stream's audio data layout. 613 662 * This indicates how the audio data buffers to/from the backend is being layouted. … … 622 671 * Can be one or many streams at once, depending on the stream's mixing buffer setup. 623 672 * The audio data will get handled as PDMAUDIOFRAME frames without any modification done. */ 624 PDMAUDIOSTREAMLAYOUT 673 PDMAUDIOSTREAMLAYOUT enmLayout; 625 674 /** Device emulation-specific data needed for the audio connector. */ 626 675 struct … … 628 677 /** Scheduling hint set by the device emulation about when this stream is being served on average (in ms). 629 678 * Can be 0 if not hint given or some other mechanism (e.g. callbacks) is being used. */ 630 uint32_t 679 uint32_t uSchedulingHintMs; 631 680 } Device; 632 681 /** … … 641 690 * This value reflects the number of audio frames in between each hardware interrupt on the 642 691 * backend (host) side. 0 if not set / available by the backend. */ 643 uint32_t 692 uint32_t cfPeriod; 644 693 /** (Ring) buffer size (in audio frames). Often is a multiple of cfPeriod. 645 694 * 0 if not set / available by the backend. */ 646 uint32_t 695 uint32_t cfBufferSize; 647 696 /** Pre-buffering size (in audio frames). Frames needed in buffer before the stream becomes active (pre buffering). 648 697 * The bigger this value is, the more latency for the stream will occur. 649 698 * 0 if not set / available by the backend. UINT32_MAX if not defined (yet). */ 650 uint32_t 699 uint32_t cfPreBuf; 651 700 } Backend; 701 /** Friendly name of the stream. */ 702 char szName[64]; 652 703 } PDMAUDIOSTREAMCFG; 653 704 AssertCompileSizeAlignment(PDMAUDIOPCMPROPS, 8); … … 655 706 typedef PDMAUDIOSTREAMCFG *PPDMAUDIOSTREAMCFG; 656 707 657 658 708 /** Converts (audio) frames to bytes. */ 659 709 #define PDMAUDIOSTREAMCFG_F2B(pCfg, frames) ((frames) << (pCfg->Props).cShift) … … 661 711 #define PDMAUDIOSTREAMCFG_B2F(pCfg, cb) (cb >> (pCfg->Props).cShift) 662 712 663 #if defined(RT_LITTLE_ENDIAN)664 # define PDMAUDIOHOSTENDIANNESS PDMAUDIOENDIANNESS_LITTLE665 #elif defined(RT_BIG_ENDIAN)666 # define PDMAUDIOHOSTENDIANNESS PDMAUDIOENDIANNESS_BIG667 #else668 # error "Port me!"669 #endif670 671 713 /** 672 714 * Audio mixer controls. … … 674 716 typedef enum PDMAUDIOMIXERCTL 675 717 { 718 /** Invalid zero value as per usual (guards against using unintialized values). */ 719 PDMAUDIOMIXERCTL_INVALID = 0, 676 720 /** Unknown mixer control. */ 677 PDMAUDIOMIXERCTL_UNKNOWN = 0,721 PDMAUDIOMIXERCTL_UNKNOWN, 678 722 /** Master volume. */ 679 723 PDMAUDIOMIXERCTL_VOLUME_MASTER, … … 693 737 694 738 /** 695 * Audio stream commands. Used in the audio connector 696 * as well as in the actual host backends. 739 * Audio stream commands. 740 * 741 * Used in the audio connector as well as in the actual host backends. 697 742 */ 698 743 typedef enum PDMAUDIOSTREAMCMD 699 744 { 745 /** Invalid zero value as per usual (guards against using unintialized values). */ 746 PDMAUDIOSTREAMCMD_INVALID = 0, 700 747 /** Unknown command, do not use. */ 701 PDMAUDIOSTREAMCMD_UNKNOWN = 0,748 PDMAUDIOSTREAMCMD_UNKNOWN, 702 749 /** Enables the stream. */ 703 750 PDMAUDIOSTREAMCMD_ENABLE, … … 738 785 * the most silent and 255 the loudest value. */ 739 786 uint8_t uRight; 740 } PDMAUDIOVOLUME, *PPDMAUDIOVOLUME; 787 } PDMAUDIOVOLUME; 788 /** Pointer to audio volume settings. */ 789 typedef PDMAUDIOVOLUME *PPDMAUDIOVOLUME; 741 790 742 791 /** Defines the minimum volume allowed. */ … … 746 795 747 796 /** 748 * Structure for holding rate processing information749 * of a source + destination audio stream. This is needed750 * because both streams can differ regarding their rates751 * andtherefore need to be treated accordingly.797 * Rate processing information of a source & destination audio stream. 798 * 799 * This is needed because both streams can differ regarding their rates and 800 * therefore need to be treated accordingly. 752 801 */ 753 802 typedef struct PDMAUDIOSTREAMRATE … … 755 804 /** Current (absolute) offset in the output 756 805 * (destination) stream. */ 757 uint64_t dstOffset;806 uint64_t dstOffset; 758 807 /** Increment for moving dstOffset for the 759 808 * destination stream. This is needed because the 760 809 * source <-> destination rate might be different. */ 761 uint64_t dstInc;810 uint64_t dstInc; 762 811 /** Current (absolute) offset in the input 763 812 * stream. */ 764 uint32_t srcOffset; 813 uint32_t srcOffset; 814 /** Explicit alignment padding. */ 815 uint32_t u32AlignmentPadding; 765 816 /** Last processed frame of the input stream. 766 817 * Needed for interpolation. */ 767 PDMAUDIOFRAME srcFrameLast; 768 } PDMAUDIOSTREAMRATE, *PPDMAUDIOSTREAMRATE; 769 770 /** 771 * Structure for holding mixing buffer volume parameters. 772 * The volume values are in fixed point style and must 773 * be converted to/from before using with e.g. PDMAUDIOVOLUME. 818 PDMAUDIOFRAME srcFrameLast; 819 } PDMAUDIOSTREAMRATE; 820 /** Pointer to rate processing information of a stream. */ 821 typedef PDMAUDIOSTREAMRATE *PPDMAUDIOSTREAMRATE; 822 823 /** 824 * Mixing buffer volume parameters. 825 * 826 * The volume values are in fixed point style and must be converted to/from 827 * before using with e.g. PDMAUDIOVOLUME. 774 828 */ 775 829 typedef struct PDMAUDMIXBUFVOL 776 830 { 777 831 /** Set to @c true if this stream is muted, @c false if not. */ 778 bool fMuted; 779 /** Left volume to apply during conversion. Pass 0 780 * to convert the original values. May not apply to 781 * all conversion functions. */ 782 uint32_t uLeft; 783 /** Right volume to apply during conversion. Pass 0 784 * to convert the original values. May not apply to 785 * all conversion functions. */ 786 uint32_t uRight; 787 } PDMAUDMIXBUFVOL, *PPDMAUDMIXBUFVOL; 788 789 /** 790 * Structure for holding frame conversion parameters for 791 * the audioMixBufConvFromXXX / audioMixBufConvToXXX macros. 832 bool fMuted; 833 /** Left volume to apply during conversion. 834 * Pass 0 to convert the original values. May not apply to all conversion functions. */ 835 uint32_t uLeft; 836 /** Right volume to apply during conversion. 837 * Pass 0 to convert the original values. May not apply to all conversion functions. */ 838 uint32_t uRight; 839 } PDMAUDMIXBUFVOL; 840 /** Pointer to mixing buffer volument parameters. */ 841 typedef PDMAUDMIXBUFVOL *PPDMAUDMIXBUFVOL; 842 843 /* 844 * Frame conversion parameters for the audioMixBufConvFromXXX / audioMixBufConvToXXX functions. 792 845 */ 793 846 typedef struct PDMAUDMIXBUFCONVOPTS … … 810 863 811 864 /** 812 * Note: All internal handling is done in audio frames, 813 * not in bytes!865 * Note: All internal handling is done in audio frames, not in bytes! 866 * @todo r=bird: What does this node actually apply to? 814 867 */ 815 868 typedef uint32_t PDMAUDIOMIXBUFFMT; … … 841 894 typedef FNPDMAUDIOMIXBUFCONVTO *PFNPDMAUDIOMIXBUFCONVTO; 842 895 896 /** Pointer to audio mixing buffer. */ 843 897 typedef struct PDMAUDIOMIXBUF *PPDMAUDIOMIXBUF; 898 899 /** 900 * Audio mixing buffer. 901 */ 844 902 typedef struct PDMAUDIOMIXBUF 845 903 { … … 898 956 } PDMAUDIOMIXBUF; 899 957 958 /** @name PDMAUDIOFILE_FLAG_XXX 959 * @{ */ 900 960 typedef uint32_t PDMAUDIOFILEFLAGS; 901 902 961 /** No flags defined. */ 903 962 #define PDMAUDIOFILE_FLAG_NONE 0 … … 906 965 /** Audio file flag validation mask. */ 907 966 #define PDMAUDIOFILE_FLAG_VALID_MASK 0x1 967 /** @} */ 908 968 909 969 /** Audio file default open flags. */ … … 1291 1351 * @param ppStream Pointer where to return the created audio stream on success. 1292 1352 */ 1293 DECLR3CALLBACKMEMBER(int, pfnStreamCreate, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAMCFG pCfgHost, PPDMAUDIOSTREAMCFG pCfgGuest, PPDMAUDIOSTREAM *ppStream)); 1353 DECLR3CALLBACKMEMBER(int, pfnStreamCreate, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOSTREAMCFG pCfgHost, 1354 PPDMAUDIOSTREAMCFG pCfgGuest, PPDMAUDIOSTREAM *ppStream)); 1294 1355 1295 1356 /** … … 1518 1579 /** 1519 1580 * Creates an audio stream using the requested stream configuration. 1520 * If a backend is not able to create this configuration, it will return its best match in the acquired configuration 1521 * structure on success. 1581 * 1582 * If a backend is not able to create this configuration, it will return its 1583 * best match in the acquired configuration structure on success. 1522 1584 * 1523 1585 * @returns VBox status code. … … 1526 1588 * @param pCfgReq Pointer to requested stream configuration. 1527 1589 * @param pCfgAcq Pointer to acquired stream configuration. 1528 */ 1529 DECLR3CALLBACKMEMBER(int, pfnStreamCreate, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)); 1590 * @todo r=bird: Implementation (at least Alsa) seems to make undocumented 1591 * assumptions about the content of @a pCfgAcq. 1592 */ 1593 DECLR3CALLBACKMEMBER(int, pfnStreamCreate, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 1594 PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)); 1530 1595 1531 1596 /** … … 1546 1611 * @param enmStreamCmd The stream command to issue. 1547 1612 */ 1548 DECLR3CALLBACKMEMBER(int, pfnStreamControl, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd)); 1613 DECLR3CALLBACKMEMBER(int, pfnStreamControl, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 1614 PDMAUDIOSTREAMCMD enmStreamCmd)); 1549 1615 1550 1616 /**
Note:
See TracChangeset
for help on using the changeset viewer.