func CreateAudioChannel(bitrate uint, hidden bool, audioFormat string, channelType uint8) (uuid.UUID, bool) {
	var channel AudioChannel
	var channelStatus AudioChannelStatus = AudioChannelStatus{}

	// https://pkg.go.dev/github.com/google/uuid#NewRandom
	// Documentation recommends using uuid.New(), but it calls the panic
	// if the UUID generation failed. I prefer any error to not be fatal
	// and just return the error if anything happens.
	ID, err := uuid.NewRandom()
	if HandleError(err, false) {
		log.Println("Could not generate UUID on audio channel creation.")
		return [16]byte{}, false
	}

	log.Println("Generated UUID for channel: " + ID.String())

	// Sleep duration in nanoseconds between bursts of 4096 bytes.
	var sleepInterval uint = (uint(time.Second) / (bitrate / 32))

	channel = AudioChannel{
		ID:                   ID,
		temporaryInputBuffer: make([]byte, 4096),
		mainBuffer:           make([]byte, 4096*25),
		audioFormat:          audioFormat,
		bitrate:              bitrate,
		bitrateInterval:      time.Duration(sleepInterval),
		hidden:               hidden,
		channelType:          channelType,
		status:               channelStatus,
	}
	ActiveChannels[ID.String()] = &channel

	// TODO: start goroutine

	return ID, true
}
// CreateAudioChannel initializes the channel, appends it to the ActiveChannels
// map and either starts listening for streaming clients or starts broadcasting
// audio files, then returns the UUID of the channel and if the channel creation
// succeded.
CreateAudioChannel initializes the channel, appends it to the ActiveChannels
map and either starts listening for streaming clients or starts broadcasting
audio files, then returns the UUID of the channel and if the channel creation
succeded.
// CreateAudioChannel initializes the channel appends it to the ActiveChannels // map and either starts listening for streaming clients or starts broadcasting // audio files then returns the UUID of the channel and if the channel creation // succeded .
func CreateAudioChannel(bitrate uint, hidden bool, audioFormat string, channelType uint8) (uuid.UUID, bool) {
	var channel AudioChannel
	var channelStatus AudioChannelStatus = AudioChannelStatus{}
	ID, err := uuid.NewRandom()
	if HandleError(err, false) {
		log.Println("Could not generate UUID on audio channel creation.")
		return [16]byte{}, false
	}
	log.Println("Generated UUID for channel: " + ID.String())
	var sleepInterval uint = (uint(time.Second) / (bitrate / 32))
	channel = AudioChannel{
		ID:                   ID,
		temporaryInputBuffer: make([]byte, 4096),
		mainBuffer:           make([]byte, 4096*25),
		audioFormat:          audioFormat,
		bitrate:              bitrate,
		bitrateInterval:      time.Duration(sleepInterval),
		hidden:               hidden,
		channelType:          channelType,
		status:               channelStatus,
	}
	ActiveChannels[ID.String()] = &channel
	return ID, true
}
func CreateAudioChannel ( bitrate uint , hidden bool , audioFormat string , channelType uint8 ) ( uuid . UUID , bool ) { var channel AudioChannel var channelStatus AudioChannelStatus = AudioChannelStatus { } ID , err := uuid . NewRandom ( ) if HandleError ( err , false ) { log . Println ( " " ) return [ 16 ] byte { } , false } log . Println ( " " + ID . String ( ) ) var sleepInterval uint = ( uint ( time . Second ) / ( bitrate / 32 ) ) channel = AudioChannel { ID : ID , temporaryInputBuffer : make ( [ ] byte , 4096 ) , mainBuffer : make ( [ ] byte , 4096 * 25 ) , audioFormat : audioFormat , bitrate : bitrate , bitrateInterval : time . Duration ( sleepInterval ) , hidden : hidden , channelType : channelType , status : channelStatus , } ActiveChannels [ ID . String ( ) ] = & channel return ID , true }
CreateAudioChannel initializes the channel, appends it to the ActiveChannels
map and either starts listening for streaming clients or starts broadcasting
audio files, then returns the UUID of the channel and if the channel creation
succeded.
CreateAudioChannel initializes the channel appends it to the ActiveChannels map and either starts listening for streaming clients or starts broadcasting audio files then returns the UUID of the channel and if the channel creation succeded .
// https://pkg.go.dev/github.com/google/uuid#NewRandom // Documentation recommends using uuid.New(), but it calls the panic // if the UUID generation failed. I prefer any error to not be fatal // and just return the error if anything happens. // Sleep duration in nanoseconds between bursts of 4096 bytes. // TODO: start goroutine