2 [momiji music component library]
3 ---------------------------------------------------------------------
4 Momiji.Sequencer.Midi.Smf.cpp
5 stream component of standard midi file.
6 ---------------------------------------------------------------------
7 Copyright (C) 2011 tyiki badwell {miria@users.sourceforge.jp}.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
21 ---------------------------------------------------------------------
27 #include "Momiji.Interop.Winmm.h"
29 #include "Momiji.Core.Interface.h"
30 #include "Momiji.Core.Buffer.h"
32 using namespace System::Runtime;
38 public ref class WaveStream
39 : public Core::IStream
42 enum class TYPE: System::UInt32
44 HEADER = 0x52494646L, // RIFF
45 HEADER_R = 0x46464952L, // 読み込み用
48 enum class FORMAT: System::UInt32
50 WAVE = 0x57415645L, // WAVE
51 WAVE_R = 0x45564157L, // 読み込み用
54 enum class SUB: System::UInt32
56 fmt_ = 0x666D7420L, // fmt
57 fmt__R = 0x20746D66L, // 読み込み用
59 data = 0x64617461L, // data
60 data_R = 0x61746164L, // 読み込み用
62 LIST = 0x4C495354L, // LIST
63 LIST_R = 0x5453494CL, // 読み込み用
68 WIN32_DLL_STRUCTLAYOUT value struct RIFFHEADER_CHUNK
70 System::UInt32 dwType;
71 System::UInt32 dwLength;
72 System::UInt32 dwFormat;
76 WIN32_DLL_STRUCTLAYOUT value struct RIFFSUB_CHUNK
78 System::UInt32 dwType;
79 System::UInt32 dwLength;
83 System::IO::MemoryMappedFiles::MemoryMappedFile^ _mmap;
84 System::IO::MemoryMappedFiles::MemoryMappedViewAccessor^ _view;
86 Momiji::Interop::Winmm::WaveFormatEx _wfx;
88 System::Int64 _dataStartPosition;
89 System::UInt32 _dataSize;
90 System::Int64 _dataSeekPosition;
93 WaveStream(System::String^ path);
94 virtual ~WaveStream();
100 void Open(System::String^ path);
104 virtual array<Core::IStreamPacket^>^ GetStreamPacket(System::Double deltaTime) {return nullptr;};
105 virtual void Rewind() {};
107 //System::UInt32 WaveStream::Read(array<System::Byte>^ buffer, System::UInt32 samplesPerBuffer);
108 System::UInt32 WaveStream::Read(Momiji::Core::Buffer::BufferPool<array<System::Byte>^>::Buffer^ buffer, System::UInt32 samplesPerBuffer);
110 property Momiji::Interop::Winmm::WaveFormatEx format { Momiji::Interop::Winmm::WaveFormatEx get() {return this->_wfx;} }
114 public ref class WaveException
118 WaveException(System::String^ v): System::Exception(v){};