LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT, etc.

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?

Do you like this idea with using of SDL Mixer?

Yes, I like it!
25
93%
No, I don't like this thing.
2
7%
I have another opinion...
0
No votes
 
Total votes: 27
Onule
Spiny
Spiny
Posts: 27
Joined: Tue Mar 18, 2014 11:54 pm

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Onule » Fri Jan 30, 2015 3:06 pm

Reinstalled SMBX files in a new folder, added the package files (The updated package is missing libogg-0.dll!) and modified .exe, audio is now working perfectly.
Tried the playlist level again but replaced the_reincarnation_of_yammah.s3m with bossa-ing_around.s3m, when the game tried to play the file, the game's audio in the volume mixer is set to 0 and the problems come back. This happens with the reincarnation of yammah file too.

EDIT: Messing with the level's lua, the problem actually happens when ice_ow.mid fades out.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Fri Jan 30, 2015 3:28 pm

Onule wrote: Reinstalled SMBX files in a new folder, added the package files (The updated package is missing libogg-0.dll!) and modified .exe, audio is now working perfectly.
Oops, fixed
Onule wrote: Tried the playlist level again but replaced the_reincarnation_of_yammah.s3m with bossa-ing_around.s3m, when the game tried to play the file, the game's audio in the volume mixer is set to 0 and the problems come back. This happens with the reincarnation of yammah file too.
Is sound totally disappears?

I think, at first, try to replace some in the lunadll.lua:

Code: Select all

MusicPlayFadeIn(1300) replace with MusicPlay()
also put before this command the "MusicVolume(127)" line

Onule
Spiny
Spiny
Posts: 27
Joined: Tue Mar 18, 2014 11:54 pm

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Onule » Fri Jan 30, 2015 4:02 pm

This is what happens, when it switches from .mid to any other format.



And edited the code in the .lua, still happens.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Fri Jan 30, 2015 4:08 pm

Onule wrote:This is what happens, when it switches from .mid to any other format.



And edited the code in the .lua, still happens.
Also, "Native MIDI player" is not support fadeout :P, but on my computer aren't problems (same Windows 7, same x64, but custom MIDI driver, Software OPL Synthesiser istead of MS WT)
Try to install custom MIDI driver:
http://engine.wohlnet.ru/docs/Sounds/SM ... 3synth.zip
(if you use Windows 7 you need a tool to switch MIDI playback device)
You can get BASSMIDI http://www.kode54.net/bassmididrv/ , it's a SF2 MIDI Synthesiser, but we need for them to get able correctly switch MIDI device:
Spoiler: show
Image
Last edited by Wohlstand on Fri Jan 30, 2015 4:12 pm, edited 1 time in total.

dagget10
Volcano Lotus
Volcano Lotus
Posts: 536
Joined: Wed Oct 01, 2014 8:32 pm
Pronouns: she/her

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby dagget10 » Fri Jan 30, 2015 4:09 pm

I keep getting a problem with Mushroom Gorge. It plays twice as fast as normal.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Fri Jan 30, 2015 4:12 pm

dagget10 wrote:I keep getting a problem with Mushroom Gorge. It plays twice as fast as normal.
Resample it into 44100 Hz.
But also you can download this package and unpack them into your SMBX directory:
https://drive.google.com/open?id=0B3QNP ... authuser=0
It contains .OGG music pack (Same HQ pack in MP3 format have ~250 MB, this pack in same quality have ~85 MB)

Onule
Spiny
Spiny
Posts: 27
Joined: Tue Mar 18, 2014 11:54 pm

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Onule » Fri Jan 30, 2015 4:17 pm

Yup, now it's working correctly, thanks! Did have the MIDI driver and BASSMIDI but forgot to set it up, woops.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Fri Jan 30, 2015 4:24 pm

Onule wrote:Yup, now it's working correctly, thanks! Did have the MIDI driver and BASSMIDI but forgot to set it up, woops.
I just tried on my PC:
I switched to "Microsoft Synth" and got same bug with fadeout. by anyway, this should be a bug of SDL Native MIDI Player, I think, I will report to SDL Devs and will try out to fix this bug, but if you wish to use MIDI's, install & switch a custom MIDI driver!

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Sun Feb 08, 2015 4:31 pm

Just added link to experimental LunaLUA v0.5.3+SDL Build.
What's new:
  • New functions: MusicIsPlaying(), MusicIsPaused(), MusicIsFading() which you can use in Lua, and later will be more!
  • Several fixes and improvements such an adding of better resampler for MP3 48000 to 44100 which fixes noise for those 48000 MP3's so, you can play them without any problems, but still recommended to re-sample your music files into 44100 to keep better performance (real-time re-sampling usually eats more of your CPU time).
  • Experimental communicator: Added shared memory server which giving able to accept file paths to run test of any level file instantly by special call (which was implemented into PGE Editor, I will record video about this feature later)
  • Experimental hardcoded graphics customizing system (graphics.ini can define a name of file in the graphics/common/ folder which can custmize any hardcoded graphics file). I will make more user friendly specification, but now you should know addresses of each file (regular image and it's mask if uses). Read examples in the _ini_examples/ folder!

Imaynotbehere4long
Boomerang Bro
Boomerang Bro
Posts: 1389
Joined: Thu Jan 23, 2014 3:00 pm

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Imaynotbehere4long » Fri Feb 20, 2015 4:46 am

I recently began using this and I noticed that the saw-blades' (npc-179) sound effect (smw-saw) doesn't play properly; instead of ticking consistently, it ticks three times (slightly faster than normal) with a silent pause before the next set of three. Sometimes it only plays twice before the pause, but the three ticks is more common.

--EDIT--

Also, it seems like there's sometimes a delay between event triggers and the sound effect that the respective event plays.

--EDIT 2--
A similar thing happens when climbing ladders: instead of the sound effect playing consistently, it plays twice (slightly faster than normal) with a silent pause before the next pair. I'm pretty sure these problems are all related.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Fri Feb 20, 2015 5:21 am

Imaynotbehere4long wrote:I recently began using this and I noticed that the saw-blades' (npc-179) sound effect (smw-saw) doesn't play properly; instead of ticking consistently, it ticks three times (slightly faster than normal) with a silent pause before the next set of three. Sometimes it only plays twice before the pause, but the three ticks is more common.

--EDIT--

Also, it seems like there's sometimes a delay between event triggers and the sound effect that the respective event plays.

--EDIT 2--
A similar thing happens when climbing ladders: instead of the sound effect playing consistently, it plays twice (slightly faster than normal) with a silent pause before the next pair. I'm pretty sure these problems are all related.
Yea, I know this problem and I do some attempts to fix it. SDL can play looping sounds natively, but SMBX play them with ticking playback by play-play-play-play.... :P and SDL making some delays of sound playing

SilverDeoxys563
Guest

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby SilverDeoxys563 » Sun Feb 22, 2015 4:24 pm

DarkShadeX wrote:Get Audacity then do this:
Spoiler: show
Image
I never noticed that small drop-down box. Thanks!

Exiled Bowser
Tweeter
Tweeter
Posts: 135
Joined: Thu Feb 19, 2015 6:06 pm
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Exiled Bowser » Sun Feb 22, 2015 9:40 pm

I got error Mix_LoadMUS/filename.mp3 Couldn't Open filename.mp3

When trying to use a custom music file fixed to 44100Hz. the file is 11BattleRock.mp3 which is Battle Rock Galaxy from SMG with its intro intact in the file.
In fact, all my files do that now. They are all MP3s.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Sun Feb 22, 2015 9:57 pm

Exiled Bowser wrote:I got error Mix_LoadMUS/filename.mp3 Couldn't Open filename.mp3

When trying to use a custom music file fixed to 44100Hz. the file is 11BattleRock.mp3 which is Battle Rock Galaxy from SMG with its intro intact in the file.
In fact, all my files do that now. They are all MP3s.
Check file name and path first! (to play file via "custom" field file should be placed together with level or you should define path to level: example is "level folder/musicfile.mp3")
If you use the LunaLUA, all music files should be placed in the custom level directory.

Note: your SMBX full path shouldn't have non-ASCII characters

Exiled Bowser
Tweeter
Tweeter
Posts: 135
Joined: Thu Feb 19, 2015 6:06 pm
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Exiled Bowser » Sun Feb 22, 2015 10:01 pm

Ah so no longer in my episode folder? So this broke SMBX's global functions for customs to allow more than one custom per section? My episode will get rather large if I have to copy the file to every level folder that uses each custom music.
Last edited by Exiled Bowser on Sun Feb 22, 2015 10:09 pm, edited 1 time in total.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Sun Feb 22, 2015 10:08 pm

Exiled Bowser wrote:Ah so no longer in my episode folder? So this broke SMBX's global functions for customs to allow more than one custom per section?
- Put musics into episode folder if you will play them by "Custom" music field (to play musics from level custom folder
use relative paths like "folder of my level/another_music_from_level.ogg") [Talkhaus is cool!, each level of A*XT uses this method]
- Put musics into level custom folder if you will play them by LunaLUA calls MusicOpen() and by MusicPlay() . If you wish play musics from episode folder,
use relative paths like "../some_file_from_episode.ogg"

To play more one custom musics in one section I was used LunaLUA:
- SMBX's music should be switched to "none", just SMBX's internal calls will release music stream and we can use it for our purposes
- MusicOpen() will load music file (relative to level custom directory) into stream. MusicPlay() will start playback of music file.

Take the special example "LUA Example - multiple custom musics in one section!" which will show you how it works
Exiled Bowser wrote:My episode will get rather large if I have to copy the file to every level folder that uses each custom music.
How I says, you CAN use LunaLUA with musics from episode folder, but you should use relative paths like "../musicfile.ogg"

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Fri Mar 13, 2015 6:57 am

Repost of my Talkhaus post:
Good news!
I just implemented the new audio API which has 33 API functions to work with sounds and musics!
https://github.com/Wohlhabend-Networks/ ... n.cpp#L235
Later there are will be available in next build, now I documenting a new stuff.
New stuff uses more useful things of SDL Mixer API, including the looped SFXed with ability to control them! Etc.
Also I was implemented the fix of annoy bug with Alt-Tab: It will work, but with new rules:
- Set ANY default music into section with LUA-music
- Add into onLoad() event the Audio.SeizeStream(xxx) (where XXX - is a section ID from 0...20. If you will write -1 - will be seized ALL sections). This function will seize music stream from SMBX engine and we can freely use music stream with LUA. This also fixing a bug: SMBX think than "Music is playing" and sends "pause" and "resume" commands to play/pause music by alt+tab switching.

Also I fixed bug with playing long SFXes after exiting from level: all custom SFXes and LUA Musics will be aborted when level/world will be closed.

Later I can bind more functions of SDL Mixer API:
http://www.libsdl.org/projects/SDL_mixe ... mixer.html

Documentation of new LunaLUA Audio API: http://engine.wohlnet.ru/pgewiki/LunaLu ... _functions
Small tutorial of Audio usage: http://engine.wohlnet.ru/pgewiki/How_To ... and_sounds

Experimental Pre-Release patch: <link has removed because legacy> which contains some bug fixes and new LunaLUA Audio API
(Unpack this archive into SMBX directory after installation of current version of LunaLUA with replacing of files)

P.S. New LUA example: https://drive.google.com/open?id=0B3QNP ... authuser=0
- Random music switcher
- Panned plane flight SFX effect (please re-install patch now, panning functions was implemented today (13 march 2015))

EDIT AT 18 June 2015: Link to legacy patch has been removed. Actual version available here: http://engine.wohlnet.ru/LunaLua/
Last edited by Wohlstand on Thu Jun 18, 2015 3:51 pm, edited 1 time in total.

Imaynotbehere4long
Boomerang Bro
Boomerang Bro
Posts: 1389
Joined: Thu Jan 23, 2014 3:00 pm

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Imaynotbehere4long » Fri Mar 13, 2015 5:28 pm

I'm still having the issue where the saw-blade's and ladder's sound effects (among others) play too quickly, then get delayed before playing again.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Wohlstand » Fri Mar 13, 2015 8:04 pm

Imaynotbehere4long wrote:I'm still having the issue where the saw-blade's and ladder's sound effects (among others) play too quickly, then get delayed before playing again.
I just tested something - reason of than delays are nonuniform framespeed. SMBX play loops by stupid flood of "playSND()" calls, and because frame speed is nonuniform, result you was heard - nonuniform delays between sound loops. The solution is play smart loops with using of SDL Mixer's functions, but implementation of than system will be not easy. I mean the detection of "playSND()"-flood and starting of true loop which will continues while SMBX doing the "playSND()"-flood. SDL can perfectly loop sounds natively, but doing of "playSND()"-flood from nonuniform SMBX's main loop too much wrong delays, therefore this system should be implemented.

This is a little example which takes some ogg file and launching it's looping:

Code: Select all

Time=15
SawSnd = Audio.newMix_Chunk()
play=1
function onLoop()
	Time = Time-1
	if(Time==0)then
		Time=15
		printText(tostring(Time), 10, 10);
	end
	if(play==1)then
		play=0
		Audio.SfxPlayCh(1, SawSnd, -1)
	end
	
end

function onLoad()
	SawSnd = Audio.SfxOpen("yoshi-tongue.ogg")
end
While blinking of text label will be nonuniform, SFX loop will be uniform!

EDIT: After some researched, Rednexala found than size of audio buffer should had lenght less than 1/65 of second (less than SMBX's framerate). Therefore I will add INI-value which will give able to put custom buffer size to fix this stupid bug. BUT on slow PC's may be delays between buffer chunks if size is too small.

Fennor
Buster Beetle
Buster Beetle
Posts: 94
Joined: Sat Apr 25, 2015 12:08 pm

Re: LunaDLL+SDL2_Mixer = Customizable SFX, FLAC,OGG,MOD,IT,

Postby Fennor » Tue Apr 28, 2015 6:01 pm

When I download this, my avira reports "TR/Crypt.XPACK.Gen" within SMBX.exe

What does that do?


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari