-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy some methods from PositionableStream to FSWriteStream
This is done to allow AbstractSound/SampledSound to use these methods when reading/writing WAV and AIFF while using an FSWriteStream.
- Loading branch information
Showing
6 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/Squot.package/FSWriteStream.extension/instance/int16..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*Squot-Mapper-FSStream-compatibility | ||
int16: anInteger | ||
"copied from PositionableStream" | ||
"Store the given signed, 16-bit integer on this (binary) stream." | ||
|
||
| n | | ||
(anInteger < -16r8000) | (anInteger >= 16r8000) | ||
ifTrue: [self error: 'outside 16-bit integer range']. | ||
|
||
anInteger < 0 | ||
ifTrue: [n := 16r10000 + anInteger] | ||
ifFalse: [n := anInteger]. | ||
self nextPut: (n digitAt: 2). | ||
self nextPut: (n digitAt: 1). |
8 changes: 8 additions & 0 deletions
8
src/Squot.package/FSWriteStream.extension/instance/nextLittleEndianNumber.put..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*Squot-Mapper-FSStream-compatibility | ||
nextLittleEndianNumber: n put: value | ||
"copied from PositionableStream" | ||
"Answer the next n bytes as a positive Integer or LargePositiveInteger, where the bytes are ordered from least significant to most significant." | ||
| bytes | | ||
bytes := ByteArray new: n. | ||
1 to: n do: [: i | bytes at: i put: (value digitAt: i)]. | ||
self nextPutAll: bytes |
6 changes: 6 additions & 0 deletions
6
src/Squot.package/FSWriteStream.extension/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"int16:" : "mad 10/17/2023 12:45", | ||
"nextLittleEndianNumber:put:" : "mad 10/17/2023 12:45" } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
"name" : "FSWriteStream" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters