summaryrefslogtreecommitdiff
path: root/audio/sysvad/ToneGenerator.cpp
diff options
context:
space:
mode:
authorGirish Pattabiraman <[email protected]>2018-08-13 10:54:19 -0700
committerAdonais Romero González <[email protected]>2018-08-13 10:54:19 -0700
commit2af3e666d01a60568c2875b4ccbd56b122ad714f (patch)
tree29825a7b7cb0f6a9f77f1ab6e5813665d45ca4cc /audio/sysvad/ToneGenerator.cpp
parent181c180357cdf9a04d5e3bb21a8e86dc2155ca69 (diff)
Update sample to get ready for RS4 changes - merge pre-RS4 fixes. (#256)
* Format Changes ============== * Add KSEVENT_PINCAPS_FORMATCHANGE to Bluetooth HFP Endpoints * Remove 8 bit formats from Bluetooth HFP Endpoints Name Template ============== * Bluetooth Endpoints are now based on templates in INF and then customized with endpoints specific data Sideband Common Interface for future Sideband buses =================================================== * Add ISidebandDevice * Add current directory to TabletAudioSample include path. Remove unused compiler flags. * RS4 bug fixes
Diffstat (limited to 'audio/sysvad/ToneGenerator.cpp')
-rw-r--r--audio/sysvad/ToneGenerator.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/audio/sysvad/ToneGenerator.cpp b/audio/sysvad/ToneGenerator.cpp
index 2a01e49a..6ef2a39a 100644
--- a/audio/sysvad/ToneGenerator.cpp
+++ b/audio/sysvad/ToneGenerator.cpp
@@ -15,7 +15,6 @@ Abstract:
#include <sysvad.h>
#include "ToneGenerator.h"
-const double TONE_AMPLITUDE = 0.5; // Scalar value, should be between 0.0 - 1.0
const double TWO_PI = M_PI * 2;
extern DWORD g_DisableToneGenerator;
@@ -89,7 +88,7 @@ VOID ToneGenerator::InitNewFrame
_In_ DWORD FrameSize
)
{
- double sinValue = TONE_AMPLITUDE * sin( m_Theta );
+ double sinValue = m_ToneDCOffset + m_ToneAmplitude * sin( m_Theta );
if (FrameSize != (DWORD)m_ChannelCount * m_BitsPerSample/8)
{
@@ -222,6 +221,9 @@ ZeroBuffer:
NTSTATUS ToneGenerator::Init
(
_In_ DWORD ToneFrequency,
+ _In_ double ToneAmplitude,
+ _In_ double ToneDCOffset,
+ _In_ double ToneInitialPhase,
_In_ PWAVEFORMATEXTENSIBLE WfExt
)
{
@@ -248,8 +250,11 @@ NTSTATUS ToneGenerator::Init
//
// Basic init.
//
- RtlZeroMemory(&m_Theta, sizeof(m_Theta));
+ m_Theta = ToneInitialPhase;
m_Frequency = ToneFrequency;
+ m_ToneAmplitude = ToneAmplitude;
+ m_ToneDCOffset = ToneDCOffset;
+
m_ChannelCount = WfExt->Format.nChannels; // # channels.
m_BitsPerSample = WfExt->Format.wBitsPerSample; // bits per sample.
m_SamplesPerSecond = WfExt->Format.nSamplesPerSec; // samples per sec.