- Timestamp:
- Feb 19, 2009 7:13:49 PM (16 years ago)
- Location:
- pjproject/branches/projects/aps-direct/pjmedia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia-audiodev/audiodev.h
r2463 r2466 578 578 #define PJMEDIA_EAUD_NODEV -1 579 579 580 /* Device not ready */ 581 #define PJMEDIA_EAUD_NOTREADY -1 582 580 583 /* Unknown system error */ 581 584 #define PJMEDIA_EAUD_SYSERR -1 -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp
r2465 r2466 367 367 368 368 TInt ActivateSpeaker(TBool active); 369 370 TInt SetVolume(TInt vol) { return iSession.SetVolume(vol); } 371 TInt GetVolume() { return iSession.Volume(); } 372 TInt GetMaxVolume() { return iSession.MaxVolume(); } 373 374 TInt SetGain(TInt gain) { return iSession.SetGain(gain); } 375 TInt GetGain() { return iSession.Gain(); } 376 TInt GetMaxGain() { return iSession.MaxGain(); } 369 377 370 378 private: … … 1107 1115 af->dev_info.default_samples_per_sec = 8000; 1108 1116 af->dev_info.caps = PJMEDIA_AUD_DEV_CAP_EXT_FORMAT | 1109 //PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING |1110 //PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING |1117 PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING | 1118 PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING | 1111 1119 PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE | 1112 1120 PJMEDIA_AUD_DEV_CAP_VAD | … … 1116 1124 af->dev_info.input_count = 1; 1117 1125 af->dev_info.output_count = 1; 1118 1119 af->dev_info.ext_fmt_cnt = 2; 1120 1126 1127 af->dev_info.ext_fmt_cnt = 6; 1121 1128 af->dev_info.ext_fmt[0].id = PJMEDIA_FORMAT_AMR; 1122 af->dev_info.ext_fmt[0].bitrate = 0;1123 af->dev_info.ext_fmt[0].vad = PJ_TRUE;1124 1125 1129 af->dev_info.ext_fmt[1].id = PJMEDIA_FORMAT_G729; 1126 af->dev_info.ext_fmt[1].bitrate = 0; 1127 af->dev_info.ext_fmt[1].vad = PJ_TRUE; 1130 af->dev_info.ext_fmt[2].id = PJMEDIA_FORMAT_ILBC; 1131 af->dev_info.ext_fmt[3].id = PJMEDIA_FORMAT_PCMU; 1132 af->dev_info.ext_fmt[4].id = PJMEDIA_FORMAT_PCMA; 1133 af->dev_info.ext_fmt[5].id = PJMEDIA_FORMAT_L16; 1128 1134 1129 1135 PJ_LOG(4, (THIS_FILE, "APS initialized")); … … 1141 1147 pj_pool_release(pool); 1142 1148 1149 PJ_LOG(4, (THIS_FILE, "APS destroyed")); 1150 1143 1151 return PJ_SUCCESS; 1144 1152 } … … 1183 1191 param->bits_per_sample = BITS_PER_SAMPLE; 1184 1192 param->flags = af->dev_info.caps; 1193 param->ext_fmt.id = PJMEDIA_FORMAT_L16; 1194 param->out_route = PJMEDIA_AUD_DEV_ROUTE_EARPIECE; 1185 1195 1186 1196 return PJ_SUCCESS; … … 1352 1362 break; 1353 1363 case PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING: 1364 if (strm->param.dir & PJMEDIA_DIR_CAPTURE) { 1365 PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL); 1366 1367 TInt max_gain = strm->engine->GetMaxGain(); 1368 TInt gain = strm->engine->GetGain(); 1369 1370 if (max_gain > 0 && gain >= 0) { 1371 *(unsigned*)pval = gain * 100 / max_gain; 1372 status = PJ_SUCCESS; 1373 } else { 1374 status = PJMEDIA_EAUD_NOTREADY; 1375 } 1376 } 1354 1377 break; 1355 1378 case PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING: 1379 if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) { 1380 PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL); 1381 1382 TInt max_vol = strm->engine->GetMaxVolume(); 1383 TInt vol = strm->engine->GetVolume(); 1384 1385 if (max_vol > 0 && vol >= 0) { 1386 *(unsigned*)pval = vol * 100 / max_vol; 1387 status = PJ_SUCCESS; 1388 } else { 1389 status = PJMEDIA_EAUD_NOTREADY; 1390 } 1391 } 1356 1392 break; 1357 1393 default: … … 1399 1435 break; 1400 1436 case PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING: 1437 if (strm->param.dir & PJMEDIA_DIR_CAPTURE) { 1438 PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL); 1439 1440 TInt max_gain = strm->engine->GetMaxGain(); 1441 if (max_gain > 0) { 1442 TInt gain, err; 1443 1444 gain = *(unsigned*)pval * max_gain / 100; 1445 err = strm->engine->SetGain(gain); 1446 status = (err==KErrNone)? PJ_SUCCESS:PJ_RETURN_OS_ERROR(err); 1447 } else { 1448 status = PJMEDIA_EAUD_NOTREADY; 1449 } 1450 } 1401 1451 break; 1402 1452 case PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING: 1453 if (strm->param.dir & PJMEDIA_DIR_CAPTURE) { 1454 PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL); 1455 1456 TInt max_vol = strm->engine->GetMaxVolume(); 1457 if (max_vol > 0) { 1458 TInt vol, err; 1459 1460 vol = *(unsigned*)pval * max_vol / 100; 1461 err = strm->engine->SetVolume(vol); 1462 status = (err==KErrNone)? PJ_SUCCESS:PJ_RETURN_OS_ERROR(err); 1463 } else { 1464 status = PJMEDIA_EAUD_NOTREADY; 1465 } 1466 } 1403 1467 break; 1404 1468 default:
Note: See TracChangeset
for help on using the changeset viewer.