Changeset 5202:a6267bfa61b1 in roaraudio


Ignore:
Timestamp:
10/23/11 20:01:40 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added opmode:ms

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/config.h

    r5183 r5202  
    6363 ROAR_LIBROAR_CONFIG_OPMODE_NORMAL = 0, 
    6464#define ROAR_LIBROAR_CONFIG_OPMODE_NORMAL   ROAR_LIBROAR_CONFIG_OPMODE_NORMAL 
    65  ROAR_LIBROAR_CONFIG_OPMODE_FUNNY  = 1 
     65 ROAR_LIBROAR_CONFIG_OPMODE_FUNNY  = 1, 
    6666#define ROAR_LIBROAR_CONFIG_OPMODE_FUNNY    ROAR_LIBROAR_CONFIG_OPMODE_FUNNY 
     67 ROAR_LIBROAR_CONFIG_OPMODE_MS     = 2, 
     68#define ROAR_LIBROAR_CONFIG_OPMODE_MS       ROAR_LIBROAR_CONFIG_OPMODE_MS 
    6769}; 
    6870 
  • libroar/config.c

    r5201 r5202  
    257257   } else if ( !strcmp(v, "funny") ) { 
    258258    config->opmode = ROAR_LIBROAR_CONFIG_OPMODE_FUNNY; 
     259   } else if ( !strcmp(v, "ms") ) { 
     260    config->opmode = ROAR_LIBROAR_CONFIG_OPMODE_MS; 
    259261   } else { 
    260262    ROAR_WARN("roar_libroar_config_parse(*): Unknown opmode: %s", v); 
  • libroar/error.c

    r5184 r5202  
    911911 
    912912// phi@ph7:roaraudio $ grep '^#define ROAR_ERROR_' error.h  | tr -d /\* | while read d c d t; do printf "  {%-23s \"%s\"},\n" $c, "$t"; done 
     913 
     914static const char * roar_error2str_ms(const int error, const char * msg) { 
     915 static char buf[1024] = ""; 
     916 int num[8]; 
     917 int i; 
     918 int _ra_err = roar_error; 
     919 int _sys_err = errno; 
     920 
     921 for (i = 0; i < (sizeof(num)/sizeof(*num)); i++) 
     922  num[i] = roar_random_uint32(); 
     923 
     924 snprintf(buf, sizeof(buf), "\e[44;39;1m\e[2J\e[H" 
     925                            "                                   RoarAudio\n" 
     926                            "\n\n" 
     927                            "Fatal error %.4x: %s\n" 
     928                            "RA Error: %.4i, Sys Error: %.4i (%s)\n" 
     929                            "Random numbers:\n" 
     930                            " A: 0x%.8X B: 0x%.8X\n" 
     931                            " C: 0x%.8X D: 0x%.8X\n" 
     932                            " E: 0x%.8X F: 0x%.8X\n" 
     933                            " G: 0x%.8X H: 0x%.8X\n" 
     934                            "\n\n" 
     935                            "\e[0m", 
     936                            error, msg, 
     937                            _ra_err, _sys_err, strerror(_sys_err), 
     938                            num[0], num[1], num[2], num[3], num[4], num[5], num[6], num[7]); 
     939 
     940 return buf; 
     941} 
    913942 
    914943const char * roar_error2str(const int error) { 
     
    10991128 int i; 
    11001129 
     1130 if ( config->opmode == ROAR_LIBROAR_CONFIG_OPMODE_MS ) 
     1131  for (i = 0; msgs[i].msg != NULL; i++) 
     1132   if ( msgs[i].err == error ) 
     1133    return roar_error2str_ms(error, msgs[i].msg); 
     1134 
    11011135 if ( config->opmode == ROAR_LIBROAR_CONFIG_OPMODE_FUNNY ) 
    11021136  for (i = 0; msgs_funny[i].msg != NULL; i++) 
  • roarclients/roarcat.c

    r5109 r5202  
    169169 
    170170 if ( roar_simple_connect(&con, server, name) == -1 ) { 
    171   fprintf(stderr, "Error: can not connect to server\n"); 
     171  fprintf(stderr, "Error: can not connect to server: %s\n", roar_error2str(roar_error)); 
    172172  return 10; 
    173173 } 
Note: See TracChangeset for help on using the changeset viewer.