blargg_err_t Classic_Emu::play_( int count, sample_t out [] ) { // read from buffer, then refill buffer and repeat if necessary int remain = count; while ( remain ) { buf->disable_immediate_removal(); remain -= buf->read_samples( &out [count - remain], remain ); if ( remain ) { if ( buf_changed_count != buf->channels_changed_count() ) { buf_changed_count = buf->channels_changed_count(); remute_voices(); } // TODO: use more accurate length calculation int msec = buf->length(); blip_time_t clocks_emulated = msec * clock_rate_ / 1000 - 100; RETURN_ERR( run_clocks( clocks_emulated, msec ) ); assert( clocks_emulated ); buf->end_frame( clocks_emulated ); } } return blargg_ok; }
PHP_METHOD(Clockthread, start) { long anz_activities; zval *clock_array; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la", &anz_activities, &clock_array) != SUCCESS) { return; } run_clocks(clock_array); RETURN_LONG(clock_thread); }
blargg_err_t Classic_Emu::play_( long count, sample_t* out ) { long remain = count; while ( remain ) { remain -= buf->read_samples( &out [count - remain], remain ); if ( remain ) { if ( buf_changed_count != buf->channels_changed_count() ) { buf_changed_count = buf->channels_changed_count(); remute_voices(); } int msec = buf->length(); blip_time_t clocks_emulated = (blargg_long) msec * clock_rate_ / 1000; RETURN_ERR( run_clocks( clocks_emulated, msec ) ); assert( clocks_emulated ); buf->end_frame( clocks_emulated ); } } return 0; }