1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_StreamSoundFileLoader.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: 14068 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_SND_STREAM_SOUND_FILE_LOADER_H_
17 #define NW_SND_STREAM_SOUND_FILE_LOADER_H_
18 
19 #include <nw/io/io_FileStream.h>
20 #include <nw/snd/snd_StreamSoundFileReader.h>
21 
22 namespace nw {
23 namespace snd {
24 namespace internal {
25 
26 /* ========================================================================
27         StreamSoundFileLoader class
28    ======================================================================== */
29 
30 class StreamSoundFileLoader
31 {
32   public:
StreamSoundFileLoader(io::FileStream & stream)33     StreamSoundFileLoader( io::FileStream& stream )
34     : m_Stream( stream )
35     {}
36 
37     bool LoadFileHeader( void* buffer, unsigned long size );
38 
39     bool ReadStreamInfo( StreamSoundFile::StreamSoundInfo* strmInfo ) const;
40     bool ReadStreamTrackInfo(
41             StreamSoundFileReader::TrackInfo* trackInfo,
42             int trackIndex ) const;
43     bool ReadDspAdpcmChannelInfo(
44             DspAdpcmParam* adpcmParam,
45             DspAdpcmLoopParam* adpcmLoopParam,
46             int channelIndex ) const;
47     u32 GetChannelCount() const;
48     u32 GetTrackCount() const;
49 
GetDataBlockOffset()50     u32 GetDataBlockOffset() const
51     {
52         return m_Reader.GetDataBlockOffset();
53     }
54 
55     bool ReadAdpcBlockData( u16* yn1, u16* yn2, int blockIndex, int channelCount );
56 
57   private:
58     io::FileStream& m_Stream;
59     StreamSoundFileReader m_Reader;
60 };
61 
62 } // namespace nw::snd::internal
63 } // namespace nw::snd
64 } // namespace nw
65 
66 
67 #endif /* NW_SND_STREAM_SOUND_FILE_LOADER_H_ */
68 
69