<ABAudiobusControllerStateIODelegate> Protocol Referenceabstract

State input/output delegate protocol. More...

#import <ABAudiobusController.h>

Inherits <NSObject>.

Instance Methods

(NSDictionary *) - audiobusStateDictionaryForCurrentState
 Provide a dictionary to represent the current app state.
(void) - loadStateFromAudiobusStateDictionary:responseMessage:
 Load state from previously-created state dictionary.

Detailed Description

State input/output delegate protocol.

This protocol is used to provide app-specific state data when a preset is saved within Audiobus. This state data will then be presented back to your app when the user loads the saved preset within Audiobus, so your app can restore the prior state.

The nature of the state information to be saved and restored is up to you. It should be enough to put your app into the same operating state as when the preset was saved, but should not necessarily contain the user's content. Presets should represent workspaces, rather than complete projects.

To assist in streamlining your app initialization, when your app is being launched from a preset within Audiobus, Audiobus will launch your app by providing the string "incoming-preset" to the host part of the app launch URL. For example, if your Audiobus launch URL is "myapp.audiobus://", launching your app from within an Audiobus preset will cause the app to be launched with the URL "myapp.audiobus://incoming-preset". You can then detect this condition from within application:openURL:sourceApplication:annotation:

Method Documentation

- (NSDictionary*) audiobusStateDictionaryForCurrentState

Provide a dictionary to represent the current app state.

This dictionary can represent any state you deem relevant to the saved preset, for later restoration in loadStateFromAudiobusStateDictionary:responseMessage:. It may only contain values that can be represented in a Property List (See Apple's "Property List Types and Objects" documentation).

You may include NSData objects representing larger resources, if appropriate, such as audio data for a sampler. To avoid loading large files into memory all at once, you can request that the NSData use memory-mapping via the NSDataReadingMappedIfSafe hint.

Note: You should not spend more than a couple hundred milliseconds (at most) gathering state information in this method.

A dictionary containing state information for your app.
- (void) loadStateFromAudiobusStateDictionary: (NSDictionary *)  dictionary
responseMessage: (NSString **)  outResponseMessage 

Load state from previously-created state dictionary.

This method is called when the user loads a preset from within Audiobus. You will receive the state dictionary originally provided via audiobusStateDictionaryForCurrentState, and should apply this state information to restore your app to the state it was in when saved.

If you wish, you may provide a message to be displayed to the user within Audiobus, via the 'outResponseMessage' parameter. This can be used to notify the user of any issues with the state load, like the case where the state relies on some In-App Purchase content the user hasn't bought yet.

dictionaryThe state dictionary, as originally provided via audiobusStateDictionaryForCurrentState. In addition to the keys you provided, the value of the key ABStateDictionaryPresetNameKey will contain the name of the preset, as set by the user.
outResponseMessageResponse message to be displayed to the user (optional)

The documentation for this protocol was generated from the following file: