2010-09-11 6 views
0
 I only get this 
 Float32 preferredBufferSize = 0.005; // 5 millis buffer 
    UInt32 size = sizeof(preferredBufferSize); 


    AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareIOBufferDuration, &size, 
       &preferredBufferSize); 
    printf("\n%d", kAudioSessionProperty_CurrentHardwareIOBufferDuration); 

SiComment je peux printf comme résultat 0,0045

 printf("\n%.4f", kAudioSessionProperty_CurrentHardwareIOBufferDuration); 

je reçois 73620479325976951480553954495833288118580890 5380376591296729466482703872896792123284994544877461533270472921226586720994654163338779026978512060081697113376452636514975744,0000 736204793259769514805539544958332881185808905380376591296729466482703872896792123284994544877461533270472921226586720994654163338779026978512060081697113376452636514975744,0000

Répondre

2

Vous utilisez un symbole entier. Utilisez un flotteur à la place.

printf("\n%.4f", kAudioSessionProperty_CurrentHardwareIOBufferDuration); 
0
printf("\n%.4f", kAudioSessionProperty_CurrentHardwareIOBufferDuration); 

si vous voulez 4 précision décimale sur un nombre à virgule flottante 32 bits. Déposez le .4 si vous voulez une longueur arbitraire. Pourquoi est-ce que vous imprimez l'ID de la propriété au lieu de la valeur?

1

si vous voulez imprimer vos millisecondes faire comme ceci:

Float32 currentBufferSize; 
UInt32 size = sizeof(currentBufferSize); 
AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareIOBufferDuration, 
         &size, 
         &currentBufferSize); 
printf("\n%.4f", currentBufferSize); 
Questions connexes