mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 06:53:01 +00:00
YMZ280B: fix VGM export
This commit is contained in:
parent
d943eb02ae
commit
8041173eb9
4 changed files with 17 additions and 18 deletions
|
@ -286,6 +286,8 @@ int ymz280b_device::generate_pcm8(struct YMZ280BVoice *voice, s16 *buffer, int s
|
||||||
|
|
||||||
***********************************************************************************************/
|
***********************************************************************************************/
|
||||||
|
|
||||||
|
// according to this core, it should be little-endian.
|
||||||
|
// but it's big-endian in VGMPlay...
|
||||||
int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int samples)
|
int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int samples)
|
||||||
{
|
{
|
||||||
u32 position = voice->position;
|
u32 position = voice->position;
|
||||||
|
@ -298,7 +300,7 @@ int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int
|
||||||
while (samples)
|
while (samples)
|
||||||
{
|
{
|
||||||
/* fetch the current value */
|
/* fetch the current value */
|
||||||
val = (s16)((m_ext_mem[position / 2 + 1] << 8) + m_ext_mem[position / 2 + 0]);
|
val = (s16)((m_ext_mem[position / 2 + 0] << 8) + m_ext_mem[position / 2 + 1]);
|
||||||
|
|
||||||
/* output to the buffer, scaling by the volume */
|
/* output to the buffer, scaling by the volume */
|
||||||
*buffer++ = val;
|
*buffer++ = val;
|
||||||
|
@ -321,7 +323,7 @@ int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int
|
||||||
while (samples)
|
while (samples)
|
||||||
{
|
{
|
||||||
/* fetch the current value */
|
/* fetch the current value */
|
||||||
val = (s16)((m_ext_mem[position / 2 + 1] << 8) + m_ext_mem[position / 2 + 0]);
|
val = (s16)((m_ext_mem[position / 2 + 0] << 8) + m_ext_mem[position / 2 + 1]);
|
||||||
|
|
||||||
/* output to the buffer, scaling by the volume */
|
/* output to the buffer, scaling by the volume */
|
||||||
*buffer++ = val;
|
*buffer++ = val;
|
||||||
|
|
|
@ -431,7 +431,17 @@ void DivPlatformYMZ280B::renderSamples() {
|
||||||
unsigned char* src=(unsigned char*)s->getCurBuf();
|
unsigned char* src=(unsigned char*)s->getCurBuf();
|
||||||
int actualLength=MIN((int)(getSampleMemCapacity()-memPos),length);
|
int actualLength=MIN((int)(getSampleMemCapacity()-memPos),length);
|
||||||
if (actualLength>0) {
|
if (actualLength>0) {
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
memcpy(&sampleMem[memPos],src,actualLength);
|
memcpy(&sampleMem[memPos],src,actualLength);
|
||||||
|
#else
|
||||||
|
if (s->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
|
for (int i=0; i<actualLength; i++) {
|
||||||
|
sampleMem[memPos+i]=src[i^1];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
memcpy(&sampleMem[memPos],src,actualLength);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
sampleOff[i]=memPos;
|
sampleOff[i]=memPos;
|
||||||
memPos+=length;
|
memPos+=length;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1746,21 +1746,6 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
|
||||||
size_t sampleMemLen=writeZ280[i]->getSampleMemUsage();
|
size_t sampleMemLen=writeZ280[i]->getSampleMemUsage();
|
||||||
unsigned char* sampleMem=new unsigned char[sampleMemLen];
|
unsigned char* sampleMem=new unsigned char[sampleMemLen];
|
||||||
memcpy(sampleMem,writeZ280[i]->getSampleMem(),sampleMemLen);
|
memcpy(sampleMem,writeZ280[i]->getSampleMem(),sampleMemLen);
|
||||||
// TODO: please fix this later
|
|
||||||
/*
|
|
||||||
for (int i=0; i<song.sampleLen; i++) {
|
|
||||||
DivSample* s=song.sample[i];
|
|
||||||
if (s->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
|
||||||
unsigned int pos=s->offYMZ280B;
|
|
||||||
for (unsigned int j=0; j<s->samples; j++) {
|
|
||||||
unsigned char lo=sampleMem[pos+j*2];
|
|
||||||
unsigned char hi=sampleMem[pos+j*2+1];
|
|
||||||
sampleMem[pos+j*2]=hi;
|
|
||||||
sampleMem[pos+j*2+1]=lo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
w->writeC(0x67);
|
w->writeC(0x67);
|
||||||
w->writeC(0x66);
|
w->writeC(0x66);
|
||||||
w->writeC(0x86);
|
w->writeC(0x86);
|
||||||
|
|
|
@ -204,7 +204,9 @@ void FurnaceGUI::drawMobileControls() {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Button("Export Audio");
|
ImGui::Button("Export Audio");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Button("Export VGM");
|
if (ImGui::Button("Export VGM")) {
|
||||||
|
openFileDialog(GUI_FILE_EXPORT_VGM);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Button("CmdStream");
|
ImGui::Button("CmdStream");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue