Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MemSound has a deficiency :)
#5
(04-25-2023, 08:35 AM)a740g Wrote: It is actually super easy to expose 24-bit audio data using _MEMSOUND, but we'll need to come up with a solution on how to expose this correctly. Probably we could just return 11000 or 0x18 in the TYPE member and 3, 6... for the ELEMENTSIZE (depending on the channels).

I'm not against the idea, but I could see it breaking some existing code. The catch is that right now the documentation implies that all the .TYPE bitflags for size are exclusive, so you're free to assume that if one of them is set then the other ones are not. That's further backed up by the note on that page basically saying we won't do what you're suggesting:

Quote:If a future integer, float or other type doesn't have a size that is 1,2,4,8,16,32,64,128 or 256 it won't have a size-bit set.

For me, that tells me I could use an `AND` to easily check for the size, such as `.TYPE AND &h08` to check for an 8-byte size (4th bit set), which is a nice way to do it if all the other information is irrelevant to me. The issue is that the check still passes if you introduce a 24-bit type with two bits set in .TYPE, that code would think it's the correct size when it's actually not. This can be fixed by changing the code to `(.TYPE AND &h3F) = &H08` so that it checks all the bit-size bits, but that doesn't help any existing code.

I suppose the other weird aspect is that the .TYPE flags are supposed to indicate a type that actually exists in QB64, or a flag indicating it's a UDT or etc. A 24-bit integer doesn't really fit into that, this doesn't matter much to me but I could see it being a bit confusing. It's only necessary to set it to 24-bits because you have to use it together with .ELEMENTSIZE to differentiate between mono and stereo, so perhaps it'd be simpler to just introduce a new `_SND` command to get the number of channels (I feel like we talked about this before Big Grin I don't remember the outcome though) - then we could leave the .TYPE size bits blank for 24-bit and .ELEMENTSIZE would be used along with the channel count.

In practice I mostly see people just doing a straight `=` comparison with a specific `.TYPE` value, and when you do that it doesn't matter, so that's why I'm not super bothered by it if we do want to just use two bit flags.
Reply


Messages In This Thread
MemSound has a deficiency :) - by Petr - 04-24-2023, 06:37 PM
RE: MemSound has a deficiency :) - by a740g - 04-25-2023, 08:35 AM
RE: MemSound has a deficiency :) - by RhoSigma - 04-25-2023, 12:09 PM
RE: MemSound has a deficiency :) - by DSMan195276 - 04-25-2023, 01:40 PM
RE: MemSound has a deficiency :) - by mnrvovrfc - 04-25-2023, 09:17 AM
RE: MemSound has a deficiency :) - by SMcNeill - 04-25-2023, 04:16 PM
RE: MemSound has a deficiency :) - by DSMan195276 - 04-25-2023, 06:09 PM
RE: MemSound has a deficiency :) - by SMcNeill - 04-25-2023, 06:42 PM
RE: MemSound has a deficiency :) - by mnrvovrfc - 04-26-2023, 02:51 AM
RE: MemSound has a deficiency :) - by a740g - 04-25-2023, 08:58 PM



Users browsing this thread: 2 Guest(s)