Audio::~Audio() { for (int sound_id = 0; sound_id < MAX_SOUND; sound_id++) { if (IsSound(sound_id)) { ResetSound(sound_id); } } for (int music_id = 0; music_id < MAX_MUSIC; music_id++) { if (IsMusic(music_id)) { ResetMusic(music_id); } } }
// -------------------------------------------------------------------------- // // Sound property functions // -------------------------------------------------------------------------- // void VFmodSoundObject::Play(float fStartTime, bool bAlsoInEditor) { if (m_spResource == NULL || IsPlaying()) return; if (!bAlsoInEditor && !Vision::Editor.IsAnimatingOrPlaying()) return; m_fStartTime = fStartTime; VFmodManager &manager = VFmodManager::GlobalManager(); if (manager.IsInitialized()) { const hkvVec3 &vPos = GetPosition(); // stop old playing if (m_pChannel) m_pChannel->stop(); VFmodSoundResource* pResource = (VFmodSoundResource*)GetResource(); if (pResource->m_pSound == NULL) // sound resource not loaded successfully return; FMOD_WARNINGCHECK(manager.m_pSystem->playSound(FMOD_CHANNEL_FREE, pResource->m_pSound, true, &m_pChannel)); if (!m_pChannel) return; FMOD_WARNINGCHECK(m_pChannel->getFrequency(&m_fInitialFreq)); // if this a music sound object assign it to the music channel group if (IsMusic()) m_pChannel->setChannelGroup(manager.m_pMusicGroup); // set everything m_pChannel->setUserData(this); // ...so that we can get from channel to VSoundObject m_pChannel->setCallback(ChannelCallback); m_pChannel->setMode(IsLooped() ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF); m_pChannel->setPriority(GetPriority()); m_pChannel->set3DMinMaxDistance(Get3DFadeMinDistance(), Get3DFadeMaxDistance()); m_pChannel->set3DAttributes((FMOD_VECTOR *)&vPos, NULL); // no speed (yet) m_pChannel->setVolume(GetVolume()); m_pChannel->setPan(GetPan()); SetPitch(GetPitch()); SetConeAngles(GetConeAngleInside(), GetConeAngleOutside()); // Initially the sound is left paused, then within the first RunTick it is unpaused. This is required since // the 3D listener attributes has to be set prior to playing a sound. Otherwise Fmod would perform // occlusion-raycasts without having initialized listener-attributes, which potentially results in a // wrong occlusion-behavior. m_bUnpause = true; m_bIsPlaying = true; m_bPlayedOnce = true; unsigned int ims = (int)(fStartTime*1000.f); // milliseconds m_pChannel->setPosition(ims,FMOD_TIMEUNIT_MS); m_pChannel->setMute(IsMuted()); } Helper_SetFlag(VFMOD_FLAG_PAUSED, !IsPlaying()); }
void Audio::ResumeMusic(const int& music_id) { assert(IsMusic(music_id)); Mix_ResumeMusic(); }
void Audio::PauseMusic(const int& music_id) { assert(IsMusic(music_id)); Mix_PauseMusic(); }
void Audio::StopMusic(const int& music_id) { assert(IsMusic(music_id)); ResetMusic(music_id); }
void Audio::PlayMusic(const int& music_id, const bool& loop) { assert(IsMusic(music_id)); Mix_PlayMusic(music[music_id], loop ? -1 : 1); }
void Audio::ResetMusic(const int& music_id) { assert(IsMusic(music_id)); Mix_HaltMusic(); }
void LogEntry1Data::ResumeSyncSend(void) { if (!SyncSendPaused) { return; } SyncSendPaused = FALSE; if (SyncNumber == CERROR) { return; } // We just unpaused and we're assigned a record number... tell everybody // else all about ourselves. GAINEXCLUSIVEACCESS(); char Buffer[256]; CopyStringToBuffer(Buffer, Name); SetName(Buffer); CopyStringToBuffer(Buffer, Initials); SetInitials(Buffer); CopyStringToBuffer(Buffer, Password); SetPassword(Buffer); CopyStringToBuffer(Buffer, Surname); SetSurname(Buffer); CopyStringToBuffer(Buffer, Title); SetTitle(Buffer); CopyStringToBuffer(Buffer, RealName); SetRealName(Buffer); CopyStringToBuffer(Buffer, PhoneNumber); SetPhoneNumber(Buffer); CopyStringToBuffer(Buffer, ForwardAddr); SetForwardAddr(Buffer); CopyStringToBuffer(Buffer, ForwardAddrNode); SetForwardAddrNode(Buffer); CopyStringToBuffer(Buffer, ForwardAddrRegion); SetForwardAddrRegion(Buffer); CopyStringToBuffer(Buffer, PromptFormat); SetPromptFormat(Buffer); CopyStringToBuffer(Buffer, DateStamp); SetDateStamp(Buffer); CopyStringToBuffer(Buffer, VerboseDateStamp); SetVerboseDateStamp(Buffer); CopyStringToBuffer(Buffer, Signature); SetSignature(Buffer); CopyStringToBuffer(Buffer, NetPrefix); SetNetPrefix(Buffer); CopyStringToBuffer(Buffer, MailAddr1); SetMailAddr1(Buffer); CopyStringToBuffer(Buffer, MailAddr2); SetMailAddr2(Buffer); CopyStringToBuffer(Buffer, MailAddr3); SetMailAddr3(Buffer); CopyStringToBuffer(Buffer, Alias); SetAlias(Buffer); CopyStringToBuffer(Buffer, LocID); SetLocID(Buffer); CopyStringToBuffer(Buffer, MorePrompt); SetMorePrompt(Buffer); CopyStringToBuffer(Buffer, Occupation); SetOccupation(Buffer); CopyStringToBuffer(Buffer, WhereHear); SetWhereHear(Buffer); CopyStringToBuffer(Buffer, LastRoom); SetLastRoom(Buffer); CopyStringToBuffer(Buffer, LastHall); SetLastHall(Buffer); CopyStringToBuffer(Buffer, DefaultRoom); SetDefaultRoom(Buffer); CopyStringToBuffer(Buffer, DefaultHall); SetDefaultHall(Buffer); CopyStringToBuffer(Buffer, TermType); SetTermType(Buffer); RELEASEEXCLUSIVEACCESS(); SetBirthDate(BirthDate); SetFirstOn(FirstOn); SetSex(Sex); SetNulls(Nulls); SetWidth(Width); SetLinesPerScreen(LinesPerScreen); SetAttribute(ATTR_NORMAL, attributes[ATTR_NORMAL]); SetAttribute(ATTR_BLINK, attributes[ATTR_BLINK]); SetAttribute(ATTR_REVERSE, attributes[ATTR_REVERSE]); SetAttribute(ATTR_BOLD, attributes[ATTR_BOLD]); SetAttribute(ATTR_UNDERLINE, attributes[ATTR_UNDERLINE]); SetNumUserShow(NumUserShow); SetDefaultProtocol(DefaultProtocol); SetCallTime(CallTime); SetCallNumber(CallNumber); SetTotalTime(TotalTime); SetCredits(Credits); SetLogins(Logins); SetPosted(Posted); SetRead(Read); SetPasswordChangeTime(PasswordChangeTime); SetCallsToday(CallsToday); SetCallLimit(CallLimit); SetLastMessage(LastMessage); SetDL_Bytes(DL_Bytes); SetUL_Bytes(UL_Bytes); SetDL_Num(DL_Num); SetUL_Num(UL_Num); SetPoopcount(Poopcount); SetDungeoned(IsDungeoned()); SetForwardToNode(IsForwardToNode()); SetAutoNextHall(IsAutoNextHall()); SetEnterBorders(IsEnterBorders()); SetVerified(IsVerified()); SetSurnameLocked(IsSurnameLocked()); SetDefaultHallLocked(IsDefaultHallLocked()); SetPsycho(IsPsycho()); SetViewTitleSurname(IsViewTitleSurname()); SetViewSubjects(IsViewSubjects()); SetViewSignatures(IsViewSignatures()); SetOldIBMGraph(IsOldIBMGraph()); SetOldIBMANSI(IsOldIBMANSI()); SetOldIBMColor(IsOldIBMColor()); SetTwirly(IsTwirly()); SetAutoVerbose(IsAutoVerbose()); SetPauseBetweenMessages(IsPauseBetweenMessages()); SetMinibin(IsMinibin()); SetClearScreenBetweenMessages(IsClearScreenBetweenMessages()); SetViewRoomInfoLines(IsViewRoomInfoLines()); SetViewHallDescription(IsViewHallDescription()); SetVerboseContinue(IsVerboseContinue()); SetViewCensoredMessages(IsViewCensoredMessages()); SetViewBorders(IsViewBorders()); SetOut300(IsOut300()); SetUserSignatureLocked(IsUserSignatureLocked()); SetHideMessageExclusions(IsHideMessageExclusions()); SetDownload(IsDownload()); SetUpload(IsUpload()); SetChat(IsChat()); SetPrintFile(IsPrintFile()); SetSpellCheckMode(GetSpellCheckMode()); SetMakeRoom(IsMakeRoom()); SetVerboseLogOut(IsVerboseLogOut()); SetConfirmSave(IsConfirmSave()); SetConfirmAbort(IsConfirmAbort()); SetConfirmNoEO(IsConfirmNoEO()); SetUsePersonalHall(IsUsePersonalHall()); SetYouAreHere(IsYouAreHere()); SetIBMRoom(IsIBMRoom()); SetWideRoom(IsWideRoom()); SetMusic(IsMusic()); SetCheckApostropheS(IsCheckApostropheS()); SetCheckAllCaps(IsCheckAllCaps()); SetCheckDigits(IsCheckDigits()); SetExcludeEncryptedMessages(IsExcludeEncryptedMessages()); SetViewCommas(IsViewCommas()); SetPUnPauses(IsPUnPauses()); SetRoman(IsRoman()); SetSuperSysop(IsSuperSysop()); SetInuse(IsInuse()); SetUpperOnly(IsUpperOnly()); SetLinefeeds(IsLinefeeds()); SetExpert(IsExpert()); SetAide(IsAide()); SetTabs(IsTabs()); SetOldToo(IsOldToo()); SetProblem(IsProblem()); SetUnlisted(IsUnlisted()); SetPermanent(IsPermanent()); SetSysop(IsSysop()); SetNode(IsNode()); SetNetUser(IsNetUser()); SetAccounting(IsAccounting()); SetMail(IsMail()); SetViewRoomDesc(IsViewRoomDesc()); }