func_audio_createaudiosample.rst 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. .. _func_audio_createaudiosample:
  2. =================
  3. CreateAudioSample
  4. =================
  5. CreateAudioSample -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. CreateAudioSample:TAudioSample( length,hertz,format )
  10. Create an audio sample
  11. @length is the number of samples to allocate for the sample. @hertz is the frequency in samples per second (hz)
  12. the audio sample will be played. @format should be one of:
  13. [ @Format | @Description
  14. * &SF_MONO8 | Mono unsigned 8 bit
  15. * &SF_MONO16LE | Mono signed 16 bit little endian
  16. * &SF_MONO16BE | Mono signed 16 bit big endian
  17. * &SF_STEREO8 | Stereo unsigned 8 bit
  18. * &SF_STEREO16LE | Stereo signed 16 bit little endian
  19. * &SF_STEREO16BE | Stereo signed 16 bit big endian
  20. ]
  21. Parameters
  22. ==========
  23. Return Values
  24. =============
  25. An audio sample object
  26. Examples
  27. ========
  28. .. code-block:: blitzmax
  29. ' createaudiosample.bmx
  30. Local sample:TAudioSample=CreateAudioSample( 32,11025,SF_MONO8 )
  31. For Local k=0 Until 32
  32. sample.samples[k]=Sin(k*360/32)*127.5+127.5
  33. Next
  34. Local sound:TSound=LoadSound( sample,True )
  35. PlaySound(sound)
  36. Input
  37. See Also
  38. ========