Sujet : Re: [programming in c] bitmap gramophone
De : fir (at) *nospam* grunge.pl (fir)
Groupes : comp.lang.cDate : 02. Apr 2024, 17:48:54
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <uuhcs7$3rmbc$1@i2pn2.org>
References : 1 2 3 4
User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
Spiros Bousbouras wrote:
On Tue, 02 Apr 2024 14:29:17 +0200
fir <fir@grunge.pl> wrote:
fir wrote:
fir wrote:
>
than i run the playback just from teh screen data
so i can play bitmap data like sorta of bitmap
gramophone (hovever playing bitmaps genarally makes
mostly if not ony some buzzes not much interesting)
>
i mean normal graphical bitmaps sound like buzzes
whan those that are generated from loaded vaw - it is those
who are mess soound like music
>
so regular imeges give buzes but mess images give music
>
>
some things showed imo
>
1) the vaves seem to be 16 bit signed, so drawing it as a bitmap
not fully works cos -min and +max have nearly the same color on screen
(0x8000 is lowest 0x7fff is max)where 0 sound and -1 sound have quite
different colors 0x0000 and 0xffff) - but at least it seems i generati
it right (?)
>
unsigned short val=amplitude*127*256*sin(t);
>
i rewritten the code
>
void buffer_add_sinwave(int len, float amplitude, float hz)
{
for(int i=wave_pos; i<wave_pos+len; i++)
{
if(i>big_ofscreen_buffer_size_x*big_ofscreen_buffer_size_y)
continue;
>
Shouldn't this be break ? When
i>big_ofscreen_buffer_size_x*big_ofscreen_buffer_size_y , it will remain
true for all the other values of i in the loop.
>
>
float cycle = 22050.0/hz;
float t = 2*M_PI*fmod(i,cycle)/cycle;
unsigned short val=amplitude*127*256*sin(t);
big_ofscreen_buffer[i] = val;
}
wave_pos+=len;
return;
}
>
Are big_ofscreen_buffer , big_ofscreen_buffer_size_x , big_ofscreen_buffer_size_y
global variables ?
>
yes, what people call it, (coz it is not global but module scope (exe/dll) in fact)
thsi name is bad should be offscreen buffer but when i code various experiments i dont care for names to much (than in normal 'design' code)