Trouble integrating with ofSoundplayer raspberry pi, song player example.
Closed this issue · 5 comments
Hi, I have trouble integrating this addon with ofSoundplayer on Raspberry pi, I did not test all cases, but when I am using a grain cloud. I cannot load any samples with sound player once grain cloud is loaded. I looked at the song player example, as I can initialize a sound stream engine once for all ofxPDSP objects and I am guessing this is the issue, that on the pi each object wants to take control of the audio hardware. So far so good, when I look at the pattern you created in the song_player example it is reasonable simple. but for this task I need to know where I am playing at any current time with from an audio file player like in song_player_example. I exposed the sampler1.meter_position();
from the AudioPlayer class that you made for the example but I only get 0 back when I call that method. Is this the correct approach? Is there something wrong with this method that it returns 0 all the time? If this compatibility between ofSoundPlayer and ofxPDSP (on Raspberry pi) is not just a mistake I am making it would be great to be able to use ofxPDSP as a drop in replacement, so have a way to replicate all the methods would be amazing.
Anyway, it would be great to know at which points I am messing up or encountering an actual error. Cheers
it's normal that pdsp won't work with the ofSoundPlayer, as both of them need access to the same audio device id and i most of the time it's not possible (maybe it could be possible if you were using JACK instead of ALSA on the rpi).
sampler1.meter_position();
should return you a float value in the 0.0f - 1.0f range representing the position inside the audio buffer length, in the AudioPlayer sampler1
is used only if you are using a stereo sample, otherwise just sampler0
is used, so it's better to get the position with sampler0.meter_position();
Ok, that was easy. I have added most of the methods I need for ofSoundplayer substitution, the only things I want to add would require a callback when from the pdsp::Sampler
classs when a sample is finished playing (this allows for setting looping modes and checking if the sample is finished).
Ok, that was easy. I have added most of the methods I need for ofSoundplayer substitution, the only things I want to add would require a callback when from the pdsp::Sampler
classs when a sample is finished playing (this allows for setting looping modes and checking if the sample is finished).
at the moment pdsp::Sampler
doesn't have looping modes, but probably i should add them as they are a standard sampler feature.
If you want to loop a sample with the right timing maybe it's better to trigger it from the sequencer, using the right tempo, instead of using a callback for the AudioPlayer.
Anyway, let me know if i can consider this issue closed.