summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/cassette.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/imagedev/cassette.cpp')
-rw-r--r--src/devices/imagedev/cassette.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp
index 38f5fcfb059..8b408355ed4 100644
--- a/src/devices/imagedev/cassette.cpp
+++ b/src/devices/imagedev/cassette.cpp
@@ -83,13 +83,13 @@ void cassette_image_device::update()
switch (int(m_state & CASSETTE_MASK_UISTATE)) // cast to int to suppress unhandled enum value warning
{
case CASSETTE_RECORD:
- cassette_put_sample(m_cassette, m_channel, m_position, new_position - m_position, m_value);
+ m_cassette->put_sample(m_channel, m_position, new_position - m_position, m_value);
break;
case CASSETTE_PLAY:
if (m_cassette)
{
- cassette_get_sample(m_cassette, m_channel, new_position, 0.0, &m_value);
+ m_cassette->get_sample(m_channel, new_position, 0.0, &m_value);
// See if reached end of tape
double length = get_length();
if (new_position > length)
@@ -167,9 +167,7 @@ double cassette_image_device::get_position()
double cassette_image_device::get_length()
{
- struct CassetteInfo info;
-
- cassette_get_info(m_cassette, &info);
+ cassette_image::Info info = m_cassette->get_info();
return ((double) info.sample_count) / info.sample_frequency;
}
@@ -258,7 +256,7 @@ image_init_result cassette_image_device::internal_load(bool is_create)
if (is_create || (length()==0)) // empty existing images are fine to write over.
{
// creating an image
- err = cassette_create((void *)image, &image_ioprocs, &wavfile_format, m_create_opts, CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT, &m_cassette);
+ err = cassette_image::create((void *)image, &image_ioprocs, &cassette_image::wavfile_format, m_create_opts, CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT, m_cassette);
if (err != cassette_image::error::SUCCESS)
goto error;
}
@@ -275,7 +273,7 @@ image_init_result cassette_image_device::internal_load(bool is_create)
int cassette_flags = is_readonly()
? CASSETTE_FLAG_READONLY
: (CASSETTE_FLAG_READWRITE | CASSETTE_FLAG_SAVEONEXIT);
- err = cassette_open_choices((void *)image, &image_ioprocs, filetype(), m_formats, cassette_flags, &m_cassette);
+ err = cassette_image::open_choices((void *)image, &image_ioprocs, filetype(), m_formats, cassette_flags, m_cassette);
// special case - if we failed due to readwrite not being supported, make the image be read only and retry
if (err == cassette_image::error::READ_WRITE_UNSUPPORTED)
@@ -337,8 +335,7 @@ void cassette_image_device::call_unload()
update();
/* close out the cassette */
- cassette_close(m_cassette);
- m_cassette = nullptr;
+ m_cassette.reset();
/* set to default state, but only change the UI state */
change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
@@ -419,7 +416,7 @@ void cassette_image_device::sound_stream_update(sound_stream &stream, std::vecto
for (int ch = 0; ch < outputs.size(); ch++)
{
- cassette_get_samples(cassette, 0, time_index, duration, outputs[0].samples(), 2, &m_samples[0], CASSETTE_WAVEFORM_16BIT);
+ cassette->get_samples(0, time_index, duration, outputs[0].samples(), 2, &m_samples[0], CASSETTE_WAVEFORM_16BIT);
for (int sampindex = 0; sampindex < outputs[ch].samples(); sampindex++)
outputs[ch].put_int(sampindex, m_samples[sampindex], 32768);
}