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

Changeset b497018 in mainline


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

Drop id parameter from audio_pcm interface.

Independent buffer should have separate nodes.

Location:
uspace
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/dplay/dplay.c

    r44d1311 rb497018  
    5757                void *base;
    5858                size_t size;
    59                 unsigned id;
    6059                void* position;
    6160        } buffer;
     
    7170        assert(exch);
    7271        assert(pb);
    73         pb->buffer.id = 0;
    7472        pb->buffer.base = NULL;
    7573        pb->buffer.size = 0;
     
    113111                   buffer_part, pb->source);
    114112                if (bytes == 0) {
    115                         audio_pcm_stop_playback(pb->device, pb->buffer.id);
     113                        audio_pcm_stop_playback(pb->device);
    116114                }
    117115                bzero(pb->buffer.position + bytes, buffer_part - bytes);
     
    138136        printf("Buffer data ready.\n");
    139137        fibril_mutex_lock(&pb->mutex);
    140         int ret = audio_pcm_start_playback(pb->device, pb->buffer.id,
     138        int ret = audio_pcm_start_playback(pb->device,
    141139            SUBBUFFERS, channels, sampling_rate, format);
    142140        if (ret != EOK) {
     
    204202
    205203        ret = audio_pcm_get_buffer(pb.device, &pb.buffer.base,
    206             &pb.buffer.size, &pb.buffer.id, device_event_callback, &pb);
     204            &pb.buffer.size, device_event_callback, &pb);
    207205        if (ret != EOK) {
    208206                printf("Failed to get PCM buffer: %s.\n", str_error(ret));
    209207                goto close_session;
    210208        }
    211         printf("Buffer (%u): %p %zu.\n", pb.buffer.id, pb.buffer.base,
    212             pb.buffer.size);
     209        printf("Buffer: %p %zu.\n", pb.buffer.base, pb.buffer.size);
    213210        uintptr_t ptr = 0;
    214211        as_get_physical_mapping(pb.buffer.base, &ptr);
     
    239236cleanup:
    240237        munmap(pb.buffer.base, pb.buffer.size);
    241         audio_pcm_release_buffer(exch, pb.buffer.id);
     238        audio_pcm_release_buffer(exch);
    242239close_session:
    243240        async_exchange_end(exch);
  • uspace/app/drec/drec.c

    r44d1311 rb497018  
    7272        assert(exch);
    7373        assert(rec);
    74         rec->buffer.id = 0;
    7574        rec->buffer.base = NULL;
    7675        rec->buffer.size = 0;
     
    123122        printf("Recording: %dHz, %s, %d channel(s).\n",
    124123            sampling_rate, pcm_sample_format_str(format), channels);
    125         int ret = audio_pcm_start_record(rec->device, rec->buffer.id,
     124        int ret = audio_pcm_start_record(rec->device,
    126125            SUBBUFFERS, channels, sampling_rate, format);
    127126        if (ret != EOK) {
     
    132131        getchar();
    133132        printf("\n");
    134         audio_pcm_stop_record(rec->device, rec->buffer.id);
     133        audio_pcm_stop_record(rec->device);
    135134}
    136135
     
    186185
    187186        ret = audio_pcm_get_buffer(rec.device, &rec.buffer.base,
    188             &rec.buffer.size, &rec.buffer.id, device_event_callback, &rec);
     187            &rec.buffer.size, device_event_callback, &rec);
    189188        if (ret != EOK) {
    190189                printf("Failed to get PCM buffer: %s.\n", str_error(ret));
    191190                goto close_session;
    192191        }
    193         printf("Buffer (%u): %p %zu.\n", rec.buffer.id, rec.buffer.base,
    194             rec.buffer.size);
     192        printf("Buffer: %p %zu.\n", rec.buffer.base, rec.buffer.size);
    195193        uintptr_t ptr = 0;
    196194        as_get_physical_mapping(rec.buffer.base, &ptr);
     
    222220cleanup:
    223221        munmap(rec.buffer.base, rec.buffer.size);
    224         audio_pcm_release_buffer(exch, rec.buffer.id);
     222        audio_pcm_release_buffer(exch);
    225223close_session:
    226224        async_exchange_end(exch);
  • uspace/drv/audio/sb16/dsp.c

    r44d1311 rb497018  
    4646#include "dsp.h"
    4747
    48 #define BUFFER_ID 1
    4948#define MAX_BUFFER_SIZE (PAGE_SIZE)
    5049
     
    221220}
    222221
    223 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size, unsigned *id)
     222int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
    224223{
    225224        assert(dsp);
     
    233232        const int ret = sb_setup_buffer(dsp, *size);
    234233        if (ret == EOK) {
    235                 ddf_log_debug("Providing buffer(%u): %p, %zu B.",
    236                     BUFFER_ID, dsp->buffer.data, dsp->buffer.size);
     234                ddf_log_debug("Providing buffer: %p, %zu B.",
     235                    dsp->buffer.data, dsp->buffer.size);
    237236
    238237                if (buffer)
     
    240239                if (size)
    241240                        *size = dsp->buffer.size;
    242                 if (id)
    243                         *id = BUFFER_ID;
    244241        }
    245242        return ret;
    246243}
    247244
    248 int sb_dsp_set_event_session(sb_dsp_t *dsp, unsigned id, async_sess_t *session)
     245int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
    249246{
    250247        assert(dsp);
    251248        assert(session);
    252         if (id != BUFFER_ID)
    253                 return ENOENT;
    254249        if (dsp->event_session)
    255250                return EBUSY;
     
    259254}
    260255
    261 int sb_dsp_release_buffer(sb_dsp_t *dsp, unsigned id)
    262 {
    263         assert(dsp);
    264         if (id != BUFFER_ID)
    265                 return ENOENT;
     256int sb_dsp_release_buffer(sb_dsp_t *dsp)
     257{
     258        assert(dsp);
    266259        sb_clear_buffer(dsp);
    267260        async_exchange_end(dsp->event_exchange);
     
    274267}
    275268
    276 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned id, unsigned parts,
     269int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned parts,
    277270    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
    278271{
     
    289282
    290283        /* Check supported parameters */
    291         ddf_log_debug("Requested playback on buffer \"%u\" (%u parts): %uHz, "
    292             "%s, %u channel(s).", id, parts, sampling_rate,
    293             pcm_sample_format_str(format), channels);
    294         if (id != BUFFER_ID)
    295                 return ENOENT;
     284        ddf_log_debug("Requested playback (%u parts): %uHz, %s, %u channel(s).",
     285            parts, sampling_rate, pcm_sample_format_str(format), channels);
    296286        if (channels != 1 && channels != 2)
    297287                return ENOTSUP;
     
    338328}
    339329
    340 int sb_dsp_stop_playback(sb_dsp_t *dsp, unsigned id)
    341 {
    342         assert(dsp);
    343         if (id != BUFFER_ID)
    344                 return ENOENT;
     330int sb_dsp_stop_playback(sb_dsp_t *dsp)
     331{
     332        assert(dsp);
    345333        sb_dsp_write(dsp, DMA_16B_EXIT);
    346         ddf_log_debug("Stopping playback on buffer %u.", id);
     334        ddf_log_debug("Stopping playback on buffer.");
    347335        async_msg_0(dsp->event_exchange, PCM_EVENT_PLAYBACK_TERMINATED);
    348336        async_exchange_end(dsp->event_exchange);
     
    351339}
    352340
    353 int sb_dsp_start_record(sb_dsp_t *dsp, unsigned id, unsigned parts,
     341int sb_dsp_start_record(sb_dsp_t *dsp, unsigned parts,
    354342    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
    355343{
     
    366354
    367355        /* Check supported parameters */
    368         ddf_log_debug("Requested recording on buffer \"%u\" (%u parts): %uHz, "
    369             "%s, %u channel(s).", id, parts, sampling_rate,
    370             pcm_sample_format_str(format), channels);
    371         if (id != BUFFER_ID)
    372                 return ENOENT;
     356        ddf_log_debug("Requested record (%u parts): %uHz, %s, %u channel(s).",
     357            parts, sampling_rate, pcm_sample_format_str(format), channels);
    373358        if (channels != 1 && channels != 2)
    374359                return ENOTSUP;
     
    414399}
    415400
    416 int sb_dsp_stop_record(sb_dsp_t *dsp, unsigned id)
    417 {
    418         assert(dsp);
    419         if (id != BUFFER_ID)
    420                 return ENOENT;
     401int sb_dsp_stop_record(sb_dsp_t *dsp)
     402{
     403        assert(dsp);
    421404        sb_dsp_write(dsp, DMA_16B_EXIT);
    422         ddf_log_debug("Stopping playback on buffer %u.", id);
     405        ddf_log_debug("Stopped recording");
    423406        async_msg_0(dsp->event_exchange, PCM_EVENT_RECORDING_TERMINATED);
    424407        async_exchange_end(dsp->event_exchange);
  • uspace/drv/audio/sb16/dsp.h

    r44d1311 rb497018  
    7272void sb_dsp_interrupt(sb_dsp_t *dsp);
    7373
    74 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size, unsigned *id);
    75 int sb_dsp_set_event_session(sb_dsp_t *dsp, unsigned id, async_sess_t *session);
    76 int sb_dsp_release_buffer(sb_dsp_t *dsp, unsigned id);
    77 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned id, unsigned parts,
     74int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size);
     75int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session);
     76int sb_dsp_release_buffer(sb_dsp_t *dsp);
     77int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned parts,
    7878    unsigned channels, unsigned sample_rate, pcm_sample_format_t format);
    79 int sb_dsp_stop_playback(sb_dsp_t *dsp, unsigned id);
    80 int sb_dsp_start_record(sb_dsp_t *dsp, unsigned id, unsigned parts,
     79int sb_dsp_stop_playback(sb_dsp_t *dsp);
     80int sb_dsp_start_record(sb_dsp_t *dsp, unsigned parts,
    8181    unsigned channels, unsigned sample_rate, pcm_sample_format_t format);
    82 int sb_dsp_stop_record(sb_dsp_t *dsp, unsigned id);
     82int sb_dsp_stop_record(sb_dsp_t *dsp);
    8383
    8484#endif
  • uspace/drv/audio/sb16/pcm_iface.c

    r44d1311 rb497018  
    4747}
    4848
    49 static int sb_get_buffer(ddf_fun_t *fun,
    50     void **buffer, size_t *size, unsigned *id)
     49static int sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
    5150{
    5251        assert(fun);
    5352        assert(fun->driver_data);
    5453        sb_dsp_t *dsp = fun->driver_data;
    55         return sb_dsp_get_buffer(dsp, buffer, size, id);
     54        return sb_dsp_get_buffer(dsp, buffer, size);
    5655}
    57 static int sb_set_event_session(ddf_fun_t *fun, unsigned id, async_sess_t *sess)
     56static int sb_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
    5857{
    5958        assert(fun);
    6059        assert(fun->driver_data);
    6160        sb_dsp_t *dsp = fun->driver_data;
    62         return sb_dsp_set_event_session(dsp, id, sess);
     61        return sb_dsp_set_event_session(dsp, sess);
    6362}
    6463
    65 static int sb_release_buffer(ddf_fun_t *fun, unsigned id)
     64static int sb_release_buffer(ddf_fun_t *fun)
    6665{
    6766        assert(fun);
    6867        assert(fun->driver_data);
    6968        sb_dsp_t *dsp = fun->driver_data;
    70         return sb_dsp_release_buffer(dsp, id);
     69        return sb_dsp_release_buffer(dsp);
    7170}
    7271
    73 static int sb_start_playback(ddf_fun_t *fun, unsigned id, unsigned parts,
     72static int sb_start_playback(ddf_fun_t *fun, unsigned parts,
    7473    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    7574{
     
    7877        sb_dsp_t *dsp = fun->driver_data;
    7978        return sb_dsp_start_playback(
    80             dsp, id, parts, channels, sample_rate, format);
     79            dsp, parts, channels, sample_rate, format);
    8180}
    8281
    83 static int sb_stop_playback(ddf_fun_t *fun, unsigned id)
     82static int sb_stop_playback(ddf_fun_t *fun)
    8483{
    8584        assert(fun);
    8685        assert(fun->driver_data);
    8786        sb_dsp_t *dsp = fun->driver_data;
    88         return sb_dsp_stop_playback(dsp, id);
     87        return sb_dsp_stop_playback(dsp);
    8988}
    9089
    91 static int sb_start_record(ddf_fun_t *fun, unsigned id, unsigned parts,
     90static int sb_start_record(ddf_fun_t *fun, unsigned parts,
    9291    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    9392{
     
    9695        sb_dsp_t *dsp = fun->driver_data;
    9796        return sb_dsp_start_record(
    98             dsp, id, parts, channels, sample_rate, format);
     97            dsp, parts, channels, sample_rate, format);
    9998}
    10099
    101 static int sb_stop_record(ddf_fun_t *fun, unsigned id)
     100static int sb_stop_record(ddf_fun_t *fun)
    102101{
    103102        assert(fun);
    104103        assert(fun->driver_data);
    105104        sb_dsp_t *dsp = fun->driver_data;
    106         return sb_dsp_stop_record(dsp, id);
     105        return sb_dsp_stop_record(dsp);
    107106}
    108107
  • uspace/lib/drv/generic/remote_audio_pcm.c

    r44d1311 rb497018  
    8383
    8484int audio_pcm_get_buffer(async_exch_t *exch, void **buffer, size_t *size,
    85     unsigned *id, async_client_conn_t event_rec, void* arg)
    86 {
    87         if (!exch || !buffer || !size || !id)
    88                 return EINVAL;
    89 
    90         sysarg_t buffer_size = *size, buffer_id = 0;
    91         const int ret = async_req_2_2(exch,
     85    async_client_conn_t event_rec, void* arg)
     86{
     87        if (!exch || !buffer || !size)
     88                return EINVAL;
     89
     90        sysarg_t buffer_size = *size;
     91        const int ret = async_req_2_1(exch,
    9292            DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_GET_BUFFER,
    93             (sysarg_t)buffer_size, &buffer_size, &buffer_id);
     93            (sysarg_t)buffer_size, &buffer_size);
    9494        if (ret == EOK) {
    9595                void *dst = NULL;
     
    105105                *buffer = dst;
    106106                *size = buffer_size;
    107                 *id = buffer_id;
    108107        }
    109108        return ret;
    110109}
    111110
    112 int audio_pcm_release_buffer(async_exch_t *exch, unsigned id)
     111int audio_pcm_release_buffer(async_exch_t *exch)
    113112{
    114113        if (!exch)
    115114                return EINVAL;
    116         return async_req_2_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
    117             IPC_M_AUDIO_PCM_RELEASE_BUFFER, id);
    118 }
    119 
    120 int audio_pcm_start_playback(async_exch_t *exch, unsigned id, unsigned parts,
     115        return async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
     116            IPC_M_AUDIO_PCM_RELEASE_BUFFER);
     117}
     118
     119int audio_pcm_start_playback(async_exch_t *exch, unsigned parts,
    121120    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    122121{
     
    128127        const sysarg_t packed =
    129128            (parts << 24) | (channels << 16) | (format & UINT16_MAX);
    130         return async_req_4_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
    131             IPC_M_AUDIO_PCM_START_PLAYBACK, id, sample_rate, packed);
    132 }
    133 
    134 int audio_pcm_stop_playback(async_exch_t *exch, unsigned id)
     129        return async_req_3_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
     130            IPC_M_AUDIO_PCM_START_PLAYBACK, sample_rate, packed);
     131}
     132
     133int audio_pcm_stop_playback(async_exch_t *exch)
    135134{
    136135        if (!exch)
    137136                return EINVAL;
    138         return async_req_2_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
    139             IPC_M_AUDIO_PCM_STOP_PLAYBACK, id);
    140 }
    141 
    142 int audio_pcm_start_record(async_exch_t *exch, unsigned id, unsigned parts,
     137        return async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
     138            IPC_M_AUDIO_PCM_STOP_PLAYBACK);
     139}
     140
     141int audio_pcm_start_record(async_exch_t *exch, unsigned parts,
    143142    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    144143{
     
    150149        const sysarg_t packed =
    151150            (parts << 24) | (channels << 16) | (format & UINT16_MAX);
    152         return async_req_4_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
    153             IPC_M_AUDIO_PCM_START_RECORD, id, sample_rate, packed);
    154 }
    155 
    156 int audio_pcm_stop_record(async_exch_t *exch, unsigned id)
     151        return async_req_3_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
     152            IPC_M_AUDIO_PCM_START_RECORD, sample_rate, packed);
     153}
     154
     155int audio_pcm_stop_record(async_exch_t *exch)
    157156{
    158157        if (!exch)
    159158                return EINVAL;
    160         return async_req_2_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
    161             IPC_M_AUDIO_PCM_STOP_RECORD, id);
     159        return async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
     160            IPC_M_AUDIO_PCM_STOP_RECORD);
    162161}
    163162
     
    233232        void *buffer = NULL;
    234233        size_t size = DEV_IPC_GET_ARG1(*call);
    235         unsigned id = 0;
    236         int ret = pcm_iface->get_buffer(fun, &buffer, &size, &id);
    237         async_answer_2(callid, ret, size, id);
     234        int ret = pcm_iface->get_buffer(fun, &buffer, &size);
     235        async_answer_1(callid, ret, size);
    238236        if (ret != EOK || size == 0)
    239237                return;
     
    246244        if (!async_share_in_receive(&share_id, &share_size)) {
    247245                ddf_msg(LVL_DEBUG, "Failed to share pcm buffer.");
    248                 pcm_iface->release_buffer(fun, id);
     246                pcm_iface->release_buffer(fun);
    249247                async_answer_0(share_id, EPARTY);
    250248                return;
     
    254252        if (share_size != size) {
    255253                ddf_msg(LVL_DEBUG, "Incorrect pcm buffer size requested.");
    256                 pcm_iface->release_buffer(fun, id);
     254                pcm_iface->release_buffer(fun);
    257255                async_answer_0(share_id, ELIMIT);
    258256                return;
     
    264262        if (ret != EOK) {
    265263                ddf_msg(LVL_DEBUG, "Failed to share buffer.");
    266                 pcm_iface->release_buffer(fun, id);
     264                pcm_iface->release_buffer(fun);
    267265                return;
    268266        }
     
    277275                if (sess == NULL) {
    278276                        ddf_msg(LVL_DEBUG, "Failed to create event callback");
    279                         pcm_iface->release_buffer(fun, id);
     277                        pcm_iface->release_buffer(fun);
    280278                        async_answer_0(callid, EAGAIN);
    281279                        return;
    282280                }
    283                 ret = pcm_iface->set_event_session(fun, id, sess);
     281                ret = pcm_iface->set_event_session(fun, sess);
    284282                if (ret != EOK) {
    285283                        ddf_msg(LVL_DEBUG, "Failed to set event callback.");
    286                         pcm_iface->release_buffer(fun, id);
     284                        pcm_iface->release_buffer(fun);
    287285                        async_answer_0(callid, ret);
    288286                        return;
     
    298296        const audio_pcm_iface_t *pcm_iface = iface;
    299297
    300         const unsigned id = DEV_IPC_GET_ARG1(*call);
    301298        const int ret = pcm_iface->release_buffer ?
    302             pcm_iface->release_buffer(fun, id) : ENOTSUP;
     299            pcm_iface->release_buffer(fun) : ENOTSUP;
    303300        async_answer_0(callid, ret);
    304301}
     
    309306        const audio_pcm_iface_t *pcm_iface = iface;
    310307
    311         const unsigned id = DEV_IPC_GET_ARG1(*call);
    312         const unsigned rate = DEV_IPC_GET_ARG2(*call);
    313         const unsigned parts = (DEV_IPC_GET_ARG3(*call) >> 24) & UINT8_MAX;
    314         const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT8_MAX;
    315         const pcm_sample_format_t format =DEV_IPC_GET_ARG3(*call) & UINT16_MAX;
     308        const unsigned rate = DEV_IPC_GET_ARG1(*call);
     309        const unsigned parts = (DEV_IPC_GET_ARG2(*call) >> 24) & UINT8_MAX;
     310        const unsigned channels = (DEV_IPC_GET_ARG2(*call) >> 16) & UINT8_MAX;
     311        const pcm_sample_format_t format = DEV_IPC_GET_ARG2(*call) & UINT16_MAX;
    316312
    317313        const int ret = pcm_iface->start_playback
    318             ? pcm_iface->start_playback(fun, id, parts, channels, rate, format)
     314            ? pcm_iface->start_playback(fun, parts, channels, rate, format)
    319315            : ENOTSUP;
    320316        async_answer_0(callid, ret);
     
    326322        const audio_pcm_iface_t *pcm_iface = iface;
    327323
    328         const unsigned id = DEV_IPC_GET_ARG1(*call);
    329324        const int ret = pcm_iface->stop_playback ?
    330             pcm_iface->stop_playback(fun, id) : ENOTSUP;
     325            pcm_iface->stop_playback(fun) : ENOTSUP;
    331326        async_answer_0(callid, ret);
    332327}
     
    337332        const audio_pcm_iface_t *pcm_iface = iface;
    338333
    339         const unsigned id = DEV_IPC_GET_ARG1(*call);
    340         const unsigned rate = DEV_IPC_GET_ARG2(*call);
    341         const unsigned parts = (DEV_IPC_GET_ARG3(*call) >> 24) & UINT8_MAX;
    342         const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT8_MAX;
    343         const pcm_sample_format_t format =DEV_IPC_GET_ARG3(*call) & UINT16_MAX;
     334        const unsigned rate = DEV_IPC_GET_ARG1(*call);
     335        const unsigned parts = (DEV_IPC_GET_ARG2(*call) >> 24) & UINT8_MAX;
     336        const unsigned channels = (DEV_IPC_GET_ARG2(*call) >> 16) & UINT8_MAX;
     337        const pcm_sample_format_t format = DEV_IPC_GET_ARG2(*call) & UINT16_MAX;
    344338
    345339        const int ret = pcm_iface->start_record
    346             ? pcm_iface->start_record(fun, id, parts, channels, rate, format)
     340            ? pcm_iface->start_record(fun, parts, channels, rate, format)
    347341            : ENOTSUP;
    348342        async_answer_0(callid, ret);
     
    354348        const audio_pcm_iface_t *pcm_iface = iface;
    355349
    356         const unsigned id = DEV_IPC_GET_ARG1(*call);
    357350        const int ret = pcm_iface->stop_record ?
    358             pcm_iface->stop_record(fun, id) : ENOTSUP;
     351            pcm_iface->stop_record(fun) : ENOTSUP;
    359352        async_answer_0(callid, ret);
    360353}
  • uspace/lib/drv/include/audio_pcm_iface.h

    r44d1311 rb497018  
    5252
    5353int audio_pcm_get_info_str(async_exch_t *, const char **);
    54 int audio_pcm_get_buffer(async_exch_t *, void **, size_t *, unsigned *,
     54int audio_pcm_get_buffer(async_exch_t *, void **, size_t *,
    5555    async_client_conn_t, void *);
    56 int audio_pcm_release_buffer(async_exch_t *, unsigned);
     56int audio_pcm_release_buffer(async_exch_t *);
    5757
    58 int audio_pcm_start_playback(async_exch_t *, unsigned, unsigned,
     58int audio_pcm_start_playback(async_exch_t *, unsigned,
    5959    unsigned, unsigned, pcm_sample_format_t);
    60 int audio_pcm_stop_playback(async_exch_t *, unsigned);
     60int audio_pcm_stop_playback(async_exch_t *);
    6161
    62 int audio_pcm_start_record(async_exch_t *, unsigned, unsigned,
     62int audio_pcm_start_record(async_exch_t *, unsigned,
    6363    unsigned, unsigned, pcm_sample_format_t);
    64 int audio_pcm_stop_record(async_exch_t *, unsigned);
     64int audio_pcm_stop_record(async_exch_t *);
    6565
    6666/** Audio pcm communication interface. */
    6767typedef struct {
    6868        int (*get_info_str)(ddf_fun_t *, const char **);
    69         int (*get_buffer)(ddf_fun_t *, void **, size_t *, unsigned *);
    70         int (*release_buffer)(ddf_fun_t *, unsigned);
    71         int (*set_event_session)(ddf_fun_t *, unsigned, async_sess_t *);
    72         int (*start_playback)(ddf_fun_t *, unsigned, unsigned,
     69        int (*get_buffer)(ddf_fun_t *, void **, size_t *);
     70        int (*release_buffer)(ddf_fun_t *);
     71        int (*set_event_session)(ddf_fun_t *, async_sess_t *);
     72        int (*start_playback)(ddf_fun_t *, unsigned,
    7373            unsigned, unsigned, pcm_sample_format_t);
    74         int (*stop_playback)(ddf_fun_t *, unsigned);
    75         int (*start_record)(ddf_fun_t *, unsigned, unsigned,
     74        int (*stop_playback)(ddf_fun_t *);
     75        int (*start_record)(ddf_fun_t *, unsigned,
    7676            unsigned, unsigned, pcm_sample_format_t);
    77         int (*stop_record)(ddf_fun_t *, unsigned);
     77        int (*stop_record)(ddf_fun_t *);
    7878} audio_pcm_iface_t;
    7979
  • uspace/srv/audio/hound/audio_device.c

    r44d1311 rb497018  
    8080        fibril_mutex_initialize(&dev->buffer.guard);
    8181        fibril_condvar_initialize(&dev->buffer.wc);
    82         dev->buffer.id = 0;
    8382        dev->buffer.base = NULL;
    8483        dev->buffer.position = NULL;
     
    232231        async_exch_t *exch = async_exchange_begin(dev->sess);
    233232        const int ret = audio_pcm_get_buffer(exch, &dev->buffer.base,
    234             &dev->buffer.size, &dev->buffer.id, device_event_callback, dev);
     233            &dev->buffer.size, device_event_callback, dev);
    235234        async_exchange_end(exch);
    236235        return ret;
     
    256255
    257256        async_exch_t *exch = async_exchange_begin(dev->sess);
    258         const int ret = audio_pcm_release_buffer(exch, dev->buffer.id);
     257        const int ret = audio_pcm_release_buffer(exch);
    259258        async_exchange_end(exch);
    260259        if (ret == EOK) {
     
    274273
    275274        async_exch_t *exch = async_exchange_begin(dev->sess);
    276         const int ret = audio_pcm_start_playback(exch, dev->buffer.id,
     275        const int ret = audio_pcm_start_playback(exch,
    277276            BUFFER_BLOCKS, dev->sink.format.channels,
    278277            dev->sink.format.sampling_rate, dev->sink.format.sample_format);
     
    286285
    287286        async_exch_t *exch = async_exchange_begin(dev->sess);
    288         const int ret = audio_pcm_stop_playback(exch, dev->buffer.id);
     287        const int ret = audio_pcm_stop_playback(exch);
    289288        async_exchange_end(exch);
    290289        return ret;
     
    296295
    297296        async_exch_t *exch = async_exchange_begin(dev->sess);
    298         const int ret = audio_pcm_start_record(exch, dev->buffer.id,
     297        const int ret = audio_pcm_start_record(exch,
    299298            BUFFER_BLOCKS, dev->sink.format.channels,
    300299            dev->sink.format.sampling_rate, dev->sink.format.sample_format);
     
    308307
    309308        async_exch_t *exch = async_exchange_begin(dev->sess);
    310         const int ret = audio_pcm_stop_record(exch, dev->buffer.id);
     309        const int ret = audio_pcm_stop_record(exch);
    311310        async_exchange_end(exch);
    312311        return ret;
  • uspace/srv/audio/hound/audio_device.h

    r44d1311 rb497018  
    5555                fibril_mutex_t guard;
    5656                fibril_condvar_t wc;
    57                 unsigned id;
    5857                void *base;
    5958                size_t size;
Note: See TracChangeset for help on using the changeset viewer.