Page 1 of 1
On real hardware program hangs
Posted: Sun Jan 17, 2016 11:04 am
by alko
During playback wav-sample on real hardware (and on android-emulator "Gensoid" ) program crashes.
but in the emulator Kega Fusion all right.
Code: Select all
SND_startPlay_PCM(sample, sizeof(sample), SOUND_RATE_16000,SOUND_PAN_CENTER,FALSE);
I tried different samples.
Also tried turn off interrupts. It did not help.
Re: On real hardware program hangs
Posted: Sun Jan 17, 2016 3:44 pm
by alko
Cartridge - everdrive v3
Re: On real hardware program hangs
Posted: Sun Jan 17, 2016 6:42 pm
by alko
hmmm... standard example of sound-driver works properly...
It may necessary use any specific program to convert the wav?
I use jetAudio (PCM 16 kHz 8bit MONO).

Re: On real hardware program hangs
Posted: Sun Jan 17, 2016 8:38 pm
by Stef
SGDK should convert it for you, why are you converting it yourself ?
At least you can resample it to 16000 Khz as the resampler in rescomp is rubbish, but you can keep your file as WAV file at least to avoid any problem

Re: On real hardware program hangs
Posted: Mon Jan 18, 2016 5:24 am
by alko
I already converts from original file Wav 44 kHz 16bit to Wav 16 kHz 8bit
Re: On real hardware program hangs
Posted: Mon Jan 18, 2016 8:56 am
by Stef
Ok that sounds correct

as long you keep them in WAV format it should be ok. Maybe the problem come from the wav converter in SGDK :-/
Re: On real hardware program hangs
Posted: Mon Jan 18, 2016 10:35 am
by alko
One gets the impression Z80 conflicts with 68000.
They have the common bus.
Or maybe amplitude too large for this audio-driver

Re: On real hardware program hangs
Posted: Mon Jan 18, 2016 10:46 am
by Stef
Except if you are hanging the main BUS for very long period (with DMA or just accessing VDP too much during active area) it should not have any effect on Z80. Rescomp automatically takes care of converting 16 bits WAV to 8 bits if need, that could not be an amplitude problem...
Do you hear anything on real hardware ? did you try to comment all your code except the WAV play command ?
Re: On real hardware program hangs
Posted: Mon Jan 18, 2016 4:59 pm
by alko
Do you hear anything on real hardware ?
VGM|XGM-music played correctly.
did you try to comment all your code except the WAV play command ?
Code: Select all
#include <genesis.h>
#include "gfx.h"
#include "music.h"
#include "fonanimate.h"
#include "lyapanimate.h"
#include "globalvar.h"
#include "menu.h"
#include "worm.h"
#include "tride.h"
.....
static void joyEvent(u16 joy, u16 changed, u16 state);
....
int main()
{
level=lvl_worm_boss;
SYS_disableInts();
VDP_setScreenWidth320();
VDP_setScreenHeight240();
JOY_setEventHandler(joyEvent);
zastavka();
SYS_enableInts();
.....
}
.....
static void zastavka()
{
ind = TILE_USERINDEX;
VDP_drawImageEx(BPLAN, &alko, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, ind),4, 0, FALSE, TRUE);
memcpy(&palette[0], alko.palette->data, 16 * 2);
VDP_fadeIn(0, (3 * 16) - 1, palette, 150, FALSE);
SND_startPlay_PCM(hristu, sizeof(hristu),
SOUND_RATE_16000,
SOUND_PAN_CENTER,
FALSE); //THERE PROGRAM CRUSHED
waitTick(900);
VDP_fadeOut(0, (1 * 16) - 1, 150, FALSE);
}
.............
static void joyEvent(u16 joy, u16 changed, u16 state)
{
// START button state changed
/*
if (changed & BUTTON_START)
{
}
if (changed & state & (BUTTON_A | BUTTON_B | BUTTON_C))
{
}*/
}
Re: On real hardware program hangs
Posted: Mon Jan 18, 2016 9:46 pm
by Stef
I don't see any problem with the code... not sure about what happen :-/
Did you try to comment every thing except the WAV command then re-enable one by one to see where the problem arrive.
Re: On real hardware program hangs
Posted: Sun Feb 14, 2016 6:15 pm
by alko
SND_startPlayPCM_XGM (which is intended for mixing samples and music) does not hangs on hardware, unlike of SND_startPlay_PCM.
But the sample is played back slowly, as if a sampling frequency (16 kHz) does not support.
Re: On real hardware program hangs
Posted: Mon Feb 15, 2016 11:34 am
by Stef
When you want to play sample and at same time play music, you need to stick on XGM driver methods (SND_startPlayPCM_XGM(..) here) else you will change the current loaded driver and music will stop ! The XGM driver requires sample at 14Khz, normally if you define them correctly in the resources files they should be automatically converted but i recommend you to do it manually as the conversion quality may be better than my automatic one.
Re: On real hardware program hangs
Posted: Mon Feb 15, 2016 2:06 pm
by alko
Stef wrote:When you want to play sample and at same time play music
I just wanted to play a sample without music, but in this case it hangs [SND_startPlayPCM]
completely hangs
Re: On real hardware program hangs
Posted: Mon Feb 15, 2016 3:42 pm
by Stef
You probably have some edge effects with others pieces of your code, as the sound driver test sample provided in SGDK does work on real hardware (and use the same SND_startPlayPCM(..) method).
Try to isolate code to understand when it start/stop to work.