OSDN Git Service

非同期エージェントライブラリにてスレッド部分を書き換えてみた。
[winaudioj/wasapi2.git] / wasapi2 / writer_thread.cpp
1 /*\r
2 ==============================================================================\r
3 \r
4 This file is part of the async\r
5 Copyright 2005-10 by Satoshi Fujiwara.\r
6 \r
7 async can be redistributed and/or modified under the terms of the\r
8 GNU General Public License, as published by the Free Software Foundation;\r
9 either version 2 of the License, or (at your option) any later version.\r
10 \r
11 async is distributed in the hope that it will be useful,\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 GNU General Public License for more details.\r
15 \r
16 You should have received a copy of the GNU General Public License\r
17 along with async; if not, visit www.gnu.org/licenses or write to the\r
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, \r
19 Boston, MA 02111-1307 USA\r
20 \r
21 ==============================================================================\r
22 */\r
23 #include "StdAfx.h"\r
24 #include <commctrl.h>\r
25 \r
26 #if _DEBUG\r
27 #define _CRTDBG_MAP_ALLOC\r
28 #include <crtdbg.h>\r
29 #define new new(_NORMAL_BLOCK, __FILE__, __LINE__)\r
30 #endif\r
31 \r
32 #include "message_loop.h"\r
33 #include "sf_com.h"\r
34 #include "application.h"\r
35 #include "writer_thread.h"\r
36 #include "dout.h"\r
37 #include "async_reader.h"\r
38 \r
39 using namespace std;\r
40 \r
41 namespace sf {\r
42 \r
43 \r
44 void writer_thread_t::run()\r
45 {\r
46   // TODO:ミキサーの実装\r
47   // COMの初期化\r
48   sf::com_initialize init(0,multi_threaded);\r
49   init_buffer();\r
50   int status;\r
51   switch(status = status_.load(),status !=status_exit)\r
52   {\r
53   case status_processing:\r
54     break;\r
55   case status_pause:\r
56     break;\r
57   default:\r
58         wait_event();\r
59 //        WaitForSingleObject(event_.get(),WAIT_TIMEOUT_DEFAULT);\r
60   }\r
61 }\r
62 \r
63 }\r
64 \r