Skip to content

clemos/hx-kcs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

A Kansas-City standard decoder written in Haxe

Ported from py-kcs

Features

  • Target agnostic (tested mostly with Flash, but should work on any target)
  • UTF-8 support
  • No unit tests ;)

Usage

import kcs.Decoder;
import flash.media.Microphone;
import flash.events.SampleDataEvent;

class Test {
  static function main(){
    var mic = Microphone.get();
    var kcs = new Decoder();
    
    mic.addEventListener( SampleEventData.SAMPLE_EVENT , readMic );
  }
  
  static function readMic( e : SampleEventData ){
    var output : BytesData = kcs.decode( e.data );
    var str : String = output.toString();
    trace(str);
  }
}

Notes

The decoder keeps data that couldn't be decoded after every decode() call (incomplete bytes, unterminated UTF-8 characters, etc). You can flush these remaining data using the decoder's init() method.

See also

About

A Kansas-City standard decoder written in Haxe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages