Re: stop a sound file after playing once?
Re: stop a sound file after playing once?
- Subject: Re: stop a sound file after playing once?
- From: Aran Mulholland <email@hidden>
- Date: Fri, 22 Jul 2011 07:18:34 +1000
>From what I understand you are copying samples into a buffer from
memory. You obviously know which samples you are copying (because you
are copying them), so what would stop you, once you have copied all
the samples for a "one-shot", simply not copying any more? Once you
have played through all the samples in your sound file fill the buffer
with 0's instead of copying samples from the start of it again.
On Fri, Jul 22, 2011 at 4:08 AM, Bob Sabiston <email@hidden> wrote:
>>
>> what is the deal with core audio man. i have laboriously gone through the Tim Bolstad tutorial, then merged that with Apple's MixerHost sample code, and now I can play synthy sound-FX and play music in the background made from a looping guitar sound and beat track.
>>
>> That is great, but what I really want to do is replace AudioServicesPlaySystemSound.
>> Those calls seem subject to the whim of the mute switch whereas the AUGraph stuff does not, or maybe is set differently?
>>
>> So how would I do that? I feel like I know how to load the sound files into nodes but how do you restrict the playback to just once? Do you have to, or can you, keep track of what sample it is playing and then stop the bus when it hits the end?
>>
>> It is surprising that Apple's audio is so complex and incoherent when the rest seems so polished these days.
>>
>> Thanks
>> Bob
>
>
> So I got my sound file to play, but it loops incessantly just like the samples in the mixerHost example. I tried turning off the bus when it hit the last sample in the render callback, but for some reason that stops all the buses from playing. I thought I would turn on and off the bus and reset the sample for the bus to 0 every time I wanted to play my effect.
>
> Is the problem that I can't call a function like that from within a render loop? Am I way off base, just missing some obvious thing like setting the bus to "play once" mode? I don't see anything like that but the documentation is not simple enough for me.
>
> Thanks
> Bob
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden