Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 182
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: How to play another music with a loop in-game  (Read 926 times)

0 Members and 1 Guest are viewing this topic.

Offline maxman

  • Hero Member
  • *****
  • Posts: 2763
  • I'm a slowpoke in speed.
How to play another music with a loop in-game
« on: April 24, 2012, 04:32:19 am »
I don't know how I'm gonna say this correctly. I'm having a problem with playing one non-loop music and one loop music in between for the gameplay. That one is the one that lagarto did fix and play the songs for the boss fight. The boss song plays first and then another song comes after.

I use the txt and script it with music. But everytime I put them like in anim spawn and anim idle, it sounds like the first music stops after it finishes and then another one. Here's what I'm trying to do for fixing the music. I want to avoid having the first music pause before another one begins.

Code: [Select]
name Blankee
type obstacle
health 1
offscreenkill 3000

anim spawn
@cmd playmusic "data/music/intdark.ogg" 0
delay 634
offset 1 1
frame data/chars/misc/empty.gif

anim idle
@cmd playmusic "data/music/dark.ogg" 1
delay 100
offset 1 1
frame data/chars/misc/empty.gif

anim fall

delay 100
offset 1 1
frame data/chars/misc/empty.gif



Am I doing it wrong?
Dragon Duo (W.I.P./Outdated demo (2010 version)) (in progress)
Captain Commando (in progress)
Unelmia: Dreamers' Fate (collaborating with contress/taskmaster) (in progress)

Best OpenBOR mods:Spoiler
1. World Heroes Supreme Justice
2. Golden Axe Myth
3. Art of Fighting: Beats of Rage Remix III
4. A Tale of Vengeance
5. Valdivia Ransom City (demo)
6. Sega Brawlers Megamix
7. Super Fightin Spirit
8. Angel-0

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: How to play another music with a loop in-game
« Reply #1 on: April 24, 2012, 04:50:42 am »
With .bor format you can set the loop position, but wiht ogg you can't.
So there's not a good solution, plus the timer doesn't synchronize with the music perfectly.

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: How to play another music with a loop in-game
« Reply #2 on: April 24, 2012, 05:13:26 am »
 The idea of lagarto's method is simple. Have SPAWN animation plays the 1st music then IDLE will play the 2nd one.

 I think the problem you have lies here:

Quote
anim spawn
@cmd playmusic "data/music/intdark.ogg" 0
   delay   634
   offset   1 1
   frame   data/chars/misc/empty.gif

 The red text means intdark.ogg will be played for 634 centiseconds or about 6 seconds.
 Question is: is your intdark.ogg length only 6 seconds?

 Also don't set loop to IDLE unless you don't mind the 2nd music replayed every 1 second.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline BeasTie

  • Hero Member
  • *****
  • Posts: 760
Re: How to play another music with a loop in-game
« Reply #3 on: April 24, 2012, 07:26:48 am »
Weird I was just working on a similar thing yesterday. 

You're probably right BloodBane but when I was doing this yesterday the music would not play properly unless there was a frame before it.  When I did it the same as maxman has there the music would stutter (like it kept starting to play it over and over again) until next frame hit.  So I set it like this and works fine now.

Code: [Select]
anim spawn
   loop     0
   offset   1 1
   delay   1
   frame   data/chars/misc/empty.gif
   delay   634
  @cmd playmusic "data/music/intdark.ogg" 0
   frame   data/chars/misc/empty.gif

Offline maxman

  • Hero Member
  • *****
  • Posts: 2763
  • I'm a slowpoke in speed.
Re: How to play another music with a loop in-game
« Reply #4 on: April 24, 2012, 08:31:52 am »
With .bor format you can set the loop position, but wiht ogg you can't.
I wish .ogg could work like .bor does.

....
Yep. I use that first song on loop 0 and the second one on loop 1. That one is easy but the problem is the pause. Yes, I did try on the exact 600 but didn't go to the ending yet so I went with 630 some for some testing.

Quote
Also don't set loop to IDLE unless you don't mind the 2nd music replayed every 1 second.
What do you mean with that? I just "removed" the anims idle and fall and I already put the music in its own stage txt, but I only put anim spawn. When I play it after the intro song finishes, no song is heard.
Dragon Duo (W.I.P./Outdated demo (2010 version)) (in progress)
Captain Commando (in progress)
Unelmia: Dreamers' Fate (collaborating with contress/taskmaster) (in progress)

Best OpenBOR mods:Spoiler
1. World Heroes Supreme Justice
2. Golden Axe Myth
3. Art of Fighting: Beats of Rage Remix III
4. A Tale of Vengeance
5. Valdivia Ransom City (demo)
6. Sega Brawlers Megamix
7. Super Fightin Spirit
8. Angel-0

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: How to play another music with a loop in-game
« Reply #5 on: April 25, 2012, 11:11:56 pm »
 I should've realized that we're in wrong section here.

@Beastie: That's called 1st frame bug. @cmd and other 'frame' commands don't work if declared in 1st frame of SPAWN

@maxman:
Quote
What do you mean with that?

 I mean in IDLE animation there's 1 second delay. If it's looped, the animation will be replayed every 1 second. That also means the playmusic script will be rerun every 1 second too.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: How to play another music with a loop in-game
« Reply #6 on: May 04, 2012, 12:14:47 pm »
Dang, I just realized you can use loop position for ogg. :dunce:
Though the offset means number of samples instead of bytes.


Edit*
For example, if an ogg is 44100Hz/stereo and you want to set the loop position at 12 seconds, then you need to use 44100*12/2=264600
« Last Edit: May 04, 2012, 12:23:40 pm by utunnels »

Offline BeasTie

  • Hero Member
  • *****
  • Posts: 760
Re: How to play another music with a loop in-game
« Reply #7 on: May 04, 2012, 10:11:19 pm »
@BloodBane  - yeah I know it is but you were giving example that would of had frame bug too.

@utunnels - that's good to know, thanks.

Is this really the best way to do this type of thing thou? using entities etc.  Wouldn't it be easier to have something so you can declare what track to play and if no loop set what song plays NEXT.

eg.
@cmd playmusic "data/music/intdark.ogg" 0 next "data/music/intdark2.ogg" 1

The syntax is made up but basically it plays intdark.ogg first and when that finishes it plays intdark2.ogg with loop set.

Offline maxman

  • Hero Member
  • *****
  • Posts: 2763
  • I'm a slowpoke in speed.
Re: How to play another music with a loop in-game
« Reply #8 on: May 04, 2012, 10:51:00 pm »
I wonder if that one in syntax works.
Dragon Duo (W.I.P./Outdated demo (2010 version)) (in progress)
Captain Commando (in progress)
Unelmia: Dreamers' Fate (collaborating with contress/taskmaster) (in progress)

Best OpenBOR mods:Spoiler
1. World Heroes Supreme Justice
2. Golden Axe Myth
3. Art of Fighting: Beats of Rage Remix III
4. A Tale of Vengeance
5. Valdivia Ransom City (demo)
6. Sega Brawlers Megamix
7. Super Fightin Spirit
8. Angel-0

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: How to play another music with a loop in-game
« Reply #9 on: May 04, 2012, 11:25:17 pm »
 @Beastie: I think playing next song should be set by the modders themself instead. That command you suggested is kinda bloat.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline BeasTie

  • Hero Member
  • *****
  • Posts: 760
Re: How to play another music with a loop in-game
« Reply #10 on: May 04, 2012, 11:34:03 pm »
Well what I mean is atm I have intro music that plays when player starts the stage, it is set in his spawn anim as posted above, then in in the levels .txt it spawns an entity to play the stage music.

in the level file -

spawn   lvl_1mus
coords  0 0
at      0

The entity
Code: [Select]
name lvl_1mus
health 1
type none
shadow 0
lifespawn 1

anim spawn
loop 0
delay 800
frame data/chars/misc/empty.gif
@cmd playmusic "data/music/stageloop.ogg" 1
frame data/chars/misc/empty.gif


anim idle
loop 0
delay 10
frame data/chars/misc/empty.gif

So far I'm up to 6 of these entities for different stages just to play the stage loop the intro track is always the same
So what I'm saying is being able to declare mutiple songs/tracks could be of benifit, it was just an idea thou, perhaps theres a better way.

 



 0%




mighty
SimplePortal 2.3.3 © 2008-2010, SimplePortal