Issue with simply playing a file, and question about introspection
-
Hi. New to hise, and I having trouble with this:
local player = Synth.getAudioSampleProcessor("Audio Loop Player1"); Console.print(player.getFilename()); Console.print(player); player.loadFile(path);
it's saying player.loadFile function not found. Any idea what I am doing wrong? according to https://docs.hise.dev/scripting/scripting-api/synth/index.html#getaudiosampleprocessor it looks correct to me, but seems to not be returning the correct object type.
Also is there a way to introspect objects on the console, to inspect things like the class name, functions on the object, etc, similar to ruby or other languages? I keep running into issues like this, where the thing I am dealing with isn't the correct thing, and that would be nice for debugging, rather than just seeing Object 0x in the console.
-
@thrice801 What is
path
?@thrice801 said in Issue with simply playing a file, and question about introspection:
Also is there a way to introspect objects on the console
Console.print(trace(myObj));
You might get more info using the variable watch table.
-
@d-healey path is a string pointing at a wav file. will it throw function not found if the wrong type is passed into the function?
-
@thrice801 said in Issue with simply playing a file, and question about introspection:
it's saying player.loadFile function not found.
Why is
player
local? Is this code within a callback or a helper function? My first thought was that it wasn't finding the AudioSampleProcessor at runtime, but that usually throws a different error like "Audio Loop Player1 was not found."But I think the main issue is that
loadFile()
is not a function of AudioSampleProcessor, it is a function of AudioFile. You might want to tryAudioSampleProcessor.setFile()
-
@thrice801 said in Issue with simply playing a file, and question about introspection:
Hi. New to hise, and I having trouble with this:
local player = Synth.getAudioSampleProcessor("Audio Loop Player1"); Console.print(player.getFilename()); Console.print(player); player.loadFile(path);
it's saying player.loadFile function not found.
It should be
player.setFile(String fileName)
and the
player.getFilename()
will get the path to the loaded file
-
@d-healey when I tried the trace function, it broke off execution and opened xcode (not familiar with xcode debugging), I can't tell if that is the expected behavior from that, or if it was trying to log some data as json unsuccessfully, and it is blowing up, and xcode is catching the error (the line it breaks on is something about json serialization) - is that the expected behavior of trace, or is it supposed to be putting info in my console? - also the variable watch table gave me slightly more info which is helpful, could see arrays of strings and what not, but still don't see any class names or object types and what not.
Thanks all I eventually got it figured out, and was able to get the file loaded in the AudioLoopPlayer. However I am now realizing, there is no play method on this thing. How do I actually go about triggering playback of the file, or what am I missing here?
I'm basically just trying to trigger playback of the sample now, when the daw transport play button is clicked, except I have no daw here. So I'm wondering, how do I actually play it back, and also: is there a way to simulate daw transport playback/controls directly within hise (and or setting tempo and things)?
-
@thrice801 said in Issue with simply playing a file, and question about introspection:
when I tried the trace function, it broke off execution and opened xcode
Where did you try it?