RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

Sound Scheduler

SoundDMA
» SWI Calls
» Sound_Configure

Scheduler

The Scheduler is used to queue Sound system SWIs. Its most common use is to play sequences of notes, and a simplified interface is provided for this purpose.

A beat counter is used which is reset every time it reaches the end of a bar. Both its tempo and the number of beats to the bar can be programmed.

The Scheduler registers itself with the DMA Handler (SoundDMA) by passing its address using Sound_Configure. At this address there must be a pointer to the code for the Scheduler:

Offset Contents
+0 Pointer to scheduler

On entry, the following registers are passed by the DMA Handler (SoundDMA):

Entry
R12 Pointer to Scheduler (value of R4 in Sound_Configure)
R13 IRQ stack
R14 Return address
Exit
R1-R7 Preserved

Use

Although the Scheduler is principally designed for queuing sound commands it can be used to issue other SWIs. Thus it could be used to control, for example, an external instrument interface (such as a Musical Instrument Digital Interface (MIDI) expansion podule), or a screen-based music editor with real-time score replay.

Extreme care must be used with the Scheduler, as it has limitations. R2 – R7 are always cleared when the SWI is issued, and the error-returning form (‘X’ form) of the SWI is forced. Return parameters are discarded. If pointers are to be passed in R0 or R1 then the data they address must be preserved until the SWI is called. If a SWI will not work within these limitations it must not be called by the Scheduler.

The Scheduler implements the queue as a circular chain of records. A stack listing the free slots is also kept. The number of free slots varies not only according to how many events are queued, but also to how the events are ‘clustered’.

The queue is always accessed through the SWI calls provided, and so its precise format is not defined.

Event dispatcher

Every centisecond the beat counter is advanced according to the tempo value and any events that fall within the period are activated in strict queuing order. Voice and parameter change events are processed and the Sound Channel Control Block for each Voice Generator updated as necessary by the Channel Handler, before fill requests are issued to the relevant Voice Generator.

Notes

The scheduler is entered in IRQ mode, with IRQs disabled.

See also

  • Sound_Configure
Revised on November 13, 2017 02:35:44 by Alan Robertson (52) (49.192.18.196)
Edit | Back in time (6 revisions) | See changes | History | Views: Print | Source | Linked from: Sound_Configure, Sound Channel Control Block, Sound Scheduler

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys