Changeset ab07cf0 in mainline
- Timestamp:
- 2012-07-13T16:11:05Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 13df13c8
- Parents:
- 6424800
- Location:
- uspace/srv/audio/hound
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_client.c
r6424800 rab07cf0 139 139 } 140 140 void *old_buffer = source->available_data.base; 141 source->available_data.position = buffer; 141 142 source->available_data.base = buffer; 142 143 source->available_data.size = size; -
uspace/srv/audio/hound/audio_device.c
r6424800 rab07cf0 187 187 if (dev->buffer.position) { 188 188 dev->buffer.position += 189 dev->buffer.size / BUFFER_BLOCKS;189 (dev->buffer.size / BUFFER_BLOCKS); 190 190 } 191 if ( !dev->buffer.position||192 dev->buffer.position >=193 dev->buffer.base + dev->buffer.size)191 if ((!dev->buffer.position) || 192 (dev->buffer.position >= 193 (dev->buffer.base + dev->buffer.size))) 194 194 { 195 195 dev->buffer.position = dev->buffer.base; … … 202 202 log_verbose("Playback terminated!"); 203 203 return; 204 break;205 204 } 206 205 case PCM_EVENT_RECORDING_DONE: { 206 //TODO implement 207 207 break; 208 208 } 209 209 case PCM_EVENT_RECORDING_TERMINATED: 210 210 log_verbose("Recording terminated!"); 211 break; 212 } 213 214 } 215 //TODO implement 211 return; 212 } 213 214 } 216 215 } 217 216 -
uspace/srv/audio/hound/audio_format.c
r6424800 rab07cf0 55 55 return EINVAL; 56 56 const size_t sample_size = pcm_sample_format_size(f->sample_format); 57 if ( !(size % sample_size == 0))57 if ((size % sample_size) != 0) 58 58 return EINVAL; 59 59 … … 65 65 const type *src_buff = src; \ 66 66 type *dst_buff = dst; \ 67 for (size_t i = 0; i < size / s ample_size; ++i) { \68 type a = type ## _ ## endian ##2host(dst_buff[i]); \69 type b = type ## _ ## endian ##2host(src_buff[i]); \70 type c = a + b; \67 for (size_t i = 0; i < size / sizeof(type); ++i) { \ 68 const type a = type ## _ ## endian ##2host(dst_buff[i]); \ 69 const type b = type ## _ ## endian ##2host(src_buff[i]); \ 70 const type c = a + b; \ 71 71 dst_buff[i] = host2 ## type ## _ ## endian(c); \ 72 72 } \ -
uspace/srv/audio/hound/audio_source.c
r6424800 rab07cf0 64 64 source->format = *f; 65 65 source->available_data.base = NULL; 66 source->available_data.position = NULL; 66 67 source->available_data.size = 0; 67 68 log_verbose("Initialized source (%p) '%s'", source, source->name); … … 119 120 return ENOTSUP; 120 121 } 121 if (source->available_data. base== NULL ||122 if (source->available_data.position == NULL || 122 123 source->available_data.size == 0) { 123 124 int ret = EOVERFLOW; /* In fact this is underflow... */ … … 125 126 ret = source->update_available_data(source, size); 126 127 if (ret != EOK) { 127 log_debug("No data to add ");128 log_debug("No data to add to %p(%zu)", buffer, size); 128 129 return ret; 129 130 } … … 132 133 const size_t real_size = min(size, source->available_data.size); 133 134 const int ret = 134 audio_format_mix(buffer, source->available_data. base, real_size, f);135 audio_format_mix(buffer, source->available_data.position, real_size, f); 135 136 if (ret != EOK) { 136 log_debug("Mixing failed"); 137 log_debug("Mixing failed %p <= %p, %zu", 138 buffer, source->available_data.position, real_size); 137 139 return ret; 138 140 } 139 source->available_data.base += real_size; 141 142 source->available_data.position += real_size; 140 143 source->available_data.size -= real_size; 144 145 log_verbose("Mixing successful %p <= %p, %zu", 146 buffer, source->available_data.position, real_size); 147 141 148 buffer += real_size; 142 149 size -= real_size; -
uspace/srv/audio/hound/audio_source.h
r6424800 rab07cf0 56 56 struct audio_sink *connected_sink; 57 57 struct { 58 void *position; 58 59 void *base; 59 60 size_t size;
Note:
See TracChangeset
for help on using the changeset viewer.