Skip to content

Commit

Permalink
Merge branch 'dev-5.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Nov 23, 2023
2 parents 9c2d042 + f00b45e commit 8ad5055
Show file tree
Hide file tree
Showing 18 changed files with 119 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center"><img src="https://raw.githubusercontent.com/JujuAdams/vinyl/master/LOGO.png" style="display:block; margin:auto; width:300px"></p>
<h1 align="center">Vinyl 5.5.3</h1>
<h1 align="center">Vinyl 5.5.4</h1>

<p align="center">Modular audio system for GameMaker 2023.8 (and later)</p>

Expand Down
5 changes: 5 additions & 0 deletions notes/TestConfig/TestConfig.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
assetsWithTag: bleep
}

bleep wildcard shuffle: {
type: shuffle
assets: sndBleep*
}

queue test: {
type: queue
assets: [
Expand Down
5 changes: 5 additions & 0 deletions objects/oTest/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ UIButtonInline("Bleep shuffle (simple)", function()
VinylPlaySimple("bleep shuffle");
});

UIButtonInline("Bleep wildcard shuffle", function()
{
VinylPlaySimple("bleep wildcard shuffle");
});

UINewline();

UIButtonInline("Music sync test", function()
Expand Down
2 changes: 1 addition & 1 deletion options/windows/options_windows.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 4 additions & 15 deletions scripts/VinylSystemReadConfig/VinylSystemReadConfig.gml
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,8 @@ function VinylSystemReadConfig(_configData)
variable_struct_remove(_inputAssetDict, _assetName);
array_delete(_assetNameArray, _i, 1);

//Build an array of all audio asset names on demand
if (!is_array(_audioAssetArray))
{
_audioAssetArray = [];

var _j = 0;
repeat(1000000)
{
if (not audio_exists(_j)) break;
array_push(_audioAssetArray, audio_get_name(_j));
++_j;
}
}

//Find all matching assets for the search string
var _array = __VinylFindMatchingAudioAssets(_assetName, _audioAssetArray);
var _array = __VinylFindMatchingAudioAssets(_assetName);

if (array_length(_array) <= 0)
{
Expand Down Expand Up @@ -465,6 +451,9 @@ function VinylSystemReadConfig(_configData)
_knob.__OutputRefresh();
});

//Dump this memory, we don't need it any more
__VinylCompiledSoundArrayClear();

//Workaround for problems setting effects on the main audio effect bus in 2023.1
gc_collect();
}
41 changes: 29 additions & 12 deletions scripts/__VinylClassPatternCommon/__VinylClassPatternCommon.gml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function __VinylClassPatternCommon()

static __InitializeAssetArray = function(_assetArray, _tagArray)
{
__assetArray = _assetArray;
__assetArray = is_array(_assetArray)? _assetArray : [_assetArray];

//Convert any basic patterns into audio asset indexes
var _i = 0;
Expand All @@ -94,23 +94,40 @@ function __VinylClassPatternCommon()
{
if (is_string(_asset))
{
if (VinylLiveUpdateGet())
if (string_pos("*", _asset) > 0)
{
if (not VinylAssetExists(_asset)) __VinylError("Error in ", self, " for \"assets\" property\nAsset \"", _asset, "\" not recognised");
_asset = VinylAssetGetIndex(_asset);
//Remove this from the asset array itself
array_delete(__assetArray, _i, 1);
--_i;

//Unpack the wildcard string into an array then add that to the asset array
var _array = __VinylFindMatchingAudioAssets(_asset);
array_copy(__assetArray, array_length(__assetArray), _array, 0, array_length(_array));
}
else
{
if (asset_get_index(_asset) < 0) __VinylError("Error in ", self, " for \"assets\" property\nAsset \"", _asset, "\" not found in the project");
if (asset_get_type(_asset) != asset_sound) __VinylError("Error in ", self, " for \"assets\" property\nAsset \"", _asset, "\" not a sound asset");
_asset = asset_get_index(_asset);
if (VinylLiveUpdateGet())
{
if (not VinylAssetExists(_asset)) __VinylError("Error in ", self, " for \"assets\" property\nAsset \"", _asset, "\" not recognised");
_asset = VinylAssetGetIndex(_asset);
}
else
{
if (asset_get_index(_asset) < 0) __VinylError("Error in ", self, " for \"assets\" property\nAsset \"", _asset, "\" not found in the project");
if (asset_get_type(_asset) != asset_sound) __VinylError("Error in ", self, " for \"assets\" property\nAsset \"", _asset, "\" not a sound asset");
_asset = asset_get_index(_asset);
}

__assetArray[@ _i] = _asset;
}
}

if (!is_numeric(_asset)) __VinylError("Error in ", self, " for \"assets\" property\nAssets should be specified as an audio asset index or audio asset name (datatype=", typeof(_asset), ")");
if (!audio_exists(_asset)) __VinylError("Error in ", self, " for \"assets\" property\nAudio asset with index ", _asset, " not found");

__assetArray[@ _i] = _asset;
else
{
if (!is_numeric(_asset)) __VinylError("Error in ", self, " for \"assets\" property\nAssets should be specified as an audio asset index or audio asset name (datatype=", typeof(_asset), ")");
if (!audio_exists(_asset)) __VinylError("Error in ", self, " for \"assets\" property\nAudio asset with index ", _asset, " not found");

__assetArray[@ _i] = _asset;
}
}

++_i;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Feather disable all

function __VinylCompiledSoundArrayClear()
{
array_resize(__VinylGlobalData().__compiledSoundArray, 0);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Feather disable all

function __VinylCompiledSoundArrayEnsure()
{
static _array = __VinylGlobalData().__compiledSoundArray;

//Build an array of all audio asset names on demand
if (array_length(_array) <= 0)
{
var _j = 0;
repeat(1000000)
{
if (not audio_exists(_j)) break;
array_push(_array, audio_get_name(_j));
++_j;
}
}

return _array;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// Feather disable all

/// @param searchString
/// @param assetNameArray

function __VinylFindMatchingAudioAssets(_searchString, _assetNameArray)
function __VinylFindMatchingAudioAssets(_searchString)
{
static _soundNameArray = __VinylCompiledSoundArrayEnsure();

static _result = [];
array_resize(_result, 0);

var _test = [];

var _subArray = string_split(_searchString, "*", true);

var _i = 0;
repeat(array_length(_assetNameArray))
repeat(array_length(_soundNameArray))
{
var _assetName = _assetNameArray[_i];
var _assetName = _soundNameArray[_i];

var _accepted = true;
var _pos = 1;
Expand All @@ -36,7 +36,6 @@ function __VinylFindMatchingAudioAssets(_searchString, _assetNameArray)
if (_accepted)
{
array_push(_result, _i);
array_push(_test, audio_get_name(_i));
}

++_i;
Expand Down
2 changes: 2 additions & 0 deletions scripts/__VinylGlobalData/__VinylGlobalData.gml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function __VinylGlobalData()
__projectSoundArray: [],
__projectSoundHashDict: {},

__compiledSoundArray: [],

__listenerX: 0,
__listenerY: 0,

Expand Down
4 changes: 2 additions & 2 deletions scripts/__VinylSystem/__VinylSystem.gml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Feather disable all
#macro __VINYL_VERSION "5.5.3"
#macro __VINYL_DATE "2023-11-20"
#macro __VINYL_VERSION "5.5.4"
#macro __VINYL_DATE "2023-11-23"

#macro __VINYL_DATA_BUNDLE_FILENAME "vinyl.dat"
#macro __VINYL_CONFIG_NOTE_NAME "__VinylConfig"
Expand Down
13 changes: 12 additions & 1 deletion scripts/__VinylTick/__VinylTick.gml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ function __VinylTick()
static _globalData = __VinylGlobalData();

++_globalData.__frame;
var _deltaTimeFactor = (delta_time / (game_get_speed(gamespeed_fps)*game_get_speed(gamespeed_microseconds)));

var _usPerFrame = game_get_speed(gamespeed_microseconds);
if (delta_time > 10*_usPerFrame)
{
//Game hung, revert to fixed step size
var _deltaTimeFactor = _usPerFrame / 1000000;
}
else
{
//Game running within generous acceptable parameters, delta time as normal
var _deltaTimeFactor = (clamp(delta_time, _usPerFrame/3, 3*_usPerFrame) / 1000000);
}

//Update knobs
var _knobArray = _globalData.__knobArray; //Don't use a static here because this struct can be recreated
Expand Down
1 change: 0 additions & 1 deletion scripts/__VinylUpdateData/__VinylUpdateData.gml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ function __VinylUpdateData(_forceReload)
show_debug_message("");

var _trimmedMessage = string_replace(_error.message, "Vinyl:\n", "");
_trimmedMessage = string_copy(_trimmedMessage, 1, string_length(_trimmedMessage)-2);

if (_firstUpdate)
{
Expand Down
1 change: 0 additions & 1 deletion scripts/__VinylUpdateProject/__VinylUpdateProject.gml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function __VinylUpdateProject()
show_debug_message("");

var _trimmedMessage = string_replace(_error.message, "Vinyl:\n", "");
_trimmedMessage = string_copy(_trimmedMessage, 1, string_length(_trimmedMessage)-2);

if (_firstUpdate)
{
Expand Down
2 changes: 2 additions & 0 deletions vinyl.resource_order
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
{"name":"VinylPositionGet","order":1,"path":"scripts/VinylPositionGet/VinylPositionGet.yy",},
{"name":"VinylEmitterRectangle","order":7,"path":"scripts/VinylEmitterRectangle/VinylEmitterRectangle.yy",},
{"name":"sndBleep3","order":13,"path":"sounds/sndBleep3/sndBleep3.yy",},
{"name":"__VinylCompiledSoundArrayEnsure","order":25,"path":"scripts/__VinylCompiledSoundArrayEnsure/__VinylCompiledSoundArrayEnsure.yy",},
{"name":"VinylFadeOutAll","order":4,"path":"scripts/VinylFadeOutAll/VinylFadeOutAll.yy",},
{"name":"__VinylClassPatternBasic","order":3,"path":"scripts/__VinylClassPatternBasic/__VinylClassPatternBasic.yy",},
{"name":"UITextWrap","order":3,"path":"scripts/UITextWrap/UITextWrap.yy",},
Expand All @@ -149,6 +150,7 @@
{"name":"sndSync3","order":9,"path":"sounds/sndSync3/sndSync3.yy",},
{"name":"TestConfig","order":4,"path":"notes/TestConfig/TestConfig.yy",},
{"name":"sndBleep0","order":10,"path":"sounds/sndBleep0/sndBleep0.yy",},
{"name":"__VinylCompiledSoundArrayClear","order":26,"path":"scripts/__VinylCompiledSoundArrayClear/__VinylCompiledSoundArrayClear.yy",},
{"name":"__VinylConfigDebug","order":2,"path":"scripts/__VinylConfigDebug/__VinylConfigDebug.yy",},
{"name":"VinylPitchTargetSet","order":2,"path":"scripts/VinylPitchTargetSet/VinylPitchTargetSet.yy",},
{"name":"sndPop","order":4,"path":"sounds/sndPop/sndPop.yy",},
Expand Down
2 changes: 2 additions & 0 deletions vinyl.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8ad5055

Please sign in to comment.