• R/O
  • HTTP
  • SSH
  • HTTPS

win7x64Audio: Commit


Commit MetaInfo

Revision9813517ccca84a875570ba2831e783500615dabb (tree)
Time2010-12-12 04:30:20
AuthorSFPGMR <sfpg@git....>
CommiterSFPGMR

Log Message

MIDI Input部分を追加。

Change Summary

Incremental Difference

--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
1+*.sdf
2+*.suo
3+Debug/
4+Release/
5+ipch/
\ No newline at end of file
--- /dev/null
+++ b/win64.sln
@@ -0,0 +1,30 @@
1+
2+Microsoft Visual Studio Solution File, Format Version 11.00
3+# Visual C++ Express 2010
4+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win64", "win64\win64.vcxproj", "{55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}"
5+EndProject
6+Global
7+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+ Debug|Mixed Platforms = Debug|Mixed Platforms
9+ Debug|Win32 = Debug|Win32
10+ Debug|x64 = Debug|x64
11+ Release|Mixed Platforms = Release|Mixed Platforms
12+ Release|Win32 = Release|Win32
13+ Release|x64 = Release|x64
14+ EndGlobalSection
15+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
17+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Debug|Mixed Platforms.Build.0 = Debug|x64
18+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Debug|Win32.ActiveCfg = Debug|x64
19+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Debug|x64.ActiveCfg = Debug|x64
20+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Debug|x64.Build.0 = Debug|x64
21+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Release|Mixed Platforms.ActiveCfg = Release|x64
22+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Release|Mixed Platforms.Build.0 = Release|x64
23+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Release|Win32.ActiveCfg = Release|x64
24+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Release|x64.ActiveCfg = Release|x64
25+ {55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}.Release|x64.Build.0 = Release|x64
26+ EndGlobalSection
27+ GlobalSection(SolutionProperties) = preSolution
28+ HideSolutionNode = FALSE
29+ EndGlobalSection
30+EndGlobal
--- /dev/null
+++ b/win64/logger.cpp
@@ -0,0 +1,115 @@
1+/*
2+==============================================================================
3+
4+This file is part of the S.F.Tracker
5+Copyright 2005-7 by Satoshi Fujiwara.
6+
7+S.F.Tracker can be redistributed and/or modified under the terms of the
8+GNU General Public License, as published by the Free Software Foundation;
9+either version 2 of the License, or (at your option) any later version.
10+
11+S.F.Tracker is distributed in the hope that it will be useful,
12+but WITHOUT ANY WARRANTY; without even the implied warranty of
13+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+GNU General Public License for more details.
15+
16+You should have received a copy of the GNU General Public License
17+along with S.F.Tracker; if not, visit www.gnu.org/licenses or write to the
18+Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19+Boston, MA 02111-1307 USA
20+
21+==============================================================================
22+*/
23+/** @file
24+* @author S.F. (Satoshi Fujiwara)
25+*/
26+
27+#include "stdafx.h"
28+
29+namespace sf {
30+
31+ struct logger::impl
32+ {
33+ impl() : m_log_file("sftracker.log",std::ios_base::out | std::ios_base::trunc ){};
34+ ~impl() {m_log_file.close();}
35+
36+ void write(const boost::wformat & fmt)
37+ {
38+ write(fmt.str());
39+ };
40+
41+ void write(const std::wistream & st)
42+ {
43+ {
44+ //mutex_type::scoped_lock lock_(m_mutex);
45+ m_log_file << st << std::endl;
46+ }
47+ boost::gregorian::date dt = boost::gregorian::day_clock::local_day();
48+
49+ };
50+
51+ void write(const std::wstring & mes)
52+ {
53+ write(mes.c_str());
54+ }
55+
56+ void write(const TCHAR * mes)
57+ {
58+ //mutex_type::scoped_lock lock_(m_mutex);
59+ m_log_file << mes << std::endl;
60+ m_log_file.flush();
61+ }
62+ private:
63+ std::wofstream m_log_file;
64+ //mutex_type m_mutex;
65+ };
66+
67+ logger::logger() : m_impl(new logger::impl())
68+ {
69+ }
70+ void logger::write(const boost::wformat & fmt)
71+ {
72+ m_impl->write(fmt);
73+ };
74+
75+ void logger::write(const std::wstring & mes)
76+ {
77+ m_impl->write(mes);
78+ }
79+
80+ void logger::write(const TCHAR * mes)
81+ {
82+ m_impl->write(mes);
83+ }
84+
85+ void logger::write(const std::wistream & st)
86+ {
87+ m_impl->write(st);
88+ }
89+
90+ logger::~logger()
91+ {
92+
93+ }
94+
95+ void debug_out(const char * file_name,const int line,boost::wformat& fmt)
96+ {
97+ OutputDebugString((boost::wformat(_T("%s(%d) %s \n")) % std::wstring(sf::code_converter<char,wchar_t>(file_name)) % line % fmt).str().c_str());
98+ };
99+
100+ void debug_out(const char * file_name,const int line,const std::wstring& str)
101+ {
102+ OutputDebugString((boost::wformat(_T("%s(%d) %s \n")) % std::wstring(sf::code_converter<char,wchar_t>(file_name)) % line % str).str().c_str());
103+ };
104+
105+ void debug_out(const char * file_name,const int line,const char* str)
106+ {
107+ OutputDebugString((boost::wformat(_T("%s(%d) %s \n")) % std::wstring(sf::code_converter<char,wchar_t>(file_name)) % line % sf::code_converter<char,wchar_t>(str)).str().c_str());
108+ }
109+
110+ void debug_outW(const char * file_name,const int line,const wchar_t* str)
111+ {
112+ OutputDebugString((boost::wformat(_T("%s(%d) %s \n")) % std::wstring(sf::code_converter<char,wchar_t>(file_name)) % line % str).str().c_str());
113+ };
114+
115+}
--- /dev/null
+++ b/win64/logger.h
@@ -0,0 +1,37 @@
1+#pragma once
2+
3+#include "boost/date_time/gregorian/gregorian.hpp"
4+#include "boost/date_time/posix_time/posix_time.hpp"
5+#include "singleton.h"
6+
7+namespace sf {
8+
9+ struct logger : public singleton<logger>
10+ {
11+ public:
12+ logger();
13+ ~logger();
14+ void write(const boost::wformat & fmt);
15+ void write(const std::wstring & mes);
16+ void write(const TCHAR * mes);
17+ void write(const std::wistream & st);
18+ private:
19+ struct impl;
20+ boost::shared_ptr<impl> m_impl;
21+ };
22+
23+ void debug_out(const char * file_name,const int line,boost::wformat& fmt);
24+ void debug_out(const char * file_name,const int line,const std::wstring& str);
25+ void debug_out(const char * file_name,const int line,const char* str);
26+ void debug_out(const char * file_name,const int line,const wchar_t* str);
27+}
28+
29+#define WRITE_LOG(s) \
30+ sf::logger::instance()->write(boost::wformat(_T("%s %s %6d %s")) % boost::posix_time::second_clock::local_time() % (TCHAR*)sf::ca2t(__FILE__) % __LINE__ % (s))
31+
32+#ifdef _DEBUG
33+#define SFTRACE(x) sf::debug_out(__FILE__,__LINE__,(x))
34+#else
35+#define SFTRACE(x)
36+#endif
37+
--- /dev/null
+++ b/win64/midi_input.cpp
@@ -0,0 +1,177 @@
1+#include "stdafx.h"
2+#include "midi_input.h"
3+
4+namespace sf {
5+
6+ midi_input::capss_type midi_input::capss_;
7+
8+ void midi_input::search_devices()
9+ {
10+ const boost::uint32_t num_devs_ = midiInGetNumDevs();
11+ if(num_devs_ > 0)
12+ {
13+ capss_.clear();
14+ for( boost::uint32_t dev_id_ = 0;dev_id_ < num_devs_;++dev_id_)
15+ {
16+ MIDIINCAPS2 caps2_;
17+ boost::uint32_t result = midiInGetDevCaps(dev_id_,reinterpret_cast<LPMIDIINCAPS>(&caps2_),sizeof(MIDIINCAPS2));
18+ if(result != MMSYSERR_NOERROR)
19+ {
20+ std::wstring error_message;
21+ switch(result)
22+ {
23+ case MMSYSERR_BADDEVICEID:
24+ error_message = _T("midiInGetDevCaps Error : MMSYSERR_BADDEVICEID");
25+ break;
26+ case MMSYSERR_INVALPARAM:
27+ error_message = _T("midiInGetDevCaps Error : MMSYSERR_INVALPARAM");
28+ break;
29+ case MMSYSERR_NODRIVER:
30+ error_message = _T("midiInGetDevCaps Error : MMSYSERR_NODRIVER");
31+ break;
32+ case MMSYSERR_NOMEM:
33+ error_message = _T("midiInGetDevCaps Error : MMSYSERR_NOMEM");
34+ break;
35+ default:
36+ error_message = _T("midiInGetDevCaps Error : UNKNOWN");
37+ break;
38+ }
39+ throw midi_input::device_error(error_message,result);
40+ } else {
41+ midi_input::capss_.push_back(new midi_input::caps(caps2_,dev_id_));
42+ }
43+ }
44+ }
45+
46+ }
47+
48+ midi_input::midi_input(boost::uint32_t id)
49+ : dev_id_(id),hmidiin_(NULL)
50+ {
51+ open();
52+ }
53+
54+ midi_input::~midi_input()
55+ {
56+ close();
57+ }
58+ /*
59+ void CALLBACK midi_input::on_midi_in(const boost::uint32_t wMsg,const DWORD midi_message,const DWORD time_stamp)
60+ {
61+
62+ boost::uint32_t current_step = 0;
63+
64+ switch( wMsg )
65+ {
66+ // normal data message
67+ case MIM_DATA:
68+ {
69+ boost::uint32_t data2_ = ((midi_message & 0xFF0000) >> 16);
70+ boost::uint32_t data1_ = ((midi_message & 0xFF00) >> 8);
71+ boost::uint32_t status_ = ((midi_message & 0xFF));
72+ SFTRACE((boost::wformat(_T("%2x %2x %2x \n")) % status_ % data1_ % data2_));
73+ switch (status_ & 0xf0)
74+ {
75+ case 0x90: // note on
76+ {
77+ //if(data2_ != 0){
78+ // input_messages::instance()->push_back(
79+ // new note_on_command(current_step,cur_mac,(float)data1_,(float)data2_ / 127.0f,status_ & 0xf)
80+ // );
81+ //} else {
82+ // input_messages::instance()->push_back(
83+ // new note_off_command(current_step,cur_mac,(float)data1_,(float)data2_ / 127.0f, status_ & 0xf)
84+ // );
85+ //}
86+ }
87+ break;
88+ case 0x80: // note off
89+ {
90+ //input_messages::instance()->push_back(
91+ // new note_off_command(current_step,cur_mac,(float)data1_,(float)data2_ / 127.0f,status_ & 0xf)
92+ // );
93+ }
94+ break;
95+ case 0xa0: // poly after touch
96+ {
97+ //input_messages::instance()->push_back(
98+ // new polyphonic_after_touch_command(current_step,cur_mac,(float)data1_,(float)data2_ / 127.0f,status_ & 0xf)
99+ // );
100+ }
101+ break;
102+ case 0xb0: // control change
103+ {
104+ SFTRACE((format(_T("control_change: %2x %2x \n")) % data1_ % data2_));
105+ //if(data1_ < 32 )
106+ //{
107+ // control_change_buffer_[status_ & 0xf][0] = data1_;
108+ // control_change_buffer_[status_ & 0xf][1] = data2_ << 7;
109+
110+ // input_messages::instance()->push_back
111+ // (
112+ // m_control_creators[data1_](current_step,cur_mac,(float)(data2_ << 7) / 16384.0f ,status_ & 0xf)
113+ // );
114+
115+ //} else {
116+ // if(data1_ > 31 && data1_ < 64)
117+ // {
118+
119+ // if(control_change_buffer_[status_ & 0xf][0] == data1_)
120+ // {
121+ // data2_ += control_change_buffer_[status_ & 0xf][1];
122+ // input_messages::instance()->push_back(
123+ // m_control_creators[data1_](current_step,(main_controller::instance()->current_machine()),(float)data2_ / 16384.0f,status_ & 0xf)
124+ // );
125+ // };
126+ // control_change_buffer_[status_ & 0xf][0] = 0;
127+ // control_change_buffer_[status_ & 0xf][1] = 0;
128+ // } else {
129+ // // 64 ... 119
130+ // input_messages::instance()->push_back(
131+ // m_control_creators[data1_](current_step,sf::model::main_controller::instance()->current_machine(),(float)(data2_) / 127.0f,status_ & 0xf)
132+ // );
133+ // control_change_buffer_[status_ & 0xf][0] = 0;
134+ // control_change_buffer_[status_ & 0xf][1] = 0;
135+ // }
136+ //}
137+ }
138+ break;
139+ case 0xc0: // program change
140+ {
141+ //input_messages::instance()->push_back(
142+ // new program_change_command(current_step,
143+ // sf::model::main_controller::instance()->current_machine(),
144+ // data1_,status_ & 0xf)
145+ // );
146+ }
147+ break;
148+ case 0xd0: // channel after touch
149+ {
150+ //input_messages::instance()->push_back(
151+ // new channel_after_touch(current_step,
152+ // sf::model::main_controller::instance()->current_machine(),
153+ // (float)data1_,status_ & 0xf)
154+ // );
155+ }
156+ break;
157+ case 0xe0: // pitch bend
158+ {
159+ //const boost::uint32_t value_ = data1_ << 7 | data2_;
160+ //const float fvalue_ = value_ / 16384.0f;
161+
162+ //input_messages::instance()->push_back(
163+ // new pitch_bend_command(current_step,
164+ // sf::model::main_controller::instance()->current_machine(),
165+ // fvalue_,status_ & 0xf)
166+ // );
167+ }
168+ break;
169+ default:
170+ break;
171+ }
172+ }
173+ break;
174+ }
175+ };
176+ */
177+}
--- /dev/null
+++ b/win64/midi_input.h
@@ -0,0 +1,121 @@
1+#pragma once
2+/** @file
3+* @brief header file
4+* $Date: 2007/10/15 20:41:44 $
5+* $Revision: 1.11 $
6+*/
7+#include "midi_message.h"
8+#include "exception.h"
9+
10+namespace sf {
11+
12+ const int midi_ch_num = 16;
13+ const int control_change_num = 2;
14+ const int max_control_changes = 128;
15+
16+ /** MIDI Input Class */
17+ struct midi_input
18+ {
19+
20+ typedef boost::signals2::signal<void (const boost::uint32_t wMsg,const DWORD midi_message,const DWORD time_stamp) > on_message_arrived_type;
21+ on_message_arrived_type on_message_arrived;
22+
23+ /** デバイスが存在しない時に投げる例外 */
24+ struct device_not_exist_exception : sf::exception
25+ {
26+ explicit device_not_exist_exception(const std::wstring& reason) : exception(reason){}
27+ };
28+
29+ /** デバイスエラー時に投げる例外 */
30+ struct device_error : sf::exception
31+ {
32+ device_error(const std::wstring& reason,boost::uint32_t err_id) : exception(reason),err_id_(err_id){}
33+ const boost::uint32_t err_id() const {return err_id_;};
34+ private:
35+ const boost::uint32_t err_id_;
36+ };
37+
38+ /** MIDI IN インターフェース*/
39+ struct caps {
40+ caps(const MIDIINCAPS2& value,const boost::uint32_t dev_id) :id_(dev_id),name_(value.szPname),caps_(value)
41+ {
42+ }
43+ const boost::uint32_t id() const { return id_;}
44+ const std::wstring& name() const {return name_;}
45+ private:
46+ const boost::uint32_t id_;
47+ const std::wstring name_;
48+ MIDIINCAPS2 caps_;
49+ };
50+
51+ typedef boost::ptr_vector<caps> capss_type;
52+
53+ midi_input(boost::uint32_t id);
54+ virtual ~midi_input();
55+
56+ //void id(const boost::uint32_t id) { assert(id < capss_.size()); dev_id_ = id;}
57+ const boost::uint32_t id() {return dev_id_;}
58+
59+ const boost::uint32_t num_devices() {return ::midiInGetNumDevs();}
60+
61+ void open()
62+ {
63+ if(num_devices() > 0){
64+ int result = midiInOpen(&hmidiin_,dev_id_,(LONG_PTR)(&midi_in_proc),(DWORD_PTR)this,CALLBACK_FUNCTION);
65+ assert(result == MMSYSERR_NOERROR);
66+ } else {
67+ throw device_not_exist_exception(_T("midi in device not found"));
68+ }
69+ }
70+
71+ void start()
72+ {
73+ assert(hmidiin_ != NULL);
74+
75+// memset(control_change_buffer_,0,sizeof(boost::uint32_t) * midi_ch_num * control_change_num );
76+
77+ int result = midiInStart(hmidiin_);
78+ assert(result == MMSYSERR_NOERROR);
79+ }
80+
81+ void stop()
82+ {
83+ assert(hmidiin_ != NULL);
84+ int result = midiInStop(hmidiin_);
85+ assert(result == MMSYSERR_NOERROR);
86+ }
87+
88+ void reset()
89+ {
90+ assert(hmidiin_ != NULL);
91+ int result = midiInReset(hmidiin_);
92+ assert(result == MMSYSERR_NOERROR);
93+ }
94+
95+ void close()
96+ {
97+ if(hmidiin_ == NULL) return;
98+
99+ int result = midiInClose(hmidiin_);
100+ assert(result == MMSYSERR_NOERROR);
101+ hmidiin_ = NULL;
102+ }
103+
104+ static const capss_type & capss(){return capss_;};
105+ static void CALLBACK midi_in_proc(
106+ HMIDIIN hMidiIn,
107+ boost::uint32_t wMsg,
108+ DWORD dwInstance,
109+ DWORD dwParam1,
110+ DWORD dwParam2
111+ ){
112+ reinterpret_cast<midi_input*>(dwInstance)->on_message_arrived(wMsg,dwParam1,dwParam2);
113+ }
114+ static void search_devices();
115+ private:
116+ static capss_type capss_;
117+// boost::uint32_t control_change_buffer_[midi_ch_num][control_change_num];
118+ HMIDIIN hmidiin_;
119+ boost::uint32_t dev_id_;
120+ };
121+}
--- /dev/null
+++ b/win64/midi_message.h
@@ -0,0 +1,151 @@
1+#pragma once
2+/** @file
3+ * @brief MIDI
4+ */
5+namespace sf {
6+
7+ struct message
8+ {
9+
10+ message(const boost::uint64_t step_time_value)
11+ : step_time_(step_time_value) {}
12+
13+ message(const message& src ): step_time_(src.step_time_) {}
14+
15+ const boost::uint64_t step_time() const { return step_time_;}
16+ void step_time(const boost::uint64_t value) {step_time_ = value;}
17+
18+ const std::wstring& name() {return name_();}
19+ const std::wstring& description() {return description_();}
20+
21+ protected:
22+
23+ virtual const std::wstring& name_() const = 0;
24+ virtual const std::wstring& description_() const = 0;
25+
26+ boost::uint64_t step_time_;
27+ };
28+
29+
30+ struct midi_message_enum
31+ {
32+ enum {
33+ note_on = 0x90,
34+ note_off = 0x80,
35+ polyphonic_after_touch = 0xa0,
36+ control_change = 0xb0,
37+ program_change = 0xc0,
38+ channel_after_touch = 0xd0,
39+ pitch_bend = 0xe0,
40+ exclusive = 0xf0,
41+ quota_frame = 0xf1,
42+ song_position_pointer = 0xf2,
43+ song_select = 0xf3,
44+ tune_request = 0xf6,
45+ end_of_exclusive = 0xf7,
46+ timing_clock = 0xf8,
47+ midi_clock_start = 0xfa,
48+ midi_clock_continue = 0xfb,
49+ midi_clock_stop = 0xfc,
50+ active_sensing = 0xfe,
51+ system_reset = 0xff
52+ };
53+ };
54+
55+ /*
56+ 0 00 32 20 バンクセレクト(音色バンクの切替)
57+ 1 01 33 21 モジュレーション・デプス
58+ 2 02 34 22 ブレスコントロール(息を吹き込む強さによるコントロール)
59+ 3 03 35 23 (未定義)
60+ 4 04 36 24 フットコントロール(フットペダルによるコントロール)
61+ 5 05 37 25 ポルタメントタイム
62+ 6 06 38 26 データエントリ(RPN/NRPNで指定したパラメータの値を設定)
63+ 7 07 39 27 メインボリューム(チャンネルの音量を設定)
64+ 8 08 40 28 バランスコントロール(上の音域と下の音域のバランス)
65+ 9 09 41 29 (未定義)
66+ 10 0A 42 2A パンポット(定位−左右のバランス)
67+ 11 0B 43 2B エクスプレッション(音量の抑揚をつける)
68+ 12 0C 44 2C (未定義)
69+ 13 0D 45 2D (未定義)
70+ 14 0E 46 2E (未定義)
71+ 15 0F 47 2F (未定義)
72+ 16 10 48 30 汎用操作子1
73+ 17 11 49 31 汎用操作子2
74+ 18 12 50 32 汎用操作子3
75+ 19 13 51 33 汎用操作子4
76+
77+ 7ビット連続可変
78+ No. Hex 機能
79+ 64 40 ホールド1(ダンパメダル)
80+ 65 41 ポルタメント
81+ 66 42 ソステヌート(コードホールド)
82+ 67 43 ソフトペダル
83+ 68 44 (未定義)
84+ 69 45 ホールド2(フリーズ)
85+ 70 46 メモリバッチセレクト
86+ 71-79 47-4F (未定義)
87+ 80 50 汎用操作子5
88+ 81 51 汎用操作子6
89+ 82 52 汎用操作子7
90+ 83 53 汎用操作子8
91+ 84-90 54-5A (未定義)
92+ 91 5B 汎用エフェクト1(リバーブ)
93+ 92 5C 汎用エフェクト2(トレモロ)
94+ 93 5D 汎用エフェクト3(コーラス)
95+ 94 5E 汎用エフェクト4(セレステ)
96+ 95 5F 汎用エフェクト5(フェイザ)
97+
98+
99+
100+ RPN-NRPN
101+ No. Hex 機能
102+ 96 60 データインクリメント
103+ 97 61 データデクリメント
104+ LSB MSB
105+ No. Hex No. Hex 機能
106+ 98 62 99 63 NRPN
107+ 100 64 101 65 RPN
108+
109+ */
110+ struct control_message_enum
111+ {
112+ enum {
113+ bank_select = 0x0,
114+ moduration_depth = 0x1,
115+ breath_control =0x2,
116+ foot_control = 0x4,
117+ portament_time =0x5,
118+ data_entry = 0x6,
119+ main_volume = 0x7,
120+ balance_control = 0x8,
121+ panpot = 0xa,
122+ expression = 0xb,
123+ hold = 0x40,
124+ portament = 0x41,
125+ chord_hold = 0x42,
126+ soft_pedal = 0x43,
127+ hold2 = 0x45,
128+ memory_batch_select = 0x46,
129+ reverb = 0x5b,
130+ tremolo = 0x5c,
131+ chorus = 0x5d,
132+ celeste = 0x5e,
133+ phazer = 0x5f,
134+ all_sound_off = 0x78,
135+ reset_all_controller = 0x79,
136+ local_control = 0x7a,
137+ all_note_off = 0x7b,
138+ omni_off =0x7c,
139+ omni_on = 0x7d,
140+ mono_mode_on = 0x7e,
141+ poly_mode_on = 0x7f
142+ };
143+ };
144+
145+ //template <boost::uint32_t MessageNo,class Storage>
146+ //struct midi_message : public message , public Storage
147+ //{
148+
149+ //};
150+
151+}
--- a/win64/sf_windows.h
+++ b/win64/sf_windows.h
@@ -240,6 +240,7 @@ namespace sf{
240240 virtual void discard_device();
241241 virtual void create_device();
242242 virtual void create_device_independent_resources();
243+ public:
243244 virtual LRESULT window_proc(HWND hwnd,boost::uint32_t message, WPARAM wParam, LPARAM lParam);
244245 protected:
245246 static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -280,7 +281,7 @@ namespace sf{
280281
281282 struct toplevel_window;
282283 typedef boost::shared_ptr<toplevel_window> toplevel_window_ptr;
283-
284+
284285 /** toplevel_window を生成する関数 */
285286 toplevel_window_ptr create_toplevel_window (
286287 const std::wstring& menu_name,
@@ -289,31 +290,32 @@ namespace sf{
289290 bool fit_to_display = false,
290291 float width = 640,
291292 float height = 480
292- );
293-
294-
295-
293+ );
294+
295+
296+
296297 /** toplevel ウィンドウクラス */
297298 /* このクラスは、create_toplevel_window 関数からのみ生成可能 */
298299 struct toplevel_window : public base_window
299300 {
300301 friend toplevel_window_ptr create_toplevel_window
301- (
302- const std::wstring& menu_name,
303- const std::wstring& name,
304- const boost::uint32_t show_flag,
305- bool fit_to_display ,
306- float width ,
307- float height
308- );
309- void main_loop();
302+ (
303+ const std::wstring& menu_name,
304+ const std::wstring& name,
305+ const boost::uint32_t show_flag,
306+ bool fit_to_display ,
307+ float width ,
308+ float height
309+ );
310+ void main_loop();
310311 protected:
311- void render();
312- toplevel_window(const std::wstring& menu_name,const std::wstring& name,bool fit_to_display,float width = 640,float height = 480) : base_window(menu_name,name,fit_to_display,width,height)
313- {
314- on_render.connect(boost::bind(&toplevel_window::render,this));
315- };
316- LRESULT toplevel_window::window_proc(HWND hwnd,boost::uint32_t message, WPARAM wParam, LPARAM lParam);
312+ void render();
313+ toplevel_window(const std::wstring& menu_name,const std::wstring& name,bool fit_to_display,float width = 640,float height = 480) : base_window(menu_name,name,fit_to_display,width,height)
314+ {
315+ on_render.connect(boost::bind(&toplevel_window::render,this));
316+ };
317+ public:
318+ LRESULT toplevel_window::window_proc(HWND hwnd,boost::uint32_t message, WPARAM wParam, LPARAM lParam);
317319 };
318320
319321 struct av_mm_thread_characteristics
--- a/win64/stdafx.h
+++ b/win64/stdafx.h
@@ -113,3 +113,6 @@
113113
114114
115115 // TODO: プログラムに必要な追加ヘッダーをここで参照してください。
116+#include "code_converter.h"
117+#include "logger.h"
118+#include "dout.h"
--- a/win64/win64.vcxproj
+++ b/win64/win64.vcxproj
@@ -63,19 +63,30 @@
6363 </Link>
6464 </ItemDefinitionGroup>
6565 <ItemGroup>
66+ <ClCompile Include="code_converter.cpp" />
6667 <ClCompile Include="exception.cpp" />
68+ <ClCompile Include="logger.cpp" />
6769 <ClCompile Include="message_loop.cpp" />
70+ <ClCompile Include="midi_input.cpp" />
6871 <ClCompile Include="sf_com.cpp" />
69- <ClCompile Include="sf_windows.cpp" />
72+ <ClCompile Include="sf_windows.cpp">
73+ <AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NoListing</AssemblerOutput>
74+ </ClCompile>
7075 <ClCompile Include="stdafx.cpp">
7176 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
7277 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
7378 </ClCompile>
74- <ClCompile Include="winmain.cpp" />
79+ <ClCompile Include="winmain.cpp">
80+ <AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AssemblyAndSourceCode</AssemblerOutput>
81+ </ClCompile>
7582 </ItemGroup>
7683 <ItemGroup>
84+ <ClInclude Include="code_converter.h" />
85+ <ClInclude Include="dout.h" />
7786 <ClInclude Include="exception.h" />
87+ <ClInclude Include="logger.h" />
7888 <ClInclude Include="message_loop.h" />
89+ <ClInclude Include="midi_input.h" />
7990 <ClInclude Include="sf_com.h" />
8091 <ClInclude Include="sf_memory.h" />
8192 <ClInclude Include="sf_windows.h" />
--- a/win64/win64.vcxproj.filters
+++ b/win64/win64.vcxproj.filters
@@ -33,6 +33,15 @@
3333 <ClCompile Include="message_loop.cpp">
3434 <Filter>ソース ファイル</Filter>
3535 </ClCompile>
36+ <ClCompile Include="midi_input.cpp">
37+ <Filter>ソース ファイル</Filter>
38+ </ClCompile>
39+ <ClCompile Include="logger.cpp">
40+ <Filter>ソース ファイル</Filter>
41+ </ClCompile>
42+ <ClCompile Include="code_converter.cpp">
43+ <Filter>ソース ファイル</Filter>
44+ </ClCompile>
3645 </ItemGroup>
3746 <ItemGroup>
3847 <ClInclude Include="exception.h">
@@ -59,5 +68,17 @@
5968 <ClInclude Include="message_loop.h">
6069 <Filter>ソース ファイル</Filter>
6170 </ClInclude>
71+ <ClInclude Include="midi_input.h">
72+ <Filter>ソース ファイル</Filter>
73+ </ClInclude>
74+ <ClInclude Include="logger.h">
75+ <Filter>ソース ファイル</Filter>
76+ </ClInclude>
77+ <ClInclude Include="code_converter.h">
78+ <Filter>ソース ファイル</Filter>
79+ </ClInclude>
80+ <ClInclude Include="dout.h">
81+ <Filter>ソース ファイル</Filter>
82+ </ClInclude>
6283 </ItemGroup>
6384 </Project>
\ No newline at end of file
--- a/win64/winmain.cpp
+++ b/win64/winmain.cpp
@@ -2,7 +2,9 @@
22 #include "sf_windows.h"
33 #include "message_loop.h"
44 #include "sf_com.h"
5+#include "midi_input.h"
56
7+/** WinMain */
68 int APIENTRY _tWinMain(HINSTANCE hInstance,
79 HINSTANCE hPrevInstance,
810 LPTSTR lpCmdLine,
@@ -10,11 +12,38 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
1012 {
1113 UNREFERENCED_PARAMETER(hPrevInstance);
1214 UNREFERENCED_PARAMETER(lpCmdLine);
15+
16+ std::wcout.imbue(std::locale(""));
17+
1318 // COMの初期化
1419 sf::com_initialize init();
20+
21+ // MIDI IN デバイスの検索
22+ sf::midi_input::search_devices();
23+
24+ std::for_each(sf::midi_input::capss().begin(),sf::midi_input::capss().end()
25+ ,[](const sf::midi_input::caps& c)
26+ {
27+ sf::wdout << c.name() << std::endl;
28+ }
29+ );
30+
31+ if(!sf::midi_input::capss().empty())
32+ {
33+ sf::midi_input i(sf::midi_input::capss().begin()->id());
34+ i.start();
35+ i.stop();
36+ i.reset();
37+ i.close();
38+ }
39+
40+
1541 // ウィンドウの作成
1642 sf::toplevel_window_ptr
17- window(sf::create_toplevel_window(std::wstring(L"Test Window"),std::wstring(L"Test Window")));
43+ window(
44+ sf::create_toplevel_window(
45+ std::wstring(L"Test Window"),std::wstring(L"Test Window")));
46+
1847 // メッセージループの実行
1948 return sf::run_message_loop()();
2049
Show on old repository browser