/*---------------------------------------------------------------------------* Project: NintendoWare File: snd_SequenceSoundHandle.cpp Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. The content herein is highly confidential and should be handled accordingly. $Revision: 31311 $ *---------------------------------------------------------------------------*/ #include "precompiled.h" #include #include namespace nw { namespace snd { /*---------------------------------------------------------------------------* Name: SequenceSoundHandle Description: 変換コンストラクタ Arguments: sound - 関連付けるサウンド Returns: None. *---------------------------------------------------------------------------*/ SequenceSoundHandle::SequenceSoundHandle( SoundHandle* handle ) : m_pSound( NULL ) { if ( handle == NULL ) return; // 汎用ハンドルからサウンドを取得 if ( !handle->IsAttachedSound() ) return; internal::SequenceSound* sound = ut::DynamicCast( handle->detail_GetAttachedSound() ); if ( sound != NULL ) { // シーケンスサウンドなら一時ハンドルとしてAttachする detail_AttachSoundAsTempHandle( sound ); } } /*---------------------------------------------------------------------------* Name: detail_AttachSoundAsTempHandle Description: ハンドルにサウンドを関連付ける Arguments: sound - 関連付けるサウンド Returns: None. *---------------------------------------------------------------------------*/ void SequenceSoundHandle::detail_AttachSoundAsTempHandle( internal::SequenceSound* sound ) { NW_NULL_ASSERT( sound ); m_pSound = sound; // 一時ハンドルとしてAttachする if ( m_pSound->IsAttachedTempSpecialHandle() ) { m_pSound->DetachTempSpecialHandle(); } m_pSound->m_pTempSpecialHandle = this; } /*---------------------------------------------------------------------------* Name: DetachSound Description: ハンドルに結びついているサウンドの関連を外す Arguments: None. Returns: None. *---------------------------------------------------------------------------*/ void SequenceSoundHandle::DetachSound() { if ( IsAttachedSound() ) { if ( m_pSound->m_pTempSpecialHandle == this ) m_pSound->m_pTempSpecialHandle = NULL; } if ( m_pSound != NULL ) m_pSound = NULL; } } // namespace nw::snd } // namespace nw