<commit_before>package plugin

import (
	"github.com/layeh/gopus"
	"github.com/layeh/gumble/gumble"
	"github.com/robertkrimen/otto"
)

func (in *Instance) apiAudioPlay(call otto.FunctionCall) otto.Value {
	if in.audio.IsPlaying() {
		return otto.FalseValue()
	}
	obj := call.Argument(0).Object()
	if obj == nil {
		return otto.FalseValue()
	}

	filenameValue, _ := obj.Get("filename")
	callbackValue, _ := obj.Get("callback")

	if callbackValue.IsFunction() {
		in.audio.Done = func() {
			in.audio.Done = nil
			in.callValue(callbackValue)
		}
	}

	if enc := in.client.AudioEncoder(); enc != nil {
		enc.SetApplication(gopus.Audio)
	}

	in.audio.Play(filenameValue.String())
	return otto.TrueValue()
}<commit_msg>change according to gumble_ffmpeg's API<commit_after>package plugin

import (
	"github.com/layeh/gopus"
	"github.com/layeh/gumble/gumble"
	"github.com/robertkrimen/otto"
)

func (in *Instance) apiAudioPlay(call otto.FunctionCall) otto.Value {
	if in.audio.IsPlaying() {
		return otto.FalseValue()
	}
	obj := call.Argument(0).Object()
	if obj == nil {
		return otto.FalseValue()
	}

	filenameValue, _ := obj.Get("filename")
	callbackValue, _ := obj.Get("callback")

	if enc := in.client.AudioEncoder(); enc != nil {
		enc.SetApplication(gopus.Audio)
	}

	in.audio.Play(filenameValue.String(), func() {
		if callbackValue.IsFunction() {
			in.callValue(callbackValue)
		}
	})
	return otto.TrueValue()
}
{'fraction_non_alphanumeric': 0.157001414427157, 'fraction_numerical': 0.0014144271570014145, 'mean_word_length': 4.299625468164794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7029588', 'n_tokens_mistral': 542, 'n_tokens_neox': 522, 'n_words': 87}