Hi all, Hi everyone, I fought with the impressive code of Russell Hayward and John Findlay demonstrating the use of Direct Sound in GFA-Basic. Based largely on Microsoft's C examples for DSShow. I deleted the DSFile () global table because we cannot export such a table in a library. I replaced it with a dynamic allocation based on Malloc () and MRealloc (). I also modified the UDT DSFILEINFO by adding a new UDT (WAVEEXTRAINFO_STRUCT) allowing me to manage 8 duplicated buffers for each wave and thus to be able to play the same sample 8 times simultaneously in cluttering the memory. I also simplified the calling of the functions a lot.
But unfortunaly i dont know how to apply an effect like the WaveOut demo of JMM... ...maybe another day.
New version available, first post is updated with.
New function : DS_WaveFromDblArray(Hertz%, Channels%, BitsPerSample%, dCount%, ByRef d() As Double) As Long
Fill your double array with amplitude between -1 to 1, you can use value outside this range, but your sound will be simply saturated.
- Hertz can have value from _MinFrequency to _MaxFrequency (generally 100 to 200000) - Channel can be 1 (mono) or 2 (stereo) - BitPerSample can be 8 or 16, if incorrect value passe it's raised to 8 bits. - dCount : Number of sample to process, it can be 1 (no sense) to dim?(d()) max. - d() an array of double who store amplitude values.
The function return an index to DirectSound Structure. You can play it like wave created with DS_LoadWave or DS_DuplicateWave, example :