void creature_t::shout(const char* what) { if (strlen(what) == 0) { if (player.sees(this)) { append_msg_log("%s shouts!", capitalize(get_full_name()).c_str()); } else { append_msg_log("You hear a shout."); } } else { if (player.sees(this)) { append_msg_log("%s shouts: \"%s\".", capitalize(get_full_name()).c_str(), what); } else { append_msg_log("You hear someone shout: \"%s\".", what); } } create_noise(pos.x, pos.y, SHOUT_RADIUS); }
void nesapu_device::device_start() { // resolve callbacks m_irq_handler.resolve_safe(); m_mem_read_cb.resolve_safe(0x00); create_noise(m_noise_lut, 13, apu_t::NOISE_LONG); calculate_rates(); /* register for save */ for (int i = 0; i < 2; i++) { save_item(NAME(m_APU.squ[i].regs), i); save_item(NAME(m_APU.squ[i].vbl_length), i); save_item(NAME(m_APU.squ[i].freq), i); save_item(NAME(m_APU.squ[i].phaseacc), i); save_item(NAME(m_APU.squ[i].output_vol), i); save_item(NAME(m_APU.squ[i].env_phase), i); save_item(NAME(m_APU.squ[i].sweep_phase), i); save_item(NAME(m_APU.squ[i].adder), i); save_item(NAME(m_APU.squ[i].env_vol), i); save_item(NAME(m_APU.squ[i].enabled), i); } save_item(NAME(m_APU.tri.regs)); save_item(NAME(m_APU.tri.linear_length)); save_item(NAME(m_APU.tri.vbl_length)); save_item(NAME(m_APU.tri.write_latency)); save_item(NAME(m_APU.tri.phaseacc)); save_item(NAME(m_APU.tri.output_vol)); save_item(NAME(m_APU.tri.adder)); save_item(NAME(m_APU.tri.counter_started)); save_item(NAME(m_APU.tri.enabled)); save_item(NAME(m_APU.noi.regs)); save_item(NAME(m_APU.noi.cur_pos)); save_item(NAME(m_APU.noi.vbl_length)); save_item(NAME(m_APU.noi.phaseacc)); save_item(NAME(m_APU.noi.output_vol)); save_item(NAME(m_APU.noi.env_phase)); save_item(NAME(m_APU.noi.env_vol)); save_item(NAME(m_APU.noi.enabled)); save_item(NAME(m_APU.dpcm.regs)); save_item(NAME(m_APU.dpcm.address)); save_item(NAME(m_APU.dpcm.length)); save_item(NAME(m_APU.dpcm.bits_left)); save_item(NAME(m_APU.dpcm.phaseacc)); save_item(NAME(m_APU.dpcm.output_vol)); save_item(NAME(m_APU.dpcm.cur_byte)); save_item(NAME(m_APU.dpcm.enabled)); save_item(NAME(m_APU.dpcm.irq_occurred)); save_item(NAME(m_APU.dpcm.vol)); save_item(NAME(m_APU.regs)); #ifdef USE_QUEUE save_item(NAME(m_APU.queue)); save_item(NAME(m_APU.head)); save_item(NAME(m_APU.tail)); #else save_item(NAME(m_APU.buf_pos)); save_item(NAME(m_APU.step_mode)); #endif }
void nesapu_device::device_start() { int rate = clock() / 4; /* Initialize global variables */ m_samps_per_sync = rate / ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds); m_buffer_size = m_samps_per_sync; m_real_rate = m_samps_per_sync * ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds); m_apu_incsize = (float) (clock() / (float) m_real_rate); /* Use initializer calls */ create_noise(m_noise_lut, 13, NOISE_LONG); create_vbltimes(m_vbl_times,vbl_length,m_samps_per_sync); create_syncs(m_samps_per_sync); /* Adjust buffer size if 16 bits */ m_buffer_size+=m_samps_per_sync; /* Initialize individual chips */ (m_APU.dpcm).memory = &machine().device(m_cpu_tag)->memory().space(AS_PROGRAM); m_stream = machine().sound().stream_alloc(*this, 0, 1, rate); /* register for save */ for (int i = 0; i < 2; i++) { save_item(NAME(m_APU.squ[i].regs), i); save_item(NAME(m_APU.squ[i].vbl_length), i); save_item(NAME(m_APU.squ[i].freq), i); save_item(NAME(m_APU.squ[i].phaseacc), i); save_item(NAME(m_APU.squ[i].output_vol), i); save_item(NAME(m_APU.squ[i].env_phase), i); save_item(NAME(m_APU.squ[i].sweep_phase), i); save_item(NAME(m_APU.squ[i].adder), i); save_item(NAME(m_APU.squ[i].env_vol), i); save_item(NAME(m_APU.squ[i].enabled), i); } save_item(NAME(m_APU.tri.regs)); save_item(NAME(m_APU.tri.linear_length)); save_item(NAME(m_APU.tri.vbl_length)); save_item(NAME(m_APU.tri.write_latency)); save_item(NAME(m_APU.tri.phaseacc)); save_item(NAME(m_APU.tri.output_vol)); save_item(NAME(m_APU.tri.adder)); save_item(NAME(m_APU.tri.counter_started)); save_item(NAME(m_APU.tri.enabled)); save_item(NAME(m_APU.noi.regs)); save_item(NAME(m_APU.noi.cur_pos)); save_item(NAME(m_APU.noi.vbl_length)); save_item(NAME(m_APU.noi.phaseacc)); save_item(NAME(m_APU.noi.output_vol)); save_item(NAME(m_APU.noi.env_phase)); save_item(NAME(m_APU.noi.env_vol)); save_item(NAME(m_APU.noi.enabled)); save_item(NAME(m_APU.dpcm.regs)); save_item(NAME(m_APU.dpcm.address)); save_item(NAME(m_APU.dpcm.length)); save_item(NAME(m_APU.dpcm.bits_left)); save_item(NAME(m_APU.dpcm.phaseacc)); save_item(NAME(m_APU.dpcm.output_vol)); save_item(NAME(m_APU.dpcm.cur_byte)); save_item(NAME(m_APU.dpcm.enabled)); save_item(NAME(m_APU.dpcm.irq_occurred)); save_item(NAME(m_APU.dpcm.vol)); save_item(NAME(m_APU.regs)); #ifdef USE_QUEUE save_item(NAME(m_APU.queue)); save_item(NAME(m_APU.head)); save_item(NAME(m_APU.tail)); #else save_item(NAME(m_APU.buf_pos)); save_item(NAME(m_APU.step_mode)); #endif }
int main() { srand (time(NULL)); int i,j; double sigma; unsigned int *X = random_X (NUM_BLOCKS*NUM_CARRIERS); complex_table *IP_SIG = (complex_table *) malloc (sizeof(complex_table)); complex_table_init (IP_SIG,NUM_CARRIERS,NUM_BLOCKS,"IP_SIG"); create_IP_BLOCKS (IP_SIG,X,ALPHA,PI); complex_table *CARRIERS = (complex_table *) malloc (sizeof(complex_table)); complex_table_init (CARRIERS,NUM_BLOCKS,NUM_CARRIERS,"CARRIERS"); create_CARRIERS (CARRIERS); print_table (CARRIERS); complex_table *CARRIERST = (complex_table *) malloc (sizeof(complex_table)); complex_table_init (CARRIERST,NUM_CARRIERS,NUM_BLOCKS,"CARRIERST"); TRANSPOSE (CARRIERS,CARRIERST); //print_table (CARRIERST); //printf("\nrows : %d\tcolumns : %d",CARRIERST->rows,CARRIERST->columns); complex_table *CORRELATION = (complex_table *) malloc (sizeof(complex_table)); complex_table_init (CORRELATION,CARRIERST->columns,CARRIERST->columns,"CORRELATION"); CORRELATET (CARRIERST,CORRELATION); //print_table (CORRELATION); complex_table *MODI = (complex_table *) malloc (sizeof(complex_table)); complex_table_init (MODI,NUM_BLOCKS,NUM_BLOCKS,"MODI"); modulate (MODI,CARRIERS,IP_SIG); sigma = complex_sigma (MODI); complex_table *AWGN = (complex_table *) malloc (sizeof(complex_table)); complex_table_init (AWGN,NUM_BLOCKS*OVERSAMPLING,NUM_BLOCKS,"AWGN"); create_noise (AWGN,Eb,sigma,OVERSAMPLING); complex_table *NOISY = (complex_table *) malloc (sizeof(complex_table)); complex_table_init (NOISY,NUM_BLOCKS,NUM_BLOCKS*OVERSAMPLING,"NOISY"); // printf("\nhere\n"); // create_noisy (NOISY,AWGN,MODI); complex_addition (NOISY,AWGN,MODI); complex_table *INVERSE = (complex_table *) malloc (sizeof(complex_table)); complex_table_init (INVERSE,CORRELATION->rows,CORRELATION->columns,"INVERSE"); complex_idenity_init (INVERSE); complex_inverse (CORRELATION,INVERSE); //print_table (CORRELATION); /*for (i=0;i<NUM_BLOCKS;i++) { o = column_from_table (IP_SIG,i); complex_Ax (CARRIERS,SYMBOL,IP_BLOCK); list_to_table (MODI,SYMBOL,i); }*/ //inverse (CORRELATION,INVERSE); // send result to table :end of loop calculate sigma /*complex_list *IP_BLOCK = (complex_list *) malloc (sizeof(complex_list)); complex_list_init (IP_BLOCK);*/ // printf("\t%d\t%d\t:\t%.5lf\t%.5lf\t\n",mynode->col,mynode->row,mynode->real,mynode->imag); //complex_table *SYMBOL_MODI = create_SYMBOL_MODI (CARRIERS,IP_BLOCK); //complex_list *SEFDM_SYMBOL = (complex_list *) malloc (sizeof(complex_list)); //A_complex_x (CARRIERS,SEFDM_SYMBOL,IP_BLOCK); //double SEFDM_SQUARED = complex printf("\n\n"); printf("NUM_CARRIERS :\t\t%d \n",NUM_CARRIERS); printf("MODULATION_LEVEL :\t%d \n",MODULATION_LEVEL); printf("NUM_BLOCKS :\t\t%d \n",NUM_BLOCKS); printf("ALPHA :\t\t\t%d \n",ALPHA); printf("OVERSAMPLING :\t\t%d \n",OVERSAMPLING); printf("Eb :\t\t\t%d \n",Eb); //print_table (CARRIERS); //print_table (CORRELATION); /* print_table (IP_SIG); print_table (CARRIERS); print_table (CORRELATION); print_table (MODI); print_table (AWGN); print_table (NOISY); print_table (INVERSE); */ return 0; }