[Vm-dev] MPEG3Plugin code appears broken when generated?

tim Rowledge tim at rowledge.org
Sun Dec 13 22:57:05 UTC 2020


Hmph. So I see that the mpeg3plugin actually got slang-updated a couple of weeks back and actually fixed this issue, but the plugin C code hasn't been regenerated in 3+ months. 

Sure, *I* can generate the stuff, I can probably remember how to use it anyway, but it could cause confusion for anyone less steeped in the lore. And please don't anyone suggest I try to make this git stuff do anything.

> On 2020-12-12, at 10:02 PM, tim Rowledge <tim at rowledge.org> wrote:
> 
> 
> OK, I woke up with a start and an idea. Changing to 'WordArray' and recompiling... made mp3 files play.
> 
> I wonder if there are any other places needing changing. Tomorrow...
> 
>> On 2020-12-12, at 6:07 PM, tim Rowledge <tim at rowledge.org> wrote:
>> 
>> 
>> Is anybody else doing anything with MP3 files? It looks like we haven't included any image-side support for them for several releases now (I've look back to 4.5) but it is/was working just fine for the work I did on Pi Scratch. That was, admittedly, quite a while ago.
>> 
>> In the current system I can load much of Scratch without too many issues - sounds are really messed up in various places, some morph building is broken etc - but today I'm trying to see why mp3 sounds don't.
>> 
>> It seems that the code for the src/plugins/Mpeg3Plugin.c is broken. The autogenerated checks for the types of the arguments is insisting that be indexable pointers, when is is in fact a variable word array. That at least explains why the prim fails, which is at least a step forward.
>> 
>> Current code on opensmalltalk git - 
>> 
>> /*	int mpeg3_read_audio(mpeg3_t *file, 
>> 	float *output_f, 
>> 	short *output_i, 
>> 	int channel, 
>> 	long samples,
>> 	int stream) */
>> 
>> 	/* Mpeg3Plugin>>#primitiveMPEG3ReadAudio:shortArray:channel:samples:stream: */
>> EXPORT(sqInt)
>> primitiveMPEG3ReadAudio(void)
>> {
>> 	sqInt aChannelNumber;
>> 	sqInt aNumber;
>> 	sqInt *anArray;
>> 	short *arrayBase;
>> 	sqInt aSampleNumber;
>> 	mpeg3_t *file;
>> 	sqInt fileHandle;
>> 	sqInt result;
>> 
>> 	result = 0;
>> 	if (!(((isPointers(stackValue(3)))
>> 		 && (isIndexable(stackValue(3))))
>> 		 && ((isIntegerObject((aChannelNumber = stackValue(2))))
>> 		 && ((isIntegerObject((aSampleNumber = stackValue(1))))
>> 		 && (isIntegerObject((aNumber = stackValue(0)))))))) {
>> 		primitiveFailFor(PrimErrBadArgument);
>> 		return null;
>> 	}
>> 
>> The two interesting things I have remaining energy to point out today -
>> The Slang does explicitly and wrongly declare it as 
>> 
>> self primitive: 'primitiveMPEG3ReadAudio' parameters: #(Oop Array SmallInteger SmallInteger SmallInteger).
>> 
>> .. which clearly doesn't help. It has, however, been that way since 2006.
>> 
>> And the old C file from Back Then has 
>> 
>> 	result = 0;
>> 	fileHandle = stackValue(4);
>> 	success(isIndexable(stackValue(3)));
>> 	anArray = ((sqInt *) (firstIndexableField(stackValue(3))));
>> 	aChannelNumber = stackIntegerValue(2);
>> 	aSampleNumber = stackIntegerValue(1);
>> 	aNumber = stackIntegerValue(0);
>> 	if (failed()) {
>> 		return null;
>> 	}
>> .. and so it makes kinda sense why it worked Back Then.
>> 
>> Thus I am inclined (and not just because I'm falling asleep) to think that some change in how the prologue stuff is generated might have started to note the Array declaration and become more zealous.
>> 
>> More when awake.
>> 
>> tim
>> --
>> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>> Strange OpCodes: STOP: No Op
>> 
>> 
>> 
> 
> 
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Strange OpCodes: POI: Power Off Intermittently
> 
> 
> 


tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
State-of-the-art: What we could do with enough money.




More information about the Vm-dev mailing list