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

Changeset 346643c in mainline for uspace/app/dplay/dplay.c


Ignore:
Timestamp:
2012-07-11T12:05:30Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial
Children:
039337e8
Parents:
94694a4
Message:

audio: Use enum for sample format.

File:
1 edited

Legend:

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

    r94694a4 r346643c  
    112112
    113113
    114 static void play(playback_t *pb, unsigned sampling_rate, unsigned sample_size,
    115     unsigned channels, bool sign)
     114static void play(playback_t *pb, unsigned channels,  unsigned sampling_rate,
     115    pcm_sample_format_t format)
    116116{
    117117        assert(pb);
    118118        assert(pb->device);
    119119        pb->buffer.position = pb->buffer.base;
    120         printf("Playing: %dHz, %d-bit %ssigned samples, %d channel(s).\n",
    121             sampling_rate, sample_size, sign ? "": "un", channels);
     120        printf("Playing: %dHz, %s, %d channel(s).\n",
     121            sampling_rate, pcm_sample_format_str(format), channels);
    122122        const size_t bytes = fread(pb->buffer.base, sizeof(uint8_t),
    123123            pb->buffer.size, pb->source);
     
    127127        fibril_mutex_lock(&pb->mutex);
    128128        int ret = audio_pcm_start_playback(pb->device, pb->buffer.id,
    129             SUBBUFFERS, sampling_rate, sample_size, channels, sign);
     129            SUBBUFFERS, channels, sampling_rate, format);
    130130        if (ret != EOK) {
    131131                fibril_mutex_unlock(&pb->mutex);
     
    212212        wave_header_t header;
    213213        fread(&header, sizeof(header), 1, pb.source);
    214         unsigned rate, sample_size, channels;
    215         bool sign;
     214        unsigned rate, channels;
     215        pcm_sample_format_t format;
    216216        const char *error;
    217         ret = wav_parse_header(&header, NULL, NULL, &rate, &sample_size,
    218             &channels, &sign, &error);
     217        ret = wav_parse_header(&header, NULL, NULL, &channels, &rate, &format,
     218            &error);
    219219        if (ret != EOK) {
    220220                printf("Error parsing wav header: %s.\n", error);
     
    223223        }
    224224
    225         play(&pb, rate, sample_size, channels, sign);
     225        play(&pb, channels, rate, format);
    226226        fclose(pb.source);
    227227
Note: See TracChangeset for help on using the changeset viewer.