-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from sirkrypt0/master
Added ability to customize sampling rate when loading new sound.
- Loading branch information
Showing
5 changed files
with
27 additions
and
20 deletions.
There are no files selected for viewing
9 changes: 0 additions & 9 deletions
9
...M-Core.package/GMSoundLoader.class/instance/sampledSoundStringFromSound.withSamplesIn..st
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
...MSoundLoader.class/instance/sampledSoundStringFromSound.withSamplesIn.andSamplingRate..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,9 @@ | ||
storing | ||
sampledSoundStringFromSound: aSound withSamplesIn: aSelector andSamplingRate: aNumber | ||
aSound setSamples: #[] samplingRate: aNumber. | ||
^ (WriteStream on: '') | ||
store: aSound; | ||
nextPutAll: ' setSamples: (SoundBuffer fromByteArray: self '; | ||
nextPutAll: aSelector asString; | ||
nextPutAll: ') samplingRate: ', aNumber; | ||
contents |
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
14 changes: 14 additions & 0 deletions
14
...SoundLoader.class/instance/storeResourceInMethod.inInstance.fromFile.withSamplingRate..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 @@ | ||
storing | ||
storeResourceInMethod: aSelector inInstance: anInstance fromFile: aFilename withSamplingRate: aNumber | ||
"meta-programming warning | ||
only supports WAV, overwritten because we need multiple methods" | ||
| sound | | ||
sound := self resourceFromDrive: aFilename. | ||
self compileMethod: (self samplesMethodName: aSelector) | ||
inInstance: anInstance | ||
fromString: (self samplesStringFromSound: sound). | ||
self compileMethod: aSelector | ||
inInstance: anInstance | ||
fromString: (self sampledSoundStringFromSound: sound | ||
withSamplesIn: (self samplesMethodName: aSelector) | ||
andSamplingRate: aNumber). |
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