Home › Forums › General › Programming › Things that worked before rev. 1184
- This topic has 29 replies, 5 voices, and was last updated 6 years, 7 months ago by goodweather.
-
AuthorPosts
-
December 18, 2012 at 7:14 pm #5190
Hi Atom. I’m having several LUA errors with things that worked before the present revision (1184):
· LoadFileAsData:
Previously I had working fine:
configFile = File.getSpecialLocation(File.userApplicationDataDirectory):getChildFile(String("XP30.ini"))
if configFile:existsAsFile() then
-- configFileData = configFile:loadFileAsData()
configFileData = File:loadFileAsData(configFile)
console (configFileData:toHexString(1))
end
Now I get “ERROR: no static ‘loadFileAsData’ in class ‘File'”· replaceFileContentWithData
I get this error: “attempt to call method ‘replaceFileContentWithData’ (a nil value)”
It seems that file handling has changed a lot. Could you provide us some example of how to deal with it now?
There are several issues with components and midi messages.
uiCustomComponent sends midi message “F8” 12 times when you call a method in any component’s Callback (if the method is for mouseDown, when you click the component the messages are sent. If the method is on MouseEnter, the messages are sent when the mouse enters the component…). (The Sysex Formula is empty).
If a component has Midi Message = None and it has a sysex formula, the sysex message is sent. You have to select again Midi Message = None to fix it, but it happens again when you reopen the panel.
Removing the sysex formula fix it too, but by default all modulators had “F0 00 F7” in previous revisions, so we should change all modulators from old panels.December 18, 2012 at 7:28 pm #5195I’ll post an example asap. This changes cause i want the API to be as close to the JUCE api as possible, so the methods from the JUCE::File class will be working, and not my “wrappers”.
The SysEx formula is a pain in the ass, it’s how the component is loading is the problem maybe i can find a fix for that.
December 18, 2012 at 9:24 pm #5198This should work with the latest nightly. I’m fixing the rest.
fileTest = function(mod, value) fileRead = File("c:\\data.txt") buf = MemoryBlock(4,true) fileRead:loadFileAsData(buf) console ("read data: "..buf:getSize()) fileWrite = File("c:\\newFile.txt") fileWrite:replaceWithData(buf) console ("data written: "..fileWrite:getSize()) end
- This reply was modified 11 years, 4 months ago by atom.
December 18, 2012 at 10:18 pm #5200Thx, I’ll try it later.
December 19, 2012 at 7:09 pm #5204In your example, buf is a MemoryBlock (correct me if I’m wrong). But I’m trying to use a = buf:getByte(0) and get “attempt to call method ‘getByte’ (a nil value)”
December 19, 2012 at 10:54 pm #5205This is a type mismatch on your side CtrlrLuaMemoryBlock is not MemoryBlock, CtrlrLuaMemoryBlock had some additional methods that are not in MemoryBlock, but i just added them and the newer nightly will have the new getByte() and getRange() methods, but also more LUA freindly, insertIntoTable (table) and createFromTable (table) methods that take a normal LUA table as a parameter.
December 20, 2012 at 8:27 am #5206Hey atom, what If I want to write the contents of a variable to a file? The variable is set in this line which is run when receiving a patch dump.
programData = midiMessage:getLuaData():getRange(7,263)
I have to be honest i’ve never been able to get writing data to a file from a variable to work. I don’t understand anything about CtrlrLuaMemoryBlock or MemoryBlock.
The variable above which I want to save to a file contains the bytes that set all modulator values.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
December 21, 2012 at 3:22 pm #5239I’m trying to insert data in a MemoryBlock without luck. Can you pinpoint me the correct way? Thx.
config_data = MemoryBlock(2,true)
config_data:insert(expansionDValue,1,0)December 21, 2012 at 4:38 pm #5240Try 1193 it should work now, i had to re-implement insert/append/copyFrom/copyTo/replaceWith methods.
December 29, 2012 at 6:04 pm #5319Hi Atom
I want to append data to a MemoryBlock, but I don’t get it.In rawmaterialsoftware it says void append (const void *data, size_t numBytes) but the error I get in Ctrlr is void append(LMemoryBlock&,MemoryBlock&).
How to use it?.December 29, 2012 at 8:00 pm #5320If the api docs say (void *, size_t) that means i changed it to a MemoryBlock as a parameter so to append
data1 = MemoryBlock({0xf0, 0xf1, 0xf2}) data2 = MemoryBlock({0x00, 0x01, 0x02}) data1:append(data2) -- instead of data1:append(data2:getData(), data2:getSize())
December 29, 2012 at 10:23 pm #5321I get this with the first line of your example
data1 = MemoryBlock({0xf0, 0xf1, 0xf2})
ERROR: No matching overload found, candidates:
void __init(luabind::argument const&,MemoryBlock const&)
void __init(luabind::argument const&,unsigned int const,bool)
void __init(luabind::argument const&)December 29, 2012 at 10:43 pm #5322Well yeah i didn’t compile this i wrote it from my head. it should be something like
data1 = MemoryBlock() data2 = MemoryBlock() data1:createFromTable({0xf0, 0xf1, 0xf2}) data2:createFromTable({0x00, 0x01, 0x02}) data1:append(data2)
December 30, 2012 at 5:43 pm #5328Can’t we use setByte with a MemoryBlock? I get ” attempt to call method ‘setByte’ (a nil value)”
December 30, 2012 at 5:48 pm #5329Yeah i haven’t added that, i’ll do that asap
December 31, 2012 at 10:37 am #5338Thanks, working in 1195.
I would like to be able to use Font() as well.
December 31, 2012 at 1:55 pm #5341I’ll have a look at Font(), what exactly would you like to do with it so i can prepare an example.
December 31, 2012 at 3:46 pm #5345I just want to write some stuff inside a CustomComponent with another font, nothing complicated. Right now I got the text displayed but with the default font.
January 5, 2013 at 5:33 pm #5390Hi Atom
Previously we could insert in a MemoryBlock a block of data with a specified size (MemoryBlock:insert (MemoryBlock2, position, size)).
How can we do it now?January 9, 2013 at 9:24 am #5444BUMP
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.