Re: Serialising an 8x8x8 array of pygame sounds

2016-09-18 Thread Peter Otten
kerbingamer376 wrote:

> On Sunday, September 18, 2016 at 2:59:10 PM UTC+1, Steve D'Aprano wrote:
>> On Sun, 18 Sep 2016 11:20 pm, kerbingamer376 wrote:
>> 
>> > Is it possible to serialise an 8x8x8 array of pygame.mixer.Sound
>> > objects, so they stay at the same places in the array, but in a format
>> > that can be pickled, and then the opposite (read from that back to
>> > pygame.mixer.Sound objects)?
>> 
>> Can you seralise *one* Sound object?
>> 
>> If not, then you can't serialise an array of Sound objects either.
>> 
>> 
>> 
>> --
>> Steve
>> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
>> enough, things got worse.
> 
> That's my problem, the Sound object can't be picked, I was wondering if a
> way existed to convert said object to a serialize-able format.

If the Sound object exposes enough of its state to build an equivalent one 
from that state there's a way to write and register your own serialization 
routine. See

https://docs.python.org/2/library/copy_reg.html

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Serialising an 8x8x8 array of pygame sounds

2016-09-18 Thread kerbingamer376
On Sunday, September 18, 2016 at 2:59:10 PM UTC+1, Steve D'Aprano wrote:
> On Sun, 18 Sep 2016 11:20 pm, kerbingamer376 wrote:
> 
> > Is it possible to serialise an 8x8x8 array of pygame.mixer.Sound objects,
> > so they stay at the same places in the array, but in a format that can be
> > pickled, and then the opposite (read from that back to pygame.mixer.Sound
> > objects)?
> 
> Can you seralise *one* Sound object?
> 
> If not, then you can't serialise an array of Sound objects either.
> 
> 
> 
> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

That's my problem, the Sound object can't be picked, I was wondering if a way 
existed to convert said object to a serialize-able format.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Serialising an 8x8x8 array of pygame sounds

2016-09-18 Thread Steve D'Aprano
On Sun, 18 Sep 2016 11:20 pm, kerbingamer376 wrote:

> Is it possible to serialise an 8x8x8 array of pygame.mixer.Sound objects,
> so they stay at the same places in the array, but in a format that can be
> pickled, and then the opposite (read from that back to pygame.mixer.Sound
> objects)?

Can you seralise *one* Sound object?

If not, then you can't serialise an array of Sound objects either.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list