Why are sometimes my sound files locked?

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,356
Reaction score
2,553
First Language
French
Primarily Uses
RMVXA
Hello,

I was wondering why sometimes the editor is locking my sound files.
I have a sound file (0.5 second, 8KB) that, when played in the editor, is not locked when I try to delete it in the Windows Explorer.
If I copy/paste this file in Audacity to expand its length, then play it in the editor, I can no longer delete this file in the explorer unless I close the editor.

I've even tried with a sound file composed only of generated silence. Above the 2.756 seconds mark (more or less a few milliseconds) then the file becomes locked.

Questions time:
Why is the editor locking the files?
How can I prevent it?

It doesn't seem to be related to the file itself, since the same file saved with Audacity works under the 2.756 seconds mark.
 

Seriel

Veteran
Veteran
Joined
Aug 16, 2014
Messages
3,013
Reaction score
504
First Language
English
Primarily Uses
Other
I usually let another file play for a few seconds and it releases the original one.
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,356
Reaction score
2,553
First Language
French
Primarily Uses
RMVXA
I've tried waiting, to no avail. Now I have two sound files locked. I'm wondering if it's a bug or a feature... :distrust:
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,465
Reaction score
11,940
First Language
English
Primarily Uses
RMVXA
When that happens to me, I have to wait until I close the editor, then go in to the audio folder and delete it manually.
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,356
Reaction score
2,553
First Language
French
Primarily Uses
RMVXA
That's annoying, because I'm working on an alternate sound engine for encryption, but I'm stuck because of these locked sound files.

I can't figure why it happens, which makes it difficult to fix.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,346
Reaction score
8,389
First Language
German
Primarily Uses
RMMV
Basically, if windows can't delete a file, that is because it's in use. However, that is not something directly checked - the file is marked as such on opening and remains that way until closing.


Having two programs open similiar-named files can get to problems here, but it can very well be that it's another program accessing those files as well - you have to close programs and check the results until you know which one causes the problem.
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,356
Reaction score
2,553
First Language
French
Primarily Uses
RMVXA
It is related to the editor, no doubt here.

I used a program to get the handle of the locked file and which program is using it, and the only answer is the editor.

It allows deletion if the sound file is short (under 2.756 seconds in my testing) and locks the file above it.

I tried waiting for the sound to be played entirely, I also used the "stop" button. Nothing works. Once the editor locks the file, only quitting the editor can free the file again.

Or kill the handle with an external program, which seems overkill for my use.

Edit:

I couldn't prevent this lock, but I found an alternate way to access my sound files. Actually, I still have to test to be sure but it's even more effective than my previous attempt.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,869
Reaction score
14,989
First Language
English
Primarily Uses
RMMV
I've moved this thread to Tech Support - All Makers. Please be sure to post your threads in the correct forum next time. Thank you.
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,356
Reaction score
2,553
First Language
French
Primarily Uses
RMVXA
Back to square one, I can't make the system read a specific file name inside an encrypted archive. I can extract the data, but not the path of the file...

And since the se_play function only takes a path and not the sound data, it doesn't work.

I still have to extract the data to a temporary file, but it gets locked after it's played (for sounds longer that 2.756s)

I've tried many ways to read and write data, but this darn undocumented audio function is broken and I can't fix it.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,869
Reaction score
14,989
First Language
English
Primarily Uses
RMMV
What command are you using?
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,356
Reaction score
2,553
First Language
French
Primarily Uses
RMVXA
I play my sound with:

Audio.se_play('<path+filename>', @volume, @pitch)

Which seems to lock the file after play, just like the editor does. It's probably the same command so I asked about the editor command first instead of scaring people with ruby code :|

If I could find a way to send the path of the file inside the rgss3a archive that could work, but load_data retrieves only the data, not the path to it. And this se_play command only wants a path, not the data itself...

At the moment I see two solutions:

-remove/prevent the lock of played sound files so I can use a temp file.

-retrieve the path to a specific file inside a rgss3a archive to send directly to se_play.

But I can't do it, at least not with my limited ruby skill.
 

Latest Threads

Latest Posts

Latest Profile Posts

For anyone interested: there's another huge humble bundle with JRPG assets + a game jam starting next month - it's for a good cause, so check it out <3
Turning a specific vibe into reality is incredibly difficult. For instance, this song is one of the ones I listen to when working on my post apocalyptic project, and getting it's "feeling" into the game has been a real challenge.

I don't just wanna regurgitate the numbers I see, I wanna actually understand the calculations I'm making so I'm probably gonna make a post later with some calculations and what I THINK they mean to get some advice and corrections.

Edit: All (Most) of these will be tested in game prior. I just wanna make sure I understand what's going on under the hood if you will.
my girlfriend calls all my little chibi art cute lol... funny considering that wasn't the original art style of the game.
100 problems in RMMZ 100 more problems take one down pass it around 101 Problems in RMMZ

Forum statistics

Threads
113,778
Messages
1,077,361
Members
147,808
Latest member
traviscot
Top