| 1 | #ifndef PORT_MIXER_H |
| 2 | #define PORT_MIXER_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" |
| 6 | { |
| 7 | #endif /* __cplusplus */ |
| 8 | |
| 9 | |
| 10 | /* |
| 11 | * PortMixer |
| 12 | * PortMixer API Header File |
| 13 | * |
| 14 | * Copyright (c) 2002 |
| 15 | * |
| 16 | * Written by Dominic Mazzoni |
| 17 | * |
| 18 | * PortMixer is intended to work side-by-side with PortAudio, |
| 19 | * the Portable Real-Time Audio Library by Ross Bencina and |
| 20 | * Phil Burk. |
| 21 | * |
| 22 | * Permission is hereby granted, free of charge, to any person obtaining |
| 23 | * a copy of this software and associated documentation files |
| 24 | * (the "Software"), to deal in the Software without restriction, |
| 25 | * including without limitation the rights to use, copy, modify, merge, |
| 26 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 27 | * and to permit persons to whom the Software is furnished to do so, |
| 28 | * subject to the following conditions: |
| 29 | * |
| 30 | * The above copyright notice and this permission notice shall be |
| 31 | * included in all copies or substantial portions of the Software. |
| 32 | * |
| 33 | * Any person wishing to distribute modifications to the Software is |
| 34 | * requested to send the modifications to the original developer so that |
| 35 | * they can be incorporated into the canonical version. |
| 36 | * |
| 37 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 38 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 39 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 40 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR |
| 41 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
| 42 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 43 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 44 | * |
| 45 | */ |
| 46 | |
| 47 | #include "portaudio.h" |
| 48 | |
| 49 | typedef void PxMixer; |
| 50 | |
| 51 | typedef float PxVolume; /* 0.0 (min) --> 1.0 (max) */ |
| 52 | typedef float PxBalance; /* -1.0 (left) --> 1.0 (right) */ |
| 53 | |
| 54 | /* |
| 55 | Px_GetNumMixers returns the number of mixers which could be |
| 56 | used with the given PortAudio device. On most systems, there |
| 57 | will be only one mixer for each device; however there may be |
| 58 | multiple mixers for each device, or possibly multiple mixers |
| 59 | which are independent of any particular PortAudio device. |
| 60 | */ |
| 61 | |
| 62 | int Px_GetNumMixers( void *pa_stream ); |
| 63 | const char *Px_GetMixerName( void *pa_stream, int i ); |
| 64 | |
| 65 | /* |
| 66 | Px_OpenMixer() returns a mixer which will work with the given PortAudio |
| 67 | audio device. Pass 0 as the index for the first (default) mixer. |
| 68 | */ |
| 69 | |
| 70 | PxMixer *Px_OpenMixer( void *pa_stream, int i ); |
| 71 | |
| 72 | /* |
| 73 | Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any |
| 74 | memory associated with it. |
| 75 | */ |
| 76 | |
| 77 | void Px_CloseMixer(PxMixer *mixer); |
| 78 | |
| 79 | /* |
| 80 | Master (output) volume |
| 81 | */ |
| 82 | |
| 83 | PxVolume Px_GetMasterVolume( PxMixer *mixer ); |
| 84 | void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume ); |
| 85 | |
| 86 | /* |
| 87 | Main output volume |
| 88 | */ |
| 89 | |
| 90 | PxVolume Px_GetPCMOutputVolume( PxMixer *mixer ); |
| 91 | void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume ); |
| 92 | int Px_SupportsPCMOutputVolume( PxMixer* mixer ) ; |
| 93 | |
| 94 | /* |
| 95 | All output volumes |
| 96 | */ |
| 97 | |
| 98 | int Px_GetNumOutputVolumes( PxMixer *mixer ); |
| 99 | const char *Px_GetOutputVolumeName( PxMixer *mixer, int i ); |
| 100 | PxVolume Px_GetOutputVolume( PxMixer *mixer, int i ); |
| 101 | void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume ); |
| 102 | |
| 103 | /* |
| 104 | Input source |
| 105 | */ |
| 106 | |
| 107 | int Px_GetNumInputSources( PxMixer *mixer ); |
| 108 | const char *Px_GetInputSourceName( PxMixer *mixer, int i); |
| 109 | int Px_GetCurrentInputSource( PxMixer *mixer ); /* may return -1 == none */ |
| 110 | void Px_SetCurrentInputSource( PxMixer *mixer, int i ); |
| 111 | |
| 112 | /* |
| 113 | Input volume |
| 114 | */ |
| 115 | |
| 116 | PxVolume Px_GetInputVolume( PxMixer *mixer ); |
| 117 | void Px_SetInputVolume( PxMixer *mixer, PxVolume volume ); |
| 118 | |
| 119 | /* |
| 120 | Balance |
| 121 | */ |
| 122 | |
| 123 | int Px_SupportsOutputBalance( PxMixer *mixer ); |
| 124 | PxBalance Px_GetOutputBalance( PxMixer *mixer ); |
| 125 | void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance ); |
| 126 | |
| 127 | /* |
| 128 | Playthrough |
| 129 | */ |
| 130 | |
| 131 | int Px_SupportsPlaythrough( PxMixer *mixer ); |
| 132 | PxVolume Px_GetPlaythrough( PxMixer *mixer ); |
| 133 | void Px_SetPlaythrough( PxMixer *mixer, PxVolume volume ); |
| 134 | |
| 135 | /* |
| 136 | toggle microphone boost function |
| 137 | */ |
| 138 | |
| 139 | /* returns 0 on success, 1 on failure, -1 if not available */ |
| 140 | int Px_SetMicrophoneBoost( PxMixer* mixer, int enable ) ; |
| 141 | int Px_GetMicrophoneBoost( PxMixer* mixer ) ; |
| 142 | |
| 143 | /* |
| 144 | set input source by name |
| 145 | */ |
| 146 | |
| 147 | /* returns 0 on sucess, 1 on failure */ |
| 148 | int Px_SetCurrentInputSourceByName( PxMixer* mixer, const char* line_name ) ; |
| 149 | |
| 150 | |
| 151 | #ifdef __cplusplus |
| 152 | } |
| 153 | #endif /* __cplusplus */ |
| 154 | #endif /* PORT_AUDIO_H */ |