sound_paths bug?
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- meadwarrior
- Journeyman
- Posts: 91
- Joined: Sat Dec 01, 2018 1:02 am
sound_paths bug?
Hello!
It may not be a bug but instead me missing something.
When I make a trigger to start a music theme, it only works when the music is in the main folder (like before 0.7.0).
Creating a sound.cfg and describing sound_paths doesn't help, the music is not recognized.
How would I go about implementing music that's in a different folder?
Thanks!
It may not be a bug but instead me missing something.
When I make a trigger to start a music theme, it only works when the music is in the main folder (like before 0.7.0).
Creating a sound.cfg and describing sound_paths doesn't help, the music is not recognized.
How would I go about implementing music that's in a different folder?
Thanks!
- Gambit37
- Should eat more pies
- Posts: 13715
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: sound_paths bug?
To access music from a subfolder, edit the music exvar in your ambient sound object so that it points to the folder, eg:
That works for me, do you get a different result?
The sound.cfg file is a new feature that only works for the existing sound effects. You'd only use that if you want to override those built-in sounds with filenames in a different subfolder, eg, in sound.cfg you'd need something like this:
I've not yet tested that new feature, but in theory that's how it should work. Note that DSB built in sounds have some funny names, but you need to refer to them exactly. You can get the existing names from base/graphics.lua near the bottom of the file. You just need the bit after the "snd." definition.
Code: Select all
music = "folder/filename_without_extension"
no_loop = true
The sound.cfg file is a new feature that only works for the existing sound effects. You'd only use that if you want to override those built-in sounds with filenames in a different subfolder, eg, in sound.cfg you'd need something like this:
Code: Select all
sound_paths = {
BUZZ = "sfx_remaster/dungeon_teleport.ogg",
CLICK = "sfx_remaster/dungeon_click.ogg",
DINK = "sfx_remaster/dungeon_dink.ogg",
[..etc..]
}
- meadwarrior
- Journeyman
- Posts: 91
- Joined: Sat Dec 01, 2018 1:02 am
Re: sound_paths bug?
I see, so it's for sounds only.
Thanks, Gambit! Pointing the exvar to the folder worked perfectly.
As a bonus, it seems to be loading the music much faster than from the main folder. At least there's no 'slowdown' when the music starts
Thanks, Gambit! Pointing the exvar to the folder worked perfectly.
As a bonus, it seems to be loading the music much faster than from the main folder. At least there's no 'slowdown' when the music starts
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: sound_paths bug?
Actually, no, sound_paths works for dsb_music as well. If it isn't working for you, then you've done something wrong.
Post your relevant code and I'll try to help.
Post your relevant code and I'll try to help.
- meadwarrior
- Journeyman
- Posts: 91
- Joined: Sat Dec 01, 2018 1:02 am
Re: sound_paths bug?
Okay, this is awkward. After trying again, it worked as advertised
Sorry for the false alarm.
Is there an advantage to doing it this away vs the other one?
I get a slowdown when the music starts with both methods (except for one trigger that magically has none )
Thanks!
Sorry for the false alarm.
Is there an advantage to doing it this away vs the other one?
I get a slowdown when the music starts with both methods (except for one trigger that magically has none )
Thanks!
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: sound_paths bug?
The main advantage is you have all of your file paths in one place so if you need to move things around you don't have to edit a bunch of code. DSB will also load (very slightly) faster, but the difference isn't significant.
The slowdown is caused more by FMOD (the sound library used by DSB) and your filesystem than anything DSB is doing, and unfortunately there isn't much I can do about it.
The slowdown is caused more by FMOD (the sound library used by DSB) and your filesystem than anything DSB is doing, and unfortunately there isn't much I can do about it.
- meadwarrior
- Journeyman
- Posts: 91
- Joined: Sat Dec 01, 2018 1:02 am
Re: sound_paths bug?
I see, thanks!
Don't worry about the slowdown, it doesn't really bother that much
Don't worry about the slowdown, it doesn't really bother that much
- Gambit37
- Should eat more pies
- Posts: 13715
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: sound_paths bug?
Sorry for any misinformation on my part!
I had thought the .cfg files were only for re-pathing existing DSB named assets? Is that not the case? I did try defining new named graphics in the graphics.cfg, but that didn't work, so I'm still using my graphics.lua for new stuff. What is the right way to do this? I'm getting a bit confused to be honest!
I had thought the .cfg files were only for re-pathing existing DSB named assets? Is that not the case? I did try defining new named graphics in the graphics.cfg, but that didn't work, so I'm still using my graphics.lua for new stuff. What is the right way to do this? I'm getting a bit confused to be honest!
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: sound_paths bug?
All graphics.cfg does is specify a path to use when trying to load a certain bitmap. It doesn't actually try to load anything. That is, you still need a call to dsb_get_bitmap to actually load an image, but you can just use a short symbolic name (like in base/graphics.lua) and it will pull the long path out of graphics.cfg.
There are other methods for specifying a path, such as putting it directly in the dsb_get_bitmap call, but they are less flexible.
There are other methods for specifying a path, such as putting it directly in the dsb_get_bitmap call, but they are less flexible.
- meadwarrior
- Journeyman
- Posts: 91
- Joined: Sat Dec 01, 2018 1:02 am
Re: sound_paths bug?
No worries, I appreciate your help either way, Gambit
What I do is to specify a pathname in the graphics.cfg
and then I do the thing in the graphics.lua
which I can then use for new objects.
The gfx folder is inside the main folder.
--EDIT: Oops, Sophia beat me there
What I do is to specify a pathname in the graphics.cfg
Code: Select all
graphics_paths = {
DEADSKULLTIST_FRONT1 = "gfx/floor_flats/deco/deadskulltist_front1.png",
}
Code: Select all
gfx.deadskulltist_front1 = dsb_get_bitmap("DEADSKULLTIST_FRONT1")
The gfx folder is inside the main folder.
--EDIT: Oops, Sophia beat me there
- Gambit37
- Should eat more pies
- Posts: 13715
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: sound_paths bug?
Doh! Right. OK, thanks both!
Sophia, is there any difference in startup loading speed between adding a short named file in the CFG and then loading it in graphics.lua, versus just loading it in graphics.lua without a short name?
Sophia, is there any difference in startup loading speed between adding a short named file in the CFG and then loading it in graphics.lua, versus just loading it in graphics.lua without a short name?
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: sound_paths bug?
A file should always have a short name, but something like this is also perfectly valid:
Both doing it this way and adding a "SOMEIMAGE" entry in graphics.cfg are pretty much the same speed, and both methods are ever so slightly faster than just having a short name by itself because DSB doesn't have to try to load every single format it supports. Without a file extension DSB just has to try each file extension it supports in turn.
Code: Select all
gfx.some_image = dsb_get_bitmap("SOMEIMAGE", "gfx/someimage.png")
- Gambit37
- Should eat more pies
- Posts: 13715
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: sound_paths bug?
Hmmm. I've never bothered with short names for my new graphics, I don't see the point of them. As I'm only ever referring to things by their "gfx.name" in my code, having a short name makes no difference. So I've been doing it like this for years which seems to work fine:
Code: Select all
gfx.ui_background_only = dsb_get_bitmap(path .. "ui_background_only")