I don't use portmixer, but I know I would be more likely to if it was
included in PA. Does portMixer integrate well with v19? Does it make
sense to merge to projects altogether?
I don't know how it interactis with V19. For WMME it needs a pointer to the PA
stream. For OSS it works independently. There is no ALSA support in the
version I have but maybe it's been added in other forks. I also have mac_core
support but I've never tried it.
Yes, it might make sense to integrate mixer/volume control into PA, if the
various maintainers of the platform implementations don't mind supporting it.
Generally it ought to be pretty easy to implement mixer control, just a few
functions (if we simplify PortMixer API from what it is now).
The API looks like this, it could probably be simplified a lot. Normally all you
care about is 2 levels: output and input. If each is associated with a PA
stream, then you can just create multiple PxMixer* handles for each stream (i.e.
each input/output channel set), then you wouldn't need the functions to select
different input channels etc. RecordLevel and InputGain should be merged into
one, as should the different output volume functions (maybe retaining master
volume to adjust the global system volume).
typedef void PxMixer;
typedef float PxVolume; /* 0.0 (min) --> 1.0 (max) */
typedef float PxBalance; /* -1.0 (left) --> 1.0 (right) */
PxMixer *Px_OpenMixer( void *pa_stream, int i );
void Px_CloseMixer(PxMixer *mixer);
// I added this function, for OSS you can use a NULL pa_stream in
// Px_OpenMixer(): (-reed)
int Px_PortAudioStreamRequired();
// never used these: (-reed)
int Px_GetNumMixers( void *pa_stream );
const char *Px_GetMixerName( void *pa_stream, int i );
// I use these functions a lot: (-reed)
PxVolume Px_GetMasterVolume( PxMixer *mixer );
void Px_SetMasterVolume( PxMixer *mixer, PxVolume volume );
// I use these too. The two concepts (RecordLevel and InputGain) could
// maybe be merged into one. I use RecordLevel if supported, else InputGain.
// (-reed)
int Px_SupportsRecordLevel(PxMixer *mixer);
PxVolume Px_GetRecordLevel(PxMixer *mixer);
void Px_SetRecordLevel(PxMixer *mixer, PxVolume volume);
int Px_SupportsInputGain(PxMixer *mixer);
PxVolume Px_GetInputGain(PxMixer *mixer);
void Px_SetInputGain(PxMixer *mixer, PxVolume volume);
// I don't use these, they seem sort of redundant or maybe platform-specific
// compared to the above functions, and could be merged in with the above
// functions or removed (the user will always have operating system tools to
// do things like set playthrough, and the information about input sources
// can be via PortAudio): (-reed)
PxVolume Px_GetPCMOutputVolume( PxMixer *mixer );
void Px_SetPCMOutputVolume( PxMixer *mixer, PxVolume volume );
int Px_SupportsPCMOutputVolume( PxMixer* mixer ) ;
int Px_GetNumOutputVolumes( PxMixer *mixer );
const char *Px_GetOutputVolumeName( PxMixer *mixer, int i );
PxVolume Px_GetOutputVolume( PxMixer *mixer, int i );
void Px_SetOutputVolume( PxMixer *mixer, int i, PxVolume volume );
int Px_GetNumInputSources( PxMixer *mixer );
const char *Px_GetInputSourceName( PxMixer *mixer, int i);
int Px_GetCurrentInputSource( PxMixer *mixer ); /* may return -1 == none */
void Px_SetCurrentInputSource( PxMixer *mixer, int i );
PxVolume Px_GetInputVolume( PxMixer *mixer );
void Px_SetInputVolume( PxMixer *mixer, PxVolume volume );
int Px_SupportsOutputBalance( PxMixer *mixer );
PxBalance Px_GetOutputBalance( PxMixer *mixer );
void Px_SetOutputBalance( PxMixer *mixer, PxBalance balance );
int Px_SupportsPlaythrough( PxMixer *mixer );
PxVolume Px_GetPlaythrough( PxMixer *mixer );
void Px_SetPlaythrough( PxMixer *mixer, PxVolume volume );
Reed