Hello Guest

locating audio files

  • 3 Replies
  • 7613 Views
locating audio files
« on: December 24, 2005, 06:23:08 »
The WaveData class, when instanciated, looks for audio relative to the classpath, and that's kinda lame... I want to make it look 'absolutely', or relative to the working directory. I tried feeding it an absolute path and it didn't work.

Anybody have some advice?

Cheers
Jeff

*

Offline oNyx

  • ***
  • 177
  • 弾幕
locating audio files
« Reply #1 on: December 24, 2005, 17:00:46 »
Relative to the classpath and relative to the working directory is the same (the former is a superset of the latter).

Well, use leading slashes (like "/sfx/blam.wav") for making it relative from the root of the classpath.

locating audio files
« Reply #2 on: December 25, 2005, 03:28:25 »
Yeah, the workaround is easy, just not very elegant since netbeans has a weird place for putting my class files, which I feel I shouldn't need to worry about. I set it up to use a specific working directory, but LWJGL doesn't use that.

Oh, and so I don't the working directory is in the classpath necessarily...

It would be nice if WaveData took a location relative to the working directory, or if it could take an absolute address, or if it took a File as input.

~Jeff

*

Offline oNyx

  • ***
  • 177
  • 弾幕
locating audio files
« Reply #3 on: December 25, 2005, 10:02:35 »
Its not a workaround. Its the proper way to do it.

Using files or absolute pathes would be an ugly hack, which would break outside of your building system. Dont do that.

Just add the resouce dir to the classpath (for the run bit) and use pathes with leading slashes. Thats all.