int init_sound (void) { if (gSoundPlayer != NULL) return 0; media_raw_audio_format audioFormat; gSoundBufferSize = currprefs.sound_freq * currprefs.sound_latency * (currprefs.sound_stereo ? 2 : 1) / 1000; gSoundBufferSize = get_nearest_power_of_2 (gSoundBufferSize); audioFormat.frame_rate = currprefs.sound_freq; audioFormat.channel_count = currprefs.sound_stereo ? 2 : 1; audioFormat.format = media_raw_audio_format::B_AUDIO_FLOAT; audioFormat.byte_order = B_MEDIA_HOST_ENDIAN; audioFormat.buffer_size = gSoundBufferSize * sizeof(float); gSoundPlayer = new BSoundPlayer (&audioFormat, "UAE SoundPlayer", stream_func16); sound_ready = (gSoundPlayer != NULL); if (!currprefs.produce_sound) return 3; sound_sync_sem = create_sem (0, "UAE Sound Sync Semaphore"); gBufferReadPos = 0; gDoubleBufferWrite = new uae_u16[2 * gSoundBufferSize]; gDoubleBufferRead = gDoubleBufferWrite + gSoundBufferSize; buffer = gDoubleBufferWrite; memset (buffer, 0, 4 * gSoundBufferSize); paula_sndbufpt = paula_sndbuffer = buffer; paula_sndbufsize = sizeof (uae_u16) * gSoundBufferSize; if (currprefs.sound_stereo) sample_handler = sample16s_handler; else sample_handler = sample16_handler; init_sound_table16 (); sound_available = 1; obtainedfreq = currprefs.sound_freq; write_log ("BeOS sound driver found and configured at %d Hz, buffer is %d samples (%d ms)\n", currprefs.sound_freq, gSoundBufferSize / audioFormat.channel_count, (gSoundBufferSize / audioFormat.channel_count) * 1000 / currprefs.sound_freq); if (gSoundPlayer) { gSoundPlayer->Start (); gSoundPlayer->SetHasData (true); return 1; } return 0; }
IR_GVN::IR_GVN(REGION * ru) { IS_TRUE0(ru != NULL); m_ru = ru; m_md_sys = m_ru->get_md_sys(); m_du = m_ru->get_du_mgr(); m_dm = m_ru->get_dm(); m_cfg = m_ru->get_cfg(); m_vn_count = 1; m_is_vn_fp = false; m_is_valid = false; m_is_comp_ild_vn_by_du = true; m_is_comp_lda_string = false; m_zero_vn = NULL; LIST<IR_BB*> * bbl = ru->get_bb_list(); UINT n = 0; for (IR_BB * bb = bbl->get_head(); bb != NULL; bb = bbl->get_next()) { n += IR_BB_ir_num(bb); } m_stmt2domdef.init(MAX(4, get_nearest_power_of_2(n/2))); m_pool = smpool_create_handle(sizeof(VN) * 4, MEM_COMM); }