2 [momiji music component library]
3 ---------------------------------------------------------------------
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 ---------------------------------------------------------------------
26 #include "Momiji.Core.Interface.h"
27 #include "Momiji.Core.Winmm.h"
28 #include "Momiji.Core.Buffer.h"
30 using namespace System::Runtime;
37 public ref class Device
40 initonly System::UInt32 _deviceID;
42 initonly System::UInt16 _channels;
43 initonly System::UInt32 _samplesPerSecond;
44 initonly System::UInt16 _bitsPerSample;
45 initonly Interop::Winmm::WaveFormatExtensiblePart::SPEAKER _channelMask;
46 initonly Interop::Guiddef::Guid _formatSubType;
47 initonly System::UInt32 _samplesPerBuffer;
49 Interop::Winmm::Function::WaveOut^ _handle;
50 Core::Winmm::DriverCallBack^ _callBack;
51 Core::Buffer::BufferPool<Interop::Winmm::WaveHeader^>^ _headerPool;
54 ref class UnpreparedEventArgs: System::EventArgs
57 System::IntPtr bufferPtr;
62 System::UInt32 deviceID,
63 System::UInt16 channels,
64 System::UInt32 samplesPerSecond,
65 System::UInt16 bitsPerSample,
66 Interop::Winmm::WaveFormatExtensiblePart::SPEAKER channelMask,
67 Interop::Guiddef::Guid formatSubType,
68 System::UInt32 samplesPerBuffer
75 System::IntPtr Prepare(System::IntPtr data, System::UInt32 useSize);
76 System::IntPtr Unprepare(System::IntPtr headerPtr);
78 Interop::Winmm::WaveHeader^ AllocateHeader();
81 static System::UInt32 GetNumDevices();
82 static Interop::Winmm::WaveOutCapabilities^ GetCapabilities(System::UInt32 uDeviceID);
83 Interop::Winmm::WaveOutCapabilities^ GetCapabilities();
90 //TODO: これのインタフェースは何かのBuffer情報の塊にしたい
91 void Send(System::IntPtr data, System::UInt32 useSize);
95 event System::EventHandler<System::EventArgs^>^ OnOpen;
96 event System::EventHandler<System::EventArgs^>^ OnClose;
97 event System::EventHandler<UnpreparedEventArgs^>^ OnDone;
100 void OnEventHandler(System::Object^ sender, Interop::Winmm::DriverCallBack::DriverEventArgs^ args);
102 void DoOpen(System::IntPtr dwParam1, System::IntPtr dwParam2);
103 void DoClose(System::IntPtr dwParam1, System::IntPtr dwParam2);
104 void DoDone(System::IntPtr dwParam1, System::IntPtr dwParam2);
107 public ref class WaveOutException
108 : public System::Exception
111 initonly Interop::Winmm::MMRESULT _mmResult;
112 System::String^ Initialize();
115 WaveOutException(Interop::Winmm::MMRESULT v): _mmResult(v), System::Exception(Initialize()){};
116 WaveOutException(System::String^ v): System::Exception(v){};
117 virtual ~WaveOutException(void){};
119 property Interop::Winmm::MMRESULT mmResult
121 Interop::Winmm::MMRESULT get(void) {return this->_mmResult;};