summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-core-pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-core-pcm.c')
-rw-r--r--plugins/alsa/alsa-core-pcm.c140
1 files changed, 70 insertions, 70 deletions
diff --git a/plugins/alsa/alsa-core-pcm.c b/plugins/alsa/alsa-core-pcm.c
index a45d463..3ef6012 100644
--- a/plugins/alsa/alsa-core-pcm.c
+++ b/plugins/alsa/alsa-core-pcm.c
@@ -98,7 +98,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
const char * modeS = mode==SND_PCM_STREAM_PLAYBACK?"PLAYBACK":"CAPTURE";
- AFB_ApiDebug(mixer->api,
+ AFB_API_DEBUG(mixer->api,
"%s: mixer info %s uid %s, pcm %s, mode %s",
__func__, mixer->info, mixer->uid, card, modeS);
@@ -106,11 +106,11 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
snd_pcm_hw_params_alloca(&pxmHwParams);
error = snd_pcm_hw_params_any(pcm->handle, pxmHwParams);
if (error < 0) {
- AFB_ApiError(mixer->api, "%s: Failed to get parameters: %s", __func__, snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Failed to get parameters: %s", __func__, snd_strerror(error));
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api, "(%s): PARAMS before:", card);
+ AFB_API_DEBUG(mixer->api, "(%s): PARAMS before:", card);
AlsaDumpPcmParams(mixer, pxmHwParams);
if (!opts->access)
@@ -119,7 +119,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
snd_pcm_hw_params_get_access(pxmHwParams, &access);
error = snd_pcm_hw_params_set_access(pcm->handle, pxmHwParams, opts->access);
if (error) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s) set_access failed (ignore this error): mixer=%s access=%d Fail current=%d mode error=%s",
__func__, card, mixer->uid, opts->access, access, snd_strerror(error));
//Fulup goto OnErrorExit;
@@ -128,7 +128,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
if (opts->format != SND_PCM_FORMAT_UNKNOWN) {
snd_pcm_hw_params_get_format(pxmHwParams, &format);
if ((error = snd_pcm_hw_params_set_format(pcm->handle, pxmHwParams, opts->format)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s) mixer=%s Set_Format=%s (%d) FAILED current=%d error=%s",
__func__, card, mixer->uid, opts->formatString, opts->format, format, snd_strerror(error));
AlsaDumpFormats(mixer, pcm->handle);
@@ -138,12 +138,12 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
if (opts->rate > 0 ) {
- AFB_ApiDebug(mixer->api,"%s (%s): set rate to %d", __func__, card, opts->rate);
+ AFB_API_DEBUG(mixer->api,"%s (%s): set rate to %d", __func__, card, opts->rate);
unsigned int pcmRate = opts->rate;
/* Attempt to set the rate. Failing on a capture dev is acceptable */
error = snd_pcm_hw_params_set_rate_near(pcm->handle, pxmHwParams, &opts->rate, 0);
if ( mode == SND_PCM_STREAM_PLAYBACK && error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s FailSet_Rate=%d error=%s",
__func__, card, mixer->uid, opts->rate, snd_strerror(error));
goto OnErrorExit;
@@ -151,7 +151,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
// check we got requested rate
if (mode == SND_PCM_STREAM_PLAYBACK && opts->rate != pcmRate) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Set_Rate Fail ask=%dHz get=%dHz",
__func__, card, mixer->uid, pcmRate, opts->rate);
goto OnErrorExit;
@@ -160,7 +160,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
if (opts->channels) {
if ((error = snd_pcm_hw_params_set_channels(pcm->handle, pxmHwParams, opts->channels)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Set_Channels=%d Fail error=%s",
__func__, card, mixer->uid, opts->channels, snd_strerror(error));
goto OnErrorExit;
@@ -179,7 +179,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
error = snd_pcm_hw_params_get_buffer_time_max(pxmHwParams, &buffer_time, 0);
- AFB_ApiDebug(mixer->api, "(%s) HW_BUFFER_TIME MAX is %d", card, buffer_time);
+ AFB_API_DEBUG(mixer->api, "(%s) HW_BUFFER_TIME MAX is %d", card, buffer_time);
if (buffer_time > 500000)
buffer_time = 500000;
@@ -192,31 +192,31 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
}
if (period_time > 0) {
- AFB_ApiDebug(mixer->api, "(%s) SET PERIOD TIME to %d", card, period_time);
+ AFB_API_DEBUG(mixer->api, "(%s) SET PERIOD TIME to %d", card, period_time);
error = snd_pcm_hw_params_set_period_time_near(pcm->handle, pxmHwParams, &period_time, 0);
}
else {
- AFB_ApiDebug(mixer->api, "(%s) SET PERIOD SIZE...", card);
+ AFB_API_DEBUG(mixer->api, "(%s) SET PERIOD SIZE...", card);
error = snd_pcm_hw_params_set_period_size_near(pcm->handle, pxmHwParams, &period_frames, 0);
}
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail to set period in hwparams error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
}
if (buffer_time > 0) {
- AFB_ApiDebug(mixer->api, "(%s) SET BUFFER TIME to %d", card, buffer_time);
+ AFB_API_DEBUG(mixer->api, "(%s) SET BUFFER TIME to %d", card, buffer_time);
error = snd_pcm_hw_params_set_buffer_time_near(pcm->handle, pxmHwParams, &buffer_time, 0);
} else {
- AFB_ApiDebug(mixer->api, "(%s) SET BUFFER SIZE to %ld...", card, buffer_frames);
+ AFB_API_DEBUG(mixer->api, "(%s) SET BUFFER SIZE to %ld...", card, buffer_frames);
error = snd_pcm_hw_params_set_buffer_size_near(pcm->handle, pxmHwParams, &buffer_frames);
}
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail to set buffer in hwparams error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
@@ -224,13 +224,13 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
// store selected values
if ((error = snd_pcm_hw_params(pcm->handle, pxmHwParams)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail to apply hwparams error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api, "(%s) PARAMS after:", card);
+ AFB_API_DEBUG(mixer->api, "(%s) PARAMS after:", card);
AlsaDumpPcmParams(mixer, pxmHwParams);
// check we effective hw params after optional format change
@@ -238,11 +238,11 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
snd_pcm_hw_params_get_format(pxmHwParams, &opts->format);
snd_pcm_hw_params_get_rate(pxmHwParams, &opts->rate, 0);
- AFB_ApiDebug(mixer->api, "(%s) rate is %d", card, opts->rate);
+ AFB_API_DEBUG(mixer->api, "(%s) rate is %d", card, opts->rate);
opts->sampleSize = AlsaPeriodSize(opts->format);
if (opts->sampleSize == 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail unsupported format format=%d",
__func__, card, mixer->uid, opts->format);
goto OnErrorExit;
@@ -253,7 +253,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
snd_pcm_hw_params_get_period_size(pxmHwParams, &chunk_size, 0);
snd_pcm_hw_params_get_buffer_size(pxmHwParams, &buffer_size);
if (chunk_size == buffer_size) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"(%s) Can't use period equal to buffer size (%lu == %lu)",
card, chunk_size, buffer_size);
goto OnErrorExit;
@@ -276,7 +276,7 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
// when the call to poll returns. Assume this is the same for playback (not checked that)
if ((error = snd_pcm_sw_params_set_avail_min(pcm->handle, pxmSwParams, n)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail set_buffersize error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
@@ -299,16 +299,16 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
if (start_threshold > n/2)
start_threshold = n/2;
- AFB_ApiDebug(mixer->api, "(%s) CALCULATED START THRESHOLD: %ld", card, start_threshold);
+ AFB_API_DEBUG(mixer->api, "(%s) CALCULATED START THRESHOLD: %ld", card, start_threshold);
if (mode == SND_PCM_STREAM_PLAYBACK) {
start_threshold = 1;
}
- AFB_ApiDebug(mixer->api, "(%s) %s: Set start threshold to %ld", card, modeS, start_threshold);
+ AFB_API_DEBUG(mixer->api, "(%s) %s: Set start threshold to %ld", card, modeS, start_threshold);
error = snd_pcm_sw_params_set_start_threshold(pcm->handle, pxmSwParams, start_threshold);
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s failed set start_threshold, error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
@@ -316,13 +316,13 @@ PUBLIC int AlsaPcmConf(SoftMixerT *mixer, AlsaPcmCtlT *pcm, int mode) {
// push software params into PCM
if ((error = snd_pcm_sw_params(pcm->handle, pxmSwParams)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s (%s): mixer=%s Fail to push SW params error=%s",
__func__, card, mixer->uid, snd_strerror(error));
goto OnErrorExit;
};
- AFB_ApiNotice(mixer->api,
+ AFB_API_NOTICE(mixer->api,
"%s (%s): mixer=%s Done channels=%d rate=%d format=%d access=%d ... DONE !",
__func__, card, mixer->uid, opts->channels, opts->rate, opts->format, opts->access);
return 0;
@@ -346,7 +346,7 @@ STATIC int AlsaPcmReadCB( AlsaPcmCopyHandleT * pcmCopyHandle) {
if (availIn <= 0) {
if (availIn == -EPIPE) {
int ret = xrun(pcmIn, (int)availIn);
- AFB_ApiDebug(pcmCopyHandle->api, "XXX read EPIPE (recov=%d) {%s}!", ret, ALSA_PCM_UID(pcmIn, string));
+ AFB_API_DEBUG(pcmCopyHandle->api, "XXX read EPIPE (recov=%d) {%s}!", ret, ALSA_PCM_UID(pcmIn, string));
// For some (undocumented...) reason, a start is mandatory.
snd_pcm_start(pcmIn);
@@ -383,10 +383,10 @@ STATIC int AlsaPcmReadCB( AlsaPcmCopyHandleT * pcmCopyHandle) {
if (nbRead < 0) {
if (nbRead== -EPIPE) {
err = xrun(pcmIn, (int)nbRead);
- AFB_ApiDebug(pcmCopyHandle->api, "read EPIPE (%d), recov %d", ++pcmCopyHandle->read_err_count, err);
+ AFB_API_DEBUG(pcmCopyHandle->api, "read EPIPE (%d), recov %d", ++pcmCopyHandle->read_err_count, err);
goto ExitOnSuccess;
} else if (nbRead== -ESTRPIPE) {
- AFB_ApiDebug(pcmCopyHandle->api, "read ESTRPIPE");
+ AFB_API_DEBUG(pcmCopyHandle->api, "read ESTRPIPE");
if ((err = suspend(pcmIn, (int)nbRead)) < 0)
goto ExitOnSuccess;
nbRead = 0;
@@ -448,7 +448,7 @@ static void readSuspend(AlsaPcmCopyHandleT * pcmCopyHandle) {
pcmCopyHandle->saveFd = pcmCopyHandle->pollFds[1].fd;
pcmCopyHandle->pollFds[1].fd = -1;
- AFB_ApiNotice(pcmCopyHandle->api, "capture muted");
+ AFB_API_NOTICE(pcmCopyHandle->api, "capture muted");
}
static void readResume(AlsaPcmCopyHandleT * pcmCopyHandle) {
@@ -457,7 +457,7 @@ static void readResume(AlsaPcmCopyHandleT * pcmCopyHandle) {
pcmCopyHandle->pollFds[1].fd = pcmCopyHandle->saveFd;
snd_pcm_prepare(pcmCopyHandle->pcmIn->handle);
snd_pcm_start(pcmCopyHandle->pcmIn->handle);
- AFB_ApiNotice(pcmCopyHandle->api, "capture unmuted");
+ AFB_API_NOTICE(pcmCopyHandle->api, "capture unmuted");
}
@@ -468,7 +468,7 @@ static void *readThreadEntry(void *handle) {
pcmCopyHandle->tid = (int) syscall(SYS_gettid);
int ix;
- AFB_ApiNotice(pcmCopyHandle->api,
+ AFB_API_NOTICE(pcmCopyHandle->api,
"%s :%s/%d Started, muted=%d",
__func__, pcmCopyHandle->info, pcmCopyHandle->tid, pcmCopyHandle->pcmIn->mute);
@@ -492,13 +492,13 @@ static void *readThreadEntry(void *handle) {
int err = poll(pcmCopyHandle->pollFds, pcmCopyHandle->nbPcmFds, LOOP_TIMEOUT_MSEC);
if (err < 0) {
- AFB_ApiError(pcmCopyHandle->api, "%s: poll err %s", __func__, strerror(errno));
+ AFB_API_ERROR(pcmCopyHandle->api, "%s: poll err %s", __func__, strerror(errno));
continue;
}
if (err == 0) {
/* timeout */
-// AFB_ApiDebug(pcmCopyHandle->api, "%s(%s) alive, mute %d", __func__, pcmCopyHandle->pcmIn->cid.cardid, muted );
+// AFB_API_DEBUG(pcmCopyHandle->api, "%s(%s) alive, mute %d", __func__, pcmCopyHandle->pcmIn->cid.cardid, muted );
continue;
}
@@ -524,12 +524,12 @@ static void *readThreadEntry(void *handle) {
};
break;
case PCM_COPY_END:
- AFB_ApiDebug(pcmCopyHandle->api, "%s ending -> EXIT", __func__);
+ AFB_API_DEBUG(pcmCopyHandle->api, "%s ending -> EXIT", __func__);
goto done;
break;
case PCM_COPY_LAST:
default:
- AFB_ApiError(pcmCopyHandle->api, "%s: Unexpected event 0x%x", __func__, event.eventType);
+ AFB_API_ERROR(pcmCopyHandle->api, "%s: Unexpected event 0x%x", __func__, event.eventType);
break;
}
continue;
@@ -545,7 +545,7 @@ static void *readThreadEntry(void *handle) {
}
if (revents & POLLHUP) {
- AFB_ApiNotice(pcmCopyHandle->api, "Frame POLLHUP");
+ AFB_API_NOTICE(pcmCopyHandle->api, "Frame POLLHUP");
continue;
}
@@ -589,7 +589,7 @@ static void *writeThreadEntry(void *handle) {
while (true) {
if (pcmCopyHandle->ending) {
- AFB_ApiDebug(pcmCopyHandle->api, "%s: ending -> EXIT", __func__);
+ AFB_API_DEBUG(pcmCopyHandle->api, "%s: ending -> EXIT", __func__);
goto done;
}
@@ -598,12 +598,12 @@ static void *writeThreadEntry(void *handle) {
if (availOut < 0) {
if (availOut == -EPIPE) {
- AFB_ApiDebug(pcmCopyHandle->api, "%s: write update EPIPE", cardid);
+ AFB_API_DEBUG(pcmCopyHandle->api, "%s: write update EPIPE", cardid);
xrun(pcmOut, (int)availOut);
continue;
}
if (availOut == -ESTRPIPE) {
- AFB_ApiDebug(pcmCopyHandle->api, "%s: write update ESTRPIPE", cardid);
+ AFB_API_DEBUG(pcmCopyHandle->api, "%s: write update ESTRPIPE", cardid);
suspend(pcmOut, (int)availOut);
continue;
}
@@ -633,15 +633,15 @@ static void *writeThreadEntry(void *handle) {
if (nbWritten <= 0) {
if (nbWritten == -EPIPE) {
int err = xrun(pcmOut, (int)nbWritten);
- AFB_ApiDebug(pcmCopyHandle->api, "XXX %s write EPIPE (%d), recov %d",
+ AFB_API_DEBUG(pcmCopyHandle->api, "XXX %s write EPIPE (%d), recov %d",
pcmCopyHandle->pcmOut->cid.cardid, ++pcmCopyHandle->write_err_count , err);
continue;
} else if (nbWritten == -ESTRPIPE) {
- AFB_ApiDebug(pcmCopyHandle->api, "XXX write ESTRPIPE");
+ AFB_API_DEBUG(pcmCopyHandle->api, "XXX write ESTRPIPE");
break;
}
- AFB_ApiDebug(pcmCopyHandle->api, "Unhandled error %s", strerror(errno));
+ AFB_API_DEBUG(pcmCopyHandle->api, "Unhandled error %s", strerror(errno));
break;
}
@@ -684,17 +684,17 @@ static int AlsaPcmCopyEnd(SoftMixerT *mixer, AlsaPcmCopyHandleT * handle) {
PUBLIC int AlsaPcmCopyStop(SoftMixerT *mixer, AlsaPcmCopyHandleT * handle) {
- AFB_ApiDebug(mixer->api, "%s: Stopping copy threads of %s", __func__, handle->stream->uid);
+ AFB_API_DEBUG(mixer->api, "%s: Stopping copy threads of %s", __func__, handle->stream->uid);
AlsaPcmCopyEnd(mixer, handle);
if (pthread_join(handle->wthread, NULL) != 0)
- AFB_ApiDebug(mixer->api, "%s: Failed to join write thread", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: Failed to join write thread", __func__);
if (pthread_join(handle->rthread, NULL) != 0)
- AFB_ApiDebug(mixer->api, "%s: Failed to join read thread", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: Failed to join read thread", __func__);
- AFB_ApiDebug(mixer->api, "%s: Copy threads of %s are STOPPED", __func__, handle->stream->uid);
+ AFB_API_DEBUG(mixer->api, "%s: Copy threads of %s are STOPPED", __func__, handle->stream->uid);
sem_destroy(&handle->sem);
@@ -735,45 +735,45 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
pcmIn->mixer = mixer;
pcmOut->mixer = mixer;
- AFB_ApiDebug(mixer->api, "%s: Configure CAPTURE PCM", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: Configure CAPTURE PCM", __func__);
// prepare PCM for capture and replay
error = AlsaPcmConf(mixer, pcmIn, SND_PCM_STREAM_CAPTURE);
if (error) {
- AFB_ApiError(mixer->api, "%s: PCM configuration for capture failed", __func__);
+ AFB_API_ERROR(mixer->api, "%s: PCM configuration for capture failed", __func__);
goto OnErrorExit;
}
- AFB_ApiDebug(mixer->api, "%s: Configure PLAYBACK PCM", __func__);
+ AFB_API_DEBUG(mixer->api, "%s: Configure PLAYBACK PCM", __func__);
// input and output should match
error = AlsaPcmConf(mixer, pcmOut, SND_PCM_STREAM_PLAYBACK);
if (error) {
- AFB_ApiError(mixer->api, "%s: PCM configuration for playback failed", __func__);
+ AFB_API_ERROR(mixer->api, "%s: PCM configuration for playback failed", __func__);
goto OnErrorExit;
}
// Prepare PCM for usage
if ((error = snd_pcm_prepare(pcmOut->handle)) < 0) {
- AFB_ApiError(mixer->api, "%s: Fail to prepare PLAYBACK PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Fail to prepare PLAYBACK PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
goto OnErrorExit;
};
// Prepare PCM for usage
if ((error = snd_pcm_prepare(pcmIn->handle)) < 0) {
- AFB_ApiError(mixer->api, "%s: Fail to prepare CAPTURE PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Fail to prepare CAPTURE PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
goto OnErrorExit;
};
// Start PCM
if ((error = snd_pcm_start(pcmOut->handle)) < 0) {
- AFB_ApiError(mixer->api, "%s: Fail to start PLAYBACK PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Fail to start PLAYBACK PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
goto OnErrorExit;
};
// Start PCM
if ((error = snd_pcm_start(pcmIn->handle)) < 0) {
- AFB_ApiError(mixer->api, "%s: Fail to start CAPTURE PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
+ AFB_API_ERROR(mixer->api, "%s: Fail to start CAPTURE PCM=%s error=%s", __func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
goto OnErrorExit;
};
@@ -791,8 +791,8 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
cHandle->stream = stream;
cHandle->frame_size = (snd_pcm_format_physical_width(opts->format) / 8) * opts->channels;
- AFB_ApiDebug(mixer->api, "%s: Frame size is %zu", __func__, cHandle->frame_size);
- AFB_ApiDebug(mixer->api, "%s: Buffer delay is %d ms", __func__, stream->delayms);
+ AFB_API_DEBUG(mixer->api, "%s: Frame size is %zu", __func__, cHandle->frame_size);
+ AFB_API_DEBUG(mixer->api, "%s: Buffer delay is %d ms", __func__, stream->delayms);
snd_pcm_uframes_t nbFrames = (stream->delayms * opts->rate)/1000;
@@ -805,12 +805,12 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
cHandle->read_err_count = 0;
cHandle->write_err_count = 0;
- AFB_ApiDebug(mixer->api, "%s Copy buffer: nbframes is %zu", __func__, nbFrames);
+ AFB_API_DEBUG(mixer->api, "%s Copy buffer: nbframes is %zu", __func__, nbFrames);
// get FD poll descriptor for capture PCM
int pcmInCount = snd_pcm_poll_descriptors_count(pcmIn->handle);
if (pcmInCount <= 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: Fail pcmIn=%s get fds count error=%s",
__func__, ALSA_PCM_UID(pcmIn->handle, string), snd_strerror(error));
goto OnErrorExit;
@@ -824,7 +824,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
}
if ((error = snd_pcm_poll_descriptors(pcmIn->handle, cHandle->pollFds+1, pcmInCount)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s: Fail pcmIn=%s get pollfds error=%s",
__func__, ALSA_PCM_UID(pcmOut->handle, string), snd_strerror(error));
goto OnErrorExit;
@@ -834,7 +834,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
int eventFdPipe[2];
error = pipe(eventFdPipe);
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"Unable to create the mute signaling pipe");
goto OnErrorExit;
}
@@ -850,7 +850,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
error = sem_init(&cHandle->sem, 0 , 0);
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s Fail initialize loop semaphore pcmIn=%s err=%d",
__func__, ALSA_PCM_UID(pcmIn->handle, string), error);
goto OnErrorExit;
@@ -862,7 +862,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
error = pthread_mutex_init(&cHandle->mutex, &attr);
if (error < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s Fail initialize loop mutex pcmIn=%s err=%d",
__func__, ALSA_PCM_UID(pcmIn->handle, string), error);
}
@@ -870,7 +870,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
/// start a thread for writing
if ((error = pthread_create(&cHandle->wthread, NULL, &readThreadEntry, cHandle)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s Fail create write thread pcmOut=%s err=%d",
__func__, ALSA_PCM_UID(pcmOut->handle, string), error);
goto OnErrorExit;
@@ -878,7 +878,7 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
// start a thread for reading
if ((error = pthread_create(&cHandle->rthread, NULL, &writeThreadEntry, cHandle)) < 0) {
- AFB_ApiError(mixer->api,
+ AFB_API_ERROR(mixer->api,
"%s Fail create read thread pcmIn=%s err=%d",
__func__, ALSA_PCM_UID(pcmIn->handle, string), error);
goto OnErrorExit;
@@ -890,14 +890,14 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
error= pthread_setschedparam(cHandle->rthread, SCHED_FIFO, &params);
if (error) {
- AFB_ApiWarning(mixer->api,
+ AFB_API_WARNING(mixer->api,
"%s: Failed to increase stream read thread priority pcmIn=%s err=%s",
__func__, ALSA_PCM_UID(pcmIn->handle, string), strerror(error));
}
error= pthread_setschedparam(cHandle->wthread, SCHED_FIFO, &params);
if (error) {
- AFB_ApiWarning(mixer->api,
+ AFB_API_WARNING(mixer->api,
"%s: Failed to increase stream write thread priority pcmIn=%s err=%s",
__func__, ALSA_PCM_UID(pcmOut->handle, string), strerror(error));
}
@@ -907,8 +907,8 @@ PUBLIC int AlsaPcmCopyStart(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcm
return 0;
OnErrorExit:
- AFB_ApiError(mixer->api, "%s: - pcmIn=%s" , __func__, ALSA_PCM_UID(pcmIn->handle, string));
- AFB_ApiError(mixer->api, "%s: - pcmOut=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string));
+ AFB_API_ERROR(mixer->api, "%s: - pcmIn=%s" , __func__, ALSA_PCM_UID(pcmIn->handle, string));
+ AFB_API_ERROR(mixer->api, "%s: - pcmOut=%s", __func__, ALSA_PCM_UID(pcmOut->handle, string));
if (cHandle &&cHandle->pollFds) {
free (cHandle->pollFds);