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

Changeset 2cc5c835 in mainline for uspace/app/drec/drec.c


Ignore:
Timestamp:
2012-07-15T15:14:10Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial
Children:
57e8b3b
Parents:
b497018
Message:

Cleanup audio_pcm interface.

File:
1 edited

Legend:

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

    rb497018 r2cc5c835  
    6565        } buffer;
    6666        FILE* file;
    67         async_exch_t *device;
     67        audio_pcm_sess_t *device;
    6868} record_t;
    6969
    70 static void record_initialize(record_t *rec, async_exch_t *exch)
    71 {
    72         assert(exch);
     70static void record_initialize(record_t *rec, audio_pcm_sess_t *sess)
     71{
     72        assert(sess);
    7373        assert(rec);
    7474        rec->buffer.base = NULL;
     
    7676        rec->buffer.position = NULL;
    7777        rec->file = NULL;
    78         rec->device = exch;
     78        rec->device = sess;
    7979}
    8080
     
    151151        }
    152152
    153         devman_handle_t pcm_handle;
    154         int ret = devman_fun_get_handle(device, &pcm_handle, 0);
    155         if (ret != EOK) {
    156                 printf("Failed to get device(%s) handle: %s.\n",
    157                     device, str_error(ret));
    158                 return 1;
    159         }
    160 
    161         async_sess_t *session = devman_device_connect(
    162             EXCHANGE_SERIALIZE, pcm_handle, IPC_FLAG_BLOCKING);
     153
     154        audio_pcm_sess_t *session = audio_pcm_open(device);
    163155        if (!session) {
    164156                printf("Failed to connect to device.\n");
     
    166158        }
    167159
    168         async_exch_t *exch = async_exchange_begin(session);
    169         if (!exch) {
    170                 ret = EPARTY;
    171                 printf("Failed to start session exchange.\n");
    172                 goto close_session;
    173         }
    174160        const char* info = NULL;
    175         ret = audio_pcm_get_info_str(exch, &info);
     161        int ret = audio_pcm_get_info_str(session, &info);
    176162        if (ret != EOK) {
    177163                printf("Failed to get PCM info.\n");
     
    182168
    183169        record_t rec;
    184         record_initialize(&rec, exch);
     170        record_initialize(&rec, session);
    185171
    186172        ret = audio_pcm_get_buffer(rec.device, &rec.buffer.base,
     
    220206cleanup:
    221207        munmap(rec.buffer.base, rec.buffer.size);
    222         audio_pcm_release_buffer(exch);
     208        audio_pcm_release_buffer(rec.device);
    223209close_session:
    224         async_exchange_end(exch);
    225210        async_hangup(session);
    226211        return ret == EOK ? 0 : 1;
Note: See TracChangeset for help on using the changeset viewer.