float FKAggregateGeom::GetVolume(const FVector& Scale) const { float Volume = 0.0f; for ( auto SphereElemIt = SphereElems.CreateConstIterator(); SphereElemIt; ++SphereElemIt ) { Volume += SphereElemIt->GetVolume(Scale); } for ( auto BoxElemIt = BoxElems.CreateConstIterator(); BoxElemIt; ++BoxElemIt ) { Volume += BoxElemIt->GetVolume(Scale); } for ( auto SphylElemIt = SphylElems.CreateConstIterator(); SphylElemIt; ++SphylElemIt ) { Volume += SphylElemIt->GetVolume(Scale); } for ( auto ConvexElemIt = ConvexElems.CreateConstIterator(); ConvexElemIt; ++ConvexElemIt ) { Volume += ConvexElemIt->GetVolume(Scale); } return Volume; }
void UBasicVolumeComponent::EnsureRendering() { if (GetVolume() && !m_octree.IsValid()) { m_octree = MakeShareable(new FSparseOctree(GetVolume(), this, EOctreeConstructionModes::BoundCells)); } }
BOOL CAudioMixerControl::OpenDevice(const GUID* pGuid, BOOL bCaptureDevice, int nInput, BOOL bRealMixer) { m_bRealMixer = bRealMixer; // virtual mixer if (!bRealMixer) { VOIP_DESTROY_MODULE(m_pMixer); memset(&m_guidDevice, 0, sizeof(m_guidDevice)); m_nInput = -1; m_nVirtualVolume = 100; m_bVirtualMuted = FALSE; if (m_pCallback) m_pCallback->OnVolumeChanged(m_nId, TRUE, GetVolume(), m_bRealMixer, m_pvParam); return TRUE; } // real mixer if (m_pMixer && m_guidDevice == *pGuid) { if (m_nInput != nInput) { m_nInput = nInput; if (m_pCallback) m_pCallback->OnVolumeChanged(m_nId, TRUE, GetVolume(), m_bRealMixer, m_pvParam); } return TRUE; } do { VOIP_DESTROY_MODULE(m_pMixer); m_guidDevice = *pGuid; m_nInput = nInput; m_bCaptureDevice = bCaptureDevice; if (VOIP_FAILED(IAudioMixerModule::Create(m_guidDevice, bCaptureDevice, m_pMixer))) break; if (!m_bWinVista && bCaptureDevice && m_pMixer->GetLineCount() <= nInput) break; m_pMixer->SetCallback(this, 0); if (m_pCallback) m_pCallback->OnVolumeChanged(m_nId, TRUE, GetVolume(), m_bRealMixer, m_pvParam); return TRUE; } while (0); VOIP_DESTROY_MODULE(m_pMixer); memset(&m_guidDevice, 0, sizeof(m_guidDevice)); m_nInput = -1; if (m_pCallback) m_pCallback->OnVolumeChanged(m_nId, FALSE, 0, m_bRealMixer, m_pvParam); return FALSE; }
void UBasicVolumeComponent::PostLoad() { if (GetVolume()) { GetVolume()->ConditionalPostLoad(); EnsureRendering(); } Super::PostLoad(); }
void AudioDescriptor::_HandleFadeStates() { if (_state == AUDIO_STATE_FADE_OUT) { // Hande when the effect time is very quick if( _fade_effect_time <= 10.0f) { Stop(); SetVolume(0.0f); return; } float time_elapsed = (float)hoa_system::SystemManager->GetUpdateTime(); float new_volume = GetVolume() - (_original_volume - (_original_volume - (time_elapsed / _fade_effect_time))); // Stop the audio, and terminate the effect if the volume drops to 0.0f or below if(new_volume <= 0.0f) { Stop(); SetVolume(0.0f); return; } // Otherwise, update the volume for the audio else { SetVolume(new_volume); return; } } else if (_state == AUDIO_STATE_FADE_IN) { // Stop right away when the effect is less than a usual cpu cycle if(_fade_effect_time <= 10.0f) { SetVolume(1.0f); _state = AUDIO_STATE_PLAYING; return; } float time_elapsed = (float)hoa_system::SystemManager->GetUpdateTime(); float new_volume = GetVolume() + (time_elapsed / _fade_effect_time); // If the volume has reached the maximum, mark the effect as over if(new_volume >= 1.0f) { SetVolume(1.0f); _state = AUDIO_STATE_PLAYING; return; } // Otherwise, update the volume for the audio else { SetVolume(new_volume); } } }
bool UBasicVolumeComponent::PickLastSolidVoxel(const FVector& Start, const FVector& End, FIntVector& HitPoint) const { if (GetVolume() == nullptr) { return false; } FVector NewStart; FVector NewEnd; WorldPositionToVolumePosition(Start, NewStart); WorldPositionToVolumePosition(End, NewEnd); return GetVolume()->PickLastSolidVoxel(NewStart, NewEnd, HitPoint); }
//---------------------------------------------- TeffHit::TeffHit( TsceneGame *game, const Vector2D &pos, const Vector2D &velocity) :TobjEffect( game, pos, // position 0.5, // radius velocity, // velocity 0.5, // max_speed Vec2DNormalize(velocity), // heading 0., // mass Vector2D(0.08, 0.08), // scale 0, // turn_rate 1, // max_force 1 // vitality ), FiTimer(0), FiAlpha(1.0) { iImageWidth=TRIMMING__IMAGE_RBX - TRIMMING__IMAGE_LTX; iImageHeight=TRIMMING__IMAGE_RBY - TRIMMING__IMAGE_LTY; // ヒット時の効果音 int ch = PlayDxSound( SND_SE_SHOT ); int bgm_vol = GetVolume(ch); SetVolume(ch, -200); }
status_t SymLink::WriteSymLink(const char* buffer, size_t toWrite, Transaction& transaction) { uint64 size = Size(); if (size > kMaxSymLinkSize) RETURN_ERROR(B_BAD_DATA); if (toWrite > kMaxSymLinkSize) RETURN_ERROR(B_NAME_TOO_LONG); if (toWrite == 0) { SetSize(0); return B_OK; } Block block; if (!block.GetWritable(GetVolume(), BlockIndex(), transaction)) return B_ERROR; char* data = (char*)block.Data() + kSymLinkDataOffset; memcpy(data, buffer, toWrite); SetSize(toWrite); return B_OK; }
//---------------------------------------------- TeffFinalBigExplosion::TeffFinalBigExplosion( TsceneGame *game, const Vector2D &pos, const Vector2D &velocity) :TobjEffect( game, pos, // position 0.5, // radius velocity, // velocity 0.5, // max_speed Vec2DNormalize(velocity), // heading 0., // mass Vector2D(5.0, 5.0), // scale 0, // turn_rate 1, // max_force 1 // vitality ), FiTimer(0), FiAlpha(1.0), FiFrame(0) { iImageWidth=TRIMMING__IMAGE_RBX - TRIMMING__IMAGE_LTX; iImageHeight=TRIMMING__IMAGE_RBY - TRIMMING__IMAGE_LTY; // ボス独自の爆発音を発生 int ch = PlayDxSound( SND_SE_BOSS_DEATH ); int bgm_vol = GetVolume(ch); SetVolume(ch, -300); }
void CAudioManager::Fadein(int id, int targetVolume, float time){ if(m_bValidAudio == false) return; int currentVolume = 0; double timeStep = 0; double volumeStep = 0; for(int i = 0; i < m_AudioClip.size(); i++){ if(m_AudioClip[i].AudioID == id){// && IsPlaying(id) == true){ if(IsPlaying(i) == false){ PlaySoundClip(i, 0); SetVolume(i, 0); } m_AudioClip[i].targetVolume = targetVolume; currentVolume = GetVolume(i); if(targetVolume > currentVolume && time > 0){ timeStep = time/ 0.1; volumeStep = (double)(targetVolume - currentVolume) / timeStep; m_AudioClip[i].fadeStep = volumeStep; m_AudioClip[i].bFadein = true; } } }//for }
// WriteAt status_t Attribute::WriteAt(off_t offset, const void *buffer, size_t size, size_t *bytesWritten) { // get the current key for the attribute uint8 oldKey[kMaxIndexKeyLength]; size_t oldLength; GetKey(oldKey, &oldLength); // write the new value status_t error = DataContainer::WriteAt(offset, buffer, size, bytesWritten); // If there is an index and a change has been made within the key, notify // the index. if (offset < kMaxIndexKeyLength && size > 0 && fIndex) fIndex->Changed(this, oldKey, oldLength); // update live queries const uint8* newKey; size_t newLength; GetKey(&newKey, &newLength); GetVolume()->UpdateLiveQueries(NULL, fNode, GetName(), fType, oldKey, oldLength, newKey, newLength); // node has been changed if (fNode && size > 0) fNode->MarkModified(B_STAT_MODIFICATION_TIME); return error; }
//---------------------------------------------- TobjShot::TobjShot( TsceneGame *game, Vector2D position, double radius, Vector2D velocity, double max_speed, Vector2D heading, double mass, Vector2D scale, double turn_rate, double max_force, double vitality) : TBaseMovingObject( game, TBaseObject::shot, position, radius, velocity, max_speed, heading, mass, scale, turn_rate, max_force, vitality) { // プレイヤーショットの効果音を再生 int ch = PlayDxSound( SND_SE_SHOT ); int bgm_vol = GetVolume(ch); SetVolume(ch, -300); }
status_t SymLink::ReadSymLink(char* buffer, size_t toRead, size_t& _bytesRead) { uint64 size = Size(); if (size > kMaxSymLinkSize) RETURN_ERROR(B_BAD_DATA); if (toRead > size) toRead = size; if (toRead == 0) { _bytesRead = 0; return B_OK; } // get the block Block block; if (!block.GetReadable(GetVolume(), BlockIndex())) RETURN_ERROR(B_ERROR); const char* data = (char*)block.Data() + kSymLinkDataOffset; memcpy(buffer, data, toRead); _bytesRead = toRead; return B_OK; }
bool UBasicVolumeComponent::SetBasicVolume(UBasicVolume* NewVolume) { if (NewVolume == GetVolume() && NewVolume == nullptr) return false; AActor* Owner = GetOwner(); if (!AreDynamicDataChangesAllowed() && Owner != NULL) { FMessageLog("PIE").Warning(FText::Format( FText::FromString(TEXT("Calling SetBasicVolume on '{0}' but Mobility is Static.")), FText::FromString(GetPathName()))); return false; } if (m_octree.IsValid()) { m_octree.Reset(); } PRAGMA_DISABLE_DEPRECATION_WARNINGS Volume = NewVolume; PRAGMA_ENABLE_DEPRECATION_WARNINGS // If there were a volume before we call then we force gc UWorld* World = GetWorld(); if (World) { World->ForceGarbageCollection(true); } EnsureRendering(); return true; }
bool CCit_gen::GetLabelV1(string* label, TLabelFlags flags) const { bool unique = (flags & fLabel_Unique) != 0; if (IsSetSerial_number()) { *label += "[" + NStr::IntToString(GetSerial_number()) + "]"; } if (IsSetMuid()) { *label += "NLM" + NStr::IntToString(GetMuid()); } string date; string* date_ptr = 0; if ( IsSetDate() ) { date_ptr = &date; GetDate().GetDate(date_ptr, true); } const string* title2 = 0; const string* titleunique = 0; bool unpublished = false; const CTitle* title = IsSetJournal() ? &GetJournal() : 0; const CAuth_list* authors = IsSetAuthors() ? &GetAuthors() : 0; const string* volume = IsSetVolume() ? &GetVolume() : 0; const string* issue = IsSetIssue() ? &GetIssue() : 0; const string* pages = IsSetPages() ? &GetPages() : 0; if (IsSetCit()) { if ( NStr::EqualNocase( GetCit(), "Unpublished") ) { unpublished = true; } else if (!title) { title2 = &GetCit(); } } if (IsSetTitle()) { titleunique = &GetTitle(); } else if (title2) { titleunique = title2; } else if (!title && IsSetCit()) { titleunique = &GetCit(); } if (!title && !authors && !IsSetTitle() && !volume && !pages && !issue) { titleunique = 0; if (IsSetCit()) { string cit(GetCit()); if (!unique) { try { cit.resize(cit.find_last_of('|')); } catch(length_error&) {} } *label += cit; } return true; } return x_GetLabelV1(label, unique, authors, 0, title, 0, 0, 0, title2, titleunique, date_ptr, volume, issue, pages, unpublished); }
//--------------------------------------------------------------------------- void tTJSNI_BaseSoundBuffer::TimerBeatHandler() { // fade handling if(!Owner) return; // "Owner" indicates the owner object is valid if(!InFading) return; if(BlankLeft) { BlankLeft -= TVP_SB_BEAT_INTERVAL; if(BlankLeft < 0) BlankLeft = 0; } else if(FadeCount) { if(FadeCount == 1) { StopFade(true, true); } else { FadeCount--; tjs_int v; v = GetVolume(); v += DeltaVolume; if(v<0) v = 0; if(v>100000) v = 100000; SetVolume(v); } } }
void UBasicVolumeComponent::BeginPlay() { Super::BeginPlay(); // TODO: Bind somewhere else?? GetVolume()->OnChanged.AddDynamic(this, &UBasicVolumeComponent::OnVolumeChanged); }
void Output::saveVolume () { SaveVolumeScheduled_ = false; XmlSettingsManager::Instance ().setProperty ("AudioVolume", GetVolume ()); XmlSettingsManager::Instance ().setProperty ("AudioMuted", IsMuted ()); }
void CheckASZStatus() { char volumeName[4096] = {0}; if(GetVolume(volumeName)) { WriteASZExistRecord(IsHaveASZ); } }
void _show_music_info( std::vector< string >& arg ) { #if ( __USE_FMOD_MUSIC == ML_MILES ) gConsole()->Log( "FMOD Music, Current Volum is : %f", GetVolume( ) ); #else gConsole()->Log( "Miles Music or ..., Current Volum is :%f", GetVolum( ) ); #endif }
void Settings::SetVolume(int volume) { if (GetVolume() != volume) { SConfig::GetInstance().m_Volume = volume; emit VolumeChanged(volume); } }
// RemoveReference void Node::RemoveReference() { if (--fRefCount == 0) { GetVolume()->RemoveVNode(this); fRefCount++; } }
void UBasicVolumeComponent::MarkVolumeDirty() { // Rebuild mesh if (m_octree.IsValid()) { m_octree->MarkChangeNow(GetVolume()->GetEnclosingRegion()); } }
// PutVolume // // The VolumeManager must not be locked, when this method is invoked. void VolumeManager::PutVolume(Volume* volume) { if (!volume) return; // If the volume is marked unmounting and is not yet marked removed, we // initiate the removal process. { AutoLocker<Locker> locker(this); //PRINT(("VolumeManager::PutVolume(%p): reference count before: %ld\n", //volume, volume->CountReferences())); if (volume->IsUnmounting() && !volume->IsRemoved()) { //PRINT(("VolumeManager::PutVolume(%p): Volume connection broken, marking " //"removed and removing all nodes.\n", volume)); // mark removed volume->MarkRemoved(); // get parent volume Volume* parentVolume = volume->GetParentVolume(); if (parentVolume && !GetVolume(parentVolume)) parentVolume = NULL; locker.Unlock(); // prepare to unmount volume->PrepareToUnmount(); // remove from parent volume if (parentVolume) { parentVolume->RemoveChildVolume(volume); PutVolume(parentVolume); } } } // If the volume is marked removed and it's reference count drops to 0, // we unmount and delete it. { AutoLocker<Locker> locker(this); if (volume->ReleaseReference() && volume->IsRemoved()) { PRINT(("VolumeManager::PutVolume(%p): Removed volume unreferenced. " "Unmounting...\n", volume)); // remove from volume set -- now noone can get a reference to it // anymore fVolumes->Remove(volume); locker.Unlock(); // unmount and delete the volume // TODO: At some point all the volume's node IDs have to be removed from // fNodeIDs2Volumes. For the time being we expect the volume to do that itself // in Unmount(). volume->Unmount(); delete volume; } } }
unsigned long GS_GetAudioVolmue(unsigned long nPort,unsigned long *pnVolume) { PSTREAMCONFIG pm = GetStream(nPort); if(pm==NULL) { return S_FALSE; } return GetVolume(pm->pAudioConfig,(LONG *)pnVolume); }
// GetVolume Volume* VolumeManager::GetVolume(vnode_id nodeID) { AutoLocker<Locker> _(this); Volume* volume = fNodeIDs2Volumes->Get(nodeID); if (volume && GetVolume(volume)) return volume; return NULL; }
void CMPlayerUtility::VolUp() { INT32 nOldVol = GetVolume(); INT32 nMaxVol = MaxVolume(); INT32 nNewVol = nOldVol + 10 * nMaxVol / 100; if (nNewVol > nMaxVol) nNewVol = nMaxVol; SetVolume(nNewVol); }
void CMPlayerUtility::VolDown() { INT32 nOldVol = GetVolume(); INT32 nMaxVol = MaxVolume(); INT32 nNewVol = nOldVol - 10 * nMaxVol / 100; if (nNewVol < 0) nNewVol = 0; SetVolume(nNewVol); }
string CCone::GetInfo() const { string info = GetName() + '\n' + "height = " + to_string(GetHeight()) + '\n' + "radius = " + to_string(GetRadius()) + '\n' + "value = " + to_string(GetVolume()) + '\n' + "mass = " + to_string(GetMass()); return info; }
void khResourceManager::CleanVolumeReservation(const std::string &volume, const std::string &path) { Volume *vol = GetVolume(volume); if (vol) { vol->CleanReservation(path); } }