src/emu/sound/wave.c
| r4628 | r4629 | |
| 19 | 19 | |
| 20 | 20 | #define ALWAYS_PLAY_SOUND 0 |
| 21 | 21 | |
| 22 | | |
| 23 | | |
| 24 | 22 | static STREAM_UPDATE( wave_sound_update ) |
| 25 | 23 | { |
| 26 | 24 | #ifdef MESS |
| r4628 | r4629 | |
| 29 | 27 | cassette_state state; |
| 30 | 28 | double time_index; |
| 31 | 29 | double duration; |
| 32 | | stream_sample_t *buffer = outputs[0]; |
| 30 | stream_sample_t *left_buffer = outputs[0]; |
| 31 | stream_sample_t *right_buffer = outputs[1]; |
| 33 | 32 | int i; |
| 34 | 33 | |
| 35 | 34 | state = cassette_get_state(image); |
| 36 | 35 | |
| 37 | 36 | state &= CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER; |
| 37 | |
| 38 | 38 | if (image_exists(image) && (ALWAYS_PLAY_SOUND || (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)))) |
| 39 | 39 | { |
| 40 | 40 | cassette = cassette_get_image(image); |
| 41 | 41 | time_index = cassette_get_position(image); |
| 42 | 42 | duration = ((double) samples) / image->machine->sample_rate; |
| 43 | 43 | |
| 44 | | cassette_get_samples(cassette, 0, time_index, duration, samples, 2, buffer, CASSETTE_WAVEFORM_16BIT); |
| 44 | cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT); |
| 45 | cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT); |
| 45 | 46 | |
| 46 | | for (i = samples-1; i >= 0; i--) |
| 47 | | buffer[i] = ((INT16 *) buffer)[i]; |
| 47 | for (i = samples - 1; i >= 0; i--) |
| 48 | { |
| 49 | left_buffer[i] = ((INT16 *) left_buffer)[i]; |
| 50 | right_buffer[i] = ((INT16 *) right_buffer)[i]; |
| 51 | } |
| 48 | 52 | } |
| 49 | 53 | else |
| 50 | 54 | { |
| 51 | | memset(buffer, 0, sizeof(*buffer) * samples); |
| 55 | memset(left_buffer, 0, sizeof(*left_buffer) * samples); |
| 56 | memset(right_buffer, 0, sizeof(*right_buffer) * samples); |
| 52 | 57 | } |
| 53 | 58 | #endif |
| 54 | 59 | } |
| r4628 | r4629 | |
| 65 | 70 | #ifdef MESS |
| 66 | 71 | image = devtag_get_device( device->machine, (const char *)device->static_config ); |
| 67 | 72 | #endif |
| 68 | | stream_create(device, 0, 1, device->machine->sample_rate, (void *)image, wave_sound_update); |
| 73 | stream_create(device, 0, 2, device->machine->sample_rate, (void *)image, wave_sound_update); |
| 69 | 74 | } |
| 70 | 75 | |
| 71 | 76 | |
| r4628 | r4629 | |
| 82 | 87 | case DEVINFO_INT_TOKEN_BYTES: info->i = 0; break; |
| 83 | 88 | |
| 84 | 89 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 85 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( wave ); break; |
| 90 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( wave ); break; |
| 86 | 91 | case DEVINFO_FCT_STOP: /* nothing */ break; |
| 87 | 92 | case DEVINFO_FCT_RESET: /* nothing */ break; |
| 88 | 93 | |
| 89 | 94 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 90 | 95 | case DEVINFO_STR_NAME: strcpy(info->s, "Cassette"); break; |
| 91 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Cassette"); break; |
| 92 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 93 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 94 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break; |
| 96 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Cassette"); break; |
| 97 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 98 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 99 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break; |
| 95 | 100 | } |
| 96 | 101 | } |
src/mess/drivers/crvision.c
| r4628 | r4629 | |
| 13 | 13 | TODO: |
| 14 | 14 | |
| 15 | 15 | - BASIC v1,v2 numbers are invisible |
| 16 | | - cassette left (data) / right (audio) track separation |
| 17 | 16 | - proper keyboard emulation, need keyboard schematics |
| 18 | 17 | - parallel I/O module |
| 19 | 18 | |
| r4628 | r4629 | |
| 26 | 25 | #include "devices/cassette.h" |
| 27 | 26 | #include "machine/6821pia.h" |
| 28 | 27 | #include "sound/sn76496.h" |
| 28 | #include "sound/wave.h" |
| 29 | 29 | #include "video/tms9928a.h" |
| 30 | 30 | |
| 31 | 31 | static const device_config *cassette_device_image(running_machine *machine) |
| r4628 | r4629 | |
| 506 | 506 | MDRV_SOUND_ADD(SN76489_TAG, SN76489, XTAL_2MHz) |
| 507 | 507 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 508 | 508 | |
| 509 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 510 | MDRV_SOUND_ROUTE(1, "mono", 0.25) |
| 511 | |
| 509 | 512 | /* peripheral hardware */ |
| 510 | 513 | MDRV_PIA6821_ADD(PIA6821_TAG, crvision_pia_intf) |
| 511 | 514 | |