CreateSoundFromMemblock

Family: Memblock · 2 forms

What it does

CreateSoundFromMemblock brings a Memblock object into being: it is how the rest of the program comes to have one. It takes soundID (an integer) and memID (an integer), and returns nothing. That is the first of 2 forms. soundID is the id you are giving a Sound object: every later call names it by that number.

Syntax

1
CreateSoundFromMemblock(soundID integer, memID integer)
2
CreateSoundFromMemblock(memID integer) → integer

Parameters

NameTypeIn forms
soundIDinteger1
memIDintegerall

What each form returns

1CreateSoundFromMemblock(1, memblock)nothing
2soundFromMemblock = CreateSoundFromMemblock(1)integer

Example · generated

Form 1, you choose the id yourself

memblock = CreateMemblockFromFile("assets/data.dat")CreateSoundFromMemblock(1, memblock)DO  Sync()LOOP

Form 2, the command hands back the id

soundFromMemblock = CreateSoundFromMemblock(1)DO  Sync()LOOP

CreateMemblockFromFile is there to give the call something to act on; CreateSoundFromMemblock is the line that matters. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

43 commands in Memblock