{"action":"closed","issue":{"url":"https://api.github.com/repos/naudio/NAudio/issues/86","repository_url":"https://api.github.com/repos/naudio/NAudio","labels_url":"https://api.github.com/repos/naudio/NAudio/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/naudio/NAudio/issues/86/comments","events_url":"https://api.github.com/repos/naudio/NAudio/issues/86/events","html_url":"https://github.com/naudio/NAudio/issues/86","id":150432121,"number":86,"title":"Add meter on audio decoding in shoutcast streaming sample","user":{"login":"fabcal24","id":16600519,"avatar_url":"https://avatars.githubusercontent.com/u/16600519?v=3","gravatar_id":"","url":"https://api.github.com/users/fabcal24","html_url":"https://github.com/fabcal24","followers_url":"https://api.github.com/users/fabcal24/followers","following_url":"https://api.github.com/users/fabcal24/following{/other_user}","gists_url":"https://api.github.com/users/fabcal24/gists{/gist_id}","starred_url":"https://api.github.com/users/fabcal24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabcal24/subscriptions","organizations_url":"https://api.github.com/users/fabcal24/orgs","repos_url":"https://api.github.com/users/fabcal24/repos","events_url":"https://api.github.com/users/fabcal24/events{/privacy}","received_events_url":"https://api.github.com/users/fabcal24/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-04-22T17:50:53Z","updated_at":"2016-09-20T19:50:40Z","closed_at":"2016-09-20T19:50:40Z","body":"I suggest this modifications in audiostreamer sample shoutcast:\r\n\r\n//add a new declaration\r\n     private MeteringSampleProvider vuMeter = null;\r\n     public double LevelLeftValue = 0;\r\n     public double LevelRightValue = 0;\r\n\r\n//In timer event add this rows\r\n                    vuMeter = new MeteringSampleProvider(volumeProvider.ToSampleProvider());\r\n                    waveOut.Init(new SampleToWaveProvider(vuMeter));\r\n                    vuMeter.StreamVolume += Meter_StreamVolume;   \r\n\r\n//Add this method\r\n\r\n private void Meter_StreamVolume(Object sender,StreamVolumeEventArgs e)\r\n        {\r\n              try\r\n              {\r\n                  \r\n                  LevelLeftValue = (Math.Truncate(e.MaxSampleValues[0] * 150));\r\n                  LevelRightValue =(Math.Truncate(e.MaxSampleValues[1] * 150));\r\n               \r\n              }\r\n                catch\r\n              {\r\n                  LevelLeftValue = 0;\r\n                  LevelRightValue = 0;\r\n                }\r\n        \r\n        \r\n        }\r\n\r\n//Change stop method with this:\r\n\r\n public void Stop()\r\n        {\r\n            if (playbackState != StreamingPlaybackState.Stopped)\r\n            {\r\n                if (!fullyDownloaded)\r\n                {\r\n                    webRequest.Abort();\r\n                }\r\n                \r\n                playbackState = StreamingPlaybackState.Stopped;\r\n                if (waveOut != null)\r\n                { \r\n                    waveOut.Stop();\r\n                    waveOut.Dispose();\r\n                    waveOut = null;\r\n                    vuMeter.StreamVolume -= Meter_StreamVolume;\r\n                    vuMeter = null;\r\n                }\r\n                timer1.Enabled = false;\r\n                LevelLeftValue = 0;\r\n                LevelRightValue = 0;\r\n                // n.b. streaming thread may not yet have exited\r\n                Thread.Sleep(500);\r\n                ShowBufferState(0);\r\n             \r\n            }\r\n        }\r\n\r\nThanks :-)\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"markheath"}}