Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Loop point in an OGG  (Read 3337 times)
0 Members and 1 Guest are viewing this topic.
Offline princec

JGO Kernel


Medals: 363
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Posted 2009-10-14 21:12:41 »

I'm using JOrbis to decode Ogg Vorbis streams and send little chunks to OpenAL.
What I'd like to know is - has anyone got any tips about setting a "loop" point, where the stream resets itself back to a particular point in time and continues reading from there until stopped? I don't think I can just arbitrarily choose any old byte in the file because it'll be in the middle of a "frame" of Ogg data, so I need to know how, given a specific timecode, I can set the stream read point back to where this time occurs. If you see what I mean.

Cas Smiley

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2009-10-17 13:38:48 »

At the risk of being captain obvious to the rescue...


You have the decoded data that you send to OpenAL. While decoding/streaming, you can store it somewhere (either RAM or disk) and jump to a 'N byte aligned random offset' and pass the next samples to OpenAL again.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline paulscode

Senior Member


Medals: 12


Staff Sergeant


« Reply #2 - Posted 2009-10-17 14:13:08 »

You have the decoded data that you send to OpenAL. While decoding/streaming, you can store it somewhere (either RAM or disk) and jump to a 'N byte aligned random offset' and pass the next samples to OpenAL again.
That would eliminate the resource-saving benefit that you get from streaming an OGG (i.e. taking advantage of the small size of OGGs and only hanging onto to a small chunk of the much larger decoded data at any one time).
I actually need something like this as well for a method I'm adding to my sound library, so I'll post the solution if I happen to discover it before you do, princec.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2009-10-17 14:46:29 »

Well doh. But often you just want your download to be as small as possible. As soon as you're installed... who cares.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline paulscode

Senior Member


Medals: 12


Staff Sergeant


« Reply #4 - Posted 2009-10-17 18:05:05 »

As soon as you're installed... who cares.
True for an application, but optimization is still a big concern for applets, where there is a maximum amount of memory you can use.  There are of course more than one solution to every problem, so which one is best ultimately depends on the project and whatever constraints you are working under.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #5 - Posted 2009-10-17 18:10:06 »

The ogg container format defines what would work with seeking. Generally a ogg packet/page boundary should work, but vorbis uses an overlapping transform. So that may be a good thing--in that it will smooth out any clicks from an abrupt level change. OTOH it may cause the next 2? blocks to get pretty distorted. 

I think the software decoding lib should have some seeking hooks. That would be the correct way to do it if possible.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2009-10-17 18:23:38 »

True for an application, but optimization is still a big concern for applets, where there is a maximum amount of memory you can use.  There are of course more than one solution to every problem, so which one is best ultimately depends on the project and whatever constraints you are working under.

LWJGL/OpenAL uses a signed applet. They can easily hack in support for the allocation of direct bytebuffers (or simply use mapped files for ByteBuffers up to 2GB) and dump your sound data inthere.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline paulscode

Senior Member


Medals: 12


Staff Sergeant


« Reply #7 - Posted 2009-10-17 20:26:26 »

They can easily hack in support for the allocation of direct bytebuffers (or simply use mapped files for ByteBuffers up to 2GB) and dump your sound data inthere.
True for signed applets, but in the case of unsigned ones using Java Sound instead of LWJGL, that wouldn't be an option.  This may work in princec's case depending on what his project is (it may not even be an applet).  But in my case, if at all possible I don't want to require the user to sign his/her applet when using my library.  One of its appeals is the possibility of a simple 3D sound system in pure Java.  Coupled with a pure Java software-rendering 3D engine, and you can create game applets that don't require applet signing or for the user to click a security warning.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #8 - Posted 2009-10-18 06:19:20 »

You can keep track of the number of bytes decoded. I'm pretty sure if you decode X bytes, then you can sometime later give the OGG decoder bytes starting at offset X and be sure to be on whatever boundary OGG expects.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (41 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!