Changeset aef1799 in mainline for uspace/app/wavplay/main.c
- Timestamp:
- 2012-07-17T10:57:41Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1f7da3b
- Parents:
- cd8f19d
- File:
-
- 1 moved
-
uspace/app/wavplay/main.c (moved) (moved from uspace/app/wavplay/wavplay.c ) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/wavplay/main.c
rcd8f19d raef1799 41 41 #include <hound/client.h> 42 42 #include <pcm/sample_format.h> 43 43 #include <getopt.h> 44 45 #include "dplay.h" 44 46 #include "wave.h" 45 47 … … 119 121 } 120 122 123 static const struct option opts[] = { 124 {"device", required_argument, 0, 'd'}, 125 {"record", no_argument, 0, 'r'}, 126 {0, 0, 0, 0} 127 }; 128 129 121 130 int main(int argc, char *argv[]) 122 131 { 123 if (argc != 2) 124 return 1; 125 const char *file = argv[1]; 132 const char *device = "default"; 133 int idx = 0; 134 bool direct = false, record = false; 135 optind = 0; 136 int ret = 0; 137 while (ret != -1) { 138 ret = getopt_long(argc, argv, "d:r", opts, &idx); 139 switch (ret) { 140 case 'd': 141 direct = true; 142 device = optarg; 143 break; 144 case 'r': 145 record = true; 146 break; 147 }; 148 } 149 150 if (optind == argc) { 151 printf("Not enough arguments.\n"); 152 return 1; 153 } 154 const char *file = argv[optind]; 155 156 printf("%s %s\n", record ? "Recording" : "Playing", file); 157 if (record) { 158 printf("Recording is not supported yet.\n"); 159 return 1; 160 } 161 if (direct) 162 return dplay(device, file); 126 163 127 164 task_id_t tid = task_get_id(); … … 149 186 pcm_sample_format_t format; 150 187 const char *error; 151 const intret = wav_parse_header(&header, NULL, NULL, &channels, &rate,188 ret = wav_parse_header(&header, NULL, NULL, &channels, &rate, 152 189 &format, &error); 153 190 if (ret != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.
