本文整理汇总了C++中SetSampleRate函数的典型用法代码示例。如果您正苦于以下问题:C++ SetSampleRate函数的具体用法?C++ SetSampleRate怎么用?C++ SetSampleRate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetSampleRate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartAudioI2S0AWBHardware
static void StartAudioI2S0AWBHardware(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
uint32 Audio_I2S_Dac = 0;
uint32 MclkDiv0 = 0;
const bool bEnablePhaseShiftFix = true;
printk("StartAudioI2S0AWBHardware \n");
MclkDiv0 = SetCLkMclk(Soc_Aud_I2S0, runtime->rate); //select I2S
SetCLkBclk(MclkDiv0, runtime->rate, runtime->channels, Soc_Aud_I2S_WLEN_WLEN_32BITS);
// 2nd I2S In
SetSampleRate(Soc_Aud_Digital_Block_MEM_I2S, runtime->rate);
Audio_I2S_Dac |= (bEnablePhaseShiftFix << 31);
Audio_I2S_Dac |= (Soc_Aud_I2S_IN_PAD_SEL_I2S_IN_FROM_IO_MUX << 28);//I2S in from io_mux
Audio_I2S_Dac |= Soc_Aud_LOW_JITTER_CLOCK << 12 ; //Low jitter mode
Audio_I2S_Dac |= (Soc_Aud_INV_LRCK_NO_INVERSE << 5);
Audio_I2S_Dac |= (Soc_Aud_I2S_FORMAT_I2S << 3);
Audio_I2S_Dac |= (Soc_Aud_I2S_WLEN_WLEN_32BITS << 1);
Afe_Set_Reg(AFE_I2S_CON, Audio_I2S_Dac | 0x1, MASK_ALL);
// here to set interrupt
SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->period_size >> 1);
SetIrqMcuSampleRate(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->rate);
SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, true);
SetSampleRate(Soc_Aud_Digital_Block_MEM_AWB, substream->runtime->rate);
SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_AWB, true);
SetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_IN_2, true);
// here to turn off digital part
#ifdef DUMP_HWGAIN1_AWB
uint32 REG420 = 0;
SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I00, Soc_Aud_InterConnectionOutput_O05);
SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I01, Soc_Aud_InterConnectionOutput_O06);
printk("%s() Soc_Aud_InterCon_Connection I10 O5\n", __func__);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I10, Soc_Aud_InterConnectionOutput_O05);
printk("%s() Soc_Aud_InterCon_Connection I11 O6\n", __func__);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I11, Soc_Aud_InterConnectionOutput_O06);
REG420 = Afe_Get_Reg(AFE_GAIN1_CONN);
printk("%s() AFE_GAIN1_CONN (0X420) =0x%x\n", __func__, REG420);
#else
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I00, Soc_Aud_InterConnectionOutput_O05);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I01, Soc_Aud_InterConnectionOutput_O06);
#endif
EnableAfe(true);
}
示例2: StartAudioCaptureHardware
static void StartAudioCaptureHardware(struct snd_pcm_substream *substream)
{
printk("StartAudioCaptureHardware \n");
//ConfigAdcI2S(substream);
//Set2ndI2SAdcIn(mAudioDigitalI2S);//To do, JY
SetMemIfFetchFormatPerSample(Soc_Aud_Digital_Block_MEM_MOD_DAI, AFE_WLEN_16_BIT);
SetoutputConnectionFormat(OUTPUT_DATA_FORMAT_16BIT, Soc_Aud_InterConnectionOutput_O12);
/* To Do, JY, MOD_DAI?
if (GetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_IN_ADC_2) == false)
{
SetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_IN_ADC_2, true);
Set2ndI2SAdcEnable(true);
}
else
{
SetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_IN_ADC_2, true);
}
*/
// here to set interrupt
SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->period_size);
SetIrqMcuSampleRate(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->rate);
SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, true);
SetSampleRate(Soc_Aud_Digital_Block_MEM_MOD_DAI, substream->runtime->rate);
SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_MOD_DAI, true);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O12);
EnableAfe(true);
}
示例3: SetSampleRate
CSynthesizer::CSynthesizer()
{
int i;
revrbON = INACTIVE;
delayON = INACTIVE;
activeNotesCount = 0;
for (i=0; i<POLIPHONY; i++)
{
state[i] = INACTIVE;
channels[i] = 0;
key[i] = 0;
veloc[i] = 0;
heldkeys[i] = 0;
}
for (i=0; i<MIDICHANNELS; i++)
{
lkp[i] = 255;
rev[i] = 0.0f;
dly[i] = 0.0f;
mod[i] = 0.0f;
vol[i] = 0.25f;
pan[i] = 0.0f;
aft[i] = 0.0f;
ptc[i] = 1.0f;
hld[i] = 0;
}
programs.Init();
reverb.Init();
delay.Init(buffers.bWaves[0]);
SetSampleRate(44100.f);
}
示例4: Module
/**
* Create a new instance of an analog module.
*
* Create an instance of the analog module object. Initialize all the parameters
* to reasonable values on start.
* Setting a global value on an analog module can be done only once unless subsequent
* values are set the previously set value.
* Analog modules are a singleton, so the constructor is never called outside of this class.
*
* @param slot The slot in the chassis that the module is plugged into.
*/
AnalogModule::AnalogModule(UINT32 slot)
: Module(slot)
, m_module (NULL)
, m_sampleRateSet (false)
, m_numChannelsToActivate (0)
{
status = 0;
AddToSingletonList();
m_module = new tAI(SlotToIndex(slot), &status);
SetNumChannelsToActivate(kAnalogChannels);
SetSampleRate(kDefaultSampleRate);
for (UINT32 i = 0; i < kAnalogChannels; i++)
{
m_module->writeScanList(i, i, &status);
SetAverageBits(i + 1, kDefaultAverageBits);
SetOversampleBits(i + 1, kDefaultOversampleBits);
}
if (m_registerWindowSemaphore == NULL)
{
// Needs to be global since the protected resource spans both module singletons.
m_registerWindowSemaphore = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE);
}
wpi_assertCleanStatus(status);
}
示例5: Module
/**
* Create a new instance of an analog module.
*
* Create an instance of the analog module object. Initialize all the parameters
* to reasonable values on start.
* Setting a global value on an analog module can be done only once unless subsequent
* values are set the previously set value.
* Analog modules are a singleton, so the constructor is never called outside of this class.
*
* @param moduleNumber The analog module to create (1 or 2).
*/
AnalogModule::AnalogModule(UINT8 moduleNumber)
: Module(nLoadOut::kModuleType_Analog, moduleNumber)
, m_module (NULL)
, m_sampleRateSet (false)
, m_numChannelsToActivate (0)
{
AddToSingletonList();
tRioStatusCode localStatus = NiFpga_Status_Success;
m_module = tAI::create(m_moduleNumber - 1, &localStatus);
wpi_setError(localStatus);
SetNumChannelsToActivate(kAnalogChannels);
SetSampleRate(kDefaultSampleRate);
for (UINT32 i = 0; i < kAnalogChannels; i++)
{
m_module->writeScanList(i, i, &localStatus);
wpi_setError(localStatus);
SetAverageBits(i + 1, kDefaultAverageBits);
SetOversampleBits(i + 1, kDefaultOversampleBits);
}
if (m_registerWindowSemaphore == NULL)
{
// Needs to be global since the protected resource spans both module singletons.
m_registerWindowSemaphore = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE);
}
}
示例6: mtk_pcm_I2S0dl1_start
static int mtk_pcm_I2S0dl1_start(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
printk("%s\n", __func__);
// here start digital part
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I05, Soc_Aud_InterConnectionOutput_O00);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I06, Soc_Aud_InterConnectionOutput_O01);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I05, Soc_Aud_InterConnectionOutput_O03);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I06, Soc_Aud_InterConnectionOutput_O04);
SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ1_MCU_MODE, true);
SetSampleRate(Soc_Aud_Digital_Block_MEM_DL1, runtime->rate);
SetChannels(Soc_Aud_Digital_Block_MEM_DL1, runtime->channels);
SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL1, true);
EnableAfe(true);
#ifdef _DEBUG_6328_CLK
//Debug 6328 Digital to Analog path clock and data work or not. and read TEST_OUT(0x206)
// Ana_Set_Reg(AFE_MON_DEBUG0, 0x4600 , 0xcf00); // monitor 6328 digitala data sent to analog or not
Ana_Set_Reg(AFE_MON_DEBUG0, 0x4200 , 0xcf00); // monitor 6328 digitala data sent to analog or not
Ana_Set_Reg(TEST_CON0, 0x0e00 , 0xffff);
#endif
#if 0 // test 6328 sgen
Ana_Set_Reg(AFE_SGEN_CFG0 , 0x0080 , 0xffff);
Ana_Set_Reg(AFE_SGEN_CFG1 , 0x0101 , 0xffff);
Ana_Set_Reg(AFE_AUDIO_TOP_CON0, 0x0000, 0xffff); //power on clock
// Ana_Set_Reg(PMIC_AFE_TOP_CON0, 0x0002, 0x0002); //UL from sinetable
Ana_Set_Reg(PMIC_AFE_TOP_CON0, 0x0001, 0x0001); //DL from sinetable
#endif
return 0;
}
示例7: mtk_pcm_dl2_start
static int mtk_pcm_dl2_start(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
pr_warn("%s\n", __func__);
/* here start digital part */
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I07,
Soc_Aud_InterConnectionOutput_O03);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I08,
Soc_Aud_InterConnectionOutput_O04);
#ifdef CONFIG_MTK_FPGA
/* set loopback test interconnection */
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I07,
Soc_Aud_InterConnectionOutput_O09);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I08,
Soc_Aud_InterConnectionOutput_O10);
#endif
SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ1_MCU_MODE, true);
SetSampleRate(Soc_Aud_Digital_Block_MEM_DL2, runtime->rate);
SetChannels(Soc_Aud_Digital_Block_MEM_DL2, runtime->channels);
SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL2, true);
SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ1_MCU_MODE, runtime->period_size);
SetIrqMcuSampleRate(Soc_Aud_IRQ_MCU_MODE_IRQ1_MCU_MODE, runtime->rate);
EnableAfe(true);
return 0;
}
示例8: StartAudioI2S0AWBHardware
static void StartAudioI2S0AWBHardware(struct snd_pcm_substream *substream)
{
pr_debug("StartAudioI2S0AWBHardware \n");
// here to set interrupt
SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->period_size);
SetIrqMcuSampleRate(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->rate);
SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, true);
SetSampleRate(Soc_Aud_Digital_Block_MEM_AWB, substream->runtime->rate);
SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_AWB, true);
// here to turn off digital part
#ifdef DUMP_HWGAIN1_AWB
uint32 REG420 = 0;
SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I00, Soc_Aud_InterConnectionOutput_O05);
SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I01, Soc_Aud_InterConnectionOutput_O06);
pr_debug("%s() Soc_Aud_InterCon_Connection I10 O5\n", __func__);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I10, Soc_Aud_InterConnectionOutput_O05);
pr_debug("%s() Soc_Aud_InterCon_Connection I11 O6\n", __func__);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I11, Soc_Aud_InterConnectionOutput_O06);
REG420 = Afe_Get_Reg(AFE_GAIN1_CONN);
pr_debug("%s() AFE_GAIN1_CONN (0X420) =0x%x\n", __func__, REG420);
#else
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I00, Soc_Aud_InterConnectionOutput_O05);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I01, Soc_Aud_InterConnectionOutput_O06);
#endif
EnableAfe(true);
}
示例9: StartAudioMrgrxAWBHardware
static void StartAudioMrgrxAWBHardware(struct snd_pcm_substream *substream)
{
printk("StartAudioMrgrxAWBHardware \n");
// here to set interrupt
SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->period_size>>1);
SetIrqMcuSampleRate( Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->rate);
SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, true);
SetSampleRate(Soc_Aud_Digital_Block_MEM_AWB, substream->runtime->rate);
SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_AWB,true);
// here to turn off digital part
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I15, Soc_Aud_InterConnectionOutput_O05);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I16, Soc_Aud_InterConnectionOutput_O06);
if(GetMemoryPathEnable(Soc_Aud_Digital_Block_MRG_I2S_OUT )== false)
{
//set merge interface
SetMemoryPathEnable(Soc_Aud_Digital_Block_MRG_I2S_OUT, true);
SetMrgI2SEnable(true, substream->runtime->rate);
}
else
{
SetMemoryPathEnable(Soc_Aud_Digital_Block_MRG_I2S_OUT, true);
}
EnableAfe(true);
}
示例10: SetBufferSize
bool DspOscillator::ParameterUpdating_(int index, DspParameter const& param)
{
if (index == pBufferSize)
{
SetBufferSize(*param.GetInt());
return true;
}
else if (index == pSampleRate)
{
SetSampleRate(*param.GetInt());
return true;
}
else if (index == pAmplitude)
{
SetAmpl(*param.GetFloat());
return true;
}
else if (index == pFrequency)
{
SetFreq(*param.GetFloat());
return true;
}
return false;
}
示例11: StartAudioBtDaiHardware
static void StartAudioBtDaiHardware(struct snd_pcm_substream *substream)
{
printk("StartAudioBtDaiHardware period_size = %d\n",(unsigned int)(substream->runtime->period_size));
// here to set interrupt
SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->period_size>>1);
SetIrqMcuSampleRate(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->rate);
SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, true);
SetSampleRate(Soc_Aud_Digital_Block_MEM_DAI, substream->runtime->rate);
SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DAI, true);
// here to turn off digital part
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I02, Soc_Aud_InterConnectionOutput_O11);
if (GetMemoryPathEnable(Soc_Aud_Digital_Block_DAI_BT) == false)
{
SetMemoryPathEnable(Soc_Aud_Digital_Block_DAI_BT, true);
SetVoipDAIBTAttribute(substream->runtime->rate);
SetDaiBtEnable(true);
}
else
{
SetMemoryPathEnable(Soc_Aud_Digital_Block_DAI_BT, true);
}
EnableAfe(true);
}
示例12: StartAudioCaptureHardware
static void StartAudioCaptureHardware(struct snd_pcm_substream *substream)
{
printk("StartAudioCaptureHardware \n");
ConfigAdcI2S(substream);
SetI2SAdcIn(mAudioDigitalI2S);
//EnableSideGenHw(Soc_Aud_InterConnectionOutput_O09,Soc_Aud_MemIF_Direction_DIRECTION_OUTPUT,true);
SetMemIfFetchFormatPerSample(Soc_Aud_Digital_Block_MEM_VUL, AFE_WLEN_16_BIT);
SetMemIfFetchFormatPerSample(Soc_Aud_Digital_Block_MEM_VUL, AFE_WLEN_16_BIT);
SetoutputConnectionFormat(OUTPUT_DATA_FORMAT_16BIT, Soc_Aud_InterConnectionOutput_O09);
SetoutputConnectionFormat(OUTPUT_DATA_FORMAT_16BIT, Soc_Aud_InterConnectionOutput_O10);
SetI2SAdcEnable(true);
// here to set interrupt
SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->period_size);
SetIrqMcuSampleRate(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->rate);
SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, true);
SetSampleRate(Soc_Aud_Digital_Block_MEM_VUL, substream->runtime->rate);
SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_VUL, true);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I03, Soc_Aud_InterConnectionOutput_O09);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I04, Soc_Aud_InterConnectionOutput_O10);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I05, Soc_Aud_InterConnectionOutput_O09);
SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I06, Soc_Aud_InterConnectionOutput_O10);
EnableAfe(true);
}
示例13: SetSampleRate
/*****************************************************************************
* CSynth::Activate()
*****************************************************************************
* Make the synth active.
*/
HRESULT CSynth::Activate(DWORD dwSampleRate, DWORD dwChannels )
{
m_stLastTime = 0;
SetSampleRate(dwSampleRate);
SetStereoMode(dwChannels);
ResetPerformanceStats();
return S_OK;
}
示例14: m_SampleRate
/////////////////////////////////////////////////////////////////////////////////
// Construct FM demod object
/////////////////////////////////////////////////////////////////////////////////
CFmDemod::CFmDemod(TYPEREAL samplerate) : m_SampleRate(samplerate)
{
m_FreqErrorDC = 0.0;
m_NcoPhase = 0.0;
m_NcoFreq = 0.0;
SetSampleRate(m_SampleRate);
}
示例15: SetUpUnidirectionalStream
static PaError SetUpUnidirectionalStream(AudioDeviceID device, double sampleRate, unsigned long framesPerBuffer, int isInput)
{
PaError err = paNoError;
err = SetSampleRate(device, sampleRate, isInput);
if( err == paNoError )
err = SetFramesPerBuffer(device, framesPerBuffer, isInput);
return err;
}