src/mess/devices/cassette.c
| r8058 | r8059 | |
| 74 | 74 | static void cassette_update(running_device *device) |
| 75 | 75 | { |
| 76 | 76 | dev_cassette_t *cassette = get_safe_token( device ); |
| 77 | | double cur_time; |
| 77 | double cur_time = attotime_to_double(timer_get_time(device->machine)); |
| 78 | 78 | |
| 79 | | cur_time = attotime_to_double(timer_get_time(device->machine)); |
| 80 | | |
| 81 | 79 | if (cassette_is_motor_on(device)) |
| 82 | 80 | { |
| 83 | 81 | double new_position = cassette->position + (cur_time - cassette->position_time); |
| r8058 | r8059 | |
| 89 | 87 | |
| 90 | 88 | case CASSETTE_PLAY: |
| 91 | 89 | if ( cassette->cassette ) |
| 90 | { |
| 92 | 91 | cassette_get_sample(cassette->cassette, 0, new_position, 0.0, &cassette->value); |
| 92 | /* See if reached end of tape */ |
| 93 | double length = cassette_get_length(device); |
| 94 | if (new_position > length) |
| 95 | { |
| 96 | cassette->state = (cassette_state)(CASSETTE_MASK_DRVSTATE); |
| 97 | new_position = length; |
| 98 | } |
| 99 | } |
| 93 | 100 | break; |
| 94 | 101 | } |
| 95 | 102 | cassette->position = new_position; |
| r8058 | r8059 | |
| 204 | 211 | { |
| 205 | 212 | dev_cassette_t *cassette = get_safe_token( device ); |
| 206 | 213 | |
| 214 | double length; |
| 215 | |
| 207 | 216 | cassette_update(device); |
| 208 | 217 | |
| 218 | length = cassette_get_length(device); |
| 219 | |
| 209 | 220 | switch(origin) { |
| 210 | 221 | case SEEK_SET: |
| 211 | 222 | break; |
| 212 | 223 | |
| 213 | 224 | case SEEK_END: |
| 214 | | time += cassette_get_length(device); |
| 225 | time += length; |
| 215 | 226 | break; |
| 216 | 227 | |
| 217 | 228 | case SEEK_CUR: |
| r8058 | r8059 | |
| 220 | 231 | } |
| 221 | 232 | |
| 222 | 233 | /* clip position into legal bounds */ |
| 234 | if (time < 0) |
| 235 | time = 0; |
| 236 | else |
| 237 | if (time > length) |
| 238 | time = length; |
| 239 | |
| 223 | 240 | cassette->position = time; |
| 224 | 241 | } |
| 225 | 242 | |
src/mess/osd/windows/menu.c
| r8058 | r8059 | |
| 1565 | 1565 | break; |
| 1566 | 1566 | |
| 1567 | 1567 | case DEVOPTION_CASSETTE_REWIND: |
| 1568 | | cassette_seek(img, -1.0, SEEK_CUR); |
| 1568 | cassette_seek(img, -60.0, SEEK_CUR); |
| 1569 | 1569 | break; |
| 1570 | 1570 | |
| 1571 | 1571 | case DEVOPTION_CASSETTE_FASTFORWARD: |
| 1572 | | cassette_seek(img, +1.0, SEEK_CUR); |
| 1572 | cassette_seek(img, +60.0, SEEK_CUR); |
| 1573 | 1573 | break; |
| 1574 | 1574 | } |
| 1575 | 1575 | } |