Codea 1.6 Beta

Hey Beta People

Please let me know how things go with 1.6 in this thread.

I’m using Codea in a lecture this afternoon (pendulum dynamics) so don’t want to upgrade until afterwards in case it all goes horribly wrong!

No problem Andrew. Hope your lecture goes well!

I’ll be first to say WOW >:D<

Just Wow!

Bug with the sound() documentation. Volume info is repeated twice and it seems to display the info for loop instead of sound.

Install went cleanly, nice content - I’m always happy to see good media, it’s one area I have zero skill in.

How asset packs fit into the ecosystem puzzle me. Is this mainly for new TLL asset packs? Can users make/share their own? Could you programmatically require a specific asset pack, and can you tell if one is available? In other words, if I depend on the hero sounds - can I tell if they’re not downloaded, and either force it or at least fail cleanly (ie with a nice dialog to the user that they need this asset pack)? What about their format? (I’m hoping for a zip file with a different extension, like .codea, and “open in…” support. Then I’m hoping we can add code to them >:-)

Interesting. Emojii truncate a post to this board.

Anyway - looking forward to messing with wav/mp3, just gotta find the time - I’m building out some nice hefty datacenters for work, and there’s a lot of legwork still to do.

Install went cleanly. I love all the sounds, that will make a big difference, thank you for your effort and expense on our behalf.

I have the same questions about asset packs, custom asset packs, and ensuring users have the right ones available.

I wonder too, about mixing all the shader packs in with the other assets. That is likely to really confuse most users, who have no idea what shaders do. I think they would be better in subfolders off a Shader folder. But maybe that’s hard to do.

Asset packs came about mostly because as we add more file types to support, having specialised “sections” in which to view them seemed redundant.

So if we add plain text file support in the future (for example), we’d like them just to show up as assets.

At the moment if you attempt to use an asset from a pack that is not downloaded Codea warns you and tells you to download the pack.

On adding custom asset packs, I have two thoughts:

  • Allow people to import zip files as asset packs (via Open With)
  • Every project becomes its own Asset Pack, referred to by the name “Project” from your code. Letting you put all your project specific assets right into your project. (Viewing any asset picker from within your project will also show the Current Project asset pack.)

I like the second option more. I don’t see a great benefit to making asset packs easily sharable (perhaps I’m missing something). I see much more benefit in allowing people to organise their assets directly in their projects.

Bugs Reguarding sound() with asset pack sound:

When using an asset pack sound the Codea editor shows the fields as:

sound(name,seed,volume)

However the correct fields are actualy used:

sound(name, volume, pitch, pan, loop)

I’m not sure if this is intended. Loop param will accept anything other then nil/false as a true param. 0 is reguarded as loop being set to true.

I like the project pack idea.

Like Andrew, I can’t upgrade at the moment. In the midst of a project at work to be delivered by week’s end.

I downloaded one asset pack, and the other downloads simply disappeared. When the downloads were showing, the scrolling was super laggy. Clicking “Edit Shader” doesn’t do anything. The download bar on packs look cool, but jump all over the place. I can’t get any sound or music to play in previewing it or in an app. My sound effects are up and so is my volume.
iPad 3 w/ iOS 7 (not GM).
Love the update so far. I can’t wait to use it in my app. Great choice of API too.
I think project-based asset packs would be great, but when you duplicate a project, your wasting space. That might be an issue.
Thanks a ton for the update!

@Zoyt is your iPad on silent? Where did you tap “Edit Shader” from? Do generated sounds not work either?

In an asset pack, [edit] button on top right kills codea.

@Jmv38 are you on iOS 5?

@Simeon - Download bug and the sound effects strangely fixed themselves today. It might be a first install thing.
Anyways, I’m in the asset packs and the edit shader button doesn’t work.
Edit: Another bug: Sound effects still play when leaving that folder. It’s minor, but it’s annoying for long sound effects.
Edit #2: Pressing cancel when syncing to DBox seems to crash.
Edit #3: When using “sound”, the bubble for selection extends all the way from one parenthesis to the other, even with extra parameters.
Edit #4: Super weird bug: When I call the sound function twice, with parameters in the first one, when I select the second one, it copies the parameters from the first one.
Edit #5: There is not way to list the sounds in a pack, so the user has to know the name of the sprite.

@Simeon - yes, Jmv38 has an iPad1 with iOS 5

Just thought I might share a very simple script to test the sound function:

displayMode(FULLSCREEN)

function setup()
    soundToPlay = "A Hero's Quest:Broke"
    parameter.text("sfxName","A Hero's Quest:Broke",function(t)
                                                        soundToPlay = t
                                                    end)
end

function draw()
    background(0, 0, 0, 255)
    sprite("Cargo Bot:Game Lower BG",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)    
    textAlign(CENTER)
    fill(255, 255, 255, 255)
    text([[
    Touch the screen to play a sound.
    The higher you touch, the higher the pitch of the sound.
    The furthure to the right you touch, the louder the volume.
    Tilt the device left and right to change the pan of the sound.
    Please note: Please make sure you have the 'Heros's Quest' sound pack downloaded.
    If you don't want to download it, feel free to change the sound by setting it in the textbox in the sidebar.
    ]],WIDTH/2,HEIGHT/2)
end

function touched(t)
    if t.state == ENDED then
        sound(soundToPlay,t.x/WIDTH,t.y/HEIGHT,Gravity.x)
    end
end

Music bug, well, more like a feature request: You can’t scrub in live time. For instance, you can’t drag your finger across the screen to move along the music live. That being said, I can replicate it by having it change the time 3 times a second.
Thanks!!
Edit #1: Errors don’t pause music

– Comment removed: After closing Codea, I wasn’t able to replicate this crash. –

Sorry, last post in a row. Anyways, as my final test, I made something that can scrub through your music. The higher you drag, the faster you scrub. My scrubbing isn’t perfect, but it works. Here it is:


--# Main
function setup()
    print([[
Drag on the screen to scrub through the music. The higher you drag, the faster you scrub.
Tilt left and right to to pan the music.
Enjoy!
    ]])
    parameter.text("Music name","Game Music One:Venus",function(t)
                                                        music(t,true)
                                                        musicPlaying = t
                                                    end)
    parameter.number("Volume",0,1,1,function(v)
                                        music.volume = v
                                    end)
    parameter.watch("music.currentTime")
    parameter.watch("music.duration")
    
    scrub = nil
    scrubInit = nil
    scrubTimeInit = nil
    scrubTimer = Timer(.5,function()
            if scrub then
                music.currentTime = scrub*music.duration
            end
        end)
end

function draw()
    background(0, 0, 0, 255)
    
    textAlign(CENTER)
    fill(255, 255, 255, 255)
    text("Currently playing:\
"..musicPlaying,WIDTH/2,HEIGHT/2)
    
    music.pan = Gravity.x
    
    scrubTimer:update()
    
    strokeWidth(3)
    if scrub then
        timeDecimal = scrub
    else
        timeDecimal = music.currentTime/music.duration
    end
    line(timeDecimal*WIDTH,0,timeDecimal*WIDTH,HEIGHT)
end

function touched(t)
    if t.state == MOVING then
        if scrubInit == nil then
            scrubInit = t.x/WIDTH
        end
        if scrubTimeInit == nil then
            scrubTimeInit = music.currentTime/music.duration
        end
        scrub = scrubTimeInit + ((t.x/WIDTH - scrubInit)*(t.y/HEIGHT))
        if scrub > 1 then
            scrub = 1
        end
    elseif t.state == ENDED or t.state == CANCELLED then
        if scrub then
            music.currentTime = scrub*music.duration
            scrub = nil
            scrubInit = nil
            scrubTimeInit = nil
        end
    end
end
--# Timer
Timer = class()

function Timer:init(interval,callback)
    self.interval = interval
    self.callback = callback
    self.time = 0
    self.occurances = 0
    self.paused = false
end

function Timer:update()
    if self.paused ~= true then
        self.time = self.time + DeltaTime
        if self.time >= self.interval then
            self.occurances = self.occurances + 1
            self.time = 0
            if type(self.callback) == "function" then
                self.callback(self.occurances)
            end
            return true
        else
            return false
        end
    end
end

function Timer:reset()
    self.time = 0
    self.occurances = 0
end

function Timer:pause()
    self.paused = true
end

function Timer:resume()
    self.paused = false
end

function Timer:isPaused()
    return self.paused
end

function Timer:getTime()
    return self.time
end

function Timer:getCount()
    return self.occurances
end