Skip to content

Commit

Permalink
Merge pull request #78 from sirkrypt0/master
Browse files Browse the repository at this point in the history
Added ability to customize sampling rate when loading new sound.
  • Loading branch information
codeZeilen committed Aug 30, 2021
2 parents 533d976 + 0d751a2 commit 90c1dfe
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.

This file was deleted.

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
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@ storing
storeResourceInMethod: aSelector inInstance: anInstance fromFile: aFilename
"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)).
self storeResourceInMethod: aSelector inInstance: anInstance fromFile: aFilename withSamplingRate: 44100.
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).
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"playSound:" : "brh 7/3/2018 22:12",
"resourceFromDrive:" : "brh 7/14/2018 23:53",
"resumePlayingMusic" : "AZ 7/10/2018 16:02",
"sampledSoundStringFromSound:withSamplesIn:" : "brh 7/24/2018 20:37",
"sampledSoundStringFromSound:withSamplesIn:andSamplingRate:" : "tok 12/16/2019 14:21",
"samplesMethodName:" : "brh 7/24/2018 20:34",
"samplesStringFromSound:" : "brh 7/24/2018 20:30",
"storeResourceInMethod:inInstance:fromFile:" : "NK 7/25/2018 12:18",
"storeResourceInMethod:inInstance:fromFile:" : "tok 12/16/2019 14:21",
"storeResourceInMethod:inInstance:fromFile:withSamplingRate:" : "tok 12/16/2019 14:20",
"supportedTypes" : "brh 7/15/2018 14:20" } }

0 comments on commit 90c1dfe

Please sign in to comment.