I am trying to get the current playback time of the background music (since i want to synchronize game events with this sound track)
Would anyone happen to know how to achieve this?
I've found that for normal cocos2d it would be something as seen on this question:
How to play a BGM and know current playback time on in cocos2d ios?
And a possible solution for cocos2dx that I found:
What I have been doing so far is saving the clock time immediately
after starting playing the music, and then on each update I get the
current clock time and compare it to the saved clock time when the
music was started, giving me the time since the music was started.
As seen on this post: http://discuss.cocos2d-x.org/t/audio-syncing-simpleaudioengine-buffer-position/8488
But he mentions that it eventually gets out of synch (the longer the music plays)
Thanks.
Related
I'm using WASAPI to capture and render audio for a VoIP application on Windows Phone 8. The app works fine when using the earpiece, but as soon as I switch to speakerphone, a distinct clicking noise appears on the far end. Looking into the timing of my system, I found that after I switched endpoints to speakerphone the mic hardware timer starts to act weird.
My audio loop starts with a WaitForMultipleObjectsEx which is woken up every 10ms by the mic capture event. After switching audio endpoints, I find this this event fires 101 times in 1 second, instead of 100. Every second, the last capture of 480 frames is split into 2 captures, whose timings add up to 10ms. This confuses me to no end, and is causing problems in my audio system.
Does anyone know what is going on, or can someone point me in the right direction?
MSFT is officially looking into a bug in WASAPI caused by multiple endpoint switches. It is confirmed on RT and being investigated for Wp8. Just an update.
I was wondering if it's possible to have a music player that will always play music even that the user is not on the site.. Kinda like streaming...
I am using jwPlayer but every time I enter the site my playlist starts from the beginning but I want her to keep playing even if I'm not there..
if there is anyway to do that please tell me..
Thanks in advance
You would need to have a virtual state that the server keeps track of. You would not really be streaming if you don't have a target device to stream to... so the server just needs to keep track of everything then continue streaming at the location you expect when the person reconnects to the server by whatever device they are using.
For a flash game i'm working on i would like to know if there is anything that can be done to stop players that pause the game by pausing the browser process as shown in this youtube video?
I'm already looking in to all the other great suggestions to avoid or at least slow down cheat engine hackers at : What is the best way to stop people hacking the PHP-based highscore table of a Flash game. But couldn't find anything on pausing processes.
Pausing a process is detectable by using (new Date()).getTime() repeatedly with short intervals. If, say, the difference between the dates exceeds several seconds, and you are querying this statement once per 30 frames, then either your framerate stalls or the process has been paused.
I'm currently working on a dynamic MP3 player in AS3. The player will also support continuous (in length) radio streams.
Because my player will include a 'seek' bar, I allow the user to seek through the Sound object's data. Now I know that with a continuous stream, data being stored on the users RAM will never stop, as downloading will never stop on a continuous stream. This means, after a few hours of streaming, allot of RAM is being used by my app. I've tested the app on my own machine, running a very high spec, and the app crashes in my browser. When i say the app crashes, I mean the whole of Flash, meaning I have to restart my browser in order to use Flash again. I know my app is the cause as Flash has never crashed in the past. It only does it when my app has been streaming for 2+ hours.
So what I want to do is only allow the user to cache up to an hours worth of audio. After an hour, I want to clear the first half of the sound objects data, meaning that only the most recent half hours audio is stored and available for seeking.
So I have my stream:
var soundObj:Sound = new Sound();
soundObj.load(new URLRequest('stream.mp3'));
//ect ect
and sound is where the data is stored. So my question: How would I clear the first 30 mins of audio from that object?
Perhaps the Sound class is not meant to reliably play "unlimited" MP3 files, which seems to be your case. It is made to play normal MP3 "songs". Two hours of MP3 sound can easily accumulate to be larger than 200 megabytes of data.
But there is a good solution - use NetConnection and NetStream classes to stream audio instead. There are many tutorials out there. You will also be able to stream your MP3s, just a bit differently - a central server will be involved, which will transcode these MP3s on the fly, delivering it to you in a true "streaming" manner. One of such servers is Adobe Flash Media Server, an overpriced piece of work from Adobe. A lot of free and open-source alternatives exist which will work fine for your purposes - Red5, nginx-rtmp to name a few, that I have tested myself.
I'm the developer of ShellShock Live, a free online artillery game:
http://www.newgrounds.com/portal/view/564049
Everything has been running smoothly, but every once in a while for a period of 4 hours or so, hundreds of "VerifyError: Error #1026" will show up in my error log. Then, they will stop.
I looked into VerifyError and found that "The VerifyError class represents an error that occurs when a malformed or corrupted SWF file is encountered." The SWF on Newgrounds is just small loader SWF that loads the full game SWF from another site, so there must be a problem there. I'm stumped, because the game will run fine for days, and then just start getting these errors out of the blue, after no changes to either SWF.
ShellShock has hundreds of players online at any given moment, so I would like to fix this ASAP. Any help would be appreciated! Thank you!
I know the original post is a couple of years old but since I've just spent many days trying to work around a similar issue, and since this thread does not contain what I believe is the correct explanation I'll post the conclusions of my own investigation here, for anyone else to use:
The VerifyError events are almost certainly being logged because the loader SWF on NewGrounds targets a lower Flash Player version than that of the game SWF that causes this error.
The Flash Player on the user's system will accept the NewGrounds SWF loader because it targets a version equal to or lower than the version installed. After that, an external SWF that targets a higher Flash Player version can be loaded without any complaint from the Flash Player, unless it tries to access unavailable features in that Flash Player, and then it will throw the VerifyError.
The sporadic nature of this problem, in 4-hour surges, is likely related to the different penetration of later Flash Player versions in different parts of the world (and hence different time zones). During very active periods of casual gaming (weekends and evenings?) in countries with low penetration of recent Flash Player versions you will likely see batches of these VerifyErrors logged.
The bad news is that after many days of trying to find a workaround for this very problem we have been unable to find any way to catch the VerifyError. It does not even get caught by an UncaughtErrorEvent handler!
The only thing I can suggest that might help in your case (not mine, unfortunately) is to determine the target version of the NewGrounds loader SWF (check the 4th byte in the SWF) then do one of the following :
Compile your game to target the same version of Flash Player as the loader targets. That way you can be sure that if the NewGrounds loader SWF is successfully loaded into the user's Flash Player your SWF will also work in that version without problem, or
In the initialization code of your game, check the Capabilities.version to determine the Flash Player version installed on the user's system and use that to branch control so that advanced Flash Player features are only used in appropriate Flash Player versions.
In my case I have access to the loader code, but not the code of the thousands of SWFs it loads. Since the external SWFs are stenciled into copies of the loader SWF as ByteArrays I can check the SWF's Flash Player target version byte (byteArray[3]), and compare it to the installed Flash Player 'major.minor' version obtain from Capabilities.version, but since SWF Flash Player target version bytes are (currently) incremented with every minor version increment of the Flash Player, it is impossible to map the SWF target byte (byteArray[3]) to future Flash Player 'major.minor' versions, until we know what the maximum minor version number of the current Flash Player will be.
Hope anyone else encountering this will have better luck than we did.
I think it may be a flash player error, try disabling any graphics acceleration or caching. It may be helpful to figure our what graphic card they are using.
Have you made changes to your socket server? Are you using like smarfoxserver?
I had this error in a very small project with cs3 flash9. So I was able to track this error down.
NOTE: this error is emitted incorrectly. The reason the error was emitted in my project was NOT because of a faulty swf because I do not import any swf into my project.
REASON:
I had a code line written like this:
_mc.my_counter && _mc.my_counter--;
SOLUTION:
I changed the line to this:
if(_mc.my_counter) _mc.my_counter--;
... and the verify error message was gone as fast as it appeared. Looks like this is a real as3 bug.