Skip to content

Commit

Permalink
ref - Cleaned up some code
Browse files Browse the repository at this point in the history
  • Loading branch information
AptiviCEO committed Sep 18, 2023
1 parent 60c9b3f commit 1f51bbe
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 34 deletions.
1 change: 0 additions & 1 deletion BassBoom.Basolia/Format/AudioInfoTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
using System.Diagnostics;
using BassBoom.Native.Interop.LowLevel;
using System.Runtime.InteropServices;
using System.Text;
using System.Collections.Generic;
using System.Linq;

Expand Down
5 changes: 0 additions & 5 deletions BassBoom.Basolia/Format/Cache/CachedSongInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using BassBoom.Basolia.Lyrics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BassBoom.Basolia.Format.Cache
{
Expand Down
4 changes: 0 additions & 4 deletions BassBoom.Basolia/Playback/PlaybackPositioningTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
using BassBoom.Native.Interop.Output;
using BassBoom.Native.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace BassBoom.Basolia.Playback
Expand Down
13 changes: 5 additions & 8 deletions BassBoom.Basolia/Playback/PlaybackTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
using BassBoom.Native.Interop.Init;
using BassBoom.Native.Interop.Output;
using BassBoom.Native.Interop.Play;
using BassBoom.Native.Interop.LowLevel;
using BassBoom.Native.Runtime;
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using BassBoom.Basolia.Devices;
using System.Runtime.InteropServices;
using System.Reflection.Metadata;

namespace BassBoom.Basolia.Playback
{
Expand Down Expand Up @@ -69,24 +67,24 @@ public static void Play()
var outHandle = Mpg123Instance._out123Handle;

// First, get formats and reset them
var formatInfo = FormatTools.GetFormatInfo();
var (rate, channels, encoding) = FormatTools.GetFormatInfo();
int resetStatus = NativeOutput.mpg123_format_none(handle);
if (resetStatus != (int)mpg123_errors.MPG123_OK)
throw new BasoliaException($"Can't reset output encoding", (mpg123_errors)resetStatus);

// Set the format
int formatStatus = NativeOutput.mpg123_format(handle, formatInfo.rate, formatInfo.channels, formatInfo.encoding);
int formatStatus = NativeOutput.mpg123_format(handle, rate, channels, encoding);
if (formatStatus != (int)mpg123_errors.MPG123_OK)
throw new BasoliaException($"Can't set output encoding", (mpg123_errors)formatStatus);
Debug.WriteLine($"Format {formatInfo.rate}, {formatInfo.channels}, {formatInfo.encoding}");
Debug.WriteLine($"Format {rate}, {channels}, {encoding}");

// Try to open output to device
int openStatus = NativeOutputLib.out123_open(outHandle, DeviceTools.activeDriver, DeviceTools.activeDevice);
if (openStatus != (int)out123_error.OUT123_OK)
throw new BasoliaOutException($"Can't open output to device {DeviceTools.activeDevice} on driver {DeviceTools.activeDriver}", (out123_error)openStatus);

// Start the output
int startStatus = NativeOutputLib.out123_start(outHandle, formatInfo.rate, formatInfo.channels, formatInfo.encoding);
int startStatus = NativeOutputLib.out123_start(outHandle, rate, channels, encoding);
if (startStatus != (int)out123_error.OUT123_OK)
throw new BasoliaOutException($"Can't start the output.", (out123_error)startStatus);

Expand All @@ -97,7 +95,6 @@ public static void Play()
state = PlaybackState.Playing;
do
{
int played;
int num = 0;
int audioBytes = 0;
byte[] audio = null;
Expand All @@ -109,7 +106,7 @@ public static void Play()
// Now, play the MPEG buffer to the device
bufferPlaying = true;
err = DecodeTools.DecodeFrame(ref num, ref audio, ref audioBytes);
played = PlayBuffer(audio);
PlayBuffer(audio);
bufferPlaying = false;
} while (err == (int)mpg123_errors.MPG123_OK && Playing);
if (Playing)
Expand Down
1 change: 0 additions & 1 deletion BassBoom.Native/Interop/Analysis/NativeStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using System;
using System.Runtime.InteropServices;
using BassBoom.Native.Interop.Init;

Expand Down
1 change: 0 additions & 1 deletion BassBoom.Native/Interop/Play/NativeVolume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using System;
using System.Runtime.InteropServices;
using BassBoom.Native.Interop.Init;

Expand Down
13 changes: 0 additions & 13 deletions BassBoom/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,10 @@
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Controls.Primitives;
using Avalonia.Platform.Storage;
using Avalonia.Threading;
using BassBoom.Basolia;
using BassBoom.Basolia.File;
using BassBoom.Basolia.Format;
using BassBoom.Basolia.Lyrics;
using BassBoom.Basolia.Playback;
using BassBoom.ViewModels;
using MsBox.Avalonia;
using MsBox.Avalonia.Enums;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace BassBoom.Views;

Expand Down
1 change: 0 additions & 1 deletion BassBoom/Views/SelectionWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using Avalonia.Controls;
using System.Collections.ObjectModel;

namespace BassBoom.Views
{
Expand Down

0 comments on commit 1f51bbe

Please sign in to comment.