For DOS Protected Mode version of sensor core software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.5 KiB

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 26/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgVoiceModem.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgVoiceModem.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "LgVoiceModem.h"
  16. CLgVoiceModem::CLgVoiceModem()
  17. {
  18. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CLgVoiceModem::CLgVoiceModem" );
  19. }
  20. CLgVoiceModem::~CLgVoiceModem()
  21. {
  22. Destroy();
  23. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CLgVoiceModem::~CLgVoiceModem" );
  24. }
  25. BOOL CLgVoiceModem::Drop()
  26. {
  27. // stop wave
  28. CLgWavePlayer::ResetWave();
  29. // stop speech
  30. CLgSpeechPlayer::ResetSpeech();
  31. // drop line
  32. #ifdef __GSM__
  33. return CLgGSMModem::Drop();
  34. #else
  35. return CLgModem::Drop();
  36. #endif
  37. }
  38. BOOL CLgVoiceModem::Play( LPCTSTR pWaveFile )
  39. {
  40. if( !m_WaveFile.Load( pWaveFile ) )
  41. {
  42. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Play", "m_WaveFile.Load( \"%s\" ) failed", pWaveFile );
  43. return FALSE;
  44. }
  45. if( !m_WaveFile.ConvertToPCM() )
  46. {
  47. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Play", "m_WaveFile.ConvertToPCM() failed" );
  48. return FALSE;
  49. }
  50. LPCTSTR pTapiDeviceName = "wave/out";
  51. DWORD dwWaveDeviceID;
  52. #ifdef __GSM__
  53. if( !CLgGSMModem::GetDeviceID( &dwWaveDeviceID, pTapiDeviceName ) )
  54. #else
  55. if( !CLgModem::GetDeviceID( &dwWaveDeviceID, pTapiDeviceName ) )
  56. #endif
  57. {
  58. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Play", "Can't get wave device for %s", pTapiDeviceName );
  59. return FALSE;
  60. }
  61. if( !CLgWavePlayer::PlayWave( &m_WaveFile, dwWaveDeviceID ) )
  62. {
  63. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Play", "CLgWavePlayer::Play( %p, %d ) failed", &m_WaveFile, dwWaveDeviceID );
  64. return FALSE;
  65. }
  66. return TRUE;
  67. }
  68. BOOL CLgVoiceModem::Speak( LPCTSTR pSpeech, INT nVolume, INT nRate, LPWSTR pVoiceTokenId )
  69. {
  70. LPCTSTR pTapiDeviceName = "wave/out";
  71. DWORD dwWaveDeviceID;
  72. #ifdef __GSM__
  73. if( !CLgGSMModem::GetDeviceID( &dwWaveDeviceID, pTapiDeviceName ) )
  74. #else
  75. if( !CLgModem::GetDeviceID( &dwWaveDeviceID, pTapiDeviceName ) )
  76. #endif
  77. {
  78. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Speak", "Can't get wave device for %s", pTapiDeviceName );
  79. return FALSE;
  80. }
  81. return CLgSpeechPlayer::PlaySpeech( pSpeech, dwWaveDeviceID );
  82. }