Author Topic: Laser Agent Code Development  (Read 13386 times)

0 Members and 1 Guest are viewing this topic.

Agent C

  • Guest
Re: Laser Agent Code Development
« Reply #15 on: October 14, 2009, 04:06:31 pm »
What OS are you working with?

The code posting is more to satisfy the curiosity of those who wanted to see how the sound engine works  and how I get from openGL to audio.  There are really all of 12 or so trickfilms (to borrow terminology from the Lasergraph), so there isn't much to do anyway.  I'll try to help everyone get it to compile on their platform of choice.

On another note, I'm going to have to rip apart the openGL engine and rebuild it anyway.  There is a fundamental flaw in how I handle the laser shape classes that causes unwanted blanks.  The way I have it written now automatically inserts a blank at the end of a laser segment.  The problem I'm seeing is that a simple closed shape, like a circle, will have a little blank notch in it from when the segment ends, the laser is momentarily blanked, and the segment begins again from the beginning.  A more complicated problem is in shapes with multiple segments with closed geometry like a circle of circles.  Each circle has a little notch in it.  Bleh.

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2089
  • Milliwatts: 46
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: Laser Agent Code Development
« Reply #16 on: October 14, 2009, 06:14:29 pm »
That little "bleh" is a real p.i.t.a!

I just fiddled with that exact same thing!

This is where just the right amount of dwell (extra samples) and perfect timing between the colors and the galvos is super critical.

James.  :)
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Offline BlinkenLights

  • he's just this guy, ya know?
  • Administrator
  • Hero Member
  • *****
  • Posts: 726
  • Milliwatts: 4
  • Gender: Male
  • 'The Messenger' by Will Cascio
    • View Profile
Re: Laser Agent Code Development
« Reply #17 on: October 14, 2009, 11:10:57 pm »
windows 7 is my OS

Agent C

  • Guest
Re: Laser Agent Code Development
« Reply #18 on: October 15, 2009, 12:04:15 am »
That little "bleh" is a real p.i.t.a!

I just fiddled with that exact same thing!

This is where just the right amount of dwell (extra samples) and perfect timing between the colors and the galvos is super critical.

James.  :)

There are a couple of possibilities, and I agree that dwell is important part.  DPSS lasers have a warm up time with analog modulation.  I think the warm up time is making the problem look worse.  The next thing is sample shifting.
 Let's say I want to draw a circle with 1000 points. 
I'll start from the buffer as it comes back from the graphics card
Buffer is parsed, x,y,r,g,b values are placed into an array.
x,y values are copied to sample queues that is sent to the sound card at a fixed rate
r,g,b values are shifted 5 points, then copied to their respective sample queues.
Thread grabs the buffer for next graphics frame, which is the circle again.
Meanwhile, scanners start moving, 5 points later the laser comes on, stays on for 1000 samples.
Hopefully there isn't a buffer under-run, and the thread responsible for stuffing data into the queues has managed to stuff another 1000 points in by the time its needed. 
The scanners come back to the top of the circle, then start moving again.  The laser shuts off 5 samples later, and powers back on 5 samples after that.  Hence the gap.

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2089
  • Milliwatts: 46
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: Laser Agent Code Development
« Reply #19 on: October 15, 2009, 12:41:31 am »
Sample shifting is not an easy thing to code!

The offsets have to be maintained through the entire play of the stream.

James.  :)
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

Agent C

  • Guest
Re: Laser Agent Code Development
« Reply #20 on: October 22, 2009, 11:28:10 pm »
I think I will save a few samples from the previous frame, try to ascertain if the last point is lit and the first point of the next buffer is lit and if they are close enough to keep the laser lit.  We'll see this weekend if it works.

Agent C

  • Guest
Re: Laser Agent Code Development
« Reply #21 on: November 10, 2009, 02:08:23 pm »
Inspired by a failed battery and a 5 year old chip on my mac laptop, I'm going to be switching development over to windows until I can afford a newer laptop.  With this in mind, I'll do a much better job of abstracting the platform dependent portions of the code (ie audio out and maybe now video in).  I'm hoping this will get more people testing the software out, too.

Offline James

  • Administrator
  • Hero Member
  • *****
  • Posts: 2089
  • Milliwatts: 46
  • Gender: Male
    • View Profile
    • LaserBoy !!!
Re: Laser Agent Code Development
« Reply #22 on: November 10, 2009, 04:42:46 pm »
Might I suggest using Dev-C++ ?

It is GNU GCC, as you probably know.

James.  :)
LaserBoy is Sofa King Cool!
But it will never be Alpha King Done!

 

SMF spam blocked by CleanTalk