Changeset 346643c in mainline for uspace/app/drec/drec.c
- Timestamp:
- 2012-07-11T12:05:30Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 039337e8
- Parents:
- 94694a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/drec/drec.c
r94694a4 r346643c 47 47 #include <stdio.h> 48 48 #include <macros.h> 49 #include <pcm_sample_format.h> 49 50 50 51 #include "wave.h" … … 53 54 #define SUBBUFFERS 2 54 55 55 const unsigned sampling_rate = 44100, sample_size = 16, channels = 2;56 bool sign = true;56 const unsigned sampling_rate = 44100, channels = 2, sample_size = 16; 57 const pcm_sample_format_t format = PCM_SAMPLE_SINT16_LE; 57 58 58 59 typedef struct { … … 104 105 105 106 106 static void record(record_t *rec, unsigned sampling_rate, unsigned sample_size,107 unsigned channels, bool sign)107 static void record(record_t *rec, unsigned channels, unsigned sampling_rate, 108 pcm_sample_format_t format) 108 109 { 109 110 assert(rec); 110 111 assert(rec->device); 111 112 rec->buffer.position = rec->buffer.base; 112 printf("Recording: %dHz, % d-bit %ssigned samples, %d channel(s).\n",113 sampling_rate, sample_size, sign ? "": "un", channels);113 printf("Recording: %dHz, %s, %d channel(s).\n", 114 sampling_rate, pcm_sample_format_str(format), channels); 114 115 int ret = audio_pcm_start_record(rec->device, rec->buffer.id, 115 SUBBUFFERS, sampling_rate, sample_size, channels, sign);116 SUBBUFFERS, channels, sampling_rate, format); 116 117 if (ret != EOK) { 117 118 printf("Failed to start recording: %s.\n", str_error(ret)); … … 201 202 .sampling_rate = sampling_rate, 202 203 .sample_size = sample_size, 203 .byte_rate = (sampling_rate / 8) * channels,204 .block_align = (sampl ing_rate / 8) * channels,204 .byte_rate = sampling_rate * (sample_size / 8) * channels, 205 .block_align = (sample_size / 8) * channels, 205 206 .subchunk2_id = SUBCHUNK2_ID, 206 207 }; 207 208 fwrite(&header, sizeof(header), 1, rec.file); 208 record(&rec, sampling_rate, sample_size, channels, sign);209 record(&rec, sampling_rate, channels, format); 209 210 fclose(rec.file); 210 211
Note:
See TracChangeset
for help on using the changeset viewer.