本文整理汇总了C++中AudioUnitSetParameter函数的典型用法代码示例。如果您正苦于以下问题:C++ AudioUnitSetParameter函数的具体用法?C++ AudioUnitSetParameter怎么用?C++ AudioUnitSetParameter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AudioUnitSetParameter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sizeof
bool CCoreAudioMixMap::SetMixingMatrix(CAUMatrixMixer *mixerUnit,
CCoreAudioMixMap *mixMap, AudioStreamBasicDescription *inputFormat,
AudioStreamBasicDescription *fmt, int channelOffset)
{
if (!mixerUnit || !inputFormat || !fmt)
return false;
// Fetch the mixing unit size
UInt32 dims[2];
UInt32 size = sizeof(dims);
AudioUnitGetProperty(mixerUnit->GetUnit(),
kAudioUnitProperty_MatrixDimensions, kAudioUnitScope_Global, 0, dims, &size);
if(inputFormat->mChannelsPerFrame + channelOffset > dims[0])
{
CLog::Log(LOGERROR, "CCoreAudioMixMap::SetMixingMatrix - input format doesn't fit mixer size %u+%u > %u"
, inputFormat->mChannelsPerFrame, channelOffset, dims[0]);
return false;
}
if(fmt->mChannelsPerFrame > dims[1])
{
CLog::Log(LOGERROR, "CCoreAudioMixMap::SetMixingMatrix - ouput format doesn't fit mixer size %u > %u"
, fmt->mChannelsPerFrame, dims[1]);
return false;
}
if(fmt->mChannelsPerFrame < dims[1])
{
CLog::Log(LOGWARNING, "CCoreAudioMixMap::SetMixingMatrix - ouput format doesn't specify all outputs %u < %u"
, fmt->mChannelsPerFrame, dims[1]);
}
// Configure the mixing matrix
Float32* val = (Float32*)*mixMap;
for (UInt32 i = 0; i < inputFormat->mChannelsPerFrame; ++i)
{
UInt32 j = 0;
for (; j < fmt->mChannelsPerFrame; ++j)
{
AudioUnitSetParameter(mixerUnit->GetUnit(),
kMatrixMixerParam_Volume, kAudioUnitScope_Global, ( (i + channelOffset) << 16 ) | j, *val++, 0);
}
// zero out additional outputs from this input
for (; j < dims[1]; ++j)
{
AudioUnitSetParameter(mixerUnit->GetUnit(),
kMatrixMixerParam_Volume, kAudioUnitScope_Global, ( (i + channelOffset) << 16 ) | j, 0.0f, 0);
}
}
CLog::Log(LOGDEBUG, "CCoreAudioGraph::Open: "
"Mixer Output Format: %d channels, %0.1f kHz, %d bits, %d bytes per frame",
(int)fmt->mChannelsPerFrame, fmt->mSampleRate / 1000.0f, (int)fmt->mBitsPerChannel, (int)fmt->mBytesPerFrame);
if (!mixerUnit->InitMatrixMixerVolumes())
return false;
return true;
}
开发者ID:1c0n,项目名称:xbmc,代码行数:60,代码来源:CoreAudioMixMap.cpp
示例2: AudioUnitSetParameter
/**
* Calls the platform specific code to set the parameters that define a radio effect.
*
* @param RadioEffectParameters The new parameters for the radio distortion effect.
*/
void FCoreAudioEffectsManager::SetRadioEffectParameters( const FAudioRadioEffect& RadioEffectParameters )
{
enum ERadioEffectParams
{
RadioParam_ChebyshevPowerMultiplier,
RadioParam_ChebyshevPower,
RadioParam_ChebyshevMultiplier,
RadioParam_ChebyshevCubedMultiplier
};
const float ChebyshevPowerMultiplier = Radio_ChebyshevPowerMultiplier->GetValueOnGameThread();
const float ChebyshevPower = Radio_ChebyshevPower->GetValueOnGameThread();
const float ChebyshevMultiplier = Radio_ChebyshevMultiplier->GetValueOnGameThread();
const float ChebyshevCubedMultiplier = Radio_ChebyshevCubedMultiplier->GetValueOnGameThread();
for( uint32 Index = 1; Index < CORE_AUDIO_MAX_CHANNELS; Index++ )
{
FCoreAudioSoundSource *Source = ((FCoreAudioDevice*)AudioDevice)->AudioChannels[Index];
if( Source && Source->RadioUnit )
{
AudioUnitSetParameter( Source->RadioUnit, RadioParam_ChebyshevPowerMultiplier, kAudioUnitScope_Global, 0, ChebyshevPowerMultiplier, 0 );
AudioUnitSetParameter( Source->RadioUnit, RadioParam_ChebyshevPower, kAudioUnitScope_Global, 0, ChebyshevPower, 0 );
AudioUnitSetParameter( Source->RadioUnit, RadioParam_ChebyshevMultiplier, kAudioUnitScope_Global, 0, ChebyshevMultiplier, 0 );
AudioUnitSetParameter( Source->RadioUnit, RadioParam_ChebyshevCubedMultiplier, kAudioUnitScope_Global, 0, ChebyshevCubedMultiplier, 0 );
}
}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:32,代码来源:CoreAudioEffects.cpp
示例3: check
void FCoreAudioDevice::SetupMatrixMixerInput( int32 Input, bool bIs6ChannelOGG )
{
check( Input < MAX_MULTICHANNEL_AUDIOCHANNELS );
uint32 InputOffset = Input * MatrixMixerInputFormat.mChannelsPerFrame;
uint32 FLInputOffset = 0;
uint32 FRInputOffset = 1;
uint32 FCInputOffset = 2;
uint32 LFEInputOffset = 3;
uint32 SLInputOffset = 4;
uint32 SRInputOffset = 5;
// Channel ordering is different for 6 channel OGG files
if (bIs6ChannelOGG)
{
FLInputOffset = 0;
FCInputOffset = 1;
FRInputOffset = 2;
SLInputOffset = 3;
SRInputOffset = 4;
LFEInputOffset = 5;
}
// Enable input 0
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Enable, kAudioUnitScope_Input, Input, 1.0, 0 );
// Set Matrix Input volume
SetMatrixMixerInputVolume( Input, 1.0 );
// FL channel to left output
uint32 element = CalculateMatrixElement( InputOffset + FLInputOffset, 0 );
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, 1.0, 0 );
// FR channel to right output
element = CalculateMatrixElement( InputOffset + FRInputOffset, 1 );
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, 1.0, 0 );
// FC channel to left & right output
element = CalculateMatrixElement( InputOffset + FCInputOffset, 0 );
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, 0.5, 0 );
element = CalculateMatrixElement( InputOffset + FCInputOffset, 1 );
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, 0.5, 0 );
// LFE channel to left & right output
element = CalculateMatrixElement( InputOffset + LFEInputOffset, 0 );
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, 0.5, 0 );
element = CalculateMatrixElement( InputOffset + LFEInputOffset, 1 );
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, 0.5, 0 );
// SL channel to left output
element = CalculateMatrixElement( InputOffset + SLInputOffset, 0 );
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, 1.0, 0 );
// SR channel to right output
element = CalculateMatrixElement( InputOffset + SRInputOffset, 1 );
AudioUnitSetParameter( MatrixMixerUnit, kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, 1.0, 0 );
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:60,代码来源:CoreAudioDevice.cpp
示例4: writeRenderProc
OSStatus writeRenderProc(void *inRefCon,
AudioUnitRenderActionFlags *inActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumFrames,
AudioBufferList *ioData)
{
OSStatus err= noErr;
void *inInputDataProcUserData=NULL;
CAData *d=(CAData*)inRefCon;
if (gain_changed_out == true)
{
err = AudioUnitSetParameter(d->caOutAudioUnit, kAudioUnitParameterUnit_LinearGain,
kAudioUnitScope_Global, 0, (Float32)gain_volume_out, 0);
if(err != noErr)
{
ms_error("failed to set output volume %i", err);
}
gain_changed_out = false;
err= noErr;
}
if(d->write_started != FALSE) {
AudioStreamPacketDescription* outPacketDescription = NULL;
err = AudioConverterFillComplexBuffer(d->caOutConverter, writeACInputProc, inRefCon,
&inNumFrames, ioData, outPacketDescription);
if(err != noErr)
ms_error("writeRenderProc:AudioConverterFillComplexBuffer err %08x %d", err, ioData->mNumberBuffers);
}
return err;
}
开发者ID:biddyweb,项目名称:mediastream-plus,代码行数:32,代码来源:macsnd.c
示例5: AudioUnitSetParameter
bool CCoreAudioMixMap::SetMixingMatrix(CAUMatrixMixer *mixerUnit,
CCoreAudioMixMap *mixMap, AudioStreamBasicDescription *inputFormat,
AudioStreamBasicDescription *fmt, int channelOffset)
{
if (!mixerUnit || !inputFormat || !fmt)
return false;
// Configure the mixing matrix
Float32* val = (Float32*)*mixMap;
CLog::Log(LOGDEBUG, "CCoreAudioGraph::Open: Loading matrix mixer configuration");
for (UInt32 i = 0; i < inputFormat->mChannelsPerFrame; ++i)
{
val = (Float32*)*mixMap + i*m_deviceChannels;
for (UInt32 j = 0; j < fmt->mChannelsPerFrame; ++j)
{
OSStatus ret = AudioUnitSetParameter(mixerUnit->GetUnit(),
kMatrixMixerParam_Volume, kAudioUnitScope_Global, ( (i + channelOffset) << 16 ) | j, *val++, 0);
if (!ret)
{
CLog::Log(LOGINFO, "CCoreAudioGraph::Open: \t[%d][%d][%0.1f]",
(int)i + channelOffset, (int)j, *(val-1));
}
}
}
CLog::Log(LOGINFO, "CCoreAudioGraph::Open: "
"Mixer Output Format: %d channels, %0.1f kHz, %d bits, %d bytes per frame",
(int)fmt->mChannelsPerFrame, fmt->mSampleRate / 1000.0f, (int)fmt->mBitsPerChannel, (int)fmt->mBytesPerFrame);
if (!mixerUnit->InitMatrixMixerVolumes())
return false;
return true;
}
开发者ID:RobertMe,项目名称:xbmc,代码行数:34,代码来源:CoreAudioMixMap.cpp
示例6: setParameter
bool auLoader::setParameter(int index, float value, long frames) {
if(AudioUnitSetParameter(m_plugin, index, kAudioUnitScope_Global, 0, value, frames) == noErr) {
return true;
}
else {
return false;
}
}
开发者ID:Epitek,项目名称:KickMaker,代码行数:8,代码来源:auLoader.cpp
示例7: AudioUnitSetParameter
void OutputImplAudioUnit::setVolume( float aVolume )
{
aVolume = math<float>::clamp( aVolume, 0.0, 1.0 );
OSStatus err = AudioUnitSetParameter( mMixerUnit, kMultiChannelMixerParam_Volume, kAudioUnitScope_Output, 0, aVolume, 0 );
if( err ) {
//throw
}
}
开发者ID:AaronMeyers,项目名称:Cinder,代码行数:8,代码来源:OutputImplAudioUnit.cpp
示例8: OSSpinLockLock
void CoreAudioOutput::setVolume(float vol)
{
this->_volume = vol;
OSSpinLockLock(this->_spinlockAU);
AudioUnitSetParameter(this->_au, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0);
OSSpinLockUnlock(this->_spinlockAU);
}
开发者ID:MoochMcGee,项目名称:desmume-plus,代码行数:8,代码来源:coreaudiosound.cpp
示例9: control
static int control(int cmd,void *arg){
ao_control_vol_t *control_vol;
OSStatus err;
Float32 vol;
switch (cmd) {
case AOCONTROL_GET_VOLUME:
control_vol = (ao_control_vol_t*)arg;
if (ao->b_digital) {
// Digital output has no volume adjust.
return CONTROL_FALSE;
}
err = AudioUnitGetParameter(ao->theOutputUnit, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, &vol);
if(err==0) {
// printf("GET VOL=%f\n", vol);
control_vol->left=control_vol->right=vol*100.0/4.0;
return CONTROL_TRUE;
}
else {
ao_msg(MSGT_AO, MSGL_WARN, "could not get HAL output volume: [%4.4s]\n", (char *)&err);
return CONTROL_FALSE;
}
case AOCONTROL_SET_VOLUME:
control_vol = (ao_control_vol_t*)arg;
if (ao->b_digital) {
// Digital output can not set volume. Here we have to return true
// to make mixer forget it. Else mixer will add a soft filter,
// that's not we expected and the filter not support ac3 stream
// will cause mplayer die.
// Although not support set volume, but at least we support mute.
// MPlayer set mute by set volume to zero, we handle it.
if (control_vol->left == 0 && control_vol->right == 0)
ao->b_muted = 1;
else
ao->b_muted = 0;
return CONTROL_TRUE;
}
vol=(control_vol->left+control_vol->right)*4.0/200.0;
err = AudioUnitSetParameter(ao->theOutputUnit, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0);
if(err==0) {
// printf("SET VOL=%f\n", vol);
return CONTROL_TRUE;
}
else {
ao_msg(MSGT_AO, MSGL_WARN, "could not set HAL output volume: [%4.4s]\n", (char *)&err);
return CONTROL_FALSE;
}
/* Everything is currently unimplemented */
default:
return CONTROL_FALSE;
}
}
开发者ID:DanielGit,项目名称:Intrisit8000,代码行数:57,代码来源:ao_coreaudio.c
示例10: SetParameter
OSStatus SetParameter(AudioUnitParameterID inID, AudioUnitScope scope, AudioUnitElement element,
Float32 value, UInt32 bufferOffsetFrames)
{
if (mSetParamProc != NULL) {
return reinterpret_cast<AudioUnitSetParameterProc>(mSetParamProc) (mConnInstanceStorage,
inID, scope, element, value, bufferOffsetFrames);
}
return AudioUnitSetParameter(mUnit, inID, scope, element, value, bufferOffsetFrames);
}
开发者ID:63n,项目名称:ardour,代码行数:9,代码来源:CAAudioUnit.cpp
示例11: DoSetVolume
/** Set the volume of the current sequence. */
static void DoSetVolume()
{
if (_sequence == NULL) return;
AUGraph graph;
MusicSequenceGetAUGraph(_sequence, &graph);
AudioUnit output_unit = NULL;
/* Get output audio unit */
UInt32 node_count = 0;
AUGraphGetNodeCount(graph, &node_count);
for (UInt32 i = 0; i < node_count; i++) {
AUNode node;
AUGraphGetIndNode(graph, i, &node);
AudioUnit unit;
OSType comp_type = 0;
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (MacOSVersionIsAtLeast(10, 5, 0)) {
/* The 10.6 SDK has changed the function prototype of
* AUGraphNodeInfo. This is a binary compatible change,
* but we need to get the type declaration right or
* risk compilation errors. The header AudioComponent.h
* was introduced in 10.6 so use it to decide which
* type definition to use. */
#ifdef __AUDIOCOMPONENT_H__
AudioComponentDescription desc;
#else
ComponentDescription desc;
#endif
AUGraphNodeInfo(graph, node, &desc, &unit);
comp_type = desc.componentType;
} else
#endif
{
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
ComponentDescription desc;
AUGraphGetNodeInfo(graph, node, &desc, NULL, NULL, &unit);
comp_type = desc.componentType;
#endif
}
if (comp_type == kAudioUnitType_Output) {
output_unit = unit;
break;
}
}
if (output_unit == NULL) {
DEBUG(driver, 1, "cocoa_m: Failed to get output node to set volume");
return;
}
Float32 vol = _volume / 127.0f; // 0 - +127 -> 0.0 - 1.0
AudioUnitSetParameter(output_unit, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0);
}
开发者ID:ShaunOfTheLive,项目名称:OpenCoasterTycoon,代码行数:58,代码来源:cocoa_m.cpp
示例12: AudioUnitSetParameter
// ----------------------------------------------------------
void ofxAudioUnitSampler::setVolume(float volume)
// ----------------------------------------------------------
{
AudioUnitSetParameter(*_unit,
kMusicDeviceParam_Volume,
kAudioUnitScope_Global,
0,
volume,
0);
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxAudioUnit,代码行数:11,代码来源:ofxAudioUnitSampler.cpp
示例13: AudioUnitSetParameter
/*
* FOR SETTING VOLUME ON iOS, AudioQueue SHOULD BE USED INSTEAD OF AudioUnit
*/
void AudioLoopImplCocoa::setVolume(float volume)
{
#if !TARGET_OS_IPHONE
if (initialized)
{
OSStatus err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0, volume, 0);
if (err) printf("AudioUnitSetParameter ERROR: %d\n", (int)err);
}
#endif
}
开发者ID:arielm,项目名称:new-chronotext-toolkit,代码行数:13,代码来源:AudioLoopImplCocoa.cpp
示例14: ERR_CHK
// ----------------------------------------------------------
void ofxAudioUnitMixer::setInputVolume(float volume, int bus)
// ----------------------------------------------------------
{
ERR_CHK(AudioUnitSetParameter(*_unit,
kMultiChannelMixerParam_Volume,
kAudioUnitScope_Input,
bus,
volume,
0),
"setting mixer input gain");
}
开发者ID:jasonlevine,项目名称:body-controlled-instrument,代码行数:12,代码来源:ofxAudioUnitMixer.cpp
示例15: set_volume
static int set_volume(struct ao *ao, struct ao_control_vol *vol) {
struct priv *p = ao->priv;
float auvol = (vol->left + vol->right) / 200.0;
OSStatus err =
AudioUnitSetParameter(p->audio_unit, kHALOutputParam_Volume,
kAudioUnitScope_Global, 0, auvol, 0);
CHECK_CA_ERROR("could not set HAL output volume");
return CONTROL_TRUE;
coreaudio_error:
return CONTROL_ERROR;
}
开发者ID:BILIHUBSU,项目名称:mpv,代码行数:11,代码来源:ao_coreaudio.c
示例16: AudioDataMixerCallback
int AudioDataMixerCallback(uint busIndex, int totalNbOfFrameToWrite, AudioBufferList* data)
{
char* outPtr = (char*)data->mBuffers[0].mData;
int remainingFramesToWrite = totalNbOfFrameToWrite;
while (remainingFramesToWrite > 0)
{
int nbOfFrameToWrite = std::min(remainingFramesToWrite, (ShouldBeLooped() ? LoopEndPoint : TotalNumberOfFrames) - CurrentFrame);
CopyDataToBuffer(outPtr, nbOfFrameToWrite, NumberOfChannels);
remainingFramesToWrite -= nbOfFrameToWrite;
// Check if the track have to be re-looped
if (ShouldBeLooped() && CurrentFrame >= LoopEndPoint)
{
--NumberOfLoops;
CurrentFrame = LoopStartPoint;
}
// Check if we reached the end of the track.
if (CurrentFrame >= TotalNumberOfFrames)
{
AudioUnitSetParameter((AudioUnit)HandleChannelMixer, kMultiChannelMixerParam_Enable, kAudioUnitScope_Input, busIndex, 0, 0);
AudioUnitSetParameter((AudioUnit)Handle3DMixer, k3DMixerParam_Enable, kAudioUnitScope_Input, busIndex, 0, 0);
IsEnabled2D = false;
IsEnabled3D = false;
PlaybackEnded = true;
// Fill the rest of the buffer with blank
int sizeToBlank = sizeof(short) * NumberOfChannels * remainingFramesToWrite;
memset(outPtr, 0, sizeToBlank);
return 0;
}
}
return 0;
}
开发者ID:9KGameStudio,项目名称:paradox,代码行数:41,代码来源:audioCallbacks.iOS.cpp
示例17: AudioUnitSetParameter
void CoreAudioSound::SetVolume(int volume)
{
OSStatus err;
m_volume = volume;
err = AudioUnitSetParameter(audioUnit,
kHALOutputParam_Volume,
kAudioUnitParameterFlag_Output, 0,
volume / 100., 0);
if (err != noErr)
ERROR_LOG(AUDIO, "error setting volume");
}
开发者ID:Chiri23,项目名称:dolphin,代码行数:12,代码来源:CoreAudioSoundStream.cpp
示例18: native_midi_setvolume
void native_midi_setvolume(int volume)
{
if (latched_volume == volume)
return;
latched_volume = volume;
if ((currentsong) && (currentsong->audiounit)) {
const float floatvol = ((float) volume) / ((float) MIX_MAX_VOLUME);
AudioUnitSetParameter(currentsong->audiounit, kHALOutputParam_Volume,
kAudioUnitScope_Global, 0, floatvol, 0);
}
}
开发者ID:lighthouse64,项目名称:PGE-Project,代码行数:12,代码来源:native_midi_macosx.c
示例19: AudioUnitSetParameter
bool CCoreAudioUnit::SetCurrentVolume(Float32 vol)
{
if (!m_Component)
return false;
OSStatus ret = AudioUnitSetParameter(m_Component, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0);
if (ret)
{
CLog::Log(LOGERROR, "CCoreAudioUnit::SetCurrentVolume: Unable to set AudioUnit volume. Error = 0x%08x (%4.4s)", ret, CONVERT_OSSTATUS(ret));
return false;
}
return true;
}
开发者ID:flyingtime,项目名称:boxee,代码行数:13,代码来源:CoreAudio.cpp
示例20: macosx_audio_set_ogain
void macosx_audio_set_ogain(audio_desc_t ad,int vol)
{
UNUSED(ad);
OSStatus err = noErr;
// Remember the playback gain.
//devices[ad].pgain_ = level;
devices[ad].outputGain_ = vol; /// outputGainDivisor_;
//float og_scaled = devices[ad].outputGain_ / 16;
// Set the volume.
err = AudioUnitSetParameter(devices[ad].outputUnit_, kAudioUnitParameterUnit_LinearGain, kAudioUnitScope_Global, 0, devices[ad].outputGain_, 0);
if (err != noErr) fprintf(stderr, "Input device error: set_ogain");
};
开发者ID:JensenSung,项目名称:rat,代码行数:13,代码来源:auddev_macosx.c
注:本文中的AudioUnitSetParameter函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论