0
0

Hi!
I’m trying to write foobar2000 .9 plugin to listen tracker music (XM/IT/S3M/MOD)
Unfortunally I’m getting distorted output

Please, provide complete 100% working example howto decode XM file into PCM data

thats my code (fragmentary):
[code:mlpxh87k]

// Gloabl init
FMOD_RESULT result;
result = FMOD::System_Create(&m_system);
result = m_system->setOutput(FMOD_OUTPUTTYPE_NOSOUND); // I does not need playback via FMOD
result = m_system->setSoftwareChannels(128);
result = m_system->setSoftwareFormat(48000, FMOD_SOUND_FORMAT_PCM16, 0,0, FMOD_DSP_RESAMPLER_LINEAR);
result = m_system->init(1024, FMOD_INIT_NORMAL, 0);
result = m_system->setFileSystem(my_FMOD_FILE_OPENCALLBACK, my_FMOD_FILE_CLOSECALLBACK, my_FMOD_FILE_READCALLBACK, my_FMOD_FILE_SEEKCALLBACK, -1);

//Open XM file
result=m_system->createSound((const char*)this, FMOD_LOOP_OFF|FMOD_SOFTWARE|FMOD_CREATESTREAM|FMOD_OPENONLY|FMOD_ACCURATETIME, NULL, &m_sound)
result=m_sound->setDefaults(48000, 1.0, 0.0, 128);
m_samplerate=48000; // Assuming samplerate
result = m_sound->getLength(&m_samplecount, FMOD_TIMEUNIT_PCM);
result = m_sound->getFormat(NULL, NULL, &m_channels, &m_bitspersample);

//Seek to zero
result = m_sound->seekData(0);

//Get data
int toread = 1024*m_bitspersample/8;
char * buf = malloc(toread)
unsigned int readd=0;

result = m_sound->readData(buf, toread, &readd);

[/code:mlpxh87k]

[b:mlpxh87k]How to threat obtained data? I’m trying to threat them as Signed PCM where every sample (L+R) is m_bitspersample (L or R separatly is m_bitspersample/2) but no luck! Please, HELP![/b:mlpxh87k]

Thanx!

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.