Sega Genesis Dev Kit (SGDK)
Moderator: Stef
-
- Very interested
- Posts: 2994
- Joined: Fri Aug 17, 2007 9:33 pm
Ok, got it, thanks.
returns PCM time in millisecond :
returns PCM time in millisecond :
Code: Select all
u32 SND_getTime_PCM()
{
static const u32 rts[6] = { 32000, 22050, 16000, 13400, 11025, 8000 };
Z80_loadDriver(Z80_DRIVER_PCM, 1);
Z80_requestBus(1);
vu8 *pb = (u8*)(Z80_DRV_PARAMS+0x10);
u32 cr = (u32)pb[0]<<8|(u32)pb[1]<<16;
pb = (u8*)Z80_DRV_PARAMS;
cr -= (u32)pb[0]<<8|(u32)pb[1]<<16;
cr *= 1000;
cr /= rts[pb[4]];
Z80_releaseBus();
return cr;
}
Last edited by bioloid on Sat Aug 04, 2012 5:21 pm, edited 2 times in total.
-
- Very interested
- Posts: 2994
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
No register in the YM is readable, all reads will return status register. Registers can only be read back on some variations of OPL3.
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 2994
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Again if you look at the driver source you can try to retrieve sample data from the internal sound mix buffer. If you do that you have to take care about doing short Z80 interruption as it affect playback quality.bioloid wrote:Is there a way to retrieve output amplitude as well ? (need to sync a sinus effect)
"More importantly": are you sure Mem_Free is working ? I guess so, but when I do reset on the real console, something goes wrong : looks plainly like a Mem_Alloc is failing. As you know I'm not a "mega vaudou", I really dont know what reset does. Its not a big problem to have this behavior, but if it can't be solved I need, at least, a way to know if the console has been reset...
[it doesnt crash but missed stuff...]
[it doesnt crash but missed stuff...]
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Mem_Free should work but maybe there is something incorrect with the reset handler... i just had a look in sources and cannot find something wrong but some tests may clarify that.bioloid wrote:"More importantly": are you sure Mem_Free is working ? I guess so, but when I do reset on the real console, something goes wrong : looks plainly like a Mem_Alloc is failing. As you know I'm not a "mega vaudou", I really dont know what reset does. Its not a big problem to have this behavior, but if it can't be solved I need, at least, a way to know if the console has been reset...
[it doesnt crash but missed stuff...]
Ok got the demo looping, indeed Mem_Free works, I kind of notice slowdown after some loops but I guess it comes from something in my code. I'll retry the reset thing, and maybe share you the whole stuff if you wanna take a look (or even use stuff after the release). Glad to be helped! (and help if I may).
Ok, I've some strange things happening sometimes... I'll live with it (and even try to use it as features, and I'll give the whole thing after the release). Thanks.
Ok, I've some strange things happening sometimes... I'll live with it (and even try to use it as features, and I'll give the whole thing after the release). Thanks.