bool decode_run( audio_chunk & p_chunk, abort_callback & p_abort ) { if (!loop && is_playing == 0) return false; int nbSample = 512; sample_buffer.grow_size( nbSample ); is_playing = ModPlug_Read(m_player, sample_buffer.get_ptr(), nbSample*2); p_chunk.set_data_fixedpoint( sample_buffer.get_ptr(), nbSample * 2, 44100, 2, 32, audio_chunk::channel_config_stereo ); return true; }
bool decode_run( audio_chunk & p_chunk, abort_callback & p_abort ) { if (!loop && m_info.musicTimeInMs == ymMusicGetPos(m_player)) return false; int nbSample = 500 / sizeof(ymsample); sample_buffer.grow_size( nbSample ); ymMusicCompute(m_player,sample_buffer.get_ptr(), nbSample); p_chunk.set_data_fixedpoint( sample_buffer.get_ptr(), nbSample * 2, 44100, 1, 16, audio_chunk::channel_config_mono ); return true; }
virtual /* [local] */ HRESULT STDMETHODCALLTYPE Write( /* [size_is][in] */ const void *pv, /* [in] */ ULONG cb, /* [out] */ ULONG *pcbWritten) { t_size old_size = m_data.get_size(), new_size = m_position + cb; if (new_size > old_size) { m_data.grow_size(new_size); memset(&m_data.get_ptr()[old_size], 0,new_size-new_size); } memcpy(&m_data.get_ptr()[m_position], pv, cb); m_position += cb; if (pcbWritten) *pcbWritten = cb; return S_OK; }