Changeset 5c98bb28 in mainline


Ignore:
Timestamp:
2013-04-06T12:43:54Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
599034e
Parents:
afd4fc7
Message:

hound: use fragment_size param instead of macro

Location:
uspace/srv/audio/hound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/audio/hound/audio_device.c

    rafd4fc7 r5c98bb28  
    7979        dev->buffer.position = NULL;
    8080        dev->buffer.size = 0;
     81        dev->buffer.fragment_size = 0;
    8182
    8283        log_verbose("Initialized device (%p) '%s' with id %u.",
     
    111112                    dev->buffer.base, dev->buffer.size);
    112113
    113                 log_verbose("Mixed inputs: %zu/(%u * %u)",
    114                     dev->buffer.size, BUFFER_PARTS, pcm_format_frame_size(&dev->sink.format));
    115                 const unsigned frames = dev->buffer.size /
    116                     (BUFFER_PARTS * pcm_format_frame_size(&dev->sink.format));
    117                 log_verbose("FRAME COUNT %u", frames);
     114                const unsigned frames = dev->buffer.fragment_size /
     115                    pcm_format_frame_size(&dev->sink.format);
     116                log_verbose("Fragment frame count %u", frames);
    118117                ret = audio_pcm_start_playback_fragment(dev->sess, frames,
    119118                    dev->sink.format.channels, dev->sink.format.sampling_rate,
     
    151150        assert(source);
    152151        audio_device_t *dev = source->private_data;
    153         if (new && list_count(&source->connections)) {
     152        if (new && list_count(&source->connections) == 1) {
    154153                int ret = get_buffer(dev);
    155154                if (ret != EOK) {
     
    158157                        return ret;
    159158                }
    160                 const unsigned frames = dev->buffer.size /
    161                     (BUFFER_PARTS * pcm_format_frame_size(&dev->sink.format));
     159                const unsigned frames = dev->buffer.fragment_size /
     160                    pcm_format_frame_size(&dev->sink.format);
    162161                ret = audio_pcm_start_capture_fragment(dev->sess, frames,
    163162                    dev->sink.format.channels, dev->sink.format.sampling_rate,
     
    208207                        if (dev->buffer.position) {
    209208                                dev->buffer.position +=
    210                                     (dev->buffer.size / BUFFER_PARTS);
     209                                    dev->buffer.fragment_size;
    211210                        }
    212211                        if ((!dev->buffer.position) ||
     
    217216                        }
    218217                        audio_sink_mix_inputs(&dev->sink, dev->buffer.position,
    219                             dev->buffer.size / BUFFER_PARTS);
     218                            dev->buffer.fragment_size);
    220219                        struct timeval time2;
    221220                        getuptime(&time2);
     
    261260        dev->buffer.size = 0;
    262261
    263         return audio_pcm_get_buffer(dev->sess, &dev->buffer.base,
     262        const int ret = audio_pcm_get_buffer(dev->sess, &dev->buffer.base,
    264263            &dev->buffer.size);
     264        if (ret == EOK)
     265                dev->buffer.fragment_size = dev->buffer.size / BUFFER_PARTS;
     266        return ret;
     267
    265268}
    266269
  • uspace/srv/audio/hound/audio_device.h

    rafd4fc7 r5c98bb28  
    5858                size_t size;
    5959                void *position;
     60                size_t fragment_size;
    6061        } buffer;
    6162        audio_source_t source;
Note: See TracChangeset for help on using the changeset viewer.