hpwit / SID6581

Control a SID Chip using esp32
MIT License
47 stars 6 forks source link

sid.getWaveForm() always returns 0 #13

Closed tobozo closed 3 years ago

tobozo commented 3 years ago

https://github.com/hpwit/SID6581/blob/9947d1bd4fd6760611c0b397a120ca7269fa5699/src/SID6581.h#L282

moving sidregisters out of the class and changing to static solved it for me, there may be cleaner solutions to that issue

image

hpwit commented 3 years ago

I think it's because it's called from a task the original declaration like volatile uint8_t sidregisters[1532]; instead of uint8_t sidregisters[1532]; Yves

tobozo commented 3 years ago

setting 'volatile' inside the class doesn't solve it, and using 'volatile' outside the class throws a compilation error

/tmp/arduino_build_474379/libraries/SID6581/SID6581.cpp.o:(.bss.sidregisters+0x0): multiple definition of 'sidregisters'

I'll keep it static outside the class for the meantime, my brains aren't good enough at OOP to figure out a better fix ^^

tobozo commented 3 years ago

fixed in the [experm] branch, also interesting to know the "invalid waveform value" was in fact valid:

    // NOTE: The  oscillator output waveforms are  NOT additive.
    // If  more than  one  output waveform  is  selected simultaneously,
    // the  result will  be  a  logical  AN Ding  of the waveforms.

closing this as solved