You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I execute the code without Goncurses, it runs successfully. However, when I run it with Goncurses, it encounters issues. Here are some relevant log entries:
And again here is the file:
package main
import (
"io""log""os""time""github.com/hajimehoshi/go-mp3""github.com/hajimehoshi/oto""github.com/rthornton128/goncurses"
)
funcplayAudio(filestring) {
f, err:=os.Open(file)
iferr!=nil {
log.Printf("Error opening audio file: %v", err)
return
}
deferf.Close()
d, err:=mp3.NewDecoder(f)
iferr!=nil {
log.Printf("Error creating MP3 decoder: %v", err)
return
}
c, err:=oto.NewContext(d.SampleRate(), 2, 2, 8192)
iferr!=nil {
log.Printf("Error creating audio context: %v", err)
return
}
deferc.Close()
p:=c.NewPlayer()
deferp.Close()
if_, err:=p.Write([]byte{0}); err!=nil {
log.Printf("Error playing audio: %v", err)
return
}
_, err=f.Seek(0, 0) // Rewind the audio fileiferr!=nil {
log.Printf("Error rewinding audio: %v", err)
return
}
if_, err:=io.Copy(p, d); err!=nil {
log.Printf("Error playing audio: %v", err)
return
}
}
funcmain() {
stdscr, err:=goncurses.Init()
iferr!=nil {
log.Fatal(err)
}
defergoncurses.End()
goncurses.Cursor(0) // Hide the cursor// Set up colors (if supported)ifgoncurses.HasColors() {
goncurses.StartColor()
goncurses.InitPair(1, goncurses.C_CYAN, goncurses.C_BLACK)
}
stdscr.Clear()
stdscr.Print("Welcome to GoNCurses!\n")
stdscr.Refresh()
// Create a new windowwin, err:=goncurses.NewWindow(10, 40, 2, 2)
iferr!=nil {
log.Fatal(err)
}
deferwin.Delete()
win.Box(0, 0)
win.MovePrint(1, 1, "This is a GoNCurses window")
win.Refresh()
// Start playing audio in a GoroutinegoplayAudio("../../audio/Enter.mp3")
// Wait for a few seconds to play audio before accepting user inputtime.Sleep(5*time.Second)
// Wait for a keypressstdscr.Print("Press any key to exit...")
stdscr.Refresh()
stdscr.GetChar()
}
I have put the actual working Enter.mp3 and I have provided you with the logs.
The text was updated successfully, but these errors were encountered:
When I execute the code without Goncurses, it runs successfully. However, when I run it with Goncurses, it encounters issues. Here are some relevant log entries:
![image](https://private-user-images.githubusercontent.com/96101844/275316436-238f2d55-0f9f-4fbb-853b-a1b700b4776f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNzU5ODQsIm5iZiI6MTczOTM3NTY4NCwicGF0aCI6Ii85NjEwMTg0NC8yNzUzMTY0MzYtMjM4ZjJkNTUtMGY5Zi00ZmJiLTg1M2ItYTFiNzAwYjQ3NzZmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE1NTQ0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdmNWZlZjdiNWYxMWRkOWZmYTM0MWNhMzk0OWNmNzkyZTA2MzBkZjdkODA4ZjdmODAwNzM0OWQwN2QzZjQyMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.0t4HgWrQpzCkm0ST0njiFXF-f3itOoPQrU-kDF85DiE)
And again here is the file:
I have put the actual working Enter.mp3 and I have provided you with the logs.
The text was updated successfully, but these errors were encountered: