[hatari-devel] Ym / Dma mixing

npomarede at corp.free.fr npomarede at corp.free.fr
Sat Feb 7 13:34:42 CET 2009


On Sat, 7 Feb 2009, Jean-Baptiste Berlioz wrote:

>> So, my "vote" would be to keep ym emulation simple by not adding this
>> cumulative way of storing registers to replay the whole history at the
>> end.
>
> Do you really thing the code is that comlex ? :)

Yes :) At least it's more complex than before for no audible gain :)


> I find the interface between Ym emulation and the mixer far cleaner now,
> the old version was doing some strange things.

For me, the cleaner interface is to have the ym core (or any other sound 
generating device) outputs a buffer of samples, and then the mixer only 
have to mix array of bytes, without having to know how each byte has to be 
generated (the case of dma is a little in between, because you don't 
generate bytes, but you need to resample the buffer).

I think the cleaner interface is something like :

sample *DoMix ( sample *buffer1, int freq1 , sample *buffer2, int freq2, 
[...] , int outfreq );

That is, there's a complete abstraction of how the buffer were generated, 
and DoMix can do all kind of filtering/interpolation independantly of how 
buffers were generated.

What strange things do you mean ?


>> Why do you use RecordSoundRegs in Sound_WriteReg
>>
>>         RecordSoundRegs[reg] = data & SoundRegsMask[reg];
>>
>> and not directly SoundRegs (which is already masked).
>>
>> Not a lot of bytes, but why using another copy of SoundRegs instead of
>> referencing it directly in the record functions as today ?
>
> There's one copy (SoundRegs) to emulate the Ym, and one copy
> (RecordSoundRegs) for recording .ym files.

Yes, but since they contain the same values, why not considering that the 
ym core is providing an array that can be read by other modules without 
doing another copy ?

>> I don't know ; does it really improve sound a lot at 44.1 kHz ? I'm not
>> sure the real problem to get a sound really close to dma is resampling,
>> but more in the modeling of filters that match the original 1 kohm
>> resistance between the sound chip and the left/right output for instance.
>
> Downsampling or upsampling to close sample rates does generate wrong
> frequencies. Audio resampling is far different than bitmap resampling.

I agree, and I would say they're not that different in fact because 
resampling gfx without advanced interpolation will usually give some not 
really nice results.


Nicolas




More information about the hatari-devel mailing list