DSO_TASK_END now builds it's own dependence list.

- now simply DSO_TASK_END() ends a task
- updated drivers accordingly
- fixed dependence on disc_sys.c in sound.mak
This commit is contained in:
Couriersud 2009-09-06 14:54:10 +00:00
parent 872eabafb2
commit ac6238dc59
6 changed files with 82 additions and 21 deletions

View File

@ -29,13 +29,70 @@ struct dso_wavelog_context
char name[32];
};
/*************************************
*
* Task node (main task execution)
*
*************************************/
static DISCRETE_START( dso_task )
{
discrete_task_context *task = (discrete_task_context *) node->context;
int inputnum;
linked_list_entry *node_entry;
linked_list_entry *step_entry;
/* Determine, which nodes in the task are referenced in the main task
* and add them to the list of nodes to be buffered for further processing
*/
for (node_entry = task->list; node_entry != NULL; node_entry = node_entry->next)
{
node_description *node = (node_description *) node_entry->ptr;
int found = 0;
for (step_entry = node->info->step_list; step_entry != NULL; step_entry = step_entry->next)
{
node_description *snode = (node_description *) step_entry->ptr;
/* loop over all active inputs */
for (inputnum = 0; inputnum < snode->active_inputs; inputnum++)
{
int inputnode = snode->block->input_node[inputnum];
if IS_VALUE_A_NODE(inputnode)
{
if (NODE_DEFAULT_NODE(node->block->node) == NODE_DEFAULT_NODE(inputnode))
{
int i;
found = 0;
for (i = 0; i < task->numbuffered; i++)
if (task->nodes[i] == inputnode)
found = 1;
if (!found)
{
if (task->numbuffered >= DISCRETE_MAX_TASK_OUTPUTS)
fatalerror("dso_task_start - Number of maximum buffered nodes exceeded");
discrete_log(node->info, "dso_task_start - buffering %d(%d) in task %p referenced by %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, NODE_INDEX(snode->node));
task->node_buf[task->numbuffered] = auto_alloc_array(node->info->device->machine, double, 2048);
task->dest[task->numbuffered] = (double **) &snode->input[inputnum];
task->nodes[task->numbuffered] = inputnode;
task->numbuffered++;
}
}
}
}
}
}
}
static DISCRETE_STEP( dso_task )
{
discrete_task_context *ctx = (discrete_task_context *) node->context;
discrete_task_context *task = (discrete_task_context *) node->context;
int i;
for (i = 0; i < ctx->numbuffered; i++)
*(ctx->ptr[i]++) = DISCRETE_INPUT(i);
for (i = 0; i < task->numbuffered; i++)
*(task->ptr[i]++) = **task->dest[i]; //DISCRETE_INPUT(i);
}
static DISCRETE_RESET( dso_task )

View File

@ -180,7 +180,7 @@ static const discrete_module module_list[] =
/* parallel modules */
{ DSO_TASK_START ,"DSO_TASK_START" , 0 ,0 ,NULL ,NULL ,NULL ,NULL },
{ DSO_TASK_END ,"DSO_TASK_END" , 0 ,0 ,dso_task_reset ,dso_task_step ,NULL ,NULL },
{ DSO_TASK_END ,"DSO_TASK_END" , 0 ,0 ,dso_task_reset ,dso_task_step ,dso_task_start ,NULL },
{ DSO_TASK_SYNC ,"DSO_TASK_SYNC" , 0 ,0 ,NULL ,NULL ,NULL ,NULL },
/* nop */
@ -832,6 +832,9 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
if (task_node_list_ptr == NULL)
fatalerror("init_nodes() - NO DISCRETE_START_TASK.");
task = auto_alloc_clear(info->device->machine, discrete_task_context);
#if 1
task->numbuffered = 0;
#else
task->numbuffered = node->active_inputs;
{
int i;
@ -841,6 +844,7 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
task->dest[i] = (double **) &node->input[i];
}
}
#endif
task->list = task_node_list;
linked_list_add(info, &task_list_ptr, task);
node->context = task;
@ -906,7 +910,6 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
}
/*************************************
*
* Find and attach all input nodes

View File

@ -3678,10 +3678,11 @@ struct _discrete_task_context
{
linked_list_entry *list;
int numbuffered;
double *ptr[DISCRETE_MAX_TASK_OUTPUTS];
double *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
double **dest[DISCRETE_MAX_TASK_OUTPUTS];
int numbuffered;
double *ptr[DISCRETE_MAX_TASK_OUTPUTS];
double *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
int nodes[DISCRETE_MAX_TASK_OUTPUTS];
double **dest[DISCRETE_MAX_TASK_OUTPUTS];
};
@ -4414,12 +4415,8 @@ enum
/* parallel tasks */
#define DISCRETE_TASK_START() { NODE_SPECIAL, DSO_TASK_START, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_START" },
#define DISCRETE_TASK_END(BNODE1) { NODE_SPECIAL, DSO_TASK_END , 1, { BNODE1 }, { BNODE1 }, NULL, "DISCRETE_TASK_END" },
#define DISCRETE_TASK_END2(BNODE1,BNODE2) { NODE_SPECIAL, DSO_TASK_END , 2, { BNODE1,BNODE2 }, { BNODE1,BNODE2 }, NULL, "DISCRETE_TASK_END2" },
#define DISCRETE_TASK_END3(BNODE1,BNODE2,BNODE3) { NODE_SPECIAL, DSO_TASK_END , 3, { BNODE1,BNODE2,BNODE3 }, { BNODE1,BNODE2,BNODE3 }, NULL, "DISCRETE_TASK_END3" },
#define DISCRETE_TASK_END4(BNODE1,BNODE2,BNODE3,BNODE4) { NODE_SPECIAL, DSO_TASK_END , 4, { BNODE1,BNODE2,BNODE3,BNODE4 }, { BNODE1,BNODE2,BNODE3,BNODE4 }, NULL, "DISCRETE_TASK_END4" },
#define DISCRETE_TASK_END5(BNODE1,BNODE2,BNODE3,BNODE4,BNODE5) { NODE_SPECIAL, DSO_TASK_END , 5, { BNODE1,BNODE2,BNODE3,BNODE4,BNODE5 }, { BNODE1,BNODE2,BNODE3,BNODE4,BNODE5 }, NULL, "DISCRETE_TASK_END5" },
#define DISCRETE_TASK_START() { NODE_SPECIAL, DSO_TASK_START,0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_START" },
#define DISCRETE_TASK_END() { NODE_SPECIAL, DSO_TASK_END , 1, { 0 }, { 0 }, NULL, "DISCRETE_TASK_END" },
//#define DISCRETE_TASK_SYNC() { NODE_SPECIAL, DSO_TASK_SYNC, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_SYNC" },
/* output */

View File

@ -78,6 +78,7 @@ endif
$(SOUNDOBJ)/discrete.o: $(SOUNDSRC)/discrete.c \
$(SOUNDSRC)/discrete.h \
$(SOUNDSRC)/disc_dev.c \
$(SOUNDSRC)/disc_sys.c \
$(SOUNDSRC)/disc_flt.c \
$(SOUNDSRC)/disc_inp.c \
$(SOUNDSRC)/disc_mth.c \

View File

@ -384,7 +384,7 @@ static DISCRETE_SOUND_START(dkong2b)
DISCRETE_RCINTEGRATE(NODE_22,NODE_20,DK_R5, RES_2_PARALLEL(DK_R4+DK_R3,DK_R6),0,DK_C19,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
DISCRETE_MULTIPLY(DS_OUT_SOUND0,1,NODE_22,DK_R3/R_SERIES(DK_R3,DK_R4))
DISCRETE_TASK_END(DS_OUT_SOUND0)
DISCRETE_TASK_END()
/************************************************/
/* Jump */
@ -418,7 +418,7 @@ static DISCRETE_SOUND_START(dkong2b)
DISCRETE_RCINTEGRATE(NODE_39,NODE_38,DK_R27, RES_2_PARALLEL(DK_R28,DK_R26+DK_R25),0,DK_C16,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
DISCRETE_MULTIPLY(DS_OUT_SOUND1,1,NODE_39,DK_R25/(DK_R26+DK_R25))
DISCRETE_TASK_END(DS_OUT_SOUND1)
DISCRETE_TASK_END()
/************************************************/
/* Walk */
@ -444,7 +444,7 @@ static DISCRETE_SOUND_START(dkong2b)
/* Filter and divide - omitted C22 */
DISCRETE_CRFILTER(NODE_61, 1, NODE_60, DK_R15+DK_R16, DK_C23)
DISCRETE_MULTIPLY(DS_OUT_SOUND2, 1, NODE_61, DK_R15/(DK_R15+DK_R16))
DISCRETE_TASK_END(DS_OUT_SOUND2)
DISCRETE_TASK_END()
/************************************************/
/* DAC */
@ -474,7 +474,7 @@ static DISCRETE_SOUND_START(dkong2b)
#else
DISCRETE_MULTIPLY(DS_OUT_DAC, 1, NODE_73, DS_ADJ_DAC)
#endif
DISCRETE_TASK_END(DS_OUT_DAC)
DISCRETE_TASK_END()
/************************************************/
/* Amplifier */
@ -493,6 +493,9 @@ static DISCRETE_SOUND_START(dkong2b)
DISCRETE_OUTPUT(NODE_288, 32767.0/5.0 * 10)
#else
DISCRETE_OUTPUT(NODE_296, 32767.0/5.0 * 3.41)
/* Test */
//DISCRETE_CSVLOG2(NODE_296, NODE_288)
//DISCRETE_WAVELOG1(NODE_296, 32767.0/5.0 * 3.41)
#endif
DISCRETE_SOUND_END

View File

@ -308,7 +308,7 @@ static DISCRETE_SOUND_START(galaxian)
DISCRETE_BITS_DECODE(NODE_133, NODE_132, 0, 3, TTL_OUT) /* QA-QD 74393 */
/* End of this task */
DISCRETE_TASK_END5(NODE_120, NODE_SUB(133,0),NODE_SUB(133,1),NODE_SUB(133,2),NODE_SUB(133,3))
DISCRETE_TASK_END()
/* Group Hit and Fire */
@ -355,7 +355,7 @@ static DISCRETE_SOUND_START(galaxian)
DISCRETE_RCDISC5(NODE_182, NODE_181, NODE_171, (GAL_R41), GAL_C25)
/* End of task */
DISCRETE_TASK_END2(NODE_157, NODE_182)
DISCRETE_TASK_END()
/************************************************/
/* FINAL MIX */