Basic Services

A host may provide these basic services:
// provides a safe memory allocation manager
public interface IMemoryManager
{
}

// provides access to the file system in a safe manner
public interface IFileAccessor
{
}

// allows for safe downloads of online content
public interface IDownloadManager
{
}

// allows scheduling work on background threads managed by the host.
public interface ITaskScheduler
{
}

// allows any component to use publish-subscribe eventing
public interface IEventManager
{
    void Publish<T>(T event);
    void Subscribe<T>(EventHandler<T> callback);
    void Subscribe<T>(EventHandler<T> callback, Expression<Func<T, bool>> filter);
    void Unsubscribe<T>(EventHandler<T> callback);
}

// allows any component to use host-managed queues
public interface IQueueManager
{
    IQueue<T> CreateQueue<T>(string name);
    IQueue<T> FindQueue<T>(string name);
}
public interface IQueue<T>
{
    string Name { get; }
    bool IsEmpty { get; }

    void Enqueue(T item);
    T Dequeue();
    T Peek();
}

In addition the host may provide more specific services which would become part of the spec (version):
// provides access to a system wide accurate clock
public interface ISystemClock
{
}

// provides access to the master clock and conversions
public interface IMasterClock
{
}

// provides conversion routines and current music time information
public interface IMusicTimeClock
{
    IMidiClock ToMidiClock();
}

// provides music time information in Midi terminology.
public interface IMidiClock
{
}

// provides access to the master track of the sequencer
public interface IMasterTrack
{
    // Tempo and Measure map of the song.
}

// provides access to where the song is playing (based on musical clock).
public interface ISongPointer
{
  // song position and notification events
}

Last edited Oct 6, 2013 at 8:42 AM by obiwanjacobi, version 7