1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_MmlSequenceTrackAllocator.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Revision: 19566 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_SND_MML_SEQUENCE_TRACK_ALLOCATOR_H_
17 #define NW_SND_MML_SEQUENCE_TRACK_ALLOCATOR_H_
18 
19 #include <nw/snd/snd_SequenceTrackAllocator.h>
20 #include <nw/snd/snd_MmlSequenceTrack.h>
21 #include <nw/snd/snd_InstancePool.h>
22 
23 namespace nw {
24 namespace snd {
25 namespace internal {
26 namespace driver {
27 
28 class MmlParser;
29 
30 /* ========================================================================
31         class difinition
32    ======================================================================== */
33 
34 class MmlSequenceTrackAllocator : public SequenceTrackAllocator
35 {
36     typedef InstancePool<MmlSequenceTrack> MmlSequenceTrackPool;
37 
38   public:
MmlSequenceTrackAllocator(MmlParser * parser)39     MmlSequenceTrackAllocator( MmlParser* parser ) : m_pParser( parser ) {}
SetMmlParser(MmlParser * parser)40     void SetMmlParser( MmlParser* parser ) { m_pParser = parser; }
GetMmlParser()41     MmlParser* GetMmlParser() { return m_pParser; }
42     virtual SequenceTrack* AllocTrack( SequenceSoundPlayer* player );
43     virtual void FreeTrack( SequenceTrack* track );
GetAllocatableTrackCount()44     virtual int GetAllocatableTrackCount() const { return m_TrackPool.Count(); }
45 
46     unsigned long Create( void* buffer, unsigned long size );
47     void Destroy( void* buffer, unsigned long size );
48 
49   private:
50     MmlParser* m_pParser;
51     MmlSequenceTrackPool m_TrackPool;
52 };
53 
54 } // namespace nw::snd::internal::driver
55 } // namespace nw::snd::internal
56 } // namespace nw::snd
57 } // namespace nw
58 
59 
60 #endif /* NW_SND_MML_SEQUENCE_TRACK_ALLOCATOR_H_ */
61 
62