• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

TiMidity++ 改造版 (Windows 専用)


Commit MetaInfo

Revision9ac54d5b9b21fa4c0bdf0b0ba61d37ba9b6198ea (tree)
Time2017-11-11 20:39:35
AuthorStarg <starg@user...>
CommiterStarg

Log Message

Start adding WASAPI support.

Change Summary

Incremental Difference

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@ set(TIMIDITY_AUDIO_GOGO FALSE CACHE BOOL "GOGO")
77 set(TIMIDITY_AUDIO_VORBIS FALSE CACHE BOOL "vorbis")
88 set(TIMIDITY_AUDIO_FLAC FALSE CACHE BOOL "flac")
99 set(TIMIDITY_AUDIO_PORTAUDIO FALSE CACHE BOOL "portaudio")
10+set(TIMIDITY_AUDIO_WASAPI TRUE CACHE BOOL "WASAPI")
1011
1112 set(PORTAUDIO_INCLUDE_DIR "." CACHE PATH "portaudio include dir")
1213
@@ -86,6 +87,12 @@ if(TIMIDITY_AUDIO_PORTAUDIO)
8687 include_directories("${PORTAUDIO_INCLUDE_DIR}")
8788 endif()
8889
90+if(TIMIDITY_AUDIO_WASAPI)
91+ add_definitions(
92+ -DAU_WASAPI
93+ )
94+endif()
95+
8996 if(TIMIDITY_INTERFACE_W32GUI)
9097 add_definitions(
9198 -DIA_W32GUI
--- a/timidity/CMakeLists.txt
+++ b/timidity/CMakeLists.txt
@@ -155,6 +155,13 @@ if(TIMIDITY_AUDIO_PORTAUDIO)
155155 )
156156 endif()
157157
158+if(TIMIDITY_AUDIO_WASAPI)
159+ list(
160+ APPEND TiMiditySources
161+ wasapi_a.c
162+ )
163+endif()
164+
158165 if(TIMIDITY_INTERFACE_W32GUI)
159166 add_executable(timw32g WIN32 ${TiMiditySources})
160167 target_link_libraries(timw32g ${TiMidityLibs})
--- a/timidity/output.c
+++ b/timidity/output.c
@@ -101,6 +101,11 @@ extern PlayMode portaudio_win_wasapi_play_mode;
101101 #endif
102102 #endif /* AU_PORTAUDIO */
103103
104+#ifdef AU_WASAPI
105+extern PlayMode wasapi_shared_play_mode;
106+extern PlayMode wasapi_exclusive_play_mode;
107+#endif /* AU_WASAPI */
108+
104109 #ifdef AU_NPIPE
105110 extern PlayMode npipe_play_mode;
106111 #endif /* AU_NPIPE */
@@ -174,6 +179,11 @@ PlayMode *play_mode_list[] = {
174179 #endif
175180 #endif /* AU_PORTAUDIO */
176181
182+#if defined(AU_WASAPI)
183+ &wasapi_shared_play_mode,
184+ &wasapi_exclusive_play_mode,
185+#endif /* AU_WASAPI */
186+
177187 #if defined(AU_NPIPE)
178188 &npipe_play_mode,
179189 #endif /*AU_NPIPE*/
--- /dev/null
+++ b/timidity/wasapi_a.c
@@ -0,0 +1,107 @@
1+/*
2+TiMidity++ -- MIDI to WAVE converter and player
3+Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
4+Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
5+
6+This program is free software; you can redistribute it and/or modify
7+it under the terms of the GNU General Public License as published by
8+the Free Software Foundation; either version 2 of the License, or
9+(at your option) any later version.
10+
11+This program 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 this program; if not, write to the Free Software
18+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19+
20+wasapi_a.c
21+
22+Functions to play sound using WASAPI (Windows 7+).
23+
24+Written by Starg.
25+*/
26+
27+#ifdef HAVE_CONFIG_H
28+#include "config.h"
29+#endif /* HAVE_CONFIG_H */
30+#ifdef __W32__
31+#include "interface.h"
32+#endif
33+#include <stdio.h>
34+#include <stdlib.h>
35+#ifndef NO_STRING_H
36+#include <string.h>
37+#else
38+#include <strings.h>
39+#endif
40+#include <windows.h>
41+
42+#ifdef AU_WASAPI
43+
44+#include "timidity.h"
45+#include "output.h"
46+
47+int WASAPIOpenOutputShared(void)
48+{
49+ return -1;
50+}
51+
52+int WASAPIOpenOutputExclusive(void)
53+{
54+ return -1;
55+}
56+
57+void WASAPICloseOutput(void)
58+{
59+
60+}
61+
62+int WASAPIOutputData(char* pData, int32 size)
63+{
64+ return -1;
65+}
66+
67+int WASAPIACntl(int request, void* pArg)
68+{
69+ return -1;
70+}
71+
72+int WASAPIDetect(void)
73+{
74+ return 0;
75+}
76+
77+PlayMode wasapi_shared_play_mode = {
78+ DEFAULT_RATE,
79+ PE_16BIT | PE_SIGNED,
80+ PF_PCM_STREAM | PF_CAN_TRACE | PF_BUFF_FRAGM_OPT,
81+ -1,
82+ {32},
83+ "WASAPI (Shared)", 'x',
84+ NULL,
85+ &WASAPIOpenOutputShared,
86+ &WASAPICloseOutput,
87+ &WASAPIOutputData,
88+ &WASAPIACntl,
89+ &WASAPIDetect
90+};
91+
92+PlayMode wasapi_exclusive_play_mode = {
93+ DEFAULT_RATE,
94+ PE_16BIT | PE_SIGNED,
95+ PF_PCM_STREAM | PF_CAN_TRACE | PF_BUFF_FRAGM_OPT,
96+ -1,
97+ {32},
98+ "WASAPI (Exclusive)", 'X',
99+ NULL,
100+ &WASAPIOpenOutputExclusive,
101+ &WASAPICloseOutput,
102+ &WASAPIOutputData,
103+ &WASAPIACntl,
104+ &WASAPIDetect
105+};
106+
107+#endif /* AU_WASAPI */