General Category > Emulators

New Arnold port for Trimui Model S and Miyoo based Handhelds

<< < (2/2)

Aeliss:
Ha yes 2 inches ... less than the gameboy, not terrible.   

The arnold core Im using is a recent version gived by arnoldemu (but 2/3 year old at least ^^), but more recent than the version you can find.   
The other part is specific to windows, I don't remember all the reason, but to explain my code   

The hardware sound engine have a frequency = 44100 Hz with 4 Bytes per sample
The Display have a 50 Hz frequency, we have 64 * 39 * 8 = 19 968  Nops per seconds (Nops by frame * Frequency)   
We need 44100 / 50 = 882 samples per screen refresh   
We need 882 / 19968 = 0.044120.... sample per nops   The sound buffer size = 0.044120 *4 * 19968 = 3524 Bytes.   

But values are not "whole". If you debug around the code that check cycles   


--- Code: ---        while (Cycles <19968)        {        }
--- End code ---
   

On your code it's around here   


--- Code: ---        /* nop counter is used to define when we render the whole display */
        if (LocalNopCountToDate<=0)       
        {

--- End code ---
   

You will see you have sometime the sound buffer with 3528 data, sometime with 3524, not possible having something fixe, So have used this kind of hack   

--- Code: ---        while ( ((Cycles <19968) && (!Hack_Synchrosound)) || ((GetLenghtBuff() < 3528) && (Hack_Synchrosound)) )
        //while (Cycles <19968)
        {
            int NopCount;

            /* execute the instruction */
            NopCount = CPU_ExecuteCycles();

            if (NopCount==0) break;

            if (BoostZ80 > 0)
            {
                /* Accumulate the Nop counts */
                NopCountAcc += NopCount;
                /* See if we accumulated enough */
--- End code ---
I can use core synchronisation with (Cycles <19968) or sound buffer synchronisation with (GetLenghtBuff() < 3528)   

It s in the arnol.cpp file in the win folder. All file in "cpc" folder are "native", all modified file are in the folder "cpc_modified", and all in "win" folder are specific to windows.     
On your side you just need to use a fonction that calculate sound buffer size already filled, and use this value instead of counting nop.

Liartes:
Thanks for the explanation, I understand a bit more what is happening with this sound buffer now  :D
I made another release using the Cycles control and it is a bit better, I will give another try to the buffersize solution in the light of what you shared here.

Navigation

[0] Message Index

[*] Previous page

Go to full version
Powered by SMFPacks Reactions Mod
Powered by SMFPacks Alerts Pro Mod
Powered by SMFPacks Mentions Pro Mod