Old fashion design for PC-104
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.
 
 
 
 
 

83 lines
2.3 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 26/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: LgVoiceModem.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of LgVoiceModem.cpp
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "LgVoiceModem.h"
CLgVoiceModem::CLgVoiceModem()
{
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CLgVoiceModem::CLgVoiceModem" );
}
CLgVoiceModem::~CLgVoiceModem()
{
Destroy();
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CLgVoiceModem::~CLgVoiceModem" );
}
BOOL CLgVoiceModem::Drop()
{
// stop wave
CLgWavePlayer::ResetWave();
// stop speech
CLgSpeechPlayer::ResetSpeech();
// drop line
return CLgModem::Drop();
}
BOOL CLgVoiceModem::Play( LPCTSTR pWaveFile )
{
if( !m_WaveFile.Load( pWaveFile ) )
{
LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Play", "m_WaveFile.Load( \"%s\" ) failed", pWaveFile );
return FALSE;
}
if( !m_WaveFile.ConvertToPCM() )
{
LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Play", "m_WaveFile.ConvertToPCM() failed" );
return FALSE;
}
LPCTSTR pTapiDeviceName = "wave/out";
DWORD dwWaveDeviceID;
if( !CLgModem::GetDeviceID( &dwWaveDeviceID, pTapiDeviceName ) )
{
LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Play", "Can't get wave device for %s", pTapiDeviceName );
return FALSE;
}
if( !CLgWavePlayer::PlayWave( &m_WaveFile, dwWaveDeviceID ) )
{
LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Play", "CLgWavePlayer::Play( %p, %d ) failed", &m_WaveFile, dwWaveDeviceID );
return FALSE;
}
return TRUE;
}
BOOL CLgVoiceModem::Speak( LPCTSTR pSpeech, INT nVolume, INT nRate, LPWSTR pVoiceTokenId )
{
LPCTSTR pTapiDeviceName = "wave/out";
DWORD dwWaveDeviceID;
if( !CLgModem::GetDeviceID( &dwWaveDeviceID, pTapiDeviceName ) )
{
LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CLgVoiceModem::Speak", "Can't get wave device for %s", pTapiDeviceName );
return FALSE;
}
return CLgSpeechPlayer::PlaySpeech( pSpeech, dwWaveDeviceID );
}