1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_MmlSequenceTrackAllocator.h
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 #ifndef NW_SND_MML_SEQUENCE_TRACK_ALLOCATOR_H_
19 #define NW_SND_MML_SEQUENCE_TRACK_ALLOCATOR_H_
20 
21 #include <nw/snd/snd_SequenceTrackAllocator.h>
22 #include <nw/snd/snd_MmlSequenceTrack.h>
23 #include <nw/snd/snd_InstancePool.h>
24 
25 namespace nw {
26 namespace snd {
27 namespace internal {
28 namespace driver {
29 
30 class MmlParser;
31 
32 /* ========================================================================
33         class difinition
34    ======================================================================== */
35 
36 class MmlSequenceTrackAllocator : public SequenceTrackAllocator
37 {
38     typedef InstancePool<MmlSequenceTrack> MmlSequenceTrackPool;
39 
40 public:
MmlSequenceTrackAllocator(MmlParser * parser)41     MmlSequenceTrackAllocator( MmlParser* parser ) : m_pParser( parser ) {}
SetMmlParser(MmlParser * parser)42     void SetMmlParser( MmlParser* parser ) { m_pParser = parser; }
GetMmlParser()43     MmlParser* GetMmlParser() { return m_pParser; }
44     virtual SequenceTrack* AllocTrack( SequenceSoundPlayer* player );
45     virtual void FreeTrack( SequenceTrack* track );
GetAllocatableTrackCount()46     virtual int GetAllocatableTrackCount() const { return m_TrackPool.Count(); }
47 
48     unsigned long Create( void* buffer, unsigned long size );
49     void Destroy( void* buffer, unsigned long size );
50 
51 private:
52     MmlParser* m_pParser;
53     MmlSequenceTrackPool m_TrackPool;
54 };
55 
56 } // namespace nw::snd::internal::driver
57 } // namespace nw::snd::internal
58 } // namespace nw::snd
59 } // namespace nw
60 
61 
62 #endif /* NW_SND_MML_SEQUENCE_TRACK_ALLOCATOR_H_ */
63 
64