Kvak!

Author
panup
Max Output Level: -50 dBFS
  • Total Posts : 2538
  • Joined: 2006/05/23 09:34:35
  • Status: offline
2013/02/19 01:10:13 (permalink)

Kvak!

I'm currently developing a new toy to control SONAR. It's called Kvak (=Quack in English).
Kvak is a programming language. Duckbar, my utility for SONAR, has built-in virtual machine to run Kvak programs.
 
Kvak is loosely based on C syntax but it also borrows idas from PHP and it has exhibits the following characteristics:
  • Variable and function names are case insensitive. For example Result = MsgBox(); is equivalent to result=msgbox();
  • Function return values can be ignored when not needed.
  • Limited Win32 API library support including SendMessage and SendKeys functions.
  • Inline support for Cakewalk CAL scripts. Data types

  • int
  • long
  • single
  • double
  • bool
  • string
  • [more coming soon] The virtual machine attempts to ensure type correctness of expressions.

    Memory management
    All memory management is automatic.  
     
    Example:
     
    // My first Kvak program
    MsgBox("Hello, world");
     
    Example 2:
    // Call TrackPresidentReadTracks() to refresh track data from SONAR to Duckbar
    TrackPresidentReadTracks();

    // Get track count
    int count;
    count = TrackCount();

    say("Number of tracks:");
    say(count);

    // List tracks
    int        i;
    string    name;
    count--;

    do {
        name = TrackName(i);
        say(name);
        i++;
    } loop until i==count;
     
     
    Kvak supports inline CAL scripts.
     
    /*  Inline CAL
         Example       */
    l
    <CAL>
     ; inline CAL script
    ; saves current file as C.\CAL-SAVE.CWP
    (FileSaveAs "C:\CAL-SAVE.CWP")
    </CAL>
     
     
    Functions
    There are basic arithmetics, string handling, general file i/o, user input/output, program structure etc. features but they are there only to serve the special Duckbar & SONAR functions. Kvak will get a large set of tools to access even hundreds of Duckbar and SONAR settings.  Kvak programs can be triggered from floating toolbar buttons or they can be ran in the same way as CAL scripts (inside Duckbar). 
     
    Built in functions include:
     
    // File I/O
    string    ReadTextFile(string Filename)
    bool    WriteTextFile(string Filename)
    string    GetTempFilename()
    bool    FileInUse(string Filename)
    bool    FileExists(string Filename)
    bool    DirectoryExists(string Filename)
    long    FolderSize(string Foldername)
    string    GetParentPath(string Filename)
    bool    CopyFile(string sourceFilename, string destinationFilename, bool Overwrite)

    // Environment
    string    GetComputerName()
    string    GetUserName()
    string    GetEnvironmentVariable(string Variable)
    bool    Is64BitOperatingSystem()

    // Keyboard and Mouse
    bool    AltKeyDown()
    bool    CtrlKeyDown()
    bool    ShiftKeyDown()
    bool    CapsLockKeyDown()
    bool    NumLockKeyDown()
    bool    ScrollLockKeyDown()
    bool    MouseWheelExists()

    // Kvak Registry
    bool    SaveSetting(string Name, string Value)
    string    ReadSetting(string Name)


    // INI files
    bool    WriteINI(string Filename, string Section, string Key, string Value)
    string    ReadINI(string Filename, string Section, string Key)
     
    // Win32 API
    bool    ValidHandle(long hWnd)
    bool    SetVisible(string SonarObject, bool Visible)
    bool    SetWindowText(string SonarObject, string Title)
    void    Sleep(int MilliSeconds)
    long    GetTickCount()
    void    SendMessage(string SonarObject, string Msg, string Code)
    void    PostMessage(string SonarObject, string Msg, string Code)
    void    SendKeys(string SonarObject, string Keys)
    void    SetFocus(string SonarObject)
     
    // CAL
    bool    InitCAL()
    bool    WriteCAL(string    CALScript)
    bool    ExecuteCal()
    bool    InlineCAL(string CALCommand)

    // CAL based
    bool    RenameTrack(int TrackNumber, string TrackName)
    bool    SetCurrentTrack(int TrackNumber)

    // Duckbar
    void    Toolbar(bool Show)
    void    TrackPresident(bool Show)
    void    DuckbarStatusBar(bool Show)
    void    ClearRecentSONARFiles()
    bool    ToggleAudioEngine()
    bool    GotoMarker(int MarkerIndex)
    void    KillBitBridges()
    void    ClearPictureCache(int Days)
    Coming functions to apply mods, EXE colors, runtime Colors, normal colors, extract resources from DLL files, manipulate image color tones in batches etc.
     
    // Track President
    void TrackPresidentReadTracks()
    bool    BatchFreeze();
    bool    BatchUnfreeze();
    bool    CollapseAllTrackLanes()
    bool    ExpandAllTrackLanes()
    bool    CollapseAllAutomationLanes()
    bool    ExpandAllAutomationLanes()
    int TrackCount()
    string TrackName(int TrackNumber)
    bool IsSelected((int TrackNumber)
    bool IsVisible(int TrackNumber)
    bool IsMuted(int TrackNumber)
    bool IsSoloed(int TrackNumber)
    bool IsArmed(int TrackNumber)
    bool IsArchived(int TrackNumber)
     
     
    // Console View
    bool ToggleStrip(string Target)    // show/hide Tracks pane, Bus pane, Main Outs
    bool ToggleProChannel()            // toggle selected tracks' ProChannel strips
    bool InsertConsoleViewMenuItem()    // insert custom menuitem
    More functions (100+) coming in the next weeks.
     
    Program control:
     
    - for(<initializer>;<condition>;<counter) { }
    - do ... loop
    - do while ... loop
    - do until ... loop
    - do ... loop while
    - do ... loop until
     
    - C style switch-case
    - C style if (..) { .. } else { ... }
     
    Kvak will be integral part of future Duckbar versions.  I don't know if anyone else is interested but for me creating a programming language fully on my own has been the most demanding task I have ever done but also fun - almost as fun as makin music :-). 
     
    -Panu
     
  • #1

    1 Reply Related Threads

      shawn@trustmedia.tv
      Max Output Level: -54 dBFS
      • Total Posts : 2136
      • Joined: 2008/12/06 09:41:18
      • Location: Hastings, MN
      • Status: offline
      Re:Kvak! 2013/02/19 04:27:33 (permalink)
      nice! Have fun! - Shawn

      Studio SONAR X3. Axiom 25 midi controller, DUNE 2, Producer Content, Good Times, Bandlab Mojo

      #2
      Jump to:
      © 2025 APG vNext Commercial Version 5.1