Пример #1
0
void __StartLogAudio(const std::string& filename) {
	if (!m_logAudio) {
		m_logAudio = true;
		g_wave_writer.Start(filename, 44100);
		g_wave_writer.SetSkipSilence(false);
		NOTICE_LOG(SCEAUDIO, "Starting Audio logging");
	} else {
		WARN_LOG(SCEAUDIO, "Audio logging has already been started");
	}
}
Пример #2
0
void Wiimote::SpeakerData(wm_speaker_data* sd)
{
    // TODO consider using static max size instead of new
    s16 *samples = new s16[sd->length * 2];

    if (m_reg_speaker.format == 0x40)
    {
        // 8 bit PCM
        for (int i = 0; i < sd->length; ++i)
        {
            samples[i] = (s16)(s8)sd->data[i];
        }
    }
    else if (m_reg_speaker.format == 0x00)
    {
        // 4 bit Yamaha ADPCM (same as dreamcast)
        for (int i = 0; i < sd->length; ++i)
        {
            samples[i * 2] = adpcm_yamaha_expand_nibble(m_adpcm_state, (sd->data[i] >> 4) & 0xf);
            samples[i * 2 + 1] = adpcm_yamaha_expand_nibble(m_adpcm_state, sd->data[i] & 0xf);
        }
    }

#ifdef WIIMOTE_SPEAKER_DUMP
    static int num = 0;

    if (num == 0)
    {
        File::Delete("rmtdump.wav");
        File::Delete("rmtdump.bin");
        atexit(stopdamnwav);
        OpenFStream(ofile, "rmtdump.bin", ofile.binary | ofile.out);
        wav.Start("rmtdump.wav", 6000/*Common::swap16(m_reg_speaker.sample_rate)*/);
    }
    wav.AddMonoSamples(samples, sd->length*2);
    if (ofile.good())
    {
        for (int i = 0; i < sd->length; i++)
        {
            ofile << sd->data[i];
        }
    }
    num++;
#endif

    delete[] samples;
}