<commit_before>{-# OPTIONS_GHC -Wall #-}

module Main where


import qualified Control.Concurrent as C
import qualified Control.Monad as M
import qualified Data.Vector.Storable.Mutable as V
import qualified Graphics.UI.SDL as SDL
--import qualified Graphics.UI.SDL.Audio as A
import qualified SDL.Audio as A


audioCb :: A.AudioFormat sampleType -> V.IOVector sampleType -> IO ()
audioCb _ _ = print "foo"

spec :: A.OpenDeviceSpec
spec = A.OpenDeviceSpec {A.openDeviceFreq = A.Mandate 48000
                        ,A.openDeviceFormat = A.Mandate A.Unsigned16BitNativeAudio
                        ,A.openDeviceChannels = A.Mandate A.Mono
                        ,A.openDeviceSamples = 4096
                        ,A.openDeviceCallback = audioCb
                        ,A.openDeviceUsage = A.ForCapture
                        ,A.openDeviceName = Nothing}

main :: IO ()
main = do
  SDL.init[ SDL.InitAudio ]  -- do we need this?
  (dev, _) <- A.openAudioDevice spec
  A.setAudioDevicePlaybackState dev A.Play
  _ <- M.forever (C.threadDelay maxBound)
  return ()


-- apg-get install libghc-sdl-*
-- cabal install sdl2
<commit_msg>Cleaned up sdl initialization and now 'audioCb' is being called.<commit_after>{-# OPTIONS_GHC -Wall #-}


-- This module uses cabal package 'sdl2',
-- instead of the legacy sdl1(Graphics.UI.SDL) bindings.


module Main where


import qualified Control.Concurrent as C
import qualified Control.Monad as M
import qualified Data.Vector.Storable.Mutable as V

import qualified SDL
import qualified SDL.Audio as A


audioCb :: A.AudioFormat f -> V.IOVector f -> IO ()
audioCb _ _ = print "foo"

spec :: A.OpenDeviceSpec
spec = A.OpenDeviceSpec {A.openDeviceFreq = A.Mandate 48000
                        ,A.openDeviceFormat = A.Mandate A.Unsigned16BitNativeAudio
                        ,A.openDeviceChannels = A.Mandate A.Mono
                        ,A.openDeviceSamples = 4096
                        ,A.openDeviceCallback = audioCb
                        ,A.openDeviceUsage = A.ForCapture
                        ,A.openDeviceName = Nothing}

main :: IO ()
main = do
  SDL.initialize [SDL.InitAudio]
  (dev, _) <- A.openAudioDevice spec
  A.setAudioDevicePlaybackState dev A.Play
  _ <- M.forever (C.threadDelay maxBound)
  return ()

{'fraction_non_alphanumeric': 0.09122961657117673, 'fraction_numerical': 0.011018069634200088, 'mean_word_length': 2.3779761904761907, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1139591', 'n_tokens_mistral': 740, 'n_tokens_neox': 679, 'n_words': 188}