Results 1 to 2 of 2

Thread: Freebasic's "Out" function doesn't work as expected

  1. #1

    Post Freebasic's "Out" function doesn't work as expected

    Trying the example provided on the "Out"-keyword page of FreeBasic Manual, I noticed that there's no sound output. Explication is in the help file : Using true port access in the Windows version requires the program to install a device driver for the present session. The driver is only 3K in size and is embedded in the executable Obviously, the driver isn't embedded when the code is compiled to a *.dll

    Sub Sound(ByVal freq As UInteger, dur As UInteger)
      Dim t As Double,f1 As Unsigned Short
        f1 = 1193181 \ freq
        Out &h61,Inp(&h61) Or 3
        Out &h43,&hb6
        Out &h42,LoByte(f1)
        Out &h42,HiByte(f1)
        While ((Timer - t) * 1000) < dur
          Sleep 0,1
        Out &h61,Inp(&h61) And &hfc
    End Sub
    Sound(523, 60)  'C5
    Sound(587, 60)  'D5
    Sound(659, 60)  'E5
    Sound(698, 60)  'F5
    Sound(784, 60)  'G5
    Sound(880, 60)  'A5
    Sound(988, 60)  'B5
    Sound(1046, 60) 'C6
    To output a sound programmatically ( frequency , duration ) with thinBasic, this works. However, unlike old qbasic dialect, it makes a 'pause' between each instruction: no ramp (slope) is possible.
    Last edited by DirectuX; 03-11-2019 at 23:24.
    ThinBasic ALPHA - Windows 8.1 x64

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Brno - Czech Republic
    Rep Power
    Good catch with the DLL!

    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. "Locate" Function For Delimited Strings
    By gungadout in forum thinBasic General
    Replies: 3
    Last Post: 12-10-2010, 12:24

Members who have read this thread: 1

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts