205 of 318
ZBasic System Library 195 ZX Microcontroller Family Task switching is suspended and other interrupts are disabled while the sound is being produced. However, RTC ticks are accumulated during the process and the RTC is updated when the process has completed so that the RTC does not lose time. Example Dim music as ByteVectorData("sound.txt") Call PlaySound(12, LoWord(music.DataAddress), UBound(music), 11025, 1) This example assumes that you have prepared the file “sound.txt” to contain the digitized music, sampled at 11025Hz. Compatibility The BasicX documentation for PlaySound() does not explicitly indicate that a zero repeat count will result in 65,536 iterations. However, experimental evidence indicates that it does. In the BasicX implementation the RTC will lose time if the duration is too long. It is not known if the BasicX implementation has a minimum sample rate.