Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2942.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.2942 Author: eem Time: 3 February 2021, 7:56:52.6547 pm UUID: 31e90656-0f99-4fae-8633-6b761b62bc6f Ancestors: VMMaker.oscog-eem.2941 Add TerfVM-specific support to the SondPlugin for retrieving a sound device's UID. Use stackEphemeralStringValue: for marshalling devuce names. Remove an obsolete method. =============== Diff against VMMaker.oscog-eem.2941 =============== Item was added: + ----- Method: SoundPlugin>>primitiveGetSoundPlayerDeviceUID (in category 'primitives') ----- + primitiveGetSoundPlayerDeviceUID + "arguments: name(type, stack offset) + deviceNumber(Integer, 0)" + "answers a string or nil" + <export: true> + <option: #TerfVM> + | deviceNumber | + + "Parse arguments" + interpreterProxy methodArgumentCount = 1 ifFalse: + [^interpreterProxy primitiveFailFor: PrimErrBadNumArgs]. + + deviceNumber := interpreterProxy positive32BitValueOf: (interpreterProxy stackValue: 0). + interpreterProxy failed ifTrue: + [^interpreterProxy primitiveFailFor: PrimErrBadArgument]. + + self methodReturnStringOrNil: (self getSoundPlayerDeviceUID: deviceNumber - 1)! Item was added: + ----- Method: SoundPlugin>>primitiveGetSoundRecorderDeviceUID (in category 'primitives') ----- + primitiveGetSoundRecorderDeviceUID + "arguments: name(type, stack offset) + deviceNumber(Integer, 0)" + "answers a string or nil" + <export: true> + <option: #TerfVM> + | deviceNumber | + + "Parse arguments" + interpreterProxy methodArgumentCount = 1 ifFalse: + [^interpreterProxy primitiveFailFor: PrimErrBadNumArgs]. + + deviceNumber := interpreterProxy positive32BitValueOf: (interpreterProxy stackValue: 0). + interpreterProxy failed ifTrue: + [^interpreterProxy primitiveFailFor: PrimErrBadArgument]. + + self methodReturnStringOrNil: (self getSoundRecorderDeviceUID: deviceNumber - 1)! Item was changed: ----- Method: SoundPlugin>>primitiveSetDefaultSoundPlayer (in category 'primitives') ----- primitiveSetDefaultSoundPlayer "Tell the operating system to use the specified device name as the output device for sound." "arg at top of stack is the String" <export: true> + | deviceName | - | deviceName obj srcPtr sz | - <var: 'deviceName' declareC: 'char deviceName[257]'> - <var: 'srcPtr' type: #'char *'> - self cCode: [] inSmalltalk: [deviceName := ByteString new: 257]. "Parse arguments" interpreterProxy methodArgumentCount = 1 ifFalse: [^interpreterProxy primitiveFailFor: PrimErrBadNumArgs]. + deviceName := interpreterProxy stackEphemeralStringValue: 0. - ((interpreterProxy isBytes: (obj := interpreterProxy stackValue: 0)) - and: [(sz := interpreterProxy byteSizeOf: obj) <= 256]) ifFalse: - [^interpreterProxy primitiveFailFor: PrimErrBadArgument]. - - srcPtr := self cCoerce: (interpreterProxy firstIndexableField: obj) to: #'char *'. - self strncpy: deviceName _: srcPtr _: sz. - deviceName at: sz put: 0. - self setDefaultSoundPlayer: deviceName. - interpreterProxy failed ifFalse: + [self setDefaultSoundPlayer: deviceName. + interpreterProxy failed ifFalse: + [interpreterProxy methodReturnReceiver]]! - [interpreterProxy methodReturnReceiver]! Item was changed: ----- Method: SoundPlugin>>primitiveSetDefaultSoundRecorder (in category 'primitives') ----- primitiveSetDefaultSoundRecorder "Tell the operating system to use the specified device name as the input device for sound." "arg at top of stack is the String" <export: true> + | deviceName | - | deviceName obj srcPtr sz | - <var: 'deviceName' declareC: 'char deviceName[257]'> - <var: 'srcPtr' type: #'char *'> - self cCode: [] inSmalltalk: [deviceName := ByteString new: 257]. "Parse arguments" interpreterProxy methodArgumentCount = 1 ifFalse: [^interpreterProxy primitiveFailFor: PrimErrBadNumArgs]. + deviceName := interpreterProxy stackEphemeralStringValue: 0. - ((interpreterProxy isBytes: (obj := interpreterProxy stackValue: 0)) - and: [(sz := interpreterProxy byteSizeOf: obj) <= 256]) ifFalse: - [^interpreterProxy primitiveFailFor: PrimErrBadArgument]. - - srcPtr := self cCoerce: (interpreterProxy firstIndexableField: obj) to: #'char *'. - self strncpy: deviceName _: srcPtr _: sz. - deviceName at: sz put: 0. - self setDefaultSoundRecorder: deviceName. - interpreterProxy failed ifFalse: + [self setDefaultSoundRecorder: deviceName. + interpreterProxy failed ifFalse: + [interpreterProxy methodReturnReceiver]]! - [interpreterProxy methodReturnReceiver]! Item was removed: - ----- Method: SoundPlugin>>sampleSizeOf: (in category 'support') ----- - sampleSizeOf: buf - "Answer the number of 16-bit sound samples in buf, a pointer to the first indexable field of a sound buffer." - <inline: #always> - ^(interpreterProxy byteSizeOf: buf cPtrAsOop) / (self sizeof: #short)! |
Free forum by Nabble | Edit this page |