[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] starting sound playback at offset



Ah, we could probably have a better way of sharing data.  Maybe
something like a sub surface would be best.

But for now, you can copy the sound data and chop it up yourself.

cheers,


On Fri, May 9, 2008 at 5:28 PM, Brian Fisher <brian@xxxxxxxxxxxxxxxxxxx> wrote:
> although it's probably not a huge thing, the sound constructor doc claims it
> won't share the buffer:
> "Note: The buffer will be copied internally, no data will be shared between
> it and the Sound object."
> if that's correct it means that approach would make copies of the music
>
> But more importantly, how would you get a buffer that points to an offset
> within another buffer?
>
> On Fri, May 9, 2008 at 12:24 AM, René Dudfield <renesd@xxxxxxxxx> wrote:
>>
>> You can get a buffer from Sound objects now.
>> http://pygame.org/docs/ref/mixer.html#Sound.get_buffer
>>
>> Then combined with the constructor... pygame.mixer.Sound(buffer)
>> should do the trick.
>> http://pygame.org/docs/ref/mixer.html#pygame.mixer.Sound
>>
>> cheers,
>>
>> On Fri, May 9, 2008 at 5:20 PM, Brian Fisher <brian@xxxxxxxxxxxxxxxxxxx>
>> wrote:
>> > I didn't mean copying the sound - I meant with SDL could you make a
>> > mixer
>> > chunk that pointed to a portion of some other chunk.
>> >
>> > or are you saying it's easy in pygame to make a sound that points to a
>> > subset of the content of another sound? (like a subsurface...) If so,
>> > how
>> > would you do that?
>> >
>> > On Fri, May 9, 2008 at 12:17 AM, René Dudfield <renesd@xxxxxxxxx> wrote:
>> >>
>> >> yeah, pretty much.
>> >>
>> >> Doing that from python is just as easy though.
>> >>
>> >>
>> >> On Fri, May 9, 2008 at 5:16 PM, Brian Fisher
>> >> <brian@xxxxxxxxxxxxxxxxxxx>
>> >> wrote:
>> >> > From looking at SDL_mixer it's hard to tell if it would even support
>> >> > playing
>> >> > from an offset... Would adding support for playing from an offset in
>> >> > pygame
>> >> > just be a matter of manually making a new chunk object that would
>> >> > point
>> >> > to a
>> >> > place within the original chunk for the sample?
>> >> >
>> >> >
>> >> > On Fri, May 9, 2008 at 12:09 AM, René Dudfield <renesd@xxxxxxxxx>
>> >> > wrote:
>> >> >>
>> >> >> yeah, you'll have to chop up the Sound samples yourself for that...
>> >> >> which shouldn't be too hard.
>> >> >>
>> >> >> cheers,
>> >> >
>> >> >
>> >
>> >
>
>