28,7 → 28,7 |
// Tuneable Settings // |
/////////////////////////////////////////////////////////////////////////////// |
|
#define VERSION "0.93" |
#define VERSION "0.94" |
|
// |
// Number of soundcard bytes to read at a time. |
79,9 → 79,20 |
|
// Mixer gain settings requested by config file. |
int req_lgain = -1; // Line gain |
int req_mgain = -1; // Microphone gain |
int req_igain = -1; // Input gain |
int req_rgain = -1; // Record level |
|
|
// Actual mixer values, read by open_mixer() |
int mixer_recmask; // Recording device mask |
int mixer_stereo; // Stereo device mask |
int mixer_line; // Line input gain setting |
int mixer_microphone; // Microphone input gain |
int mixer_igain; // Overall input gain setting |
int mixer_reclev; // Recording level setting |
int mixer_recsrc; // Mask indicating which inputs are set to record |
|
// |
// Various filenames, contents set by config file. |
// |
662,8 → 673,18 |
int right = atoi( fields[3]); |
int gain = (right << 8) | left; |
|
if( !strcasecmp( fields[1], "line")) req_lgain = gain; |
if( !strcasecmp( fields[1], "line")) |
{ |
req_lgain = gain; |
mixer_recsrc = SOUND_MASK_LINE; |
} |
else |
if( !strcasecmp( fields[1], "mic")) |
{ |
req_mgain = gain; |
mixer_recsrc = SOUND_MASK_MIC; |
} |
else |
if( !strcasecmp( fields[1], "overall")) req_igain = gain; |
else |
if( !strcasecmp( fields[1], "record")) req_rgain = gain; |
695,14 → 716,6 |
// Mixer Stuff // |
/////////////////////////////////////////////////////////////////////////////// |
|
// Actual mixer values, read by open_mixer() |
int mixer_recmask; // Recording device mask |
int mixer_stereo; // Stereo device mask |
int mixer_line; // Line input gain setting |
int mixer_igain; // Overall input gain setting |
int mixer_reclev; // Recording level setting |
int mixer_recsrc; // Mask indicating which inputs are set to record |
|
void open_mixer( void) |
{ |
if( (fdm = open( mixer, O_RDWR)) < 0) |
782,6 → 795,19 |
mixer_line & 0xff, (mixer_line >> 8) & 0xff); |
} |
|
if( req_mgain >= 0) |
{ |
report( 1, "requesting microphone input gains left=%d right=%d", |
req_mgain & 0xff, (req_mgain >> 8) & 0xff); |
|
if( ioctl( fdm, SOUND_MIXER_WRITE_MIC, &req_mgain) < 0 || |
ioctl( fdm, SOUND_MIXER_READ_MIC, &mixer_microphone) < 0) |
bailout( "error setting mixer microphone gain"); |
|
report( 1, "Microphone input gains set to: left=%d right=%d", |
mixer_microphone & 0xff, (mixer_microphone >> 8) & 0xff); |
} |
|
if( req_igain >= 0 && |
(mixer_recmask & SOUND_MASK_IGAIN)) |
{ |
810,10 → 836,25 |
mixer_reclev & 0xff, (mixer_reclev >> 8) & 0xff); |
} |
|
mixer_recsrc = SOUND_MASK_LINE; |
//mixer_recsrc= SOUND_MASK_LINE; |
mixer_recsrc= SOUND_MASK_MIC; |
|
switch (mixer_recsrc) |
{ |
case SOUND_MASK_MIC: |
|
if( ioctl( fdm, SOUND_MIXER_WRITE_RECSRC, &mixer_recsrc) < 0) |
bailout( "cannot set mixer recsrc to microphone"); |
else report(1, "Input device set to microphone"); |
break; |
|
case SOUND_MASK_LINE: |
if( ioctl( fdm, SOUND_MIXER_WRITE_RECSRC, &mixer_recsrc) < 0) |
bailout( "cannot set mixer recsrc to line"); |
else report(1, "Input device set to line"); |
break; |
} |
} |
|
/////////////////////////////////////////////////////////////////////////////// |
// Main // |