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 .
Constant
Name
Contents
Constant that specifies the sound storage area
Property
Name
Contents
Generated commands.
Method
Name
Contents
The command for playback of a sound registered in the melody speaker is generated and added to the command buffer.
A command for playback of the sound data specified by the argument is generated and added to the command buffer.
Warning
Do not use these methods with anything other than the melody speaker connected. It may not work properly, and the printer or the peripheral unit in use may cause damage.
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.)
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
Sound storage area
area1
Use the MCS10 unit DIP switch settings.
area2
Sound number
0 - 7 Use the MCS10 unit DIP switch settings.
Volume
0 – 15 Use the MCS10 unit DIP switch settings.
SMSoundSettingVolume.off
SMSoundSettingVolume.max
SMSoundSettingVolume.min
FVP10
Sound storage area
area1
area1
area2
Sound number
1 - 255 1 Count
1 - 65535 1 Delay time (1 sec units)
0 - 65535 0 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 following1. 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.)
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 16Max. 10 sec when bitdepth is 81. 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 – 15SMSoundSettingVolume.offSMSoundSettingVolume.maxSMSoundSettingVolume.minUse 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.