on 20-04-2012 02:55 AM
Is it possible to play an intro mp3 seamlessly followed by a loop mp3 for the rest of the song?
on 26-04-2012 04:00 PM
Hi sam_p2xl
If have 2 mp3 files then this is easily done. You can simply instantiate 2 Bgm objects which each link to their own BGMPlayer objects. Here's how to create one of them.
Bgm intro = new Bgm("/Application/intro.mp3");
BgmPlayer intro_player = intro.CreatePlayer();
intro_player.Play();As part of your update loop you can watch the Status attribute (which is a BgmStatus enumerator) and when it reports that it's stopped you can then start to play the other audio file.
if(intro_player.Status == BgmStatus.Stopped)
{
// Assume looped_audio has already been instantiated
looped_audio.Play()
}BgmPlayer also has a boolean attribute which you can set to true to make it loop continiously.
If you have any further questions please let us know ![]()
James
29-04-2012 03:48 AM - edited 29-04-2012 03:54 AM
I was trying to do something along these lines, but for some reason, it won't ever accept my second file as being present. It's not the content/"copy to output" issue, I made sure of that. In fact, setting the intro and loop players to use the same mp3 resulted in one loading fine and one failing.
private static BgmPlayer bgmPlayer;
private static BgmPlayer bgmPlayer2;
private static Bgm loop;
private static Bgm intro
try{
intro = new Bgm("/Application/sounds/intro.mp3");
//loop = new Bgm("/Application/sounds/loop.mp3");
loop = new Bgm("/Application/sounds/intro.mp3");
Console.WriteLine("Loading intro"); Console.Out.Flush();
bgmPlayer = intro.CreatePlayer();
bgmPlayer.Loop = false;
Console.WriteLine("Intro loaded"); Console.Out.Flush();
Console.WriteLine("Loading loop"); Console.Out.Flush();
bgmPlayer2 = loop.CreatePlayer();
bgmPlayer2.Loop = true;
Console.WriteLine("Loop loaded"); Console.Out.Flush();
Output:
Loading intro
Intro loaded
Loading loop
at Sce.Pss.Core.Error.ThrowNativeException (Int32 error) [0x00000] in <filename unknown>:0
at Sce.Pss.Core.Audio.Bgm.CreatePlayer () [0x00000] in <filename unknown>:0
at Sample.AppMain.Initialize () [0x00000] in <filename unknown>:0
It's the same if I use the intro.mp3 line of the loop.mp3 line. Reversing the order of the bgmPlayer creation causes the other to fail; always the second one. Now if I do a bgmPlayer.Dispose() before instantiating bgmPlayer2, there's no error.
I've got this feeling that there might be some underlying native structure that keeps two bgmPlayers from being instantiated? Or am I missing something obvious here?
on 04-05-2012 04:26 PM
PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.
フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと
PSM DevPortalを一度ログアウトし、再度ログインしてください。


Website ©2013 Sony Computer Entertainment Europe
All content, game titles, trade names and/or trade dress, trademarks, artwork and associated imagery are trademarks and/or copyright material of their respective owners. All rights reserved. [more info]
%%http://community.eu.playstation.com/t5/Announcements/Beta-Trial-Information/td-p/11386362
best_shooter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_driver.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_performer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_footballer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_fighter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_creator.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_action_player.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
dev2.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Producer-and-Developer-Ranks/td-p/18407352
trophy.gif%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/The-Community-Awards-FAQ/td-p/18407096
PSlogoSM.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Online-Support-Coordinator-rank/td-p/18414870