TiMidity++ 改造版 (Windows 専用)
Revision | 9ac54d5b9b21fa4c0bdf0b0ba61d37ba9b6198ea (tree) |
---|---|
Time | 2017-11-11 20:39:35 |
Author | Starg <starg@user...> |
Commiter | Starg |
Start adding WASAPI support.
@@ -7,6 +7,7 @@ set(TIMIDITY_AUDIO_GOGO FALSE CACHE BOOL "GOGO") | ||
7 | 7 | set(TIMIDITY_AUDIO_VORBIS FALSE CACHE BOOL "vorbis") |
8 | 8 | set(TIMIDITY_AUDIO_FLAC FALSE CACHE BOOL "flac") |
9 | 9 | set(TIMIDITY_AUDIO_PORTAUDIO FALSE CACHE BOOL "portaudio") |
10 | +set(TIMIDITY_AUDIO_WASAPI TRUE CACHE BOOL "WASAPI") | |
10 | 11 | |
11 | 12 | set(PORTAUDIO_INCLUDE_DIR "." CACHE PATH "portaudio include dir") |
12 | 13 |
@@ -86,6 +87,12 @@ if(TIMIDITY_AUDIO_PORTAUDIO) | ||
86 | 87 | include_directories("${PORTAUDIO_INCLUDE_DIR}") |
87 | 88 | endif() |
88 | 89 | |
90 | +if(TIMIDITY_AUDIO_WASAPI) | |
91 | + add_definitions( | |
92 | + -DAU_WASAPI | |
93 | + ) | |
94 | +endif() | |
95 | + | |
89 | 96 | if(TIMIDITY_INTERFACE_W32GUI) |
90 | 97 | add_definitions( |
91 | 98 | -DIA_W32GUI |
@@ -155,6 +155,13 @@ if(TIMIDITY_AUDIO_PORTAUDIO) | ||
155 | 155 | ) |
156 | 156 | endif() |
157 | 157 | |
158 | +if(TIMIDITY_AUDIO_WASAPI) | |
159 | + list( | |
160 | + APPEND TiMiditySources | |
161 | + wasapi_a.c | |
162 | + ) | |
163 | +endif() | |
164 | + | |
158 | 165 | if(TIMIDITY_INTERFACE_W32GUI) |
159 | 166 | add_executable(timw32g WIN32 ${TiMiditySources}) |
160 | 167 | target_link_libraries(timw32g ${TiMidityLibs}) |
@@ -101,6 +101,11 @@ extern PlayMode portaudio_win_wasapi_play_mode; | ||
101 | 101 | #endif |
102 | 102 | #endif /* AU_PORTAUDIO */ |
103 | 103 | |
104 | +#ifdef AU_WASAPI | |
105 | +extern PlayMode wasapi_shared_play_mode; | |
106 | +extern PlayMode wasapi_exclusive_play_mode; | |
107 | +#endif /* AU_WASAPI */ | |
108 | + | |
104 | 109 | #ifdef AU_NPIPE |
105 | 110 | extern PlayMode npipe_play_mode; |
106 | 111 | #endif /* AU_NPIPE */ |
@@ -174,6 +179,11 @@ PlayMode *play_mode_list[] = { | ||
174 | 179 | #endif |
175 | 180 | #endif /* AU_PORTAUDIO */ |
176 | 181 | |
182 | +#if defined(AU_WASAPI) | |
183 | + &wasapi_shared_play_mode, | |
184 | + &wasapi_exclusive_play_mode, | |
185 | +#endif /* AU_WASAPI */ | |
186 | + | |
177 | 187 | #if defined(AU_NPIPE) |
178 | 188 | &npipe_play_mode, |
179 | 189 | #endif /*AU_NPIPE*/ |
@@ -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 */ |