Supercollider dev question
Tony Hardie-Bick
EMAIL HIDDEN
Thu Oct 27 13:31:01 CEST 2011
LOL. I must go get a bow tie... for that eccentric consultant's look.
No. Maybe not.
Tony (HB)
"Marc Nostromo [M-.-n]" <marc.nostromo at gmail.com> wrote:
>Template specialisation. I never know really how to write them.
>
>For example, I'm writing the template class for fixed point that works
>like
>
>typedef FixedFP<int32,28> sample_t ;
>
>where the first argument is the 'container type' (how we're going to
>store
>the fixed point) and the second is the number of bits used for the
>fractional part
>
>When you do a multiply, you need a 'temporary' container that is twice
>the
>number of bits from the original container so that if it is int32 it
>uses
>int64 if it is int8 uses int16 and so on.
>
>There are several ways of doing: on is to re-implement the operator*
>for
>each supported type with the typename explicitely stated or to have a
>mechanism that for one type, gives you the type of the 'expanded
>containter'
>type. Both need template specialisation which is fine in theory but,
>since
>i'm not 100% template HxC, I can't type it right the first time and
>need
>countless iteration before the compiler accepts it :(
>
>At least, now that's sorted, I got my basic class working. I'll need to
>polish it a bit and add support for operations between FP with variable
>fractional parts but it's not really though. Then in a few years, I can
>get
>Tony to fiddle with multiply dithering.
>
>Now to change every reference of sample_t in my framework and pray it
>still
>works :)
>
>/M
>PS: There's a (overly) extensive description of a FP class here
>http://www.codeproject.com/KB/cpp/fp_math.aspx for any one that is
>willing
>to scratch it's head very deeply
>
>
>"Thanks" to you I'm going for a template based mechanism.
>>>
>>> Boy I HATE c++ template syntax :)
>>>
>>
>>
>> - Peter
>>
>>
>> _______________________________________________
>> music-bar mailing list
>> music-bar at lists.music-bar.org
>> http://lists.music-bar.org/cgi-bin/mailman/listinfo/music-bar
>>
>>
>
>
>--
>http://nostromo.noisepages.com
>_______________________________________________
>music-bar mailing list
>music-bar at lists.music-bar.org
>http://lists.music-bar.org/cgi-bin/mailman/listinfo/music-bar
More information about the music-bar
mailing list