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