Changeset bd5860f in mainline for uspace/app/wavplay/main.c


Ignore:
Timestamp:
2013-03-17T17:06:52Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b66d43b
Parents:
9e1800c
Message:

wavplay: Add more debug output and few fixes

File:
1 edited

Legend:

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

    r9e1800c rbd5860f  
    5151static int hplay(const char *filename)
    5252{
     53        printf("HPLAY: %s\n", filename);
    5354        FILE *source = fopen(filename, "rb");
    54         if (!source)
     55        if (!source) {
     56                printf("Failed to open file %s\n", filename);
    5557                return EINVAL;
     58        }
    5659        wave_header_t header;
    5760        size_t read = fread(&header, sizeof(header), 1, source);
    58         if (read != sizeof(header)) {
     61        if (read != 1) {
     62                printf("Failed to read WAV header: %zu\n", read);
    5963                fclose(source);
    6064                return EIO;
     
    8589        }
    8690        static char buffer[BUFFER_SIZE];
    87         size_t size = 0;
    88         while ((size = fread(buffer, sizeof(buffer), 1, source)) > 0) {
    89                 ret = hound_write_main_stream(hound, buffer, size);
     91        while ((read = fread(buffer, sizeof(char), BUFFER_SIZE, source)) > 0) {
     92                ret = hound_write_main_stream(hound, buffer, read);
    9093                if (ret != EOK) {
    91                         printf("Failed to write to context main stream: %s\n",
     94                        printf("Failed to write to main context stream: %s\n",
    9295                            str_error(ret));
    9396                        break;
     
    257260        else
    258261                return play_hound(file);
    259         (void)hplay;
     262        hplay(file);
    260263}
    261264/**
Note: See TracChangeset for help on using the changeset viewer.