Fork us on GitHub Follow us on Facebook Follow us on Twitter

Ignore:
Timestamp:
2012-07-15T15:25:43Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial
Children:
5cd5079
Parents:
2cc5c835
Message:

Add frame count to event report.

This enables applications to detect underruns.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_audio_pcm.c

    r2cc5c835 r57e8b3b  
    148148}
    149149
    150 int audio_pcm_start_playback(audio_pcm_sess_t *sess, unsigned parts,
     150int audio_pcm_start_playback(audio_pcm_sess_t *sess, unsigned frames,
    151151    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    152152{
    153         if (parts > UINT8_MAX || channels > UINT8_MAX)
     153        if (channels > UINT16_MAX)
    154154                return EINVAL;
    155155        assert((format & UINT16_MAX) == format);
    156         const sysarg_t packed =
    157             (parts << 24) | (channels << 16) | (format & UINT16_MAX);
    158         async_exch_t *exch = async_exchange_begin(sess);
    159         const int ret = async_req_3_0(exch,
     156        const sysarg_t packed = (channels << 16) | (format & UINT16_MAX);
     157        async_exch_t *exch = async_exchange_begin(sess);
     158        const int ret = async_req_4_0(exch,
    160159            DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
    161160            IPC_M_AUDIO_PCM_START_PLAYBACK,
    162             sample_rate, packed);
     161            frames, sample_rate, packed);
    163162        async_exchange_end(exch);
    164163        return ret;
     
    175174}
    176175
    177 int audio_pcm_start_record(audio_pcm_sess_t *sess, unsigned parts,
     176int audio_pcm_start_record(audio_pcm_sess_t *sess, unsigned frames,
    178177    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    179178{
    180         if (parts > UINT8_MAX || channels > UINT8_MAX)
     179        if (channels > UINT16_MAX)
    181180                return EINVAL;
    182181        assert((format & UINT16_MAX) == format);
    183         const sysarg_t packed =
    184             (parts << 24) | (channels << 16) | (format & UINT16_MAX);
    185         async_exch_t *exch = async_exchange_begin(sess);
    186         const int ret = async_req_3_0(exch,
     182        const sysarg_t packed = (channels << 16) | (format & UINT16_MAX);
     183        async_exch_t *exch = async_exchange_begin(sess);
     184        const int ret = async_req_4_0(exch,
    187185            DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_START_RECORD,
    188             sample_rate, packed);
     186            frames, sample_rate, packed);
    189187        async_exchange_end(exch);
    190188        return ret;
     
    345343        const audio_pcm_iface_t *pcm_iface = iface;
    346344
    347         const unsigned rate = DEV_IPC_GET_ARG1(*call);
    348         const unsigned parts = (DEV_IPC_GET_ARG2(*call) >> 24) & UINT8_MAX;
    349         const unsigned channels = (DEV_IPC_GET_ARG2(*call) >> 16) & UINT8_MAX;
    350         const pcm_sample_format_t format = DEV_IPC_GET_ARG2(*call) & UINT16_MAX;
     345        const unsigned frames = DEV_IPC_GET_ARG1(*call);
     346        const unsigned rate = DEV_IPC_GET_ARG2(*call);
     347        const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT8_MAX;
     348        const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX;
    351349
    352350        const int ret = pcm_iface->start_playback
    353             ? pcm_iface->start_playback(fun, parts, channels, rate, format)
     351            ? pcm_iface->start_playback(fun, frames, channels, rate, format)
    354352            : ENOTSUP;
    355353        async_answer_0(callid, ret);
     
    371369        const audio_pcm_iface_t *pcm_iface = iface;
    372370
    373         const unsigned rate = DEV_IPC_GET_ARG1(*call);
    374         const unsigned parts = (DEV_IPC_GET_ARG2(*call) >> 24) & UINT8_MAX;
    375         const unsigned channels = (DEV_IPC_GET_ARG2(*call) >> 16) & UINT8_MAX;
    376         const pcm_sample_format_t format = DEV_IPC_GET_ARG2(*call) & UINT16_MAX;
     371        const unsigned frames = DEV_IPC_GET_ARG1(*call);
     372        const unsigned rate = DEV_IPC_GET_ARG2(*call);
     373        const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT16_MAX;
     374        const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX;
    377375
    378376        const int ret = pcm_iface->start_record
    379             ? pcm_iface->start_record(fun, parts, channels, rate, format)
     377            ? pcm_iface->start_record(fun, frames, channels, rate, format)
    380378            : ENOTSUP;
    381379        async_answer_0(callid, ret);
Note: See TracChangeset for help on using the changeset viewer.