de.sciss.jcollider
Interface BlockAllocator

All Known Implementing Classes:
ContiguousBlockAllocator, PowerOfTwoAllocator

public interface BlockAllocator

The BlockAllocator interface allows the use of different implementations of allocators for audio and control busses by the Server class. Busses are identified by their address or position (an integer number) and a number of channels. An instance of of a block allocator is obtained through a helper class that implements the Factory sub interface.

Version:
0.28, 24-Jul-06
Author:
Hanns Holger Rutz

Nested Class Summary
static interface BlockAllocator.Block
          This sub interface describes a class which represents a block of indices in a BlockAllocator.
static interface BlockAllocator.Factory
          This sub interface describes a class which is capable of producing a new BlockAllocator.
 
Method Summary
 int alloc(int numChannels)
          Allocates a new bus.
 void free(int address)
          Frees a bus, that is makes it available again for new re-allocation.
 java.util.List getAllocatedBlocks()
          Queries a list of allocated blocks.
 

Method Detail

alloc

int alloc(int numChannels)
Allocates a new bus.

Parameters:
numChannels - the number of channels to allocate. must be greater than zero.
Returns:
the address or index of the bus which is the index of the first channel. returns -1 if the allocator ran out of busses.

free

void free(int address)
Frees a bus, that is makes it available again for new re-allocation.

Parameters:
address - the index of the bus

getAllocatedBlocks

java.util.List getAllocatedBlocks()
Queries a list of allocated blocks. This can be usefull for debugging purposes.

Returns:
a list whose elements are instances of Block