| 1 | #ifndef PA_WIN_WMME_H |
| 2 | #define PA_WIN_WMME_H |
| 3 | /* |
| 4 | * $Id: pa_win_wmme.h,v 1.1 2006/06/10 21:30:51 dmazzoni Exp $ |
| 5 | * PortAudio Portable Real-Time Audio Library |
| 6 | * MME specific extensions |
| 7 | * |
| 8 | * Copyright (c) 1999-2000 Ross Bencina and Phil Burk |
| 9 | * |
| 10 | * Permission is hereby granted, free of charge, to any person obtaining |
| 11 | * a copy of this software and associated documentation files |
| 12 | * (the "Software"), to deal in the Software without restriction, |
| 13 | * including without limitation the rights to use, copy, modify, merge, |
| 14 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 15 | * and to permit persons to whom the Software is furnished to do so, |
| 16 | * subject to the following conditions: |
| 17 | * |
| 18 | * The above copyright notice and this permission notice shall be |
| 19 | * included in all copies or substantial portions of the Software. |
| 20 | * |
| 21 | * Any person wishing to distribute modifications to the Software is |
| 22 | * requested to send the modifications to the original developer so that |
| 23 | * they can be incorporated into the canonical version. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 28 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR |
| 29 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
| 30 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 31 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | /** @file |
| 36 | @brief WMME-specific PortAudio API extension header file. |
| 37 | */ |
| 38 | |
| 39 | |
| 40 | #include "portaudio.h" |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | extern "C" |
| 44 | { |
| 45 | #endif /* __cplusplus */ |
| 46 | |
| 47 | |
| 48 | #define paWinMmeUseLowLevelLatencyParameters (0x01) |
| 49 | #define paWinMmeUseMultipleDevices (0x02) /* use mme specific multiple device feature */ |
| 50 | |
| 51 | |
| 52 | /* By default, the mme implementation drops the processing thread's priority |
| 53 | to THREAD_PRIORITY_NORMAL and sleeps the thread if the CPU load exceeds 100% |
| 54 | This flag disables any priority throttling. The processing thread will always |
| 55 | run at THREAD_PRIORITY_TIME_CRITICAL. |
| 56 | */ |
| 57 | #define paWinMmeDontThrottleOverloadedProcessingThread (0x08) |
| 58 | |
| 59 | |
| 60 | typedef struct PaWinMmeDeviceAndChannelCount{ |
| 61 | PaDeviceIndex device; |
| 62 | int channelCount; |
| 63 | }PaWinMmeDeviceAndChannelCount; |
| 64 | |
| 65 | |
| 66 | typedef struct PaWinMmeStreamInfo{ |
| 67 | unsigned long size; /**< sizeof(PaWinMmeStreamInfo) */ |
| 68 | PaHostApiTypeId hostApiType; /**< paMME */ |
| 69 | unsigned long version; /**< 1 */ |
| 70 | |
| 71 | unsigned long flags; |
| 72 | |
| 73 | /* low-level latency setting support |
| 74 | These settings control the number and size of host buffers in order |
| 75 | to set latency. They will be used instead of the generic parameters |
| 76 | to Pa_OpenStream() if flags contains the PaWinMmeUseLowLevelLatencyParameters |
| 77 | flag. |
| 78 | |
| 79 | If PaWinMmeStreamInfo structures with PaWinMmeUseLowLevelLatencyParameters |
| 80 | are supplied for both input and output in a full duplex stream, then the |
| 81 | input and output framesPerBuffer must be the same, or the larger of the |
| 82 | two must be a multiple of the smaller, otherwise a |
| 83 | paIncompatibleHostApiSpecificStreamInfo error will be returned from |
| 84 | Pa_OpenStream(). |
| 85 | */ |
| 86 | unsigned long framesPerBuffer; |
| 87 | unsigned long bufferCount; /* formerly numBuffers */ |
| 88 | |
| 89 | /* multiple devices per direction support |
| 90 | If flags contains the PaWinMmeUseMultipleDevices flag, |
| 91 | this functionality will be used, otherwise the device parameter to |
| 92 | Pa_OpenStream() will be used instead. |
| 93 | If devices are specified here, the corresponding device parameter |
| 94 | to Pa_OpenStream() should be set to paUseHostApiSpecificDeviceSpecification, |
| 95 | otherwise an paInvalidDevice error will result. |
| 96 | The total number of channels accross all specified devices |
| 97 | must agree with the corresponding channelCount parameter to |
| 98 | Pa_OpenStream() otherwise a paInvalidChannelCount error will result. |
| 99 | */ |
| 100 | PaWinMmeDeviceAndChannelCount *devices; |
| 101 | unsigned long deviceCount; |
| 102 | |
| 103 | }PaWinMmeStreamInfo; |
| 104 | |
| 105 | |
| 106 | /** Retrieve the number of wave in handles used by a PortAudio WinMME stream. |
| 107 | Returns zero if the stream is output only. |
| 108 | |
| 109 | @return A non-negative value indicating the number of wave in handles |
| 110 | or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 111 | or an error is encountered. |
| 112 | |
| 113 | @see PaWinMME_GetStreamInputHandle |
| 114 | */ |
| 115 | int PaWinMME_GetStreamInputHandleCount( PaStream* stream ); |
| 116 | |
| 117 | |
| 118 | /** Retrieve a wave in handle used by a PortAudio WinMME stream. |
| 119 | |
| 120 | @param stream The stream to query. |
| 121 | @param handleIndex The zero based index of the wave in handle to retrieve. This |
| 122 | should be in the range [0, PaWinMME_GetStreamInputHandle(stream)-1]. |
| 123 | |
| 124 | @return A valid wave in handle, or NULL if an error occurred. |
| 125 | |
| 126 | @see PaWinMME_GetStreamInputHandle |
| 127 | */ |
| 128 | HWAVEIN PaWinMME_GetStreamInputHandle( PaStream* stream, int handleIndex ); |
| 129 | |
| 130 | |
| 131 | /** Retrieve the number of wave out handles used by a PortAudio WinMME stream. |
| 132 | Returns zero if the stream is input only. |
| 133 | |
| 134 | @return A non-negative value indicating the number of wave out handles |
| 135 | or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 136 | or an error is encountered. |
| 137 | |
| 138 | @see PaWinMME_GetStreamOutputHandle |
| 139 | */ |
| 140 | int PaWinMME_GetStreamOutputHandleCount( PaStream* stream ); |
| 141 | |
| 142 | |
| 143 | /** Retrieve a wave out handle used by a PortAudio WinMME stream. |
| 144 | |
| 145 | @param stream The stream to query. |
| 146 | @param handleIndex The zero based index of the wave out handle to retrieve. |
| 147 | This should be in the range [0, PaWinMME_GetStreamOutputHandleCount(stream)-1]. |
| 148 | |
| 149 | @return A valid wave out handle, or NULL if an error occurred. |
| 150 | |
| 151 | @see PaWinMME_GetStreamOutputHandleCount |
| 152 | */ |
| 153 | HWAVEOUT PaWinMME_GetStreamOutputHandle( PaStream* stream, int handleIndex ); |
| 154 | |
| 155 | |
| 156 | #ifdef __cplusplus |
| 157 | } |
| 158 | #endif /* __cplusplus */ |
| 159 | |
| 160 | #endif /* PA_WIN_WMME_H */ |