Changeset 1318

Show
Ignore:
Timestamp:
01/26/08 14:18:29 (7 months ago)
Author:
bjornroche
Message:

tweaked handling of xruns in core audio slightly. should be cleaner this way

Location:
portaudio/branches/v19-devel/src/hostapi/coreaudio
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • portaudio/branches/v19-devel/src/hostapi/coreaudio/pa_mac_core.c

    r1316 r1318  
    938938                                             kAudioDeviceProcessorOverload, 
    939939                                             xrunCallback, 
    940                                              addToXRunListenerList( (void *)stream, *audioDevice ) ) ; 
     940                                             addToXRunListenerList( (void *)stream ) ) ; 
    941941    if( result == kAudioHardwareIllegalOperationError ) { 
    942942       // -- already registered, we're good 
     
    21282128    if( stream ) { 
    21292129       if( stream->outputUnit ) { 
    2130           int count = removeFromXRunListenerList( stream, stream->outputDevice ); 
     2130          int count = removeFromXRunListenerList( stream ); 
    21312131          if( count == 0 ) 
    21322132             AudioDeviceRemovePropertyListener( stream->outputDevice, 
     
    21372137       } 
    21382138       if( stream->inputUnit && stream->outputUnit != stream->inputUnit ) { 
    2139           int count = removeFromXRunListenerList( stream, stream->inputDevice ); 
     2139          int count = removeFromXRunListenerList( stream ); 
    21402140          if( count == 0 ) 
    21412141             AudioDeviceRemovePropertyListener( stream->inputDevice, 
  • portaudio/branches/v19-devel/src/hostapi/coreaudio/pa_mac_core_utilities.c

    r1317 r1318  
    631631struct PaMacXRunListNode_s { 
    632632   PaMacCoreStream *stream; 
    633    AudioDeviceID audioDevice; 
    634633   struct PaMacXRunListNode_s *next; 
    635634} ; 
     
    649648 
    650649   for( ; node; node=node->next ) { 
    651       if( node->audioDevice != inDevice ) 
    652          continue; //not the same device. continue. 
    653  
    654650      PaMacCoreStream *stream = node->stream; 
    655651 
     
    657653         continue; //if the stream isn't active, we don't care if the device is dropping 
    658654 
    659       if( isInput ) 
    660          OSAtomicOr32( paInputOverflow, (uint32_t *)&(stream->xrunFlags) ); 
    661       else 
    662          OSAtomicOr32( paOutputUnderflow, (uint32_t *)&(stream->xrunFlags) ); 
     655      if( isInput ) { 
     656         if( stream->inputDevice == inDevice ) 
     657            OSAtomicOr32( paInputOverflow, (uint32_t *)&(stream->xrunFlags) ); 
     658      } else { 
     659         if( stream->outputDevice == inDevice ) 
     660            OSAtomicOr32( paOutputUnderflow, (uint32_t *)&(stream->xrunFlags) ); 
     661      } 
    663662   } 
    664663 
     
    688687} 
    689688 
    690 void *addToXRunListenerList( void *stream, AudioDeviceID audioDevice ) 
     689void *addToXRunListenerList( void *stream ) 
    691690{ 
    692691   PaMacXRunListNode *newNode; 
     
    694693   newNode = (PaMacXRunListNode *) malloc( sizeof( PaMacXRunListNode ) ); 
    695694   newNode->stream = (PaMacCoreStream *) stream; 
    696    newNode->audioDevice = audioDevice; 
    697695   newNode->next = firstXRunListNode.next; 
    698696   // insert: 
     
    702700} 
    703701 
    704 int removeFromXRunListenerList( void *stream, AudioDeviceID audioDevice ) 
     702int removeFromXRunListenerList( void *stream ) 
    705703{ 
    706704   PaMacXRunListNode *node, *prev; 
     
    708706   node = firstXRunListNode.next; 
    709707   while( node ) { 
    710       if( node->stream == stream && node->audioDevice == audioDevice ) { 
     708      if( node->stream == stream ) { 
    711709         //found it: 
    712710         --xRunListSize; 
  • portaudio/branches/v19-devel/src/hostapi/coreaudio/pa_mac_core_utilities.h

    r1316 r1318  
    222222 
    223223/**Returns the list, so that it can be passed to CorAudio.*/ 
    224 void *addToXRunListenerList( void *stream, AudioDeviceID audioDevice ); 
     224void *addToXRunListenerList( void *stream ); 
    225225/**Returns the number of Listeners in the list remaining.*/ 
    226 int removeFromXRunListenerList( void *stream, AudioDeviceID audioDevice ); 
     226int removeFromXRunListenerList( void *stream ); 
    227227 
    228228#endif /* PA_MAC_CORE_UTILITIES_H__*/