"Aborting aboutToFinish handling." warning with PySide Phonon module - pyqt

I'm allowing my workout-clock program to play sounds via the use of the phonon module. For each audio file in my program I create a device (createPlayer) and then use the play() method on it.
This works absolutely fine except for the fact that playing the sounds repeatedly somehow breaks the player. Sometimes the app works fine throughout an entire program, but sometimes the 'tic' sound of the clock gets disabled.
Every time I run the app, the second time any sound is played, I get the warning Aborting aboutToFinish handling. I think this is related.
Any suggestions?

Related

Issues with playing audio over voice channel; audio is truncated and each file is progressively more delayed

The end goal: I'm creating a discord bot built for Final Fantasy XIV raiding. You simply tell the bot when you pull the boss and it follows a pre-defined timeline that warns everyone of each mechanic shortly before it happens. In short: It plays a pre-defined list of audio files at pre-defined times after receiving a !start command.
The good news is that the audio is playing.
The bad news is...complicated.
There are two issues and I have a feeling they're related. The first issue is that, no matter what audio file I play, the last bit (about 0.5s) gets cut off. I gave it an audio file that says "Tank buster soon" and it played "Tank buster s-" then cut out. Up until now, I've been working around this by simply adding one second of silence on the end of every sound file. It's been working. It's still getting truncated, of course, it's just that it's truncating silence.
The second issue is that, after playing one audio file, the next audio file has a short delay between when the bot tries to start playing it, and when the audio actually comes out. (In discord, I can see this as the bot cueing up their "mic" a short time before it starts playing audio.) This delay gets progressively worse with every file played, to the point where it's literally several seconds delayed. (When the delay is severe enough, I see the bot cue up for about a second, un-cue, and then re-cue when the delay finally finishes)
The code doing most of the work is as follows:
//timeline() is called once per second by a setInterval() object, while the fight is active.
function timeline()
{
tick++;
var len = callouts.length;
for (var i = 0; i < len; i++)
{
if (tick == callouts[i]["time"])
{
dispatcher[dispatcherIndex] = voiceConnection.playFile(callouts[i]["file"]);
dispatcherIndex++;
activeChannel.send(callouts[i]["message"]);
}
}
} //end timeline()
Discord.js documentation mentions that it prefers node-opus to be used for voice functionality, but that opusscript will also work. I cannot seem to install the former, so I am using the latter.
EDIT: I've found a workaround for now. The progressive delay is "reset" when the bot leaves and rejoins voice, so I've simply made it do so when it finishes playing an audio file. Strictly speaking, it works, but I'd still like a "proper" solution if possible.
Installing git (why the heck have I not installed git long ago?) ultimately turned out to be the correct catalyst. That, as mentioned, let me install discord.js master branch, which handles voice better. After a couple ffmpeg-related hiccups, I now have the bot playing complete audio files with no delay, with no workarounds required. Everything's working great now!

Music replay does not work on Libgdx

I have a sound track for my game, which I play when player enters a level, and stop when the level ended.
Sound track is a Music class with looping set to true, and loaded through an AssetManager.
It works fine for the first level, I can hear the music, and when the level ends, I call stop. On the start of the second level, I cal start again, but I cannot hear any music. There is no error or exception either.
From the documentation, I thought I can user the same Music class instance, so theoretically it should work AFAIK.
Any idea why it doesn't work?

J2ME Manager.CreatePlayer() freeze application for a split second when using the first time

When I call for the first time to Manager.CreatePlayer() its freezes my application for a split second and it's a problem for me because I'm writing a game and it's noticeable, what can I do to fix it ?
As far as I know, the common logics for game are :
Display loading screen
Here's all heavy operations are prepared/preloaded and cached, so the game can run smoothly later.
Methods that usually called here are Manager.createPlayer and Player.prefetch().
All the image & sound is prepared first, and can be used quickly when game started.
Start the game (loop)
As the resource have been prepared/preloaded, now you can use (draw/play) them here.
Use the Player instances that has been created & prefetched (from loading screen).
You can call Player.start() method here to play the sound.
You can read about the Player state (especially about prefetch) HERE.
Notice that you can reuse the Player instance and call start() method multiple times for playing the same sound. No need to call createPlayer again.

libspotify: music_delivery callback not firing

I've successfully loaded a Spotify track from a playlist (verified by tracing the track name out to the screen), passed it to be played using sp_session_player_load and sp_session_player_play(sess, 1).
However my music_delivery callback is never called (I've have some trace in there to show when it is). The libspotify FAQ seems to imply that it will be invoked by an internal thread inside the API and I do not need to invoke sp_session_process_events to start the streaming.
My application is singly threaded so I'm assuming there is no locking issue in my code.
Sources:
libspotify Haskell binding:
https://github.com/mrehayden1/libspotify
(You will need libspotify installed to get this to compile: https://developer.spotify.com/technologies/libspotify/#download)
The application code:
https://github.com/mrehayden1/harmony
A few ideas:
I do not need to invoke sp_session_process_events to start the streaming.
This is somewhat correct, however, you must trigger sp_session_process_events when you get a notify_main_thread callback — this comes in on another thread, so you need to correctly delegate this back to your main thread to make the call.
Since you mention you only have a single thread, make sure you're not spinning in a tight loop somewhere — something like while (!sp_track_is_loaded(track)) {} — since a lot of work in libspotify goes on in the thread you make the calls on, doing this will cause libspotify to be unable to do any work, and everything will grind to a halt.
passed it to be played using sp_session_player_load and sp_session_player_play(sess, 1).
What are the results of these calls? Loading metadata isn't the same as loading for playback, so you might be getting SP_ERROR_IS_LOADING back from the play call. In addition, the track might not be playable for some other reason, so the error is important.
If you're still having trouble, the problem may be in the bindings or elsewhere in your code. Check the jukebox example that comes with libspotify for an example C implementation of playback.

montouch detect when sound finished playing

In objective C is a method called AudioServicesAddSystemSoundCompletion which allows to add a handler for "audio done notification".
So I add the handler call AudioServicesPlaySystemSound and when the sound finished I'll get a notification.
monotouch has MonoTouch.AudioToolbox.SystemSound.PlaySystemSound to play such a sound.
But how do I know when the playing finished?
Situiation: I have a class which get's some information. When this information indicates an error I play a sound. If I'm already palying a sound I should do nothing.
And depending on a setting ("repeat alert") I should play the sound again the replay finished and the alert is still valid.
Sounds not so complicated - but without knowing when the sound finished playing I have a problem. So I can neither detect that I already play - nor can I repeat if needed.
This isn't bound in MonoTouch yet, you should file an enhancement request at http://monotouch.net/Support so we can expose it properly.

Resources