Changeset 3287

Show
Ignore:
Timestamp:
03/20/00 15:31:37 (14 years ago)
Author:
ucacoxh
Message:

- Ignore device in settings file if it does not exist on platform.

Try using first available device instead, just like if No Audio Device is saved.
Otherwise defaults to No Audio Device if single user has instances
open on different platforms and a singlre .RTPdefaults file.

Location:
rat/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • rat/trunk/MODS

    r3285 r3287  
    12001200          then distribute the rat-4.1.8-installer binary only. 
    12011201        - Add transit estimate reset when device format changes at either end. 
     1202        - Add settings to default to first device when device in settings file 
     1203          does not exist on host. 
    12021204 
    12031205TODO -- They're features not bugs dammit! 
  • rat/trunk/settings.c

    r3263 r3287  
    270270        char                            *name, *param, *primary_codec, *port, *silence; 
    271271        int                              freq, chan, mute; 
    272         uint32_t                         i, n, success; 
     272        uint32_t                         i, n, success, device_exists; 
    273273        const cc_details_t              *ccd; 
    274274        const audio_device_details_t    *add = NULL; 
     
    282282 
    283283        name = setting_load_str("audioDevice", "No Audio Device"); 
    284         add = audio_get_device_details(0); /* Fallback first device */ 
    285         /* User may not have audio device entry in the         */ 
    286         /* settings file, or have "No Audio Device" there.  In */ 
    287         /* either case try to use first available device, if   */ 
    288         /* it's in use we'll fallback to dummy device anyway.  */ 
    289         if (strcmp(name, "No Audio Device")) { 
    290                 n = (int)audio_get_device_count(); 
    291                 for(i = 0; i < n; i++) { 
    292                         add = audio_get_device_details(i); 
    293                         if (strcmp(add->name, name) == 0) { 
    294                                 break; 
    295                         } 
    296                 } 
    297         } 
     284        /* User may not have a (valid) audio device entry in the */ 
     285        /* settings file, or have "No Audio Device" there.  In   */ 
     286        /* either case try to use first available device, if     */ 
     287        /* it's in use we'll fallback to dummy device anyway.    */ 
     288 
     289        device_exists = FALSE; 
     290        n = (int)audio_get_device_count(); 
     291        for(i = 0; i < n; i++) { 
     292                add = audio_get_device_details(i); 
     293                if (strcmp(add->name, name) == 0) { 
     294                        device_exists = TRUE; 
     295                        break; 
     296                } 
     297        } 
     298 
     299        if (strcmp(name, "No Audio Device") == 0 ||  
     300            device_exists == FALSE) { 
     301                add = audio_get_device_details(0); 
     302        } 
     303 
    298304        audio_device_register_change_device(sp, add->descriptor); 
    299305