GithubHelp home page GithubHelp logo

gobass's Introduction

Go Bindings for Un4Seen BASS

Go bindings for Un4Seen BASS Audio Library

Forked from http://github.com/lexesv/gobass.dll and https://github.com/Keithcat1/gobass

Install

$ go get github.com/pteich/gobass

Usage

Example 1

if ok, err := bass.Init(-1, 44100, 0); ok {
	fmt.Println("bass init")
} else {
	panic(err)
}
c, err := bass.StreamCreateURL("http://music.myradio.ua:8000/PopRock_news128.mp3")
if err == nil {
	fmt.Println(bass.ChannelPlay(c))
} else {
	panic(err)
}
bass.SetVol(50)
bass.ChannelSetVolume(c, 40.5)

Example 2

plugin, err := bass.PluginLoad("libbass_aac.so")
if err != nil {
	fmt.Println(err)
} else {
	defer bass.PluginFree(plugin)
}

cfg := bass.PlayerConf{
	Device: -1,
	Freq:   44100,
	Flags:  0,
	Volume: 50.5,
	Source: "http://online-hitfm.tavrmedia.ua/HitFM_Live", 
	// or Source: "file.mp3",
}

// or
cfg = bass.PlayerConf{}
cfg.Source = "http://music.myradio.ua:8000/main_stream_rock_news128.mp3"

player, err := bass.NewPlayer(cfg)
if err != nil {
	panic(err)
} 

fmt.Println(player.Play())
fmt.Println("Volume:", player.GetVol())
time.Sleep(time.Second * 1)
player.SetVol(55)
fmt.Println("Volume:", player.GetVol())

r := regexp.MustCompile(`(?isU)StreamTitle='(.*)';`)
for {
	m := r.FindStringSubmatch(bass.ChannelGetTags(player.Channel, bass.BASS_TAG_META))
	if len(m) > 0 {
		fmt.Printf("\r%s", m[1])
	}
	time.Sleep(time.Second * 3)
}

gobass's People

Contributors

keithcat1 avatar lexesv avatar pteich avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.