1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: snd_SequenceSoundHandle.cpp 4 5 Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain proprietary 8 information of Nintendo and/or its licensed developers and are protected by 9 national and international copyright laws. They may not be disclosed to third 10 parties or copied or duplicated in any form, in whole or in part, without the 11 prior written consent of Nintendo. 12 13 The content herein is highly confidential and should be handled accordingly. 14 15 $Revision: 31311 $ 16 *---------------------------------------------------------------------------*/ 17 18 #include "precompiled.h" 19 20 #include <nw/snd/snd_SequenceSoundHandle.h> 21 22 #include <nw/snd/snd_SoundHandle.h> 23 24 namespace nw { 25 namespace snd { 26 27 /*---------------------------------------------------------------------------* 28 Name: SequenceSoundHandle 29 30 Description: 変換コンストラクタ 31 32 Arguments: sound - 関連付けるサウンド 33 34 Returns: None. 35 *---------------------------------------------------------------------------*/ SequenceSoundHandle(SoundHandle * handle)36SequenceSoundHandle::SequenceSoundHandle( SoundHandle* handle ) 37 : m_pSound( NULL ) 38 { 39 if ( handle == NULL ) return; 40 41 // 汎用ハンドルからサウンドを取得 42 if ( !handle->IsAttachedSound() ) return; 43 44 internal::SequenceSound* sound = 45 ut::DynamicCast<internal::SequenceSound*>( handle->detail_GetAttachedSound() ); 46 47 if ( sound != NULL ) 48 { 49 // シーケンスサウンドなら一時ハンドルとしてAttachする 50 detail_AttachSoundAsTempHandle( sound ); 51 } 52 } 53 54 /*---------------------------------------------------------------------------* 55 Name: detail_AttachSoundAsTempHandle 56 57 Description: ハンドルにサウンドを関連付ける 58 59 Arguments: sound - 関連付けるサウンド 60 61 Returns: None. 62 *---------------------------------------------------------------------------*/ detail_AttachSoundAsTempHandle(internal::SequenceSound * sound)63void SequenceSoundHandle::detail_AttachSoundAsTempHandle( internal::SequenceSound* sound ) 64 { 65 NW_NULL_ASSERT( sound ); 66 67 m_pSound = sound; 68 69 // 一時ハンドルとしてAttachする 70 if ( m_pSound->IsAttachedTempSpecialHandle() ) 71 { 72 m_pSound->DetachTempSpecialHandle(); 73 } 74 m_pSound->m_pTempSpecialHandle = this; 75 } 76 77 /*---------------------------------------------------------------------------* 78 Name: DetachSound 79 80 Description: ハンドルに結びついているサウンドの関連を外す 81 82 Arguments: None. 83 84 Returns: None. 85 *---------------------------------------------------------------------------*/ DetachSound()86void SequenceSoundHandle::DetachSound() 87 { 88 if ( IsAttachedSound() ) 89 { 90 if ( m_pSound->m_pTempSpecialHandle == this ) m_pSound->m_pTempSpecialHandle = NULL; 91 } 92 if ( m_pSound != NULL ) m_pSound = NULL; 93 } 94 95 } // namespace nw::snd 96 } // namespace nw 97 98