Ignore:
Timestamp:
Aug 4, 2006 6:27:19 PM (18 years ago)
Author:
bennylp
Message:

More work on the AEC (including changes in PJSUA), embed the AEC in sound_port, reduce DirectSound? buffer from 32 to 16, and fixed ARM compilation for MSVC WinCE target.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp

    r641 r648  
    1313static HWND         hMainWnd; 
    1414static HWND         hwndCB; 
    15 static HWND         hwndGlobalStatus; 
    16 static HWND         hwndURI; 
    17 static HWND         hwndCallStatus; 
     15static HWND         hwndGlobalStatus, hwndURI, hwndCallStatus; 
     16static HWND         hwndActionButton, hwndExitButton; 
    1817 
    1918static pj_pool_t   *g_pool; 
     
    2120static int          g_current_acc; 
    2221static int          g_current_call = PJSUA_INVALID_ID; 
     22static int          g_current_action; 
    2323 
    2424enum 
     
    3636    ID_MENU_ANSWER, 
    3737    ID_MENU_DISCONNECT, 
     38    ID_BTN_ACTION, 
    3839}; 
     40 
     41#define DEFAULT_URI     "sip:192.168.0.7" 
    3942 
    4043 
     
    6467{ 
    6568    wchar_t tmp[128]; 
     69    if (len==-1) len=pj_ansi_strlen(uri); 
    6670    pj_ansi_to_unicode(uri, len, tmp, PJ_ARRAY_SIZE(tmp)); 
    6771    SetDlgItemText(hMainWnd, ID_GLOBAL_STATUS, tmp); 
     
    7478{ 
    7579    wchar_t tmp[128]; 
     80    if (len==-1) len=pj_ansi_strlen(uri); 
    7681    pj_ansi_to_unicode(uri, len, tmp, PJ_ARRAY_SIZE(tmp)); 
    7782    SetDlgItemText(hMainWnd, ID_URI, tmp); 
     
    8388{ 
    8489    wchar_t tmp[128]; 
     90    if (len==-1) len=pj_ansi_strlen(state); 
    8591    pj_ansi_to_unicode(state, len, tmp, PJ_ARRAY_SIZE(tmp)); 
    8692    SetDlgItemText(hMainWnd, ID_CALL_STATUS, tmp); 
     
    101107    case ID_MENU_NONE: 
    102108        InsertMenu(hMenu, ID_EXIT, MF_BYCOMMAND, action, TEXT("None")); 
     109        SetWindowText(hwndActionButton, TEXT("-")); 
    103110        break; 
    104111    case ID_MENU_CALL: 
    105112        InsertMenu(hMenu, ID_EXIT, MF_BYCOMMAND, action, TEXT("Call")); 
     113        SetWindowText(hwndActionButton, TEXT("&Call")); 
    106114        break; 
    107115    case ID_MENU_ANSWER: 
    108116        InsertMenu(hMenu, ID_EXIT, MF_BYCOMMAND, action, TEXT("Answer")); 
     117        SetWindowText(hwndActionButton, TEXT("&Answer")); 
    109118        break; 
    110119    case ID_MENU_DISCONNECT: 
    111120        InsertMenu(hMenu, ID_EXIT, MF_BYCOMMAND, action, TEXT("Hangup")); 
     121        SetWindowText(hwndActionButton, TEXT("&Hangup")); 
    112122        break; 
    113123    } 
    114124 
    115125    EnableMenuItem(hMenu, action, MF_BYCOMMAND | (enable?MF_ENABLED:MF_GRAYED)); 
     126    DrawMenuBar(hMainWnd); 
     127 
     128    g_current_action = action; 
    116129} 
    117130 
     
    131144 
    132145        g_current_call = PJSUA_INVALID_ID; 
    133         SetURI("sip:", 4); 
     146        SetURI(DEFAULT_URI, -1); 
    134147        SetAction(ID_MENU_CALL); 
    135         SetCallStatus(call_info.state_text.ptr, call_info.state_text.slen); 
     148        //SetCallStatus(call_info.state_text.ptr, call_info.state_text.slen); 
     149        SetCallStatus(call_info.last_status_text.ptr, call_info.last_status_text.slen); 
    136150 
    137151    } else { 
     
    259273    pjsua_media_config_default(&media_cfg); 
    260274    pjsua_transport_config_default(&udp_cfg); 
     275    udp_cfg.port = 50060; 
    261276    pjsua_transport_config_default(&rtp_cfg); 
     277    rtp_cfg.port = 40000; 
    262278 
    263279    /* Setup media */ 
     
    388404    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
    389405    hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE, 
    390             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,  
     406            CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 200,  
    391407            NULL, NULL, hInstance, NULL); 
    392408 
     
    412428    { 
    413429        X = 10, 
     430        Y = 40, 
    414431        W = 220, 
    415432        H = 30, 
     
    431448                dwStyle,        // Window style 
    432449                X,              // x-coordinate of the upper-left corner 
    433                 60,            // y-coordinate of the upper-left corner 
     450                Y+0,            // y-coordinate of the upper-left corner 
    434451                W,              // Width of the window for the edit 
    435452                                // control 
    436                 H,              // Height of the window for the edit 
     453                H-5,            // Height of the window for the edit 
    437454                                // control 
    438455                hWnd,           // Window handle to the parent window 
     
    451468                dwStyle,        // Window style 
    452469                X,  // x-coordinate of the upper-left corner 
    453                 100,  // y-coordinate of the upper-left corner 
     470                Y+H,  // y-coordinate of the upper-left corner 
    454471                W,  // Width of the window for the edit 
    455472                                // control 
    456                 H,  // Height of the window for the edit 
     473                H-5,  // Height of the window for the edit 
    457474                                // control 
    458475                hWnd,           // Window handle to the parent window 
     
    461478                NULL);          // Specify NULL for this parameter when  
    462479                                // you create a control 
    463     SetURI("sip:", 4, true); 
    464     SetFocus(hwndURI); 
     480 
     481    // Create action Button 
     482    hwndActionButton = CreateWindow( L"button", L"Action",  
     483                         WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,  
     484                         X, Y+2*H,  
     485                         60, H-5, hWnd,  
     486                         (HMENU) ID_BTN_ACTION, 
     487                         hInst, NULL ); 
     488 
     489    // Create exit button 
     490    hwndExitButton = CreateWindow( L"button", L"E&xit",  
     491                         WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,  
     492                         X+70, Y+2*H,  
     493                         60, H-5, hWnd,  
     494                         (HMENU) ID_EXIT, 
     495                         hInst, NULL ); 
     496 
    465497 
    466498    // Create call status edit 
     
    471503                dwStyle,        // Window style 
    472504                X,  // x-coordinate of the upper-left corner 
    473                 140,  // y-coordinate of the upper-left corner 
     505                Y+3*H,  // y-coordinate of the upper-left corner 
    474506                W,  // Width of the window for the edit 
    475507                                // control 
    476                 H,  // Height of the window for the edit 
     508                H-5,  // Height of the window for the edit 
    477509                                // control 
    478510                hWnd,           // Window handle to the parent window 
     
    482514                                // you create a control 
    483515    SetCallStatus("Ready", 5); 
    484  
    485516    SetAction(ID_MENU_CALL); 
     517    SetURI(DEFAULT_URI, -1); 
     518    SetFocus(hwndURI); 
     519 
    486520} 
    487521 
     
    500534        wmId    = LOWORD(wParam);  
    501535        wmEvent = HIWORD(wParam);  
     536        if (wmId == ID_BTN_ACTION) 
     537            wmId = g_current_action; 
    502538        switch (wmId) 
    503539        { 
Note: See TracChangeset for help on using the changeset viewer.