summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/discrete.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/discrete.cpp')
-rw-r--r--src/devices/sound/discrete.cpp323
1 files changed, 152 insertions, 171 deletions
diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp
index 7d6a84a4fc7..47e517af633 100644
--- a/src/devices/sound/discrete.cpp
+++ b/src/devices/sound/discrete.cpp
@@ -44,9 +44,6 @@
#include <iostream>
-/* for_each collides with c++ standard libraries - include it here */
-#define for_each(_T, _e, _l) for (_T _e = (_l)->begin_ptr() ; _e <= (_l)->end_ptr(); _e++)
-
// device type definition
DEFINE_DEVICE_TYPE(DISCRETE, discrete_sound_device, "discrete", "Discrete Sound")
@@ -93,7 +90,7 @@ DEFINE_DEVICE_TYPE(DISCRETE, discrete_sound_device, "discrete", "Discrete Sound"
struct output_buffer
{
- double *node_buf;
+ std::unique_ptr<double []> node_buf;
const double *source;
volatile double *ptr;
int node_num;
@@ -110,47 +107,44 @@ class discrete_task
{
friend class discrete_device;
public:
- virtual ~discrete_task(void) { }
+ virtual ~discrete_task() { }
- inline void step_nodes(void);
+ inline void step_nodes();
inline bool lock_threadid(int32_t threadid)
{
int expected = -1;
return m_threadid.compare_exchange_weak(expected, threadid, std::memory_order_release,std::memory_order_relaxed);
}
- inline void unlock(void) { m_threadid = -1; }
+ inline void unlock() { m_threadid = -1; }
//const linked_list_entry *list;
- node_step_list_t step_list;
+ discrete_device::node_step_list_t step_list;
/* list of source nodes */
- vector_t<input_buffer> source_list; /* discrete_source_node */
+ std::vector<input_buffer> source_list; /* discrete_source_node */
- int task_group;
+ int task_group = 0;
- discrete_task(discrete_device &pdev)
- : task_group(0), m_device(pdev), m_threadid(-1), m_samples(0)
-{
- source_list.clear();
- step_list.clear();
- m_buffers.clear();
+ discrete_task(discrete_device &pdev) : m_device(pdev), m_threadid(-1)
+ {
+ // FIXME: the code expects to be able to take pointers to members of elements of this vector before it's filled
+ source_list.reserve(16);
}
protected:
static void *task_callback(void *param, int threadid);
- inline bool process(void);
+ inline bool process();
- void check(discrete_task *dest_task);
+ void check(discrete_task &dest_task);
void prepare_for_queue(int samples);
- vector_t<output_buffer> m_buffers;
+ std::vector<output_buffer> m_buffers;
discrete_device & m_device;
private:
std::atomic<int32_t> m_threadid;
- volatile int m_samples;
-
+ volatile int m_samples = 0;
};
@@ -181,29 +175,27 @@ private:
*
*************************************/
-inline void discrete_task::step_nodes(void)
+inline void discrete_task::step_nodes()
{
- for_each(input_buffer *, sn, &source_list)
+ for (input_buffer &sn : source_list)
{
- sn->buffer = *sn->ptr++;
+ sn.buffer = *sn.ptr++;
}
if (EXPECTED(!m_device.profiling()))
{
- for_each(discrete_step_interface **, entry, &step_list)
+ for (discrete_step_interface *entry : step_list)
{
/* Now step the node */
- (*entry)->step();
+ entry->step();
}
}
else
{
osd_ticks_t last = get_profile_ticks();
- for_each(discrete_step_interface **, entry, &step_list)
+ for (discrete_step_interface *node : step_list)
{
- discrete_step_interface *node = *entry;
-
node->run_time -= last;
node->step();
last = get_profile_ticks();
@@ -212,23 +204,23 @@ inline void discrete_task::step_nodes(void)
}
/* buffer the outputs */
- for_each(output_buffer *, outbuf, &m_buffers)
- *(outbuf->ptr++) = *outbuf->source;
+ for (output_buffer &outbuf : m_buffers)
+ *outbuf.ptr++ = *outbuf.source;
}
void *discrete_task::task_callback(void *param, int threadid)
{
- task_list_t *list = (task_list_t *) param;
+ const auto &list = *reinterpret_cast<const discrete_sound_device::task_list_t *>(param);
do
{
- for_each(discrete_task **, task, list)
+ for (const auto &task : list)
{
/* try to lock */
- if ((*task)->lock_threadid(threadid))
+ if (task->lock_threadid(threadid))
{
- if (!(*task)->process())
+ if (!task->process())
return nullptr;
- (*task)->unlock();
+ task->unlock();
}
}
} while (1);
@@ -236,16 +228,14 @@ void *discrete_task::task_callback(void *param, int threadid)
return nullptr;
}
-bool discrete_task::process(void)
+bool discrete_task::process()
{
int samples = std::min(int(m_samples), MAX_SAMPLES_PER_TASK_SLICE);
/* check dependencies */
- for_each(input_buffer *, sn, &source_list)
+ for (input_buffer &sn : source_list)
{
- int avail;
-
- avail = sn->linked_outbuf->ptr - sn->ptr;
+ int avail = sn.linked_outbuf->ptr - sn.ptr;
if (avail < 0)
throw emu_fatalerror("discrete_task::process: available samples are negative");
if (avail < samples)
@@ -273,33 +263,35 @@ void discrete_task::prepare_for_queue(int samples)
{
m_samples = samples;
/* set up task buffers */
- for_each(output_buffer *, ob, &m_buffers)
- ob->ptr = ob->node_buf;
+ for (output_buffer &ob : m_buffers)
+ ob.ptr = ob.node_buf.get();
/* initialize sources */
- for_each(input_buffer *, sn, &source_list)
+ for (input_buffer &sn : source_list)
{
- sn->ptr = sn->linked_outbuf->node_buf;
+ sn.ptr = sn.linked_outbuf->node_buf.get();
}
}
-void discrete_task::check(discrete_task *dest_task)
+void discrete_task::check(discrete_task &dest_task)
{
- int inputnum;
+ // FIXME: this function takes addresses of elements of a vector that has items added later
+ // 16 is enough for the systems in MAME, but the code should be fixed properly
+ m_buffers.reserve(16);
/* Determine, which nodes in the task are referenced by nodes in dest_task
* and add them to the list of nodes to be buffered for further processing
*/
- for_each(discrete_step_interface **, node_entry, &step_list)
+ for (discrete_step_interface *node_entry : step_list)
{
- discrete_base_node *task_node = (*node_entry)->self;
+ discrete_base_node *task_node = node_entry->self;
- for_each(discrete_step_interface **, step_entry, &dest_task->step_list)
+ for (discrete_step_interface *step_entry : dest_task.step_list)
{
- discrete_base_node *dest_node = (*step_entry)->self;
+ discrete_base_node *dest_node = step_entry->self;
/* loop over all active inputs */
- for (inputnum = 0; inputnum < dest_node->active_inputs(); inputnum++)
+ for (int inputnum = 0; inputnum < dest_node->active_inputs(); inputnum++)
{
int inputnode_num = dest_node->input_node(inputnum);
if IS_VALUE_A_NODE(inputnode_num)
@@ -307,11 +299,10 @@ void discrete_task::check(discrete_task *dest_task)
/* Fixme: sub nodes ! */
if (NODE_DEFAULT_NODE(task_node->block_node()) == NODE_DEFAULT_NODE(inputnode_num))
{
- input_buffer source;
- int i, found = -1;
+ int found = -1;
output_buffer *pbuf = nullptr;
- for (i = 0; i < m_buffers.count(); i++)
+ for (int i = 0; i < m_buffers.size(); i++)
// if (m_buffers[i].node->block_node() == inputnode_num)
if (m_buffers[i].node_num == inputnode_num)
{
@@ -324,28 +315,20 @@ void discrete_task::check(discrete_task *dest_task)
{
output_buffer buf;
- buf.node_buf = auto_alloc_array(m_device.machine(), double,
- ((task_node->sample_rate() + sound_manager::STREAMS_UPDATE_FREQUENCY) / sound_manager::STREAMS_UPDATE_FREQUENCY));
- buf.ptr = buf.node_buf;
+ buf.node_buf = std::make_unique<double []>((task_node->sample_rate() + sound_manager::STREAMS_UPDATE_FREQUENCY) / sound_manager::STREAMS_UPDATE_FREQUENCY);
+ buf.ptr = buf.node_buf.get();
buf.source = dest_node->m_input[inputnum];
buf.node_num = inputnode_num;
//buf.node = device->discrete_find_node(inputnode);
- m_buffers.count();
- pbuf = m_buffers.add(buf);
+ m_buffers.push_back(std::move(buf));
+ pbuf = &m_buffers.back();
}
- m_device.discrete_log("dso_task_start - buffering %d(%d) in task %p group %d referenced by %d group %d", NODE_INDEX(inputnode_num), NODE_CHILD_NODE_NUM(inputnode_num), this, task_group, dest_node->index(), dest_task->task_group);
+ m_device.discrete_log("dso_task_start - buffering %d(%d) in task %p group %d referenced by %d group %d", NODE_INDEX(inputnode_num), NODE_CHILD_NODE_NUM(inputnode_num), this, task_group, dest_node->index(), dest_task.task_group);
/* register into source list */
- //source = auto_alloc(device->machine(), discrete_source_node);
- //source.task = this;
- //source.output_node = i;
- source.linked_outbuf = pbuf;
- source.buffer = 0.0; /* please compiler */
- source.ptr = nullptr;
- dest_task->source_list.add(source);
-
- /* point the input to a buffered location */
- dest_node->m_input[inputnum] = &dest_task->source_list[dest_task->source_list.count()-1].buffer; // was copied! &source.buffer;
+ dest_task.source_list.push_back(input_buffer{ nullptr, pbuf, 0.0 });
+ // FIXME: taking address of element of vector before it's filled
+ dest_node->m_input[inputnum] = &dest_task.source_list.back().buffer;
}
}
@@ -374,7 +357,7 @@ discrete_base_node::discrete_base_node() :
}
-discrete_base_node::~discrete_base_node(void)
+discrete_base_node::~discrete_base_node()
{
/* currently noting */
}
@@ -398,7 +381,7 @@ void discrete_base_node::init(discrete_device *pdev, const discrete_block *xbloc
}
}
-void discrete_base_node::save_state(void)
+void discrete_base_node::save_state()
{
if (m_block->node != NODE_SPECIAL)
m_device->save_item(NAME(m_output), m_block->node);
@@ -410,7 +393,7 @@ discrete_base_node *discrete_device::discrete_find_node(int node)
return m_indexed_node[NODE_INDEX(node)];
}
-void discrete_base_node::resolve_input_nodes(void)
+void discrete_base_node::resolve_input_nodes()
{
int inputnum;
@@ -520,7 +503,7 @@ void discrete_device::discrete_build_list(const discrete_block *intf, sound_bloc
if (intf[node_count].type == DSS_NULL)
fatalerror("discrete_build_list: DISCRETE_REPLACE at end of node_list\n");
- for (int i=0; i < block_list.count(); i++)
+ for (int i=0; i < block_list.size(); i++)
{
const discrete_block *block = block_list[i];
@@ -540,9 +523,9 @@ void discrete_device::discrete_build_list(const discrete_block *intf, sound_bloc
}
else if (intf[node_count].type == DSO_DELETE)
{
- vector_t<int> deletethem;
+ std::vector<int> deletethem;
- for (int i=0; i<block_list.count(); i++)
+ for (int i=0; i<block_list.size(); i++)
{
const discrete_block *block = block_list[i];
@@ -550,16 +533,16 @@ void discrete_device::discrete_build_list(const discrete_block *intf, sound_bloc
(block->node <= intf[node_count].input_node[1]))
{
discrete_log("discrete_build_list() - DISCRETE_DELETE deleted NODE_%02d", NODE_INDEX(block->node) );
- deletethem.add(i);
+ deletethem.push_back(i);
}
}
- for_each (int *, i, &deletethem)
- block_list.remove(*i);
+ for (int i : deletethem)
+ block_list.erase(block_list.begin() + i); // FIXME: how is this supposed to work if there's more than one item to remove? indices are shifted back on each removal
}
else
{
discrete_log("discrete_build_list() - adding node %d\n", node_count);
- block_list.add(&intf[node_count]);
+ block_list.push_back(&intf[node_count]);
}
node_count++;
@@ -575,7 +558,7 @@ void discrete_device::discrete_sanity_check(const sound_block_list_t &block_list
int node_count = 0;
discrete_log("discrete_start() - Doing node list sanity check");
- for (int i=0; i < block_list.count(); i++)
+ for (int i=0; i < block_list.size(); i++)
{
const discrete_block *block = block_list[i];
@@ -618,61 +601,60 @@ void discrete_device::discrete_sanity_check(const sound_block_list_t &block_list
*
*************************************/
-static uint64_t list_run_time(const node_list_t &list)
+static uint64_t list_run_time(const discrete_device::node_list_t &list)
{
uint64_t total = 0;
- for_each(discrete_base_node **, node, &list)
+ for (const auto &node : list)
{
discrete_step_interface *step;
- if ((*node)->interface(step))
+ if (node->interface(step))
total += step->run_time;
}
return total;
}
-static uint64_t step_list_run_time(const node_step_list_t &list)
+static uint64_t step_list_run_time(const discrete_device::node_step_list_t &list)
{
uint64_t total = 0;
- for_each(discrete_step_interface **, node, &list)
+ for (discrete_step_interface *node : list)
{
- total += (*node)->run_time;
+ total += node->run_time;
}
return total;
}
-void discrete_device::display_profiling(void)
+void discrete_device::display_profiling()
{
int count;
uint64_t total;
uint64_t tresh;
- double tt;
/* calculate total time */
total = list_run_time(m_node_list);
- count = m_node_list.count();
+ count = m_node_list.size();
/* print statistics */
- util::stream_format(std::cout, "Total Samples : %16d\n", m_total_samples);
+ osd_printf_info("Total Samples : %16d\n", m_total_samples);
tresh = total / count;
- util::stream_format(std::cout, "Threshold (mean): %16d\n", tresh / m_total_samples );
- for_each(discrete_base_node **, node, &m_node_list)
+ osd_printf_info("Threshold (mean): %16d\n", tresh / m_total_samples);
+ for (const auto &node : m_node_list)
{
discrete_step_interface *step;
- if ((*node)->interface(step))
+ if (node->interface(step))
if (step->run_time > tresh)
- util::stream_format(std::cout, "%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), double(step->run_time) / double(total) * 100.0, double(step->run_time) / double(m_total_samples));
+ osd_printf_info("%3d: %20s %8.2f %10.2f\n", node->index(), node->module_name(), double(step->run_time) / double(total) * 100.0, double(step->run_time) / double(m_total_samples));
}
/* Task information */
- for_each(discrete_task **, task, &task_list)
+ for (const auto &task : task_list)
{
- tt = step_list_run_time((*task)->step_list);
+ double tt = step_list_run_time(task->step_list);
- util::stream_format(std::cout, "Task(%d): %8.2f %15.2f\n", (*task)->task_group, tt / double(total) * 100.0, tt / double(m_total_samples));
+ osd_printf_info("Task(%d): %8.2f %15.2f\n", task->task_group, tt / double(total) * 100.0, tt / double(m_total_samples));
}
- util::stream_format(std::cout, "Average samples/double->update: %8.2f\n", double(m_total_samples) / double(m_total_stream_updates));
+ osd_printf_info("Average samples/double->update: %8.2f\n", double(m_total_samples) / double(m_total_stream_updates));
}
@@ -687,15 +669,15 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list)
{
discrete_task *task = nullptr;
/* list tail pointers */
- int has_tasks = 0;
+ bool has_tasks = false;
/* check whether we have tasks ... */
if (USE_DISCRETE_TASKS)
{
- for (int i = 0; i < block_list.count(); i++)
+ for (int i = 0; !has_tasks && (i < block_list.size()); i++)
{
if (block_list[i]->type == DSO_TASK_START)
- has_tasks = 1;
+ has_tasks = true;
}
}
@@ -704,21 +686,23 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list)
/* make sure we have one simple task
* No need to create a node since there are no dependencies.
*/
- task = auto_alloc_clear(machine(), <discrete_task>(*this));
- task_list.add(task);
+ task_list.push_back(std::make_unique<discrete_task>(*this));
+ task = task_list.back().get();
}
/* loop over all nodes */
- for (int i = 0; i < block_list.count(); i++)
+ for (int i = 0; i < block_list.size(); i++)
{
- const discrete_block *block = block_list[i];
+ const discrete_block &block = *block_list[i];
+
+ // add to node list
+ m_node_list.push_back(block.factory(*this, block));
+ discrete_base_node &node = *m_node_list.back();
- //discrete_base_node *node = block->factory->Create(this, block);
- discrete_base_node *node = block->factory(this, block);
- /* keep track of special nodes */
- if (block->node == NODE_SPECIAL)
+ if (block.node == NODE_SPECIAL)
{
- switch(block->type)
+ // keep track of special nodes
+ switch (block.type)
{
/* Output Node */
case DSO_OUTPUT:
@@ -739,12 +723,12 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list)
{
if (task != nullptr)
fatalerror("init_nodes() - Nested DISCRETE_START_TASK.\n");
- task = auto_alloc_clear(machine(), <discrete_task>(*this));
- task->task_group = block->initial[0];
+ task_list.push_back(std::make_unique<discrete_task>(*this));
+ task = task_list.back().get();
+ task->task_group = block.initial[0];
if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS)
fatalerror("discrete_dso_task: illegal task_group %d\n", task->task_group);
- //util::stream_format(std::cout, "task group %d\n", task->task_group);
- task_list.add(task);
+ //logerror("task group %d\n", task->task_group);
}
break;
@@ -760,37 +744,33 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list)
fatalerror("init_nodes() - Failed, trying to create unknown special discrete node.\n");
}
}
-
- /* otherwise, make sure we are not a duplicate, and put ourselves into the indexed list */
else
{
- if (m_indexed_node[NODE_INDEX(block->node)])
- fatalerror("init_nodes() - Duplicate entries for NODE_%02d\n", NODE_INDEX(block->node));
- m_indexed_node[NODE_INDEX(block->node)] = node;
+ // otherwise, make sure we are not a duplicate, and put ourselves into the indexed list
+ if (m_indexed_node[NODE_INDEX(block.node)])
+ fatalerror("init_nodes() - Duplicate entries for NODE_%02d\n", NODE_INDEX(block.node));
+ m_indexed_node[NODE_INDEX(block.node)] = &node;
}
- /* add to node list */
- m_node_list.add(node);
-
- /* our running order just follows the order specified */
- /* does the node step ? */
+ // our running order just follows the order specified
+ // does the node step?
discrete_step_interface *step;
- if (node->interface(step))
+ if (node.interface(step))
{
/* do we belong to a task? */
if (task == nullptr)
- fatalerror("init_nodes() - found node outside of task: %s\n", node->module_name() );
+ fatalerror("init_nodes() - found node outside of task: %s\n", node.module_name());
else
- task->step_list.add(step);
+ task->step_list.push_back(step);
}
- if (USE_DISCRETE_TASKS && block->type == DSO_TASK_END)
+ if (USE_DISCRETE_TASKS && block.type == DSO_TASK_END)
{
task = nullptr;
}
/* and register save state */
- node->save_state();
+ node.save_state();
}
if (!has_tasks)
@@ -810,11 +790,11 @@ int discrete_device::same_module_index(const discrete_base_node &node)
{
int index = 0;
- for_each(discrete_base_node **, n, &m_node_list)
+ for (const auto &n : m_node_list)
{
- if (*n == &node)
+ if (n.get() == &node)
return index;
- if ((*n)->module_type() == node.module_type())
+ if (n->module_type() == node.module_type())
index++;
}
return -1;
@@ -851,7 +831,7 @@ discrete_sound_device::discrete_sound_device(const machine_config &mconfig, cons
{
}
-discrete_device::~discrete_device(void)
+discrete_device::~discrete_device()
{
}
@@ -862,7 +842,7 @@ discrete_device::~discrete_device(void)
void discrete_device::device_start()
{
// create the stream
- //m_stream = stream_alloc_legacy(0, 2, 22257);
+ //m_stream = stream_alloc(0, 2, 22257);
const discrete_block *intf_start = m_intf;
@@ -897,33 +877,33 @@ void discrete_device::device_start()
m_node_list.clear();
/* allocate memory to hold pointers to nodes by index */
- m_indexed_node = auto_alloc_array_clear(this->machine(), discrete_base_node *, DISCRETE_MAX_NODES);
+ m_indexed_node = make_unique_clear<discrete_base_node * []>(DISCRETE_MAX_NODES);
/* initialize the node data */
init_nodes(block_list);
/* now go back and find pointers to all input nodes */
- for_each(discrete_base_node **, node, &m_node_list)
+ for (const auto &node : m_node_list)
{
- (*node)->resolve_input_nodes();
+ node->resolve_input_nodes();
}
/* allocate a queue */
m_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
/* Process nodes which have a start func */
- for_each(discrete_base_node **, node, &m_node_list)
+ for (const auto &node : m_node_list)
{
- (*node)->start();
+ node->start();
}
/* Now set up tasks */
- for_each(discrete_task **, task, &task_list)
+ for (const auto &task : task_list)
{
- for_each(discrete_task **, dest_task, &task_list)
+ for (const auto &dest_task : task_list)
{
- if ((*task)->task_group > (*dest_task)->task_group)
- (*dest_task)->check((*task));
+ if (task->task_group > dest_task->task_group)
+ dest_task->check(*task);
}
}
}
@@ -942,9 +922,9 @@ void discrete_device::device_stop()
/* Process nodes which have a stop func */
- for_each(discrete_base_node **, node, &m_node_list)
+ for (const auto &node : m_node_list)
{
- (*node)->stop();
+ node->stop();
}
if (DISCRETE_DEBUGLOG)
@@ -969,31 +949,31 @@ void discrete_sound_device::device_start()
discrete_device::device_start();
/* look for input stream nodes */
- for_each(discrete_base_node **, node, &m_node_list)
+ for (const auto &node : m_node_list)
{
/* if we are an stream input node, track that */
- discrete_dss_input_stream_node *input_stream = dynamic_cast<discrete_dss_input_stream_node *>(*node);
+ discrete_dss_input_stream_node *input_stream = dynamic_cast<discrete_dss_input_stream_node *>(node.get());
if (input_stream != nullptr)
{
- m_input_stream_list.add(input_stream);
+ m_input_stream_list.push_back(input_stream);
}
/* if this is an output interface, add it the output list */
discrete_sound_output_interface *out;
- if ((*node)->interface(out))
- m_output_list.add(out);
+ if (node->interface(out))
+ m_output_list.push_back(out);
}
/* if no outputs, give an error */
- if (m_output_list.count() == 0)
+ if (m_output_list.empty())
fatalerror("init_nodes() - Couldn't find an output node\n");
/* initialize the stream(s) */
- m_stream = stream_alloc(m_input_stream_list.count(), m_output_list.count(), m_sample_rate);
+ m_stream = stream_alloc(m_input_stream_list.size(), m_output_list.size(), m_sample_rate);
/* Finalize stream_input_nodes */
- for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list)
+ for (discrete_dss_input_stream_node *node : m_input_stream_list)
{
- (*node)->stream_start();
+ node->stream_start();
}
@@ -1008,12 +988,12 @@ void discrete_device::device_reset()
update_to_current_time();
/* loop over all nodes */
- for_each (discrete_base_node **, node, &m_node_list)
+ for (const auto &node : m_node_list)
{
/* Fimxe : node_level */
- (*node)->m_output[0] = 0;
+ node->m_output[0] = 0;
- (*node)->reset();
+ node->reset();
}
}
@@ -1026,7 +1006,7 @@ void discrete_sound_device::device_reset()
// discrete_device_process - process a number of
// samples.
//
-// input / output buffers are stream_sample_t
+// input / output buffers are s32
// to not to have to convert the buffers.
// a "discrete cpu" device will pass nullptr here
//-------------------------------------------------
@@ -1037,18 +1017,19 @@ void discrete_device::process(int samples)
return;
/* Setup tasks */
- for_each(discrete_task **, task, &task_list)
+ for (const auto &task : task_list)
{
/* unlock the thread */
- (*task)->unlock();
+ task->unlock();
- (*task)->prepare_for_queue(samples);
+ task->prepare_for_queue(samples);
}
- for_each(discrete_task **, task, &task_list)
+ for (const auto &task : task_list)
{
/* Fire a work item for each task */
- osd_work_item_queue(m_queue, discrete_task::task_callback, (void *) &task_list, WORK_ITEM_FLAG_AUTO_RELEASE);
+ (void)task;
+ osd_work_item_queue(m_queue, discrete_task::task_callback, (void *)&task_list, WORK_ITEM_FLAG_AUTO_RELEASE);
}
osd_work_queue_wait(m_queue, osd_ticks_per_second()*10);
@@ -1060,7 +1041,7 @@ void discrete_device::process(int samples)
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle update requests for
+// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
@@ -1069,17 +1050,17 @@ void discrete_sound_device::sound_stream_update(sound_stream &stream, std::vecto
int outputnum = 0;
/* Setup any output streams */
- for_each(discrete_sound_output_interface **, node, &m_output_list)
+ for (discrete_sound_output_interface *node : m_output_list)
{
- (*node)->set_output_ptr(outputs[outputnum]);
+ node->set_output_ptr(outputs[outputnum]);
outputnum++;
}
/* Setup any input streams */
- for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list)
+ for (discrete_dss_input_stream_node *node : m_input_stream_list)
{
- (*node)->m_inview = &inputs[(*node)->m_stream_in_number];
- (*node)->m_inview_sample = 0;
+ node->m_inview = &inputs[node->m_stream_in_number];
+ node->m_inview_sample = 0;
}
/* just process it */