1 /*---------------------------------------------------------------------------*
2 Project: NintendoWare
3 File: snd_MmlSequenceTrackAllocator.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_MmlSequenceTrackAllocator.h>
21
22 namespace nw {
23 namespace snd {
24 namespace internal {
25 namespace driver {
26
27 /* ========================================================================
28 static member function
29 ======================================================================== */
30
31
32 /*---------------------------------------------------------------------------*
33 Name: AllocTrack
34
35 Description: トラックを確保します
36
37 Arguments: None.
38
39 Returns: 確保できたときは、トラックID
40 確保できなかったときは、-1 を返します
41 *---------------------------------------------------------------------------*/
AllocTrack(SequenceSoundPlayer * player)42 SequenceTrack* MmlSequenceTrackAllocator::AllocTrack( SequenceSoundPlayer* player )
43 {
44 MmlSequenceTrack* track = m_TrackPool.Alloc();
45 if ( track != NULL )
46 {
47 track->SetSequenceSoundPlayer( player );
48 track->SetMmlParser( m_pParser );
49 }
50 return track;
51 }
52
53 /*---------------------------------------------------------------------------*
54 Name: FreeTrack
55
56 Description: トラックを開放します
57
58 Arguments: trackID - トラックID
59
60 Returns: None.
61 *---------------------------------------------------------------------------*/
FreeTrack(SequenceTrack * track)62 void MmlSequenceTrackAllocator::FreeTrack( SequenceTrack* track )
63 {
64 NW_NULL_ASSERT( track );
65
66 track->SetSequenceSoundPlayer( NULL );
67
68 m_TrackPool.Free( reinterpret_cast<MmlSequenceTrack*>( track ) ); // TODO: 気になるキャスト
69 }
70
Create(void * buffer,unsigned long size)71 unsigned long MmlSequenceTrackAllocator::Create( void* buffer, unsigned long size )
72 {
73 return m_TrackPool.Create( buffer, size );
74 }
75
Destroy(void * buffer,unsigned long size)76 void MmlSequenceTrackAllocator::Destroy( void* buffer, unsigned long size )
77 {
78 m_TrackPool.Destroy( buffer, size );
79 }
80
81 } // namespace nw::snd::internal::driver
82 } // namespace nw::snd::internal
83 } // namespace nw::snd
84 } // namespace nw
85
86