Playing a sound at regular intervals

Daniel Glöckner daniel.gloeckner at 360t.com
Tue Aug 23 11:51:39 UTC 2016


Hi,

We're trying to play a notification sound at a regular interval (every 500ms) in a loop.

It should sound like "bing.bing.bing." and not like "bing......bing..bing...bing" if you know what I mean ;)

>From the JavaDoc we were guessing that an efficient way to do this would be to set cycle count to indefinite on the audio clip / on the media player and call play() once.

Observations:
- Cycle count doesn't work for mp3 files. No problem, just use WAV.
- The playback does not happen at regular intervals. -> not usable in this scenario

Our solution so far has been to have a scheduled executor which calls audioclip.play() every 500 ms. This creates a new thread every time (see stack trace below) and we don't like this approach.

Are there any experts for NativeMediaPlayer on this mailing list?

Kind regards,
Daniel

Daemon Thread [Thread-21] (Suspended)	
	owns: NativeMediaAudioClipPlayer  (id=1523)	
	NativeMediaPlayer$EventQueueThread(Thread).init(ThreadGroup, Runnable, String, long, AccessControlContext) line: 365	
	NativeMediaPlayer$EventQueueThread(Thread).init(ThreadGroup, Runnable, String, long) line: 349	
	NativeMediaPlayer$EventQueueThread(Thread).<init>() line: 445	
	NativeMediaPlayer$EventQueueThread.<init>(NativeMediaPlayer) line: 386	
	GSTMediaPlayer(NativeMediaPlayer).<init>(NativeMedia) line: 109	
	GSTMediaPlayer.<init>(GSTMedia) line: 46	
	GSTMediaPlayer.<init>(Locator) line: 62	
	GSTPlatform.createMediaPlayer(Locator) line: 121	
	PlatformManager.createMediaPlayer(Locator) line: 201	
	NativeMediaManager.getPlayer(Locator) line: 222	
	MediaManager.getPlayer(Locator) line: 104	
	NativeMediaAudioClipPlayer.play() line: 319	
	NativeMediaAudioClipPlayer.clipScheduler() line: 112	
	NativeMediaAudioClipPlayer.access$000() line: 47	
	NativeMediaAudioClipPlayer$Enthreaderator.lambda$static$4() line: 85	
	2056540299.run() line: not available	
	Thread.run() line: 745	



More information about the openjfx-dev mailing list