├── .gitignore ├── Debug └── WebRTC_Wrapper.exe ├── README.md ├── Release ├── WebRTC_Wrapper.dll └── WebRTC_Wrapper.lib ├── WebRTC_Wrapper.sln └── WebRTC_Wrapper ├── WebRTC_Wrapper.vcproj ├── audio_short16.pcm ├── testmain.cpp ├── webrtc_wrapper.h ├── webrtc_wrapper_impl.cpp └── webrtc_wrapper_impl.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | -------------------------------------------------------------------------------- /Debug/WebRTC_Wrapper.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calvingit/WebRTC_Wrapper/fc94a30088ee6781e10afe338b9c295f49f9bc84/Debug/WebRTC_Wrapper.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WebRTC_Wrapper 2 | ============== 3 | 4 | 自己封装的WebRTC, 使用的库编译自webrtc的2013-05-23版本,开发环境为Visual Studio 2008。 5 | 6 | 其实很简单的东西,只是把Voe_Base, Voe_Hardware, Voe_File之类集合在一起。 7 | 8 | 目前只有语音部分,采集、播放、音量控制、音频编码器已经集成了,网络部分绑定了ip和channel,但没有进行详细测试,扩展自己传输得写那两个回调函数。 9 | -------------------------------------------------------------------------------- /Release/WebRTC_Wrapper.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calvingit/WebRTC_Wrapper/fc94a30088ee6781e10afe338b9c295f49f9bc84/Release/WebRTC_Wrapper.dll -------------------------------------------------------------------------------- /Release/WebRTC_Wrapper.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calvingit/WebRTC_Wrapper/fc94a30088ee6781e10afe338b9c295f49f9bc84/Release/WebRTC_Wrapper.lib -------------------------------------------------------------------------------- /WebRTC_Wrapper.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebRTC_Wrapper", "WebRTC_Wrapper\WebRTC_Wrapper.vcproj", "{72D8A4FA-8567-4FD3-93F2-2D9A2A89835E}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {72D8A4FA-8567-4FD3-93F2-2D9A2A89835E}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {72D8A4FA-8567-4FD3-93F2-2D9A2A89835E}.Debug|Win32.Build.0 = Debug|Win32 14 | {72D8A4FA-8567-4FD3-93F2-2D9A2A89835E}.Release|Win32.ActiveCfg = Release|Win32 15 | {72D8A4FA-8567-4FD3-93F2-2D9A2A89835E}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /WebRTC_Wrapper/WebRTC_Wrapper.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calvingit/WebRTC_Wrapper/fc94a30088ee6781e10afe338b9c295f49f9bc84/WebRTC_Wrapper/WebRTC_Wrapper.vcproj -------------------------------------------------------------------------------- /WebRTC_Wrapper/audio_short16.pcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calvingit/WebRTC_Wrapper/fc94a30088ee6781e10afe338b9c295f49f9bc84/WebRTC_Wrapper/audio_short16.pcm -------------------------------------------------------------------------------- /WebRTC_Wrapper/testmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calvingit/WebRTC_Wrapper/fc94a30088ee6781e10afe338b9c295f49f9bc84/WebRTC_Wrapper/testmain.cpp -------------------------------------------------------------------------------- /WebRTC_Wrapper/webrtc_wrapper.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calvingit/WebRTC_Wrapper/fc94a30088ee6781e10afe338b9c295f49f9bc84/WebRTC_Wrapper/webrtc_wrapper.h -------------------------------------------------------------------------------- /WebRTC_Wrapper/webrtc_wrapper_impl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | **Copyright (c) 2013 Calvin Cheung. All Rights Reserved. 3 | ** 4 | **Use of this source code is governed by a BSD-style license. 5 | ** 6 | **This is a simple wrapper for WebRTC. I used it in the Video Conference project. 7 | ** 8 | **URL:https://github.com/calvingit/WebRTC_Wrapper/ 9 | ** 10 | **File: LoganVoiceEngineImpl.cpp 11 | ** 12 | **Author: Calvin Cheung, Chinna. 13 | ** 14 | **Update Date: 2013-5-21 15 | */ 16 | 17 | #include "webrtc_wrapper_impl.h" 18 | 19 | #ifdef _DEBUG 20 | #define VALIDATE \ 21 | if (res != 0){ \ 22 | printf("##%s(%i) ERROR:\n",__FILE__, __LINE__); \ 23 | printf(" %s error, code = %i\n",__FUNCTION__, base->LastError()); \ 24 | } 25 | 26 | #else 27 | #define VALIDATE 28 | #endif 29 | 30 | static int res = 0; 31 | 32 | 33 | LoganVoiceEngine* LoganVoiceEngine::Create() { 34 | LoganVoiceEngineImpl* lap = new LoganVoiceEngineImpl(); 35 | if (lap->LoganVoe_Init() != 0) { 36 | delete lap; 37 | lap = NULL; 38 | } 39 | 40 | return lap; 41 | } 42 | 43 | void LoganVoiceEngine::Destroy(LoganVoiceEngine* lve) { 44 | delete static_cast(lve); 45 | } 46 | 47 | 48 | LoganVoiceEngineImpl::LoganVoiceEngineImpl(): 49 | m_voe(NULL), 50 | base(NULL), 51 | codec(NULL), 52 | volume(NULL), 53 | apm(NULL), 54 | netw(NULL), 55 | hardware(NULL) 56 | { 57 | 58 | } 59 | 60 | LoganVoiceEngineImpl::~LoganVoiceEngineImpl() 61 | { 62 | LoganVoe_UnInit(); 63 | } 64 | 65 | 66 | int LoganVoiceEngineImpl::LoganVoe_Init() 67 | { 68 | m_voe = VoiceEngine::Create(); 69 | 70 | base = VoEBase::GetInterface(m_voe); 71 | codec = VoECodec::GetInterface(m_voe); 72 | apm = VoEAudioProcessing::GetInterface(m_voe); 73 | volume = VoEVolumeControl::GetInterface(m_voe); 74 | netw = VoENetwork::GetInterface(m_voe); 75 | file = VoEFile::GetInterface(m_voe); 76 | hardware = VoEHardware::GetInterface(m_voe); 77 | 78 | //for no trace 79 | VoiceEngine::SetTraceFilter(kTraceNone); 80 | 81 | return base->Init(); 82 | } 83 | 84 | void LoganVoiceEngineImpl::LoganVoe_UnInit() 85 | { 86 | base->Terminate(); 87 | 88 | if (base) 89 | base->Release(); 90 | 91 | if (codec) 92 | codec->Release(); 93 | 94 | if (volume) 95 | volume->Release(); 96 | 97 | if (apm) 98 | apm->Release(); 99 | 100 | if (netw) 101 | netw->Release(); 102 | 103 | if (file) 104 | file->Release(); 105 | 106 | 107 | if (hardware) 108 | hardware->Release(); 109 | 110 | 111 | VoiceEngine::Delete(m_voe); 112 | } 113 | 114 | int LoganVoiceEngineImpl::LoganVoe_CreateChannel() 115 | { 116 | int channel = base->CreateChannel(); 117 | 118 | //����VoiceChanTrans 119 | VoiceChannelTransport *voice_channel_transport(new VoiceChannelTransport(netw, channel)); 120 | VoiceChanTrans vct; 121 | vct.channel = channel; 122 | vct.pTrans = voice_channel_transport; 123 | 124 | vec_vct.push_back(vct); 125 | 126 | return channel; 127 | } 128 | int LoganVoiceEngineImpl::LoganVoe_DeleteChannel(int channel) 129 | { 130 | int index = LoganVoe_FindIndexOfTrans(channel); 131 | if (index < 0) 132 | { 133 | return index; 134 | } 135 | if (vec_vct[index].pTrans) 136 | { 137 | delete vec_vct[index].pTrans; 138 | } 139 | res = base->DeleteChannel(vec_vct[index].channel); 140 | VALIDATE; 141 | vec_vct[index].SetEmpty(); 142 | return res; 143 | } 144 | 145 | int LoganVoiceEngineImpl::LoganVoe_DeleteAllChannel() 146 | { 147 | for(unsigned int i = 0; i < vec_vct.size(); i++) 148 | { 149 | if (vec_vct[i].channel != -1) 150 | { 151 | if (vec_vct[i].pTrans) 152 | { 153 | delete vec_vct[i].pTrans; 154 | } 155 | res = base->DeleteChannel(vec_vct[i].channel); 156 | VALIDATE; 157 | vec_vct[i].SetEmpty(); 158 | } 159 | } 160 | vec_vct.clear(); 161 | return res; 162 | } 163 | 164 | int LoganVoiceEngineImpl::LoganVoe_FindIndexOfTrans(int channelid) 165 | { 166 | unsigned int i = 0; 167 | for(; i < vec_vct.size(); i++) 168 | { 169 | if (vec_vct[i].channel == channelid) 170 | { 171 | return i; 172 | } 173 | } 174 | return -1; 175 | } 176 | 177 | int LoganVoiceEngineImpl::LoganVoe_SetSendDestination(int channelId,const char * ip, int port) 178 | { 179 | 180 | int index = LoganVoe_FindIndexOfTrans(channelId); 181 | if (index < 0) 182 | { 183 | return index; 184 | } 185 | 186 | res = vec_vct[index].pTrans->SetSendDestination(ip, port); 187 | VALIDATE; 188 | 189 | return res; 190 | } 191 | 192 | int LoganVoiceEngineImpl::LoganVoe_SetLocalReceiver(int channelId,int port) 193 | { 194 | int index = LoganVoe_FindIndexOfTrans(channelId); 195 | if (index < 0) 196 | { 197 | return index; 198 | } 199 | 200 | res = vec_vct[index].pTrans->SetLocalReceiver(port); 201 | VALIDATE; 202 | return res; 203 | } 204 | 205 | int LoganVoiceEngineImpl::LoganVoe_GetSpecCodec(int index, LoganCodec &lc) 206 | { 207 | if (index < 0 || index >= codec->NumOfCodecs()) 208 | { 209 | res = -1; 210 | VALIDATE; 211 | return res; 212 | } 213 | CodecInst c; 214 | res = codec->GetCodec(index, c); 215 | VALIDATE; 216 | lc.channels = c.channels; 217 | lc.pacsize = c.pacsize; 218 | memcpy(lc.plname,c.plname, RTP_PAYLOAD_NAME_LEN); 219 | lc.plfreq = c.plfreq; 220 | lc.pltype = c.pltype; 221 | lc.rate = c.rate; 222 | 223 | return res; 224 | } 225 | 226 | int LoganVoiceEngineImpl::LoganVoe_SetSendCodec(int channelid, LoganCodec lc) 227 | { 228 | CodecInst c; 229 | c.channels = lc.channels; 230 | c.pacsize = lc.pacsize ; 231 | c.plfreq = lc.plfreq ; 232 | c.pltype = lc.pltype ; 233 | c.rate = lc.rate ; 234 | memcpy(c.plname, lc.plname, RTP_PAYLOAD_NAME_LEN); 235 | res = codec->SetSendCodec(channelid, c); 236 | VALIDATE; 237 | return res; 238 | } 239 | 240 | int LoganVoiceEngineImpl::LoganVoe_GetNumsOfCodec() 241 | { 242 | return codec->NumOfCodecs(); 243 | } 244 | 245 | int LoganVoiceEngineImpl::LoganVoe_GetNumOfRecordingDevices() 246 | { 247 | int rd(-1); 248 | res = hardware->GetNumOfRecordingDevices(rd); 249 | VALIDATE; 250 | return rd; 251 | } 252 | int LoganVoiceEngineImpl::LoganVoe_GetNumOfPlayoutDevices() 253 | { 254 | int rd(-1); 255 | res = hardware->GetNumOfPlayoutDevices(rd); 256 | VALIDATE; 257 | return rd; 258 | } 259 | 260 | int LoganVoiceEngineImpl::LoganVoe_GetPlayoutDeviceName(int index, char nameUTF8[128], char guidUTF8[128]) 261 | { 262 | char dn[DEVICE_MAX_LEN] = { 0 }; 263 | char guid[DEVICE_MAX_LEN] = { 0 }; 264 | res = hardware->GetPlayoutDeviceName(index, nameUTF8, guidUTF8); 265 | VALIDATE; 266 | 267 | return res; 268 | } 269 | int LoganVoiceEngineImpl::LoganVoe_GetRecordingDeviceName(int index, char nameUTF8[128], char guidUTF8[128]) 270 | { 271 | char dn[DEVICE_MAX_LEN] = { 0 }; 272 | char guid[DEVICE_MAX_LEN] = { 0 }; 273 | res = hardware->GetRecordingDeviceName(index, nameUTF8, guidUTF8); 274 | VALIDATE; 275 | 276 | return res; 277 | } 278 | 279 | int LoganVoiceEngineImpl::LoganVoe_SetPlayoutDevice(int idx) 280 | { 281 | if(idx >= LoganVoe_GetNumOfPlayoutDevices()) 282 | { 283 | return -1; 284 | } 285 | res = hardware->SetPlayoutDevice(idx); 286 | VALIDATE; 287 | return res; 288 | } 289 | int LoganVoiceEngineImpl::LoganVoe_SetRecordingDevice(int idx) 290 | { 291 | if (idx >= LoganVoe_GetNumOfRecordingDevices()) 292 | { 293 | return -1; 294 | } 295 | res = hardware->SetRecordingDevice(idx); 296 | VALIDATE; 297 | return res; 298 | } 299 | //for vad 300 | int LoganVoiceEngineImpl::LoganVoe_SetVADStatus(int channelsid, bool b, int mode) 301 | { 302 | res = codec->SetVADStatus(channelsid, b, (VadModes)mode); 303 | VALIDATE; 304 | return res; 305 | } 306 | int LoganVoiceEngineImpl::LoganVoe_GetVADStatus(int channelsid,bool &b, int &mode) 307 | { 308 | bool disabledDTX; 309 | VadModes m; 310 | res = codec->GetVADStatus(channelsid,b,(VadModes)m, disabledDTX); 311 | VALIDATE; 312 | mode = (int)m; 313 | return res; 314 | } 315 | //for agc 316 | int LoganVoiceEngineImpl::LoganVoe_SetAgcStatus(bool b, int mode) 317 | { 318 | res = apm->SetAgcStatus(b, (AgcModes)mode); 319 | VALIDATE; 320 | return res; 321 | } 322 | int LoganVoiceEngineImpl::LoganVoe_GetAgcStatus(bool &b, int &mode) 323 | { 324 | AgcModes m; 325 | res = apm->GetAgcStatus(b,(AgcModes)m); 326 | VALIDATE; 327 | mode = (int)m; 328 | return res; 329 | } 330 | 331 | //for ec 332 | int LoganVoiceEngineImpl::LoganVoe_SetEcStatus(bool b, int mode) 333 | { 334 | res = apm->SetEcStatus(b, (EcModes)mode); 335 | VALIDATE; 336 | return res; 337 | } 338 | int LoganVoiceEngineImpl::LoganVoe_GetEcStatus(bool &b, int &mode) 339 | { 340 | EcModes m; 341 | res = apm->GetEcStatus(b,(EcModes)m); 342 | VALIDATE; 343 | mode = (int)m; 344 | return res; 345 | } 346 | 347 | //for ns 348 | int LoganVoiceEngineImpl::LoganVoe_SetNsStatus(bool b, int mode) 349 | { 350 | res = apm->SetNsStatus(b, (NsModes)mode); 351 | VALIDATE; 352 | return res; 353 | } 354 | int LoganVoiceEngineImpl::LoganVoe_GetNsStatus(bool &b, int &mode) 355 | { 356 | NsModes m; 357 | res = apm->GetNsStatus(b,(NsModes)m); 358 | VALIDATE; 359 | mode = int(m); 360 | return res; 361 | } 362 | 363 | 364 | int LoganVoiceEngineImpl::LoganVoe_StartReceive(int channelid) 365 | { 366 | res = base->StartReceive(channelid); 367 | VALIDATE; 368 | return res; 369 | } 370 | 371 | int LoganVoiceEngineImpl::LoganVoe_StartPlayout(int channelid) 372 | { 373 | res = base->StartPlayout(channelid); 374 | VALIDATE; 375 | return res; 376 | } 377 | int LoganVoiceEngineImpl::LoganVoe_StartSend(int channelid) 378 | { 379 | res = base->StartSend(channelid); 380 | VALIDATE; 381 | return res; 382 | } 383 | 384 | int LoganVoiceEngineImpl::LoganVoe_StopReceive(int channelid) 385 | { 386 | res = base->StopReceive(channelid); 387 | VALIDATE; 388 | return res; 389 | } 390 | 391 | int LoganVoiceEngineImpl::LoganVoe_StopPlayout(int channelid) 392 | { 393 | res = base->StopPlayout(channelid); 394 | VALIDATE; 395 | return res; 396 | } 397 | int LoganVoiceEngineImpl::LoganVoe_StopSend(int channelid) 398 | { 399 | res = base->StopSend(channelid); 400 | VALIDATE; 401 | return res; 402 | } 403 | 404 | int LoganVoiceEngineImpl::LoganVoe_StartRecordingMicrophone(LoganWriteStreamCallBack lwscb) 405 | { 406 | _outStream.pWrite = lwscb; 407 | res = file->StartRecordingMicrophone(&_outStream); 408 | VALIDATE; 409 | return res; 410 | } 411 | 412 | int LoganVoiceEngineImpl::LoganVoe_StartRecordingMicrophone(const char* fileNameUTF8, 413 | LoganCodec* codec) 414 | { 415 | if (codec == NULL) 416 | { 417 | res = file->StartRecordingMicrophone(fileNameUTF8, NULL); 418 | } 419 | else 420 | { 421 | CodecInst ci; 422 | ci.channels = codec->channels; 423 | ci.pacsize = codec->pacsize; 424 | ci.plfreq = codec->plfreq; 425 | ci.pltype = codec->pltype; 426 | ci.rate = codec->rate; 427 | memcpy(ci.plname, codec->plname, RTP_PAYLOAD_NAME_LEN); 428 | res = file->StartRecordingMicrophone(fileNameUTF8, &ci); 429 | } 430 | VALIDATE; 431 | return res; 432 | 433 | } 434 | 435 | int LoganVoiceEngineImpl::LoganVoe_StartPlayingFileLocally(int channelid, 436 | LoganReadStreamCallBack lrscb) 437 | { 438 | _inStream.pRead = lrscb; 439 | res = file->StartPlayingFileLocally(channelid, &_inStream); 440 | VALIDATE; 441 | return res; 442 | } 443 | 444 | int LoganVoiceEngineImpl::LoganVoe_StartPlayingFileLocally(int channelid, 445 | const char fileNameUTF8[1024], 446 | int samplerate,//(8000, 16000, 32000) 447 | bool loop) 448 | { 449 | FileFormats format; 450 | switch(samplerate) 451 | { 452 | case 8000:format = kFileFormatPcm8kHzFile;break; 453 | case 16000:format = kFileFormatPcm16kHzFile;break; 454 | case 32000:format = kFileFormatPcm32kHzFile;break; 455 | default:format = kFileFormatPcm16kHzFile;break; 456 | } 457 | res = file->StartPlayingFileLocally(channelid, fileNameUTF8, loop, format); 458 | VALIDATE; 459 | return res; 460 | } 461 | 462 | int LoganVoiceEngineImpl::LoganVoe_IsPlayingFileLocally(int channel) 463 | { 464 | return file->IsPlayingFileLocally(channel); 465 | } 466 | 467 | int LoganVoiceEngineImpl::LoganVoe_StartRecordingPlayout(int channel, const char* fileNameUTF8, 468 | LoganCodec *codec) 469 | { 470 | if (codec == NULL) 471 | { 472 | res = file->StartRecordingPlayout(channel,fileNameUTF8); 473 | } 474 | else 475 | { 476 | CodecInst ci; 477 | ci.channels = codec->channels; 478 | ci.pacsize = codec->pacsize; 479 | ci.plfreq = codec->plfreq; 480 | ci.pltype = codec->pltype; 481 | ci.rate = codec->rate; 482 | memcpy(ci.plname, codec->plname, RTP_PAYLOAD_NAME_LEN); 483 | res = file->StartRecordingPlayout(channel,fileNameUTF8, &ci); 484 | } 485 | VALIDATE; 486 | return res; 487 | } 488 | 489 | int LoganVoiceEngineImpl::LoganVoe_StopRecordingPlayout(int channel) 490 | { 491 | res = file->StopRecordingPlayout(channel); 492 | VALIDATE; 493 | return res; 494 | } 495 | 496 | int LoganVoiceEngineImpl::LoganVoe_StopPlayingFileLocally(int channelid) 497 | { 498 | res = file->StopPlayingFileLocally(channelid); 499 | VALIDATE; 500 | return res; 501 | } 502 | int LoganVoiceEngineImpl::LoganVoe_StopRecordingMicrophone() 503 | { 504 | res = file->StopRecordingMicrophone(); 505 | VALIDATE; 506 | return res; 507 | } 508 | 509 | 510 | unsigned int LoganVoiceEngineImpl::LoganVoe_GetMicVolume() 511 | { 512 | unsigned int vol = 999; 513 | res = volume->GetMicVolume(vol); 514 | VALIDATE; 515 | return vol; 516 | } 517 | 518 | int LoganVoiceEngineImpl::LoganVoe_SetMicVolume(unsigned int vol) 519 | { 520 | res = volume->SetMicVolume(vol); 521 | VALIDATE; 522 | return vol; 523 | } 524 | 525 | unsigned int LoganVoiceEngineImpl::LoganVoe_GetSpeakerVolume() 526 | { 527 | unsigned int vol = 999; 528 | res = volume->GetSpeakerVolume(vol); 529 | VALIDATE; 530 | return vol; 531 | } 532 | int LoganVoiceEngineImpl::LoganVoe_SetInputMute(int channel, bool enable) 533 | { 534 | res = volume->SetInputMute(channel, enable); 535 | VALIDATE; 536 | return res; 537 | } 538 | 539 | 540 | int LoganVoiceEngineImpl::LoganVoe_SetSpeakerVolume(unsigned int vol) 541 | { 542 | res = volume->SetSpeakerVolume(vol); 543 | VALIDATE; 544 | return vol; 545 | } 546 | 547 | int LoganVoiceEngineImpl::LoganVoe_GetInputMute(int channel, bool& enabled) 548 | { 549 | res = volume->GetInputMute(channel, enabled); 550 | VALIDATE; 551 | return res; 552 | } 553 | 554 | int LoganVoiceEngineImpl::LoganVoe_SetSystemOutputMute(bool enable) 555 | { 556 | res = volume->SetSystemOutputMute(enable); 557 | VALIDATE; 558 | return res; 559 | } 560 | 561 | int LoganVoiceEngineImpl::LoganVoe_GetSystemOutputMute(bool &enabled) 562 | { 563 | res = volume->GetSystemOutputMute(enabled); 564 | VALIDATE; 565 | return res; 566 | } 567 | 568 | int LoganVoiceEngineImpl::LoganVoe_SetSystemInputMute(bool enable) 569 | { 570 | res = volume->SetSystemInputMute(enable); 571 | VALIDATE; 572 | return res; 573 | } 574 | int LoganVoiceEngineImpl::LoganVoe_GetSystemInputMute(bool& enabled) 575 | { 576 | res = volume->GetSystemInputMute(enabled); 577 | VALIDATE; 578 | return res; 579 | } 580 | 581 | int LoganVoiceEngineImpl::LoganVoe_GetSpeechInputLevel(unsigned int& level) 582 | { 583 | res = volume->GetSpeechInputLevel(level); 584 | VALIDATE; 585 | return res; 586 | } 587 | 588 | int LoganVoiceEngineImpl::LoganVoe_GetSpeechOutputLevel(int channel, unsigned int& level) 589 | { 590 | res = volume->GetSpeechOutputLevel(channel, level); 591 | VALIDATE; 592 | return res; 593 | } 594 | 595 | int LoganVoiceEngineImpl::LoganVoe_StartPlayingFileAsMicrophone( 596 | int channel, 597 | const char fileNameUTF8[1024], 598 | int sampleRate, 599 | bool loop, 600 | bool mixWithMicrophone) 601 | { 602 | FileFormats format; 603 | switch(sampleRate) 604 | { 605 | case 8000:format = kFileFormatPcm8kHzFile;break; 606 | case 16000:format = kFileFormatPcm16kHzFile;break; 607 | case 32000:format = kFileFormatPcm32kHzFile;break; 608 | default:format = kFileFormatPcm16kHzFile;break; 609 | } 610 | res = file->StartPlayingFileAsMicrophone(channel, fileNameUTF8, loop, 611 | mixWithMicrophone,format); 612 | VALIDATE; 613 | return res; 614 | } 615 | 616 | 617 | int LoganVoiceEngineImpl::LoganVoe_StartPlayingFileAsMicrophone( 618 | int channel, 619 | LoganReadStreamCallBack read, 620 | int sampleRate, 621 | bool mixWithMicrophone) 622 | { 623 | _inStream.pRead = read; 624 | FileFormats format; 625 | switch(sampleRate) 626 | { 627 | case 8000:format = kFileFormatPcm8kHzFile;break; 628 | case 16000:format = kFileFormatPcm16kHzFile;break; 629 | case 32000:format = kFileFormatPcm32kHzFile;break; 630 | default:format = kFileFormatPcm16kHzFile;break; 631 | } 632 | res = file->StartPlayingFileAsMicrophone(channel, &_inStream, mixWithMicrophone, 633 | format); 634 | VALIDATE; 635 | return res; 636 | } 637 | 638 | int LoganVoiceEngineImpl::LoganVoe_StopPlayingFileAsMicrophone(int channel) 639 | { 640 | res = file->StopPlayingFileAsMicrophone(channel); 641 | VALIDATE; 642 | return res; 643 | } 644 | 645 | int LoganVoiceEngineImpl::LoganVoe_IsPlayingFileAsMicrophone(int channel) 646 | { 647 | return file->IsPlayingFileAsMicrophone(channel); 648 | } 649 | -------------------------------------------------------------------------------- /WebRTC_Wrapper/webrtc_wrapper_impl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calvingit/WebRTC_Wrapper/fc94a30088ee6781e10afe338b9c295f49f9bc84/WebRTC_Wrapper/webrtc_wrapper_impl.h --------------------------------------------------------------------------------