|
@@ -328,6 +328,7 @@ class SampleNodeBus {
|
|
|
* offset?: number
|
|
|
* playbackRate?: number
|
|
|
* startTime?: number
|
|
|
+ * pitchScale?: number
|
|
|
* loopMode?: LoopMode
|
|
|
* volume?: Float32Array
|
|
|
* start?: boolean
|
|
@@ -438,7 +439,7 @@ class SampleNode {
|
|
|
/** @type {LoopMode} */
|
|
|
this.loopMode = options.loopMode ?? this.getSample().loopMode ?? 'disabled';
|
|
|
/** @type {number} */
|
|
|
- this._pitchScale = 1;
|
|
|
+ this._pitchScale = options.pitchScale ?? 1;
|
|
|
/** @type {number} */
|
|
|
this._sourceStartTime = 0;
|
|
|
/** @type {Map<Bus, SampleNodeBus>} */
|
|
@@ -1648,13 +1649,14 @@ const _GodotAudio = {
|
|
|
},
|
|
|
|
|
|
godot_audio_sample_start__proxy: 'sync',
|
|
|
- godot_audio_sample_start__sig: 'viiiii',
|
|
|
+ godot_audio_sample_start__sig: 'viiiifi',
|
|
|
/**
|
|
|
* Starts a sample.
|
|
|
* @param {number} playbackObjectIdStrPtr Playback object id pointer
|
|
|
* @param {number} streamObjectIdStrPtr Stream object id pointer
|
|
|
* @param {number} busIndex Bus index
|
|
|
* @param {number} offset Sample offset
|
|
|
+ * @param {number} pitchScale Pitch scale
|
|
|
* @param {number} volumePtr Volume pointer
|
|
|
* @returns {void}
|
|
|
*/
|
|
@@ -1663,6 +1665,7 @@ const _GodotAudio = {
|
|
|
streamObjectIdStrPtr,
|
|
|
busIndex,
|
|
|
offset,
|
|
|
+ pitchScale,
|
|
|
volumePtr
|
|
|
) {
|
|
|
/** @type {string} */
|
|
@@ -1671,11 +1674,12 @@ const _GodotAudio = {
|
|
|
const streamObjectId = GodotRuntime.parseString(streamObjectIdStrPtr);
|
|
|
/** @type {Float32Array} */
|
|
|
const volume = GodotRuntime.heapSub(HEAPF32, volumePtr, 8);
|
|
|
- /** @type {SampleNodeConstructorOptions} */
|
|
|
+ /** @type {SampleNodeOptions} */
|
|
|
const startOptions = {
|
|
|
offset,
|
|
|
volume,
|
|
|
playbackRate: 1,
|
|
|
+ pitchScale,
|
|
|
start: true,
|
|
|
};
|
|
|
GodotAudio.start_sample(
|