<commit_before>package audio

/*
#ifdef _GOSMF_OSX_
  #include <CoreFoundation/CoreFoundation.h>
#endif

#include <OpenAL/al.h>
#include <OpenAL/alc.h>


ALuint genBuffer() {
  ALuint sound;

  alGenBuffers(1, &sound);
  return sound;
}

*/
import "C"
import "unsafe"

func Init() {
	initDevice()
}

func Cleanup() {
	destroyDevice()
}

type Sound struct {
	channels  uint16
	frequency uint32
	size      uint32
	data      []byte
	buffer    C.ALuint
}

func (w *Sound) attachSoundData() {
	w.buffer = C.genBuffer()
	C.alBufferData(w.buffer, C.AL_FORMAT_STEREO16, unsafe.Pointer(&w.data[0]), C.ALsizei(w.size), C.ALsizei(w.frequency))
}

func (w *Sound) Play() {
	var source C.ALuint
	C.alGenSources(1, &source)

	C.alSourcei(source, C.AL_BUFFER, C.ALint(w.buffer))
	C.alSourcePlay(source)
}<commit_msg>some more audio cleanup<commit_after>package audio

/*
#ifdef _GOSMF_OSX_
  #include <CoreFoundation/CoreFoundation.h>
#endif

#include <OpenAL/al.h>
#include <OpenAL/alc.h>

*/
import "C"
import "unsafe"

func Init() {
	initDevice()
}

func Cleanup() {
	destroyDevice()
}

type Sound struct {
	channels  uint16
	frequency uint32
	size      uint32
	data      []byte
	buffer    C.ALuint
}

func (s *Sound) attachSoundData() {
	C.alGenBuffers(1, &s.buffer)
	C.alBufferData(s.buffer, C.AL_FORMAT_STEREO16, unsafe.Pointer(&s.data[0]), C.ALsizei(s.size), C.ALsizei(s.frequency))
}

func (s *Sound) Play() {
	var source C.ALuint
	C.alGenSources(1, &source)

	C.alSourcei(source, C.AL_BUFFER, C.ALint(s.buffer))
	C.alSourcePlay(source)
}
{'fraction_non_alphanumeric': 0.14761593729588504, 'fraction_numerical': 0.014369693011103853, 'mean_word_length': 4.2465753424657535, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3339836', 'n_tokens_mistral': 636, 'n_tokens_neox': 620, 'n_words': 127}