📄 audiomanager.hpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
#pragma once
#ifndef __AUDIOMANAGER_HPP__
#define __AUDIOMANAGER_HPP__
#include <windows.h>
#include "string.hxx"
class AudioManager_t
{
public:
enum ProgressToneType_e
{
ProgressToneInvalid = 0,
ProgressToneDial,
ProgressToneRingback,
ProgressToneCallWaiting, // 1 call connected and another incoming
ProgressToneReorder, //Local error - e.g. wrong digitmap
ProgressToneClientBusy, //other client is busy
};
public:
AudioManager_t();
~AudioManager_t();
HRESULT
Initialize(
void
);
void
Uninitialize(
void
);
HRESULT
PlayProgressTone(
ProgressToneType_e ProgressToneType
);
HRESULT
StopProgressTone(
void
);
HRESULT
Ring(
__in const WCHAR* c_RingTonePath
);
HRESULT
CancelRing(
void
);
bool
IsRinging(
void
)
{
return (m_RingThreadId != NULL);
};
private:
static
DWORD WINAPI
s_ProgressToneThreadProc(
__in_opt LPVOID Parameter
);
HRESULT
ProgressToneThreadProc(
void
);
static
DWORD WINAPI
s_RingerProc(
__in_opt LPVOID Parameter
);
DWORD
RingerProc(
void
);
HRESULT
PlaySound(
__in BSTR bstrFilePath,
DWORD CallbackHandle
);
HRESULT
StopSound(
void
);
HRESULT
StartRing(
HANDLE CallbackEvent
);
HRESULT
StopRing(
void
);
private:
static const WCHAR sc_CallWaitingTone[];
static const WCHAR sc_DialTone[];
static const WCHAR sc_ClientBusyTone[];
static const WCHAR sc_ReorderTone[];
static const WCHAR sc_RingbackTone[];
HWAVEOUT m_RingWaveOutHandle;
WAVEHDR m_RingWaveDataBlockHeader;
HANDLE m_RingThreadId;
HANDLE m_StopRingEvent;
ce::wstring m_RingTonePath;
const WCHAR* m_pProgressTonePath;
HANDLE m_ProgressToneThreadId;
CRITICAL_SECTION m_Lock;
HANDLE m_StopToneEvent;
};
#endif /* __AUDIOMANAGER_HPP__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -