Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / DeleteFile does not delete an OGG music file

Author
Message
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 19th Jun 2019 15:26 Edited at: 19th Jun 2019 16:42
I need to update one of my apps in the Google Play Store and as part of the update I have converted my mp3 music files in to .ogg files.

Using an encryption/decryption method provided by Steve Vink in September 2015 newsletter, a temporary file is written to my Windows default write location on my pc.
This file needs to be deleted once it is loaded, but unfortunately .ogg files refuse to be deleted.

Please note that this is to delete a file from the directory and not the same as deleting the file to simply free up resources using example DeleteMusicOgg(1)

Other files such as .png, .wav and .mp3 files are readily deleted using deletefile("filename") , but not .ogg files.

I need help, Thanks
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 19th Jun 2019 17:05 Edited at: 19th Jun 2019 17:08
Does this happen after you load and play the file? If so, what happens if you simply copy/place the file and then try to delete it? It's possible that one of the mechanisms in the OGG loading/playing operations is not properly releasing/unhooking the file from memory after it is deleted from its index, preventing the file itself from being deleted. But it could also just be some quirk with the delete file operation and the OGG extension. Knowing one way or the other might help direct TGC in what direction to go to fix it.

I ran into a similar issue with the Enhanced Audio Plugin for DBP. If I loaded a sound file via EAP, I couldn't later delete the file itself after it had been used. I discovered that if I cleared the index, then loaded a small blank audio file in that same index, I could then delete the original file.
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 19th Jun 2019 17:44
Hi SFSW, thanks for your suggestions.

If I simply copy/paste the ogg file and then simply run the deletefile( ) command, it does delete.

If I load the file using LoadMusicOgg(1,"mymusic.ogg") and then try to delete using deletefile("mymusic.ogg") then it does not delete.

If I load the ogg file, play the ogg file to its end or stop the ogg file, then it does not delete.

Other files with wav, mp3 and png extensions delete at all times.

I am not sure whats happening or not happening to prevent the deletion but hope this helps somewhat.
+
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Jun 2019 21:26
Maybe deletesound() then deletefile()
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 19th Jun 2019 21:58 Edited at: 20th Jun 2019 02:06
Sounds like the same kind of problem I had with the EAP, for some reason, it seems unhooking loaded OGG files from their indexes doesn't appear to work quite right with both systems.

If available as Blink says, it would be interesting if the SoundOGG file commands behave any differently, or if you run into the same problem as with the MusicOGG commands. If the former lets you delete the file, then it might be a temporary work around in the meantime (depending on your load time requirements) until TGC can sort out the problem.

If both fail, then you could try my work around approach and just keep a tiny OGG file in place (that doesn't need to be deleted) that you can load in the same index you previously loaded the one you want to delete in. Then see if that unhooks it so you can delete the original OGG file.

Either way, definitely sounds like something to report to TGC as a bug.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Jun 2019 22:35
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 20th Jun 2019 02:07
Ah ok, I was wondering about SoundOGG commands

I suspect the OP had deleted the OGG from the index before trying to delete the file itself, but maybe not?
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 20th Jun 2019 11:30
Hi both SFSW & blink0k. I have tested a few more options and this is what I have found.

LoadSoundOgg( id, mysound.ogg) works ok, loads, plays, and then does deletes using deletefile("mysound.ogg").

DeleteMusicOgg(1) basically unloads the music file but does not delete the "mymusic.ogg" file from the folder.

DeleteMusicOgg(1) followed by deletefile("mymusic.ogg") both unloads the music and then deletes the file from the folder.
Unfortunately because it has been uninstalled it needs to be loaded again to be played which takes me back to where I started, needing to load the file again and then deleting.
So this method cannot really be used.

And of course using just;
Deletefile("mymusic.ogg") does not delete the file from the folder.

I did make some attempt to load an "unwanted music" using the same index, but it doesn't allow unless I delete the 1st one, so again this method cannot be used for this use.

I thank you both for trying to help but I guess this is a BUG.

Can anyone else try to replicate my dilemma ? Thank you.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Jun 2019 11:35
just a thought
could it be that your load path is normal ie yourapplication/media
but the delete is trying to delete in c:\users/yourname/appdata/local/AGKapps/yourapplication/media
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 20th Jun 2019 12:08 Edited at: 20th Jun 2019 12:18
Hi fubarpk, thanks for mentioning.
However the files are initially written to c:\users/yourname/appdata/local/AGKapps/yourapplication/media folder and this is the folder I am trying to delete from.

Just as a test I placed copies of my files in the media folder but nothing is deleted from here.

p.s don't forget all files with other extensions including soundOgg.ogg are deleted successfully, its just musicOgg.ogg that is being awkward.

Thanks though.
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 20th Jun 2019 12:37
I would like to report this as a BUG and as per usual need a quick fix.

How do I report this as a BUG.

1) Do i use Studio GitHub although I thought that was just for the Studio IDE ?

2) In this forum can I mark the "post title" as BUG, although I cannot see a way to do that ?

3) Will Paul see this post or will a mod refer it to him ?

4) Do I just leave it here and hope for the best ?


As mentioned before if anyone can replicate the fault it may add some weight.

Thanks again.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Jun 2019 22:59 Edited at: 20th Jun 2019 23:02
I'm thinking it isn't so much a bug as it is the way that loadmusicogg differs from loadsoundogg

SoundOGG fully decompresses it and loads fully into memory (allowing it to then release the file handle and allowing you to delete the file without unloading the resource)

MusicOGG doesn't do this: it reduces memory use by not fully decompressing and loading fully into memory. My guess is that it instead decompresses and loads as a stream, small chunks at a time (requiring it to hold the file open for reading, and thus preventing you from deleting)

It sounds like you have your fix: use loadsoundogg instead and be mindful of the memory use
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 21st Jun 2019 10:46 Edited at: 21st Jun 2019 15:13
@ Ortu
Quote: "use loadsoundogg instead"


Thank you for pointing this out and YES the file is now deleted using deletefile("mymusic.ogg").

I don't think this is obvious as a fix but it has the desired result except for possible memory implications, so if a permanent solution is not provided maybe a note in the "Help Files" regarding its limitations may be sufficient to let others know when and if they need to use it.

Thanks again for taking the time to helping with this one.

Login to post a reply

Server time is: 2024-04-20 06:21:27
Your offset time is: 2024-04-20 06:21:27