Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » SWT "realtime" VU Meter Control
SWT "realtime" VU Meter Control [message #722344] Mon, 05 September 2011 12:59
Peter Dell is currently offline Peter DellFriend
Messages: 12
Registered: September 2011
Junior Member
Hi,
I'm currently integrating a sound module player (asap.sourceforge.net) into my Eclipse based WUDSN IDE (www.wudsn.com). In fact it already works fine and has I have added a VU meter display which shows the current volume for each channel.
index.php/fa/3872/0/

I've already learned that SWT requires widgets to be updated from the display thread. So whenever the player thread has rendered another chunk of music data, I trigger an asynchronous update as shown below. But the delay is really large (so the sound and the display are out of sync) and I'd like to have a more updates - maybe even couples with the actual audio.

Has anybody done something like this before and can provide tips?

Best regards, Peter


    public void playerUpdated() {
	String position;
	final String text;
	final int[] channelVolumnes;

	channelVolumnes = player.getChannelVolumes();
	if (player.isRunning()) {
	    position = (player.getPosition() + 999) / 1000 + "s";
	    if (player.isPaused()) {
		text = position + " (paused)";
	    } else {
		text = position;
	    }

	} else {
	    text = "Stopped";
	}

	// Updates to widgets must be performed in the display thread.
	Display.getDefault().asyncExec(new Runnable() {
	    // @Override
	    public void run() {
		playerUpdatedWithValues(text, channelVolumnes);
	    }
	});
    }

    void playerUpdatedWithValues(final String text, final int[] channelVolumnes) {
	if (partControlCreated) {
	    if (positionField.getControl().isDisposed()) {
		positionField.setValue(text);
	    }
	    vuMeterField.update(channelVolumnes);
	}
    }



  • Attachment: VUMeter.png
    (Size: 12.01KB, Downloaded 1724 times)

[Updated on: Mon, 05 September 2011 13:00]

Report message to a moderator

Previous Topic:Eclipse cannot create Java files
Next Topic:Running Eclipse IDE on cortex platform (ARM processor)
Goto Forum:
  


Current Time: Mon May 06 14:46:59 GMT 2024

Powered by FUDForum. Page generated in 0.03513 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top