Changeset 59428 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jan 21, 2016 1:56:23 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 105163
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r59378 r59428 66 66 ******************************************************************************/ 67 67 68 #ifdef DEBUG69 68 static void drvHostCoreAudioPrintASBDesc(const char *pszDesc, const AudioStreamBasicDescription *pStreamDesc) 70 69 { 71 70 char pszSampleRate[32]; 72 Log (("%s AudioStreamBasicDescription:\n", pszDesc));73 Log FlowFunc(("Format ID: %RU32 (%c%c%c%c)\n", pStreamDesc->mFormatID,74 75 76 Log FlowFunc(("Flags: %RU32", pStreamDesc->mFormatFlags));71 LogRel2(("CoreAudio: %s description:\n", pszDesc)); 72 LogRel2(("CoreAudio: Format ID: %RU32 (%c%c%c%c)\n", pStreamDesc->mFormatID, 73 RT_BYTE4(pStreamDesc->mFormatID), RT_BYTE3(pStreamDesc->mFormatID), 74 RT_BYTE2(pStreamDesc->mFormatID), RT_BYTE1(pStreamDesc->mFormatID))); 75 LogRel2(("CoreAudio: Flags: %RU32", pStreamDesc->mFormatFlags)); 77 76 if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsFloat) 78 Log ((" Float"));77 LogRel2((" Float")); 79 78 if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsBigEndian) 80 Log ((" BigEndian"));79 LogRel2((" BigEndian")); 81 80 if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsSignedInteger) 82 Log ((" SignedInteger"));81 LogRel2((" SignedInteger")); 83 82 if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsPacked) 84 Log ((" Packed"));83 LogRel2((" Packed")); 85 84 if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsAlignedHigh) 86 Log ((" AlignedHigh"));85 LogRel2((" AlignedHigh")); 87 86 if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsNonInterleaved) 88 Log ((" NonInterleaved"));87 LogRel2((" NonInterleaved")); 89 88 if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsNonMixable) 90 Log ((" NonMixable"));89 LogRel2((" NonMixable")); 91 90 if (pStreamDesc->mFormatFlags & kAudioFormatFlagsAreAllClear) 92 Log ((" AllClear"));93 Log (("\n"));91 LogRel2((" AllClear")); 92 LogRel2(("\n")); 94 93 snprintf(pszSampleRate, 32, "%.2f", (float)pStreamDesc->mSampleRate); /** @todo r=andy Use RTStrPrint*. */ 95 LogFlowFunc(("SampleRate : %s\n", pszSampleRate)); 96 LogFlowFunc(("ChannelsPerFrame: %RU32\n", pStreamDesc->mChannelsPerFrame)); 97 LogFlowFunc(("FramesPerPacket : %RU32\n", pStreamDesc->mFramesPerPacket)); 98 LogFlowFunc(("BitsPerChannel : %RU32\n", pStreamDesc->mBitsPerChannel)); 99 LogFlowFunc(("BytesPerFrame : %RU32\n", pStreamDesc->mBytesPerFrame)); 100 LogFlowFunc(("BytesPerPacket : %RU32\n", pStreamDesc->mBytesPerPacket)); 101 } 102 #endif /* DEBUG */ 94 LogRel2(("CoreAudio: SampleRate : %s\n", pszSampleRate)); 95 LogRel2(("CoreAudio: ChannelsPerFrame: %RU32\n", pStreamDesc->mChannelsPerFrame)); 96 LogRel2(("CoreAudio: FramesPerPacket : %RU32\n", pStreamDesc->mFramesPerPacket)); 97 LogRel2(("CoreAudio: BitsPerChannel : %RU32\n", pStreamDesc->mBitsPerChannel)); 98 LogRel2(("CoreAudio: BytesPerFrame : %RU32\n", pStreamDesc->mBytesPerFrame)); 99 LogRel2(("CoreAudio: BytesPerPacket : %RU32\n", pStreamDesc->mBytesPerPacket)); 100 } 103 101 104 102 static void drvHostCoreAudioPCMInfoToASBDesc(PDMPCMPROPS *pPcmProperties, AudioStreamBasicDescription *pStreamDesc) … … 807 805 } 808 806 809 /* Switch the I/O mode for input to off. This is important, as this is a pure input stream. */807 /* Switch the I/O mode for output to off. This is important, as this is a pure input stream. */ 810 808 uFlag = 0; 811 809 err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, … … 856 854 drvHostCoreAudioPCMInfoToASBDesc(&pStreamIn->streamIn.Props, &pStreamIn->streamFormat); 857 855 858 #ifdef DEBUG859 856 drvHostCoreAudioPrintASBDesc("CoreAudio: Input device", &pStreamIn->deviceFormat); 860 857 drvHostCoreAudioPrintASBDesc("CoreAudio: Input stream", &pStreamIn->streamFormat); 861 #endif /* DEBUG */862 858 863 859 /* If the frequency of the device is different from the requested one we … … 866 862 || pStreamIn->deviceFormat.mChannelsPerFrame != pStreamIn->streamFormat.mChannelsPerFrame) 867 863 { 864 LogRel(("CoreAudio: Input converter is active\n")); 865 868 866 err = AudioConverterNew(&pStreamIn->deviceFormat, &pStreamIn->streamFormat, &pStreamIn->converter); 869 867 if (RT_UNLIKELY(err != noErr)) 870 868 { 871 LogRel(("CoreAudio: Failed to create the audio converte(%RI32). Input Format=%d, Output Foramt=%d\n", 872 err, pStreamIn->deviceFormat, pStreamIn->streamFormat)); 869 LogRel(("CoreAudio: Failed to create the audio converter (%RI32)\n", err)); 873 870 return VERR_AUDIO_BACKEND_INIT_FAILED; 874 871 } … … 889 886 if (err != noErr) 890 887 { 891 LogRel(("CoreAudio: Failed to set channel mapping for the audio input converter (%RI32)\n", err));888 LogRel(("CoreAudio: Failed to set channel mapping (mono -> stereo) for the audio input converter (%RI32)\n", err)); 892 889 return VERR_AUDIO_BACKEND_INIT_FAILED; 893 890 } 894 }895 896 /* Set the new input format description for the stream. */897 err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,898 1, &pStreamIn->streamFormat, sizeof(pStreamIn->streamFormat));899 if (err != noErr)900 {901 LogRel(("CoreAudio: Failed to set input format for input stream (%RI32)\n", err));902 return VERR_AUDIO_BACKEND_INIT_FAILED;903 891 } 904 892 #if 0 … … 910 898 LogRel(("CoreAudio: Failed to set input audio converter quality to the maximum (%RI32)\n", err)); 911 899 #endif 912 LogRel(("CoreAudio: Input converter is active\n")); 913 } 914 else 915 { 916 /* Set the new output format description for the stream. */ 917 err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 918 1, &pStreamIn->streamFormat, sizeof(pStreamIn->streamFormat)); 919 if (err != noErr) 920 { 921 LogRel(("CoreAudio: Failed to set output format for input stream (%RI32)\n", err)); 922 return VERR_AUDIO_BACKEND_INIT_FAILED; /** @todo Fudge! */ 923 } 900 } 901 902 903 /* Set the new output format description for the input stream. */ 904 err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 905 1, &pStreamIn->streamFormat, sizeof(pStreamIn->streamFormat)); 906 if (err != noErr) 907 { 908 LogRel(("CoreAudio: Failed to set output format for input stream (%RI32)\n", err)); 909 return VERR_AUDIO_BACKEND_INIT_FAILED; /** @todo Fudge! */ 924 910 } 925 911 … … 1196 1182 drvHostCoreAudioPCMInfoToASBDesc(&pStreamOut->streamOut.Props, &pStreamOut->streamFormat); 1197 1183 1198 #ifdef DEBUG1199 1184 drvHostCoreAudioPrintASBDesc("CoreAudio: Output device", &pStreamOut->deviceFormat); 1200 1185 drvHostCoreAudioPrintASBDesc("CoreAudio: Output format", &pStreamOut->streamFormat); 1201 #endif /* DEBUG */1202 1186 1203 1187 /* Set the new output format description for the stream. */
Note:
See TracChangeset
for help on using the changeset viewer.