PROGRAMMER'S GUIDEBranch playback library
Back | ■
Branch playback library

7. Function specifications


7.1 Scenario processing


 List
 Title

Function specifications

 Function

Initialization of branch playback

 Function Name

BPL_Init

 No

1.1

Form
Sint32 BPL_Init (Sint32 bstmmax, Sint32 brmax, Sint32 Keymax, void * work)
input

bstmmax: Total number of branch streams to be registered brmax: Total number of branches keymax: Total number of stream key types work: Work area
output
none
Function value
Error code
function
Initialize the workspace to use the branch playback library. All the information about the set scenario will be cleared.
Be sure to execute it before using the branch playback library.
remarks

  1. The size of the work area is calculated by BPL_WORK_SIZE (bstmmax, brmax, keymax) bytes.
    Place the work area on a 4-byte boundary.
    "example"
    Uint32 work [BPL_WORK_SIZE (bstmmax, brmax, keymax) / sizeof (Uint32)];

  2. If you set different types of stream keys for different branch streams, the sum of those types will be the value of keymax.
    "example"
    When setting key1 (3 types of keys) for bstm1 and key2 (4 types of keys) for bstm2
    keymax is the sum of key1 and key2, which is 7.
    If you set the same key1 for bstm1 and bstm2, the keymax will be 3 for key1 only.

  3. The BPL_Init function does not close the stream group you are using.
    To force initialization while using the branch playback library, execute the BPL_Reset function.


 List
 Title

Function specifications

 Function

Branch playback reset

 Function Name

BPL_Reset

 No

1.2

Form
Sint32 BPL_Reset (void)
input
none
output
none
Function value
Error code
function
Stops access to the branch stream and resets branch playback.
(Closes the stream group used by the branch playback library and initializes all the information.)

 List
 Title

Function specifications

 Function

Branch stream information settings

 Function Name

BPL_SetStmInfo

 No

1.3 1.3

Form
Sint32 BPL_SetStmInfo (Sint32 bstmid, Sint32 fid, Sint32 nkey, StmKey * keytbl)
input

bstmid: Branch stream identifier (0 ≤ bstmid <bstmmax)

fid: File identifier nkey: Number of stream keys (nkey ≤ BPL_STMKEY_MAX)

keytbl: Stream case table
output
none
Function value
Error code
function
For the branch stream, set the branch stream information (information of each stream actually read).
remarks

  1. You can read channel-interleaved data by setting multiple stream keys in one file.

  2. The maximum stream key that can be set for one branch stream is BPL_STMKEY_MAX. The total number of stream key types that can be used in all streams is specified by the BPL_Enit function.


 List
 Title

Function specifications

 Function

Get branch stream information

 Function Name

BPL_GetStmInfo

 No

1.4

Form
Sint32 BPL_GetStmInfo (Sint32 bstmid, Sint32 * fid, Sint32 * nkey, Stmkey * keytbl)
input
bstmid: branch stream identifier
output

fid: File identifier nkey: Number of stream keys (nkey ≤ BPL_STMKEY_MAX)

keytbl: Stream key table
Function value
Number of branch destinations set (error code if negative)
function
Acquires the branch stream information set in the branch stream.
For the number of branch destinations, refer to the branch destination information setting function (BPL_SetBranchInfo).

 List
 Title

Function specifications

 Function

Branch destination information settings

 Function Name

BPL_SetBranchInfo

 No

1.5

Form
Sint32 BPL_SetBranchInfo (Sint32 bstmid, Sint32 nbranch, Sint32 * brtbl)
input

bstmid: Branch stream identifier nbranch: Number of branch destinations brtbl: Branch table
output
none
Function value
Error code
function
Set the branch destination information (branch destination candidate) for the branch stream.
remarks

  1. Set the branch stream identifier of the branch candidate in the branch table.
    To set no branch destination, specify BPL_BR_NONE for the element of the branch table.

    
    brtbl [0] = BSTMID_A; 
    
    brtbl [1] = BPL_BR_NONE; / * No branch destination (end of branch playback) * /
    
    brtbl [2] = BSTMID_B;
    
    nbranch = 3;
    
    
    The branch destination is specified by the BPL_SelectBranch function and the branch number (position in the branch table).
    In the case of this example, the branch processing will be as follows depending on the selected branch destination.
     Selected branch destination
     Branch processing (when the branch execution switch of the server function is ON)
     Branch number 0
     Branch Branches to the stream identifier BSTMID_A.
     Branch number 1
     Branch playback ends. Immediately after selection, there is no branch destination.
     Branch number 2
     Branch Branches to the stream identifier BSTMID_B.
     others
     BPL_SelectBranch returns a BPL_ERR_BRNO error and the selection is disabled.

  2. The number of streams must meet the following conditions:


X + Y ≤ Z

X: Number of stream keys set in bstmid Y: Total number of stream keys at the branch destination Z: Maximum number of streams that can be opened at the same time (specified by the STM_Init function)

 List
 Title

Function specifications

 Function

Acquisition of branch destination information

 Function Name

BPL_GetBranchInfo

 No

1.6

Form
Sint32 BPL_GetBranchInfo (Sint32 bstmid, Sint32 * nbrabch, Sint32 * brtbl, Sint32 nelem)
input

bstmid: Branch stream identifier nelem: Number of elements in the branch table
output

nbranch: Number of branch destinations (0 if there are no branch candidates)

brtbl: Branch table (up to nerem branch candidates are stored from the beginning)

Function value
Error code
function
Acquires the branch destination information set in the branch stream.

7.2 Branch playback processing


 List
 Title

Function specifications

 Function

Specifying the playback start stream

 Function Name

BPL_SetStart

 No

2.1

Form
Sint32 BPL_SetStart (Sint32 bstmid)
input
bstmid: Branch stream identifier (BPL_BR_NONE: Cancel branch playback)
output
none
Function value
Error code
function
Specify the playback start stream (branch stream at the beginning of the scenario).
If BPL_BR_NONE is specified for the branch stream identifier, branch playback will be stopped.

 List
 Title

Function specifications

 Function

Execution of branch playback server

 Function Name

BPL_ExecServer

 No

2.2

Form
Sint32 BPL_ExecServer (Bool chgsw)
input
chgsw: Branch execution switch (ON: branch processing, OFF: not)
Function value
Branch playback state
function
Executes the branch playback server. If the branch execution switch is ON, branch processing (branch stream switching processing) is performed.
(1) Branch playback state
 Fixed number of people
 explanation
 BPL_SVR_COMPLETED
 Branch playback end
 BPL_SVR_WAITSEL
 Waiting for branch destination selection
 BPL_SVR_SELECT
 Branch destination decision
 BPL_SVR_NOBRN
 No branch destination
For the branch playback state, see " 3.3 State transition of branch playback ".

 List
 Title

Function specifications

 Function

Selection of branch destination

 Function Name

BPL_SelectBranch

 No

2.3

Form
Sint32 BPL_SelectBranch (Sint32 brno)
input
brno: branch number
output
none
Function value
Error code
function
Selects the branch destination according to the specified branch number.
remarks

  1. If you specify the branch execution switch ON when executing BPL_ExecServer, branch processing is actually performed.
    (The selected branch destination switches to the current stream.)

  2. You need to perform branch destination selection even if there is only one branch candidate.


 List
 Title

Function specifications

 Function

Get the current stream

 Function Name

BPL_GetCurStm

 No

2.4

Form
Sint32 BPL_GetCurStm (Sint32 nelem, Sint32 * stmtbl)
input
nelem: Number of elements in the stream handle table (nelem ≤ BPL_STMKEY_MAX)
output
stmtbl: stream handle table
Function value
Branch stream identifier (if negative, there is no corresponding branch stream)
function
Gets the current stream (branch stream identifier and stream handle) that is being read / retrieved.
remarks

  1. The stream handle table is populated with stream handles for each stream key.


 List
 Title

Function specifications

 Function

Get the branch destination stream

 Function Name

BPL_GetNextStm

 No

2.5

Form
Sint32 BPL_GetNextStm (Sint32 nelem, StmHn * stmtbl)
input
nelem: Number of elements in stream handle table (nelem ≤ BPL_STMKEY_MAX)
output
stmbl: stream handle table
Function value
Branch stream identifier (if negative, there is no corresponding branch stream)
function
Gets the branch destination stream (branch stream identifier and stream handle).
remarks

  1. The stream handle table is populated with stream handles for each stream key.

  2. The function value is always negative until the branch destination is selected (BPL_SelectBranch is executed).


 List
 Title

Function specifications

 Function

Get stream group

 Function Name

BPL_GetStmGrp

 No

2.6

Form
StmGrpHn BPL_GetStmGrp (void)
input
none
output
none
Function value
Stream group handle
function
Gets the handle of the stream group used by the branch playback library.
remarks

  1. The branch playback library opens one stream group during operation.
    At the end of branch playback, the stream group handle will be NULL.


Back | ■
PROGRAMMER'S GUIDEBranch playback library
Copyright SEGA ENTERPRISES, LTD., 1997