Changeset e7bf5f6 in mainline


Ignore:
Timestamp:
2012-08-20T15:10:21Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
daed689
Parents:
0387b92
Message:

wavplay: Use PCM_PLAYBACK_STARTED event and only fill up half of the buffer.

File:
1 edited

Legend:

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

    r0387b92 re7bf5f6  
    9191                ipc_callid_t callid = async_get_call(&call);
    9292                switch(IPC_GET_IMETHOD(call)) {
     93                case PCM_EVENT_PLAYBACK_STARTED:
    9394                case PCM_EVENT_FRAMES_PLAYED:
    9495                        printf("%u frames\n", IPC_GET_ARG1(call));
     
    128129        assert(pb);
    129130        assert(pb->device);
    130         pb->buffer.position = pb->buffer.base;
     131        const size_t buffer_part = pb->buffer.size / BUFFER_PARTS;
     132        pb->buffer.position = pb->buffer.base + buffer_part;
    131133        printf("Registering event callback\n");
    132134        int ret = audio_pcm_register_event_callback(pb->device,
     
    139141            sampling_rate, pcm_sample_format_str(format), channels);
    140142        const size_t bytes = fread(pb->buffer.base, sizeof(uint8_t),
    141             pb->buffer.size, pb->source);
    142         if (bytes != pb->buffer.size)
    143                 bzero(pb->buffer.base + bytes, pb->buffer.size - bytes);
     143            buffer_part, pb->source);
     144        if (bytes != buffer_part)
     145                bzero(pb->buffer.base + bytes, buffer_part - bytes);
    144146        printf("Buffer data ready.\n");
    145147        fibril_mutex_lock(&pb->mutex);
Note: See TracChangeset for help on using the changeset viewer.