4.4. ISMCBBuilder

added in version 1.12.0

This interface provides the function which creates melody speaker control commands.

This interface is only for models which support a melody speaker and for FVP10.For the supporting models, refer to Supported Peripherals .

  • Property

    Name

    Contents

    commands

    Generated commands.

  • Method

    Name

    Contents

    appendSoundWithSetting

    The command for playback of a sound registered in the melody speaker is generated and added to the command buffer.

    appendSoundWithSound

    A command for playback of the sound data specified by the argument is generated and added to the command buffer.

4.4.1. SMCBSoundStorageArea

added in version 1.12.0

Constant that specifies the sound storage area.

  • Declaration

    public enum SMCBSoundStorageArea : Int {
        case area1
        case area2
    }
    

The sound storage areas which correspond to the constants are the following.

MelodySpeakerModel Constants Sound storage area
MCS10
area1
area2
Sound storage area1
Sound storage area2
FVP10
area1
area2
Default area
User area

4.4.2. commands

added in version 1.12.0

Gets the command buffer (generated command).

  • Declaration

    open var commands: NSMutableData
    
  • Parameter

    None

  • Return value

    Contents Type
    Cmmand buffer (generated command) NSMutableData

4.4.3. appendSoundWithSetting

added in version 1.12.0

The command for playback of a sound registered in the melody speaker is generated and added to the command buffer.

  • Declaration

    open func appendSound(with setting: SMSoundSetting?, error: NSErrorPointer)
    
  • Parameter

    Name Contents Type
    setting Settings information for the playback sound (sound storage area, sound number, etc.) SMSoundSetting
    error Error information when command generation failed NSErrorPointer

    The parameters which can be set in the setting argument are the following.

    StarIoExtMelodySpeakerModel

    Property

    Contents

    Parameters that can be set

    Default (operation when nothing is specified)

    MCS10

    soundStorageArea

    Sound storage area

    area1

    Use the MCS10 unit DIP switch settings.

    area2

    soundNumber

    Sound number

    0 - 7

    Use the MCS10 unit DIP switch settings.

    volume

    Volume

    0 – 15

    Use the MCS10 unit DIP switch settings.

    SMSoundSettingVolume.off

    SMSoundSettingVolume.min

    SMSoundSettingVolume.max

    FVP10

    soundStorageArea

    Sound storage area

    area1

    area1

    area2

    soundNumber

    Sound number

    1 - 255 1

    count

    Count

    1 - 65535 1

    delay

    Delay time (1 sec units)

    0 - 65535 0

    interval

    Interval time (1 sec units)

    0 - 65535 0

    Sound played according to the combination of parameters specified for the soundStorageArea property and soundNumber property are as follows.

    StarIoExtMelodySpeakerModel

    soundStorageArea

    soundNumber

    Sound

    MCS10

    area1

    0

    Sound1

    1

    Sound2

    2

    Sound3

    3

    Sound4

    4

    Sound5

    5

    Sound6

    6

    Sound7

    7

    Sound8

    area2

    0

    Sound9

    1

    Sound10

    2

    Sound11

    3

    Sound12

    4

    Sound13

    5

    Sound14

    6

    Sound15

    7

    Sound16

    FVP10

    area1

    1 - 255

    Sound stored in the specified sound number of the default area

    area2

    1 - 255

    Sound stored in the specified sound number of the user area

  • Return value

    None

  • Error code

    Value Contents
    SMResultCodeInvalidArgument
    One of the following
    1. The property that can not be set on the specified model is set.
    2. Only one of the soundStorageArea property and the soundNumber property is set.
    SMResultCodeArgumentOutOfRange Parameter is out of range

4.4.4. appendSoundWithSound

added in version 1.12.0

A command for playback of the sound data specified by the argument is generated and added to the command buffer.

Warning

FVP10 is not supported.

  • Declaration

    open func appendSound(withSound data: Data, setting: SMSoundSetting?, error: NSErrorPointer)
    
  • Parameter

    Name Contents Type
    data Sound data Data
    setting Settings information for the playback sound (sound storage area, sound number, etc.) SMSoundSetting
    error Error information when command generation failed NSErrorPointer

    For the supported sound formats, refer to the table of supported sound formats.

    Name Value
    Sound file format WAV
    WAV file format Linear PCM
    Sampling rate 12800Hz
    Bit depth 16 bits or 8 bits
    Channel Monaural
    Playback time
    Max. 5 sec when bitdepth is 16
    Max. 10 sec when bitdepth is 8

    1. It is possible to convert a sound file format to a format in the table of supported sound formats by using the Start Sound Converter application that was provided with this package. For details, refer to “FileFormatList_en.htm” in “Others/StarSoundConverter/(Windows or Mac)/Documents” folder.

    The parameters which can be set in the setting argument are the following.

    Property Contents Parameters that can be set Default (operation when nothing is specified)
    volume Volume
    0 – 15
    SMSoundSettingVolume.off
    SMSoundSettingVolume.min
    SMSoundSettingVolume.max
    Use the MCS10 unit DIP switch settings.
  • Return value

    None

  • Error code

    Value Contents
    StarIoExtErrorFormatError Data other than a supported sound format is input.
    SMResultCodeInvalidArgument The property that can not be set on the specified model is set.
    SMResultCodeArgumentOutOfRange Parameter is out of range
    StarIoExtErrorInvalidOperation FVP10 is specified.